diff --git a/ipmitool/Makefile.am b/ipmitool/Makefile.am new file mode 100644 index 0000000..fe29d30 --- /dev/null +++ b/ipmitool/Makefile.am @@ -0,0 +1,47 @@ +# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistribution of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistribution in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of Sun Microsystems, Inc. or the names of +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# This software is provided "AS IS," without a warranty of any kind. +# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. +# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE +# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF +# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, +# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +# +# You acknowledge that this software is not designed or intended for use +# in the design, construction, operation or maintenance of any nuclear +# facility. + +EXTRA_DIST = ipmitool.spec.in control/pkginfo control/prototype debian/* + +MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure configure-stamp \ + config.guess config.sub depcomp install-sh ltmain.sh missing \ + mkinstalldirs config.h.in stamp-h.in $(distdir).tar.gz + +SUBDIRS = libltdl lib src include doc + +INCLUDES = $(LTDLINCL) + +dist-hook: ipmitool.spec + cp ipmitool.spec $(distdir) + diff --git a/ipmitool/bootstrap b/ipmitool/bootstrap new file mode 100755 index 0000000..a13560a --- /dev/null +++ b/ipmitool/bootstrap @@ -0,0 +1,46 @@ +#!/bin/sh -x +# +# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistribution of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistribution in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of Sun Microsystems, Inc. or the names of +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# This software is provided "AS IS," without a warranty of any kind. +# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. +# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE +# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF +# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, +# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +# +# You acknowledge that this software is not designed or intended for use +# in the design, construction, operation or maintenance of any nuclear +# facility. + +aclocal +libtoolize --automake --copy --ltdl + +autoheader +automake --foreign --add-missing --copy + +aclocal +autoconf +automake --foreign + diff --git a/ipmitool/configure.in b/ipmitool/configure.in new file mode 100644 index 0000000..529d0cf --- /dev/null +++ b/ipmitool/configure.in @@ -0,0 +1,133 @@ +dnl +dnl autoconf for ipmitool +dnl +AC_INIT([src/ipmitool.c]) +AM_INIT_AUTOMAKE([ipmitool], [1.5.4]) +AM_CONFIG_HEADER([config.h]) +AC_CONFIG_SRCDIR([src/ipmitool.c]) +AC_PREREQ(2.50) + +IPMITOOL_PKG=ipmitool +AC_SUBST(IPMITOOL_PKG) +AC_SUBST(ac_configure_args) + +dnl check for programs +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + +AC_CHECK_PROG(SED, sed, sed) + +dnl setup libtool and ltdl +AC_LIB_LTDL +AC_LIBTOOL_DLOPEN +AC_LIBLTDL_CONVENIENCE +AM_PROG_LIBTOOL +LIBTOOL="$LIBTOOL --silent" +AC_SUBST(LTDLINCL) +AC_SUBST(LIBLTDL) +AC_CONFIG_SUBDIRS(libltdl) + +AC_CHECK_LIB([m], [pow], [], [ + echo "** libm library pow() not found!" + exit 1 + ]) + +AC_SEARCH_LIBS(gethostbyname, nsl) +AC_SEARCH_LIBS(socket, socket, , + [AC_CHECK_LIB(nsl, socket, LIBS="$LIBS -lsocket -lnsl", , -lsocket)]) + +AC_CHECK_LIB([ltdl], [lt_dlopen], [], [ + echo "** libltdl library lt_dlopen() not found!" + exit 1 + ]) + +dnl check for headers +AC_HEADER_STDC +AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/stat.h unistd.h]) +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/socket.h]) + +have_openipmi=no +AC_CHECK_HEADER([linux/ipmi.h], + [have_openipmi=yes], + [AC_MSG_WARN([Unable to find OpenIPMI header files])]) + +dnl check for typedefs, structs, and compiler options +AC_C_CONST +AC_C_INLINE + +dnl check for lib functions +AC_PROG_GCC_TRADITIONAL +AC_FUNC_MALLOC +AC_FUNC_SELECT_ARGTYPES +AC_FUNC_STAT +AC_FUNC_STRTOD +AC_CHECK_FUNCS([alarm gethostbyname socket select]) +AC_CHECK_FUNCS([memmove memset strchr strdup strerror]) + +dnl check for byteswap functionality +AC_CHECK_HEADERS([asm/byteorder.h byteswap.h]) +AC_CHECK_FUNCS([bswap_16 bswap_32]) +AC_C_BIGENDIAN + +if test "x$prefix" = "xNONE"; then + prefix="$ac_default_prefix" +fi + +if test "x$exec_prefix" = "xNONE"; then + exec_prefix="$prefix" +fi + +dnl enable plugins for interfaces +AC_ARG_WITH([plugin-path], + [[ --with-plugin-path=DIR Set plugin path to DIR]], + [pluginpath="$withval"], + [pluginpath="${exec_prefix}/lib/ipmitool"]) + +AC_DEFINE_UNQUOTED(PLUGIN_PATH, "$pluginpath", "IPMI interface plugin path") +AC_SUBST(pluginpath) + +AC_ARG_ENABLE([intf-lan], + [[ --enable-intf-lan enable IPMI-over-LAN interface [default=yes]]], + [if test "x$enableval" = "xyes"; then + PLUGINS="$PLUGINS lan" + fi], + [PLUGINS="$PLUGINS lan"]) + +AC_ARG_ENABLE([intf-open], + [[ --enable-intf-open enable OpenIPMI device interface [default=no]]], + [if test "x$enableval" = "xyes"; then + if test "x$have_openipmi" = "xyes"; then + PLUGINS="$PLUGINS open" + else + echo "** Unable to build OpenIPMI interface support!" + exit 1 + fi + fi]) + +AC_SUBST(PLUGINS) + +AC_ARG_ENABLE([ipmievd], + [[ --enable-ipmievd enable IPMI event daemon [default=no]]],,) + +AM_CONDITIONAL(IPMIEVD, test "x$enable_ipmievd" = "xyes") + +AC_CONFIG_FILES([ipmitool.spec + Makefile + doc/Makefile + lib/Makefile + include/Makefile + include/ipmitool/Makefile + src/Makefile + src/plugins/Makefile + src/plugins/lan/Makefile + src/plugins/open/Makefile]) + +AC_OUTPUT + +echo +echo Building $PACKAGE version $VERSION with interface plugins: $PLUGINS +echo Plugin Path: $pluginpath +echo diff --git a/ipmitool/debian/changelog b/ipmitool/debian/changelog index 8cdaec4..87a4f41 100644 --- a/ipmitool/debian/changelog +++ b/ipmitool/debian/changelog @@ -1,8 +1,36 @@ -ipmitool (1.4.1.1-1) unstable; urgency=low +ipmitool (1.5.4) unstable; urgency=low - * First public source relese + * Put interface plugin API into library + * Fix ipmievd - -- Duncan Laurie Wed, 12 Nov 2003 09:23:18 -0700 + -- Duncan Laurie Fri, 14 Nov 2003 15:16:34 -0700 + +ipmitool (1.5.3) unstable; urgency=low + + * Add -g option to work with grizzly bmc + + -- Duncan Laurie Mon, 3 Nov 2003 18:04:07 -0700 + +ipmitool (1.5.2) unstable; urgency=low + + * add support for setting gratuitous arp interval + + -- Duncan Laurie Fri, 24 Oct 2003 11:00:00 -0700 + +ipmitool (1.5.1) unstable; urgency=low + + * better SEL support + * fix display bug in SDR list + + -- Duncan Laurie Wed, 8 Oct 2003 17:28:51 -0700 + +ipmitool (1.5.0) unstable; urgency=low + + * more robust UDP packet handling + * add Intel IMB driver support + * use autoconf/automake/libtool + + -- Duncan Laurie Fri, 5 Sep 2003 11:57:32 -0700 ipmitool (1.2-1) unstable; urgency=low @@ -13,13 +41,13 @@ ipmitool (1.2-1) unstable; urgency=low ipmitool (1.1-1) unstable; urgency=low - * Minor fixes + * Minor fixes. -- Duncan Laurie Tue, 1 Apr 2003 14:31:10 -0700 ipmitool (1.0-1) unstable; urgency=low - * Initial Release + * Initial Release. -- Duncan Laurie Sun, 30 Mar 2003 21:30:46 -0700 diff --git a/ipmitool/debian/dirs b/ipmitool/debian/dirs index 236670a..6905016 100644 --- a/ipmitool/debian/dirs +++ b/ipmitool/debian/dirs @@ -1 +1,3 @@ -usr/sbin +usr/bin +usr/lib/ipmitool +usr/include/ipmitool diff --git a/ipmitool/debian/rules b/ipmitool/debian/rules index b9b5eea..2ef9d21 100755 --- a/ipmitool/debian/rules +++ b/ipmitool/debian/rules @@ -1,20 +1,9 @@ #!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# GNU copyright 1997 to 1999 by Joey Hess. -# -# Modified to make a template file for a multi-binary package with separated -# build-arch and build-indep targets by Bill Allombert 2001 -# Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 - -# This is the debhelper compatability version to use. export DH_COMPAT=4 -# This has to be exported to make some magic below work. export DH_OPTIONS - - CFLAGS = -Wall -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) @@ -29,11 +18,11 @@ endif configure: configure-stamp configure-stamp: dh_testdir -# Add here commands to configure the package. - + ./configure --enable-intf-lan --enable-intf-open \ + --enable-ipmievd \ + --prefix=/usr --mandir=/usr/share/man touch configure-stamp - #Architecture build: build-arch build-indep @@ -97,7 +86,7 @@ binary-common: # dh_installpam # dh_installinit # dh_installcron - dh_installmanpages +# dh_installmanpages # dh_installinfo # dh_undocumented # dh_installchangelogs @@ -111,6 +100,7 @@ binary-common: dh_installdeb # dh_perl dh_gencontrol + dh_md5sums dh_builddeb # Build architecture independant packages using the common target. binary-indep: build-indep install-indep @@ -122,3 +112,4 @@ binary-arch: build-arch install-arch binary: binary-arch #binary-indep .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure + diff --git a/ipmitool/doc/Makefile.am b/ipmitool/doc/Makefile.am new file mode 100644 index 0000000..4171378 --- /dev/null +++ b/ipmitool/doc/Makefile.am @@ -0,0 +1,39 @@ +# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistribution of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistribution in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of Sun Microsystems, Inc. or the names of +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# This software is provided "AS IS," without a warranty of any kind. +# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. +# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE +# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF +# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, +# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +# +# You acknowledge that this software is not designed or intended for use +# in the design, construction, operation or maintenance of any nuclear +# facility. + +MAINTAINERCLEANFILES = Makefile.in + +man_MANS = ipmitool.1 + +EXTRA_DIST = $(man_MANS) diff --git a/ipmitool/doc/ipmitool.1 b/ipmitool/doc/ipmitool.1 new file mode 100644 index 0000000..428b8c0 --- /dev/null +++ b/ipmitool/doc/ipmitool.1 @@ -0,0 +1,348 @@ +.TH "ipmitool" "1" "" "Duncan Laurie" "" +.SH "NAME" +.LP +ipmitool \- utility for controlling IPMI-enabled devices +.SH "SYNTAX" +.LP +ipmitool [\fB\-ghcvV\fR] \fB\-I\fR \fIlan\fP \fB\-H\fR \fIaddress\fP [\fB\-P\fR \fIpassword\fP] <\fIexpression\fP> +.br +ipmitool [\fB\-ghcvV\fR] \fB\-I\fR \fIopen\fP <\fIexpression\fP> +.SH "DESCRIPTION" +.LP +This program lets you perform various IPMI functions with either a kernel device driver or over a LAN interface. These functions include printing FRU information, LAN configuration, sensor readings, and remote chassis power control. +.SH "OPTIONS" +.LP +.TP +\fB\-h\fR +Get basic usage help from the command line. +.TP +\fB\-c\fR +Make output suitable for parsing where possible by separating fields with commas instead of spaces. +.TP +\fB\-g\fR +Attempt to be extra robust in IPMI-over-LAN communications. +.TP +\fB\-V\fR +Display version information. +.TP +\fB\-v\fR +Increase verbose output level. This option may be specified multiple times to increase the level of debug output. If given three times you will get hexdumps of all incoming and outgoing packets. +.TP +\fB\-I\fR <\fIinterface\fP> +Selects IPMI interface to use. Possible interfaces are \fIlan\fP or \fIopen\fP. +.TP +\fB\-H\fR <\fIaddress\fP> +Remote server address, can be IP address or hostname. This option is required for the LAN interface connection. +.TP +\fB\-P\fR <\fIpassword\fP> +Remote server password, 16 character maximum. This is optional for the LAN interface, if it is not provided the session will not be authenticated. +.SH "EXPRESSIONS" +.LP +.TP +.I help +This can be used to get command-line help on ipmitool commands. It may also be placed at the end of commands to get option usage help. +.RS +.PP +ipmitool -I open help +.br +Commands: chassis, fru, lan, sdr, sel +.LP +.PP +ipmitool -I open chassis help +.br +Chassis Commands: status, power, identify, policy, restart_cause +.LP +.PP +ipmitool -I open chassis power help +.br +Chassis Power Commands: status, on, off, cycle, reset, diag, soft +.LP +.RE +.TP +\fIraw\fP <\fBnetfn\fR> <\fBcmd\fR> [\fBdata\fR] +This will allow you to execute raw IPMI commands. For example to query the POH counter with a raw command: +.RS +.PP +ipmitool -I open raw 0x0 0xf +.br +RAW REQ (netfn=0x0 cmd=0xf data_len=0) +.br +RAW RSP (5 bytes) +.br + 3c 72 0c 00 00 +.LP +.RE +.TP +\fIchaninfo\fP [\fBchannel\fR] +This command will display information about the selected channel. If no channel is given it will display information about the currently used channel: +.RS +.PP +ipmitool -I open chaninfo +.br +Channel 0xf info: +.br + Channel Medium Type : System Interface +.br + Channel Protocol Type : KCS +.br + Session Support : session-less +.br + Active Session Count : 0 +.br + Protocol Vendor ID : 7154 +.LP +.RE +.TP +\fIuserinfo\fP <\fBchannel\fR> +This command will display information about configured user information on a specific LAN channel. This command will fail on system interfaces. Try channel 6 or 7. +.RS +.PP +ipmitool -I open userinfo 6 +.br +Maximum User IDs : 4 +.br +Enabled User IDs : 1 +.br +Fixed Name User IDs : 1 +.br +Access Available : call-in / callback +.br +Link Authentication : disabled +.br +IPMI Messaging : enabled +.LP +.RE +.TP +.I chassis +.RS +.TP +.I status +This command returns information about the high-level status of the system chassis and main power subsystem. +.TP +.I poh +This command will return the Power-On Hours counter. +.TP +\fIidentify\fP <\fBinterval\fR> +Control the front panel identify light. Default is 15. Use 0 to turn off. +.TP +.I restart_cause +Query the chassis for the cause of the last system restart. +.TP +.I policy +Set the chassis power policy in the event power failure. +.RS +.TP +.I list +Return supported policies. +.TP +.I always-on +Turn on when power is restored. +.TP +.I previous +Returned to previous state when power is restored. +.TP +.I always-off +Stay off after power is restored. +.RE +.TP +.I power +Performs a chassis control command to view and change the power state. +.RS +.TP +.I status +Show current chassis power status. +.TP +.I on +Power up chassis. +.TP +.I off +Power down chassis into soft off (S4/S5 state). WARNING: this command does not initiate a clean shutdown of the operating system prior to powering down the system. +.TP +.I cycle +This command provides a power off interval of at least 1 second. No action should occur if chassis power is in S4/S5 state, but it is recommended to check power state first and only issue a power cycle command if the system power is on or in lower sleep state than S4/S5. +.TP +.I reset +This command will perform a hard reset. +.TP +.I diag +Pulse a version of a diagnostic interrupt (NMI) that goes directly to the processor(s). +.TP +.I soft +Initiate a soft\-shutdown of OS via ACPI by emulating a fatal overtemperature. +.RE +.RE +.TP +.I lan +.RS +.TP +\fIprint\fP <\fBchannel\fR> +Print the current configuration for the given channel. +.TP +\fIset\fP <\fBchannel\fR> <\fBparameter\fR> +Set the given parameter on the given channel. Valid parameters are: +.RS +.TP +\fIipaddr\fP <\fBx.x.x.x\fR> +Set the IP address for this channel. +.TP +\fInetmask\fP <\fBx.x.x.x\fR> +Set the netmask for this channel. +.TP +\fImacaddr\fP <\fBxx:xx:xx:xx:xx:xx\fR> +Set the MAC adddress for this channel. +.TP +\fIdefgw\fP \fIipaddr\fP <\fBx.x.x.x\fR> +Set the default gateway IP address. +.TP +\fIdefgw\fP \fImacaddr\fP <\fBxx:xx:xx:xx:xx:xx\fR> +Set the default gateway MAC address. +.TP +\fIbakgw\fP \fIipaddr\fP <\fBx.x.x.x\fR> +Set the backup gateway IP address. +.TP +\fIbakgw\fP \fImacaddr\fP <\fBxx:xx:xx:xx:xx:xx\fR> +Set the backup gateway MAC address. +.TP +\fIpassword\fP <\fBpass\fR> +Set the null user password. +.TP +\fIuser\fP +Enable user access mode. +.TP +\fIaccess\fP <\fBon|off\fR> +Set LAN channel access mode. +.TP +\fIipsrc\fP <\fBsource\fR> +Set the IP address source: +.br +none = unspecified +.br +static = manually configured static IP address +.br +dhcp = address obtained by BMC running DHCP +.br +bios = address loaded by BIOS or system software +.TP +\fIarp\fP \fIrespond\fP <\fBon|off\fR> +Set BMC generated ARP responses. +.TP +\fIarp\fP \fIgenerate\fP <\fBon|off\fR> +Set BMC generated gratuitous ARPs. +.TP +\fIarp\fP \fIinterval\fP <\fBseconds\fR> +Set BMC generated gratuitous ARP interval. +.TP +\fIauth\fP <\fBlevel,...\fR> <\fBtype,...\fR> +Set the valid authtypes for a given auth level. +.RS +Levels: +.B callback +.B user +.B operator +.B admin +.br +Types: +.B none +.B md2 +.B md5 +.B key +.RE +.RE +.RE +.TP +.I fru +.RS +.TP +.I print +This command will read all Field Replacable Unit inventory data and extract such information as serial number, part number, asset tags, and short strings describing the chassis, board, or product. +.RE +.TP +.I sdr +.RS +.TP +.I list +This command will read the SDR and extract sensor information, then query each sensor and print its name, reading, and status. +.RE +.TP +.I sel +.RS +.TP +.I info +This command will query the BMC for information about the SEL and its contents. +.TP +.I clear +This command will clear the contents of the SEL. It cannot be undone so be careful. +.TP +.I list +This command will list the contents of the SEL. +.RE +.TP +.I sol +.RS +.TP +.I setup +Setup Serial-over-LAN: enable, set authentication and baud rate. +.RE +.SH "OPEN INTERFACE" +.LP +The ipmitool \fIopen\fP interface utilizes the MontaVista OpenIPMI kernel device driver. This driver is present in 2.5.57 and later development kernels and in 2.4.21pre1 and later stable kernels. There are also IPMI driver kernel patches for different versions available from the OpenIPMI homepage. +.LP +The following kernel modules must be loaded in order for ipmitool to work: +.TP +.B ipmi_msghandler +Incoming and outgoing message handler for IPMI interfaces. +.TP +.B ipmi_kcs_drv +An IPMI Keyboard Controler Style (KCS) interface driver for the message handler. +.TP +.B ipmi_devintf +Linux character device interface for the message handler. +.LP +Once they are loaded there will be a dynamic char device entry that must exist at \fB/dev/ipmi0\fR. Usually if this is the first dynamic device it will be major number \fB254\fR and minor number \fB0\fR so you would create the dev entry with: +.LP +.I mknod /dev/ipmi0 c 254 0 +.LP +In order to force ipmitool to make use of the device interface you can specifiy it on the command line: +.PP +ipmitool \-I open [option...] +.LP +Alternatively if you do not provide a hostname on the command line ipmitool will assume you want to use the open interface. +.SH "LAN INTERFACE" +.LP +The ipmitool \fIlan\fP interface communicates with the BMC over an Ethernet LAN connection using UDP under IPv4. UDP datagrams are formatted to contain IPMI request/response messages with a IPMI session headers and RMCP headers. +.LP +IPMI\-over\-LAN uses version 1 of the Remote Management Control Protocol (RMCP) to support \fIpre\-OS\fP and \fIOS\-absent\fP management. RMCP is a request\-response protocol delivered using UDP datagrams to port 623. +.LP +The LAN interface is an authenticatiod multi\-session connection; messages delivered to the BMC can (and should) be authenticated with a challenge/response protocol with either straight password/key or MD5 message\-digest algorithm. ipmitool will attempt to connect with administrator privilege level as this is required to perform chassis power functions. +.LP +You can tell ipmitool to use the lan interface with the \fB\-I\fR option: +.PP +ipmitool \-I lan [option...]
[password] +.LP +A hostname \fBmust\fR be given on the command line in order to use the lan interface with ipmitool. The password field is optional; if you do not provide a password on the command line ipmitool will attempt to connect without authentication. If you specify a password it will use MD5 authentication if supported by the BMC and straight password/key otherwise. +.SH "FILES" +.TP +.I /dev/ipmi0 +This character device file is used by the OpenIPMI kernel driver. +.SH "EXAMPLES" +.LP +If you want to remotely control the power of an IPMI\-over\-LAN enabled system you can use: +.LP +ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power on +.br +Chassis Power Control: Up/On +.LP +ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power status +.br +Chassis Power is on +.SH "AUTHOR" +.LP +Duncan Laurie +.SH "SEE ALSO" +.LP +.TP +Intelligent Platform Management Interface Specification +http://www.intel.com/design/servers/ipmi/spec.htm +.TP +OpenIPMI project (MontaVista IPMI kernel driver) +http://openipmi.sourceforge.net/ diff --git a/ipmitool/include/Makefile.am b/ipmitool/include/Makefile.am new file mode 100644 index 0000000..977c7aa --- /dev/null +++ b/ipmitool/include/Makefile.am @@ -0,0 +1,38 @@ +# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistribution of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistribution in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of Sun Microsystems, Inc. or the names of +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# This software is provided "AS IS," without a warranty of any kind. +# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. +# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE +# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF +# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, +# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +# +# You acknowledge that this software is not designed or intended for use +# in the design, construction, operation or maintenance of any nuclear +# facility. + +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = ipmitool + diff --git a/ipmitool/include/ipmitool/Makefile.am b/ipmitool/include/ipmitool/Makefile.am new file mode 100644 index 0000000..99c46b1 --- /dev/null +++ b/ipmitool/include/ipmitool/Makefile.am @@ -0,0 +1,42 @@ +# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistribution of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistribution in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of Sun Microsystems, Inc. or the names of +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# This software is provided "AS IS," without a warranty of any kind. +# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. +# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE +# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF +# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, +# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +# +# You acknowledge that this software is not designed or intended for use +# in the design, construction, operation or maintenance of any nuclear +# facility. + +MAINTAINERCLEANFILES = Makefile.in + +ipmitooldir = $(includedir)/ipmitool + +ipmitool_HEADERS = bswap.h helper.h ipmi.h ipmi_intf.h \ + ipmi_chassis.h ipmi_entity.h ipmi_fru.h ipmi_lanp.h \ + ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_bmc.h + diff --git a/ipmitool/include/ipmitool/bswap.h b/ipmitool/include/ipmitool/bswap.h new file mode 100644 index 0000000..5add178 --- /dev/null +++ b/ipmitool/include/ipmitool/bswap.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_BSWAP_H +#define IPMI_BSWAP_H + +#if defined(__sun) + +#define BSWAP_16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8)) +#define BSWAP_32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) |\ + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) + +#else + +#include + +#define BSWAP_16(x) bswap_16(x) +#define BSWAP_32(x) bswap_32(x) + +#endif + +#endif /* IPMI_BSWAP_H */ diff --git a/ipmitool/include/ipmitool/helper.h b/ipmitool/include/ipmitool/helper.h new file mode 100644 index 0000000..b821912 --- /dev/null +++ b/ipmitool/include/ipmitool/helper.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_HELPER_H +#define IPMI_HELPER_H + +struct valstr { + unsigned char val; + const char * str; +}; +const char * val2str(unsigned char val, const struct valstr * vs); + +unsigned short buf2short(unsigned char * buf); +unsigned long buf2long(unsigned char * buf); +const char * buf2str(unsigned char * buf, int len); +void printbuf(unsigned char * buf, int len, char * desc); + +void signal_handler(int sig, void * handler); + +#define SIG_IGNORE(s) ((void)signal((s), SIG_IGN)) +#define SIG_DEFAULT(s) ((void)signal((s), SIG_DFL)) +#define SIG_HANDLE(s,h) ((void)signal_handler((s), (h))) + +#endif /* IPMI_HELPER_H */ + diff --git a/ipmitool/include/ipmitool/ipmi.h b/ipmitool/include/ipmitool/ipmi.h new file mode 100644 index 0000000..cef5833 --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi.h @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_H +#define IPMI_H + +#include +#include +#include + +#define BUF_SIZE 256 + +extern int verbose; +extern int csv_output; + +struct ipmi_session { + unsigned char username[16]; + unsigned char challenge[16]; + unsigned char password; + unsigned char authtype; + unsigned char authcode[16]; + unsigned char privlvl; + unsigned long in_seq; + unsigned long out_seq; + unsigned long id; + int active; +}; + +struct ipmi_rq { + struct { + unsigned char netfn; + unsigned char cmd; + unsigned short data_len; + unsigned char *data; + } msg; +}; + +struct ipmi_rq_entry { + struct ipmi_rq req; + struct ipmi_intf * intf; + struct ipmi_session * session; + unsigned char rq_seq; + unsigned char * msg_data; + int msg_len; + struct ipmi_rq_entry * next; +}; + +struct ipmi_rs { + unsigned char ccode; + unsigned char data[BUF_SIZE]; + int data_len; + struct { + unsigned char authtype; + unsigned long seq; + unsigned long id; + } session; + unsigned char msglen; + struct { + unsigned char rq_addr; + unsigned char netfn; + unsigned char rq_lun; + unsigned char rs_addr; + unsigned char rq_seq; + unsigned char rs_lun; + unsigned char cmd; + } header; +}; + +struct ipmi_intf { + int fd; + struct sockaddr_in addr; + int abort; + int pedantic; + int (*open)(struct ipmi_intf *, char *, int, char *); + void (*close)(struct ipmi_intf *); + struct ipmi_rs *(*sendrecv)(struct ipmi_intf *, struct ipmi_rq *); +}; + +#define IPMI_NETFN_CHASSIS 0x0 +#define IPMI_NETFN_BRIDGE 0x2 +#define IPMI_NETFN_SE 0x4 +#define IPMI_NETFN_APP 0x6 +#define IPMI_NETFN_FIRMWARE 0x8 +#define IPMI_NETFN_STORAGE 0xa +#define IPMI_NETFN_TRANSPORT 0xc +#define IPMI_NETFN_SOL 0x34 + +#define IPMI_BMC_SLAVE_ADDR 0x20 +#define IPMI_REMOTE_SWID 0x81 + +int handle_ipmi(struct ipmi_intf *intf, unsigned char * data, int data_len); + +#endif /* IPMI_H */ diff --git a/ipmitool/include/ipmitool/ipmi_bmc.h b/ipmitool/include/ipmitool/ipmi_bmc.h new file mode 100644 index 0000000..d68f3cf --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_bmc.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_BMC_H +#define IPMI_BMC_H + +#include + +#define BMC_GET_DEVICE_ID 0x01 +#define BMC_COLD_RESET 0x02 +#define BMC_WARM_RESET 0x03 +#define BMC_GET_SELF_TEST 0x04 + +int ipmi_bmc_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_BMC_H*/ diff --git a/ipmitool/include/ipmitool/ipmi_chassis.h b/ipmitool/include/ipmitool/ipmi_chassis.h new file mode 100644 index 0000000..85ee1e2 --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_chassis.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_CHASSIS_H +#define IPMI_CHASSIS_H + +#include + +#define IPMI_CHASSIS_CTL_POWER_DOWN 0x0 +#define IPMI_CHASSIS_CTL_POWER_UP 0x1 +#define IPMI_CHASSIS_CTL_POWER_CYCLE 0x2 +#define IPMI_CHASSIS_CTL_HARD_RESET 0x3 +#define IPMI_CHASSIS_CTL_PULSE_DIAG 0x4 +#define IPMI_CHASSIS_CTL_ACPI_SOFT 0x5 + +#define IPMI_CHASSIS_POLICY_NO_CHANGE 0x3 +#define IPMI_CHASSIS_POLICY_ALWAYS_ON 0x2 +#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1 +#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0 + +int ipmi_chassis_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_CHASSIS_H*/ diff --git a/ipmitool/include/ipmitool/ipmi_entity.h b/ipmitool/include/ipmitool/ipmi_entity.h new file mode 100644 index 0000000..9a9524f --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_entity.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_ENTITY_H +#define IPMI_ENTITY_H + +#include + +const struct valstr entity_id_vals[] __attribute__((unused)) = { + { 0x00, "Unspecified" }, + { 0x01, "Other" }, + { 0x02, "Unknown" }, + { 0x03, "Processor" }, + { 0x04, "Disk or Disk Bay" }, + { 0x05, "Peripheral Bay" }, + { 0x06, "System Management Module" }, + { 0x07, "System Board" }, + { 0x08, "Memory Module" }, + { 0x09, "Processor Module" }, + { 0x0a, "Power Supply" }, + { 0x0b, "Add-in Card" }, + { 0x0c, "Front Panel Board" }, + { 0x0d, "Back Panel Board" }, + { 0x0e, "Power System Board" }, + { 0x0f, "Drive Backplane" }, + { 0x10, "System Internal Expansion Board" }, + { 0x11, "Other System Board" }, + { 0x12, "Processor Board" }, + { 0x13, "Power Unit" }, + { 0x14, "Power Module" }, + { 0x15, "Power Management" }, + { 0x16, "Chassis Back Panel Board" }, + { 0x17, "System Chassis" }, + { 0x18, "Sub-Chassis" }, + { 0x19, "Other Chassis Board" }, + { 0x1a, "Disk Drive Bay" }, + { 0x1b, "Peripheral Bay" }, + { 0x1c, "Device Bay" }, + { 0x1d, "Fan Device" }, + { 0x1e, "Cooling Unit" }, + { 0x1f, "Cable/Interconnect" }, + { 0x20, "Memory Device" }, + { 0x21, "System Management Software" }, + { 0x22, "BIOS" }, + { 0x23, "Operating System" }, + { 0x24, "System Bus" }, + { 0x25, "Group" }, + { 0x26, "Remote Management Device" }, + { 0x27, "External Environment" }, + { 0x28, "Battery" }, + { 0x00, NULL }, +}; + +#endif /* IPMI_ENTITY_H */ + diff --git a/ipmitool/include/ipmitool/ipmi_fru.h b/ipmitool/include/ipmitool/ipmi_fru.h new file mode 100644 index 0000000..88b0110 --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_fru.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_FRU_H +#define IPMI_FRU_H + +#include + +#define GET_FRU_INFO 0x10 +#define GET_FRU_DATA 0x11 +#define SET_FRU_DATA 0x12 + +enum { + FRU_CHASSIS_PARTNO, + FRU_CHASSIS_SERIAL, + FRU_BOARD_MANUF, + FRU_BOARD_PRODUCT, + FRU_BOARD_SERIAL, + FRU_BOARD_PARTNO, + FRU_PRODUCT_MANUF, + FRU_PRODUCT_NAME, + FRU_PRODUCT_PARTNO, + FRU_PRODUCT_VERSION, + FRU_PRODUCT_SERIAL, + FRU_PRODUCT_ASSET, +}; + +struct fru_info { + unsigned short size; + unsigned char access : 1; +} __attribute__ ((packed)); + +struct fru_header { + unsigned char version; + struct { + unsigned char internal; + unsigned char chassis; + unsigned char board; + unsigned char product; + unsigned char multi; + } offset; + unsigned char pad; + unsigned char checksum; +} __attribute__ ((packed)); + +struct fru_area_chassis { + unsigned char area_ver; + unsigned char area_len; + unsigned char type; + char * part; + char * serial; +}; + +struct fru_area_board { + unsigned char area_ver; + unsigned char area_len; + unsigned char lang; + unsigned long mfg_date_time; + char * mfg; + char * prod; + char * serial; + char * part; +}; + +struct fru_area_product { + unsigned char area_ver; + unsigned char area_len; + unsigned char lang; + char * mfg; + char * name; + char * part; + char * version; + char * serial; + char * asset; +}; + +static const char * chassis_type_desc[] __attribute__((unused)) = { + "Unspecified", "Other", "Unknown", + "Desktop", "Low Profile Desktop", "Pizza Box", + "Mini Tower", "Tower", + "Portable", "LapTop", "Notebook", "Hand Held", "Docking Station", + "All in One", "Sub Notebook", "Space-saving", "Lunch Box", + "Main Server Chassis", "Expansion Chassis", "SubChassis", + "Bus Expansion Chassis", "Peripheral Chassis", "RAID Chassis", + "Rack Mount Chassis" +}; + +void ipmi_print_fru(struct ipmi_intf *, unsigned char); +int ipmi_fru_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_FRU_H */ diff --git a/ipmitool/include/ipmitool/ipmi_intf.h b/ipmitool/include/ipmitool/ipmi_intf.h new file mode 100644 index 0000000..64747df --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_intf.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_INTF_H +#define IPMI_INTF_H + +#include + +int ipmi_intf_init(void); +void ipmi_intf_exit(void); +struct ipmi_intf * ipmi_intf_load(char * name); + +#endif /* IPMI_INTF_H */ diff --git a/ipmitool/include/ipmitool/ipmi_lanp.h b/ipmitool/include/ipmitool/ipmi_lanp.h new file mode 100644 index 0000000..c16998e --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_lanp.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_LANP_H +#define IPMI_LANP_H + +#include + +#define IPMI_LAN_SET_CONFIG 0x01 +#define IPMI_LAN_GET_CONFIG 0x02 +#define IPMI_LAN_SUSPEND_ARP 0x03 +# define IPMI_LAN_SUSPEND_ARP_RESP (2) +# define IPMI_LAN_SUSPEND_ARP_GRAT (1) +#define IPMI_LAN_GET_STAT 0x04 + +#define IPMI_SESSION_AUTHTYPE_NONE 0x0 +#define IPMI_SESSION_AUTHTYPE_MD2 0x1 +#define IPMI_SESSION_AUTHTYPE_MD5 0x2 +#define IPMI_SESSION_AUTHTYPE_KEY 0x4 +#define IPMI_SESSION_AUTHTYPE_OEM 0x5 + +#define IPMI_SESSION_PRIV_CALLBACK 0x1 +#define IPMI_SESSION_PRIV_USER 0x2 +#define IPMI_SESSION_PRIV_OPERATOR 0x3 +#define IPMI_SESSION_PRIV_ADMIN 0x4 +#define IPMI_SESSION_PRIV_OEM 0x5 + +extern const struct valstr ipmi_privlvl_vals[]; +extern const struct valstr ipmi_authtype_vals[]; +extern struct ipmi_session lan_session; + +enum { + IPMI_LANP_SET_IN_PROGRESS, + IPMI_LANP_AUTH_TYPE, + IPMI_LANP_AUTH_TYPE_ENABLE, + IPMI_LANP_IP_ADDR, + IPMI_LANP_IP_ADDR_SRC, + IPMI_LANP_MAC_ADDR, + IPMI_LANP_SUBNET_MASK, + IPMI_LANP_IP_HEADER, + IPMI_LANP_PRI_RMCP_PORT, + IPMI_LANP_SEC_RMCP_PORT, + IPMI_LANP_BMC_ARP, + IPMI_LANP_GRAT_ARP, + IPMI_LANP_DEF_GATEWAY_IP, + IPMI_LANP_DEF_GATEWAY_MAC, + IPMI_LANP_BAK_GATEWAY_IP, + IPMI_LANP_BAK_GATEWAY_MAC, + IPMI_LANP_SNMP_STRING, + IPMI_LANP_NUM_DEST, + IPMI_LANP_DEST_TYPE, + IPMI_LANP_DEST_ADDR, + IPMI_LANP_OEM_ALERT_STRING=96, + IPMI_LANP_ALERT_RETRY=97, + IPMI_LANP_UTC_OFFSET=98, + IPMI_LANP_DHCP_SERVER_IP=192, + IPMI_LANP_DHCP_SERVER_MAC=193, + IPMI_LANP_DHCP_ENABLE=194, + IPMI_LANP_CHAN_ACCESS_MODE=201, +}; + +static struct lan_param { + int cmd; + int size; + char desc[24]; + unsigned char * data; +} ipmi_lan_params[] __attribute__((unused)) = { + { IPMI_LANP_SET_IN_PROGRESS, 1, "Set in Progress" }, + { IPMI_LANP_AUTH_TYPE, 1, "Auth Type" }, + { IPMI_LANP_AUTH_TYPE_ENABLE, 5, "Auth Type Enable" }, + { IPMI_LANP_IP_ADDR, 4, "IP Address" }, + { IPMI_LANP_IP_ADDR_SRC, 1, "IP Address Source" }, + { IPMI_LANP_MAC_ADDR, 6, "MAC Address" }, + { IPMI_LANP_SUBNET_MASK, 4, "Subnet Mask" }, + { IPMI_LANP_IP_HEADER, 3, "IP Header" }, + { IPMI_LANP_PRI_RMCP_PORT, 2, "Primary RMCP Port" }, + { IPMI_LANP_SEC_RMCP_PORT, 2, "Secondary RMCP Port" }, + { IPMI_LANP_BMC_ARP, 1, "BMC ARP Control" }, + { IPMI_LANP_GRAT_ARP, 1, "Gratituous ARP Intrvl" }, + { IPMI_LANP_DEF_GATEWAY_IP, 4, "Default Gateway IP" }, + { IPMI_LANP_DEF_GATEWAY_MAC, 6, "Default Gateway MAC" }, + { IPMI_LANP_BAK_GATEWAY_IP, 4, "Backup Gateway IP" }, + { IPMI_LANP_BAK_GATEWAY_MAC, 6, "Backup Gateway MAC" }, + { IPMI_LANP_SNMP_STRING, 18, "Community String" }, + { IPMI_LANP_NUM_DEST, 1, "Number of Destinations"}, + { IPMI_LANP_DEST_TYPE, 4, "Destination Type" }, + { IPMI_LANP_DEST_ADDR, 13, "Destination Addresses" }, + { IPMI_LANP_OEM_ALERT_STRING, 28, "OEM Alert String" }, + { IPMI_LANP_ALERT_RETRY, 1, "Alert Retry Algorithm" }, + { IPMI_LANP_UTC_OFFSET, 3, "UTC Offset" }, + { IPMI_LANP_DHCP_SERVER_IP, 4, "DHCP Server IP" }, + { IPMI_LANP_DHCP_SERVER_MAC, 6, "DHDP Server MAC" }, + { IPMI_LANP_DHCP_ENABLE, 1, "DHCP Enable" }, + { IPMI_LANP_CHAN_ACCESS_MODE, 2, "Channel Access Mode" }, + { -1 } +}; + +void ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel); +int ipmi_lanp_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_LANP_H*/ diff --git a/ipmitool/include/ipmitool/ipmi_sdr.h b/ipmitool/include/ipmitool/ipmi_sdr.h new file mode 100644 index 0000000..da75567 --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_sdr.h @@ -0,0 +1,325 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_SDR_H +#define IPMI_SDR_H + +#include +#include +#include + +int ipmi_sdr_main(struct ipmi_intf *, int, char **); +int utos(unsigned val, unsigned bits); + +#define __TO_TOL(mtol) (unsigned short)(BSWAP_16(mtol) & 0x3f) +#define __TO_M(mtol) (unsigned short)(utos((((BSWAP_16(mtol) & 0xff00) >> 8) | ((BSWAP_16(mtol) & 0xc0) << 2)), 10)) +#define __TO_B(bacc) (unsigned int)(utos((((BSWAP_32(bacc) & 0xff000000) >> 24) | \ + ((BSWAP_32(bacc) & 0xc00000) >> 14)), 10)) +#define __TO_ACC(bacc) (unsigned int)(((BSWAP_32(bacc) & 0x3f0000) >> 16) | ((BSWAP_32(bacc) & 0xf000) >> 6)) +#define __TO_ACC_EXP(bacc) (unsigned int)((BSWAP_32(bacc) & 0xc00) >> 10) +#define __TO_R_EXP(bacc) (unsigned int)(utos(((BSWAP_32(bacc) & 0xf0) >> 4), 4)) +#define __TO_B_EXP(bacc) (unsigned int)(utos((BSWAP_32(bacc) & 0xf), 4)) + +#define CONVERT_RAW(val, m, b, k1, k2) (float)(((m * val) + (b * pow(10, k1))) * pow(10, k2)) +#define CONVERT_TOL(val, m, k2) (float)(((m * val) / 2) * pow(10, k2)) + +#define CONVERT_SENSOR_RAW(sensor, val) (float)(((__TO_M((sensor)->mtol) * val) + (__TO_B((sensor)->bacc) * pow(10, __TO_B_EXP((sensor)->bacc)))) * pow(10, __TO_R_EXP((sensor)->bacc))) +#define CONVERT_SENSOR_TOL(sensor) (float)((((__TO_M((sensor)->mtol) * __TO_TOL((sensor)->mtol)) / 2) * pow(10, __TO_R_EXP((sensor)->bacc)))) + +#define GET_SDR_REPO_INFO 0x20 +#define GET_SDR_ALLOC_INFO 0x21 + +#define SDR_SENSOR_STAT_LO_NC (1<<0) +#define SDR_SENSOR_STAT_LO_CR (1<<1) +#define SDR_SENSOR_STAT_LO_NR (1<<2) +#define SDR_SENSOR_STAT_HI_NC (1<<3) +#define SDR_SENSOR_STAT_HI_CR (1<<4) +#define SDR_SENSOR_STAT_HI_NR (1<<5) + +struct sdr_repo_info_rs { + unsigned char version; /* SDR version (51h) */ + unsigned short count; /* number of records */ + unsigned short free; /* free space in SDR */ + unsigned long add_stamp; /* last add timestamp */ + unsigned long erase_stamp; /* last del timestamp */ + unsigned char op_support; /* supported operations */ +} __attribute__ ((packed)); + +#define GET_SDR_RESERVE_REPO 0x22 +struct sdr_reserve_repo_rs { + unsigned short reserve_id; /* reservation ID */ +} __attribute__ ((packed)); + +#define GET_SDR 0x23 +struct sdr_get_rq { + unsigned short reserve_id; /* reservation ID */ + unsigned short id; /* record ID */ + unsigned char offset; /* offset into SDR */ +#define GET_SDR_ENTIRE_RECORD 0xff +#define GET_SDR_MAX_LEN 30 + unsigned char length; /* length to read */ +} __attribute__ ((packed)); + +struct sdr_get_rs { + unsigned short next; /* next record id */ + unsigned short id; /* record ID */ + unsigned char version; /* SDR version (51h) */ +#define SDR_RECORD_TYPE_FULL_SENSOR 0x01 +#define SDR_RECORD_TYPE_COMPACT_SENSOR 0x02 + unsigned char type; /* record type */ + unsigned char length; /* remaining record bytes */ +} __attribute__ ((packed)); + +struct sdr_record_compact_sensor { + struct { + unsigned char owner_id; + unsigned char lun : 2, /* sensor owner lun */ + __reserved : 2, + channel : 4; /* channel number */ + unsigned char sensor_num; /* unique sensor number */ + } keys; + + struct { + unsigned char id; /* physical entity id */ + unsigned char instance : 7, /* instance number */ + logical : 1; /* physical/logical */ + } entity; + + struct { + struct { + unsigned char sensor_scan : 1, + event_gen : 1, + type : 1, + hysteresis : 1, + thresholds : 1, + events : 1, + scanning : 1, + __reserved : 1; + } init; + struct { + unsigned char event_msg : 2, + threshold : 2, + hysteresis : 2, + rearm : 1, + ignore : 1; + } capabilities; + unsigned char type; /* sensor type */ + } sensor; + + unsigned char event_type; /* event/reading type code */ + + union { + struct { + unsigned short assert_event; /* assertion event mask */ + unsigned short deassert_event; /* de-assertion event mask */ + unsigned short read; /* discrete reaading mask */ + } discrete; + struct { + unsigned short lower; /* lower threshold reading mask */ + unsigned short upper; /* upper threshold reading mask */ + unsigned char set; /* settable threshold mask */ + unsigned char read; /* readable threshold mask */ + } threshold; + } mask; + + struct { + unsigned char pct : 1, + modifier : 2, + rate : 3, + analog : 2; + struct { + unsigned char base; + unsigned char modifier; + } type; + } unit; + + struct { + unsigned char count : 4, + mod_type : 2, + __reserved : 2; + unsigned char mod_offset : 7, + entity_inst : 1; + } share; + + struct { + struct { + unsigned char positive; + unsigned char negative; + } hysteresis; + } threshold; + + unsigned char __reserved[3]; + unsigned char oem; /* reserved for OEM use */ + unsigned char id_code; /* sensor ID string type/length code */ + unsigned char id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ + +} __attribute__ ((packed)); + +struct sdr_record_full_sensor { + struct { + unsigned char owner_id; + unsigned char lun : 2, /* sensor owner lun */ + __reserved : 2, + channel : 4; /* channel number */ + unsigned char sensor_num; /* unique sensor number */ + } keys; + + struct { + unsigned char id; /* physical entity id */ + unsigned char instance : 7, /* instance number */ + logical : 1; /* physical/logical */ + } entity; + + struct { + struct { + unsigned char sensor_scan : 1, + event_gen : 1, + type : 1, + hysteresis : 1, + thresholds : 1, + events : 1, + scanning : 1, + __reserved : 1; + } init; + struct { + unsigned char event_msg : 2, + threshold : 2, + hysteresis : 2, + rearm : 1, + ignore : 1; + } capabilities; + unsigned char type; + } sensor; + + unsigned char event_type; /* event/reading type code */ + + union { + struct { + unsigned short assert_event; /* assertion event mask */ + unsigned short deassert_event; /* de-assertion event mask */ + unsigned short read; /* discrete reaading mask */ + } discrete; + struct { + unsigned short lower; /* lower threshold reading mask */ + unsigned short upper; /* upper threshold reading mask */ + unsigned char set; /* settable threshold mask */ + unsigned char read; /* readable threshold mask */ + } threshold; + } mask; + + struct { + unsigned char pct : 1, + modifier : 2, + rate : 3, + analog : 2; + struct { + unsigned char base; + unsigned char modifier; + } type; + } unit; + + unsigned char linearization; /* 70h=non linear, 71h-7Fh=non linear, OEM */ + + unsigned short mtol; /* M, tolerance */ + + unsigned long bacc; /* accuracy, B, Bexp, Rexp */ + + struct { + unsigned char nominal_read : 1, /* nominal reading field specified */ + normal_max : 1, /* normal max field specified */ + normal_min : 1, /* normal min field specified */ + __reserved : 5; + } analog_flag; + + unsigned char nominal_read; /* nominal reading, raw value */ + unsigned char normal_max; /* normal maximum, raw value */ + unsigned char normal_min; /* normal minimum, raw value */ + unsigned char sensor_max; /* sensor maximum, raw value */ + unsigned char sensor_min; /* sensor minimum, raw value */ + + struct { + struct { + unsigned char non_recover; + unsigned char critical; + unsigned char non_critical; + } upper; + struct { + unsigned char non_recover; + unsigned char critical; + unsigned char non_critical; + } lower; + struct { + unsigned char positive; + unsigned char negative; + } hysteresis; + } threshold; + unsigned char __reserved[2]; + unsigned char oem; /* reserved for OEM use */ + unsigned char id_code; /* sensor ID string type/length code */ + unsigned char id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ +} __attribute__ ((packed)); + +/* unit description codes (IPMI v1.5 section 37.16) */ +#define UNIT_MAX 0x90 +static const char * unit_desc[] __attribute__((unused)) = { + "unspecified", + "degrees C", "degrees F", "degrees K", + "Volts", "Amps", "Watts", "Joules", + "Coulombs", "VA", "Nits", + "lumen", "lux", "Candela", + "kPa", "PSI", "Newton", + "CFM", "RPM", "Hz", + "microsecond", "millisecond", "second", "minute", "hour", "day", "week", + "mil", "inches", "feet", "cu in", "cu feet", "mm", "cm", "m", "cu cm", "cu m", + "liters", "fluid ounce", + "radians", "steradians", "revolutions", "cycles", "gravities", + "ounce", "pound", "ft-lb", "oz-in", + "gauss", "gilberts", "henry", "millihenry", + "farad", "microfarad", "ohms", "siemens", "mole", "becquerel", + "PPM", "reserved", + "Decibels", "DbA", "DbC", + "gray", "sievert", "color temp deg K", + "bit", "kilobit", "megabit", "gigabit", + "byte", "kilobyte", "megabyte", "gigabyte", + "word", "dword", "qword", "line", + "hit", "miss", "retry", "reset", + "overflow", "underrun", + "collision", "packets", + "messages", "characters", + "error", "correctable error", "uncorrectable error", +}; + +#endif /* IPMI_SDR_H */ diff --git a/ipmitool/include/ipmitool/ipmi_sel.h b/ipmitool/include/ipmitool/ipmi_sel.h new file mode 100644 index 0000000..13668b1 --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_sel.h @@ -0,0 +1,361 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_SEL_H +#define IPMI_SEL_H + +#include + +enum { + IPMI_EVENT_CLASS_DISCRETE, + IPMI_EVENT_CLASS_DIGITAL, + IPMI_EVENT_CLASS_THRESHOLD, + IPMI_EVENT_CLASS_OEM, +}; + +struct sel_get_rq { + unsigned short reserve_id; + unsigned short record_id; + unsigned char offset; + unsigned char length; +} __attribute__ ((packed)); + +struct sel_event_record { + unsigned short record_id; + unsigned char record_type; + unsigned long timestamp; + unsigned short gen_id; + unsigned char evm_rev; + unsigned char sensor_type; + unsigned char sensor_num; + unsigned char event_type : 7; + unsigned char event_dir : 1; + unsigned char event_data[3]; +} __attribute__ ((packed)); + +struct sel_oem_record_ts { + unsigned short next_id; + unsigned short record_id; + unsigned char record_type; + unsigned long timestamp; + unsigned char mfg_id[3]; + unsigned char oem_defined[6]; +} __attribute__ ((packed)); + +struct sel_oem_record_nots { + unsigned short next_id; + unsigned short record_id; + unsigned char record_type; + unsigned char oem_defined[13]; +} __attribute__ ((packed)); + + +struct ipmi_event_sensor_types { + unsigned char code; + unsigned char offset; + unsigned char class; + const char * type; + const char * desc; +}; + +static struct ipmi_event_sensor_types generic_event_types[] __attribute__((unused)) = { + /* Threshold Based States */ + { 0x01, 0x00, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical - going low" }, + { 0x01, 0x01, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical - going high" }, + { 0x01, 0x02, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical - going low" }, + { 0x01, 0x03, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical - going high" }, + { 0x01, 0x04, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable - going low" }, + { 0x01, 0x05, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable - going high" }, + { 0x01, 0x06, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical - going low" }, + { 0x01, 0x07, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical - going high" }, + { 0x01, 0x08, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical - going low" }, + { 0x01, 0x09, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical - going high" }, + { 0x01, 0x0a, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable - going low" }, + { 0x01, 0x0b, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable - going high" }, + /* DMI-based "usage state" States */ + { 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Idle" }, + { 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Active" }, + { 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Busy" }, + /* Digital-Discrete Event States */ + { 0x03, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "State Deasserted" }, + { 0x03, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "State Asserted" }, + { 0x04, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Predictive Failure Deasserted" }, + { 0x04, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Predictive Failure Asserted" }, + { 0x05, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Limit Not Exceeded" }, + { 0x05, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Limit Exceeded" }, + { 0x06, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Performance Met" }, + { 0x06, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Performance Lags" }, + /* Severity Event States */ + { 0x07, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to OK" }, + { 0x07, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critial from OK" }, + { 0x07, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Critical from less severe" }, + { 0x07, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-recoverable from less severe" }, + { 0x07, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critical from more severe" }, + { 0x07, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Critical from Non-recoverable" }, + { 0x07, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-recoverable" }, + { 0x07, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Monitor" }, + { 0x07, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Informational" }, + /* Availability Status States */ + { 0x08, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Removed/Absent" }, + { 0x08, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Inserted/Present" }, + { 0x09, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Disabled" }, + { 0x09, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Enabled" }, + { 0x0a, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Running" }, + { 0x0a, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to In Test" }, + { 0x0a, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Power Off" }, + { 0x0a, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to On Line" }, + { 0x0a, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Off Line" }, + { 0x0a, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Off Duty" }, + { 0x0a, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Degraded" }, + { 0x0a, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Power Save" }, + { 0x0a, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Install Error" }, + /* Redundancy States */ + { 0x0b, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Fully Redundant" }, + { 0x0b, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Lost" }, + { 0x0b, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded" }, + { 0x0b, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Sufficient from Redundant" }, + { 0x0b, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Sufficient from Insufficient" }, + { 0x0b, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Insufficient Resources" }, + { 0x0b, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded from Fully Redundant" }, + { 0x0b, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded from Non-Redundant" }, + /* ACPI Device Power States */ + { 0x0c, 0x00, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D0 Power State" }, + { 0x0c, 0x01, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D1 Power State" }, + { 0x0c, 0x02, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D2 Power State" }, + { 0x0c, 0x03, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D3 Power State" }, + /* END */ + { 0x00, 0x00, 0x00, NULL, NULL }, +}; + +static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unused)) = { + { 0x00, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Reserved", NULL }, + { 0x01, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Temperature", NULL }, + { 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Voltage", NULL }, + { 0x03, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Current", NULL }, + { 0x04, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Fan", NULL }, + + { 0x05, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "General Chassis intrusion" }, + { 0x05, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Drive Bay intrusion" }, + { 0x05, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "I/O Card area intrusion" }, + { 0x05, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Processor area intrusion" }, + { 0x05, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "System unplugged from LAN" }, + { 0x05, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Unauthorized dock/undock" }, + { 0x05, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "FAN area intrusion" }, + + { 0x06, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Front Panel Lockout violation attempted" }, + { 0x06, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password viiolation - user password" }, + { 0x06, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - setup password" }, + { 0x06, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - network boot password" }, + { 0x06, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Other pre-boot password violation" }, + { 0x06, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Out-of-band access password violation" }, + + { 0x07, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Processor", "IERR" }, + { 0x07, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Thermal Trip" }, + { 0x07, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB1/BIST failure" }, + { 0x07, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB2/Hang in POST failure" }, + { 0x07, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB3/Processor startup/init failure" }, + { 0x07, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Configuration Error" }, + { 0x07, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Processor", "SM BIOS Uncorrectable CPU-complex Error" }, + { 0x07, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Presence detected" }, + { 0x07, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Disabled" }, + { 0x07, 0x09, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Terminator presence detected" }, + + { 0x08, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Presence detected" }, + { 0x08, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Failure detected" }, + { 0x08, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Predictive failure" }, + { 0x08, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Power Supply AC lost" }, + { 0x08, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "AC lost or out-of-range" }, + { 0x08, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "AC out-of-range, but present" }, + + { 0x09, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power off/down" }, + { 0x09, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power cycle" }, + { 0x09, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "240VA power down" }, + { 0x09, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Interlock power down" }, + { 0x09, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "AC lost" }, + { 0x09, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Soft-power control failure" }, + { 0x09, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Failure detected" }, + { 0x09, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Predictive failure" }, + + { 0x0a, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Cooling Device", NULL }, + { 0x0b, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Other Units-based Sensor", NULL }, + + { 0x0c, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Correctable ECC" }, + { 0x0c, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Uncorrectable ECC" }, + { 0x0c, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Parity" }, + { 0x0c, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Scrub Failed" }, + { 0x0c, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Device Disabled" }, + { 0x0c, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Correctable ECC logging limit reached" }, + + { 0x0d, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", NULL }, + { 0x0e, 0x00, IPMI_EVENT_CLASS_DISCRETE, "POST Memory Resize", NULL }, + + { 0x0f, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Error" }, + { 0x0f, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Hang" }, + { 0x0f, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress" }, + + { 0x10, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Correctable memory error logging disabled" }, + { 0x10, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Event logging disabled" }, + { 0x10, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log area reset/cleared" }, + { 0x10, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "All event logging disabled" }, + + { 0x11, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "BIOS Reset" }, + { 0x11, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Reset" }, + { 0x11, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Shut Down" }, + { 0x11, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Down" }, + { 0x11, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Cycle" }, + { 0x11, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS NMI/diag Interrupt" }, + { 0x11, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Expired" }, + { 0x11, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS pre-timeout Interrupt" }, + + { 0x12, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Event", "System Reconfigured" }, + { 0x12, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Event", "OEM System boot event" }, + { 0x12, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Undetermined system hardware failure" }, + { 0x12, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Entry added to auxillary log" }, + { 0x12, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Event", "PEF Action" }, + { 0x12, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Timestamp Clock Sync." }, + + { 0x13, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Front Panel NMI" }, + { 0x13, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Timeout" }, + { 0x13, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "I/O Channel check NMI" }, + { 0x13, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Software NMI" }, + { 0x13, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "PCI PERR" }, + { 0x13, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "PCI SERR" }, + { 0x13, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "EISA failsafe timeout" }, + { 0x13, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Correctable error" }, + { 0x13, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Uncorrectable error" }, + { 0x13, 0x09, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Fatal NMI" }, + + { 0x14, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Button", "Power Button pressed" }, + { 0x14, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Button", "Sleep Button pressed" }, + { 0x14, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Button", "Reset Button pressed" }, + + { 0x15, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Module/Board", NULL }, + { 0x16, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Microcontroller/Coprocessor", NULL }, + { 0x17, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Add-in Card", NULL }, + { 0x18, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Chassis", NULL }, + { 0x19, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", NULL }, + { 0x1a, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Other FRU", NULL }, + { 0x1b, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", NULL }, + { 0x1c, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Terminator", NULL }, + + { 0x1d, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by power up" }, + { 0x1d, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by hard reset" }, + { 0x1d, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by warm reset" }, + { 0x1d, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "User requested PXE boot" }, + { 0x1d, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Automatic boot to diagnostic" }, + + { 0x1e, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "No bootable media" }, + { 0x1e, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Non-bootable disk in drive" }, + { 0x1e, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "PXE server not found" }, + { 0x1e, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Invalid boot sector" }, + { 0x1e, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Timeout waiting for selection" }, + + { 0x1f, 0x00, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "A: boot completed" }, + { 0x1f, 0x01, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "C: boot completed" }, + { 0x1f, 0x02, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "PXE boot completed" }, + { 0x1f, 0x03, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Diagnostic boot completed" }, + { 0x1f, 0x04, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "CD-ROM boot completed" }, + { 0x1f, 0x05, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "ROM boot completed" }, + { 0x1f, 0x06, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "boot completed - device not specified" }, + + { 0x20, 0x00, IPMI_EVENT_CLASS_DISCRETE, "OS Critical Stop", "Stop during OS load/init" }, + { 0x20, 0x01, IPMI_EVENT_CLASS_DISCRETE, "OS Critical Stop", "Run-time stop" }, + + { 0x21, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Fault Status asserted" }, + { 0x21, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Identify Status asserted" }, + { 0x21, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector Device installed/attached" }, + { 0x21, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector ready for device installation" }, + { 0x21, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector ready for device removal" }, + { 0x21, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot Power is off" }, + { 0x21, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector device removal request" }, + { 0x21, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Interlock asserted" }, + { 0x21, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot is disabled" }, + + { 0x22, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S0/G0: working" }, + { 0x22, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S1: sleeping with system hw & processor context maintained" }, + { 0x22, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S2: sleeping, processor context lost" }, + { 0x22, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S3: sleeping, processor & hw context lost, memory retained" }, + { 0x22, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S4: non-volatile sleep/suspend-to-disk" }, + { 0x22, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S5/G2: soft-off" }, + { 0x22, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S4/S5: soft-off" }, + { 0x22, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "G3: mechanical off" }, + { 0x22, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Sleeping in S1/S2/S3 state" }, + { 0x22, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "G1: sleeping" }, + { 0x22, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S5: entered by override" }, + { 0x22, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Legacy ON state" }, + { 0x22, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Legacy OFF state" }, + { 0x22, 0x0e, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Unknown" }, + + { 0x23, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Timer expired" }, + { 0x23, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Hard reset" }, + { 0x23, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Power down" }, + { 0x23, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Power cycle" }, + { 0x23, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" }, + { 0x23, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" }, + { 0x23, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" }, + { 0x23, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" }, + { 0x23, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Timer interrupt" }, + + { 0x24, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated page" }, + { 0x24, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated LAN alert" }, + { 0x24, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform Event Trap generated" }, + { 0x24, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated SNMP trap, OEM format" }, + + { 0x25, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Present" }, + { 0x25, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Absent" }, + { 0x25, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Disabled" }, + + { 0x26, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Monitor ASIC/IC", NULL }, + + { 0x27, 0x00, IPMI_EVENT_CLASS_DISCRETE, "LAN", "Heartbeat Lost" }, + { 0x27, 0x01, IPMI_EVENT_CLASS_DISCRETE, "LAN", "Heartbeat" }, + + { 0x28, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Sensor access degraded or unavailable" }, + { 0x28, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Controller access degraded or unavailable" }, + { 0x28, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Management controller off-line" }, + { 0x28, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Management controller unavailable" }, + + { 0x29, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Low" }, + { 0x29, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Failed" }, + { 0x29, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Presence Detected" }, + + { 0x00, 0x00, 0x00, NULL, NULL }, +}; + +int ipmi_sel_main(struct ipmi_intf *, int, char **); +void ipmi_sel_print_std_entry(int num, struct sel_event_record * evt); + +#endif /* IPMI_SEL_H */ diff --git a/ipmitool/include/ipmitool/ipmi_sol.h b/ipmitool/include/ipmitool/ipmi_sol.h new file mode 100644 index 0000000..7379221 --- /dev/null +++ b/ipmitool/include/ipmitool/ipmi_sol.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#ifndef IPMI_SOL_H +#define IPMI_SOL_H + +#include + +#define ACTIVATE_SOL 0x01 +#define SET_SOL_CONFIG 0x03 +#define GET_SOL_CONFIG 0x04 + +#define SOL_ENABLE_PARAM 0x01 +#define SOL_AUTHENTICATION_PARAM 0x02 +#define SOL_ENABLE_FLAG 0x01 +#define SOL_PRIVILEGE_LEVEL_USER 0x02 +#define SOL_BAUD_RATE_PARAM 0x05 +#define SOL_PREFERRED_BAUD_RATE 0x07 + +int ipmi_sol_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_SOL_H */ diff --git a/ipmitool/ipmitool.spec.in b/ipmitool/ipmitool.spec.in index 7030879..333f0ca 100644 --- a/ipmitool/ipmitool.spec.in +++ b/ipmitool/ipmitool.spec.in @@ -1,53 +1,95 @@ -Summary: Utility for interfacing with IPMI hardware -Name: ipmitool -Version: @@VERSION@@ +Name: @IPMITOOL_PKG@ +Summary: @IPMITOOL_PKG@ - Utility for interfacing with IPMI devices +Version: @VERSION@ Release: 1 -Copyright: Sun Microsystems -License: BSD -Group: Applications/System -Source: ipmitool.tar.gz +Copyright: BSD +Group: Utilities +Vendor: Sun Microsystems +Packager: Duncan Laurie +Source: @IPMITOOL_PKG@-@VERSION@.tar.gz +Buildroot: /var/tmp/@IPMITOOL_PKG@-root + +%package dev +Summary: Development files for ipmitool +Group: Utilities %description -This package contains a utility for interfacing with IPMI -hardware through either the Linux OpenIPMI kernel driver or -over ethernet LAN. It provides some basic functions for -reading the SDR and displaying sensor values, printing FRU -information, LAN configuration, and chassis power control. +This package contains a utility for interfacing with IPMI-enabled devices +through either the OpenIPMI kernel driver or with IPMI-over-LAN protocol. +It provides some basic functions for reading the SDR and displaying sensor +values, displaying the contents of the SEL, printing FRU information, +reading and setting LAN configuration, and chassis power control. + +%description dev +Additional development files for creating applications or interface plugins +for ipmitool. %prep -[ "$RPM_BUILD_ROOT" ] && rm -rf $RPM_BUILD_ROOT +if [ "$RPM_BUILD_ROOT" ] && [ "$RPM_BUILD_ROOT" != "/" ]; then + rm -rf $RPM_BUILD_ROOT +fi -%setup -q -n ipmitool -mkdir -p $RPM_BUILD_ROOT/usr/sbin -mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1 +%setup %build -make +./configure @ac_configure_args@ \ + --prefix=%{_prefix} \ + --bindir=%{_bindir} \ + --datadir=%{_datadir} \ + --includedir=%{_includedir} \ + --libdir=%{_libdir} \ + --mandir=%{_mandir} \ + --sysconfdir=%{_sysconfdir} +make %install -mkdir -p $RPM_BUILD_ROOT/usr/sbin -make install DESTDIR=$RPM_BUILD_ROOT -make install-man DESTDIR=$RPM_BUILD_ROOT -install -m 0755 -o root -g root bmcautoconf.sh $RPM_BUILD_ROOT/usr/sbin +make DESTDIR=$RPM_BUILD_ROOT install %clean -rm -rf $RPM_BUILD_ROOT +if [ "$RPM_BUILD_ROOT" ] && [ "$RPM_BUILD_ROOT" != "/" ]; then + rm -rf $RPM_BUILD_ROOT +fi +rm -rf $RPM_BUILD_DIR/@IPMITOOL_PKG@-@VERSION@ %files -/usr/sbin/ipmitool -/usr/sbin/bmcautoconf.sh -/usr/share/man/man1/ipmitool.1.gz +%defattr(-,root,root) +%doc %{_mandir}/man1/* +%{_bindir}/* +%dir %{_libdir}/ipmitool +%attr(755,root,root) %{_libdir}/ipmitool/* + +%files dev +%defattr(-,root,root) +%dir %{_includedir}/ipmitool +%{_includedir}/ipmitool/*.h %changelog -* Wed Nov 12 2003 1.4.1.1-1 - - first public release +* Fri Nov 14 2003 1.5.4-1 + - pull interface plugin api into library + - fix ipmievd + +* Fri Oct 31 2003 1.5.3-1 + - add -g optin for pedantic ipmi-over-lan communication + +* Fri Oct 24 2003 1.5.2-1 + - add gratuitous arp interval setting + +* Wed Oct 8 2003 1.5.1-1 + - better SEL support + - fix display bug in SDR list + +* Fri Sep 5 2003 1.5.0-1 + - use automake/autoconf/libtool + - dynamic loading interface plugins * Wed May 28 2003 1.4.0-1 - make UDP packet handling more robust + - fix imb driver support * Thu May 22 2003 1.3-1 - update manpage - rework of low-level network handling + - add basic imb driver support * Wed Apr 2 2003 1.2-1 - change command line option parsing diff --git a/ipmitool/lib/Makefile.am b/ipmitool/lib/Makefile.am new file mode 100644 index 0000000..017f0fe --- /dev/null +++ b/ipmitool/lib/Makefile.am @@ -0,0 +1,43 @@ +# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistribution of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistribution in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of Sun Microsystems, Inc. or the names of +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# This software is provided "AS IS," without a warranty of any kind. +# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. +# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE +# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF +# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, +# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +# +# You acknowledge that this software is not designed or intended for use +# in the design, construction, operation or maintenance of any nuclear +# facility. + +INCLUDES = -I$(top_srcdir)/include +MAINTAINERCLEANFILES = Makefile.in + +noinst_LTLIBRARIES = libipmitool.la +libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_lanp.c \ + ipmi_fru.c ipmi_chassis.c ipmi_bmc.c ipmi_intf.c +libipmitool_la_LDFLAGS = -export-dynamic +libipmitool_la_LIBADD = -lm $(LIBLTDL) +libipmitool_la_DEPENDENCIES = $(LIBLTDL) diff --git a/ipmitool/lib/helper.c b/ipmitool/lib/helper.c index ec01e7e..f68242c 100644 --- a/ipmitool/lib/helper.c +++ b/ipmitool/lib/helper.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include @@ -115,18 +115,13 @@ void signal_handler(int sig, void * handler) act.sa_flags = 0; if (sigemptyset(&act.sa_mask) < 0) { - printf("SIGNAL[%s] unable to empty signal set\n", - (char *)strsignal(sig)); + psignal(sig, "unable to empty signal set"); return; } if (sigaction(sig, &act, NULL) < 0) { - printf("SIGNAL[%s] unable to register handler @ %p\n", - (char *)strsignal(sig), (void *)handler); + psignal(sig, "unable to register handler"); return; } - - printf("SIGNAL[%s]: handler registered @ %p\n", - (char *)strsignal(sig), (void *)handler); } diff --git a/ipmitool/lib/ipmi_bmc.c b/ipmitool/lib/ipmi_bmc.c new file mode 100644 index 0000000..3db4ef7 --- /dev/null +++ b/ipmitool/lib/ipmi_bmc.c @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#include +#include +#include + +#include +#include +#include + +extern int verbose; + +static int ipmi_bmc_reset(struct ipmi_intf * intf, int cmd) +{ + struct ipmi_rs * rsp; + struct ipmi_rq req; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_APP; + req.msg.cmd = cmd; + req.msg.data_len = 0; + + rsp = intf->sendrecv(intf, &req); + if (!rsp) { + printf("Error in BMC Reset Command\n"); + return -1; + } + if (rsp->ccode) { + printf("BMC Reset Command returned %x\n", rsp->ccode); + return -1; + } + + return 0; +} + +int ipmi_bmc_main(struct ipmi_intf * intf, int argc, char ** argv) +{ + if (!argc || !strncmp(argv[0], "help", 4)) { + printf("BMC Commands: reset\n"); + return 0; + } + else if (!strncmp(argv[0], "reset", 5)) { + if (argc < 2 || !strncmp(argv[1], "help", 4)) { + printf("reset commands: warm, cold\n"); + } + else if (!strncmp(argv[1], "cold", 4)) { + ipmi_bmc_reset(intf, BMC_COLD_RESET); + } + else if (!strncmp(argv[1], "warm", 4)) { + ipmi_bmc_reset(intf, BMC_WARM_RESET); + } + else { + printf("reset commands: warm, cold\n"); + } + } + return 0; +} diff --git a/ipmitool/lib/ipmi_chassis.c b/ipmitool/lib/ipmi_chassis.c new file mode 100644 index 0000000..c56576f --- /dev/null +++ b/ipmitool/lib/ipmi_chassis.c @@ -0,0 +1,506 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +#include +#include +#include + +#include +#include +#include + +extern int verbose; + +static int ipmi_chassis_power_status(struct ipmi_intf * intf) +{ + struct ipmi_rs * rsp; + struct ipmi_rq req; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_CHASSIS; + req.msg.cmd = 0x1; + req.msg.data_len = 0; + + rsp = intf->sendrecv(intf, &req); + if (!rsp || rsp->ccode) { + printf("error in Chassis Status Command\n"); + return 0; + } + + printf("Chassis Power is %s\n", (rsp->data[0] & 0x1) ? "on" : "off"); + + return rsp->data[0] & 0x1; +} + +static const struct valstr ipmi_chassis_power_control_vals[] = { + { 0x00, "Down/Off" }, + { 0x01, "Up/On" }, + { 0x02, "Cycle" }, + { 0x03, "Reset" }, + { 0x04, "Pulse" }, + { 0x05, "Soft" }, + { 0x00, NULL }, +}; + +static void ipmi_chassis_power_control(struct ipmi_intf * intf, unsigned char ctl) +{ + struct ipmi_rq req; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_CHASSIS; + req.msg.cmd = 0x2; + req.msg.data = &ctl; + req.msg.data_len = 1; + + printf("Chassis Power Control: %s\n", + val2str(ctl, ipmi_chassis_power_control_vals)); + + intf->sendrecv(intf, &req); + intf->abort = 1; +} + +static void ipmi_chassis_identify(struct ipmi_intf * intf, char * arg) +{ + struct ipmi_rq req; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_CHASSIS; + req.msg.cmd = 0x4; + + printf("Chassis identify interval: "); + + if (arg) { + unsigned char interval = (unsigned char)atoi(arg); + + req.msg.data = &interval; + req.msg.data_len = 1; + + if (interval) + printf("%d seconds\n", interval); + else + printf("off\n"); + } else { + printf("default (15 seconds)\n"); + } + + intf->sendrecv(intf, &req); +} + +static void ipmi_chassis_poh(struct ipmi_intf * intf) +{ + struct ipmi_rs * rsp; + struct ipmi_rq req; + unsigned long count; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_CHASSIS; + req.msg.cmd = 0xf; + + rsp = intf->sendrecv(intf, &req); + + if (!rsp || rsp->ccode) + return; + + memcpy(&count, rsp->data+1, 4); + + printf("POH Counter : %li hours total (%li days, %li hours)\n", + count, (unsigned long)(count / 24), (unsigned long)(count % 24)); +} + +static void ipmi_chassis_restart_cause(struct ipmi_intf * intf) +{ + struct ipmi_rs * rsp; + struct ipmi_rq req; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_CHASSIS; + req.msg.cmd = 0x7; + + rsp = intf->sendrecv(intf, &req); + + if (!rsp || rsp->ccode) + return; + + printf("System restart cause: "); + + switch (rsp->data[0] & 0xf) { + case 0: + printf("unknown\n"); + break; + case 1: + printf("chassis power control command\n"); + break; + case 2: + printf("reset via pushbutton\n"); + break; + case 3: + printf("power-up via pushbutton\n"); + break; + case 4: + printf("watchdog expired\n"); + break; + case 5: + printf("OEM\n"); + break; + case 6: + printf("power-up due to always-restore power policy\n"); + break; + case 7: + printf("power-up due to restore-previous power policy\n"); + break; + case 8: + printf("reset via PEF\n"); + break; + case 9: + printf("power-cycle via PEF\n"); + break; + default: + printf("error!\n"); + } +} + +static void ipmi_chassis_status(struct ipmi_intf * intf) +{ + struct ipmi_rs * rsp; + struct ipmi_rq req; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_CHASSIS; + req.msg.cmd = 0x1; + + rsp = intf->sendrecv(intf, &req); + if (!rsp || rsp->ccode) + return; + + /* byte 1 */ + printf("System Power : %s\n", (rsp->data[0] & 0x1) ? "on" : "off"); + printf("Power Overload : %s\n", (rsp->data[0] & 0x2) ? "true" : "false"); + printf("Power Interlock : %s\n", (rsp->data[0] & 0x4) ? "active" : "inactive"); + printf("Main Power Fault : %s\n", (rsp->data[0] & 0x8) ? "true" : "false"); + printf("Power Control Fault : %s\n", (rsp->data[0] & 0x10) ? "true" : "false"); + printf("Power Restore Policy : "); + switch ((rsp->data[0] & 0x60) >> 5) { + case 0x0: + printf("always-off\n"); + break; + case 0x1: + printf("previous\n"); + break; + case 0x2: + printf("always-on\n"); + break; + case 0x3: + default: + printf("unknown\n"); + } + + /* byte 2 */ + printf("Last Power Event : "); + if (rsp->data[1] & 0x1) + printf("ac-failed "); + if (rsp->data[1] & 0x2) + printf("overload "); + if (rsp->data[1] & 0x4) + printf("interlock "); + if (rsp->data[1] & 0x8) + printf("fault "); + if (rsp->data[1] & 0x10) + printf("command"); + printf("\n"); + + /* byte 3 */ + printf("Chassis Intrusion : %s\n", (rsp->data[2] & 0x1) ? "active" : "inactive"); + printf("Front-Panel Lockout : %s\n", (rsp->data[2] & 0x2) ? "active" : "inactive"); + printf("Drive Fault : %s\n", (rsp->data[2] & 0x4) ? "true" : "false"); + printf("Cooling/Fan Fault : %s\n", (rsp->data[2] & 0x8) ? "true" : "false"); +} + +static void ipmi_chassis_set_bootparam(struct ipmi_intf * intf, unsigned char param, unsigned char * data, int len) +{ + struct ipmi_rs * rsp; + struct ipmi_rq req; + unsigned char msg_data[16]; + + memset(msg_data, 0, 16); + msg_data[0] = param & 0x7f; + memcpy(msg_data+1, data, len); + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_CHASSIS; + req.msg.cmd = 0x8; + req.msg.data = msg_data; + req.msg.data_len = len + 1; + + rsp = intf->sendrecv(intf, &req); + if (!rsp || rsp->ccode) { + printf("Error setting Chassis Boot Parameter %d\n", param); + return; + } + + printf("Chassis Set Boot Param %d to %s\n", param, data); +} + +static void ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg) +{ + struct ipmi_rs * rsp; + struct ipmi_rq req; + unsigned char msg_data[3]; + + if (!arg) + return; + + memset(msg_data, 0, 3); + + msg_data[0] = (unsigned char)atoi(arg) & 0x7f; + msg_data[1] = 0; + msg_data[2] = 0; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_CHASSIS; + req.msg.cmd = 0x9; + req.msg.data = msg_data; + req.msg.data_len = 3; + + rsp = intf->sendrecv(intf, &req); + if (!rsp || rsp->ccode) + return; + + if (verbose > 2) + printbuf(rsp->data, rsp->data_len, "Boot Option"); + + printf("Boot parameter version: %d\n", rsp->data[0]); + printf("Boot parameter %d is %s\n", rsp->data[1] & 0x7f, + (rsp->data[1] & 0x80) ? "invalid/locked" : "valid/unlocked"); + printf("Boot parameter data: %s\n", buf2str(rsp->data+2, rsp->data_len - 2)); +} + +static void ipmi_chassis_set_bootflag(struct ipmi_intf * intf, char * arg) +{ + unsigned char flags[5]; + + if (!arg) { + printf("Error: no bootflag argument supplied\n"); + return; + } + + if (!strncmp(arg, "force_pxe", 9)) { + flags[1] = 0x04; // 00000100 + } + else if (!strncmp(arg, "force_disk", 10)) { + flags[1] = 0x08; // 00001000 + } + else if (!strncmp(arg, "force_diag", 10)) { + flags[1] = 0x10; // 00010000 + } + else if (!strncmp(arg, "force_cdrom", 11)) { + flags[1] = 0x14; // 00010100 + } + else if (!strncmp(arg, "force_floppy", 12)) { + flags[1] = 0x3c; // 00111100 + } + else { + printf("Invalid bootflag: %s\n", arg); + return; + } + + flags[0] = 0x80; /* set flag valid bit */ + ipmi_chassis_set_bootparam(intf, 5, flags, 5); + + flags[0] = 0x08; /* don't automatically clear boot flag valid bit in 60 seconds */ + ipmi_chassis_set_bootparam(intf, 3, flags, 1); +} + +static void ipmi_chassis_power_policy(struct ipmi_intf * intf, unsigned char policy) +{ + struct ipmi_rs * rsp; + struct ipmi_rq req; + + if (!policy) + return; + + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_CHASSIS; + req.msg.cmd = 0x6; + req.msg.data = &policy; + req.msg.data_len = 1; + + rsp = intf->sendrecv(intf, &req); + if (!rsp || rsp->ccode) + return; + + if (policy == IPMI_CHASSIS_POLICY_NO_CHANGE) { + printf("Supported chassis power policy: "); + if (rsp->data[0] & (1<data[0] & (1<data[0] & (1<\n"); + printf(" default is 15 seconds\n"); + printf(" 0 to turn off\n"); + } else { + ipmi_chassis_identify(intf, argv[1]); + } + } + else if (!strncmp(argv[0], "poh", 3)) { + ipmi_chassis_poh(intf); + } + else if (!strncmp(argv[0], "restart_cause", 13)) { + ipmi_chassis_restart_cause(intf); + } + else if (!strncmp(argv[0], "policy", 4)) { + if (argc < 2 || !strncmp(argv[1], "help", 4)) { + printf("chassis policy \n"); + printf(" list : return supported policies\n"); + printf(" always-on : turn on when power is restored\n"); + printf(" previous : return to previous state when power is restored\n"); + printf(" always-off : stay off after power is restored\n"); + } else { + unsigned char ctl; + + if (!strncmp(argv[1], "list", 4)) + ctl = IPMI_CHASSIS_POLICY_NO_CHANGE; + else if (!strncmp(argv[1], "always-on", 9)) + ctl = IPMI_CHASSIS_POLICY_ALWAYS_ON; + else if (!strncmp(argv[1], "previous", 8)) + ctl = IPMI_CHASSIS_POLICY_PREVIOUS; + else if (!strncmp(argv[1], "always-off", 10)) + ctl = IPMI_CHASSIS_POLICY_ALWAYS_OFF; + else { + printf("invalid chassis policy: %s\n", argv[1]); + return -1; + } + + ipmi_chassis_power_policy(intf, ctl); + } + } + else if (!strncmp(argv[0], "bootparam", 7)) { + if (argc < 3 || !strncmp(argv[1], "help", 4)) { + printf("bootparam get|set