Skip to content

Commit

Permalink
Support multiple nodes in HBRT - Add Node Container
Browse files Browse the repository at this point in the history
Add node container to AttrRP class in support of multiple nodes
in HBRT.

Change-Id: I2d343a6165f3abdf271e5f60bee0df6256806857
RTC: 186579
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/52720
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: Richard J. Knight <rjknight@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mgloff authored and dcrowell77 committed Feb 27, 2018
1 parent 95c3ddc commit d01ca15
Show file tree
Hide file tree
Showing 4 changed files with 449 additions and 43 deletions.
99 changes: 92 additions & 7 deletions src/include/usr/targeting/attrrp.H
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
// Includes
//******************************************************************************

#include <vector>
#include <initservice/taskargs.H>
#include <sys/msg.h>
#include <targeting/adapters/types.H>
Expand All @@ -48,6 +49,43 @@ namespace TARGETING
// Forward declaration of attribute section parsed information structure.
struct AttrRP_Section;

#ifdef __HOSTBOOT_RUNTIME
/**
* @brief Structure used to store Node specific information
*/
struct NodeInfo
{

NodeInfo() :
pTargetMap(nullptr),
pSections(nullptr),
sectionCount(0)
{
}

// Pointer to the targeting image
void* pTargetMap;

// Parsed structures of the attribute sections.
AttrRP_Section* pSections;

// Count of attribute sections.
size_t sectionCount;

};

/**
* @brief enumeration of node instance status
*/
enum NodeInstanceStatus
{
SINGLE_NODE,
MULTI_NODE,
MULTI_NODE_LT_MAX_INSTANCES,
MULTI_NODE_INSTANCE_GAP,
};
#endif

/**
* @class AttrRP
*
Expand Down Expand Up @@ -89,18 +127,48 @@ class AttrRP
*/
static uint64_t getHbDataTocAddr();

#ifdef __HOSTBOOT_RUNTIME
/**
* @brief Initialize node struct for a given node
*
* @param[in/out] io_nodeCont
* Node struct to be initialized
*
* @param[in] i_header
* Targeting image header for node
*
* @param[in] i_nodeId
* Node ID for which to initialize node struct
*
* @return Error log
*/
errlHndl_t nodeInfoInit(NodeInfo& io_nodeCont,
TargetingHeader* i_header,
const NODE_ID i_nodeId);

/**
* @brief Returns address of targeting image in reserved memory
*
* @param[in] i_nodeId
* Node ID for which to get targeting image address
*
* @return Address of targeting image as a void*
*/
void* getTargetMapPtr(const NODE_ID i_nodeId);
#endif

/**
* @brief Returns base address of the RO section containing the
* targets
*
* @param[in] i_nodeIdUnused
* @param[in] i_nodeId
* Node ID to get base address for, ignored by Hostboot, which
* always gets base address of local node
*
* @return Base address of the RO section containing the targets as
* a void*
*/
void* getBaseAddress(const NODE_ID i_nodeIdUnused);
void* getBaseAddress(const NODE_ID i_nodeId);

/**
* @brief Translates given address, according to the resource
Expand Down Expand Up @@ -231,6 +299,16 @@ class AttrRP
* @return void
*/
void fillInAttrRP(TargetingHeader* i_header);

/**
* @brief Get count of nodes handled by attribute resource provider.
*
* @return Number of node containers
*/
size_t getNodeCount()
{
return iv_nodeContainer.size();
}
#endif

protected:
Expand All @@ -246,8 +324,8 @@ class AttrRP
: iv_msgQ(NULL), iv_sections(NULL), iv_sectionCount(0),
iv_isMpipl(false)
#else
: iv_isTempInstance(false), iv_sections(NULL), iv_sectionCount(0),
iv_isMpipl(false)
: iv_isTempInstance(false), iv_instanceStatus(SINGLE_NODE),
iv_sections(NULL), iv_sectionCount(0), iv_isMpipl(false)
#endif
{
};
Expand All @@ -260,7 +338,8 @@ class AttrRP
* Ensures member variables are initialized to sane values.
*/
AttrRP(TargetingHeader* i_header)
: iv_isTempInstance(true), iv_isMpipl(false)
: iv_isTempInstance(true), iv_instanceStatus(SINGLE_NODE),
iv_isMpipl(false)
{
// Fill in member variables
fillInAttrRP(i_header);
Expand Down Expand Up @@ -424,12 +503,18 @@ class AttrRP
#else
// Indicator that AttrRP instance is a temporary one, not the singleton
bool iv_isTempInstance;

// Node Container
std::vector<NodeInfo> iv_nodeContainer;

// Node instance status
NodeInstanceStatus iv_instanceStatus;
#endif
// Parsed structures of the attribute sections.
AttrRP_Section* iv_sections;
AttrRP_Section* iv_sections; // @TODO RTC:186585 move to #ifndef clause

// Count of attribute sections.
size_t iv_sectionCount;
size_t iv_sectionCount; // @TODO RTC:186585 move to #ifndef clause

bool iv_isMpipl;
};
Expand Down
23 changes: 20 additions & 3 deletions src/usr/targeting/attrrp_common.C
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 All @@ -28,6 +28,14 @@

namespace TARGETING
{
#define TARG_NAMESPACE "TARGETING"
#define TARG_CLASS "AttrRP"

#ifdef __HOSTBOOT_RUNTIME
// It is defined here to limit the scope within this file
#define INVALID_NODE_ID iv_nodeContainer.size()
#endif

/** @struct AttrRP_Section
* @brief Contains parsed information about each attribute section.
*/
Expand All @@ -50,14 +58,23 @@ namespace TARGETING

AttrRP::~AttrRP()
{
if (iv_sections)
if (iv_sections) // @TODO RTC:186585 move if... to #ifndef clause
{
delete[] iv_sections;
}
} // @TODO RTC:186585 move if... to #ifndef clause

#ifndef __HOSTBOOT_RUNTIME
msg_q_destroy(iv_msgQ);
TARG_ASSERT(false, "Assert to exit ~AttrRP");
#else
for(uint32_t i = NODE0; i < INVALID_NODE_ID; ++i)
{
if (iv_nodeContainer[i].pSections)
{
delete[] iv_nodeContainer[i].pSections;
}
}

// Only assert if this in not a temporary AttrRP instance
if (!iv_isTempInstance)
{
Expand Down

0 comments on commit d01ca15

Please sign in to comment.