summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-06-08 08:09:45 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-06-08 08:09:45 +0000
commit95da2243c76760307b218cb7f05645e68a73e8af (patch)
tree594a78dc6e16ba4f07e3c1bc9c44def6966cf19e /sys/arch/mvme88k
parent0579d34f9bf07b4a6bfebb51a83de3ac8356c01f (diff)
Change the paddr_t pmap_extract(struct pmap *, vaddr_t) interface to
boolean_t pmap_extract(struct pmap *, vaddr_t, paddr_t *). Matches NetBSD. Tested by various people on various platforms.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r--sys/arch/mvme88k/ddb/db_interface.c4
-rw-r--r--sys/arch/mvme88k/dev/if_ie.c15
-rw-r--r--sys/arch/mvme88k/mvme88k/pmap.c49
-rw-r--r--sys/arch/mvme88k/mvme88k/vm_machdep.c63
4 files changed, 55 insertions, 76 deletions
diff --git a/sys/arch/mvme88k/ddb/db_interface.c b/sys/arch/mvme88k/ddb/db_interface.c
index 49bca971001..24b98ae206f 100644
--- a/sys/arch/mvme88k/ddb/db_interface.c
+++ b/sys/arch/mvme88k/ddb/db_interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.c,v 1.8 2001/03/16 00:01:51 miod Exp $ */
+/* $OpenBSD: db_interface.c,v 1.9 2001/06/08 08:09:11 art Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -577,7 +577,7 @@ db_write_bytes(addr, size, data)
#endif
*dst++ = *data++;
}
- physaddr = pmap_extract(kernel_pmap, (vm_offset_t)addr);
+ pmap_extract(kernel_pmap, (vm_offset_t)addr, &physaddr);
cmmu_flush_cache(physaddr, i);
}
diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c
index f42566b9d4d..b1c7d9a4368 100644
--- a/sys/arch/mvme88k/dev/if_ie.c
+++ b/sys/arch/mvme88k/dev/if_ie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ie.c,v 1.10 2001/03/09 05:44:38 smurph Exp $ */
+/* $OpenBSD: if_ie.c,v 1.11 2001/06/08 08:09:13 art Exp $ */
/*-
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -161,8 +161,6 @@ vm_map_t ie_map; /* for obio */
#define NTXBUF 2 /* number of transmit commands */
#define IE_TBUF_SIZE ETHER_MAX_LEN /* length of transmit buffer */
-#define CACHED_TO_PHYS(x) pmap_extract(pmap_kernel(), (vm_offset_t)(x))
-
struct ie_softc {
struct device sc_dev; /* device structure */
struct intrhand sc_ih, sc_failih; /* interrupt info */
@@ -362,8 +360,8 @@ ie_obreset(sc)
ieo->portlow = a >> 16;
delay(1000);
- a = (u_long)CACHED_TO_PHYS(sc->scp) |
- IE_PORT_NEWSCPADDR;
+ pmap_extract(pmap_kernel(), sc->scp, &a);
+ a |= IE_PORT_NEWSCPADDR;
ieo->porthigh = a & 0xffff;
t = 0; t = 1;
ieo->portlow = a >> 16;
@@ -417,8 +415,8 @@ ieattach(parent, self, aux)
/* get the first avaliable etherbuf */
sc->sc_maddr = etherbuf; /* maddr = vaddr */
if (sc->sc_maddr == NULL) panic("ie: too many ethernet boards");
- pa = CACHED_TO_PHYS(sc->sc_maddr);
- if (pa == 0) panic("ie: pmap_extract");
+ if (pmap_extract(pmap_kernel(), sc->sc_maddr, &pa) == FALSE)
+ panic("ie: pmap_extract");
sc->sc_iobase = (caddr_t)pa; /* iobase = paddr (24 bit) */
/*printf("maddrP %x iobaseV %x\n", sc->sc_maddr, sc->sc_iobase);*/
@@ -433,7 +431,8 @@ ieattach(parent, self, aux)
/*printf("scpV %x iscpV %x scbV %x\n", sc->scp, sc->iscp, sc->scb);*/
sc->scp->ie_bus_use = 0x44;
- SWT_32(sc->scp->ie_iscp_ptr, CACHED_TO_PHYS(sc->iscp));
+ pmap_extract(pmap_kernel(), sc->iscp, &pa);
+ SWT_32(sc->scp->ie_iscp_ptr, pa);
/*
* rest of first page is unused (wasted!), rest of ram
* for buffers
diff --git a/sys/arch/mvme88k/mvme88k/pmap.c b/sys/arch/mvme88k/mvme88k/pmap.c
index 6bf3e432933..f647a14b34b 100644
--- a/sys/arch/mvme88k/mvme88k/pmap.c
+++ b/sys/arch/mvme88k/mvme88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.27 2001/05/16 12:49:47 ho Exp $ */
+/* $OpenBSD: pmap.c,v 1.28 2001/06/08 08:09:14 art Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* All rights reserved.
@@ -1709,18 +1709,24 @@ pmap_pinit(pmap_t p)
if (segdt == NULL)
panic("pmap_create: kmem_alloc failure");
+#if !defined(UVM)
+ /* uvm_km_zalloc gives zeroed memory */
/* use pmap zero page to zero it out */
addr = (vm_offset_t)segdt;
for (i=0; i<atop(s); i++) {
- pmap_zero_page(pmap_extract(kernel_pmap, addr));
+ paddr_t pa;
+
+ pmap_extract(kernel_pmap, addr, &pa);
+ pmap_zero_page(pa);
addr += PAGE_SIZE;
}
+#endif
/*
* Initialize pointer to segment table both virtual and physical.
*/
p->sdt_vaddr = segdt;
- p->sdt_paddr = (sdt_entry_t *)pmap_extract(kernel_pmap,(vm_offset_t)segdt);
+ pmap_extract(kernel_pmap, (vaddr_t)segdt, (paddr_t *)&p->sdt_paddr);
if (!PAGE_ALIGNED(p->sdt_paddr)) {
printf("pmap_create: std table = %x\n",(int)p->sdt_paddr);
@@ -2654,7 +2660,6 @@ pmap_expand(pmap_t map, vm_offset_t v)
vm_offset_t pdt_vaddr, pdt_paddr;
sdt_entry_t *sdt;
pt_entry_t *pte;
- vm_offset_t pmap_extract();
if (map == PMAP_NULL) {
panic("pmap_expand: pmap is NULL");
@@ -2688,7 +2693,7 @@ pmap_expand(pmap_t map, vm_offset_t v)
#else
pdt_vaddr = kmem_alloc (kernel_map, PAGE_SIZE);
#endif
- pdt_paddr = pmap_extract(kernel_pmap, pdt_vaddr);
+ pmap_extract(kernel_pmap, pdt_vaddr, &pdt_paddr);
#ifdef MVME188
if (cputyp == CPU_188) {
@@ -3110,6 +3115,7 @@ pmap_unwire(pmap_t map, vm_offset_t v)
* Parameters:
* pmap pointer to pmap structure
* va virtual address
+ * pap storage for result.
*
* Calls:
* PMAP_LOCK, PMAP_UNLOCK
@@ -3125,12 +3131,12 @@ pmap_unwire(pmap_t map, vm_offset_t v)
* then 0 address is returned. Otherwise, the physical page address from
* the PTE is returned.
*/
-vm_offset_t
-pmap_extract(pmap_t pmap, vm_offset_t va)
+boolean_t
+pmap_extract(pmap_t pmap, vm_offset_t va, paddr_t *pap)
{
- register pt_entry_t *pte;
- register vm_offset_t pa;
- register int i;
+ pt_entry_t *pte;
+ paddr_t pa;
+ int i;
int spl;
if (pmap == PMAP_NULL)
@@ -3142,28 +3148,31 @@ pmap_extract(pmap_t pmap, vm_offset_t va)
if (pmap == kernel_pmap && batc_used > 0)
for (i = batc_used-1; i > 0; i--)
if (batc_entry[i].lba == M88K_BTOBLK(va)) {
- pa = (batc_entry[i].pba << BATC_BLKSHIFT) |
+ *pap = (batc_entry[i].pba << BATC_BLKSHIFT) |
(va & BATC_BLKMASK );
- return (pa);
+ return (TRUE);
}
PMAP_LOCK(pmap, spl);
- if ((pte = pmap_pte(pmap, va)) == PT_ENTRY_NULL)
- pa = (vm_offset_t) 0;
- else {
+ if ((pte = pmap_pte(pmap, va)) == PT_ENTRY_NULL) {
+ goto fail;
+ } else {
if (PDT_VALID(pte))
pa = M88K_PTOB(pte->pfn);
else
- pa = (vm_offset_t) 0;
+ goto fail;
}
- if (pa)
- pa |= (va & M88K_PGOFSET); /* offset within page */
+ pa |= (va & M88K_PGOFSET); /* offset within page */
+ *pap = pa;
PMAP_UNLOCK(pmap, spl);
- return (pa);
-} /* pamp_extract() */
+ return (TRUE);
+fail:
+ PMAP_UNLOCK(pmap, spl);
+ return (FALSE);
+} /* pmap_extract() */
/*
a version for the kernel debugger
diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c
index 828a9e94356..2a502a4d25b 100644
--- a/sys/arch/mvme88k/mvme88k/vm_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.24 2001/05/06 00:45:54 art Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.25 2001/06/08 08:09:16 art Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -243,7 +243,8 @@ vmapbuf(bp, len)
vm_size_t len;
{
register caddr_t addr;
- register vm_offset_t pa, kva, off;
+ register vm_offset_t kva, off;
+ vm_offset_t pa;
struct pmap *pmap;
#ifdef DIAGNOSTIC
@@ -279,8 +280,7 @@ vmapbuf(bp, len)
bp->b_data = (caddr_t)(kva + off);
while (len > 0) {
- pa = pmap_extract(pmap, (vm_offset_t)addr);
- if (pa == 0)
+ if (pmap_extract(pmap, (vm_offset_t)addr, &pa) == FALSE)
panic("vmapbuf: null page frame");
pmap_enter(vm_map_pmap(phys_map), kva, pa,
VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
@@ -502,22 +502,26 @@ badpaddr(caddr_t pa, int size)
* Move pages from one kernel virtual address to another.
*/
void
-pagemove(caddr_t from, caddr_t to, size_t size)
+pagemove(from, to, size)
+ caddr_t from, to;
+ size_t size;
{
- register vm_offset_t pa;
+ vm_offset_t pa;
#ifdef DEBUG
if ((size & PAGE_MASK) != 0)
panic("pagemove");
#endif
while (size > 0) {
- pa = pmap_extract(kernel_pmap, (vm_offset_t)from);
+ pmap_extract(kernel_pmap, (vm_offset_t)from, &pa);
#ifdef DEBUG
+#if 0
if (pa == 0)
panic("pagemove 2");
- if (pmap_extract(kernel_pmap, (vm_offset_t)to) != 0)
+ if (pmap_extract(kernel_pmap, (vm_offset_t)to, XXX) != 0)
panic("pagemove 3");
#endif
+#endif
pmap_remove(kernel_pmap,
(vm_offset_t)from, (vm_offset_t)from + NBPG);
pmap_enter(kernel_pmap,
@@ -530,45 +534,12 @@ pagemove(caddr_t from, caddr_t to, size_t size)
}
u_int
-kvtop(vm_offset_t va)
+kvtop(va)
+ vm_offset_t va;
{
+ vm_offset_t pa;
extern pmap_t kernel_pmap;
- return ((u_int)pmap_extract(kernel_pmap, va));
-}
-/*
- * Map `size' bytes of physical memory starting at `paddr' into
- * kernel VA space at `vaddr'. Read/write and cache-inhibit status
- * are specified by `prot'.
- */
-#if 0
-physaccess(vaddr, paddr, size, prot)
- void *vaddr, *paddr;
- register int size, prot;
-{
-/* register pt_entry_t *pte;*/
- pte_template_t *pte;
- register u_int page;
-
- pte = kvtopte(vaddr);
- page = (u_int)paddr & PG_FRAME;
- for (size = btoc(size); size; size--) {
- *pte++ = PG_V | prot | page;
- page += NBPG;
- }
- TBIAS();
+ pmap_extract(kernel_pmap, va, &pa);
+ return ((u_int)pa);
}
-
-physunaccess(vaddr, size)
- caddr_t vaddr;
- register int size;
-{
- register pt_entry_t *pte;
-
- pte = kvtopte(vaddr);
- for (size = btoc(size); size; size--)
- *pte++ = PG_NV;
- TBIAS();
-}
-
-#endif