Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / linux / ipmi.h
index 75311f2..0a84b56 100644 (file)
@@ -35,6 +35,8 @@
 #define __LINUX_IPMI_H
 
 #include <linux/ipmi_msgdefs.h>
 #define __LINUX_IPMI_H
 
 #include <linux/ipmi_msgdefs.h>
+#include <linux/compiler.h>
+#include <linux/device.h>
 
 /*
  * This file describes an interface to an IPMI driver.  You have to
 
 /*
  * This file describes an interface to an IPMI driver.  You have to
@@ -124,7 +126,7 @@ struct ipmi_ipmb_addr
  * In this address, the remote_SWID is always the SWID the remote
  * message came from, or the SWID we are sending the message to.
  * local_SWID is always our SWID.  Note that having our SWID in the
  * In this address, the remote_SWID is always the SWID the remote
  * message came from, or the SWID we are sending the message to.
  * local_SWID is always our SWID.  Note that having our SWID in the
- * message is a little wierd, but this is required.
+ * message is a little weird, but this is required.
  */
 #define IPMI_LAN_ADDR_TYPE             0x04
 struct ipmi_lan_addr
  */
 #define IPMI_LAN_ADDR_TYPE             0x04
 struct ipmi_lan_addr
@@ -155,6 +157,14 @@ struct ipmi_lan_addr
  * out).
  */
 struct ipmi_msg
  * out).
  */
 struct ipmi_msg
+{
+       unsigned char  netfn;
+       unsigned char  cmd;
+       unsigned short data_len;
+       unsigned char  __user *data;
+};
+
+struct kernel_ipmi_msg
 {
        unsigned char  netfn;
        unsigned char  cmd;
 {
        unsigned char  netfn;
        unsigned char  cmd;
@@ -201,6 +211,11 @@ struct ipmi_msg
 #include <linux/list.h>
 #include <linux/module.h>
 
 #include <linux/list.h>
 #include <linux/module.h>
 
+#ifdef CONFIG_PROC_FS
+#include <linux/proc_fs.h>
+extern struct proc_dir_entry *proc_ipmi_root;
+#endif /* CONFIG_PROC_FS */
+
 /* Opaque type for a IPMI message user.  One of these is needed to
    send and receive messages. */
 typedef struct ipmi_user *ipmi_user_t;
 /* Opaque type for a IPMI message user.  One of these is needed to
    send and receive messages. */
 typedef struct ipmi_user *ipmi_user_t;
@@ -223,12 +238,13 @@ struct ipmi_recv_msg
        ipmi_user_t      user;
        struct ipmi_addr addr;
        long             msgid;
        ipmi_user_t      user;
        struct ipmi_addr addr;
        long             msgid;
-       struct ipmi_msg  msg;
+       struct kernel_ipmi_msg  msg;
 
        /* The user_msg_data is the data supplied when a message was
           sent, if this is a response to a sent message.  If this is
           not a response to a sent message, then user_msg_data will
 
        /* The user_msg_data is the data supplied when a message was
           sent, if this is a response to a sent message.  If this is
           not a response to a sent message, then user_msg_data will
-          be NULL. */
+          be NULL.  If the user above is NULL, then this will be the
+          intf. */
        void             *user_msg_data;
 
        /* Call this when done with the message.  It will presumably free
        void             *user_msg_data;
 
        /* Call this when done with the message.  It will presumably free
@@ -241,11 +257,7 @@ struct ipmi_recv_msg
 };
 
 /* Allocate and free the receive message. */
 };
 
 /* Allocate and free the receive message. */
-static inline void ipmi_free_recv_msg(struct ipmi_recv_msg *msg)
-{
-       msg->done(msg);
-}
-struct ipmi_recv_msg *ipmi_alloc_recv_msg(void);
+void ipmi_free_recv_msg(struct ipmi_recv_msg *msg);
 
 struct ipmi_user_hndl
 {
 
 struct ipmi_user_hndl
 {
@@ -286,39 +298,19 @@ void ipmi_get_version(ipmi_user_t   user,
    this user, so it will affect all users of this interface.  This is
    so some initialization code can come in and do the OEM-specific
    things it takes to determine your address (if not the BMC) and set
    this user, so it will affect all users of this interface.  This is
    so some initialization code can come in and do the OEM-specific
    things it takes to determine your address (if not the BMC) and set
-   it for everyone else. */
-void ipmi_set_my_address(ipmi_user_t   user,
-                        unsigned char address);
-unsigned char ipmi_get_my_address(ipmi_user_t user);
-void ipmi_set_my_LUN(ipmi_user_t   user,
-                    unsigned char LUN);
-unsigned char ipmi_get_my_LUN(ipmi_user_t user);
-
-/*
- * Send a command request from the given user.  The address is the
- * proper address for the channel type.  If this is a command, then
- * the message response comes back, the receive handler for this user
- * will be called with the given msgid value in the recv msg.  If this
- * is a response to a command, then the msgid will be used as the
- * sequence number for the response (truncated if necessary), so when
- * sending a response you should use the sequence number you received
- * in the msgid field of the received command.  If the priority is >
- * 0, the message will go into a high-priority queue and be sent
- * first.  Otherwise, it goes into a normal-priority queue.
- * The user_msg_data field will be returned in any response to this
- * message.
- *
- * Note that if you send a response (with the netfn lower bit set),
- * you *will* get back a SEND_MSG response telling you what happened
- * when the response was sent.  You will not get back a response to
- * the message itself.
- */
-int ipmi_request(ipmi_user_t      user,
-                struct ipmi_addr *addr,
-                long             msgid,
-                struct ipmi_msg  *msg,
-                void             *user_msg_data,
-                int              priority);
+   it for everyone else.  Note that each channel can have its own address. */
+int ipmi_set_my_address(ipmi_user_t   user,
+                       unsigned int  channel,
+                       unsigned char address);
+int ipmi_get_my_address(ipmi_user_t   user,
+                       unsigned int  channel,
+                       unsigned char *address);
+int ipmi_set_my_LUN(ipmi_user_t   user,
+                   unsigned int  channel,
+                   unsigned char LUN);
+int ipmi_get_my_LUN(ipmi_user_t   user,
+                   unsigned int  channel,
+                   unsigned char *LUN);
 
 /*
  * Like ipmi_request, but lets you specify the number of retries and
 
 /*
  * Like ipmi_request, but lets you specify the number of retries and
@@ -336,24 +328,12 @@ int ipmi_request(ipmi_user_t      user,
 int ipmi_request_settime(ipmi_user_t      user,
                         struct ipmi_addr *addr,
                         long             msgid,
 int ipmi_request_settime(ipmi_user_t      user,
                         struct ipmi_addr *addr,
                         long             msgid,
-                        struct ipmi_msg  *msg,
+                        struct kernel_ipmi_msg  *msg,
                         void             *user_msg_data,
                         int              priority,
                         int              max_retries,
                         unsigned int     retry_time_ms);
 
                         void             *user_msg_data,
                         int              priority,
                         int              max_retries,
                         unsigned int     retry_time_ms);
 
-/*
- * Like ipmi_request, but lets you specify the slave return address.
- */
-int ipmi_request_with_source(ipmi_user_t      user,
-                            struct ipmi_addr *addr,
-                            long             msgid,
-                            struct ipmi_msg  *msg,
-                            void             *user_msg_data,
-                            int              priority,
-                            unsigned char    source_address,
-                            unsigned char    source_lun);
-
 /*
  * Like ipmi_request, but with messages supplied.  This will not
  * allocate any memory, and the messages may be statically allocated
 /*
  * Like ipmi_request, but with messages supplied.  This will not
  * allocate any memory, and the messages may be statically allocated
@@ -366,7 +346,7 @@ int ipmi_request_with_source(ipmi_user_t      user,
 int ipmi_request_supply_msgs(ipmi_user_t          user,
                             struct ipmi_addr     *addr,
                             long                 msgid,
 int ipmi_request_supply_msgs(ipmi_user_t          user,
                             struct ipmi_addr     *addr,
                             long                 msgid,
-                            struct ipmi_msg      *msg,
+                            struct kernel_ipmi_msg *msg,
                             void                 *user_msg_data,
                             void                 *supplied_smi,
                             struct ipmi_recv_msg *supplied_recv,
                             void                 *user_msg_data,
                             void                 *supplied_smi,
                             struct ipmi_recv_msg *supplied_recv,
@@ -387,6 +367,12 @@ int ipmi_unregister_for_cmd(ipmi_user_t   user,
                            unsigned char netfn,
                            unsigned char cmd);
 
                            unsigned char netfn,
                            unsigned char cmd);
 
+/*
+ * Allow run-to-completion mode to be set for the interface of
+ * a specific user.
+ */
+void ipmi_user_set_run_to_completion(ipmi_user_t user, int val);
+
 /*
  * When the user is created, it will not receive IPMI events by
  * default.  The user must set this to TRUE to get incoming events.
 /*
  * When the user is created, it will not receive IPMI events by
  * default.  The user must set this to TRUE to get incoming events.
@@ -395,17 +381,6 @@ int ipmi_unregister_for_cmd(ipmi_user_t   user,
  */
 int ipmi_set_gets_events(ipmi_user_t user, int val);
 
  */
 int ipmi_set_gets_events(ipmi_user_t user, int val);
 
-/*
- * Register the given user to handle all received IPMI commands.  This
- * will fail if anyone is registered as a command receiver or if
- * another is already registered to receive all commands.  NOTE THAT
- * THIS IS FOR EMULATION USERS ONLY, DO NOT USER THIS FOR NORMAL
- * STUFF.
- */
-int ipmi_register_all_cmd_rcvr(ipmi_user_t user);
-int ipmi_unregister_all_cmd_rcvr(ipmi_user_t user);
-
-
 /*
  * Called when a new SMI is registered.  This will also be called on
  * every existing interface when a new watcher is registered with
 /*
  * Called when a new SMI is registered.  This will also be called on
  * every existing interface when a new watcher is registered with
@@ -423,7 +398,7 @@ struct ipmi_smi_watcher
           the watcher list.  So you can add and remove users from the
           IPMI interface, send messages, etc., but you cannot add
           or remove SMI watchers or SMI interfaces. */
           the watcher list.  So you can add and remove users from the
           IPMI interface, send messages, etc., but you cannot add
           or remove SMI watchers or SMI interfaces. */
-       void (*new_smi)(int if_num);
+       void (*new_smi)(int if_num, struct device *dev);
        void (*smi_gone)(int if_num);
 };
 
        void (*smi_gone)(int if_num);
 };
 
@@ -439,9 +414,6 @@ unsigned int ipmi_addr_length(int addr_type);
 /* Validate that the given IPMI address is valid. */
 int ipmi_validate_addr(struct ipmi_addr *addr, int len);
 
 /* Validate that the given IPMI address is valid. */
 int ipmi_validate_addr(struct ipmi_addr *addr, int len);
 
-/* Return 1 if the given addresses are equal, 0 if not. */
-int ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2);
-
 #endif /* __KERNEL__ */
 
 
 #endif /* __KERNEL__ */
 
 
@@ -488,7 +460,7 @@ int ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2);
 /* Messages sent to the interface are this format. */
 struct ipmi_req
 {
 /* Messages sent to the interface are this format. */
 struct ipmi_req
 {
-       unsigned char *addr; /* Address to send the message to. */
+       unsigned char __user *addr; /* Address to send the message to. */
        unsigned int  addr_len;
 
        long    msgid; /* The sequence number for the message.  This
        unsigned int  addr_len;
 
        long    msgid; /* The sequence number for the message.  This
@@ -539,7 +511,7 @@ struct ipmi_recv
        int     recv_type; /* Is this a command, response or an
                              asyncronous event. */
 
        int     recv_type; /* Is this a command, response or an
                              asyncronous event. */
 
-       unsigned char *addr;    /* Address the message was from is put
+       unsigned char __user *addr;    /* Address the message was from is put
                                   here.  The caller must supply the
                                   memory. */
        unsigned int  addr_len; /* The size of the address buffer.
                                   here.  The caller must supply the
                                   memory. */
        unsigned int  addr_len; /* The size of the address buffer.
@@ -619,6 +591,16 @@ struct ipmi_cmdspec
  * things it takes to determine your address (if not the BMC) and set
  * it for everyone else.  You should probably leave the LUN alone.
  */
  * things it takes to determine your address (if not the BMC) and set
  * it for everyone else.  You should probably leave the LUN alone.
  */
+struct ipmi_channel_lun_address_set
+{
+       unsigned short channel;
+       unsigned char  value;
+};
+#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
+#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
+#define IPMICTL_SET_MY_CHANNEL_LUN_CMD    _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
+#define IPMICTL_GET_MY_CHANNEL_LUN_CMD    _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
+/* Legacy interfaces, these only set IPMB 0. */
 #define IPMICTL_SET_MY_ADDRESS_CMD     _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
 #define IPMICTL_GET_MY_ADDRESS_CMD     _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
 #define IPMICTL_SET_MY_LUN_CMD         _IOR(IPMI_IOC_MAGIC, 19, unsigned int)
 #define IPMICTL_SET_MY_ADDRESS_CMD     _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
 #define IPMICTL_GET_MY_ADDRESS_CMD     _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
 #define IPMICTL_SET_MY_LUN_CMD         _IOR(IPMI_IOC_MAGIC, 19, unsigned int)