1 #ifndef __IPMI_WRITE_FRU_DATA_H__ 2 #define __IPMI_WRITE_FRU_DATA_H__ 3 4 #include <sdbusplus/bus.hpp> 5 6 // IPMI commands for Storage net functions. 7 enum ipmi_netfn_storage_cmds 8 { 9 IPMI_CMD_WRITE_FRU_DATA = 0x12 10 }; 11 12 // Format of write fru data command 13 struct write_fru_data_t 14 { 15 uint8_t frunum; 16 uint8_t offsetls; 17 uint8_t offsetms; 18 uint8_t data; 19 } __attribute__((packed)); 20 21 // Per IPMI v2.0 FRU specification 22 struct common_header 23 { 24 uint8_t fixed; 25 uint8_t internal_offset; 26 uint8_t chassis_offset; 27 uint8_t board_offset; 28 uint8_t product_offset; 29 uint8_t multi_offset; 30 uint8_t pad; 31 uint8_t crc; 32 } __attribute__((packed)); 33 34 // first byte in header is 1h per IPMI V2 spec. 35 #define IPMI_FRU_HDR_BYTE_ZERO 1 36 #define IPMI_FRU_INTERNAL_OFFSET offsetof(struct common_header, internal_offset) 37 #define IPMI_FRU_CHASSIS_OFFSET offsetof(struct common_header, chassis_offset) 38 #define IPMI_FRU_BOARD_OFFSET offsetof(struct common_header, board_offset) 39 #define IPMI_FRU_PRODUCT_OFFSET offsetof(struct common_header, product_offset) 40 #define IPMI_FRU_MULTI_OFFSET offsetof(struct common_header, multi_offset) 41 #define IPMI_FRU_HDR_CRC_OFFSET offsetof(struct common_header, crc) 42 #define IPMI_EIGHT_BYTES 8 43 #define IPMI_FRU_MULTIREC_HDR_BYTES 5 44 45 /** 46 * Validate a FRU. 47 * 48 * @param[in] fruid - The ID to use for this FRU. 49 * @param[in] fruFilename - the filename of the FRU. 50 * @param[in] bus - an sdbusplus systemd bus for publishing the information. 51 * @param[in] bmcOnlyFru - If a particular area accessible only by BMC. 52 */ 53 int validateFRUArea(const uint8_t fruid, const char* fruFilename, 54 sdbusplus::bus_t& bus, const bool bmcOnlyFru); 55 56 #endif 57