[Skiboot] [PATCH v6 5/9] Create device tree for each nest unit
Madhavan Srinivasan
maddy at linux.vnet.ibm.com
Fri Feb 19 03:45:13 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 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/hw/nest.c b/hw/nest.c
index 23a61d80f101..e09ce3af5fdb 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -58,6 +58,35 @@ struct nest_catalog_grps_device 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_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, int id)
+{
+
+}
+
static void update_catalog_to_devices(struct nest_catalog_group_data *gptr)
{
int i, rc, dev_id, cnt;
@@ -90,6 +119,7 @@ static int detect_nest_units(struct dt_node *ima)
struct nest_catalog_group_data *group_ptr;
char *marker;
int rc = 0;
+ int i,j;
/*
* Scan all available groups in the chip domain from
@@ -109,6 +139,24 @@ static int detect_nest_units(struct dt_node *ima)
group_ptr = (struct nest_catalog_group_data *)marker;
};
+ for (i=0; i<NEST_DT_DEVICE_MAX; i++) {
+ for (j=0; j<dev_grp_map[i].nest_device_grps_cnt; j++) {
+ group_ptr = (struct nest_catalog_group_data *)
+ dev_grp_map[i].grp_ptr_arr[j];
+
+ /*
+ * Check whether dt node has been created for this
+ * device, if not do it.
+ */
+ if (!dev_grp_map[i].ptr)
+ dev_grp_map[i].ptr = dt_add_device_node(ima,
+ dev_grp_map[i].name);
+ rc = dt_create_nest_unit(dev_grp_map[i].ptr, group_ptr, i);
+ if (rc)
+ return rc;
+ }
+ }
+
return rc;
}
--
1.9.1
More information about the Skiboot
mailing list