summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/usr/util/utillidmgr.H3
-rw-r--r--src/usr/errl/errlentry.C96
-rw-r--r--src/usr/runtime/common/runtime_utils.C3
-rw-r--r--src/usr/runtime/populate_hbruntime.C7
-rw-r--r--src/usr/runtime/test/testpreverifiedlidmgr.H13
-rw-r--r--src/usr/util/runtime/utillidmgr_rt.C6
-rw-r--r--src/usr/util/utillidpnor.C3
7 files changed, 123 insertions, 8 deletions
diff --git a/src/include/usr/util/utillidmgr.H b/src/include/usr/util/utillidmgr.H
index 9b2b349f3..29e317233 100644
--- a/src/include/usr/util/utillidmgr.H
+++ b/src/include/usr/util/utillidmgr.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2017 */
+/* Contributors Listed Below - COPYRIGHT 2013,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -48,6 +48,7 @@ namespace Util
enum LidId
{
TEST_LIDID = 0x00000111,
+ VERSION_LIDID = 0x0000FFFF,
OCC_LIDID = 0x81e00430,
OCC_CONTAINER_LIDID = 0x80d0000b,
MCL_LIDID = 0x80d00020,
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()");
}
diff --git a/src/usr/runtime/common/runtime_utils.C b/src/usr/runtime/common/runtime_utils.C
index d87847f85..ba15de167 100644
--- a/src/usr/runtime/common/runtime_utils.C
+++ b/src/usr/runtime/common/runtime_utils.C
@@ -37,6 +37,7 @@ const PreVerifyVector preVerifiedPnorSections {
{PNOR::OCC, true},
{PNOR::WOFDATA, true},
{PNOR::HCODE, true},
+ {PNOR::VERSION, true},
{PNOR::RINGOVD, false},
};
@@ -76,4 +77,4 @@ bool isPreVerifiedSectionSecure(const PNOR::SectionId i_section)
return l_result;
}
-} \ No newline at end of file
+}
diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C
index 5c0596f35..db32eef40 100644
--- a/src/usr/runtime/populate_hbruntime.C
+++ b/src/usr/runtime/populate_hbruntime.C
@@ -1658,6 +1658,13 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId, bool i_master_node)
continue;
}
+ // Skip VERSION section for non-BMC based systems.
+ if ((secIdPair.first == PNOR::VERSION)
+ && INITSERVICE::spBaseServicesEnabled())
+ {
+ continue;
+ }
+
l_elog = hbResvLoadSecureSection(secIdPair.first,
secIdPair.second);
if (l_elog)
diff --git a/src/usr/runtime/test/testpreverifiedlidmgr.H b/src/usr/runtime/test/testpreverifiedlidmgr.H
index 47ba6c61b..78fcbd95c 100644
--- a/src/usr/runtime/test/testpreverifiedlidmgr.H
+++ b/src/usr/runtime/test/testpreverifiedlidmgr.H
@@ -83,6 +83,13 @@ class PreVerifiedLidMgrTest : public CxxTest::TestSuite
// Handle all Pre verified PNOR sections
for (const auto & secIdPair : RUNTIME::preVerifiedPnorSections)
{
+
+ // VERSION is not in standalone so ignore it here.
+ if (secIdPair.first == PNOR::VERSION)
+ {
+ continue;
+ }
+
l_errl = RUNTIME::hbResvLoadSecureSection(secIdPair.first,
secIdPair.second);
if (l_errl)
@@ -110,6 +117,10 @@ class PreVerifiedLidMgrTest : public CxxTest::TestSuite
// RINGOVD not permitted in secure mode. Meaning the Header and
// Content lid will be missing.
l_expectedLids -= 2;
+
+ // VERSION is only an OpenPOWER partition so we need to adjust for
+ // it here since it doesn't exist for standalone.
+ l_expectedLids -= 2;
}
// Ensure the expected number of lids were loaded.
@@ -129,4 +140,4 @@ class PreVerifiedLidMgrTest : public CxxTest::TestSuite
}
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/usr/util/runtime/utillidmgr_rt.C b/src/usr/util/runtime/utillidmgr_rt.C
index 8efbb7ffc..ad5a7cd48 100644
--- a/src/usr/util/runtime/utillidmgr_rt.C
+++ b/src/usr/util/runtime/utillidmgr_rt.C
@@ -354,7 +354,8 @@ const uint32_t * UtilLidMgr::getLidList(size_t * o_num)
Util::CUMULUS_HCODE_LIDID,
Util::HCODE_CONTAINER_LIDID,
Util::HWREFIMG_RINGOVD_LIDID,
- Util::TARGETING_BINARY_LIDID
+ Util::TARGETING_BINARY_LIDID,
+ Util::VERSION_LIDID
};
*o_num = sizeof(lidlist)/sizeof(lidlist[0]);
TRACFCOMP(g_trac_hbrt, EXIT_MRK" get_lid_list");
@@ -371,7 +372,8 @@ bool UtilLidMgr::lidInHbResvMem(const uint32_t i_lidId) const
i_lidId == Util::CUMULUS_HCODE_LIDID ||
i_lidId == Util::HCODE_CONTAINER_LIDID ||
i_lidId == Util::HWREFIMG_RINGOVD_LIDID ||
- i_lidId == Util::TARGETING_BINARY_LIDID;
+ i_lidId == Util::TARGETING_BINARY_LIDID ||
+ i_lidId == Util::VERSION_LIDID;
}
//------------------------------------------------------------------------
diff --git a/src/usr/util/utillidpnor.C b/src/usr/util/utillidpnor.C
index c7118c915..f304eab2d 100644
--- a/src/usr/util/utillidpnor.C
+++ b/src/usr/util/utillidpnor.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2017 */
+/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -49,6 +49,7 @@ const size_t lidIdStrLength = 9;
static const PnorLidsMap PnorToLidsMap =
{
{ PNOR::TESTRO, LidAndContainerLid(TEST_LIDID, INVALID_LIDID)},
+ { PNOR::VERSION, LidAndContainerLid(VERSION_LIDID, INVALID_LIDID)},
{ PNOR::OCC, LidAndContainerLid(OCC_LIDID, OCC_CONTAINER_LIDID)},
{ PNOR::WOFDATA, LidAndContainerLid(WOF_LIDID, WOF_CONTAINER_LIDID)},
{ PNOR::HCODE, LidAndContainerLid(NIMBUS_HCODE_LIDID, HCODE_CONTAINER_LIDID)},
OpenPOWER on IntegriCloud