Skip to content

Commit

Permalink
Support multiple nodes in HBRT - VPD Image
Browse files Browse the repository at this point in the history
Enable HBRT to find the location of the correct VPD image on a multiple node
system.

Change-Id: I712879cf2c58d71d55ba13b06285e41bbf4ea65d
RTC: 186583
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/53983
Tested-by: Jenkins Server <pfd-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>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mgloff authored and dcrowell77 committed Mar 13, 2018
1 parent 27755fa commit 5fc3b52
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
34 changes: 25 additions & 9 deletions src/usr/vpd/runtime/rt_vpd.C
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern trace_desc_t* g_trac_vpd;
// Global variable to store the location of hbrt-vpd-image returned by the
// host interface get_reserved_mem function. We only want to call the
// function once as memory is allocated with every call.
static uint64_t g_reserved_mem_addr = 0;
static uint64_t g_reserved_mem_addr[] = {0, 0, 0, 0};


namespace VPD
Expand Down Expand Up @@ -97,20 +97,22 @@ rtVpdInit g_rtVpdInit;
// Fake getPnorAddr - VPD image is in memory
// ------------------------------------------------------------------
errlHndl_t getPnorAddr( pnorInformation & i_pnorInfo,
uint8_t i_instance,
uint64_t &io_cachedAddr,
mutex_t * i_mutex )
{
errlHndl_t err = NULL;

// Get the reserved_mem_addr only once
if( g_reserved_mem_addr == 0 )
if( g_reserved_mem_addr[i_instance] == 0 )
{
uint64_t l_vpdSize;
g_reserved_mem_addr = hb_get_rt_rsvd_mem(Util::HBRT_MEM_LABEL_VPD,
0,
l_vpdSize);
g_reserved_mem_addr[i_instance] =
hb_get_rt_rsvd_mem(Util::HBRT_MEM_LABEL_VPD,
i_instance,
l_vpdSize);

if( g_reserved_mem_addr == 0 )
if( g_reserved_mem_addr[i_instance] == 0 )
{
TRACFCOMP(g_trac_vpd,ERR_MRK"rt_vpd: Failed to get VPD addr. "
"vpd_type: %d",
Expand All @@ -120,14 +122,14 @@ errlHndl_t getPnorAddr( pnorInformation & i_pnorInfo,
* @moduleid VPD::VPD_RT_GET_ADDR
* @reasoncode VPD::VPD_RT_NULL_VPD_PTR
* @userdata1 VPD type
* @userdata2 0
* @userdata2 Node ID
* @devdesc Hypervisor returned NULL address for VPD
*/
err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL,
VPD::VPD_RT_GET_ADDR,
VPD::VPD_RT_NULL_VPD_PTR,
i_pnorInfo.pnorSection,
0);
i_instance);

err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE,
HWAS::SRCI_PRIORITY_HIGH);
Expand All @@ -136,7 +138,7 @@ errlHndl_t getPnorAddr( pnorInformation & i_pnorInfo,
}
}

uint64_t vpd_addr = g_reserved_mem_addr;
uint64_t vpd_addr = g_reserved_mem_addr[i_instance];

if(!err)
{
Expand Down Expand Up @@ -204,17 +206,24 @@ errlHndl_t readPNOR ( uint64_t i_byteAddr,
mutex_t * i_mutex )
{
errlHndl_t err = NULL;
TARGETING::NODE_ID l_nodeId = TARGETING::NODE0;
int64_t vpdLocation = 0;
uint64_t addr = 0x0;
const char * readAddr = NULL;

TRACSSCOMP( g_trac_vpd,
ENTER_MRK"RT fake readPNOR()" );

// Get AttrRP pointer
TARGETING::AttrRP *l_attrRP = &TARG_GET_SINGLETON(TARGETING::theAttrRP);
// Get the node ID associated with the input target
l_attrRP->getNodeId(i_target, l_nodeId);

do
{
// fake getPnorAddr gets memory address of VPD
err = getPnorAddr(i_pnorInfo,
l_nodeId,
io_cachedAddr,
i_mutex );
if(err)
Expand Down Expand Up @@ -267,20 +276,27 @@ errlHndl_t writePNOR ( uint64_t i_byteAddr,
{
errlHndl_t err = NULL;

TARGETING::NODE_ID l_nodeId = TARGETING::NODE0;
int64_t vpdLocation = 0;
uint64_t addr = 0x0;
const char * writeAddr = NULL;

TRACSSCOMP( g_trac_vpd,
ENTER_MRK"RT writePNOR()" );

// Get AttrRP pointer
TARGETING::AttrRP *l_attrRP = &TARG_GET_SINGLETON(TARGETING::theAttrRP);
// Get the node ID associated with the input target
l_attrRP->getNodeId(i_target, l_nodeId);

do
{
//----------------------------
// Write memory version of VPD
//----------------------------
// Fake getPnorAddr gets memory address of VPD
err = getPnorAddr( i_pnorInfo,
l_nodeId,
io_cachedAddr,
i_mutex );
if(err)
Expand Down
7 changes: 6 additions & 1 deletion src/usr/vpd/vpd.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* Contributors Listed Below - COPYRIGHT 2013,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -107,6 +107,8 @@ errlHndl_t getVpdLocation ( int64_t & o_vpdLocation,
* @param[in] i_pnorInfo - Structure of common PNOR information needed to
* query for the sections address.
*
* @param[in] i_instance -Reserved memory instance (Hostboot Runtime only).
*
* @param[in/out] io_cachedAddr - This parameter is a gloval variable in the
* calling code. It is the address that is obtained from the PNOR
* RP.
Expand All @@ -118,6 +120,9 @@ errlHndl_t getVpdLocation ( int64_t & o_vpdLocation,
* Error log.
*/
errlHndl_t getPnorAddr ( pnorInformation & i_pnorInfo,
#ifdef __HOSTBOOT_RUNTIME
uint8_t i_instance,
#endif
uint64_t &io_cachedAddr,
mutex_t * i_mutex );

Expand Down

0 comments on commit 5fc3b52

Please sign in to comment.