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