diff options
author | Matt Derksen <mderkse1@us.ibm.com> | 2017-11-13 16:06:20 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-11-15 18:03:21 -0500 |
commit | dacd80a9811f5865e53b29e1e0c2d0dddd1e9719 (patch) | |
tree | f63db592a03298e80bc1aaff02fdad1f83246433 | |
parent | eaf4ca605f7b0e23fe72188b3e2f30aa9879d41c (diff) | |
download | talos-hostboot-dacd80a9811f5865e53b29e1e0c2d0dddd1e9719.tar.gz talos-hostboot-dacd80a9811f5865e53b29e1e0c2d0dddd1e9719.zip |
Fix grabbing config from NV keyword data
getGPUSensors was returning INVALID_IPMI_SENSOR for all GPUs
as it was incorrectly reading the NV config ID.
Change-Id: Iab71302f2066304dbf17e4fafcde0af8ca3c1240
CQ: SW407191
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/49615
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Brian E. Bakke <bbakke@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rwxr-xr-x | src/include/usr/hdat/hdat.H | 8 | ||||
-rwxr-xr-x | src/usr/hdat/hdatutil.H | 12 | ||||
-rw-r--r-- | src/usr/ipmi/ipmisensor.C | 42 |
3 files changed, 43 insertions, 19 deletions
diff --git a/src/include/usr/hdat/hdat.H b/src/include/usr/hdat/hdat.H index bf005866b..0f750936c 100755 --- a/src/include/usr/hdat/hdat.H +++ b/src/include/usr/hdat/hdat.H @@ -239,6 +239,14 @@ enum hdatRhbPermType : uint8_t RHB_READ_WRITE = RHB_READ_ONLY | RHB_WRITE_ONLY, }; +/** NV Keyword header struct */ +typedef struct{ + uint32_t magic; // = "NV00" + uint8_t version; // Version of the structure = 0x01 start + uint8_t config; // Configuration specifier : redbud=0x01,sequoia=0x02 + uint8_t reserved[249]; // keyword is 255 bytes long +}__attribute__ ((packed)) hdatNVKwdStruct_t; + /* vpd constants * Defining vpd constants */ diff --git a/src/usr/hdat/hdatutil.H b/src/usr/hdat/hdatutil.H index efb492c57..5472c5ab2 100755 --- a/src/usr/hdat/hdatutil.H +++ b/src/usr/hdat/hdatutil.H @@ -147,14 +147,6 @@ struct hdatSMPLinkInfo_t }__attribute__ ((packed)); -/** NV Keyword header struct */ -typedef struct{ - uint32_t magic; // = "NV00" - uint8_t version; // Version of the structure = 0x01 start - uint8_t config; // Configuration specifier : redbud=0x01,sequoia=0x02 - uint8_t reserved[249]; // keyword is 255 bytes long -}__attribute__ ((packed)) hdatNVKwdStruct_t; - enum hdatSMPLinkUsage { HDAT_SMP_LINK_USAGE_SMP = 0, @@ -389,7 +381,7 @@ errlHndl_t hdatGetAsciiKwdForPvpd( /** * @brief Get the Full MVPD records post adding start/end tag. * We need to add the tag back, since HB is stripping them off before - * storing the vpd records in pnor cache. + * storing the vpd records in pnor cache. * * @param[in] i_target input target pointer * @param[out]o_kwdSize: keyword size @@ -410,7 +402,7 @@ errlHndl_t hdatGetMvpdFullRecord( /** * @brief Get the Full PVPD records post adding start/end tag. * We need to add the tag back, since HB is stripping them off before - * storing the vpd records in pnor cache. + * storing the vpd records in pnor cache. * @param[out]o_kwdSize: keyword size * @param[out]o_kwd: key word array * @param[in] i_fetchVpd: relevant structure to be read to fetch the VPD diff --git a/src/usr/ipmi/ipmisensor.C b/src/usr/ipmi/ipmisensor.C index 6cd03acb0..5eb850c6a 100644 --- a/src/usr/ipmi/ipmisensor.C +++ b/src/usr/ipmi/ipmisensor.C @@ -38,6 +38,7 @@ #include <endian.h> #include <vpd/pvpdenums.H> #include <devicefw/userif.H> +#include <hdat/hdat.H> extern trace_desc_t * g_trac_ipmi; @@ -1408,21 +1409,44 @@ namespace SENSOR DEVICE_PVPD_ADDRESS(l_Record,l_KeyWord)); if (!l_err) { - uint8_t l_kwd[l_nvKwdSize] = {0}; - // now read the keyword - l_err = deviceRead(l_nodeTargets[0],l_kwd,l_nvKwdSize, - DEVICE_PVPD_ADDRESS(l_Record,l_KeyWord)); - if (!l_err) + if (l_nvKwdSize == sizeof(HDAT::hdatNVKwdStruct_t)) { - uint8_t cfgID = l_kwd[l_nvKwdSize-1]; - if (cfgID < 16) // maximum setting (bits 0-15) + uint8_t l_kwd[l_nvKwdSize] = {0}; + // now read the keyword + l_err = deviceRead(l_nodeTargets[0],l_kwd,l_nvKwdSize, + DEVICE_PVPD_ADDRESS(l_Record,l_KeyWord)); + if (!l_err) + { + HDAT::hdatNVKwdStruct_t * NVptr = + reinterpret_cast<HDAT::hdatNVKwdStruct_t*>(l_kwd); + + // Valid NV keyword config has NV00 as magic header + if ( !memcmp((char*)&(NVptr->magic),"NV00", 4) ) + { + uint8_t cfgID = NVptr->config; + if (cfgID < 16) // maximum setting (bits 0-15) + { + L_NV_bits = 0x0001 << cfgID; + } + else + { + TRACFCOMP(g_trac_ipmi,"getNVCfgIDBit(): Invalid NV config 0x%02X", cfgID); + } + } + else + { + TRACFCOMP(g_trac_ipmi, "Invalid NV magic header: 0x%.8X", NVptr->magic); + TRACFBIN(g_trac_ipmi, "NV KEYWORD", l_kwd, l_nvKwdSize); + } + } + else { - L_NV_bits = 0x0001 << cfgID; + TRACFCOMP(g_trac_ipmi,ERR_MRK"%.8X Error getting VNDR record data",l_err->eid()); } } else { - TRACFCOMP(g_trac_ipmi,ERR_MRK"%.8X Error getting VNDR record data",l_err->eid()); + TRACFCOMP(g_trac_ipmi,"Invalid NV keyword size: %d, expected %d",l_nvKwdSize,sizeof(HDAT::hdatNVKwdStruct_t)); } } else |