Skip to content

Commit

Permalink
Update VPD in correct node at runtime
Browse files Browse the repository at this point in the history
Fixes VPD writes in runtime code to include the node HUID of the target
whose VPD is to be written in the communication to FSP so that FSP can
apply the update to the VPD within the correct node

Change-Id: Ic0801450e312714e80f067b4817b4d06d8236f0c
CQ: SW444403
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65615
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: Nicholas E. Bofferding <bofferdn@us.ibm.com>
  • Loading branch information
Nick Bofferding committed Sep 5, 2018
1 parent 53569a2 commit 4f68936
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/include/usr/vpd/vpdreasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ enum vpdReasonCode
VPD_EEPROM_VPD_PRIMARY_INFO_MISSING = VPD_COMP_ID | 0x3a,
VPD_RT_NODE_TOO_LARGE = VPD_COMP_ID | 0x3b,
VPD_CANNOT_WRITE_OVERRIDDEN_VPD = VPD_COMP_ID | 0x3c,

VPD_FAILED_TO_RESOLVE_NODE_TARGET = VPD_COMP_ID | 0x3d,
};


Expand Down
50 changes: 48 additions & 2 deletions src/usr/vpd/runtime/rt_vpd.C
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,55 @@ errlHndl_t sendMboxWriteMsg ( size_t i_numBytes,
// the OCC code. On FSP systems this is handled by the HWSV
// code. On OP systems this is handled by OPAL.

TARGETING::Target* pNode = nullptr;
if(i_target != nullptr)
{
if( i_target->getAttr<TARGETING::ATTR_TYPE>()
== TARGETING::TYPE_NODE)
{
pNode = i_target;
}
else
{
auto nodeType = TARGETING::TYPE_NODE;
pNode = TARGETING::getParent(i_target,nodeType);
}
}

if(pNode == nullptr)
{
TRACFCOMP(g_trac_vpd, ERR_MRK"sendMboxWriteMsg (runtime): "
"Failed to determine HUID of node target containing "
"(or equalling) requested target with HUID of 0x%08X",
TARGETING::get_huid(i_target));
/*@
* @errortype
* @moduleid VPD_SEND_MBOX_WRITE_MESSAGE
* @reasoncode VPD_FAILED_TO_RESOLVE_NODE_TARGET
* @userdata1 HUID of target to update VPD for
* @userdata2 VPD message type
* @devdesc Could not determine which node the target is in
* @custdesc Runtime vital product data update failure
*/
l_err = new ErrlEntry(
ERRL_SEV_UNRECOVERABLE,
VPD_SEND_MBOX_WRITE_MESSAGE,
VPD_FAILED_TO_RESOLVE_NODE_TARGET,
TARGETING::get_huid(i_target),
i_type,
true);
break;
}

const uint32_t nodeHuid = pNode->getAttr<TARGETING::ATTR_HUID>();

// Get an accurate size of memory needed to transport
// the data for the firmware_request request struct
uint32_t l_fsp_req_size = GENERIC_FSP_MBOX_MESSAGE_BASE_SIZE;
// add on the 2 header words that are used in the IPL-time
// version of the VPD write message (see vpd.H)
l_fsp_req_size += sizeof(VpdWriteMsg_t) + sizeof(uint64_t);
l_fsp_req_size += sizeof(nodeHuid) + sizeof(VpdWriteMsg_t)
+ sizeof(uint64_t);
// add on the extra_data portion of the message
l_fsp_req_size += i_numBytes;

Expand Down Expand Up @@ -516,12 +558,16 @@ errlHndl_t sendMboxWriteMsg ( size_t i_numBytes,
// the full message looks like this
struct VpdWriteMsgHBRT_t
{
uint32_t nodeHuid;
VpdWriteMsg_t vpdInfo;
uint64_t vpdBytes;
uint8_t vpdData; //of vpdBytes size
};

} PACKED;

VpdWriteMsgHBRT_t* l_msg = reinterpret_cast<VpdWriteMsgHBRT_t*>
(&(l_req_fw_msg->generic_msg.data));
l_msg->nodeHuid = nodeHuid;
l_msg->vpdInfo = i_record;
l_msg->vpdBytes = i_numBytes;
memcpy( &(l_msg->vpdData), i_data, i_numBytes );
Expand Down

0 comments on commit 4f68936

Please sign in to comment.