[Skiboot] [PATCH v3 6/9] Nest PowerBus unit support

Madhavan Srinivasan maddy at linux.vnet.ibm.com
Mon Aug 3 17:33:45 AEST 2015


Add support for Nest PowerBus(PB) unit. PowerBus internal
and external bandwidth events are exported for now. Both unit and scale
information for each PB event passed as Device-Tree entry to kernel.

Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
 hw/nest.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/hw/nest.c b/hw/nest.c
index 1733f08af06a..42c2bfc224c9 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -100,6 +100,56 @@ int dt_create_nest_chip_mcs_type( struct dt_node *ima,
 	return 0;
 }
 
+int dt_create_nest_chip_powerbus_event(struct dt_node *ima, u32 offset,
+							const char *name)
+{
+	char ev_name[MAX_NAME_SIZE];
+	const char *unit = "MiB", *scale = "4.883e-4";
+
+	/* PowerBus BW DT for Internal/External BW */
+	snprintf(ev_name, MAX_NAME_SIZE, name);
+	dt_add_property_cells(ima, ev_name, offset);
+
+	/* Unit for the Event */
+	snprintf(ev_name, MAX_NAME_SIZE, "unit.%s.unit", name);
+	dt_add_property_string(ima, ev_name, unit);
+
+	/* Scale for the Event */
+	snprintf(ev_name, MAX_NAME_SIZE, "scale.%s.scale", name);
+	dt_add_property_string(ima, ev_name, scale);
+
+	return 0;
+}
+
+int dt_create_nest_chip_powerbus_type( struct dt_node *ima,
+			struct nest_catalogue_group_data *gptr, char *name)
+{
+	struct dt_node *type;
+	u32 offset;
+
+	type = dt_new(ima, name);
+	if (!type) {
+		prlog(PR_DEBUG, "ima %s type creation failed \n", name);
+		return -1;
+	}
+
+	/*
+	 * Incase of PowerBus(PB) Group, only Internal and External
+	 * transfer Bandwidth matters.
+	 */
+	dt_add_property_string(type, "device_type", "nest-ima-unit");
+
+	/* Create DT entry for PB Internal BW */
+	offset = get_chip_event_offset(gptr->event_index[2]);
+	dt_create_nest_chip_powerbus_event(type, offset, "Internal");
+
+	/* Create DT entry for PB External BW */
+	offset = get_chip_event_offset(gptr->event_index[3]);
+	dt_create_nest_chip_powerbus_event(type, offset, "External");
+
+	return 0;
+}
+
 /*
  * Wrapper Function to call Corresponding Nest unit functions
  * for event dt creation. Not all the Chip Groups in the Catalog are
@@ -118,6 +168,9 @@ int dt_create_nest_chip_type(struct dt_node *ima,
 	if (strstr(name, "MCS_")) {
 		if (dt_create_nest_chip_mcs_type(ima, gptr,name))
 			goto out;
+	} else if (strstr(name, "PowerBus_BW")) {
+		if (dt_create_nest_chip_powerbus_type(ima, gptr,name))
+			goto out;
 	}
 
 	return OPAL_SUCCESS;
-- 
1.9.1



More information about the Skiboot mailing list