diff options
Diffstat (limited to 'include/linux/ipmi.h')
| -rw-r--r-- | include/linux/ipmi.h | 131 |
1 files changed, 128 insertions, 3 deletions
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 9479a550b924..75311f205806 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h @@ -109,6 +109,35 @@ struct ipmi_ipmb_addr unsigned char lun; }; +/* + * A LAN Address. This is an address to/from a LAN interface bridged + * by the BMC, not an address actually out on the LAN. + * + * A concious decision was made here to deviate slightly from the IPMI + * spec. We do not use rqSWID and rsSWID like it shows in the + * message. Instead, we use remote_SWID and local_SWID. This means + * that any message (a request or response) from another device will + * always have exactly the same address. If you didn't do this, + * requests and responses from the same device would have different + * addresses, and that's not too cool. + * + * 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. + */ +#define IPMI_LAN_ADDR_TYPE 0x04 +struct ipmi_lan_addr +{ + int addr_type; + short channel; + unsigned char privilege; + unsigned char session_handle; + unsigned char remote_SWID; + unsigned char local_SWID; + unsigned char lun; +}; + /* * Channel for talking directly with the BMC. When using this @@ -145,10 +174,20 @@ struct ipmi_msg * Receive types for messages coming from the receive interface. This * is used for the receive in-kernel interface and in the receive * IOCTL. + * + * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but + * it allows you to get the message results when you send a response + * message. */ #define IPMI_RESPONSE_RECV_TYPE 1 /* A response to a command */ #define IPMI_ASYNC_EVENT_RECV_TYPE 2 /* Something from the event queue */ #define IPMI_CMD_RECV_TYPE 3 /* A command from somewhere else */ +#define IPMI_RESPONSE_RESPONSE_TYPE 4 /* The response for + a sent response, giving any + error status for sending the + response. When you send a + response message, this will + be returned. */ /* Note that async events and received commands do not have a completion code as the first byte of the incoming data, unlike a response. */ @@ -160,6 +199,7 @@ struct ipmi_msg * The in-kernel interface. */ #include <linux/list.h> +#include <linux/module.h> /* Opaque type for a IPMI message user. One of these is needed to send and receive messages. */ @@ -185,6 +225,12 @@ struct ipmi_recv_msg long msgid; struct 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 + be NULL. */ + void *user_msg_data; + /* Call this when done with the message. It will presumably free the message and do any other necessary cleanup. */ void (*done)(struct ipmi_recv_msg *msg); @@ -206,9 +252,10 @@ struct ipmi_user_hndl /* Routine type to call when a message needs to be routed to the upper layer. This will be called with some locks held, the only IPMI routines that can be called are ipmi_request - and the alloc/free operations. */ + and the alloc/free operations. The handler_data is the + variable supplied when the receive handler was registered. */ void (*ipmi_recv_hndl)(struct ipmi_recv_msg *msg, - void *handler_data); + void *user_msg_data); /* Called when the interface detects a watchdog pre-timeout. If this is NULL, it will be ignored for the user. */ @@ -221,7 +268,12 @@ int ipmi_create_user(unsigned int if_num, void *handler_data, ipmi_user_t *user); -/* Destroy the given user of the IPMI layer. */ +/* Destroy the given user of the IPMI layer. Note that after this + function returns, the system is guaranteed to not call any + callbacks for the user. Thus as long as you destroy all the users + before you unload a module, you will be safe. And if you destroy + the users before you destroy the callback structures, it should be + safe, too. */ int ipmi_destroy_user(ipmi_user_t user); /* Get the IPMI version of the BMC we are talking to. */ @@ -253,20 +305,51 @@ unsigned char ipmi_get_my_LUN(ipmi_user_t user); * 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); /* + * Like ipmi_request, but lets you specify the number of retries and + * the retry time. The retries is the number of times the message + * will be resent if no reply is received. If set to -1, the default + * value will be used. The retry time is the time in milliseconds + * between retries. If set to zero, the default value will be + * used. + * + * Don't use this unless you *really* have to. It's primarily for the + * IPMI over LAN converter; since the LAN stuff does its own retries, + * it makes no sense to do it here. However, this can be used if you + * have unusual requirements. + */ +int ipmi_request_settime(ipmi_user_t user, + struct ipmi_addr *addr, + long msgid, + struct ipmi_msg *msg, + 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); @@ -284,6 +367,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user, struct ipmi_addr *addr, long msgid, struct ipmi_msg *msg, + void *user_msg_data, void *supplied_smi, struct ipmi_recv_msg *supplied_recv, int priority); @@ -331,6 +415,10 @@ struct ipmi_smi_watcher { struct list_head link; + /* You must set the owner to the current module, if you are in + a module (generally just set it to "THIS_MODULE"). */ + struct module *owner; + /* These two are called with read locks held for the interface the watcher list. So you can add and remove users from the IPMI interface, send messages, etc., but you cannot add @@ -422,6 +510,29 @@ struct ipmi_req #define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, \ struct ipmi_req) +/* Messages sent to the interface with timing parameters are this + format. */ +struct ipmi_req_settime +{ + struct ipmi_req req; + + /* See ipmi_request_settime() above for details on these + values. */ + int retries; + unsigned int retry_time_ms; +}; +/* + * Send a message to the interfaces with timing parameters. error values + * are: + * - EFAULT - an address supplied was invalid. + * - EINVAL - The address supplied was not valid, or the command + * was not allowed. + * - EMSGSIZE - The message to was too large. + * - ENOMEM - Buffers could not be allocated for the command. + */ +#define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, \ + struct ipmi_req_settime) + /* Messages received from the interface are this format. */ struct ipmi_recv { @@ -513,4 +624,18 @@ struct ipmi_cmdspec #define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int) #define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int) +/* + * Get/set the default timing values for an interface. You shouldn't + * generally mess with these. + */ +struct ipmi_timing_parms +{ + int retries; + unsigned int retry_time_ms; +}; +#define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, \ + struct ipmi_timing_parms) +#define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \ + struct ipmi_timing_parms) + #endif /* __LINUX_IPMI_H */ |
