Date: Mon, 29 May 2006 08:56:22 GMT From: Kevin Lo <kevlo@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 98054 for review Message-ID: <200605290856.k4T8uMUx076522@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=98054 Change 98054 by kevlo@kevlo_rtsl on 2006/05/29 08:55:21 Implement s3c2xx0_bs_unmap. Affected files ... .. //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2xx0_space.c#2 edit Differences ... ==== //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2xx0_space.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $NetBSD: s3c2xx0_space.c,v 1.3 2003/09/03 03:15:02 mycroft Exp $ */ +/* $NetBSD: s3c2xx0_space.c,v 1.7 2005/11/24 13:08:32 yamt Exp $ */ /* * Copyright (c) 2002 Fujitsu Component Limited @@ -74,29 +74,24 @@ */ #include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> -#include <sys/queue.h> -#include <sys/types.h> -#include <sys/lock.h> -#include <sys/mutex.h> +#include <sys/bus.h> #include <vm/vm.h> +#include <vm/vm_kern.h> #include <vm/pmap.h> +#include <vm/vm_page.h> #include <vm/vm_extern.h> -#include <vm/vm_kern.h> -#include <machine/vmparam.h> #include <machine/bus.h> -#include <machine/pmap.h> -#include <machine/vmparam.h> /* Prototypes for all the bus_space structure functions */ bs_protos(s3c2xx0); bs_protos(generic); bs_protos(generic_armv4); -bs_protos(bs_notimpl); struct bus_space s3c2xx0_bs_tag = { /* cookie */ @@ -176,13 +171,14 @@ u_long startpa, endpa, pa; vm_offset_t va; pt_entry_t *pte; + const struct pmap_devmap *pd; - if ((u_long) bpa > (u_long) KERNBASE) { - /* Some IO registers (ex. UART ports for console) are mapped - * to fixed address by board specific routine. */ - *bshp = bpa; - return (0); + if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) { + /* Device was statically mapped. */ + *bshp = pd->pd_va + (bpa - pd->pd_pa); + return 0; } + startpa = trunc_page(bpa); endpa = round_page(bpa + size); @@ -200,18 +196,29 @@ if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0) *pte &= ~L2_S_CACHE_MASK; } - return (0); } void s3c2xx0_bs_unmap(void *t, bus_size_t size) { + vm_offset_t va, endva; + + if (pmap_devmap_find_va((vm_offset_t)t, size) != NULL) { + /* Device was statically mapped; nothing to do. */ + return; + } - /* Nothing to do. */ + endva = round_page((vm_offset_t)t + size); + va = trunc_page((vm_offset_t)t); + + while (va < endva) { + pmap_kremove(va); + va += PAGE_SIZE; + } + kmem_free(kernel_map, va, endva - va); } - int s3c2xx0_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, bus_space_handle_t * nbshp) @@ -241,6 +248,5 @@ void s3c2xx0_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) { - panic("s3c2xx0_io_bs_free(): not implemented\n"); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605290856.k4T8uMUx076522>