Deleted Added
full compact
agp_i810.c (189578) agp_i810.c (190169)
1/*-
2 * Copyright (c) 2000 Doug Rabson
3 * Copyright (c) 2000 Ruslan Ermilov
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 */
27
28/*
29 * Fixes for 830/845G support: David Dawes <dawes@xfree86.org>
30 * 852GM/855GM/865G support added by David Dawes <dawes@xfree86.org>
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000 Doug Rabson
3 * Copyright (c) 2000 Ruslan Ermilov
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 */
27
28/*
29 * Fixes for 830/845G support: David Dawes <dawes@xfree86.org>
30 * 852GM/855GM/865G support added by David Dawes <dawes@xfree86.org>
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/dev/agp/agp_i810.c 189578 2009-03-09 13:27:33Z imp $");
34__FBSDID("$FreeBSD: head/sys/dev/agp/agp_i810.c 190169 2009-03-20 18:30:20Z rnoland $");
35
36#include "opt_bus.h"
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/malloc.h>
41#include <sys/kernel.h>
42#include <sys/module.h>

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

835 }
836}
837
838static int
839agp_i810_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
840{
841 struct agp_i810_softc *sc = device_get_softc(dev);
842
35
36#include "opt_bus.h"
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/malloc.h>
41#include <sys/kernel.h>
42#include <sys/module.h>

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

835 }
836}
837
838static int
839agp_i810_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
840{
841 struct agp_i810_softc *sc = device_get_softc(dev);
842
843 if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) {
843 if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) {
844 device_printf(dev, "failed: offset is 0x%08jx, shift is %d, entries is %d\n", (intmax_t)offset, AGP_PAGE_SHIFT, sc->gatt->ag_entries);
845 return EINVAL;
846 }
847
848 if ( sc->chiptype != CHIP_I810 ) {
849 if ( (offset >> AGP_PAGE_SHIFT) < sc->stolen ) {
850 device_printf(dev, "trying to bind into stolen memory");
851 return EINVAL;

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

857 return 0;
858}
859
860static int
861agp_i810_unbind_page(device_t dev, vm_offset_t offset)
862{
863 struct agp_i810_softc *sc = device_get_softc(dev);
864
844 device_printf(dev, "failed: offset is 0x%08jx, shift is %d, entries is %d\n", (intmax_t)offset, AGP_PAGE_SHIFT, sc->gatt->ag_entries);
845 return EINVAL;
846 }
847
848 if ( sc->chiptype != CHIP_I810 ) {
849 if ( (offset >> AGP_PAGE_SHIFT) < sc->stolen ) {
850 device_printf(dev, "trying to bind into stolen memory");
851 return EINVAL;

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

857 return 0;
858}
859
860static int
861agp_i810_unbind_page(device_t dev, vm_offset_t offset)
862{
863 struct agp_i810_softc *sc = device_get_softc(dev);
864
865 if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
865 if (offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
866 return EINVAL;
867
868 if ( sc->chiptype != CHIP_I810 ) {
869 if ( (offset >> AGP_PAGE_SHIFT) < sc->stolen ) {
870 device_printf(dev, "trying to unbind from stolen memory");
871 return EINVAL;
872 }
873 }

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

1011static int
1012agp_i810_bind_memory(device_t dev, struct agp_memory *mem,
1013 vm_offset_t offset)
1014{
1015 struct agp_i810_softc *sc = device_get_softc(dev);
1016 vm_offset_t i;
1017
1018 /* Do some sanity checks first. */
866 return EINVAL;
867
868 if ( sc->chiptype != CHIP_I810 ) {
869 if ( (offset >> AGP_PAGE_SHIFT) < sc->stolen ) {
870 device_printf(dev, "trying to unbind from stolen memory");
871 return EINVAL;
872 }
873 }

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

1011static int
1012agp_i810_bind_memory(device_t dev, struct agp_memory *mem,
1013 vm_offset_t offset)
1014{
1015 struct agp_i810_softc *sc = device_get_softc(dev);
1016 vm_offset_t i;
1017
1018 /* Do some sanity checks first. */
1019 if (offset < 0 || (offset & (AGP_PAGE_SIZE - 1)) != 0 ||
1019 if ((offset & (AGP_PAGE_SIZE - 1)) != 0 ||
1020 offset + mem->am_size > AGP_GET_APERTURE(dev)) {
1021 device_printf(dev, "binding memory at bad offset %#x\n",
1022 (int)offset);
1023 return EINVAL;
1024 }
1025
1026 if (mem->am_type == 2 && mem->am_size != AGP_PAGE_SIZE) {
1027 mtx_lock(&sc->agp.as_lock);

--- 102 unchanged lines hidden ---
1020 offset + mem->am_size > AGP_GET_APERTURE(dev)) {
1021 device_printf(dev, "binding memory at bad offset %#x\n",
1022 (int)offset);
1023 return EINVAL;
1024 }
1025
1026 if (mem->am_type == 2 && mem->am_size != AGP_PAGE_SIZE) {
1027 mtx_lock(&sc->agp.as_lock);

--- 102 unchanged lines hidden ---