Skip to content

Commit 1810bec

Browse files
author
Chris Austen
committed
Add support for the the dcmi package
1 parent b4f5b92 commit 1810bec

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ DAEMON_OBJ = $(DAEMON).o
55
LIB_APP_OBJ = apphandler.o \
66
sensorhandler.o \
77
storagehandler.o \
8+
dcmihandler.o
89

910
LIB_APP = libapphandler.so
1011

dcmihandler.C

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include "dcmihandler.h"
2+
#include "ipmid-api.h"
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+
{
36+
printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_GRPEXT, IPMI_CMD_DCMI_GET_POWER);
37+
ipmi_register_callback(NETFUN_GRPEXT, IPMI_CMD_DCMI_GET_POWER, NULL, ipmi_dcmi_get_power_limit);
38+
return;
39+
}
40+
// 956379

dcmihandler.h

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef __HOST_IPMI_DCMI_HANDLER_H__
2+
#define __HOST_IPMI_DCMI_HANDLER_H__
3+
4+
// IPMI commands for net functions.
5+
enum ipmi_netfn_sen_cmds
6+
{
7+
// Get capability bits
8+
IPMI_CMD_DCMI_GET_POWER = 0x03,
9+
10+
};
11+
12+
#endif

ipmid-api.h

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ enum ipmi_netfn_wild_card_cmd
8585
enum ipmi_return_codes
8686
{
8787
IPMI_CC_OK = 0x00,
88+
IPMI_DCMI_CC_NO_ACTIVE_POWER_LIMIT = 0x80,
8889
IPMI_CC_INVALID = 0xC1
8990
};
9091

0 commit comments

Comments
 (0)