use pmap_k{enter_pa,remove}() where appropriate.

This commit is contained in:
chs 2001-10-03 09:40:12 +00:00
parent f657918fda
commit 4dcf281923
4 changed files with 24 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.154 2001/09/28 11:59:53 chs Exp $ */ /* $NetBSD: autoconf.c,v 1.155 2001/10/03 09:40:12 chs Exp $ */
/* /*
* Copyright (c) 1996 * Copyright (c) 1996
@ -330,9 +330,9 @@ bootstrap()
if (CPU_ISSUN4OR4C) { if (CPU_ISSUN4OR4C) {
/* Map Interrupt Enable Register */ /* Map Interrupt Enable Register */
pmap_enter(pmap_kernel(), INTRREG_VA, pmap_kenter_pa(INTRREG_VA,
INT_ENABLE_REG_PHYSADR | PMAP_NC | PMAP_OBIO, INT_ENABLE_REG_PHYSADR | PMAP_NC | PMAP_OBIO,
VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); VM_PROT_READ | VM_PROT_WRITE);
pmap_update(pmap_kernel()); pmap_update(pmap_kernel());
/* Disable all interrupts */ /* Disable all interrupts */
*((unsigned char *)INTRREG_VA) = 0; *((unsigned char *)INTRREG_VA) = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.123 2001/09/26 20:53:08 eeh Exp $ */ /* $NetBSD: cpu.c,v 1.124 2001/10/03 09:40:12 chs Exp $ */
/* /*
* Copyright (c) 1996 * Copyright (c) 1996
@ -202,9 +202,7 @@ alloc_cpuinfo()
/* Map the pages */ /* Map the pages */
for (m = TAILQ_FIRST(&mlist); m != NULL; m = TAILQ_NEXT(m, pageq)) { for (m = TAILQ_FIRST(&mlist); m != NULL; m = TAILQ_NEXT(m, pageq)) {
paddr_t pa = VM_PAGE_TO_PHYS(m); paddr_t pa = VM_PAGE_TO_PHYS(m);
pmap_enter(pmap_kernel(), va, pa, pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
VM_PROT_READ|VM_PROT_WRITE,
VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
va += NBPG; va += NBPG;
} }
pmap_update(pmap_kernel()); pmap_update(pmap_kernel());

View File

@ -1,4 +1,4 @@
/* $NetBSD: iommu.c,v 1.58 2001/09/28 11:59:53 chs Exp $ */ /* $NetBSD: iommu.c,v 1.59 2001/10/03 09:40:12 chs Exp $ */
/* /*
* Copyright (c) 1996 * Copyright (c) 1996
@ -259,8 +259,7 @@ iommu_attach(parent, self, aux)
/* Map the pages */ /* Map the pages */
for (; m != NULL; m = TAILQ_NEXT(m,pageq)) { for (; m != NULL; m = TAILQ_NEXT(m,pageq)) {
paddr_t pa = VM_PAGE_TO_PHYS(m); paddr_t pa = VM_PAGE_TO_PHYS(m);
pmap_enter(pmap_kernel(), va, pa | PMAP_NC, pmap_kenter_pa(va, pa | PMAP_NC, VM_PROT_READ | VM_PROT_WRITE);
VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
va += NBPG; va += NBPG;
} }
pmap_update(pmap_kernel()); pmap_update(pmap_kernel());
@ -838,8 +837,7 @@ iommu_dmamem_map(t, segs, nsegs, size, kvap, flags)
panic("iommu_dmamem_map: size botch"); panic("iommu_dmamem_map: size botch");
addr = VM_PAGE_TO_PHYS(m); addr = VM_PAGE_TO_PHYS(m);
pmap_enter(pmap_kernel(), va, addr | cbit, pmap_kenter_pa(va, addr | cbit, VM_PROT_READ | VM_PROT_WRITE);
VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
#if 0 #if 0
if (flags & BUS_DMA_COHERENT) if (flags & BUS_DMA_COHERENT)
/* XXX */; /* XXX */;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.186 2001/10/03 09:37:23 chs Exp $ */ /* $NetBSD: machdep.c,v 1.187 2001/10/03 09:40:12 chs Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -238,20 +238,18 @@ cpu_startup()
/* Map first 8192 */ /* Map first 8192 */
while (va < va0 + 8192) { while (va < va0 + 8192) {
pmap_enter(pmap_kernel(), va, pa, pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
pa += PAGE_SIZE; pa += PAGE_SIZE;
va += PAGE_SIZE; va += PAGE_SIZE;
} }
pmap_update(pmap_kernel()); pmap_update(pmap_kernel());
/* Map the rest of the pages */ /* Map the rest of the pages */
for (m = TAILQ_FIRST(&mlist); m != NULL; m = TAILQ_NEXT(m,pageq)) { TAILQ_FOREACH(m, &mlist ,pageq) {
if (va >= va0 + size) if (va >= va0 + size)
panic("cpu_start: memory buffer size botch"); panic("cpu_start: memory buffer size botch");
pa = VM_PAGE_TO_PHYS(m); pa = VM_PAGE_TO_PHYS(m);
pmap_enter(pmap_kernel(), va, pa, pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
va += PAGE_SIZE; va += PAGE_SIZE;
} }
pmap_update(pmap_kernel()); pmap_update(pmap_kernel());
@ -323,7 +321,7 @@ cpu_startup()
panic("cpu_startup: " panic("cpu_startup: "
"not enough RAM for buffer cache"); "not enough RAM for buffer cache");
pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg), pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ|VM_PROT_WRITE); VM_PROT_READ | VM_PROT_WRITE);
curbuf += PAGE_SIZE; curbuf += PAGE_SIZE;
curbufsize -= PAGE_SIZE; curbufsize -= PAGE_SIZE;
} }
@ -1514,6 +1512,7 @@ no_fit:
for (; buflen > 0; ) { for (; buflen > 0; ) {
paddr_t pa; paddr_t pa;
/* /*
* Get the physical address for this page. * Get the physical address for this page.
*/ */
@ -1532,9 +1531,8 @@ no_fit:
pa |= PG_IOC; pa |= PG_IOC;
#endif #endif
#endif #endif
pmap_enter(pmap_kernel(), dva, pmap_kenter_pa(dva, (pa & -pagesz) | PMAP_NC,
(pa & -pagesz) | PMAP_NC, VM_PROT_READ | VM_PROT_WRITE);
VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
dva += pagesz; dva += pagesz;
va += sgsize; va += sgsize;
@ -1603,9 +1601,8 @@ sun4_dmamap_load_raw(t, map, segs, nsegs, size, flags)
pa |= PG_IOC; pa |= PG_IOC;
#endif #endif
#endif #endif
pmap_enter(pmap_kernel(), dva, pmap_kenter_pa(dva, (pa & -pagesz) | PMAP_NC,
(pa & -pagesz) | PMAP_NC, VM_PROT_READ | VM_PROT_WRITE);
VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
dva += pagesz; dva += pagesz;
sgsize -= pagesz; sgsize -= pagesz;
@ -1645,7 +1642,7 @@ sun4_dmamap_unload(t, map)
dva = segs[i].ds_addr & -PAGE_SIZE; dva = segs[i].ds_addr & -PAGE_SIZE;
len = segs[i]._ds_sgsize; len = segs[i]._ds_sgsize;
pmap_remove(pmap_kernel(), dva, dva + len); pmap_kremove(dva, len);
if ((flags & BUS_DMA_24BIT) != 0) { if ((flags & BUS_DMA_24BIT) != 0) {
s = splhigh(); s = splhigh();
@ -1694,15 +1691,14 @@ sun4_dmamem_map(t, segs, nsegs, size, kvap, flags)
*kvap = (caddr_t)va; *kvap = (caddr_t)va;
mlist = segs[0]._ds_mlist; mlist = segs[0]._ds_mlist;
for (m = TAILQ_FIRST(mlist); m != NULL; m = TAILQ_NEXT(m,pageq)) { TAILQ_FOREACH(m, mlist, pageq) {
paddr_t pa; paddr_t pa;
if (size == 0) if (size == 0)
panic("sun4_dmamem_map: size botch"); panic("sun4_dmamem_map: size botch");
pa = VM_PAGE_TO_PHYS(m); pa = VM_PAGE_TO_PHYS(m);
pmap_enter(pmap_kernel(), va, pa | PMAP_NC, pmap_kenter_pa(va, pa | PMAP_NC, VM_PROT_READ | VM_PROT_WRITE);
VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
va += PAGE_SIZE; va += PAGE_SIZE;
size -= PAGE_SIZE; size -= PAGE_SIZE;
@ -1792,8 +1788,8 @@ static vaddr_t iobase;
pmtype = PMAP_IOENC(iospace); pmtype = PMAP_IOENC(iospace);
do { do {
pmap_enter(pmap_kernel(), v, pa | pmtype | PMAP_NC, pmap_kenter_pa(v, pa | pmtype | PMAP_NC,
VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); VM_PROT_READ | VM_PROT_WRITE);
v += PAGE_SIZE; v += PAGE_SIZE;
pa += PAGE_SIZE; pa += PAGE_SIZE;
} while ((size -= PAGE_SIZE) > 0); } while ((size -= PAGE_SIZE) > 0);
@ -1808,9 +1804,8 @@ sparc_bus_unmap(t, bh, size)
bus_space_handle_t bh; bus_space_handle_t bh;
{ {
vaddr_t va = trunc_page((vaddr_t)bh); vaddr_t va = trunc_page((vaddr_t)bh);
vaddr_t endva = va + round_page(size);
pmap_remove(pmap_kernel(), va, endva); pmap_kremove(va, round_page(size));
pmap_update(pmap_kernel()); pmap_update(pmap_kernel());
return (0); return (0);
} }