1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-23 16:01:42 +00:00

Remove the duplicated implementations of some bus_space functions and use

the essentially identical generic implementations instead.  The generic
implementations differ only in the spelling of a couple variable names
and some formatting differences.
This commit is contained in:
Ian Lepore 2013-11-04 16:16:40 +00:00
parent bf10ab6b9c
commit 2b3f8f22e1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257639
2 changed files with 8 additions and 91 deletions

View File

@ -1,4 +1,6 @@
# $FreeBSD$
arm/arm/bus_space_asm_generic.S standard
arm/arm/bus_space_generic.c standard
arm/arm/cpufunc_asm_arm9.S standard
arm/arm/irq_dispatch.S standard
arm/s3c2xx0/board_ln2410sbc.c optional board_ln2410sbc

View File

@ -89,7 +89,6 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
/* Prototypes for all the bus_space structure functions */
bs_protos(s3c2xx0);
bs_protos(generic);
bs_protos(generic_armv4);
@ -98,16 +97,16 @@ struct bus_space s3c2xx0_bs_tag = {
(void *) 0,
/* mapping/unmapping */
s3c2xx0_bs_map,
s3c2xx0_bs_unmap,
s3c2xx0_bs_subregion,
generic_bs_map,
generic_bs_unmap,
generic_bs_subregion,
/* allocation/deallocation */
s3c2xx0_bs_alloc, /* not implemented */
s3c2xx0_bs_free, /* not implemented */
generic_bs_alloc, /* not implemented */
generic_bs_free, /* not implemented */
/* barrier */
s3c2xx0_bs_barrier,
generic_bs_barrier,
/* read (single) */
generic_bs_r_1,
@ -164,87 +163,3 @@ struct bus_space s3c2xx0_bs_tag = {
NULL,
};
int
s3c2xx0_bs_map(void *t, bus_addr_t bpa, bus_size_t size,
int flag, bus_space_handle_t * bshp)
{
u_long startpa, endpa, pa;
vm_offset_t va;
pt_entry_t *pte;
const struct pmap_devmap *pd;
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);
va = kva_alloc(endpa - startpa);
if (!va)
return (ENOMEM);
*bshp = (bus_space_handle_t) (va + (bpa - startpa));
for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
pmap_kenter(va, pa);
pte = vtopte(va);
if ((flag & BUS_SPACE_MAP_CACHEABLE) == 0)
*pte &= ~L2_S_CACHE_MASK;
}
return (0);
}
void
s3c2xx0_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size)
{
vm_offset_t va, endva, origva;
if (pmap_devmap_find_va((vm_offset_t)h, size) != NULL) {
/* Device was statically mapped; nothing to do. */
return;
}
endva = round_page((vm_offset_t)h + size);
origva = va = trunc_page((vm_offset_t)h);
while (va < endva) {
pmap_kremove(va);
va += PAGE_SIZE;
}
kva_free(origva, endva - origva);
}
int
s3c2xx0_bs_subregion(void *t, bus_space_handle_t bsh, bus_size_t offset,
bus_size_t size, bus_space_handle_t * nbshp)
{
*nbshp = bsh + offset;
return (0);
}
void
s3c2xx0_bs_barrier(void *t, bus_space_handle_t bsh, bus_size_t offset,
bus_size_t len, int flags)
{
/* Nothing to do. */
}
int
s3c2xx0_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
bus_size_t size, bus_size_t alignment, bus_size_t boundary,
int flags, bus_addr_t * bpap, bus_space_handle_t * bshp)
{
panic("s3c2xx0_io_bs_alloc(): not implemented\n");
}
void
s3c2xx0_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)
{
panic("s3c2xx0_io_bs_free(): not implemented\n");
}