summaryrefslogtreecommitdiffstats
path: root/src/bootloader/bl_pnorAccess.C
diff options
context:
space:
mode:
authorMarty Gloff <mgloff@us.ibm.com>2016-11-08 14:29:38 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-01-04 21:15:44 -0500
commit82af686f8456f594ae17409f1e1e70fc55485cd8 (patch)
treedfb45ebed75b31efdc09f0e5d248d30c6d0a52a6 /src/bootloader/bl_pnorAccess.C
parentb2e82859d8551ef4ee4c6e270794b2fd2d5ad3a4 (diff)
downloadtalos-hostboot-82af686f8456f594ae17409f1e1e70fc55485cd8.tar.gz
talos-hostboot-82af686f8456f594ae17409f1e1e70fc55485cd8.zip
Bootloader - Error handling - Add terminate function
As a first step to providing Bootloader error handling add support for a terminate function. Change-Id: Id4f8f130376d1396cd4feb796d1a3a908558225b RTC:135746 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/32390 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/bootloader/bl_pnorAccess.C')
-rw-r--r--src/bootloader/bl_pnorAccess.C110
1 files changed, 106 insertions, 4 deletions
diff --git a/src/bootloader/bl_pnorAccess.C b/src/bootloader/bl_pnorAccess.C
index e5e790426..77f53265c 100644
--- a/src/bootloader/bl_pnorAccess.C
+++ b/src/bootloader/bl_pnorAccess.C
@@ -25,6 +25,7 @@
#include <bootloader/bl_pnorAccess.H>
#include <bootloader/bootloader_trace.H>
+#include <bootloader/hbblreasoncodes.H>
#include <util/singleton.H>
#include <bootloader/bootloader.H>
#ifdef PNORUTILSTEST_H
@@ -48,6 +49,7 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
do
{
o_errCode = PNOR::NO_ERROR;
+ o_pnorStart = NULL;
ffs_hdr* l_ffs_hdr = NULL;
//zero out the section data for each section
@@ -58,18 +60,37 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
//make sure that the buffer is not null
PNOR::checkForNullBuffer(i_tocBuffer, o_errCode, l_ffs_hdr);
- //Subtract the size of the pnor from the end address to find the start
- o_pnorStart = i_pnorEnd -
- (l_ffs_hdr->block_size * l_ffs_hdr->block_count) + 1;
-
if(o_errCode != PNOR::NO_ERROR)
{
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_READTOC_CHKNULLBUFFER_NULL);
+ // Set TI information but caller decides to TI or not
+ /*@
+ * @errortype
+ * @moduleid MOD_PNORACC_READTOC
+ * @reasoncode 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,
+ false);
break;
}
BOOTLOADER_TRACE(BTLDR_TRC_PA_READTOC_CHECKNULLBUFFER_RTN);
+ //Subtract the size of the pnor from the end address to find the start
+ o_pnorStart = i_pnorEnd -
+ (l_ffs_hdr->block_size * l_ffs_hdr->block_count) + 1;
+
//Do a checksum on the header
if(PNOR::pnor_ffs_checksum(l_ffs_hdr, FFS_HDR_SIZE) != 0)
{
@@ -79,6 +100,25 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
if(o_errCode != PNOR::NO_ERROR)
{
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_READTOC_HDRCHECKSUM_ERR);
+ // Set TI information but caller decides to TI or not
+ /*@
+ * @errortype
+ * @moduleid MOD_PNORACC_READTOC
+ * @reasoncode RC_HDR_CHECKSUM_ERR
+ * @userdata1[0:15] TI_WITH_SRC
+ * @userdata1[16:31] TI_BOOTLOADER
+ * @userdata1[32:63] Failing address = 0
+ * @userdata2[0:31] Pointer to FFS header
+ * @userdata2[32:63] Error code
+ * @devdesc FFS header checksum error
+ * @custdesc A problem occurred while running processor
+ * boot code.
+ */
+ bl_terminate(Bootloader::MOD_PNORACC_READTOC,
+ Bootloader::RC_HDR_CHECKSUM_ERR,
+ reinterpret_cast<uint64_t>(l_ffs_hdr),
+ o_errCode,
+ false);
break;
}
@@ -90,6 +130,25 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
if(o_errCode != PNOR::NO_ERROR)
{
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_READTOC_CHECKHEADER_ERR);
+ // Set TI information but caller decides to TI or not
+ /*@
+ * @errortype
+ * @moduleid MOD_PNORACC_READTOC
+ * @reasoncode RC_CHECK_HEADER_ERR
+ * @userdata1[0:15] TI_WITH_SRC
+ * @userdata1[16:31] TI_BOOTLOADER
+ * @userdata1[32:63] Failing address = 0
+ * @userdata2[0:31] Pointer to FFS header
+ * @userdata2[32:63] Error code
+ * @devdesc Check FFS header error(s)
+ * @custdesc A problem occurred while running processor
+ * boot code.
+ */
+ bl_terminate(Bootloader::MOD_PNORACC_READTOC,
+ Bootloader::RC_CHECK_HEADER_ERR,
+ reinterpret_cast<uint64_t>(l_ffs_hdr),
+ o_errCode,
+ false);
break;
}
BOOTLOADER_TRACE(BTLDR_TRC_PA_READTOC_CHECKHEADER_RTN);
@@ -106,6 +165,25 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
if(o_errCode != PNOR::NO_ERROR)
{
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_READTOC_PARSEENTRIES_ERR);
+ // Set TI information but caller decides to TI or not
+ /*@
+ * @errortype
+ * @moduleid MOD_PNORACC_READTOC
+ * @reasoncode RC_PARSE_ENTRIES_ERR
+ * @userdata1[0:15] TI_WITH_SRC
+ * @userdata1[16:31] TI_BOOTLOADER
+ * @userdata1[32:63] Failing address = 0
+ * @userdata2[0:31] Pointer to FFS entry with error
+ * @userdata2[32:63] Error code
+ * @devdesc Parse FFS entries error
+ * @custdesc A problem occurred while running processor
+ * boot code.
+ */
+ bl_terminate(Bootloader::MOD_PNORACC_READTOC,
+ Bootloader::RC_PARSE_ENTRIES_ERR,
+ reinterpret_cast<uint64_t>(l_err_entry),
+ o_errCode,
+ false);
break;
}
BOOTLOADER_TRACE(BTLDR_TRC_PA_READTOC_PARSEENTRIES_RTN);
@@ -143,6 +221,10 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC,
}
else
{
+ // @TODO RTC:164445 Can remove if there is a way to find another TOC
+ // TI with data from readTOC
+ terminateExecuteTI();
+
//If the first toc was invalid, look for the backup in the start
Bootloader::handleMMIO(o_pnorStart,
reinterpret_cast<uint64_t>(l_tocBuffer),
@@ -157,6 +239,8 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC,
break;
}
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_FINDTOC_READTOC_ERR);
+ // TI with data from readTOC
+ terminateExecuteTI();
}
break;
@@ -181,6 +265,7 @@ void bl_pnorAccess::getHBBSection(uint64_t i_pnorEnd,
if(o_errCode != PNOR::NO_ERROR)
{
+ // Note findTOC should have TI'd so won't get here
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_GETHBBSECTION_FINDTOC_ERR);
break;
}
@@ -190,6 +275,23 @@ void bl_pnorAccess::getHBBSection(uint64_t i_pnorEnd,
{
o_errCode = PNOR::NO_HBB_SECTION;
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_GETHBBSECTION_FINDTOC_NOHBB);
+ /*@
+ * @errortype
+ * @moduleid MOD_PNORACC_GETHBBSECT
+ * @reasoncode RC_NO_HBB_IN_TOC
+ * @userdata1[0:15] TI_WITH_SRC
+ * @userdata1[16:31] TI_BOOTLOADER
+ * @userdata1[32:63] Failing address = 0
+ * @userdata2[0:31] Pointer to HBB Section data
+ * @userdata2[32:63] HBB Section flash address
+ * @devdesc Invalid flash address for HBB
+ * @custdesc A problem occurred while running processor
+ * boot code.
+ */
+ bl_terminate(Bootloader::MOD_PNORACC_GETHBBSECT,
+ Bootloader::RC_NO_HBB_IN_TOC,
+ reinterpret_cast<uint64_t>(&o_hbbSection),
+ o_hbbSection.flashAddr);
break;
}
} while(0);
OpenPOWER on IntegriCloud