From 30cd84febe39134df6d837538e68e25ca9fb8b76 Mon Sep 17 00:00:00 2001 From: Vasant Hegde Date: Wed, 21 Feb 2018 11:14:11 +0530 Subject: Add support to find relocated payload base address OPAL relocates itself after boot. During MPIPL, hostboot needs to access relocated SPIRAH. Hence lets add support to get relocated payload base address. OPAL will use SBE stash chip-op to send relocated address to SBE. During early IPL SBE sends stashed data to hostboot. And hostboot will use that information to find relocated payload (OPAL) base. SBE stash chip op: key = 0x03 val = Change-Id: I1089bd38f32b01b877d1580ba76313fc250e5c08 Signed-off-by: Vasant Hegde Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/55190 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Christian R. Geddes Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- src/usr/runtime/hdatservice.C | 27 +++++++++++++++++++++++++++ src/usr/runtime/hdatservice.H | 17 +++++++++++++++++ 2 files changed, 44 insertions(+) (limited to 'src/usr/runtime') diff --git a/src/usr/runtime/hdatservice.C b/src/usr/runtime/hdatservice.C index 4fd752653..88e80e9a0 100644 --- a/src/usr/runtime/hdatservice.C +++ b/src/usr/runtime/hdatservice.C @@ -38,6 +38,7 @@ #include "hdatservice.H" #include "errlud_hdat.H" #include +#include //#define REAL_HDAT_TEST @@ -316,6 +317,7 @@ hdatService::hdatService(void) :iv_spiraL(NULL) ,iv_spiraH(NULL) ,iv_spiraS(NULL) +,iv_useRelocatedPayload(false) { for( uint8_t id = static_cast(RUNTIME::FIRST_SECTION); id <= static_cast(RUNTIME::LAST_SECTION); @@ -492,6 +494,26 @@ errlHndl_t hdatService::loadHostData(void) uint64_t hdat_start = payload_base*MEGABYTE; uint64_t hdat_size = HDAT_MEM_SIZE; + // OPAL relocates itself after boot. Hence get relocated payload + // address. If relocated address not available then use normal + // base address (as OPAL would have crashed during early init). + if (iv_useRelocatedPayload == true && + TARGETING::PAYLOAD_KIND_SAPPHIRE == payload_kind) + { + uint64_t reloc_base; + + reloc_base = TARGETING::AttrRP::getHbDataRelocPayloadAddr(); + if (reloc_base != 0) + { + hdat_start = reloc_base; + TRACFCOMP( g_trac_runtime, "Relocated payload base =%p", hdat_start); + } + else + { + TRACFCOMP( g_trac_runtime, "No relocated payload base found, continuing on"); + } + } + #ifdef REAL_HDAT_TEST hdat_start = 256*MEGABYTE; #endif @@ -1745,6 +1767,11 @@ errlHndl_t writeActualCount( SectionId i_id ) return Singleton::instance().writeActualCount(i_id); } +void useRelocatedPayloadAddr(bool val) +{ + return Singleton::instance().useRelocatedPayloadAddr(val); +} + /** * @brief Retrieve and log FFDC data relevant to a given section of * host data memory diff --git a/src/usr/runtime/hdatservice.H b/src/usr/runtime/hdatservice.H index 9e3be107b..44ff12a58 100644 --- a/src/usr/runtime/hdatservice.H +++ b/src/usr/runtime/hdatservice.H @@ -302,6 +302,12 @@ namespace RUNTIME */ uint16_t iv_actuals[RUNTIME::LAST_SECTION+1]; + /** + * Used to identify whether to use relocated payload base address + * or normal address. + */ + bool iv_useRelocatedPayload; + /** * Dummy value for unassigned actual */ @@ -339,6 +345,17 @@ namespace RUNTIME } return l_err; } + + /** + * @brief Use relocated payload base address + * + * @param[in] val 'true' for post dump data collection + * + */ + void useRelocatedPayloadAddr(bool val) + { + iv_useRelocatedPayload = val; + } }; }; -- cgit v1.2.3