| From 1521a501ada30fd69606829b8f551547d7d882cd Mon Sep 17 00:00:00 2001 |
| From: Bill Hoffa <wghoffa@us.ibm.com> |
| Date: Mon, 30 Mar 2015 11:09:17 -0500 |
| Subject: [PATCH 5/5] Update VPD Fields Use for Fru Inventory |
| |
| Change-Id: Iaa4802e72e355acd03cb88e58c40d1069dd76ef5 |
| RTC:125044 |
| (cherry picked from commit 8a7427bd44bd4742a53412e6894cc2294d893012) |
| --- |
| src/usr/ipmi/ipmifruinv.C | 97 +++++++++++++++++-------------------------- |
| src/usr/ipmi/ipmifruinvprvt.H | 6 ++- |
| 2 files changed, 42 insertions(+), 61 deletions(-) |
| |
| diff --git a/src/usr/ipmi/ipmifruinv.C b/src/usr/ipmi/ipmifruinv.C |
| index 7c9eb85..c6c7a30 100644 |
| --- a/src/usr/ipmi/ipmifruinv.C |
| +++ b/src/usr/ipmi/ipmifruinv.C |
| @@ -35,6 +35,7 @@ |
| #include <ipmi/ipmifruinv.H> |
| #include "ipmifru.H" |
| #include "ipmifruinvprvt.H" |
| +#include <stdio.h> |
| |
| extern trace_desc_t * g_trac_ipmi; |
| |
| @@ -401,7 +402,7 @@ errlHndl_t isdimmIpmiFruInv::buildProductInfoArea(std::vector<uint8_t> &io_data) |
| l_errl = addVpdData(io_data, SPD::BASIC_MEMORY_TYPE); |
| if (l_errl) { break; } |
| //Set Product Part/Model Number |
| - l_errl = addVpdData(io_data, SPD::MODULE_PART_NUMBER); |
| + l_errl = addVpdData(io_data, SPD::MODULE_PART_NUMBER, true); |
| if (l_errl) { break; } |
| //Set Product Version |
| l_errl = addVpdData(io_data, SPD::MODULE_REVISION_CODE); |
| @@ -411,8 +412,7 @@ errlHndl_t isdimmIpmiFruInv::buildProductInfoArea(std::vector<uint8_t> &io_data) |
| if (l_errl) { break; } |
| |
| //Add Asset Tag |
| - io_data.push_back(uint8_t(1)); //Asset Tag is One Byte for now |
| - io_data.push_back(uint8_t(0)); |
| + io_data.push_back(uint8_t(0)); //No Asset Tag needed - O bytes |
| |
| //FRU File ID - Empty |
| io_data.push_back(IPMIFRUINV::TYPELENGTH_BYTE_NULL); |
| @@ -434,7 +434,8 @@ errlHndl_t isdimmIpmiFruInv::buildProductInfoArea(std::vector<uint8_t> &io_data) |
| } |
| |
| errlHndl_t isdimmIpmiFruInv::addVpdData(std::vector<uint8_t> &io_data, |
| - uint8_t i_keyword) |
| + uint8_t i_keyword, |
| + bool i_ascii) |
| { |
| size_t l_vpdSize = 0; |
| errlHndl_t l_errl = NULL; |
| @@ -463,12 +464,22 @@ errlHndl_t isdimmIpmiFruInv::addVpdData(std::vector<uint8_t> &io_data, |
| uint8_t l_offset = io_data.size(); |
| io_data.resize(l_offset + 1 + l_vpdSize); |
| |
| - //Add on the data to the type/length byte indicating it is binary |
| - io_data.at(l_offset) = l_vpdSize; |
| + //Add on the data to the type/length byte indicating it is ascii |
| + // otherwise leave it as binary |
| + if (i_ascii) |
| + { |
| + io_data.at(l_offset) = l_vpdSize |
| + + IPMIFRUINV::TYPELENGTH_BYTE_ASCII; |
| + } |
| + else |
| + { |
| + io_data.at(l_offset) = l_vpdSize; |
| + } |
| + l_offset += 1; |
| |
| //Read the VPD data directly into fru inventory data buffer |
| - l_errl = deviceRead(iv_target,&io_data[l_offset+1], l_vpdSize, |
| - DEVICE_SPD_ADDRESS(i_keyword)); |
| + l_errl = deviceRead(iv_target,&io_data[l_offset], l_vpdSize, |
| + DEVICE_SPD_ADDRESS(i_keyword)); |
| } |
| else |
| { |
| @@ -534,10 +545,10 @@ errlHndl_t procIpmiFruInv::buildBoardInfoArea(std::vector<uint8_t> &io_data) |
| l_errl = addVpdData(io_data, MVPD::VINI, MVPD::DR, true); |
| if (l_errl) { break; } |
| //Set Board Info serial number |
| - l_errl = addVpdData(io_data, MVPD::VINI, MVPD::SN); |
| + l_errl = addVpdData(io_data, MVPD::VRML, MVPD::SN, true); |
| if (l_errl) { break; } |
| //Set Board part number |
| - l_errl = addVpdData(io_data, MVPD::VINI, MVPD::FN); |
| + l_errl = addVpdData(io_data, MVPD::VRML, MVPD::PN, true); |
| if (l_errl) { break; } |
| //Set Board FRU File ID |
| l_errl = addVpdData(io_data, MVPD::VINI, MVPD::VZ); |
| @@ -760,47 +771,18 @@ errlHndl_t backplaneIpmiFruInv::buildBoardInfoArea( |
| |
| //Set Product Name - ascii formatted data |
| //@fixme RTC Story 118373 |
| - l_errl = addVpdData(io_data, CVPD::OSYS, CVPD::DR, true); |
| - |
| - //Support Legacy VPD without OSYS record |
| - if (l_errl) |
| - { |
| - |
| - TRACFCOMP(g_trac_ipmi, |
| - "backplaneIpmiFruInv::buildChassisBoardInfoArea - " |
| - " Using Legacy Chassis VPD Data without OSYS record"); |
| - |
| - //Delete errorlog and use Legacy VPD Fields |
| - delete l_errl; |
| - l_errl = NULL; |
| - //Set Product Name - ascii formatted data |
| - //@fixme RTC Story 118373 |
| - l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::DR, true); |
| - if (l_errl) { break; } |
| - |
| - //Set Product Serial number - ascii formatted data |
| - //@fixme RTC Story 118373 |
| - l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::VS, true); |
| - if (l_errl) { break; } |
| - |
| - //Set Product Part number - ascii formatted data |
| - //@fixme RTC Story 118373 |
| - l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::VP, true); |
| - if (l_errl) { break; } |
| + l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::DR, true); |
| + if (l_errl) { break; } |
| |
| - } |
| - else |
| - { |
| - //Set serial number - ascii formatted field |
| - //@fixme RTC Story 118373 |
| - l_errl = addVpdData(io_data, CVPD::OSYS, CVPD::SS, true); |
| - if (l_errl) { break; } |
| + //Set Product Serial number - ascii formatted data |
| + //@fixme RTC Story 118373 |
| + l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::VS, true); |
| + if (l_errl) { break; } |
| |
| - //Set chassis part number - ascii formatted field |
| - //@fixme RTC Story 118373 |
| - l_errl = addVpdData(io_data, CVPD::OSYS, CVPD::MM, true); |
| - if (l_errl) { break; } |
| - } |
| + //Set Product Part number - ascii formatted data |
| + //@fixme RTC Story 118373 |
| + l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::VP, true); |
| + if (l_errl) { break; } |
| |
| //Push Fru File ID Byte - NULL |
| io_data.push_back(IPMIFRUINV::TYPELENGTH_BYTE_NULL); |
| @@ -950,22 +932,19 @@ void IpmiFruInv::addEcidData(const TARGETING::TargetHandle_t& i_target, |
| { |
| // Create Custom ECID Field |
| // - First put in 'ECID:' to make it obvious what this is |
| - uint8_t l_data[] = {IPMIFRUINV::TYPELENGTH_BYTE_ASCII + 5,'E','C','I','D', |
| - ':', IPMIFRUINV::TYPELENGTH_BYTE_NULL + 16}; |
| + uint8_t l_data[] = {IPMIFRUINV::TYPELENGTH_BYTE_ASCII + 21,'E','C','I','D', |
| + ':'}; |
| |
| // @todo-RTC:124687 - Refactor multiple reallocations |
| io_data.insert( io_data.end(), |
| &l_data[0], |
| &l_data[0] + (uint8_t(sizeof(l_data) / sizeof(uint8_t)))); |
| |
| - uint8_t* l_vDataPtr = (uint8_t*) &i_ecidInfo[0]; |
| - //Insert first 64 bits of ECID data |
| - io_data.insert(io_data.end(), |
| - &l_vDataPtr[0], &l_vDataPtr[0]+8); |
| - l_vDataPtr = (uint8_t*) &i_ecidInfo[1]; |
| - //Insert second 64 bits of ECID data |
| - io_data.insert(io_data.end(), |
| - &l_vDataPtr[0], &l_vDataPtr[0]+8); |
| + char l_ecidAscii[33]; |
| + sprintf(l_ecidAscii, "%.16llX%.16llX", i_ecidInfo[0], i_ecidInfo[1]); |
| + |
| + uint8_t* l_vDataPtr = (uint8_t*) &l_ecidAscii[0]; |
| + io_data.insert(io_data.end(), &l_vDataPtr[0], &l_vDataPtr[0]+16); |
| |
| return; |
| } |
| diff --git a/src/usr/ipmi/ipmifruinvprvt.H b/src/usr/ipmi/ipmifruinvprvt.H |
| index aed5dfc..2573a84 100644 |
| --- a/src/usr/ipmi/ipmifruinvprvt.H |
| +++ b/src/usr/ipmi/ipmifruinvprvt.H |
| @@ -303,9 +303,11 @@ class isdimmIpmiFruInv : public IpmiFruInv |
| * record |
| * @param[in/out] data, The container with record data |
| * @param[in] keyword, Indicates where in the VPD to get more data |
| - |
| + * @param[in] ascii, Indicates if VPD field is in ascii format or not |
| */ |
| - errlHndl_t addVpdData(std::vector<uint8_t> &io_data, uint8_t i_keyword); |
| + errlHndl_t addVpdData(std::vector<uint8_t> &io_data, |
| + uint8_t i_keyword, |
| + bool i_ascii=false); |
| |
| }; |
| |
| -- |
| 1.8.2.2 |
| |