* implement unmapiodev(), make mapiodev() aware of ppc4xx_tlb_mapiodev()
* we now don't rely on having console linear-mapped (that was terribly broken, really) * also, this can be used as generic ibm4xx mapiodev()/unmapiodev() OK by matt@
This commit is contained in:
parent
3a3624455e
commit
8f274ce5a8
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: evbppc_machdep.c,v 1.7 2005/12/11 12:17:12 christos Exp $ */
|
||||
/* $NetBSD: evbppc_machdep.c,v 1.8 2006/08/31 22:53:40 freza Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001, 2002 Wasabi Systems, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: evbppc_machdep.c,v 1.7 2005/12/11 12:17:12 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: evbppc_machdep.c,v 1.8 2006/08/31 22:53:40 freza Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -83,21 +83,30 @@ __KERNEL_RCSID(0, "$NetBSD: evbppc_machdep.c,v 1.7 2005/12/11 12:17:12 christos
|
||||
int fake_mapiodev = 1;
|
||||
|
||||
/*
|
||||
* Allocate vm space and mapin the I/O address
|
||||
* mapiodev:
|
||||
*
|
||||
* Allocate vm space and mapin the I/O address. Use reserved TLB
|
||||
* mapping if one is found.
|
||||
*/
|
||||
void *
|
||||
mapiodev(paddr_t pa, psize_t len)
|
||||
{
|
||||
void *p;
|
||||
paddr_t faddr;
|
||||
vaddr_t taddr, va;
|
||||
int off;
|
||||
|
||||
/*
|
||||
* Initially we cannot use uvm_ functions, but we still have to map
|
||||
* console..
|
||||
/*
|
||||
* See if we have reserved TLB entry for the pa. This needs to be
|
||||
* true for console as we can't use uvm during early bootstrap.
|
||||
*/
|
||||
if (fake_mapiodev)
|
||||
return (void *)(intptr_t)pa;
|
||||
p = ppc4xx_tlb_mapiodev(pa, len);
|
||||
if (p != NULL)
|
||||
return (p);
|
||||
|
||||
if (fake_mapiodev)
|
||||
panic("mapiodev: no TLB entry reserved for %llx+%llx",
|
||||
(long long)pa, (long long)len);
|
||||
|
||||
faddr = trunc_page(pa);
|
||||
off = pa - faddr;
|
||||
@ -116,3 +125,17 @@ mapiodev(paddr_t pa, psize_t len)
|
||||
pmap_update(pmap_kernel());
|
||||
return (void *)(va + off);
|
||||
}
|
||||
|
||||
void
|
||||
unmapiodev(vaddr_t va, vsize_t sz)
|
||||
{
|
||||
/* Nothing to do for reserved (ie. not uvm_km_alloc'd) mappings. */
|
||||
if (va < VM_MIN_KERNEL_ADDRESS || va > VM_MAX_KERNEL_ADDRESS)
|
||||
return;
|
||||
|
||||
sz = round_page((va & PAGE_MASK) + sz);
|
||||
va = trunc_page(va);
|
||||
|
||||
pmap_kremove(va, sz);
|
||||
uvm_km_free(kernel_map, va, sz, UVM_KMF_VAONLY);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user