Skip to content

Commit

Permalink
Refactor populate_HbRsvMem to use a function to fill entries
Browse files Browse the repository at this point in the history
Change-Id: Ia16001250e9c7c6612b683458d8e8b593739f0f3
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40411
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
Stephen Cprek authored and wghoffa committed May 31, 2017
1 parent b4970bb commit e2cd6a0
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 201 deletions.
2 changes: 1 addition & 1 deletion src/include/usr/hdat/hdat.H
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ struct hdatSpira_t

/** @enum List of possible Range Types for Reserved Hostboot Memory (RHB)
*/
enum hdatMsVpdRhbAddrRangeType
enum hdatMsVpdRhbAddrRangeType : uint8_t
{
RHB_TYPE_PRIMARY = 0,
RHB_TYPE_HBRT = 1,
Expand Down
17 changes: 17 additions & 0 deletions src/usr/runtime/hdatservice.C
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,23 @@ errlHndl_t get_instance_count(const SectionId i_section,

};

void hdatMsVpdRhbAddrRange_t::set(const HDAT::hdatMsVpdRhbAddrRangeType i_type,
const uint16_t i_rangeId,
const uint64_t i_startAddr,
const uint64_t i_size,
const char* i_label)
{
assert(i_label != nullptr, "Null label for hdatMsVpdRhbAddrRange_t");

hdatRhbRngType = i_type;
hdatRhbRngId = i_rangeId;
hdatRhbAddrRngStrAddr = i_startAddr;
hdatRhbAddrRngEndAddr = (i_startAddr + i_size - 1);
hdatRhbLabelSize = strlen(i_label) + 1;
memset(hdatRhbLabelString, 0, hdatRhbLabelSize);
memcpy(hdatRhbLabelString, i_label, hdatRhbLabelSize);
}

/********************
Private/Protected Methods
********************/
Expand Down
22 changes: 20 additions & 2 deletions src/usr/runtime/hdatstructs.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <stdint.h>
#include <vmmconst.h>
#include <string.h>
#include <hdat/hdat.H>

// Copied from FipS:src/hdat/fsp/hdatnaca.H
// offset in mainstore where NACA starts
Expand Down Expand Up @@ -329,7 +330,25 @@ struct hdatMsReservedMemArrayHeader_t
*/
struct hdatMsVpdRhbAddrRange_t
{
uint8_t hdatRhbRngType; // 0x0000 Range type
hdatMsVpdRhbAddrRange_t(): hdatRhbRngType(HDAT::RHB_TYPE_INVALID),
hdatRhbRngId(0), hdatRhbAddrRngStrAddr(0),
hdatRhbAddrRngEndAddr(0), hdatRhbLabelSize(1),
hdatRhbLabelString{}, reserved{} {}

/**
* Set all member variables of class
* @param[in] i_type, Range type
* @param[in] i_rangeId, Range ID
* @param[in] i_startAddr, Range Starting Address
* @param[in] i_size, Size of memory region
* @param[in] i_label, Label String Ptr
* @note size of i_label is calculated in function versus a input parameter.
*/
void set(const HDAT::hdatMsVpdRhbAddrRangeType i_type,
const uint16_t i_rangeId, const uint64_t i_startAddr,
const uint64_t i_endAddr, const char* i_label);

HDAT::hdatMsVpdRhbAddrRangeType hdatRhbRngType; // 0x0000 Range type
uint8_t hdatRhbRngRes; // 0x0001 Reserved
uint16_t hdatRhbRngId; // 0x0002 Range ID
uint64_t hdatRhbAddrRngStrAddr; // 0x0004 Range starting
Expand All @@ -339,5 +358,4 @@ struct hdatMsVpdRhbAddrRange_t
uint8_t reserved[8]; // 0x0058 Reserved
} __attribute__ ((packed));


#endif

0 comments on commit e2cd6a0

Please sign in to comment.