summaryrefslogtreecommitdiffstats
path: root/sys/pci/agp_via.c
diff options
context:
space:
mode:
authoranholt <anholt@FreeBSD.org>2004-08-09 21:01:49 +0000
committeranholt <anholt@FreeBSD.org>2004-08-09 21:01:49 +0000
commita5739e0b312cc41186678052f12b96495ddb074d (patch)
treef3b3c35dfc6bd122dc5a99495948cd28873393f1 /sys/pci/agp_via.c
parent1e00fe7b057fa9e2896700e40f006617e0d70e6c (diff)
downloadFreeBSD-src-a5739e0b312cc41186678052f12b96495ddb074d.zip
FreeBSD-src-a5739e0b312cc41186678052f12b96495ddb074d.tar.gz
Minimal fix to prevent crashes when an AGP v2 card is used with the new v3 VIA
chipsets, based on Linux's via-agp.c. On boot, the system selects which AGP version to use based on the inserted card. If v2 was chosen, the chipset needs to be programmed with the v2 registers still. Also included in kern/69953 are changes to make the programming of the v3 registers match linux, but that will be left out until the need to do so is confirmed (want specs or a tester). PR: kern/69953 Submitted by: Oleg Sharoiko <os@rsu.ru> Tested by: Oleg Sharoiko <os@rsu.ru>, Geoff Speicher <geoff@speicher.org> (full version from PR)
Diffstat (limited to 'sys/pci/agp_via.c')
-rw-r--r--sys/pci/agp_via.c12
1 files changed, 11 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;
OpenPOWER on IntegriCloud