aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ipmi.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-10-13 05:46:48 -0400
committerDavid Howells <dhowells@redhat.com>2012-10-13 05:46:48 -0400
commit607ca46e97a1b6594b29647d98a32d545c24bdff (patch)
tree30f4c0784bfddb57332cdc0678bd06d1e77fa185 /include/linux/ipmi.h
parent08cce05c5a91f5017f4edc9866cf026908c73f9f (diff)
UAPI: (Scripted) Disintegrate include/linux
Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Michael Kerrisk <mtk.manpages@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'include/linux/ipmi.h')
-rw-r--r--include/linux/ipmi.h422
1 files changed, 1 insertions, 421 deletions
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 48dcba9b2065..1487e7906bbd 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -30,191 +30,11 @@
30 * with this program; if not, write to the Free Software Foundation, Inc., 30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA. 31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */ 32 */
33
34#ifndef __LINUX_IPMI_H 33#ifndef __LINUX_IPMI_H
35#define __LINUX_IPMI_H 34#define __LINUX_IPMI_H
36 35
37#include <linux/ipmi_msgdefs.h> 36#include <uapi/linux/ipmi.h>
38#include <linux/compiler.h>
39
40/*
41 * This file describes an interface to an IPMI driver. You have to
42 * have a fairly good understanding of IPMI to use this, so go read
43 * the specs first before actually trying to do anything.
44 *
45 * With that said, this driver provides a multi-user interface to the
46 * IPMI driver, and it allows multiple IPMI physical interfaces below
47 * the driver. The physical interfaces bind as a lower layer on the
48 * driver. They appear as interfaces to the application using this
49 * interface.
50 *
51 * Multi-user means that multiple applications may use the driver,
52 * send commands, receive responses, etc. The driver keeps track of
53 * commands the user sends and tracks the responses. The responses
54 * will go back to the application that send the command. If the
55 * response doesn't come back in time, the driver will return a
56 * timeout error response to the application. Asynchronous events
57 * from the BMC event queue will go to all users bound to the driver.
58 * The incoming event queue in the BMC will automatically be flushed
59 * if it becomes full and it is queried once a second to see if
60 * anything is in it. Incoming commands to the driver will get
61 * delivered as commands.
62 *
63 * This driver provides two main interfaces: one for in-kernel
64 * applications and another for userland applications. The
65 * capabilities are basically the same for both interface, although
66 * the interfaces are somewhat different. The stuff in the
67 * #ifdef __KERNEL__ below is the in-kernel interface. The userland
68 * interface is defined later in the file. */
69
70
71
72/*
73 * This is an overlay for all the address types, so it's easy to
74 * determine the actual address type. This is kind of like addresses
75 * work for sockets.
76 */
77#define IPMI_MAX_ADDR_SIZE 32
78struct ipmi_addr {
79 /* Try to take these from the "Channel Medium Type" table
80 in section 6.5 of the IPMI 1.5 manual. */
81 int addr_type;
82 short channel;
83 char data[IPMI_MAX_ADDR_SIZE];
84};
85
86/*
87 * When the address is not used, the type will be set to this value.
88 * The channel is the BMC's channel number for the channel (usually
89 * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC.
90 */
91#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c
92struct ipmi_system_interface_addr {
93 int addr_type;
94 short channel;
95 unsigned char lun;
96};
97
98/* An IPMB Address. */
99#define IPMI_IPMB_ADDR_TYPE 0x01
100/* Used for broadcast get device id as described in section 17.9 of the
101 IPMI 1.5 manual. */
102#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41
103struct ipmi_ipmb_addr {
104 int addr_type;
105 short channel;
106 unsigned char slave_addr;
107 unsigned char lun;
108};
109
110/*
111 * A LAN Address. This is an address to/from a LAN interface bridged
112 * by the BMC, not an address actually out on the LAN.
113 *
114 * A conscious decision was made here to deviate slightly from the IPMI
115 * spec. We do not use rqSWID and rsSWID like it shows in the
116 * message. Instead, we use remote_SWID and local_SWID. This means
117 * that any message (a request or response) from another device will
118 * always have exactly the same address. If you didn't do this,
119 * requests and responses from the same device would have different
120 * addresses, and that's not too cool.
121 *
122 * In this address, the remote_SWID is always the SWID the remote
123 * message came from, or the SWID we are sending the message to.
124 * local_SWID is always our SWID. Note that having our SWID in the
125 * message is a little weird, but this is required.
126 */
127#define IPMI_LAN_ADDR_TYPE 0x04
128struct ipmi_lan_addr {
129 int addr_type;
130 short channel;
131 unsigned char privilege;
132 unsigned char session_handle;
133 unsigned char remote_SWID;
134 unsigned char local_SWID;
135 unsigned char lun;
136};
137
138
139/*
140 * Channel for talking directly with the BMC. When using this
141 * channel, This is for the system interface address type only. FIXME
142 * - is this right, or should we use -1?
143 */
144#define IPMI_BMC_CHANNEL 0xf
145#define IPMI_NUM_CHANNELS 0x10
146
147/*
148 * Used to signify an "all channel" bitmask. This is more than the
149 * actual number of channels because this is used in userland and
150 * will cover us if the number of channels is extended.
151 */
152#define IPMI_CHAN_ALL (~0)
153
154
155/*
156 * A raw IPMI message without any addressing. This covers both
157 * commands and responses. The completion code is always the first
158 * byte of data in the response (as the spec shows the messages laid
159 * out).
160 */
161struct ipmi_msg {
162 unsigned char netfn;
163 unsigned char cmd;
164 unsigned short data_len;
165 unsigned char __user *data;
166};
167
168struct kernel_ipmi_msg {
169 unsigned char netfn;
170 unsigned char cmd;
171 unsigned short data_len;
172 unsigned char *data;
173};
174
175/*
176 * Various defines that are useful for IPMI applications.
177 */
178#define IPMI_INVALID_CMD_COMPLETION_CODE 0xC1
179#define IPMI_TIMEOUT_COMPLETION_CODE 0xC3
180#define IPMI_UNKNOWN_ERR_COMPLETION_CODE 0xff
181
182 37
183/*
184 * Receive types for messages coming from the receive interface. This
185 * is used for the receive in-kernel interface and in the receive
186 * IOCTL.
187 *
188 * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but
189 * it allows you to get the message results when you send a response
190 * message.
191 */
192#define IPMI_RESPONSE_RECV_TYPE 1 /* A response to a command */
193#define IPMI_ASYNC_EVENT_RECV_TYPE 2 /* Something from the event queue */
194#define IPMI_CMD_RECV_TYPE 3 /* A command from somewhere else */
195#define IPMI_RESPONSE_RESPONSE_TYPE 4 /* The response for
196 a sent response, giving any
197 error status for sending the
198 response. When you send a
199 response message, this will
200 be returned. */
201#define IPMI_OEM_RECV_TYPE 5 /* The response for OEM Channels */
202
203/* Note that async events and received commands do not have a completion
204 code as the first byte of the incoming data, unlike a response. */
205
206
207/*
208 * Modes for ipmi_set_maint_mode() and the userland IOCTL. The AUTO
209 * setting is the default and means it will be set on certain
210 * commands. Hard setting it on and off will override automatic
211 * operation.
212 */
213#define IPMI_MAINTENANCE_MODE_AUTO 0
214#define IPMI_MAINTENANCE_MODE_OFF 1
215#define IPMI_MAINTENANCE_MODE_ON 2
216
217#ifdef __KERNEL__
218 38
219/* 39/*
220 * The in-kernel interface. 40 * The in-kernel interface.
@@ -493,244 +313,4 @@ struct ipmi_smi_info {
493/* This is to get the private info of ipmi_smi_t */ 313/* This is to get the private info of ipmi_smi_t */
494extern int ipmi_get_smi_info(int if_num, struct ipmi_smi_info *data); 314extern int ipmi_get_smi_info(int if_num, struct ipmi_smi_info *data);
495 315
496#endif /* __KERNEL__ */
497
498
499/*
500 * The userland interface
501 */
502
503/*
504 * The userland interface for the IPMI driver is a standard character
505 * device, with each instance of an interface registered as a minor
506 * number under the major character device.
507 *
508 * The read and write calls do not work, to get messages in and out
509 * requires ioctl calls because of the complexity of the data. select
510 * and poll do work, so you can wait for input using the file
511 * descriptor, you just can use read to get it.
512 *
513 * In general, you send a command down to the interface and receive
514 * responses back. You can use the msgid value to correlate commands
515 * and responses, the driver will take care of figuring out which
516 * incoming messages are for which command and find the proper msgid
517 * value to report. You will only receive reponses for commands you
518 * send. Asynchronous events, however, go to all open users, so you
519 * must be ready to handle these (or ignore them if you don't care).
520 *
521 * The address type depends upon the channel type. When talking
522 * directly to the BMC (IPMC_BMC_CHANNEL), the address is ignored
523 * (IPMI_UNUSED_ADDR_TYPE). When talking to an IPMB channel, you must
524 * supply a valid IPMB address with the addr_type set properly.
525 *
526 * When talking to normal channels, the driver takes care of the
527 * details of formatting and sending messages on that channel. You do
528 * not, for instance, have to format a send command, you just send
529 * whatever command you want to the channel, the driver will create
530 * the send command, automatically issue receive command and get even
531 * commands, and pass those up to the proper user.
532 */
533
534
535/* The magic IOCTL value for this interface. */
536#define IPMI_IOC_MAGIC 'i'
537
538
539/* Messages sent to the interface are this format. */
540struct ipmi_req {
541 unsigned char __user *addr; /* Address to send the message to. */
542 unsigned int addr_len;
543
544 long msgid; /* The sequence number for the message. This
545 exact value will be reported back in the
546 response to this request if it is a command.
547 If it is a response, this will be used as
548 the sequence value for the response. */
549
550 struct ipmi_msg msg;
551};
552/*
553 * Send a message to the interfaces. error values are:
554 * - EFAULT - an address supplied was invalid.
555 * - EINVAL - The address supplied was not valid, or the command
556 * was not allowed.
557 * - EMSGSIZE - The message to was too large.
558 * - ENOMEM - Buffers could not be allocated for the command.
559 */
560#define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, \
561 struct ipmi_req)
562
563/* Messages sent to the interface with timing parameters are this
564 format. */
565struct ipmi_req_settime {
566 struct ipmi_req req;
567
568 /* See ipmi_request_settime() above for details on these
569 values. */
570 int retries;
571 unsigned int retry_time_ms;
572};
573/*
574 * Send a message to the interfaces with timing parameters. error values
575 * are:
576 * - EFAULT - an address supplied was invalid.
577 * - EINVAL - The address supplied was not valid, or the command
578 * was not allowed.
579 * - EMSGSIZE - The message to was too large.
580 * - ENOMEM - Buffers could not be allocated for the command.
581 */
582#define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, \
583 struct ipmi_req_settime)
584
585/* Messages received from the interface are this format. */
586struct ipmi_recv {
587 int recv_type; /* Is this a command, response or an
588 asyncronous event. */
589
590 unsigned char __user *addr; /* Address the message was from is put
591 here. The caller must supply the
592 memory. */
593 unsigned int addr_len; /* The size of the address buffer.
594 The caller supplies the full buffer
595 length, this value is updated to
596 the actual message length when the
597 message is received. */
598
599 long msgid; /* The sequence number specified in the request
600 if this is a response. If this is a command,
601 this will be the sequence number from the
602 command. */
603
604 struct ipmi_msg msg; /* The data field must point to a buffer.
605 The data_size field must be set to the
606 size of the message buffer. The
607 caller supplies the full buffer
608 length, this value is updated to the
609 actual message length when the message
610 is received. */
611};
612
613/*
614 * Receive a message. error values:
615 * - EAGAIN - no messages in the queue.
616 * - EFAULT - an address supplied was invalid.
617 * - EINVAL - The address supplied was not valid.
618 * - EMSGSIZE - The message to was too large to fit into the message buffer,
619 * the message will be left in the buffer. */
620#define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, \
621 struct ipmi_recv)
622
623/*
624 * Like RECEIVE_MSG, but if the message won't fit in the buffer, it
625 * will truncate the contents instead of leaving the data in the
626 * buffer.
627 */
628#define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, \
629 struct ipmi_recv)
630
631/* Register to get commands from other entities on this interface. */
632struct ipmi_cmdspec {
633 unsigned char netfn;
634 unsigned char cmd;
635};
636
637/*
638 * Register to receive a specific command. error values:
639 * - EFAULT - an address supplied was invalid.
640 * - EBUSY - The netfn/cmd supplied was already in use.
641 * - ENOMEM - could not allocate memory for the entry.
642 */
643#define IPMICTL_REGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 14, \
644 struct ipmi_cmdspec)
645/*
646 * Unregister a regsitered command. error values:
647 * - EFAULT - an address supplied was invalid.
648 * - ENOENT - The netfn/cmd was not found registered for this user.
649 */
650#define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, \
651 struct ipmi_cmdspec)
652
653/*
654 * Register to get commands from other entities on specific channels.
655 * This way, you can only listen on specific channels, or have messages
656 * from some channels go to one place and other channels to someplace
657 * else. The chans field is a bitmask, (1 << channel) for each channel.
658 * It may be IPMI_CHAN_ALL for all channels.
659 */
660struct ipmi_cmdspec_chans {
661 unsigned int netfn;
662 unsigned int cmd;
663 unsigned int chans;
664};
665
666/*
667 * Register to receive a specific command on specific channels. error values:
668 * - EFAULT - an address supplied was invalid.
669 * - EBUSY - One of the netfn/cmd/chans supplied was already in use.
670 * - ENOMEM - could not allocate memory for the entry.
671 */
672#define IPMICTL_REGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 28, \
673 struct ipmi_cmdspec_chans)
674/*
675 * Unregister some netfn/cmd/chans. error values:
676 * - EFAULT - an address supplied was invalid.
677 * - ENOENT - None of the netfn/cmd/chans were found registered for this user.
678 */
679#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \
680 struct ipmi_cmdspec_chans)
681
682/*
683 * Set whether this interface receives events. Note that the first
684 * user registered for events will get all pending events for the
685 * interface. error values:
686 * - EFAULT - an address supplied was invalid.
687 */
688#define IPMICTL_SET_GETS_EVENTS_CMD _IOR(IPMI_IOC_MAGIC, 16, int)
689
690/*
691 * Set and get the slave address and LUN that we will use for our
692 * source messages. Note that this affects the interface, not just
693 * this user, so it will affect all users of this interface. This is
694 * so some initialization code can come in and do the OEM-specific
695 * things it takes to determine your address (if not the BMC) and set
696 * it for everyone else. You should probably leave the LUN alone.
697 */
698struct ipmi_channel_lun_address_set {
699 unsigned short channel;
700 unsigned char value;
701};
702#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \
703 _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
704#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \
705 _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
706#define IPMICTL_SET_MY_CHANNEL_LUN_CMD \
707 _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
708#define IPMICTL_GET_MY_CHANNEL_LUN_CMD \
709 _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
710/* Legacy interfaces, these only set IPMB 0. */
711#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
712#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
713#define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int)
714#define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int)
715
716/*
717 * Get/set the default timing values for an interface. You shouldn't
718 * generally mess with these.
719 */
720struct ipmi_timing_parms {
721 int retries;
722 unsigned int retry_time_ms;
723};
724#define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, \
725 struct ipmi_timing_parms)
726#define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \
727 struct ipmi_timing_parms)
728
729/*
730 * Set the maintenance mode. See ipmi_set_maintenance_mode() above
731 * for a description of what this does.
732 */
733#define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int)
734#define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int)
735
736#endif /* __LINUX_IPMI_H */ 316#endif /* __LINUX_IPMI_H */