[Skiboot] [PATCH 2/2] OCC: Map OCC sensor to a chip-id
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Thu Jul 27 18:45:18 AEST 2017
Parse device tree to get chip-id for OCC sensor.
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
hw/ipmi/ipmi-sel.c | 28 ++++++++++++++++++++++++++--
1 file 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;
}
--
2.9.3
More information about the Skiboot
mailing list