summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bootloader/bl_pnorAccess.C22
-rw-r--r--src/bootloader/bl_terminate.C16
-rw-r--r--src/bootloader/bootloader.C6
-rw-r--r--src/build/debug/Hostboot/BlTrace.pm1
-rw-r--r--src/include/bootloader/bootloader_trace.H3
-rw-r--r--src/include/bootloader/hbblreasoncodes.H38
-rw-r--r--src/include/usr/pnor/pnor_const.H1
-rwxr-xr-xsrc/usr/errl/parser/genErrlParsers.pl5
-rw-r--r--src/usr/pnor/pnor_common.C9
-rw-r--r--src/usr/pnor/pnor_utils.C121
-rw-r--r--src/usr/pnor/pnor_utils.H16
-rw-r--r--src/usr/pnor/pnorrp.C10
-rw-r--r--src/usr/pnor/runtime/rt_pnor.C11
-rw-r--r--src/usr/pnor/test/pnorutilsTest.H4
-rw-r--r--src/usr/testcore/rtloader/loader.H4
-rw-r--r--src/usr/testcore/rtloader/makefile6
16 files changed, 166 insertions, 107 deletions
diff --git a/src/bootloader/bl_pnorAccess.C b/src/bootloader/bl_pnorAccess.C
index 037b5eb68..b8db406a0 100644
--- a/src/bootloader/bl_pnorAccess.C
+++ b/src/bootloader/bl_pnorAccess.C
@@ -33,8 +33,6 @@
#define BOOTLOADER_TRACE_W_BRK(args) TRACFCOMP(g_trac_pnor,"##args")
#endif
-
-extern const char* cv_EYECATCHER[];
/**
* @brief Takes in a buffer containing a ToC, as well as a base address
Returns out a boolean whether or not this toc was valid
@@ -66,8 +64,8 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
// Set TI information but caller decides to TI or not
/*@
* @errortype
- * @moduleid MOD_PNORACC_READTOC
- * @reasoncode RC_CHK_NULL_BUFFER
+ * @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
@@ -103,8 +101,8 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
// Set TI information but caller decides to TI or not
/*@
* @errortype
- * @moduleid MOD_PNORACC_READTOC
- * @reasoncode RC_HDR_CHECKSUM_ERR
+ * @moduleid Bootloader::MOD_PNORACC_READTOC
+ * @reasoncode Bootloader::RC_HDR_CHECKSUM_ERR
* @userdata1[0:15] TI_WITH_SRC
* @userdata1[16:31] TI_BOOTLOADER
* @userdata1[32:63] Failing address = 0
@@ -133,8 +131,8 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
// Set TI information but caller decides to TI or not
/*@
* @errortype
- * @moduleid MOD_PNORACC_READTOC
- * @reasoncode RC_CHECK_HEADER_ERR
+ * @moduleid Bootloader::MOD_PNORACC_READTOC
+ * @reasoncode Bootloader::RC_CHECK_HEADER_ERR
* @userdata1[0:15] TI_WITH_SRC
* @userdata1[16:31] TI_BOOTLOADER
* @userdata1[32:63] Failing address = 0
@@ -168,8 +166,8 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
// Set TI information but caller decides to TI or not
/*@
* @errortype
- * @moduleid MOD_PNORACC_READTOC
- * @reasoncode RC_PARSE_ENTRIES_ERR
+ * @moduleid Bootloader::MOD_PNORACC_READTOC
+ * @reasoncode Bootloader::RC_PARSE_ENTRIES_ERR
* @userdata1[0:15] TI_WITH_SRC
* @userdata1[16:31] TI_BOOTLOADER
* @userdata1[32:63] Failing address = 0
@@ -277,8 +275,8 @@ void bl_pnorAccess::getHBBSection(uint64_t i_pnorEnd,
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_GETHBBSECTION_FINDTOC_NOHBB);
/*@
* @errortype
- * @moduleid MOD_PNORACC_GETHBBSECT
- * @reasoncode RC_NO_HBB_IN_TOC
+ * @moduleid Bootloader::MOD_PNORACC_GETHBBSECT
+ * @reasoncode Bootloader::RC_NO_HBB_IN_TOC
* @userdata1[0:15] TI_WITH_SRC
* @userdata1[16:31] TI_BOOTLOADER
* @userdata1[32:63] Failing address = 0
diff --git a/src/bootloader/bl_terminate.C b/src/bootloader/bl_terminate.C
index 8c2c1ab1f..e0721bc37 100644
--- a/src/bootloader/bl_terminate.C
+++ b/src/bootloader/bl_terminate.C
@@ -43,8 +43,8 @@ void kernel_std_exception()
/*@
* @errortype
- * @moduleid MOD_BOOTLOADER_TERMINATE
- * @reasoncode RC_STD_EXCEPTION
+ * @moduleid Bootloader::MOD_BOOTLOADER_TERMINATE
+ * @reasoncode Bootloader::RC_STD_EXCEPTION
* @userdata1[0:15] TI_WITH_SRC
* @userdata1[16:31] TI_BOOTLOADER
* @userdata1[32:63] Exception vector address
@@ -69,8 +69,8 @@ void kernel_std_exception_w_dsisr()
/*@
* @errortype
- * @moduleid MOD_BOOTLOADER_TERMINATE
- * @reasoncode RC_STD_EX_W_DSISR
+ * @moduleid Bootloader::MOD_BOOTLOADER_TERMINATE
+ * @reasoncode Bootloader::RC_STD_EX_W_DSISR
* @userdata1[0:15] TI_WITH_SRC
* @userdata1[16:31] TI_BOOTLOADER
* @userdata1[32:63] Exception vector address
@@ -97,8 +97,8 @@ void kernel_std_exception_w_srr1()
/*@
* @errortype
- * @moduleid MOD_BOOTLOADER_TERMINATE
- * @reasoncode RC_STD_EX_W_SRR1
+ * @moduleid Bootloader::MOD_BOOTLOADER_TERMINATE
+ * @reasoncode Bootloader::RC_STD_EX_W_SRR1
* @userdata1[0:15] TI_WITH_SRC
* @userdata1[16:31] TI_BOOTLOADER
* @userdata1[32:63] Exception vector address
@@ -124,8 +124,8 @@ void kernel_hype_exception()
/*@
* @errortype
- * @moduleid MOD_BOOTLOADER_TERMINATE
- * @reasoncode RC_HYPE_EXCEPTION
+ * @moduleid Bootloader::MOD_BOOTLOADER_TERMINATE
+ * @reasoncode Bootloader::RC_HYPE_EXCEPTION
* @userdata1[0:15] TI_WITH_SRC
* @userdata1[16:31] TI_BOOTLOADER
* @userdata1[32:63] Exception vector address
diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C
index be2c2f748..305033f44 100644
--- a/src/bootloader/bootloader.C
+++ b/src/bootloader/bootloader.C
@@ -216,7 +216,7 @@ namespace Bootloader{
BOOTLOADER_TRACE(BTLDR_TRC_MAIN_VERIFY_FAIL);
/*@
* @errortype
- * @moduleid MOD_BOOTLOADER_VERIFY
+ * @moduleid Bootloader::MOD_BOOTLOADER_VERIFY
* @reasoncode SECUREBOOT::RC_ROM_VERIFY
* @userdata1 ROM return code
* @userdata2 ROM_hw_params log
@@ -351,8 +351,8 @@ namespace Bootloader{
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_MAIN_REMOVEECC_FAIL);
/*@
* @errortype
- * @moduleid MOD_BOOTLOADER_MAIN
- * @reasoncode RC_REMOVE_ECC_FAIL
+ * @moduleid Bootloader::MOD_BOOTLOADER_MAIN
+ * @reasoncode Bootloader::RC_REMOVE_ECC_FAIL
* @userdata1[0:15] TI_WITH_SRC
* @userdata1[16:31] TI_BOOTLOADER
* @userdata1[32:63] Failing address = 0
diff --git a/src/build/debug/Hostboot/BlTrace.pm b/src/build/debug/Hostboot/BlTrace.pm
index 321dca079..1c629d707 100644
--- a/src/build/debug/Hostboot/BlTrace.pm
+++ b/src/build/debug/Hostboot/BlTrace.pm
@@ -65,6 +65,7 @@ my %traceText = (
"E5" => "Utils checkHeader block count invalid",
"E6" => "Utils checkHeader header size invalid",
"E7" => "Utils parseEntries invalid section",
+ "E8" => "Utils SectionIdToString PNOR section id out of range",
"F0" => "Main getHBBSection returned",
"F1" => "Main removeECC returned error",
"F2" => "PNOR Access readTOC checkForNullBuffer null buffer",
diff --git a/src/include/bootloader/bootloader_trace.H b/src/include/bootloader/bootloader_trace.H
index 6de32997c..fb86e1c8b 100644
--- a/src/include/bootloader/bootloader_trace.H
+++ b/src/include/bootloader/bootloader_trace.H
@@ -141,6 +141,9 @@ enum BootloaderTraces
/** Bootloader Utils parseEntries invalid section */
BTLDR_TRC_UTILS_PARSE_INVALID_SECTION = 0xE7,
+ /** Bootloader Utils SectionIdToString PNOR section id out of range*/
+ BTLDR_TRC_UTILS_PARSE_PNOR_SECID_OUT_OF_RANGE = 0xE8,
+
/** Bootloader main getHBBSection returned error */
BTLDR_TRC_MAIN_GETHBBSECTION_FAIL = 0xF0,
diff --git a/src/include/bootloader/hbblreasoncodes.H b/src/include/bootloader/hbblreasoncodes.H
index 2b2ee0010..22abf9059 100644
--- a/src/include/bootloader/hbblreasoncodes.H
+++ b/src/include/bootloader/hbblreasoncodes.H
@@ -42,12 +42,13 @@ namespace Bootloader
*/
enum hbblModuleId
{
- MOD_BOOTLOADER_INVALID = 0x00, /**< Zero is an invalid module id */
- MOD_BOOTLOADER_TERMINATE = 0x01, /**< bl_terminate.C : save SRC */
- MOD_BOOTLOADER_MAIN = 0x02, /**< bootloader.C : main */
- MOD_PNORACC_READTOC = 0x03, /**< bl_pnorAccess.C : read TOC */
- MOD_PNORACC_GETHBBSECT = 0x04, /**< bl_pnorAccess.C : get HBB sect */
- MOD_BOOTLOADER_VERIFY = 0x05, /**< bootloader.C : verifyContainer */
+ MOD_BOOTLOADER_INVALID = 0x00, /**< Zero is an invalid module id */
+ MOD_BOOTLOADER_TERMINATE = 0x01, /**< bl_terminate.C : save SRC */
+ MOD_BOOTLOADER_MAIN = 0x02, /**< bootloader.C : main */
+ MOD_PNORACC_READTOC = 0x03, /**< bl_pnorAccess.C : read TOC */
+ MOD_PNORACC_GETHBBSECT = 0x04, /**< bl_pnorAccess.C : get HBB sect */
+ MOD_BOOTLOADER_VERIFY = 0x05, /**< bootloader.C : verifyContainer */
+ MOD_BOOTLOADER_PNOR_SECID_TO_STR = 0x06 /**< pnor_utils.C : SectionIdToString */
};
@@ -59,18 +60,19 @@ namespace Bootloader
*/
enum hbblReasonCode
{
- RC_ASSERT = HBBL_COMP_ID | 0x01, /**< Assert */
- RC_SHUTDOWN = HBBL_COMP_ID | 0x02, /**< Shutdown */
- RC_STD_EXCEPTION = HBBL_COMP_ID | 0x03, /**< Standard Exception */
- RC_STD_EX_W_DSISR = HBBL_COMP_ID | 0x04, /**< Std Except w/ DSISR */
- RC_STD_EX_W_SRR1 = HBBL_COMP_ID | 0x05, /**< Std Except w/ SRR1 */
- RC_HYPE_EXCEPTION = HBBL_COMP_ID | 0x06, /**< Hypervisor Exception */
- RC_REMOVE_ECC_FAIL = HBBL_COMP_ID | 0x07, /**< Remove ECC Failed */
- RC_CHK_NULL_BUFFER = HBBL_COMP_ID | 0x08, /**< Check for NULL Buffr */
- RC_HDR_CHECKSUM_ERR = HBBL_COMP_ID | 0x09, /**< Hdr Checksum Error */
- RC_CHECK_HEADER_ERR = HBBL_COMP_ID | 0x0A, /**< Check Header Error */
- RC_PARSE_ENTRIES_ERR = HBBL_COMP_ID | 0x0B, /**< Parse Entries Error */
- RC_NO_HBB_IN_TOC = HBBL_COMP_ID | 0x0C, /**< No HBB Sect in TOC */
+ RC_ASSERT = HBBL_COMP_ID | 0x01, /**< Assert */
+ RC_SHUTDOWN = HBBL_COMP_ID | 0x02, /**< Shutdown */
+ RC_STD_EXCEPTION = HBBL_COMP_ID | 0x03, /**< Standard Exception */
+ RC_STD_EX_W_DSISR = HBBL_COMP_ID | 0x04, /**< Std Except w/ DSISR */
+ RC_STD_EX_W_SRR1 = HBBL_COMP_ID | 0x05, /**< Std Except w/ SRR1 */
+ RC_HYPE_EXCEPTION = HBBL_COMP_ID | 0x06, /**< Hypervisor Exception */
+ RC_REMOVE_ECC_FAIL = HBBL_COMP_ID | 0x07, /**< Remove ECC Failed */
+ RC_CHK_NULL_BUFFER = HBBL_COMP_ID | 0x08, /**< Check for NULL Buffr */
+ RC_HDR_CHECKSUM_ERR = HBBL_COMP_ID | 0x09, /**< Hdr Checksum Error */
+ RC_CHECK_HEADER_ERR = HBBL_COMP_ID | 0x0A, /**< Check Header Error */
+ RC_PARSE_ENTRIES_ERR = HBBL_COMP_ID | 0x0B, /**< Parse Entries Error */
+ RC_NO_HBB_IN_TOC = HBBL_COMP_ID | 0x0C, /**< No HBB Sect in TOC */
+ RC_PNOR_SECID_OUT_OF_RANGE = HBBL_COMP_ID | 0x0D, /**< Requested PNOR SecId DNE in string array */
};
}; // end Bootloader
diff --git a/src/include/usr/pnor/pnor_const.H b/src/include/usr/pnor/pnor_const.H
index 3b4b199a0..0a96e3180 100644
--- a/src/include/usr/pnor/pnor_const.H
+++ b/src/include/usr/pnor/pnor_const.H
@@ -67,6 +67,7 @@ enum SectionId
POWERVM, /**< Power VM data */
RINGOVD, /**< Ring override data */
WOFDATA, /**< VFRT data tables for WOF */
+ SBKT, /**< SecureBoot Key Transition */
NUM_SECTIONS, /**< Number of defined sections */
FIRST_SECTION = TOC, /**< First section (for looping) */
diff --git a/src/usr/errl/parser/genErrlParsers.pl b/src/usr/errl/parser/genErrlParsers.pl
index c24df2f34..0316db383 100755
--- a/src/usr/errl/parser/genErrlParsers.pl
+++ b/src/usr/errl/parser/genErrlParsers.pl
@@ -76,6 +76,8 @@ while( $ARGV = shift )
my $compIdFile = $base."/src/include/usr/hbotcompid.H";
my $compPath = $base."/src/usr";
my $compIncPath = $base."/src/include/usr";
+my $compBlPath = $base."/src/bootloader";
+my $compBlIncPath = $base."/src/include/bootloader";
my $genFilesPath = $base."/obj/genfiles";
my $hbfwTermRcFile = $genFilesPath."/hbfw_term_rc.H";
my $srcFileName = $genFilesPath."/srcListing";
@@ -91,9 +93,12 @@ my @reasonCodeFiles;
my @filesToParse;
my @pluginDirsToParse;
getReasonCodeFiles($compIncPath);
+getReasonCodeFiles($compBlIncPath);
getFilesToParse($compPath);
getFilesToParse($compIncPath);
getFilesToParse($genFilesPath);
+getFilesToParse($compBlPath);
+getFilesToParse($compBlIncPath);
getPluginDirsToParse($compPath);
#Add kernel/lib files for TI SRC descriptions
diff --git a/src/usr/pnor/pnor_common.C b/src/usr/pnor/pnor_common.C
index 93978c277..f766e3937 100644
--- a/src/usr/pnor/pnor_common.C
+++ b/src/usr/pnor/pnor_common.C
@@ -46,11 +46,6 @@ TRAC_INIT(&g_trac_pnor, PNOR_COMP_NAME, 4*KILOBYTE, TRACE::BUFFER_SLOW); //4K
//#define TRACUCOMP(args...) TRACFCOMP(args)
#define TRACUCOMP(args...)
-/**
- * Eyecatcher strings for PNOR TOC entries
- */
-extern const char* cv_EYECATCHER[];
-
/*
* @brief determine the physical offset of the ffs entry
@@ -319,7 +314,7 @@ errlHndl_t PNOR::parseTOC( uint8_t* i_tocBuffer,SectionData_t * o_TOC)
addr -= headerSize;
l_errhdl = PNOR::extendHash(addr, headerSize,
- cv_EYECATCHER[l_secId]);
+ PNOR::SectionIdToString(l_secId));
if (l_errhdl)
{
break;
@@ -333,7 +328,7 @@ errlHndl_t PNOR::parseTOC( uint8_t* i_tocBuffer,SectionData_t * o_TOC)
tmpId ++ )
{
TRACFCOMP(g_trac_pnor, "%s: size=0x%.8X flash=0x%.8X ",
- cv_EYECATCHER[tmpId], o_TOC[tmpId].size,
+ PNOR::SectionIdToString(tmpId), o_TOC[tmpId].size,
o_TOC[tmpId].flashAddr);
}
diff --git a/src/usr/pnor/pnor_utils.C b/src/usr/pnor/pnor_utils.C
index 5af2993cb..c7e77cbb7 100644
--- a/src/usr/pnor/pnor_utils.C
+++ b/src/usr/pnor/pnor_utils.C
@@ -34,13 +34,16 @@
#include "pnor_utils.H"
#include <pnor/pnor_const.H>
-#if !defined(__BOOT_LOADER_H)
+#ifndef BOOTLOADER
#include <errl/errlmanager.H>
+#include <assert.h>
extern trace_desc_t* g_trac_pnor;
#define PNOR_UTIL_TRACE(arg0, args...) TRACFCOMP(g_trac_pnor, args)
#define PNOR_UTIL_TRACE_W_BRK(arg0, args...) TRACFCOMP(g_trac_pnor, args)
#else
#include <bootloader/bootloader_trace.H>
+#include <bootloader/bootloader.H>
+#include <bootloader/hbblreasoncodes.H>
#define PNOR_UTIL_TRACE(arg0, args...) BOOTLOADER_TRACE(arg0)
#define PNOR_UTIL_TRACE_W_BRK(arg0, args...) BOOTLOADER_TRACE_W_BRK(arg0)
#endif
@@ -49,42 +52,7 @@ extern trace_desc_t* g_trac_pnor;
#include "common/ffs_hb.H"
#include <util/align.H>
-/**
- * Eyecatcher strings for PNOR TOC entries
- */
-const char* cv_EYECATCHER[] = {
- "part", /**< PNOR::TOC : Table of Contents */
- "HBI", /**< PNOR::HB_EXT_CODE : Hostboot Extended Image */
- "GLOBAL", /**< PNOR::GLOBAL_DATA : Global Data */
- "HBB", /**< PNOR::HB_BASE_CODE : Hostboot Base Image */
- "SBEC", /**< PNOR::CENTAUR_SBE : Centaur Self-Boot Engine image */
- "SBE", /**< PNOR::SBE_IPL : Self-Boot Enginer IPL image */
- "HCODE", /**< PNOR::HCODE : HCODE Reference image */
- "PAYLOAD", /**< PNOR::PAYLOAD : HAL/OPAL */
- "HBRT", /**< PNOR::HB_RUNTIME : Hostboot Runtime(for Sapphire)*/
- "HBD", /**< PNOR::HB_DATA : Hostboot Data */
- "GUARD", /**< PNOR::GUARD_DATA : Hostboot Data */
- "HBEL", /**< PNOR::HB_ERRLOGS : Hostboot Error log Repository */
- "DJVPD", /**< PNOR::DIMM_JEDEC_VPD : Dimm JEDEC VPD */
- "MVPD", /**< PNOR::MODULE_VPD : Module VPD */
- "CVPD", /**< PNOR::CENTAUR_VPD : Centaur VPD */
- "NVRAM", /**< PNOR::NVRAM : OPAL Storage */
- "OCC", /**< PNOR::OCC : OCC LID */
- "FIRDATA", /**< PNOR::FIRDATA : FIRs for checkstop analysis */
- "ATTR_TMP", /**< PNOR::ATTR_TMP : Temporary Attribute Overrides */
- "ATTR_PERM", /**< PNOR::ATTR_PERM : Permanent Attribute Overrides */
- "CAPP", /**< PNOR::CAPP : CAPP LID */
- "VERSION", /**< PNOR::VERSION : PNOR Version string */
- "HBBL", /**<PNOR::HB_BOOTLOADER : Hostboot Bootloader image */
- "TEST", /**< PNOR::TEST : Test space for PNOR*/
- "TESTRO", /**< PNOR::TESTRO : ReadOnly Test space for PNOR */
- "BACKUP_PART", /**PNOR::BACKUP_PART : Backup of PART*/
- "POWERVM", /**< PNOR::POWERVM : Power VM data */
- "RINGOVD", /**< PNOR::RINGOVD : Ring overrides */
- "WOFDATA", /**< PNOR::WOFDATA : VFRT data tables for WOF */
-};
-
-/**
+/*
* @brief calculates the checksum on data(ffs header/entry) and will return
* 0 if the checksums match
*/
@@ -248,7 +216,7 @@ void PNOR::getSectionEnum (ffs_entry* i_entry,
for(uint32_t eyeIndex=PNOR::TOC;eyeIndex<PNOR::NUM_SECTIONS;
eyeIndex++)
{
- if(strcmp(cv_EYECATCHER[eyeIndex],i_entry->name) == 0)
+ if(strcmp(PNOR::SectionIdToString(eyeIndex),i_entry->name) == 0)
{
*o_secId = eyeIndex;
break;
@@ -382,3 +350,80 @@ bool PNOR::isSecureSection(const uint32_t i_section)
#endif
}
+const char * PNOR::SectionIdToString( uint32_t i_secIdIndex )
+{
+ /**
+ * Eyecatcher strings for PNOR TOC entries
+ * Use an array vs switch statement for O(1) lookup
+ * Not using std::array so we can check the actual size filled in vs N
+ * in std:array<const char*, N>.
+ */
+ static const char* SectionIdToStringArr[] =
+ {
+ "part", /**< PNOR::TOC : Table of Contents */
+ "HBI", /**< PNOR::HB_EXT_CODE : Hostboot Extended Image */
+ "GLOBAL", /**< PNOR::GLOBAL_DATA : Global Data */
+ "HBB", /**< PNOR::HB_BASE_CODE : Hostboot Base Image */
+ "SBEC", /**< PNOR::CENTAUR_SBE : Centaur Self-Boot Engine image */
+ "SBE", /**< PNOR::SBE_IPL : Self-Boot Enginer IPL image */
+ "HCODE", /**< PNOR::HCODE : HCODE Reference image */
+ "PAYLOAD", /**< PNOR::PAYLOAD : HAL/OPAL */
+ "HBRT", /**< PNOR::HB_RUNTIME : Hostboot Runtime(for Sapphire)*/
+ "HBD", /**< PNOR::HB_DATA : Hostboot Data */
+ "GUARD", /**< PNOR::GUARD_DATA : Hostboot Data */
+ "HBEL", /**< PNOR::HB_ERRLOGS : Hostboot Error log Repository */
+ "DJVPD", /**< PNOR::DIMM_JEDEC_VPD : Dimm JEDEC VPD */
+ "MVPD", /**< PNOR::MODULE_VPD : Module VPD */
+ "CVPD", /**< PNOR::CENTAUR_VPD : Centaur VPD */
+ "NVRAM", /**< PNOR::NVRAM : OPAL Storage */
+ "OCC", /**< PNOR::OCC : OCC LID */
+ "FIRDATA", /**< PNOR::FIRDATA : FIRs for checkstop analysis */
+ "ATTR_TMP", /**< PNOR::ATTR_TMP : Temporary Attribute Overrides */
+ "ATTR_PERM", /**< PNOR::ATTR_PERM : Permanent Attribute Overrides */
+ "CAPP", /**< PNOR::CAPP : CAPP LID */
+ "VERSION", /**< PNOR::VERSION : PNOR Version string */
+ "HBBL", /**<PNOR::HB_BOOTLOADER : Hostboot Bootloader image */
+ "TEST", /**< PNOR::TEST : Test space for PNOR*/
+ "TESTRO", /**< PNOR::TESTRO : ReadOnly Test space for PNOR */
+ "BACKUP_PART", /**PNOR::BACKUP_PART : Backup of PART*/
+ "POWERVM", /**< PNOR::POWERVM : Power VM data */
+ "RINGOVD", /**< PNOR::RINGOVD : Ring overrides */
+ "WOFDATA", /**< PNOR::WOFDATA : VFRT data tables for WOF */
+ "SBKT", /**< PNOR::SBKT : SecureBoot Key Transition */
+ };
+
+ // Get actual number of entries of array.
+ const size_t numEntries = sizeof(SectionIdToStringArr)/sizeof(char*);
+
+ // Assert that the number of entries equals PNOR::NUM_SECTIONS
+ static_assert (numEntries == (PNOR::NUM_SECTIONS),
+ "Mismatch between number of SectionIds and correlating strings");
+
+ // Bootloader does not support asserts
+#ifdef BOOTLOADER
+ if(i_secIdIndex >= (PNOR::NUM_SECTIONS))
+ {
+ PNOR_UTIL_TRACE(BTLDR_TRC_UTILS_PARSE_PNOR_SECID_OUT_OF_RANGE);
+ /*@
+ * @errortype
+ * @moduleid Bootloader::MOD_BOOTLOADER_PNOR_SECID_TO_STR
+ * @reasoncode Bootloader::RC_PNOR_SECID_OUT_OF_RANGE
+ * @userdata1 Section ID requested
+ * @userdata2 Max index of Section id to string array
+ * @devdesc No String associated with PNOR section ID
+ * @custdesc A problem occurred while running processor
+ * boot code.
+ */
+ bl_terminate(Bootloader::MOD_BOOTLOADER_PNOR_SECID_TO_STR,
+ Bootloader::RC_PNOR_SECID_OUT_OF_RANGE,
+ i_secIdIndex,
+ numEntries);
+ }
+#else
+ // Assert if accessing index out of array.
+ assert(i_secIdIndex < (PNOR::NUM_SECTIONS), "SectionIdToString PNOR section id out of range");
+#endif
+
+ return SectionIdToStringArr[i_secIdIndex];
+}
+
diff --git a/src/usr/pnor/pnor_utils.H b/src/usr/pnor/pnor_utils.H
index 75d85d77b..8bb4504f1 100644
--- a/src/usr/pnor/pnor_utils.H
+++ b/src/usr/pnor/pnor_utils.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2016 */
+/* Contributors Listed Below - COPYRIGHT 2011,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -229,6 +229,20 @@ void parseEntries (ffs_hdr* i_ffs_hdr,
*/
bool isSecureSection(const uint32_t i_section);
+/**
+ * @brief Returns string representation of a PNOR SectionId.
+ * If id requested is out of range of known string array
+ * - Hostboot asserts
+ * - Bootloader terminates
+ *
+ * @param[in] i_secIdIndex PNOR section id which also represents the index
+ * into the string array.
+ *
+ * @return const char* - String associated with Section ID
+ *
+*/
+const char * SectionIdToString( uint32_t i_secIdIndex );
+
} // End namespace PNOR
diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C
index b3f394e51..329e3cac9 100644
--- a/src/usr/pnor/pnorrp.C
+++ b/src/usr/pnor/pnorrp.C
@@ -66,10 +66,6 @@ extern trace_desc_t* g_trac_pnor;
using namespace PNOR;
-/**
- * Eyecatcher strings for PNOR TOC entries
- */
-extern const char* cv_EYECATCHER[];
/**
* @brief set up _start() task entry procedure for PNOR daemon
@@ -528,7 +524,7 @@ errlHndl_t PnorRP::getSectionInfo( PNOR::SectionId i_section,
// copy my data into the external format
o_info.id = iv_TOC[id].id;
- o_info.name = cv_EYECATCHER[id];
+ o_info.name = SectionIdToString(id);
#ifdef CONFIG_SECUREBOOT
o_info.secureProtectedPayloadSize = 0; // for non secure sections
@@ -1737,7 +1733,7 @@ errlHndl_t PnorRP::setVirtAddrs(void)
if (rc)
{
TRACFCOMP(g_trac_pnor, "E>PnorRP::readTOC: Failed to set block permissions to WRITABLE for section %s.",
- cv_EYECATCHER[i]);
+ SectionIdToString(i));
/*@
* @errortype
* @moduleid PNOR::MOD_PNORRP_READTOC
@@ -1770,7 +1766,7 @@ errlHndl_t PnorRP::setVirtAddrs(void)
if (rc)
{
TRACFCOMP(g_trac_pnor, "E>PnorRP::readTOC: Failed to set block permissions to WRITABLE/WRITE_TRACKED for section %s.",
- cv_EYECATCHER[i]);
+ SectionIdToString(i));
/*@
* @errortype
* @moduleid PNOR::MOD_PNORRP_READTOC
diff --git a/src/usr/pnor/runtime/rt_pnor.C b/src/usr/pnor/runtime/rt_pnor.C
index dc5adb7f7..484d47e7d 100644
--- a/src/usr/pnor/runtime/rt_pnor.C
+++ b/src/usr/pnor/runtime/rt_pnor.C
@@ -43,11 +43,6 @@
extern trace_desc_t* g_trac_pnor;
/**
- * Eyecatcher strings for PNOR TOC entries
- */
-extern const char* cv_EYECATCHER[];
-
-/**
* @brief set up _start() task entry procedure for PNOR daemon
*/
TASK_ENTRY_MACRO( RtPnor::init );
@@ -214,7 +209,7 @@ errlHndl_t RtPnor::getSectionInfo(PNOR::SectionId i_section,
}
//return the data in the struct
o_info.id = i_section;
- o_info.name = cv_EYECATCHER[i_section];
+ o_info.name = SectionIdToString(i_section);
o_info.vaddr = (uint64_t)l_pWorking;
o_info.flashAddr = iv_TOC[i_section].flashAddr;
o_info.size = l_sizeBytes;
@@ -365,7 +360,7 @@ errlHndl_t RtPnor::readFromDevice (uint64_t i_procId,
do
{
- const char* l_partitionName = cv_EYECATCHER[i_section];
+ const char* l_partitionName = SectionIdToString(i_section);
void* l_dataToRead = o_data;
size_t l_readSize = i_size;
size_t l_readSizePlusECC = (i_size * 9)/8;
@@ -581,7 +576,7 @@ errlHndl_t RtPnor::writeToDevice( uint64_t i_procId,
l_offset = (i_offset * 9)/8;
}
- const char* l_partitionName = cv_EYECATCHER[i_section];
+ const char* l_partitionName = SectionIdToString(i_section);
if (g_hostInterfaces && g_hostInterfaces->pnor_write)
{
//make call into opal to write the data
diff --git a/src/usr/pnor/test/pnorutilsTest.H b/src/usr/pnor/test/pnorutilsTest.H
index c71f90e54..a2258c622 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,2016 */
+/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -39,7 +39,7 @@
*
* @brief unit tests for pnor utils
*/
-extern const char* cv_EYECATCHER[];
+
extern trace_desc_t* g_trac_pnor;
class pnorutilsTest : public CxxTest::TestSuite
{
diff --git a/src/usr/testcore/rtloader/loader.H b/src/usr/testcore/rtloader/loader.H
index 417009992..f131d9a7e 100644
--- a/src/usr/testcore/rtloader/loader.H
+++ b/src/usr/testcore/rtloader/loader.H
@@ -42,10 +42,10 @@
#include <devicefw/userif.H>
#include <pnor/ecc.H>
#include <ipmi/ipmiif.H>
+#include <pnor_utils.H>
trace_desc_t* g_trac_hbrt = NULL;
TRAC_INIT(&g_trac_hbrt, "HBRT_TEST", 2*KILOBYTE);
-extern const char* cv_EYECATCHER[];
class RuntimeLoaderTest : public CxxTest::TestSuite
{
@@ -347,7 +347,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
for (size_t i=PNOR::FIRST_SECTION; i<=PNOR::NUM_SECTIONS;
++i)
{
- if (0 == strcmp(cv_EYECATCHER[i], i_partitionName))
+ if (0 == strcmp(PNOR::SectionIdToString(i), i_partitionName))
{
l_id = (PNOR::SectionId)i;
break;
diff --git a/src/usr/testcore/rtloader/makefile b/src/usr/testcore/rtloader/makefile
index c75e71933..d253d3f06 100644
--- a/src/usr/testcore/rtloader/makefile
+++ b/src/usr/testcore/rtloader/makefile
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,2017
+# [+] International Business Machines Corp.
+#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,6 +24,8 @@
# IBM_PROLOG_END_TAG
ROOTPATH = ../../../..
+EXTRAINCDIR += ${ROOTPATH}/src/usr/pnor/
+
MODULE = testrtloader
TESTS = *.H
OpenPOWER on IntegriCloud