xref: /openbmc/linux/include/uapi/linux/ipmi.h (revision 607ca46e)
1607ca46eSDavid Howells /*
2607ca46eSDavid Howells  * ipmi.h
3607ca46eSDavid Howells  *
4607ca46eSDavid Howells  * MontaVista IPMI interface
5607ca46eSDavid Howells  *
6607ca46eSDavid Howells  * Author: MontaVista Software, Inc.
7607ca46eSDavid Howells  *         Corey Minyard <minyard@mvista.com>
8607ca46eSDavid Howells  *         source@mvista.com
9607ca46eSDavid Howells  *
10607ca46eSDavid Howells  * Copyright 2002 MontaVista Software Inc.
11607ca46eSDavid Howells  *
12607ca46eSDavid Howells  *  This program is free software; you can redistribute it and/or modify it
13607ca46eSDavid Howells  *  under the terms of the GNU General Public License as published by the
14607ca46eSDavid Howells  *  Free Software Foundation; either version 2 of the License, or (at your
15607ca46eSDavid Howells  *  option) any later version.
16607ca46eSDavid Howells  *
17607ca46eSDavid Howells  *
18607ca46eSDavid Howells  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19607ca46eSDavid Howells  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20607ca46eSDavid Howells  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21607ca46eSDavid Howells  *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22607ca46eSDavid Howells  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23607ca46eSDavid Howells  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24607ca46eSDavid Howells  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25607ca46eSDavid Howells  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26607ca46eSDavid Howells  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27607ca46eSDavid Howells  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28607ca46eSDavid Howells  *
29607ca46eSDavid Howells  *  You should have received a copy of the GNU General Public License along
30607ca46eSDavid Howells  *  with this program; if not, write to the Free Software Foundation, Inc.,
31607ca46eSDavid Howells  *  675 Mass Ave, Cambridge, MA 02139, USA.
32607ca46eSDavid Howells  */
33607ca46eSDavid Howells 
34607ca46eSDavid Howells #ifndef _UAPI__LINUX_IPMI_H
35607ca46eSDavid Howells #define _UAPI__LINUX_IPMI_H
36607ca46eSDavid Howells 
37607ca46eSDavid Howells #include <linux/ipmi_msgdefs.h>
38607ca46eSDavid Howells #include <linux/compiler.h>
39607ca46eSDavid Howells 
40607ca46eSDavid Howells /*
41607ca46eSDavid Howells  * This file describes an interface to an IPMI driver.  You have to
42607ca46eSDavid Howells  * have a fairly good understanding of IPMI to use this, so go read
43607ca46eSDavid Howells  * the specs first before actually trying to do anything.
44607ca46eSDavid Howells  *
45607ca46eSDavid Howells  * With that said, this driver provides a multi-user interface to the
46607ca46eSDavid Howells  * IPMI driver, and it allows multiple IPMI physical interfaces below
47607ca46eSDavid Howells  * the driver.  The physical interfaces bind as a lower layer on the
48607ca46eSDavid Howells  * driver.  They appear as interfaces to the application using this
49607ca46eSDavid Howells  * interface.
50607ca46eSDavid Howells  *
51607ca46eSDavid Howells  * Multi-user means that multiple applications may use the driver,
52607ca46eSDavid Howells  * send commands, receive responses, etc.  The driver keeps track of
53607ca46eSDavid Howells  * commands the user sends and tracks the responses.  The responses
54607ca46eSDavid Howells  * will go back to the application that send the command.  If the
55607ca46eSDavid Howells  * response doesn't come back in time, the driver will return a
56607ca46eSDavid Howells  * timeout error response to the application.  Asynchronous events
57607ca46eSDavid Howells  * from the BMC event queue will go to all users bound to the driver.
58607ca46eSDavid Howells  * The incoming event queue in the BMC will automatically be flushed
59607ca46eSDavid Howells  * if it becomes full and it is queried once a second to see if
60607ca46eSDavid Howells  * anything is in it.  Incoming commands to the driver will get
61607ca46eSDavid Howells  * delivered as commands.
62607ca46eSDavid Howells  *
63607ca46eSDavid Howells  * This driver provides two main interfaces: one for in-kernel
64607ca46eSDavid Howells  * applications and another for userland applications.  The
65607ca46eSDavid Howells  * capabilities are basically the same for both interface, although
66607ca46eSDavid Howells  * the interfaces are somewhat different.  The stuff in the
67607ca46eSDavid Howells  * #ifdef __KERNEL__ below is the in-kernel interface.  The userland
68607ca46eSDavid Howells  * interface is defined later in the file.  */
69607ca46eSDavid Howells 
70607ca46eSDavid Howells 
71607ca46eSDavid Howells 
72607ca46eSDavid Howells /*
73607ca46eSDavid Howells  * This is an overlay for all the address types, so it's easy to
74607ca46eSDavid Howells  * determine the actual address type.  This is kind of like addresses
75607ca46eSDavid Howells  * work for sockets.
76607ca46eSDavid Howells  */
77607ca46eSDavid Howells #define IPMI_MAX_ADDR_SIZE 32
78607ca46eSDavid Howells struct ipmi_addr {
79607ca46eSDavid Howells 	 /* Try to take these from the "Channel Medium Type" table
80607ca46eSDavid Howells 	    in section 6.5 of the IPMI 1.5 manual. */
81607ca46eSDavid Howells 	int   addr_type;
82607ca46eSDavid Howells 	short channel;
83607ca46eSDavid Howells 	char  data[IPMI_MAX_ADDR_SIZE];
84607ca46eSDavid Howells };
85607ca46eSDavid Howells 
86607ca46eSDavid Howells /*
87607ca46eSDavid Howells  * When the address is not used, the type will be set to this value.
88607ca46eSDavid Howells  * The channel is the BMC's channel number for the channel (usually
89607ca46eSDavid Howells  * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC.
90607ca46eSDavid Howells  */
91607ca46eSDavid Howells #define IPMI_SYSTEM_INTERFACE_ADDR_TYPE	0x0c
92607ca46eSDavid Howells struct ipmi_system_interface_addr {
93607ca46eSDavid Howells 	int           addr_type;
94607ca46eSDavid Howells 	short         channel;
95607ca46eSDavid Howells 	unsigned char lun;
96607ca46eSDavid Howells };
97607ca46eSDavid Howells 
98607ca46eSDavid Howells /* An IPMB Address. */
99607ca46eSDavid Howells #define IPMI_IPMB_ADDR_TYPE		0x01
100607ca46eSDavid Howells /* Used for broadcast get device id as described in section 17.9 of the
101607ca46eSDavid Howells    IPMI 1.5 manual. */
102607ca46eSDavid Howells #define IPMI_IPMB_BROADCAST_ADDR_TYPE	0x41
103607ca46eSDavid Howells struct ipmi_ipmb_addr {
104607ca46eSDavid Howells 	int           addr_type;
105607ca46eSDavid Howells 	short         channel;
106607ca46eSDavid Howells 	unsigned char slave_addr;
107607ca46eSDavid Howells 	unsigned char lun;
108607ca46eSDavid Howells };
109607ca46eSDavid Howells 
110607ca46eSDavid Howells /*
111607ca46eSDavid Howells  * A LAN Address.  This is an address to/from a LAN interface bridged
112607ca46eSDavid Howells  * by the BMC, not an address actually out on the LAN.
113607ca46eSDavid Howells  *
114607ca46eSDavid Howells  * A conscious decision was made here to deviate slightly from the IPMI
115607ca46eSDavid Howells  * spec.  We do not use rqSWID and rsSWID like it shows in the
116607ca46eSDavid Howells  * message.  Instead, we use remote_SWID and local_SWID.  This means
117607ca46eSDavid Howells  * that any message (a request or response) from another device will
118607ca46eSDavid Howells  * always have exactly the same address.  If you didn't do this,
119607ca46eSDavid Howells  * requests and responses from the same device would have different
120607ca46eSDavid Howells  * addresses, and that's not too cool.
121607ca46eSDavid Howells  *
122607ca46eSDavid Howells  * In this address, the remote_SWID is always the SWID the remote
123607ca46eSDavid Howells  * message came from, or the SWID we are sending the message to.
124607ca46eSDavid Howells  * local_SWID is always our SWID.  Note that having our SWID in the
125607ca46eSDavid Howells  * message is a little weird, but this is required.
126607ca46eSDavid Howells  */
127607ca46eSDavid Howells #define IPMI_LAN_ADDR_TYPE		0x04
128607ca46eSDavid Howells struct ipmi_lan_addr {
129607ca46eSDavid Howells 	int           addr_type;
130607ca46eSDavid Howells 	short         channel;
131607ca46eSDavid Howells 	unsigned char privilege;
132607ca46eSDavid Howells 	unsigned char session_handle;
133607ca46eSDavid Howells 	unsigned char remote_SWID;
134607ca46eSDavid Howells 	unsigned char local_SWID;
135607ca46eSDavid Howells 	unsigned char lun;
136607ca46eSDavid Howells };
137607ca46eSDavid Howells 
138607ca46eSDavid Howells 
139607ca46eSDavid Howells /*
140607ca46eSDavid Howells  * Channel for talking directly with the BMC.  When using this
141607ca46eSDavid Howells  * channel, This is for the system interface address type only.  FIXME
142607ca46eSDavid Howells  * - is this right, or should we use -1?
143607ca46eSDavid Howells  */
144607ca46eSDavid Howells #define IPMI_BMC_CHANNEL  0xf
145607ca46eSDavid Howells #define IPMI_NUM_CHANNELS 0x10
146607ca46eSDavid Howells 
147607ca46eSDavid Howells /*
148607ca46eSDavid Howells  * Used to signify an "all channel" bitmask.  This is more than the
149607ca46eSDavid Howells  * actual number of channels because this is used in userland and
150607ca46eSDavid Howells  * will cover us if the number of channels is extended.
151607ca46eSDavid Howells  */
152607ca46eSDavid Howells #define IPMI_CHAN_ALL     (~0)
153607ca46eSDavid Howells 
154607ca46eSDavid Howells 
155607ca46eSDavid Howells /*
156607ca46eSDavid Howells  * A raw IPMI message without any addressing.  This covers both
157607ca46eSDavid Howells  * commands and responses.  The completion code is always the first
158607ca46eSDavid Howells  * byte of data in the response (as the spec shows the messages laid
159607ca46eSDavid Howells  * out).
160607ca46eSDavid Howells  */
161607ca46eSDavid Howells struct ipmi_msg {
162607ca46eSDavid Howells 	unsigned char  netfn;
163607ca46eSDavid Howells 	unsigned char  cmd;
164607ca46eSDavid Howells 	unsigned short data_len;
165607ca46eSDavid Howells 	unsigned char  __user *data;
166607ca46eSDavid Howells };
167607ca46eSDavid Howells 
168607ca46eSDavid Howells struct kernel_ipmi_msg {
169607ca46eSDavid Howells 	unsigned char  netfn;
170607ca46eSDavid Howells 	unsigned char  cmd;
171607ca46eSDavid Howells 	unsigned short data_len;
172607ca46eSDavid Howells 	unsigned char  *data;
173607ca46eSDavid Howells };
174607ca46eSDavid Howells 
175607ca46eSDavid Howells /*
176607ca46eSDavid Howells  * Various defines that are useful for IPMI applications.
177607ca46eSDavid Howells  */
178607ca46eSDavid Howells #define IPMI_INVALID_CMD_COMPLETION_CODE	0xC1
179607ca46eSDavid Howells #define IPMI_TIMEOUT_COMPLETION_CODE		0xC3
180607ca46eSDavid Howells #define IPMI_UNKNOWN_ERR_COMPLETION_CODE	0xff
181607ca46eSDavid Howells 
182607ca46eSDavid Howells 
183607ca46eSDavid Howells /*
184607ca46eSDavid Howells  * Receive types for messages coming from the receive interface.  This
185607ca46eSDavid Howells  * is used for the receive in-kernel interface and in the receive
186607ca46eSDavid Howells  * IOCTL.
187607ca46eSDavid Howells  *
188607ca46eSDavid Howells  * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but
189607ca46eSDavid Howells  * it allows you to get the message results when you send a response
190607ca46eSDavid Howells  * message.
191607ca46eSDavid Howells  */
192607ca46eSDavid Howells #define IPMI_RESPONSE_RECV_TYPE		1 /* A response to a command */
193607ca46eSDavid Howells #define IPMI_ASYNC_EVENT_RECV_TYPE	2 /* Something from the event queue */
194607ca46eSDavid Howells #define IPMI_CMD_RECV_TYPE		3 /* A command from somewhere else */
195607ca46eSDavid Howells #define IPMI_RESPONSE_RESPONSE_TYPE	4 /* The response for
196607ca46eSDavid Howells 					      a sent response, giving any
197607ca46eSDavid Howells 					      error status for sending the
198607ca46eSDavid Howells 					      response.  When you send a
199607ca46eSDavid Howells 					      response message, this will
200607ca46eSDavid Howells 					      be returned. */
201607ca46eSDavid Howells #define IPMI_OEM_RECV_TYPE		5 /* The response for OEM Channels */
202607ca46eSDavid Howells 
203607ca46eSDavid Howells /* Note that async events and received commands do not have a completion
204607ca46eSDavid Howells    code as the first byte of the incoming data, unlike a response. */
205607ca46eSDavid Howells 
206607ca46eSDavid Howells 
207607ca46eSDavid Howells /*
208607ca46eSDavid Howells  * Modes for ipmi_set_maint_mode() and the userland IOCTL.  The AUTO
209607ca46eSDavid Howells  * setting is the default and means it will be set on certain
210607ca46eSDavid Howells  * commands.  Hard setting it on and off will override automatic
211607ca46eSDavid Howells  * operation.
212607ca46eSDavid Howells  */
213607ca46eSDavid Howells #define IPMI_MAINTENANCE_MODE_AUTO	0
214607ca46eSDavid Howells #define IPMI_MAINTENANCE_MODE_OFF	1
215607ca46eSDavid Howells #define IPMI_MAINTENANCE_MODE_ON	2
216607ca46eSDavid Howells 
217607ca46eSDavid Howells 
218607ca46eSDavid Howells 
219607ca46eSDavid Howells /*
220607ca46eSDavid Howells  * The userland interface
221607ca46eSDavid Howells  */
222607ca46eSDavid Howells 
223607ca46eSDavid Howells /*
224607ca46eSDavid Howells  * The userland interface for the IPMI driver is a standard character
225607ca46eSDavid Howells  * device, with each instance of an interface registered as a minor
226607ca46eSDavid Howells  * number under the major character device.
227607ca46eSDavid Howells  *
228607ca46eSDavid Howells  * The read and write calls do not work, to get messages in and out
229607ca46eSDavid Howells  * requires ioctl calls because of the complexity of the data.  select
230607ca46eSDavid Howells  * and poll do work, so you can wait for input using the file
231607ca46eSDavid Howells  * descriptor, you just can use read to get it.
232607ca46eSDavid Howells  *
233607ca46eSDavid Howells  * In general, you send a command down to the interface and receive
234607ca46eSDavid Howells  * responses back.  You can use the msgid value to correlate commands
235607ca46eSDavid Howells  * and responses, the driver will take care of figuring out which
236607ca46eSDavid Howells  * incoming messages are for which command and find the proper msgid
237607ca46eSDavid Howells  * value to report.  You will only receive reponses for commands you
238607ca46eSDavid Howells  * send.  Asynchronous events, however, go to all open users, so you
239607ca46eSDavid Howells  * must be ready to handle these (or ignore them if you don't care).
240607ca46eSDavid Howells  *
241607ca46eSDavid Howells  * The address type depends upon the channel type.  When talking
242607ca46eSDavid Howells  * directly to the BMC (IPMC_BMC_CHANNEL), the address is ignored
243607ca46eSDavid Howells  * (IPMI_UNUSED_ADDR_TYPE).  When talking to an IPMB channel, you must
244607ca46eSDavid Howells  * supply a valid IPMB address with the addr_type set properly.
245607ca46eSDavid Howells  *
246607ca46eSDavid Howells  * When talking to normal channels, the driver takes care of the
247607ca46eSDavid Howells  * details of formatting and sending messages on that channel.  You do
248607ca46eSDavid Howells  * not, for instance, have to format a send command, you just send
249607ca46eSDavid Howells  * whatever command you want to the channel, the driver will create
250607ca46eSDavid Howells  * the send command, automatically issue receive command and get even
251607ca46eSDavid Howells  * commands, and pass those up to the proper user.
252607ca46eSDavid Howells  */
253607ca46eSDavid Howells 
254607ca46eSDavid Howells 
255607ca46eSDavid Howells /* The magic IOCTL value for this interface. */
256607ca46eSDavid Howells #define IPMI_IOC_MAGIC 'i'
257607ca46eSDavid Howells 
258607ca46eSDavid Howells 
259607ca46eSDavid Howells /* Messages sent to the interface are this format. */
260607ca46eSDavid Howells struct ipmi_req {
261607ca46eSDavid Howells 	unsigned char __user *addr; /* Address to send the message to. */
262607ca46eSDavid Howells 	unsigned int  addr_len;
263607ca46eSDavid Howells 
264607ca46eSDavid Howells 	long    msgid; /* The sequence number for the message.  This
265607ca46eSDavid Howells 			  exact value will be reported back in the
266607ca46eSDavid Howells 			  response to this request if it is a command.
267607ca46eSDavid Howells 			  If it is a response, this will be used as
268607ca46eSDavid Howells 			  the sequence value for the response.  */
269607ca46eSDavid Howells 
270607ca46eSDavid Howells 	struct ipmi_msg msg;
271607ca46eSDavid Howells };
272607ca46eSDavid Howells /*
273607ca46eSDavid Howells  * Send a message to the interfaces.  error values are:
274607ca46eSDavid Howells  *   - EFAULT - an address supplied was invalid.
275607ca46eSDavid Howells  *   - EINVAL - The address supplied was not valid, or the command
276607ca46eSDavid Howells  *              was not allowed.
277607ca46eSDavid Howells  *   - EMSGSIZE - The message to was too large.
278607ca46eSDavid Howells  *   - ENOMEM - Buffers could not be allocated for the command.
279607ca46eSDavid Howells  */
280607ca46eSDavid Howells #define IPMICTL_SEND_COMMAND		_IOR(IPMI_IOC_MAGIC, 13,	\
281607ca46eSDavid Howells 					     struct ipmi_req)
282607ca46eSDavid Howells 
283607ca46eSDavid Howells /* Messages sent to the interface with timing parameters are this
284607ca46eSDavid Howells    format. */
285607ca46eSDavid Howells struct ipmi_req_settime {
286607ca46eSDavid Howells 	struct ipmi_req req;
287607ca46eSDavid Howells 
288607ca46eSDavid Howells 	/* See ipmi_request_settime() above for details on these
289607ca46eSDavid Howells 	   values. */
290607ca46eSDavid Howells 	int          retries;
291607ca46eSDavid Howells 	unsigned int retry_time_ms;
292607ca46eSDavid Howells };
293607ca46eSDavid Howells /*
294607ca46eSDavid Howells  * Send a message to the interfaces with timing parameters.  error values
295607ca46eSDavid Howells  * are:
296607ca46eSDavid Howells  *   - EFAULT - an address supplied was invalid.
297607ca46eSDavid Howells  *   - EINVAL - The address supplied was not valid, or the command
298607ca46eSDavid Howells  *              was not allowed.
299607ca46eSDavid Howells  *   - EMSGSIZE - The message to was too large.
300607ca46eSDavid Howells  *   - ENOMEM - Buffers could not be allocated for the command.
301607ca46eSDavid Howells  */
302607ca46eSDavid Howells #define IPMICTL_SEND_COMMAND_SETTIME	_IOR(IPMI_IOC_MAGIC, 21,	\
303607ca46eSDavid Howells 					     struct ipmi_req_settime)
304607ca46eSDavid Howells 
305607ca46eSDavid Howells /* Messages received from the interface are this format. */
306607ca46eSDavid Howells struct ipmi_recv {
307607ca46eSDavid Howells 	int     recv_type; /* Is this a command, response or an
308607ca46eSDavid Howells 			      asyncronous event. */
309607ca46eSDavid Howells 
310607ca46eSDavid Howells 	unsigned char __user *addr;    /* Address the message was from is put
311607ca46eSDavid Howells 				   here.  The caller must supply the
312607ca46eSDavid Howells 				   memory. */
313607ca46eSDavid Howells 	unsigned int  addr_len; /* The size of the address buffer.
314607ca46eSDavid Howells 				   The caller supplies the full buffer
315607ca46eSDavid Howells 				   length, this value is updated to
316607ca46eSDavid Howells 				   the actual message length when the
317607ca46eSDavid Howells 				   message is received. */
318607ca46eSDavid Howells 
319607ca46eSDavid Howells 	long    msgid; /* The sequence number specified in the request
320607ca46eSDavid Howells 			  if this is a response.  If this is a command,
321607ca46eSDavid Howells 			  this will be the sequence number from the
322607ca46eSDavid Howells 			  command. */
323607ca46eSDavid Howells 
324607ca46eSDavid Howells 	struct ipmi_msg msg; /* The data field must point to a buffer.
325607ca46eSDavid Howells 				The data_size field must be set to the
326607ca46eSDavid Howells 				size of the message buffer.  The
327607ca46eSDavid Howells 				caller supplies the full buffer
328607ca46eSDavid Howells 				length, this value is updated to the
329607ca46eSDavid Howells 				actual message length when the message
330607ca46eSDavid Howells 				is received. */
331607ca46eSDavid Howells };
332607ca46eSDavid Howells 
333607ca46eSDavid Howells /*
334607ca46eSDavid Howells  * Receive a message.  error values:
335607ca46eSDavid Howells  *  - EAGAIN - no messages in the queue.
336607ca46eSDavid Howells  *  - EFAULT - an address supplied was invalid.
337607ca46eSDavid Howells  *  - EINVAL - The address supplied was not valid.
338607ca46eSDavid Howells  *  - EMSGSIZE - The message to was too large to fit into the message buffer,
339607ca46eSDavid Howells  *               the message will be left in the buffer. */
340607ca46eSDavid Howells #define IPMICTL_RECEIVE_MSG		_IOWR(IPMI_IOC_MAGIC, 12,	\
341607ca46eSDavid Howells 					      struct ipmi_recv)
342607ca46eSDavid Howells 
343607ca46eSDavid Howells /*
344607ca46eSDavid Howells  * Like RECEIVE_MSG, but if the message won't fit in the buffer, it
345607ca46eSDavid Howells  * will truncate the contents instead of leaving the data in the
346607ca46eSDavid Howells  * buffer.
347607ca46eSDavid Howells  */
348607ca46eSDavid Howells #define IPMICTL_RECEIVE_MSG_TRUNC	_IOWR(IPMI_IOC_MAGIC, 11,	\
349607ca46eSDavid Howells 					      struct ipmi_recv)
350607ca46eSDavid Howells 
351607ca46eSDavid Howells /* Register to get commands from other entities on this interface. */
352607ca46eSDavid Howells struct ipmi_cmdspec {
353607ca46eSDavid Howells 	unsigned char netfn;
354607ca46eSDavid Howells 	unsigned char cmd;
355607ca46eSDavid Howells };
356607ca46eSDavid Howells 
357607ca46eSDavid Howells /*
358607ca46eSDavid Howells  * Register to receive a specific command.  error values:
359607ca46eSDavid Howells  *   - EFAULT - an address supplied was invalid.
360607ca46eSDavid Howells  *   - EBUSY - The netfn/cmd supplied was already in use.
361607ca46eSDavid Howells  *   - ENOMEM - could not allocate memory for the entry.
362607ca46eSDavid Howells  */
363607ca46eSDavid Howells #define IPMICTL_REGISTER_FOR_CMD	_IOR(IPMI_IOC_MAGIC, 14,	\
364607ca46eSDavid Howells 					     struct ipmi_cmdspec)
365607ca46eSDavid Howells /*
366607ca46eSDavid Howells  * Unregister a regsitered command.  error values:
367607ca46eSDavid Howells  *  - EFAULT - an address supplied was invalid.
368607ca46eSDavid Howells  *  - ENOENT - The netfn/cmd was not found registered for this user.
369607ca46eSDavid Howells  */
370607ca46eSDavid Howells #define IPMICTL_UNREGISTER_FOR_CMD	_IOR(IPMI_IOC_MAGIC, 15,	\
371607ca46eSDavid Howells 					     struct ipmi_cmdspec)
372607ca46eSDavid Howells 
373607ca46eSDavid Howells /*
374607ca46eSDavid Howells  * Register to get commands from other entities on specific channels.
375607ca46eSDavid Howells  * This way, you can only listen on specific channels, or have messages
376607ca46eSDavid Howells  * from some channels go to one place and other channels to someplace
377607ca46eSDavid Howells  * else.  The chans field is a bitmask, (1 << channel) for each channel.
378607ca46eSDavid Howells  * It may be IPMI_CHAN_ALL for all channels.
379607ca46eSDavid Howells  */
380607ca46eSDavid Howells struct ipmi_cmdspec_chans {
381607ca46eSDavid Howells 	unsigned int netfn;
382607ca46eSDavid Howells 	unsigned int cmd;
383607ca46eSDavid Howells 	unsigned int chans;
384607ca46eSDavid Howells };
385607ca46eSDavid Howells 
386607ca46eSDavid Howells /*
387607ca46eSDavid Howells  * Register to receive a specific command on specific channels.  error values:
388607ca46eSDavid Howells  *   - EFAULT - an address supplied was invalid.
389607ca46eSDavid Howells  *   - EBUSY - One of the netfn/cmd/chans supplied was already in use.
390607ca46eSDavid Howells  *   - ENOMEM - could not allocate memory for the entry.
391607ca46eSDavid Howells  */
392607ca46eSDavid Howells #define IPMICTL_REGISTER_FOR_CMD_CHANS	_IOR(IPMI_IOC_MAGIC, 28,	\
393607ca46eSDavid Howells 					     struct ipmi_cmdspec_chans)
394607ca46eSDavid Howells /*
395607ca46eSDavid Howells  * Unregister some netfn/cmd/chans.  error values:
396607ca46eSDavid Howells  *  - EFAULT - an address supplied was invalid.
397607ca46eSDavid Howells  *  - ENOENT - None of the netfn/cmd/chans were found registered for this user.
398607ca46eSDavid Howells  */
399607ca46eSDavid Howells #define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29,	\
400607ca46eSDavid Howells 					     struct ipmi_cmdspec_chans)
401607ca46eSDavid Howells 
402607ca46eSDavid Howells /*
403607ca46eSDavid Howells  * Set whether this interface receives events.  Note that the first
404607ca46eSDavid Howells  * user registered for events will get all pending events for the
405607ca46eSDavid Howells  * interface.  error values:
406607ca46eSDavid Howells  *  - EFAULT - an address supplied was invalid.
407607ca46eSDavid Howells  */
408607ca46eSDavid Howells #define IPMICTL_SET_GETS_EVENTS_CMD	_IOR(IPMI_IOC_MAGIC, 16, int)
409607ca46eSDavid Howells 
410607ca46eSDavid Howells /*
411607ca46eSDavid Howells  * Set and get the slave address and LUN that we will use for our
412607ca46eSDavid Howells  * source messages.  Note that this affects the interface, not just
413607ca46eSDavid Howells  * this user, so it will affect all users of this interface.  This is
414607ca46eSDavid Howells  * so some initialization code can come in and do the OEM-specific
415607ca46eSDavid Howells  * things it takes to determine your address (if not the BMC) and set
416607ca46eSDavid Howells  * it for everyone else.  You should probably leave the LUN alone.
417607ca46eSDavid Howells  */
418607ca46eSDavid Howells struct ipmi_channel_lun_address_set {
419607ca46eSDavid Howells 	unsigned short channel;
420607ca46eSDavid Howells 	unsigned char  value;
421607ca46eSDavid Howells };
422607ca46eSDavid Howells #define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \
423607ca46eSDavid Howells 	_IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
424607ca46eSDavid Howells #define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \
425607ca46eSDavid Howells 	_IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
426607ca46eSDavid Howells #define IPMICTL_SET_MY_CHANNEL_LUN_CMD \
427607ca46eSDavid Howells 	_IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
428607ca46eSDavid Howells #define IPMICTL_GET_MY_CHANNEL_LUN_CMD \
429607ca46eSDavid Howells 	_IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
430607ca46eSDavid Howells /* Legacy interfaces, these only set IPMB 0. */
431607ca46eSDavid Howells #define IPMICTL_SET_MY_ADDRESS_CMD	_IOR(IPMI_IOC_MAGIC, 17, unsigned int)
432607ca46eSDavid Howells #define IPMICTL_GET_MY_ADDRESS_CMD	_IOR(IPMI_IOC_MAGIC, 18, unsigned int)
433607ca46eSDavid Howells #define IPMICTL_SET_MY_LUN_CMD		_IOR(IPMI_IOC_MAGIC, 19, unsigned int)
434607ca46eSDavid Howells #define IPMICTL_GET_MY_LUN_CMD		_IOR(IPMI_IOC_MAGIC, 20, unsigned int)
435607ca46eSDavid Howells 
436607ca46eSDavid Howells /*
437607ca46eSDavid Howells  * Get/set the default timing values for an interface.  You shouldn't
438607ca46eSDavid Howells  * generally mess with these.
439607ca46eSDavid Howells  */
440607ca46eSDavid Howells struct ipmi_timing_parms {
441607ca46eSDavid Howells 	int          retries;
442607ca46eSDavid Howells 	unsigned int retry_time_ms;
443607ca46eSDavid Howells };
444607ca46eSDavid Howells #define IPMICTL_SET_TIMING_PARMS_CMD	_IOR(IPMI_IOC_MAGIC, 22, \
445607ca46eSDavid Howells 					     struct ipmi_timing_parms)
446607ca46eSDavid Howells #define IPMICTL_GET_TIMING_PARMS_CMD	_IOR(IPMI_IOC_MAGIC, 23, \
447607ca46eSDavid Howells 					     struct ipmi_timing_parms)
448607ca46eSDavid Howells 
449607ca46eSDavid Howells /*
450607ca46eSDavid Howells  * Set the maintenance mode.  See ipmi_set_maintenance_mode() above
451607ca46eSDavid Howells  * for a description of what this does.
452607ca46eSDavid Howells  */
453607ca46eSDavid Howells #define IPMICTL_GET_MAINTENANCE_MODE_CMD	_IOR(IPMI_IOC_MAGIC, 30, int)
454607ca46eSDavid Howells #define IPMICTL_SET_MAINTENANCE_MODE_CMD	_IOW(IPMI_IOC_MAGIC, 31, int)
455607ca46eSDavid Howells 
456607ca46eSDavid Howells #endif /* _UAPI__LINUX_IPMI_H */
457