We don't need at91_bs_tag. arm_base_bs_tag works now that we have

better dynamic device mapping that didn't exit when we started this
port. Remove it, since everything works w/o it.
This commit is contained in:
Warner Losh 2016-01-16 05:47:34 +00:00
parent 01bab39427
commit 8046b4f5b5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=294133
5 changed files with 8 additions and 167 deletions

View File

@ -54,54 +54,6 @@ __FBSDID("$FreeBSD$");
uint32_t at91_master_clock;
static int
at91_bs_map(bus_space_tag_t tag, bus_addr_t bpa, bus_size_t size, int flags,
bus_space_handle_t *bshp)
{
vm_paddr_t pa, endpa;
pa = trunc_page(bpa);
if (pa >= AT91_PA_BASE + 0xff00000) {
*bshp = bpa - AT91_PA_BASE + AT91_BASE;
return (0);
}
if (pa >= AT91_BASE + 0xff00000) {
*bshp = bpa;
return (0);
}
endpa = round_page(bpa + size);
*bshp = (vm_offset_t)pmap_mapdev(pa, endpa - pa) + (bpa - pa);
return (0);
}
static void
at91_bs_unmap(bus_space_tag_t tag, bus_space_handle_t h, bus_size_t size)
{
vm_offset_t va;
va = (vm_offset_t)h;
if (va >= AT91_BASE && va <= AT91_BASE + 0xff00000)
return;
pmap_unmapdev(va, size);
}
static int
at91_bs_subregion(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset,
bus_size_t size, bus_space_handle_t *nbshp)
{
*nbshp = bsh + offset;
return (0);
}
static void
at91_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size, bus_size_t b,
int a)
{
}
struct arm32_dma_range *
bus_dma_get_range(void)
{
@ -115,115 +67,6 @@ bus_dma_get_range_nb(void)
return (0);
}
bs_protos(generic);
struct bus_space at91_bs_tag = {
/* privdata is whatever the implementer wants; unused in base tag */
.bs_privdata = NULL,
/* mapping/unmapping */
.bs_map = at91_bs_map,
.bs_unmap = at91_bs_unmap,
.bs_subregion = at91_bs_subregion,
/* allocation/deallocation */
.bs_alloc = generic_bs_alloc,
.bs_free = generic_bs_free,
/* barrier */
.bs_barrier = at91_barrier,
/* read (single) */
.bs_r_1 = NULL, /* Use inline code in bus.h */
.bs_r_2 = NULL, /* Use inline code in bus.h */
.bs_r_4 = NULL, /* Use inline code in bus.h */
.bs_r_8 = NULL, /* Use inline code in bus.h */
/* read multiple */
.bs_rm_1 = generic_bs_rm_1,
.bs_rm_2 = generic_bs_rm_2,
.bs_rm_4 = generic_bs_rm_4,
.bs_rm_8 = BS_UNIMPLEMENTED,
/* read region */
.bs_rr_1 = generic_bs_rr_1,
.bs_rr_2 = generic_bs_rr_2,
.bs_rr_4 = generic_bs_rr_4,
.bs_rr_8 = BS_UNIMPLEMENTED,
/* write (single) */
.bs_w_1 = NULL, /* Use inline code in bus.h */
.bs_w_2 = NULL, /* Use inline code in bus.h */
.bs_w_4 = NULL, /* Use inline code in bus.h */
.bs_w_8 = NULL, /* Use inline code in bus.h */
/* write multiple */
.bs_wm_1 = generic_bs_wm_1,
.bs_wm_2 = generic_bs_wm_2,
.bs_wm_4 = generic_bs_wm_4,
.bs_wm_8 = BS_UNIMPLEMENTED,
/* write region */
.bs_wr_1 = generic_bs_wr_1,
.bs_wr_2 = generic_bs_wr_2,
.bs_wr_4 = generic_bs_wr_4,
.bs_wr_8 = BS_UNIMPLEMENTED,
/* set multiple */
.bs_sm_1 = BS_UNIMPLEMENTED,
.bs_sm_2 = BS_UNIMPLEMENTED,
.bs_sm_4 = BS_UNIMPLEMENTED,
.bs_sm_8 = BS_UNIMPLEMENTED,
/* set region */
.bs_sr_1 = generic_bs_sr_1,
.bs_sr_2 = generic_bs_sr_2,
.bs_sr_4 = generic_bs_sr_4,
.bs_sr_8 = BS_UNIMPLEMENTED,
/* copy */
.bs_c_1 = BS_UNIMPLEMENTED,
.bs_c_2 = generic_bs_c_2,
.bs_c_4 = BS_UNIMPLEMENTED,
.bs_c_8 = BS_UNIMPLEMENTED,
/* read stream (single) */
.bs_r_1_s = NULL, /* Use inline code in bus.h */
.bs_r_2_s = NULL, /* Use inline code in bus.h */
.bs_r_4_s = NULL, /* Use inline code in bus.h */
.bs_r_8_s = NULL, /* Use inline code in bus.h */
/* read multiple stream */
.bs_rm_1_s = generic_bs_rm_1,
.bs_rm_2_s = generic_bs_rm_2,
.bs_rm_4_s = generic_bs_rm_4,
.bs_rm_8_s = BS_UNIMPLEMENTED,
/* read region stream */
.bs_rr_1_s = generic_bs_rr_1,
.bs_rr_2_s = generic_bs_rr_2,
.bs_rr_4_s = generic_bs_rr_4,
.bs_rr_8_s = BS_UNIMPLEMENTED,
/* write stream (single) */
.bs_w_1_s = NULL, /* Use inline code in bus.h */
.bs_w_2_s = NULL, /* Use inline code in bus.h */
.bs_w_4_s = NULL, /* Use inline code in bus.h */
.bs_w_8_s = NULL, /* Use inline code in bus.h */
/* write multiple stream */
.bs_wm_1_s = generic_bs_wm_1,
.bs_wm_2_s = generic_bs_wm_2,
.bs_wm_4_s = generic_bs_wm_4,
.bs_wm_8_s = BS_UNIMPLEMENTED,
/* write region stream */
.bs_wr_1_s = generic_bs_wr_1,
.bs_wr_2_s = generic_bs_wr_2,
.bs_wr_4_s = generic_bs_wr_4,
.bs_wr_8_s = BS_UNIMPLEMENTED,
};
#ifndef FDT
static struct at91_softc *at91_softc;
@ -265,7 +108,7 @@ at91_attach(device_t dev)
arm_post_filter = at91_eoi;
at91_softc = sc;
sc->sc_st = &at91_bs_tag;
sc->sc_st = arm_base_bs_tag;
sc->sc_sh = AT91_BASE;
sc->sc_aic_sh = AT91_BASE + AT91_SYS_BASE;
sc->dev = dev;
@ -336,9 +179,9 @@ at91_alloc_resource(device_t dev, device_t child, int type, int *rid,
rle->res = rman_reserve_resource(&sc->sc_mem_rman,
start, end, count, flags, child);
if (rle->res != NULL) {
bus_space_map(&at91_bs_tag, start,
bus_space_map(arm_base_bs_tag, start,
rman_get_size(rle->res), 0, &bsh);
rman_set_bustag(rle->res, &at91_bs_tag);
rman_set_bustag(rle->res, arm_base_bs_tag);
rman_set_bushandle(rle->res, bsh);
}
break;

View File

@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$");
#include <machine/fdt.h>
extern const struct arm_devmap_entry at91_devmap[];
extern struct bus_space at91_bs_tag;
bus_space_tag_t fdtbus_bs_tag = &at91_bs_tag;
struct fdt_fixup_entry fdt_fixup_table[] = {
{ NULL, NULL }

View File

@ -114,8 +114,6 @@ __FBSDID("$FreeBSD$");
/* this should be evenly divisable by PAGE_SIZE / L2_TABLE_SIZE_REAL (or 4) */
#define NUM_KERNEL_PTS (KERNEL_PT_AFKERNEL + KERNEL_PT_AFKERNEL_NUM)
extern struct bus_space at91_bs_tag;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
/* Static device mappings. */

View File

@ -68,3 +68,6 @@ dev/usb/controller/at91dci.c optional at91_dci
dev/usb/controller/at91dci_atmelarm.c optional at91_dci ! fdt
dev/usb/controller/at91dci_fdt.c optional at91_dci fdt
# We need this for both FDT and !FDT since we use arm_base_bs_ta
# files.arm picks it up for FDT.
arm/arm/bus_space_base.c optional !fdt

View File

@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
bus_space_tag_t uart_bus_space_io;
bus_space_tag_t uart_bus_space_mem;
extern struct bus_space at91_bs_tag;
extern struct uart_class at91_usart_class;
int
@ -69,7 +68,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
class->uc_rclk = at91_master_clock;
di->ops = uart_getops(class);
di->bas.chan = 0;
di->bas.bst = &at91_bs_tag;
di->bas.bst = arm_base_bs_tag;
/*
* XXX: Not pretty, but will work because we map the needed addresses
* early. At least we probed this so that the console will work on
@ -82,7 +81,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
di->databits = 8;
di->stopbits = 1;
di->parity = UART_PARITY_NONE;
uart_bus_space_io = &at91_bs_tag;
uart_bus_space_io = arm_base_bs_tag;
uart_bus_space_mem = NULL;
/* Check the environment for overrides */
uart_getenv(devtype, di, class);