diff --git a/sys/arm/mv/armv5_machdep.c b/sys/arm/mv/armv5_machdep.c index 3751387e667c..53cc21c74e3b 100644 --- a/sys/arm/mv/armv5_machdep.c +++ b/sys/arm/mv/armv5_machdep.c @@ -377,7 +377,8 @@ platform_devmap_init(void) * PCI range(s) and localbus. */ for (child = OF_child(root); child != 0; child = OF_peer(child)) { - if (fdt_is_type(child, "pci") || fdt_is_type(child, "pciep")) { + if (mv_fdt_is_type(child, "pci") || + mv_fdt_is_type(child, "pciep")) { /* * Check space: each PCI node will consume 2 devmap * entries. diff --git a/sys/arm/mv/mv_armv7_machdep.c b/sys/arm/mv/mv_armv7_machdep.c index af3a866cbc53..810ebd260782 100644 --- a/sys/arm/mv/mv_armv7_machdep.c +++ b/sys/arm/mv/mv_armv7_machdep.c @@ -397,7 +397,8 @@ mv_a38x_platform_devmap_init(platform_t plat) * PCI range(s) and localbus. */ for (child = OF_child(root); child != 0; child = OF_peer(child)) { - if (fdt_is_type(child, "pci") || fdt_is_type(child, "pciep")) { + if (mv_fdt_is_type(child, "pci") || + mv_fdt_is_type(child, "pciep")) { /* * Check space: each PCI node will consume 2 devmap * entries. diff --git a/sys/arm/mv/mv_common.c b/sys/arm/mv/mv_common.c index 2c46ae44035f..91692e8d9c6b 100644 --- a/sys/arm/mv/mv_common.c +++ b/sys/arm/mv/mv_common.c @@ -483,6 +483,26 @@ pm_disable_device(int mask) #endif } +int +mv_fdt_is_type(phandle_t node, const char *typestr) +{ +#define FDT_TYPE_LEN 64 + char type[FDT_TYPE_LEN]; + + if (OF_getproplen(node, "device_type") <= 0) + return (0); + + if (OF_getprop(node, "device_type", type, FDT_TYPE_LEN) < 0) + return (0); + + if (strncasecmp(type, typestr, FDT_TYPE_LEN) == 0) + /* This fits. */ + return (1); + + return (0); +#undef FDT_TYPE_LEN +} + int mv_fdt_pm(phandle_t node) { diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c index 7800fd7b6362..57b2545f69d4 100644 --- a/sys/arm/mv/mv_pci.c +++ b/sys/arm/mv/mv_pci.c @@ -420,7 +420,7 @@ mv_pcib_probe(device_t self) phandle_t node; node = ofw_bus_get_node(self); - if (!fdt_is_type(node, "pci")) + if (!mv_fdt_is_type(node, "pci")) return (ENXIO); if (!(ofw_bus_is_compatible(self, "mrvl,pcie") || diff --git a/sys/arm/mv/mvvar.h b/sys/arm/mv/mvvar.h index c9b107e46d49..c1e51fa6c62c 100644 --- a/sys/arm/mv/mvvar.h +++ b/sys/arm/mv/mvvar.h @@ -141,6 +141,7 @@ int mv_pci_devmap(phandle_t, struct devmap_entry *, vm_offset_t, int fdt_localbus_devmap(phandle_t, struct devmap_entry *, int, int *); enum soc_family mv_check_soc_family(void); +int mv_fdt_is_type(phandle_t, const char *); int mv_fdt_pm(phandle_t); uint32_t get_tclk_armadaxp(void); diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c index 3aa89f4a9451..70bf744c3d77 100644 --- a/sys/dev/fdt/fdt_common.c +++ b/sys/dev/fdt/fdt_common.c @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #endif #define FDT_COMPAT_LEN 255 -#define FDT_TYPE_LEN 64 #define FDT_REG_CELLS 4 #define FDT_RANGES_SIZE 48 @@ -334,24 +333,6 @@ fdt_depth_search_compatible(phandle_t start, const char *compat, int strict) return (0); } -int -fdt_is_type(phandle_t node, const char *typestr) -{ - char type[FDT_TYPE_LEN]; - - if (OF_getproplen(node, "device_type") <= 0) - return (0); - - if (OF_getprop(node, "device_type", type, FDT_TYPE_LEN) < 0) - return (0); - - if (strncasecmp(type, typestr, FDT_TYPE_LEN) == 0) - /* This fits. */ - return (1); - - return (0); -} - int fdt_parent_addr_cells(phandle_t node) { diff --git a/sys/dev/fdt/fdt_common.h b/sys/dev/fdt/fdt_common.h index 1e749c612509..30b049fc3ebe 100644 --- a/sys/dev/fdt/fdt_common.h +++ b/sys/dev/fdt/fdt_common.h @@ -91,7 +91,6 @@ int fdt_get_range(phandle_t, int, u_long *, u_long *); int fdt_immr_addr(vm_offset_t); int fdt_regsize(phandle_t, u_long *, u_long *); int fdt_is_compatible_strict(phandle_t, const char *); -int fdt_is_type(phandle_t, const char *); int fdt_parent_addr_cells(phandle_t); int fdt_get_chosen_bootargs(char *bootargs, size_t max_size);