blob: 089a7cb15601a359129716cb37a433bffa83c0e4 [file] [log] [blame]
Patrick Venture0b02be92018-08-31 11:55:55 -07001#include "ipmi_fru_info_area.hpp"
2
Marri Devender Rao7d9157e2017-07-01 16:11:40 -05003#include <algorithm>
Patrick Venture0b02be92018-08-31 11:55:55 -07004#include <ctime>
Marri Devender Rao7d9157e2017-07-01 16:11:40 -05005#include <map>
6#include <numeric>
Marri Devender Rao7d9157e2017-07-01 16:11:40 -05007#include <phosphor-logging/elog.hpp>
Patrick Ventureb51bf9c2018-09-10 15:53:14 -07008
Marri Devender Rao7d9157e2017-07-01 16:11:40 -05009namespace ipmi
10{
11namespace fru
12{
13using namespace phosphor::logging;
14
Patrick Venture0b02be92018-08-31 11:55:55 -070015// Property variables
16static constexpr auto partNumber = "PartNumber";
17static constexpr auto serialNumber = "SerialNumber";
18static constexpr auto manufacturer = "Manufacturer";
19static constexpr auto buildDate = "BuildDate";
20static constexpr auto model = "Model";
21static constexpr auto prettyName = "PrettyName";
22static constexpr auto version = "Version";
Oskar Senft40f59e22018-12-04 22:43:19 -050023static constexpr auto type = "Type";
Marri Devender Rao7d9157e2017-07-01 16:11:40 -050024
Patrick Venture0b02be92018-08-31 11:55:55 -070025// Board info areas
26static constexpr auto board = "Board";
27static constexpr auto chassis = "Chassis";
28static constexpr auto product = "Product";
Marri Devender Rao7d9157e2017-07-01 16:11:40 -050029
Patrick Venture0b02be92018-08-31 11:55:55 -070030static constexpr auto specVersion = 0x1;
31static constexpr auto recordUnitOfMeasurement = 0x8; // size in bytes
32static constexpr auto checksumSize = 0x1; // size in bytes
33static constexpr auto recordNotPresent = 0x0;
34static constexpr auto englishLanguageCode = 0x0;
35static constexpr auto typeLengthByteNull = 0x0;
36static constexpr auto endOfCustomFields = 0xC1;
37static constexpr auto commonHeaderFormatSize = 0x8; // size in bytes
38static constexpr auto manufacturingDateSize = 0x3;
39static constexpr auto areaSizeOffset = 0x1;
40static constexpr uint8_t typeASCII = 0xC0;
41static constexpr auto maxRecordAttributeValue = 0x1F;
Marri Devender Rao7d9157e2017-07-01 16:11:40 -050042
Andres Oportus7ebd2462018-04-09 10:35:21 -070043static constexpr auto secs_from_1970_1996 = 820454400;
Patrick Venture0b02be92018-08-31 11:55:55 -070044static constexpr auto maxMfgDateValue = 0xFFFFFF; // 3 Byte length
Andres Oportus7ebd2462018-04-09 10:35:21 -070045static constexpr auto secs_per_min = 60;
Patrick Venture0b02be92018-08-31 11:55:55 -070046static constexpr auto secsToMaxMfgdate =
47 secs_from_1970_1996 + secs_per_min * maxMfgDateValue;
Andres Oportus7ebd2462018-04-09 10:35:21 -070048
Oskar Senft8b189412018-12-07 16:13:38 -050049// Minimum size of resulting FRU blob.
50// This is also the theoretical maximum size according to the spec:
51// 8 bytes header + 5 areas at 0xff*8 bytes max each
52// 8 + 5*0xff*8 = 0x27e0
53static constexpr auto fruMinSize = 0x27E0;
54
55// Value to use for padding.
56// Using 0xff to match the default (blank) value in a physical EEPROM.
57static constexpr auto fruPadValue = 0xff;
58
Marri Devender Rao7d9157e2017-07-01 16:11:40 -050059/**
60 * @brief Format Beginning of Individual IPMI FRU Data Section
61 *
62 * @param[in] langCode Language code
63 * @param[in/out] data FRU area data
64 */
65void preFormatProcessing(bool langCode, FruAreaData& data)
66{
Patrick Venture0b02be92018-08-31 11:55:55 -070067 // Add id for version of FRU Info Storage Spec used
Marri Devender Rao7d9157e2017-07-01 16:11:40 -050068 data.emplace_back(specVersion);
69
Patrick Venture0b02be92018-08-31 11:55:55 -070070 // Add Data Size - 0 as a placeholder, can edit after the data is finalized
Marri Devender Rao7d9157e2017-07-01 16:11:40 -050071 data.emplace_back(typeLengthByteNull);
72
73 if (langCode)
74 {
75 data.emplace_back(englishLanguageCode);
76 }
77}
78
79/**
80 * @brief Append checksum of the FRU area data
81 *
82 * @param[in/out] data FRU area data
83 */
84void appendDataChecksum(FruAreaData& data)
85{
86 uint8_t checksumVal = std::accumulate(data.begin(), data.end(), 0);
87 // Push the Zero checksum as the last byte of this data
88 // This appears to be a simple summation of all the bytes
89 data.emplace_back(-checksumVal);
90}
91
92/**
93 * @brief Append padding bytes for the FRU area data
94 *
95 * @param[in/out] data FRU area data
96 */
97void padData(FruAreaData& data)
98{
Ratan Gupta3e6a7692018-02-07 16:10:16 +053099 uint8_t pad = (data.size() + checksumSize) % recordUnitOfMeasurement;
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500100 if (pad)
101 {
Ratan Gupta3e6a7692018-02-07 16:10:16 +0530102 data.resize((data.size() + recordUnitOfMeasurement - pad));
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500103 }
104}
105
106/**
107 * @brief Format End of Individual IPMI FRU Data Section
108 *
109 * @param[in/out] fruAreaData FRU area info data
110 */
111void postFormatProcessing(FruAreaData& data)
112{
Patrick Venture0b02be92018-08-31 11:55:55 -0700113 // This area needs to be padded to a multiple of 8 bytes (after checksum)
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500114 padData(data);
115
Patrick Venture0b02be92018-08-31 11:55:55 -0700116 // Set size of data info area
117 data.at(areaSizeOffset) =
118 (data.size() + checksumSize) / (recordUnitOfMeasurement);
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500119
Patrick Venture0b02be92018-08-31 11:55:55 -0700120 // Finally add area checksum
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500121 appendDataChecksum(data);
122}
123
124/**
Oskar Senft40f59e22018-12-04 22:43:19 -0500125 * @brief Read chassis type property value from inventory and append to the FRU
126 * area data.
127 *
128 * @param[in] propMap map of property values
129 * @param[in,out] data FRU area data to be appended
130 */
131void appendChassisType(const PropertyMap& propMap, FruAreaData& data)
132{
133 uint8_t chassisType = 0; // Not specified
134 auto iter = propMap.find(type);
135 if (iter != propMap.end())
136 {
137 auto value = iter->second;
138 chassisType = std::stoi(value);
139 }
140 data.emplace_back(chassisType);
141}
142
143/**
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500144 * @brief Read property value from inventory and append to the FRU area data
145 *
146 * @param[in] key key to search for in the property inventory data
147 * @param[in] propMap map of property values
148 * @param[in,out] data FRU area data to be appended
149 */
150void appendData(const Property& key, const PropertyMap& propMap,
151 FruAreaData& data)
152{
153 auto iter = propMap.find(key);
154 if (iter != propMap.end())
155 {
156 auto value = iter->second;
Patrick Venture0b02be92018-08-31 11:55:55 -0700157 // If starts with 0x or 0X remove them
158 // ex: 0x123a just take 123a
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500159 if ((value.compare(0, 2, "0x")) == 0 ||
Patrick Venture0b02be92018-08-31 11:55:55 -0700160 (value.compare(0, 2, "0X") == 0))
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500161 {
162 value.erase(0, 2);
163 }
Ratan Gupta6edfc5c2018-01-31 21:41:45 +0530164
165 // 5 bits for length
Patrick Venture0b02be92018-08-31 11:55:55 -0700166 // if length is greater then 31(2^5) bytes then trim the data to 31
167 // bytess.
168 auto valueLength = (value.length() > maxRecordAttributeValue)
169 ? maxRecordAttributeValue
170 : value.length();
Ratan Gupta6edfc5c2018-01-31 21:41:45 +0530171 // 2 bits for type
172 // Set the type to ascii
173 uint8_t typeLength = valueLength | ipmi::fru::typeASCII;
174
175 data.emplace_back(typeLength);
Patrick Venture0b02be92018-08-31 11:55:55 -0700176 std::copy(value.begin(), value.begin() + valueLength,
Ratan Gupta6edfc5c2018-01-31 21:41:45 +0530177 std::back_inserter(data));
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500178 }
179 else
180 {
Patrick Venture0b02be92018-08-31 11:55:55 -0700181 // set 0 size
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500182 data.emplace_back(typeLengthByteNull);
183 }
184}
185
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500186/**
187 * @brief Appends Build Date
188 *
189 * @param[in] propMap map of property values
190 * @param[in/out] data FRU area to add the manfufacture date
191 */
192void appendMfgDate(const PropertyMap& propMap, FruAreaData& data)
193{
Patrick Venture0b02be92018-08-31 11:55:55 -0700194 // MFG Date/Time
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500195 auto iter = propMap.find(buildDate);
Nagaraju Gorugantib898cde2018-07-10 00:47:43 -0500196 if ((iter != propMap.end()) && (iter->second.size() > 0))
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500197 {
Andres Oportus7ebd2462018-04-09 10:35:21 -0700198 tm time = {};
199 strptime(iter->second.c_str(), "%F - %H:%M:%S", &time);
200 time_t raw = mktime(&time);
201
202 // From FRU Spec:
203 // "Mfg. Date / Time
204 // Number of minutes from 0:00 hrs 1/1/96.
205 // LSbyte first (little endian)
206 // 00_00_00h = unspecified."
Nagaraju Gorugantib898cde2018-07-10 00:47:43 -0500207 if ((raw >= secs_from_1970_1996) && (raw <= secsToMaxMfgdate))
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500208 {
Andres Oportus7ebd2462018-04-09 10:35:21 -0700209 raw -= secs_from_1970_1996;
210 raw /= secs_per_min;
211 uint8_t fru_raw[3];
212 fru_raw[0] = raw & 0xFF;
213 fru_raw[1] = (raw >> 8) & 0xFF;
214 fru_raw[2] = (raw >> 16) & 0xFF;
215 std::copy(fru_raw, fru_raw + 3, std::back_inserter(data));
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500216 return;
217 }
Patrick Ventureb51bf9c2018-09-10 15:53:14 -0700218 std::fprintf(stderr, "MgfDate invalid date: %u secs since UNIX epoch\n",
219 static_cast<unsigned int>(raw));
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500220 }
Patrick Venture0b02be92018-08-31 11:55:55 -0700221 // Blank date
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500222 data.emplace_back(0);
223 data.emplace_back(0);
224 data.emplace_back(0);
225}
226
227/**
228 * @brief Builds a section of the common header
229 *
230 * @param[in] infoAreaSize size of the FRU area to write
231 * @param[in] offset Current offset for data in overall record
232 * @param[in/out] data Common Header section data container
233 */
Patrick Venture0b02be92018-08-31 11:55:55 -0700234void buildCommonHeaderSection(const uint32_t& infoAreaSize, uint16_t& offset,
235 FruAreaData& data)
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500236{
Patrick Venture0b02be92018-08-31 11:55:55 -0700237 // Check if data for internal use section populated
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500238 if (infoAreaSize == 0)
239 {
Patrick Venture0b02be92018-08-31 11:55:55 -0700240 // Indicate record not present
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500241 data.emplace_back(recordNotPresent);
242 }
243 else
244 {
Ratan Gupta2f66f002018-01-31 21:26:25 +0530245 // offset should be multiple of 8.
Ratan Gupta3e6a7692018-02-07 16:10:16 +0530246 auto remainder = offset % recordUnitOfMeasurement;
Ratan Gupta2f66f002018-01-31 21:26:25 +0530247 // add the padding bytes in the offset so that offset
248 // will be multiple of 8 byte.
Ratan Gupta3e6a7692018-02-07 16:10:16 +0530249 offset += (remainder > 0) ? recordUnitOfMeasurement - remainder : 0;
Patrick Venture0b02be92018-08-31 11:55:55 -0700250 // Place data to define offset to area data section
Ratan Gupta3e6a7692018-02-07 16:10:16 +0530251 data.emplace_back(offset / recordUnitOfMeasurement);
Ratan Gupta2f66f002018-01-31 21:26:25 +0530252
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500253 offset += infoAreaSize;
254 }
255}
256
257/**
258 * @brief Builds the Chassis info area data section
259 *
260 * @param[in] propMap map of properties for chassis info area
261 * @return FruAreaData container with chassis info area
262 */
263FruAreaData buildChassisInfoArea(const PropertyMap& propMap)
264{
265 FruAreaData fruAreaData;
266 if (!propMap.empty())
267 {
Patrick Venture0b02be92018-08-31 11:55:55 -0700268 // Set formatting data that goes at the beginning of the record
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500269 preFormatProcessing(false, fruAreaData);
270
Patrick Venture0b02be92018-08-31 11:55:55 -0700271 // chassis type
Oskar Senft40f59e22018-12-04 22:43:19 -0500272 appendChassisType(propMap, fruAreaData);
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500273
Patrick Venture0b02be92018-08-31 11:55:55 -0700274 // Chasiss part number, in config.yaml it is configured as model
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500275 appendData(model, propMap, fruAreaData);
276
Patrick Venture0b02be92018-08-31 11:55:55 -0700277 // Board serial number
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500278 appendData(serialNumber, propMap, fruAreaData);
279
Patrick Venture0b02be92018-08-31 11:55:55 -0700280 // Indicate End of Custom Fields
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500281 fruAreaData.emplace_back(endOfCustomFields);
282
Patrick Venture0b02be92018-08-31 11:55:55 -0700283 // Complete record data formatting
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500284 postFormatProcessing(fruAreaData);
285 }
286 return fruAreaData;
287}
288
289/**
290 * @brief Builds the Board info area data section
291 *
292 * @param[in] propMap map of properties for board info area
293 * @return FruAreaData container with board info area
294 */
295FruAreaData buildBoardInfoArea(const PropertyMap& propMap)
296{
297 FruAreaData fruAreaData;
298 if (!propMap.empty())
299 {
300 preFormatProcessing(true, fruAreaData);
301
Patrick Venture0b02be92018-08-31 11:55:55 -0700302 // Manufacturing date
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500303 appendMfgDate(propMap, fruAreaData);
304
Patrick Venture0b02be92018-08-31 11:55:55 -0700305 // manufacturer
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500306 appendData(manufacturer, propMap, fruAreaData);
307
Patrick Venture0b02be92018-08-31 11:55:55 -0700308 // Product name/Pretty name
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500309 appendData(prettyName, propMap, fruAreaData);
310
Patrick Venture0b02be92018-08-31 11:55:55 -0700311 // Board serial number
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500312 appendData(serialNumber, propMap, fruAreaData);
313
Patrick Venture0b02be92018-08-31 11:55:55 -0700314 // Board part number
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500315 appendData(partNumber, propMap, fruAreaData);
316
Patrick Venture0b02be92018-08-31 11:55:55 -0700317 // FRU File ID - Empty
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500318 fruAreaData.emplace_back(typeLengthByteNull);
319
320 // Empty FRU File ID bytes
321 fruAreaData.emplace_back(recordNotPresent);
322
Patrick Venture0b02be92018-08-31 11:55:55 -0700323 // End of custom fields
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500324 fruAreaData.emplace_back(endOfCustomFields);
325
326 postFormatProcessing(fruAreaData);
327 }
328 return fruAreaData;
329}
330
331/**
332 * @brief Builds the Product info area data section
333 *
334 * @param[in] propMap map of FRU properties for Board info area
335 * @return FruAreaData container with product info area data
336 */
337FruAreaData buildProductInfoArea(const PropertyMap& propMap)
338{
339 FruAreaData fruAreaData;
340 if (!propMap.empty())
341 {
Patrick Venture0b02be92018-08-31 11:55:55 -0700342 // Set formatting data that goes at the beginning of the record
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500343 preFormatProcessing(true, fruAreaData);
344
Patrick Venture0b02be92018-08-31 11:55:55 -0700345 // manufacturer
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500346 appendData(manufacturer, propMap, fruAreaData);
347
Patrick Venture0b02be92018-08-31 11:55:55 -0700348 // Product name/Pretty name
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500349 appendData(prettyName, propMap, fruAreaData);
350
Patrick Venture0b02be92018-08-31 11:55:55 -0700351 // Product part/model number
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500352 appendData(model, propMap, fruAreaData);
353
Patrick Venture0b02be92018-08-31 11:55:55 -0700354 // Product version
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500355 appendData(version, propMap, fruAreaData);
356
Patrick Venture0b02be92018-08-31 11:55:55 -0700357 // Serial Number
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500358 appendData(serialNumber, propMap, fruAreaData);
359
Patrick Venture0b02be92018-08-31 11:55:55 -0700360 // Add Asset Tag
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500361 fruAreaData.emplace_back(recordNotPresent);
362
Patrick Venture0b02be92018-08-31 11:55:55 -0700363 // FRU File ID - Empty
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500364 fruAreaData.emplace_back(typeLengthByteNull);
365
366 // Empty FRU File ID bytes
367 fruAreaData.emplace_back(recordNotPresent);
368
Patrick Venture0b02be92018-08-31 11:55:55 -0700369 // End of custom fields
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500370 fruAreaData.emplace_back(endOfCustomFields);
371
372 postFormatProcessing(fruAreaData);
373 }
374 return fruAreaData;
375}
376
377FruAreaData buildFruAreaData(const FruInventoryData& inventory)
378{
Ratan Gupta2f66f002018-01-31 21:26:25 +0530379 FruAreaData combFruArea{};
Patrick Venture0b02be92018-08-31 11:55:55 -0700380 // Now build common header with data for this FRU Inv Record
381 // Use this variable to increment size of header as we go along to determine
382 // offset for the subsequent area offsets
Ratan Gupta2f66f002018-01-31 21:26:25 +0530383 uint16_t curDataOffset = commonHeaderFormatSize;
Patrick Venture0b02be92018-08-31 11:55:55 -0700384 // First byte is id for version of FRU Info Storage Spec used
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500385 combFruArea.emplace_back(specVersion);
386
Patrick Venture0b02be92018-08-31 11:55:55 -0700387 // 2nd byte is offset to internal use data
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500388 combFruArea.emplace_back(recordNotPresent);
389
Patrick Venture0b02be92018-08-31 11:55:55 -0700390 // 3rd byte is offset to chassis data
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500391 FruAreaData chassisArea;
392 auto chassisIt = inventory.find(chassis);
393 if (chassisIt != inventory.end())
394 {
395 chassisArea = std::move(buildChassisInfoArea(chassisIt->second));
396 }
Ratan Gupta2f66f002018-01-31 21:26:25 +0530397 // update the offset to chassis data.
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500398 buildCommonHeaderSection(chassisArea.size(), curDataOffset, combFruArea);
399
Patrick Venture0b02be92018-08-31 11:55:55 -0700400 // 4th byte is offset to board data
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500401 FruAreaData boardArea;
402 auto boardIt = inventory.find(board);
403 if (boardIt != inventory.end())
404 {
405 boardArea = std::move(buildBoardInfoArea(boardIt->second));
406 }
Ratan Gupta2f66f002018-01-31 21:26:25 +0530407 // update the offset to the board data.
408 buildCommonHeaderSection(boardArea.size(), curDataOffset, combFruArea);
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500409
Patrick Venture0b02be92018-08-31 11:55:55 -0700410 // 5th byte is offset to product data
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500411 FruAreaData prodArea;
412 auto prodIt = inventory.find(product);
413 if (prodIt != inventory.end())
414 {
415 prodArea = std::move(buildProductInfoArea(prodIt->second));
416 }
Ratan Gupta2f66f002018-01-31 21:26:25 +0530417 // update the offset to the product data.
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500418 buildCommonHeaderSection(prodArea.size(), curDataOffset, combFruArea);
419
Patrick Venture0b02be92018-08-31 11:55:55 -0700420 // 6th byte is offset to multirecord data
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500421 combFruArea.emplace_back(recordNotPresent);
422
Patrick Venture0b02be92018-08-31 11:55:55 -0700423 // 7th byte is PAD
Ratan Gupta2f66f002018-01-31 21:26:25 +0530424 combFruArea.emplace_back(recordNotPresent);
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500425
Patrick Venture0b02be92018-08-31 11:55:55 -0700426 // 8th (Final byte of Header Format) is the checksum
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500427 appendDataChecksum(combFruArea);
428
Patrick Venture0b02be92018-08-31 11:55:55 -0700429 // Combine everything into one full IPMI FRU specification Record
430 // add chassis use area data
431 combFruArea.insert(combFruArea.end(), chassisArea.begin(),
432 chassisArea.end());
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500433
Patrick Venture0b02be92018-08-31 11:55:55 -0700434 // add board area data
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500435 combFruArea.insert(combFruArea.end(), boardArea.begin(), boardArea.end());
436
Patrick Venture0b02be92018-08-31 11:55:55 -0700437 // add product use area data
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500438 combFruArea.insert(combFruArea.end(), prodArea.begin(), prodArea.end());
439
Oskar Senft8b189412018-12-07 16:13:38 -0500440 // If area is smaller than the minimum size, pad it. This enables ipmitool
441 // to update the FRU blob with values longer than the original payload.
442 if (combFruArea.size() < fruMinSize)
443 {
444 combFruArea.resize(fruMinSize, fruPadValue);
445 }
446
Marri Devender Rao7d9157e2017-07-01 16:11:40 -0500447 return combFruArea;
448}
449
Patrick Venture0b02be92018-08-31 11:55:55 -0700450} // namespace fru
451} // namespace ipmi