diff options
-rw-r--r-- | src/include/usr/runtime/runtime.H | 7 | ||||
-rw-r--r-- | src/usr/runtime/hdatservice.C | 57 | ||||
-rw-r--r-- | src/usr/runtime/hdatstructs.H | 23 |
3 files changed, 86 insertions, 1 deletions
diff --git a/src/include/usr/runtime/runtime.H b/src/include/usr/runtime/runtime.H index 286e649e5..dc24175cb 100644 --- a/src/include/usr/runtime/runtime.H +++ b/src/include/usr/runtime/runtime.H @@ -83,6 +83,10 @@ errlHndl_t populate_RtDataByNode(uint64_t iNodeId); #define HBRT_VPD_SECTION 0 #define HBRT_ATTRIB_SECTION 1 +//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 + /** * HDAT Sections */ @@ -101,7 +105,8 @@ enum SectionId NACA, //< NACA HBRT, //< Hostboot Runtime HBRT_DATA, //< Hostboot Runtime Data - LAST_SECTION = HBRT_DATA //< Placeholder for arrays + RESERVED_MEM, //< Hostboot's Reserved Mainstore Memory + LAST_SECTION = RESERVED_MEM //< Placeholder for arrays }; /** diff --git a/src/usr/runtime/hdatservice.C b/src/usr/runtime/hdatservice.C index 88475e0c4..205c6e006 100644 --- a/src/usr/runtime/hdatservice.C +++ b/src/usr/runtime/hdatservice.C @@ -52,6 +52,12 @@ namespace RUNTIME /******************** Local Constants used for sanity checks ********************/ +const hdatHeaderExp_t MDT_HEADER = { + 0xD1F0, //id + "MS VPD", //name + 0x0024 //version +}; + const hdatHeaderExp_t HBRT_DATA_HEADER = { 0xD1F0, //id "HBRT ", //name @@ -673,6 +679,57 @@ errlHndl_t hdatService::getHostDataSection( SectionId i_section, o_dataSize = 0; } } + else if (RUNTIME::RESERVED_MEM == i_section) + { + // Find the right tuple and verify it makes sense + hdat5Tuple_t* tuple = NULL; + if( iv_spiraS ) + { + tuple = &(iv_spiraS->hdatDataArea[SPIRAS_MDT]); + } + else if( unlikely(iv_spiraL != NULL) ) + { + tuple = &(iv_spiraL->hdatDataArea[SPIRAL_MDT]); + } + TRACUCOMP(g_trac_runtime, "MDT_DATA tuple=%p", tuple); + errhdl = check_tuple( i_section, + tuple ); + if( errhdl ) { break; } + + uint64_t base_addr; + errhdl = getSpiraTupleVA(tuple, base_addr); + if( errhdl ) { break; } + + hdatHDIF_t* mdt_header = + reinterpret_cast<hdatHDIF_t*>(base_addr); + TRACUCOMP( g_trac_runtime, "mdt_header=%p", mdt_header ); + + // Check the headers and version info + errhdl = check_header( mdt_header, + MDT_HEADER ); + if( errhdl ) { break; } + + hdatHDIFDataHdr_t* mdt_data_header = + reinterpret_cast<hdatHDIFDataHdr_t*> + (mdt_header->hdatDataPtrOffset + base_addr); + + errhdl = verify_hdat_address(mdt_data_header, + mdt_header->hdatDataPtrCnt * sizeof(hdatHDIFDataHdr_t) ); + if( errhdl ) { break; } + + uint64_t resvMemHdatAddr = mdt_data_header[MDT_RESERVED_HB_MEM_SECTION].hdatOffset + base_addr; + + hdatMsReservedMemArrayHeader_t* reservedMemArrayHeader = + reinterpret_cast<hdatMsReservedMemArrayHeader_t *>(resvMemHdatAddr); + + assert(i_instance < reservedMemArrayHeader->arrayEntryCount, + "Instance entered exceeds max reserved mem entry count"); + + o_dataAddr = reinterpret_cast<uint64_t>( + resvMemHdatAddr + reservedMemArrayHeader->offsetToArray + (i_instance * sizeof(hdatMsVpdRhbAddrRange_t))); + //Array Header addr + o_dataSize = sizeof(hdatMsVpdRhbAddrRange_t); + } // HB Runtime Data else if ( (RUNTIME::HBRT == i_section) || (RUNTIME::HBRT_DATA == i_section) ) diff --git a/src/usr/runtime/hdatstructs.H b/src/usr/runtime/hdatstructs.H index 1eb2bc70f..804f8414e 100644 --- a/src/usr/runtime/hdatstructs.H +++ b/src/usr/runtime/hdatstructs.H @@ -296,4 +296,27 @@ struct hdatHBRT_t } __attribute__ ((packed)); +/** @brief Header to array of reserved Hostboot memory address +*/ +struct hdatMsReservedMemArrayHeader_t +{ + uint32_t offsetToArray; //offSet to Address Range Array + uint32_t arrayEntryCount; //total number of entries (reserved memSections) + uint32_t entrySize; // allotted size of each array entry + uint32_t actualContentSize; //actual size of array entries +} __attribute__ ((packed)); + +/** @brief In Reserved Hostboot Memory iaddress range +* array element information - +*/ +struct hdatMsVpdRhbAddrRange_t +{ + uint32_t hdatDbobID; // 0x0000 Node instance + uint64_t hdatRhbAddrRngStrAddr; // 0x0004 Range starting + uint64_t hdatRhbAddrRngEndAddr; // 0x000C Range ending + uint32_t hdatRhbLabelSize; // 0x0014 Label size + uint8_t hdatRhbLabelString[64]; // 0x0019 Label string Ptr +} __attribute__ ((packed)); + + #endif |