summaryrefslogtreecommitdiffstats
path: root/src/bootloader
diff options
context:
space:
mode:
authorMarty Gloff <mgloff@us.ibm.com>2017-05-04 11:49:53 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-05-08 17:37:12 -0400
commit8d2f642444d8581ea7dda1219f2ffccc79a63dce (patch)
treeb4e923d4f96d4792f41c8209d78cda82bc91d4ad /src/bootloader
parent8527fc2b9549b9b6782fdffde29ff8713e677bc4 (diff)
downloadtalos-hostboot-8d2f642444d8581ea7dda1219f2ffccc79a63dce.tar.gz
talos-hostboot-8d2f642444d8581ea7dda1219f2ffccc79a63dce.zip
Bootloader updates to support remapped memory - Initial pass
Add support to BlToHbData structure and create new version. Put in TODOs for pending p9_sbe_hb_structures.H changes. Move selected Bootloader data out of image due to size issues. Update BlTrace tool for new location of trace data. Change-Id: Ic513a95b8f4054d467537c4623d5a7b7aa09e25e RTC:173526 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40096 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: William G. Hoffa <wghoffa@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/bootloader')
-rw-r--r--src/bootloader/bl_start.S23
-rw-r--r--src/bootloader/bl_terminate.C3
-rw-r--r--src/bootloader/bootloader.C86
3 files changed, 58 insertions, 54 deletions
diff --git a/src/bootloader/bl_start.S b/src/bootloader/bl_start.S
index 60bfc1ccc..0105380b8 100644
--- a/src/bootloader/bl_start.S
+++ b/src/bootloader/bl_start.S
@@ -31,6 +31,8 @@
.set SBE_HB_PNORSIZEMB, sbe_hb_structures+6 ;// uint16_t
.set SBE_HB_BLLOADSIZE, sbe_hb_structures+8 ;// uint64_t
.set SBE_HB_SECUREACCESSBIT, sbe_hb_structures+16 ;// uint8_t
+.set SBE_HB_XSCOMMMIOBAR, sbe_hb_structures+17 ;// uint64_t
+.set SBE_HB_LPCMMIOBAR, sbe_hb_structures+25 ;// uint64_t
.set HBBL_BASE_ADDRESS, base_load_address
.set HBBL_END_ADDRESS, end_load_address
.set HBBL_system_reset, 0x100
@@ -397,28 +399,7 @@ switchToHBB:
kernel_other_thread_spinlock:
.space 8
- ;// @name bootloader_trace_index
- ;// @brief Index for Bootloader Trace entries
- ;// One-byte index for next entry to use in bootloader_trace.
-.global bootloader_trace_index
-bootloader_trace_index:
- .space 1
-
.balign 16
- ;// @name bootloader_trace
- ;// @brief Buffer for Bootloader Trace data
- ;// Buffer with bootloader trace entries. There are 64 one-byte entries
- ;// in the buffer. They are used to track events that have occurred in
- ;// the bootloader code. After all entries have been used, the buffer
- ;// wraps and the oldest entry is overwritten by the newest trace data.
-.global bootloader_trace
-bootloader_trace:
- .space 64
-
-.global bootloader_hbbSection
-bootloader_hbbSection:
- .space 32
-
.global hbi_ImageId
hbi_ImageId:
.space 128
diff --git a/src/bootloader/bl_terminate.C b/src/bootloader/bl_terminate.C
index e0721bc37..9f639d7bb 100644
--- a/src/bootloader/bl_terminate.C
+++ b/src/bootloader/bl_terminate.C
@@ -28,6 +28,9 @@
#define bl_terminate_C
+// Redefine kernel_TIDataArea to use space in Bootloader data
+#define kernel_TIDataArea Bootloader::g_blData->bl_TIDataArea
+
#include <../kernel/terminate.C>
#define UINT64_HIGH(data) ((data & 0xFFFFFFFF00000000) >> 32)
diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C
index 13e58b8b9..cbdcb0ce2 100644
--- a/src/bootloader/bootloader.C
+++ b/src/bootloader/bootloader.C
@@ -49,10 +49,9 @@
#include <pnor/pnorif.H>
-extern uint64_t kernel_other_thread_spinlock;
-extern PNOR::SectionData_t bootloader_hbbSection;
extern char bootloader_end_address;
+
namespace Bootloader{
/**
* @brief Pointer to bootloader scratch space
@@ -60,13 +59,15 @@ namespace Bootloader{
* Pointer to location in main storage which bootloader uses as
* scratch space
*/
- uint8_t *g_blScratchSpace = NULL;
-
- // Global Object that will be stored where the SBE HB structure indicates
- BlToHbData g_blToHbData;
+ uint8_t *g_blScratchSpace = nullptr;
- // Global bool indicating if the secureROM is valid. Toggles verification.
- bool g_secureRomValid = false;
+ /**
+ * @brief Pointer to bootloader external data
+ *
+ * Pointer to location in main storage which bootloader uses for
+ * storing data
+ */
+ blData_t *g_blData = nullptr;
/**
* @brief Set Secureboot Config Data structure so it is accessible via
@@ -86,7 +87,8 @@ namespace Bootloader{
// Ensure SBE to Bootloader structure has the SAB member
if (l_blConfigData->version >= SAB_ADDED)
{
- g_blToHbData.secureAccessBit = l_blConfigData->secureAccessBit;
+ g_blData->blToHbData.secureAccessBit =
+ l_blConfigData->secureAccessBit;
}
// Find secure ROM addr
@@ -101,10 +103,10 @@ namespace Bootloader{
// Create BlToHbData
// Set Rom Size
- memcpy (&g_blToHbData.secureRomSize,
+ memcpy (&g_blData->blToHbData.secureRomSize,
l_pRomStart,
- sizeof(g_blToHbData.secureRomSize));
- l_pRomStart += sizeof(g_blToHbData.secureRomSize);
+ sizeof(g_blData->blToHbData.secureRomSize));
+ l_pRomStart += sizeof(g_blData->blToHbData.secureRomSize);
// Get Secure ROM info
const auto l_pSecRomInfo = reinterpret_cast<const SecureRomInfo*>(
@@ -115,27 +117,43 @@ namespace Bootloader{
{
// Store valid check local to bootloader, as another validation
// is required in code outside the bootloader.
- g_secureRomValid = true;
+ g_blData->secureRomValid = true;
- g_blToHbData.eyeCatch = BLTOHB_EYECATCHER;
- g_blToHbData.version = BLTOHB_SAB;
- g_blToHbData.branchtableOffset = l_pSecRomInfo->branchtableOffset;
- g_blToHbData.secureRom = l_pRomStart;
+ g_blData->blToHbData.eyeCatch = BLTOHB_EYECATCHER;
+ if (l_blConfigData->version == BLTOHB_SAB + 1 /* MMIO_BARS_ADDED @TODO RTC:173526*/ )
+ {
+ g_blData->blToHbData.version = BLTOHB_MMIOBARS;
+ }
+ else
+ {
+ g_blData->blToHbData.version = BLTOHB_SAB;
+ }
+ g_blData->blToHbData.branchtableOffset =
+ l_pSecRomInfo->branchtableOffset;
+ g_blData->blToHbData.secureRom = l_pRomStart;
// Set HW key hash pointer (20K - 64 bytes) and size
- g_blToHbData.hwKeysHash = reinterpret_cast<const void *>
+ g_blData->blToHbData.hwKeysHash = reinterpret_cast<const void *>
(HW_KEYS_HASH_ADDR);
- g_blToHbData.hwKeysHashSize = SHA512_DIGEST_LENGTH;
+ g_blData->blToHbData.hwKeysHashSize = SHA512_DIGEST_LENGTH;
// Set HBB header and size
- g_blToHbData.hbbHeader = i_pHbbSrc;
- g_blToHbData.hbbHeaderSize = PAGE_SIZE;
+ g_blData->blToHbData.hbbHeader = i_pHbbSrc;
+ g_blData->blToHbData.hbbHeaderSize = PAGE_SIZE;
+
+ // Set the MMIO BAR information if appropriate
+ if (l_blConfigData->version >= BLTOHB_SAB + 1 /* MMIO_BARS_ADDED @TODO RTC:173526*/ )
+ {
+ g_blData->blToHbData.xscomBAR = 0 /* l_blConfigData->xscomBAR @TODO RTC:173526*/ ;
+ g_blData->blToHbData.lpcBAR = 0 /* l_blConfigData->lpcBAR @TODO RTC:173526*/ ;
+ }
+
}
// Place structure into proper location for HB to find
memcpy(reinterpret_cast<void *>(BLTOHB_COMM_DATA_ADDR |
IGNORE_HRMOR_MASK),
- &g_blToHbData,
+ &g_blData->blToHbData,
sizeof(BlToHbData));
}
@@ -157,13 +175,13 @@ namespace Bootloader{
uint64_t l_rc = 0;
// Check if Secure Access Bit is set
- if (!g_blToHbData.secureAccessBit)
+ if (!g_blData->blToHbData.secureAccessBit)
{
BOOTLOADER_TRACE(BTLDR_TRC_MAIN_VERIFY_SAB_UNSET);
}
// # @TODO RTC:170136 terminate in this case
// Ensure SecureRom is actually present
- else if ( !g_secureRomValid )
+ else if ( !g_blData->secureRomValid )
{
BOOTLOADER_TRACE(BTLDR_TRC_MAIN_VERIFY_NO_EYECATCH);
}
@@ -177,9 +195,9 @@ namespace Bootloader{
{
// Set startAddr to ROM_verify() function at an offset of Secure ROM
uint64_t l_rom_verify_startAddr =
- reinterpret_cast<const uint64_t>(g_blToHbData.secureRom)
- + g_blToHbData.branchtableOffset
- + ROM_VERIFY_FUNCTION_OFFSET;
+ reinterpret_cast<const uint64_t>(g_blData->blToHbData.secureRom)
+ + g_blData->blToHbData.branchtableOffset
+ + ROM_VERIFY_FUNCTION_OFFSET;
// Declare local input struct
ROM_hw_params l_hw_parms;
@@ -189,7 +207,7 @@ namespace Bootloader{
memset(&l_hw_parms, 0, sizeof(ROM_hw_params));
// Use current hw hash key
- memcpy (&l_hw_parms.hw_key_hash, g_blToHbData.hwKeysHash,
+ memcpy (&l_hw_parms.hw_key_hash, g_blData->blToHbData.hwKeysHash,
sizeof(sha2_hash_t));
const auto l_container = reinterpret_cast<const ROM_container_raw*>
@@ -235,7 +253,8 @@ namespace Bootloader{
int main()
{
// Initialization
- bootloader_trace_index = 0;
+ g_blData = reinterpret_cast<blData_t *>(HBBL_DATA_ADDR);
+ g_blData->bl_trace_index = 0;
BOOTLOADER_TRACE(BTLDR_TRC_MAIN_START);
//Set core scratch 3 to say bootloader is active
@@ -256,11 +275,12 @@ namespace Bootloader{
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;
// Get location of HB base code in PNOR from TOC
// @TODO RTC:138268 Support multiple sides of PNOR in bootloader
bl_pnorAccess::getHBBSection(l_pnorEnd,
- bootloader_hbbSection,
+ g_blData->bl_hbbSection,
l_errCode,
l_tocUsed,
l_pnorStart);
@@ -269,12 +289,12 @@ namespace Bootloader{
if(PNOR::NO_ERROR == l_errCode)
{
// get hbbFlashOffset
- uint64_t l_hbbFlashOffset = bootloader_hbbSection.flashAddr;
+ uint64_t l_hbbFlashOffset = g_blData->bl_hbbSection.flashAddr;
// get hbbLength without size of ECC data
- uint32_t l_hbbLength = bootloader_hbbSection.size;
+ uint32_t l_hbbLength = g_blData->bl_hbbSection.size;
// get hbbEcc
bool l_hbbEcc =
- ( bootloader_hbbSection.integrity == FFS_INTEG_ECC_PROTECT);
+ ( g_blData->bl_hbbSection.integrity == FFS_INTEG_ECC_PROTECT);
// Copy HB base code from PNOR to working location
handleMMIO(l_pnorStart + l_hbbFlashOffset,
OpenPOWER on IntegriCloud