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