diff options
author | anholt <anholt@FreeBSD.org> | 2005-06-26 04:01:11 +0000 |
---|---|---|
committer | anholt <anholt@FreeBSD.org> | 2005-06-26 04:01:11 +0000 |
commit | 991a0a96327d5811129df168ecd42872b043cd28 (patch) | |
tree | 92a45805f0f4a45c2280f2c2510ceed29e2af4c5 /sys | |
parent | 8f1c0248bd6960862d8f8f55ee81120e5c02bdd0 (diff) | |
download | FreeBSD-src-991a0a96327d5811129df168ecd42872b043cd28.zip FreeBSD-src-991a0a96327d5811129df168ecd42872b043cd28.tar.gz |
Make the initialization in the AGPv3 case match that of Linux. Fixes hangs on
X startup with DRI enabled, with a v3-capable card.
Tested by: Tom McLaughlin <tmclaugh@sdf.lonestar.org>
Approved by: re (scottl)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/agp/agp_via.c | 36 | ||||
-rw-r--r-- | sys/pci/agp_via.c | 36 |
2 files changed, 56 insertions, 16 deletions
diff --git a/sys/dev/agp/agp_via.c b/sys/dev/agp/agp_via.c index 118b906..f2cd381 100644 --- a/sys/dev/agp/agp_via.c +++ b/sys/dev/agp/agp_via.c @@ -211,11 +211,22 @@ agp_via_attach(device_t dev) } sc->gatt = gatt; - /* Install the gatt. */ - pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4); - - /* Enable the aperture. */ - pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); + if (sc->regs == via_v2_regs) { + /* Install the gatt. */ + pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4); + + /* Enable the aperture. */ + pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); + } else { + u_int32_t gartctrl; + + /* Install the gatt. */ + pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical, 4); + + /* Enable the aperture. */ + gartctrl = pci_read_config(dev, sc->regs[REG_ATTBASE], 4); + pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl | (3 << 7), 4); + } return 0; } @@ -306,9 +317,18 @@ static void agp_via_flush_tlb(device_t dev) { struct agp_via_softc *sc = device_get_softc(dev); - - pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4); - pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); + u_int32_t gartctrl; + + if (sc->regs == via_v2_regs) { + pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4); + pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); + } else { + gartctrl = pci_read_config(dev, sc->regs[REG_GARTCTRL], 4); + pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl & + ~(1 << 7), 4); + pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl, 4); + } + } static device_method_t agp_via_methods[] = { diff --git a/sys/pci/agp_via.c b/sys/pci/agp_via.c index 118b906..f2cd381 100644 --- a/sys/pci/agp_via.c +++ b/sys/pci/agp_via.c @@ -211,11 +211,22 @@ agp_via_attach(device_t dev) } sc->gatt = gatt; - /* Install the gatt. */ - pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4); - - /* Enable the aperture. */ - pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); + if (sc->regs == via_v2_regs) { + /* Install the gatt. */ + pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4); + + /* Enable the aperture. */ + pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); + } else { + u_int32_t gartctrl; + + /* Install the gatt. */ + pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical, 4); + + /* Enable the aperture. */ + gartctrl = pci_read_config(dev, sc->regs[REG_ATTBASE], 4); + pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl | (3 << 7), 4); + } return 0; } @@ -306,9 +317,18 @@ static void agp_via_flush_tlb(device_t dev) { struct agp_via_softc *sc = device_get_softc(dev); - - pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4); - pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); + u_int32_t gartctrl; + + if (sc->regs == via_v2_regs) { + pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4); + pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); + } else { + gartctrl = pci_read_config(dev, sc->regs[REG_GARTCTRL], 4); + pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl & + ~(1 << 7), 4); + pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl, 4); + } + } static device_method_t agp_via_methods[] = { |