Deleted Added
full compact
agp.c (219902) agp.c (235782)
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>
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 $");
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 }
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;
242 if (i == agp_max_size)
243 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
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
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
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);
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 ---
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 ---