~ubuntu-branches/ubuntu/vivid/ipmitool/vivid-updates

« back to all changes in this revision

Viewing changes to include/ipmitool/ipmi_dcmi.h

  • Committer: Package Import Robot
  • Author(s): Luk Claes
  • Date: 2013-05-07 18:12:12 UTC
  • mfrom: (5.1.11 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130507181212-fitwelheknk3tqnq
Tags: 1.8.12-1
Merge new upstream from Ubuntu (Closes: #692292).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2008 Intel Corporation.
 
3
 * All rights reserved
 
4
 * 
 
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.  
 
16
 *
 
17
 */
 
18
 
 
19
 
 
20
#ifndef IPMI_DCMI_H
 
21
#define IPMI_DCMI_H
 
22
 
 
23
#include <ipmitool/ipmi.h>
 
24
 
 
25
/* DCMI commands per DCMI 1.5 SPEC */
 
26
 
 
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
 
44
 
 
45
#define IPMI_DCMI_CONFORM           0x0001
 
46
#define IPMI_DCMI_1_1_CONFORM       0x0101
 
47
 
 
48
#define DCMI_MAX_BYTE_SIZE              0x10
 
49
#define DCMI_MAX_BYTE_TEMP_READ_SIZE    0x08
 
50
 
 
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)))
 
53
 
 
54
 
 
55
struct dcmi_cmd {
 
56
    uint16_t val;
 
57
    const char * str;
 
58
    const char * desc;
 
59
};
 
60
 
 
61
/* make a struct for the return from the get limit command */
 
62
struct power_limit {
 
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));
 
71
 
 
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 */
 
75
    uint16_t curr_pwr;
 
76
    uint16_t min_sample;
 
77
    uint16_t max_sample;
 
78
    uint16_t avg_pwr;
 
79
    uint32_t time_stamp; /* time since epoch */
 
80
    uint32_t sample;
 
81
    uint8_t state;
 
82
} __attribute__ ((packed));
 
83
 
 
84
/* make a struct for the return from the capabilites command */
 
85
struct capabilities {
 
86
    uint8_t grp_id; /* first byte: Group Extension ID */
 
87
    uint16_t conformance;
 
88
    uint8_t revision;
 
89
    uint8_t data_byte1;
 
90
    uint8_t data_byte2;
 
91
    uint8_t data_byte3;
 
92
    uint8_t data_byte4;
 
93
} __attribute__ ((packed));
 
94
 
 
95
/* make a struct for the return from the sensor info command */
 
96
struct sensor_info {
 
97
    uint8_t grp_id; /* first byte: Group Extension ID */
 
98
    uint8_t i_instances;
 
99
    uint8_t i_records;
 
100
    
 
101
} __attribute__ ((packed));
 
102
 
 
103
/* make a struct for the return from the get asset tag command */
 
104
struct asset_tag {
 
105
    uint8_t grp_id; /* first byte: Group Extension ID */
 
106
    uint8_t length;
 
107
    const char tag[16];
 
108
} __attribute__ ((packed));
 
109
 
 
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 */
 
113
    uint8_t length;
 
114
    const char tag[16];
 
115
        uint8_t *data;
 
116
} __attribute__ ((packed));
 
117
 
 
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;
 
122
    uint8_t tempLimit;
 
123
    uint16_t exceptionTime;
 
124
} __attribute__ ((packed));
 
125
 
 
126
int ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char ** argv);
 
127
 
 
128
#endif /*IPMI_DCMI_H*/