diff options
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 43 | ||||
-rw-r--r-- | sys/arch/i386/i386/rbus_machdep.c | 66 | ||||
-rw-r--r-- | sys/arch/i386/include/bus.h | 5 | ||||
-rw-r--r-- | sys/arch/i386/include/rbus_machdep.h | 5 |
4 files changed, 48 insertions, 71 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 5ad884d0cff..7b48e132b45 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.290 2004/04/19 22:26:22 tom Exp $ */ +/* $OpenBSD: machdep.c,v 1.291 2004/05/04 17:06:33 grange Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -3257,6 +3257,47 @@ ok: } } +void +_bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size, + bus_addr_t *adrp) +{ + u_long va, endva; + bus_addr_t bpa; + + /* + * Find the correct bus physical address. + */ + if (t == I386_BUS_SPACE_IO) { + bpa = bsh; + } else if (t == I386_BUS_SPACE_MEM) { + bpa = (bus_addr_t)ISA_PHYSADDR(bsh); + if (IOM_BEGIN <= bpa && bpa <= IOM_END) + goto ok; + + va = i386_trunc_page(bsh); + endva = i386_round_page(bsh + size); + +#ifdef DIAGNOSTIC + if (endva <= va) + panic("_bus_space_unmap: overflow"); +#endif + + (void) pmap_extract(pmap_kernel(), va, &bpa); + bpa += (bsh & PGOFSET); + + /* + * Free the kernel virtual mapping. + */ + uvm_km_free(kernel_map, va, endva - va); + } else + panic("bus_space_unmap: bad bus space tag"); + +ok: + if (adrp != NULL) { + *adrp = bpa; + } +} + void bus_space_free(t, bsh, size) bus_space_tag_t t; diff --git a/sys/arch/i386/i386/rbus_machdep.c b/sys/arch/i386/i386/rbus_machdep.c index 8c148d6df72..e4c5c08283e 100644 --- a/sys/arch/i386/i386/rbus_machdep.c +++ b/sys/arch/i386/i386/rbus_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rbus_machdep.c,v 1.15 2002/07/23 17:53:24 drahn Exp $ */ +/* $OpenBSD: rbus_machdep.c,v 1.16 2004/05/04 17:06:33 grange Exp $ */ /* $NetBSD: rbus_machdep.c,v 1.2 1999/10/15 06:43:06 haya Exp $ */ /* @@ -54,70 +54,6 @@ /********************************************************************** - * void _bus_space_unmap(bus_space_tag bst, bus_space_handle bsh, - * bus_size_t size, bus_addr_t *adrp) - * - * This function unmaps memory- or io-space mapped by the function - * _bus_space_map(). This function works nearly as same as - * bus_space_map(), but this function does not ask kernel - * built-in extents and returns physical address of the bus space, - * for the convenience of the extra extent manager. - * - * I suppose this function should be in arch/i386/i386/machdep.c, - * but it is not. - **********************************************************************/ -void -_bus_space_unmap(t, bsh, size, adrp) - bus_space_tag_t t; - bus_space_handle_t bsh; - bus_size_t size; - bus_addr_t *adrp; -{ - u_long va, endva; - bus_addr_t bpa; - - /* - * Find the correct extent and bus physical address. - */ - if (t == I386_BUS_SPACE_IO) { - bpa = bsh; - } else if (t == I386_BUS_SPACE_MEM) { - if (bsh >= atdevbase && (bsh + size) <= (atdevbase + IOM_SIZE)) { - bpa = (bus_addr_t)ISA_PHYSADDR(bsh); - } else { - - va = i386_trunc_page(bsh); - endva = i386_round_page(bsh + size); - -#ifdef DIAGNOSTIC - if (endva <= va) { - panic("_i386_memio_unmap: overflow"); - } -#endif - - if (pmap_extract(pmap_kernel(), va, &bpa) == FALSE) { - panic("_i386_memio_unmap:i386/rbus_machdep.c wrong virtual address"); - } - bpa += (bsh & PGOFSET); - - /* - * Free the kernel virtual mapping. - */ - uvm_km_free(kernel_map, va, endva - va); - } - } else { - panic("_i386_memio_unmap: bad bus space tag"); - } - - if (adrp != NULL) { - *adrp = bpa; - } -} - - - - -/********************************************************************** * rbus_tag_t rbus_fakeparent_mem(struct pci_attach_args *pa) * * This function makes an rbus tag for memory space. This rbus tag diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h index f88ed6afd10..13c9544d312 100644 --- a/sys/arch/i386/include/bus.h +++ b/sys/arch/i386/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.35 2003/04/17 03:42:14 drahn Exp $ */ +/* $OpenBSD: bus.h,v 1.36 2004/05/04 17:06:33 grange Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -100,6 +100,9 @@ int _bus_space_map(bus_space_tag_t t, bus_addr_t addr, bus_size_t size, int cacheable, bus_space_handle_t *bshp); void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size); +/* like bus_space_unmap(), but without extent map deallocation */ +void _bus_space_unmap(bus_space_tag_t, bus_space_handle_t, + bus_size_t, bus_addr_t *); int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp); diff --git a/sys/arch/i386/include/rbus_machdep.h b/sys/arch/i386/include/rbus_machdep.h index 70725e6f0e2..cc214020061 100644 --- a/sys/arch/i386/include/rbus_machdep.h +++ b/sys/arch/i386/include/rbus_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rbus_machdep.h,v 1.3 2002/07/23 17:53:24 drahn Exp $ */ +/* $OpenBSD: rbus_machdep.h,v 1.4 2004/05/04 17:06:33 grange Exp $ */ /* $NetBSD: rbus_machdep.h,v 1.2 1999/10/15 06:43:05 haya Exp $ */ /* @@ -37,9 +37,6 @@ struct pci_attach_args; /* XXX */ -void _bus_space_unmap(bus_space_tag_t, bus_space_handle_t, - bus_size_t, bus_addr_t *); - #define md_space_map(bt, physaddr, size, flags, bshp) \ _bus_space_map((bt), (physaddr), (size), (flags), (bshp)) |