From: jsg Date: Tue, 22 Jul 2014 04:42:51 +0000 (+0000) Subject: The aperture needed test should be in vgafb as well as vga@pci. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=db1a15332008fae09a4954aafd21198cf84f2474;p=openbsd The aperture needed test should be in vgafb as well as vga@pci. Problem noticed/fix tested by sebastia@ on macppc. sparc64 problems in earlier diff pointed out by deraadt@ 'looks good' kettenis@ 'commit' deraadt@ --- diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c index 5bc0abc0c3f..5bb859ea457 100644 --- a/sys/arch/macppc/pci/vgafb.c +++ b/sys/arch/macppc/pci/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.58 2013/10/21 10:36:16 miod Exp $ */ +/* $OpenBSD: vgafb.c,v 1.59 2014/07/22 04:42:51 jsg Exp $ */ /* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */ /* @@ -167,6 +167,9 @@ vgafb_attach(struct device *parent, struct device *self, void *aux) vgafb_burn(sc, WSDISPLAYIO_VIDEO_ON, 0); /* paranoia */ } + if (vga_aperture_needed(pa)) + printf("%s: aperture needed\n", sc->sc_dev.dv_xname); + config_found(self, &waa, wsemuldisplaydevprint); } diff --git a/sys/arch/sparc64/dev/vgafb.c b/sys/arch/sparc64/dev/vgafb.c index 2deb2afc654..ec016101d05 100644 --- a/sys/arch/sparc64/dev/vgafb.c +++ b/sys/arch/sparc64/dev/vgafb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vgafb.c,v 1.60 2013/10/20 20:07:27 miod Exp $ */ +/* $OpenBSD: vgafb.c,v 1.61 2014/07/22 04:42:51 jsg Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -183,6 +184,9 @@ vgafbattach(parent, self, aux) /* sc->sc_ofhandle = PCITAG_NODE(sc->sc_pcitag); */ } + if (vga_aperture_needed(pa)) + printf("%s: aperture needed\n", sc->sc_sunfb.sf_dev.dv_xname); + fbwscons_attach(&sc->sc_sunfb, &vgafb_accessops, sc->sc_console); } diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index a9efc2c98d1..87ceca83a96 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga_pci.c,v 1.79 2014/07/12 23:16:23 jsg Exp $ */ +/* $OpenBSD: vga_pci.c,v 1.80 2014/07/22 04:42:51 jsg Exp $ */ /* $NetBSD: vga_pci.c,v 1.3 1998/06/08 06:55:58 thorpej Exp $ */ /* @@ -81,9 +81,6 @@ #include #include -#include -#include - #include #include @@ -174,28 +171,6 @@ static const struct vga_device_description vga_devs[] = { }; #endif -static const struct pci_matchid aperture_blacklist[] = { - /* server adapters found in mga200 drm driver */ - { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200E_SE }, - { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200E_SE_B }, - { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EH }, - { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200ER }, - { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EV }, - { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EW }, - - /* server adapters found in ast drm driver */ - { PCI_VENDOR_ASPEED, PCI_PRODUCT_ASPEED_AST2000 }, - { PCI_VENDOR_ASPEED, PCI_PRODUCT_ASPEED_AST2100 }, - - /* ati adapters found in servers */ - { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGEXL }, - { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_ES1000 }, - - /* xgi found in some poweredges/supermicros/tyans */ - { PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_Z7 }, - { PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_Z9 }, -}; - int vga_pci_match(struct device *parent, void *match, void *aux) { @@ -223,19 +198,6 @@ vga_pci_match(struct device *parent, void *match, void *aux) return (1); } -int -vga_aperture_needed(struct pci_attach_args *pa) -{ -#if defined(__i386__) || defined(__amd64__) || \ - defined(__sparc64__) || defined(__macppc__) - if (pci_matchbyid(pa, i915_devices, nitems(i915_devices)) || - pci_matchbyid(pa, radeon_devices, nitems(radeon_devices)) || - pci_matchbyid(pa, aperture_blacklist, nitems(aperture_blacklist))) - return (0); -#endif - return (1); -} - void vga_pci_attach(struct device *parent, struct device *self, void *aux) { diff --git a/sys/dev/pci/vga_pci_common.c b/sys/dev/pci/vga_pci_common.c index 9f4567bb38a..b8a9b4e3401 100644 --- a/sys/dev/pci/vga_pci_common.c +++ b/sys/dev/pci/vga_pci_common.c @@ -24,8 +24,11 @@ #include #include +#include #include +#include +#include #if NDRM > 0 int @@ -150,3 +153,38 @@ vga_pci_bar_unmap(struct vga_pci_bar *bar) bus_space_unmap(bar->bst, bar->bsh, bar->size); } } + +static const struct pci_matchid aperture_blacklist[] = { + /* server adapters found in mga200 drm driver */ + { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200E_SE }, + { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200E_SE_B }, + { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EH }, + { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200ER }, + { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EV }, + { PCI_VENDOR_MATROX, PCI_PRODUCT_MATROX_G200EW }, + + /* server adapters found in ast drm driver */ + { PCI_VENDOR_ASPEED, PCI_PRODUCT_ASPEED_AST2000 }, + { PCI_VENDOR_ASPEED, PCI_PRODUCT_ASPEED_AST2100 }, + + /* ati adapters found in servers */ + { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_RAGEXL }, + { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_ES1000 }, + + /* xgi found in some poweredges/supermicros/tyans */ + { PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_Z7 }, + { PCI_VENDOR_XGI, PCI_PRODUCT_XGI_VOLARI_Z9 }, +}; + +int +vga_aperture_needed(struct pci_attach_args *pa) +{ +#if defined(__i386__) || defined(__amd64__) || \ + defined(__sparc64__) || defined(__macppc__) + if (pci_matchbyid(pa, i915_devices, nitems(i915_devices)) || + pci_matchbyid(pa, radeon_devices, nitems(radeon_devices)) || + pci_matchbyid(pa, aperture_blacklist, nitems(aperture_blacklist))) + return (0); +#endif + return (1); +} diff --git a/sys/dev/pci/vga_pcivar.h b/sys/dev/pci/vga_pcivar.h index 3f7eef6b0c6..3c2bf7ff056 100644 --- a/sys/dev/pci/vga_pcivar.h +++ b/sys/dev/pci/vga_pcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vga_pcivar.h,v 1.17 2013/08/12 04:11:52 jsg Exp $ */ +/* $OpenBSD: vga_pcivar.h,v 1.18 2014/07/22 04:42:51 jsg Exp $ */ /* $NetBSD: vga_pcivar.h,v 1.1 1998/03/22 15:16:19 drochner Exp $ */ /* @@ -90,6 +90,7 @@ struct vga_pci_bar *vga_pci_bar_info(struct vga_pci_softc *, int); struct vga_pci_bar *vga_pci_bar_map(struct vga_pci_softc *, int, bus_size_t, int); void vga_pci_bar_unmap(struct vga_pci_bar*); +int vga_aperture_needed(struct pci_attach_args *); #if NDRM > 0 int vga_drmsubmatch(struct device *, void *, void *);