1155c34fbSMatthew Barth #ifndef __IPMI_WRITE_FRU_DATA_H__ 2155c34fbSMatthew Barth #define __IPMI_WRITE_FRU_DATA_H__ 3155c34fbSMatthew Barth 4a8093a25SPatrick Venture #include <sdbusplus/bus.hpp> 5155c34fbSMatthew Barth 6155c34fbSMatthew Barth // IPMI commands for Storage net functions. 7155c34fbSMatthew Barth enum ipmi_netfn_storage_cmds 8155c34fbSMatthew Barth { 9155c34fbSMatthew Barth IPMI_CMD_WRITE_FRU_DATA = 0x12 10155c34fbSMatthew Barth }; 11155c34fbSMatthew Barth 12155c34fbSMatthew Barth // Format of write fru data command 13155c34fbSMatthew Barth struct write_fru_data_t 14155c34fbSMatthew Barth { 15155c34fbSMatthew Barth uint8_t frunum; 16155c34fbSMatthew Barth uint8_t offsetls; 17155c34fbSMatthew Barth uint8_t offsetms; 18155c34fbSMatthew Barth uint8_t data; 19155c34fbSMatthew Barth } __attribute__((packed)); 20155c34fbSMatthew Barth 21155c34fbSMatthew Barth // Per IPMI v2.0 FRU specification 22155c34fbSMatthew Barth struct common_header 23155c34fbSMatthew Barth { 24155c34fbSMatthew Barth uint8_t fixed; 25155c34fbSMatthew Barth uint8_t internal_offset; 26155c34fbSMatthew Barth uint8_t chassis_offset; 27155c34fbSMatthew Barth uint8_t board_offset; 28155c34fbSMatthew Barth uint8_t product_offset; 29155c34fbSMatthew Barth uint8_t multi_offset; 30155c34fbSMatthew Barth uint8_t pad; 31155c34fbSMatthew Barth uint8_t crc; 32155c34fbSMatthew Barth } __attribute__((packed)); 33155c34fbSMatthew Barth 34155c34fbSMatthew Barth // first byte in header is 1h per IPMI V2 spec. 35155c34fbSMatthew Barth #define IPMI_FRU_HDR_BYTE_ZERO 1 36155c34fbSMatthew Barth #define IPMI_FRU_INTERNAL_OFFSET offsetof(struct common_header, internal_offset) 37155c34fbSMatthew Barth #define IPMI_FRU_CHASSIS_OFFSET offsetof(struct common_header, chassis_offset) 38155c34fbSMatthew Barth #define IPMI_FRU_BOARD_OFFSET offsetof(struct common_header, board_offset) 39155c34fbSMatthew Barth #define IPMI_FRU_PRODUCT_OFFSET offsetof(struct common_header, product_offset) 40155c34fbSMatthew Barth #define IPMI_FRU_MULTI_OFFSET offsetof(struct common_header, multi_offset) 41155c34fbSMatthew Barth #define IPMI_FRU_HDR_CRC_OFFSET offsetof(struct common_header, crc) 42155c34fbSMatthew Barth #define IPMI_EIGHT_BYTES 8 43472d3e2fSThang Q. Nguyen #define IPMI_FRU_MULTIREC_HDR_BYTES 5 44155c34fbSMatthew Barth 4532c4e36aSPatrick Venture /** 4632c4e36aSPatrick Venture * Validate a FRU. 4732c4e36aSPatrick Venture * 4832c4e36aSPatrick Venture * @param[in] fruid - The ID to use for this FRU. 49ef83b993SPatrick Venture * @param[in] fruFilename - the filename of the FRU. 50a8093a25SPatrick Venture * @param[in] bus - an sdbusplus systemd bus for publishing the information. 51ef83b993SPatrick Venture * @param[in] bmcOnlyFru - If a particular area accessible only by BMC. 5232c4e36aSPatrick Venture */ 53ef83b993SPatrick Venture int validateFRUArea(const uint8_t fruid, const char* fruFilename, 54*5e8829e8SPatrick Williams sdbusplus::bus_t& bus, const bool bmcOnlyFru); 55155c34fbSMatthew Barth 56155c34fbSMatthew Barth #endif 57