summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootloader/bl_pnorAccess.C73
-rw-r--r--src/bootloader/bootloader.C2
-rw-r--r--src/build/debug/Hostboot/BlTrace.pm4
-rw-r--r--src/include/bootloader/bl_pnorAccess.H12
-rw-r--r--src/include/bootloader/bootloader_trace.H8
5 files changed, 46 insertions, 53 deletions
diff --git a/src/bootloader/bl_pnorAccess.C b/src/bootloader/bl_pnorAccess.C
index b8db406a0..3ea60eaaf 100644
--- a/src/bootloader/bl_pnorAccess.C
+++ b/src/bootloader/bl_pnorAccess.C
@@ -28,6 +28,7 @@
#include <bootloader/hbblreasoncodes.H>
#include <util/singleton.H>
#include <bootloader/bootloader.H>
+#include <lpc_const.H>
#ifdef PNORUTILSTEST_H
#define BOOTLOADER_TRACE(args) TRACFCOMP(g_trac_pnor,"##args")
#define BOOTLOADER_TRACE_W_BRK(args) TRACFCOMP(g_trac_pnor,"##args")
@@ -61,7 +62,7 @@ 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_CHKNULLBUFFER_NULL);
- // Set TI information but caller decides to TI or not
+ // Always TI if NULL pointer is passed in
/*@
* @errortype
* @moduleid Bootloader::MOD_PNORACC_READTOC
@@ -78,17 +79,12 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
bl_terminate(Bootloader::MOD_PNORACC_READTOC,
Bootloader::RC_CHK_NULL_BUFFER,
reinterpret_cast<uint64_t>(i_tocBuffer),
- o_errCode,
- false);
+ o_errCode);
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)
{
@@ -149,8 +145,12 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
false);
break;
}
+
BOOTLOADER_TRACE(BTLDR_TRC_PA_READTOC_CHECKHEADER_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;
//if an error is found with an entry we use this variable to hold
//the value of the entry. That way we can record which entry is causing
@@ -184,25 +184,25 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
false);
break;
}
- BOOTLOADER_TRACE(BTLDR_TRC_PA_READTOC_PARSEENTRIES_RTN);
-
+ BOOTLOADER_TRACE(BTLDR_TRC_PA_READTOC_PARSEENTRIES_RTN);
} while(0);
}
void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC,
- uint32_t& o_errCode, uint8_t& o_tocUsed,
- uint64_t& o_pnorStart)
+ uint32_t& o_errCode, uint64_t& o_pnorStart)
{
uint8_t *l_tocBuffer = Bootloader::g_blScratchSpace;
+
+ //The first TOC is 1 TOC size + 1 page back from the end of the flash (+ 1)
+ uint64_t l_mmioAddr = i_pnorEnd - PNOR::TOC_OFFSET_FROM_TOP_OF_FLASH;
+
do
{
//@TODO RTC:138268 Set up multiple side of PNOR for bootloader
o_errCode = 0;
- o_tocUsed = 0;
//Copy Table of Contents from PNOR flash to a local buffer
- //The first TOC is 2 TOC sizes back from the end of the flash (+ 1)
- Bootloader::handleMMIO(i_pnorEnd - PNOR::TOC_OFFSET_FROM_TOP_OF_FLASH,
+ Bootloader::handleMMIO(l_mmioAddr,
reinterpret_cast<uint64_t>(l_tocBuffer),
(PNOR::TOC_SIZE),
Bootloader::WORDSIZE);
@@ -214,35 +214,35 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC,
if(o_errCode == PNOR::NO_ERROR)
{
BOOTLOADER_TRACE(BTLDR_TRC_PA_FINDTOC_TOC1_READTOC_RTN);
- o_tocUsed = 0;
break;
}
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),
- (PNOR::TOC_SIZE),
- Bootloader::WORDSIZE);
-
- o_errCode = 0;
- readTOC(l_tocBuffer, o_errCode, o_TOC, o_pnorStart, i_pnorEnd);
- if(o_errCode == PNOR::NO_ERROR)
+ if(o_pnorStart != NULL)
+ {
+ // Use PNOR start address for next MMIO
+ BOOTLOADER_TRACE(BTLDR_TRC_PA_FINDTOC_USE_PNOR_START);
+ l_mmioAddr = o_pnorStart;
+ }
+ else
{
- o_tocUsed = 1;
+ // Adjust to new location in PNOR flash for next MMIO
+ BOOTLOADER_TRACE(BTLDR_TRC_PA_FINDTOC_ADJUST_PNOR_ADDR);
+ l_mmioAddr -= PAGESIZE;
+ }
+
+ // Check that address is still in FW space
+ if(l_mmioAddr < (LPC::LPC_PHYS_BASE + LPC::LPCHC_FW_SPACE))
+ {
+ BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_FINDTOC_READTOC_ERR);
+
+ // TI with data from readTOC
+ terminateExecuteTI();
+
break;
}
- BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_FINDTOC_READTOC_ERR);
- // TI with data from readTOC
- terminateExecuteTI();
}
-
- break;
- }while(0);
+ }while(1);
}
/**
@@ -251,7 +251,6 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC,
void bl_pnorAccess::getHBBSection(uint64_t i_pnorEnd,
PNOR::SectionData_t& o_hbbSection,
uint32_t& o_errCode,
- uint8_t& o_tocUsed,
uint64_t& o_pnorStart)
{
BOOTLOADER_TRACE(BTLDR_TRC_PA_GETHBBSECTION_START);
@@ -259,7 +258,7 @@ void bl_pnorAccess::getHBBSection(uint64_t i_pnorEnd,
{
PNOR::SectionData_t l_TOC[PNOR::NUM_SECTIONS+1];
- findTOC(i_pnorEnd, l_TOC, o_errCode, o_tocUsed, o_pnorStart);
+ findTOC(i_pnorEnd, l_TOC, o_errCode, o_pnorStart);
if(o_errCode != PNOR::NO_ERROR)
{
diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C
index 78300ea63..303b14f86 100644
--- a/src/bootloader/bootloader.C
+++ b/src/bootloader/bootloader.C
@@ -297,7 +297,6 @@ namespace Bootloader{
uint64_t l_pnorStart = 0;
uint32_t l_errCode = PNOR::NO_ERROR;
- uint8_t l_tocUsed = 0;
g_blScratchSpace = reinterpret_cast<uint8_t*>(HBBL_SCRATCH_SPACE_ADDR);
g_blData->secureRomValid = false;
@@ -306,7 +305,6 @@ namespace Bootloader{
bl_pnorAccess::getHBBSection(l_pnorEnd,
g_blData->bl_hbbSection,
l_errCode,
- l_tocUsed,
l_pnorStart);
BOOTLOADER_TRACE(BTLDR_TRC_MAIN_GETHBBSECTION_RTN );
diff --git a/src/build/debug/Hostboot/BlTrace.pm b/src/build/debug/Hostboot/BlTrace.pm
index 1a3ee0ec2..57890d868 100644
--- a/src/build/debug/Hostboot/BlTrace.pm
+++ b/src/build/debug/Hostboot/BlTrace.pm
@@ -48,8 +48,8 @@ my %traceText = (
"30" => "PNOR Access getHBBSection started",
"31" => "PNOR Access findTOC handleMMIO to copy TOC ONE returned",
"32" => "PNOR Access findTOC readTOC for TOC ONE returned",
- "33" => "PNOR Access findTOC handleMMIO to copy TOC TWO returned",
- "34" => "PNOR Access findTOC readTOC for TOC TWO returned",
+ "33" => "PNOR Access findTOC use PNOR start address",
+ "34" => "PNOR Access findTOC adjust PNOR address",
"35" => "PNOR Access getHBBSection findTOC returned",
"41" => "PNOR Access readTOC zeroSection returned",
"42" => "PNOR Access readTOC checkForNullBuffer returned",
diff --git a/src/include/bootloader/bl_pnorAccess.H b/src/include/bootloader/bl_pnorAccess.H
index 237900b0d..a9c37d1cc 100644
--- a/src/include/bootloader/bl_pnorAccess.H
+++ b/src/include/bootloader/bl_pnorAccess.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -56,8 +56,6 @@ class bl_pnorAccess
*
* @param[out] o_errCode Anything besides PNOR:NO_ERROR is an error
*
- * @param[out] o_tocUsed Tells you which table of contents was used
- *
* @param[out] o_pnorStart The MMIO address of the start of PNOR
*
* @return void
@@ -65,7 +63,6 @@ class bl_pnorAccess
static void getHBBSection(uint64_t i_pnorEnd,
PNOR::SectionData_t& o_hbbSection,
uint32_t& o_errCode,
- uint8_t& o_tocUsed,
uint64_t& o_pnorStart);
private:
@@ -85,7 +82,8 @@ static void getHBBSection(uint64_t i_pnorEnd,
* @return void
*/
static void readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE], uint32_t & o_errCode,
- PNOR::SectionData_t * o_TOC, uint64_t& o_pnorStart, uint64_t i_pnorEnd);
+ PNOR::SectionData_t * o_TOC, uint64_t& o_pnorStart,
+ uint64_t i_pnorEnd);
/**
* @brief Find a valid TOC within specified side of pnor flash
@@ -97,14 +95,12 @@ static void readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE], uint32_t & o_errCode,
*
* @param[out] o_errCode Anything besides PNOR:NO_ERROR is an error
*
- * @param[out] o_tocUsed Tells you which table of contents was used
- *
* @param[out] o_pnorStart The MMIO address of the start of PNOR
*
* @return void
*/
static void findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC,
- uint32_t& o_errCode, uint8_t& o_tocUsed, uint64_t& o_pnorStart);
+ uint32_t& o_errCode, uint64_t& o_pnorStart);
};
diff --git a/src/include/bootloader/bootloader_trace.H b/src/include/bootloader/bootloader_trace.H
index df6887890..4a11dbf49 100644
--- a/src/include/bootloader/bootloader_trace.H
+++ b/src/include/bootloader/bootloader_trace.H
@@ -89,11 +89,11 @@ enum BootloaderTraces
/** Bootloader PNOR Access findTOC readTOC for TOC ONE returned */
BTLDR_TRC_PA_FINDTOC_TOC1_READTOC_RTN = 0x32,
- /** Bootloader PNOR Access findTOC handleMMIO to copy TOC TWO returned */
- BTLDR_TRC_PA_FINDTOC_TOC2_HANDLEMMIO_RTN = 0x33,
+ /** Bootloader PNOR Access findTOC use PNOR start address */
+ BTLDR_TRC_PA_FINDTOC_USE_PNOR_START = 0x33,
- /** Bootloader PNOR Access findTOC readTOC for TOC TWO returned */
- BTLDR_TRC_PA_FINDTOC_TOC2_READTOC_RTN = 0x34,
+ /** Bootloader PNOR Access findTOC adjust PNOR address */
+ BTLDR_TRC_PA_FINDTOC_ADJUST_PNOR_ADDR = 0x34,
/** Bootloader PNOR Access getHBBSection findTOC returned */
BTLDR_TRC_PA_GETHBBSECTION_FINDTOC_RTN = 0x35,
OpenPOWER on IntegriCloud