aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2017-07-27 14:15:18 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-11 16:37:28 +1000
commit98e5c27e15e355de01a6c8f362be3e1ee95ff014 (patch)
tree1958afbc29a526393650ab47cecd5ed778a84172 /hw
parent3ceba40caa03b0bf8c2189f52177225e939620ef (diff)
downloadskiboot-98e5c27e15e355de01a6c8f362be3e1ee95ff014.zip
skiboot-98e5c27e15e355de01a6c8f362be3e1ee95ff014.tar.gz
skiboot-98e5c27e15e355de01a6c8f362be3e1ee95ff014.tar.bz2
OCC: Map OCC sensor to a chip-id
Parse device tree to get chip-id for OCC sensor. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/ipmi/ipmi-sel.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c
index 5c76647..3386854 100644
--- a/hw/ipmi/ipmi-sel.c
+++ b/hw/ipmi/ipmi-sel.c
@@ -532,9 +532,33 @@ static void sel_power(uint8_t power)
static uint32_t occ_sensor_id_to_chip(uint8_t sensor, uint32_t *chip)
{
- /* TODO: Lookup sensor ID node in the DT, and map to a chip id */
- (void)sensor;
+ struct dt_node *node, *bmc_node, *sensors_node;
+
+ /* Default chip id */
*chip = 0;
+
+ bmc_node = dt_find_by_name(dt_root, "bmc");
+ if (!bmc_node)
+ return 0;
+
+ sensors_node = dt_find_by_name(bmc_node, "sensors");
+ if (!sensors_node)
+ return 0;
+
+ node = dt_find_by_name_addr(sensors_node, "sensor", sensor);
+ if (!node) {
+ prlog(PR_DEBUG, "Could not find OCC sensor node. Id : %d\n",
+ (u32)sensor);
+ return 0;
+ }
+
+ if (!dt_has_node_property(node, "ibm,chip-id", NULL)) {
+ prlog(PR_DEBUG, "Could not find chip-id for OCC sensor : %d\n",
+ (u32)sensor);
+ return 0;
+ }
+
+ *chip = dt_get_chip_id(node);
return 0;
}