diff options
-rw-r--r-- | sys/arch/macppc/macppc/ofw_machdep.c | 16 | ||||
-rw-r--r-- | sys/arch/macppc/pci/vgafb.c | 8 | ||||
-rw-r--r-- | sys/arch/macppc/pci/vgafb_pci.c | 32 | ||||
-rw-r--r-- | sys/arch/macppc/pci/vgafb_pcivar.h | 2 | ||||
-rw-r--r-- | sys/arch/macppc/pci/vgafbvar.h | 1 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_kms.c | 12 |
6 files changed, 29 insertions, 42 deletions
diff --git a/sys/arch/macppc/macppc/ofw_machdep.c b/sys/arch/macppc/macppc/ofw_machdep.c index bd879bbd9a0..239befc771f 100644 --- a/sys/arch/macppc/macppc/ofw_machdep.c +++ b/sys/arch/macppc/macppc/ofw_machdep.c @@ -184,7 +184,6 @@ save_ofw_mapping() return 0; } -#include <dev/pci/pcivar.h> #include <arch/macppc/pci/vgafb_pcivar.h> struct ppc_bus_space ppc_membus; @@ -195,6 +194,7 @@ int cons_display_ofh; u_int32_t cons_addr; int cons_brightness; int cons_backlight_available; +int fbnode; #include "vgafb_pci.h" @@ -358,7 +358,6 @@ of_display_console() char name[32]; int len; int stdout_node; - int display_node; int err; stdout_node = OF_instance_to_package(OF_stdout); @@ -389,15 +388,15 @@ of_display_console() ofw_find_keyboard(); - display_node = stdout_node; + fbnode = stdout_node; len = OF_getprop(stdout_node, "assigned-addresses", addr, sizeof(addr)); if (len == -1) { - display_node = OF_parent(stdout_node); - len = OF_getprop(display_node, "name", name, 20); + fbnode = OF_parent(stdout_node); + len = OF_getprop(fbnode, "name", name, 20); name[len] = 0; printf("using parent %s:", name); - len = OF_getprop(display_node, "assigned-addresses", + len = OF_getprop(fbnode, "assigned-addresses", addr, sizeof(addr)); if (len < sizeof(addr[0])) { panic(": no address"); @@ -407,11 +406,6 @@ of_display_console() if (OF_getnodebyname(0, "backlight") != 0) cons_backlight_available = 1; - vgafb_pci_console_tag = PCITAG_CREATE(display_node, - OFW_PCI_PHYS_HI_BUS(addr[1].phys_hi), - OFW_PCI_PHYS_HI_DEVICE(addr[1].phys_hi), - OFW_PCI_PHYS_HI_FUNCTION(addr[1].phys_hi)); - #if 1 printf(": memaddr %x size %x, ", addr[0].phys_lo, addr[0].size_lo); printf(": consaddr %x, ", cons_addr); diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c index 91d3cb8bc74..b93d4559e18 100644 --- a/sys/arch/macppc/pci/vgafb.c +++ b/sys/arch/macppc/pci/vgafb.c @@ -298,6 +298,14 @@ vgafb_mmap(void *v, off_t off, int prot) } int +vgafb_is_console(int node) +{ + extern int fbnode; + + return (fbnode == node); +} + +int vgafb_cnattach(bus_space_tag_t iot, bus_space_tag_t memt, int type, int check) { struct vga_config *vc = &vgafbcn; diff --git a/sys/arch/macppc/pci/vgafb_pci.c b/sys/arch/macppc/pci/vgafb_pci.c index 3670bcf4692..0c6f2bb3605 100644 --- a/sys/arch/macppc/pci/vgafb_pci.c +++ b/sys/arch/macppc/pci/vgafb_pci.c @@ -62,7 +62,6 @@ const struct cfattach vgafb_pci_ca = { sizeof(struct vga_pci_softc), vgafb_pci_match, vgafb_pci_attach, }; -pcitag_t vgafb_pci_console_tag; struct vga_config vgafbcn; void @@ -140,6 +139,7 @@ int vgafb_pci_match(struct device *parent, void *match, void *aux) { struct pci_attach_args *pa = aux; + int node; if (DEVICE_IS_VGA_PCI(pa->pa_class) == 0) { /* @@ -151,23 +151,15 @@ vgafb_pci_match(struct device *parent, void *match, void *aux) return (0); } - /* If it's the console, we have a winner! */ - if (!bcmp(&pa->pa_tag, &vgafb_pci_console_tag, sizeof(pa->pa_tag))) { - return (1); - } - -#ifdef DEBUG_VGAFB - { - int i; - pci_chipset_tag_t pc = pa->pa_pc; - for (i = 0x10; i < 0x24; i+=4) { - printf("vgafb confread %x %x\n", - i, pci_conf_read(pc, pa->pa_tag, i)); - } - } -#endif + /* + * XXX Non-console devices do not get configured by the PROM, + * XXX so do not attach them yet. + */ + node = PCITAG_NODE(pa->pa_tag); + if (!vgafb_is_console(node)) + return (0); - return (0); + return (1); } void @@ -178,15 +170,17 @@ vgafb_pci_attach(struct device *parent, struct device *self, void *aux) struct vga_config *vc; u_int32_t memaddr, memsize; u_int32_t mmioaddr, mmiosize; - int console; + int console, node; pcireg_t reg; + node = PCITAG_NODE(pa->pa_tag); + vga_pci_bar_init(sc, pa); vgafb_pci_mem_init(sc, &memaddr, &memsize, &mmioaddr, &mmiosize); - console = (!bcmp(&pa->pa_tag, &vgafb_pci_console_tag, sizeof(pa->pa_tag))); + console = vgafb_is_console(node); if (console) { vc = sc->sc_vc = &vgafbcn; diff --git a/sys/arch/macppc/pci/vgafb_pcivar.h b/sys/arch/macppc/pci/vgafb_pcivar.h index b21b0fcaa46..5c3b48eb6bb 100644 --- a/sys/arch/macppc/pci/vgafb_pcivar.h +++ b/sys/arch/macppc/pci/vgafb_pcivar.h @@ -28,7 +28,5 @@ * rights to redistribute these changes. */ -extern pcitag_t vgafb_pci_console_tag; - /* XXX */ int vgafb_cnattach(bus_space_tag_t, bus_space_tag_t, int, int); diff --git a/sys/arch/macppc/pci/vgafbvar.h b/sys/arch/macppc/pci/vgafbvar.h index a49396cb977..8fd967c717f 100644 --- a/sys/arch/macppc/pci/vgafbvar.h +++ b/sys/arch/macppc/pci/vgafbvar.h @@ -53,6 +53,7 @@ struct vga_config { }; int vgafb_cnattach(bus_space_tag_t, bus_space_tag_t, int, int); +int vgafb_is_console(int); void vgafb_init(bus_space_tag_t, bus_space_tag_t, struct vga_config *, u_int32_t, size_t); diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c index d8eefdac7c4..86515ecbf60 100644 --- a/sys/dev/pci/drm/radeon/radeon_kms.c +++ b/sys/dev/pci/drm/radeon/radeon_kms.c @@ -40,10 +40,6 @@ extern int vga_console_attached; #endif -#ifdef __macppc__ -#include "vgafb_pci.h" -#endif - #define DRIVER_NAME "radeon" #define DRIVER_DESC "ATI Radeon" #define DRIVER_DATE "20080613" @@ -1558,7 +1554,7 @@ radeondrm_attach_kms(struct device *parent, struct device *self, void *aux) pcireg_t type; uint8_t iobar; -#ifdef __sparc64__ +#if defined(__sparc64__) || defined(__macppc__) extern int fbnode; #endif @@ -1571,13 +1567,9 @@ radeondrm_attach_kms(struct device *parent, struct device *self, void *aux) rdev->memt = pa->pa_memt; rdev->dmat = pa->pa_dmat; -#ifdef __sparc64__ +#if defined(__sparc64__) || defined(__macppc__) if (fbnode == PCITAG_NODE(rdev->pa_tag)) rdev->console = 1; -#elif NVGAFB_PCI > 0 - extern pcitag_t vgafb_pci_console_tag; - if (!bcmp(&rdev->pa_tag, &vgafb_pci_console_tag, sizeof(rdev->pa_tag))) - rdev->console = 1; #else if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY && PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA && |