blob: 19187ba0cc92fc6b3cba4ed94351faf60b74e93b [file] [log] [blame]
Chris Austen1810bec2015-10-13 12:12:39 -05001#include "dcmihandler.h"
Patrick Williams37af7332016-09-02 21:21:42 -05002#include "host-ipmid/ipmid-api.h"
Chris Austen1810bec2015-10-13 12:12:39 -05003#include <stdio.h>
4#include <string.h>
5#include <stdint.h>
6
7void register_netfn_dcmi_functions() __attribute__((constructor));
8
9
10ipmi_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
34void register_netfn_dcmi_functions()
35{
Tom05732372016-09-06 17:21:23 +053036 // <Get Power Limit>
Chris Austen1810bec2015-10-13 12:12:39 -050037 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_GRPEXT, IPMI_CMD_DCMI_GET_POWER);
Tom05732372016-09-06 17:21:23 +053038 ipmi_register_callback(NETFUN_GRPEXT, IPMI_CMD_DCMI_GET_POWER, NULL, ipmi_dcmi_get_power_limit,
39 PRIVILEGE_USER);
Chris Austen1810bec2015-10-13 12:12:39 -050040 return;
41}
Tom05732372016-09-06 17:21:23 +053042// 956379