summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2003-01-15 23:54:35 +0000
committerdillon <dillon@FreeBSD.org>2003-01-15 23:54:35 +0000
commitbd6fdb8977d9154d972b0403fd08b7f1a258be6c (patch)
treee69a67ab93e65ba985b3b22b14b0ac7873b09ec6 /sys/powerpc
parent1eabfd1ad136c32cded248ceef448d9d5de27d6f (diff)
downloadFreeBSD-src-bd6fdb8977d9154d972b0403fd08b7f1a258be6c.zip
FreeBSD-src-bd6fdb8977d9154d972b0403fd08b7f1a258be6c.tar.gz
Merge all the various copies of vmapbuf() and vunmapbuf() into a single
portable copy. Note that pmap_extract() must be used instead of pmap_kextract(). This is precursor work to a reorganization of vmapbuf() to close remaining user/kernel races (which can lead to a panic).
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/aim/vm_machdep.c74
-rw-r--r--sys/powerpc/powerpc/vm_machdep.c74
2 files changed, 0 insertions, 148 deletions
diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c
index c5e4fa5..fc0a30f 100644
--- a/sys/powerpc/aim/vm_machdep.c
+++ b/sys/powerpc/aim/vm_machdep.c
@@ -231,80 +231,6 @@ cpu_throw(void)
}
/*
- * Map an IO request into kernel virtual address space.
- *
- * All requests are (re)mapped into kernel VA space.
- * Notice that we use b_bufsize for the size of the buffer
- * to be mapped. b_bcount might be modified by the driver.
- */
-void
-vmapbuf(struct buf *bp)
-{
- caddr_t addr, kva;
- vm_offset_t pa;
- int pidx;
- struct vm_page *m;
- pmap_t pmap;
-
- GIANT_REQUIRED;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vmapbuf");
-
- pmap = &curproc->p_vmspace->vm_pmap;
- for (addr = (caddr_t)trunc_page(bp->b_data), pidx = 0;
- addr < bp->b_data + bp->b_bufsize;
- addr += PAGE_SIZE, pidx++) {
- /*
- * Do the vm_fault if needed; do the copy-on-write thing
- * when reading stuff off device into memory.
- */
- vm_fault_quick((addr >= bp->b_data) ? addr : bp->b_data,
- (bp->b_iocmd == BIO_READ)?(VM_PROT_READ|VM_PROT_WRITE):VM_PROT_READ);
- pa = trunc_page(pmap_extract(pmap, (vm_offset_t) addr));
- if (pa == 0)
- panic("vmapbuf: page not present");
- m = PHYS_TO_VM_PAGE(pa);
- vm_page_hold(m);
- bp->b_pages[pidx] = m;
- }
- if (pidx > btoc(MAXPHYS))
- panic("vmapbuf: mapped more than MAXPHYS");
- pmap_qenter((vm_offset_t)bp->b_saveaddr, bp->b_pages, pidx);
-
- kva = bp->b_saveaddr;
- bp->b_npages = pidx;
- bp->b_saveaddr = bp->b_data;
- bp->b_data = kva + (((vm_offset_t) bp->b_data) & PAGE_MASK);
-}
-
-/*
- * Free the io map PTEs associated with this IO operation.
- * We also invalidate the TLB entries and restore the original b_addr.
- */
-void
-vunmapbuf(struct buf *bp)
-{
- int pidx;
- int npages;
-
- GIANT_REQUIRED;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
-
- npages = bp->b_npages;
- pmap_qremove(trunc_page((vm_offset_t)bp->b_data),
- npages);
- vm_page_lock_queues();
- for (pidx = 0; pidx < npages; pidx++)
- vm_page_unhold(bp->b_pages[pidx]);
- vm_page_unlock_queues();
-
- bp->b_data = bp->b_saveaddr;
-}
-
-/*
* Reset back to firmware.
*/
void
diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c
index c5e4fa5..fc0a30f 100644
--- a/sys/powerpc/powerpc/vm_machdep.c
+++ b/sys/powerpc/powerpc/vm_machdep.c
@@ -231,80 +231,6 @@ cpu_throw(void)
}
/*
- * Map an IO request into kernel virtual address space.
- *
- * All requests are (re)mapped into kernel VA space.
- * Notice that we use b_bufsize for the size of the buffer
- * to be mapped. b_bcount might be modified by the driver.
- */
-void
-vmapbuf(struct buf *bp)
-{
- caddr_t addr, kva;
- vm_offset_t pa;
- int pidx;
- struct vm_page *m;
- pmap_t pmap;
-
- GIANT_REQUIRED;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vmapbuf");
-
- pmap = &curproc->p_vmspace->vm_pmap;
- for (addr = (caddr_t)trunc_page(bp->b_data), pidx = 0;
- addr < bp->b_data + bp->b_bufsize;
- addr += PAGE_SIZE, pidx++) {
- /*
- * Do the vm_fault if needed; do the copy-on-write thing
- * when reading stuff off device into memory.
- */
- vm_fault_quick((addr >= bp->b_data) ? addr : bp->b_data,
- (bp->b_iocmd == BIO_READ)?(VM_PROT_READ|VM_PROT_WRITE):VM_PROT_READ);
- pa = trunc_page(pmap_extract(pmap, (vm_offset_t) addr));
- if (pa == 0)
- panic("vmapbuf: page not present");
- m = PHYS_TO_VM_PAGE(pa);
- vm_page_hold(m);
- bp->b_pages[pidx] = m;
- }
- if (pidx > btoc(MAXPHYS))
- panic("vmapbuf: mapped more than MAXPHYS");
- pmap_qenter((vm_offset_t)bp->b_saveaddr, bp->b_pages, pidx);
-
- kva = bp->b_saveaddr;
- bp->b_npages = pidx;
- bp->b_saveaddr = bp->b_data;
- bp->b_data = kva + (((vm_offset_t) bp->b_data) & PAGE_MASK);
-}
-
-/*
- * Free the io map PTEs associated with this IO operation.
- * We also invalidate the TLB entries and restore the original b_addr.
- */
-void
-vunmapbuf(struct buf *bp)
-{
- int pidx;
- int npages;
-
- GIANT_REQUIRED;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
-
- npages = bp->b_npages;
- pmap_qremove(trunc_page((vm_offset_t)bp->b_data),
- npages);
- vm_page_lock_queues();
- for (pidx = 0; pidx < npages; pidx++)
- vm_page_unhold(bp->b_pages[pidx]);
- vm_page_unlock_queues();
-
- bp->b_data = bp->b_saveaddr;
-}
-
-/*
* Reset back to firmware.
*/
void
OpenPOWER on IntegriCloud