diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-06-24 13:24:22 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-06-24 13:24:22 +0000 |
commit | 1fa8ffa2433edf118f75207c291a2a0162163691 (patch) | |
tree | 6dfa66ce418655c636a6fc75967a91b3951d4d46 /sys/arch/mac68k | |
parent | e9eab0aae49664d0c130f1b60640f862d325d438 (diff) |
Use pmap_enter_cache() instead of physacc() in bus_mem_add_mapping(), and let
physacc() die. As a bonus, kvtop() dies too.
Diffstat (limited to 'sys/arch/mac68k')
-rw-r--r-- | sys/arch/mac68k/include/cpu.h | 6 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/bus_space.c | 26 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/locore.s | 6 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/vm_machdep.c | 54 |
4 files changed, 17 insertions, 75 deletions
diff --git a/sys/arch/mac68k/include/cpu.h b/sys/arch/mac68k/include/cpu.h index 25445986629..795d72f13a3 100644 --- a/sys/arch/mac68k/include/cpu.h +++ b/sys/arch/mac68k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.38 2006/06/11 20:48:13 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.39 2006/06/24 13:24:20 miod Exp $ */ /* $NetBSD: cpu.h,v 1.45 1997/02/10 22:13:40 scottr Exp $ */ /* @@ -288,10 +288,6 @@ void mac68k_set_bell_callback(int (*)(void *, int, int, int), void *); int mac68k_ring_bell(int, int, int); u_int get_mapping(void); -/* vm_machdep.c */ -void physaccess(caddr_t, caddr_t, register int, register int); -void physunaccess(caddr_t, register int); - #endif #endif /* _CPU_MACHINE_ */ diff --git a/sys/arch/mac68k/mac68k/bus_space.c b/sys/arch/mac68k/mac68k/bus_space.c index e17bc0805be..ebef9574021 100644 --- a/sys/arch/mac68k/mac68k/bus_space.c +++ b/sys/arch/mac68k/mac68k/bus_space.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_space.c,v 1.21 2006/06/11 20:57:44 miod Exp $ */ +/* $OpenBSD: bus_space.c,v 1.22 2006/06/24 13:24:21 miod Exp $ */ /* $NetBSD: bus_space.c,v 1.5 1999/03/26 23:41:30 mycroft Exp $ */ /*- @@ -155,8 +155,7 @@ bus_mem_add_mapping(bpa, size, flags, bshp) { u_long pa, endpa; vaddr_t va; - pt_entry_t *pte; - extern void TBIA(void); + pt_entry_t pte; pa = trunc_page(bpa); endpa = round_page((bpa + size) - 1); @@ -197,17 +196,14 @@ bus_mem_add_mapping(bpa, size, flags, bshp) bshp->bssr2 = mac68k_bssr2; bshp->bssr4 = mac68k_bssr4; - for (; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { - pmap_enter(pmap_kernel(), va, pa, - VM_PROT_READ | VM_PROT_WRITE, - VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); - pte = kvtopte(va); - if ((flags & BUS_SPACE_MAP_CACHEABLE)) - *pte &= ~PG_CI; - else - *pte |= PG_CI; - TBIA(); - } + if (flags & BUS_SPACE_MAP_CACHEABLE) + pte = PG_CWT; + else + pte = PG_CI; + + for (; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) + pmap_enter_cache(pmap_kernel(), va, pa, + UVM_PROT_RW, UVM_PROT_RW | PMAP_WIRED, pte); pmap_update(pmap_kernel()); return 0; @@ -236,6 +232,8 @@ bus_space_unmap(t, bsh, size) /* * Free the kernel virtual mapping. */ + pmap_remove(pmap_kernel(), va, endva); + pmap_update(pmap_kernel()); uvm_km_free(kernel_map, va, endva - va); if (extent_free(iomem_ex, bpa, size, diff --git a/sys/arch/mac68k/mac68k/locore.s b/sys/arch/mac68k/mac68k/locore.s index c6c3158ac3f..0aca5617b53 100644 --- a/sys/arch/mac68k/mac68k/locore.s +++ b/sys/arch/mac68k/mac68k/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.53 2006/06/11 20:57:44 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.54 2006/06/24 13:24:21 miod Exp $ */ /* $NetBSD: locore.s,v 1.103 1998/07/09 06:02:50 scottr Exp $ */ /* @@ -330,7 +330,7 @@ Lloaddone: movl a1,_C_LABEL(curpcb) | proc0 is running /* flush TLB and turn on caches */ - jbsr _C_LABEL(TBIA) | invalidate TLB + jbsr _ASM_LABEL(TBIA) | invalidate TLB cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jeq Lnocache0 | yes, cache already on movl #CACHE_ON,d0 @@ -1162,7 +1162,7 @@ Lsldone: /* * Invalidate entire TLB. */ -ENTRY(TBIA) +ASENTRY_NOPROFILE(TBIA) #if defined(M68040) cmpl #MMU_68040,_C_LABEL(mmutype) | 68040? jne Lmotommu3 | no, skip diff --git a/sys/arch/mac68k/mac68k/vm_machdep.c b/sys/arch/mac68k/mac68k/vm_machdep.c index 72f925a6f44..f4421428e43 100644 --- a/sys/arch/mac68k/mac68k/vm_machdep.c +++ b/sys/arch/mac68k/mac68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.36 2006/06/23 13:46:05 mickey Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.37 2006/06/24 13:24:21 miod Exp $ */ /* $NetBSD: vm_machdep.c,v 1.29 1998/07/28 18:34:55 thorpej Exp $ */ /* @@ -230,58 +230,6 @@ pagemove(from, to, size) } /* - * 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'. - */ -void -physaccess(vaddr, paddr, size, prot) - caddr_t vaddr, paddr; - int size, prot; -{ - pt_entry_t *pte; - 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(); -} - -void -physunaccess(vaddr, size) - caddr_t vaddr; - int size; -{ - pt_entry_t *pte; - - pte = kvtopte(vaddr); - for (size = btoc(size); size; size--) - *pte++ = PG_NV; - TBIAS(); -} - -int kvtop(caddr_t addr); - -/* - * Convert kernel VA to physical address - */ -int -kvtop(addr) - caddr_t addr; -{ - paddr_t pa; - - if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE) - panic("kvtop: zero page frame"); - - return((int)pa); -} - -/* * Map an IO request into kernel virtual address space. * * XXX we allocate KVA space by using kmem_alloc_wait which we know |