2
* Copyright (C) 2008 Intel Corporation.
5
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
6
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
7
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
9
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
10
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
11
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
13
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
14
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
15
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
#include <ipmitool/ipmi.h>
25
/* DCMI commands per DCMI 1.5 SPEC */
27
#define IPMI_DCMI 0xDC /* Group Extension Identification */
28
#define IPMI_DCMI_COMPAT 0x01
29
#define IPMI_DCMI_GETRED 0x02
30
#define IPMI_DCMI_GETLMT 0x03
31
#define IPMI_DCMI_SETLMT 0x04
32
#define IPMI_DCMI_PWRACT 0x05
33
#define IPMI_DCMI_GETASSET 0x06
34
#define IPMI_DCMI_SETASSET 0x08
35
#define IPMI_DCMI_GETMNGCTRLIDS 0x09
36
#define IPMI_DCMI_SETMNGCTRLIDS 0x0A
37
#define IPMI_DCMI_SETTERMALLIMIT 0x0B
38
#define IPMI_DCMI_GETTERMALLIMIT 0x0C
39
#define IPMI_DCMI_GETSNSR 0x07
40
#define IPMI_DCMI_PWRMGT 0x08
41
#define IPMI_DCMI_GETTEMPRED 0x10
42
#define IPMI_DCMI_SETCONFPARAM 0x12
43
#define IPMI_DCMI_GETCONFPARAM 0x13
45
#define IPMI_DCMI_CONFORM 0x0001
46
#define IPMI_DCMI_1_1_CONFORM 0x0101
48
#define DCMI_MAX_BYTE_SIZE 0x10
49
#define DCMI_MAX_BYTE_TEMP_READ_SIZE 0x08
51
#define GOOD_PWR_GLIMIT_CCODE(ccode) ((ccode = ((ccode == 0x80) ? 0 : ccode)))
52
#define GOOD_ASSET_TAG_CCODE(ccode) ((ccode = (((ccode == 0x80) || (ccode == 0x81) || (ccode == 0x82) || (ccode == 0x83)) ? 0 : ccode)))
61
/* make a struct for the return from the get limit command */
63
uint8_t grp_id; /* first byte: Group Extension ID */
64
uint16_t reserved_1; /* second and third bytes are reserved */
65
uint8_t action; /* fourth byte is the exception action */
66
uint16_t limit; /* fifth through sixth byte are the power limit in watts */
67
uint32_t correction; /* seventh - 10th bytes are the correction period */
68
uint16_t reserved_2; /* 11th - 12th are reserved bytes */
69
uint16_t sample; /* 13th - 14th are sample period time */
70
} __attribute__ ((packed));
72
/* make a struct for the return from the reading command */
73
struct power_reading {
74
uint8_t grp_id; /* first byte: Group Extension ID */
79
uint32_t time_stamp; /* time since epoch */
82
} __attribute__ ((packed));
84
/* make a struct for the return from the capabilites command */
86
uint8_t grp_id; /* first byte: Group Extension ID */
93
} __attribute__ ((packed));
95
/* make a struct for the return from the sensor info command */
97
uint8_t grp_id; /* first byte: Group Extension ID */
101
} __attribute__ ((packed));
103
/* make a struct for the return from the get asset tag command */
105
uint8_t grp_id; /* first byte: Group Extension ID */
108
} __attribute__ ((packed));
110
/* make a struct for the return from the set asset tag command */
111
struct set_asset_tag {
112
uint8_t grp_id; /* first byte: Group Extension ID */
116
} __attribute__ ((packed));
118
/* make a struct for the return from the get thermal limit command */
119
struct thermal_limit {
120
uint8_t grp_id; /* first byte: Group Extension ID */
121
uint8_t exceptionActions;
123
uint16_t exceptionTime;
124
} __attribute__ ((packed));
126
int ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char ** argv);
128
#endif /*IPMI_DCMI_H*/