Skip to content

Commit e2cd6a0

Browse files
Stephen Cprekwghoffa
authored andcommitted
Refactor populate_HbRsvMem to use a function to fill entries
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>
1 parent b4970bb commit e2cd6a0

File tree

4 files changed

+130
-201
lines changed

4 files changed

+130
-201
lines changed

src/include/usr/hdat/hdat.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ struct hdatSpira_t
203203

204204
/** @enum List of possible Range Types for Reserved Hostboot Memory (RHB)
205205
*/
206-
enum hdatMsVpdRhbAddrRangeType
206+
enum hdatMsVpdRhbAddrRangeType : uint8_t
207207
{
208208
RHB_TYPE_PRIMARY = 0,
209209
RHB_TYPE_HBRT = 1,

src/usr/runtime/hdatservice.C

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,23 @@ errlHndl_t get_instance_count(const SectionId i_section,
15761576

15771577
};
15781578

1579+
void hdatMsVpdRhbAddrRange_t::set(const HDAT::hdatMsVpdRhbAddrRangeType i_type,
1580+
const uint16_t i_rangeId,
1581+
const uint64_t i_startAddr,
1582+
const uint64_t i_size,
1583+
const char* i_label)
1584+
{
1585+
assert(i_label != nullptr, "Null label for hdatMsVpdRhbAddrRange_t");
1586+
1587+
hdatRhbRngType = i_type;
1588+
hdatRhbRngId = i_rangeId;
1589+
hdatRhbAddrRngStrAddr = i_startAddr;
1590+
hdatRhbAddrRngEndAddr = (i_startAddr + i_size - 1);
1591+
hdatRhbLabelSize = strlen(i_label) + 1;
1592+
memset(hdatRhbLabelString, 0, hdatRhbLabelSize);
1593+
memcpy(hdatRhbLabelString, i_label, hdatRhbLabelSize);
1594+
}
1595+
15791596
/********************
15801597
Private/Protected Methods
15811598
********************/

src/usr/runtime/hdatstructs.H

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <stdint.h>
2929
#include <vmmconst.h>
3030
#include <string.h>
31+
#include <hdat/hdat.H>
3132

3233
// Copied from FipS:src/hdat/fsp/hdatnaca.H
3334
// offset in mainstore where NACA starts
@@ -329,7 +330,25 @@ struct hdatMsReservedMemArrayHeader_t
329330
*/
330331
struct hdatMsVpdRhbAddrRange_t
331332
{
332-
uint8_t hdatRhbRngType; // 0x0000 Range type
333+
hdatMsVpdRhbAddrRange_t(): hdatRhbRngType(HDAT::RHB_TYPE_INVALID),
334+
hdatRhbRngId(0), hdatRhbAddrRngStrAddr(0),
335+
hdatRhbAddrRngEndAddr(0), hdatRhbLabelSize(1),
336+
hdatRhbLabelString{}, reserved{} {}
337+
338+
/**
339+
* Set all member variables of class
340+
* @param[in] i_type, Range type
341+
* @param[in] i_rangeId, Range ID
342+
* @param[in] i_startAddr, Range Starting Address
343+
* @param[in] i_size, Size of memory region
344+
* @param[in] i_label, Label String Ptr
345+
* @note size of i_label is calculated in function versus a input parameter.
346+
*/
347+
void set(const HDAT::hdatMsVpdRhbAddrRangeType i_type,
348+
const uint16_t i_rangeId, const uint64_t i_startAddr,
349+
const uint64_t i_endAddr, const char* i_label);
350+
351+
HDAT::hdatMsVpdRhbAddrRangeType hdatRhbRngType; // 0x0000 Range type
333352
uint8_t hdatRhbRngRes; // 0x0001 Reserved
334353
uint16_t hdatRhbRngId; // 0x0002 Range ID
335354
uint64_t hdatRhbAddrRngStrAddr; // 0x0004 Range starting
@@ -339,5 +358,4 @@ struct hdatMsVpdRhbAddrRange_t
339358
uint8_t reserved[8]; // 0x0058 Reserved
340359
} __attribute__ ((packed));
341360

342-
343361
#endif

0 commit comments

Comments
 (0)