aboutsummaryrefslogtreecommitdiff
path: root/hdata/vpd.c
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 Hegde1-94/+78
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-09-04hdata: Make vpd data parsing function globalVasant Hegde1-5/+9
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-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-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>
2017-06-26hdat/vpd: Don't warn and don't create a dummy "model-name"Benjamin Herrenschmidt1-3/+0
If the model property doesn't contain a known model number that we can translate into a name, assume it's already a name, stop warning and don't create an extraneous property. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-04-05hdat: Use dt_add_property_nstr instead of duplicating codeVasant Hegde1-9/+3
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-04-05hdat: Add model-name property for OpenPower systemVasant Hegde1-4/+10
Lets add model-name property for OpenPower system as well. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-04-05hdat: Read description from ibm, vpd binary blobVasant Hegde1-4/+10
In P8, for few FRU's we hardcoded description table (I don't call the reason behind this). Hence on newers system, for most devices description propetry under /vpd contains "Unknown". Hence lets read description from vpd blob. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-04-05hdat: Populate model property with 'Unknown' in error pathVasant Hegde1-0/+5
Linux kernel refers to model and sytem-id properties. Also some of the user space tools refers these properties. Hence in error path fill model/system-id property with "Unknown". Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-03-31hdata/vpd: Parse the OpenPOWER OPFR recordAnanth N Mavinakayanahalli1-1/+44
Parse the OpenPOWER FRU VPD (OPFR) record on OpenPOWER instead of the VINI records. TODO: Add the dts and updates for make check for P9 OPFR systems once the HDAT in those are complete. Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-03-31hdata/vpd: Parse additional VINI recordsAnanth N Mavinakayanahalli1-56/+43
These records provide hardware version details, CCIN extension information, card type details and hardware characteristics of the FRU While there, use the helper to add individual records. Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-03-31hdata/vpd: Reorganize VPD codeAnanth N Mavinakayanahalli1-5/+8
To make it convenient to add OpenPOWER platform support. No change in functionality. This series has been tested on a Witherspoon. The HDAT has the corresponding properties, but is not populated with the right values (serial number, etc). Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-02-17hdata/vpd: Reorganize vpd name mappingAnanth N Mavinakayanahalli1-287/+140
to use a more graceful structured representation. Signed-off-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Reviewed-by: Oliver O'Halloran <oohall@gmail.com> [stewart@linux.vnet.ibm.com: preserve PR_WARNING on Unknown] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-02-06hdat: Rework parsing of system VPD for Open PowerBenjamin Herrenschmidt1-49/+62
Handle the OSYS record on OPP machines in stead of VSYS Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-01-16hdat: Grab system model name from HDAT when availableVasant Hegde1-8/+34
Latest spec added system model information to IPL PARAMS ntuple. Grab this information when available instead of using hardcoded table (machine_table). Its better to parse all IPL params in one place. But on P8 we depend on model information ..which we get from sysvpd_parse(). Hence for now I've added code inside sysvpd_parse(). Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-01-16hdat: Grab vendor information from HDAT when availableVasant Hegde1-1/+0
Latest spec added vendor information to IPL PARAMS ntuple. Grab this information when available instead of hardcoding vendor name. Also move vendor property code from vpd.c to iplparms parsing function in spira.c. Suggested-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-01-16hdat: handle ISDIMM SPD blobsOliver O'Halloran1-1/+2
Previously the HDAT format was only ever used with IBM hardware so it would store vital product data (VPD) blobs in the IBM ASCII Keyword VPD format. With P9 HDAT is used on OpenPower machines which use Industry Standard DIMMs that provide their product data through a "Serial Present Detect" EEPROM mounted on the DIMM. The SPD blob has a different format and is exported in the device-tree under the "spd" property rather than the "ibm,vpd" property. This patch adds support for recognising these blobs and placing them in the appropriate DT property. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-11-16Enable -Werror for -WformatStewart Smith1-1/+2
We create our own inttypes.h to get the correct printf formatting for 64bit numbers. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-11-09sparse: fix conversion of hdat slca_indexStewart Smith1-1/+1
No code changes as skiboot is BE. hdata/vpd.c:559:38: warning: incorrect type in argument 1 (different base types) hdata/vpd.c:559:38: expected unsigned short [unsigned] [usertype] slca_index hdata/vpd.c:559:38: got restricted beint16_t const [usertype] slca_index Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-07hdata/vpd: Improve error loggingVasant Hegde1-3/+16
Populate CCIN description and model-name property as "Unknown" if its not available (say new system model, etc). That way device tree will be consistent. Also improve error logging. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-11vpd: Use slca parent-child relationship to create vpd treeNeelesh Gupta1-142/+75
SLCA entries available through hdat have parent-child relationship of various FRUs of the system, the patch makes use of this data to create VPD nodes in hierarchial fashion. This is further useful for the user space tools like 'lshw'/'lsvpd' to plug-in the support easily on POWER. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-07-02Initial commit of Open Source releaseBenjamin Herrenschmidt1-0/+851
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>