diff options
author | Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> | 2017-08-22 08:09:49 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-08-22 13:24:18 +1000 |
commit | a72cc3cefb5b3f25f419c1233b3b65779174a3e4 (patch) | |
tree | 79f8df5e438a856d7dc5cd19025c3abde9ff09fc | |
parent | b8ac8cde994023806c976878b8c86c02f74f03e4 (diff) | |
download | skiboot-a72cc3cefb5b3f25f419c1233b3b65779174a3e4.zip skiboot-a72cc3cefb5b3f25f419c1233b3b65779174a3e4.tar.gz skiboot-a72cc3cefb5b3f25f419c1233b3b65779174a3e4.tar.bz2 |
opal: Extract sw checkstop fir address from HDAT.
Extract sw checkstop fir address info from HDAT and populate device tree
node ibm,sw-checkstop-fir.
This patch is required for OPAL_CEC_REBOOT2 OPAL call to work as expected
on p9.
With this patch a device property 'ibm,sw-checkstop-fir' is now properly
populated:
# lsprop ibm,sw-checkstop-fir
ibm,sw-checkstop-fir
05012000 0000001f
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Tested-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | hdata/spira.c | 25 | ||||
-rw-r--r-- | hdata/spira.h | 4 |
2 files changed, 28 insertions, 1 deletions
diff --git a/hdata/spira.c b/hdata/spira.c index 59ea5cb..b58be7c 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -425,9 +425,10 @@ static bool add_xscom_sppcrd(uint64_t xscom_base) for_each_ntuple_idx(&spira.ntuples.proc_chip, hdif, i, SPPCRD_HDIF_SIG) { const struct sppcrd_chip_info *cinfo; + unsigned int csize; u32 ve, version; - cinfo = HDIF_get_idata(hdif, SPPCRD_IDATA_CHIP_INFO, NULL); + cinfo = HDIF_get_idata(hdif, SPPCRD_IDATA_CHIP_INFO, &csize); if (!CHECK_SPPTR(cinfo)) { prerror("XSCOM: Bad ChipID data %d\n", i); continue; @@ -487,6 +488,28 @@ static bool add_xscom_sppcrd(uint64_t xscom_base) parse_i2c_devs(hdif, SPPCRD_IDATA_HOST_I2C, np); add_vas_node(np, i); } + + /* + * Add sw checkstop scom address (ibm,sw-checkstop-fir) + * + * The latest HDAT versions have sw checkstop scom address + * info. But not sure from which version onwards (at least + * HDAT spec do not mention that explicitly). Hence use the + * sppcrd struct size returned by HDIF_get_idata to figure out + * whether it contains sw checkstop scom address info. Also + * check if sw_xstop_fir_scom address is non-zero. + */ + if ((csize >= (offsetof(struct sppcrd_chip_info, + sw_xstop_fir_bitpos) + 1)) && + cinfo->sw_xstop_fir_scom) { + __be32 fir_bit = cinfo->sw_xstop_fir_bitpos; + + if (!dt_find_property(dt_root, "ibm,sw-checkstop-fir")) + dt_add_property_cells(dt_root, + "ibm,sw-checkstop-fir", + be32_to_cpu(cinfo->sw_xstop_fir_scom), + be32_to_cpu(fir_bit)); + } } return i > 0; diff --git a/hdata/spira.h b/hdata/spira.h index 4867b6d..0276d4a 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -1035,6 +1035,10 @@ struct sppcrd_chip_info { __be32 capp1_func_state; /* *possibly* from Version 0x20 - check spec */ __be32 stop_levels; + /* From latest version (possibly 0x21 and later) */ + __be32 sw_xstop_fir_scom; + uint8_t sw_xstop_fir_bitpos; + uint8_t reserved_1[3]; } __packed; /* Idata index 1 : Chip TOD */ |