replaces the early bus space map support with ways more elegant approach, by checking in the one-and-only bus_space_map function used by armv7 (simplebus_bs_map essentially uses the the same *bs_map()). also removes the unnecessary bs_protos(bs_notimpl); from armv7_machdep.c, which might break the build later, if left around.
diff --git a/sys/arch/arm/armv7/armv7_space.c b/sys/arch/arm/armv7/armv7_space.c index c7e9b686b8f..64907252b76 100644 --- a/sys/arch/arm/armv7/armv7_space.c +++ b/sys/arch/arm/armv7/armv7_space.c @@ -170,7 +170,16 @@ armv7_bs_map(void *t, uint64_t bpa, bus_size_t size, { u_long startpa, endpa, pa; vaddr_t va; - int pmap_flags = PMAP_DEVICE; + int pmap_flags; + extern int bootstrap_bs_map(void *, uint64_t, bus_size_t, + int, bus_space_handle_t *); + + /* + * Once pmap_bootstrap() has ran, pm_refs will be > 0, + * and we should be ready to provide non-bootstrap mappings + */ + if (pmap_kernel()->pm_refs == 0) + return bootstrap_bs_map(t, bpa, size, flags, bshp); startpa = trunc_page(bpa); endpa = round_page(bpa + size); @@ -183,8 +192,7 @@ armv7_bs_map(void *t, uint64_t bpa, bus_size_t size, *bshp = (bus_space_handle_t)(va + (bpa - startpa)); - if (flags & BUS_SPACE_MAP_CACHEABLE) - pmap_flags = 0; + pmap_flags = (flags & BUS_SPACE_MAP_CACHEABLE) ? 0 : PMAP_DEVICE; for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) pmap_kenter_pa(va, pa | pmap_flags, PROT_READ | PROT_WRITE); diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c index aa1c549b29b..f7b3f6baf83 100644 --- a/sys/arch/armv7/armv7/armv7_machdep.c +++ b/sys/arch/armv7/armv7/armv7_machdep.c @@ -204,8 +204,6 @@ int bootstrap_bs_map(void *, uint64_t, bus_size_t, int, void process_kernel_args(char *); void consinit(void); -bs_protos(bs_notimpl); - #ifndef CONSPEED #define CONSPEED B115200 /* What u-boot */ #endif @@ -384,11 +382,6 @@ initarm(void *arg0, void *arg1, void *arg2, paddr_t loadaddr) void *node; extern uint32_t esym; /* &_end if no symbols are loaded */ - /* early bus_space_map support */ - struct bus_space tmp_bs_tag; - int (*map_func_save)(void *, uint64_t, bus_size_t, int, - bus_space_handle_t *); - if (arg0) esym = (uint32_t)arg0; @@ -407,19 +400,6 @@ initarm(void *arg0, void *arg1, void *arg2, paddr_t loadaddr) panic("cpu not recognized!"); /* - * Temporarily replace bus_space_map() functions so that - * console devices can get mapped. - * - * Note that this relies upon the fact that both regular - * and a4x bus_space tags use the same map function. - */ - tmp_bs_tag = armv7_bs_tag; - map_func_save = armv7_bs_tag.bs_map; - armv7_bs_tag.bs_map = bootstrap_bs_map; - armv7_a4x_bs_tag.bs_map = bootstrap_bs_map; - tmp_bs_tag.bs_map = bootstrap_bs_map; - - /* * Now, map the FDT area. * * As we don't know the size of a possible FDT, map the size of a @@ -772,12 +752,6 @@ initarm(void *arg0, void *arg1, void *arg2, paddr_t loadaddr) vector_page_setprot(PROT_READ | PROT_EXEC); - /* - * Restore proper bus_space operation, now that pmap is initialized. - */ - armv7_bs_tag.bs_map = map_func_save; - armv7_a4x_bs_tag.bs_map = map_func_save; - #ifdef DDB db_machine_init();