Index: agp_via.c =================================================================== RCS file: /home/ncvs/src/sys/pci/agp_via.c,v retrieving revision 1.17 diff -u -r1.17 agp_via.c --- agp_via.c 9 Aug 2004 21:01:49 -0000 1.17 +++ agp_via.c 9 Aug 2004 21:02:43 -0000 @@ -165,11 +165,22 @@ } 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; } @@ -260,9 +271,18 @@ agp_via_flush_tlb(device_t dev) { struct agp_via_softc *sc = device_get_softc(dev); + u_int32_t gartctrl; - pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4); - pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); + 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); + } + }