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