aboutsummaryrefslogtreecommitdiff
path: root/hw/occ-sensor.c
diff options
context:
space:
mode:
authorShilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>2017-07-28 00:45:33 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-07-28 14:53:19 +1000
commit5c2510d171cb0a0a7e34e659f2b7a2483decf7de (patch)
treea61199a5f4828b37c8b65dea3324f7b2f82d6af3 /hw/occ-sensor.c
parentfa57f7ccff403e5035c5cec32f92ac4826438195 (diff)
downloadskiboot-5c2510d171cb0a0a7e34e659f2b7a2483decf7de.zip
skiboot-5c2510d171cb0a0a7e34e659f2b7a2483decf7de.tar.gz
skiboot-5c2510d171cb0a0a7e34e659f2b7a2483decf7de.tar.bz2
sensors: occ: Add support to clear sensor groups
Adds a generic API to clear sensor groups. OCC inband sensor groups such as CSM, Profiler and Job Scheduler can be cleared using this API. It will clear the min/max of all sensors belonging to OCC sensor groups. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/occ-sensor.c')
-rw-r--r--hw/occ-sensor.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index 87886db..a55acac 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -546,6 +546,7 @@ static const char *get_sensor_loc_string(enum occ_sensor_location loc)
void occ_sensors_init(void)
{
struct proc_chip *chip;
+ struct dt_node *sg;
int occ_num = 0, i;
/* OCC inband sensors is only supported in P9 */
@@ -561,9 +562,17 @@ void occ_sensors_init(void)
occ_sensor_base = chip->occ_common_base + OCC_SENSOR_DATA_BLOCK_OFFSET;
+ sg = dt_new(opal_node, "sensor-groups");
+ if (!sg) {
+ prerror("OCC: Failed to create sensor groups node\n");
+ return;
+ }
+ dt_add_property_string(sg, "compatible", "ibm,opal-occ-sensor-group");
+
for_each_chip(chip) {
struct occ_sensor_data_header *hb;
struct occ_sensor_name *md;
+ u32 *phandles, phcount = 0;
hb = get_sensor_header_block(occ_num);
md = get_names_block(hb);
@@ -572,6 +581,9 @@ void occ_sensors_init(void)
if (!occ_sensor_sanity(hb, chip->id))
continue;
+ phandles = malloc(hb->nr_sensors * sizeof(u32));
+ assert(phandles);
+
for (i = 0; i < hb->nr_sensors; i++) {
char name[30];
const char *type, *loc;
@@ -615,7 +627,10 @@ void occ_sensors_init(void)
if (md[i].location == OCC_SENSOR_LOC_CORE)
dt_add_property_cells(node, "ibm,pir", c->pir);
+ phandles[phcount++] = node->phandle;
}
occ_num++;
+ occ_add_sensor_groups(sg, phandles, phcount, chip->id);
+ free(phandles);
}
}