From 5ff30c35122026589eb7351452d7221e6c746f69 Mon Sep 17 00:00:00 2001 From: Dean Sanner Date: Thu, 27 Oct 2016 21:40:41 -0500 Subject: Boot loader support for relative HRMOR Update the bootloader to allow different HRMORs to be used. Reads the starting HRMOR as the base and then loads Hostboot off of that. Change-Id: I6d56c30b4b3ba3d7297d5988ac965e5f5a5f7fd7 RTC: 138273 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31934 Tested-by: Jenkins Server Reviewed-by: Christian R. Geddes Reviewed-by: Martin Gloff Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- src/include/bootloader/bootloader.H | 55 +++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 24 deletions(-) (limited to 'src/include/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 @@ -51,6 +51,20 @@ extern "C" void enterHBB(uint64_t i_hbb_hrmor, uint64_t i_hbb_offset); #define printk(format...) 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 * @@ -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 */ -- cgit v1.2.1