diff options
Diffstat (limited to 'sys/uvm/uvm_device.c')
-rw-r--r-- | sys/uvm/uvm_device.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/sys/uvm/uvm_device.c b/sys/uvm/uvm_device.c index 0f5f2214ec8..08bdccca0d0 100644 --- a/sys/uvm/uvm_device.c +++ b/sys/uvm/uvm_device.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uvm_device.c,v 1.20 2001/12/04 23:22:42 art Exp $ */ -/* $NetBSD: uvm_device.c,v 1.37 2001/09/10 21:19:42 chris Exp $ */ +/* $OpenBSD: uvm_device.c,v 1.21 2001/12/19 08:58:07 art Exp $ */ +/* $NetBSD: uvm_device.c,v 1.30 2000/11/25 06:27:59 chs Exp $ */ /* * @@ -57,7 +57,7 @@ LIST_HEAD(udv_list_struct, uvm_device); static struct udv_list_struct udv_list; -static struct simplelock udv_lock; +static simple_lock_data_t udv_lock; /* * functions @@ -67,7 +67,7 @@ static void udv_init __P((void)); static void udv_reference __P((struct uvm_object *)); static void udv_detach __P((struct uvm_object *)); static int udv_fault __P((struct uvm_faultinfo *, vaddr_t, - struct vm_page **, int, int, vm_fault_t, + vm_page_t *, int, int, vm_fault_t, vm_prot_t, int)); static boolean_t udv_flush __P((struct uvm_object *, voff_t, voff_t, int)); @@ -145,7 +145,7 @@ udv_attach(arg, accessprot, off, size) /* * Check that the specified range of the device allows the * desired protection. - * + * * XXX assumes VM_PROT_* == PROT_* * XXX clobbers off and size, but nothing else here needs them. */ @@ -163,7 +163,7 @@ udv_attach(arg, accessprot, off, size) for (;;) { /* - * first, attempt to find it on the main list + * first, attempt to find it on the main list */ simple_lock(&udv_lock); @@ -259,7 +259,7 @@ udv_attach(arg, accessprot, off, size) } /*NOTREACHED*/ } - + /* * udv_reference * @@ -278,7 +278,7 @@ udv_reference(uobj) simple_lock(&uobj->vmobjlock); uobj->uo_refs++; - UVMHIST_LOG(maphist, "<- done (uobj=0x%x, ref = %d)", + UVMHIST_LOG(maphist, "<- done (uobj=0x%x, ref = %d)", uobj, uobj->uo_refs,0,0); simple_unlock(&uobj->vmobjlock); } @@ -306,7 +306,7 @@ again: if (uobj->uo_refs > 1) { uobj->uo_refs--; simple_unlock(&uobj->vmobjlock); - UVMHIST_LOG(maphist," <- done, uobj=0x%x, ref=%d", + UVMHIST_LOG(maphist," <- done, uobj=0x%x, ref=%d", uobj,uobj->uo_refs,0,0); return; } @@ -374,7 +374,7 @@ static int udv_fault(ufi, vaddr, pps, npages, centeridx, fault_type, access_type, flags) struct uvm_faultinfo *ufi; vaddr_t vaddr; - struct vm_page **pps; + vm_page_t *pps; int npages, centeridx, flags; vm_fault_t fault_type; vm_prot_t access_type; @@ -396,16 +396,16 @@ udv_fault(ufi, vaddr, pps, npages, centeridx, fault_type, access_type, flags) * we do not allow device mappings to be mapped copy-on-write * so we kill any attempt to do so here. */ - + if (UVM_ET_ISCOPYONWRITE(entry)) { - UVMHIST_LOG(maphist, "<- failed -- COW entry (etype=0x%x)", + UVMHIST_LOG(maphist, "<- failed -- COW entry (etype=0x%x)", entry->etype, 0,0,0); uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj, NULL); - return(EIO); + return(VM_PAGER_ERROR); } /* - * get device map function. + * get device map function. */ device = udv->u_device; @@ -422,12 +422,12 @@ udv_fault(ufi, vaddr, pps, npages, centeridx, fault_type, access_type, flags) curr_offset = entry->offset + (vaddr - entry->start); /* pmap va = vaddr (virtual address of pps[0]) */ curr_va = vaddr; - + /* * loop over the page range entering in as needed */ - retval = 0; + retval = VM_PAGER_OK; for (lcv = 0 ; lcv < npages ; lcv++, curr_offset += PAGE_SIZE, curr_va += PAGE_SIZE) { if ((flags & PGO_ALLPAGES) == 0 && lcv != centeridx) @@ -438,7 +438,7 @@ udv_fault(ufi, vaddr, pps, npages, centeridx, fault_type, access_type, flags) mdpgno = (*mapfn)(device, curr_offset, access_type); if (mdpgno == -1) { - retval = EIO; + retval = VM_PAGER_ERROR; break; } paddr = pmap_phys_address(mdpgno); @@ -447,7 +447,7 @@ udv_fault(ufi, vaddr, pps, npages, centeridx, fault_type, access_type, flags) " MAPPING: device: pm=0x%x, va=0x%x, pa=0x%lx, at=%d", ufi->orig_map->pmap, curr_va, paddr, mapprot); if (pmap_enter(ufi->orig_map->pmap, curr_va, paddr, - mapprot, PMAP_CANFAIL | mapprot) != 0) { + mapprot, PMAP_CANFAIL | mapprot) != KERN_SUCCESS) { /* * pmap_enter() didn't have the resource to * enter this mapping. Unlock everything, @@ -460,13 +460,11 @@ udv_fault(ufi, vaddr, pps, npages, centeridx, fault_type, access_type, flags) */ uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj, NULL); - pmap_update(ufi->orig_map->pmap); /* sync what we have so far */ uvm_wait("udv_fault"); - return (ERESTART); + return (VM_PAGER_REFAULT); } } uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj, NULL); - pmap_update(ufi->orig_map->pmap); return (retval); } |