[Skiboot] [PATCH v8 5/7] Create device tree for each nest unit
Madhavan Srinivasan
maddy at linux.vnet.ibm.com
Mon Mar 14 15:02:01 AEDT 2016
Code to loop all the supported nest units and
create device tree nodes for each.
Also empty dt_create_nest_unit() added which
will be used in subsequent patches.
Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
hw/nest.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/hw/nest.c b/hw/nest.c
index 279da186f4aa..ac77b2f146b2 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -57,6 +57,36 @@ struct catalog_grp_to_dt_node dev_grp_map[NEST_DT_DEVICE_MAX];
*/
struct nest_catalog_page_0 *page0_desc;
+static struct dt_node *
+dt_add_device_node(struct dt_node *ptr, const char *name)
+{
+ struct dt_node *type=NULL;
+
+ type = dt_new(ptr, name);
+ if (!type) {
+ prlog(PR_ERR, "nest_counters: %s type creation failed\n", name);
+ return type;
+ }
+
+ dt_add_property_strings(type, "compatible", "ibm,nest-counters-chip");
+ dt_add_property_cells(type, "#address-cells", 1);
+ dt_add_property_cells(type, "#size-cells", 1);
+ dt_add_property(type, "ranges", NULL, 0);
+
+ return type;
+}
+
+/*
+ * Wrapper function to call corresponding nest unit functions
+ * for event dt creation. Not all the chip groups in the catalog are
+ * supported at this point.
+ */
+static int
+dt_create_nest_unit(struct dt_node *ima,
+ struct nest_catalog_group_data *gptr)
+{
+}
+
static void add_grp_to_nest_unit_table(struct nest_catalog_group_data *gptr)
{
int i, rc, unit, cnt;
@@ -89,6 +119,7 @@ static int detect_nest_units(struct dt_node *ima)
struct nest_catalog_group_data *group;
char *marker;
int rc = 0;
+ int i,j;
/* Zero out to avoid issues in multi node/chip config */
memset((void *)dev_grp_map, 0,
@@ -112,6 +143,24 @@ static int detect_nest_units(struct dt_node *ima)
group = (struct nest_catalog_group_data *)marker;
};
+ for (i = 0; i < NEST_DT_DEVICE_MAX; i++) {
+ for (j = 0; j < dev_grp_map[i].grp_count; j++) {
+ group = (struct nest_catalog_group_data *)
+ dev_grp_map[i].groups[j];
+
+ /*
+ * Check whether dt node has been created for this
+ * nest unit, if not do it.
+ */
+ if (!dev_grp_map[i].dt_node)
+ dev_grp_map[i].dt_node = dt_add_device_node(ima,
+ dev_grp_map[i].nest_unit_name);
+ rc = dt_create_nest_unit(dev_grp_map[i].dt_node, group);
+ if (rc)
+ return rc;
+ }
+ }
+
return rc;
}
--
1.9.1
More information about the Skiboot
mailing list