diff options
author | Jaymes Wilks <mjwilks@us.ibm.com> | 2018-11-16 09:52:59 -0600 |
---|---|---|
committer | Christian R. Geddes <crgeddes@us.ibm.com> | 2018-12-13 17:40:40 -0600 |
commit | 1851aa0056c54576d3b328f7b1c9070262857eb0 (patch) | |
tree | b9085dd6f2edfbe3adccf8149864d4dcb5f0e8c9 /src/usr/ipmiext | |
parent | 8923b2a9a3c9c477c646df3a4c66690a75ab8479 (diff) | |
download | talos-hostboot-1851aa0056c54576d3b328f7b1c9070262857eb0.tar.gz talos-hostboot-1851aa0056c54576d3b328f7b1c9070262857eb0.zip |
Add TPM FRU Inventory Record Data
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>
Diffstat (limited to 'src/usr/ipmiext')
-rw-r--r-- | src/usr/ipmiext/ipmifruinv.C | 116 | ||||
-rw-r--r-- | src/usr/ipmiext/ipmifruinvprvt.H | 48 |
2 files changed, 154 insertions, 10 deletions
diff --git a/src/usr/ipmiext/ipmifruinv.C b/src/usr/ipmiext/ipmifruinv.C index 62c2ff9c3..6fdd99a27 100644 --- a/src/usr/ipmiext/ipmifruinv.C +++ b/src/usr/ipmiext/ipmifruinv.C @@ -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]", @@ -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) { @@ -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 diff --git a/src/usr/ipmiext/ipmifruinvprvt.H b/src/usr/ipmiext/ipmifruinvprvt.H index 772a650f8..b7d3f77fa 100644 --- a/src/usr/ipmiext/ipmifruinvprvt.H +++ b/src/usr/ipmiext/ipmifruinvprvt.H @@ -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"); */ @@ -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 |