diff options
author | Pradeep Kumar <pradeep1x.kumar@intel.com> | 2019-05-06 15:17:01 +0000 |
---|---|---|
committer | jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> | 2019-07-05 19:04:36 +0000 |
commit | b60e840abc33a50979ea0c8778fe06e28241b3b3 (patch) | |
tree | 3676464e228f93bca8dc2701d34982895420a940 | |
parent | 455ee0b99cdb2e438fd64fdcdd8b897cb617f249 (diff) | |
download | phosphor-host-ipmid-b60e840abc33a50979ea0c8778fe06e28241b3b3.tar.gz phosphor-host-ipmid-b60e840abc33a50979ea0c8778fe06e28241b3b3.zip |
storagehandler: move get sdr info to new API
Rewrite: "Get SDR repository info" command to new IPMI provider API.
Tested:
Verified using ipmitool.
ipmitool raw 0x0a 0x20
51 01 00 ff ff 00 00 00 00 00 00 00 00 00
Change-Id: I4b18631c4b4182f2c98caa145c151f3079cd7fc4
Signed-off-by: Pradeep Kumar <pradeep1x.kumar@intel.com>
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
-rw-r--r-- | storagehandler.cpp | 38 | ||||
-rw-r--r-- | storagehandler.hpp | 14 |
2 files changed, 18 insertions, 34 deletions
diff --git a/storagehandler.cpp b/storagehandler.cpp index eb1944a..d86b273 100644 --- a/storagehandler.cpp +++ b/storagehandler.cpp @@ -709,29 +709,26 @@ ipmi_ret_t ipmi_storage_read_fru_data(ipmi_netfn_t netfn, ipmi_cmd_t cmd, return rc; } -ipmi_ret_t ipmi_get_repository_info(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) +ipmi::RspType<uint8_t, // SDR version + uint16_t, // record count LS first + uint16_t, // free space in bytes, LS first + uint32_t, // addition timestamp LS first + uint32_t, // deletion timestamp LS first + uint8_t> // operation Support + ipmiGetRepositoryInfo() { - constexpr auto sdrVersion = 0x51; - auto responseData = reinterpret_cast<GetRepositoryInfoResponse*>(response); - - std::memset(responseData, 0, sizeof(GetRepositoryInfoResponse)); - responseData->sdrVersion = sdrVersion; + constexpr uint8_t sdrVersion = 0x51; + constexpr uint16_t freeSpace = 0xFFFF; + constexpr uint32_t additionTimestamp = 0x0; + constexpr uint32_t deletionTimestamp = 0x0; + constexpr uint8_t operationSupport = 0; uint16_t records = frus.size() + sensors.size(); - responseData->recordCountMs = records >> 8; - responseData->recordCountLs = records; - responseData->freeSpace[0] = 0xFF; - responseData->freeSpace[1] = 0xFF; - - *data_len = sizeof(GetRepositoryInfoResponse); - - return IPMI_CC_OK; + return ipmi::responseSuccess(sdrVersion, records, freeSpace, + additionTimestamp, deletionTimestamp, + operationSupport); } void register_netfn_storage_functions() @@ -787,8 +784,9 @@ void register_netfn_storage_functions() ipmi_storage_read_fru_data, PRIVILEGE_USER); // <Get Repository Info> - ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_REPOSITORY_INFO, - nullptr, ipmi_get_repository_info, PRIVILEGE_USER); + ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, + ipmi::storage::cmdGetSdrRepositoryInfo, + ipmi::Privilege::User, ipmiGetRepositoryInfo); // <Reserve SDR Repository> ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_RESERVE_SDR, nullptr, diff --git a/storagehandler.hpp b/storagehandler.hpp index 9ec87cb..d093980 100644 --- a/storagehandler.hpp +++ b/storagehandler.hpp @@ -41,17 +41,3 @@ struct ReadFruDataResponse uint8_t count; ///< Response data Count. uint8_t data[]; ///< Response data. } __attribute__((packed)); - -/** - * @struct Get Repository info command response - */ -struct GetRepositoryInfoResponse -{ - uint8_t sdrVersion; //< SDR version - uint8_t recordCountLs; //< Record count LS byte - uint8_t recordCountMs; //< Record count MS bte - uint8_t freeSpace[2]; //< Free space in bytes, LS first - uint8_t additionTimestamp[4]; //< Most recent addition timestamp LS first - uint8_t deletionTimestamp[4]; //< Most recent deletion timestamp LS first - uint8_t operationSupport; //< Operation support -} __attribute__((packed)); |