summaryrefslogtreecommitdiffstats
path: root/src/bootloader
diff options
context:
space:
mode:
authorcrgeddes <crgeddes@us.ibm.com>2016-07-26 11:40:30 -0500
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2016-08-25 14:50:15 -0400
commitb0bf18528f97ecef49ff27fd4715b2d2a50ad5ba (patch)
treec62489d62c413e523e72e3a5559d629165078c08 /src/bootloader
parent1400bea75a6bbd2083a8b39095470102479c8514 (diff)
downloadtalos-hostboot-b0bf18528f97ecef49ff27fd4715b2d2a50ad5ba.tar.gz
talos-hostboot-b0bf18528f97ecef49ff27fd4715b2d2a50ad5ba.zip
Update Bootloader to handle moving the TOC of PNOR around
Moved 1 of the PNOR TOCs from 0x8000 to TOP_OF_FLASH - 64KB. Updated bootloader and pnor access code to handle new toc location. Update the defaultPnorLayout to reflect these changes Also added a FSP default pnor xml that will generate a 128 MB image for FSP boxes to use. RTC: 154286 Change-Id: I0253590299ff9714b0d5ab12a02ac9d653b115fa Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27461 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com> Reviewed-by: Andres A. Lugo-Reyes <aalugore@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/bootloader')
-rw-r--r--src/bootloader/bl_pnorAccess.C32
-rw-r--r--src/bootloader/bootloader.C16
2 files changed, 33 insertions, 15 deletions
diff --git a/src/bootloader/bl_pnorAccess.C b/src/bootloader/bl_pnorAccess.C
index 046a4bf0a..991011872 100644
--- a/src/bootloader/bl_pnorAccess.C
+++ b/src/bootloader/bl_pnorAccess.C
@@ -40,9 +40,10 @@ extern const char* cv_EYECATCHER[];
also returns a SectionData_t struct if the toc was valid
*/
void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
- uint32_t & o_errCode,
+ uint32_t& o_errCode,
PNOR::SectionData_t * o_TOC,
- uint64_t i_baseAddr)
+ uint64_t& o_pnorStart,
+ uint64_t i_pnorEnd)
{
do
{
@@ -57,6 +58,10 @@ 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);
@@ -109,8 +114,9 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE],
} while(0);
}
-void bl_pnorAccess::findTOC(uint64_t i_pnorBase, PNOR::SectionData_t * o_TOC,
- uint32_t& o_errCode, uint8_t& o_tocUsed)
+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)
{
uint8_t *l_tocBuffer = Bootloader::g_blScratchSpace;
do
@@ -119,14 +125,15 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorBase, PNOR::SectionData_t * o_TOC,
o_errCode = 0;
o_tocUsed = 0;
//Copy Table of Contents from PNOR flash to a local buffer
- Bootloader::handleMMIO(i_pnorBase,
+ //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,
reinterpret_cast<uint64_t>(l_tocBuffer),
(PNOR::TOC_SIZE),
Bootloader::BYTESIZE);
BOOTLOADER_TRACE(BTLDR_TRC_PA_FINDTOC_TOC1_HANDLEMMIO_RTN);
- readTOC(l_tocBuffer, o_errCode, o_TOC, i_pnorBase);
+ readTOC(l_tocBuffer, o_errCode, o_TOC, o_pnorStart, i_pnorEnd);
if(o_errCode == PNOR::NO_ERROR)
{
@@ -136,13 +143,14 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorBase, PNOR::SectionData_t * o_TOC,
}
else
{
- Bootloader::handleMMIO(i_pnorBase + PNOR::BACKUP_TOC_OFFSET,
+ //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::BYTESIZE);
o_errCode = 0;
- readTOC(l_tocBuffer, o_errCode, o_TOC, i_pnorBase);
+ readTOC(l_tocBuffer, o_errCode, o_TOC, o_pnorStart, i_pnorEnd);
if(o_errCode == PNOR::NO_ERROR)
{
o_tocUsed = 1;
@@ -158,17 +166,19 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorBase, PNOR::SectionData_t * o_TOC,
/**
* @brief Get the hostboot base image
*/
-void bl_pnorAccess::getHBBSection(uint64_t i_pnorStart,
+void bl_pnorAccess::getHBBSection(uint64_t i_pnorEnd,
PNOR::SectionData_t& o_hbbSection,
uint32_t& o_errCode,
- uint8_t& o_tocUsed)
+ uint8_t& o_tocUsed,
+ uint64_t& o_pnorStart)
{
BOOTLOADER_TRACE(BTLDR_TRC_PA_GETHBBSECTION_START);
do
{
PNOR::SectionData_t l_TOC[PNOR::NUM_SECTIONS];
- findTOC(i_pnorStart, l_TOC, o_errCode, o_tocUsed);
+ findTOC(i_pnorEnd, l_TOC, o_errCode, o_tocUsed, o_pnorStart);
+
if(o_errCode != PNOR::NO_ERROR)
{
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_GETHBBSECTION_FINDTOC_ERR);
diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C
index 0158f211a..ec9b12c4a 100644
--- a/src/bootloader/bootloader.C
+++ b/src/bootloader/bootloader.C
@@ -76,17 +76,25 @@ namespace Bootloader{
// Set variables needed for getting location of HB base code
// @TODO RTC:138268 Support multiple sides of PNOR in bootloader
- uint64_t l_pnorStart = LPC::LPC_PHYS_BASE + LPC::LPCHC_FW_SPACE
- + PNOR::LPC_SFC_MMIO_OFFSET;
+
+ //pnorEnd is the end of flash, which is base of lpc, plus
+ //the offset of the FW space, plus the TOP memory address in FW space
+ uint64_t l_pnorEnd = LPC::LPC_PHYS_BASE + LPC::LPCHC_FW_SPACE
+ + PNOR::LPC_TOP_OF_FLASH_OFFSET;
+
+ //We dont know what the start of pnor is because we dont know the size
+ uint64_t l_pnorStart = 0;
+
uint32_t l_errCode = PNOR::NO_ERROR;
uint8_t l_tocUsed = 0;
// Get location of HB base code in PNOR from TOC
// @TODO RTC:138268 Support multiple sides of PNOR in bootloader
- bl_pnorAccess::getHBBSection(l_pnorStart,
+ bl_pnorAccess::getHBBSection(l_pnorEnd,
bootloader_hbbSection,
l_errCode,
- l_tocUsed);
+ l_tocUsed,
+ l_pnorStart);
BOOTLOADER_TRACE(BTLDR_TRC_MAIN_GETHBBSECTION_RTN );
if(PNOR::NO_ERROR == l_errCode)
OpenPOWER on IntegriCloud