diff options
author | anil kumar appana <anil.kumarx.appana@intel.com> | 2019-05-28 11:20:19 +0000 |
---|---|---|
committer | Vernon Mauery <vernon.mauery@linux.intel.com> | 2019-06-24 17:48:52 +0000 |
commit | 2c7db1d3594b388c0b857560e7217bbc154f84bf (patch) | |
tree | 21417079dca8866fcf1332a5a2d91637eee9a109 /storagehandler.cpp | |
parent | 23d06441e9ef92b0cfa421dbf256661d31ed5153 (diff) | |
download | phosphor-host-ipmid-2c7db1d3594b388c0b857560e7217bbc154f84bf.tar.gz phosphor-host-ipmid-2c7db1d3594b388c0b857560e7217bbc154f84bf.zip |
storagehandler: move Add SEL to new API
Rewrite "Add SEL Entry" command to use the newly
introduced IPMI provider API.
Tested:
Verified the behavior to be same as previous change.
ipmitool raw 0x0a 0x44 1 0 0xff 4 5 6 7 8 9 0 1 2 3 4 5 6
05 06
Signed-off-by: anil kumar appana <anil.kumarx.appana@intel.com>
Change-Id: I49bad876a209fb55f1b5b635b5a4ded425d33af0
Diffstat (limited to 'storagehandler.cpp')
-rw-r--r-- | storagehandler.cpp | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/storagehandler.cpp b/storagehandler.cpp index 3923621..a490235 100644 --- a/storagehandler.cpp +++ b/storagehandler.cpp @@ -29,7 +29,7 @@ void register_netfn_storage_functions() __attribute__((constructor)); unsigned int g_sel_time = 0xFFFFFFFF; extern const ipmi::sensor::IdInfoMap sensors; extern const FruMap frus; - +constexpr uint8_t eventDataSize = 3; namespace { constexpr auto TIME_INTERFACE = "xyz.openbmc_project.Time.EpochTime"; @@ -582,44 +582,45 @@ ipmi_ret_t ipmi_storage_reserve_sel(ipmi_netfn_t netfn, ipmi_cmd_t cmd, return rc; } -ipmi_ret_t ipmi_storage_add_sel(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) +/** @brief implements the Add SEL entry command + * @request + * + * - recordID ID used for SEL Record access + * - recordType Record Type + * - timeStamp Time when event was logged. LS byte first + * - generatorID software ID if event was generated from + * system software + * - evmRev event message format version + * - sensorType sensor type code for service that generated + * the event + * - sensorNumber number of sensors that generated the event + * - eventDir event dir + * - eventData event data field contents + * + * @returns ipmi completion code plus response data + * - RecordID of the Added SEL entry + */ +ipmi::RspType<uint16_t // recordID of the Added SEL entry + > + ipmiStorageAddSEL(uint16_t recordID, uint8_t recordType, uint32_t timeStamp, + uint16_t generatorID, uint8_t evmRev, uint8_t sensorType, + uint8_t sensorNumber, uint8_t eventDir, + std::array<uint8_t, eventDataSize> eventData) { - if (*data_len != sizeof(ipmi_add_sel_request_t)) - { - *data_len = 0; - return IPMI_CC_REQ_DATA_LEN_INVALID; - } - - ipmi_ret_t rc = IPMI_CC_OK; - ipmi_add_sel_request_t* p = (ipmi_add_sel_request_t*)request; - uint16_t recordid; - // Per the IPMI spec, need to cancel the reservation when a SEL entry is // added cancelSELReservation(); - - recordid = ((uint16_t)p->eventdata[1] << 8) | p->eventdata[2]; - - *data_len = sizeof(recordid); - - // Pack the actual response - std::memcpy(response, &p->eventdata[1], 2); - // Hostboot sends SEL with OEM record type 0xDE to indicate that there is // a maintenance procedure associated with eSEL record. static constexpr auto procedureType = 0xDE; - if (p->recordtype == procedureType) + if (recordType == procedureType) { // In the OEM record type 0xDE, byte 11 in the SEL record indicate the // procedure number. - createProcedureLogEntry(p->sensortype); + createProcedureLogEntry(sensorType); } - return rc; + return ipmi::responseSuccess(recordID); } /** @brief implements the get FRU Inventory Area Info command @@ -767,8 +768,10 @@ void register_netfn_storage_functions() ipmi::Privilege::Operator, deleteSELEntry); // <Add SEL Entry> - ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_ADD_SEL, NULL, - ipmi_storage_add_sel, PRIVILEGE_OPERATOR); + ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, + ipmi::storage::cmdAddSelEntry, + ipmi::Privilege::Operator, ipmiStorageAddSEL); + // <Clear SEL> ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, ipmi::storage::cmdClearSel, ipmi::Privilege::Operator, |