diff --git a/sys/arch/alpha/alpha/autoconf.c b/sys/arch/alpha/alpha/autoconf.c index 674a4c74a840..ff4f45a1525d 100644 --- a/sys/arch/alpha/alpha/autoconf.c +++ b/sys/arch/alpha/alpha/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.52 2012/07/29 18:05:39 mlelstv Exp $ */ +/* $NetBSD: autoconf.c,v 1.53 2014/01/20 15:05:13 tsutsui Exp $ */ /* * Copyright (c) 1992, 1993 @@ -42,7 +42,9 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.52 2012/07/29 18:05:39 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.53 2014/01/20 15:05:13 tsutsui Exp $"); + +#include "pci.h" #include #include @@ -53,6 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.52 2012/07/29 18:05:39 mlelstv Exp $" #include #include +#include + #include #include #include @@ -172,6 +176,13 @@ atoi(const char *s) void device_register(device_t dev, void *aux) { +#if NPCI > 0 + device_t parent = device_parent(dev); + + if (parent != NULL && device_is_a(parent, "pci")) + device_pci_register(dev, aux); +#endif + if (bootdev_data == NULL) { /* * There is no hope. diff --git a/sys/arch/alpha/include/pci_machdep.h b/sys/arch/alpha/include/pci_machdep.h index 493385c0f54f..c40691e277f0 100644 --- a/sys/arch/alpha/include/pci_machdep.h +++ b/sys/arch/alpha/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.h,v 1.15 2012/02/06 02:14:13 matt Exp $ */ +/* $NetBSD: pci_machdep.h,v 1.16 2014/01/20 15:05:13 tsutsui Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -109,3 +109,4 @@ void pci_display_console(bus_space_tag_t, bus_space_tag_t, ((c)->pc_pciide_compat_intr_establish == NULL ? NULL : \ (*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p), \ (ch), (f), (a))) +void device_pci_register(device_t, void *); diff --git a/sys/arch/alpha/pci/pci_machdep.c b/sys/arch/alpha/pci/pci_machdep.c index 6568ec83e3cd..e01c82569721 100644 --- a/sys/arch/alpha/pci/pci_machdep.c +++ b/sys/arch/alpha/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.19 2012/02/06 02:14:15 matt Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.20 2014/01/20 15:05:14 tsutsui Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -33,7 +33,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.19 2012/02/06 02:14:15 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.20 2014/01/20 15:05:14 tsutsui Exp $"); #include #include @@ -59,6 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.19 2012/02/06 02:14:15 matt Exp $" #include #endif +#include + void pci_display_console(bus_space_tag_t iot, bus_space_tag_t memt, pci_chipset_tag_t pc, int bus, int device, int function) { @@ -101,3 +103,20 @@ pci_display_console(bus_space_tag_t iot, bus_space_tag_t memt, pci_chipset_tag_t panic("pci_display_console: unconfigured device at %d/%d/%d", bus, device, function); } + +void +device_pci_register(device_t dev, void *aux) +{ + struct pci_attach_args *pa = aux; + struct ctb *ctb; + prop_dictionary_t dict; + + /* set properties for PCI framebuffers */ + ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off); + if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY && + ctb->ctb_term_type == CTB_GRAPHICS) { + /* XXX should consider multiple displays? */ + dict = device_properties(dev); + prop_dictionary_set_bool(dict, "is_console", true); + } +}