diff options
Diffstat (limited to 'src/usr/pnor/pnor_common.C')
-rw-r--r-- | src/usr/pnor/pnor_common.C | 90 |
1 files changed, 48 insertions, 42 deletions
diff --git a/src/usr/pnor/pnor_common.C b/src/usr/pnor/pnor_common.C index 3b642a6e6..41f17ff7e 100644 --- a/src/usr/pnor/pnor_common.C +++ b/src/usr/pnor/pnor_common.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2018 */ +/* Contributors Listed Below - COPYRIGHT 2014,2019 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -34,7 +34,6 @@ #include <initservice/initserviceif.H> #include <util/align.H> #include <errl/errlmanager.H> -#include <config.h> // @FIXME RTC 132398 #include <secureboot/trustedbootif.H> #include <devicefw/driverif.H> @@ -144,12 +143,16 @@ errlHndl_t PNOR::parseTOC( uint8_t* i_tocBuffer,SectionData_t * o_TOC, // Zero out my table PNOR::initializeSections(o_TOC); - uint32_t l_errCode = 0; - ffs_hdr* l_ffs_hdr = NULL; + uint32_t l_errCode(0); + ffs_hdr* l_ffs_hdr(reinterpret_cast<ffs_hdr*>(i_tocBuffer)); TRACDCOMP(g_trac_pnor, "PNOR::parseTOC verifying TOC"); + if (!l_ffs_hdr) + { + l_errCode = PNOR::BUFF_IS_NULL; + l_ffs_hdr = nullptr; + } - PNOR::checkForNullBuffer(i_tocBuffer, l_errCode, l_ffs_hdr); //Check if the buffer is null if(l_errCode != NO_ERROR) { @@ -160,16 +163,16 @@ errlHndl_t PNOR::parseTOC( uint8_t* i_tocBuffer,SectionData_t * o_TOC, "Null TOC Buffer found while checking TOC" " during pnor initialization"); /*@ - * @errortype - * @moduleid PNOR::MOD_PNORRP_READTOC - * @reasoncode PNOR::RC_NULL_TOC_BUFFER - * @userdata1 Address of toc buffer - * @userdata2 Error code - * @devdesc Expected buffer to have contents of TOC, - * instead was NULL - * @custdesc A problem occurred while reading - * Processor NOR flash partition table - */ + * @errortype + * @moduleid PNOR::MOD_PNORRP_READTOC + * @reasoncode PNOR::RC_NULL_TOC_BUFFER + * @userdata1 Address of toc buffer + * @userdata2 Error code + * @devdesc Expected buffer to have contents of TOC, + * instead was NULL + * @custdesc A problem occurred while reading + * Processor NOR flash partition table + */ l_errhdl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_PNORRP_READTOC, @@ -197,15 +200,16 @@ errlHndl_t PNOR::parseTOC( uint8_t* i_tocBuffer,SectionData_t * o_TOC, "PNOR::parseTOC Found checksum error in TOC's header" " during pnor initialization"); - /* @errortype - * @moduleid PNOR::MOD_PNORRP_READTOC - * @reasoncode PNOR::RC_TOC_HDR_CHECKSUM_ERR - * @userdata1 Address of toc buffer - * @userdata2 Error Code - * @devdesc Hdr of TOC of PNOR failed checksum - * @custdesc A problem occurred while reading - * Processor NOR flash partition table - */ + /*@ + * @errortype + * @moduleid PNOR::MOD_PNORRP_READTOC + * @reasoncode PNOR::RC_TOC_HDR_CHECKSUM_ERR + * @userdata1 Address of toc buffer + * @userdata2 Error Code + * @devdesc Hdr of TOC of PNOR failed checksum + * @custdesc A problem occurred while reading + * Processor NOR flash partition table + */ l_errhdl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_PNORRP_READTOC, @@ -230,15 +234,16 @@ errlHndl_t PNOR::parseTOC( uint8_t* i_tocBuffer,SectionData_t * o_TOC, assert(i_pnorInitialized, "PNOR::parseTOC Error found parsing hdr of TOC" " during pnor initialization"); - /* @errortype - * @moduleid PNOR::MOD_PNORRP_READTOC - * @reasoncode PNOR::RC_BAD_TOC_HEADER - * @userdata1 Address of toc buffer - * @userdata2 Error Code - * @devdesc Hdr of TOC of PNOR failed series of tests - * @custdesc A problem occurred while reading - * Processor NOR flash partition table - */ + /*@ + * @errortype + * @moduleid PNOR::MOD_PNORRP_READTOC + * @reasoncode PNOR::RC_BAD_TOC_HEADER + * @userdata1 Address of toc buffer + * @userdata2 Error Code + * @devdesc Hdr of TOC of PNOR failed series of tests + * @custdesc A problem occurred while reading + * Processor NOR flash partition table + */ l_errhdl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_PNORRP_READTOC, @@ -276,15 +281,16 @@ errlHndl_t PNOR::parseTOC( uint8_t* i_tocBuffer,SectionData_t * o_TOC, "PNOR::parseTOC parseEntries returned an error code" " during pnor initialization"); - /* @errortype - * @moduleid PNOR::MOD_PNORRP_READTOC - * @reasoncode PNOR::RC_PNOR_PARSE_ENTRIES_ERR - * @userdata1 Address of toc buffer - * @userdata2 Error Code - * @devdesc Error while parsing pnor TOC entries - * @custdesc A problem occurred while reading - * Processor NOR flash partition table - */ + /*@ + * @errortype + * @moduleid PNOR::MOD_PNORRP_READTOC + * @reasoncode PNOR::RC_PNOR_PARSE_ENTRIES_ERR + * @userdata1 Address of toc buffer + * @userdata2 Error Code + * @devdesc Error while parsing pnor TOC entries + * @custdesc A problem occurred while reading + * Processor NOR flash partition table + */ l_errhdl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_PNORRP_READTOC, |