1 #pragma once 2 3 #include <host-ipmid/ipmid-api.h> 4 #include <stdint.h> 5 6 #include <map> 7 #include <string> 8 9 // IPMI commands for net functions. 10 enum ipmi_netfn_oem_cmds 11 { 12 IPMI_CMD_PREP_FW_UPDATE = 0x10, 13 IPMI_CMD_RESET_BMC_AUTH = 0x11, 14 IPMI_CMD_PESEL = 0xF0, 15 IPMI_CMD_OCC_RESET = 0x0E, 16 }; 17 18 /** @brief Read eSEL data into a string 19 * 20 * @param[in] filename - filename of file containing eSEL 21 * 22 * @return On success return the eSEL data 23 */ 24 std::string readESEL(const char* filename); 25 26 /** @brief Create OCC metrics log entry 27 * 28 * @param[in] eSELData - eSEL data containing OCC metrics data 29 */ 30 void createLogEntry(const std::string& eSELData); 31 32 ipmi_ret_t ipmi_ibm_oem_partial_esel(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 33 ipmi_request_t request, 34 ipmi_response_t response, 35 ipmi_data_len_t data_len, 36 ipmi_context_t context); 37 38 struct esel_request_t 39 { 40 uint16_t resid; 41 uint16_t selrecord; 42 uint16_t offset; 43 uint8_t progress; 44 } __attribute__((packed)); 45 46 /** @struct SELEventRecord 47 * 48 * IPMI SEL event record format. 49 */ 50 struct SELEventRecord 51 { 52 uint16_t recordID; //!< Record ID. 53 uint8_t recordType; //!< Record Type. 54 uint32_t timeStamp; //!< Timestamp. 55 uint16_t generatorID; //!< Generator ID. 56 uint8_t eventMsgRevision; //!< Event Message Revision. 57 uint8_t sensorType; //!< Sensor Type. 58 uint8_t sensorNum; //!< Sensor Number. 59 uint8_t eventType; //!< Event Dir | Event Type. 60 uint8_t eventData1; //!< Event Data 1. 61 uint8_t eventData2; //!< Event Data 2. 62 uint8_t eventData3; //!< Event Data 3. 63 } __attribute__((packed)); 64 65 using Id = uint8_t; 66 using Type = uint8_t; 67 using ReadingType = uint8_t; 68 using Offset = uint8_t; 69 using Path = std::string; 70 71 struct Data 72 { 73 Id sensorID; 74 Type sensorType; 75 ReadingType eventReadingType; 76 Offset eventOffset; 77 }; 78 79 using ObjectIDMap = std::map<Path, Data>; 80