Chris Austen | 1810bec | 2015-10-13 12:12:39 -0500 | [diff] [blame] | 1 | #include "dcmihandler.h" |
Patrick Williams | 37af733 | 2016-09-02 21:21:42 -0500 | [diff] [blame] | 2 | #include "host-ipmid/ipmid-api.h" |
Chris Austen | 1810bec | 2015-10-13 12:12:39 -0500 | [diff] [blame] | 3 | #include <stdio.h> |
| 4 | #include <string.h> |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | void register_netfn_dcmi_functions() __attribute__((constructor)); |
| 8 | |
| 9 | |
| 10 | ipmi_ret_t ipmi_dcmi_get_power_limit(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 11 | ipmi_request_t request, ipmi_response_t response, |
| 12 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 13 | { |
| 14 | ipmi_ret_t rc = IPMI_DCMI_CC_NO_ACTIVE_POWER_LIMIT; |
| 15 | |
| 16 | // dcmi-v1-5-rev-spec.pdf 6.6.2. |
| 17 | // This is good enough for OpenBMC support for OpenPOWER based systems |
| 18 | // TODO research if more is needed |
| 19 | uint8_t data_response[] = { 0xDC, 0x00, 0x00, 0x01, 0x00, 0x00, |
| 20 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 21 | 0x00, 0x01}; |
| 22 | |
| 23 | |
| 24 | |
| 25 | printf("IPMI DCMI_GET_POWER_LEVEL\n"); |
| 26 | |
| 27 | memcpy(response, data_response, sizeof(data_response)); |
| 28 | *data_len = sizeof(data_response); |
| 29 | |
| 30 | return rc; |
| 31 | } |
| 32 | |
| 33 | |
| 34 | void register_netfn_dcmi_functions() |
| 35 | { |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 36 | // <Get Power Limit> |
Chris Austen | 1810bec | 2015-10-13 12:12:39 -0500 | [diff] [blame] | 37 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_GRPEXT, IPMI_CMD_DCMI_GET_POWER); |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 38 | ipmi_register_callback(NETFUN_GRPEXT, IPMI_CMD_DCMI_GET_POWER, NULL, ipmi_dcmi_get_power_limit, |
| 39 | PRIVILEGE_USER); |
Chris Austen | 1810bec | 2015-10-13 12:12:39 -0500 | [diff] [blame] | 40 | return; |
| 41 | } |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 42 | // 956379 |