[Skiboot] [PATCH v1 07/11]ibm-fsp/firenze: Nest PowerBus unit support
Madhavan Srinivasan
maddy at linux.vnet.ibm.com
Mon Jun 1 11:53:26 AEST 2015
Patch adds 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 DT entry to kernel.
Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
---
hw/nest.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/nest.h | 3 +++
2 files changed, 59 insertions(+)
diff --git a/hw/nest.c b/hw/nest.c
index 2d5a331..bc87ec0 100644
--- a/hw/nest.c
+++ b/hw/nest.c
@@ -98,6 +98,59 @@ int dt_create_ima_chip_mcs_type( struct dt_node *ima,
return 0;
}
+int dt_create_ima_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 */
+ memset((void *)ev_name, '\0', MAX_NAME_SIZE);
+ snprintf(ev_name, MAX_NAME_SIZE, name);
+ dt_add_property_cells(ima, ev_name, offset);
+
+ /* Unit for the Event */
+ memset((void *)ev_name, '\0', MAX_NAME_SIZE);
+ snprintf(ev_name, MAX_NAME_SIZE, "unit.%s.unit", name);
+ dt_add_property_string(ima, ev_name, unit);
+
+ /* Scale for the Event */
+ memset((void *)ev_name, '\0', MAX_NAME_SIZE);
+ snprintf(ev_name, MAX_NAME_SIZE, "scale.%s.scale", name);
+ dt_add_property_string(ima, ev_name, scale);
+
+ return 0;
+}
+
+int dt_create_ima_chip_powerbus_type( struct dt_node *ima,
+ struct ima_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_ima_chip_powerbus_event(type, offset, "Internal");
+
+ /* Create DT entry for PB External BW */
+ offset = get_chip_event_offset(gptr->event_index[3]);
+ dt_create_ima_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
@@ -117,6 +170,9 @@ int dt_create_ima_chip_type (struct dt_node *ima,
if (strstr(name, "MCS_")) {
if (dt_create_ima_chip_mcs_type(ima, gptr,name))
goto out;
+ } else if (strstr(name, "PowerBus_BW")) {
+ if (dt_create_ima_chip_powerbus_type(ima, gptr,name))
+ goto out;
} else
goto out;
diff --git a/include/nest.h b/include/nest.h
index 89b6eff..f569998 100644
--- a/include/nest.h
+++ b/include/nest.h
@@ -230,6 +230,9 @@ int dt_create_ima_chip_type (struct dt_node *,
int dt_create_ima_chip_mcs_type(struct dt_node *,
struct ima_catalogue_group_data *,char *);
int dt_create_ima_chip_mcs_event(struct dt_node *,int,u32);
+int dt_create_ima_chip_powerbus_type(struct dt_node *,
+ struct ima_catalogue_group_data *,char *);
+int dt_create_ima_chip_powerbus_event(struct dt_node *,u32, const char *);
void nest_ima_init(void);
#endif /* __NEST_H__ */
--
1.9.3
More information about the Skiboot
mailing list