xref: /OK3568_Linux_fs/kernel/include/uapi/linux/ipmi.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * ipmi.h
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * MontaVista IPMI interface
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Author: MontaVista Software, Inc.
8*4882a593Smuzhiyun  *         Corey Minyard <minyard@mvista.com>
9*4882a593Smuzhiyun  *         source@mvista.com
10*4882a593Smuzhiyun  *
11*4882a593Smuzhiyun  * Copyright 2002 MontaVista Software Inc.
12*4882a593Smuzhiyun  *
13*4882a593Smuzhiyun  */
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun #ifndef _UAPI__LINUX_IPMI_H
16*4882a593Smuzhiyun #define _UAPI__LINUX_IPMI_H
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun #include <linux/ipmi_msgdefs.h>
19*4882a593Smuzhiyun #include <linux/compiler.h>
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /*
22*4882a593Smuzhiyun  * This file describes an interface to an IPMI driver.  You have to
23*4882a593Smuzhiyun  * have a fairly good understanding of IPMI to use this, so go read
24*4882a593Smuzhiyun  * the specs first before actually trying to do anything.
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  * With that said, this driver provides a multi-user interface to the
27*4882a593Smuzhiyun  * IPMI driver, and it allows multiple IPMI physical interfaces below
28*4882a593Smuzhiyun  * the driver.  The physical interfaces bind as a lower layer on the
29*4882a593Smuzhiyun  * driver.  They appear as interfaces to the application using this
30*4882a593Smuzhiyun  * interface.
31*4882a593Smuzhiyun  *
32*4882a593Smuzhiyun  * Multi-user means that multiple applications may use the driver,
33*4882a593Smuzhiyun  * send commands, receive responses, etc.  The driver keeps track of
34*4882a593Smuzhiyun  * commands the user sends and tracks the responses.  The responses
35*4882a593Smuzhiyun  * will go back to the application that send the command.  If the
36*4882a593Smuzhiyun  * response doesn't come back in time, the driver will return a
37*4882a593Smuzhiyun  * timeout error response to the application.  Asynchronous events
38*4882a593Smuzhiyun  * from the BMC event queue will go to all users bound to the driver.
39*4882a593Smuzhiyun  * The incoming event queue in the BMC will automatically be flushed
40*4882a593Smuzhiyun  * if it becomes full and it is queried once a second to see if
41*4882a593Smuzhiyun  * anything is in it.  Incoming commands to the driver will get
42*4882a593Smuzhiyun  * delivered as commands.
43*4882a593Smuzhiyun  */
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun /*
46*4882a593Smuzhiyun  * This is an overlay for all the address types, so it's easy to
47*4882a593Smuzhiyun  * determine the actual address type.  This is kind of like addresses
48*4882a593Smuzhiyun  * work for sockets.
49*4882a593Smuzhiyun  */
50*4882a593Smuzhiyun #define IPMI_MAX_ADDR_SIZE 32
51*4882a593Smuzhiyun struct ipmi_addr {
52*4882a593Smuzhiyun 	 /* Try to take these from the "Channel Medium Type" table
53*4882a593Smuzhiyun 	    in section 6.5 of the IPMI 1.5 manual. */
54*4882a593Smuzhiyun 	int   addr_type;
55*4882a593Smuzhiyun 	short channel;
56*4882a593Smuzhiyun 	char  data[IPMI_MAX_ADDR_SIZE];
57*4882a593Smuzhiyun };
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun /*
60*4882a593Smuzhiyun  * When the address is not used, the type will be set to this value.
61*4882a593Smuzhiyun  * The channel is the BMC's channel number for the channel (usually
62*4882a593Smuzhiyun  * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC.
63*4882a593Smuzhiyun  */
64*4882a593Smuzhiyun #define IPMI_SYSTEM_INTERFACE_ADDR_TYPE	0x0c
65*4882a593Smuzhiyun struct ipmi_system_interface_addr {
66*4882a593Smuzhiyun 	int           addr_type;
67*4882a593Smuzhiyun 	short         channel;
68*4882a593Smuzhiyun 	unsigned char lun;
69*4882a593Smuzhiyun };
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun /* An IPMB Address. */
72*4882a593Smuzhiyun #define IPMI_IPMB_ADDR_TYPE		0x01
73*4882a593Smuzhiyun /* Used for broadcast get device id as described in section 17.9 of the
74*4882a593Smuzhiyun    IPMI 1.5 manual. */
75*4882a593Smuzhiyun #define IPMI_IPMB_BROADCAST_ADDR_TYPE	0x41
76*4882a593Smuzhiyun struct ipmi_ipmb_addr {
77*4882a593Smuzhiyun 	int           addr_type;
78*4882a593Smuzhiyun 	short         channel;
79*4882a593Smuzhiyun 	unsigned char slave_addr;
80*4882a593Smuzhiyun 	unsigned char lun;
81*4882a593Smuzhiyun };
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun /*
84*4882a593Smuzhiyun  * A LAN Address.  This is an address to/from a LAN interface bridged
85*4882a593Smuzhiyun  * by the BMC, not an address actually out on the LAN.
86*4882a593Smuzhiyun  *
87*4882a593Smuzhiyun  * A conscious decision was made here to deviate slightly from the IPMI
88*4882a593Smuzhiyun  * spec.  We do not use rqSWID and rsSWID like it shows in the
89*4882a593Smuzhiyun  * message.  Instead, we use remote_SWID and local_SWID.  This means
90*4882a593Smuzhiyun  * that any message (a request or response) from another device will
91*4882a593Smuzhiyun  * always have exactly the same address.  If you didn't do this,
92*4882a593Smuzhiyun  * requests and responses from the same device would have different
93*4882a593Smuzhiyun  * addresses, and that's not too cool.
94*4882a593Smuzhiyun  *
95*4882a593Smuzhiyun  * In this address, the remote_SWID is always the SWID the remote
96*4882a593Smuzhiyun  * message came from, or the SWID we are sending the message to.
97*4882a593Smuzhiyun  * local_SWID is always our SWID.  Note that having our SWID in the
98*4882a593Smuzhiyun  * message is a little weird, but this is required.
99*4882a593Smuzhiyun  */
100*4882a593Smuzhiyun #define IPMI_LAN_ADDR_TYPE		0x04
101*4882a593Smuzhiyun struct ipmi_lan_addr {
102*4882a593Smuzhiyun 	int           addr_type;
103*4882a593Smuzhiyun 	short         channel;
104*4882a593Smuzhiyun 	unsigned char privilege;
105*4882a593Smuzhiyun 	unsigned char session_handle;
106*4882a593Smuzhiyun 	unsigned char remote_SWID;
107*4882a593Smuzhiyun 	unsigned char local_SWID;
108*4882a593Smuzhiyun 	unsigned char lun;
109*4882a593Smuzhiyun };
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun 
112*4882a593Smuzhiyun /*
113*4882a593Smuzhiyun  * Channel for talking directly with the BMC.  When using this
114*4882a593Smuzhiyun  * channel, This is for the system interface address type only.  FIXME
115*4882a593Smuzhiyun  * - is this right, or should we use -1?
116*4882a593Smuzhiyun  */
117*4882a593Smuzhiyun #define IPMI_BMC_CHANNEL  0xf
118*4882a593Smuzhiyun #define IPMI_NUM_CHANNELS 0x10
119*4882a593Smuzhiyun 
120*4882a593Smuzhiyun /*
121*4882a593Smuzhiyun  * Used to signify an "all channel" bitmask.  This is more than the
122*4882a593Smuzhiyun  * actual number of channels because this is used in userland and
123*4882a593Smuzhiyun  * will cover us if the number of channels is extended.
124*4882a593Smuzhiyun  */
125*4882a593Smuzhiyun #define IPMI_CHAN_ALL     (~0)
126*4882a593Smuzhiyun 
127*4882a593Smuzhiyun 
128*4882a593Smuzhiyun /*
129*4882a593Smuzhiyun  * A raw IPMI message without any addressing.  This covers both
130*4882a593Smuzhiyun  * commands and responses.  The completion code is always the first
131*4882a593Smuzhiyun  * byte of data in the response (as the spec shows the messages laid
132*4882a593Smuzhiyun  * out).
133*4882a593Smuzhiyun  */
134*4882a593Smuzhiyun struct ipmi_msg {
135*4882a593Smuzhiyun 	unsigned char  netfn;
136*4882a593Smuzhiyun 	unsigned char  cmd;
137*4882a593Smuzhiyun 	unsigned short data_len;
138*4882a593Smuzhiyun 	unsigned char  __user *data;
139*4882a593Smuzhiyun };
140*4882a593Smuzhiyun 
141*4882a593Smuzhiyun struct kernel_ipmi_msg {
142*4882a593Smuzhiyun 	unsigned char  netfn;
143*4882a593Smuzhiyun 	unsigned char  cmd;
144*4882a593Smuzhiyun 	unsigned short data_len;
145*4882a593Smuzhiyun 	unsigned char  *data;
146*4882a593Smuzhiyun };
147*4882a593Smuzhiyun 
148*4882a593Smuzhiyun /*
149*4882a593Smuzhiyun  * Various defines that are useful for IPMI applications.
150*4882a593Smuzhiyun  */
151*4882a593Smuzhiyun #define IPMI_INVALID_CMD_COMPLETION_CODE	0xC1
152*4882a593Smuzhiyun #define IPMI_TIMEOUT_COMPLETION_CODE		0xC3
153*4882a593Smuzhiyun #define IPMI_UNKNOWN_ERR_COMPLETION_CODE	0xff
154*4882a593Smuzhiyun 
155*4882a593Smuzhiyun 
156*4882a593Smuzhiyun /*
157*4882a593Smuzhiyun  * Receive types for messages coming from the receive interface.  This
158*4882a593Smuzhiyun  * is used for the receive in-kernel interface and in the receive
159*4882a593Smuzhiyun  * IOCTL.
160*4882a593Smuzhiyun  *
161*4882a593Smuzhiyun  * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but
162*4882a593Smuzhiyun  * it allows you to get the message results when you send a response
163*4882a593Smuzhiyun  * message.
164*4882a593Smuzhiyun  */
165*4882a593Smuzhiyun #define IPMI_RESPONSE_RECV_TYPE		1 /* A response to a command */
166*4882a593Smuzhiyun #define IPMI_ASYNC_EVENT_RECV_TYPE	2 /* Something from the event queue */
167*4882a593Smuzhiyun #define IPMI_CMD_RECV_TYPE		3 /* A command from somewhere else */
168*4882a593Smuzhiyun #define IPMI_RESPONSE_RESPONSE_TYPE	4 /* The response for
169*4882a593Smuzhiyun 					      a sent response, giving any
170*4882a593Smuzhiyun 					      error status for sending the
171*4882a593Smuzhiyun 					      response.  When you send a
172*4882a593Smuzhiyun 					      response message, this will
173*4882a593Smuzhiyun 					      be returned. */
174*4882a593Smuzhiyun #define IPMI_OEM_RECV_TYPE		5 /* The response for OEM Channels */
175*4882a593Smuzhiyun 
176*4882a593Smuzhiyun /* Note that async events and received commands do not have a completion
177*4882a593Smuzhiyun    code as the first byte of the incoming data, unlike a response. */
178*4882a593Smuzhiyun 
179*4882a593Smuzhiyun 
180*4882a593Smuzhiyun /*
181*4882a593Smuzhiyun  * Modes for ipmi_set_maint_mode() and the userland IOCTL.  The AUTO
182*4882a593Smuzhiyun  * setting is the default and means it will be set on certain
183*4882a593Smuzhiyun  * commands.  Hard setting it on and off will override automatic
184*4882a593Smuzhiyun  * operation.
185*4882a593Smuzhiyun  */
186*4882a593Smuzhiyun #define IPMI_MAINTENANCE_MODE_AUTO	0
187*4882a593Smuzhiyun #define IPMI_MAINTENANCE_MODE_OFF	1
188*4882a593Smuzhiyun #define IPMI_MAINTENANCE_MODE_ON	2
189*4882a593Smuzhiyun 
190*4882a593Smuzhiyun 
191*4882a593Smuzhiyun 
192*4882a593Smuzhiyun /*
193*4882a593Smuzhiyun  * The userland interface
194*4882a593Smuzhiyun  */
195*4882a593Smuzhiyun 
196*4882a593Smuzhiyun /*
197*4882a593Smuzhiyun  * The userland interface for the IPMI driver is a standard character
198*4882a593Smuzhiyun  * device, with each instance of an interface registered as a minor
199*4882a593Smuzhiyun  * number under the major character device.
200*4882a593Smuzhiyun  *
201*4882a593Smuzhiyun  * The read and write calls do not work, to get messages in and out
202*4882a593Smuzhiyun  * requires ioctl calls because of the complexity of the data.  select
203*4882a593Smuzhiyun  * and poll do work, so you can wait for input using the file
204*4882a593Smuzhiyun  * descriptor, you just can use read to get it.
205*4882a593Smuzhiyun  *
206*4882a593Smuzhiyun  * In general, you send a command down to the interface and receive
207*4882a593Smuzhiyun  * responses back.  You can use the msgid value to correlate commands
208*4882a593Smuzhiyun  * and responses, the driver will take care of figuring out which
209*4882a593Smuzhiyun  * incoming messages are for which command and find the proper msgid
210*4882a593Smuzhiyun  * value to report.  You will only receive reponses for commands you
211*4882a593Smuzhiyun  * send.  Asynchronous events, however, go to all open users, so you
212*4882a593Smuzhiyun  * must be ready to handle these (or ignore them if you don't care).
213*4882a593Smuzhiyun  *
214*4882a593Smuzhiyun  * The address type depends upon the channel type.  When talking
215*4882a593Smuzhiyun  * directly to the BMC (IPMC_BMC_CHANNEL), the address is ignored
216*4882a593Smuzhiyun  * (IPMI_UNUSED_ADDR_TYPE).  When talking to an IPMB channel, you must
217*4882a593Smuzhiyun  * supply a valid IPMB address with the addr_type set properly.
218*4882a593Smuzhiyun  *
219*4882a593Smuzhiyun  * When talking to normal channels, the driver takes care of the
220*4882a593Smuzhiyun  * details of formatting and sending messages on that channel.  You do
221*4882a593Smuzhiyun  * not, for instance, have to format a send command, you just send
222*4882a593Smuzhiyun  * whatever command you want to the channel, the driver will create
223*4882a593Smuzhiyun  * the send command, automatically issue receive command and get even
224*4882a593Smuzhiyun  * commands, and pass those up to the proper user.
225*4882a593Smuzhiyun  */
226*4882a593Smuzhiyun 
227*4882a593Smuzhiyun 
228*4882a593Smuzhiyun /* The magic IOCTL value for this interface. */
229*4882a593Smuzhiyun #define IPMI_IOC_MAGIC 'i'
230*4882a593Smuzhiyun 
231*4882a593Smuzhiyun 
232*4882a593Smuzhiyun /* Messages sent to the interface are this format. */
233*4882a593Smuzhiyun struct ipmi_req {
234*4882a593Smuzhiyun 	unsigned char __user *addr; /* Address to send the message to. */
235*4882a593Smuzhiyun 	unsigned int  addr_len;
236*4882a593Smuzhiyun 
237*4882a593Smuzhiyun 	long    msgid; /* The sequence number for the message.  This
238*4882a593Smuzhiyun 			  exact value will be reported back in the
239*4882a593Smuzhiyun 			  response to this request if it is a command.
240*4882a593Smuzhiyun 			  If it is a response, this will be used as
241*4882a593Smuzhiyun 			  the sequence value for the response.  */
242*4882a593Smuzhiyun 
243*4882a593Smuzhiyun 	struct ipmi_msg msg;
244*4882a593Smuzhiyun };
245*4882a593Smuzhiyun /*
246*4882a593Smuzhiyun  * Send a message to the interfaces.  error values are:
247*4882a593Smuzhiyun  *   - EFAULT - an address supplied was invalid.
248*4882a593Smuzhiyun  *   - EINVAL - The address supplied was not valid, or the command
249*4882a593Smuzhiyun  *              was not allowed.
250*4882a593Smuzhiyun  *   - EMSGSIZE - The message to was too large.
251*4882a593Smuzhiyun  *   - ENOMEM - Buffers could not be allocated for the command.
252*4882a593Smuzhiyun  */
253*4882a593Smuzhiyun #define IPMICTL_SEND_COMMAND		_IOR(IPMI_IOC_MAGIC, 13,	\
254*4882a593Smuzhiyun 					     struct ipmi_req)
255*4882a593Smuzhiyun 
256*4882a593Smuzhiyun /* Messages sent to the interface with timing parameters are this
257*4882a593Smuzhiyun    format. */
258*4882a593Smuzhiyun struct ipmi_req_settime {
259*4882a593Smuzhiyun 	struct ipmi_req req;
260*4882a593Smuzhiyun 
261*4882a593Smuzhiyun 	/* See ipmi_request_settime() above for details on these
262*4882a593Smuzhiyun 	   values. */
263*4882a593Smuzhiyun 	int          retries;
264*4882a593Smuzhiyun 	unsigned int retry_time_ms;
265*4882a593Smuzhiyun };
266*4882a593Smuzhiyun /*
267*4882a593Smuzhiyun  * Send a message to the interfaces with timing parameters.  error values
268*4882a593Smuzhiyun  * are:
269*4882a593Smuzhiyun  *   - EFAULT - an address supplied was invalid.
270*4882a593Smuzhiyun  *   - EINVAL - The address supplied was not valid, or the command
271*4882a593Smuzhiyun  *              was not allowed.
272*4882a593Smuzhiyun  *   - EMSGSIZE - The message to was too large.
273*4882a593Smuzhiyun  *   - ENOMEM - Buffers could not be allocated for the command.
274*4882a593Smuzhiyun  */
275*4882a593Smuzhiyun #define IPMICTL_SEND_COMMAND_SETTIME	_IOR(IPMI_IOC_MAGIC, 21,	\
276*4882a593Smuzhiyun 					     struct ipmi_req_settime)
277*4882a593Smuzhiyun 
278*4882a593Smuzhiyun /* Messages received from the interface are this format. */
279*4882a593Smuzhiyun struct ipmi_recv {
280*4882a593Smuzhiyun 	int     recv_type; /* Is this a command, response or an
281*4882a593Smuzhiyun 			      asyncronous event. */
282*4882a593Smuzhiyun 
283*4882a593Smuzhiyun 	unsigned char __user *addr;    /* Address the message was from is put
284*4882a593Smuzhiyun 				   here.  The caller must supply the
285*4882a593Smuzhiyun 				   memory. */
286*4882a593Smuzhiyun 	unsigned int  addr_len; /* The size of the address buffer.
287*4882a593Smuzhiyun 				   The caller supplies the full buffer
288*4882a593Smuzhiyun 				   length, this value is updated to
289*4882a593Smuzhiyun 				   the actual message length when the
290*4882a593Smuzhiyun 				   message is received. */
291*4882a593Smuzhiyun 
292*4882a593Smuzhiyun 	long    msgid; /* The sequence number specified in the request
293*4882a593Smuzhiyun 			  if this is a response.  If this is a command,
294*4882a593Smuzhiyun 			  this will be the sequence number from the
295*4882a593Smuzhiyun 			  command. */
296*4882a593Smuzhiyun 
297*4882a593Smuzhiyun 	struct ipmi_msg msg; /* The data field must point to a buffer.
298*4882a593Smuzhiyun 				The data_size field must be set to the
299*4882a593Smuzhiyun 				size of the message buffer.  The
300*4882a593Smuzhiyun 				caller supplies the full buffer
301*4882a593Smuzhiyun 				length, this value is updated to the
302*4882a593Smuzhiyun 				actual message length when the message
303*4882a593Smuzhiyun 				is received. */
304*4882a593Smuzhiyun };
305*4882a593Smuzhiyun 
306*4882a593Smuzhiyun /*
307*4882a593Smuzhiyun  * Receive a message.  error values:
308*4882a593Smuzhiyun  *  - EAGAIN - no messages in the queue.
309*4882a593Smuzhiyun  *  - EFAULT - an address supplied was invalid.
310*4882a593Smuzhiyun  *  - EINVAL - The address supplied was not valid.
311*4882a593Smuzhiyun  *  - EMSGSIZE - The message to was too large to fit into the message buffer,
312*4882a593Smuzhiyun  *               the message will be left in the buffer. */
313*4882a593Smuzhiyun #define IPMICTL_RECEIVE_MSG		_IOWR(IPMI_IOC_MAGIC, 12,	\
314*4882a593Smuzhiyun 					      struct ipmi_recv)
315*4882a593Smuzhiyun 
316*4882a593Smuzhiyun /*
317*4882a593Smuzhiyun  * Like RECEIVE_MSG, but if the message won't fit in the buffer, it
318*4882a593Smuzhiyun  * will truncate the contents instead of leaving the data in the
319*4882a593Smuzhiyun  * buffer.
320*4882a593Smuzhiyun  */
321*4882a593Smuzhiyun #define IPMICTL_RECEIVE_MSG_TRUNC	_IOWR(IPMI_IOC_MAGIC, 11,	\
322*4882a593Smuzhiyun 					      struct ipmi_recv)
323*4882a593Smuzhiyun 
324*4882a593Smuzhiyun /* Register to get commands from other entities on this interface. */
325*4882a593Smuzhiyun struct ipmi_cmdspec {
326*4882a593Smuzhiyun 	unsigned char netfn;
327*4882a593Smuzhiyun 	unsigned char cmd;
328*4882a593Smuzhiyun };
329*4882a593Smuzhiyun 
330*4882a593Smuzhiyun /*
331*4882a593Smuzhiyun  * Register to receive a specific command.  error values:
332*4882a593Smuzhiyun  *   - EFAULT - an address supplied was invalid.
333*4882a593Smuzhiyun  *   - EBUSY - The netfn/cmd supplied was already in use.
334*4882a593Smuzhiyun  *   - ENOMEM - could not allocate memory for the entry.
335*4882a593Smuzhiyun  */
336*4882a593Smuzhiyun #define IPMICTL_REGISTER_FOR_CMD	_IOR(IPMI_IOC_MAGIC, 14,	\
337*4882a593Smuzhiyun 					     struct ipmi_cmdspec)
338*4882a593Smuzhiyun /*
339*4882a593Smuzhiyun  * Unregister a registered command.  error values:
340*4882a593Smuzhiyun  *  - EFAULT - an address supplied was invalid.
341*4882a593Smuzhiyun  *  - ENOENT - The netfn/cmd was not found registered for this user.
342*4882a593Smuzhiyun  */
343*4882a593Smuzhiyun #define IPMICTL_UNREGISTER_FOR_CMD	_IOR(IPMI_IOC_MAGIC, 15,	\
344*4882a593Smuzhiyun 					     struct ipmi_cmdspec)
345*4882a593Smuzhiyun 
346*4882a593Smuzhiyun /*
347*4882a593Smuzhiyun  * Register to get commands from other entities on specific channels.
348*4882a593Smuzhiyun  * This way, you can only listen on specific channels, or have messages
349*4882a593Smuzhiyun  * from some channels go to one place and other channels to someplace
350*4882a593Smuzhiyun  * else.  The chans field is a bitmask, (1 << channel) for each channel.
351*4882a593Smuzhiyun  * It may be IPMI_CHAN_ALL for all channels.
352*4882a593Smuzhiyun  */
353*4882a593Smuzhiyun struct ipmi_cmdspec_chans {
354*4882a593Smuzhiyun 	unsigned int netfn;
355*4882a593Smuzhiyun 	unsigned int cmd;
356*4882a593Smuzhiyun 	unsigned int chans;
357*4882a593Smuzhiyun };
358*4882a593Smuzhiyun 
359*4882a593Smuzhiyun /*
360*4882a593Smuzhiyun  * Register to receive a specific command on specific channels.  error values:
361*4882a593Smuzhiyun  *   - EFAULT - an address supplied was invalid.
362*4882a593Smuzhiyun  *   - EBUSY - One of the netfn/cmd/chans supplied was already in use.
363*4882a593Smuzhiyun  *   - ENOMEM - could not allocate memory for the entry.
364*4882a593Smuzhiyun  */
365*4882a593Smuzhiyun #define IPMICTL_REGISTER_FOR_CMD_CHANS	_IOR(IPMI_IOC_MAGIC, 28,	\
366*4882a593Smuzhiyun 					     struct ipmi_cmdspec_chans)
367*4882a593Smuzhiyun /*
368*4882a593Smuzhiyun  * Unregister some netfn/cmd/chans.  error values:
369*4882a593Smuzhiyun  *  - EFAULT - an address supplied was invalid.
370*4882a593Smuzhiyun  *  - ENOENT - None of the netfn/cmd/chans were found registered for this user.
371*4882a593Smuzhiyun  */
372*4882a593Smuzhiyun #define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29,	\
373*4882a593Smuzhiyun 					     struct ipmi_cmdspec_chans)
374*4882a593Smuzhiyun 
375*4882a593Smuzhiyun /*
376*4882a593Smuzhiyun  * Set whether this interface receives events.  Note that the first
377*4882a593Smuzhiyun  * user registered for events will get all pending events for the
378*4882a593Smuzhiyun  * interface.  error values:
379*4882a593Smuzhiyun  *  - EFAULT - an address supplied was invalid.
380*4882a593Smuzhiyun  */
381*4882a593Smuzhiyun #define IPMICTL_SET_GETS_EVENTS_CMD	_IOR(IPMI_IOC_MAGIC, 16, int)
382*4882a593Smuzhiyun 
383*4882a593Smuzhiyun /*
384*4882a593Smuzhiyun  * Set and get the slave address and LUN that we will use for our
385*4882a593Smuzhiyun  * source messages.  Note that this affects the interface, not just
386*4882a593Smuzhiyun  * this user, so it will affect all users of this interface.  This is
387*4882a593Smuzhiyun  * so some initialization code can come in and do the OEM-specific
388*4882a593Smuzhiyun  * things it takes to determine your address (if not the BMC) and set
389*4882a593Smuzhiyun  * it for everyone else.  You should probably leave the LUN alone.
390*4882a593Smuzhiyun  */
391*4882a593Smuzhiyun struct ipmi_channel_lun_address_set {
392*4882a593Smuzhiyun 	unsigned short channel;
393*4882a593Smuzhiyun 	unsigned char  value;
394*4882a593Smuzhiyun };
395*4882a593Smuzhiyun #define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \
396*4882a593Smuzhiyun 	_IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
397*4882a593Smuzhiyun #define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \
398*4882a593Smuzhiyun 	_IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
399*4882a593Smuzhiyun #define IPMICTL_SET_MY_CHANNEL_LUN_CMD \
400*4882a593Smuzhiyun 	_IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
401*4882a593Smuzhiyun #define IPMICTL_GET_MY_CHANNEL_LUN_CMD \
402*4882a593Smuzhiyun 	_IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
403*4882a593Smuzhiyun /* Legacy interfaces, these only set IPMB 0. */
404*4882a593Smuzhiyun #define IPMICTL_SET_MY_ADDRESS_CMD	_IOR(IPMI_IOC_MAGIC, 17, unsigned int)
405*4882a593Smuzhiyun #define IPMICTL_GET_MY_ADDRESS_CMD	_IOR(IPMI_IOC_MAGIC, 18, unsigned int)
406*4882a593Smuzhiyun #define IPMICTL_SET_MY_LUN_CMD		_IOR(IPMI_IOC_MAGIC, 19, unsigned int)
407*4882a593Smuzhiyun #define IPMICTL_GET_MY_LUN_CMD		_IOR(IPMI_IOC_MAGIC, 20, unsigned int)
408*4882a593Smuzhiyun 
409*4882a593Smuzhiyun /*
410*4882a593Smuzhiyun  * Get/set the default timing values for an interface.  You shouldn't
411*4882a593Smuzhiyun  * generally mess with these.
412*4882a593Smuzhiyun  */
413*4882a593Smuzhiyun struct ipmi_timing_parms {
414*4882a593Smuzhiyun 	int          retries;
415*4882a593Smuzhiyun 	unsigned int retry_time_ms;
416*4882a593Smuzhiyun };
417*4882a593Smuzhiyun #define IPMICTL_SET_TIMING_PARMS_CMD	_IOR(IPMI_IOC_MAGIC, 22, \
418*4882a593Smuzhiyun 					     struct ipmi_timing_parms)
419*4882a593Smuzhiyun #define IPMICTL_GET_TIMING_PARMS_CMD	_IOR(IPMI_IOC_MAGIC, 23, \
420*4882a593Smuzhiyun 					     struct ipmi_timing_parms)
421*4882a593Smuzhiyun 
422*4882a593Smuzhiyun /*
423*4882a593Smuzhiyun  * Set the maintenance mode.  See ipmi_set_maintenance_mode() above
424*4882a593Smuzhiyun  * for a description of what this does.
425*4882a593Smuzhiyun  */
426*4882a593Smuzhiyun #define IPMICTL_GET_MAINTENANCE_MODE_CMD	_IOR(IPMI_IOC_MAGIC, 30, int)
427*4882a593Smuzhiyun #define IPMICTL_SET_MAINTENANCE_MODE_CMD	_IOW(IPMI_IOC_MAGIC, 31, int)
428*4882a593Smuzhiyun 
429*4882a593Smuzhiyun #endif /* _UAPI__LINUX_IPMI_H */
430