svn commit: r332274 - in head/sys: arm/mv dev/fdt

Andrew Turner andrew at FreeBSD.org
Sun Apr 8 12:20:09 UTC 2018


Author: andrew
Date: Sun Apr  8 12:20:06 2018
New Revision: 332274
URL: https://svnweb.freebsd.org/changeset/base/332274

Log:
  Move fdt_is_type to be a Marvell specific function. It's not used by any
  other SoCs.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/arm/mv/armv5_machdep.c
  head/sys/arm/mv/mv_armv7_machdep.c
  head/sys/arm/mv/mv_common.c
  head/sys/arm/mv/mv_pci.c
  head/sys/arm/mv/mvvar.h
  head/sys/dev/fdt/fdt_common.c
  head/sys/dev/fdt/fdt_common.h

Modified: head/sys/arm/mv/armv5_machdep.c
==============================================================================
--- head/sys/arm/mv/armv5_machdep.c	Sun Apr  8 12:08:20 2018	(r332273)
+++ head/sys/arm/mv/armv5_machdep.c	Sun Apr  8 12:20:06 2018	(r332274)
@@ -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.

Modified: head/sys/arm/mv/mv_armv7_machdep.c
==============================================================================
--- head/sys/arm/mv/mv_armv7_machdep.c	Sun Apr  8 12:08:20 2018	(r332273)
+++ head/sys/arm/mv/mv_armv7_machdep.c	Sun Apr  8 12:20:06 2018	(r332274)
@@ -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.

Modified: head/sys/arm/mv/mv_common.c
==============================================================================
--- head/sys/arm/mv/mv_common.c	Sun Apr  8 12:08:20 2018	(r332273)
+++ head/sys/arm/mv/mv_common.c	Sun Apr  8 12:20:06 2018	(r332274)
@@ -484,6 +484,26 @@ pm_disable_device(int mask)
 }
 
 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)
 {
 	uint32_t cpu_pm_ctrl;

Modified: head/sys/arm/mv/mv_pci.c
==============================================================================
--- head/sys/arm/mv/mv_pci.c	Sun Apr  8 12:08:20 2018	(r332273)
+++ head/sys/arm/mv/mv_pci.c	Sun Apr  8 12:20:06 2018	(r332274)
@@ -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") ||

Modified: head/sys/arm/mv/mvvar.h
==============================================================================
--- head/sys/arm/mv/mvvar.h	Sun Apr  8 12:08:20 2018	(r332273)
+++ head/sys/arm/mv/mvvar.h	Sun Apr  8 12:20:06 2018	(r332274)
@@ -141,6 +141,7 @@ int mv_pci_devmap(phandle_t, struct devmap_entry *, vm
 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);

Modified: head/sys/dev/fdt/fdt_common.c
==============================================================================
--- head/sys/dev/fdt/fdt_common.c	Sun Apr  8 12:08:20 2018	(r332273)
+++ head/sys/dev/fdt/fdt_common.c	Sun Apr  8 12:20:06 2018	(r332274)
@@ -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
@@ -331,24 +330,6 @@ fdt_depth_search_compatible(phandle_t start, const cha
 		if (child != 0)
 			return (child);
 	}
-	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);
 }
 

Modified: head/sys/dev/fdt/fdt_common.h
==============================================================================
--- head/sys/dev/fdt/fdt_common.h	Sun Apr  8 12:08:20 2018	(r332273)
+++ head/sys/dev/fdt/fdt_common.h	Sun Apr  8 12:20:06 2018	(r332274)
@@ -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);
 


More information about the svn-src-head mailing list