aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>2018-01-19 11:05:57 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2018-01-30 20:42:38 -0600
commita05e341c9af2700c69bd0477132caead28d0bb89 (patch)
tree1631fc2fec9d6bbf6df2c5bc378db0d2b3ff1f02
parentbebe096ee242057094e546d3ecbb9a077d6b7111 (diff)
downloadskiboot-a05e341c9af2700c69bd0477132caead28d0bb89.zip
skiboot-a05e341c9af2700c69bd0477132caead28d0bb89.tar.gz
skiboot-a05e341c9af2700c69bd0477132caead28d0bb89.tar.bz2
sensors: occ: Skip power sensors with zero sample value
APSS is not avialable on platforms like Zaius, Romulus where OCC can only measure Vdd (core) and Vdn (nest) power from the AVSbus reading. So all the sensors for APSS channels will be populated with 0. Different component power sensors like system, memory which point to the APSS channels will also be 0. As per OCC team (Martha Broyles) zero'ed power sensor means that the system doesnot have it. So this patch filters out these sensors. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/occ-sensor.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index 72c8964..1e103cb 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -548,6 +548,23 @@ static const char *get_sensor_loc_string(enum occ_sensor_location loc)
return "unknown";
}
+/*
+ * Power sensors can be 0 valued in few platforms like Zaius, Romulus
+ * which do not have APSS. At the moment there is no HDAT/DT property
+ * to indicate if APSS is present. So for now skip zero valued power
+ * sensors.
+ */
+static bool check_sensor_sample(struct occ_sensor_data_header *hb, u32 offset)
+{
+ struct occ_sensor_record *ping, *pong;
+
+ ping = (struct occ_sensor_record *)((u64)hb + hb->reading_ping_offset
+ + offset);
+ pong = (struct occ_sensor_record *)((u64)hb + hb->reading_pong_offset
+ + offset);
+ return ping->sample || pong->sample;
+}
+
void occ_sensors_init(void)
{
struct proc_chip *chip;
@@ -611,6 +628,10 @@ void occ_sensors_init(void)
if (md[i].location == OCC_SENSOR_LOC_GPU && !has_gpu)
continue;
+ if (md[i].type == OCC_SENSOR_TYPE_POWER &&
+ !check_sensor_sample(hb, md[i].reading_offset))
+ continue;
+
if (md[i].location == OCC_SENSOR_LOC_CORE) {
int num = parse_entity(md[i].name, NULL);