Deleted Added
full compact
agp_nvidia.c (153572) agp_nvidia.c (173203)
1/*-
2 * Copyright (c) 2003 Matthew N. Dodd <winter@jurai.net>
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) 2003 Matthew N. Dodd <winter@jurai.net>
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_nvidia.c 153572 2005-12-20 21:12:26Z jhb $");
28__FBSDID("$FreeBSD: head/sys/dev/agp/agp_nvidia.c 173203 2007-10-30 22:09:16Z jhb $");
29
30/*
31 * Written using information gleaned from the
32 * NVIDIA nForce/nForce2 AGPGART Linux Kernel Patch.
33 */
34
35#include "opt_bus.h"
36

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

242 agp_generic_detach(dev);
243 return (ENOMEM);
244}
245
246static int
247agp_nvidia_detach (device_t dev)
248{
249 struct agp_nvidia_softc *sc = device_get_softc(dev);
29
30/*
31 * Written using information gleaned from the
32 * NVIDIA nForce/nForce2 AGPGART Linux Kernel Patch.
33 */
34
35#include "opt_bus.h"
36

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

242 agp_generic_detach(dev);
243 return (ENOMEM);
244}
245
246static int
247agp_nvidia_detach (device_t dev)
248{
249 struct agp_nvidia_softc *sc = device_get_softc(dev);
250 int error;
251 u_int32_t temp;
252
250 u_int32_t temp;
251
253 error = agp_generic_detach(dev);
254 if (error)
255 return (error);
252 agp_free_cdev(dev);
256
257 /* GART Control */
258 temp = pci_read_config(sc->dev, AGP_NVIDIA_0_APSIZE, 4);
259 pci_write_config(sc->dev, AGP_NVIDIA_0_APSIZE, temp & ~(0x100), 4);
260
261 /* GTLB Control */
262 temp = pci_read_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, 4);
263 pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, temp & ~(0x11), 4);
264
265 /* Put the aperture back the way it started. */
266 AGP_SET_APERTURE(dev, sc->initial_aperture);
267
268 /* restore iorr for previous aperture size */
269 nvidia_init_iorr(rman_get_start(sc->agp.as_aperture),
270 sc->initial_aperture);
271
272 agp_free_gatt(sc->gatt);
253
254 /* GART Control */
255 temp = pci_read_config(sc->dev, AGP_NVIDIA_0_APSIZE, 4);
256 pci_write_config(sc->dev, AGP_NVIDIA_0_APSIZE, temp & ~(0x100), 4);
257
258 /* GTLB Control */
259 temp = pci_read_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, 4);
260 pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, temp & ~(0x11), 4);
261
262 /* Put the aperture back the way it started. */
263 AGP_SET_APERTURE(dev, sc->initial_aperture);
264
265 /* restore iorr for previous aperture size */
266 nvidia_init_iorr(rman_get_start(sc->agp.as_aperture),
267 sc->initial_aperture);
268
269 agp_free_gatt(sc->gatt);
270 agp_free_res(dev);
273
274 return (0);
275}
276
277static u_int32_t
278agp_nvidia_get_aperture(device_t dev)
279{
280 switch (pci_read_config(dev, AGP_NVIDIA_0_APSIZE, 1) & 0x0f) {

--- 184 unchanged lines hidden ---
271
272 return (0);
273}
274
275static u_int32_t
276agp_nvidia_get_aperture(device_t dev)
277{
278 switch (pci_read_config(dev, AGP_NVIDIA_0_APSIZE, 1) & 0x0f) {

--- 184 unchanged lines hidden ---