diff options
author | Matt Raybuck <mraybuc@us.ibm.com> | 2018-11-15 09:45:07 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-11-27 13:47:16 -0600 |
commit | 022f2d75d80d7ac11abec2e87da76b8691d0498b (patch) | |
tree | 6df0d37f51e0a2f2a55eb9a987e1ed07530dc8ea /src/usr/errl | |
parent | b08f9e7eb4a76ed813b0596b4b0eab30070cb3a4 (diff) | |
download | talos-hostboot-022f2d75d80d7ac11abec2e87da76b8691d0498b.tar.gz talos-hostboot-022f2d75d80d7ac11abec2e87da76b8691d0498b.zip |
Add VERSION to all OpenPOWER HBRT error logs
Now that the VERSION partition is a secure section, in order to have the
version info in all runtime error logs the VERSION section has been put
into reserved memory which can then be loaded and added to all HBRT
OpenPOWER error logs.
Change-Id: Iaf74d19270f8221710f30834097e131f4dadeeba
RTC:200439
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/68855
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
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: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/errl')
-rw-r--r-- | src/usr/errl/errlentry.C | 96 |
1 files changed, 94 insertions, 2 deletions
diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C index 7f7c9a5b0..99271a8da 100644 --- a/src/usr/errl/errlentry.C +++ b/src/usr/errl/errlentry.C @@ -71,6 +71,8 @@ #include <errl/errludsensor.H> #endif +#include <util/utillidmgr.H> + // Hostboot Image ID string extern char hbi_ImageId; @@ -672,6 +674,8 @@ void ErrlEntry::addHbBuildId() void ErrlEntry::addVersionInfo() { + TRACDCOMP(g_trac_errl, ENTER_MRK"addVersionInfo()"); + // Start of IPL only block; runtime does not support secure loading of // partitions #ifndef __HOSTBOOT_RUNTIME @@ -732,7 +736,8 @@ void ErrlEntry::addVersionInfo() size_t l_numberOfBytes = 0; - // Determine the size of the version data. + // Determine the size of the version data. The max size is the given + // size in the SectionInfo but can be less. while ((static_cast<char>(l_versionData[l_numberOfBytes]) != '\0') && l_numberOfBytes < l_pnorVersionInfo.size) { @@ -768,7 +773,94 @@ void ErrlEntry::addVersionInfo() } -#endif // End of IPL only block +// End of IPL only block +#else +// Start of runtime block. Since runtime doesn't support securing load of PNOR +// sections, we load the version info from reserved memory. + + // Version section of PNOR is only available to OpenPOWER systems. + if (!INITSERVICE::spBaseServicesEnabled()) + { + errlHndl_t l_errl = nullptr; + + do + { + + // Get PNOR Version + UtilLidMgr l_lidMgr(Util::VERSION_LIDID); + size_t l_lidSize = 0; + l_errl = l_lidMgr.getLidSize(l_lidSize); + + if (l_errl) + { + TRACFCOMP( g_trac_errl, + "addVersionInfo: Failed to getLidSize() - error"); + // Since an error occurred while attempting to add version info + // to another error log there is nothing that can be done with + // this error since attempting to commit it will lead to an + // infinite loop of committing the error and then recalling this + // function. If this error occurred then the VERSION partition + // is not added and the error log commit continues. + delete l_errl; + l_errl = nullptr; + break; + } + + TRACDCOMP(g_trac_errl, + "addVersionInfo: l_lidSize = %d", + l_lidSize); + + char* l_versionData = new char[l_lidSize](); + l_errl = l_lidMgr.getLid(l_versionData, l_lidSize); + + + if (l_errl) + { + TRACFCOMP( g_trac_errl, + "addVersionInfo: Failed to getLid() - error"); + // Since an error occurred while attempting to add version info + // to another error log there is nothing that can be done with + // this error since attempting to commit it will lead to an + // infinite loop of committing the error and then recalling this + // function. If this error occurred then the VERSION partition + // is not added and the error log commit continues. + delete l_errl; + l_errl = nullptr; + delete[] l_versionData; + l_versionData = nullptr; + break; + } + + size_t l_numberOfBytes = 0; + + // Determine the size of the version data. The max size is the + // lidSize but can be less. + while ((static_cast<char>(l_versionData[l_numberOfBytes]) != '\0') + && l_numberOfBytes < l_lidSize) + { + ++l_numberOfBytes; + } + + TRACDCOMP(g_trac_errl, + "addVersionInfo: l_numberOfBytes = %d", + l_numberOfBytes); + + char l_pVersionString[l_numberOfBytes + 1]={0}; + + memcpy(l_pVersionString, l_versionData, l_numberOfBytes); + + ErrlUserDetailsString(l_pVersionString).addToLog(this); + + delete[] l_versionData; + l_versionData = nullptr; + + } while(0); + + + } +#endif + + TRACFCOMP(g_trac_errl, EXIT_MRK"addVersionInfo()"); } |