include/linux/ipmi.h

Source file repositories/reference/linux-study-clean/include/linux/ipmi.h

File Facts

System
Linux kernel
Corpus path
include/linux/ipmi.h
Extension
.h
Size
11841 bytes
Lines
358
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ipmi_recv_msg {
	struct list_head link;

	/*
	 * The type of message as defined in the "Receive Types"
	 * defines above.
	 */
	int              recv_type;

	struct ipmi_user *user;
	struct ipmi_addr addr;
	long             msgid;
	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
	 * 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
	 * the message and do any other necessary cleanup.
	 */
	void (*done)(struct ipmi_recv_msg *msg);

	/*
	 * Place-holder for the data, don't make any assumptions about
	 * the size or existence of this, since it may change.
	 */
	unsigned char   msg_data[IPMI_MAX_MSG_LENGTH];
};

#define INIT_IPMI_RECV_MSG(done_handler) \
{					\
	.done = done_handler		\
}

/* Allocate and free the receive message. */
void ipmi_free_recv_msg(struct ipmi_recv_msg *msg);

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.  The handler_data is the
	 * variable supplied when the receive handler was registered.
	 */
	void (*ipmi_recv_hndl)(struct ipmi_recv_msg *msg,
			       void                 *user_msg_data);

	/*
	 * Called when the interface detects a watchdog pre-timeout.  If
	 * this is NULL, it will be ignored for the user.  Note that you
	 * can't do any IPMI calls from here, it's called with locks held.
	 */
	void (*ipmi_watchdog_pretimeout)(void *handler_data);

	/*
	 * If not NULL, called at panic time after the interface has
	 * been set up to handle run to completion.
	 */
	void (*ipmi_panic_handler)(void *handler_data);

	/*
	 * Called when the interface has been removed.  After this returns
	 * the user handle will be invalid.  The interface may or may
	 * not be usable when this is called, but it will return errors
	 * if it is not usable.
	 */
	void (*shutdown)(void *handler_data);
};

/* Create a new user of the IPMI layer on the given interface number. */
int ipmi_create_user(unsigned int          if_num,
		     const struct ipmi_user_hndl *handler,
		     void                  *handler_data,
		     struct ipmi_user      **user);

/*
 * 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.

Annotation

Implementation Notes