aboutsummaryrefslogtreecommitdiff
path: root/hdata
AgeCommit message (Collapse)AuthorFilesLines
2017-10-16hdata/vpd: Improve vpd node find logicVasant Hegde1-14/+2
Use dt_find_by_name_addr() instead of dt_find_by_name(). That way we can avoid unnecessary memory allocation/cleanup. CC: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-16hdata/vpd: Rework vpd node creation logicVasant Hegde5-399/+363
Presently we traverse SLCA structure to create various FRU nodes under /vpd node. We assumed that children are always contiguous. It happened to be contiguous in P8 and worked fine, but failed in P9 system. So it ended up populating duplicate node under wrong parent. Also failed to populate some of the nodes. Unfortunately there is no way to reach all the children of a given parent from parent node :-( Hence we have to rework vpd creation logic. This patch goes through all the SLCA entries serially and creates vpd node. Assumptions: - SLCA index is always serial (0..n) - When we traverse serially parent entry comes before child - Redundant resources are always consecutive - Populate node if SLCA has 'installed' and 'VPD collected' bit set CC: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-15hdata/i2c: update the list of known i2c devsClaudio Carvalho1-4/+33
This updates the list of known i2c devices - as of HDAT spec v10.5e - so that they can be properly identified during the hdat parsing. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Reviewed-by: Oliver O'Halloran <oohal@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-15hdata/i2c: log unknown i2c devicesClaudio Carvalho1-4/+17
An i2c device is unknown if either the i2c device list is outdated or the device is marked as unknown (0xFF) in the hdat. This log both cases. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Reviewed-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-15hdata/i2c: add __packed to the host_i2c_hdr structureClaudio Carvalho1-1/+1
This adds __packed to the host_i2c_hdr structure since it defines an offset that refers to the beginning of the structure. Fixes: 41dc3eb4495c451a405974570f604622a3f829ef Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-10hdat: Disable TM on Power9 DD 2.1Michael Ellerman1-1/+1
Update pa_features_p9[] to disable TM (Transactional Memory). On DD 2.1 TM is not usable by Linux without other workarounds, so skiboot must disable it. The presence of TM is communicated by setting bit 7 of byte 22 in the pa-features array. As no other bits are set in that byte, we currently have a value of 0x80. To disable TM we set bit 7 to 0, leaving a value of 0x0. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-10hdata/iohub: Check IOHUB child count before usingVasant Hegde1-1/+4
..else we endup getting below calltrace in older system. [ 169.179598388,3] HDIF: child array idx out of range! CPU 085c Backtrace: S: 0000000033d739b0 R: 00000000300136e8 .backtrace+0x40 S: 0000000033d73a50 R: 00000000300a1510 .HDIF_child_arr+0x34 S: 0000000033d73ac0 R: 00000000300a47a8 .io_parse+0x708 S: 0000000033d73c80 R: 000000003009f4ec .parse_hdat+0x177c S: 0000000033d73e30 R: 0000000030014750 .main_cpu_entry+0x148 S: 0000000033d73f00 R: 0000000030002690 boot_entry+0x198 Fixes: ad484081 (hdata: Parse IOSLOT information) CC: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-02hdata: Fix sparse warning in add_ecid_data()Vasant Hegde1-1/+1
warning: hdata/spira.c:433:33: warning: restricted beint64_t degrades to integer Reported-by: Stewart Smith <stewart@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-02hdata/i2c: hdat_i2c_labels and hdat_i2c_devs should be staticStewart Smith1-2/+2
Silences sparse warnings: hdata/i2c.c:103:23: warning: symbol 'hdat_i2c_labels' was not declared. Should it be static? hdata/i2c.c:93:22: warning: symbol 'hdat_i2c_devs' was not declared. Should it be static? Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-02hdata/spira: silence 'so big is unsigned long' sparse warningsStewart Smith1-2/+2
hdata/spira.c:1401:17: warning: constant 0x8000000009010c3f is so big it is unsigned long hdata/spira.c:1401:17: warning: constant 0x800000000c010c3f is so big it is unsigned long hdata/spira.c:1401:17: warning: constant 0x8000000009010c3f is so big it is unsigned long hdata/spira.c:1401:17: warning: constant 0x800000000c010c3f is so big it is unsigned long Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-10-02hdata/spira: be32_to_cpu() doesn't work on 8bitsStewart Smith1-1/+1
Sparse warning: hdata/spira.c:1458:41: warning: incorrect type in argument 1 (different base types) expected restricted beint32_t [usertype] be_val got unsigned char const [unsigned] [usertype] link_speed Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Reviewed-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-20core: POWER9 implement OPAL_SIGNAL_SYSTEM_RESETNicholas Piggin2-14/+15
This implements OPAL_SIGNAL_SYSTEM_RESET, using scom registers to quiesce the target thread and raise a system reset exception on it. It has been tested on DD2 with stop0 ESL=0 and ESL=1 shallow power saving modes. DD1 is not implemented because it is sufficiently different as to make support difficult. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [stewart@linux.vnet.ibm.com: fixup hdat_to_dt test] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-20hdata/smplink: Increment index of associated PHBOliver O'Halloran1-1/+1
The PHB number of the NPU device needs to be incremented per-chip or bad things are going to occur. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> [stewart@linux.vnet.ibm.com: Reza found npu_index++ needed too] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-20hdat: logically dead code, assert insteadStewart Smith1-2/+1
Since we already assert that base != NULL, the if() condition on hdif can never be NULL. Instead, we should just assert (if even that) if it is. Found by Coverity Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-19hdata: Add wafer-location propertyVasant Hegde1-0/+4
Extract wafer-location from ECID and add property under xscom node. bits 64:71 are the chip x location (7:0) bits 72:79 are the chip y location (7:0) Sample output: ------------- [root@wsp xscom@623fc00000000]# lsprop ecid ecid 019a00d4 03100718 852c0000 00fd7911 [root@wsp xscom@623fc00000000]# lsprop wafer-location wafer-location 00000085 0000002c Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-19hdata: Add wafer-id propertyVasant Hegde1-0/+25
Wafer id is derived from ECID data. bits 4:63 are the wafer id ( ten 6 bit fields each containing a code) Sample output: ------------- [root@wsp xscom@623fc00000000]# lsprop ecid ecid 019a00d4 03100718 852c0000 00fd7911 [root@wsp xscom@623fc00000000]# lsprop wafer-id wafer-id "6Q0DG340SO" Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-19hdata: Add ecid propertyVasant Hegde2-1/+28
Add ecid property under xscom node. Sample output: ------------- [root@wsp xscom@623fc00000000]# lsprop ecid ecid 019a00d4 03100718 852c0000 00fd7911 Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-18hdat: fix parsing of P8 hdatStewart Smith2-6/+3
Also fixes hdat_to_dt test cases. Fixes: ad484081ef8a51811e7902aec436fa8f1ca9604a Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-15hdata: Parse extra NVLink infoOliver O'Halloran2-1/+32
Add parsing for the link speed information and the OCC GPU presence flags. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-15hdata: Parse NVLink informationOliver O'Halloran4-2/+202
Add the per-chip structures that descibe how the A-Bus/NVLink/OpenCAPI phy is configured. This generates the npu@xyz nodes for each chip on systems that support it. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-15hdata: Parse IOSLOT informationOliver O'Halloran2-0/+470
Add structure definitions that describe the physical PCIe topology of a system and parse them into the device-tree based PCIe slot description. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-15hdata: Add xscom_to_pcrd()Oliver O'Halloran1-0/+39
Iterating the SPPCRD structures (per chip data) is a fairly common operation in the HDAT parser. Iterating the tuples directly is somewhat irritating since we need to check for disabled chips, etc on every pass. A better way to handle this is to iterate throught he xscom nodes (generated from the SPPCRD data) and map from the xscom node to the originating structure. This patch adds a function to do that. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-15hdata: Add an idata array iteratorOliver O'Halloran2-0/+87
Adds HDIF_get_iarray() which retrieves and validates an internal array header and HDIF_iarray_for_each() for walking the individual array entries. This reduces the amount of get-then-check boilerplate that we have with the existing HDIF_get_iarray_item() method for iterating internal data arrays. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-04hdata: Update RAM area structureVasant Hegde1-6/+2
Also remove unused ram_area structure. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-04hdata: Make vpd data parsing function globalVasant Hegde2-5/+11
Move VPD parsing code to separate function (vpd_data_parse()) and make it as global. So that we can call this function from other files. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Acked-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-09-04hdata: Fix vpd parseVasant Hegde1-6/+3
We detect vpd data format in vpd_parse() and set "op_platform" variable. dt_add_vpd_node() depends on op_platform to select parser type. There are places where we call dt_add_vpd_node() even before calling vpd_parse(). And in such cases it will not parse vpd data properly. This patch fixes above issue. Fixes: 694546c1 (hdata/vpd: Parse the OpenPOWER OPFR record) CC: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Acked-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-24hdata/iohub: fix load of misaligned address for type 'long unsigned int', ↵Stewart Smith1-4/+7
which requires 8 byte alignment UBSan caught this: hdata/test/../iohub.c:83:2: runtime error: load of misaligned address 0x7f1dc7b0210a for type 'long unsigned int', which requires 8 byte alignment 0x7f1dc7b0210a: note: pointer points here 31 4c 58 08 31 00 04 01 00 30 00 42 50 46 02 00 00 78 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ #0 0x41470a in io_get_lx_info hdata/test/../iohub.c:83 #1 0x41759f in io_add_p8_cec_vpd hdata/test/../iohub.c:450 #2 0x417d35 in io_parse_fru hdata/test/../iohub.c:538 #3 0x41812a in io_parse hdata/test/../iohub.c:600 #4 0x425aa2 in parse_hdat hdata/test/../spira.c:1337 #5 0x43d9f8 in main hdata/test/hdata_to_dt.c:358 #6 0x7f1dcb868509 in __libc_start_main (/lib64/libc.so.6+0x20509) #7 0x4019e9 in _start (/home/stewart/skiboot/hdata/test/hdata_to_dt+0x4019e9) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-24hdata: Reduce 'struct HDIF_array_hdr' alignment to 4 bytesStewart Smith1-1/+1
UBSan threw up the following: hdata/test/../hdif.c:96:9: runtime error: member access within misaligned address 0x7f9ad8b02c18 for type 'const struct HDIF_array_hdr', which requires 16 byte alignment 0x7f9ad8b02c18: note: pointer points here 00 00 00 00 00 00 00 10 00 00 00 08 00 00 00 14 00 00 00 14 00 00 00 20 00 00 00 00 80 03 ff ff ^ Real data we're parsing doesn't enforce that alignment requirement, so we shouldn't rely on it. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-24hdata/hostservices: fix memory leak parsing mini dtStewart Smith1-0/+1
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-24hdata_to_dt: free device tree on error pathStewart Smith1-0/+1
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-22opal: Extract sw checkstop fir address from HDAT.Mahesh Salgaonkar2-1/+28
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>
2017-08-22HDAT/device-tree: only add lid-type on pre-POWER9 systemsStewart Smith1-2/+4
Largely a relic of back when we had multiple entry points into OPAL depending on which mechanism on an FSP we were using to get loaded, this isn't needed on modern P9 as we only have one entry point (we don't do the PHYP LID hack). Fixes: https://github.com/open-power/skiboot/issues/82 Reported-by: Pavaman Subramaniyam <pavsubra@linux.vnet.ibm.com> Reported-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-15hdata/vpd: Fix possible NULL dereference (CID 144258)Cyril Bur1-3/+1
Only use devicetree model if there was one. Fixes: CID 144258 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-15hdata/paca: Fix possible dereference of NULL (CID 141080)Cyril Bur1-0/+3
Fixes: CID 141080 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-11hdata/i2c: Work around broken I2C array versionOliver O'Halloran1-2/+8
Work around a bug in the I2C devices array that shows the array version as being v2 when only the v1 data is populated. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> [stewart@linux.vnet.ibm.com: only parse V2 as V1, still pass on >v2] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-11HDAT: Add chip-id property to ipmi sensorsVasant Hegde1-0/+36
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>
2017-08-11hdat: Fix PCIe GEN4 lane-eq setting for DD2Michael Neuling1-4/+19
For PCIe GEN4, DD2 uses only 1 byte per PCIe lane for the lane-eq settings (DD1 uses 2 bytes). This fixes the HDAT parsing to cope with this. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-11hdat: Add POWER9 DD2.0 specific pa_featuresMichael Neuling1-1/+20
Same as the default but with TM off. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-11hdat: Make is_power9n() globalMichael Neuling2-12/+16
This splits out is_power9n() so it can be used elsewhere. It also adds a check for for POWER9 so the function does more of what it's name suggests (and so the caller doesn't need to do it). Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-11hdata_to_dt: use a realistic PVR and chip revisionStewart Smith3-42/+53
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-10hdata/spira: POWER9 NX isn't software compatible with P7/P8 NX, don't claim soStewart Smith1-8/+10
Fixes: 2512953c7c6dc3b479d159d9bce8206219951164 Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01nx: Add device tree node for Power9Sukadev Bhattiprolu1-0/+3
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-08-01vas: Create xscom DT node in hdataSukadev Bhattiprolu1-0/+15
Create the VAS xscom node in hdata and use that when initializing VAS. Suggested-by: Ben Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-25hdat/i2c: Fix array version checkOliver O'Halloran1-1/+1
We should be checking the array version, not the HDIF header version. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-25hdata/memory: Add newlines to debug messagesOliver O'Halloran1-2/+2
Missed a few. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-25hdata/memory: Add memory reservations to the DTOliver O'Halloran2-4/+55
Currently we just add these to a list of pre-boot reserved regions which is then converted into a the contents of the /reserved-memory/ node just before Skiboot jumps into the firmware kernel. This approach is insufficent because we need to add the ibm,prd-instance labels to the various hostboot reserved regions. To do this we want to create these resevation nodes inside the HDAT parser rather than having the mem_region flattening code handle it. On P8 systems Hostboot placed its memory reservations under the /ibm,hostboot/ node and this patch makes the HDAT parser do the same. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-17hdat: Add missing newline to printMichael Neuling1-1/+1
Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-13HDAT: Add IPMI sensor data under /bmc nodeVasant Hegde3-2/+75
Add IPMI sensor data under /bmc node. CC: Joel Stanley <joel@jms.id.au> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Tested-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-13hdata: Fix phb4 lane-eq property generationMichael Neuling1-4/+5
The lane-eq data we get from hdat is all 7s but what we end up in the device tree is: xscom@603fc00000000/pbcq@4010c00/stack@0/ibm,lane-eq 00000000 31c339e0 00000000 0000000c 00000000 00000000 00000000 00000000 00000000 31c30000 77777777 77777777 77777777 77777777 77777777 77777777 This fixes grabbing the properties from hdat and fixes the call to put them in the device tree. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-07-04hdata/vpd: Don't dereference possible NULL model_nameStewart Smith1-4/+4
It's legitimate to just add model-name to the device tree if we have one, which is what the hdata logic tries to do, but subtley fails in one of the code paths. Found by static analysis Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>