summaryrefslogtreecommitdiffstats
path: root/sensorhandler.cpp
diff options
context:
space:
mode:
authorEmily Shaffer <emilyshaffer@google.com>2017-04-05 09:08:57 -0700
committerPatrick Williams <patrick@stwcx.xyz>2017-07-17 15:05:58 -0500
commitd06e0e7e5974af83cb4e424ae9af58e26fc41de8 (patch)
tree311c8cacff87623ed1027a4e6ff60d00c3617af2 /sensorhandler.cpp
parent6edc8a0406bc31fc24f46f15b4db6f7ed0453f8a (diff)
downloadphosphor-host-ipmid-d06e0e7e5974af83cb4e424ae9af58e26fc41de8.tar.gz
phosphor-host-ipmid-d06e0e7e5974af83cb4e424ae9af58e26fc41de8.zip
sensorhandler: add get_sdr_info
Change-Id: I13c82b62cec1c2f505fa81786fdc60cb38b2a636 Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'sensorhandler.cpp')
-rw-r--r--sensorhandler.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 71376d2..c1657da 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -664,6 +664,37 @@ ipmi_ret_t ipmi_sen_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
return rc;
}
+ipmi_ret_t ipmi_sen_get_sdr_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)
+{
+ auto resp = static_cast<get_sdr_info::GetSdrInfoResp*>(response);
+ if (request == nullptr ||
+ get_sdr_info::request::get_count(request) == false)
+ {
+ // Get Sensor Count
+ resp->count = sensors.size();
+ }
+ else
+ {
+ resp->count = 1;
+ }
+
+ // Multiple LUNs not supported.
+ namespace response = get_sdr_info::response;
+ response::set_lun_present(0, &(resp->luns_and_dynamic_population));
+ response::set_lun_not_present(1, &(resp->luns_and_dynamic_population));
+ response::set_lun_not_present(2, &(resp->luns_and_dynamic_population));
+ response::set_lun_not_present(3, &(resp->luns_and_dynamic_population));
+ response::set_static_population(&(resp->luns_and_dynamic_population));
+
+ *data_len = SDR_INFO_RESP_SIZE;
+
+ return IPMI_CC_OK;
+}
+
void register_netfn_sen_functions()
{
@@ -687,5 +718,9 @@ void register_netfn_sen_functions()
ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING, NULL,
ipmi_sen_get_sensor_reading, 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, NULL,
+ ipmi_sen_get_sdr_info, PRIVILEGE_USER);
return;
}
OpenPOWER on IntegriCloud