diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2007-11-25 17:11:13 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2007-11-25 17:11:13 +0000 |
commit | f6e609402178409f4ffab378b534c5668d547e35 (patch) | |
tree | 01a30adae412455b8dc5fff7ffeb751f12ffbb93 /sys/arch | |
parent | 36d2c964c15e49779643651e2e0f68f3a2b9f26c (diff) |
Make agp attach as a device. This means that many more agp bridges
actually get detected and attached. Also adds a kernel api for
manipulating agp.
Enable this on i386 and amd64.
"I think you should commit it" deraadt@, ok matthieu. Looked over by
several others.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/conf.c | 5 | ||||
-rw-r--r-- | sys/arch/amd64/conf/GENERIC | 5 | ||||
-rw-r--r-- | sys/arch/amd64/conf/files.amd64 | 11 | ||||
-rw-r--r-- | sys/arch/amd64/pci/agp_machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/amd64/pci/pchb.c | 35 | ||||
-rw-r--r-- | sys/arch/i386/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/i386/conf/files.i386 | 14 | ||||
-rw-r--r-- | sys/arch/i386/i386/conf.c | 5 | ||||
-rw-r--r-- | sys/arch/i386/pci/agp_machdep.c | 25 | ||||
-rw-r--r-- | sys/arch/i386/pci/pchb.c | 170 |
10 files changed, 166 insertions, 120 deletions
diff --git a/sys/arch/amd64/amd64/conf.c b/sys/arch/amd64/amd64/conf.c index 9f1323cb280..eed892fe3b6 100644 --- a/sys/arch/amd64/amd64/conf.c +++ b/sys/arch/amd64/amd64/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.16 2007/09/12 18:18:27 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.17 2007/11/25 17:11:12 oga Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -171,6 +171,8 @@ cdev_decl(cztty); #include "radio.h" #include "nvram.h" cdev_decl(nvram); +#include "agp.h" +cdev_decl(agp); #include "wsdisplay.h" #include "wskbd.h" @@ -293,6 +295,7 @@ struct cdevsw cdevsw[] = cdev_acpi_init(NACPI,acpi), /* 83: ACPI */ cdev_bthub_init(NBTHUB,bthub), /* 84: bthub */ cdev_nvram_init(NNVRAM,nvram), /* 85: NVRAM interface */ + cdev_agp_init(NAGP,agp), /* 86: agp */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index e0d1bb9ca78..ae3264f79a0 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.205 2007/11/25 12:00:46 jsg Exp $ +# $OpenBSD: GENERIC,v 1.206 2007/11/25 17:11:12 oga Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -64,6 +64,8 @@ pci* at pchb? pcib* at pci? # PCI-ISA bridge amdpcib* at pci? # AMD 8111 LPC bridge +agp* at pchb? # AGP bridge + # National Semiconductor LM7[89] and compatible hardware monitors lm0 at isa? port 0x290 #lm1 at isa? port 0x280 @@ -237,7 +239,6 @@ pms* at pckbc? # PS/2 mouse for wsmouse pmsi* at pckbc? # PS/2 "Intelli"mouse for wsmouse vga0 at isa? vga* at pci? -option PCIAGP wsdisplay* at vga? wskbd* at pckbd? mux 1 wsmouse* at pms? mux 0 diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64 index 6cd06816c70..5ab5f20a899 100644 --- a/sys/arch/amd64/conf/files.amd64 +++ b/sys/arch/amd64/conf/files.amd64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.amd64,v 1.36 2007/10/10 15:53:51 art Exp $ +# $OpenBSD: files.amd64,v 1.37 2007/11/25 17:11:12 oga Exp $ maxpartitions 16 maxusers 2 16 128 @@ -102,8 +102,12 @@ file arch/amd64/pci/pciide_machdep.c pciide include "dev/puc/files.puc" +# AGP +include "dev/pci/files.agp" +file arch/amd64/pci/agp_machdep.c agp + # PCI Host bridge chipsets -device pchb: pcibus +device pchb: pcibus, agpbus, agp_i810 attach pchb at pci file arch/amd64/pci/pchb.c pchb @@ -222,6 +226,3 @@ major {cd = 6} major {rd = 17} major {wd = 0} major {fd = 2} - -file arch/amd64/pci/agp_machdep.c pciagp -file dev/pci/agp_i810.c pciagp diff --git a/sys/arch/amd64/pci/agp_machdep.c b/sys/arch/amd64/pci/agp_machdep.c index ff725b830cb..6237588010d 100644 --- a/sys/arch/amd64/pci/agp_machdep.c +++ b/sys/arch/amd64/pci/agp_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp_machdep.c,v 1.2 2007/08/04 19:40:25 reyk Exp $ */ +/* $OpenBSD: agp_machdep.c,v 1.3 2007/11/25 17:11:12 oga Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -36,16 +36,6 @@ #include <machine/cpufunc.h> -const struct agp_product agp_products[] = { - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915G_IV, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915GM_IGD, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945G_IGD_1, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945GM_IGD, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965_IGD_1, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965GM_IGD_1, agp_i810_attach }, - { 0, 0, NULL } -}; - void agp_flush_cache(void) { diff --git a/sys/arch/amd64/pci/pchb.c b/sys/arch/amd64/pci/pchb.c index 358a82dd976..dfd27f45f4b 100644 --- a/sys/arch/amd64/pci/pchb.c +++ b/sys/arch/amd64/pci/pchb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pchb.c,v 1.11 2007/11/16 15:31:19 mikeb Exp $ */ +/* $OpenBSD: pchb.c,v 1.12 2007/11/25 17:11:12 oga Exp $ */ /* $NetBSD: pchb.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */ /* * Copyright (c) 2000 Michael Shalayeff @@ -73,6 +73,8 @@ #include <dev/pci/pcireg.h> #include <dev/pci/pcidevs.h> +#include <dev/pci/agpvar.h> + #include <dev/rndvar.h> #include <dev/ic/i82802reg.h> @@ -128,6 +130,7 @@ int pchbmatch(struct device *, void *, void *); void pchbattach(struct device *, struct device *, void *); int pchb_print(void *, const char *); +int agpbus_print(void *, const char *); void pchb_rnd(void *); void pchb_amd64ht_attach (struct device *, struct pci_attach_args *, int); @@ -157,7 +160,10 @@ pchbattach(struct device *parent, struct device *self, void *aux) { struct pchb_softc *sc = (struct pchb_softc *)self; struct pci_attach_args *pa = aux; - int i, r; + struct agpbus_attach_args apa; + int has_agp, i, r; + + has_agp = 0; switch (PCI_VENDOR(pa->pa_id)) { case PCI_VENDOR_AMD: @@ -169,9 +175,6 @@ pchbattach(struct device *parent, struct device *self, void *aux) } break; case PCI_VENDOR_INTEL: -#ifdef PCIAGP - pciagp_set_pchb(pa); -#endif switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_INTEL_82915G_HB: case PCI_PRODUCT_INTEL_82925X_HB: @@ -217,6 +220,20 @@ pchbattach(struct device *parent, struct device *self, void *aux) break; } printf("\n"); + + /* + * If we haven't detected AGP yet (via a product ID), + * then check for AGP capability on the device. + */ + if (has_agp || + pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP, + NULL, NULL) != 0) { + printf("\n"); + apa.apa_busname = "agp"; + apa.apa_pci_args = *pa; + config_found(self, &apa, agpbus_print); + printf("\n"); + } } int @@ -230,6 +247,14 @@ pchb_print(void *aux, const char *pnp) return (UNCONF); } +int +agpbus_print(void *vaa, const char *pnp) +{ + if (pnp) + printf("agp at %s", pnp); + return (UNCONF); +} + void pchb_amd64ht_attach(struct device *self, struct pci_attach_args *pa, int i) { diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index 295fd8571ec..12d6c098087 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.590 2007/11/25 12:00:46 jsg Exp $ +# $OpenBSD: GENERIC,v 1.591 2007/11/25 17:11:12 oga Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -90,6 +90,7 @@ gpio* at gscpcib? glxpcib* at pci? # AMD CS5536 PCI-ISA bridge gpio* at glxpcib? +agp* at pchb? # AGP bridges # power management and other environmental stuff elansc* at pci? # AMD Elan SC520 System Controller gpio* at elansc? @@ -300,7 +301,6 @@ pckbd* at pckbc? # PC keyboard pms* at pckbc? # PS/2 mouse for wsmouse pmsi* at pckbc? # PS/2 "Intelli"mouse for wsmouse vga0 at isa? -option PCIAGP vga* at pci? pcdisplay0 at isa? # CGA, MDA, EGA, HGA wsdisplay* at vga? diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index cff1f90b9de..0466e09ec8e 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: files.i386,v 1.168 2007/11/25 15:42:15 tedu Exp $ +# $OpenBSD: files.i386,v 1.169 2007/11/25 17:11:12 oga Exp $ # # new style config file for i386 architecture # @@ -96,19 +96,15 @@ file arch/i386/i386/mainbus.c mainbus # include "../../../dev/pci/files.pci" +include "../../../dev/pci/files.agp" file arch/i386/pci/pci_machdep.c pci -file arch/i386/pci/agp_machdep.c pciagp -file dev/pci/agp_ali.c pciagp -file dev/pci/agp_amd.c pciagp -file dev/pci/agp_i810.c pciagp -file dev/pci/agp_intel.c pciagp -file dev/pci/agp_sis.c pciagp -file dev/pci/agp_via.c pciagp +file arch/i386/pci/agp_machdep.c agp file arch/i386/pci/pciide_machdep.c pciide file arch/i386/pci/pcic_pci_machdep.c pcic_pci # PCI-Host bridge chipsets -device pchb: pcibus +device pchb: pcibus, agpbus, agp_ali, agp_amd, agp_i810, agp_intel, agp_sis, + agp_via attach pchb at pci file arch/i386/pci/pchb.c pchb diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c index cdd1f90f7da..867bbc7c853 100644 --- a/sys/arch/i386/i386/conf.c +++ b/sys/arch/i386/i386/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.120 2007/11/25 15:42:15 tedu Exp $ */ +/* $OpenBSD: conf.c,v 1.121 2007/11/25 17:11:12 oga Exp $ */ /* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */ /* @@ -174,6 +174,8 @@ cdev_decl(cztty); #include "gpr.h" #include "nvram.h" cdev_decl(nvram); +#include "agp.h" +cdev_decl(agp); /* XXX -- this needs to be supported by config(8)! */ #if (NCOM > 0) && (NPCCOM > 0) @@ -307,6 +309,7 @@ struct cdevsw cdevsw[] = cdev_nvram_init(NNVRAM,nvram), /* 84: NVRAM interface */ cdev_notdef(), /* 85: ACPI (deprecated) */ cdev_bthub_init(NBTHUB,bthub), /* 86: bthub */ + cdev_agp_init(NAGP,agp), /* 87: agp */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); diff --git a/sys/arch/i386/pci/agp_machdep.c b/sys/arch/i386/pci/agp_machdep.c index dae50a45006..507428a94d2 100644 --- a/sys/arch/i386/pci/agp_machdep.c +++ b/sys/arch/i386/pci/agp_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp_machdep.c,v 1.8 2007/08/04 19:40:25 reyk Exp $ */ +/* $OpenBSD: agp_machdep.c,v 1.9 2007/11/25 17:11:12 oga Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -36,29 +36,6 @@ #include <machine/cpufunc.h> -const struct agp_product agp_products[] = { - { PCI_VENDOR_ALI, -1, agp_ali_attach }, - { PCI_VENDOR_AMD, -1, agp_amd_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_GC, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810_DC100_GC, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82810E_GC, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82815_FULL_GRAPH, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82830MP_IV, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82845G_IGD, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82852GM_AGP, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82865_IGD, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915G_IV, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915GM_IGD, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945G_IGD_1, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82945GM_IGD, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965_IGD_1, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82965GM_IGD_1, agp_i810_attach }, - { PCI_VENDOR_INTEL, -1, agp_intel_attach }, - { PCI_VENDOR_SIS, -1, agp_sis_attach }, - { PCI_VENDOR_VIATECH, -1, agp_via_attach }, - { 0, 0, NULL } -}; - void agp_flush_cache(void) { diff --git a/sys/arch/i386/pci/pchb.c b/sys/arch/i386/pci/pchb.c index 406ff34d4fd..081dcaed476 100644 --- a/sys/arch/i386/pci/pchb.c +++ b/sys/arch/i386/pci/pchb.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pchb.c,v 1.57 2007/11/16 15:31:19 mikeb Exp $ */ -/* $NetBSD: pchb.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */ +/* $OpenBSD: pchb.c,v 1.58 2007/11/25 17:11:12 oga Exp $ */ +/* $NetBSD: pchb.c,v 1.65 2007/08/15 02:26:13 markd Exp $ */ /* * Copyright (c) 2000 Michael Shalayeff @@ -27,7 +27,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ /*- - * Copyright (c) 1996 The NetBSD Foundation, Inc. + * Copyright (c) 1996, 1998, 2000 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -74,6 +74,9 @@ #include <dev/pci/pcireg.h> #include <dev/pci/pcidevs.h> +#include <dev/pci/agpreg.h> +#include <dev/pci/agpvar.h> + #include <dev/rndvar.h> #include <dev/ic/i82802reg.h> @@ -130,6 +133,7 @@ int pchbmatch(struct device *, void *, void *); void pchbattach(struct device *, struct device *, void *); int pchb_print(void *, const char *); +int agpbus_print(void *, const char *); struct cfattach pchb_ca = { sizeof(struct pchb_softc), pchbmatch, pchbattach @@ -180,35 +184,27 @@ pchbattach(struct device *parent, struct device *self, void *aux) struct pchb_softc *sc = (struct pchb_softc *)self; struct pci_attach_args *pa = aux; struct pcibus_attach_args pba; + struct agpbus_attach_args apa; pcireg_t bcreg; u_char bdnum, pbnum; pcitag_t tag; - int neednl = 1; - int i, r; + int doattach, has_agp, i, r; + + doattach = 0; + has_agp = 0; /* - * Print out a description, and configure certain chipsets which - * have auxiliary PCI buses. + * configure certain chipsets which have auxiliary PCI buses. */ switch (PCI_VENDOR(pa->pa_id)) { -#ifdef PCIAGP - case PCI_VENDOR_ALI: - case PCI_VENDOR_SIS: - case PCI_VENDOR_VIATECH: - pciagp_set_pchb(pa); - break; -#endif case PCI_VENDOR_AMD: switch (PCI_PRODUCT(pa->pa_id)) { -#ifdef PCIAGP case PCI_PRODUCT_AMD_SC751_SC: case PCI_PRODUCT_AMD_762_PCHB: - pciagp_set_pchb(pa); + has_agp =1; /* XXX is this detected otherwise */ break; -#endif case PCI_PRODUCT_AMD_AMD64_HT: - neednl = 0; printf("\n"); for (i = 0; i < AMD64HT_NUM_LDT; i++) pchb_amd64ht_attach(self, pa, i); @@ -227,23 +223,20 @@ pchbattach(struct device *parent, struct device *self, void *aux) * This host bridge has a second PCI bus. * Configure it. */ - neednl = 0; - pba.pba_busname = "pci"; - pba.pba_iot = pa->pa_iot; - pba.pba_memt = pa->pa_memt; - pba.pba_dmat = pa->pa_dmat; - pba.pba_domain = pa->pa_domain; - pba.pba_bus = bdnum; + pbnum = bdnum; pba.pba_bridgetag = NULL; - pba.pba_pc = pa->pa_pc; - printf("\n"); - config_found(self, &pba, pchb_print); + doattach = 1; break; case PCI_VENDOR_INTEL: -#ifdef PCIAGP - pciagp_set_pchb(pa); -#endif switch (PCI_PRODUCT(pa->pa_id)) { + case PCI_PRODUCT_INTEL_82452_HB: + bcreg = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x40); + pbnum = PCISET_INTEL_BRIDGE_NUMBER(bcreg); + if (pbnum != 0xff) { + pbnum++; + doattach = 1; + } + break; case PCI_PRODUCT_INTEL_82443BX_AGP: /* 82443BX AGP (PAC) */ case PCI_PRODUCT_INTEL_82443BX_NOAGP: /* 82443BX Host-PCI (no AGP) */ /* @@ -274,24 +267,25 @@ pchbattach(struct device *parent, struct device *self, void *aux) break; case PCISET_INTEL_TYPE_AUX: printf(": Auxiliary PB (bus %d)", pbnum); - neednl = 0; /* * This host bridge has a second PCI bus. * Configure it. */ - pba.pba_busname = "pci"; - pba.pba_iot = pa->pa_iot; - pba.pba_memt = pa->pa_memt; - pba.pba_dmat = pa->pa_dmat; - pba.pba_domain = pa->pa_domain; - pba.pba_bus = pbnum; - pba.pba_pc = pa->pa_pc; - printf("\n"); - config_found(self, &pba, pchb_print); + doattach = 1; break; } break; + case PCI_PRODUCT_INTEL_CDC: + bcreg = pci_conf_read(pa->pa_pc, pa->pa_tag, + I82424_CPU_BCTL_REG); + if (bcreg & I82424_BCTL_CPUPCI_POSTEN) { + bcreg &= ~I82424_BCTL_CPUPCI_POSTEN; + pci_conf_write(pa->pa_pc, pa->pa_tag, + I82424_CPU_BCTL_REG, bcreg); + printf(": disabled CPU-PCI write posting"); + } + break; case PCI_PRODUCT_INTEL_82454NX: pbnum = 0; switch (pa->pa_device) { @@ -317,27 +311,47 @@ pchbattach(struct device *parent, struct device *self, void *aux) break; } if (pbnum != 0) { - pba.pba_busname = "pci"; - pba.pba_iot = pa->pa_iot; - pba.pba_memt = pa->pa_memt; - pba.pba_dmat = pa->pa_dmat; - pba.pba_domain = pa->pa_domain; - pba.pba_bus = pbnum; - pba.pba_pc = pa->pa_pc; - printf("\n"); - config_found(self, &pba, pchb_print); + doattach = 1; } break; - case PCI_PRODUCT_INTEL_CDC: - bcreg = pci_conf_read(pa->pa_pc, pa->pa_tag, - I82424_CPU_BCTL_REG); - if (bcreg & I82424_BCTL_CPUPCI_POSTEN) { - bcreg &= ~I82424_BCTL_CPUPCI_POSTEN; - pci_conf_write(pa->pa_pc, pa->pa_tag, - I82424_CPU_BCTL_REG, bcreg); - printf(": disabled CPU-PCI write posting"); - } + case PCI_PRODUCT_INTEL_82810_MCH: + case PCI_PRODUCT_INTEL_82810_DC100_MCH: + case PCI_PRODUCT_INTEL_82810E_MCH: + case PCI_PRODUCT_INTEL_82815_FULL_HUB: + case PCI_PRODUCT_INTEL_82830MP_IO_1: + case PCI_PRODUCT_INTEL_82845G: + case PCI_PRODUCT_INTEL_82852GM_HPB: + case PCI_PRODUCT_INTEL_82865_IO_1: + case PCI_PRODUCT_INTEL_82915G_HB: + case PCI_PRODUCT_INTEL_82915GM_HB: + case PCI_PRODUCT_INTEL_82945GP_MCH: + case PCI_PRODUCT_INTEL_82945GM_MCH: + case PCI_PRODUCT_INTEL_82Q963_HB: + case PCI_PRODUCT_INTEL_82965_MCH: + /* + * The host bridge is either in GFX mode (internal + * graphics) or in AGP mode. In GFX mode, we pretend + * to have AGP because the graphics memory access + * is very similar and the AGP GATT code will + * deal with this. In the latter case, the + * pci_get_capability(PCI_CAP_AGP) test below will + * fire, so we do no harm by already setting the flag. + */ + has_agp = 1; + break; + } + break; + default: break; + } + + /* + * Now set up RNG. this isn't in previous switch since only + * some of the rng devices need special attention for AGP + */ + switch (PCI_VENDOR(pa->pa_id)) { + case PCI_VENDOR_INTEL: + switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_INTEL_82810_MCH: case PCI_PRODUCT_INTEL_82810_DC100_MCH: case PCI_PRODUCT_INTEL_82810E_MCH: @@ -388,8 +402,36 @@ pchbattach(struct device *parent, struct device *self, void *aux) break; } } - if (neednl) + + /* + * If we haven't detected AGP yet (via a product ID), + * then check for AGP capability on the device. + */ + if (has_agp || + pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP, + NULL, NULL) != 0) { + printf("\n"); + apa.apa_busname = "agp"; + apa.apa_pci_args = *pa; + config_found(self, &apa, agpbus_print); printf("\n"); + } + + if (doattach) { + pba.pba_busname = "pci"; + pba.pba_iot = pa->pa_iot; + pba.pba_memt = pa->pa_memt; + pba.pba_dmat = pa->pa_dmat; + pba.pba_domain = pa->pa_domain; + pba.pba_bus = pbnum; + pba.pba_bridgetag = NULL; + pba.pba_pc = pa->pa_pc; + printf("\n"); + config_found(self, &pba, pchb_print); + pba.pba_bridgetag = NULL; + memset(&pba.pba_intrtag, 0, sizeof(pba.pba_intrtag)); + config_found(self, &pba, pchb_print); + } } int @@ -403,6 +445,14 @@ pchb_print(void *aux, const char *pnp) return (UNCONF); } +int +agpbus_print(void *vaa, const char *pnp) +{ + if (pnp) + printf("agp at %s", pnp); + return (UNCONF); +} + /* * Should do FIPS testing as per: * http://csrc.nist.gov/publications/fips/fips140-1/fips1401.pdf |