Deleted Added
sdiff udiff text old ( 219902 ) new ( 235782 )
full compact
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.c 219902 2011-03-23 13:10:15Z jhb $");
29
30#include "opt_agp.h"
31#include "opt_bus.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/malloc.h>
36#include <sys/kernel.h>

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

234 * Work out an upper bound for agp memory allocation. This
235 * uses a heurisitc table from the Linux driver.
236 */
237 memsize = ptoa(Maxmem) >> 20;
238 for (i = 0; i < agp_max_size; i++) {
239 if (memsize <= agp_max[i][0])
240 break;
241 }
242 if (i == agp_max_size) i = agp_max_size - 1;
243 sc->as_maxmem = agp_max[i][1] << 20U;
244
245 /*
246 * The lock is used to prevent re-entry to
247 * agp_generic_bind_memory() since that function can sleep.
248 */
249 mtx_init(&sc->as_lock, "agp lock", NULL, MTX_DEF);
250

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

798
799 if (!mem)
800 return ENOENT;
801
802 return AGP_UNBIND_MEMORY(dev, mem);
803}
804
805static int
806agp_open(struct cdev *kdev, int oflags, int devtype, struct thread *td)
807{
808 device_t dev = kdev->si_drv1;
809 struct agp_softc *sc = device_get_softc(dev);
810
811 if (!sc->as_isopen) {
812 sc->as_isopen = 1;
813 device_busy(dev);

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

864 return agp_deallocate_user(dev, *(int *) data);
865
866 case AGPIOC_BIND:
867 return agp_bind_user(dev, (agp_bind *)data);
868
869 case AGPIOC_UNBIND:
870 return agp_unbind_user(dev, (agp_unbind *)data);
871
872 }
873
874 return EINVAL;
875}
876
877static int
878agp_mmap(struct cdev *kdev, vm_ooffset_t offset, vm_paddr_t *paddr,
879 int prot, vm_memattr_t *memattr)

--- 109 unchanged lines hidden ---