summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2018-05-31 17:03:24 -0500
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2018-06-04 17:32:40 -0400
commit41daed137d2f31ba125a1ada241755e42f36868c (patch)
tree5067edb244a9ed4bd0bc7a04b792df15c0a93619 /src
parentcbacafbc508accc492c63d4f18e509a6082e8f45 (diff)
downloadblackbird-hostboot-41daed137d2f31ba125a1ada241755e42f36868c.tar.gz
blackbird-hostboot-41daed137d2f31ba125a1ada241755e42f36868c.zip
Write Hostboot HRMOR into core scratch reg 1
Hostboot code will write the current HRMOR value into core scratch reg 1 (scom=xx010A87, spr=0x08) at initial boot. This data is ORed into the memory size data that was already present. The bootloader code will do the same. Also updated the debug tools to key off of this data if it is available to avoid any HRMOR hardcoding. The purpose of this change is to provide a method for the FSP code to handle various memory remapping scenarios that are currently in plan without needing any explicit communication from Hostboot. Change-Id: Ia3c81980ebd780ae182956cddae785dd408fbed9 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/59699 Reviewed-by: Prachi Gupta <pragupta@us.ibm.com> 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> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/bootloader/bootloader.C15
-rwxr-xr-xsrc/build/debug/ecmd-debug-framework.pl22
-rwxr-xr-xsrc/build/debug/fsp-memdump.sh12
-rw-r--r--src/include/bootloader/bootloader.H7
-rw-r--r--src/include/kernel/memstate.H58
-rw-r--r--src/kernel/misc.C16
6 files changed, 84 insertions, 46 deletions
diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C
index eed79770d..b9b14c8b2 100644
--- a/src/bootloader/bootloader.C
+++ b/src/bootloader/bootloader.C
@@ -49,6 +49,7 @@
#include <p9_sbe_hb_structures.H>
#include <pnor/pnorif.H>
+#include <kernel/memstate.H>
extern char bootloader_end_address;
@@ -405,7 +406,19 @@ namespace Bootloader{
uint64_t hostboot_string = 0x626F6F746C6F6164;
writeScratchReg(MMIO_SCRATCH_HOSTBOOT_ACTIVE, hostboot_string);
- // @TODO RTC:138268 Support multiple sides of PNOR in bootloader
+ //Set core scratch 1 to the eventual HRMOR of Hostboot
+ // and 4MB of space. The HRMOR spoofing is required in
+ // order for FSP code to be able to find the TI area without
+ // having to know exactly where we are in the boot flow.
+ // See _updates_and_setup in bl_start.S for where we put
+ // our TI area below our actual HRMOR. The 4MB size will
+ // allow a dump to grab all of our working data along with
+ // our actual image.
+ KernelMemState::MemState_t l_memstate;
+ l_memstate.location = KernelMemState::MEM_CONTAINED_L3;
+ l_memstate.hrmor = getHRMOR() - HBB_RUNNING_ADDR;
+ l_memstate.size = KernelMemState::HALF_CACHE;
+ writeScratchReg(MMIO_SCRATCH_MEMORY_STATE, l_memstate.fullData);
// Copy SBE BL shared data into BL HB shared data
const auto l_blConfigData = reinterpret_cast<BootloaderConfigData_t *>(
diff --git a/src/build/debug/ecmd-debug-framework.pl b/src/build/debug/ecmd-debug-framework.pl
index 15439c66a..0fadd554b 100755
--- a/src/build/debug/ecmd-debug-framework.pl
+++ b/src/build/debug/ecmd-debug-framework.pl
@@ -35,6 +35,7 @@ use Hostboot::_DebugFramework;
use constant DEFAULT_HRMOR => 128*1024*1024; # 128 MB.
use constant PER_NODE_OFFSET => 32*1024*1024*1024*1024; # 32 TB.
+use constant UNSET_HRMOR => 0xFFFFFFFFFFFFFFFF;
my $filename = basename (__FILE__);
my $self = ($0 =~ m/$filename/);
@@ -49,6 +50,7 @@ my $forceHRMOR = 0;
my $node = 0; # -nX parm to ecmd
my $proc = 0; # -pX parm to ecmd
my $memMode = "check";
+my $hrmor = UNSET_HRMOR;
my $imgPath = "";
my $hbDir = $ENV{'HB_IMGDIR'};
@@ -152,9 +154,27 @@ sub getHRMOR
{
return $forceHRMOR;
}
+ elsif( $hrmor != UNSET_HRMOR )
+ {
+ # we already calculated everything
+ return $hrmor;
+ }
else
{
- return DEFAULT_HRMOR + ($node * PER_NODE_OFFSET);
+ # read Core Scratch 1 (multicast to all cores)
+ my $scratch1 = readScom( 0x41010A87, 8 );
+ # Bits 4:51 are the current HRMOR in MB (see memstate.H)
+ my $hrmor = ($scratch1 & 0x0FFFFFFFFFFFF000)>>12;
+ if( $hrmor == 0 )
+ {
+ $hrmor = DEFAULT_HRMOR + ($node * PER_NODE_OFFSET);
+ }
+ else
+ {
+ $hrmor = $hrmor*1024; #value is in MB
+ }
+
+ return $hrmor;
}
}
diff --git a/src/build/debug/fsp-memdump.sh b/src/build/debug/fsp-memdump.sh
index ef1b096ed..f62ae120f 100755
--- a/src/build/debug/fsp-memdump.sh
+++ b/src/build/debug/fsp-memdump.sh
@@ -93,6 +93,18 @@ limit_memory()
esac
}
+# @fn find_hrmor
+# Discover the stashed away HRMOR.
+find_hrmor()
+{
+ # HRMOR is stored in bits 4:51 of core scratch 1
+ # See memstate.H for details
+ fullreg=`getscom pu 41010A87 4 48`
+ #multiply result by 1024 since it is in MB
+ #take NODE into account
+ #fixme
+}
+
# Read filename and state.
FILE=$1
STATE=$2
diff --git a/src/include/bootloader/bootloader.H b/src/include/bootloader/bootloader.H
index 8020311ba..55b148f6b 100644
--- a/src/include/bootloader/bootloader.H
+++ b/src/include/bootloader/bootloader.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2017 */
+/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -139,6 +139,11 @@ namespace Bootloader{
}
+ /**Core Scratch Register 1 which tells HRMOR and memsize.
+ This is passed into writeScratchReg to select which scratch
+ reg you are writing */
+#define MMIO_SCRATCH_MEMORY_STATE 0x08
+
/**Core Scratch Register 3 which tells the state of hostboot.
This is passed into writeScratchReg to select which scratch
reg you are writing */
diff --git a/src/include/kernel/memstate.H b/src/include/kernel/memstate.H
index fb42ed31f..350cf6a2d 100644
--- a/src/include/kernel/memstate.H
+++ b/src/include/kernel/memstate.H
@@ -33,67 +33,55 @@
namespace KernelMemState
{
- // hb_Mem_Location struct values are defined below.
- /* see mmio.h for scratch reg definitions
-
- Register Bit Definition:
- - 0:7 - Indicator of memory mode
- NOTE: having no bits on in this range indicated the memory is not ready.
- - - 0b00000000 = Hostboot contained in L3
- - - 0b00000001 = Hostboot expanded to mainstore
- - 8:31 - Reserved/Unused
- - 32:63 - Size of active Hostboot memory in MB
- - - 0 = Hostboot is not ready yet.
- - - 4 = Hostboot is using half a cache
- - - 8 = Hostboot is using reduced cache
- - - 10 = Hostboot is using the full cache
- - - XX = Hostboot is using XX MB of mainstore*/
-
+ /* see mmio.h for scratch reg definitions */
enum MemLocation
{
MEM_CONTAINED_NR = 0x0,
- MEM_CONTAINED_L3 = 0x80,
- MEM_CONTAINED_MS = 0x40,
+ MEM_CONTAINED_L3 = 0x8,
+ MEM_CONTAINED_MS = 0x4,
};
// This constants must be kept in sync with the Dump.pm debug tool.
enum MemSize
{
- NO_MEM = 0x0,
- HALF_CACHE = 0x00000004,
- REDUCED_CACHE = 0x00000008,
- FULL_CACHE = 0x0000000A,
+ NO_MEM = 0x000,
+ HALF_CACHE = 0x004,
+ REDUCED_CACHE = 0x008,
+ FULL_CACHE = 0x00A,
FULL_MEM = (VMM_MEMORY_SIZE/MEGABYTE),
+ MAX_MEMORY = 0xFFF //max space allocated for size
};
- struct mem_location
+ struct MemState_t
{
union{
struct {
- uint64_t memMode:8; /**< indicator of memory mode HostBoot
- contained in l3 or mainstore */
-
- uint64_t reserved:24; /**< reserved */
- uint64_t memSize:32; /**< Size of the memory */
+ // 00:03 - Indicator of memory mode
+ uint64_t location:4; /**< Indicator of memory mode HostBoot
+ contained in L3 or mainstore */
+ // 04:51 - Current HRMOR
+ uint64_t hrmor:48; /**< Current HRMOR in MB */
+ // 52:63 - Size of active Hostboot memory
+ uint64_t size:12; /**< Size of the memory in MB */
};
- uint64_t Scratch6Data; /**< Full double word */
+ uint64_t fullData; /**< Full double word */
};
- };
+ } PACKED;
- /** @fn set
+ /** @fn setMemScratchReg
*
- * @brief Sets the Hostboot memory location and size in the scratch
- * register 6
+ * @brief Sets the Hostboot memory location and size
*
- * This is used to update the core scratch reg 6 with the current
+ * This is used to update the core scratch reg with the current
* location of hostboot memory and the size it is.
*
* @param[in] uint16_t - location of the memory (L3 or Mainstore)
* @param[in] uint32_t - size of the memory
*/
- void setMemScratchReg(MemLocation i_location,MemSize i_size);
+ void setMemScratchReg( MemLocation i_location,
+ MemSize i_size );
};
diff --git a/src/kernel/misc.C b/src/kernel/misc.C
index 3ab2a7a57..b602ed707 100644
--- a/src/kernel/misc.C
+++ b/src/kernel/misc.C
@@ -591,22 +591,22 @@ namespace KernelMisc
namespace KernelMemState
{
void setMemScratchReg(MemLocation i_location,
- MemSize i_size)
+ MemSize i_size)
{
- mem_location l_MemData;
+ MemState_t l_MemData;
- l_MemData.memMode = i_location;
- l_MemData.reserved = 0;
- l_MemData.memSize = i_size;
+ l_MemData.location = i_location;
+ l_MemData.hrmor = getHRMOR();
+ l_MemData.size = i_size;
+ kassert( i_size < KernelMemState::MAX_MEMORY );
isync();
- kernel_hbDescriptor.kernelMemoryState = l_MemData.Scratch6Data;
+ kernel_hbDescriptor.kernelMemoryState = l_MemData.fullData;
KernelMisc::updateScratchReg(MMIO_SCRATCH_MEMORY_STATE,
- l_MemData.Scratch6Data);
+ l_MemData.fullData);
lwsync();
}
-
};
const char* ProcessorCoreTypeStrings[]
OpenPOWER on IntegriCloud