|
Lines 122-132
Link Here
|
| 122 |
struct agp_via_softc *sc = device_get_softc(dev); |
122 |
struct agp_via_softc *sc = device_get_softc(dev); |
| 123 |
struct agp_gatt *gatt; |
123 |
struct agp_gatt *gatt; |
| 124 |
int error; |
124 |
int error; |
|
|
125 |
u_int32_t agpsel; |
| 125 |
|
126 |
|
| 126 |
switch (pci_get_devid(dev)) { |
127 |
switch (pci_get_devid(dev)) { |
| 127 |
case 0x31881106: |
128 |
case 0x31881106: |
| 128 |
case 0x31891106: |
129 |
case 0x31891106: |
| 129 |
sc->regs = via_v3_regs; |
130 |
/* The newer VIA chipsets will select the AGP version based on |
|
|
131 |
* what AGP versions the card supports. We still have to |
| 132 |
* program it using the v2 registers if it has chosen to use |
| 133 |
* compatibility mode. |
| 134 |
*/ |
| 135 |
agpsel = pci_read_config(dev, AGP_VIA_AGPSEL, 1); |
| 136 |
if ((agpsel & (1 << 1)) == 0) |
| 137 |
sc->regs = via_v3_regs; |
| 138 |
else |
| 139 |
sc->regs = via_v2_regs; |
| 130 |
break; |
140 |
break; |
| 131 |
default: |
141 |
default: |
| 132 |
sc->regs = via_v2_regs; |
142 |
sc->regs = via_v2_regs; |
|
Lines 155-165
Link Here
|
| 155 |
} |
165 |
} |
| 156 |
sc->gatt = gatt; |
166 |
sc->gatt = gatt; |
| 157 |
|
167 |
|
| 158 |
/* Install the gatt. */ |
168 |
if (sc->regs == via_v2_regs) { |
| 159 |
pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4); |
169 |
/* Install the gatt. */ |
| 160 |
|
170 |
pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4); |
| 161 |
/* Enable the aperture. */ |
171 |
|
| 162 |
pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); |
172 |
/* Enable the aperture. */ |
|
|
173 |
pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); |
| 174 |
} else { |
| 175 |
u_int32_t gartctrl; |
| 176 |
|
| 177 |
/* Install the gatt. */ |
| 178 |
pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical, 4); |
| 179 |
|
| 180 |
/* Enable the aperture. */ |
| 181 |
gartctrl = pci_read_config(dev, sc->regs[REG_ATTBASE], 4); |
| 182 |
pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl | (3 << 7), 4); |
| 183 |
} |
| 163 |
|
184 |
|
| 164 |
return 0; |
185 |
return 0; |
| 165 |
} |
186 |
} |
|
Lines 250-258
Link Here
|
| 250 |
agp_via_flush_tlb(device_t dev) |
271 |
agp_via_flush_tlb(device_t dev) |
| 251 |
{ |
272 |
{ |
| 252 |
struct agp_via_softc *sc = device_get_softc(dev); |
273 |
struct agp_via_softc *sc = device_get_softc(dev); |
|
|
274 |
u_int32_t gartctrl; |
| 253 |
|
275 |
|
| 254 |
pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4); |
276 |
if (sc->regs == via_v2_regs) { |
| 255 |
pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); |
277 |
pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4); |
|
|
278 |
pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4); |
| 279 |
} else { |
| 280 |
gartctrl = pci_read_config(dev, sc->regs[REG_GARTCTRL], 4); |
| 281 |
pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl & |
| 282 |
~(1 << 7), 4); |
| 283 |
pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl, 4); |
| 284 |
} |
| 285 |
|
| 256 |
} |
286 |
} |
| 257 |
|
287 |
|
| 258 |
static device_method_t agp_via_methods[] = { |
288 |
static device_method_t agp_via_methods[] = { |