summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-11-09 15:11:20 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-11-09 15:11:20 +0000
commitc82365de6d1669d3aa8f37a7f91c598524aba316 (patch)
treeb47841f2a3a7541cc4236df1638f5f4433c8f81e /sys/arch
parent19e72e3b9f3138440f80b79260f2adaee85eae40 (diff)
Rework that way that agp attaches.
previously, we had a static list of pcidevs and which agp driver would be interanlly attached. Instead, split the agp drivers so they work like audio(4), where we attach a driver, which sets up some callbacks and initial state, then attaches the interface (agp(4)). Since this allows us to attach different drivers in different places, and give them /proper/ probe functions move most of the drivers back to attaching at pchb, where they should, and intagp (formerly agp_i810) stays attaching at vga, since it's part of the intel integrated graphics chips. Diff shrinks the kernel slightly, gets rid of the annoying "no integrated graphics" warning, and allows more cleanup later. Tested by many. fix for alpha build (the only other vga_pci.c consumer) suggested by miod.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/conf/files.alpha4
-rw-r--r--sys/arch/amd64/conf/GENERIC6
-rw-r--r--sys/arch/amd64/conf/files.amd6413
-rw-r--r--sys/arch/amd64/pci/pchb.c47
-rw-r--r--sys/arch/i386/conf/GENERIC17
-rw-r--r--sys/arch/i386/conf/files.i38613
-rw-r--r--sys/arch/i386/pci/pchb.c70
7 files changed, 62 insertions, 108 deletions
diff --git a/sys/arch/alpha/conf/files.alpha b/sys/arch/alpha/conf/files.alpha
index 277b0cea08f..34610f64c5b 100644
--- a/sys/arch/alpha/conf/files.alpha
+++ b/sys/arch/alpha/conf/files.alpha
@@ -1,4 +1,4 @@
-# $OpenBSD: files.alpha,v 1.87 2008/07/19 18:13:04 miod Exp $
+# $OpenBSD: files.alpha,v 1.88 2008/11/09 15:11:18 oga Exp $
# $NetBSD: files.alpha,v 1.32 1996/11/25 04:03:21 cgd Exp $
#
# alpha-specific configuration info
@@ -173,6 +173,8 @@ file arch/alpha/eisa/eisa_machdep.c eisa
# include "dev/pci/files.pci" XXX SEE ABOVE
+include "dev/pci/files.agp"
+
file arch/alpha/pci/pciide_machdep.c pciide
define alpha_pci_sgmap_pte64
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
index dfff40beaef..1002709705d 100644
--- a/sys/arch/amd64/conf/GENERIC
+++ b/sys/arch/amd64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.245 2008/10/24 06:10:25 brad Exp $
+# $OpenBSD: GENERIC,v 1.246 2008/11/09 15:11:19 oga Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -263,7 +263,9 @@ wskbd* at pckbd? mux 1
wsmouse* at pms? mux 0
wsmouse* at pmsi? mux 0
-agp* at vga? # AGP bridge
+intagp* at vga? # intel integrated graphics
+agp* at intagp?
+#agp* at vga? # AGP bridge
#option DRM_DEBUG
inteldrm* at vga? # Intel i915, i945 DRM driver
#machdrm* at vga? # mach64 (3D Rage Pro, Rage) DRM driver
diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64
index 35bc57acdbe..7ce88984879 100644
--- a/sys/arch/amd64/conf/files.amd64
+++ b/sys/arch/amd64/conf/files.amd64
@@ -1,4 +1,4 @@
-# $OpenBSD: files.amd64,v 1.40 2008/06/11 09:22:39 phessler Exp $
+# $OpenBSD: files.amd64,v 1.41 2008/11/09 15:11:19 oga Exp $
maxpartitions 16
maxusers 2 16 128
@@ -104,16 +104,15 @@ file arch/amd64/pci/pciide_machdep.c pciide
include "dev/puc/files.puc"
-# AGP devices
-device agp: agp_i810
-attach agp at agpbus
-file arch/amd64/pci/agp_machdep.c agp
-
# PCI Host bridge chipsets
-device pchb: pcibus
+device pchb: pcibus, agpbus
attach pchb at pci
file arch/amd64/pci/pchb.c pchb
+# AGP bridge support. most attach at pchb
+include "dev/pci/files.agp"
+file arch/amd64/pci/agp_machdep.c agp
+
#
# CARDBUS
#
diff --git a/sys/arch/amd64/pci/pchb.c b/sys/arch/amd64/pci/pchb.c
index 662741dccdc..d59508a7d46 100644
--- a/sys/arch/amd64/pci/pchb.c
+++ b/sys/arch/amd64/pci/pchb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pchb.c,v 1.26 2008/09/26 21:15:53 mikeb Exp $ */
+/* $OpenBSD: pchb.c,v 1.27 2008/11/09 15:11:19 oga Exp $ */
/* $NetBSD: pchb.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */
/*
* Copyright (c) 2000 Michael Shalayeff
@@ -142,7 +142,7 @@ pchbattach(struct device *parent, struct device *self, void *aux)
{
struct pchb_softc *sc = (struct pchb_softc *)self;
struct pci_attach_args *pa = aux;
- int has_agp = 0, i, r;
+ int i, r;
switch (PCI_VENDOR(pa->pa_id)) {
case PCI_VENDOR_AMD:
@@ -158,35 +158,8 @@ pchbattach(struct device *parent, struct device *self, void *aux)
break;
case PCI_VENDOR_INTEL:
switch (PCI_PRODUCT(pa->pa_id)) {
-
- /*
- * As for Intel AGP, 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.
- */
-
- /* AGP only */
- case PCI_PRODUCT_INTEL_82915GM_HB:
- case PCI_PRODUCT_INTEL_82945GM_HB:
- case PCI_PRODUCT_INTEL_82945GME_HB:
- case PCI_PRODUCT_INTEL_82G965_HB:
- case PCI_PRODUCT_INTEL_82Q965_HB:
- case PCI_PRODUCT_INTEL_82GM965_HB:
- case PCI_PRODUCT_INTEL_82G33_HB:
- case PCI_PRODUCT_INTEL_82G35_HB:
- case PCI_PRODUCT_INTEL_82Q35_HB:
- has_agp = 1;
- break;
-
- /* AGP + RNG */
case PCI_PRODUCT_INTEL_82915G_HB:
case PCI_PRODUCT_INTEL_82945G_HB:
- has_agp = 1;
- /* FALLTHROUGH */
-
case PCI_PRODUCT_INTEL_82925X_HB:
case PCI_PRODUCT_INTEL_82955X_HB:
sc->sc_bt = pa->pa_memt;
@@ -232,15 +205,19 @@ pchbattach(struct device *parent, struct device *self, void *aux)
#if NAGP > 0
/*
- * If we haven't detected AGP yet (via a product ID),
- * then check for AGP capability on the device.
+ * Intel IGD have an odd interface and attach at vga, however
+ * in that mode they don't have the AGP cap bit, so this
+ * test should be sufficient
*/
- if (has_agp ||
- pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
+ if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
NULL, NULL) != 0) {
- agp_set_pchb(pa);
+ struct agp_attach_args aa;
+ aa.aa_busname = "agp";
+ aa.aa_pa = pa;
+
+ config_found(self, &aa, agpdev_print);
}
-#endif
+#endif /* NAGP > 0 */
}
int
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index d4bf04a9bd6..de8ff873db1 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.638 2008/10/24 06:10:25 brad Exp $
+# $OpenBSD: GENERIC,v 1.639 2008/11/09 15:11:19 oga Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -330,7 +330,20 @@ wskbd* at pckbd? mux 1
wsmouse* at pms? mux 0
wsmouse* at pmsi? mux 0
-agp* at vga? # AGP bridges
+intagp* at vga? # intel integrated graphics agp
+aliagp* at pchb?
+amdagp* at pchb?
+intelagp* at pchb?
+sisagp* at pchb?
+viaagp* at pchb?
+
+agp* at intagp? # AGP bridges
+agp* at aliagp? # AGP bridges
+agp* at amdagp? # AGP bridges
+agp* at intelagp? # AGP bridges
+agp* at sisagp? # AGP bridges
+agp* at viaagp? # AGP bridges
+
#option DRM_DEBUG
inteldrm* at vga? # Intel i915, i945 DRM driver
#machdrm* at vga? # mach64 (3D Rage Pro, Rage) DRM driver
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386
index 21b51d2a205..651dfa007c7 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -1,4 +1,4 @@
-# $OpenBSD: files.i386,v 1.183 2008/10/10 20:21:38 deraadt Exp $
+# $OpenBSD: files.i386,v 1.184 2008/11/09 15:11:19 oga Exp $
#
# new style config file for i386 architecture
#
@@ -99,16 +99,15 @@ file arch/i386/pci/pci_machdep.c pci
file arch/i386/pci/pciide_machdep.c pciide
file arch/i386/pci/pcic_pci_machdep.c pcic_pci
-# AGP devices
-device agp: agp_ali, agp_amd, agp_i810, agp_intel, agp_sis, agp_via
-attach agp at agpbus
-file arch/i386/pci/agp_machdep.c agp
-
# PCI-Host bridge chipsets
-device pchb: pcibus
+device pchb: pcibus, agpbus
attach pchb at pci
file arch/i386/pci/pchb.c pchb
+# AGP bridge support. most attach at pchb
+include "dev/pci/files.agp"
+file arch/i386/pci/agp_machdep.c agp
+
# AMD Elan SC520 System Controller (PCI-Host bridge)
device elansc: gpiobus
attach elansc at pci
diff --git a/sys/arch/i386/pci/pchb.c b/sys/arch/i386/pci/pchb.c
index 794f1e673f0..6908385e735 100644
--- a/sys/arch/i386/pci/pchb.c
+++ b/sys/arch/i386/pci/pchb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pchb.c,v 1.74 2008/09/26 21:15:53 mikeb Exp $ */
+/* $OpenBSD: pchb.c,v 1.75 2008/11/09 15:11:19 oga Exp $ */
/* $NetBSD: pchb.c,v 1.65 2007/08/15 02:26:13 markd Exp $ */
/*
@@ -171,19 +171,13 @@ pchbattach(struct device *parent, struct device *self, void *aux)
pcireg_t bcreg;
u_char bdnum, pbnum;
pcitag_t tag;
- int has_agp = 0, i, r;
+ int i, r;
int doattach = 0;
switch (PCI_VENDOR(pa->pa_id)) {
case PCI_VENDOR_AMD:
printf("\n");
switch (PCI_PRODUCT(pa->pa_id)) {
-#ifdef __i386__
- case PCI_PRODUCT_AMD_SC751_SC:
- case PCI_PRODUCT_AMD_762_PCHB:
- has_agp = 1; /* XXX is this detected otherwise */
- break;
-#endif /* __i386__ */
case PCI_PRODUCT_AMD_AMD64_0F_HT:
case PCI_PRODUCT_AMD_AMD64_10_HT:
case PCI_PRODUCT_AMD_AMD64_11_HT:
@@ -303,55 +297,18 @@ pchbattach(struct device *parent, struct device *self, void *aux)
if (pbnum != 0)
doattach = 1;
break;
-#endif /* __i386__ */
-
- /*
- * As for Intel AGP, 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.
- */
-
- /* AGP only */
-#ifdef __i386__
- case PCI_PRODUCT_INTEL_82830M_HB:
- case PCI_PRODUCT_INTEL_82845G_HB:
- case PCI_PRODUCT_INTEL_82855GM_HB:
- case PCI_PRODUCT_INTEL_82865G_HB:
-#endif /* __i386__ */
- case PCI_PRODUCT_INTEL_82915GM_HB:
- case PCI_PRODUCT_INTEL_82945GM_HB:
- case PCI_PRODUCT_INTEL_82945GME_HB:
- case PCI_PRODUCT_INTEL_82G965_HB:
- case PCI_PRODUCT_INTEL_82Q965_HB:
- case PCI_PRODUCT_INTEL_82GM965_HB:
- case PCI_PRODUCT_INTEL_82G33_HB:
- case PCI_PRODUCT_INTEL_82G35_HB:
- case PCI_PRODUCT_INTEL_82Q35_HB:
- has_agp = 1;
- break;
-
- /* AGP + RNG */
-#ifdef __i386__
+ /* RNG */
case PCI_PRODUCT_INTEL_82810_HB:
case PCI_PRODUCT_INTEL_82810_DC100_HB:
case PCI_PRODUCT_INTEL_82810E_HB:
case PCI_PRODUCT_INTEL_82815_HB:
-#endif /* __i386__ */
- case PCI_PRODUCT_INTEL_82915G_HB:
- case PCI_PRODUCT_INTEL_82945G_HB:
- has_agp = 1;
- /* FALLTHROUGH */
-
- /* RNG only */
-#ifdef __i386__
case PCI_PRODUCT_INTEL_82820_HB:
case PCI_PRODUCT_INTEL_82840_HB:
case PCI_PRODUCT_INTEL_82850_HB:
case PCI_PRODUCT_INTEL_82860_HB:
#endif /* __i386__ */
+ case PCI_PRODUCT_INTEL_82915G_HB:
+ case PCI_PRODUCT_INTEL_82945G_HB:
case PCI_PRODUCT_INTEL_82925X_HB:
case PCI_PRODUCT_INTEL_82955X_HB:
sc->sc_bt = pa->pa_memt;
@@ -397,13 +354,18 @@ pchbattach(struct device *parent, struct device *self, void *aux)
#if NAGP > 0
/*
- * If we haven't detected AGP yet (via a product ID),
- * then check for AGP capability on the device.
+ * Intel IGD have an odd interface and attach at vga, however,
+ * in that mode they don't have the AGP cap bit, so this
+ * test should be sufficient
*/
- if (has_agp ||
- pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
- NULL, NULL) != 0)
- agp_set_pchb(pa);
+ if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
+ NULL, NULL) != 0) {
+ struct agp_attach_args aa;
+ aa.aa_busname = "agp";
+ aa.aa_pa = pa;
+
+ config_found(self, &aa, agpdev_print);
+ }
#endif /* NAGP > 0 */
#ifdef __i386__
if (doattach == 0)