xref: /openbmc/linux/include/uapi/linux/ipmi.h (revision 59fb1b9f)
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.
6259fb1b9fSRobert P. J. Day  */
63607ca46eSDavid Howells 
64607ca46eSDavid Howells /*
65607ca46eSDavid Howells  * This is an overlay for all the address types, so it's easy to
66607ca46eSDavid Howells  * determine the actual address type.  This is kind of like addresses
67607ca46eSDavid Howells  * work for sockets.
68607ca46eSDavid Howells  */
69607ca46eSDavid Howells #define IPMI_MAX_ADDR_SIZE 32
70607ca46eSDavid Howells struct ipmi_addr {
71607ca46eSDavid Howells 	 /* Try to take these from the "Channel Medium Type" table
72607ca46eSDavid Howells 	    in section 6.5 of the IPMI 1.5 manual. */
73607ca46eSDavid Howells 	int   addr_type;
74607ca46eSDavid Howells 	short channel;
75607ca46eSDavid Howells 	char  data[IPMI_MAX_ADDR_SIZE];
76607ca46eSDavid Howells };
77607ca46eSDavid Howells 
78607ca46eSDavid Howells /*
79607ca46eSDavid Howells  * When the address is not used, the type will be set to this value.
80607ca46eSDavid Howells  * The channel is the BMC's channel number for the channel (usually
81607ca46eSDavid Howells  * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC.
82607ca46eSDavid Howells  */
83607ca46eSDavid Howells #define IPMI_SYSTEM_INTERFACE_ADDR_TYPE	0x0c
84607ca46eSDavid Howells struct ipmi_system_interface_addr {
85607ca46eSDavid Howells 	int           addr_type;
86607ca46eSDavid Howells 	short         channel;
87607ca46eSDavid Howells 	unsigned char lun;
88607ca46eSDavid Howells };
89607ca46eSDavid Howells 
90607ca46eSDavid Howells /* An IPMB Address. */
91607ca46eSDavid Howells #define IPMI_IPMB_ADDR_TYPE		0x01
92607ca46eSDavid Howells /* Used for broadcast get device id as described in section 17.9 of the
93607ca46eSDavid Howells    IPMI 1.5 manual. */
94607ca46eSDavid Howells #define IPMI_IPMB_BROADCAST_ADDR_TYPE	0x41
95607ca46eSDavid Howells struct ipmi_ipmb_addr {
96607ca46eSDavid Howells 	int           addr_type;
97607ca46eSDavid Howells 	short         channel;
98607ca46eSDavid Howells 	unsigned char slave_addr;
99607ca46eSDavid Howells 	unsigned char lun;
100607ca46eSDavid Howells };
101607ca46eSDavid Howells 
102607ca46eSDavid Howells /*
103607ca46eSDavid Howells  * A LAN Address.  This is an address to/from a LAN interface bridged
104607ca46eSDavid Howells  * by the BMC, not an address actually out on the LAN.
105607ca46eSDavid Howells  *
106607ca46eSDavid Howells  * A conscious decision was made here to deviate slightly from the IPMI
107607ca46eSDavid Howells  * spec.  We do not use rqSWID and rsSWID like it shows in the
108607ca46eSDavid Howells  * message.  Instead, we use remote_SWID and local_SWID.  This means
109607ca46eSDavid Howells  * that any message (a request or response) from another device will
110607ca46eSDavid Howells  * always have exactly the same address.  If you didn't do this,
111607ca46eSDavid Howells  * requests and responses from the same device would have different
112607ca46eSDavid Howells  * addresses, and that's not too cool.
113607ca46eSDavid Howells  *
114607ca46eSDavid Howells  * In this address, the remote_SWID is always the SWID the remote
115607ca46eSDavid Howells  * message came from, or the SWID we are sending the message to.
116607ca46eSDavid Howells  * local_SWID is always our SWID.  Note that having our SWID in the
117607ca46eSDavid Howells  * message is a little weird, but this is required.
118607ca46eSDavid Howells  */
119607ca46eSDavid Howells #define IPMI_LAN_ADDR_TYPE		0x04
120607ca46eSDavid Howells struct ipmi_lan_addr {
121607ca46eSDavid Howells 	int           addr_type;
122607ca46eSDavid Howells 	short         channel;
123607ca46eSDavid Howells 	unsigned char privilege;
124607ca46eSDavid Howells 	unsigned char session_handle;
125607ca46eSDavid Howells 	unsigned char remote_SWID;
126607ca46eSDavid Howells 	unsigned char local_SWID;
127607ca46eSDavid Howells 	unsigned char lun;
128607ca46eSDavid Howells };
129607ca46eSDavid Howells 
130607ca46eSDavid Howells 
131607ca46eSDavid Howells /*
132607ca46eSDavid Howells  * Channel for talking directly with the BMC.  When using this
133607ca46eSDavid Howells  * channel, This is for the system interface address type only.  FIXME
134607ca46eSDavid Howells  * - is this right, or should we use -1?
135607ca46eSDavid Howells  */
136607ca46eSDavid Howells #define IPMI_BMC_CHANNEL  0xf
137607ca46eSDavid Howells #define IPMI_NUM_CHANNELS 0x10
138607ca46eSDavid Howells 
139607ca46eSDavid Howells /*
140607ca46eSDavid Howells  * Used to signify an "all channel" bitmask.  This is more than the
141607ca46eSDavid Howells  * actual number of channels because this is used in userland and
142607ca46eSDavid Howells  * will cover us if the number of channels is extended.
143607ca46eSDavid Howells  */
144607ca46eSDavid Howells #define IPMI_CHAN_ALL     (~0)
145607ca46eSDavid Howells 
146607ca46eSDavid Howells 
147607ca46eSDavid Howells /*
148607ca46eSDavid Howells  * A raw IPMI message without any addressing.  This covers both
149607ca46eSDavid Howells  * commands and responses.  The completion code is always the first
150607ca46eSDavid Howells  * byte of data in the response (as the spec shows the messages laid
151607ca46eSDavid Howells  * out).
152607ca46eSDavid Howells  */
153607ca46eSDavid Howells struct ipmi_msg {
154607ca46eSDavid Howells 	unsigned char  netfn;
155607ca46eSDavid Howells 	unsigned char  cmd;
156607ca46eSDavid Howells 	unsigned short data_len;
157607ca46eSDavid Howells 	unsigned char  __user *data;
158607ca46eSDavid Howells };
159607ca46eSDavid Howells 
160607ca46eSDavid Howells struct kernel_ipmi_msg {
161607ca46eSDavid Howells 	unsigned char  netfn;
162607ca46eSDavid Howells 	unsigned char  cmd;
163607ca46eSDavid Howells 	unsigned short data_len;
164607ca46eSDavid Howells 	unsigned char  *data;
165607ca46eSDavid Howells };
166607ca46eSDavid Howells 
167607ca46eSDavid Howells /*
168607ca46eSDavid Howells  * Various defines that are useful for IPMI applications.
169607ca46eSDavid Howells  */
170607ca46eSDavid Howells #define IPMI_INVALID_CMD_COMPLETION_CODE	0xC1
171607ca46eSDavid Howells #define IPMI_TIMEOUT_COMPLETION_CODE		0xC3
172607ca46eSDavid Howells #define IPMI_UNKNOWN_ERR_COMPLETION_CODE	0xff
173607ca46eSDavid Howells 
174607ca46eSDavid Howells 
175607ca46eSDavid Howells /*
176607ca46eSDavid Howells  * Receive types for messages coming from the receive interface.  This
177607ca46eSDavid Howells  * is used for the receive in-kernel interface and in the receive
178607ca46eSDavid Howells  * IOCTL.
179607ca46eSDavid Howells  *
180607ca46eSDavid Howells  * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but
181607ca46eSDavid Howells  * it allows you to get the message results when you send a response
182607ca46eSDavid Howells  * message.
183607ca46eSDavid Howells  */
184607ca46eSDavid Howells #define IPMI_RESPONSE_RECV_TYPE		1 /* A response to a command */
185607ca46eSDavid Howells #define IPMI_ASYNC_EVENT_RECV_TYPE	2 /* Something from the event queue */
186607ca46eSDavid Howells #define IPMI_CMD_RECV_TYPE		3 /* A command from somewhere else */
187607ca46eSDavid Howells #define IPMI_RESPONSE_RESPONSE_TYPE	4 /* The response for
188607ca46eSDavid Howells 					      a sent response, giving any
189607ca46eSDavid Howells 					      error status for sending the
190607ca46eSDavid Howells 					      response.  When you send a
191607ca46eSDavid Howells 					      response message, this will
192607ca46eSDavid Howells 					      be returned. */
193607ca46eSDavid Howells #define IPMI_OEM_RECV_TYPE		5 /* The response for OEM Channels */
194607ca46eSDavid Howells 
195607ca46eSDavid Howells /* Note that async events and received commands do not have a completion
196607ca46eSDavid Howells    code as the first byte of the incoming data, unlike a response. */
197607ca46eSDavid Howells 
198607ca46eSDavid Howells 
199607ca46eSDavid Howells /*
200607ca46eSDavid Howells  * Modes for ipmi_set_maint_mode() and the userland IOCTL.  The AUTO
201607ca46eSDavid Howells  * setting is the default and means it will be set on certain
202607ca46eSDavid Howells  * commands.  Hard setting it on and off will override automatic
203607ca46eSDavid Howells  * operation.
204607ca46eSDavid Howells  */
205607ca46eSDavid Howells #define IPMI_MAINTENANCE_MODE_AUTO	0
206607ca46eSDavid Howells #define IPMI_MAINTENANCE_MODE_OFF	1
207607ca46eSDavid Howells #define IPMI_MAINTENANCE_MODE_ON	2
208607ca46eSDavid Howells 
209607ca46eSDavid Howells 
210607ca46eSDavid Howells 
211607ca46eSDavid Howells /*
212607ca46eSDavid Howells  * The userland interface
213607ca46eSDavid Howells  */
214607ca46eSDavid Howells 
215607ca46eSDavid Howells /*
216607ca46eSDavid Howells  * The userland interface for the IPMI driver is a standard character
217607ca46eSDavid Howells  * device, with each instance of an interface registered as a minor
218607ca46eSDavid Howells  * number under the major character device.
219607ca46eSDavid Howells  *
220607ca46eSDavid Howells  * The read and write calls do not work, to get messages in and out
221607ca46eSDavid Howells  * requires ioctl calls because of the complexity of the data.  select
222607ca46eSDavid Howells  * and poll do work, so you can wait for input using the file
223607ca46eSDavid Howells  * descriptor, you just can use read to get it.
224607ca46eSDavid Howells  *
225607ca46eSDavid Howells  * In general, you send a command down to the interface and receive
226607ca46eSDavid Howells  * responses back.  You can use the msgid value to correlate commands
227607ca46eSDavid Howells  * and responses, the driver will take care of figuring out which
228607ca46eSDavid Howells  * incoming messages are for which command and find the proper msgid
229607ca46eSDavid Howells  * value to report.  You will only receive reponses for commands you
230607ca46eSDavid Howells  * send.  Asynchronous events, however, go to all open users, so you
231607ca46eSDavid Howells  * must be ready to handle these (or ignore them if you don't care).
232607ca46eSDavid Howells  *
233607ca46eSDavid Howells  * The address type depends upon the channel type.  When talking
234607ca46eSDavid Howells  * directly to the BMC (IPMC_BMC_CHANNEL), the address is ignored
235607ca46eSDavid Howells  * (IPMI_UNUSED_ADDR_TYPE).  When talking to an IPMB channel, you must
236607ca46eSDavid Howells  * supply a valid IPMB address with the addr_type set properly.
237607ca46eSDavid Howells  *
238607ca46eSDavid Howells  * When talking to normal channels, the driver takes care of the
239607ca46eSDavid Howells  * details of formatting and sending messages on that channel.  You do
240607ca46eSDavid Howells  * not, for instance, have to format a send command, you just send
241607ca46eSDavid Howells  * whatever command you want to the channel, the driver will create
242607ca46eSDavid Howells  * the send command, automatically issue receive command and get even
243607ca46eSDavid Howells  * commands, and pass those up to the proper user.
244607ca46eSDavid Howells  */
245607ca46eSDavid Howells 
246607ca46eSDavid Howells 
247607ca46eSDavid Howells /* The magic IOCTL value for this interface. */
248607ca46eSDavid Howells #define IPMI_IOC_MAGIC 'i'
249607ca46eSDavid Howells 
250607ca46eSDavid Howells 
251607ca46eSDavid Howells /* Messages sent to the interface are this format. */
252607ca46eSDavid Howells struct ipmi_req {
253607ca46eSDavid Howells 	unsigned char __user *addr; /* Address to send the message to. */
254607ca46eSDavid Howells 	unsigned int  addr_len;
255607ca46eSDavid Howells 
256607ca46eSDavid Howells 	long    msgid; /* The sequence number for the message.  This
257607ca46eSDavid Howells 			  exact value will be reported back in the
258607ca46eSDavid Howells 			  response to this request if it is a command.
259607ca46eSDavid Howells 			  If it is a response, this will be used as
260607ca46eSDavid Howells 			  the sequence value for the response.  */
261607ca46eSDavid Howells 
262607ca46eSDavid Howells 	struct ipmi_msg msg;
263607ca46eSDavid Howells };
264607ca46eSDavid Howells /*
265607ca46eSDavid Howells  * Send a message to the interfaces.  error values are:
266607ca46eSDavid Howells  *   - EFAULT - an address supplied was invalid.
267607ca46eSDavid Howells  *   - EINVAL - The address supplied was not valid, or the command
268607ca46eSDavid Howells  *              was not allowed.
269607ca46eSDavid Howells  *   - EMSGSIZE - The message to was too large.
270607ca46eSDavid Howells  *   - ENOMEM - Buffers could not be allocated for the command.
271607ca46eSDavid Howells  */
272607ca46eSDavid Howells #define IPMICTL_SEND_COMMAND		_IOR(IPMI_IOC_MAGIC, 13,	\
273607ca46eSDavid Howells 					     struct ipmi_req)
274607ca46eSDavid Howells 
275607ca46eSDavid Howells /* Messages sent to the interface with timing parameters are this
276607ca46eSDavid Howells    format. */
277607ca46eSDavid Howells struct ipmi_req_settime {
278607ca46eSDavid Howells 	struct ipmi_req req;
279607ca46eSDavid Howells 
280607ca46eSDavid Howells 	/* See ipmi_request_settime() above for details on these
281607ca46eSDavid Howells 	   values. */
282607ca46eSDavid Howells 	int          retries;
283607ca46eSDavid Howells 	unsigned int retry_time_ms;
284607ca46eSDavid Howells };
285607ca46eSDavid Howells /*
286607ca46eSDavid Howells  * Send a message to the interfaces with timing parameters.  error values
287607ca46eSDavid Howells  * are:
288607ca46eSDavid Howells  *   - EFAULT - an address supplied was invalid.
289607ca46eSDavid Howells  *   - EINVAL - The address supplied was not valid, or the command
290607ca46eSDavid Howells  *              was not allowed.
291607ca46eSDavid Howells  *   - EMSGSIZE - The message to was too large.
292607ca46eSDavid Howells  *   - ENOMEM - Buffers could not be allocated for the command.
293607ca46eSDavid Howells  */
294607ca46eSDavid Howells #define IPMICTL_SEND_COMMAND_SETTIME	_IOR(IPMI_IOC_MAGIC, 21,	\
295607ca46eSDavid Howells 					     struct ipmi_req_settime)
296607ca46eSDavid Howells 
297607ca46eSDavid Howells /* Messages received from the interface are this format. */
298607ca46eSDavid Howells struct ipmi_recv {
299607ca46eSDavid Howells 	int     recv_type; /* Is this a command, response or an
300607ca46eSDavid Howells 			      asyncronous event. */
301607ca46eSDavid Howells 
302607ca46eSDavid Howells 	unsigned char __user *addr;    /* Address the message was from is put
303607ca46eSDavid Howells 				   here.  The caller must supply the
304607ca46eSDavid Howells 				   memory. */
305607ca46eSDavid Howells 	unsigned int  addr_len; /* The size of the address buffer.
306607ca46eSDavid Howells 				   The caller supplies the full buffer
307607ca46eSDavid Howells 				   length, this value is updated to
308607ca46eSDavid Howells 				   the actual message length when the
309607ca46eSDavid Howells 				   message is received. */
310607ca46eSDavid Howells 
311607ca46eSDavid Howells 	long    msgid; /* The sequence number specified in the request
312607ca46eSDavid Howells 			  if this is a response.  If this is a command,
313607ca46eSDavid Howells 			  this will be the sequence number from the
314607ca46eSDavid Howells 			  command. */
315607ca46eSDavid Howells 
316607ca46eSDavid Howells 	struct ipmi_msg msg; /* The data field must point to a buffer.
317607ca46eSDavid Howells 				The data_size field must be set to the
318607ca46eSDavid Howells 				size of the message buffer.  The
319607ca46eSDavid Howells 				caller supplies the full buffer
320607ca46eSDavid Howells 				length, this value is updated to the
321607ca46eSDavid Howells 				actual message length when the message
322607ca46eSDavid Howells 				is received. */
323607ca46eSDavid Howells };
324607ca46eSDavid Howells 
325607ca46eSDavid Howells /*
326607ca46eSDavid Howells  * Receive a message.  error values:
327607ca46eSDavid Howells  *  - EAGAIN - no messages in the queue.
328607ca46eSDavid Howells  *  - EFAULT - an address supplied was invalid.
329607ca46eSDavid Howells  *  - EINVAL - The address supplied was not valid.
330607ca46eSDavid Howells  *  - EMSGSIZE - The message to was too large to fit into the message buffer,
331607ca46eSDavid Howells  *               the message will be left in the buffer. */
332607ca46eSDavid Howells #define IPMICTL_RECEIVE_MSG		_IOWR(IPMI_IOC_MAGIC, 12,	\
333607ca46eSDavid Howells 					      struct ipmi_recv)
334607ca46eSDavid Howells 
335607ca46eSDavid Howells /*
336607ca46eSDavid Howells  * Like RECEIVE_MSG, but if the message won't fit in the buffer, it
337607ca46eSDavid Howells  * will truncate the contents instead of leaving the data in the
338607ca46eSDavid Howells  * buffer.
339607ca46eSDavid Howells  */
340607ca46eSDavid Howells #define IPMICTL_RECEIVE_MSG_TRUNC	_IOWR(IPMI_IOC_MAGIC, 11,	\
341607ca46eSDavid Howells 					      struct ipmi_recv)
342607ca46eSDavid Howells 
343607ca46eSDavid Howells /* Register to get commands from other entities on this interface. */
344607ca46eSDavid Howells struct ipmi_cmdspec {
345607ca46eSDavid Howells 	unsigned char netfn;
346607ca46eSDavid Howells 	unsigned char cmd;
347607ca46eSDavid Howells };
348607ca46eSDavid Howells 
349607ca46eSDavid Howells /*
350607ca46eSDavid Howells  * Register to receive a specific command.  error values:
351607ca46eSDavid Howells  *   - EFAULT - an address supplied was invalid.
352607ca46eSDavid Howells  *   - EBUSY - The netfn/cmd supplied was already in use.
353607ca46eSDavid Howells  *   - ENOMEM - could not allocate memory for the entry.
354607ca46eSDavid Howells  */
355607ca46eSDavid Howells #define IPMICTL_REGISTER_FOR_CMD	_IOR(IPMI_IOC_MAGIC, 14,	\
356607ca46eSDavid Howells 					     struct ipmi_cmdspec)
357607ca46eSDavid Howells /*
358607ca46eSDavid Howells  * Unregister a regsitered command.  error values:
359607ca46eSDavid Howells  *  - EFAULT - an address supplied was invalid.
360607ca46eSDavid Howells  *  - ENOENT - The netfn/cmd was not found registered for this user.
361607ca46eSDavid Howells  */
362607ca46eSDavid Howells #define IPMICTL_UNREGISTER_FOR_CMD	_IOR(IPMI_IOC_MAGIC, 15,	\
363607ca46eSDavid Howells 					     struct ipmi_cmdspec)
364607ca46eSDavid Howells 
365607ca46eSDavid Howells /*
366607ca46eSDavid Howells  * Register to get commands from other entities on specific channels.
367607ca46eSDavid Howells  * This way, you can only listen on specific channels, or have messages
368607ca46eSDavid Howells  * from some channels go to one place and other channels to someplace
369607ca46eSDavid Howells  * else.  The chans field is a bitmask, (1 << channel) for each channel.
370607ca46eSDavid Howells  * It may be IPMI_CHAN_ALL for all channels.
371607ca46eSDavid Howells  */
372607ca46eSDavid Howells struct ipmi_cmdspec_chans {
373607ca46eSDavid Howells 	unsigned int netfn;
374607ca46eSDavid Howells 	unsigned int cmd;
375607ca46eSDavid Howells 	unsigned int chans;
376607ca46eSDavid Howells };
377607ca46eSDavid Howells 
378607ca46eSDavid Howells /*
379607ca46eSDavid Howells  * Register to receive a specific command on specific channels.  error values:
380607ca46eSDavid Howells  *   - EFAULT - an address supplied was invalid.
381607ca46eSDavid Howells  *   - EBUSY - One of the netfn/cmd/chans supplied was already in use.
382607ca46eSDavid Howells  *   - ENOMEM - could not allocate memory for the entry.
383607ca46eSDavid Howells  */
384607ca46eSDavid Howells #define IPMICTL_REGISTER_FOR_CMD_CHANS	_IOR(IPMI_IOC_MAGIC, 28,	\
385607ca46eSDavid Howells 					     struct ipmi_cmdspec_chans)
386607ca46eSDavid Howells /*
387607ca46eSDavid Howells  * Unregister some netfn/cmd/chans.  error values:
388607ca46eSDavid Howells  *  - EFAULT - an address supplied was invalid.
389607ca46eSDavid Howells  *  - ENOENT - None of the netfn/cmd/chans were found registered for this user.
390607ca46eSDavid Howells  */
391607ca46eSDavid Howells #define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29,	\
392607ca46eSDavid Howells 					     struct ipmi_cmdspec_chans)
393607ca46eSDavid Howells 
394607ca46eSDavid Howells /*
395607ca46eSDavid Howells  * Set whether this interface receives events.  Note that the first
396607ca46eSDavid Howells  * user registered for events will get all pending events for the
397607ca46eSDavid Howells  * interface.  error values:
398607ca46eSDavid Howells  *  - EFAULT - an address supplied was invalid.
399607ca46eSDavid Howells  */
400607ca46eSDavid Howells #define IPMICTL_SET_GETS_EVENTS_CMD	_IOR(IPMI_IOC_MAGIC, 16, int)
401607ca46eSDavid Howells 
402607ca46eSDavid Howells /*
403607ca46eSDavid Howells  * Set and get the slave address and LUN that we will use for our
404607ca46eSDavid Howells  * source messages.  Note that this affects the interface, not just
405607ca46eSDavid Howells  * this user, so it will affect all users of this interface.  This is
406607ca46eSDavid Howells  * so some initialization code can come in and do the OEM-specific
407607ca46eSDavid Howells  * things it takes to determine your address (if not the BMC) and set
408607ca46eSDavid Howells  * it for everyone else.  You should probably leave the LUN alone.
409607ca46eSDavid Howells  */
410607ca46eSDavid Howells struct ipmi_channel_lun_address_set {
411607ca46eSDavid Howells 	unsigned short channel;
412607ca46eSDavid Howells 	unsigned char  value;
413607ca46eSDavid Howells };
414607ca46eSDavid Howells #define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \
415607ca46eSDavid Howells 	_IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
416607ca46eSDavid Howells #define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \
417607ca46eSDavid Howells 	_IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
418607ca46eSDavid Howells #define IPMICTL_SET_MY_CHANNEL_LUN_CMD \
419607ca46eSDavid Howells 	_IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
420607ca46eSDavid Howells #define IPMICTL_GET_MY_CHANNEL_LUN_CMD \
421607ca46eSDavid Howells 	_IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
422607ca46eSDavid Howells /* Legacy interfaces, these only set IPMB 0. */
423607ca46eSDavid Howells #define IPMICTL_SET_MY_ADDRESS_CMD	_IOR(IPMI_IOC_MAGIC, 17, unsigned int)
424607ca46eSDavid Howells #define IPMICTL_GET_MY_ADDRESS_CMD	_IOR(IPMI_IOC_MAGIC, 18, unsigned int)
425607ca46eSDavid Howells #define IPMICTL_SET_MY_LUN_CMD		_IOR(IPMI_IOC_MAGIC, 19, unsigned int)
426607ca46eSDavid Howells #define IPMICTL_GET_MY_LUN_CMD		_IOR(IPMI_IOC_MAGIC, 20, unsigned int)
427607ca46eSDavid Howells 
428607ca46eSDavid Howells /*
429607ca46eSDavid Howells  * Get/set the default timing values for an interface.  You shouldn't
430607ca46eSDavid Howells  * generally mess with these.
431607ca46eSDavid Howells  */
432607ca46eSDavid Howells struct ipmi_timing_parms {
433607ca46eSDavid Howells 	int          retries;
434607ca46eSDavid Howells 	unsigned int retry_time_ms;
435607ca46eSDavid Howells };
436607ca46eSDavid Howells #define IPMICTL_SET_TIMING_PARMS_CMD	_IOR(IPMI_IOC_MAGIC, 22, \
437607ca46eSDavid Howells 					     struct ipmi_timing_parms)
438607ca46eSDavid Howells #define IPMICTL_GET_TIMING_PARMS_CMD	_IOR(IPMI_IOC_MAGIC, 23, \
439607ca46eSDavid Howells 					     struct ipmi_timing_parms)
440607ca46eSDavid Howells 
441607ca46eSDavid Howells /*
442607ca46eSDavid Howells  * Set the maintenance mode.  See ipmi_set_maintenance_mode() above
443607ca46eSDavid Howells  * for a description of what this does.
444607ca46eSDavid Howells  */
445607ca46eSDavid Howells #define IPMICTL_GET_MAINTENANCE_MODE_CMD	_IOR(IPMI_IOC_MAGIC, 30, int)
446607ca46eSDavid Howells #define IPMICTL_SET_MAINTENANCE_MODE_CMD	_IOW(IPMI_IOC_MAGIC, 31, int)
447607ca46eSDavid Howells 
448607ca46eSDavid Howells #endif /* _UAPI__LINUX_IPMI_H */
449