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