Skip to content

Commit

Permalink
Add TPM FRU Inventory Record Data
Browse files Browse the repository at this point in the history
This adds a FRU Inventory Record entry for TPMs. Due to the
current lack of a VPD chip (for now) on any supported board,
the manufacturer is assumed to be IBM and the part number is
all zeros.

Change-Id: I080be7d6bcebcf36e5eec5b3ac111a0e37a78587
RTC:189819
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69257
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
  • Loading branch information
popfuture authored and crgeddes committed Dec 13, 2018
1 parent 8923b2a commit 1851aa0
Show file tree
Hide file tree
Showing 2 changed files with 154 additions and 10 deletions.
116 changes: 106 additions & 10 deletions src/usr/ipmiext/ipmifruinv.C
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ IpmiFruInv *IpmiFruInv::Factory(TARGETING::TargetHandleList i_targets,
// Use sys target for setting System Firmware Info
l_fru = new systemFwIpmiFruInv(l_target);
break;
case TARGETING::TYPE_TPM:
l_fru = new tpmIpmiFruInv(l_target);
break;
default:
assert(false,
"IpmiFruInv::Factory: No support for target type given: [%08x]",
Expand Down Expand Up @@ -1728,6 +1731,109 @@ errlHndl_t membufIpmiFruInv::buildBoardInfoArea(
return l_errl;
}

//##############################################################################
tpmIpmiFruInv::tpmIpmiFruInv( TARGETING::TargetHandle_t i_target )
:IpmiFruInv(i_target)
{
TRACFCOMP(g_trac_ipmi, "tpmIpmiFruInv::tpmIpmiFruInv - Creating TPM Fru Inventory object");
};

errlHndl_t tpmIpmiFruInv::buildInternalUseArea(std::vector<uint8_t> &io_data)
{
//This section not needed for TPM type
return IpmiFruInv::buildEmptyArea(io_data);
}

errlHndl_t tpmIpmiFruInv::buildChassisInfoArea(std::vector<uint8_t> &io_data)
{
//This section not needed for TPM type
return IpmiFruInv::buildEmptyArea(io_data);
}

errlHndl_t tpmIpmiFruInv::buildBoardInfoArea(std::vector<uint8_t> &io_data)
{
errlHndl_t l_errl = NULL;

do {

//Set formatting data that goes at the beginning of the record
preFormatProcessing(io_data, true);

//MFG Date/Time - Blank
io_data.push_back(0);
io_data.push_back(0);
io_data.push_back(0);

//Board Manufacturer - IBM
//Board MFG - Type/Length Byte
// - Indicate 8-bit Ascii + Latin 1 (0xC0 via leading two bits)
// - and a size of 3 for "IBM" - 0x3
// - add together and the value for this byte is 0xC3
io_data.push_back(0xC3);
// - Now put in 'IBM'
io_data.push_back('I');
io_data.push_back('B');
io_data.push_back('M');

//Board Product Name - type/length byte
//Set Board Info description to 'TPM'
// - Indicate 8-bit Ascii + Latin 1 (0xC0 via leading two bits)
// - add a size 0x3 for TPM
io_data.push_back(0xC3);
io_data.push_back('T');
io_data.push_back('P');
io_data.push_back('M');

//Set Board Info serial number to 0
// - Indicate binary data (leading two zero bits)
// - and add a size of 0x1 for a single zero byte
io_data.push_back(0x01);
io_data.push_back(0);

//Set Board part number to IBM part number BLAH BLAH
// - Indicate 8-bit Ascii + Latin 1 (0xC0 via leading two bits)
// - and add a size of 0x7 since it is seven bytes of data
io_data.push_back(0xC7);
// add seven zeros as placeholder for the part number
// use a for loop to save PNOR space
for (uint8_t i=0; i<7; i++)
{
io_data.push_back('0');
}

//Push Fru File ID Byte - NULL
io_data.push_back(IPMIFRUINV::TYPELENGTH_BYTE_NULL);

//Indicate end of custom fields
io_data.push_back(IPMIFRUINV::END_OF_CUSTOM_FIELDS);

} while (0);

//Complete formatting for this data record
postFormatProcessing(io_data);

if (l_errl)
{
TRACFCOMP(g_trac_ipmi,"buildBoardInfoArea - Errors Collecting TPM "
"FRU Inventory Board Info Data");
}

return l_errl;
}

errlHndl_t tpmIpmiFruInv::buildProductInfoArea(std::vector<uint8_t> &io_data)
{
//This section not needed for TPM type
return IpmiFruInv::buildEmptyArea(io_data);
}

errlHndl_t tpmIpmiFruInv::buildMultiRecordInfoArea(
std::vector<uint8_t> &io_data)
{
//This section not needed for TPM type
return IpmiFruInv::buildEmptyArea(io_data);
}

errlHndl_t membufIpmiFruInv::buildProductInfoArea(
std::vector<uint8_t> &io_data)
{
Expand Down Expand Up @@ -2306,16 +2412,6 @@ void IPMIFRUINV::gatherSetData(const TARGETING::Target* i_pSys,
TARGETING::TargetHandle_t pTarget = *pTarget_it;
uint32_t l_fruId = pTarget->getAttr<TARGETING::ATTR_FRU_ID>();

// Check if this is a tpm target, if so zero out the fru entry for now
// until we are ready to handle it. The reason we can't handle it is
// because it doesn't exist in the MRW yet. But if we add it, then
// then hostboot will crash. This helps escape the chicken/egg scenario.
// TODO RTC 194318 - remove later as a second step
if (TARGETING::TYPE_TPM == pTarget->getAttr<TARGETING::ATTR_TYPE>())
{
l_fruId = 0;
}

// check if this is a membuf target, if it is and the special
// attribute to say we want a separate fru entry for the centaur ecids
// is populated, then we will push that ecid to the potential frus
Expand Down
48 changes: 48 additions & 0 deletions src/usr/ipmiext/ipmifruinvprvt.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* [+] International Business Machines Corp. */
/* [+] Maxim Polyakov */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
Expand Down Expand Up @@ -686,4 +687,51 @@ class membufIpmiFruInv : public IpmiFruInv

};

//Child class for building up TPM Fru Inventory Record Data
class tpmIpmiFruInv : public IpmiFruInv
{

public:

/**
* @brief Constructor
*
* @param[in] TargetHandle_t i_target Handle to TPM target for which
* to get relevant IPMI FRU Data from
*/
tpmIpmiFruInv( TARGETING::TargetHandle_t i_target);

/**
* @brief Builds the Internal Use Area Data Section
* @param[in/out] io_data The container to put internal use area data in
*/
errlHndl_t buildInternalUseArea(std::vector<uint8_t> &io_data);

/**
* @brief Builds the Chassis Info Area Data Section
* @param[in/out] io_data The container to put chassis info area data in
*/
errlHndl_t buildChassisInfoArea(std::vector<uint8_t> &io_data);

/**
* @brief Builds the Board Info Area Data Section
* @param[in/out] io_data The container to put board info area data in
*/
errlHndl_t buildBoardInfoArea(std::vector<uint8_t> &io_data);

/**
* @brief Builds the Product Info Area Data Section
* @param[in/out] io_data The container to put product info area data in
*/
errlHndl_t buildProductInfoArea(std::vector<uint8_t> &io_data);

/**
* @brief Builds the MultiRecord Info Area Data Section
* @param[in/out] io_data The container to put multirecord info area data in
*/
errlHndl_t buildMultiRecordInfoArea(std::vector<uint8_t> &io_data);

};


#endif

0 comments on commit 1851aa0

Please sign in to comment.