summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2017-02-06 12:31:42 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-03-01 14:04:03 -0500
commitf0d7c809d23c2cf44c0be0ff594c14aff22d6f04 (patch)
treebbb67150e4e1d2a6309c4bed69ab70473d02e7ce /src/usr
parentd3d4ae7c89e6b35fffa8857170762992dc3c6538 (diff)
downloadblackbird-hostboot-f0d7c809d23c2cf44c0be0ff594c14aff22d6f04.tar.gz
blackbird-hostboot-f0d7c809d23c2cf44c0be0ff594c14aff22d6f04.zip
Add SecureROM version info and Change SBE update to use max HBBL size
The HBBL also contains the securerom code and hw keys' hash for verification purposes. So looking for the end of the HBBL code leaves out those sections Change-Id: I73a1b5c50e3a5b3f642ca569b90e79dbe4c4ba1e Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35979 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/pnor/pnor_utils.C27
-rw-r--r--src/usr/sbe/sbe_update.C143
-rw-r--r--src/usr/sbe/sbe_update.H6
-rw-r--r--src/usr/sbe/test/sbeupdatetest.H48
4 files changed, 32 insertions, 192 deletions
diff --git a/src/usr/pnor/pnor_utils.C b/src/usr/pnor/pnor_utils.C
index 1890499bc..5af2993cb 100644
--- a/src/usr/pnor/pnor_utils.C
+++ b/src/usr/pnor/pnor_utils.C
@@ -361,19 +361,22 @@ void PNOR::parseEntries (ffs_hdr* i_ffs_hdr,
bool PNOR::isSecureSection(const uint32_t i_section)
{
-// TODO securebootp9 uncomment these sections as they become ready for
-// inclusion in p9. Remove this comment after the last one.
#ifdef CONFIG_SECUREBOOT
- return i_section == HB_BASE_CODE;
-// return i_section == HB_EXT_CODE ||
-// i_section == HB_DATA ||
-// i_section == SBE_IPL ||
-// i_section == CENTAUR_SBE ||
-// i_section == PAYLOAD ||
-// i_section == SBKT ||
-// i_section == OCC ||
-// i_section == HB_RUNTIME;
- return false;
+ #ifdef BOOTLOADER
+ return i_section == HB_BASE_CODE;
+ // TODO securebootp9 uncomment these sections as they become ready for
+ // inclusion in p9. Remove this comment after the last one.
+ #else
+ // return i_section == HB_EXT_CODE ||
+ // i_section == HB_DATA ||
+ // i_section == SBE_IPL ||
+ // i_section == CENTAUR_SBE ||
+ // i_section == PAYLOAD ||
+ // i_section == SBKT ||
+ // i_section == OCC ||
+ // i_section == HB_RUNTIME;
+ return false;
+ #endif
#else
return false;
#endif
diff --git a/src/usr/sbe/sbe_update.C b/src/usr/sbe/sbe_update.C
index 95dc2bc87..199379d44 100644
--- a/src/usr/sbe/sbe_update.C
+++ b/src/usr/sbe/sbe_update.C
@@ -71,6 +71,7 @@
#include <p9_perv_scom_addresses.H>
#include <initservice/mboxRegs.H>
+#include <bootloader/bootloaderif.H>
// ----------------------------------------------
@@ -737,104 +738,6 @@ namespace SBE
return err;
}
-
-/////////////////////////////////////////////////////////////////////
- errlHndl_t findHBBLInPnor(void*& o_imgPtr,
- size_t& o_imgSize)
- {
- errlHndl_t err = NULL;
- PNOR::SectionInfo_t pnorInfo;
- hbblEndData_t* hbblEndData = NULL;
- PNOR::SectionId pnorSectionId = PNOR::HB_BOOTLOADER;
-
- o_imgPtr = NULL;
- o_imgSize = 0;
-
- TRACDCOMP( g_trac_sbe,
- ENTER_MRK"findHBBLInPnor()" );
-
- do{
- // Get SBE PNOR section info from PNOR RP
- err = getSectionInfo( pnorSectionId,
- pnorInfo );
-
- if(err)
- {
- TRACFCOMP( g_trac_sbe, ERR_MRK"findHBBLInPnor: Error calling "
- "getSectionInfo() rc=0x%.4X",
- err->reasonCode() );
- break;
- }
-
- TRACUCOMP( g_trac_sbe,
- INFO_MRK"findHBBLInPnor: sectionId=0x%X. "
- "pnor vaddr = 0x%.16X",
- pnorSectionId, pnorInfo.vaddr);
-
- // Look for HBBL end data on 16-byte boundary start at offset
- // HBBL_FUZZY_END_ADDRESS
- // Note: Code takes up at least the first HBBL_FUZZY_END_ADDRESS
- // bytes of the HBBL image, so start at that offset to search
- // for this data.
- uint64_t hbblAbsoluteEnd = pnorInfo.vaddr + pnorInfo.size;
- uint64_t hbblAddr = pnorInfo.vaddr + HBBL_FUZZY_END_ADDRESS;
- while( hbblAddr < hbblAbsoluteEnd )
- {
- hbblEndData = reinterpret_cast<hbblEndData_t*>(hbblAddr);
-
- if( HBBL_END_EYECATCHER == hbblEndData->eyecatcher )
- {
- TRACUCOMP( g_trac_sbe,
- INFO_MRK"findHBBLInPnor: hbblEndData = %p, "
- "hbblEndData.address = 0x%.16X",
- hbblEndData, hbblEndData->address);
- break;
- }
-
- hbblAddr += sizeof(hbblEndData_t);
- }
-
- if( hbblAddr >= hbblAbsoluteEnd )
- {
- //The HBBL partition does not have the HBBL end data
- TRACFCOMP( g_trac_sbe, ERR_MRK"findHBBLInPnor: HBBL partition "
- "does not have the HBBL end data" );
-
- /*@
- * @errortype
- * @moduleid HBBL_FIND_IN_PNOR
- * @reasoncode HBBL_END_DATA_NOT_FOUND
- * @userdata1 HBBL PNOR Section Address
- * @userdata2 HBBL PNOR Section Size
- * @devdesc HBBL partition did not have end data
- * @custdesc A problem occurred while updating processor
- * boot code.
- */
- err = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- HBBL_FIND_IN_PNOR,
- HBBL_END_DATA_NOT_FOUND,
- pnorInfo.vaddr,
- pnorInfo.size);
- err->collectTrace(SBE_COMP_NAME);
- err->addProcedureCallout( HWAS::EPUB_PRC_SP_CODE,
- HWAS::SRCI_PRIORITY_HIGH );
-
- break;
- }
-
- o_imgPtr = reinterpret_cast<void*>( pnorInfo.vaddr );
- o_imgSize = hbblEndData->address - HBBL_START_ADDRESS;
-
- }while(0);
-
- TRACDCOMP( g_trac_sbe,
- EXIT_MRK"findHBBLInPnor(): o_imgPtr=%p, o_imgSize=0x%X",
- o_imgPtr, o_imgSize );
-
- return err;
- }
-
-
/////////////////////////////////////////////////////////////////////
errlHndl_t appendHbblToSbe(void* i_section,
uint32_t i_section_size,
@@ -1909,43 +1812,31 @@ namespace SBE
/*******************************************/
/* Get PNOR HBBL Information */
/*******************************************/
- void* hbblPnorPtr = NULL;
- size_t hbblPnorImageSize = 0;
- size_t hbblCachelineSize = 0;
-
- err = findHBBLInPnor(hbblPnorPtr,
- hbblPnorImageSize);
+ // Get SBE PNOR section info from PNOR RP
+ PNOR::SectionInfo_t pnorInfo;
+ err = getSectionInfo( PNOR::HB_BOOTLOADER, pnorInfo );
if(err)
{
- TRACFCOMP( g_trac_sbe, ERR_MRK"getSbeInfoState() - "
- "Error getting HBBL Version from PNOR, "
- "RC=0x%X, PLID=0x%lX",
- ERRL_GETRC_SAFE(err),
- ERRL_GETPLID_SAFE(err));
+ TRACFCOMP( g_trac_sbe, ERR_MRK"getSbeInfoState: Error calling "
+ "getSectionInfo() rc=0x%.4X",
+ err->reasonCode() );
break;
}
- else
- {
- TRACFCOMP( g_trac_sbe, "getSbeInfoState() - "
- "hbblPnorPtr=%p, hbblPnorImageSize=0x%08X (%d)",
- hbblPnorPtr, hbblPnorImageSize, hbblPnorImageSize);
- }
-
- hbblCachelineSize = ALIGN_X(hbblPnorImageSize, CACHELINE_SIZE);
-
- TRACUCOMP( g_trac_sbe, "getSbeInfoState() - HBBL: "
- "maxSize=0x%X, actSize=0x%X, cachelineSize=0x%X",
- HBBL_MAX_SIZE, hbblPnorImageSize,
- hbblCachelineSize);
-
+ const void* hbblPnorPtr = reinterpret_cast<const void*>(
+ pnorInfo.vaddr);
+ // Use max hbbl size and not the PNOR size. The PNOR size can grow
+ // to add a secure header, but the code size limit is still 20K.
+ TRACFCOMP( g_trac_sbe, "getSbeInfoState() - "
+ "hbblPnorPtr=%p, hbblMaxSize=0x%08X (%d)",
+ hbblPnorPtr, MAX_HBBL_SIZE, MAX_HBBL_SIZE);
/*******************************************/
/* Append HBBL Image from PNOR to SBE */
/* Image from PNOR */
/*******************************************/
uint32_t sbeHbblImgSize =
- static_cast<uint32_t>(sbePnorImageSize + hbblCachelineSize);
+ static_cast<uint32_t>(sbePnorImageSize + MAX_HBBL_SIZE);
// copy SBE image from PNOR to memory
sbeHbblImgPtr = (void*)SBE_HBBL_IMG_VADDR;
@@ -1953,8 +1844,8 @@ namespace SBE
sbePnorPtr,
sbePnorImageSize);
- err = appendHbblToSbe(hbblPnorPtr, // HBBL Image to append
- hbblCachelineSize, // Size of HBBL Image
+ err = appendHbblToSbe(const_cast<void*>(hbblPnorPtr), // HBBL Image to append
+ MAX_HBBL_SIZE, // Size of HBBL Image
sbeHbblImgPtr, // SBE, HBBL Image
sbeHbblImgSize); // Available/used
diff --git a/src/usr/sbe/sbe_update.H b/src/usr/sbe/sbe_update.H
index 008252145..ff436f419 100644
--- a/src/usr/sbe/sbe_update.H
+++ b/src/usr/sbe/sbe_update.H
@@ -91,12 +91,6 @@ namespace SBE
const uint64_t NONSECURE_VER_EYECATCH = 0x56455253494F4E00; //'VERSION\0'
const uint32_t SUPPORTED_TOC_VER = 0x00000001;
- // PNOR HBBL Partition constants
- const uint64_t HBBL_START_ADDRESS = 0x0000000000003000;
- const uint64_t HBBL_FUZZY_END_ADDRESS = 0x1400;
- const size_t HBBL_MAX_SIZE = 20*KILOBYTE; // 20KB
- const uint64_t HBBL_END_EYECATCHER = 0x4842424C656E6400; // 'HBBLend\0'
-
// Cacheline Size
const uint64_t CACHELINE_SIZE = 128;
diff --git a/src/usr/sbe/test/sbeupdatetest.H b/src/usr/sbe/test/sbeupdatetest.H
index 7fd5295f6..e9210b102 100644
--- a/src/usr/sbe/test/sbeupdatetest.H
+++ b/src/usr/sbe/test/sbeupdatetest.H
@@ -675,54 +675,6 @@ class SBEUpdateTest: public CxxTest::TestSuite
}
-
- /**
- * @brief This function will test SBE Update's ability
- * to find HBBL images in PNOR
- */
-
- void testFindHBBLInPnor ( void )
- {
- errlHndl_t err = NULL;
- uint64_t fails = 0x0;
- uint64_t total = 0x0;
-
- void* hbblImgPtr = NULL;
- size_t hbblImgSize = 0;
-
- do{
-
- TRACFCOMP( g_trac_sbe,
- ENTER_MRK"testFindHBBLInPnor()" );
-
- total++;
- err = findHBBLInPnor(hbblImgPtr,
- hbblImgSize);
-
- if(err || (hbblImgPtr == NULL) || (hbblImgSize == 0) )
- {
- fails++;
- TRACFCOMP( g_trac_sbe, ERR_MRK"testFindHBBLInPnor() - "
- "failure finding HBBL image, hbblImgPtr=%p, "
- "hbblImgSize=0x%x",
- hbblImgPtr, hbblImgSize );
- TS_FAIL("testFindHBBLInPnor() -failure finding HBBL image!");
- errlCommit( err,
- SBE_COMP_ID );
-
- }
- TRACDBIN(g_trac_sbe, "testFindHBBLInPnor()-Proc PNOR Image",
- hbblImgPtr, 0x80);
-
- TRACFCOMP( g_trac_sbe,
- EXIT_MRK"testFindHBBLInPnor - %d/%d fails",
- fails, total );
-
- }while(0);
-
- }
-
-
/**
* @brief This function will run through the functions used to collect
* SBE information on a single target, determine if that target
OpenPOWER on IntegriCloud