diff options
author | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2017-07-27 14:15:17 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-08-11 16:37:27 +1000 |
commit | 3ceba40caa03b0bf8c2189f52177225e939620ef (patch) | |
tree | 12bd985e5e1a034b3542e51e7c1c56e68c9cb28c | |
parent | 961547bceed3276415e1a8505093a818a44001e7 (diff) | |
download | skiboot-3ceba40caa03b0bf8c2189f52177225e939620ef.zip skiboot-3ceba40caa03b0bf8c2189f52177225e939620ef.tar.gz skiboot-3ceba40caa03b0bf8c2189f52177225e939620ef.tar.bz2 |
HDAT: Add chip-id property to ipmi sensors
Presently we do not have a way to map sensor to chip id. Hence we are
always passing chip id 0 for occ_reset request (see occ_sensor_id_to_chip()).
This patch adds chip-id property to sensors (whenever its available) so that
we can map occ sensor to chip-id and pass valid chip-id to occ_reset request.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | hdata/fsp.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/hdata/fsp.c b/hdata/fsp.c index 4846fcd..2bf691f 100644 --- a/hdata/fsp.c +++ b/hdata/fsp.c @@ -281,6 +281,40 @@ static void add_uart(const struct spss_iopath *iopath, struct dt_node *lpc) be32_to_cpu(iopath->lpc.uart_baud)); } +static void add_chip_id_to_sensors(struct dt_node *sensor_node, __be32 slca_index) +{ + unsigned int i; + const void *hdif; + const struct slca_entry *slca; + const struct spira_fru_id *fru_id; + const struct sppcrd_chip_info *cinfo; + + slca = slca_get_entry(slca_index); + if (slca == NULL) { + prlog(PR_WARNING, "SENSORS: Invalid slca index\n"); + return; + } + + for_each_ntuple_idx(&spira.ntuples.proc_chip, hdif, i, SPPCRD_HDIF_SIG) { + fru_id = HDIF_get_idata(hdif, SPPCRD_IDATA_FRU_ID, NULL); + if (!fru_id) + return; + + if (fru_id->rsrc_id != slca->rsrc_id) + continue; + + cinfo = HDIF_get_idata(hdif, SPPCRD_IDATA_CHIP_INFO, NULL); + if (!CHECK_SPPTR(cinfo)) { + prlog(PR_ERR, "SENSORS: Bad ChipID data %d\n", i); + return; + } + + dt_add_property_cells(sensor_node, + "ibm,chip-id", be32_to_cpu(cinfo->xscom_id)); + return; + } +} + static void add_ipmi_sensors(struct dt_node *bmc_node) { int i; @@ -325,6 +359,8 @@ static void add_ipmi_sensors(struct dt_node *bmc_node) dt_add_property_cells(sensor_node, "reg", ipmi_sensors->data[i].id); dt_add_property_cells(sensor_node, "ipmi-sensor-type", ipmi_sensors->data[i].type); + + add_chip_id_to_sensors(sensor_node, ipmi_sensors->data[i].slca_index); } } |