Deleted Added
full compact
agp.c (186433) agp.c (188247)
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 186433 2008-12-23 16:04:33Z kib $");
28__FBSDID("$FreeBSD: head/sys/dev/agp/agp.c 188247 2009-02-06 20:57:10Z wkoszek $");
29
29
30#include "opt_agp.h"
30#include "opt_bus.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/bus.h>

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

549 * Find a page from the object and wire it
550 * down. This page will be mapped using one or more
551 * entries in the GATT (assuming that PAGE_SIZE >=
552 * AGP_PAGE_SIZE. If this is the first call to bind,
553 * the pages will be allocated and zeroed.
554 */
555 m = vm_page_grab(mem->am_obj, OFF_TO_IDX(i),
556 VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
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>
37#include <sys/module.h>
38#include <sys/bus.h>

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

550 * Find a page from the object and wire it
551 * down. This page will be mapped using one or more
552 * entries in the GATT (assuming that PAGE_SIZE >=
553 * AGP_PAGE_SIZE. If this is the first call to bind,
554 * the pages will be allocated and zeroed.
555 */
556 m = vm_page_grab(mem->am_obj, OFF_TO_IDX(i),
557 VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
557 AGP_DPF("found page pa=%#x\n", VM_PAGE_TO_PHYS(m));
558 AGP_DPF("found page pa=%#jx\n", (uintmax_t)VM_PAGE_TO_PHYS(m));
558 }
559 VM_OBJECT_UNLOCK(mem->am_obj);
560
561 mtx_lock(&sc->as_lock);
562
563 if (mem->am_is_bound) {
564 device_printf(dev, "memory already bound\n");
565 error = EINVAL;

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

580 * Install entries in the GATT, making sure that if
581 * AGP_PAGE_SIZE < PAGE_SIZE and mem->am_size is not
582 * aligned to PAGE_SIZE, we don't modify too many GATT
583 * entries.
584 */
585 for (j = 0; j < PAGE_SIZE && i + j < mem->am_size;
586 j += AGP_PAGE_SIZE) {
587 vm_offset_t pa = VM_PAGE_TO_PHYS(m) + j;
559 }
560 VM_OBJECT_UNLOCK(mem->am_obj);
561
562 mtx_lock(&sc->as_lock);
563
564 if (mem->am_is_bound) {
565 device_printf(dev, "memory already bound\n");
566 error = EINVAL;

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

581 * Install entries in the GATT, making sure that if
582 * AGP_PAGE_SIZE < PAGE_SIZE and mem->am_size is not
583 * aligned to PAGE_SIZE, we don't modify too many GATT
584 * entries.
585 */
586 for (j = 0; j < PAGE_SIZE && i + j < mem->am_size;
587 j += AGP_PAGE_SIZE) {
588 vm_offset_t pa = VM_PAGE_TO_PHYS(m) + j;
588 AGP_DPF("binding offset %#x to pa %#x\n",
589 offset + i + j, pa);
589 AGP_DPF("binding offset %#jx to pa %#jx\n",
590 (uintmax_t)offset + i + j, (uintmax_t)pa);
590 error = AGP_BIND_PAGE(dev, offset + i + j, pa);
591 if (error) {
592 /*
593 * Bail out. Reverse all the mappings
594 * and unwire the pages.
595 */
596 for (k = 0; k < i + j; k += AGP_PAGE_SIZE)
597 AGP_UNBIND_PAGE(dev, offset + k);

--- 381 unchanged lines hidden ---
591 error = AGP_BIND_PAGE(dev, offset + i + j, pa);
592 if (error) {
593 /*
594 * Bail out. Reverse all the mappings
595 * and unwire the pages.
596 */
597 for (k = 0; k < i + j; k += AGP_PAGE_SIZE)
598 AGP_UNBIND_PAGE(dev, offset + k);

--- 381 unchanged lines hidden ---