FreeBSD/Linux Kernel Cross Reference
sys/sys/ipmi.h
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2006 IronPort Systems Inc. <ambrisko@ironport.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD$
29 */
30
31 #ifndef __SYS_IPMI_H__
32 #define __SYS_IPMI_H__
33
34 #define IPMI_MAX_ADDR_SIZE 0x20
35 #define IPMI_MAX_RX 1024
36 #define IPMI_BMC_SLAVE_ADDR 0x20 /* Linux Default slave address */
37 #define IPMI_BMC_CHANNEL 0x0f /* Linux BMC channel */
38
39 #define IPMI_BMC_SMS_LUN 0x02
40
41 #define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c
42 #define IPMI_IPMB_ADDR_TYPE 0x01
43 #define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41
44
45 #define IPMI_IOC_MAGIC 'i'
46 #define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, struct ipmi_recv)
47 #define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, struct ipmi_recv)
48 #define IPMICTL_SEND_COMMAND _IOW(IPMI_IOC_MAGIC, 13, struct ipmi_req)
49 #define IPMICTL_REGISTER_FOR_CMD _IOW(IPMI_IOC_MAGIC, 14, struct ipmi_cmdspec)
50 #define IPMICTL_UNREGISTER_FOR_CMD _IOW(IPMI_IOC_MAGIC, 15, struct ipmi_cmdspec)
51 #define IPMICTL_SET_GETS_EVENTS_CMD _IOW(IPMI_IOC_MAGIC, 16, int)
52 #define IPMICTL_SET_MY_ADDRESS_CMD _IOW(IPMI_IOC_MAGIC, 17, unsigned int)
53 #define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
54 #define IPMICTL_SET_MY_LUN_CMD _IOW(IPMI_IOC_MAGIC, 19, unsigned int)
55 #define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int)
56
57 #define IPMI_RESPONSE_RECV_TYPE 1
58 #define IPMI_ASYNC_EVENT_RECV_TYPE 2
59 #define IPMI_CMD_RECV_TYPE 3
60
61 #define IPMI_CHASSIS_REQUEST 0x00
62 # define IPMI_CHASSIS_CONTROL 0x02
63 # define IPMI_CC_POWER_DOWN 0x0
64 # define IPMI_CC_POWER_UP 0x1
65 # define IPMI_CC_POWER_CYCLE 0x2
66 # define IPMI_CC_HARD_RESET 0x3
67 # define IPMI_CC_PULSE_DI 0x4
68 # define IPMI_CC_SOFT_OVERTEMP 0x5
69
70 #define IPMI_APP_REQUEST 0x06
71 #define IPMI_GET_DEVICE_ID 0x01
72 # define IPMI_ADS_CHASSIS 0x80
73 # define IPMI_ADS_BRIDGE 0x40
74 # define IPMI_ADS_EVENT_GEN 0x20
75 # define IPMI_ADS_EVENT_RCV 0x10
76 # define IPMI_ADS_FRU_INV 0x08
77 # define IPMI_ADS_SEL 0x04
78 # define IPMI_ADS_SDR 0x02
79 # define IPMI_ADS_SENSOR 0x01
80 #define IPMI_CLEAR_FLAGS 0x30
81 #define IPMI_GET_MSG_FLAGS 0x31
82 # define IPMI_MSG_AVAILABLE 0x01
83 # define IPMI_MSG_BUFFER_FULL 0x02
84 # define IPMI_WDT_PRE_TIMEOUT 0x08
85 #define IPMI_GET_MSG 0x33
86 #define IPMI_SEND_MSG 0x34
87 #define IPMI_GET_CHANNEL_INFO 0x42
88 #define IPMI_RESET_WDOG 0x22
89 #define IPMI_SET_WDOG 0x24
90 #define IPMI_GET_WDOG 0x25
91
92 #define IPMI_SET_WD_TIMER_SMS_OS 0x04
93 #define IPMI_SET_WD_TIMER_DONT_STOP 0x40
94 #define IPMI_SET_WD_ACTION_NONE 0x00
95 #define IPMI_SET_WD_ACTION_RESET 0x01
96 #define IPMI_SET_WD_ACTION_POWER_DOWN 0x02
97 #define IPMI_SET_WD_ACTION_POWER_CYCLE 0x03
98 #define IPMI_SET_WD_PREACTION_NONE (0x00 << 4)
99 #define IPMI_SET_WD_PREACTION_SMI (0x01 << 4)
100 #define IPMI_SET_WD_PREACTION_NMI (0x02 << 4)
101 #define IPMI_SET_WD_PREACTION_MI (0x03 << 4)
102
103 struct ipmi_msg {
104 unsigned char netfn;
105 unsigned char cmd;
106 unsigned short data_len;
107 unsigned char *data;
108 };
109
110 struct ipmi_req {
111 unsigned char *addr;
112 unsigned int addr_len;
113 long msgid;
114 struct ipmi_msg msg;
115 };
116
117 struct ipmi_recv {
118 int recv_type;
119 unsigned char *addr;
120 unsigned int addr_len;
121 long msgid;
122 struct ipmi_msg msg;
123 };
124
125 struct ipmi_cmdspec {
126 unsigned char netfn;
127 unsigned char cmd;
128 };
129
130
131 struct ipmi_addr {
132 int addr_type;
133 short channel;
134 unsigned char data[IPMI_MAX_ADDR_SIZE];
135 };
136
137 struct ipmi_system_interface_addr {
138 int addr_type;
139 short channel;
140 unsigned char lun;
141 };
142
143 struct ipmi_ipmb_addr {
144 int addr_type;
145 short channel;
146 unsigned char slave_addr;
147 unsigned char lun;
148 };
149
150 #if defined(__amd64__)
151 /* Compatibility with 32-bit binaries. */
152
153 #define IPMICTL_RECEIVE_MSG_TRUNC_32 _IOWR(IPMI_IOC_MAGIC, 11, struct ipmi_recv32)
154 #define IPMICTL_RECEIVE_MSG_32 _IOWR(IPMI_IOC_MAGIC, 12, struct ipmi_recv32)
155 #define IPMICTL_SEND_COMMAND_32 _IOW(IPMI_IOC_MAGIC, 13, struct ipmi_req32)
156
157 struct ipmi_msg32 {
158 unsigned char netfn;
159 unsigned char cmd;
160 unsigned short data_len;
161 uint32_t data;
162 };
163
164 struct ipmi_req32 {
165 uint32_t addr;
166 unsigned int addr_len;
167 int32_t msgid;
168 struct ipmi_msg32 msg;
169 };
170
171 struct ipmi_recv32 {
172 int recv_type;
173 uint32_t addr;
174 unsigned int addr_len;
175 int32_t msgid;
176 struct ipmi_msg32 msg;
177 };
178
179 #endif
180
181 #endif /* !__SYS_IPMI_H__ */
Cache object: 3cfd91756196c3963855d57a6251b7de
|