Commit ba3e3dba authored by Corey Minyard's avatar Corey Minyard Committed by Linus Torvalds

[PATCH] IPMI (Intelligent Platform Management Interface) driver

parent af1dbde2
......@@ -2185,9 +2185,15 @@ S: Germany
N: Corey Minyard
E: minyard@wf-rch.cirr.com
E: minyard@mvista.com
W: http://home.attbi.com/~minyard
D: Sony CDU31A CDROM Driver
S: 1805 Marquette
S: Richardson, Texas 75081
D: IPMI driver
D: Various networking fixes long ago
D: Original ppc_md work
D: Shared zlib
S: 7406 Wheat Field Rd
S: Garland, Texas 75044
S: USA
N: Patrick Mochel
......
This diff is collapsed.
......@@ -636,6 +636,8 @@ comment "from the tpqic02-support package. It is available at"
comment "metalab.unc.edu or ftp://titus.cfw.com/pub/Linux/util/"
depends on QIC02_TAPE && QIC02_DYNCONF
source "drivers/char/ipmi/Kconfig"
source "drivers/char/watchdog/Kconfig"
config DS1620
......
......@@ -82,6 +82,7 @@ obj-$(CONFIG_MWAVE) += mwave/
obj-$(CONFIG_AGP) += agp/
obj-$(CONFIG_DRM) += drm/
obj-$(CONFIG_PCMCIA) += pcmcia/
obj-$(CONFIG_IPMI_HANDLER) += ipmi/
# Files generated that shall be removed upon make clean
......
#
# IPMI device configuration
#
menu "IPMI"
config IPMI_HANDLER
tristate 'IPMI top-level message handler'
help
This enables the central IPMI message handler, required for IPMI
to work. Note that you must have this enabled to do any other IPMI
things. See IPMI.txt for more details.
config IPMI_PANIC_EVENT
bool 'Generate a panic event to all BMCs on a panic'
depends on IPMI_HANDLER
help
When a panic occurs, this will cause the IPMI message handler to
generate an IPMI event describing the panic to each interface
registered with the message handler.
config IPMI_DEVICE_INTERFACE
tristate 'Device interface for IPMI'
depends on IPMI_HANDLER
help
This provides an IOCTL interface to the IPMI message handler so
userland processes may use IPMI. It supports poll() and select().
config IPMI_KCS
tristate 'IPMI KCS handler'
depends on IPMI_HANDLER
help
Provides a driver for a KCS-style interface to a BMC.
config IPMI_WATCHDOG
tristate 'IPMI Watchdog Timer'
depends on IPMI_HANDLER
help
This enables the IPMI watchdog timer.
endmenu
#
# Makefile for the ipmi drivers.
#
export-objs := ipmi_msghandler.o ipmi_watchdog.o
ipmi_kcs_drv-objs := ipmi_kcs_sm.o ipmi_kcs_intf.o
obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
obj-$(CONFIG_IPMI_KCS) += ipmi_kcs_drv.o
obj-$(CONFIG_IPMI_WATCHDOG) += ipmi_watchdog.o
ipmi_kcs_drv.o: $(ipmi_kcs_drv-objs)
$(LD) -r -o $@ $(ipmi_kcs_drv-objs)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* ipmi_kcs_sm.h
*
* State machine for handling IPMI KCS interfaces.
*
* Author: MontaVista Software, Inc.
* Corey Minyard <minyard@mvista.com>
* source@mvista.com
*
* Copyright 2002 MontaVista Software Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
struct kcs_data;
void init_kcs_data(struct kcs_data *kcs,
unsigned int port,
unsigned char *addr);
/* Start a new transaction in the state machine. This will return -2
if the state machine is not idle, -1 if the size is invalid (to
large or too small), or 0 if the transaction is successfully
completed. */
int start_kcs_transaction(struct kcs_data *kcs, char *data, unsigned int size);
/* Return the results after the transaction. This will return -1 if
the buffer is too small, zero if no transaction is present, or the
actual length of the result data. */
int kcs_get_result(struct kcs_data *kcs, unsigned char *data, int length);
enum kcs_result
{
KCS_CALL_WITHOUT_DELAY, /* Call the driver again immediately */
KCS_CALL_WITH_DELAY, /* Delay some before calling again. */
KCS_TRANSACTION_COMPLETE, /* A transaction is finished. */
KCS_SM_IDLE, /* The SM is in idle state. */
KCS_SM_HOSED, /* The hardware violated the state machine. */
KCS_ATTN /* The hardware is asserting attn and the
state machine is idle. */
};
/* Call this periodically (for a polled interface) or upon receiving
an interrupt (for a interrupt-driven interface). If interrupt
driven, you should probably poll this periodically when not in idle
state. This should be called with the time that passed since the
last call, if it is significant. Time is in microseconds. */
enum kcs_result kcs_event(struct kcs_data *kcs, long time);
/* Return the size of the KCS structure in bytes. */
int kcs_size(void);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* ipmi_smi.h
*
* MontaVista IPMI system management interface
*
* Author: MontaVista Software, Inc.
* Corey Minyard <minyard@mvista.com>
* source@mvista.com
*
* Copyright 2002 MontaVista Software Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __LINUX_IPMI_MSGDEFS_H
#define __LINUX_IPMI_MSGDEFS_H
/* Various definitions for IPMI messages used by almost everything in
the IPMI stack. */
#define IPMI_NETFN_APP_REQUEST 0x06
#define IPMI_NETFN_APP_RESPONSE 0x07
#define IPMI_BMC_SLAVE_ADDR 0x20
#define IPMI_GET_DEVICE_ID_CMD 0x01
#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30
#define IPMI_GET_MSG_FLAGS_CMD 0x31
#define IPMI_SEND_MSG_CMD 0x34
#define IPMI_GET_MSG_CMD 0x33
#define IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e
#define IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f
#define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35
#define IPMI_MAX_MSG_LENGTH 80
#endif /* __LINUX_IPMI_MSGDEFS_H */
/*
* ipmi_smi.h
*
* MontaVista IPMI system management interface
*
* Author: MontaVista Software, Inc.
* Corey Minyard <minyard@mvista.com>
* source@mvista.com
*
* Copyright 2002 MontaVista Software Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __LINUX_IPMI_SMI_H
#define __LINUX_IPMI_SMI_H
#include <linux/ipmi_msgdefs.h>
/* This files describes the interface for IPMI system management interface
drivers to bind into the IPMI message handler. */
/* Structure for the low-level drivers. */
typedef struct ipmi_smi *ipmi_smi_t;
/*
* Messages to/from the lower layer. The smi interface will take one
* of these to send. After the send has occurred and a response has
* been received, it will report this same data structure back up to
* the upper layer. If an error occurs, it should fill in the
* response with an error code in the completion code location. When
* asyncronous data is received, one of these is allocated, the
* data_size is set to zero and the response holds the data from the
* get message or get event command that the interface initiated.
* Note that it is the interfaces responsibility to detect
* asynchronous data and messages and request them from the
* interface.
*/
struct ipmi_smi_msg
{
struct list_head link;
long msgid;
void *user_data;
/* If 0, add to the end of the queue. If 1, add to the beginning. */
int prio;
int data_size;
unsigned char data[IPMI_MAX_MSG_LENGTH];
int rsp_size;
unsigned char rsp[IPMI_MAX_MSG_LENGTH];
/* Will be called when the system is done with the message
(presumably to free it). */
void (*done)(struct ipmi_smi_msg *msg);
};
struct ipmi_smi_handlers
{
/* Called to enqueue an SMI message to be sent. This
operation is not allowed to fail. If an error occurs, it
should report back the error in a received message. It may
do this in the current call context, since no write locks
are held when this is run. 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. */
void (*sender)(void *send_info,
struct ipmi_smi_msg *msg,
int priority);
/* Called by the upper layer to request that we try to get
events from the BMC we are attached to. */
void (*request_events)(void *send_info);
/* Called when someone is using the interface, so the module can
adjust it's use count. Return zero if successful, or an
errno if not. */
int (*new_user)(void *send_info);
/* Called when someone is no longer using the interface, so the
module can adjust it's use count. */
void (*user_left)(void *send_info);
/* Called when the interface should go into "run to
completion" mode. If this call sets the value to true, the
interface should make sure that all messages are flushed
out and that none are pending, and any new requests are run
to completion immediately. */
void (*set_run_to_completion)(void *send_info, int run_to_completion);
};
/* Add a low-level interface to the IPMI driver. */
int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
void *send_info,
unsigned char version_major,
unsigned char version_minor,
ipmi_smi_t *intf);
/*
* Remove a low-level interface from the IPMI driver. This will
* return an error if the interface is still in use by a user.
*/
int ipmi_unregister_smi(ipmi_smi_t intf);
/*
* The lower layer reports received messages through this interface.
* The data_size should be zero if this is an asyncronous message. If
* the lower layer gets an error sending a message, it should format
* an error response in the message response.
*/
void ipmi_smi_msg_received(ipmi_smi_t intf,
struct ipmi_smi_msg *msg);
/* The lower layer received a watchdog pre-timeout on interface. */
void ipmi_smi_watchdog_pretimeout(ipmi_smi_t intf);
struct ipmi_smi_msg *ipmi_alloc_smi_msg(void);
static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)
{
msg->done(msg);
}
#endif /* __LINUX_IPMI_SMI_H */
......@@ -66,6 +66,8 @@
extern struct timezone sys_tz;
extern int panic_timeout;
#ifdef CONFIG_MODVERSIONS
const struct module_symbol __export_Using_Versions
__attribute__((section("__ksymtab"))) = {
......@@ -502,6 +504,8 @@ EXPORT_SYMBOL(loops_per_jiffy);
/* misc */
EXPORT_SYMBOL(panic);
EXPORT_SYMBOL(panic_notifier_list);
EXPORT_SYMBOL(panic_timeout);
EXPORT_SYMBOL(sprintf);
EXPORT_SYMBOL(snprintf);
EXPORT_SYMBOL(sscanf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment