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 235782 2012-05-22 10:59:26Z kib $"); |
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) 243 i = agp_max_size - 1; |
244 sc->as_maxmem = agp_max[i][1] << 20U; 245 246 /* 247 * The lock is used to prevent re-entry to 248 * agp_generic_bind_memory() since that function can sleep. 249 */ 250 mtx_init(&sc->as_lock, "agp lock", NULL, MTX_DEF); 251 --- 547 unchanged lines hidden (view full) --- 799 800 if (!mem) 801 return ENOENT; 802 803 return AGP_UNBIND_MEMORY(dev, mem); 804} 805 806static int |
807agp_chipset_flush(device_t dev) 808{ 809 810 return (AGP_CHIPSET_FLUSH(dev)); 811} 812 813static int |
814agp_open(struct cdev *kdev, int oflags, int devtype, struct thread *td) 815{ 816 device_t dev = kdev->si_drv1; 817 struct agp_softc *sc = device_get_softc(dev); 818 819 if (!sc->as_isopen) { 820 sc->as_isopen = 1; 821 device_busy(dev); --- 50 unchanged lines hidden (view full) --- 872 return agp_deallocate_user(dev, *(int *) data); 873 874 case AGPIOC_BIND: 875 return agp_bind_user(dev, (agp_bind *)data); 876 877 case AGPIOC_UNBIND: 878 return agp_unbind_user(dev, (agp_unbind *)data); 879 |
880 case AGPIOC_CHIPSET_FLUSH: 881 return agp_chipset_flush(dev); |
882 } 883 884 return EINVAL; 885} 886 887static int 888agp_mmap(struct cdev *kdev, vm_ooffset_t offset, vm_paddr_t *paddr, 889 int prot, vm_memattr_t *memattr) --- 109 unchanged lines hidden --- |