diff options
-rw-r--r-- | host-ipmid-whitelist.conf | 3 | ||||
-rw-r--r-- | sensorhandler.cpp | 18 | ||||
-rw-r--r-- | sensorhandler.h | 17 | ||||
-rw-r--r-- | storagehandler.cpp | 11 | ||||
-rw-r--r-- | storagehandler.h | 2 |
5 files changed, 36 insertions, 15 deletions
diff --git a/host-ipmid-whitelist.conf b/host-ipmid-whitelist.conf index 5fa539a..66af810 100644 --- a/host-ipmid-whitelist.conf +++ b/host-ipmid-whitelist.conf @@ -21,6 +21,9 @@ 0x06:0x42 //<App>:<Get Channel Info Command> 0x0A:0x10 //<Storage>:<Get FRU Inventory Area Info> 0x0A:0x11 //<Storage>:<Read FRU Data> +0x0A:0x20 //<Storage>:<Get SDR Repository Info> +0x0A:0x22 //<Storage>:<Reserve SDR Repository> +0x0A:0x23 //<Storage>:<Get SDR> 0x0A:0x40 //<Storage>:<Get SEL Info> 0x0A:0x42 //<Storage>:<Reserve SEL> 0x0A:0x44 //<Storage>:<Add SEL Entry> diff --git a/sensorhandler.cpp b/sensorhandler.cpp index 2bd022b..7d9d394 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -1082,24 +1082,18 @@ void register_netfn_sen_functions() nullptr, ipmi_sen_get_sensor_reading, PRIVILEGE_USER); - // <Reserve SDR> - printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", - NETFUN_SENSOR, IPMI_CMD_RESERVE_SDR_REPO); - ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_RESERVE_SDR_REPO, + // <Reserve Device SDR Repository> + ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_RESERVE_DEVICE_SDR_REPO, nullptr, ipmi_sen_reserve_sdr, PRIVILEGE_USER); - // <Get SDR Info> - printf("Registering NetFn:[0x%X], Cmd:[0x%x]\n", - NETFUN_SENSOR, IPMI_CMD_GET_SDR_INFO); - ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SDR_INFO, + // <Get Device SDR Info> + ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_DEVICE_SDR_INFO, nullptr, ipmi_sen_get_sdr_info, PRIVILEGE_USER); - // <Get SDR> - printf("Registering NetFn:[0x%X], Cmd:[0x%x]\n", - NETFUN_SENSOR, IPMI_CMD_GET_SDR); - ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SDR, + // <Get Device SDR> + ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_DEVICE_SDR, nullptr, ipmi_sen_get_sdr, PRIVILEGE_USER); diff --git a/sensorhandler.h b/sensorhandler.h index 4dd079d..d6426f6 100644 --- a/sensorhandler.h +++ b/sensorhandler.h @@ -3,13 +3,14 @@ #include <stdint.h> #include "types.hpp" +#include "host-ipmid/ipmid-api.h" // IPMI commands for net functions. enum ipmi_netfn_sen_cmds { - IPMI_CMD_GET_SDR_INFO = 0x20, - IPMI_CMD_GET_SDR = 0x21, - IPMI_CMD_RESERVE_SDR_REPO = 0x22, + IPMI_CMD_GET_DEVICE_SDR_INFO = 0x20, + IPMI_CMD_GET_DEVICE_SDR = 0x21, + IPMI_CMD_RESERVE_DEVICE_SDR_REPO = 0x22, IPMI_CMD_GET_SENSOR_READING = 0x2D, IPMI_CMD_GET_SENSOR_TYPE = 0x2F, IPMI_CMD_SET_SENSOR = 0x30, @@ -50,6 +51,16 @@ int set_sensor_dbus_state_s(uint8_t , const char *, const char *); int set_sensor_dbus_state_y(uint8_t , const char *, const uint8_t); int find_openbmc_path(uint8_t , dbus_interface_t *); +ipmi_ret_t ipmi_sen_get_sdr(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_ret_t ipmi_sen_reserve_sdr(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); + static const uint16_t FRU_RECORD_ID_START = 256; static const uint8_t SDR_VERSION = 0x51; static const uint16_t END_OF_RECORD = 0xFFFF; diff --git a/storagehandler.cpp b/storagehandler.cpp index 59dfdde..fa630e3 100644 --- a/storagehandler.cpp +++ b/storagehandler.cpp @@ -19,6 +19,7 @@ #include "storagehandler.h" #include "utils.hpp" #include "xyz/openbmc_project/Common/error.hpp" +#include "sensorhandler.h" void register_netfn_storage_functions() __attribute__((constructor)); @@ -762,6 +763,16 @@ void register_netfn_storage_functions() nullptr, ipmi_get_repository_info, PRIVILEGE_USER); + // <Reserve SDR Repository> + ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_RESERVE_SDR, + nullptr, ipmi_sen_reserve_sdr, + PRIVILEGE_USER); + + // <Get SDR> + ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SDR, + nullptr, ipmi_sen_get_sdr, + PRIVILEGE_USER); + ipmi::fru::registerCallbackHandler(); return; } diff --git a/storagehandler.h b/storagehandler.h index 497db82..1849fc7 100644 --- a/storagehandler.h +++ b/storagehandler.h @@ -8,6 +8,8 @@ enum ipmi_netfn_storage_cmds IPMI_CMD_GET_FRU_INV_AREA_INFO = 0x10, IPMI_CMD_GET_REPOSITORY_INFO = 0x20, IPMI_CMD_READ_FRU_DATA = 0x11, + IPMI_CMD_RESERVE_SDR = 0x22, + IPMI_CMD_GET_SDR = 0x23, IPMI_CMD_GET_SEL_INFO = 0x40, IPMI_CMD_RESERVE_SEL = 0x42, IPMI_CMD_GET_SEL_ENTRY = 0x43, |