Deleted Added
full compact
agp_ati.c (161788) agp_ati.c (173203)
1/*-
2 * Copyright (c) 2005 Eric Anholt
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

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

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 * Based on reading the Linux 2.6.8.1 driver by Dave Jones.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2005 Eric Anholt
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

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

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 * Based on reading the Linux 2.6.8.1 driver by Dave Jones.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/agp/agp_ati.c 161788 2006-09-01 02:22:17Z anholt $");
30__FBSDID("$FreeBSD: head/sys/dev/agp/agp_ati.c 173203 2007-10-30 22:09:16Z jhb $");
31
32#include "opt_bus.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/malloc.h>
37#include <sys/kernel.h>
38#include <sys/module.h>

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

243
244 return 0;
245}
246
247static int
248agp_ati_detach(device_t dev)
249{
250 struct agp_ati_softc *sc = device_get_softc(dev);
31
32#include "opt_bus.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/malloc.h>
37#include <sys/kernel.h>
38#include <sys/module.h>

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

243
244 return 0;
245}
246
247static int
248agp_ati_detach(device_t dev)
249{
250 struct agp_ati_softc *sc = device_get_softc(dev);
251 int error;
252 u_int32_t apsize_reg, temp;
253
251 u_int32_t apsize_reg, temp;
252
253 agp_free_cdev(dev);
254
254 if (sc->is_rs300)
255 apsize_reg = ATI_RS300_APSIZE;
256 else
257 apsize_reg = ATI_RS100_APSIZE;
258
255 if (sc->is_rs300)
256 apsize_reg = ATI_RS300_APSIZE;
257 else
258 apsize_reg = ATI_RS100_APSIZE;
259
259 error = agp_generic_detach(dev);
260 if (error)
261 return error;
262
263 /* Clear the GATT base */
264 WRITE4(ATI_GART_BASE, 0);
265
266 /* Put the aperture back the way it started. */
267 AGP_SET_APERTURE(dev, sc->initial_aperture);
268
269 temp = pci_read_config(dev, apsize_reg, 4);
270 pci_write_config(dev, apsize_reg, temp & ~1, 4);
271
272 free(sc->ag_vdir, M_AGP);
273 free(sc->ag_virtual, M_AGP);
274
275 bus_release_resource(dev, SYS_RES_MEMORY, ATI_GART_MMADDR, sc->regs);
260 /* Clear the GATT base */
261 WRITE4(ATI_GART_BASE, 0);
262
263 /* Put the aperture back the way it started. */
264 AGP_SET_APERTURE(dev, sc->initial_aperture);
265
266 temp = pci_read_config(dev, apsize_reg, 4);
267 pci_write_config(dev, apsize_reg, temp & ~1, 4);
268
269 free(sc->ag_vdir, M_AGP);
270 free(sc->ag_virtual, M_AGP);
271
272 bus_release_resource(dev, SYS_RES_MEMORY, ATI_GART_MMADDR, sc->regs);
273 agp_free_res(dev);
276
277 return 0;
278}
279
280static u_int32_t
281agp_ati_get_aperture(device_t dev)
282{
283 struct agp_ati_softc *sc = device_get_softc(dev);

--- 105 unchanged lines hidden ---
274
275 return 0;
276}
277
278static u_int32_t
279agp_ati_get_aperture(device_t dev)
280{
281 struct agp_ati_softc *sc = device_get_softc(dev);

--- 105 unchanged lines hidden ---