blob: 9c5f563e5e6bb01a986a8306227efe675792371e [file] [log] [blame]
#pragma once
#include <ipmid/api.h>
#include <stdint.h>
#include <map>
#include <string>
static constexpr auto propertiesIntf = "org.freedesktop.DBus.Properties";
static constexpr auto bmcUpdaterServiceName =
"xyz.openbmc_project.Software.BMC.Updater";
static constexpr auto softwarePath = "/xyz/openbmc_project/software";
static constexpr auto factoryResetIntf =
"xyz.openbmc_project.Common.FactoryReset";
static constexpr auto stateChassisPath = "/xyz/openbmc_project/state/chassis0";
static constexpr auto stateChassisIntf = "xyz.openbmc_project.State.Chassis";
static constexpr auto stateBmcPath = "/xyz/openbmc_project/state/bmc0";
static constexpr auto stateBmcIntf = "xyz.openbmc_project.State.BMC";
// IPMI commands for net functions.
enum ipmi_netfn_oem_cmds
{
IPMI_CMD_PREP_FW_UPDATE = 0x10,
IPMI_CMD_BMC_FACTORY_RESET = 0x11,
IPMI_CMD_PESEL = 0xF0,
IPMI_CMD_OCC_RESET = 0x0E,
};
/** @brief Read eSEL data into a string
*
* @param[in] filename - filename of file containing eSEL
*
* @return On success return the eSEL data
*/
std::string readESEL(const char* filename);
/** @brief Create OCC metrics log entry
*
* @param[in] eSELData - eSEL data containing OCC metrics data
*/
void createLogEntry(const std::string& eSELData);
ipmi_ret_t ipmi_ibm_oem_partial_esel(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request,
ipmi_response_t response,
ipmi_data_len_t data_len,
ipmi_context_t context);
struct esel_request_t
{
uint16_t resid;
uint16_t selrecord;
uint16_t offset;
uint8_t progress;
} __attribute__((packed));
/** @struct SELEventRecord
*
* IPMI SEL event record format.
*/
struct SELEventRecord
{
uint16_t recordID; //!< Record ID.
uint8_t recordType; //!< Record Type.
uint32_t timeStamp; //!< Timestamp.
uint16_t generatorID; //!< Generator ID.
uint8_t eventMsgRevision; //!< Event Message Revision.
uint8_t sensorType; //!< Sensor Type.
uint8_t sensorNum; //!< Sensor Number.
uint8_t eventType; //!< Event Dir | Event Type.
uint8_t eventData1; //!< Event Data 1.
uint8_t eventData2; //!< Event Data 2.
uint8_t eventData3; //!< Event Data 3.
} __attribute__((packed));
using Id = uint8_t;
using Type = uint8_t;
using ReadingType = uint8_t;
using Offset = uint8_t;
using Path = std::string;
struct Data
{
Id sensorID;
Type sensorType;
ReadingType eventReadingType;
Offset eventOffset;
};
using ObjectIDMap = std::map<Path, Data>;