diff --git a/sys/arm/mv/armadaxp/armadaxp_mp.c b/sys/arm/mv/armadaxp/armadaxp_mp.c --- a/sys/arm/mv/armadaxp/armadaxp_mp.c +++ b/sys/arm/mv/armadaxp/armadaxp_mp.c @@ -46,6 +46,7 @@ #include #include +#include #include diff --git a/sys/arm/mv/mv_armv7_machdep.c b/sys/arm/mv/mv_armv7_machdep.c --- a/sys/arm/mv/mv_armv7_machdep.c +++ b/sys/arm/mv/mv_armv7_machdep.c @@ -103,6 +103,10 @@ void mv_axp_platform_mp_start_ap(platform_t plate); #endif +vm_paddr_t fdt_immr_pa; +vm_offset_t fdt_immr_va; +static vm_offset_t fdt_immr_size; + #define MPP_PIN_MAX 68 #define MPP_PIN_CELLS 2 #define MPP_PINS_PER_REG 8 @@ -270,9 +274,35 @@ mv_platform_probe_and_attach(platform_t plate) { - if (fdt_immr_addr(MV_BASE) != 0) - while (1); - return (0); + phandle_t node; + u_long base, size; + int r; + + /* + * Try to access the SOC node directly i.e. through /aliases/. + */ + if ((node = OF_finddevice("soc")) != -1) + if (ofw_bus_node_is_compatible(node, "simple-bus")) + goto moveon; + /* + * Find the node the long way. + */ + if ((node = OF_finddevice("/")) == -1) + goto errout; + + if ((node = fdt_find_compatible(node, "simple-bus", 0)) == 0) + goto errout; + +moveon: + if ((r = fdt_get_range(node, 0, &base, &size)) == 0) { + fdt_immr_pa = base; + fdt_immr_va = MV_BASE; + fdt_immr_size = size; + return (0); + } + +errout: + while (1); } static void diff --git a/sys/arm/mv/mvvar.h b/sys/arm/mv/mvvar.h --- a/sys/arm/mv/mvvar.h +++ b/sys/arm/mv/mvvar.h @@ -80,6 +80,9 @@ extern int idma_wins_no; extern int xor_wins_no; +extern vm_paddr_t fdt_immr_pa; +extern vm_offset_t fdt_immr_va; + int soc_decode_win(void); void soc_id(uint32_t *dev, uint32_t *rev); void soc_dump_decode_win(void); diff --git a/sys/dev/fdt/fdt_common.h b/sys/dev/fdt/fdt_common.h --- a/sys/dev/fdt/fdt_common.h +++ b/sys/dev/fdt/fdt_common.h @@ -66,10 +66,6 @@ device_t dev; }; -extern vm_paddr_t fdt_immr_pa; -extern vm_offset_t fdt_immr_va; -extern vm_offset_t fdt_immr_size; - #if defined(FDT_DTB_STATIC) extern u_char fdt_static_dtb; #endif diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c --- a/sys/dev/fdt/fdt_common.c +++ b/sys/dev/fdt/fdt_common.c @@ -62,10 +62,6 @@ SYSCTL_NODE(_hw, OID_AUTO, fdt, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Flattened Device Tree"); -vm_paddr_t fdt_immr_pa; -vm_offset_t fdt_immr_va; -vm_offset_t fdt_immr_size; - struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head); static int @@ -199,38 +195,6 @@ return (0); } -int -fdt_immr_addr(vm_offset_t immr_va) -{ - phandle_t node; - u_long base, size; - int r; - - /* - * Try to access the SOC node directly i.e. through /aliases/. - */ - if ((node = OF_finddevice("soc")) != -1) - if (ofw_bus_node_is_compatible(node, "simple-bus")) - goto moveon; - /* - * Find the node the long way. - */ - if ((node = OF_finddevice("/")) == -1) - return (ENXIO); - - if ((node = fdt_find_compatible(node, "simple-bus", 0)) == 0) - return (ENXIO); - -moveon: - if ((r = fdt_get_range(node, 0, &base, &size)) == 0) { - fdt_immr_pa = base; - fdt_immr_va = immr_va; - fdt_immr_size = size; - } - - return (r); -} - int fdt_is_compatible_strict(phandle_t node, const char *compatible) {