diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/include/usr/hdat/hdat.H | 13 | ||||
-rw-r--r-- | src/include/usr/runtime/runtime.H | 7 | ||||
-rw-r--r-- | src/include/usr/runtime/runtime_reasoncodes.H | 1 | ||||
-rwxr-xr-x | src/usr/hdat/hdatmsvpd.C | 2 | ||||
-rwxr-xr-x | src/usr/hdat/hdatmsvpd.H | 30 | ||||
-rw-r--r-- | src/usr/runtime/hdatservice.C | 25 | ||||
-rw-r--r-- | src/usr/runtime/populate_hbruntime.C | 51 |
7 files changed, 94 insertions, 35 deletions
diff --git a/src/include/usr/hdat/hdat.H b/src/include/usr/hdat/hdat.H index 5c95ce792..b173dcd98 100755 --- a/src/include/usr/hdat/hdat.H +++ b/src/include/usr/hdat/hdat.H @@ -201,6 +201,19 @@ struct hdatSpira_t hdat5Tuple_t hdatDataArea[24]; }__attribute__ ((packed)); +/** @enum List of possible Range Types for Reserved Hostboot Memory (RHB) + */ +enum hdatMsVpdRhbAddrRangeType +{ + RHB_TYPE_PRIMARY = 0, + RHB_TYPE_HBRT = 1, + RHB_TYPE_VERIFIED_LIDS = 2, + RHB_TYPE_TPM_LOG = 3, + RHB_TYPE_HOMER_OCC = 4, + + RHB_TYPE_INVALID = 0xFF +}; + /* vpd constants * Defining vpd constants */ diff --git a/src/include/usr/runtime/runtime.H b/src/include/usr/runtime/runtime.H index 7086ef55b..bdbcf20a8 100644 --- a/src/include/usr/runtime/runtime.H +++ b/src/include/usr/runtime/runtime.H @@ -116,13 +116,6 @@ errlHndl_t populate_RtDataByNode(uint64_t iNodeId); // HOMER*8/OCC_Common/VPD/ATTR/HBRT_Image/Res/Res/Res #define HB_RSV_MEM_NUM_PTRS 15 -// Range types for HB reserved memory -#define RANGE_TYPE_PRIMARY 0 -#define RANGE_TYPE_HBRT 1 -#define RANGE_TYPE_VERIFIED_LIDS 2 -#define RANGE_TYPE_TPM_LOG 3 -#define RANGE_TYPE_HOMER_OCC 4 - //Note this means the Reserved Mem sub-section is the 6th //(0 based) of the MDT section (See HDAT spec) #define MDT_RESERVED_HB_MEM_SECTION 5 diff --git a/src/include/usr/runtime/runtime_reasoncodes.H b/src/include/usr/runtime/runtime_reasoncodes.H index 2678c28a0..f287a5d97 100644 --- a/src/include/usr/runtime/runtime_reasoncodes.H +++ b/src/include/usr/runtime/runtime_reasoncodes.H @@ -88,6 +88,7 @@ namespace RUNTIME RC_PM_RT_UNKNOWN_MODE = RUNTIME_COMP_ID | 0x1D, RC_PM_RT_INTERFACE_ERR = RUNTIME_COMP_ID | 0x1E, RC_PM_RT_HCODE_UPDATE_ERR = RUNTIME_COMP_ID | 0x1F, + RC_INVALID_RHB_INSTANCE = RUNTIME_COMP_ID | 0x20, }; enum UserDetailsTypes diff --git a/src/usr/hdat/hdatmsvpd.C b/src/usr/hdat/hdatmsvpd.C index 32ab77fd1..5808561d6 100755 --- a/src/usr/hdat/hdatmsvpd.C +++ b/src/usr/hdat/hdatmsvpd.C @@ -289,7 +289,7 @@ errlHndl_t HdatMsVpd::addRHBAddrRange(uint32_t i_dbob_id, hdatMsAddr_t &i_start, <char*>(iv_RHBaddrRangeArray) + (iv_RHBaddrRngArrayHdr.hdatArrayCnt * sizeof(hdatMsVpdRhbAddrRange_t))); - l_addr->hdatRhbRngType = 0x0; + l_addr->hdatRhbRngType = HDAT::RHB_TYPE_INVALID; l_addr->hdatRhbRngId = i_dbob_id; l_addr->hdatRhbAddrRngStrAddr = i_start; l_addr->hdatRhbAddrRngEndAddr = i_end; diff --git a/src/usr/hdat/hdatmsvpd.H b/src/usr/hdat/hdatmsvpd.H index c530db9e3..273de55d1 100755 --- a/src/usr/hdat/hdatmsvpd.H +++ b/src/usr/hdat/hdatmsvpd.H @@ -67,10 +67,6 @@ const uint32_t HDAT_RHB_MAX_RANGE_ENTRIES = 15; */ const uint16_t HDAT_MS_VPD_VERSION = 0x24; -/** @brief Other constants - */ -const uint16_t HDAT_MS_RHB_LABEL_LEN = 64; //Reserved HB length - /** @enum hdatDataPtrs * Constants for the internal data pointers that are added to the base class */ @@ -176,20 +172,27 @@ struct hdatMsVpdUEAddrRange_t hdatMsAddr_t hdatUEAddr; // 0x0000 UE area starting address } __attribute__ ((packed)); -/** @brief In Reserved Hostboot Memory iaddress range array element information- +/** @brief In Reserved Hostboot Memory iaddress range array element information */ struct hdatMsVpdRhbAddrRange_t { - uint32_t hdatRhbRngType:8; // 0x0000 Range type - uint32_t hdatRhbRngId:24; // 0x0001 Range ID - hdatMsAddr_t hdatRhbAddrRngStrAddr; // 0x0004 Range starting - // address - hdatMsAddr_t hdatRhbAddrRngEndAddr; // 0x000C Range ending - // address+1 - uint32_t hdatRhbLabelSize; // 0x0014 Label size - uint8_t hdatRhbLabelString[HDAT_MS_RHB_LABEL_LEN];// 0x0019 Label string Ptr + uint32_t hdatRhbRngType:8; // 0x0000 Range type + uint32_t hdatRhbRngId:24; // 0x0001 Range ID + hdatMsAddr_t hdatRhbAddrRngStrAddr; // 0x0004 Range starting + // address + hdatMsAddr_t hdatRhbAddrRngEndAddr; // 0x000C Range ending + // address+1 + uint32_t hdatRhbLabelSize; // 0x0014 Label size + uint8_t hdatRhbLabelString[64]; // 0x0018 Label string Ptr + uint8_t reserved[8]; // 0x0058 Reserved } __attribute__ ((packed)); +/** @brief Reserved HB length + */ +const uint16_t HDAT_MS_RHB_LABEL_LEN = + sizeof(hdatMsVpdRhbAddrRange_t::hdatRhbLabelString); + + struct hdatMsVpd_t { @@ -200,6 +203,7 @@ struct hdatMsVpd_t hdatMsVpdUEAddrRange_t hdatUEAddrRange; hdatMsVpdRhbAddrRange_t hdatRhbAddrRange; }__attribute__ ((packed)); + /*----------------------------------------------------------------------------*/ /* Constants */ /*----------------------------------------------------------------------------*/ diff --git a/src/usr/runtime/hdatservice.C b/src/usr/runtime/hdatservice.C index ab306c381..0b6201df9 100644 --- a/src/usr/runtime/hdatservice.C +++ b/src/usr/runtime/hdatservice.C @@ -709,8 +709,29 @@ errlHndl_t hdatService::getHostDataSection( SectionId i_section, hdatMsReservedMemArrayHeader_t* reservedMemArrayHeader = reinterpret_cast<hdatMsReservedMemArrayHeader_t *>(resvMemHdatAddr); - assert(i_instance < reservedMemArrayHeader->arrayEntryCount, - "Instance entered exceeds max reserved mem entry count"); + if( i_instance >= reservedMemArrayHeader->arrayEntryCount ) + { + TRACFCOMP( g_trac_runtime, "Instance %d exceeds max reserved mem entry count %d", i_instance, reservedMemArrayHeader->arrayEntryCount ); + /*@ + * @errortype + * @moduleid RUNTIME::MOD_HDATSERVICE_GETHOSTDATASECTION + * @reasoncode RUNTIME::RC_INVALID_RHB_INSTANCE + * @userdata1 Requested instance + * @userdata2 Entry count + * @devdesc Invalid instance requested for Reserved + * Hostboot Memory section + * @custdesc Firmware error during boot + */ + errhdl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + RUNTIME::MOD_HDATSERVICE_GETHOSTDATASECTION, + RUNTIME::RC_INVALID_RHB_INSTANCE, + i_instance, + reservedMemArrayHeader->arrayEntryCount, + true /*Add HB Software Callout*/); + errhdl->collectTrace(RUNTIME_COMP_NAME,KILOBYTE); + break; + } o_dataAddr = reinterpret_cast<uint64_t>( resvMemHdatAddr + reservedMemArrayHeader->offsetToArray + (i_instance * sizeof(hdatMsVpdRhbAddrRange_t))); diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C index 534403d0b..04cfb8465 100644 --- a/src/usr/runtime/populate_hbruntime.C +++ b/src/usr/runtime/populate_hbruntime.C @@ -54,10 +54,12 @@ #include <util/align.H> #include <secureboot/trustedbootif.H> #include <secureboot/service.H> +#include <hdat/hdat.H> #include <config.h> #include "../hdat/hdattpmdata.H" #include "../secureboot/trusted/tpmLogMgr.H" #include "../secureboot/trusted/trustedboot.H" +#include <targeting/attrPlatOverride.H> namespace RUNTIME @@ -81,6 +83,7 @@ TRAC_INIT(&g_trac_runtime, RUNTIME_COMP_NAME, KILOBYTE); */ errlHndl_t populate_RtDataByNode(uint64_t iNodeId) { + TRACFCOMP( g_trac_runtime, ENTER_MRK"populate_RtDataByNode" ); errlHndl_t l_elog = nullptr; const char* l_stringLabels[] = { "ibm,hbrt-vpd-image" , @@ -253,6 +256,7 @@ errlHndl_t populate_RtDataByNode(uint64_t iNodeId) } while(0); + TRACFCOMP( g_trac_runtime, EXIT_MRK"populate_RtDataByNode" ); return(l_elog); } // end populate_RtDataByNode @@ -445,7 +449,7 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId) // Fill in the entry l_rngPtr->hdatRhbRngType = - static_cast<uint8_t>(RANGE_TYPE_PRIMARY); + static_cast<uint8_t>(HDAT::RHB_TYPE_PRIMARY); l_rngPtr->hdatRhbRngId = i_nodeId; l_rngPtr->hdatRhbAddrRngStrAddr = l_hbAddr | VmmManager::FORCE_PHYS_ADDR; @@ -458,6 +462,24 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId) l_labelSize ); traceHbRsvMemRange(l_rngPtr); + + //@fixme-RTC:169478-Remove this workaround once HDAT is ready + // Check to see if HDAT has the space we need allocated + // by looking for a 3rd instance + uint64_t l_rsvMemDataAddr = 0; + uint64_t l_rsvMemDataSizeMax = 0; + l_elog = RUNTIME::get_host_data_section( RUNTIME::RESERVED_MEM, + 3, + l_rsvMemDataAddr, + l_rsvMemDataSizeMax ); + if(l_elog != nullptr) + { + TRACFCOMP( g_trac_runtime, "populate_HbRsvMem> HDAT doesn't have RHB allocated, fall back to using old HBRT data" ); + delete l_elog; + l_elog = nullptr; + break; + } + //end workaround } else if(TARGETING::is_sapphire_load()) @@ -502,7 +524,7 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId) // Fill in the entry l_rngPtr->hdatRhbRngType = - static_cast<uint8_t>(RANGE_TYPE_HOMER_OCC); + static_cast<uint8_t>(HDAT::RHB_TYPE_HOMER_OCC); l_rngPtr->hdatRhbRngId = l_procChip->getAttr<TARGETING::ATTR_HBRT_HYP_ID>(); l_rngPtr->hdatRhbAddrRngStrAddr = @@ -545,7 +567,7 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId) // Fill in the entry l_rngPtr->hdatRhbRngType = - static_cast<uint8_t>(RANGE_TYPE_HOMER_OCC); + static_cast<uint8_t>(HDAT::RHB_TYPE_HOMER_OCC); l_rngPtr->hdatRhbRngId = i_nodeId; l_rngPtr->hdatRhbAddrRngStrAddr = l_occCommonAddr | VmmManager::FORCE_PHYS_ADDR; @@ -589,7 +611,7 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId) // Fill in the entry l_rngPtr->hdatRhbRngType = - static_cast<uint8_t>(RANGE_TYPE_HBRT); + static_cast<uint8_t>(HDAT::RHB_TYPE_HBRT); l_rngPtr->hdatRhbRngId = i_nodeId; l_rngPtr->hdatRhbAddrRngStrAddr = l_vpdAddr | VmmManager::FORCE_PHYS_ADDR; @@ -652,7 +674,7 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId) // Fill in the entry l_rngPtr->hdatRhbRngType = - static_cast<uint8_t>(RANGE_TYPE_HBRT); + static_cast<uint8_t>(HDAT::RHB_TYPE_HBRT); l_rngPtr->hdatRhbRngId = i_nodeId; l_rngPtr->hdatRhbAddrRngStrAddr = l_attrDataAddr | VmmManager::FORCE_PHYS_ADDR; @@ -729,7 +751,7 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId) // Fill in the entry l_rngPtr->hdatRhbRngType = - static_cast<uint8_t>(RANGE_TYPE_HBRT); + static_cast<uint8_t>(HDAT::RHB_TYPE_HBRT); l_rngPtr->hdatRhbRngId = i_nodeId; l_rngPtr->hdatRhbAddrRngStrAddr = l_hbrtImageAddr | VmmManager::FORCE_PHYS_ADDR; @@ -1187,14 +1209,19 @@ errlHndl_t populate_hbRuntimeData( void ) // needs to be setup by a hb routine that snoops for multiple nodes. if (0 == hb_images) //Single-node { - // Single node system, call inline and pass in our node number - l_elog = populate_RtDataByNode(nodeid); - if(l_elog != nullptr) + //@fixme-RTC:169478-Remove once all code has switched + if( TARGETING::is_phyp_load() ) { - TRACFCOMP( g_trac_runtime, "populate_RtDataByNode failed" ); + // Single node system, call inline and pass in our node number + l_elog = populate_RtDataByNode(0); + if(l_elog != nullptr) + { + TRACFCOMP( g_trac_runtime, "populate_RtDataByNode failed" ); + break; + } } - // RTC 169478 - enable for PHYP when supported in FSP - if(TARGETING::is_sapphire_load()) + + if(!TARGETING::is_no_load()) { l_elog = populate_HbRsvMem(nodeid); if(l_elog != nullptr) |