Bill Hoffa | ffe8370 | 2015-03-30 21:37:20 -0500 | [diff] [blame] | 1 | From 1521a501ada30fd69606829b8f551547d7d882cd Mon Sep 17 00:00:00 2001 |
| 2 | From: Bill Hoffa <wghoffa@us.ibm.com> |
| 3 | Date: Mon, 30 Mar 2015 11:09:17 -0500 |
| 4 | Subject: [PATCH 5/5] Update VPD Fields Use for Fru Inventory |
| 5 | |
| 6 | Change-Id: Iaa4802e72e355acd03cb88e58c40d1069dd76ef5 |
| 7 | RTC:125044 |
| 8 | (cherry picked from commit 8a7427bd44bd4742a53412e6894cc2294d893012) |
| 9 | --- |
| 10 | src/usr/ipmi/ipmifruinv.C | 97 +++++++++++++++++-------------------------- |
| 11 | src/usr/ipmi/ipmifruinvprvt.H | 6 ++- |
| 12 | 2 files changed, 42 insertions(+), 61 deletions(-) |
| 13 | |
| 14 | diff --git a/src/usr/ipmi/ipmifruinv.C b/src/usr/ipmi/ipmifruinv.C |
| 15 | index 7c9eb85..c6c7a30 100644 |
| 16 | --- a/src/usr/ipmi/ipmifruinv.C |
| 17 | +++ b/src/usr/ipmi/ipmifruinv.C |
| 18 | @@ -35,6 +35,7 @@ |
| 19 | #include <ipmi/ipmifruinv.H> |
| 20 | #include "ipmifru.H" |
| 21 | #include "ipmifruinvprvt.H" |
| 22 | +#include <stdio.h> |
| 23 | |
| 24 | extern trace_desc_t * g_trac_ipmi; |
| 25 | |
| 26 | @@ -401,7 +402,7 @@ errlHndl_t isdimmIpmiFruInv::buildProductInfoArea(std::vector<uint8_t> &io_data) |
| 27 | l_errl = addVpdData(io_data, SPD::BASIC_MEMORY_TYPE); |
| 28 | if (l_errl) { break; } |
| 29 | //Set Product Part/Model Number |
| 30 | - l_errl = addVpdData(io_data, SPD::MODULE_PART_NUMBER); |
| 31 | + l_errl = addVpdData(io_data, SPD::MODULE_PART_NUMBER, true); |
| 32 | if (l_errl) { break; } |
| 33 | //Set Product Version |
| 34 | l_errl = addVpdData(io_data, SPD::MODULE_REVISION_CODE); |
| 35 | @@ -411,8 +412,7 @@ errlHndl_t isdimmIpmiFruInv::buildProductInfoArea(std::vector<uint8_t> &io_data) |
| 36 | if (l_errl) { break; } |
| 37 | |
| 38 | //Add Asset Tag |
| 39 | - io_data.push_back(uint8_t(1)); //Asset Tag is One Byte for now |
| 40 | - io_data.push_back(uint8_t(0)); |
| 41 | + io_data.push_back(uint8_t(0)); //No Asset Tag needed - O bytes |
| 42 | |
| 43 | //FRU File ID - Empty |
| 44 | io_data.push_back(IPMIFRUINV::TYPELENGTH_BYTE_NULL); |
| 45 | @@ -434,7 +434,8 @@ errlHndl_t isdimmIpmiFruInv::buildProductInfoArea(std::vector<uint8_t> &io_data) |
| 46 | } |
| 47 | |
| 48 | errlHndl_t isdimmIpmiFruInv::addVpdData(std::vector<uint8_t> &io_data, |
| 49 | - uint8_t i_keyword) |
| 50 | + uint8_t i_keyword, |
| 51 | + bool i_ascii) |
| 52 | { |
| 53 | size_t l_vpdSize = 0; |
| 54 | errlHndl_t l_errl = NULL; |
| 55 | @@ -463,12 +464,22 @@ errlHndl_t isdimmIpmiFruInv::addVpdData(std::vector<uint8_t> &io_data, |
| 56 | uint8_t l_offset = io_data.size(); |
| 57 | io_data.resize(l_offset + 1 + l_vpdSize); |
| 58 | |
| 59 | - //Add on the data to the type/length byte indicating it is binary |
| 60 | - io_data.at(l_offset) = l_vpdSize; |
| 61 | + //Add on the data to the type/length byte indicating it is ascii |
| 62 | + // otherwise leave it as binary |
| 63 | + if (i_ascii) |
| 64 | + { |
| 65 | + io_data.at(l_offset) = l_vpdSize |
| 66 | + + IPMIFRUINV::TYPELENGTH_BYTE_ASCII; |
| 67 | + } |
| 68 | + else |
| 69 | + { |
| 70 | + io_data.at(l_offset) = l_vpdSize; |
| 71 | + } |
| 72 | + l_offset += 1; |
| 73 | |
| 74 | //Read the VPD data directly into fru inventory data buffer |
| 75 | - l_errl = deviceRead(iv_target,&io_data[l_offset+1], l_vpdSize, |
| 76 | - DEVICE_SPD_ADDRESS(i_keyword)); |
| 77 | + l_errl = deviceRead(iv_target,&io_data[l_offset], l_vpdSize, |
| 78 | + DEVICE_SPD_ADDRESS(i_keyword)); |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | @@ -534,10 +545,10 @@ errlHndl_t procIpmiFruInv::buildBoardInfoArea(std::vector<uint8_t> &io_data) |
| 83 | l_errl = addVpdData(io_data, MVPD::VINI, MVPD::DR, true); |
| 84 | if (l_errl) { break; } |
| 85 | //Set Board Info serial number |
| 86 | - l_errl = addVpdData(io_data, MVPD::VINI, MVPD::SN); |
| 87 | + l_errl = addVpdData(io_data, MVPD::VRML, MVPD::SN, true); |
| 88 | if (l_errl) { break; } |
| 89 | //Set Board part number |
| 90 | - l_errl = addVpdData(io_data, MVPD::VINI, MVPD::FN); |
| 91 | + l_errl = addVpdData(io_data, MVPD::VRML, MVPD::PN, true); |
| 92 | if (l_errl) { break; } |
| 93 | //Set Board FRU File ID |
| 94 | l_errl = addVpdData(io_data, MVPD::VINI, MVPD::VZ); |
| 95 | @@ -760,47 +771,18 @@ errlHndl_t backplaneIpmiFruInv::buildBoardInfoArea( |
| 96 | |
| 97 | //Set Product Name - ascii formatted data |
| 98 | //@fixme RTC Story 118373 |
| 99 | - l_errl = addVpdData(io_data, CVPD::OSYS, CVPD::DR, true); |
| 100 | - |
| 101 | - //Support Legacy VPD without OSYS record |
| 102 | - if (l_errl) |
| 103 | - { |
| 104 | - |
| 105 | - TRACFCOMP(g_trac_ipmi, |
| 106 | - "backplaneIpmiFruInv::buildChassisBoardInfoArea - " |
| 107 | - " Using Legacy Chassis VPD Data without OSYS record"); |
| 108 | - |
| 109 | - //Delete errorlog and use Legacy VPD Fields |
| 110 | - delete l_errl; |
| 111 | - l_errl = NULL; |
| 112 | - //Set Product Name - ascii formatted data |
| 113 | - //@fixme RTC Story 118373 |
| 114 | - l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::DR, true); |
| 115 | - if (l_errl) { break; } |
| 116 | - |
| 117 | - //Set Product Serial number - ascii formatted data |
| 118 | - //@fixme RTC Story 118373 |
| 119 | - l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::VS, true); |
| 120 | - if (l_errl) { break; } |
| 121 | - |
| 122 | - //Set Product Part number - ascii formatted data |
| 123 | - //@fixme RTC Story 118373 |
| 124 | - l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::VP, true); |
| 125 | - if (l_errl) { break; } |
| 126 | + l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::DR, true); |
| 127 | + if (l_errl) { break; } |
| 128 | |
| 129 | - } |
| 130 | - else |
| 131 | - { |
| 132 | - //Set serial number - ascii formatted field |
| 133 | - //@fixme RTC Story 118373 |
| 134 | - l_errl = addVpdData(io_data, CVPD::OSYS, CVPD::SS, true); |
| 135 | - if (l_errl) { break; } |
| 136 | + //Set Product Serial number - ascii formatted data |
| 137 | + //@fixme RTC Story 118373 |
| 138 | + l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::VS, true); |
| 139 | + if (l_errl) { break; } |
| 140 | |
| 141 | - //Set chassis part number - ascii formatted field |
| 142 | - //@fixme RTC Story 118373 |
| 143 | - l_errl = addVpdData(io_data, CVPD::OSYS, CVPD::MM, true); |
| 144 | - if (l_errl) { break; } |
| 145 | - } |
| 146 | + //Set Product Part number - ascii formatted data |
| 147 | + //@fixme RTC Story 118373 |
| 148 | + l_errl = addVpdData(io_data, CVPD::OPFR, CVPD::VP, true); |
| 149 | + if (l_errl) { break; } |
| 150 | |
| 151 | //Push Fru File ID Byte - NULL |
| 152 | io_data.push_back(IPMIFRUINV::TYPELENGTH_BYTE_NULL); |
| 153 | @@ -950,22 +932,19 @@ void IpmiFruInv::addEcidData(const TARGETING::TargetHandle_t& i_target, |
| 154 | { |
| 155 | // Create Custom ECID Field |
| 156 | // - First put in 'ECID:' to make it obvious what this is |
| 157 | - uint8_t l_data[] = {IPMIFRUINV::TYPELENGTH_BYTE_ASCII + 5,'E','C','I','D', |
| 158 | - ':', IPMIFRUINV::TYPELENGTH_BYTE_NULL + 16}; |
| 159 | + uint8_t l_data[] = {IPMIFRUINV::TYPELENGTH_BYTE_ASCII + 21,'E','C','I','D', |
| 160 | + ':'}; |
| 161 | |
| 162 | // @todo-RTC:124687 - Refactor multiple reallocations |
| 163 | io_data.insert( io_data.end(), |
| 164 | &l_data[0], |
| 165 | &l_data[0] + (uint8_t(sizeof(l_data) / sizeof(uint8_t)))); |
| 166 | |
| 167 | - uint8_t* l_vDataPtr = (uint8_t*) &i_ecidInfo[0]; |
| 168 | - //Insert first 64 bits of ECID data |
| 169 | - io_data.insert(io_data.end(), |
| 170 | - &l_vDataPtr[0], &l_vDataPtr[0]+8); |
| 171 | - l_vDataPtr = (uint8_t*) &i_ecidInfo[1]; |
| 172 | - //Insert second 64 bits of ECID data |
| 173 | - io_data.insert(io_data.end(), |
| 174 | - &l_vDataPtr[0], &l_vDataPtr[0]+8); |
| 175 | + char l_ecidAscii[33]; |
| 176 | + sprintf(l_ecidAscii, "%.16llX%.16llX", i_ecidInfo[0], i_ecidInfo[1]); |
| 177 | + |
| 178 | + uint8_t* l_vDataPtr = (uint8_t*) &l_ecidAscii[0]; |
| 179 | + io_data.insert(io_data.end(), &l_vDataPtr[0], &l_vDataPtr[0]+16); |
| 180 | |
| 181 | return; |
| 182 | } |
| 183 | diff --git a/src/usr/ipmi/ipmifruinvprvt.H b/src/usr/ipmi/ipmifruinvprvt.H |
| 184 | index aed5dfc..2573a84 100644 |
| 185 | --- a/src/usr/ipmi/ipmifruinvprvt.H |
| 186 | +++ b/src/usr/ipmi/ipmifruinvprvt.H |
| 187 | @@ -303,9 +303,11 @@ class isdimmIpmiFruInv : public IpmiFruInv |
| 188 | * record |
| 189 | * @param[in/out] data, The container with record data |
| 190 | * @param[in] keyword, Indicates where in the VPD to get more data |
| 191 | - |
| 192 | + * @param[in] ascii, Indicates if VPD field is in ascii format or not |
| 193 | */ |
| 194 | - errlHndl_t addVpdData(std::vector<uint8_t> &io_data, uint8_t i_keyword); |
| 195 | + errlHndl_t addVpdData(std::vector<uint8_t> &io_data, |
| 196 | + uint8_t i_keyword, |
| 197 | + bool i_ascii=false); |
| 198 | |
| 199 | }; |
| 200 | |
| 201 | -- |
| 202 | 1.8.2.2 |
| 203 | |