1 #include "fru_area.hpp" 2 3 #include "frup.hpp" 4 5 #include <cstdint> 6 #include <cstring> 7 #include <phosphor-logging/log.hpp> 8 9 using namespace phosphor::logging; 10 11 IPMIFruArea::IPMIFruArea(const uint8_t fruID, const ipmi_fru_area_type type, 12 bool bmcOnlyFru) : 13 fruID(fruID), 14 type(type), bmcOnlyFru(bmcOnlyFru) 15 { 16 if (type == IPMI_FRU_AREA_INTERNAL_USE) 17 { 18 name = "INTERNAL_"; 19 } 20 else if (type == IPMI_FRU_AREA_CHASSIS_INFO) 21 { 22 name = "CHASSIS_"; 23 } 24 else if (type == IPMI_FRU_AREA_BOARD_INFO) 25 { 26 name = "BOARD_"; 27 } 28 else if (type == IPMI_FRU_AREA_PRODUCT_INFO) 29 { 30 name = "PRODUCT_"; 31 } 32 else if (type == IPMI_FRU_AREA_MULTI_RECORD) 33 { 34 name = "MULTI_"; 35 } 36 else 37 { 38 name = IPMI_FRU_AREA_TYPE_MAX; 39 log<level::ERR>("Invalid Area", entry("TYPE=%d", type)); 40 } 41 } 42 43 void IPMIFruArea::setData(const uint8_t* value, const size_t length) 44 { 45 data.reserve(length); // pre-allocate the space. 46 data.insert(data.begin(), value, value + length); 47 } 48