summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bootloader.ld1
-rw-r--r--src/bootloader/bl_start.S4
-rw-r--r--src/bootloader/bootloader.C5
-rw-r--r--src/include/bootloader/bootloader.H55
4 files changed, 36 insertions, 29 deletions
diff --git a/src/bootloader.ld b/src/bootloader.ld
index b075f53bc..685c67434 100644
--- a/src/bootloader.ld
+++ b/src/bootloader.ld
@@ -25,7 +25,6 @@
/* IBM_PROLOG_END_TAG */
base_load_address = 0x00000000;
sbe_hb_structures = 0x00000004;
-/* @TODO-RTC:138273-Support multiple nodes using relative HRMOR */
/* Text section offset = 12KB (space reserved for exception vectors) */
text_load_address = 0x00003000;
diff --git a/src/bootloader/bl_start.S b/src/bootloader/bl_start.S
index 5c6e8d79e..d1a7d5703 100644
--- a/src/bootloader/bl_start.S
+++ b/src/bootloader/bl_start.S
@@ -97,8 +97,8 @@ _dcbz_before_bl:
li r7, 1
rotldi r7, r7, 63 ;// set bit mask for ignoring HRMOR
- lis r5, 0
- addis r5, r5, 2048 ;// 128M (2048 * 0x10000) is start of HBB
+ mfspr r5, HRMOR ;// start of HBB is HRMOR - 2MB
+ subis r5, r5, 32 ;// 2M (32 * 0x10000) is start of HBB
or r5, r5, r7 ;// ignore HRMOR
mfspr r6, HRMOR ;// use HRMOR as start of Bootloader
diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C
index 0f16881a3..966332460 100644
--- a/src/bootloader/bootloader.C
+++ b/src/bootloader/bootloader.C
@@ -47,8 +47,7 @@ namespace Bootloader{
* Pointer to location in main storage which bootloader uses as
* scratch space
*/
- uint8_t *g_blScratchSpace =
- reinterpret_cast<uint8_t*>(HBBL_SCRATCH_SPACE_ADDR);
+ uint8_t *g_blScratchSpace = NULL;
/** Apply Secure Signature Validation function.
*
@@ -86,6 +85,8 @@ namespace Bootloader{
uint32_t l_errCode = PNOR::NO_ERROR;
uint8_t l_tocUsed = 0;
+ g_blScratchSpace = reinterpret_cast<uint8_t*>(HBBL_SCRATCH_SPACE_ADDR);
+
// Get location of HB base code in PNOR from TOC
// @TODO RTC:138268 Support multiple sides of PNOR in bootloader
diff --git a/src/include/bootloader/bootloader.H b/src/include/bootloader/bootloader.H
index 65b715c09..ebcc4e1de 100644
--- a/src/include/bootloader/bootloader.H
+++ b/src/include/bootloader/bootloader.H
@@ -52,6 +52,20 @@ extern "C" void enterHBB(uint64_t i_hbb_hrmor, uint64_t i_hbb_offset);
namespace Bootloader{
/**
+ * @brief Get the current HBBL HRMOR
+ *
+ * Used to know where the bootloader is running
+ */
+ ALWAYS_INLINE
+ inline uint64_t getHRMOR()
+ {
+ register uint64_t hrmor = 0;
+ asm volatile("mfspr %0, 313" : "=r" (hrmor));
+ return hrmor;
+ }
+
+
+ /**
* @brief Pointer to bootloader scratch space
*
* Pointer to location in main storage which bootloader uses as
@@ -105,7 +119,7 @@ namespace Bootloader{
LENGTH_W_ECC = 9
};
- /** @enum HbAddrs
+ /**
* @brief List of addresses where HBB and HBBL code is stored.
*
* These specify locations where the Hostboot Bootloader code is
@@ -113,30 +127,23 @@ namespace Bootloader{
* is copied to various locations as the HBBL works with it. Then
* HBB is copied to its running location and its execution is started.
*/
- enum HbAddrs
+
+
+ /** Location of working copy of HBB with ECC */
+#define HBB_ECC_WORKING_ADDR (getHRMOR() - ( 1*MEGABYTE))
+
+ /** Location of working copy of HBB without ECC */
+#define HBB_WORKING_ADDR (getHRMOR() - ( 1*MEGABYTE))
+
+ /** Location of HBBL scratch space */
+#define HBBL_SCRATCH_SPACE_ADDR (getHRMOR() + (64*KILOBYTE))
+
+ /** Location of running copy of HBB */
+#define HBB_HRMOR (getHRMOR() - ( 2*MEGABYTE))
+#define HBB_RUNNING_ADDR (getHRMOR() - ( 2*MEGABYTE))
+
+ enum
{
- // @TODO-RTC:138273-Support multiple nodes using relative HRMOR
-
- /** HRMOR */
- HBBL_HRMOR = 130*MEGABYTE,
- HBB_HRMOR = 128*MEGABYTE,
-
- /** Location of working copy of HBB with ECC */
- HBB_ECC_WORKING_ADDR = (HBBL_HRMOR + 1*MEGABYTE),
-
- /** Location of HBBL */
- HBBL_ADDR = HBBL_HRMOR,
- /** Location of HBBL exception vectors */
- HBBL_EXCEPTION_VECTORS_ADDR = HBBL_ADDR,
- /** Location of HBBL code */
- HBBL_CODE_ADDR = HBBL_ADDR + 12*KILOBYTE,
- /** Location of HBBL scratch space */
- HBBL_SCRATCH_SPACE_ADDR = HBBL_ADDR + 64*KILOBYTE,
-
- /** Location of working copy of HBB without ECC */
- HBB_WORKING_ADDR = (HBBL_HRMOR - 1*MEGABYTE),
- /** Location of running copy of HBB */
- HBB_RUNNING_ADDR = (HBBL_HRMOR - 2*MEGABYTE),
/** Offset for starting running copy of HBB */
HBB_RUNNING_OFFSET = 0,
/** Mask to indicate HRMOR should be ignored for the address */
OpenPOWER on IntegriCloud