diff options
author | Cédric Le Goater <clg@fr.ibm.com> | 2015-03-09 21:56:14 +0100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-03-24 18:22:55 +1100 |
commit | 4c6ab2e4ab05111066c35ff37b6cb0f285242d30 (patch) | |
tree | cdae5583f3495b1a1b7d4cbf69a9dfc764533b34 /hw/dts.c | |
parent | 2d8952a581a857f010df38422ed7803d8be64061 (diff) | |
download | blackbird-skiboot-4c6ab2e4ab05111066c35ff37b6cb0f285242d30.tar.gz blackbird-skiboot-4c6ab2e4ab05111066c35ff37b6cb0f285242d30.zip |
dts: add device tree nodes for the core temperatures
This patch simply adds sensors nodes for the core temperatures. It
uses the core PIR as a resource identifier to fit in the sensor model.
The device tree nodes use the new layout.
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/dts.c')
-rw-r--r-- | hw/dts.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -19,6 +19,7 @@ #include <sensor.h> #include <dts.h> #include <skiboot.h> +#include <opal-api.h> /* Per core Digital Thermal Sensors */ #define EX_THERM_DTS_RESULT0 0x10050000 @@ -163,3 +164,38 @@ int64_t dts_sensor_read(uint32_t sensor_hndl, uint32_t *sensor_data) return 0; } + +bool dts_sensor_create_nodes(struct dt_node *sensors) +{ + uint8_t sensor_class = SENSOR_DTS_CORE_TEMP|SENSOR_DTS; + + struct proc_chip *chip; + char name[64]; + + /* build the device tree nodes : + * + * sensors/core-temp@pir + * + * The core is identified by its PIR, is stored in the resource + * number of the sensor handler. + */ + for_each_chip(chip) { + struct cpu_thread *c; + + for_each_available_core_in_chip(c, chip->id) { + struct dt_node *node; + uint32_t handler; + + snprintf(name, sizeof(name), "core-temp@%x", c->pir); + + handler = sensor_make_handler(sensor_class, + c->pir, SENSOR_DTS_ATTR_TEMP_MAX); + node = dt_new(sensors, name); + dt_add_property_string(node, "compatible", + "ibm,opal-sensor"); + dt_add_property_cells(node, "sensor-data", handler); + } + } + + return true; +} |