Skip to content

Commit a363bb9

Browse files
crgeddesNick Bofferding
authored and
Nick Bofferding
committed
Add option to get reserved mem section from hdat service
In the future, attribute/targeting hdat data will be stored in main store memory and hdat will just have a pointer to the memory location. This is setting up the ability for hdat service to provide the memory locations. Change-Id: I3d6748cb496c79465602d89e3c4f6d4508a68b35 RTC:165369 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33436 Tested-by: Jenkins Server <[email protected]> Tested-by: Jenkins OP Build CI <[email protected]> Tested-by: FSP CI Jenkins <[email protected]> Reviewed-by: Daniel M. Crowell <[email protected]>
1 parent e6cad3a commit a363bb9

File tree

3 files changed

+86
-1
lines changed

3 files changed

+86
-1
lines changed

src/include/usr/runtime/runtime.H

+6-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ errlHndl_t populate_RtDataByNode(uint64_t iNodeId);
8383
#define HBRT_VPD_SECTION 0
8484
#define HBRT_ATTRIB_SECTION 1
8585

86+
//Note this means the Reserved Mem sub-section is the 6th
87+
//(0 based) of the MDT section (See HDAT spec)
88+
#define MDT_RESERVED_HB_MEM_SECTION 5
89+
8690
/**
8791
* HDAT Sections
8892
*/
@@ -101,7 +105,8 @@ enum SectionId
101105
NACA, //< NACA
102106
HBRT, //< Hostboot Runtime
103107
HBRT_DATA, //< Hostboot Runtime Data
104-
LAST_SECTION = HBRT_DATA //< Placeholder for arrays
108+
RESERVED_MEM, //< Hostboot's Reserved Mainstore Memory
109+
LAST_SECTION = RESERVED_MEM //< Placeholder for arrays
105110
};
106111

107112
/**

src/usr/runtime/hdatservice.C

+57
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ namespace RUNTIME
5252
/********************
5353
Local Constants used for sanity checks
5454
********************/
55+
const hdatHeaderExp_t MDT_HEADER = {
56+
0xD1F0, //id
57+
"MS VPD", //name
58+
0x0024 //version
59+
};
60+
5561
const hdatHeaderExp_t HBRT_DATA_HEADER = {
5662
0xD1F0, //id
5763
"HBRT ", //name
@@ -673,6 +679,57 @@ errlHndl_t hdatService::getHostDataSection( SectionId i_section,
673679
o_dataSize = 0;
674680
}
675681
}
682+
else if (RUNTIME::RESERVED_MEM == i_section)
683+
{
684+
// Find the right tuple and verify it makes sense
685+
hdat5Tuple_t* tuple = NULL;
686+
if( iv_spiraS )
687+
{
688+
tuple = &(iv_spiraS->hdatDataArea[SPIRAS_MDT]);
689+
}
690+
else if( unlikely(iv_spiraL != NULL) )
691+
{
692+
tuple = &(iv_spiraL->hdatDataArea[SPIRAL_MDT]);
693+
}
694+
TRACUCOMP(g_trac_runtime, "MDT_DATA tuple=%p", tuple);
695+
errhdl = check_tuple( i_section,
696+
tuple );
697+
if( errhdl ) { break; }
698+
699+
uint64_t base_addr;
700+
errhdl = getSpiraTupleVA(tuple, base_addr);
701+
if( errhdl ) { break; }
702+
703+
hdatHDIF_t* mdt_header =
704+
reinterpret_cast<hdatHDIF_t*>(base_addr);
705+
TRACUCOMP( g_trac_runtime, "mdt_header=%p", mdt_header );
706+
707+
// Check the headers and version info
708+
errhdl = check_header( mdt_header,
709+
MDT_HEADER );
710+
if( errhdl ) { break; }
711+
712+
hdatHDIFDataHdr_t* mdt_data_header =
713+
reinterpret_cast<hdatHDIFDataHdr_t*>
714+
(mdt_header->hdatDataPtrOffset + base_addr);
715+
716+
errhdl = verify_hdat_address(mdt_data_header,
717+
mdt_header->hdatDataPtrCnt * sizeof(hdatHDIFDataHdr_t) );
718+
if( errhdl ) { break; }
719+
720+
uint64_t resvMemHdatAddr = mdt_data_header[MDT_RESERVED_HB_MEM_SECTION].hdatOffset + base_addr;
721+
722+
hdatMsReservedMemArrayHeader_t* reservedMemArrayHeader =
723+
reinterpret_cast<hdatMsReservedMemArrayHeader_t *>(resvMemHdatAddr);
724+
725+
assert(i_instance < reservedMemArrayHeader->arrayEntryCount,
726+
"Instance entered exceeds max reserved mem entry count");
727+
728+
o_dataAddr = reinterpret_cast<uint64_t>(
729+
resvMemHdatAddr + reservedMemArrayHeader->offsetToArray + (i_instance * sizeof(hdatMsVpdRhbAddrRange_t)));
730+
//Array Header addr
731+
o_dataSize = sizeof(hdatMsVpdRhbAddrRange_t);
732+
}
676733
// HB Runtime Data
677734
else if ( (RUNTIME::HBRT == i_section) ||
678735
(RUNTIME::HBRT_DATA == i_section) )

src/usr/runtime/hdatstructs.H

+23
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,27 @@ struct hdatHBRT_t
296296
} __attribute__ ((packed));
297297

298298

299+
/** @brief Header to array of reserved Hostboot memory address
300+
*/
301+
struct hdatMsReservedMemArrayHeader_t
302+
{
303+
uint32_t offsetToArray; //offSet to Address Range Array
304+
uint32_t arrayEntryCount; //total number of entries (reserved memSections)
305+
uint32_t entrySize; // allotted size of each array entry
306+
uint32_t actualContentSize; //actual size of array entries
307+
} __attribute__ ((packed));
308+
309+
/** @brief In Reserved Hostboot Memory iaddress range
310+
* array element information -
311+
*/
312+
struct hdatMsVpdRhbAddrRange_t
313+
{
314+
uint32_t hdatDbobID; // 0x0000 Node instance
315+
uint64_t hdatRhbAddrRngStrAddr; // 0x0004 Range starting
316+
uint64_t hdatRhbAddrRngEndAddr; // 0x000C Range ending
317+
uint32_t hdatRhbLabelSize; // 0x0014 Label size
318+
uint8_t hdatRhbLabelString[64]; // 0x0019 Label string Ptr
319+
} __attribute__ ((packed));
320+
321+
299322
#endif

0 commit comments

Comments
 (0)