Deleted Added
full compact
agp_via.c (142398) agp_via.c (147606)
1/*-
2 * Copyright (c) 2000 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/agp/agp_via.c 142398 2005-02-24 21:32:56Z imp $");
28__FBSDID("$FreeBSD: head/sys/dev/agp/agp_via.c 147606 2005-06-26 04:01:11Z anholt $");
29
30#include "opt_bus.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>
35#include <sys/kernel.h>
36#include <sys/module.h>

--- 169 unchanged lines hidden (view full) ---

206 */
207 if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) {
208 agp_generic_detach(dev);
209 return ENOMEM;
210 }
211 }
212 sc->gatt = gatt;
213
29
30#include "opt_bus.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>
35#include <sys/kernel.h>
36#include <sys/module.h>

--- 169 unchanged lines hidden (view full) ---

206 */
207 if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) {
208 agp_generic_detach(dev);
209 return ENOMEM;
210 }
211 }
212 sc->gatt = gatt;
213
214 /* Install the gatt. */
215 pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4);
216
217 /* Enable the aperture. */
218 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4);
214 if (sc->regs == via_v2_regs) {
215 /* Install the gatt. */
216 pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4);
217
218 /* Enable the aperture. */
219 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4);
220 } else {
221 u_int32_t gartctrl;
219
222
223 /* Install the gatt. */
224 pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical, 4);
225
226 /* Enable the aperture. */
227 gartctrl = pci_read_config(dev, sc->regs[REG_ATTBASE], 4);
228 pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl | (3 << 7), 4);
229 }
230
220 return 0;
221}
222
223static int
224agp_via_detach(device_t dev)
225{
226 struct agp_via_softc *sc = device_get_softc(dev);
227 int error;

--- 73 unchanged lines hidden (view full) ---

301 sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
302 return 0;
303}
304
305static void
306agp_via_flush_tlb(device_t dev)
307{
308 struct agp_via_softc *sc = device_get_softc(dev);
231 return 0;
232}
233
234static int
235agp_via_detach(device_t dev)
236{
237 struct agp_via_softc *sc = device_get_softc(dev);
238 int error;

--- 73 unchanged lines hidden (view full) ---

312 sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
313 return 0;
314}
315
316static void
317agp_via_flush_tlb(device_t dev)
318{
319 struct agp_via_softc *sc = device_get_softc(dev);
320 u_int32_t gartctrl;
309
321
310 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4);
311 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4);
322 if (sc->regs == via_v2_regs) {
323 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4);
324 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4);
325 } else {
326 gartctrl = pci_read_config(dev, sc->regs[REG_GARTCTRL], 4);
327 pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl &
328 ~(1 << 7), 4);
329 pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl, 4);
330 }
331
312}
313
314static device_method_t agp_via_methods[] = {
315 /* Device interface */
316 DEVMETHOD(device_probe, agp_via_probe),
317 DEVMETHOD(device_attach, agp_via_attach),
318 DEVMETHOD(device_detach, agp_via_detach),
319 DEVMETHOD(device_shutdown, bus_generic_shutdown),

--- 29 unchanged lines hidden ---
332}
333
334static device_method_t agp_via_methods[] = {
335 /* Device interface */
336 DEVMETHOD(device_probe, agp_via_probe),
337 DEVMETHOD(device_attach, agp_via_attach),
338 DEVMETHOD(device_detach, agp_via_detach),
339 DEVMETHOD(device_shutdown, bus_generic_shutdown),

--- 29 unchanged lines hidden ---