summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/agp_via.c12
-rw-r--r--sys/pci/agpreg.h1
2 files changed, 12 insertions, 1 deletions
diff --git a/sys/pci/agp_via.c b/sys/pci/agp_via.c
index e3271af..90edbfd 100644
--- a/sys/pci/agp_via.c
+++ b/sys/pci/agp_via.c
@@ -122,11 +122,21 @@ agp_via_attach(device_t dev)
struct agp_via_softc *sc = device_get_softc(dev);
struct agp_gatt *gatt;
int error;
+ u_int32_t agpsel;
switch (pci_get_devid(dev)) {
case 0x31881106:
case 0x31891106:
- sc->regs = via_v3_regs;
+ /* The newer VIA chipsets will select the AGP version based on
+ * what AGP versions the card supports. We still have to
+ * program it using the v2 registers if it has chosen to use
+ * compatibility mode.
+ */
+ agpsel = pci_read_config(dev, AGP_VIA_AGPSEL, 1);
+ if ((agpsel & (1 << 1)) == 0)
+ sc->regs = via_v3_regs;
+ else
+ sc->regs = via_v2_regs;
break;
default:
sc->regs = via_v2_regs;
diff --git a/sys/pci/agpreg.h b/sys/pci/agpreg.h
index a5373e4..8d552a6 100644
--- a/sys/pci/agpreg.h
+++ b/sys/pci/agpreg.h
@@ -99,6 +99,7 @@
#define AGP3_VIA_GARTCTRL 0x90
#define AGP3_VIA_APSIZE 0x94
#define AGP3_VIA_ATTBASE 0x98
+#define AGP_VIA_AGPSEL 0xfd
/*
* Config offsets for SiS AGP chipsets.
OpenPOWER on IntegriCloud