diff options
Diffstat (limited to 'src/usr/errl/errlentry.C')
| -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()"); } |

