diff options
| author | Stephen Cprek <smcprek@us.ibm.com> | 2017-12-15 10:24:02 -0600 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-12-20 13:54:35 -0500 |
| commit | 34dbdc49d0d14933c317be2815302d0d558c5924 (patch) | |
| tree | d65d06b6901b0188057263519bf0b2f127b3ddd0 /src/usr/util | |
| parent | 1dce3206aa219d0cef4501b6795255a730f4ecba (diff) | |
| download | talos-hostboot-34dbdc49d0d14933c317be2815302d0d558c5924.tar.gz talos-hostboot-34dbdc49d0d14933c317be2815302d0d558c5924.zip | |
Convert asserts to error logs where it makes sense
Change-Id: Idd15e39cc6be44c0865f13503bfa4482d77fcf0d
RTC:181899
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/51042
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@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>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martin Gloff <mgloff@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/util')
| -rw-r--r-- | src/usr/util/runtime/utillidmgr_rt.C | 39 | ||||
| -rw-r--r-- | src/usr/util/utillidmgr.C | 78 | ||||
| -rw-r--r-- | src/usr/util/utillidpnor.C | 25 |
3 files changed, 108 insertions, 34 deletions
diff --git a/src/usr/util/runtime/utillidmgr_rt.C b/src/usr/util/runtime/utillidmgr_rt.C index 05f15c3c4..e5d381a2c 100644 --- a/src/usr/util/runtime/utillidmgr_rt.C +++ b/src/usr/util/runtime/utillidmgr_rt.C @@ -41,8 +41,17 @@ UtilLidMgr::UtilLidMgr(uint32_t i_lidId) : iv_isLidInPnor(false), iv_lidBuffer(nullptr), iv_lidSize(0), iv_isLidInVFS(false), iv_isLidInHbResvMem(false) { + errlHndl_t l_err = nullptr; iv_spBaseServicesEnabled = INITSERVICE::spBaseServicesEnabled(); - updateLid(i_lidId); + l_err = updateLid(i_lidId); + if (l_err) + { + UTIL_FT(ERR_MRK"UtilLidMgr::UtilLidMgr() cstor failed to update Lid (0x%X)", + i_lidId); + errlCommit(l_err,UTIL_COMP_ID); + // Set to invalid lid id and allow to continue + iv_lidId = Util::INVALID_LIDID; + } } UtilLidMgr::~UtilLidMgr() @@ -61,10 +70,20 @@ errlHndl_t UtilLidMgr::setLidId(uint32_t i_lidId) { errlHndl_t l_err = nullptr; + do { //must call cleanup before updateLid l_err = cleanup(); + if (l_err) + { + break; + } - updateLid(i_lidId); + l_err = updateLid(i_lidId); + if (l_err) + { + break; + } + } while(0); return l_err; } @@ -280,17 +299,19 @@ errlHndl_t UtilLidMgr::cleanup() return l_err; } -void UtilLidMgr::updateLid(uint32_t i_lidId) +errlHndl_t UtilLidMgr::updateLid(uint32_t i_lidId) { UTIL_FT("UtilLidMgr::updateLid - i_lidId=0x%.8X", i_lidId); iv_lidId = i_lidId; + errlHndl_t l_err = nullptr; + + do { // First check if lid is already in hostboot reserved memory // In securemode the lid is pre-verified if (TARGETING::is_sapphire_load() && lidInHbResvMem(iv_lidId)) { UTIL_FT("UtilLidMgr::updateLid - lid in Hb Resv Mem"); - getLidPnorSectionInfo(iv_lidId, iv_lidPnorInfo); iv_isLidInHbResvMem = true; } // Check if PNOR is access is supported @@ -304,10 +325,18 @@ void UtilLidMgr::updateLid(uint32_t i_lidId) UTIL_FT("UtilLidMgr::updateLid - lid in PNOR"); // If it's in PNOR it's not technically a lid // so use a slightly different extension - iv_isLidInPnor = getLidPnorSectionInfo(iv_lidId, iv_lidPnorInfo); + l_err = getLidPnorSectionInfo(iv_lidId, iv_lidPnorInfo, iv_isLidInPnor); + if (l_err) + { + break; + } } sprintf(iv_lidFileName, "%x.lidbin", iv_lidId); iv_isLidInVFS = VFS::module_exists(iv_lidFileName); + + } while (0); + + return l_err; } const uint32_t * UtilLidMgr::getLidList(size_t * o_num) diff --git a/src/usr/util/utillidmgr.C b/src/usr/util/utillidmgr.C index d69d02d0b..5f329b2d4 100644 --- a/src/usr/util/utillidmgr.C +++ b/src/usr/util/utillidmgr.C @@ -56,19 +56,48 @@ UtilLidMgr::UtilLidMgr(uint32_t i_lidId) ,iv_lidImageSize(0) ,iv_lidSize(0) { + errlHndl_t l_err = nullptr; iv_spBaseServicesEnabled = INITSERVICE::spBaseServicesEnabled(); - updateLid(i_lidId); + l_err = updateLid(i_lidId); + if (l_err) + { + uint64_t l_reasonCode = l_err->reasonCode(); + UTIL_FT(ERR_MRK"UtilLidMgr::UtilLidMgr() Failed to update Lid (0x%X) shutting down rc=0x%08X", + i_lidId, l_reasonCode); + errlCommit(l_err,UTIL_COMP_ID); + INITSERVICE::doShutdown(l_reasonCode); + } + + // On non-FSP based systems only get LIDs from either PNOR or VFS + if ( (iv_spBaseServicesEnabled == false) && + (iv_isLidInPnor == false) && + (iv_isLidInVFS == false) + ) + { + UTIL_FT(ERR_MRK"UtilLidMgr::UtilLidMgr() Requested lid 0x%X not in PNOR or VFS which is required on non-FSP based systems", + i_lidId); + + /*@ + * @errortype + * @moduleid Util::UTIL_LIDMGR_CSTOR + * @reasoncode Util::UTIL_LIDMGR_INVAL_LID_REQUEST + * @userdata1 LID ID + * @userdata2 0 + * @devdesc Lid not in PNOR or VFS for non-FSP systems + * @custdesc Firmware encountered an internal error. + */ + l_err = new ErrlEntry( + ERRL_SEV_UNRECOVERABLE, + Util::UTIL_LIDMGR_CSTOR, + Util::UTIL_LIDMGR_INVAL_LID_REQUEST, + i_lidId, + 0, + true /*Add HB Software Callout*/); + l_err->collectTrace(UTIL_COMP_NAME); + errlCommit(l_err,UTIL_COMP_ID); + INITSERVICE::doShutdown(Util::UTIL_LIDMGR_INVAL_LID_REQUEST); + } -#ifdef CONFIG_SECUREBOOT - // In SECUREBOOT mode ensure that OpenPower systems only get LIDs from - // either PNOR or VFS where we can trust the security - assert( !(( iv_spBaseServicesEnabled == false ) && - ( iv_isLidInPnor == false ) && - ( iv_isLidInVFS == false ) - ), "UtilLidMgr::UtilLidMgr: Secureboot: OpenPower requesting LID " - "that is not in PNOR or VFS" - ); -#endif } /////////////////////////////////////////////////////////// @@ -892,28 +921,47 @@ errlHndl_t UtilLidMgr::setLidId(uint32_t i_lidId) { errlHndl_t l_err = nullptr; + do { //must call cleanup before updateLid l_err = cleanup(); + if (l_err) + { + break; + } - updateLid(i_lidId); + l_err = updateLid(i_lidId); + if (l_err) + { + break; + } + } while(0); return l_err; } /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// -void UtilLidMgr::updateLid(uint32_t i_lidId) +errlHndl_t UtilLidMgr::updateLid(uint32_t i_lidId) { iv_lidId = i_lidId; + errlHndl_t l_err = nullptr; + + do { //if it's in PNOR, it's not technically lid, so use a slightly //different extension. sprintf(iv_lidFileName, "%x.lidbin", iv_lidId); - iv_isLidInPnor = getLidPnorSectionInfo(iv_lidId, iv_lidPnorInfo); + l_err = getLidPnorSectionInfo(iv_lidId, iv_lidPnorInfo, iv_isLidInPnor); + if (l_err) + { + UTIL_FT("UtilLidMgr::updateLid - getLidPnorSectionInfo failed"); + break; + } UTIL_DT(INFO_MRK "UtilLidMgr: LID 0x%.8X in pnor: %d", iv_lidId ,iv_isLidInPnor); iv_isLidInVFS = VFS::module_exists(iv_lidFileName); + } while(0); - return; + return l_err; } diff --git a/src/usr/util/utillidpnor.C b/src/usr/util/utillidpnor.C index 25c90c73e..c7118c915 100644 --- a/src/usr/util/utillidpnor.C +++ b/src/usr/util/utillidpnor.C @@ -97,11 +97,12 @@ PNOR::SectionId getLidPnorSection(const LidId i_lid) } // end Util namespace -bool UtilLidMgr::getLidPnorSectionInfo(uint32_t i_lidId, - PNOR::SectionInfo_t &o_lidPnorInfo) +errlHndl_t UtilLidMgr::getLidPnorSectionInfo(const uint32_t i_lidId, + PNOR::SectionInfo_t &o_lidPnorInfo, + bool &o_isLidInPnor) { errlHndl_t l_err = nullptr; - bool l_lidInPnor = false; + o_isLidInPnor = false; // Search if a lid id maps to pnor section auto l_secId = Util::getLidPnorSection(static_cast<Util::LidId>(i_lidId)); @@ -141,20 +142,19 @@ bool UtilLidMgr::getLidPnorSectionInfo(uint32_t i_lidId, o_lidPnorInfo.id = PNOR::INVALID_SECTION; delete l_err; l_err = nullptr; - UTIL_FT("UtilLidMgr::getLidPnorSectionInfo Lid 0x%X ignore getSectionInfo error", + UTIL_FT("UtilLidMgr::getLidPnorSectionInfo Lid 0x%X ignore getSectionInfo INVALID_SECTION error", i_lidId); break; } else if (l_err) { - UTIL_FT(ERR_MRK"UtilLidMgr::getLidPnorSectionInfo Lid 0x%X getSectionInfo error shutting down rc=0x%08X", + UTIL_FT(ERR_MRK"UtilLidMgr::getLidPnorSectionInfo Lid 0x%X getSectionInfo failed rc=0x%08X", l_err->reasonCode()); - errlCommit(l_err, UTIL_COMP_ID); break; } else { - l_lidInPnor = true; + o_isLidInPnor = true; UTIL_FT("UtilLidMgr::getLidPnorSectionInfo Lid 0x%X in PNOR", i_lidId); #ifdef CONFIG_SECUREBOOT #ifndef __HOSTBOOT_RUNTIME @@ -165,14 +165,11 @@ bool UtilLidMgr::getLidPnorSectionInfo(uint32_t i_lidId, // Load the secure section l_err = loadSecureSection(l_secId); - - // If secure section fails to load log the error and assert if (l_err) { - errlCommit(l_err, UTIL_COMP_ID); - assert(false,"UtilLidMgr::getLidPnorSectionInfo: attempt to " - "load Secure Section %d failed", - l_secId); + UTIL_FT("UtilLidMgr::getLidPnorSectionInfo loadSecureSection failed for Section %d", + l_secId); + break; } // In Secureboot, rather than using the whole partition size, @@ -189,5 +186,5 @@ bool UtilLidMgr::getLidPnorSectionInfo(uint32_t i_lidId, } } while(0); - return l_lidInPnor; + return l_err; } |

