[Skiboot] [PATCH V2 4/4] sensors: occ: Filter out de-configured sensors
Shilpasri G Bhat
shilpa.bhat at linux.vnet.ibm.com
Fri Dec 15 18:21:03 AEDT 2017
OCC copies APSS, GPU sensors on platforms that dont have them. The
de-configured sensors are copied with 0 sensor values. So filter
out the zero'ed environment sensors as they are not present on
the system.
Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
---
hw/occ-sensor.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/hw/occ-sensor.c b/hw/occ-sensor.c
index bc5085a..e41c850 100644
--- a/hw/occ-sensor.c
+++ b/hw/occ-sensor.c
@@ -706,6 +706,17 @@ static void add_sensor_node(const char *loc, const char *type, int i, int attr,
*phandle = node->phandle;
}
+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;
@@ -759,6 +770,9 @@ void occ_sensors_init(void)
if (!(md[i].type & HWMON_SENSORS_MASK))
continue;
+ if (!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);
--
1.8.3.1
More information about the Skiboot
mailing list