Adriana Kobylak | 40814c6 | 2015-10-27 15:58:44 -0500 | [diff] [blame] | 1 | #include "chassishandler.h" |
| 2 | #include "ipmid-api.h" |
| 3 | #include <stdio.h> |
| 4 | #include <string.h> |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | void register_netfn_chassis_functions() __attribute__((constructor)); |
| 8 | |
| 9 | struct get_sys_boot_options_t { |
| 10 | uint8_t parameter; |
| 11 | uint8_t set; |
| 12 | uint8_t block; |
| 13 | } __attribute__ ((packed)); |
| 14 | |
| 15 | ipmi_ret_t ipmi_chassis_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 16 | ipmi_request_t request, ipmi_response_t response, |
| 17 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 18 | { |
| 19 | printf("Handling CHASSIS WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd); |
| 20 | // Status code. |
| 21 | ipmi_ret_t rc = IPMI_CC_OK; |
| 22 | *data_len = 0; |
| 23 | return rc; |
| 24 | } |
| 25 | |
| 26 | ipmi_ret_t ipmi_chassis_get_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 27 | ipmi_request_t request, ipmi_response_t response, |
| 28 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 29 | { |
| 30 | ipmi_ret_t rc = IPMI_CC_OK; |
| 31 | *data_len = 0; |
| 32 | |
| 33 | printf("IPMI GET_SYS_BOOT_OPTIONS\n"); |
| 34 | |
| 35 | get_sys_boot_options_t *reqptr = (get_sys_boot_options_t*) request; |
| 36 | |
| 37 | // TODO Return default values to OPAL until dbus interface is available |
| 38 | |
| 39 | if (reqptr->parameter == 5) // Parameter #5 |
| 40 | { |
| 41 | uint8_t buf[] = {0x1,0x5,80,0,0,0,0}; |
| 42 | *data_len = sizeof(buf); |
| 43 | memcpy(response, &buf, *data_len); |
| 44 | } |
| 45 | else |
| 46 | { |
| 47 | fprintf(stderr, "Unsupported parameter 0x%x\n", reqptr->parameter); |
| 48 | return IPMI_CC_PARM_NOT_SUPPORTED; |
| 49 | } |
| 50 | |
| 51 | return rc; |
| 52 | } |
| 53 | |
| 54 | void register_netfn_chassis_functions() |
| 55 | { |
| 56 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_WILDCARD); |
| 57 | ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_WILDCARD, NULL, ipmi_chassis_wildcard); |
| 58 | |
| 59 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_CHASSIS, IPMI_CMD_GET_SYS_BOOT_OPTIONS); |
| 60 | ipmi_register_callback(NETFUN_CHASSIS, IPMI_CMD_GET_SYS_BOOT_OPTIONS, NULL, ipmi_chassis_get_sys_boot_options); |
| 61 | } |
| 62 | |