summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoland Veloz <rveloz@us.ibm.com>2019-04-30 23:22:00 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2019-05-07 08:51:08 -0500
commitd935c5c94a9e1c23325f3dcd4ed113a6985412db (patch)
tree83f05f240b8f65eb506d4f9a9d03abea6b8563ff /src
parente4b279cb88d769dd7167b35d0d6f51d9c5500bd3 (diff)
downloadblackbird-hostboot-d935c5c94a9e1c23325f3dcd4ed113a6985412db.tar.gz
blackbird-hostboot-d935c5c94a9e1c23325f3dcd4ed113a6985412db.zip
Added more error reporting to HWSV when PNOR fails, removed superfluous code
- Replaced the terminate (terminateExecuteTI) raw calls with bl_terminate. Returning descriptive RC codes with bl_terminate call. - Module ID MOD_PNORACC_FINDTOC(=0x08) was added to hbblModuleId enums. - Return codes RC_LPC_ERR(HBBL_COMP_ID | 0x10) and RC_TOC_NOT_FOUND_ERR(HBBL_COMP_ID | 0x11) added to hbblReasonCode enums. - Freed up space in bootoloader: - Removed unnecessary calls to the method PNOR::checkForNullBuffer, because the call is always guaranteed to return with no error. - Once the calls to PNOR::checkForNullBuffer were dropped, the method PNOR::checkForNullBuffer is no longer necessary - removed it from production code. - The unit tests relied heavily on the call to PNOR::checkForNullBuffer, was not sure if the call could be removed from the unit tests, so relocated the PNOR::checkForNullBuffer method to the unit tests, out of production code. Change-Id: I1e3f8915ee4ed9b75ad74c57627ca1d2bc3a458d CQ:SW464040 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/76787 Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/bootloader/bl_pnorAccess.C71
-rw-r--r--src/include/bootloader/bootloader_trace.H4
-rw-r--r--src/include/bootloader/hbblreasoncodes.H3
-rw-r--r--src/usr/pnor/pnor_common.C12
-rw-r--r--src/usr/pnor/pnor_utils.C24
-rw-r--r--src/usr/pnor/test/pnorutilsTest.H43
6 files changed, 85 insertions, 72 deletions
diff --git a/src/bootloader/bl_pnorAccess.C b/src/bootloader/bl_pnorAccess.C
index 89183754a..ac49e010b 100644
--- a/src/bootloader/bl_pnorAccess.C
+++ b/src/bootloader/bl_pnorAccess.C
@@ -57,32 +57,8 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
BOOTLOADER_TRACE(BTLDR_TRC_PA_READTOC_ZEROSECTION_RTN);
- //make sure that the buffer is not null
- PNOR::checkForNullBuffer(i_tocBuffer, o_errCode, l_ffs_hdr);
-
- if(o_errCode != PNOR::NO_ERROR)
- {
- BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_READTOC_CHKNULLBUFFER_NULL);
- // Always TI if NULL pointer is passed in
- /*@
- * @errortype
- * @moduleid Bootloader::MOD_PNORACC_READTOC
- * @reasoncode Bootloader::RC_CHK_NULL_BUFFER
- * @userdata1[0:15] TI_WITH_SRC
- * @userdata1[16:31] TI_BOOTLOADER
- * @userdata1[32:63] Failing address = 0
- * @userdata2[0:31] Pointer to TOC buffer
- * @userdata2[32:63] Error code
- * @devdesc Invalid TOC buffer pointer
- * @custdesc A problem occurred while running processor
- * boot code.
- */
- bl_terminate(Bootloader::MOD_PNORACC_READTOC,
- Bootloader::RC_CHK_NULL_BUFFER,
- reinterpret_cast<uint64_t>(i_tocBuffer),
- o_errCode);
- break;
- }
+ // Create a convenient way to access the ffs_hdr struct
+ l_ffs_hdr = reinterpret_cast<ffs_hdr*>(i_tocBuffer);
BOOTLOADER_TRACE(BTLDR_TRC_PA_READTOC_CHECKNULLBUFFER_RTN);
@@ -233,8 +209,25 @@ void bl_pnorAccess::findTOC(uint64_t i_lpcBar, PNOR::SectionData_t * o_TOC,
//PNOR error found
o_errCode = PNOR::LPC_ERR;
BOOTLOADER_TRACE(BTLDR_TRC_PA_FINDTOC_TOC1_LPC_ERR);
- //@TODO RTC:203989 Add LPC Error/Status Reg as part of FFDC
- terminateExecuteTI();
+ /*@
+ * @errortype
+ * @moduleid Bootloader::MOD_PNORACC_FINDTOC
+ * @reasoncode Bootloader::RC_LPC_ERR
+ * @userdata1[0:15] TI_WITH_SRC
+ * @userdata1[16:31] TI_BOOTLOADER
+ * @userdata1[32:63] Failing address = 0
+ * @userdata2[0:31] LPC error/status
+ * @userdata2[32:63] Error code
+ * @devdesc LPC error detected.
+ * @custdesc A problem occurred while running processor
+ * boot code.
+ */
+ bl_terminate(Bootloader::MOD_PNORACC_FINDTOC,
+ Bootloader::RC_LPC_ERR,
+ (*l_val),
+ o_errCode,
+ true);
+ break;
}
//Copy Table of Contents from PNOR flash to a local buffer
@@ -293,10 +286,24 @@ void bl_pnorAccess::findTOC(uint64_t i_lpcBar, PNOR::SectionData_t * o_TOC,
(g_blData->blToHbData.lpcBAR + LPC::LPCHC_FW_SPACE))
{
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_FINDTOC_READTOC_ERR);
-
- // TI with data from readTOC
- terminateExecuteTI();
-
+ /*@
+ * @errortype
+ * @moduleid Bootloader::MOD_PNORACC_FINDTOC
+ * @reasoncode Bootloader::RC_TOC_NOT_FOUND_ERR
+ * @userdata1[0:15] TI_WITH_SRC
+ * @userdata1[16:31] TI_BOOTLOADER
+ * @userdata1[32:63] Failing address = 0
+ * @userdata2 MMIO Address
+ * @devdesc TOC not found
+ * @custdesc A problem occurred while running processor
+ * boot code.
+ */
+ bl_terminate(Bootloader::MOD_PNORACC_FINDTOC,
+ Bootloader::RC_TOC_NOT_FOUND_ERR,
+ // Extract the l_mmioAddr address among 2 - 32 bits
+ (l_mmioAddr >> 32),
+ l_mmioAddr,
+ true);
break;
}
}
diff --git a/src/include/bootloader/bootloader_trace.H b/src/include/bootloader/bootloader_trace.H
index 69c708ad0..0c82a936e 100644
--- a/src/include/bootloader/bootloader_trace.H
+++ b/src/include/bootloader/bootloader_trace.H
@@ -166,9 +166,9 @@ enum BootloaderTraces
/** Bootloader main removeECC returned error */
BTLDR_TRC_MAIN_REMOVEECC_FAIL = 0xF1,
-
+
/** Bootloader PNOR Access readTOC checkForNullBuffer null buffer */
- BTLDR_TRC_PA_READTOC_CHKNULLBUFFER_NULL = 0xF2,
+ BTLDR_TRC_PA_READTOC_CHKNULLBUFFER_NULL = 0xF2, // deprecated - do not use
/** Bootloader PNOR Access readTOC performHdrChecksum checksum error */
BTLDR_TRC_PA_READTOC_HDRCHECKSUM_ERR = 0xF3,
diff --git a/src/include/bootloader/hbblreasoncodes.H b/src/include/bootloader/hbblreasoncodes.H
index 7ea0f189f..b5fe331e3 100644
--- a/src/include/bootloader/hbblreasoncodes.H
+++ b/src/include/bootloader/hbblreasoncodes.H
@@ -50,6 +50,7 @@ namespace Bootloader
MOD_BOOTLOADER_VERIFY = 0x05, /**< bootloader.C : verifyContainer */
MOD_BOOTLOADER_ASSERT = 0x06, /**< bootloader.H assert */
MOD_BOOTLOADER_VERIFY_COMP_ID = 0x07, /**< bootloader.C : verifyComponentId */
+ MOD_PNORACC_FINDTOC = 0x08, /**< bl_pnorAccess.C : find TOC */
};
/**
@@ -75,6 +76,8 @@ namespace Bootloader
RC_PNOR_SECID_OUT_OF_RANGE = HBBL_COMP_ID | 0x0D, /**< Requested PNOR SecId DNE in string array */
RC_PNOR_NULLPTR = HBBL_COMP_ID | 0x0E, /**< Requested address to compare is a nullptr */
RC_BAD_WORK_LEN = HBBL_COMP_ID | 0x0F, /**< Working length too large */
+ RC_LPC_ERR = HBBL_COMP_ID | 0x10, /**< LPC Error */
+ RC_TOC_NOT_FOUND_ERR = HBBL_COMP_ID | 0x11, /**< TOC Not Found Error */
};
}; // end Bootloader
diff --git a/src/usr/pnor/pnor_common.C b/src/usr/pnor/pnor_common.C
index 3b642a6e6..0bdb3ebcb 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. */
/* */
@@ -144,12 +144,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)
{
diff --git a/src/usr/pnor/pnor_utils.C b/src/usr/pnor/pnor_utils.C
index 134bb8113..8858d6826 100644
--- a/src/usr/pnor/pnor_utils.C
+++ b/src/usr/pnor/pnor_utils.C
@@ -110,30 +110,6 @@ void PNOR::initializeSections(PNOR::SectionData_t io_toc[NUM_SECTIONS])
}
}
-
-
-/**
- * @brief Ensure the buffer is not NULL, if it is, then return
- * the appropriate err code from the o_errCode param.
- * if the buffer is not NULL then cast it to a ffs_hdr
- * and return that out through the respective o_param
- */
-void PNOR::checkForNullBuffer(uint8_t* i_tocBuffer,
- uint32_t& o_errCode,
- ffs_hdr*& o_ffs_hdr)
-{
- if(!i_tocBuffer)
- {
- o_errCode |= BUFF_IS_NULL;
- o_ffs_hdr = NULL;
- }
- else
- {
- o_ffs_hdr = (ffs_hdr*)i_tocBuffer;
- }
-}
-
-
/**
* @brief Perform a series of checks on the header of the table of contents
* These checks include: looking for valid magic #, valid block size,
diff --git a/src/usr/pnor/test/pnorutilsTest.H b/src/usr/pnor/test/pnorutilsTest.H
index a2258c622..b273665c7 100644
--- a/src/usr/pnor/test/pnorutilsTest.H
+++ b/src/usr/pnor/test/pnorutilsTest.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2017 */
+/* Contributors Listed Below - COPYRIGHT 2014,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -62,7 +62,7 @@ class pnorutilsTest : public CxxTest::TestSuite
l_tocBuffer[17] = 0x41;
ffs_hdr* l_ffs_hdr = NULL;
- PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
PNOR::checkHeader(l_ffs_hdr, l_errCode);
if((l_errCode & PNOR::INVALID_MAGIC) == PNOR::INVALID_MAGIC)
@@ -92,7 +92,7 @@ class pnorutilsTest : public CxxTest::TestSuite
l_tocBuffer[7] = 0x0;
ffs_hdr* l_ffs_hdr = NULL;
- PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
PNOR::checkHeader(l_ffs_hdr, l_errCode);
@@ -122,7 +122,7 @@ class pnorutilsTest : public CxxTest::TestSuite
l_tocBuffer[31] = 0x80;
ffs_hdr* l_ffs_hdr = NULL;
- PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
PNOR::checkHeader(l_ffs_hdr, l_errCode);
@@ -153,7 +153,7 @@ class pnorutilsTest : public CxxTest::TestSuite
l_tocBuffer[35] = 0x12;
ffs_hdr* l_ffs_hdr = NULL;
- PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
PNOR::checkHeader(l_ffs_hdr, l_errCode);
@@ -183,7 +183,7 @@ class pnorutilsTest : public CxxTest::TestSuite
l_tocBuffer[38] = 0x10;
ffs_hdr* l_ffs_hdr = NULL;
- PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
PNOR::checkHeader(l_ffs_hdr, l_errCode);
@@ -213,7 +213,7 @@ class pnorutilsTest : public CxxTest::TestSuite
l_tocBuffer[42] = 0x40;
ffs_hdr* l_ffs_hdr = NULL;
- PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
PNOR::checkHeader(l_ffs_hdr, l_errCode);
@@ -246,7 +246,7 @@ class pnorutilsTest : public CxxTest::TestSuite
l_tocBuffer[39] = 0x33;
ffs_hdr* l_ffs_hdr = NULL;
- PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
PNOR::checkHeader(l_ffs_hdr, l_errCode);
@@ -276,7 +276,7 @@ class pnorutilsTest : public CxxTest::TestSuite
l_tocBuffer[208] = 0xFF;
PNOR::SectionData_t l_TOC[PNOR::NUM_SECTIONS];
ffs_hdr* l_ffs_hdr = NULL;
- PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
PNOR::checkHeader(l_ffs_hdr, l_errCode);
//parse through the entries and check for any errors
ffs_entry* l_err_entry = NULL;
@@ -317,7 +317,7 @@ class pnorutilsTest : public CxxTest::TestSuite
PNOR::SectionData_t l_TOC[PNOR::NUM_SECTIONS];
ffs_hdr* l_ffs_hdr = NULL;
- PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
PNOR::checkHeader(l_ffs_hdr, l_errCode);
//parse through the entries and check for any errors
ffs_entry* l_err_entry = NULL;
@@ -336,6 +336,29 @@ class pnorutilsTest : public CxxTest::TestSuite
TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_entryExtendsBeyondFlash: complete, Failed = %d", l_failed);
}
+
+ private:
+
+ /**
+ * @brief Ensure the buffer is not NULL, if it is, then return
+ * the appropriate err code from the o_errCode param.
+ * If the buffer is not NULL then cast it to a ffs_hdr
+ * and return that out through the o_ffs_hdr param.
+ */
+ void checkForNullBuffer(uint8_t* i_tocBuffer,
+ uint32_t& o_errCode,
+ ffs_hdr*& o_ffs_hdr)
+ {
+ if(!i_tocBuffer)
+ {
+ o_errCode |= PNOR::BUFF_IS_NULL;
+ o_ffs_hdr = NULL;
+ }
+ else
+ {
+ o_ffs_hdr = reinterpret_cast<ffs_hdr*>(i_tocBuffer);
+ }
+ }
};
#endif
OpenPOWER on IntegriCloud