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 188247 2009-02-06 20:57:10Z wkoszek $"); |
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> 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); |
558 AGP_DPF("found page pa=%#jx\n", (uintmax_t)VM_PAGE_TO_PHYS(m)); |
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; |
589 AGP_DPF("binding offset %#jx to pa %#jx\n", 590 (uintmax_t)offset + i + j, (uintmax_t)pa); |
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 --- |