summaryrefslogtreecommitdiffstats
path: root/chassishandler.C
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2015-10-27 15:58:44 -0500
committerAdriana Kobylak <anoo@us.ibm.com>2015-11-10 13:11:58 -0600
commit40814c6ea395d43afde5e8a3785bdcc89dc094fe (patch)
treeb73e4f20e1a41c4bcd882aec4a20dfacee0449ae /chassishandler.C
parent8f71a6190d17d59f8de49182b0a8f3f063be3146 (diff)
downloadphosphor-host-ipmid-40814c6ea395d43afde5e8a3785bdcc89dc094fe.tar.gz
phosphor-host-ipmid-40814c6ea395d43afde5e8a3785bdcc89dc094fe.zip
Add support for IPMI Get Boot Options command
Create new Chassis NetFn file and add basic support for OPAL to call the IPMI Get Boot Options command.
Diffstat (limited to 'chassishandler.C')
-rw-r--r--chassishandler.C62
1 files changed, 62 insertions, 0 deletions
diff --git a/chassishandler.C b/chassishandler.C
new file mode 100644
index 0000000..d00a124
--- /dev/null
+++ b/chassishandler.C
@@ -0,0 +1,62 @@
+#include "chassishandler.h"
+#include "ipmid-api.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+
+void register_netfn_chassis_functions() __attribute__((constructor));
+
+struct get_sys_boot_options_t {
+ uint8_t parameter;
+ uint8_t set;
+ uint8_t block;
+} __attribute__ ((packed));
+
+ipmi_ret_t ipmi_chassis_wildcard(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)
+{
+ printf("Handling CHASSIS WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
+ // Status code.
+ ipmi_ret_t rc = IPMI_CC_OK;
+ *data_len = 0;
+ return rc;
+}
+
+ipmi_ret_t ipmi_chassis_get_sys_boot_options(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 rc = IPMI_CC_OK;
+ *data_len = 0;
+
+ printf("IPMI GET_SYS_BOOT_OPTIONS\n");
+
+ get_sys_boot_options_t *reqptr = (get_sys_boot_options_t*) request;
+
+ // TODO Return default values to OPAL until dbus interface is available
+
+ if (reqptr->parameter == 5) // Parameter #5
+ {
+ uint8_t buf[] = {0x1,0x5,80,0,0,0,0};
+ *data_len = sizeof(buf);
+ memcpy(response, &buf, *data_len);
+ }
+ else
+ {
+ fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter);
+ return IPMI_CC_PARM_NOT_SUPPORTED;
+ }
+
+ return rc;
+}
+
+void register_netfn_chassis_functions()
+{
+ printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_WILDCARD);
+ ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_WILDCARD, NULL, ipmi_chassis_wildcard);
+
+ printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_GET_SYS_BOOT_OPTIONS);
+ ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_GET_SYS_BOOT_OPTIONS, NULL, ipmi_chassis_get_sys_boot_options);
+}
+
OpenPOWER on IntegriCloud