mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-07-01 10:13:35 +00:00
Compare commits
89 Commits
IPMITOOL_1
...
IPMITOOL_1
Author | SHA1 | Date | |
---|---|---|---|
8ea2f160e1 | |||
1435321c86 | |||
db7f0ba560 | |||
072c5d8461 | |||
5b8ff924e5 | |||
079f451dd0 | |||
9e06705aa4 | |||
26dd8d1429 | |||
edaf1aba33 | |||
f7590819fa | |||
2c898cfc85 | |||
0e5cbcd112 | |||
e7c7d7d2e9 | |||
122f422da7 | |||
d68bf042b1 | |||
a76f069b0a | |||
3012023e7e | |||
51104a0cb4 | |||
779a863a0c | |||
fb89d1e6ea | |||
23cf8254e2 | |||
62eeecb378 | |||
1cc46a898e | |||
98035ca03d | |||
ccd0920f37 | |||
187e25e658 | |||
90cd4acb4f | |||
3b17fb7dd8 | |||
84cd061ad4 | |||
11a35b0452 | |||
3f17e0f508 | |||
320853217c | |||
a56df3a244 | |||
7ee80165ec | |||
60b14feb65 | |||
9e08347965 | |||
8efaddec02 | |||
becaec236c | |||
45a0fa0324 | |||
81ae330e9b | |||
db3d59fe08 | |||
7b11ad75c0 | |||
c51c2b94d6 | |||
8c1dbf31c4 | |||
1c9f5127e6 | |||
b61d4cc2fb | |||
ff2d92d08c | |||
348f402739 | |||
b39d7a2015 | |||
45d8b901de | |||
402418ab6e | |||
f33274ee4d | |||
d6e686bffb | |||
3f83dc4e2e | |||
a5e813318a | |||
1a7873b684 | |||
c79cb2e740 | |||
2ee612d62b | |||
43a65a47b7 | |||
43db890016 | |||
6890e1f002 | |||
fc29d57ffc | |||
85dc962bc0 | |||
4879ab9d21 | |||
7d910260e4 | |||
18a1ff5e60 | |||
ceaa360249 | |||
37dcdc8615 | |||
b86dd5e8b8 | |||
dd87b050b8 | |||
702627f6b3 | |||
57a1ea3801 | |||
ff9c8dd094 | |||
c42d2caaa7 | |||
41720d46ec | |||
c56a70c0d9 | |||
19c0f522ed | |||
d52f792652 | |||
3177b09272 | |||
4de32a37e8 | |||
05df8eb9a2 | |||
5c337dcdf6 | |||
897e1c6a20 | |||
b502dc0bc7 | |||
fcb6595b6e | |||
2cca8ad7ba | |||
5d55d7dcfe | |||
003b4ee57e | |||
357d98b74d |
3
ipmitool/AUTHORS
Normal file
3
ipmitool/AUTHORS
Normal file
@ -0,0 +1,3 @@
|
||||
Duncan Laurie <duncan@sun.com>
|
||||
Fredrik <20>hrn <ohrn@chl.chalmers.se>
|
||||
Jon Cassorla <jon.cassorla@newisys.com>
|
46
ipmitool/ChangeLog
Normal file
46
ipmitool/ChangeLog
Normal file
@ -0,0 +1,46 @@
|
||||
version 1.5.8
|
||||
* Enable static compilation of interfaces
|
||||
* Fix types to be 64-bit safe
|
||||
* Fix compilation problems on Solaris
|
||||
* Fix multiple big-endian problems for Solaris/SPARC
|
||||
* Fix channel access to save settings to NVRAM
|
||||
* Set channel privilege limit to ADMIN during "access on"
|
||||
* Enable gratuitous ARP in bmcautoconf.sh
|
||||
* Add support for Linux kernel panic messages in SEL output
|
||||
* Add support for type 3 SDR records
|
||||
|
||||
version 1.5.7
|
||||
* Add IPMIv1.5 eratta fixes
|
||||
* Additions to FRU printing and FRU multirecords
|
||||
* Better handling of SDR printing
|
||||
* Contrib scripts for creating rrdtool graphs
|
||||
|
||||
version 1.5.6
|
||||
* Fix SEL event decoding for generic events
|
||||
* Handle empty SEL gracefully when doing "sel list"
|
||||
* Fix sdr handling of sensors that do not return a reading
|
||||
* Fix for CSV display of sensor readings/units from Fredrik <20>hrn
|
||||
|
||||
version 1.5.5
|
||||
* Add -U option for setting LAN username
|
||||
* Fix -v usage for plugin interfaces
|
||||
|
||||
version 1.5.4
|
||||
* Put interface plugin API into library
|
||||
* Fix ipmievd
|
||||
|
||||
version 1.5.3
|
||||
* Add -g option to work with grizzly bmc
|
||||
|
||||
version 1.5.2
|
||||
* Add support for setting gratuitous arp interval
|
||||
|
||||
version 1.5.1
|
||||
* Better SEL support
|
||||
* Fix display bug in SDR list
|
||||
|
||||
version 1.5.0
|
||||
* More robust UDP packet handling
|
||||
* Add Intel IMB driver support
|
||||
* Use autoconf/automake/libtool
|
||||
|
@ -32,15 +32,13 @@
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
EXTRA_DIST = ipmitool.spec.in control/pkginfo control/prototype debian/*
|
||||
EXTRA_DIST = ipmitool.spec.in AUTHORS COPYING ChangeLog 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)
|
||||
SUBDIRS = libltdl lib src include doc contrib
|
||||
|
||||
dist-hook: ipmitool.spec
|
||||
cp ipmitool.spec $(distdir)
|
||||
|
@ -1,132 +0,0 @@
|
||||
#!/bin/bash
|
||||
# bmcautoconf [interface] [channel]
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
: ${DEBUG:=0}
|
||||
: ${IFACE:=eth0}
|
||||
: ${CHANNEL:=7}
|
||||
: ${IPMIINTF:=dev}
|
||||
|
||||
# util locations
|
||||
IPMITOOL=/usr/sbin/ipmitool
|
||||
PING=/bin/ping
|
||||
ARP=/sbin/arp
|
||||
IFCONFIG=/sbin/ifconfig
|
||||
ROUTE=/sbin/route
|
||||
|
||||
ipmitool_lan_set ()
|
||||
{
|
||||
[ $# -lt 2 ] && return
|
||||
PARAM=$1
|
||||
VALUE=$2
|
||||
|
||||
if [ $DEBUG -gt 0 ]; then
|
||||
echo "Setting LAN parameter ${PARAM} to ${VALUE}"
|
||||
echo "$IPMITOOL -I $IPMIINTF lan set $CHANNEL $PARAM $VALUE"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! -x $IPMITOOL ]; then
|
||||
echo "Error: unable to find $IPMITOOL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
IFACE=$1
|
||||
if ! $IFCONFIG $IFACE | grep -q "inet addr:" >/dev/null 2>&1 ; then
|
||||
echo "Error: unable to find interface $IFACE"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $# -ge 2 ]; then
|
||||
CHANNEL=$2
|
||||
if [ $CHANNEL -ne 6 ] && [ $CHANNEL -ne 7 ]; then
|
||||
echo "Invalid channel: $CHANNEL"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
[ $DEBUG -gt 0 ] && echo "Auto-configuring $IFACE (channel $CHANNEL)"
|
||||
|
||||
# IP Address
|
||||
IP_ADDRESS=$( $IFCONFIG $IFACE | grep "inet addr:" | awk -F"[:[:space:]]+" '{ print $4 }' )
|
||||
if [ X$IP_ADDRESS = X ]; then
|
||||
echo "Unable to determine IP address for interface $IFACE"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Netmask
|
||||
IP_NETMASK=$( $IFCONFIG $IFACE | grep "inet addr:" | awk -F"[:[:space:]]+" '{ print $8 }' )
|
||||
if [ X$IP_NETMASK = X ]; then
|
||||
echo "Unable to determine IP netmask for interface $IFACE"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# MAC Address
|
||||
MAC_ADDRESS=$( $IFCONFIG $IFACE | grep "HWaddr" | awk '{ print $5 }' )
|
||||
if [ X$MAC_ADDRESS = X ]; then
|
||||
echo "Unable to determine MAC address for interface $IFACE"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
# default route IP Address
|
||||
DEF_ROUTE_IP=$( $ROUTE -n | awk '/^0.0.0.0/ { print $2 }' )
|
||||
if [ X$DEF_ROUTE_IP = X ]; then
|
||||
echo "Unable to determine default route IP address"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
# Default Route MAC Address
|
||||
# (ping it first to populate arp table)
|
||||
$PING -q -c1 >/dev/null 2>&1
|
||||
DEF_ROUTE_MAC=$( $ARP -an -i $IFACE | grep $DEF_ROUTE_IP | awk '{ print $4 }' )
|
||||
if [ X$DEF_ROUTE_MAC = X ]; then
|
||||
echo "Unable to determine default route MAC address"
|
||||
exit 6
|
||||
fi
|
||||
|
||||
ipmitool_lan_set "ipsrc" "static"
|
||||
ipmitool_lan_set "ipaddr" $IP_ADDRESS
|
||||
ipmitool_lan_set "netmask" $IP_NETMASK
|
||||
ipmitool_lan_set "macaddr" $MAC_ADDRESS
|
||||
ipmitool_lan_set "defgw ipaddr" $DEF_ROUTE_IP
|
||||
ipmitool_lan_set "defgw macaddr" $DEF_ROUTE_MAC
|
||||
ipmitool_lan_set "auth callback,user,operator,admin"
|
||||
|
||||
exit 0
|
@ -2,8 +2,8 @@ dnl
|
||||
dnl autoconf for ipmitool
|
||||
dnl
|
||||
AC_INIT([src/ipmitool.c])
|
||||
AM_INIT_AUTOMAKE([ipmitool], [1.5.4])
|
||||
AM_CONFIG_HEADER([config.h])
|
||||
AM_INIT_AUTOMAKE([ipmitool], [1.5.8])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_SRCDIR([src/ipmitool.c])
|
||||
AC_PREREQ(2.50)
|
||||
|
||||
@ -13,53 +13,37 @@ 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
|
||||
dnl setup libtool
|
||||
AC_LIB_LTDL
|
||||
AC_LIBTOOL_DLOPEN
|
||||
AC_LIBLTDL_CONVENIENCE
|
||||
AM_PROG_LIBTOOL
|
||||
LIBTOOL="$LIBTOOL --silent"
|
||||
AC_SUBST(LTDLINCL)
|
||||
AC_SUBST(INCLTDL)
|
||||
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
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
dnl check for lib functions
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_FUNC_STAT
|
||||
@ -68,9 +52,20 @@ 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
|
||||
AC_CHECK_HEADERS([sys/byteorder.h byteswap.h])
|
||||
|
||||
dnl set kernel directory for openipmi header files
|
||||
AC_ARG_WITH([kerneldir],
|
||||
[[ --with-kerneldir=DIR Set kernel path to DIR]],
|
||||
[kerneldir="$withval"],
|
||||
[kerneldir="/usr/src/linux-2.4"])
|
||||
CFLAGS="$CFLAGS -I${kerneldir}/include"
|
||||
AC_SUBST(CFLAGS)
|
||||
|
||||
have_openipmi=no
|
||||
AC_CHECK_HEADER([linux/ipmi.h],
|
||||
[have_openipmi=yes],
|
||||
[AC_MSG_WARN([Unable to find OpenIPMI header files])])
|
||||
|
||||
if test "x$prefix" = "xNONE"; then
|
||||
prefix="$ac_default_prefix"
|
||||
@ -89,45 +84,94 @@ AC_ARG_WITH([plugin-path],
|
||||
AC_DEFINE_UNQUOTED(PLUGIN_PATH, "$pluginpath", "IPMI interface plugin path")
|
||||
AC_SUBST(pluginpath)
|
||||
|
||||
STATIC_INTF_LIST=
|
||||
STATIC_INTF=
|
||||
STATIC_INTF_EXT=
|
||||
STATIC_INTF_LIB=
|
||||
|
||||
PLUGIN_INTF_LAN=
|
||||
STATIC_INTF_LAN=
|
||||
LDFLAGS_INTF_LAN=
|
||||
AC_ARG_ENABLE([intf-lan],
|
||||
[[ --enable-intf-lan enable IPMI-over-LAN interface [default=yes]]],
|
||||
[if test "x$enableval" = "xyes"; then
|
||||
PLUGINS="$PLUGINS lan"
|
||||
AC_SUBST(INTF_LAN,lan)
|
||||
PLUGIN_INTF_LAN="libintf_lan.la"
|
||||
LDFLAGS_INTF_LAN="-rpath $pluginpath -avoid-version"
|
||||
DYNAMIC_INTF_LIST="lan $DYNAMIC_INTF_LIST"
|
||||
elif test "x$enableval" = "xstatic"; then
|
||||
AC_SUBST(INTF_LAN,lan)
|
||||
STATIC_INTF_LAN="libintf_lan.la"
|
||||
STATIC_INTF_LIST="lan $STATIC_INTF_LIST"
|
||||
fi],
|
||||
[PLUGINS="$PLUGINS lan"])
|
||||
[AC_SUBST(INTF_LAN,lan)
|
||||
PLUGIN_INTF_LAN="libintf_lan.la"
|
||||
LDFLAGS_INTF_LAN="-rpath $pluginpath -avoid-version"
|
||||
DYNAMIC_INTF_LIST="lan $DYNAMIC_INTF_LIST"
|
||||
])
|
||||
AC_SUBST(PLUGIN_INTF_LAN)
|
||||
AC_SUBST(STATIC_INTF_LAN)
|
||||
AC_SUBST(LDFLAGS_INTF_LAN)
|
||||
|
||||
PLUGIN_INTF_OPEN=
|
||||
STATIC_INTF_OPEN=
|
||||
LDFLAGS_INTF_OPEN=
|
||||
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"
|
||||
AC_SUBST(INTF_OPEN,open)
|
||||
PLUGIN_INTF_OPEN="libintf_open.la"
|
||||
LDFLAGS_INTF_OPEN="-rpath $pluginpath -avoid-version"
|
||||
DYNAMIC_INTF_LIST="open $DYNAMIC_INTF_LIST"
|
||||
else
|
||||
echo "** Unable to build OpenIPMI interface support!"
|
||||
exit 1
|
||||
fi
|
||||
elif test "x$enableval" = "xstatic"; then
|
||||
AC_SUBST(INTF_OPEN,open)
|
||||
STATIC_INTF_OPEN="libintf_open.la"
|
||||
STATIC_INTF_LIST="open $STATIC_INTF_LIST"
|
||||
fi])
|
||||
AC_SUBST(PLUGIN_INTF_OPEN)
|
||||
AC_SUBST(STATIC_INTF_OPEN)
|
||||
AC_SUBST(LDFLAGS_INTF_OPEN)
|
||||
|
||||
AC_SUBST(PLUGINS)
|
||||
for name in $STATIC_INTF_LIST; do
|
||||
STATIC_INTF="$STATIC_INTF { \"intf_${name}\", ${name}_intf_setup },";
|
||||
STATIC_INTF_EXT="$STATIC_INTF_EXT extern int ${name}_intf_setup(struct ipmi_intf ** intf);";
|
||||
STATIC_INTF_LIB="$STATIC_INTF_LIB \$(top_builddir)/src/plugins/${name}/libintf_${name}.la";
|
||||
done
|
||||
|
||||
AC_SUBST(STATIC_INTF)
|
||||
AC_SUBST(STATIC_INTF_EXT)
|
||||
AC_SUBST(STATIC_INTF_LIB)
|
||||
|
||||
AC_ARG_ENABLE([ipmievd],
|
||||
[[ --enable-ipmievd enable IPMI event daemon [default=no]]],,)
|
||||
|
||||
[[ --enable-ipmievd enable IPMI event daemon [default=no]]],,enable_ipmievd=no)
|
||||
AM_CONDITIONAL(IPMIEVD, test "x$enable_ipmievd" = "xyes")
|
||||
|
||||
AC_CONFIG_FILES([ipmitool.spec
|
||||
Makefile
|
||||
doc/Makefile
|
||||
contrib/Makefile
|
||||
lib/Makefile
|
||||
include/Makefile
|
||||
include/ipmitool/Makefile
|
||||
src/Makefile
|
||||
src/plugins/ipmi_intf_static.c
|
||||
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
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_RESULT([$PACKAGE $VERSION])
|
||||
AC_MSG_RESULT([])
|
||||
AC_MSG_RESULT([ Interface Path........ : $pluginpath])
|
||||
AC_MSG_RESULT([ Static Interfaces..... : $STATIC_INTF_LIST])
|
||||
AC_MSG_RESULT([ Dynamic Interfaces.... : $DYNAMIC_INTF_LIST])
|
||||
AC_MSG_RESULT([ Build ipmievd......... : $enable_ipmievd])
|
||||
AC_MSG_RESULT([])
|
||||
|
||||
|
@ -32,70 +32,7 @@
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
V_MAJ = 1
|
||||
V_MIN = 4
|
||||
V_REV = 1.1
|
||||
VERSION = $(V_MAJ).$(V_MIN).$(V_REV)
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
PROG = ipmitool
|
||||
SPEC = $(PROG).spec
|
||||
MAN = $(PROG).1
|
||||
OBJS = main.o ipmi_sdr.o ipmi_sel.o ipmi_fru.o ipmi_chassis.o ipmi_lanp.o
|
||||
|
||||
LIB = libipmitool.a
|
||||
LIB_OBJS= lib/helper.o lib/ipmi_dev.o lib/ipmi_lan.o
|
||||
|
||||
CC = gcc
|
||||
RM = rm -f
|
||||
AR = ar rc
|
||||
RANLIB = ranlib
|
||||
STRIP = strip
|
||||
|
||||
INCLUDE = -I include
|
||||
CFLAGS = -g -Wall -Werror -D_GNU_SOURCE -DVERSION=\"$(VERSION)\"
|
||||
LDFLAGS = -L . -lm -lipmitool
|
||||
|
||||
SBINDIR = $(DESTDIR)/usr/sbin
|
||||
MANDIR = $(DESTDIR)/usr/share/man/man1
|
||||
|
||||
.PHONY: all
|
||||
all: $(LIB) $(PROG) man
|
||||
|
||||
$(PROG): $(OBJS)
|
||||
$(CC) $(INCLUDE) -o $@ $(OBJS) $(LDFLAGS)
|
||||
|
||||
$(LIB): $(LIB_OBJS)
|
||||
$(AR) $(LIB) $?
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
install: $(PROG)
|
||||
strip $(PROG)
|
||||
install -m755 -o root -g root $(PROG) $(SBINDIR)/$(PROG)
|
||||
|
||||
install-man: man
|
||||
gzip -c $(PROG).1 > $(MANDIR)/$(PROG).1.gz
|
||||
|
||||
clean:
|
||||
-$(RM) $(PROG) $(SPEC) $(MAN) $(LIB)
|
||||
-$(RM) $(OBJS)
|
||||
-$(RM) $(LIB_OBJS)
|
||||
|
||||
dist: clean spec
|
||||
tar -C .. -czf ../$(PROG)-$(VERSION).tar.gz $(PROG)
|
||||
|
||||
man:
|
||||
sed -e "s/@@VERSION@@/$(VERSION)/" $(MAN).in > $(MAN)
|
||||
|
||||
spec:
|
||||
sed -e "s/@@VERSION@@/$(VERSION)/" $(SPEC).in > $(SPEC)
|
||||
|
||||
rpm: spec
|
||||
tar -C .. -czf $(PROG).tar.gz $(PROG); \
|
||||
RPM=`which rpmbuild`; \
|
||||
if [ -z "$$RPM" ]; then RPM=rpm; fi; \
|
||||
$$RPM -ta $(PROG).tar.gz; \
|
||||
rm $(PROG).tar.gz
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -c $(@D)/$(<F) -o $(@D)/$(@F)
|
||||
EXTRA_DIST = collect_data.sh create_rrds.sh create_webpage.sh
|
||||
|
29
ipmitool/contrib/collect_data.sh
Executable file
29
ipmitool/contrib/collect_data.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2003 Fredrik Ohrn. All Rights Reserved.
|
||||
#
|
||||
# See the included COPYING file for license details.
|
||||
#
|
||||
|
||||
# Edit the variables
|
||||
|
||||
hostname=$HOSTNAME
|
||||
|
||||
ipmi_cmd="/usr/local/bin/ipmitool -I open"
|
||||
rrd_dir="/some/dir/rrd"
|
||||
|
||||
# No need to edit below this point.
|
||||
|
||||
IFS="
|
||||
"
|
||||
|
||||
for line in `eval $ipmi_cmd -c sdr list full` ; do
|
||||
|
||||
IFS=,
|
||||
|
||||
split=($line)
|
||||
|
||||
file="$rrd_dir/$hostname-${split[0]}.rrd"
|
||||
|
||||
rrdupdate "$file" "N:${split[1]}"
|
||||
done
|
40
ipmitool/contrib/create_rrds.sh
Executable file
40
ipmitool/contrib/create_rrds.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2003 Fredrik Ohrn. All Rights Reserved.
|
||||
#
|
||||
# See the included COPYING file for license details.
|
||||
#
|
||||
|
||||
# Edit the variables
|
||||
|
||||
hostname=$HOSTNAME
|
||||
|
||||
ipmi_cmd="/usr/local/bin/ipmitool -I open"
|
||||
rrd_dir="/some/dir/rrd"
|
||||
|
||||
# No need to edit below this point.
|
||||
|
||||
IFS="
|
||||
"
|
||||
|
||||
for line in `eval $ipmi_cmd -c -v sdr list full` ; do
|
||||
|
||||
IFS=,
|
||||
|
||||
split=($line)
|
||||
|
||||
file="$rrd_dir/$hostname-${split[0]}.rrd"
|
||||
|
||||
if [ -e "$file" ] ; then
|
||||
echo "Skipping existing file $file"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "Creating file $file"
|
||||
|
||||
rrdtool create "$file" \
|
||||
--step 300 DS:var:GAUGE:900:${split[16]}:${split[17]} \
|
||||
RRA:AVERAGE:0.5:1:288 \
|
||||
RRA:AVERAGE:0.5:6:336 \
|
||||
RRA:AVERAGE:0.5:12:720
|
||||
done
|
191
ipmitool/contrib/create_webpage.sh
Executable file
191
ipmitool/contrib/create_webpage.sh
Executable file
@ -0,0 +1,191 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2003 Fredrik Ohrn. All Rights Reserved.
|
||||
#
|
||||
# See the included COPYING file for license details.
|
||||
#
|
||||
|
||||
# Edit the variables
|
||||
|
||||
hostname=$HOSTNAME
|
||||
|
||||
ipmi_cmd="/usr/local/bin/ipmitool -I open"
|
||||
rrd_dir="/some/dir/rrd"
|
||||
|
||||
# Full path to the rrdcgi executable.
|
||||
rrdcgi=/usr/local/bin/rrdcgi
|
||||
|
||||
# Where should rrdcgi store the graphs? This path must be within the
|
||||
# document root and writable by the webserver user.
|
||||
img_dir=/usr/local/apache2/htdocs/images/graphs
|
||||
|
||||
# Where will the graphs show up on the webserver?
|
||||
web_dir=/images/graphs
|
||||
|
||||
# No need to edit below this point.
|
||||
|
||||
color[0]="0000FF"
|
||||
color[1]="00FF00"
|
||||
color[2]="FF0000"
|
||||
color[3]="FFFF00"
|
||||
color[4]="FF00FF"
|
||||
color[5]="00FFFF"
|
||||
color[6]="4444AA"
|
||||
color[7]="44AA44"
|
||||
color[8]="AA4444"
|
||||
color[9]="AAAA44"
|
||||
color[10]="AA44AA"
|
||||
color[11]="44AAAA"
|
||||
|
||||
cat << EOF
|
||||
#!$rrdcgi
|
||||
<html>
|
||||
<head>
|
||||
<title>$hostname</title>
|
||||
<RRD::GOODFOR 300>
|
||||
<body>
|
||||
<h2>$hostname</h2>
|
||||
EOF
|
||||
|
||||
|
||||
IFS="
|
||||
"
|
||||
|
||||
i=0
|
||||
groups=
|
||||
|
||||
for line in `eval $ipmi_cmd -c -v sdr list full` ; do
|
||||
|
||||
IFS=,
|
||||
|
||||
split=($line)
|
||||
|
||||
file="$rrd_dir/$hostname-${split[0]}.rrd"
|
||||
group=`echo "${split[2]} ${split[*]:10:6}" | tr ' .-' ___`
|
||||
|
||||
group_color=${group}_color
|
||||
|
||||
if [ -z "${!group}" ] ; then
|
||||
groups="$groups $group"
|
||||
|
||||
declare $group_color=0
|
||||
|
||||
group_unit=${group}_unit
|
||||
declare $group_unit="${split[2]}"
|
||||
|
||||
group_title=${group}_title
|
||||
declare $group_title="${split[5]} / ${split[6]}"
|
||||
|
||||
group_thres=${group}_thres
|
||||
declare $group_thres="${split[10]},${split[11]},${split[12]},${split[13]},${split[14]},${split[15]}"
|
||||
fi
|
||||
|
||||
declare $group="${!group}
|
||||
DEF:var$i=\"$file\":var:AVERAGE LINE1:var$i#${color[${!group_color}]}:\"${split[0]}\""
|
||||
|
||||
declare $group_color=$[ ${!group_color} + 1 ]
|
||||
|
||||
c=$[ c + 1 ]
|
||||
i=$[ i + 1 ]
|
||||
done
|
||||
|
||||
IFS=" "
|
||||
|
||||
for group in $groups ; do
|
||||
|
||||
group_unit=${group}_unit
|
||||
group_title=${group}_title
|
||||
group_thres=${group}_thres
|
||||
|
||||
IFS=,
|
||||
|
||||
split=(${!group_thres})
|
||||
|
||||
thres=
|
||||
|
||||
if [ -n "${split[0]}" ] ; then
|
||||
if [ -n "${split[3]}" ] ; then
|
||||
thres="
|
||||
HRULE:${split[0]}#000000
|
||||
HRULE:${split[3]}#000000:\"Upper & lower non-recoverable thresholds\""
|
||||
else
|
||||
thres="
|
||||
HRULE:${split[0]}#000000:\"Upper non-recoverable threshold\""
|
||||
fi
|
||||
else
|
||||
if [ -n "${split[3]}" ] ; then
|
||||
thres="
|
||||
HRULE:${split[3]}#000000:\"Lower non-recoverable threshold\""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${split[1]}" ] ; then
|
||||
if [ -n "${split[4]}" ] ; then
|
||||
thres="$thres
|
||||
HRULE:${split[1]}#FF0000
|
||||
HRULE:${split[4]}#FF0000:\"Upper & lower critical thresholds\""
|
||||
else
|
||||
thres="$thres
|
||||
HRULE:${split[1]}#FF0000:\"Upper critical threshold\""
|
||||
fi
|
||||
else
|
||||
if [ -n "${split[4]}" ] ; then
|
||||
thres="$thres
|
||||
HRULE:${split[4]}#FF0000:\"Lower critical threshold\""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${split[2]}" ] ; then
|
||||
if [ -n "${split[5]}" ] ; then
|
||||
thres="$thres
|
||||
HRULE:${split[2]}#FFCC00
|
||||
HRULE:${split[5]}#FFCC00:\"Upper & lower warning thresholds\""
|
||||
else
|
||||
thres="$thres
|
||||
HRULE:${split[2]}#FFCC00:\"Upper warning threshold\""
|
||||
fi
|
||||
else
|
||||
if [ -n "${split[5]}" ] ; then
|
||||
thres="$thres
|
||||
HRULE:${split[5]}#FFCC00:\"Lower warning threshold\""
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
cat << EOF
|
||||
<h3>${!group_title}</h3>
|
||||
<RRD::GRAPH "$img_dir/$hostname-$group-daily.gif"
|
||||
--imginfo "<img src="$web_dir/%s" width="%lu" height="%lu">"
|
||||
--lazy
|
||||
--height 200
|
||||
--vertical-label "${!group_unit}"
|
||||
--title "Daily graph"
|
||||
--width 576 ${!group} $thres
|
||||
>
|
||||
<RRD::GRAPH "$img_dir/$hostname-$group-weekly.gif"
|
||||
--imginfo "<img src="$web_dir/%s" width="%lu" height="%lu">"
|
||||
--lazy
|
||||
--start -7d
|
||||
--height 200
|
||||
--vertical-label "${!group_unit}"
|
||||
--title "Weelky graph"
|
||||
--width 672 ${!group} $thres
|
||||
>
|
||||
EOF
|
||||
#<RRD::GRAPH "$img_dir/$hostname-$group-monthly.gif"
|
||||
# --imginfo "<img src="$web_dir/%s" width="%lu" height="%lu">"
|
||||
# --lazy
|
||||
# --start -30d
|
||||
# --height 200
|
||||
# --vertical-label "${!group_unit}"
|
||||
# --title "Monthly graph"
|
||||
# --width 720 ${!group} $thres
|
||||
#>
|
||||
#EOF
|
||||
|
||||
done
|
||||
|
||||
cat << EOF
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
@ -1,3 +1,42 @@
|
||||
ipmitool (1.5.8) unstable; urgency=low
|
||||
|
||||
* Enable static compilation of interfaces
|
||||
* Fix types to be 64-bit safe
|
||||
* Fix compilation problems on Solaris
|
||||
* Fix multiple big-endian problems for Solaris/SPARC
|
||||
* Fix channel access to save settings to NVRAM
|
||||
* Set channel privilege limit to ADMIN during "access on"
|
||||
* Enable gratuitous ARP in bmcautoconf.sh
|
||||
* Add support for Linux kernel panic messages in SEL output
|
||||
* Add support for type 3 SDR records
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Tue, 27 Jan 2004 16:23:25 -0700
|
||||
|
||||
ipmitool (1.5.7) unstable; urgency=low
|
||||
|
||||
* add IPMIv1.5 eratta fixes
|
||||
* additions to FRU printing and FRU multirecords
|
||||
* better handling of SDR printing
|
||||
* contrib scripts for creating rrdtool graphs
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Mon, 5 Jan 2004 17:29:50 -0700
|
||||
|
||||
ipmitool (1.5.6) unstable; urgency=low
|
||||
|
||||
* Fix SEL event decoding for generic events
|
||||
* Handle empty SEL gracefully when doing "sel list"
|
||||
* Fix sdr handling of sensors that do not return a reading
|
||||
* Fix for CSV display of sensor readings/units from Fredrik <20>hrn
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Thu, 4 Dec 2003 14:47:19 -0700
|
||||
|
||||
ipmitool (1.5.5) unstable; urgency=low
|
||||
|
||||
* Add -U option for setting LAN username
|
||||
* Fix -v usage for plugin interfaces
|
||||
|
||||
-- Duncan Laurie <duncan@sun.com> Tue, 25 Nov 2003 15:10:48 -0700
|
||||
|
||||
ipmitool (1.5.4) unstable; urgency=low
|
||||
|
||||
* Put interface plugin API into library
|
||||
|
@ -1,3 +1,2 @@
|
||||
usr/bin
|
||||
usr/lib/ipmitool
|
||||
usr/include/ipmitool
|
||||
|
@ -1,290 +0,0 @@
|
||||
.TH "ipmitool" "1" "1.4.1.1" "Duncan Laurie" ""
|
||||
.SH "NAME"
|
||||
.LP
|
||||
ipmitool \- utility for IPMI control
|
||||
.SH "SYNTAX"
|
||||
.LP
|
||||
ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIlan\fP \fB\-H\fR \fIaddress\fP [\fB\-P\fR \fIpassword\fP] <\fIexpression\fP>
|
||||
.br
|
||||
ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIdev\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\-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 \fIdev\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 dev help
|
||||
.br
|
||||
Commands: chassis, fru, lan, sdr, sel
|
||||
.LP
|
||||
.PP
|
||||
ipmitool -I dev chassis help
|
||||
.br
|
||||
Chassis Commands: status, power, identify, policy, restart_cause
|
||||
.LP
|
||||
.PP
|
||||
ipmitool -I dev 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 dev 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 dev 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
|
||||
.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
|
||||
\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 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 list
|
||||
This command will list the contents of the SEL.
|
||||
.RE
|
||||
.SH "DEV INTERFACE"
|
||||
.LP
|
||||
The ipmitool \fIdev\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/ipmi/0\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/ipmi/0 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 dev [option...]
|
||||
.LP
|
||||
Alternatively if you do not provide a hostname on the command line ipmitool will assume you want to use the dev 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. 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...] <address> [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 straight password/key.
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I /dev/ipmi/0
|
||||
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
|
||||
.LP
|
||||
Chassis Power is off.
|
||||
.br
|
||||
Chassis Power Control: on
|
||||
.LP
|
||||
ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power status
|
||||
.LP
|
||||
Chassis Power is on.
|
||||
.SH "AUTHOR"
|
||||
.LP
|
||||
Duncan Laurie <duncan@sun.com>
|
||||
.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/
|
@ -18,9 +18,12 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
./configure --enable-intf-lan --enable-intf-open \
|
||||
./configure --prefix=/usr \
|
||||
--with-pluginpath=/usr/lib/ipmitool \
|
||||
--enable-intf-lan=static \
|
||||
--enable-intf-open=static \
|
||||
--enable-ipmievd \
|
||||
--prefix=/usr --mandir=/usr/share/man
|
||||
--mandir=/usr/share/man
|
||||
touch configure-stamp
|
||||
|
||||
#Architecture
|
||||
|
@ -4,7 +4,7 @@
|
||||
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>
|
||||
ipmitool [\fB\-ghcvV\fR] \fB\-I\fR \fIlan\fP \fB\-H\fR \fIhostname\fP [\fB\-P\fR \fIpassword\fP] <\fIexpression\fP>
|
||||
.br
|
||||
ipmitool [\fB\-ghcvV\fR] \fB\-I\fR \fIopen\fP <\fIexpression\fP>
|
||||
.SH "DESCRIPTION"
|
||||
@ -36,6 +36,9 @@ Remote server address, can be IP address or hostname. This option is required f
|
||||
.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.
|
||||
.TP
|
||||
\fB\-U\fR <\fIusername\fP>
|
||||
Remote username, default is NULL user.
|
||||
.SH "EXPRESSIONS"
|
||||
.LP
|
||||
.TP
|
||||
@ -304,9 +307,7 @@ Once they are loaded there will be a dynamic char device entry that must exist a
|
||||
.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.
|
||||
ipmitool \-I open <expression>
|
||||
.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.
|
||||
@ -317,7 +318,7 @@ The LAN interface is an authenticatiod multi\-session connection; messages deliv
|
||||
.LP
|
||||
You can tell ipmitool to use the lan interface with the \fB\-I\fR option:
|
||||
.PP
|
||||
ipmitool \-I lan [option...] <address> [password]
|
||||
ipmitool \-I lan \-H <hostname> \-P [password] <expression>
|
||||
.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"
|
||||
@ -341,8 +342,11 @@ Duncan Laurie <duncan@sun.com>
|
||||
.SH "SEE ALSO"
|
||||
.LP
|
||||
.TP
|
||||
IPMItool Homepage
|
||||
http://ipmitool.sourceforge.net
|
||||
.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/
|
||||
http://openipmi.sourceforge.net
|
||||
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* 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 __ASF_H
|
||||
#define __ASF_H
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi_lan.h>
|
||||
|
||||
#define ASF_RMCP_IANA 0x000011be
|
||||
|
||||
#define ASF_TYPE_PING 0x80
|
||||
#define ASF_TYPE_PONG 0x40
|
||||
|
||||
static const struct valstr asf_type_vals[] __attribute__((unused)) = {
|
||||
{ 0x10, "Reset" },
|
||||
{ 0x11, "Power-up" },
|
||||
{ 0x12, "Unconditional Power-down" },
|
||||
{ 0x13, "Power Cycle" },
|
||||
{ 0x40, "Presence Pong" },
|
||||
{ 0x41, "Capabilities Response" },
|
||||
{ 0x42, "System State Response" },
|
||||
{ 0x80, "Presence Ping" },
|
||||
{ 0x81, "Capabilities Request" },
|
||||
{ 0x82, "System State Request" },
|
||||
{ 0x00, NULL }
|
||||
};
|
||||
|
||||
/* ASF message header */
|
||||
struct asf_hdr {
|
||||
unsigned long iana;
|
||||
unsigned char type;
|
||||
unsigned char tag;
|
||||
unsigned char __reserved;
|
||||
unsigned char len;
|
||||
} __attribute__((packed));
|
||||
|
||||
int handle_asf(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
|
||||
#endif /* __ASF_H */
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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 __HELPER_H
|
||||
#define __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 /* __HELPER_H */
|
||||
|
@ -1,117 +0,0 @@
|
||||
/*
|
||||
* 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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/ipmi.h>
|
||||
|
||||
#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_req_entry {
|
||||
struct ipmi_req req;
|
||||
struct ipmi_intf * intf;
|
||||
struct ipmi_session * session;
|
||||
unsigned char rq_seq;
|
||||
unsigned char * msg_data;
|
||||
int msg_len;
|
||||
struct ipmi_req_entry * next;
|
||||
};
|
||||
|
||||
struct ipmi_rsp {
|
||||
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 (*open)(struct ipmi_intf *, char *, int, char *);
|
||||
void (*close)(struct ipmi_intf *);
|
||||
struct ipmi_rsp *(*sendrecv)(struct ipmi_intf *, struct ipmi_req *);
|
||||
int (*ll_send)(struct ipmi_intf *, unsigned char *, int);
|
||||
struct ipmi_rsp *(*ll_recv)(struct ipmi_intf *, int);
|
||||
};
|
||||
|
||||
#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_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 */
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
#define _IPMI_ENTITY
|
||||
|
||||
#include <helper.h>
|
||||
|
||||
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 */
|
||||
|
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
#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 */
|
@ -1,143 +0,0 @@
|
||||
/*
|
||||
* 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_LAN_H
|
||||
#define _IPMI_LAN_H
|
||||
|
||||
#include <linux/ipmi.h>
|
||||
#include "ipmi.h"
|
||||
|
||||
#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_LAN_CHANNEL_1 0x07
|
||||
#define IPMI_LAN_CHANNEL_2 0x06
|
||||
#define IPMI_LAN_CHANNEL_E 0x0e
|
||||
|
||||
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 }
|
||||
};
|
||||
|
||||
#define IPMI_SESSION_AUTHTYPE_NONE 0x0
|
||||
#define IPMI_SESSION_AUTHTYPE_MD2 0x1
|
||||
#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 struct ipmi_session lan_session;
|
||||
|
||||
unsigned char ipmi_csum(unsigned char * d, int s);
|
||||
|
||||
struct ipmi_rsp * ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req);
|
||||
int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * password);
|
||||
void ipmi_lan_close(struct ipmi_intf * intf);
|
||||
void ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel);
|
||||
int ipmi_lan_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
struct ipmi_intf ipmi_lan_intf;
|
||||
|
||||
#endif /*_IPMI_LAN_H*/
|
@ -1,326 +0,0 @@
|
||||
/*
|
||||
* 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 <math.h>
|
||||
#include <byteswap.h>
|
||||
#include <ipmi.h>
|
||||
|
||||
int ipmi_sdr_main(struct ipmi_intf *, int, char **);
|
||||
int utos(unsigned val, unsigned bits);
|
||||
|
||||
#define __TO_TOL(mtol) (bswap_16(mtol) & 0x3f)
|
||||
#define __TO_M(mtol) (utos((((bswap_16(mtol) & 0xff00) >> 8) | ((bswap_16(mtol) & 0xc0) << 2)), 10))
|
||||
#define __TO_B(bacc) (utos((((bswap_32(bacc) & 0xff000000) >> 24) | \
|
||||
((bswap_32(bacc) & 0xc00000) >> 14)), 10))
|
||||
#define __TO_ACC(bacc) (((bswap_32(bacc) & 0x3f0000) >> 16) | ((bswap_32(bacc) & 0xf000) >> 6))
|
||||
#define __TO_ACC_EXP(bacc) ((bswap_32(bacc) & 0xc00) >> 10)
|
||||
#define __TO_R_EXP(bacc) (utos(((bswap_32(bacc) & 0xf0) >> 4), 4))
|
||||
#define __TO_B_EXP(bacc) (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 */
|
||||
|
@ -1,366 +0,0 @@
|
||||
/*
|
||||
* 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 <ipmi.h>
|
||||
|
||||
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 next_id;
|
||||
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_type {
|
||||
unsigned char code;
|
||||
unsigned char offset;
|
||||
unsigned char class;
|
||||
const char * desc;
|
||||
};
|
||||
|
||||
static struct ipmi_event_type event_types[] __attribute__((unused)) = {
|
||||
/* Threshold Based States */
|
||||
{ 0x01, 0x00, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-critical - going low" },
|
||||
{ 0x01, 0x01, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-critical - going high" },
|
||||
{ 0x01, 0x02, IPMI_EVENT_CLASS_THRESHOLD, "Lower Critical - going low" },
|
||||
{ 0x01, 0x03, IPMI_EVENT_CLASS_THRESHOLD, "Lower Critical - going high" },
|
||||
{ 0x01, 0x04, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-recoverable - going low" },
|
||||
{ 0x01, 0x05, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-recoverable - going high" },
|
||||
{ 0x01, 0x06, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-critical - going low" },
|
||||
{ 0x01, 0x07, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-critical - going high" },
|
||||
{ 0x01, 0x08, IPMI_EVENT_CLASS_THRESHOLD, "Upper Critical - going low" },
|
||||
{ 0x01, 0x09, IPMI_EVENT_CLASS_THRESHOLD, "Upper Critical - going high" },
|
||||
{ 0x01, 0x0a, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-recoverable - going low" },
|
||||
{ 0x01, 0x0b, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-recoverable - going high" },
|
||||
/* DMI-based "usage state" States */
|
||||
{ 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Transition to Idle" },
|
||||
{ 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Transition to Active" },
|
||||
{ 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Transition to Busy" },
|
||||
/* Digital-Discrete Event States */
|
||||
{ 0x03, 0x00, IPMI_EVENT_CLASS_DIGITAL, "State Deasserted" },
|
||||
{ 0x03, 0x01, IPMI_EVENT_CLASS_DIGITAL, "State Asserted" },
|
||||
{ 0x04, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Predictive Failure Deasserted" },
|
||||
{ 0x04, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Predictive Failure Asserted" },
|
||||
{ 0x05, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Limit Not Exceeded" },
|
||||
{ 0x05, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Limit Exceeded" },
|
||||
{ 0x06, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Performance Met" },
|
||||
{ 0x06, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Performance Lags" },
|
||||
/* Severity Event States */
|
||||
{ 0x07, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Transition to OK" },
|
||||
{ 0x07, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-critial from OK" },
|
||||
{ 0x07, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Transition to Critical from less severe" },
|
||||
{ 0x07, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-recoverable from less severe" },
|
||||
{ 0x07, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-critical from more severe" },
|
||||
{ 0x07, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Transition to Critical from Non-recoverable" },
|
||||
{ 0x07, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-recoverable" },
|
||||
{ 0x07, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Monitor" },
|
||||
{ 0x07, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Informational" },
|
||||
/* Availability Status States */
|
||||
{ 0x08, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Device Removed/Absent" },
|
||||
{ 0x08, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Device Inserted/Present" },
|
||||
{ 0x09, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Device Disabled" },
|
||||
{ 0x09, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Device Enabled" },
|
||||
{ 0x0a, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Transition to Running" },
|
||||
{ 0x0a, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Transition to In Test" },
|
||||
{ 0x0a, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Transition to Power Off" },
|
||||
{ 0x0a, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Transition to On Line" },
|
||||
{ 0x0a, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Transition to Off Line" },
|
||||
{ 0x0a, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Transition to Off Duty" },
|
||||
{ 0x0a, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Transition to Degraded" },
|
||||
{ 0x0a, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Transition to Power Save" },
|
||||
{ 0x0a, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Install Error" },
|
||||
/* Redundancy States */
|
||||
{ 0x0b, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Fully Redundant" },
|
||||
{ 0x0b, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Lost" },
|
||||
{ 0x0b, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Degraded" },
|
||||
{ 0x0b, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Non-Redundant: Sufficient from Redundant" },
|
||||
{ 0x0b, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Non-Redundant: Sufficient from Insufficient" },
|
||||
{ 0x0b, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Non-Redundant: Insufficient Resources" },
|
||||
{ 0x0b, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Degraded from Fully Redundant" },
|
||||
{ 0x0b, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Degraded from Non-Redundant" },
|
||||
/* ACPI Device Power States */
|
||||
{ 0x0c, 0x00, IPMI_EVENT_CLASS_DISCRETE, "D0 Power State" },
|
||||
{ 0x0c, 0x01, IPMI_EVENT_CLASS_DISCRETE, "D1 Power State" },
|
||||
{ 0x0c, 0x02, IPMI_EVENT_CLASS_DISCRETE, "D2 Power State" },
|
||||
{ 0x0c, 0x03, IPMI_EVENT_CLASS_DISCRETE, "D3 Power State" },
|
||||
/* END */
|
||||
{ 0x00, 0x00, 0x00, NULL },
|
||||
};
|
||||
|
||||
struct ipmi_sensor_types {
|
||||
unsigned char code;
|
||||
unsigned char offset;
|
||||
const char * type;
|
||||
const char * event;
|
||||
};
|
||||
|
||||
static struct ipmi_sensor_types sensor_types[] __attribute__((unused)) = {
|
||||
{ 0x00, 0x00, "Reserved", NULL },
|
||||
{ 0x01, 0x00, "Temperature", NULL },
|
||||
{ 0x02, 0x00, "Voltage", NULL },
|
||||
{ 0x03, 0x00, "Current", NULL },
|
||||
{ 0x04, 0x00, "Fan", NULL },
|
||||
|
||||
{ 0x05, 0x00, "Chassis Intrusion", "General Chassis intrusion" },
|
||||
{ 0x05, 0x01, "Chassis Intrusion", "Drive Bay intrusion" },
|
||||
{ 0x05, 0x02, "Chassis Intrusion", "I/O Card area intrusion" },
|
||||
{ 0x05, 0x03, "Chassis Intrusion", "Processor area intrusion" },
|
||||
{ 0x05, 0x04, "Chassis Intrusion", "System unplugged from LAN" },
|
||||
{ 0x05, 0x05, "Chassis Intrusion", "Unauthorized dock/undock" },
|
||||
{ 0x05, 0x06, "Chassis Intrusion", "FAN area intrusion" },
|
||||
|
||||
{ 0x06, 0x00, "Platform Security", "Front Panel Lockout violation attempted" },
|
||||
{ 0x06, 0x01, "Platform Security", "Pre-boot password viiolation - user password" },
|
||||
{ 0x06, 0x02, "Platform Security", "Pre-boot password violation - setup password" },
|
||||
{ 0x06, 0x03, "Platform Security", "Pre-boot password violation - network boot password" },
|
||||
{ 0x06, 0x04, "Platform Security", "Other pre-boot password violation" },
|
||||
{ 0x06, 0x05, "Platform Security", "Out-of-band access password violation" },
|
||||
|
||||
{ 0x07, 0x00, "Processor", "IERR" },
|
||||
{ 0x07, 0x01, "Processor", "Thermal Trip" },
|
||||
{ 0x07, 0x02, "Processor", "FRB1/BIST failure" },
|
||||
{ 0x07, 0x03, "Processor", "FRB2/Hang in POST failure" },
|
||||
{ 0x07, 0x04, "Processor", "FRB3/Processor startup/init failure" },
|
||||
{ 0x07, 0x05, "Processor", "Configuration Error" },
|
||||
{ 0x07, 0x06, "Processor", "SM BIOS Uncorrectable CPU-complex Error" },
|
||||
{ 0x07, 0x07, "Processor", "Presence detected" },
|
||||
{ 0x07, 0x08, "Processor", "Disabled" },
|
||||
{ 0x07, 0x09, "Processor", "Terminator presence detected" },
|
||||
|
||||
{ 0x08, 0x00, "Power Supply", "Presence detected" },
|
||||
{ 0x08, 0x01, "Power Supply", "Failure detected" },
|
||||
{ 0x08, 0x02, "Power Supply", "Predictive failure" },
|
||||
{ 0x08, 0x03, "Power Supply", "Power Supply AC lost" },
|
||||
{ 0x08, 0x04, "Power Supply", "AC lost or out-of-range" },
|
||||
{ 0x08, 0x05, "Power Supply", "AC out-of-range, but present" },
|
||||
|
||||
{ 0x09, 0x00, "Power Unit", "Power off/down" },
|
||||
{ 0x09, 0x01, "Power Unit", "Power cycle" },
|
||||
{ 0x09, 0x02, "Power Unit", "240VA power down" },
|
||||
{ 0x09, 0x03, "Power Unit", "Interlock power down" },
|
||||
{ 0x09, 0x04, "Power Unit", "AC lost" },
|
||||
{ 0x09, 0x05, "Power Unit", "Soft-power control failure" },
|
||||
{ 0x09, 0x06, "Power Unit", "Failure detected" },
|
||||
{ 0x09, 0x07, "Power Unit", "Predictive failure" },
|
||||
|
||||
{ 0x0a, 0x00, "Cooling Device", NULL },
|
||||
{ 0x0b, 0x00, "Other Units-based Sensor", NULL },
|
||||
|
||||
{ 0x0c, 0x00, "Memory", "Correctable ECC" },
|
||||
{ 0x0c, 0x01, "Memory", "Uncorrectable ECC" },
|
||||
{ 0x0c, 0x02, "Memory", "Parity" },
|
||||
{ 0x0c, 0x03, "Memory", "Memory Scrub Failed" },
|
||||
{ 0x0c, 0x04, "Memory", "Memory Device Disabled" },
|
||||
{ 0x0c, 0x05, "Memory", "Correctable ECC logging limit reached" },
|
||||
|
||||
{ 0x0d, 0x00, "Drive Slot", NULL },
|
||||
{ 0x0e, 0x00, "POST Memory Resize", NULL },
|
||||
|
||||
{ 0x0f, 0x00, "System Firmware", "Error" },
|
||||
{ 0x0f, 0x01, "System Firmware", "Hang" },
|
||||
{ 0x0f, 0x02, "System Firmware", "Progress" },
|
||||
|
||||
{ 0x10, 0x00, "Event Logging Disabled", "Correctable memory error logging disabled" },
|
||||
{ 0x10, 0x01, "Event Logging Disabled", "Event logging disabled" },
|
||||
{ 0x10, 0x02, "Event Logging Disabled", "Log area reset/cleared" },
|
||||
{ 0x10, 0x03, "Event Logging Disabled", "All event logging disabled" },
|
||||
|
||||
{ 0x11, 0x00, "Watchdog 1", "BIOS Reset" },
|
||||
{ 0x11, 0x01, "Watchdog 1", "OS Reset" },
|
||||
{ 0x11, 0x02, "Watchdog 1", "OS Shut Down" },
|
||||
{ 0x11, 0x03, "Watchdog 1", "OS Power Down" },
|
||||
{ 0x11, 0x04, "Watchdog 1", "OS Power Cycle" },
|
||||
{ 0x11, 0x05, "Watchdog 1", "OS NMI/diag Interrupt" },
|
||||
{ 0x11, 0x06, "Watchdog 1", "OS Expired" },
|
||||
{ 0x11, 0x07, "Watchdog 1", "OS pre-timeout Interrupt" },
|
||||
|
||||
{ 0x12, 0x00, "System Event", "System Reconfigured" },
|
||||
{ 0x12, 0x01, "System Event", "OEM System boot event" },
|
||||
{ 0x12, 0x02, "System Event", "Undetermined system hardware failure" },
|
||||
{ 0x12, 0x03, "System Event", "Entry added to auxillary log" },
|
||||
{ 0x12, 0x04, "System Event", "PEF Action" },
|
||||
|
||||
{ 0x13, 0x00, "Critical Interrupt", "Front Panel NMI" },
|
||||
{ 0x13, 0x01, "Critical Interrupt", "Bus Timeout" },
|
||||
{ 0x13, 0x02, "Critical Interrupt", "I/O Channel check NMI" },
|
||||
{ 0x13, 0x03, "Critical Interrupt", "Software NMI" },
|
||||
{ 0x13, 0x04, "Critical Interrupt", "PCI PERR" },
|
||||
{ 0x13, 0x05, "Critical Interrupt", "PCI SERR" },
|
||||
{ 0x13, 0x06, "Critical Interrupt", "EISA failsafe timeout" },
|
||||
{ 0x13, 0x07, "Critical Interrupt", "Bus Correctable error" },
|
||||
{ 0x13, 0x08, "Critical Interrupt", "Bus Uncorrectable error" },
|
||||
{ 0x13, 0x09, "Critical Interrupt", "Fatal NMI" },
|
||||
|
||||
{ 0x14, 0x00, "Button", "Power Button pressed" },
|
||||
{ 0x14, 0x01, "Button", "Sleep Button pressed" },
|
||||
{ 0x14, 0x02, "Button", "Reset Button pressed" },
|
||||
|
||||
{ 0x15, 0x00, "Module/Board", NULL },
|
||||
{ 0x16, 0x00, "Microcontroller/Coprocessor", NULL },
|
||||
{ 0x17, 0x00, "Add-in Card", NULL },
|
||||
{ 0x18, 0x00, "Chassis", NULL },
|
||||
{ 0x19, 0x00, "Chip Set", NULL },
|
||||
{ 0x1a, 0x00, "Other FRU", NULL },
|
||||
{ 0x1b, 0x00, "Cable/Interconnect", NULL },
|
||||
{ 0x1c, 0x00, "Terminator", NULL },
|
||||
|
||||
{ 0x1d, 0x00, "System Boot Initiated", "Initiated by power up" },
|
||||
{ 0x1d, 0x01, "System Boot Initiated", "Initiated by hard reset" },
|
||||
{ 0x1d, 0x02, "System Boot Initiated", "Initiated by warm reset" },
|
||||
{ 0x1d, 0x03, "System Boot Initiated", "User requested PXE boot" },
|
||||
{ 0x1d, 0x04, "System Boot Initiated", "Automatic boot to diagnostic" },
|
||||
|
||||
{ 0x1e, 0x00, "Boot Error", "No bootable media" },
|
||||
{ 0x1e, 0x01, "Boot Error", "Non-bootable disk in drive" },
|
||||
{ 0x1e, 0x02, "Boot Error", "PXE server not found" },
|
||||
{ 0x1e, 0x03, "Boot Error", "Invalid boot sector" },
|
||||
{ 0x1e, 0x04, "Boot Error", "Timeout waiting for selection" },
|
||||
|
||||
{ 0x1f, 0x00, "OS Boot", "A: boot completed" },
|
||||
{ 0x1f, 0x01, "OS Boot", "C: boot completed" },
|
||||
{ 0x1f, 0x02, "OS Boot", "PXE boot completed" },
|
||||
{ 0x1f, 0x03, "OS Boot", "Diagnostic boot completed" },
|
||||
{ 0x1f, 0x04, "OS Boot", "CD-ROM boot completed" },
|
||||
{ 0x1f, 0x05, "OS Boot", "ROM boot completed" },
|
||||
{ 0x1f, 0x06, "OS Boot", "boot completed - device not specified" },
|
||||
|
||||
{ 0x20, 0x00, "OS Critical Stop", "Stop during OS load/init" },
|
||||
{ 0x20, 0x01, "OS Critical Stop", "Run-time stop" },
|
||||
|
||||
{ 0x21, 0x00, "Slot/Connector", "Fault Status asserted" },
|
||||
{ 0x21, 0x01, "Slot/Connector", "Identify Status asserted" },
|
||||
{ 0x21, 0x02, "Slot/Connector", "Slot/Connector Device installed/attached" },
|
||||
{ 0x21, 0x03, "Slot/Connector", "Slot/Connector ready for device installation" },
|
||||
{ 0x21, 0x04, "Slot/Connector", "Slot/Connector ready for device removal" },
|
||||
{ 0x21, 0x05, "Slot/Connector", "Slot Power is off" },
|
||||
{ 0x21, 0x06, "Slot/Connector", "Slot/Connector device removal request" },
|
||||
{ 0x21, 0x07, "Slot/Connector", "Interlock asserted" },
|
||||
{ 0x21, 0x08, "Slot/Connector", "Slot is disabled" },
|
||||
|
||||
{ 0x22, 0x00, "System ACPI Power State", "S0/G0: working" },
|
||||
{ 0x22, 0x01, "System ACPI Power State", "S1: sleeping with system hw & processor context maintained" },
|
||||
{ 0x22, 0x02, "System ACPI Power State", "S2: sleeping, processor context lost" },
|
||||
{ 0x22, 0x03, "System ACPI Power State", "S3: sleeping, processor & hw context lost, memory retained" },
|
||||
{ 0x22, 0x04, "System ACPI Power State", "S4: non-volatile sleep/suspend-to-disk" },
|
||||
{ 0x22, 0x05, "System ACPI Power State", "S5/G2: soft-off" },
|
||||
{ 0x22, 0x06, "System ACPI Power State", "S4/S5: soft-off" },
|
||||
{ 0x22, 0x07, "System ACPI Power State", "G3: mechanical off" },
|
||||
{ 0x22, 0x08, "System ACPI Power State", "Sleeping in S1/S2/S3 state" },
|
||||
{ 0x22, 0x09, "System ACPI Power State", "G1: sleeping" },
|
||||
{ 0x22, 0x0a, "System ACPI Power State", "S5: entered by override" },
|
||||
{ 0x22, 0x0b, "System ACPI Power State", "Legacy ON state" },
|
||||
{ 0x22, 0x0c, "System ACPI Power State", "Legacy OFF state" },
|
||||
{ 0x22, 0x0e, "System ACPI Power State", "Unknown" },
|
||||
|
||||
{ 0x23, 0x00, "Watchdog 2", "Timer expired" },
|
||||
{ 0x23, 0x01, "Watchdog 2", "Hard reset" },
|
||||
{ 0x23, 0x02, "Watchdog 2", "Power down" },
|
||||
{ 0x23, 0x03, "Watchdog 2", "Power cycle" },
|
||||
{ 0x23, 0x04, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x05, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x06, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x07, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x08, "Watchdog 2", "Timer interrupt" },
|
||||
|
||||
{ 0x24, 0x00, "Platform Alert", "Platform generated page" },
|
||||
{ 0x24, 0x01, "Platform Alert", "Platform generated LAN alert" },
|
||||
{ 0x24, 0x02, "Platform Alert", "Platform Event Trap generated" },
|
||||
{ 0x24, 0x03, "Platform Alert", "Platform generated SNMP trap, OEM format" },
|
||||
|
||||
{ 0x25, 0x00, "Entity Presence", "Present" },
|
||||
{ 0x25, 0x01, "Entity Presence", "Absent" },
|
||||
{ 0x25, 0x02, "Entity Presence", "Disabled" },
|
||||
|
||||
{ 0x26, 0x00, "Monitor ASIC/IC", NULL },
|
||||
|
||||
{ 0x27, 0x00, "LAN", "Heartbeat Lost" },
|
||||
{ 0x27, 0x01, "LAN", "Heartbeat" },
|
||||
|
||||
{ 0x28, 0x00, "Management Subsystem Health", "Sensor access degraded or unavailable" },
|
||||
{ 0x28, 0x01, "Management Subsystem Health", "Controller access degraded or unavailable" },
|
||||
{ 0x28, 0x02, "Management Subsystem Health", "Management controller off-line" },
|
||||
{ 0x28, 0x03, "Management Subsystem Health", "Management controller unavailable" },
|
||||
|
||||
{ 0x29, 0x00, "Battery", "Low" },
|
||||
{ 0x29, 0x01, "Battery", "Failed" },
|
||||
{ 0x29, 0x02, "Battery", "Presence Detected" },
|
||||
|
||||
{ 0x00, 0x00, NULL, NULL },
|
||||
};
|
||||
|
||||
int ipmi_sel_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
#endif /*_IPMI_SEL_H*/
|
@ -38,5 +38,5 @@ 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
|
||||
ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_bmc.h ipmi_sensor.h
|
||||
|
||||
|
@ -37,19 +37,20 @@
|
||||
#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))
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_BYTESWAP_H
|
||||
# include <byteswap.h>
|
||||
# define BSWAP_16(x) bswap_16(x)
|
||||
# define BSWAP_32(x) bswap_32(x)
|
||||
#elif HAVE_SYS_BYTEORDER_H
|
||||
# include <sys/byteorder.h>
|
||||
#else
|
||||
|
||||
#include <byteswap.h>
|
||||
|
||||
#define BSWAP_16(x) bswap_16(x)
|
||||
#define BSWAP_32(x) bswap_32(x)
|
||||
|
||||
# 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))
|
||||
#endif
|
||||
|
||||
#endif /* IPMI_BSWAP_H */
|
||||
|
@ -37,14 +37,16 @@
|
||||
#ifndef IPMI_HELPER_H
|
||||
#define IPMI_HELPER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct valstr {
|
||||
unsigned char val;
|
||||
unsigned short val;
|
||||
const char * str;
|
||||
};
|
||||
const char * val2str(unsigned char val, const struct valstr * vs);
|
||||
const char * val2str(unsigned short val, const struct valstr * vs);
|
||||
|
||||
unsigned short buf2short(unsigned char * buf);
|
||||
unsigned long buf2long(unsigned char * buf);
|
||||
uint32_t buf2long(unsigned char * buf);
|
||||
const char * buf2str(unsigned char * buf, int len);
|
||||
void printbuf(unsigned char * buf, int len, char * desc);
|
||||
|
||||
|
@ -39,7 +39,9 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <netinet/in.h>
|
||||
#include <ipmitool/helper.h>
|
||||
|
||||
#define BUF_SIZE 256
|
||||
|
||||
@ -53,9 +55,9 @@ struct ipmi_session {
|
||||
unsigned char authtype;
|
||||
unsigned char authcode[16];
|
||||
unsigned char privlvl;
|
||||
unsigned long in_seq;
|
||||
unsigned long out_seq;
|
||||
unsigned long id;
|
||||
uint32_t in_seq;
|
||||
uint32_t out_seq;
|
||||
uint32_t id;
|
||||
int active;
|
||||
};
|
||||
|
||||
@ -84,8 +86,8 @@ struct ipmi_rs {
|
||||
int data_len;
|
||||
struct {
|
||||
unsigned char authtype;
|
||||
unsigned long seq;
|
||||
unsigned long id;
|
||||
uint32_t seq;
|
||||
uint32_t id;
|
||||
} session;
|
||||
unsigned char msglen;
|
||||
struct {
|
||||
@ -104,7 +106,7 @@ struct ipmi_intf {
|
||||
struct sockaddr_in addr;
|
||||
int abort;
|
||||
int pedantic;
|
||||
int (*open)(struct ipmi_intf *, char *, int, char *);
|
||||
int (*open)(struct ipmi_intf *, char *, int, char *, char *);
|
||||
void (*close)(struct ipmi_intf *);
|
||||
struct ipmi_rs *(*sendrecv)(struct ipmi_intf *, struct ipmi_rq *);
|
||||
};
|
||||
@ -121,6 +123,6 @@ struct ipmi_intf {
|
||||
#define IPMI_BMC_SLAVE_ADDR 0x20
|
||||
#define IPMI_REMOTE_SWID 0x81
|
||||
|
||||
int handle_ipmi(struct ipmi_intf *intf, unsigned char * data, int data_len);
|
||||
const struct valstr completion_code_vals[25];
|
||||
|
||||
#endif /* IPMI_H */
|
||||
|
@ -84,5 +84,50 @@ const struct valstr entity_id_vals[] __attribute__((unused)) = {
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
const struct valstr device_type_vals[] __attribute__((unused)) = {
|
||||
{ 0x00, "Reserved" },
|
||||
{ 0x01, "Reserved" },
|
||||
{ 0x02, "DS1624 temperature sensor" },
|
||||
{ 0x03, "DS1621 temperature sensor" },
|
||||
{ 0x04, "LM75 Temperature Sensor" },
|
||||
{ 0x05, "Heceta ASIC" },
|
||||
{ 0x06, "Reserved" },
|
||||
{ 0x07, "Reserved" },
|
||||
{ 0x08, "EEPROM, 24C01" },
|
||||
{ 0x09, "EEPROM, 24C02" },
|
||||
{ 0x0a, "EEPROM, 24C04" },
|
||||
{ 0x0b, "EEPROM, 24C08" },
|
||||
{ 0x0c, "EEPROM, 24C16" },
|
||||
{ 0x0d, "EEPROM, 24C17" },
|
||||
{ 0x0e, "EEPROM, 24C32" },
|
||||
{ 0x0f, "EEPROM, 24C64" },
|
||||
{ 0x1000, "IPMI FRU Inventory" },
|
||||
{ 0x1001, "DIMM Memory ID" },
|
||||
{ 0x1002, "IPMI FRU Inventory" },
|
||||
{ 0x1003, "System Processor Cartridge FRU" },
|
||||
{ 0x11, "Reserved" },
|
||||
{ 0x12, "Reserved" },
|
||||
{ 0x13, "Reserved" },
|
||||
{ 0x14, "PCF 8570 256 byte RAM" },
|
||||
{ 0x15, "PCF 8573 clock/calendar" },
|
||||
{ 0x16, "PCF 8574A I/O Port" },
|
||||
{ 0x17, "PCF 8583 clock/calendar" },
|
||||
{ 0x18, "PCF 8593 clock/calendar" },
|
||||
{ 0x19, "Clock calendar" },
|
||||
{ 0x1a, "PCF 8591 A/D, D/A Converter" },
|
||||
{ 0x1b, "I/O Port" },
|
||||
{ 0x1c, "A/D Converter" },
|
||||
{ 0x1d, "D/A Converter" },
|
||||
{ 0x1e, "A/D, D/A Converter" },
|
||||
{ 0x1f, "LCD Controler/Driver" },
|
||||
{ 0x20, "Core Logic (Chip set) Device" },
|
||||
{ 0x21, "LMC6874 Intelligent Battery controller" },
|
||||
{ 0x22, "Intelligent Batter controller" },
|
||||
{ 0x23, "Combo Management ASIC" },
|
||||
{ 0x24, "Maxim 1617 Temperature Sensor" },
|
||||
{ 0xbf, "Other/Unspecified" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
#endif /* IPMI_ENTITY_H */
|
||||
|
||||
|
@ -37,8 +37,13 @@
|
||||
#ifndef IPMI_FRU_H
|
||||
#define IPMI_FRU_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define GET_FRU_INFO 0x10
|
||||
#define GET_FRU_DATA 0x11
|
||||
#define SET_FRU_DATA 0x12
|
||||
@ -85,14 +90,15 @@ struct fru_area_chassis {
|
||||
};
|
||||
|
||||
struct fru_area_board {
|
||||
unsigned char area_ver;
|
||||
unsigned char area_ver;
|
||||
unsigned char area_len;
|
||||
unsigned char lang;
|
||||
unsigned long mfg_date_time;
|
||||
uint32_t mfg_date_time;
|
||||
char * mfg;
|
||||
char * prod;
|
||||
char * serial;
|
||||
char * part;
|
||||
char * fru;
|
||||
};
|
||||
|
||||
struct fru_area_product {
|
||||
@ -105,8 +111,105 @@ struct fru_area_product {
|
||||
char * version;
|
||||
char * serial;
|
||||
char * asset;
|
||||
char * fru;
|
||||
};
|
||||
|
||||
struct fru_multirec_header {
|
||||
#define FRU_RECORD_TYPE_POWER_SUPPLY_INFORMATION 0x00
|
||||
#define FRU_RECORD_TYPE_DC_OUTPUT 0x01
|
||||
#define FRU_RECORD_TYPE_DC_LOAD 0x02
|
||||
#define FRU_RECORD_TYPE_MANAGEMENT_ACCESS 0x03
|
||||
#define FRU_RECORD_TYPE_BASE_COMPATIBILITY 0x04
|
||||
#define FRU_RECORD_TYPE_EXTENDED_COMPATIBILITY 0x05
|
||||
unsigned char type;
|
||||
unsigned char format;
|
||||
unsigned char len;
|
||||
unsigned char record_checksum;
|
||||
unsigned char header_checksum;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct fru_multirec_powersupply {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned short capacity;
|
||||
#else
|
||||
unsigned short capacity : 12;
|
||||
unsigned short __reserved1 : 4;
|
||||
#endif
|
||||
unsigned short peak_va;
|
||||
unsigned char inrush_current;
|
||||
unsigned char inrush_interval;
|
||||
unsigned short lowend_input1;
|
||||
unsigned short highend_input1;
|
||||
unsigned short lowend_input2;
|
||||
unsigned short highend_input2;
|
||||
unsigned char lowend_freq;
|
||||
unsigned char highend_freq;
|
||||
unsigned char dropout_tolerance;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 3;
|
||||
unsigned char tach : 1;
|
||||
unsigned char hotswap : 1;
|
||||
unsigned char autoswitch : 1;
|
||||
unsigned char pfc : 1;
|
||||
unsigned char predictive_fail : 1;
|
||||
#else
|
||||
unsigned char predictive_fail : 1;
|
||||
unsigned char pfc : 1;
|
||||
unsigned char autoswitch : 1;
|
||||
unsigned char hotswap : 1;
|
||||
unsigned char tach : 1;
|
||||
unsigned char __reserved2 : 3;
|
||||
#endif
|
||||
unsigned short peak_cap_ht;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char combined_voltage1 : 4;
|
||||
unsigned char combined_voltage2 : 4;
|
||||
#else
|
||||
unsigned char combined_voltage2 : 4;
|
||||
unsigned char combined_voltage1 : 4;
|
||||
#endif
|
||||
unsigned short combined_capacity;
|
||||
unsigned char rps_threshold;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static const char * combined_voltage_desc[] __attribute__((unused)) = {
|
||||
"12 V", "-12 V", "5 V", "3.3 V"
|
||||
};
|
||||
|
||||
struct fru_multirec_dcoutput {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char standby : 1;
|
||||
unsigned char __reserved : 3;
|
||||
unsigned char output_number : 4;
|
||||
#else
|
||||
unsigned char output_number : 4;
|
||||
unsigned char __reserved : 3;
|
||||
unsigned char standby : 1;
|
||||
#endif
|
||||
short nominal_voltage;
|
||||
short max_neg_dev;
|
||||
short max_pos_dev;
|
||||
unsigned short ripple_and_noise;
|
||||
unsigned short min_current;
|
||||
unsigned short max_current;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct fru_multirec_dcload {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 4;
|
||||
unsigned char output_number : 4;
|
||||
#else
|
||||
unsigned char output_number : 4;
|
||||
unsigned char __reserved : 4;
|
||||
#endif
|
||||
short nominal_voltage;
|
||||
short min_voltage;
|
||||
short max_voltage;
|
||||
unsigned short ripple_and_noise;
|
||||
unsigned short min_current;
|
||||
unsigned short max_current;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static const char * chassis_type_desc[] __attribute__((unused)) = {
|
||||
"Unspecified", "Other", "Unknown",
|
||||
"Desktop", "Low Profile Desktop", "Pizza Box",
|
||||
|
@ -39,6 +39,11 @@
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
struct static_intf {
|
||||
char * name;
|
||||
int (*setup)(struct ipmi_intf ** intf);
|
||||
};
|
||||
|
||||
int ipmi_intf_init(void);
|
||||
void ipmi_intf_exit(void);
|
||||
struct ipmi_intf * ipmi_intf_load(char * name);
|
||||
|
@ -37,6 +37,11 @@
|
||||
#ifndef IPMI_SDR_H
|
||||
#define IPMI_SDR_H
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <ipmitool/bswap.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
@ -44,20 +49,24 @@
|
||||
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))))
|
||||
#if WORDS_BIGENDIAN
|
||||
# define __TO_TOL(mtol) (unsigned short)(mtol & 0x3f)
|
||||
# define __TO_M(mtol) (unsigned short)(utos((((mtol & 0xff00) >> 8) | ((mtol & 0xc0) << 2)), 10))
|
||||
# define __TO_B(bacc) (unsigned int)(utos((((bacc & 0xff000000) >> 24) | ((bacc & 0xc00000) >> 14)), 10))
|
||||
# define __TO_ACC(bacc) (unsigned int)(((bacc & 0x3f0000) >> 16) | ((bacc & 0xf000) >> 6))
|
||||
# define __TO_ACC_EXP(bacc) (unsigned int)((bacc & 0xc00) >> 10)
|
||||
# define __TO_R_EXP(bacc) (unsigned int)(utos(((bacc & 0xf0) >> 4), 4))
|
||||
# define __TO_B_EXP(bacc) (unsigned int)(utos((bacc & 0xf), 4))
|
||||
#else
|
||||
# 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))
|
||||
#endif
|
||||
|
||||
#define GET_SDR_REPO_INFO 0x20
|
||||
#define GET_SDR_ALLOC_INFO 0x21
|
||||
@ -73,8 +82,8 @@ 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 */
|
||||
uint32_t add_stamp; /* last add timestamp */
|
||||
uint32_t erase_stamp; /* last del timestamp */
|
||||
unsigned char op_support; /* supported operations */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
@ -97,8 +106,17 @@ 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
|
||||
#define SDR_RECORD_TYPE_FULL_SENSOR 0x01
|
||||
#define SDR_RECORD_TYPE_COMPACT_SENSOR 0x02
|
||||
#define SDR_RECORD_TYPE_EVENTONLY_SENSOR 0x03
|
||||
#define SDR_RECORD_TYPE_ENTITY_ASSOC 0x08
|
||||
#define SDR_RECORD_TYPE_DEVICE_ENTITY_ASSOC 0x09
|
||||
#define SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR 0x10
|
||||
#define SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR 0x11
|
||||
#define SDR_RECORD_TYPE_MC_DEVICE_LOCATOR 0x12
|
||||
#define SDR_RECORD_TYPE_MC_CONFIRMATION 0x13
|
||||
#define SDR_RECORD_TYPE_BMC_MSG_CHANNEL_INFO 0x14
|
||||
#define SDR_RECORD_TYPE_OEM 0xc0
|
||||
unsigned char type; /* record type */
|
||||
unsigned char length; /* remaining record bytes */
|
||||
} __attribute__ ((packed));
|
||||
@ -106,35 +124,65 @@ struct sdr_get_rs {
|
||||
struct sdr_record_compact_sensor {
|
||||
struct {
|
||||
unsigned char owner_id;
|
||||
unsigned char lun : 2, /* sensor owner lun */
|
||||
__reserved : 2,
|
||||
channel : 4; /* channel number */
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char channel : 4; /* channel number */
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
#else
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char channel : 4; /* channel number */
|
||||
#endif
|
||||
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 */
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char logical : 1; /* physical/logical */
|
||||
unsigned char instance : 7; /* instance number */
|
||||
#else
|
||||
unsigned char instance : 7; /* instance number */
|
||||
unsigned char logical : 1; /* physical/logical */
|
||||
#endif
|
||||
} entity;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
unsigned char sensor_scan : 1,
|
||||
event_gen : 1,
|
||||
type : 1,
|
||||
hysteresis : 1,
|
||||
thresholds : 1,
|
||||
events : 1,
|
||||
scanning : 1,
|
||||
__reserved : 1;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 1;
|
||||
unsigned char scanning : 1;
|
||||
unsigned char events : 1;
|
||||
unsigned char thresholds : 1;
|
||||
unsigned char hysteresis : 1;
|
||||
unsigned char type : 1;
|
||||
unsigned char event_gen : 1;
|
||||
unsigned char sensor_scan : 1;
|
||||
#else
|
||||
unsigned char sensor_scan : 1;
|
||||
unsigned char event_gen : 1;
|
||||
unsigned char type : 1;
|
||||
unsigned char hysteresis : 1;
|
||||
unsigned char thresholds : 1;
|
||||
unsigned char events : 1;
|
||||
unsigned char scanning : 1;
|
||||
unsigned char __reserved : 1;
|
||||
#endif
|
||||
} init;
|
||||
struct {
|
||||
unsigned char event_msg : 2,
|
||||
threshold : 2,
|
||||
hysteresis : 2,
|
||||
rearm : 1,
|
||||
ignore : 1;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char ignore : 1;
|
||||
unsigned char rearm : 1;
|
||||
unsigned char hysteresis : 2;
|
||||
unsigned char threshold : 2;
|
||||
unsigned char event_msg : 2;
|
||||
#else
|
||||
unsigned char event_msg : 2;
|
||||
unsigned char threshold : 2;
|
||||
unsigned char hysteresis : 2;
|
||||
unsigned char rearm : 1;
|
||||
unsigned char ignore : 1;
|
||||
#endif
|
||||
} capabilities;
|
||||
unsigned char type; /* sensor type */
|
||||
} sensor;
|
||||
@ -156,10 +204,17 @@ struct sdr_record_compact_sensor {
|
||||
} mask;
|
||||
|
||||
struct {
|
||||
unsigned char pct : 1,
|
||||
modifier : 2,
|
||||
rate : 3,
|
||||
analog : 2;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char analog : 2;
|
||||
unsigned char rate : 3;
|
||||
unsigned char modifier : 2;
|
||||
unsigned char pct : 1;
|
||||
#else
|
||||
unsigned char pct : 1;
|
||||
unsigned char modifier : 2;
|
||||
unsigned char rate : 3;
|
||||
unsigned char analog : 2;
|
||||
#endif
|
||||
struct {
|
||||
unsigned char base;
|
||||
unsigned char modifier;
|
||||
@ -167,11 +222,22 @@ struct sdr_record_compact_sensor {
|
||||
} unit;
|
||||
|
||||
struct {
|
||||
unsigned char count : 4,
|
||||
mod_type : 2,
|
||||
__reserved : 2;
|
||||
unsigned char mod_offset : 7,
|
||||
entity_inst : 1;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char mod_type : 2;
|
||||
unsigned char count : 4;
|
||||
#else
|
||||
unsigned char count : 4;
|
||||
unsigned char mod_type : 2;
|
||||
unsigned char __reserved : 2;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char entity_inst : 1;
|
||||
unsigned char mod_offset : 7;
|
||||
#else
|
||||
unsigned char mod_offset : 7;
|
||||
unsigned char entity_inst : 1;
|
||||
#endif
|
||||
} share;
|
||||
|
||||
struct {
|
||||
@ -185,41 +251,125 @@ struct sdr_record_compact_sensor {
|
||||
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_eventonly_sensor {
|
||||
struct {
|
||||
unsigned char owner_id;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char channel : 4; /* channel number */
|
||||
unsigned char fru_owner : 2; /* fru device owner lun */
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
#else
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
unsigned char fru_owner : 2; /* fru device owner lun */
|
||||
unsigned char channel : 4; /* channel number */
|
||||
#endif
|
||||
unsigned char sensor_num; /* unique sensor number */
|
||||
} keys;
|
||||
|
||||
struct {
|
||||
unsigned char id; /* physical entity id */
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char logical : 1; /* physical/logical */
|
||||
unsigned char instance : 7; /* instance number */
|
||||
#else
|
||||
unsigned char instance : 7; /* instance number */
|
||||
unsigned char logical : 1; /* physical/logical */
|
||||
#endif
|
||||
} entity;
|
||||
|
||||
unsigned char sensor_type; /* sensor type */
|
||||
unsigned char event_type; /* event/reading type code */
|
||||
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char mod_type : 2;
|
||||
unsigned char count : 4;
|
||||
#else
|
||||
unsigned char count : 4;
|
||||
unsigned char mod_type : 2;
|
||||
unsigned char __reserved : 2;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char entity_inst : 1;
|
||||
unsigned char mod_offset : 7;
|
||||
#else
|
||||
unsigned char mod_offset : 7;
|
||||
unsigned char entity_inst : 1;
|
||||
#endif
|
||||
} share;
|
||||
|
||||
unsigned char __reserved;
|
||||
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 */
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char channel : 4; /* channel number */
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
#else
|
||||
unsigned char lun : 2; /* sensor owner lun */
|
||||
unsigned char __reserved : 2;
|
||||
unsigned char channel : 4; /* channel number */
|
||||
#endif
|
||||
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 */
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char logical : 1; /* physical/logical */
|
||||
unsigned char instance : 7; /* instance number */
|
||||
#else
|
||||
unsigned char instance : 7; /* instance number */
|
||||
unsigned char logical : 1; /* physical/logical */
|
||||
#endif
|
||||
} entity;
|
||||
|
||||
struct {
|
||||
struct {
|
||||
unsigned char sensor_scan : 1,
|
||||
event_gen : 1,
|
||||
type : 1,
|
||||
hysteresis : 1,
|
||||
thresholds : 1,
|
||||
events : 1,
|
||||
scanning : 1,
|
||||
__reserved : 1;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 1;
|
||||
unsigned char scanning : 1;
|
||||
unsigned char events : 1;
|
||||
unsigned char thresholds : 1;
|
||||
unsigned char hysteresis : 1;
|
||||
unsigned char type : 1;
|
||||
unsigned char event_gen : 1;
|
||||
unsigned char sensor_scan : 1;
|
||||
#else
|
||||
unsigned char sensor_scan : 1;
|
||||
unsigned char event_gen : 1;
|
||||
unsigned char type : 1;
|
||||
unsigned char hysteresis : 1;
|
||||
unsigned char thresholds : 1;
|
||||
unsigned char events : 1;
|
||||
unsigned char scanning : 1;
|
||||
unsigned char __reserved : 1;
|
||||
#endif
|
||||
} init;
|
||||
struct {
|
||||
unsigned char event_msg : 2,
|
||||
threshold : 2,
|
||||
hysteresis : 2,
|
||||
rearm : 1,
|
||||
ignore : 1;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char ignore : 1;
|
||||
unsigned char rearm : 1;
|
||||
unsigned char hysteresis : 2;
|
||||
unsigned char threshold : 2;
|
||||
unsigned char event_msg : 2;
|
||||
#else
|
||||
unsigned char event_msg : 2;
|
||||
unsigned char threshold : 2;
|
||||
unsigned char hysteresis : 2;
|
||||
unsigned char rearm : 1;
|
||||
unsigned char ignore : 1;
|
||||
#endif
|
||||
} capabilities;
|
||||
unsigned char type;
|
||||
} sensor;
|
||||
@ -241,10 +391,17 @@ struct sdr_record_full_sensor {
|
||||
} mask;
|
||||
|
||||
struct {
|
||||
unsigned char pct : 1,
|
||||
modifier : 2,
|
||||
rate : 3,
|
||||
analog : 2;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char analog : 2;
|
||||
unsigned char rate : 3;
|
||||
unsigned char modifier : 2;
|
||||
unsigned char pct : 1;
|
||||
#else
|
||||
unsigned char pct : 1;
|
||||
unsigned char modifier : 2;
|
||||
unsigned char rate : 3;
|
||||
unsigned char analog : 2;
|
||||
#endif
|
||||
struct {
|
||||
unsigned char base;
|
||||
unsigned char modifier;
|
||||
@ -252,16 +409,21 @@ struct sdr_record_full_sensor {
|
||||
} unit;
|
||||
|
||||
unsigned char linearization; /* 70h=non linear, 71h-7Fh=non linear, OEM */
|
||||
|
||||
unsigned short mtol; /* M, tolerance */
|
||||
|
||||
unsigned long bacc; /* accuracy, B, Bexp, Rexp */
|
||||
uint32_t 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;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved : 5;
|
||||
unsigned char normal_min : 1; /* normal min field specified */
|
||||
unsigned char normal_max : 1; /* normal max field specified */
|
||||
unsigned char nominal_read : 1; /* nominal reading field specified */
|
||||
#else
|
||||
unsigned char nominal_read : 1; /* nominal reading field specified */
|
||||
unsigned char normal_max : 1; /* normal max field specified */
|
||||
unsigned char normal_min : 1; /* normal min field specified */
|
||||
unsigned char __reserved : 5;
|
||||
#endif
|
||||
} analog_flag;
|
||||
|
||||
unsigned char nominal_read; /* nominal reading, raw value */
|
||||
@ -292,6 +454,129 @@ struct sdr_record_full_sensor {
|
||||
unsigned char id_string[16]; /* sensor ID string bytes, only if id_code != 0 */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_record_fru_device_locator {
|
||||
struct {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 1;
|
||||
unsigned char dev_access_addr : 6;
|
||||
unsigned char __reserved1 : 1;
|
||||
#else
|
||||
unsigned char __reserved1 : 1;
|
||||
unsigned char dev_access_addr : 6;
|
||||
unsigned char __reserved2 : 1;
|
||||
#endif
|
||||
unsigned char fru_device_id;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char logical_dev : 1;
|
||||
unsigned char __reserved3 : 2;
|
||||
unsigned char access_lun : 2;
|
||||
unsigned char private_bus : 3;
|
||||
#else
|
||||
unsigned char private_bus : 3;
|
||||
unsigned char access_lun : 2;
|
||||
unsigned char __reserved3 : 2;
|
||||
unsigned char logical_dev : 1;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char channel_num : 4;
|
||||
unsigned char __reserved4 : 4;
|
||||
#else
|
||||
unsigned char __reserved4 : 4;
|
||||
unsigned char channel_num : 4;
|
||||
#endif
|
||||
} keys;
|
||||
|
||||
unsigned char __reserved;
|
||||
unsigned char device_type;
|
||||
unsigned char device_type_modifier;
|
||||
unsigned char fru_entity_id;
|
||||
unsigned char fru_entity_instance;
|
||||
unsigned char oem;
|
||||
unsigned char id_code;
|
||||
unsigned char id_string[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_record_mc_locator {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char dev_slave_addr : 7;
|
||||
unsigned char __reserved1 : 1;
|
||||
#else
|
||||
unsigned char __reserved1 : 1;
|
||||
unsigned char dev_slave_addr : 7;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved2 : 4;
|
||||
unsigned char channel_num : 4;
|
||||
#else
|
||||
unsigned char channel_num : 4;
|
||||
unsigned char __reserved2 : 4;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char pwr_state_notif : 3;
|
||||
unsigned char __reserved3 : 1;
|
||||
unsigned char global_init : 4;
|
||||
#else
|
||||
unsigned char global_init : 4;
|
||||
unsigned char __reserved3 : 1;
|
||||
unsigned char pwr_state_notif : 3;
|
||||
#endif
|
||||
unsigned char dev_support;
|
||||
unsigned char __reserved4[3];
|
||||
struct {
|
||||
unsigned char id;
|
||||
unsigned char instance;
|
||||
} entity;
|
||||
unsigned char oem;
|
||||
unsigned char id_code;
|
||||
unsigned char id_string[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct sdr_record_fru_locator {
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char dev_slave_addr : 7;
|
||||
unsigned char __reserved1 : 1;
|
||||
#else
|
||||
unsigned char __reserved1 : 1;
|
||||
unsigned char dev_slave_addr : 7;
|
||||
#endif
|
||||
unsigned char device_id;
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char bus : 3;
|
||||
unsigned char lun : 2;
|
||||
unsigned char __reserved2 : 2;
|
||||
unsigned char logical : 1;
|
||||
#else
|
||||
unsigned char logical : 1;
|
||||
unsigned char __reserved2 : 2;
|
||||
unsigned char lun : 2;
|
||||
unsigned char bus : 3;
|
||||
#endif
|
||||
#if WORDS_BIGENDIAN
|
||||
unsigned char __reserved3 : 4;
|
||||
unsigned char channel_num : 4;
|
||||
#else
|
||||
unsigned char channel_num : 4;
|
||||
unsigned char __reserved3 : 4;
|
||||
#endif
|
||||
unsigned char __reserved4;
|
||||
unsigned char dev_type;
|
||||
unsigned char dev_type_modifier;
|
||||
struct {
|
||||
unsigned char id;
|
||||
unsigned char instance;
|
||||
} entity;
|
||||
unsigned char oem;
|
||||
unsigned char id_code;
|
||||
unsigned char id_string[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ipmi_sdr_iterator
|
||||
{
|
||||
unsigned short reservation;
|
||||
int total;
|
||||
int next;
|
||||
};
|
||||
|
||||
/* unit description codes (IPMI v1.5 section 37.16) */
|
||||
#define UNIT_MAX 0x90
|
||||
static const char * unit_desc[] __attribute__((unused)) = {
|
||||
@ -322,4 +607,27 @@ static const char * unit_desc[] __attribute__((unused)) = {
|
||||
"error", "correctable error", "uncorrectable error",
|
||||
};
|
||||
|
||||
/* sensor type codes (IPMI v1.5 table 36.3) */
|
||||
#define SENSOR_TYPE_MAX 0x29
|
||||
static const char * sensor_type_desc[] __attribute__((unused)) = {
|
||||
"reserved",
|
||||
"Temperature", "Voltage", "Current", "Fan", "Physical Security", "Platform Security Violation Attempt",
|
||||
"Processor", "Power Supply", "Power Unit", "Cooling Device", "Other", "Memory", "Drive Slot / Bay",
|
||||
"POST Memory Resize", "System Firmware Progress", "Event Logging Disabled", "Watchdog", "System Event",
|
||||
"Critical Interrupt", "Button", "Module / Board", "Microcontroller / Coprocessor", "Add-in Card",
|
||||
"Chassis", "Chip Set", "Other FRU", "Cable / Interconnect", "Terminator", "System Boot Initiated",
|
||||
"Boot Error", "OS Boot", "OS Critical Stop", "Slot / Connector", "System ACPI Power State", "Watchdog",
|
||||
"Platform Alert", "Entity Presence", "Monitor ASIC / IC", "LAN", "Management Subsystem Health", "Battery"
|
||||
};
|
||||
|
||||
struct ipmi_sdr_iterator * ipmi_sdr_start(struct ipmi_intf * intf);
|
||||
struct sdr_get_rs * ipmi_sdr_get_next_header(struct ipmi_intf * intf, struct ipmi_sdr_iterator * i);
|
||||
unsigned char * ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header, struct ipmi_sdr_iterator * i);
|
||||
void ipmi_sdr_end(struct ipmi_intf * intf, struct ipmi_sdr_iterator * i);
|
||||
void ipmi_sdr_print_sdr(struct ipmi_intf * intf, unsigned char type);
|
||||
const char * ipmi_sdr_get_status(unsigned char stat);
|
||||
float sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor, unsigned char val);
|
||||
struct ipmi_rs * ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, unsigned char sensor);
|
||||
|
||||
|
||||
#endif /* IPMI_SDR_H */
|
||||
|
@ -37,8 +37,22 @@
|
||||
#ifndef IPMI_SEL_H
|
||||
#define IPMI_SEL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#define IPMI_CMD_GET_SEL_INFO 0x40
|
||||
#define IPMI_CMD_GET_SEL_ALLOC_INFO 0x41
|
||||
#define IPMI_CMD_RESERVE_SEL 0x42
|
||||
#define IPMI_CMD_GET_SEL_ENTRY 0x43
|
||||
#define IPMI_CMD_ADD_SEL_ENTRY 0x44
|
||||
#define IPMI_CMD_PARTIAL_ADD_SEL_ENTRY 0x45
|
||||
#define IPMI_CMD_DELETE_SEL_ENTRY 0x46
|
||||
#define IPMI_CMD_CLEAR_SEL 0x47
|
||||
#define IPMI_CMD_GET_SEL_TIME 0x48
|
||||
#define IPMI_CMD_SET_SEL_TIME 0x49
|
||||
#define IPMI_CMD_GET_AUX_LOG_STATUS 0x5A
|
||||
#define IPMI_CMD_SET_AUX_LOG_STATUS 0x5B
|
||||
|
||||
enum {
|
||||
IPMI_EVENT_CLASS_DISCRETE,
|
||||
IPMI_EVENT_CLASS_DIGITAL,
|
||||
@ -56,13 +70,16 @@ struct sel_get_rq {
|
||||
struct sel_event_record {
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
unsigned long timestamp;
|
||||
uint32_t 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;
|
||||
#define DATA_BYTE2_SPECIFIED_MASK 0xc0 /* event_data[0] bit mask */
|
||||
#define DATA_BYTE3_SPECIFIED_MASK 0x30 /* event_data[0] bit mask */
|
||||
#define EVENT_OFFSET_MASK 0x0f /* event_data[0] bit mask */
|
||||
unsigned char event_data[3];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
@ -70,7 +87,7 @@ struct sel_oem_record_ts {
|
||||
unsigned short next_id;
|
||||
unsigned short record_id;
|
||||
unsigned char record_type;
|
||||
unsigned long timestamp;
|
||||
uint32_t timestamp;
|
||||
unsigned char mfg_id[3];
|
||||
unsigned char oem_defined[6];
|
||||
} __attribute__ ((packed));
|
||||
@ -82,10 +99,11 @@ struct sel_oem_record_nots {
|
||||
unsigned char oem_defined[13];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct ipmi_event_sensor_types {
|
||||
unsigned char code;
|
||||
unsigned char offset;
|
||||
#define ALL_OFFSETS_SPECIFIED 0xff
|
||||
unsigned char data;
|
||||
unsigned char class;
|
||||
const char * type;
|
||||
const char * desc;
|
||||
@ -93,269 +111,275 @@ struct ipmi_event_sensor_types {
|
||||
|
||||
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" },
|
||||
{ 0x01, 0x00, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical - going low" },
|
||||
{ 0x01, 0x01, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical - going high" },
|
||||
{ 0x01, 0x02, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical - going low" },
|
||||
{ 0x01, 0x03, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical - going high" },
|
||||
{ 0x01, 0x04, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable - going low" },
|
||||
{ 0x01, 0x05, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable - going high" },
|
||||
{ 0x01, 0x06, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical - going low" },
|
||||
{ 0x01, 0x07, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical - going high" },
|
||||
{ 0x01, 0x08, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical - going low" },
|
||||
{ 0x01, 0x09, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical - going high" },
|
||||
{ 0x01, 0x0a, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable - going low" },
|
||||
{ 0x01, 0x0b, 0xff, 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" },
|
||||
{ 0x02, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Idle" },
|
||||
{ 0x02, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Active" },
|
||||
{ 0x02, 0x02, 0xff, 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" },
|
||||
{ 0x03, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "State Deasserted" },
|
||||
{ 0x03, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "State Asserted" },
|
||||
{ 0x04, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Predictive Failure Deasserted" },
|
||||
{ 0x04, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Predictive Failure Asserted" },
|
||||
{ 0x05, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Limit Not Exceeded" },
|
||||
{ 0x05, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Limit Exceeded" },
|
||||
{ 0x06, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Performance Met" },
|
||||
{ 0x06, 0x01, 0xff, 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" },
|
||||
{ 0x07, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to OK" },
|
||||
{ 0x07, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critial from OK" },
|
||||
{ 0x07, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Critical from less severe" },
|
||||
{ 0x07, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-recoverable from less severe" },
|
||||
{ 0x07, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critical from more severe" },
|
||||
{ 0x07, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Critical from Non-recoverable" },
|
||||
{ 0x07, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-recoverable" },
|
||||
{ 0x07, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Monitor" },
|
||||
{ 0x07, 0x08, 0xff, 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" },
|
||||
{ 0x08, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Removed/Absent" },
|
||||
{ 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Inserted/Present" },
|
||||
{ 0x09, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Disabled" },
|
||||
{ 0x09, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Enabled" },
|
||||
{ 0x0a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Running" },
|
||||
{ 0x0a, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to In Test" },
|
||||
{ 0x0a, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Power Off" },
|
||||
{ 0x0a, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to On Line" },
|
||||
{ 0x0a, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Off Line" },
|
||||
{ 0x0a, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Off Duty" },
|
||||
{ 0x0a, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Degraded" },
|
||||
{ 0x0a, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Power Save" },
|
||||
{ 0x0a, 0x08, 0xff, 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" },
|
||||
{ 0x0b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Fully Redundant" },
|
||||
{ 0x0b, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Lost" },
|
||||
{ 0x0b, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded" },
|
||||
{ 0x0b, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Sufficient from Redundant" },
|
||||
{ 0x0b, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Sufficient from Insufficient" },
|
||||
{ 0x0b, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Insufficient Resources" },
|
||||
{ 0x0b, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded from Fully Redundant" },
|
||||
{ 0x0b, 0x07, 0xff, 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" },
|
||||
{ 0x0c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D0 Power State" },
|
||||
{ 0x0c, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D1 Power State" },
|
||||
{ 0x0c, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D2 Power State" },
|
||||
{ 0x0c, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D3 Power State" },
|
||||
/* END */
|
||||
{ 0x00, 0x00, 0x00, NULL, NULL },
|
||||
{ 0x00, 0x00, 0xff, 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 },
|
||||
{ 0x00, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Reserved", NULL },
|
||||
{ 0x01, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Temperature", NULL },
|
||||
{ 0x02, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Voltage", NULL },
|
||||
{ 0x03, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Current", NULL },
|
||||
{ 0x04, 0x00, 0xff, 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" },
|
||||
{ 0x05, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "General Chassis intrusion" },
|
||||
{ 0x05, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Drive Bay intrusion" },
|
||||
{ 0x05, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "I/O Card area intrusion" },
|
||||
{ 0x05, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Processor area intrusion" },
|
||||
{ 0x05, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "System unplugged from LAN" },
|
||||
{ 0x05, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Unauthorized dock/undock" },
|
||||
{ 0x05, 0x06, 0xff, 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" },
|
||||
{ 0x06, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Front Panel Lockout violation attempted" },
|
||||
{ 0x06, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password viiolation - user password" },
|
||||
{ 0x06, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - setup password" },
|
||||
{ 0x06, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - network boot password" },
|
||||
{ 0x06, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Other pre-boot password violation" },
|
||||
{ 0x06, 0x05, 0xff, 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" },
|
||||
{ 0x07, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "IERR" },
|
||||
{ 0x07, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Thermal Trip" },
|
||||
{ 0x07, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB1/BIST failure" },
|
||||
{ 0x07, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB2/Hang in POST failure" },
|
||||
{ 0x07, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB3/Processor startup/init failure" },
|
||||
{ 0x07, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Configuration Error" },
|
||||
{ 0x07, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "SM BIOS Uncorrectable CPU-complex Error" },
|
||||
{ 0x07, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Presence detected" },
|
||||
{ 0x07, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Disabled" },
|
||||
{ 0x07, 0x09, 0xff, 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" },
|
||||
{ 0x08, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Presence detected" },
|
||||
{ 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Failure detected" },
|
||||
{ 0x08, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Predictive failure" },
|
||||
{ 0x08, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Power Supply AC lost" },
|
||||
{ 0x08, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "AC lost or out-of-range" },
|
||||
{ 0x08, 0x05, 0xff, 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" },
|
||||
{ 0x09, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power off/down" },
|
||||
{ 0x09, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power cycle" },
|
||||
{ 0x09, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "240VA power down" },
|
||||
{ 0x09, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Interlock power down" },
|
||||
{ 0x09, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "AC lost" },
|
||||
{ 0x09, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Soft-power control failure" },
|
||||
{ 0x09, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Failure detected" },
|
||||
{ 0x09, 0x07, 0xff, 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 },
|
||||
{ 0x0a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cooling Device", NULL },
|
||||
{ 0x0b, 0x00, 0xff, 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" },
|
||||
{ 0x0c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Correctable ECC" },
|
||||
{ 0x0c, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Uncorrectable ECC" },
|
||||
{ 0x0c, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Parity" },
|
||||
{ 0x0c, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Scrub Failed" },
|
||||
{ 0x0c, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Device Disabled" },
|
||||
{ 0x0c, 0x05, 0xff, 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 },
|
||||
{ 0x0d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", NULL },
|
||||
{ 0x0e, 0x00, 0xff, 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" },
|
||||
{ 0x0f, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Error" },
|
||||
{ 0x0f, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Hang" },
|
||||
{ 0x0f, 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 1" },
|
||||
{ 0x0f, 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 2" },
|
||||
{ 0x0f, 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 3" },
|
||||
{ 0x0f, 0x02, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 4" },
|
||||
{ 0x0f, 0x02, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "Progress 5" },
|
||||
{ 0x0f, 0x02, 0x13, IPMI_EVENT_CLASS_DISCRETE, "System Firmware", "System Boot Initiated" },
|
||||
|
||||
{ 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" },
|
||||
{ 0x10, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Correctable memory error logging disabled" },
|
||||
{ 0x10, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Event logging disabled" },
|
||||
{ 0x10, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log area reset/cleared" },
|
||||
{ 0x10, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "All event logging disabled" },
|
||||
{ 0x10, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log full" },
|
||||
|
||||
{ 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" },
|
||||
{ 0x11, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "BIOS Reset" },
|
||||
{ 0x11, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Reset" },
|
||||
{ 0x11, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Shut Down" },
|
||||
{ 0x11, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Down" },
|
||||
{ 0x11, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Cycle" },
|
||||
{ 0x11, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS NMI/diag Interrupt" },
|
||||
{ 0x11, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Expired" },
|
||||
{ 0x11, 0x07, 0xff, 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." },
|
||||
{ 0x12, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "System Reconfigured" },
|
||||
{ 0x12, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "OEM System boot event" },
|
||||
{ 0x12, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Undetermined system hardware failure" },
|
||||
{ 0x12, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Entry added to auxillary log" },
|
||||
{ 0x12, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "PEF Action" },
|
||||
{ 0x12, 0x05, 0xff, 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" },
|
||||
{ 0x13, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Front Panel NMI" },
|
||||
{ 0x13, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Timeout" },
|
||||
{ 0x13, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "I/O Channel check NMI" },
|
||||
{ 0x13, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Software NMI" },
|
||||
{ 0x13, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "PCI PERR" },
|
||||
{ 0x13, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "PCI SERR" },
|
||||
{ 0x13, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "EISA failsafe timeout" },
|
||||
{ 0x13, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Correctable error" },
|
||||
{ 0x13, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Uncorrectable error" },
|
||||
{ 0x13, 0x09, 0xff, 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" },
|
||||
{ 0x14, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Power Button pressed" },
|
||||
{ 0x14, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Sleep Button pressed" },
|
||||
{ 0x14, 0x02, 0xff, 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 },
|
||||
{ 0x15, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module/Board", NULL },
|
||||
{ 0x16, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Microcontroller/Coprocessor", NULL },
|
||||
{ 0x17, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Add-in Card", NULL },
|
||||
{ 0x18, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chassis", NULL },
|
||||
{ 0x19, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", NULL },
|
||||
{ 0x1a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Other FRU", NULL },
|
||||
{ 0x1b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", NULL },
|
||||
{ 0x1c, 0x00, 0xff, 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" },
|
||||
{ 0x1d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by power up" },
|
||||
{ 0x1d, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by hard reset" },
|
||||
{ 0x1d, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by warm reset" },
|
||||
{ 0x1d, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "User requested PXE boot" },
|
||||
{ 0x1d, 0x04, 0xff, 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" },
|
||||
{ 0x1e, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "No bootable media" },
|
||||
{ 0x1e, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Non-bootable disk in drive" },
|
||||
{ 0x1e, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "PXE server not found" },
|
||||
{ 0x1e, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Invalid boot sector" },
|
||||
{ 0x1e, 0x04, 0xff, 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" },
|
||||
{ 0x1f, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "A: boot completed" },
|
||||
{ 0x1f, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "C: boot completed" },
|
||||
{ 0x1f, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "PXE boot completed" },
|
||||
{ 0x1f, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Diagnostic boot completed" },
|
||||
{ 0x1f, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "CD-ROM boot completed" },
|
||||
{ 0x1f, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "ROM boot completed" },
|
||||
{ 0x1f, 0x06, 0xff, 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" },
|
||||
{ 0x20, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Critical Stop", "Stop during OS load/init" },
|
||||
{ 0x20, 0x01, 0xff, 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" },
|
||||
{ 0x21, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Fault Status asserted" },
|
||||
{ 0x21, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Identify Status asserted" },
|
||||
{ 0x21, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector Device installed/attached" },
|
||||
{ 0x21, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector ready for device installation" },
|
||||
{ 0x21, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector ready for device removal" },
|
||||
{ 0x21, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot Power is off" },
|
||||
{ 0x21, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot/Connector device removal request" },
|
||||
{ 0x21, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Interlock asserted" },
|
||||
{ 0x21, 0x08, 0xff, 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" },
|
||||
{ 0x22, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S0/G0: working" },
|
||||
{ 0x22, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S1: sleeping with system hw & processor context maintained" },
|
||||
{ 0x22, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S2: sleeping, processor context lost" },
|
||||
{ 0x22, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S3: sleeping, processor & hw context lost, memory retained" },
|
||||
{ 0x22, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S4: non-volatile sleep/suspend-to-disk" },
|
||||
{ 0x22, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S5/G2: soft-off" },
|
||||
{ 0x22, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S4/S5: soft-off" },
|
||||
{ 0x22, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "G3: mechanical off" },
|
||||
{ 0x22, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Sleeping in S1/S2/S3 state" },
|
||||
{ 0x22, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "G1: sleeping" },
|
||||
{ 0x22, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S5: entered by override" },
|
||||
{ 0x22, 0x0b, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Legacy ON state" },
|
||||
{ 0x22, 0x0c, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Legacy OFF state" },
|
||||
{ 0x22, 0x0e, 0xff, 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" },
|
||||
{ 0x23, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Timer expired" },
|
||||
{ 0x23, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Hard reset" },
|
||||
{ 0x23, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Power down" },
|
||||
{ 0x23, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Power cycle" },
|
||||
{ 0x23, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" },
|
||||
{ 0x23, 0x08, 0xff, 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" },
|
||||
{ 0x24, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated page" },
|
||||
{ 0x24, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated LAN alert" },
|
||||
{ 0x24, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform Event Trap generated" },
|
||||
{ 0x24, 0x03, 0xff, 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" },
|
||||
{ 0x25, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Present" },
|
||||
{ 0x25, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Absent" },
|
||||
{ 0x25, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Disabled" },
|
||||
|
||||
{ 0x26, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Monitor ASIC/IC", NULL },
|
||||
{ 0x26, 0x00, 0xff, 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" },
|
||||
{ 0x27, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "LAN", "Heartbeat Lost" },
|
||||
{ 0x27, 0x01, 0xff, 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" },
|
||||
{ 0x28, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Sensor access degraded or unavailable" },
|
||||
{ 0x28, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Controller access degraded or unavailable" },
|
||||
{ 0x28, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Management controller off-line" },
|
||||
{ 0x28, 0x03, 0xff, 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" },
|
||||
{ 0x29, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Low" },
|
||||
{ 0x29, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Failed" },
|
||||
{ 0x29, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Presence Detected" },
|
||||
|
||||
{ 0x00, 0x00, 0x00, NULL, NULL },
|
||||
{ 0x00, 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);
|
||||
void ipmi_sel_print_std_entry(struct sel_event_record * evt);
|
||||
|
||||
#endif /* IPMI_SEL_H */
|
||||
|
@ -34,23 +34,18 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_CHASSIS_H
|
||||
#define _IPMI_CHASSIS_H
|
||||
#ifndef IPMI_SENSOR_H
|
||||
#define IPMI_SENSOR_H
|
||||
|
||||
#include <ipmi.h>
|
||||
#include <math.h>
|
||||
#include <ipmitool/bswap.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
#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 GET_SENSOR_READING 0x2d
|
||||
#define GET_SENSOR_FACTORS 0x23
|
||||
#define GET_SENSOR_THRES 0x27
|
||||
#define GET_SENSOR_TYPE 0x2f
|
||||
|
||||
#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_sensor_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
int ipmi_chassis_main(struct ipmi_intf *, int, char **);
|
||||
|
||||
#endif /*_IPMI_CHASSIS_H*/
|
||||
#endif /* IPMI_SENSOR_H */
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
* 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 __RMCP_H
|
||||
#define __RMCP_H
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi_lan.h>
|
||||
|
||||
#define RMCP_VERSION_1 0x06
|
||||
|
||||
#define RMCP_UDP_PORT 0x26f /* port 623 */
|
||||
#define RMCP_UDP_SECURE_PORT 0x298 /* port 664 */
|
||||
|
||||
#define RMCP_TYPE_MASK 0x80
|
||||
#define RMCP_TYPE_NORM 0x00
|
||||
#define RMCP_TYPE_ACK 0x01
|
||||
|
||||
static const struct valstr rmcp_type_vals[] __attribute__((unused)) = {
|
||||
{ RMCP_TYPE_NORM, "Normal RMCP" },
|
||||
{ RMCP_TYPE_ACK, "RMCP ACK" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define RMCP_CLASS_MASK 0x1f
|
||||
#define RMCP_CLASS_ASF 0x06
|
||||
#define RMCP_CLASS_IPMI 0x07
|
||||
#define RMCP_CLASS_OEM 0x08
|
||||
|
||||
static const struct valstr rmcp_class_vals[] __attribute__((unused)) = {
|
||||
{ RMCP_CLASS_ASF, "ASF" },
|
||||
{ RMCP_CLASS_IPMI, "IPMI" },
|
||||
{ RMCP_CLASS_OEM, "OEM" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* RMCP message header */
|
||||
struct rmcp_hdr {
|
||||
unsigned char ver;
|
||||
unsigned char __reserved;
|
||||
unsigned char seq;
|
||||
unsigned char class;
|
||||
} __attribute__((packed));
|
||||
|
||||
int handle_rmcp(struct ipmi_intf * intf, unsigned char * data, int data_len);
|
||||
|
||||
#endif /* __RMCP_H */
|
@ -1,502 +0,0 @@
|
||||
/*
|
||||
* 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_chassis.h>
|
||||
|
||||
static int ipmi_chassis_power_status(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req 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_req 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);
|
||||
}
|
||||
|
||||
static void ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
|
||||
{
|
||||
struct ipmi_req 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_rsp * rsp;
|
||||
struct ipmi_req 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_rsp * rsp;
|
||||
struct ipmi_req 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_rsp * rsp;
|
||||
struct ipmi_req 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_rsp * rsp;
|
||||
struct ipmi_req 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_rsp * rsp;
|
||||
struct ipmi_req 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_rsp * rsp;
|
||||
struct ipmi_req 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<<IPMI_CHASSIS_POLICY_ALWAYS_OFF))
|
||||
printf("always-off ");
|
||||
if (rsp->data[0] & (1<<IPMI_CHASSIS_POLICY_ALWAYS_ON))
|
||||
printf("always-on ");
|
||||
if (rsp->data[0] & (1<<IPMI_CHASSIS_POLICY_PREVIOUS))
|
||||
printf("previous");
|
||||
printf("\n");
|
||||
}
|
||||
else {
|
||||
printf("Set chassis power restore policy to ");
|
||||
switch (policy) {
|
||||
case IPMI_CHASSIS_POLICY_ALWAYS_ON:
|
||||
printf("always-on\n");
|
||||
break;
|
||||
case IPMI_CHASSIS_POLICY_ALWAYS_OFF:
|
||||
printf("always-off\n");
|
||||
break;
|
||||
case IPMI_CHASSIS_POLICY_PREVIOUS:
|
||||
printf("previous\n");
|
||||
break;
|
||||
default:
|
||||
printf("unknown\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc || !strncmp(argv[0], "help", 4)) {
|
||||
printf("Chassis Commands: status, power, identify, policy, restart_cause, poh\n");
|
||||
return 0;
|
||||
}
|
||||
else if (!strncmp(argv[0], "status", 6)) {
|
||||
ipmi_chassis_status(intf);
|
||||
}
|
||||
else if (!strncmp(argv[0], "power", 5)) {
|
||||
unsigned char ctl = 0;
|
||||
|
||||
if (argc < 2 || !strncmp(argv[1], "help", 4)) {
|
||||
printf("chassis power Commands: status, on, off, cycle, reset, diag, soft\n");
|
||||
return 0;
|
||||
}
|
||||
if (!strncmp(argv[1], "status", 6)) {
|
||||
ipmi_chassis_power_status(intf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strncmp(argv[1], "up", 2) || !strncmp(argv[1], "on", 2))
|
||||
ctl = IPMI_CHASSIS_CTL_POWER_UP;
|
||||
else if (!strncmp(argv[1], "down", 4) || !strncmp(argv[1], "off", 3))
|
||||
ctl = IPMI_CHASSIS_CTL_POWER_DOWN;
|
||||
else if (!strncmp(argv[1], "cycle", 5))
|
||||
ctl = IPMI_CHASSIS_CTL_POWER_CYCLE;
|
||||
else if (!strncmp(argv[1], "reset", 5))
|
||||
ctl = IPMI_CHASSIS_CTL_HARD_RESET;
|
||||
else if (!strncmp(argv[1], "diag", 5))
|
||||
ctl = IPMI_CHASSIS_CTL_PULSE_DIAG;
|
||||
else if (!strncmp (argv[1], "acpi", 4) || !strncmp(argv[1], "soft", 4))
|
||||
ctl = IPMI_CHASSIS_CTL_ACPI_SOFT;
|
||||
else {
|
||||
printf("Invalid chassis power command: %s\n", argv[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ipmi_chassis_power_control(intf, ctl);
|
||||
}
|
||||
else if (!strncmp(argv[0], "identify", 8)) {
|
||||
if (argc < 2) {
|
||||
ipmi_chassis_identify(intf, NULL);
|
||||
}
|
||||
else if (!strncmp(argv[1], "help", 4)) {
|
||||
printf("chassis identify <interval>\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 <state>\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 <option> [value ...]\n");
|
||||
}
|
||||
else {
|
||||
if (!strncmp(argv[1], "get", 3)) {
|
||||
ipmi_chassis_get_bootparam(intf, argv[2]);
|
||||
}
|
||||
else if (!strncmp(argv[1], "set", 3)) {
|
||||
if (argc < 4) {
|
||||
printf("bootparam set <option> [value ...]\n");
|
||||
} else {
|
||||
if (!strncmp(argv[2], "bootflag", 8)) {
|
||||
ipmi_chassis_set_bootflag(intf, argv[3]);
|
||||
}
|
||||
else {
|
||||
printf("bootparam set <option> [value ...]\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("bootparam get|set <option> [value]\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("Invalid Chassis command: %s\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,216 +0,0 @@
|
||||
/*
|
||||
* 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 <ipmi.h>
|
||||
#include <ipmi_fru.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static char * get_fru_area_str(unsigned char * data, int * offset)
|
||||
{
|
||||
char * str;
|
||||
int len;
|
||||
int off = *offset;
|
||||
|
||||
len = data[off++];
|
||||
len &= 0x3f; /* bits 0:5 contain length */
|
||||
|
||||
str = malloc(len+1);
|
||||
if (!str)
|
||||
return NULL;
|
||||
str[len] = '\0';
|
||||
|
||||
memcpy(str, &data[off], len);
|
||||
|
||||
off += len;
|
||||
*offset = off;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static void ipmi_fru_print(struct ipmi_intf * intf, unsigned char id)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
unsigned char fru_data[256], msg_data[4];
|
||||
int i, len, offset;
|
||||
|
||||
struct fru_area_chassis chassis;
|
||||
struct fru_area_board board;
|
||||
struct fru_area_product product;
|
||||
|
||||
struct fru_info fru;
|
||||
struct fru_header header;
|
||||
|
||||
msg_data[0] = id;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_FRU_INFO;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 1;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode)
|
||||
return;
|
||||
memcpy(&fru, rsp->data, sizeof(fru));
|
||||
|
||||
if (verbose > 1)
|
||||
printf("fru.size = %d bytes (accessed by %s)\n",
|
||||
fru.size, fru.access ? "words" : "bytes");
|
||||
|
||||
msg_data[0] = id;
|
||||
msg_data[1] = 0;
|
||||
msg_data[2] = 0;
|
||||
msg_data[3] = 8;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_FRU_DATA;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 4;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode)
|
||||
return;
|
||||
memcpy(&header, rsp->data + 1, 8);
|
||||
|
||||
if (verbose > 1) {
|
||||
printf("fru.header.version: 0x%x\n", header.version);
|
||||
printf("fru.header.offset.internal: 0x%x\n", header.offset.internal * 8);
|
||||
printf("fru.header.offset.chassis: 0x%x\n", header.offset.chassis * 8);
|
||||
printf("fru.header.offset.board: 0x%x\n", header.offset.board * 8);
|
||||
printf("fru.header.offset.product: 0x%x\n", header.offset.product * 8);
|
||||
printf("fru.header.offset.multi: 0x%x\n", header.offset.multi * 8);
|
||||
}
|
||||
|
||||
offset = 0;
|
||||
memset(fru_data, 0, 256);
|
||||
do {
|
||||
msg_data[0] = id;
|
||||
msg_data[1] = offset;
|
||||
msg_data[2] = 0;
|
||||
msg_data[3] = 32;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode)
|
||||
continue;
|
||||
|
||||
len = rsp->data[0];
|
||||
memcpy(&fru_data[offset], rsp->data + 1, len);
|
||||
offset += len;
|
||||
} while (offset < fru.size);
|
||||
|
||||
/* chassis area */
|
||||
i = header.offset.chassis * 8;
|
||||
chassis.area_ver = fru_data[i++];
|
||||
chassis.area_len = fru_data[i++];
|
||||
chassis.type = fru_data[i++];
|
||||
chassis.part = get_fru_area_str(fru_data, &i);
|
||||
chassis.serial = get_fru_area_str(fru_data, &i);
|
||||
|
||||
/* board area */
|
||||
i = header.offset.board * 8;
|
||||
board.area_ver = fru_data[i++];
|
||||
board.area_len = fru_data[i++];
|
||||
board.lang = fru_data[i++];
|
||||
i += 3; /* skip mfg. date time */
|
||||
board.mfg = get_fru_area_str(fru_data, &i);
|
||||
board.prod = get_fru_area_str(fru_data, &i);
|
||||
board.serial = get_fru_area_str(fru_data, &i);
|
||||
board.part = get_fru_area_str(fru_data, &i);
|
||||
|
||||
/* product area */
|
||||
i = header.offset.product * 8;
|
||||
product.area_ver = fru_data[i++];
|
||||
product.area_len = fru_data[i++];
|
||||
product.lang = fru_data[i++];
|
||||
product.mfg = get_fru_area_str(fru_data, &i);
|
||||
product.name = get_fru_area_str(fru_data, &i);
|
||||
product.part = get_fru_area_str(fru_data, &i);
|
||||
product.version = get_fru_area_str(fru_data, &i);
|
||||
product.serial = get_fru_area_str(fru_data, &i);
|
||||
product.asset = get_fru_area_str(fru_data, &i);
|
||||
|
||||
printf("Chassis Type : %s\n", chassis_type_desc[chassis.type]);
|
||||
printf("Chassis Part : %s\n", chassis.part);
|
||||
printf("Chassis Serial : %s\n", chassis.serial);
|
||||
|
||||
printf("Board Mfg : %s\n", board.mfg);
|
||||
printf("Board Product : %s\n", board.prod);
|
||||
printf("Board Serial : %s\n", board.serial);
|
||||
printf("Board Part : %s\n", board.part);
|
||||
|
||||
printf("Product Mfg : %s\n", product.mfg);
|
||||
printf("Product Name : %s\n", product.name);
|
||||
printf("Product Part : %s\n", product.part);
|
||||
printf("Product Version : %s\n", product.version);
|
||||
printf("Product Serial : %s\n", product.serial);
|
||||
printf("Product Asset : %s\n", product.asset);
|
||||
|
||||
free(chassis.part);
|
||||
free(chassis.serial);
|
||||
|
||||
free(board.mfg);
|
||||
free(board.prod);
|
||||
free(board.serial);
|
||||
free(board.part);
|
||||
|
||||
free(product.mfg);
|
||||
free(product.name);
|
||||
free(product.part);
|
||||
free(product.version);
|
||||
free(product.serial);
|
||||
free(product.asset);
|
||||
}
|
||||
|
||||
int ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (argc == 0) {
|
||||
ipmi_fru_print(intf, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strncmp(argv[0], "help", 4))
|
||||
printf("FRU Commands: print\n");
|
||||
else if (!strncmp(argv[0], "print", 4))
|
||||
ipmi_fru_print(intf, 0);
|
||||
else
|
||||
printf("Invalid FRU command: %s\n", argv[0]);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,483 +0,0 @@
|
||||
/*
|
||||
* 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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_lan.h>
|
||||
#include <helper.h>
|
||||
|
||||
static struct lan_param * get_lan_param(struct ipmi_intf * intf, unsigned char chan, int param)
|
||||
{
|
||||
struct lan_param * p;
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
unsigned char msg_data[4];
|
||||
|
||||
p = &ipmi_lan_params[param];
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
msg_data[0] = chan;
|
||||
msg_data[1] = p->cmd;
|
||||
msg_data[2] = 0;
|
||||
msg_data[3] = 0;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_TRANSPORT;
|
||||
req.msg.cmd = IPMI_LAN_GET_CONFIG;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 4;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
|
||||
if (!rsp || rsp->ccode)
|
||||
return NULL;
|
||||
|
||||
p->data = rsp->data + 1;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static int set_lan_param(struct ipmi_intf * intf, unsigned char chan, int param, unsigned char * data, int len)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
unsigned char msg_data[32];
|
||||
|
||||
if (param < 0)
|
||||
return -1;
|
||||
|
||||
msg_data[0] = chan;
|
||||
msg_data[1] = param;
|
||||
|
||||
memcpy(&msg_data[2], data, len);
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_TRANSPORT;
|
||||
req.msg.cmd = IPMI_LAN_SET_CONFIG;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = len+2;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void suspend_lan_arp(struct ipmi_intf * intf, int suspend)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
unsigned char msg_data[2];
|
||||
|
||||
msg_data[0] = IPMI_LAN_CHANNEL_1;
|
||||
msg_data[1] = suspend;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_TRANSPORT;
|
||||
req.msg.cmd = IPMI_LAN_SUSPEND_ARP;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 2;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (rsp && !rsp->ccode)
|
||||
printf("Suspend BMC ARP status : 0x%x\n", rsp->data[0]);
|
||||
}
|
||||
|
||||
/* Enable Gratuitous ARP and Interval */
|
||||
static void lan_set_arp(struct ipmi_intf * intf)
|
||||
{
|
||||
unsigned char data;
|
||||
|
||||
data = 0x01;
|
||||
set_lan_param(intf, IPMI_LANP_BMC_ARP, &data, 1);
|
||||
|
||||
data = 0x03;
|
||||
set_lan_param(intf, IPMI_LANP_GRAT_ARP, &data, 1);
|
||||
}
|
||||
|
||||
static void set_lan_params(struct ipmi_intf * intf)
|
||||
{
|
||||
lan_set_auth(intf);
|
||||
lan_set_arp(intf);
|
||||
suspend_lan_arp(intf, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void ipmi_lan_print(struct ipmi_intf * intf, unsigned char chan)
|
||||
{
|
||||
struct lan_param * p;
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_AUTH_TYPE);
|
||||
if (p) printf("%-24s: 0x%02x\n", p->desc, p->data[0]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_AUTH_TYPE_ENABLE);
|
||||
if (p) printf("%-24s: callback=0x%02x user=0x%02x operator=0x%02x admin=0x%02x oem=0x%02x\n",
|
||||
p->desc, p->data[0], p->data[1], p->data[2], p->data[3], p->data[4]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_IP_ADDR_SRC);
|
||||
if (p) printf("%-24s: 0x%02x\n", p->desc, p->data[0]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_IP_ADDR);
|
||||
if (p) printf("%-24s: %d.%d.%d.%d\n", p->desc,
|
||||
p->data[0], p->data[1], p->data[2], p->data[3]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_SUBNET_MASK);
|
||||
if (p) printf("%-24s: %d.%d.%d.%d\n", p->desc,
|
||||
p->data[0], p->data[1], p->data[2], p->data[3]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_MAC_ADDR);
|
||||
if (p) printf("%-24s: %02x:%02x:%02x:%02x:%02x:%02x\n", p->desc,
|
||||
p->data[0], p->data[1], p->data[2], p->data[3], p->data[4], p->data[5]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_SNMP_STRING);
|
||||
if (p) printf("%-24s: %s\n", p->desc, p->data);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_IP_HEADER);
|
||||
if (p) printf("%-24s: TTL=0x%02x flags=0x%02x precedence=0x%02x TOS=0x%02x\n",
|
||||
p->desc, p->data[0], p->data[1] & 0xe0, p->data[2] & 0xe0, p->data[2] & 0x1e);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_BMC_ARP);
|
||||
if (p) printf("%-24s: 0x%02x\n", p->desc, p->data[0]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_GRAT_ARP);
|
||||
if (p) printf("%-24s: 0x%02x\n", p->desc, p->data[0]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_DEF_GATEWAY_IP);
|
||||
if (p) printf("%-24s: %d.%d.%d.%d\n", p->desc,
|
||||
p->data[0], p->data[1], p->data[2], p->data[3]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_DEF_GATEWAY_MAC);
|
||||
if (p) printf("%-24s: %02x:%02x:%02x:%02x:%02x:%02x\n", p->desc,
|
||||
p->data[0], p->data[1], p->data[2], p->data[3], p->data[4], p->data[5]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_BAK_GATEWAY_IP);
|
||||
if (p) printf("%-24s: %d.%d.%d.%d\n", p->desc,
|
||||
p->data[0], p->data[1], p->data[2], p->data[3]);
|
||||
|
||||
p = get_lan_param(intf, chan, IPMI_LANP_BAK_GATEWAY_MAC);
|
||||
if (p) printf("%-24s: %02x:%02x:%02x:%02x:%02x:%02x\n", p->desc,
|
||||
p->data[0], p->data[1], p->data[2], p->data[3], p->data[4], p->data[5]);
|
||||
}
|
||||
|
||||
/* Configure Authentication Types */
|
||||
static void ipmi_lan_set_auth(struct ipmi_intf * intf, unsigned char chan, char * level, char * types)
|
||||
{
|
||||
unsigned char data[5];
|
||||
unsigned char authtype = 0;
|
||||
char * p;
|
||||
struct lan_param * lp;
|
||||
|
||||
if (!level || !types)
|
||||
return;
|
||||
|
||||
lp = get_lan_param(intf, chan, IPMI_LANP_AUTH_TYPE_ENABLE);
|
||||
if (!lp)
|
||||
return;
|
||||
if (verbose > 1)
|
||||
printf("%-24s: callback=0x%02x user=0x%02x operator=0x%02x admin=0x%02x oem=0x%02x\n",
|
||||
lp->desc, lp->data[0], lp->data[1], lp->data[2], lp->data[3], lp->data[4]);
|
||||
memset(data, 0, 5);
|
||||
memcpy(data, lp->data, 5);
|
||||
|
||||
p = types;
|
||||
while (p) {
|
||||
if (!strncmp(p, "none", 4))
|
||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_NONE;
|
||||
else if (!strncmp(p, "md2", 3))
|
||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_MD2;
|
||||
else if (!strncmp(p, "key", 3))
|
||||
authtype |= 1 << IPMI_SESSION_AUTHTYPE_KEY;
|
||||
else
|
||||
printf("invalid authtype: %s\n", p);
|
||||
p = strchr(p, ',');
|
||||
if (p)
|
||||
p++;
|
||||
}
|
||||
|
||||
p = level;
|
||||
while (p) {
|
||||
if (!strncmp(p, "callback", 8))
|
||||
data[0] = authtype;
|
||||
else if (!strncmp(p, "user", 4))
|
||||
data[1] = authtype;
|
||||
else if (!strncmp(p, "operator", 8))
|
||||
data[2] = authtype;
|
||||
else if (!strncmp(p, "admin", 5))
|
||||
data[3] = authtype;
|
||||
else
|
||||
printf("invalid auth level: %s\n", p);
|
||||
p = strchr(p, ',');
|
||||
if (p)
|
||||
p++;
|
||||
}
|
||||
|
||||
if (verbose > 1)
|
||||
printbuf(data, 5, "authtype data");
|
||||
|
||||
set_lan_param(intf, chan, IPMI_LANP_AUTH_TYPE_ENABLE, data, 5);
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_lan_set_password(struct ipmi_intf * intf,
|
||||
unsigned char userid, unsigned char * password)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
unsigned char data[18];
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
data[0] = userid & 0x3f;/* user ID */
|
||||
data[1] = 0x02; /* set password */
|
||||
memcpy(data+2, password, (strlen(password) > 16) ? 16 : strlen(password));
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x47;
|
||||
req.msg.data = data;
|
||||
req.msg.data_len = 18;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x setting user %d password to %s\n",
|
||||
rsp ? rsp->ccode : 0, userid, password);
|
||||
return;
|
||||
}
|
||||
|
||||
/* adjust our session password
|
||||
* or we will no longer be able to communicate with BMC
|
||||
*/
|
||||
lan_session.password = 1;
|
||||
memset(lan_session.authcode, 0, 16);
|
||||
memcpy(lan_session.authcode, password, strlen(password));
|
||||
|
||||
printf("Password for user %d set to %s\n", userid, lan_session.authcode);
|
||||
}
|
||||
|
||||
static int
|
||||
get_cmdline_macaddr(char * arg, unsigned char * buf)
|
||||
{
|
||||
unsigned m1, m2, m3, m4, m5, m6;
|
||||
if (sscanf(arg, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
&m1, &m2, &m3, &m4, &m5, &m6) != 6) {
|
||||
printf("Invalid MAC address: %s\n", arg);
|
||||
return -1;
|
||||
}
|
||||
buf[0] = m1;
|
||||
buf[1] = m2;
|
||||
buf[2] = m3;
|
||||
buf[3] = m4;
|
||||
buf[4] = m5;
|
||||
buf[5] = m6;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
get_cmdline_ipaddr(char * arg, unsigned char * buf)
|
||||
{
|
||||
unsigned ip1, ip2, ip3, ip4;
|
||||
if (sscanf(arg, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4) != 4) {
|
||||
printf("Invalid IP address: %s\n", arg);
|
||||
return -1;
|
||||
}
|
||||
buf[0] = ip1;
|
||||
buf[1] = ip2;
|
||||
buf[2] = ip3;
|
||||
buf[3] = ip4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
unsigned char data[32];
|
||||
unsigned char chan;
|
||||
memset(&data, 0, sizeof(data));
|
||||
|
||||
if (argc < 2 || !strncmp(argv[0], "help", 4)) {
|
||||
printf("usage: lan set <channel> <command>\n");
|
||||
printf("LAN set commands: ipaddr, netmask, macaddr, defgw, bakgw, password, auth, ipsrc\n");
|
||||
return;
|
||||
}
|
||||
|
||||
chan = (unsigned char) strtod(argv[0], NULL);
|
||||
if (chan != 0x6 && chan != 0x7) {
|
||||
printf("valid LAN channels are 6 and 7\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* set authentication types */
|
||||
if (!strncmp(argv[1], "auth", 4)) {
|
||||
if (argc < 3 || !strncmp(argv[2], "help", 4)) {
|
||||
printf("lan set <channel> auth <level> <type,type,...>\n");
|
||||
printf(" level = callback, user, operator, admin\n");
|
||||
printf(" types = none, md2, key\n");
|
||||
printf("example: lan set 7 auth admin key\n");
|
||||
return;
|
||||
}
|
||||
ipmi_lan_set_auth(intf, chan, argv[2], argv[3]);
|
||||
return;
|
||||
}
|
||||
/* ip address source */
|
||||
else if (!strncmp(argv[1], "ipsrc", 5)) {
|
||||
if (argc < 3 || !strncmp(argv[2], "help", 4)) {
|
||||
printf("lan set <channel> ipsrc <source>\n");
|
||||
printf(" none = unspecified\n");
|
||||
printf(" static = static address (manually configured)\n");
|
||||
printf(" dhcp = address obtained by BMC running DHCP\n");
|
||||
printf(" bios = address loaded by BIOS or system software\n");
|
||||
return;
|
||||
}
|
||||
if (!strncmp(argv[2], "none", 4))
|
||||
data[0] = 0;
|
||||
else if (!strncmp(argv[2], "static", 5))
|
||||
data[0] = 1;
|
||||
else if (!strncmp(argv[2], "dhcp", 4))
|
||||
data[0] = 2;
|
||||
else if (!strncmp(argv[2], "bios", 4))
|
||||
data[0] = 3;
|
||||
else
|
||||
return;
|
||||
set_lan_param(intf, chan, IPMI_LANP_IP_ADDR_SRC, data, 1);
|
||||
}
|
||||
/* session password
|
||||
* not strictly a lan setting, but its used for lan connections */
|
||||
else if (!strncmp(argv[1], "password", 8)) {
|
||||
ipmi_lan_set_password(intf, 1, argv[2]);
|
||||
}
|
||||
/* ip address */
|
||||
else if (!strncmp(argv[1], "ipaddr", 6) &&
|
||||
!get_cmdline_ipaddr(argv[2], data)) {
|
||||
printf("Setting LAN %s to %d.%d.%d.%d\n",
|
||||
ipmi_lan_params[IPMI_LANP_IP_ADDR].desc,
|
||||
data[0], data[1], data[2], data[3]);
|
||||
set_lan_param(intf, chan, IPMI_LANP_IP_ADDR, data, 4);
|
||||
/* also set ip address source to "static" */
|
||||
data[0] = 0x1;
|
||||
set_lan_param(intf, chan, IPMI_LANP_IP_ADDR_SRC, data, 1);
|
||||
}
|
||||
/* network mask */
|
||||
else if (!strncmp(argv[1], "netmask", 7) &&
|
||||
!get_cmdline_ipaddr(argv[2], data)) {
|
||||
printf("Setting LAN %s to %d.%d.%d.%d\n",
|
||||
ipmi_lan_params[IPMI_LANP_SUBNET_MASK].desc,
|
||||
data[0], data[1], data[2], data[3]);
|
||||
set_lan_param(intf, chan, IPMI_LANP_SUBNET_MASK, data, 4);
|
||||
}
|
||||
/* mac address */
|
||||
else if (!strncmp(argv[1], "macaddr", 7) &&
|
||||
!get_cmdline_macaddr(argv[2], data)) {
|
||||
printf("Setting LAN %s to %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
ipmi_lan_params[IPMI_LANP_MAC_ADDR].desc,
|
||||
data[0], data[1], data[2], data[3], data[4], data[5]);
|
||||
set_lan_param(intf, chan, IPMI_LANP_MAC_ADDR, data, 6);
|
||||
}
|
||||
/* default gateway settings */
|
||||
else if (!strncmp(argv[1], "defgw", 5)) {
|
||||
if (argc < 4 || !strncmp(argv[2], "help", 4)) {
|
||||
printf("LAN set default gateway Commands: ipaddr, mac\n");
|
||||
}
|
||||
else if (!strncmp(argv[2], "ipaddr", 5) &&
|
||||
!get_cmdline_ipaddr(argv[3], data)) {
|
||||
printf("Setting LAN %s to %d.%d.%d.%d\n",
|
||||
ipmi_lan_params[IPMI_LANP_DEF_GATEWAY_IP].desc,
|
||||
data[0], data[1], data[2], data[3]);
|
||||
set_lan_param(intf, chan, IPMI_LANP_DEF_GATEWAY_IP, data, 4);
|
||||
}
|
||||
else if (!strncmp(argv[2], "macaddr", 7) &&
|
||||
!get_cmdline_macaddr(argv[3], data)) {
|
||||
printf("Setting LAN %s to %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
ipmi_lan_params[IPMI_LANP_DEF_GATEWAY_MAC].desc,
|
||||
data[0], data[1], data[2], data[3], data[4], data[5]);
|
||||
set_lan_param(intf, chan, IPMI_LANP_DEF_GATEWAY_MAC, data, 6);
|
||||
}
|
||||
}
|
||||
/* backup gateway settings */
|
||||
else if (!strncmp(argv[1], "bakgw", 5)) {
|
||||
if (argc < 4 || !strncmp(argv[2], "help", 4)) {
|
||||
printf("LAN set backup gateway commands: ipaddr, mac\n");
|
||||
}
|
||||
else if (!strncmp(argv[2], "ipaddr", 5) &&
|
||||
!get_cmdline_ipaddr(argv[3], data)) {
|
||||
printf("Setting LAN %s to %d.%d.%d.%d\n",
|
||||
ipmi_lan_params[IPMI_LANP_BAK_GATEWAY_IP].desc,
|
||||
data[0], data[1], data[2], data[3]);
|
||||
set_lan_param(intf, chan, IPMI_LANP_BAK_GATEWAY_IP, data, 4);
|
||||
}
|
||||
else if (!strncmp(argv[2], "macaddr", 7) &&
|
||||
!get_cmdline_macaddr(argv[3], data)) {
|
||||
printf("Setting LAN %s to %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
ipmi_lan_params[IPMI_LANP_BAK_GATEWAY_MAC].desc,
|
||||
data[0], data[1], data[2], data[3], data[4], data[5]);
|
||||
set_lan_param(intf, chan, IPMI_LANP_BAK_GATEWAY_MAC, data, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ipmi_lan_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc || !strncmp(argv[0], "help", 4))
|
||||
printf("LAN Commands: print, set\n");
|
||||
else if (!strncmp(argv[0], "printconf", 9) ||
|
||||
!strncmp(argv[0], "print", 5)) {
|
||||
unsigned char chan = 7;
|
||||
if (argc > 1)
|
||||
chan = (unsigned char) strtod(argv[1], NULL);
|
||||
ipmi_lan_print(intf, chan);
|
||||
}
|
||||
else if (!strncmp(argv[0], "set", 3))
|
||||
ipmi_lan_set(intf, argc-1, &(argv[1]));
|
||||
else
|
||||
printf("Invalid LAN command: %s\n", argv[0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,428 +0,0 @@
|
||||
/*
|
||||
* 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 <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_sdr.h>
|
||||
#include <ipmi_entity.h>
|
||||
|
||||
/* convert unsigned value to 2's complement signed */
|
||||
int utos(unsigned val, unsigned bits)
|
||||
{
|
||||
int x = pow(10, bits-1);
|
||||
if (val & x) {
|
||||
x = pow(2, bits-1);
|
||||
return -((~val & (x-1))+1);
|
||||
}
|
||||
else return val;
|
||||
}
|
||||
|
||||
static float
|
||||
sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor, unsigned char val)
|
||||
{
|
||||
int m, b, k1, k2;
|
||||
|
||||
m = __TO_M(sensor->mtol);
|
||||
b = __TO_B(sensor->bacc);
|
||||
k1 = __TO_B_EXP(sensor->bacc);
|
||||
k2 = __TO_R_EXP(sensor->bacc);
|
||||
|
||||
return (float)(((m * val) + (b * pow(10, k1))) * pow(10, k2));
|
||||
}
|
||||
|
||||
#define GET_SENSOR_READING 0x2d
|
||||
#define GET_SENSOR_FACTORS 0x23
|
||||
#define GET_SENSOR_THRES 0x27
|
||||
#define GET_SENSOR_TYPE 0x2f
|
||||
|
||||
static inline struct ipmi_rsp *
|
||||
ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, unsigned char sensor)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_SE;
|
||||
req.msg.cmd = GET_SENSOR_READING;
|
||||
req.msg.data = &sensor;
|
||||
req.msg.data_len = sizeof(sensor);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
|
||||
if (!rsp || rsp->ccode)
|
||||
return NULL;
|
||||
|
||||
return rsp;
|
||||
}
|
||||
|
||||
static const char *
|
||||
ipmi_sdr_get_status(unsigned char stat)
|
||||
{
|
||||
/* cr = critical
|
||||
* nc = non-critical
|
||||
* us = unspecified
|
||||
* nr = non-recoverable
|
||||
* ok = ok
|
||||
*/
|
||||
if (stat & (SDR_SENSOR_STAT_LO_NR | SDR_SENSOR_STAT_HI_NR))
|
||||
return "nr";
|
||||
else if (stat & (SDR_SENSOR_STAT_LO_CR | SDR_SENSOR_STAT_HI_CR))
|
||||
return "cr";
|
||||
else if (stat & (SDR_SENSOR_STAT_LO_NC | SDR_SENSOR_STAT_HI_NC))
|
||||
return "nc";
|
||||
else
|
||||
return "ok";
|
||||
}
|
||||
|
||||
static struct sdr_get_rs *
|
||||
ipmi_sdr_get_header(struct ipmi_intf * intf, unsigned short reserve_id, unsigned short record_id)
|
||||
{
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rsp * rsp;
|
||||
struct sdr_get_rq sdr_rq;
|
||||
static struct sdr_get_rs sdr_rs;
|
||||
|
||||
memset(&sdr_rq, 0, sizeof(sdr_rq));
|
||||
sdr_rq.reserve_id = reserve_id;
|
||||
sdr_rq.id = record_id;
|
||||
sdr_rq.offset = 0;
|
||||
sdr_rq.length = 5; /* only get the header */
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_SDR;
|
||||
req.msg.data = (unsigned char *)&sdr_rq;
|
||||
req.msg.data_len = sizeof(sdr_rq);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || !rsp->data_len) {
|
||||
printf("Error getting SDR record id 0x%04x\n", record_id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (verbose > 1)
|
||||
printf("SDR Record ID : 0x%04x\n", record_id);
|
||||
|
||||
memcpy(&sdr_rs, rsp->data, sizeof(sdr_rs));
|
||||
|
||||
if (sdr_rs.length == 0) {
|
||||
printf("Error in SDR record id 0x%04x: invalid length %d\n",
|
||||
record_id, sdr_rs.length);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
printf("SDR record type : %d\n", sdr_rs.type);
|
||||
printf("SDR record next : %d\n", sdr_rs.next);
|
||||
printf("SDR record bytes: %d\n", sdr_rs.length);
|
||||
}
|
||||
|
||||
return &sdr_rs;
|
||||
}
|
||||
|
||||
static struct sdr_record_full_sensor *
|
||||
ipmi_sdr_get_entry(struct ipmi_intf * intf, unsigned short reserve_id, unsigned short record_id, int len)
|
||||
{
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rsp * rsp;
|
||||
struct sdr_get_rq sdr_rq;
|
||||
struct sdr_get_rs sdr_rs;
|
||||
struct sdr_record_full_sensor * sensor;
|
||||
unsigned char data[256];
|
||||
int i;
|
||||
|
||||
memset(&sdr_rq, 0, sizeof(sdr_rq));
|
||||
sdr_rq.reserve_id = reserve_id;
|
||||
sdr_rq.id = record_id;
|
||||
sdr_rq.offset = 0;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_SDR;
|
||||
req.msg.data = (unsigned char *)&sdr_rq;
|
||||
req.msg.data_len = sizeof(sdr_rq);
|
||||
|
||||
memcpy(&sdr_rs, rsp->data, sizeof(sdr_rs));
|
||||
|
||||
/* read SDR record with partial (30 byte) reads
|
||||
* because a full read (0xff) exceeds the maximum
|
||||
* transport buffer size. (completion code 0xca)
|
||||
*/
|
||||
memset(data, 0, sizeof(data));
|
||||
for (i=0; i<len; i+=GET_SDR_MAX_LEN) {
|
||||
sdr_rq.length = (len-i < GET_SDR_MAX_LEN) ? len-i : GET_SDR_MAX_LEN;
|
||||
sdr_rq.offset = i+5; /* 5 header bytes */
|
||||
if (verbose > 1)
|
||||
printf("getting %d bytes from SDR at offset %d\n",
|
||||
sdr_rq.length, sdr_rq.offset);
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (rsp && rsp->data)
|
||||
memcpy(data+i, rsp->data+2, sdr_rq.length);
|
||||
}
|
||||
|
||||
sensor = malloc(sizeof(*sensor));
|
||||
memcpy(sensor, data, sizeof(*sensor));
|
||||
|
||||
if (verbose > 1) {
|
||||
printbuf(data, len, "SDR Entry");
|
||||
|
||||
printf("keys.owner_id: 0x%x\n", sensor->keys.owner_id);
|
||||
printf("keys.lun: 0x%x\n", sensor->keys.lun);
|
||||
printf("keys.channel: 0x%x\n", sensor->keys.channel);
|
||||
printf("keys.sensor_num: 0x%x\n", sensor->keys.sensor_num);
|
||||
|
||||
printf("entity: %d.%d\n", sensor->entity.id, sensor->entity.instance);
|
||||
|
||||
printf("entity.id: %s\n", val2str(sensor->entity.id, entity_id_vals));
|
||||
printf("entity.instance: %d\n", sensor->entity.instance);
|
||||
printf("entity.logical: %d\n", sensor->entity.logical);
|
||||
|
||||
printf("sensor unit.pct: 0x%x\n", sensor->unit.pct);
|
||||
printf("sensor unit.rate: 0x%x\n", sensor->unit.rate);
|
||||
printf("sensor unit.analog: 0x%x\n", sensor->unit.analog);
|
||||
printf("sensor unit.modifier: 0x%x\n", sensor->unit.modifier);
|
||||
printf("sensor unit.type.base: 0x%x\n", sensor->unit.type.base);
|
||||
printf("sensor unit.type.modifier: 0x%x\n", sensor->unit.type.modifier);
|
||||
|
||||
printf("sensor linearization: 0x%x\n", sensor->linearization);
|
||||
|
||||
printf("sensor tolerance: 0x%x\n", __TO_TOL(sensor->mtol));
|
||||
printf("sensor M: 0x%x\n", __TO_M(sensor->mtol));
|
||||
printf("sensor B: 0x%x\n", __TO_B(sensor->bacc));
|
||||
printf("sensor B exp: %d\n", __TO_B_EXP(sensor->bacc));
|
||||
printf("sensor R exp: %d\n", __TO_R_EXP(sensor->bacc));
|
||||
printf("sensor accuracy: 0x%x\n", __TO_ACC(sensor->bacc));
|
||||
printf("sensor accuracy exp: 0x%x\n", __TO_ACC_EXP(sensor->bacc));
|
||||
|
||||
printf("sensor.type: 0x%02x\n", sensor->sensor.type);
|
||||
printf("event_type: 0x%02x\n", sensor->event_type);
|
||||
|
||||
printf("sensor min=0x%x max=0x%x\n", sensor->sensor_min, sensor->sensor_max);
|
||||
printf("sensor id code: 0x%x\n", sensor->id_code);
|
||||
|
||||
printf("Nominal Reading : %.3f\n",
|
||||
sdr_convert_sensor_reading(sensor, sensor->nominal_read));
|
||||
printf("Normal Minimum Reading : %.3f\n",
|
||||
sdr_convert_sensor_reading(sensor, sensor->normal_min));
|
||||
printf("Normal Maximum Reading : %.3f\n",
|
||||
sdr_convert_sensor_reading(sensor, sensor->normal_max));
|
||||
printf("Upper non-recoverable Threshold : %.3f\n",
|
||||
sdr_convert_sensor_reading(sensor, sensor->threshold.upper.non_recover));
|
||||
printf("Upper critical Threshold : %.3f\n",
|
||||
sdr_convert_sensor_reading(sensor, sensor->threshold.upper.critical));
|
||||
printf("Upper non-critical Threshold : %.3f\n",
|
||||
sdr_convert_sensor_reading(sensor, sensor->threshold.upper.non_critical));
|
||||
printf("Lower non-recoverable Threshold : %.3f\n",
|
||||
sdr_convert_sensor_reading(sensor, sensor->threshold.lower.non_recover));
|
||||
printf("Lower critical Threshold : %.3f\n",
|
||||
sdr_convert_sensor_reading(sensor, sensor->threshold.lower.critical));
|
||||
printf("Lower non-critical Threshold : %.3f\n",
|
||||
sdr_convert_sensor_reading(sensor, sensor->threshold.lower.non_critical));
|
||||
|
||||
if (sensor->id_code)
|
||||
printf("sensor id: %s\n", sensor->id_string);
|
||||
}
|
||||
|
||||
return sensor;
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_sdr_print_sensors(struct ipmi_intf * intf, int do_unit)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
struct sdr_repo_info_rs sdr_info;
|
||||
struct sdr_reserve_repo_rs sdr_reserve;
|
||||
struct sdr_get_rs * header;
|
||||
struct sdr_record_full_sensor * sensor;
|
||||
|
||||
int next = 0, i = 0, total;
|
||||
unsigned short reservation;
|
||||
float val;
|
||||
char sval[16], unitstr[16];
|
||||
|
||||
if (verbose)
|
||||
printf("Querying SDR for sensor list\n");
|
||||
|
||||
/* get sdr repository info */
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_SDR_REPO_INFO;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || !rsp->data_len)
|
||||
return;
|
||||
memcpy(&sdr_info, rsp->data, sizeof(sdr_info));
|
||||
|
||||
/* byte 1 is SDR version, should be 51h */
|
||||
if (sdr_info.version != 0x51) {
|
||||
printf("SDR repository version mismatch!\n");
|
||||
return;
|
||||
}
|
||||
total = sdr_info.count;
|
||||
if (verbose > 1) {
|
||||
printf("SDR free space: %d\n", sdr_info.free);
|
||||
printf("SDR records: %d\n", total);
|
||||
}
|
||||
|
||||
/* obtain reservation ID */
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_SDR_RESERVE_REPO;
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || !rsp->data_len)
|
||||
return;
|
||||
memcpy(&sdr_reserve, rsp->data, sizeof(sdr_reserve));
|
||||
reservation = sdr_reserve.reserve_id;
|
||||
if (verbose > 1)
|
||||
printf("SDR reserveration ID %04x\n", reservation);
|
||||
|
||||
while (next < total) {
|
||||
i = 0;
|
||||
|
||||
header = ipmi_sdr_get_header(intf, reservation, next);
|
||||
if (!header)
|
||||
break;
|
||||
|
||||
if (header->type != SDR_RECORD_TYPE_FULL_SENSOR) {
|
||||
if (verbose > 1)
|
||||
printf("Invalid SDR type 0x%02x\n", header->type);
|
||||
next = header->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
sensor = ipmi_sdr_get_entry(intf, reservation, next, header->length);
|
||||
next = header->next;
|
||||
|
||||
/* only handle linear sensors (for now) */
|
||||
if (sensor->linearization) {
|
||||
printf("non-linear!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
rsp = ipmi_sdr_get_sensor_reading(intf, sensor->keys.sensor_num);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("error reading sensor\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* convert RAW reading into units */
|
||||
val = rsp->data[0] ? sdr_convert_sensor_reading(sensor, rsp->data[0]) : 0;
|
||||
|
||||
if (do_unit) {
|
||||
memset(unitstr, 0, sizeof(unitstr));
|
||||
/* determine units with possible modifiers */
|
||||
switch (sensor->unit.modifier) {
|
||||
case 2:
|
||||
i += snprintf(unitstr, sizeof(unitstr), "%s * %s",
|
||||
unit_desc[sensor->unit.type.base],
|
||||
unit_desc[sensor->unit.type.modifier]);
|
||||
break;
|
||||
case 1:
|
||||
i += snprintf(unitstr, sizeof(unitstr), "%s/%s",
|
||||
unit_desc[sensor->unit.type.base],
|
||||
unit_desc[sensor->unit.type.modifier]);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
i += snprintf(unitstr, sizeof(unitstr), "%s",
|
||||
unit_desc[sensor->unit.type.base]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!verbose) {
|
||||
/*
|
||||
* print sensor name, reading, state
|
||||
*/
|
||||
if (csv_output)
|
||||
printf("%s,",
|
||||
sensor->id_code ? sensor->id_string : NULL);
|
||||
else
|
||||
printf("%-16s | ",
|
||||
sensor->id_code ? sensor->id_string : NULL);
|
||||
|
||||
memset(sval, 0, sizeof(sval));
|
||||
i += snprintf(sval, sizeof(sval), "%.*f",
|
||||
(val==(int)val) ? 0 : 3, val);
|
||||
printf("%s", sval);
|
||||
|
||||
if (do_unit)
|
||||
printf(" %s", unitstr);
|
||||
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
else {
|
||||
for (; i<sizeof(sval); i++)
|
||||
printf(" ");
|
||||
printf(" | ");
|
||||
}
|
||||
|
||||
printf("%s", ipmi_sdr_get_status(rsp->data[2]));
|
||||
printf("\n");
|
||||
}
|
||||
else {
|
||||
printf("Sensor | %s (0x%x)\n",
|
||||
sensor->id_code ? sensor->id_string : NULL,
|
||||
sensor->keys.sensor_num);
|
||||
printf("Entity | %d.%d (%s)\n",
|
||||
sensor->entity.id, sensor->entity.instance,
|
||||
val2str(sensor->entity.id, entity_id_vals));
|
||||
printf("Reading | %.*f %s\n",
|
||||
(val==(int)val) ? 0 : 3, val, unitstr);
|
||||
printf("Status | %s\n",
|
||||
ipmi_sdr_get_status(rsp->data[2]));
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
free(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
int ipmi_sdr_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc)
|
||||
ipmi_sdr_print_sensors(intf, 1);
|
||||
else if (!strncmp(argv[0], "help", 4))
|
||||
printf("SDR Commands: list\n");
|
||||
else if (!strncmp(argv[0], "list", 4))
|
||||
ipmi_sdr_print_sensors(intf, 1);
|
||||
else
|
||||
printf("Invalid SDR command: %s\n", argv[0]);
|
||||
return 0;
|
||||
}
|
@ -1,297 +0,0 @@
|
||||
/*
|
||||
* 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 <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_sel.h>
|
||||
|
||||
static const struct valstr event_dir_vals[] = {
|
||||
{ 0, "Assertion Event" },
|
||||
{ 1, "Deassertion Event" },
|
||||
};
|
||||
|
||||
static int
|
||||
ipmi_get_event_class(unsigned char code)
|
||||
{
|
||||
if (code == 0)
|
||||
return -1;
|
||||
if (code == 1)
|
||||
return IPMI_EVENT_CLASS_THRESHOLD;
|
||||
if (code >= 0x02 && code <= 0x0b)
|
||||
return IPMI_EVENT_CLASS_DISCRETE;
|
||||
if (code == 0x6f)
|
||||
return IPMI_EVENT_CLASS_DISCRETE;
|
||||
if (code >= 0x70 && code <= 0x7f)
|
||||
return IPMI_EVENT_CLASS_OEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const char *
|
||||
ipmi_get_event_type(unsigned char code)
|
||||
{
|
||||
if (code == 0)
|
||||
return "Unspecified";
|
||||
if (code == 1)
|
||||
return "Threshold";
|
||||
if (code >= 0x02 && code <= 0x0b)
|
||||
return "Generic Discrete";
|
||||
if (code == 0x6f)
|
||||
return "Sensor-specific Discrete";
|
||||
if (code >= 0x70 && code <= 0x7f)
|
||||
return "OEM";
|
||||
return "Reserved";
|
||||
}
|
||||
|
||||
static const char *
|
||||
ipmi_get_event_desc(struct sel_event_record * rec)
|
||||
{
|
||||
int class;
|
||||
unsigned char offset = 0;
|
||||
struct ipmi_event_type *evt;
|
||||
|
||||
class = ipmi_get_event_class(rec->event_type);
|
||||
if (class < 0)
|
||||
return "Invalid Class";
|
||||
|
||||
switch (class) {
|
||||
case IPMI_EVENT_CLASS_DISCRETE:
|
||||
offset = rec->event_data[0] & 0xf;
|
||||
break;
|
||||
case IPMI_EVENT_CLASS_DIGITAL:
|
||||
offset = rec->event_data[0] & 0xf;
|
||||
break;
|
||||
case IPMI_EVENT_CLASS_THRESHOLD:
|
||||
offset = rec->event_data[0] & 0xf;
|
||||
break;
|
||||
default:
|
||||
return "Unknown Class";
|
||||
}
|
||||
|
||||
if (verbose > 2)
|
||||
printf("offset: 0x%02x\n", offset);
|
||||
|
||||
evt = event_types;
|
||||
while (evt->desc) {
|
||||
if (evt->code == rec->event_type && evt->offset == offset)
|
||||
return evt->desc;
|
||||
evt++;
|
||||
}
|
||||
|
||||
return "Unknown Event";
|
||||
}
|
||||
|
||||
static const char *
|
||||
ipmi_sel_get_sensor_type(unsigned char code)
|
||||
{
|
||||
struct ipmi_sensor_types *st = sensor_types;
|
||||
while (st->type) {
|
||||
if (st->code == code)
|
||||
return st->type;
|
||||
st++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ipmi_sel_get_info(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x40;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error%x in Get SEL Info command\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return;
|
||||
}
|
||||
if (verbose > 2)
|
||||
printbuf(rsp->data, rsp->data_len, "sel_info");
|
||||
|
||||
printf("SEL Information\n");
|
||||
printf(" Version : %x%x\n",
|
||||
(rsp->data[0] & 0xf0) >> 4, rsp->data[0] & 0xf);
|
||||
printf(" Entries : %d\n",
|
||||
buf2short(rsp->data + 1));
|
||||
printf(" Free Space : %d\n",
|
||||
buf2short(rsp->data + 3));
|
||||
printf(" Last Add Time : %08lx\n",
|
||||
buf2long(rsp->data + 5));
|
||||
printf(" Last Del Time : %08lx\n",
|
||||
buf2long(rsp->data + 9));
|
||||
printf(" Overflow : %s\n",
|
||||
rsp->data[13] & 0x80 ? "true" : "false");
|
||||
printf(" Delete cmd : %ssupported\n",
|
||||
rsp->data[13] & 0x8 ? "" : "un");
|
||||
printf(" Parial add cmd : %ssupported\n",
|
||||
rsp->data[13] & 0x4 ? "" : "un");
|
||||
printf(" Reserve cmd : %ssupported\n",
|
||||
rsp->data[13] & 0x2 ? "" : "un");
|
||||
printf(" Get Alloc Info : %ssupported\n",
|
||||
rsp->data[13] & 0x1 ? "" : "un");
|
||||
|
||||
if (rsp->data[13] & 0x1) {
|
||||
/* get sel allocation info */
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x41;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("error%d in Get SEL Allocation Info command\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
printf(" # of Alloc Units : %d\n", buf2short(rsp->data));
|
||||
printf(" Alloc Unit Size : %d\n", buf2short(rsp->data + 2));
|
||||
printf(" # Free Units : %d\n", buf2short(rsp->data + 4));
|
||||
printf(" Largest Free Blk : %d\n", buf2short(rsp->data + 6));
|
||||
printf(" Max Record Size : %d\n", rsp->data[7]);
|
||||
}
|
||||
}
|
||||
|
||||
static void * ipmi_sel_get_entry(struct ipmi_intf * intf, unsigned short record_id)
|
||||
{
|
||||
struct ipmi_req req;
|
||||
struct ipmi_rsp * rsp;
|
||||
unsigned char msg_data[6];
|
||||
unsigned char type;
|
||||
|
||||
memset(msg_data, 0, 6);
|
||||
msg_data[0] = 0x00; /* no reserve id, not partial get */
|
||||
msg_data[1] = 0x00;
|
||||
memcpy(msg_data+2, &record_id, 2);
|
||||
msg_data[4] = 0x00; /* offset */
|
||||
msg_data[5] = 0xff; /* length */
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x43;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 6;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error%x in Get SEL Entry %x Command\n",
|
||||
rsp ? rsp->ccode : 0, record_id);
|
||||
return NULL;
|
||||
}
|
||||
if (verbose > 2)
|
||||
printbuf(rsp->data, rsp->data_len, "SEL Entry");
|
||||
|
||||
type = rsp->data[2];
|
||||
if (type < 0xc0) {
|
||||
/* standard SEL event record */
|
||||
return (struct sel_event_record *) rsp->data;
|
||||
}
|
||||
else if (type < 0xe0) {
|
||||
/* OEM timestamp record */
|
||||
return (struct sel_oem_record_ts *) rsp->data;
|
||||
}
|
||||
else {
|
||||
/* OEM no-timestamp record */
|
||||
return (struct sel_oem_record_nots *) rsp->data;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ipmi_sel_list_entries(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
unsigned short reserve_id, next_id;
|
||||
struct sel_event_record * evt;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x42; /* reserve SEL */
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x unable to reserve SEL\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
reserve_id = rsp->data[0] | rsp->data[1] << 8;
|
||||
if (verbose)
|
||||
printf("SEL Reservation ID: %04x\n", reserve_id);
|
||||
|
||||
next_id = 0;
|
||||
while (next_id != 0xffff) {
|
||||
evt = (struct sel_event_record *) ipmi_sel_get_entry(intf, next_id);
|
||||
if (!evt)
|
||||
return;
|
||||
|
||||
printf("SEL Record ID : %04x\n", evt->record_id);
|
||||
printf(" Record Type : %02x\n", evt->record_type);
|
||||
printf(" Timestamp : %08lx\n", evt->timestamp);
|
||||
printf(" Generator ID : %04x\n", evt->gen_id);
|
||||
printf(" EvM Revision : %02x\n", evt->evm_rev);
|
||||
printf(" Sensor Type : %s\n", ipmi_sel_get_sensor_type(evt->sensor_type));
|
||||
printf(" Sensor Num : %02x\n", evt->sensor_num);
|
||||
printf(" Event Type : %s\n", ipmi_get_event_type(evt->event_type));
|
||||
printf(" Event Direction : %s\n", val2str(evt->event_dir, event_dir_vals));
|
||||
printf(" Event Data : %02x%02x%02x\n",
|
||||
evt->event_data[0], evt->event_data[1], evt->event_data[2]);
|
||||
printf(" Description : %s\n", ipmi_get_event_desc(evt));
|
||||
printf("\n");
|
||||
|
||||
next_id = evt->next_id;
|
||||
}
|
||||
}
|
||||
|
||||
int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc)
|
||||
ipmi_sel_get_info(intf);
|
||||
else if (!strncmp(argv[0], "help", 4))
|
||||
printf("SEL Commands: info\n");
|
||||
else if (!strncmp(argv[0], "info", 4))
|
||||
ipmi_sel_get_info(intf);
|
||||
else if (!strncmp(argv[0], "list", 4))
|
||||
ipmi_sel_list_entries(intf);
|
||||
else
|
||||
printf("Invalid SEL command: %s\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,290 +0,0 @@
|
||||
.TH "ipmitool" "1" "@@VERSION@@" "Duncan Laurie" ""
|
||||
.SH "NAME"
|
||||
.LP
|
||||
ipmitool \- utility for IPMI control
|
||||
.SH "SYNTAX"
|
||||
.LP
|
||||
ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIlan\fP \fB\-H\fR \fIaddress\fP [\fB\-P\fR \fIpassword\fP] <\fIexpression\fP>
|
||||
.br
|
||||
ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIdev\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\-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 \fIdev\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 dev help
|
||||
.br
|
||||
Commands: chassis, fru, lan, sdr, sel
|
||||
.LP
|
||||
.PP
|
||||
ipmitool -I dev chassis help
|
||||
.br
|
||||
Chassis Commands: status, power, identify, policy, restart_cause
|
||||
.LP
|
||||
.PP
|
||||
ipmitool -I dev 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 dev 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 dev 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
|
||||
.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
|
||||
\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 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 list
|
||||
This command will list the contents of the SEL.
|
||||
.RE
|
||||
.SH "DEV INTERFACE"
|
||||
.LP
|
||||
The ipmitool \fIdev\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/ipmi/0\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/ipmi/0 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 dev [option...]
|
||||
.LP
|
||||
Alternatively if you do not provide a hostname on the command line ipmitool will assume you want to use the dev 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. 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...] <address> [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 straight password/key.
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I /dev/ipmi/0
|
||||
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
|
||||
.LP
|
||||
Chassis Power is off.
|
||||
.br
|
||||
Chassis Power Control: on
|
||||
.LP
|
||||
ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power status
|
||||
.LP
|
||||
Chassis Power is on.
|
||||
.SH "AUTHOR"
|
||||
.LP
|
||||
Duncan Laurie <duncan@sun.com>
|
||||
.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/
|
@ -32,7 +32,11 @@ fi
|
||||
%setup
|
||||
|
||||
%build
|
||||
./configure @ac_configure_args@ \
|
||||
./configure \
|
||||
--enable-ipmievd \
|
||||
--enable-intf-lan=static \
|
||||
--enable-intf-open=static \
|
||||
--with-kerneldir=/usr/src/linux-2.4 \
|
||||
--prefix=%{_prefix} \
|
||||
--bindir=%{_bindir} \
|
||||
--datadir=%{_datadir} \
|
||||
@ -43,7 +47,7 @@ fi
|
||||
make
|
||||
|
||||
%install
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
make DESTDIR=$RPM_BUILD_ROOT install-strip
|
||||
|
||||
%clean
|
||||
if [ "$RPM_BUILD_ROOT" ] && [ "$RPM_BUILD_ROOT" != "/" ]; then
|
||||
@ -55,8 +59,6 @@ rm -rf $RPM_BUILD_DIR/@IPMITOOL_PKG@-@VERSION@
|
||||
%defattr(-,root,root)
|
||||
%doc %{_mandir}/man1/*
|
||||
%{_bindir}/*
|
||||
%dir %{_libdir}/ipmitool
|
||||
%attr(755,root,root) %{_libdir}/ipmitool/*
|
||||
|
||||
%files dev
|
||||
%defattr(-,root,root)
|
||||
@ -64,6 +66,33 @@ rm -rf $RPM_BUILD_DIR/@IPMITOOL_PKG@-@VERSION@
|
||||
%{_includedir}/ipmitool/*.h
|
||||
|
||||
%changelog
|
||||
* Tue Jan 27 2004 <duncan@sun.com> 1.5.8-1
|
||||
- Enable static compilation of interfaces
|
||||
- Fix types to be 64-bit safe
|
||||
- Fix compilation problems on Solaris
|
||||
- Fix multiple big-endian problems for Solaris/SPARC
|
||||
- Fix channel access to save settings to NVRAM
|
||||
- Set channel privilege limit to ADMIN during "access on"
|
||||
- Enable gratuitous ARP in bmcautoconf.sh
|
||||
- Add support for Linux kernel panic messages in SEL output
|
||||
- Add support for type 3 SDR records
|
||||
|
||||
* Mon Jan 5 2004 <duncan@sun.com> 1.5.7-1
|
||||
- add IPMIv1.5 eratta fixes
|
||||
- additions to FRU printing and FRU multirecords
|
||||
- better handling of SDR printing
|
||||
- contrib scripts for creating rrdtool graphs
|
||||
|
||||
* Thu Dec 4 2003 <duncan@sun.com> 1.5.6-1
|
||||
- Fix SEL event decoding for generic events
|
||||
- Handle empty SEL gracefully when doing "sel list"
|
||||
- Fix sdr handling of sensors that do not return a reading
|
||||
- Fix for CSV display of sensor readings/units from Fredrik <EFBFBD>hrn
|
||||
|
||||
* Tue Nov 25 2003 <duncan@sun.com> 1.5.5-1
|
||||
- Add -U option for setting LAN username
|
||||
- Fix -v usage for plugin interfaces
|
||||
|
||||
* Fri Nov 14 2003 <duncan@sun.com> 1.5.4-1
|
||||
- pull interface plugin api into library
|
||||
- fix ipmievd
|
||||
|
@ -37,7 +37,8 @@ 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
|
||||
ipmi_fru.c ipmi_chassis.c ipmi_bmc.c dimm_spd.c ipmi_sensor.c
|
||||
libipmitool_la_LDFLAGS = -export-dynamic
|
||||
libipmitool_la_LIBADD = -lm $(LIBLTDL)
|
||||
libipmitool_la_DEPENDENCIES = $(LIBLTDL)
|
||||
libipmitool_la_LIBADD = -lm
|
||||
libipmitool_la_DEPENDENCIES =
|
||||
|
||||
|
767
ipmitool/lib/dimm_spd.c
Normal file
767
ipmitool/lib/dimm_spd.c
Normal file
@ -0,0 +1,767 @@
|
||||
/*
|
||||
* 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 <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_fru.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
extern int verbose;
|
||||
|
||||
const struct valstr spd_memtype_vals[] = {
|
||||
{ 0x02, "EDO" },
|
||||
{ 0x04, "SDRAM" },
|
||||
{ 0x07, "DDR" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
const struct valstr spd_config_vals[] = {
|
||||
{ 0x00, "None" },
|
||||
{ 0x01, "Parity" },
|
||||
{ 0x02, "ECC" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
const struct valstr spd_voltage_vals[] = {
|
||||
{ 0x00, "5.0V TTL" },
|
||||
{ 0x01, "LVTTL" },
|
||||
{ 0x02, "HSTL 1.5V" },
|
||||
{ 0x03, "SSTL 3.3V" },
|
||||
{ 0x04, "SSTL 2.5V" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
/*
|
||||
* JEDEC Standard Manufacturers Identification Code
|
||||
* publication JEP106N, December 2003
|
||||
*/
|
||||
|
||||
const struct valstr jedec_id1_vals[] = {
|
||||
{ 0x01, "AMD" },
|
||||
{ 0x02, "AMI" },
|
||||
{ 0x83, "Fairchild" },
|
||||
{ 0x04, "Fujitsu" },
|
||||
{ 0x85, "GTE" },
|
||||
{ 0x86, "Harris" },
|
||||
{ 0x07, "Hitachi" },
|
||||
{ 0x08, "Inmos" },
|
||||
{ 0x89, "Intel" },
|
||||
{ 0x8a, "I.T.T." },
|
||||
{ 0x0b, "Intersil" },
|
||||
{ 0x8c, "Monolithic Memories" },
|
||||
{ 0x0d, "Mostek" },
|
||||
{ 0x0e, "Motorola" },
|
||||
{ 0x8f, "National" },
|
||||
{ 0x10, "NEC" },
|
||||
{ 0x91, "RCA" },
|
||||
{ 0x92, "Raytheon" },
|
||||
{ 0x13, "Conexant (Rockwell)" },
|
||||
{ 0x94, "Seeq" },
|
||||
{ 0x15, "Philips Semi. (Signetics)" },
|
||||
{ 0x16, "Synertek" },
|
||||
{ 0x97, "Texas Instruments" },
|
||||
{ 0x98, "Toshiba" },
|
||||
{ 0x19, "Xicor" },
|
||||
{ 0x1a, "Zilog" },
|
||||
{ 0x9b, "Eurotechnique" },
|
||||
{ 0x1c, "Mitsubishi" },
|
||||
{ 0x9d, "Lucent (AT&T)" },
|
||||
{ 0x9e, "Exel" },
|
||||
{ 0x1f, "Atmel" },
|
||||
{ 0x20, "SGS/Thomson" },
|
||||
{ 0xa1, "Lattice Semi." },
|
||||
{ 0xa2, "NCR" },
|
||||
{ 0x23, "Wafer Scale Integration" },
|
||||
{ 0xa4, "IBM" },
|
||||
{ 0x25, "Tristar" },
|
||||
{ 0x26, "Visic" },
|
||||
{ 0xa7, "Intl. CMOS Technology" },
|
||||
{ 0xa8, "SSSI" },
|
||||
{ 0x29, "Microchip Technology" },
|
||||
{ 0x2a, "Ricoh Ltd." },
|
||||
{ 0xab, "VLSI" },
|
||||
{ 0x2c, "Micron Technology" },
|
||||
{ 0xad, "Hyundai Electronics" },
|
||||
{ 0xae, "OKI Semiconductor" },
|
||||
{ 0x2f, "ACTEL" },
|
||||
{ 0xb0, "Sharp" },
|
||||
{ 0x31, "Catalyst" },
|
||||
{ 0x32, "Panasonic" },
|
||||
{ 0xb3, "IDT" },
|
||||
{ 0x34, "Cypress" },
|
||||
{ 0xb5, "DEC" },
|
||||
{ 0xb6, "LSI Logic" },
|
||||
{ 0x37, "Zarlink" },
|
||||
{ 0x38, "UTMC" },
|
||||
{ 0xb9, "Thinking Machine" },
|
||||
{ 0xba, "Thomson CSF" },
|
||||
{ 0x3b, "Integrated CMOS(Vertex)" },
|
||||
{ 0xbc, "Honeywell" },
|
||||
{ 0x3d, "Tektronix" },
|
||||
{ 0x3e, "Sun Microsystems" },
|
||||
{ 0xbf, "SST" },
|
||||
{ 0x40, "MOSEL" },
|
||||
{ 0xc1, "Infineon" },
|
||||
{ 0xc2, "Macronix" },
|
||||
{ 0x43, "Xerox" },
|
||||
{ 0xc4, "Plus Logic" },
|
||||
{ 0x45, "SunDisk" },
|
||||
{ 0x46, "Elan Circuit Tech." },
|
||||
{ 0xc7, "European Silicon Str." },
|
||||
{ 0xc8, "Apple Computer" },
|
||||
{ 0xc9, "Xilinx" },
|
||||
{ 0x4a, "Compaq" },
|
||||
{ 0xcb, "Protocol Engines" },
|
||||
{ 0x4c, "SCI" },
|
||||
{ 0xcd, "Seiko Instruments" },
|
||||
{ 0xce, "Samsung" },
|
||||
{ 0x4f, "I3 Design System" },
|
||||
{ 0xd0, "Klic" },
|
||||
{ 0x51, "Crosspoint Solutions" },
|
||||
{ 0x52, "Alliance Semiconductor" },
|
||||
{ 0xd3, "Tandem" },
|
||||
{ 0x54, "Hewlett-Packard" },
|
||||
{ 0xd5, "Intg. Silicon Solutions" },
|
||||
{ 0xd6, "Brooktree" },
|
||||
{ 0x57, "New Media" },
|
||||
{ 0x58, "MHS Electronic" },
|
||||
{ 0xd9, "Performance Semi." },
|
||||
{ 0xda, "Winbond Electronic" },
|
||||
{ 0x5b, "Kawasaki Steel" },
|
||||
{ 0xdc, "Bright Micro" },
|
||||
{ 0x5d, "TECMAR" },
|
||||
{ 0x5e, "Exar" },
|
||||
{ 0xdf, "PCMCIA" },
|
||||
{ 0xe0, "LG Semiconductor" },
|
||||
{ 0x61, "Northern Telecom" },
|
||||
{ 0x62, "Sanyo" },
|
||||
{ 0xe3, "Array Microsystems" },
|
||||
{ 0x64, "Crystal Semiconductor" },
|
||||
{ 0xe5, "Analog Devices" },
|
||||
{ 0xe6, "PMC-Sierra" },
|
||||
{ 0x67, "Asparix" },
|
||||
{ 0x68, "Convex Computer" },
|
||||
{ 0xe9, "Quality Semiconductor" },
|
||||
{ 0xea, "Nimbus Technology" },
|
||||
{ 0x6b, "Transwitch" },
|
||||
{ 0xec, "Micronas (ITT Intermetall)" },
|
||||
{ 0x6d, "Cannon" },
|
||||
{ 0x6e, "Altera" },
|
||||
{ 0xef, "NEXCOM" },
|
||||
{ 0x70, "QUALCOMM" },
|
||||
{ 0xf1, "Sony" },
|
||||
{ 0xf2, "Cray Research" },
|
||||
{ 0x73, "AMS (Austria Micro)" },
|
||||
{ 0xf4, "Vitesse" },
|
||||
{ 0x75, "Aster Electronics" },
|
||||
{ 0x76, "Bay Networks (Synoptic)" },
|
||||
{ 0xf7, "Zentrum" },
|
||||
{ 0xf8, "TRW" },
|
||||
{ 0x79, "Thesys" },
|
||||
{ 0x7a, "Solbourne Computer" },
|
||||
{ 0xfb, "Allied-Signal" },
|
||||
{ 0x7c, "Dialog" },
|
||||
{ 0xfd, "Media Vision" },
|
||||
{ 0xfe, "Level One Communication" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
const struct valstr jedec_id2_vals[] = {
|
||||
{ 0x01, "Cirrus Logic" },
|
||||
{ 0x02, "National Instruments" },
|
||||
{ 0x83, "ILC Data Device" },
|
||||
{ 0x04, "Alcatel Mietec" },
|
||||
{ 0x85, "Micro Linear" },
|
||||
{ 0x86, "Univ. of NC" },
|
||||
{ 0x07, "JTAG Technologies" },
|
||||
{ 0x08, "Loral" },
|
||||
{ 0x89, "Nchip" },
|
||||
{ 0x8A, "Galileo Tech" },
|
||||
{ 0x0B, "Bestlink Systems" },
|
||||
{ 0x8C, "Graychip" },
|
||||
{ 0x0D, "GENNUM" },
|
||||
{ 0x0E, "VideoLogic" },
|
||||
{ 0x8F, "Robert Bosch" },
|
||||
{ 0x10, "Chip Express" },
|
||||
{ 0x91, "DATARAM" },
|
||||
{ 0x92, "United Microelec Corp." },
|
||||
{ 0x13, "TCSI" },
|
||||
{ 0x94, "Smart Modular" },
|
||||
{ 0x15, "Hughes Aircraft" },
|
||||
{ 0x16, "Lanstar Semiconductor" },
|
||||
{ 0x97, "Qlogic" },
|
||||
{ 0x98, "Kingston" },
|
||||
{ 0x19, "Music Semi" },
|
||||
{ 0x1A, "Ericsson Components" },
|
||||
{ 0x9B, "SpaSE" },
|
||||
{ 0x1C, "Eon Silicon Devices" },
|
||||
{ 0x9D, "Programmable Micro Corp" },
|
||||
{ 0x9E, "DoD" },
|
||||
{ 0x1F, "Integ. Memories Tech." },
|
||||
{ 0x20, "Corollary Inc." },
|
||||
{ 0xA1, "Dallas Semiconductor" },
|
||||
{ 0xA2, "Omnivision" },
|
||||
{ 0x23, "EIV(Switzerland)" },
|
||||
{ 0xA4, "Novatel Wireless" },
|
||||
{ 0x25, "Zarlink (formerly Mitel)" },
|
||||
{ 0x26, "Clearpoint" },
|
||||
{ 0xA7, "Cabletron" },
|
||||
{ 0xA8, "Silicon Technology" },
|
||||
{ 0x29, "Vanguard" },
|
||||
{ 0x2A, "Hagiwara Sys-Com" },
|
||||
{ 0xAB, "Vantis" },
|
||||
{ 0x2C, "Celestica" },
|
||||
{ 0xAD, "Century" },
|
||||
{ 0xAE, "Hal Computers" },
|
||||
{ 0x2F, "Rohm Company Ltd." },
|
||||
{ 0xB0, "Juniper Networks" },
|
||||
{ 0x31, "Libit Signal Processing" },
|
||||
{ 0x32, "Enhanced Memories Inc." },
|
||||
{ 0xB3, "Tundra Semiconductor" },
|
||||
{ 0x34, "Adaptec Inc." },
|
||||
{ 0xB5, "LightSpeed Semi." },
|
||||
{ 0xB6, "ZSP Corp." },
|
||||
{ 0x37, "AMIC Technology" },
|
||||
{ 0x38, "Adobe Systems" },
|
||||
{ 0xB9, "Dynachip" },
|
||||
{ 0xBA, "PNY Electronics" },
|
||||
{ 0x3B, "Newport Digital" },
|
||||
{ 0xBC, "MMC Networks" },
|
||||
{ 0x3D, "T Square" },
|
||||
{ 0x3E, "Seiko Epson" },
|
||||
{ 0xBF, "Broadcom" },
|
||||
{ 0x40, "Viking Components" },
|
||||
{ 0xC1, "V3 Semiconductor" },
|
||||
{ 0xC2, "Flextronics (formerly Orbit)" },
|
||||
{ 0x43, "Suwa Electronics" },
|
||||
{ 0xC4, "Transmeta" },
|
||||
{ 0x45, "Micron CMS" },
|
||||
{ 0x46, "American Computer & Digital Components Inc" },
|
||||
{ 0xC7, "Enhance 3000 Inc" },
|
||||
{ 0xC8, "Tower Semiconductor" },
|
||||
{ 0x49, "CPU Design" },
|
||||
{ 0x4A, "Price Point" },
|
||||
{ 0xCB, "Maxim Integrated Product" },
|
||||
{ 0x4C, "Tellabs" },
|
||||
{ 0xCD, "Centaur Technology" },
|
||||
{ 0xCE, "Unigen Corporation" },
|
||||
{ 0x4F, "Transcend Information" },
|
||||
{ 0xD0, "Memory Card Technology" },
|
||||
{ 0x51, "CKD Corporation Ltd." },
|
||||
{ 0x52, "Capital Instruments, Inc." },
|
||||
{ 0xD3, "Aica Kogyo, Ltd." },
|
||||
{ 0x54, "Linvex Technology" },
|
||||
{ 0xD5, "MSC Vertriebs GmbH" },
|
||||
{ 0xD6, "AKM Company, Ltd." },
|
||||
{ 0x57, "Dynamem, Inc." },
|
||||
{ 0x58, "NERA ASA" },
|
||||
{ 0xD9, "GSI Technology" },
|
||||
{ 0xDA, "Dane-Elec (C Memory)" },
|
||||
{ 0x5B, "Acorn Computers" },
|
||||
{ 0xDC, "Lara Technology" },
|
||||
{ 0x5D, "Oak Technology, Inc." },
|
||||
{ 0x5E, "Itec Memory" },
|
||||
{ 0xDF, "Tanisys Technology" },
|
||||
{ 0xE0, "Truevision" },
|
||||
{ 0x61, "Wintec Industries" },
|
||||
{ 0x62, "Super PC Memory" },
|
||||
{ 0xE3, "MGV Memory" },
|
||||
{ 0x64, "Galvantech" },
|
||||
{ 0xE5, "Gadzoox Nteworks" },
|
||||
{ 0xE6, "Multi Dimensional Cons." },
|
||||
{ 0x67, "GateField" },
|
||||
{ 0x68, "Integrated Memory System" },
|
||||
{ 0xE9, "Triscend" },
|
||||
{ 0xEA, "XaQti" },
|
||||
{ 0x6B, "Goldenram" },
|
||||
{ 0xEC, "Clear Logic" },
|
||||
{ 0x6D, "Cimaron Communications" },
|
||||
{ 0x6E, "Nippon Steel Semi. Corp." },
|
||||
{ 0xEF, "Advantage Memory" },
|
||||
{ 0x70, "AMCC" },
|
||||
{ 0xF1, "LeCroy" },
|
||||
{ 0xF2, "Yamaha Corporation" },
|
||||
{ 0x73, "Digital Microwave" },
|
||||
{ 0xF4, "NetLogic Microsystems" },
|
||||
{ 0x75, "MIMOS Semiconductor" },
|
||||
{ 0x76, "Advanced Fibre" },
|
||||
{ 0xF7, "BF Goodrich Data." },
|
||||
{ 0xF8, "Epigram" },
|
||||
{ 0x79, "Acbel Polytech Inc." },
|
||||
{ 0x7A, "Apacer Technology" },
|
||||
{ 0xFB, "Admor Memory" },
|
||||
{ 0x7C, "FOXCONN" },
|
||||
{ 0xFD, "Quadratics Superconductor" },
|
||||
{ 0xFE, "3COM" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
const struct valstr jedec_id3_vals[] = {
|
||||
{ 0x01, "Camintonn Corporation" },
|
||||
{ 0x02, "ISOA Incorporated" },
|
||||
{ 0x83, "Agate Semiconductor" },
|
||||
{ 0x04, "ADMtek Incorporated" },
|
||||
{ 0x85, "HYPERTEC" },
|
||||
{ 0x86, "Adhoc Technologies" },
|
||||
{ 0x07, "MOSAID Technologies" },
|
||||
{ 0x08, "Ardent Technologies" },
|
||||
{ 0x89, "Switchcore" },
|
||||
{ 0x8A, "Cisco Systems, Inc." },
|
||||
{ 0x0B, "Allayer Technologies" },
|
||||
{ 0x8C, "WorkX AG" },
|
||||
{ 0x0D, "Oasis Semiconductor" },
|
||||
{ 0x0E, "Novanet Semiconductor" },
|
||||
{ 0x8F, "E-M Solutions" },
|
||||
{ 0x10, "Power General" },
|
||||
{ 0x91, "Advanced Hardware Arch." },
|
||||
{ 0x92, "Inova Semiconductors GmbH" },
|
||||
{ 0x13, "Telocity" },
|
||||
{ 0x94, "Delkin Devices" },
|
||||
{ 0x15, "Symagery Microsystems" },
|
||||
{ 0x16, "C-Port Corporation" },
|
||||
{ 0x97, "SiberCore Technologies" },
|
||||
{ 0x98, "Southland Microsystems" },
|
||||
{ 0x19, "Malleable Technologies" },
|
||||
{ 0x1A, "Kendin Communications" },
|
||||
{ 0x9B, "Great Technology Microcomputer" },
|
||||
{ 0x1C, "Sanmina Corporation" },
|
||||
{ 0x9D, "HADCO Corporation" },
|
||||
{ 0x9E, "Corsair" },
|
||||
{ 0x1F, "Actrans System Inc." },
|
||||
{ 0x20, "ALPHA Technologies" },
|
||||
{ 0xA1, "Cygnal Integrated Products Incorporated" },
|
||||
{ 0xA2, "Artesyn Technologies" },
|
||||
{ 0x23, "Align Manufacturing" },
|
||||
{ 0xA4, "Peregrine Semiconductor" },
|
||||
{ 0x25, "Chameleon Systems" },
|
||||
{ 0x26, "Aplus Flash Technology" },
|
||||
{ 0xA7, "MIPS Technologies" },
|
||||
{ 0xA8, "Chrysalis ITS" },
|
||||
{ 0x29, "ADTEC Corporation" },
|
||||
{ 0x2A, "Kentron Technologies" },
|
||||
{ 0xAB, "Win Technologies" },
|
||||
{ 0x2C, "ASIC Designs Inc" },
|
||||
{ 0xAD, "Extreme Packet Devices" },
|
||||
{ 0xAE, "RF Micro Devices" },
|
||||
{ 0x2F, "Siemens AG" },
|
||||
{ 0xB0, "Sarnoff Corporation" },
|
||||
{ 0x31, "Itautec Philco SA" },
|
||||
{ 0x32, "Radiata Inc." },
|
||||
{ 0xB3, "Benchmark Elect. (AVEX)" },
|
||||
{ 0x34, "Legend" },
|
||||
{ 0xB5, "SpecTek Incorporated" },
|
||||
{ 0xB6, "Hi/fn" },
|
||||
{ 0x37, "Enikia Incorporated" },
|
||||
{ 0x38, "SwitchOn Networks" },
|
||||
{ 0xB9, "AANetcom Incorporated" },
|
||||
{ 0xBA, "Micro Memory Bank" },
|
||||
{ 0x3B, "ESS Technology" },
|
||||
{ 0xBC, "Virata Corporation" },
|
||||
{ 0x3D, "Excess Bandwidth" },
|
||||
{ 0x3E, "West Bay Semiconductor" },
|
||||
{ 0xBF, "DSP Group" },
|
||||
{ 0x40, "Newport Communications" },
|
||||
{ 0xC1, "Chip2Chip Incorporated" },
|
||||
{ 0xC2, "Phobos Corporation" },
|
||||
{ 0x43, "Intellitech Corporation" },
|
||||
{ 0xC4, "Nordic VLSI ASA" },
|
||||
{ 0x45, "Ishoni Networks" },
|
||||
{ 0x46, "Silicon Spice" },
|
||||
{ 0xC7, "Alchemy Semiconductor" },
|
||||
{ 0xC8, "Agilent Technologies" },
|
||||
{ 0x49, "Centillium Communications" },
|
||||
{ 0x4A, "W.L. Gore" },
|
||||
{ 0xCB, "HanBit Electronics" },
|
||||
{ 0x4C, "GlobeSpan" },
|
||||
{ 0xCD, "Element 14" },
|
||||
{ 0xCE, "Pycon" },
|
||||
{ 0x4F, "Saifun Semiconductors" },
|
||||
{ 0xD0, "Sibyte, Incorporated" },
|
||||
{ 0x51, "MetaLink Technologies" },
|
||||
{ 0x52, "Feiya Technology" },
|
||||
{ 0xD3, "I & C Technology" },
|
||||
{ 0x54, "Shikatronics" },
|
||||
{ 0xD5, "Elektrobit" },
|
||||
{ 0xD6, "Megic" },
|
||||
{ 0x57, "Com-Tier" },
|
||||
{ 0x58, "Malaysia Micro Solutions" },
|
||||
{ 0xD9, "Hyperchip" },
|
||||
{ 0xDA, "Gemstone Communications" },
|
||||
{ 0x5B, "Anadyne Microelectronics" },
|
||||
{ 0xDC, "3ParData" },
|
||||
{ 0x5D, "Mellanox Technologies" },
|
||||
{ 0x5E, "Tenx Technologies" },
|
||||
{ 0xDF, "Helix AG" },
|
||||
{ 0xE0, "Domosys" },
|
||||
{ 0x61, "Skyup Technology" },
|
||||
{ 0x62, "HiNT Corporation" },
|
||||
{ 0xE3, "Chiaro" },
|
||||
{ 0x64, "MCI Computer GMBH" },
|
||||
{ 0xE5, "Exbit Technology A/S" },
|
||||
{ 0xE6, "Integrated Technology Express" },
|
||||
{ 0x67, "AVED Memory" },
|
||||
{ 0x68, "Legerity" },
|
||||
{ 0xE9, "Jasmine Networks" },
|
||||
{ 0xEA, "Caspian Networks" },
|
||||
{ 0x6B, "nCUBE" },
|
||||
{ 0xEC, "Silicon Access Networks" },
|
||||
{ 0x6D, "FDK Corporation" },
|
||||
{ 0x6E, "High Bandwidth Access" },
|
||||
{ 0xEF, "MultiLink Technology" },
|
||||
{ 0x70, "BRECIS" },
|
||||
{ 0xF1, "World Wide Packets" },
|
||||
{ 0xF2, "APW" },
|
||||
{ 0x73, "Chicory Systems" },
|
||||
{ 0xF4, "Xstream Logic" },
|
||||
{ 0x75, "Fast-Chip" },
|
||||
{ 0x76, "Zucotto Wireless" },
|
||||
{ 0xF7, "Realchip" },
|
||||
{ 0xF8, "Galaxy Power" },
|
||||
{ 0x79, "eSilicon" },
|
||||
{ 0x7A, "Morphics Technology" },
|
||||
{ 0xFB, "Accelerant Networks" },
|
||||
{ 0x7C, "Silicon Wave" },
|
||||
{ 0xFD, "SandCraft" },
|
||||
{ 0xFE, "Elpida" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
const struct valstr jedec_id4_vals[] = {
|
||||
{ 0x01, "Solectron" },
|
||||
{ 0x02, "Optosys Technologies" },
|
||||
{ 0x83, "Buffalo (Formerly Melco)" },
|
||||
{ 0x04, "TriMedia Technologies" },
|
||||
{ 0x85, "Cyan Technologies" },
|
||||
{ 0x86, "Global Locate" },
|
||||
{ 0x07, "Optillion" },
|
||||
{ 0x08, "Terago Communications" },
|
||||
{ 0x89, "Ikanos Communications" },
|
||||
{ 0x8A, "Princeton Technology" },
|
||||
{ 0x0B, "Nanya Technology" },
|
||||
{ 0x8C, "Elite Flash Storage" },
|
||||
{ 0x0D, "Mysticom" },
|
||||
{ 0x0E, "LightSand Communications" },
|
||||
{ 0x8F, "ATI Technologies" },
|
||||
{ 0x10, "Agere Systems" },
|
||||
{ 0x91, "NeoMagic" },
|
||||
{ 0x92, "AuroraNetics" },
|
||||
{ 0x13, "Golden Empire" },
|
||||
{ 0x94, "Muskin" },
|
||||
{ 0x15, "Tioga Technologies" },
|
||||
{ 0x16, "Netlist" },
|
||||
{ 0x97, "TeraLogic" },
|
||||
{ 0x98, "Cicada Semiconductor" },
|
||||
{ 0x19, "Centon Electronics" },
|
||||
{ 0x1A, "Tyco Electronics" },
|
||||
{ 0x9B, "Magis Works" },
|
||||
{ 0x1C, "Zettacom" },
|
||||
{ 0x9D, "Cogency Semiconductor" },
|
||||
{ 0x9E, "Chipcon AS" },
|
||||
{ 0x1F, "Aspex Technology" },
|
||||
{ 0x20, "F5 Networks" },
|
||||
{ 0xA1, "Programmable Silicon Solutions" },
|
||||
{ 0xA2, "ChipWrights" },
|
||||
{ 0x23, "Acorn Networks" },
|
||||
{ 0xA4, "Quicklogic" },
|
||||
{ 0x25, "Kingmax Semiconductor" },
|
||||
{ 0x26, "BOPS" },
|
||||
{ 0xA7, "Flasys" },
|
||||
{ 0xA8, "BitBlitz Communications" },
|
||||
{ 0x29, "eMemory Technology" },
|
||||
{ 0x2A, "Procket Networks" },
|
||||
{ 0xAB, "Purple Ray" },
|
||||
{ 0x2C, "Trebia Networks" },
|
||||
{ 0xAD, "Delta Electronics" },
|
||||
{ 0xAE, "Onex Communications" },
|
||||
{ 0x2F, "Ample Communications" },
|
||||
{ 0xB0, "Memory Experts Intl" },
|
||||
{ 0x31, "Astute Networks" },
|
||||
{ 0x32, "Azanda Network Devices" },
|
||||
{ 0xB3, "Dibcom" },
|
||||
{ 0x34, "Tekmos" },
|
||||
{ 0xB5, "API NetWorks" },
|
||||
{ 0xB6, "Bay Microsystems" },
|
||||
{ 0x37, "Firecron Ltd" },
|
||||
{ 0x38, "Resonext Communications" },
|
||||
{ 0xB9, "Tachys Technologies" },
|
||||
{ 0xBA, "Equator Technology" },
|
||||
{ 0x3B, "Concept Computer" },
|
||||
{ 0xBC, "SILCOM" },
|
||||
{ 0x3D, "3Dlabs" },
|
||||
{ 0x3E, "ct Magazine" },
|
||||
{ 0xBF, "Sanera Systems" },
|
||||
{ 0x40, "Silicon Packets" },
|
||||
{ 0xC1, "Viasystems Group" },
|
||||
{ 0xC2, "Simtek" },
|
||||
{ 0x43, "Semicon Devices Singapore" },
|
||||
{ 0xC4, "Satron Handelsges" },
|
||||
{ 0x45, "Improv Systems" },
|
||||
{ 0x46, "INDUSYS GmbH" },
|
||||
{ 0xC7, "Corrent" },
|
||||
{ 0xC8, "Infrant Technologies" },
|
||||
{ 0x49, "Ritek Corp" },
|
||||
{ 0x4A, "empowerTel Networks" },
|
||||
{ 0xCB, "Hypertec" },
|
||||
{ 0x4C, "Cavium Networks" },
|
||||
{ 0xCD, "PLX Technology" },
|
||||
{ 0xCE, "Massana Design" },
|
||||
{ 0x4F, "Intrinsity" },
|
||||
{ 0xD0, "Valence Semiconductor" },
|
||||
{ 0x51, "Terawave Communications" },
|
||||
{ 0x52, "IceFyre Semiconductor" },
|
||||
{ 0xD3, "Primarion" },
|
||||
{ 0x54, "Picochip Designs Ltd" },
|
||||
{ 0xD5, "Silverback Systems" },
|
||||
{ 0xD6, "Jade Star Technologies" },
|
||||
{ 0x57, "Pijnenburg Securealink" },
|
||||
{ 0x58, "MemorySolutioN" },
|
||||
{ 0xD9, "Cambridge Silicon Radio" },
|
||||
{ 0xDA, "Swissbit" },
|
||||
{ 0x5B, "Nazomi Communications" },
|
||||
{ 0xDC, "eWave System" },
|
||||
{ 0x5D, "Rockwell Collins" },
|
||||
{ 0x5E, "PAION" },
|
||||
{ 0xDF, "Alphamosaic Ltd" },
|
||||
{ 0xE0, "Sandburst" },
|
||||
{ 0x61, "SiCon Video" },
|
||||
{ 0x62, "NanoAmp Solutions" },
|
||||
{ 0xE3, "Ericsson Technology" },
|
||||
{ 0x64, "PrairieComm" },
|
||||
{ 0xE5, "Mitac International" },
|
||||
{ 0xE6, "Layer N Networks" },
|
||||
{ 0x67, "Atsana Semiconductor" },
|
||||
{ 0x68, "Allegro Networks" },
|
||||
{ 0xE9, "Marvell Semiconductors" },
|
||||
{ 0xEA, "Netergy Microelectronic" },
|
||||
{ 0x6B, "NVIDIA" },
|
||||
{ 0xEC, "Internet Machines" },
|
||||
{ 0x6D, "Peak Electronics" },
|
||||
{ 0xEF, "Accton Technology" },
|
||||
{ 0x70, "Teradiant Networks" },
|
||||
{ 0xF1, "Europe Technologies" },
|
||||
{ 0xF2, "Cortina Systems" },
|
||||
{ 0x73, "RAM Components" },
|
||||
{ 0xF4, "Raqia Networks" },
|
||||
{ 0x75, "ClearSpeed" },
|
||||
{ 0x76, "Matsushita Battery" },
|
||||
{ 0xF7, "Xelerated" },
|
||||
{ 0xF8, "SimpleTech" },
|
||||
{ 0x79, "Utron Technology" },
|
||||
{ 0x7A, "Astec International" },
|
||||
{ 0xFB, "AVM gmbH" },
|
||||
{ 0x7C, "Redux Communications" },
|
||||
{ 0xFD, "Dot Hill Systems" },
|
||||
{ 0xFE, "TeraChip" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
const struct valstr jedec_id5_vals[] = {
|
||||
{ 0x01, "T-RAM Incorporated" },
|
||||
{ 0x02, "Innovics Wireless" },
|
||||
{ 0x83, "Teknovus" },
|
||||
{ 0x04, "KeyEye Communications" },
|
||||
{ 0x85, "Runcom Technologies" },
|
||||
{ 0x86, "RedSwitch" },
|
||||
{ 0x07, "Dotcast" },
|
||||
{ 0x08, "Silicon Mountain Memory" },
|
||||
{ 0x89, "Signia Technologies" },
|
||||
{ 0x8A, "Pixim" },
|
||||
{ 0x0B, "Galazar Networks" },
|
||||
{ 0x8C, "White Electronic Designs" },
|
||||
{ 0x0D, "Patriot Scientific" },
|
||||
{ 0x0E, "Neoaxiom Corporation" },
|
||||
{ 0x8F, "3Y Power Technology" },
|
||||
{ 0x10, "Europe Technologies" },
|
||||
{ 0x91, "Potentia Power Systems" },
|
||||
{ 0x92, "C-guys Incorporated" },
|
||||
{ 0x13, "Digital Communications Technology Incorporated" },
|
||||
{ 0x94, "Silicon-Based Technology" },
|
||||
{ 0x15, "Fulcrum Microsystems" },
|
||||
{ 0x16, "Positivo Informatica Ltd" },
|
||||
{ 0x97, "XIOtech Corporation" },
|
||||
{ 0x98, "PortalPlayer" },
|
||||
{ 0x19, "Zhiying Software" },
|
||||
{ 0x1A, "Direct2Data" },
|
||||
{ 0x9B, "Phonex Broadband" },
|
||||
{ 0x1C, "Skyworks Solutions" },
|
||||
{ 0x9D, "Entropic Communications" },
|
||||
{ 0x9E, "Pacific Force Technology" },
|
||||
{ 0x1F, "Zensys A/S" },
|
||||
{ 0x20, "Legend Silicon Corp." },
|
||||
{ 0xA1, "sci-worx GmbH" },
|
||||
{ 0xA2, "Oasis Silicon Systems" },
|
||||
{ 0x23, "Renesas Technology" },
|
||||
{ 0xA4, "Raza Microelectronics" },
|
||||
{ 0x25, "Phyworks" },
|
||||
{ 0x26, "MediaTek" },
|
||||
{ 0xA7, "Non-cents Productions" },
|
||||
{ 0xA8, "US Modular" },
|
||||
{ 0x29, "Wintegra Ltd" },
|
||||
{ 0x2A, "Mathstar" },
|
||||
{ 0xAB, "StarCore" },
|
||||
{ 0x2C, "Oplus Technologies" },
|
||||
{ 0xAD, "Mindspeed" },
|
||||
{ 0xAE, "Just Young Computer" },
|
||||
{ 0x2F, "Radia Communications" },
|
||||
{ 0xB0, "OCZ" },
|
||||
{ 0x31, "Emuzed" },
|
||||
{ 0x32, "LOGIC Devices" },
|
||||
{ 0xB3, "Inphi Corporation" },
|
||||
{ 0x34, "Quake Technologies" },
|
||||
{ 0xB5, "Vixel" },
|
||||
{ 0xB6, "SolusTek" },
|
||||
{ 0x37, "Kongsberg Maritime" },
|
||||
{ 0x38, "Faraday Technology" },
|
||||
{ 0xB9, "Altium Ltd." },
|
||||
{ 0xBA, "Insyte" },
|
||||
{ 0x3B, "ARM Ltd." },
|
||||
{ 0xBC, "DigiVision" },
|
||||
{ 0x3D, "Vativ Technologies" },
|
||||
{ 0x3E, "Endicott Interconnect Technologies" },
|
||||
{ 0xBF, "Pericom" },
|
||||
{ 0x40, "Bandspeed" },
|
||||
{ 0xC1, "LeWiz Communications" },
|
||||
{ 0xC2, "CPU Technology" },
|
||||
{ 0x43, "Ramaxel Technology" },
|
||||
{ 0xC4, "DSP Group" },
|
||||
{ 0x45, "Axis Communications" },
|
||||
{ 0x46, "Legacy Electronics" },
|
||||
{ 0xC7, "Chrontel" },
|
||||
{ 0xC8, "Powerchip Semiconductor" },
|
||||
{ 0x49, "MobilEye Technologies" },
|
||||
{ 0x4A, "Excel Semiconductor" },
|
||||
{ 0xCB, "A-DATA Technology" },
|
||||
{ 0x4C, "VirtualDigm" },
|
||||
{ 0x00, NULL },
|
||||
};
|
||||
|
||||
void ipmi_spd_print(struct ipmi_intf * intf, unsigned char id)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
struct fru_info fru;
|
||||
unsigned char spd_data[256], msg_data[4];
|
||||
int i, len, offset;
|
||||
int size, conf;
|
||||
|
||||
msg_data[0] = id;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_FRU_INFO;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 1;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode)
|
||||
return;
|
||||
fru.size = (rsp->data[1] << 8) | rsp->data[0];
|
||||
fru.access = rsp->data[2] & 0x1;
|
||||
|
||||
if (verbose > 1)
|
||||
printf("fru.size = %d bytes (accessed by %s)\n",
|
||||
fru.size, fru.access ? "words" : "bytes");
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = GET_FRU_DATA;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 4;
|
||||
|
||||
offset = 0;
|
||||
memset(spd_data, 0, 256);
|
||||
do {
|
||||
msg_data[0] = id;
|
||||
msg_data[1] = offset;
|
||||
msg_data[2] = 0;
|
||||
msg_data[3] = 32;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp) {
|
||||
printf(" Error while reading FRU data.\n");
|
||||
return;
|
||||
}
|
||||
if (rsp->ccode == 0xc3) {
|
||||
printf(" Timeout while reading FRU data. (Device not present?)\n");
|
||||
return;
|
||||
}
|
||||
if (rsp->ccode)
|
||||
break;
|
||||
|
||||
len = rsp->data[0];
|
||||
memcpy(&spd_data[offset], rsp->data + 1, len);
|
||||
offset += len;
|
||||
} while (offset < fru.size);
|
||||
|
||||
if (verbose)
|
||||
printbuf(spd_data, offset, "SPD DATA");
|
||||
|
||||
if (offset < 92)
|
||||
return; /* we need first 91 bytes to do our thing */
|
||||
|
||||
size = spd_data[5] * (spd_data[31] << 2);
|
||||
printf(" Memory Size : %d MB\n", size);
|
||||
printf(" Memory Type : %s\n", val2str(spd_data[2], spd_memtype_vals));
|
||||
printf(" Voltage Intf : %s\n", val2str(spd_data[8], spd_voltage_vals));
|
||||
printf(" Error Detect/Cor : %s\n", val2str(spd_data[11], spd_config_vals));
|
||||
|
||||
/* handle jedec table bank continuation values */
|
||||
printf(" Manufacturer : ");
|
||||
if (spd_data[64] != 0x7f)
|
||||
printf("%s\n", val2str(spd_data[64], jedec_id1_vals));
|
||||
else {
|
||||
if (spd_data[65] != 0x7f)
|
||||
printf("%s\n", val2str(spd_data[65], jedec_id2_vals));
|
||||
else {
|
||||
if (spd_data[66] != 0x7f)
|
||||
printf("%s\n", val2str(spd_data[66], jedec_id3_vals));
|
||||
else {
|
||||
if (spd_data[67] != 0x7f)
|
||||
printf("%s\n", val2str(spd_data[67], jedec_id4_vals));
|
||||
else
|
||||
printf("%s\n", val2str(spd_data[68], jedec_id5_vals));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (spd_data[73]) {
|
||||
char part[19];
|
||||
memcpy(part, spd_data+73, 18);
|
||||
part[18] = 0;
|
||||
printf(" Part Number : %s\n", part);
|
||||
}
|
||||
}
|
@ -36,15 +36,16 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <signal.h>
|
||||
#include <ipmitool/helper.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
unsigned long buf2long(unsigned char * buf)
|
||||
uint32_t buf2long(unsigned char * buf)
|
||||
{
|
||||
return (unsigned long)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);
|
||||
return (uint32_t)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);
|
||||
}
|
||||
|
||||
unsigned short buf2short(unsigned char * buf)
|
||||
@ -86,7 +87,7 @@ void printbuf(unsigned char * buf, int len, char * desc)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
const char * val2str(unsigned char val, const struct valstr *vs)
|
||||
const char * val2str(unsigned short val, const struct valstr *vs)
|
||||
{
|
||||
static char un_str[16];
|
||||
int i = 0;
|
||||
|
@ -44,6 +44,34 @@
|
||||
|
||||
extern int verbose;
|
||||
|
||||
const struct valstr completion_code_vals[] = {
|
||||
{ 0x00, "Command completed normally" },
|
||||
{ 0xc0, "Node busy" },
|
||||
{ 0xc1, "Invalid command" },
|
||||
{ 0xc2, "Invalid command on LUN" },
|
||||
{ 0xc3, "Timeout" },
|
||||
{ 0xc4, "Out of space" },
|
||||
{ 0xc5, "Reservation cancelled or invalid" },
|
||||
{ 0xc6, "Request data truncated" },
|
||||
{ 0xc7, "Request data length invalid" },
|
||||
{ 0xc8, "Request data field length limit exceeded" },
|
||||
{ 0xc9, "Parameter out of range" },
|
||||
{ 0xca, "Cannot return number of requested data bytes" },
|
||||
{ 0xcb, "Requested sensor, data, or record not found" },
|
||||
{ 0xcc, "Invalid data field in request" },
|
||||
{ 0xcd, "Command illegal for specified sensor or record type" },
|
||||
{ 0xce, "Command response could not be provided" },
|
||||
{ 0xcf, "Cannot execute duplicated request" },
|
||||
{ 0xd0, "SDR Repository in update mode" },
|
||||
{ 0xd1, "Device firmeware in update mode" },
|
||||
{ 0xd2, "BMC initialization in progress" },
|
||||
{ 0xd3, "Destination unavailable" },
|
||||
{ 0xd4, "Insufficient priviledge level" },
|
||||
{ 0xd5, "Command not supported in present state" },
|
||||
{ 0xff, "Unspecified error" },
|
||||
{ 0x00, NULL }
|
||||
};
|
||||
|
||||
static int ipmi_bmc_reset(struct ipmi_intf * intf, int cmd)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
|
@ -103,15 +103,26 @@ static void ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
|
||||
printf("Chassis identify interval: ");
|
||||
|
||||
if (arg) {
|
||||
unsigned char interval = (unsigned char)atoi(arg);
|
||||
struct {
|
||||
unsigned char interval;
|
||||
unsigned char force_on;
|
||||
} identify_data;
|
||||
|
||||
if (!strcmp(arg, "force")){
|
||||
identify_data.interval = 0;
|
||||
identify_data.force_on = 1;
|
||||
printf("indefinite\n");
|
||||
} else {
|
||||
identify_data.interval = (unsigned char)atoi(arg);
|
||||
identify_data.force_on = 0;
|
||||
if (identify_data.interval)
|
||||
printf("%d seconds\n", identify_data.interval);
|
||||
else
|
||||
printf("off\n");
|
||||
}
|
||||
|
||||
req.msg.data = &interval;
|
||||
req.msg.data_len = 1;
|
||||
|
||||
if (interval)
|
||||
printf("%d seconds\n", interval);
|
||||
else
|
||||
printf("off\n");
|
||||
req.msg.data = (unsigned char *)&identify_data;
|
||||
req.msg.data_len = 2;
|
||||
} else {
|
||||
printf("default (15 seconds)\n");
|
||||
}
|
||||
@ -123,7 +134,7 @@ static void ipmi_chassis_poh(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned long count;
|
||||
uint32_t count;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_CHASSIS;
|
||||
@ -137,7 +148,7 @@ static void ipmi_chassis_poh(struct ipmi_intf * intf)
|
||||
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));
|
||||
count, (uint32_t)(count / 24), (uint32_t)(count % 24));
|
||||
}
|
||||
|
||||
static void ipmi_chassis_restart_cause(struct ipmi_intf * intf)
|
||||
@ -246,6 +257,23 @@ static void ipmi_chassis_status(struct ipmi_intf * intf)
|
||||
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");
|
||||
|
||||
if (rsp->data_len > 3)
|
||||
{
|
||||
/* optional byte 4 */
|
||||
if (rsp->data[3] == 0) {
|
||||
printf("Front Panel Control : none\n");
|
||||
} else {
|
||||
printf("Sleep Button Disable : %s\n", (rsp->data[3] & 0x80) ? "allowed" : "not allowed");
|
||||
printf("Diag Button Disable : %s\n", (rsp->data[3] & 0x40) ? "allowed" : "not allowed");
|
||||
printf("Reset Button Disable : %s\n", (rsp->data[3] & 0x20) ? "allowed" : "not allowed");
|
||||
printf("Power Button Disable : %s\n", (rsp->data[3] & 0x10) ? "allowed" : "not allowed");
|
||||
printf("Sleep Button Disabled: %s\n", (rsp->data[3] & 0x80) ? "true" : "false");
|
||||
printf("Diag Button Disabled : %s\n", (rsp->data[3] & 0x40) ? "true" : "false");
|
||||
printf("Reset Button Disabled: %s\n", (rsp->data[3] & 0x20) ? "true" : "false");
|
||||
printf("Power Button Disabled: %s\n", (rsp->data[3] & 0x10) ? "true" : "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ipmi_chassis_set_bootparam(struct ipmi_intf * intf, unsigned char param, unsigned char * data, int len)
|
||||
@ -437,6 +465,7 @@ int ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
printf("chassis identify <interval>\n");
|
||||
printf(" default is 15 seconds\n");
|
||||
printf(" 0 to turn off\n");
|
||||
printf(" force to turn on indefinitely\n");
|
||||
} else {
|
||||
ipmi_chassis_identify(intf, argv[1]);
|
||||
}
|
||||
|
@ -1,164 +0,0 @@
|
||||
/*
|
||||
* 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 <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/ipmi.h>
|
||||
#include <ipmi.h>
|
||||
#include <ipmi_dev.h>
|
||||
#include <helper.h>
|
||||
|
||||
static int curr_seq;
|
||||
extern int verbose;
|
||||
|
||||
struct ipmi_intf ipmi_dev_intf = {
|
||||
.open = ipmi_dev_open,
|
||||
.close = ipmi_dev_close,
|
||||
.sendrecv = ipmi_dev_send_cmd,
|
||||
};
|
||||
|
||||
void ipmi_dev_close(struct ipmi_intf * intf)
|
||||
{
|
||||
if (intf && intf->fd >= 0)
|
||||
close(intf->fd);
|
||||
}
|
||||
|
||||
int ipmi_dev_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (!dev)
|
||||
intf->fd = open("/dev/ipmi/0", O_RDWR);
|
||||
else
|
||||
intf->fd = open(dev, O_RDWR);
|
||||
|
||||
if (intf->fd < 0) {
|
||||
perror("Could not open ipmi device");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ioctl(intf->fd, IPMICTL_SET_GETS_EVENTS_CMD, &i)) {
|
||||
perror("Could not set to get events");
|
||||
return -1;
|
||||
}
|
||||
|
||||
curr_seq = 0;
|
||||
|
||||
return intf->fd;
|
||||
}
|
||||
|
||||
struct ipmi_rsp * ipmi_dev_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req)
|
||||
{
|
||||
struct ipmi_recv recv;
|
||||
struct ipmi_addr addr;
|
||||
struct ipmi_system_interface_addr bmc_addr;
|
||||
static struct ipmi_rsp rsp;
|
||||
fd_set rset;
|
||||
|
||||
if (!req)
|
||||
return NULL;
|
||||
|
||||
if (verbose > 2)
|
||||
printbuf(req->msg.data, req->msg.data_len, "send_ipmi_cmd_dev");
|
||||
|
||||
FD_ZERO(&rset);
|
||||
FD_SET(intf->fd, &rset);
|
||||
|
||||
bmc_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
|
||||
bmc_addr.channel = IPMI_BMC_CHANNEL;
|
||||
bmc_addr.lun = 0;
|
||||
req->addr = (char *) &bmc_addr;
|
||||
req->addr_len = sizeof(bmc_addr);
|
||||
req->msgid = curr_seq++;
|
||||
|
||||
if (ioctl(intf->fd, IPMICTL_SEND_COMMAND, req) < 0) {
|
||||
printf("Error sending command: %s\n", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
if (select(intf->fd+1, &rset, NULL, NULL, NULL) < 0) {
|
||||
perror("select");
|
||||
return NULL;
|
||||
}
|
||||
if (!FD_ISSET(intf->fd, &rset)) {
|
||||
printf("Error no data available\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
recv.addr = (char *) &addr;
|
||||
recv.addr_len = sizeof(addr);
|
||||
recv.msg.data = rsp.data;
|
||||
recv.msg.data_len = sizeof(rsp.data);
|
||||
|
||||
/* get data */
|
||||
if (ioctl(intf->fd, IPMICTL_RECEIVE_MSG_TRUNC, &recv) < 0) {
|
||||
printf("Error receiving message: %s\n", strerror(errno));
|
||||
if (errno != EMSGSIZE)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
printf("Got message:\n");
|
||||
printf(" type = %d\n", recv.recv_type);
|
||||
printf(" channel = 0x%x\n", addr.channel);
|
||||
printf(" msgid = %ld\n", recv.msgid);
|
||||
printf(" netfn = 0x%x\n", recv.msg.netfn);
|
||||
printf(" cmd = 0x%x\n", recv.msg.cmd);
|
||||
if (recv.msg.data && recv.msg.data_len) {
|
||||
printf(" data_len = %d\n", recv.msg.data_len);
|
||||
printf(" data =");
|
||||
printbuf(recv.msg.data, recv.msg.data_len, "data");
|
||||
}
|
||||
}
|
||||
|
||||
rsp.ccode = recv.msg.data[0];
|
||||
rsp.data_len = recv.msg.data_len - 1;
|
||||
|
||||
if (!rsp.ccode && rsp.data_len) {
|
||||
memmove(rsp.data, rsp.data + 1, rsp.data_len);
|
||||
rsp.data[recv.msg.data_len] = 0;
|
||||
}
|
||||
|
||||
return &rsp;
|
||||
}
|
||||
|
@ -36,11 +36,17 @@
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_fru.h>
|
||||
#include <ipmitool/ipmi_sdr.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
extern int verbose;
|
||||
extern void ipmi_spd_print(struct ipmi_intf * intf, unsigned char id);
|
||||
|
||||
static char * get_fru_area_str(unsigned char * data, int * offset)
|
||||
{
|
||||
@ -89,7 +95,8 @@ static void ipmi_fru_print(struct ipmi_intf * intf, unsigned char id)
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode)
|
||||
return;
|
||||
memcpy(&fru, rsp->data, sizeof(fru));
|
||||
fru.size = (rsp->data[1] << 8) | rsp->data[0];
|
||||
fru.access = rsp->data[2] & 0x1;
|
||||
|
||||
if (verbose > 1)
|
||||
printf("fru.size = %d bytes (accessed by %s)\n",
|
||||
@ -107,17 +114,41 @@ static void ipmi_fru_print(struct ipmi_intf * intf, unsigned char id)
|
||||
req.msg.data_len = 4;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode)
|
||||
|
||||
if (!rsp)
|
||||
return;
|
||||
|
||||
if(rsp->ccode)
|
||||
{
|
||||
if (rsp->ccode == 0xc3)
|
||||
printf (" Timeout while reading FRU data. (Device not present?)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (verbose > 1)
|
||||
printbuf(rsp->data, rsp->data_len, "FRU DATA");
|
||||
|
||||
memcpy(&header, rsp->data + 1, 8);
|
||||
|
||||
if (header.version != 0x01)
|
||||
{
|
||||
printf (" Unknown FRU header version %02x.\n", header.version);
|
||||
return;
|
||||
}
|
||||
|
||||
header.offset.internal *= 8;
|
||||
header.offset.chassis *= 8;
|
||||
header.offset.board *= 8;
|
||||
header.offset.product *= 8;
|
||||
header.offset.multi *= 8;
|
||||
|
||||
if (verbose > 1) {
|
||||
printf("fru.header.version: 0x%x\n", header.version);
|
||||
printf("fru.header.offset.internal: 0x%x\n", header.offset.internal * 8);
|
||||
printf("fru.header.offset.chassis: 0x%x\n", header.offset.chassis * 8);
|
||||
printf("fru.header.offset.board: 0x%x\n", header.offset.board * 8);
|
||||
printf("fru.header.offset.product: 0x%x\n", header.offset.product * 8);
|
||||
printf("fru.header.offset.multi: 0x%x\n", header.offset.multi * 8);
|
||||
printf("fru.header.offset.internal: 0x%x\n", header.offset.internal);
|
||||
printf("fru.header.offset.chassis: 0x%x\n", header.offset.chassis);
|
||||
printf("fru.header.offset.board: 0x%x\n", header.offset.board);
|
||||
printf("fru.header.offset.product: 0x%x\n", header.offset.product);
|
||||
printf("fru.header.offset.multi: 0x%x\n", header.offset.multi);
|
||||
}
|
||||
|
||||
offset = 0;
|
||||
@ -126,11 +157,11 @@ static void ipmi_fru_print(struct ipmi_intf * intf, unsigned char id)
|
||||
msg_data[0] = id;
|
||||
msg_data[1] = offset;
|
||||
msg_data[2] = 0;
|
||||
msg_data[3] = 32;
|
||||
msg_data[3] = (fru.size - offset) > 32 ? 32 : (fru.size - offset);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode)
|
||||
continue;
|
||||
break;
|
||||
|
||||
len = rsp->data[0];
|
||||
memcpy(&fru_data[offset], rsp->data + 1, len);
|
||||
@ -138,79 +169,292 @@ static void ipmi_fru_print(struct ipmi_intf * intf, unsigned char id)
|
||||
} while (offset < fru.size);
|
||||
|
||||
/* chassis area */
|
||||
i = header.offset.chassis * 8;
|
||||
chassis.area_ver = fru_data[i++];
|
||||
chassis.area_len = fru_data[i++];
|
||||
chassis.type = fru_data[i++];
|
||||
chassis.part = get_fru_area_str(fru_data, &i);
|
||||
chassis.serial = get_fru_area_str(fru_data, &i);
|
||||
|
||||
if (header.offset.chassis)
|
||||
{
|
||||
i = header.offset.chassis;
|
||||
chassis.area_ver = fru_data[i++];
|
||||
chassis.area_len = fru_data[i++] * 8;
|
||||
chassis.type = fru_data[i++];
|
||||
chassis.part = get_fru_area_str(fru_data, &i);
|
||||
chassis.serial = get_fru_area_str(fru_data, &i);
|
||||
|
||||
printf(" Chassis Type : %s\n", chassis_type_desc[chassis.type]);
|
||||
printf(" Chassis Part : %s\n", chassis.part);
|
||||
printf(" Chassis Serial : %s\n", chassis.serial);
|
||||
|
||||
while (fru_data[i] != 0xc1 && i < header.offset.chassis + chassis.area_len)
|
||||
{
|
||||
char *extra;
|
||||
|
||||
extra = get_fru_area_str(fru_data, &i);
|
||||
if (extra [0]) printf(" Chassis Extra : %s\n", extra);
|
||||
free(extra);
|
||||
}
|
||||
free(chassis.part);
|
||||
free(chassis.serial);
|
||||
}
|
||||
|
||||
/* board area */
|
||||
i = header.offset.board * 8;
|
||||
board.area_ver = fru_data[i++];
|
||||
board.area_len = fru_data[i++];
|
||||
board.lang = fru_data[i++];
|
||||
i += 3; /* skip mfg. date time */
|
||||
board.mfg = get_fru_area_str(fru_data, &i);
|
||||
board.prod = get_fru_area_str(fru_data, &i);
|
||||
board.serial = get_fru_area_str(fru_data, &i);
|
||||
board.part = get_fru_area_str(fru_data, &i);
|
||||
|
||||
if (header.offset.board)
|
||||
{
|
||||
i = header.offset.board;
|
||||
board.area_ver = fru_data[i++];
|
||||
board.area_len = fru_data[i++] * 8;
|
||||
board.lang = fru_data[i++];
|
||||
i += 3; /* skip mfg. date time */
|
||||
board.mfg = get_fru_area_str(fru_data, &i);
|
||||
board.prod = get_fru_area_str(fru_data, &i);
|
||||
board.serial = get_fru_area_str(fru_data, &i);
|
||||
board.part = get_fru_area_str(fru_data, &i);
|
||||
board.fru = get_fru_area_str(fru_data, &i);
|
||||
|
||||
printf(" Board Mfg : %s\n", board.mfg);
|
||||
printf(" Board Product : %s\n", board.prod);
|
||||
printf(" Board Serial : %s\n", board.serial);
|
||||
printf(" Board Part : %s\n", board.part);
|
||||
|
||||
if (verbose > 0)
|
||||
printf(" Board FRU ID : %s\n", board.fru);
|
||||
|
||||
while (fru_data[i] != 0xc1 && i < header.offset.board + board.area_len)
|
||||
{
|
||||
char *extra;
|
||||
|
||||
extra = get_fru_area_str(fru_data, &i);
|
||||
if (extra [0]) printf(" Board Extra : %s\n", extra);
|
||||
free(extra);
|
||||
}
|
||||
|
||||
free(board.mfg);
|
||||
free(board.prod);
|
||||
free(board.serial);
|
||||
free(board.part);
|
||||
free(board.fru);
|
||||
}
|
||||
|
||||
/* product area */
|
||||
i = header.offset.product * 8;
|
||||
product.area_ver = fru_data[i++];
|
||||
product.area_len = fru_data[i++];
|
||||
product.lang = fru_data[i++];
|
||||
product.mfg = get_fru_area_str(fru_data, &i);
|
||||
product.name = get_fru_area_str(fru_data, &i);
|
||||
product.part = get_fru_area_str(fru_data, &i);
|
||||
product.version = get_fru_area_str(fru_data, &i);
|
||||
product.serial = get_fru_area_str(fru_data, &i);
|
||||
product.asset = get_fru_area_str(fru_data, &i);
|
||||
|
||||
printf("Chassis Type : %s\n", chassis_type_desc[chassis.type]);
|
||||
printf("Chassis Part : %s\n", chassis.part);
|
||||
printf("Chassis Serial : %s\n", chassis.serial);
|
||||
if (header.offset.product)
|
||||
{
|
||||
i = header.offset.product;
|
||||
product.area_ver = fru_data[i++];
|
||||
product.area_len = fru_data[i++] * 8;
|
||||
product.lang = fru_data[i++];
|
||||
product.mfg = get_fru_area_str(fru_data, &i);
|
||||
product.name = get_fru_area_str(fru_data, &i);
|
||||
product.part = get_fru_area_str(fru_data, &i);
|
||||
product.version = get_fru_area_str(fru_data, &i);
|
||||
product.serial = get_fru_area_str(fru_data, &i);
|
||||
product.asset = get_fru_area_str(fru_data, &i);
|
||||
product.fru = get_fru_area_str(fru_data, &i);
|
||||
|
||||
printf("Board Mfg : %s\n", board.mfg);
|
||||
printf("Board Product : %s\n", board.prod);
|
||||
printf("Board Serial : %s\n", board.serial);
|
||||
printf("Board Part : %s\n", board.part);
|
||||
printf(" Product Mfg : %s\n", product.mfg);
|
||||
printf(" Product Name : %s\n", product.name);
|
||||
printf(" Product Part : %s\n", product.part);
|
||||
printf(" Product Version : %s\n", product.version);
|
||||
printf(" Product Serial : %s\n", product.serial);
|
||||
printf(" Product Asset : %s\n", product.asset);
|
||||
|
||||
printf("Product Mfg : %s\n", product.mfg);
|
||||
printf("Product Name : %s\n", product.name);
|
||||
printf("Product Part : %s\n", product.part);
|
||||
printf("Product Version : %s\n", product.version);
|
||||
printf("Product Serial : %s\n", product.serial);
|
||||
printf("Product Asset : %s\n", product.asset);
|
||||
if (verbose > 0)
|
||||
printf(" Product FRU ID : %s\n", product.fru);
|
||||
|
||||
free(chassis.part);
|
||||
free(chassis.serial);
|
||||
while (fru_data[i] != 0xc1 && i < header.offset.product + product.area_len)
|
||||
{
|
||||
char *extra;
|
||||
|
||||
free(board.mfg);
|
||||
free(board.prod);
|
||||
free(board.serial);
|
||||
free(board.part);
|
||||
extra = get_fru_area_str(fru_data, &i);
|
||||
if (extra [0]) printf(" Product Extra : %s\n", extra);
|
||||
free(extra);
|
||||
}
|
||||
|
||||
free(product.mfg);
|
||||
free(product.name);
|
||||
free(product.part);
|
||||
free(product.version);
|
||||
free(product.serial);
|
||||
free(product.asset);
|
||||
free(product.mfg);
|
||||
free(product.name);
|
||||
free(product.part);
|
||||
free(product.version);
|
||||
free(product.serial);
|
||||
free(product.asset);
|
||||
free(product.fru);
|
||||
}
|
||||
|
||||
/* multirecord area */
|
||||
|
||||
if (header.offset.multi)
|
||||
{
|
||||
struct fru_multirec_header * h;
|
||||
struct fru_multirec_powersupply * ps;
|
||||
struct fru_multirec_dcoutput * dc;
|
||||
struct fru_multirec_dcload * dl;
|
||||
unsigned short peak_capacity;
|
||||
unsigned char peak_hold_up_time;
|
||||
|
||||
i = header.offset.multi;
|
||||
|
||||
do
|
||||
{
|
||||
h = (struct fru_multirec_header *) (fru_data + i);
|
||||
|
||||
switch (h->type)
|
||||
{
|
||||
case FRU_RECORD_TYPE_POWER_SUPPLY_INFORMATION:
|
||||
ps = (struct fru_multirec_powersupply *) (fru_data + i + sizeof (struct fru_multirec_header));
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
ps->capacity = BSWAP_16(ps->capacity);
|
||||
ps->peak_va = BSWAP_16(ps->peak_va);
|
||||
ps->lowend_input1 = BSWAP_16(ps->lowend_input1);
|
||||
ps->highend_input1 = BSWAP_16(ps->highend_input1);
|
||||
ps->lowend_input2 = BSWAP_16(ps->lowend_input2);
|
||||
ps->highend_input2 = BSWAP_16(ps->highend_input2);
|
||||
ps->combined_capacity = BSWAP_16(ps->combined_capacity);
|
||||
ps->peak_cap_ht = BSWAP_16(ps->peak_cap_ht);
|
||||
#endif
|
||||
peak_hold_up_time = (ps->peak_cap_ht & 0xf000) >> 12;
|
||||
peak_capacity = ps->peak_cap_ht & 0x0fff;
|
||||
|
||||
printf (" Power Supply Record\n");
|
||||
printf (" Capacity : %d W\n", ps->capacity);
|
||||
printf (" Peak VA : %d VA\n", ps->peak_va);
|
||||
printf (" Inrush Current : %d A\n", ps->inrush_current);
|
||||
printf (" Inrush Interval : %d ms\n", ps->inrush_interval);
|
||||
printf (" Input Voltage Range 1 : %d-%d V\n", ps->lowend_input1 / 100, ps->highend_input1 / 100);
|
||||
printf (" Input Voltage Range 2 : %d-%d V\n", ps->lowend_input2 / 100, ps->highend_input2 / 100);
|
||||
printf (" Input Frequency Range : %d-%d Hz\n", ps->lowend_freq, ps->highend_freq);
|
||||
printf (" A/C Dropout Tolerance : %d ms\n", ps->dropout_tolerance);
|
||||
printf (" Flags : %s%s%s%s%s\n",
|
||||
ps->predictive_fail ? "'Predictive fail' " : "",
|
||||
ps->pfc ? "'Power factor correction' " : "",
|
||||
ps->autoswitch ? "'Autoswitch voltage' " : "",
|
||||
ps->hotswap ? "'Hot swap' " : "",
|
||||
ps->predictive_fail ? ps->rps_threshold ?
|
||||
ps->tach ? "'Two pulses per rotation'" : "'One pulse per rotation'" :
|
||||
ps->tach ? "'Failure on pin de-assertion'" : "'Failure on pin assertion'" : "");
|
||||
printf (" Peak capacity : %d W\n", peak_capacity);
|
||||
printf (" Peak capacity holdup : %d s\n", peak_hold_up_time);
|
||||
if (ps->combined_capacity == 0)
|
||||
printf (" Combined capacity : not specified\n");
|
||||
else
|
||||
printf (" Combined capacity : %d W (%s and %s)\n", ps->combined_capacity,
|
||||
combined_voltage_desc [ps->combined_voltage1],
|
||||
combined_voltage_desc [ps->combined_voltage2]);
|
||||
if (ps->predictive_fail)
|
||||
printf (" Fan lower threshold : %d RPS\n", ps->rps_threshold);
|
||||
|
||||
break;
|
||||
|
||||
case FRU_RECORD_TYPE_DC_OUTPUT:
|
||||
dc = (struct fru_multirec_dcoutput *) (fru_data + i + sizeof (struct fru_multirec_header));
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
dc->nominal_voltage = BSWAP_16(dc->nominal_voltage);
|
||||
dc->max_neg_dev = BSWAP_16(dc->max_neg_dev);
|
||||
dc->max_pos_dev = BSWAP_16(dc->max_pos_dev);
|
||||
dc->ripple_and_noise = BSWAP_16(dc->ripple_and_noise);
|
||||
dc->min_current = BSWAP_16(dc->min_current);
|
||||
dc->max_current = BSWAP_16(dc->max_current);
|
||||
#endif
|
||||
|
||||
printf (" DC Output Record\n");
|
||||
printf (" Output Number : %d\n", dc->output_number);
|
||||
printf (" Standby power : %s\n", dc->standby ? "Yes" : "No");
|
||||
printf (" Nominal voltage : %.2f V\n", (double) dc->nominal_voltage / 100);
|
||||
printf (" Max negative deviation : %.2f V\n", (double) dc->max_neg_dev / 100);
|
||||
printf (" Max positive deviation : %.2f V\n", (double) dc->max_pos_dev / 100);
|
||||
printf (" Ripple and noise pk-pk : %d mV\n", dc->ripple_and_noise);
|
||||
printf (" Minimum current draw : %.3f A\n", (double) dc->min_current / 1000);
|
||||
printf (" Maximum current draw : %.3f A\n", (double) dc->max_current / 1000);
|
||||
break;
|
||||
|
||||
case FRU_RECORD_TYPE_DC_LOAD:
|
||||
dl = (struct fru_multirec_dcload *) (fru_data + i + sizeof (struct fru_multirec_header));
|
||||
|
||||
#if WORDS_BIGENDIAN
|
||||
dl->nominal_voltage = BSWAP_16(dl->nominal_voltage);
|
||||
dl->min_voltage = BSWAP_16(dl->min_voltage);
|
||||
dl->max_voltage = BSWAP_16(dl->max_voltage);
|
||||
dl->ripple_and_noise = BSWAP_16(dl->ripple_and_noise);
|
||||
dl->min_current = BSWAP_16(dl->min_current);
|
||||
dl->max_current = BSWAP_16(dl->max_current);
|
||||
#endif
|
||||
|
||||
printf (" DC Load Record\n");
|
||||
printf (" Output Number : %d\n", dl->output_number);
|
||||
printf (" Nominal voltage : %.2f V\n", (double) dl->nominal_voltage / 100);
|
||||
printf (" Min voltage allowed : %.2f V\n", (double) dl->min_voltage / 100);
|
||||
printf (" Max voltage allowed : %.2f V\n", (double) dl->max_voltage / 100);
|
||||
printf (" Ripple and noise pk-pk : %d mV\n", dl->ripple_and_noise);
|
||||
printf (" Minimum current load : %.3f A\n", (double) dl->min_current / 1000);
|
||||
printf (" Maximum current load : %.3f A\n", (double) dl->max_current / 1000);
|
||||
break;
|
||||
}
|
||||
i += h->len + sizeof (struct fru_multirec_header);
|
||||
} while (!(h->format & 0x80));
|
||||
}
|
||||
}
|
||||
|
||||
static void ipmi_fru_print_all(struct ipmi_intf * intf)
|
||||
{
|
||||
struct ipmi_sdr_iterator * itr;
|
||||
struct sdr_get_rs * header;
|
||||
struct sdr_record_fru_device_locator * fru;
|
||||
char desc[17];
|
||||
|
||||
printf ("Builtin FRU device\n");
|
||||
ipmi_fru_print(intf, 0); /* TODO: Figure out if FRU device 0 may show up in SDR records. */
|
||||
|
||||
if (!(itr = ipmi_sdr_start(intf)))
|
||||
return;
|
||||
|
||||
while (header = ipmi_sdr_get_next_header(intf, itr))
|
||||
{
|
||||
if (header->type != SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR)
|
||||
continue;
|
||||
|
||||
fru = (struct sdr_record_fru_device_locator *) ipmi_sdr_get_record(intf, header, itr);
|
||||
if (!fru || fru->device_type != 0x10)
|
||||
continue;
|
||||
|
||||
memset(desc, 0, sizeof(desc));
|
||||
memcpy(desc, fru->id_string, fru->id_code & 0x01f);
|
||||
desc[fru->id_code & 0x01f] = 0;
|
||||
printf("\nFRU Device Description: %s Device ID: %d\n", desc, fru->keys.fru_device_id);
|
||||
|
||||
switch (fru->device_type_modifier) {
|
||||
case 0x00:
|
||||
case 0x02:
|
||||
ipmi_fru_print(intf, fru->keys.fru_device_id);
|
||||
break;
|
||||
case 0x01:
|
||||
ipmi_spd_print(intf, fru->keys.fru_device_id);
|
||||
break;
|
||||
default:
|
||||
if (verbose)
|
||||
printf(" Unsupported device 0x%02x "
|
||||
"type 0x%02x with modifier 0x%02x\n",
|
||||
fru->keys.fru_device_id, fru->device_type,
|
||||
fru->device_type_modifier);
|
||||
else
|
||||
printf(" Unsupported device\n");
|
||||
}
|
||||
|
||||
free (fru);
|
||||
}
|
||||
|
||||
ipmi_sdr_end(intf, itr);
|
||||
}
|
||||
|
||||
int ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (argc == 0) {
|
||||
ipmi_fru_print(intf, 0);
|
||||
ipmi_fru_print_all(intf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strncmp(argv[0], "help", 4))
|
||||
printf("FRU Commands: print\n");
|
||||
else if (!strncmp(argv[0], "print", 4))
|
||||
ipmi_fru_print(intf, 0);
|
||||
else if (!strncmp(argv[0], "print", 5))
|
||||
ipmi_fru_print_all(intf);
|
||||
else
|
||||
printf("Invalid FRU command: %s\n", argv[0]);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -225,7 +225,10 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
rqdata[0] = channel & 0xf;
|
||||
rqdata[1] = 0x80; /* 0x80=active, 0x40=non-volatile */
|
||||
|
||||
/* get volatile settings */
|
||||
|
||||
rqdata[1] = 0x80; /* 0x80=active */
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x41;
|
||||
req.msg.data = rqdata;
|
||||
@ -236,10 +239,11 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
return;
|
||||
}
|
||||
|
||||
printf(" Alerting : %sabled\n", (rsp->data[0] & 0x20) ? "dis" : "en");
|
||||
printf(" Per-message Auth : %sabled\n", (rsp->data[0] & 0x10) ? "dis" : "en");
|
||||
printf(" User Level Auth : %sabled\n", (rsp->data[0] & 0x08) ? "dis" : "en");
|
||||
printf(" Access Mode : ");
|
||||
printf(" Volatile(active) Settings\n");
|
||||
printf(" Alerting : %sabled\n", (rsp->data[0] & 0x20) ? "dis" : "en");
|
||||
printf(" Per-message Auth : %sabled\n", (rsp->data[0] & 0x10) ? "dis" : "en");
|
||||
printf(" User Level Auth : %sabled\n", (rsp->data[0] & 0x08) ? "dis" : "en");
|
||||
printf(" Access Mode : ");
|
||||
switch (rsp->data[0] & 0x7) {
|
||||
case 0:
|
||||
printf("disabled\n");
|
||||
@ -257,38 +261,40 @@ ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
printf("unknown\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void suspend_lan_arp(struct ipmi_intf * intf, int suspend)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char msg_data[2];
|
||||
|
||||
msg_data[0] = IPMI_LAN_CHANNEL_1;
|
||||
msg_data[1] = suspend;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_TRANSPORT;
|
||||
req.msg.cmd = IPMI_LAN_SUSPEND_ARP;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 2;
|
||||
/* get non-volatile settings */
|
||||
|
||||
rqdata[1] = 0x40; /* 0x40=non-volatile */
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (rsp && !rsp->ccode)
|
||||
printf("Suspend BMC ARP status : 0x%x\n", rsp->data[0]);
|
||||
}
|
||||
if (!rsp || rsp->ccode) {
|
||||
return;
|
||||
}
|
||||
|
||||
static void set_lan_params(struct ipmi_intf * intf)
|
||||
{
|
||||
lan_set_auth(intf);
|
||||
lan_set_arp(intf);
|
||||
suspend_lan_arp(intf, 0);
|
||||
printf(" Non-Volatile Settings\n");
|
||||
printf(" Alerting : %sabled\n", (rsp->data[0] & 0x20) ? "dis" : "en");
|
||||
printf(" Per-message Auth : %sabled\n", (rsp->data[0] & 0x10) ? "dis" : "en");
|
||||
printf(" User Level Auth : %sabled\n", (rsp->data[0] & 0x08) ? "dis" : "en");
|
||||
printf(" Access Mode : ");
|
||||
switch (rsp->data[0] & 0x7) {
|
||||
case 0:
|
||||
printf("disabled\n");
|
||||
break;
|
||||
case 1:
|
||||
printf("pre-boot only\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("always available\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("shared\n");
|
||||
break;
|
||||
default:
|
||||
printf("unknown\n");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
lan_set_arp_interval(struct ipmi_intf * intf, unsigned char chan, unsigned char * ival)
|
||||
{
|
||||
@ -302,12 +308,12 @@ lan_set_arp_interval(struct ipmi_intf * intf, unsigned char chan, unsigned char
|
||||
if (ival) {
|
||||
interval = ((unsigned char)atoi(ival) * 2) - 1;
|
||||
set_lan_param(intf, chan, IPMI_LANP_GRAT_ARP, &interval, 1);
|
||||
printf("BMC-generated Gratuitous ARP interval: %.1f seconds\n",
|
||||
(float)((interval + 1) / 2));
|
||||
} else {
|
||||
printf("BMC-generated Gratuitous ARP interval: %.1f seconds\n",
|
||||
(float)((lp->data[0] + 1) / 2));
|
||||
interval = lp->data[0];
|
||||
}
|
||||
|
||||
printf("BMC-generated Gratuitous ARP interval: %.1f seconds\n",
|
||||
(float)((interval + 1) / 2));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -515,10 +521,10 @@ ipmi_set_channel_access(struct ipmi_intf * intf, unsigned char channel, unsigned
|
||||
memset(&req, 0, sizeof(req));
|
||||
rqdata[0] = channel & 0xf;
|
||||
|
||||
rqdata[1] = 0xa0; /* set pef disabled, per-msg auth enabled */
|
||||
rqdata[1] = 0x60; /* save to nvram first */
|
||||
if (enable)
|
||||
rqdata[1] |= 0x2; /* set always available if enable is set */
|
||||
rqdata[2] = 0x04; /* don't change channel privilege limit */
|
||||
rqdata[2] = 0x44; /* save to nvram first */
|
||||
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x40;
|
||||
@ -532,6 +538,21 @@ ipmi_set_channel_access(struct ipmi_intf * intf, unsigned char channel, unsigned
|
||||
return -1;
|
||||
}
|
||||
|
||||
rqdata[1] = 0xa0; /* set pef disabled, per-msg auth enabled */
|
||||
if (enable)
|
||||
rqdata[1] |= 0x2; /* set always available if enable is set */
|
||||
rqdata[2] = 0x84; /* set channel privilege limit to ADMIN */
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x Set Channel Access Command (0x%x)\n",
|
||||
rsp ? rsp->ccode : 0, channel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!enable) /* can't send close session if access off */
|
||||
intf->abort = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -609,7 +630,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return;
|
||||
}
|
||||
|
||||
chan = (unsigned char) strtod(argv[0], NULL);
|
||||
chan = (unsigned char)strtol(argv[0], NULL, 0);
|
||||
if (chan != 0x6 && chan != 0x7) {
|
||||
printf("valid LAN channels are 6 and 7\n");
|
||||
return;
|
||||
@ -794,7 +815,7 @@ ipmi_lanp_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
!strncmp(argv[0], "print", 5)) {
|
||||
unsigned char chan = 7;
|
||||
if (argc > 1)
|
||||
chan = (unsigned char) strtod(argv[1], NULL);
|
||||
chan = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
ipmi_lan_print(intf, chan);
|
||||
}
|
||||
else if (!strncmp(argv[0], "set", 3))
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -80,50 +80,37 @@ ipmi_get_event_type(unsigned char code)
|
||||
return "Reserved";
|
||||
}
|
||||
|
||||
static const char *
|
||||
ipmi_get_event_desc(struct sel_event_record * rec)
|
||||
static void
|
||||
ipmi_get_event_desc(struct sel_event_record * rec, char ** desc)
|
||||
{
|
||||
int class;
|
||||
unsigned char offset = 0;
|
||||
unsigned char code = 0;
|
||||
unsigned char code, offset;
|
||||
struct ipmi_event_sensor_types *evt;
|
||||
|
||||
class = ipmi_get_event_class(rec->event_type);
|
||||
if (class < 0)
|
||||
return "Invalid Class";
|
||||
if (desc == NULL)
|
||||
return;
|
||||
|
||||
switch (class) {
|
||||
case IPMI_EVENT_CLASS_DISCRETE:
|
||||
if (rec->event_type == 0x6f)
|
||||
evt = sensor_specific_types;
|
||||
else
|
||||
evt = generic_event_types;
|
||||
if (rec->event_type == 0x6f) {
|
||||
evt = sensor_specific_types;
|
||||
code = rec->sensor_type;
|
||||
break;
|
||||
case IPMI_EVENT_CLASS_DIGITAL:
|
||||
} else {
|
||||
evt = generic_event_types;
|
||||
code = rec->sensor_type;
|
||||
break;
|
||||
case IPMI_EVENT_CLASS_THRESHOLD:
|
||||
evt = generic_event_types;
|
||||
code = 0x01;
|
||||
break;
|
||||
default:
|
||||
return "Unknown Class";
|
||||
code = rec->event_type;
|
||||
}
|
||||
|
||||
offset = rec->event_data[0] & 0xf;
|
||||
|
||||
if (verbose > 2)
|
||||
printf("offset: 0x%02x\n", offset);
|
||||
|
||||
while (evt->type) {
|
||||
if (evt->code == code && evt->offset == offset)
|
||||
return evt->desc;
|
||||
if ((evt->code == code && evt->offset == offset) &&
|
||||
((evt->data == ALL_OFFSETS_SPECIFIED) ||
|
||||
((rec->event_data[0] & DATA_BYTE2_SPECIFIED_MASK) &&
|
||||
(evt->data == rec->event_data[1]))))
|
||||
{
|
||||
*desc = (char *)malloc(strlen(evt->desc) + 32);
|
||||
sprintf(*desc, "%s", evt->desc);
|
||||
return;
|
||||
}
|
||||
evt++;
|
||||
}
|
||||
|
||||
return "Unknown Event";
|
||||
}
|
||||
|
||||
static const char *
|
||||
@ -146,7 +133,7 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x40;
|
||||
req.msg.cmd = IPMI_CMD_GET_SEL_INFO;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
@ -183,7 +170,7 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
|
||||
/* get sel allocation info */
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x41;
|
||||
req.msg.cmd = IPMI_CMD_GET_SEL_ALLOC_INFO;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
@ -200,8 +187,8 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
|
||||
}
|
||||
}
|
||||
|
||||
static struct sel_event_record *
|
||||
ipmi_sel_get_std_entry(struct ipmi_intf * intf, unsigned short * next_id)
|
||||
static unsigned short
|
||||
ipmi_sel_get_std_entry(struct ipmi_intf * intf, unsigned short id, struct sel_event_record * evt)
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs * rsp;
|
||||
@ -211,111 +198,177 @@ ipmi_sel_get_std_entry(struct ipmi_intf * intf, unsigned short * next_id)
|
||||
memset(msg_data, 0, 6);
|
||||
msg_data[0] = 0x00; /* no reserve id, not partial get */
|
||||
msg_data[1] = 0x00;
|
||||
memcpy(msg_data+2, next_id, sizeof(*next_id));
|
||||
msg_data[2] = id & 0xff;
|
||||
msg_data[3] = (id >> 8) & 0xff;
|
||||
msg_data[4] = 0x00; /* offset */
|
||||
msg_data[5] = 0xff; /* length */
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x43;
|
||||
req.msg.cmd = IPMI_CMD_GET_SEL_ENTRY;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 6;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error%x in Get SEL Entry %x Command\n",
|
||||
rsp ? rsp->ccode : 0, *next_id);
|
||||
return NULL;
|
||||
printf("Error %x in Get SEL Entry %x Command\n",
|
||||
rsp ? rsp->ccode : 0, id);
|
||||
return 0;
|
||||
}
|
||||
if (verbose > 2)
|
||||
printbuf(rsp->data, rsp->data_len, "SEL Entry");
|
||||
|
||||
*next_id = (rsp->data[1] << 8) | rsp->data[0];
|
||||
|
||||
if (rsp->data[4] >= 0xc0) {
|
||||
printf("Not a standard SEL Entry!\n");
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (struct sel_event_record *) &rsp->data[2];
|
||||
memset(evt, 0, sizeof(*evt));
|
||||
evt->record_id = (rsp->data[3] << 8) | rsp->data[2];
|
||||
evt->record_type = rsp->data[4];
|
||||
evt->timestamp = (rsp->data[8] << 24) | (rsp->data[7] << 16) | (rsp->data[6] << 8) | rsp->data[5];
|
||||
evt->gen_id = (rsp->data[10] << 8) | rsp->data[9];
|
||||
evt->evm_rev = rsp->data[11];
|
||||
evt->sensor_type = rsp->data[12];
|
||||
evt->sensor_num = rsp->data[13];
|
||||
evt->event_type = rsp->data[14] & 0x7f;
|
||||
evt->event_dir = (rsp->data[14] & 0x80) >> 7;
|
||||
evt->event_data[0] = rsp->data[15];
|
||||
evt->event_data[1] = rsp->data[16];
|
||||
evt->event_data[2] = rsp->data[17];
|
||||
|
||||
return (rsp->data[1] << 8) | rsp->data[0];
|
||||
}
|
||||
|
||||
static char *
|
||||
ipmi_sel_timestamp(unsigned long stamp)
|
||||
ipmi_sel_timestamp(uint32_t stamp)
|
||||
{
|
||||
static unsigned char tbuf[40];
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&stamp));
|
||||
time_t s = (time_t)stamp;
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&s));
|
||||
return tbuf;
|
||||
}
|
||||
|
||||
static char *
|
||||
ipmi_sel_timestamp_date(unsigned long stamp)
|
||||
ipmi_sel_timestamp_date(uint32_t stamp)
|
||||
{
|
||||
static unsigned char tbuf[11];
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y", localtime(&stamp));
|
||||
time_t s = (time_t)stamp;
|
||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y", localtime(&s));
|
||||
return tbuf;
|
||||
}
|
||||
|
||||
static char *
|
||||
ipmi_sel_timestamp_time(unsigned long stamp)
|
||||
ipmi_sel_timestamp_time(uint32_t stamp)
|
||||
{
|
||||
static unsigned char tbuf[9];
|
||||
strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&stamp));
|
||||
time_t s = (time_t)stamp;
|
||||
strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&s));
|
||||
return tbuf;
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_sel_print_std_entry(int num, struct sel_event_record * evt)
|
||||
ipmi_sel_print_std_entry(struct sel_event_record * evt)
|
||||
{
|
||||
char * description;
|
||||
if (!evt)
|
||||
return;
|
||||
|
||||
if (csv_output)
|
||||
printf("%d,", num);
|
||||
printf("%x,", evt->record_id);
|
||||
else
|
||||
printf("%4d | ", num);
|
||||
printf("%4x | ", evt->record_id);
|
||||
|
||||
if (evt->timestamp < 0x20000000) {
|
||||
printf("Pre-Init Time-stamp");
|
||||
if (evt->record_type == 0xf0)
|
||||
{
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
else
|
||||
printf(" | ");
|
||||
printf(",,");
|
||||
|
||||
printf ("Linux kernel panic: %.11s\n", (char *) evt + 5);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
printf("%s", ipmi_sel_timestamp_date(evt->timestamp));
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
else
|
||||
printf(" | ");
|
||||
|
||||
printf("%s", ipmi_sel_timestamp_time(evt->timestamp));
|
||||
if (evt->record_type < 0xe0)
|
||||
{
|
||||
if (evt->timestamp < 0x20000000) {
|
||||
printf("Pre-Init Time-stamp");
|
||||
if (csv_output)
|
||||
printf(",,");
|
||||
else
|
||||
printf(" | ");
|
||||
}
|
||||
else {
|
||||
printf("%s", ipmi_sel_timestamp_date(evt->timestamp));
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
else
|
||||
printf(" | ");
|
||||
|
||||
printf("%s", ipmi_sel_timestamp_time(evt->timestamp));
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
else
|
||||
printf(" | ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (csv_output)
|
||||
printf(",");
|
||||
else
|
||||
printf(" | ");
|
||||
printf(",,");
|
||||
}
|
||||
|
||||
if (evt->record_type >= 0xc0)
|
||||
{
|
||||
printf ("OEM record %02x\n", evt->record_type);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%s #0x%02x", ipmi_sel_get_sensor_type(evt->sensor_type), evt->sensor_num);
|
||||
|
||||
if (csv_output)
|
||||
printf(",%s\n", ipmi_get_event_desc(evt));
|
||||
printf(",");
|
||||
else
|
||||
printf(" | %s\n", ipmi_get_event_desc(evt));
|
||||
printf(" | ");
|
||||
ipmi_get_event_desc(evt, &description);
|
||||
printf("%s\n", description ? description : "");
|
||||
free(description);
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_sel_print_std_entry_verbose(struct sel_event_record * evt)
|
||||
{
|
||||
char * description;
|
||||
if (!evt)
|
||||
return;
|
||||
|
||||
printf("SEL Record ID : %04x\n",
|
||||
evt->record_id);
|
||||
printf(" Record Type : %02x\n",
|
||||
evt->record_type);
|
||||
printf(" Timestamp : %s\n",
|
||||
ipmi_sel_timestamp(evt->timestamp));
|
||||
|
||||
if (evt->record_type == 0xf0)
|
||||
{
|
||||
printf (" Record Type : Linux kernel panic (OEM record %02x)\n", evt->record_type);
|
||||
printf (" Panic string : %.11s\n\n", (char *) evt + 5);
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt->record_type >= 0xc0)
|
||||
printf(" Record Type : OEM record %02x\n", evt->record_type >= 0xc0);
|
||||
else
|
||||
printf(" Record Type : %02x\n", evt->record_type);
|
||||
|
||||
if (evt->record_type < 0xe0)
|
||||
{
|
||||
printf(" Timestamp : %s\n",
|
||||
ipmi_sel_timestamp(evt->timestamp));
|
||||
}
|
||||
|
||||
if (evt->record_type >= 0xc0)
|
||||
{
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf(" Generator ID : %04x\n",
|
||||
evt->gen_id);
|
||||
printf(" EvM Revision : %02x\n",
|
||||
@ -330,8 +383,10 @@ ipmi_sel_print_std_entry_verbose(struct sel_event_record * evt)
|
||||
val2str(evt->event_dir, event_dir_vals));
|
||||
printf(" Event Data : %02x%02x%02x\n",
|
||||
evt->event_data[0], evt->event_data[1], evt->event_data[2]);
|
||||
ipmi_get_event_desc(evt, &description);
|
||||
printf(" Description : %s\n",
|
||||
ipmi_get_event_desc(evt));
|
||||
description ? description : "");
|
||||
free(description);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
@ -342,16 +397,33 @@ ipmi_sel_list_entries(struct ipmi_intf * intf)
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned short reserve_id, next_id = 0;
|
||||
int num = 1;
|
||||
struct sel_event_record * evt;
|
||||
struct sel_event_record evt;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x42; /* reserve SEL */
|
||||
req.msg.cmd = IPMI_CMD_GET_SEL_INFO;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x unable to reserve SEL\n",
|
||||
printf("Error: %x from Get SEL Info command\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return;
|
||||
}
|
||||
if (verbose > 2)
|
||||
printbuf(rsp->data, rsp->data_len, "sel_info");
|
||||
|
||||
if (!rsp->data[1] && !rsp->data[2]) {
|
||||
printf("SEL has no entries\n");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = IPMI_CMD_RESERVE_SEL;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error: %x from Reserve SEL command\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return;
|
||||
}
|
||||
@ -363,15 +435,15 @@ ipmi_sel_list_entries(struct ipmi_intf * intf)
|
||||
while (next_id != 0xffff) {
|
||||
if (verbose > 1)
|
||||
printf("SEL Next ID: %04x\n", next_id);
|
||||
/* next_id is updated by this function */
|
||||
evt = ipmi_sel_get_std_entry(intf, &next_id);
|
||||
if (!evt)
|
||||
|
||||
next_id = ipmi_sel_get_std_entry(intf, next_id, &evt);
|
||||
if (!next_id)
|
||||
break;
|
||||
|
||||
if (verbose)
|
||||
ipmi_sel_print_std_entry_verbose(evt);
|
||||
ipmi_sel_print_std_entry_verbose(&evt);
|
||||
else
|
||||
ipmi_sel_print_std_entry(num, evt);
|
||||
num++;
|
||||
ipmi_sel_print_std_entry(&evt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -383,7 +455,7 @@ ipmi_sel_reserve(struct ipmi_intf * intf)
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x42; /* reserve SEL */
|
||||
req.msg.cmd = IPMI_CMD_RESERVE_SEL;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
@ -417,7 +489,7 @@ ipmi_sel_clear(struct ipmi_intf * intf)
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = 0x47; /* clear SEL */
|
||||
req.msg.cmd = IPMI_CMD_CLEAR_SEL;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 6;
|
||||
|
||||
@ -430,18 +502,67 @@ ipmi_sel_clear(struct ipmi_intf * intf)
|
||||
printf("Clearing SEL. Please allow a few seconds to erase.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned short id;
|
||||
unsigned char msg_data[4];
|
||||
|
||||
if (!argc || !strncmp(argv[0], "help", 4))
|
||||
{
|
||||
printf("usage: delete [id ...]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
id = ipmi_sel_reserve(intf);
|
||||
if (id == 0)
|
||||
return;
|
||||
|
||||
memset(msg_data, 0, 4);
|
||||
msg_data[0] = id & 0xff;
|
||||
msg_data[1] = id >> 8;
|
||||
while (argc)
|
||||
{
|
||||
id = atoi(argv[argc-1]);
|
||||
msg_data[2] = id & 0xff;
|
||||
msg_data[3] = id >> 8;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||
req.msg.cmd = IPMI_CMD_DELETE_SEL_ENTRY;
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 4;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode)
|
||||
{
|
||||
if (!rsp) printf("No response\n");
|
||||
printf("Error %x unable to delete entry %d\n", rsp ? rsp->ccode : 0, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Deleted entry %d\n", id);
|
||||
}
|
||||
argc--;
|
||||
}
|
||||
}
|
||||
|
||||
int ipmi_sel_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc)
|
||||
ipmi_sel_get_info(intf);
|
||||
else if (!strncmp(argv[0], "help", 4))
|
||||
printf("SEL Commands: info clear list\n");
|
||||
printf("SEL Commands: info clear delete list\n");
|
||||
else if (!strncmp(argv[0], "info", 4))
|
||||
ipmi_sel_get_info(intf);
|
||||
else if (!strncmp(argv[0], "list", 4))
|
||||
ipmi_sel_list_entries(intf);
|
||||
else if (!strncmp(argv[0], "clear", 5))
|
||||
ipmi_sel_clear(intf);
|
||||
else if (!strncmp(argv[0], "delete", 6))
|
||||
ipmi_sel_delete(intf, argc-1, &argv[1]);
|
||||
else
|
||||
printf("Invalid SEL command: %s\n", argv[0]);
|
||||
return 0;
|
||||
|
155
ipmitool/lib/ipmi_sensor.c
Normal file
155
ipmitool/lib/ipmi_sensor.c
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* 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 <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_sdr.h>
|
||||
#include <ipmitool/ipmi_sensor.h>
|
||||
|
||||
extern int verbose;
|
||||
|
||||
#define READING_UNAVAILABLE 0x20
|
||||
#define SCANNING_DISABLED 0x80
|
||||
|
||||
static void
|
||||
ipmi_get_sensor_info_compact(struct ipmi_intf * intf,
|
||||
struct sdr_record_compact_sensor * sensor)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_get_sensor_info_full(struct ipmi_intf * intf,
|
||||
struct sdr_record_full_sensor * sensor)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
char sval[16], unitstr[16], desc[17];
|
||||
float val, tol;
|
||||
unsigned raw_tol;
|
||||
int i=0, not_available=0;
|
||||
|
||||
memset(desc, 0, sizeof(desc));
|
||||
memcpy(desc, sensor->id_string, 16);
|
||||
|
||||
rsp = ipmi_sdr_get_sensor_reading(intf, sensor->keys.sensor_num);
|
||||
if ((rsp && (rsp->data[1] & READING_UNAVAILABLE)) ||
|
||||
(rsp && !(rsp->data[1] & SCANNING_DISABLED)))
|
||||
not_available = 1;
|
||||
else {
|
||||
memset(unitstr, 0, sizeof(unitstr));
|
||||
/* determine units with possible modifiers */
|
||||
switch (sensor->unit.modifier) {
|
||||
case 2:
|
||||
i += snprintf(unitstr, sizeof(unitstr), "%s * %s",
|
||||
unit_desc[sensor->unit.type.base],
|
||||
unit_desc[sensor->unit.type.modifier]);
|
||||
break;
|
||||
case 1:
|
||||
i += snprintf(unitstr, sizeof(unitstr), "%s/%s",
|
||||
unit_desc[sensor->unit.type.base],
|
||||
unit_desc[sensor->unit.type.modifier]);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
i += snprintf(unitstr, sizeof(unitstr), "%s",
|
||||
unit_desc[sensor->unit.type.base]);
|
||||
break;
|
||||
}
|
||||
|
||||
val = sdr_convert_sensor_reading(sensor, rsp->data[0]);
|
||||
raw_tol = (sensor->mtol & 0x3f00) >> 8;
|
||||
tol = sdr_convert_sensor_reading(sensor, raw_tol * 2);
|
||||
}
|
||||
|
||||
if (!verbose) {
|
||||
/*
|
||||
* print sensor name, reading, state
|
||||
*/
|
||||
printf("%-16s | ", sensor->id_code ? desc : NULL);
|
||||
|
||||
i = 0;
|
||||
memset(sval, 0, sizeof(sval));
|
||||
if (not_available) {
|
||||
i += snprintf(sval, sizeof(sval), "no reading ");
|
||||
} else {
|
||||
i += snprintf(sval, sizeof(sval), "%.*f %s", (val==(int)val) ? 0 : 3, val, unitstr);
|
||||
}
|
||||
printf("%s", sval);
|
||||
|
||||
i--;
|
||||
for (; i<sizeof(sval); i++)
|
||||
printf(" ");
|
||||
printf(" | ");
|
||||
|
||||
printf("%s", ipmi_sdr_get_status(rsp->data[2]));
|
||||
printf("\n");
|
||||
} else {
|
||||
printf("Sensor ID : %s (0x%x)\n", desc, sensor->keys.sensor_num);
|
||||
if (not_available)
|
||||
printf("Sensor Reading : Unavailable");
|
||||
else
|
||||
printf("Sensor Reading : %.*f (+/- %.*f) %s\n",
|
||||
(val==(int)val) ? 0 : 3,
|
||||
val,
|
||||
(tol==(int)tol) ? 0 : 3,
|
||||
tol,
|
||||
unitstr);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_sensor_list(struct ipmi_intf * intf)
|
||||
{
|
||||
ipmi_sdr_print_sdr(intf, 0xff);
|
||||
}
|
||||
|
||||
int
|
||||
ipmi_sensor_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
if (!argc)
|
||||
ipmi_sensor_list(intf);
|
||||
else if (!strncmp(argv[0], "help", 4)) {
|
||||
printf("Sensor Commands: list\n");
|
||||
}
|
||||
else if (!strncmp(argv[0], "list", 4)) {
|
||||
ipmi_sensor_list(intf);
|
||||
}
|
||||
else
|
||||
printf("Invalid sensor command: %s\n", argv[0]);
|
||||
return 0;
|
||||
}
|
260
ipmitool/main.c
260
ipmitool/main.c
@ -1,260 +0,0 @@
|
||||
/*
|
||||
* 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 <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <helper.h>
|
||||
#include <ipmi.h>
|
||||
|
||||
#include <ipmi_dev.h>
|
||||
#include <ipmi_lan.h>
|
||||
|
||||
#include <ipmi_sdr.h>
|
||||
#include <ipmi_sel.h>
|
||||
#include <ipmi_fru.h>
|
||||
#include <ipmi_chassis.h>
|
||||
|
||||
int csv_output = 0;
|
||||
extern int verbose;
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
printf("ipmitool version %s\n", VERSION);
|
||||
printf("\n");
|
||||
printf("usage: ipmitool [options...] <command>\n");
|
||||
printf("\n");
|
||||
printf(" -h this help\n");
|
||||
printf(" -V Show version information\n");
|
||||
printf(" -v verbose (can use multiple times)\n");
|
||||
printf(" -c CSV output suitable for parsing\n");
|
||||
printf(" -I intf Inteface: lan, dev\n");
|
||||
printf(" -H hostname Remote host name for LAN interface\n");
|
||||
printf(" -P password Power commands: down, up, cycle, reset, pulse, soft\n");
|
||||
printf("\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
{
|
||||
struct ipmi_rsp * rsp;
|
||||
struct ipmi_req req;
|
||||
unsigned char netfn, cmd;
|
||||
int i;
|
||||
unsigned char data[32];
|
||||
|
||||
if (argc < 2 || !strncmp(argv[0], "help", 4)) {
|
||||
printf("RAW Commands: raw <netfn> <cmd> [data]\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
netfn = strtod(argv[0], NULL);
|
||||
cmd = strtod(argv[1], NULL);
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = netfn;
|
||||
req.msg.cmd = cmd;
|
||||
req.msg.data = data;
|
||||
|
||||
for (i=2; i<argc; i++) {
|
||||
unsigned char val = strtod(argv[i], NULL);
|
||||
req.msg.data[i-2] = val;
|
||||
req.msg.data_len++;
|
||||
}
|
||||
if (req.msg.data_len) {
|
||||
for (i=0; i<req.msg.data_len; i++) {
|
||||
if (((i%16) == 0) && (i != 0))
|
||||
printf("\n");
|
||||
printf(" %2.2x", req.msg.data[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("RAW REQ (netfn=0x%x cmd=0x%x data_len=%d)\n",
|
||||
req.msg.netfn, req.msg.cmd, req.msg.data_len);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x sending RAW command\n",
|
||||
rsp ? rsp->ccode : 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("RAW RSP (%d bytes)\n", rsp->data_len);
|
||||
|
||||
for (i=0; i<rsp->data_len; i++) {
|
||||
if (((i%16) == 0) && (i != 0))
|
||||
printf("\n");
|
||||
printf(" %2.2x", rsp->data[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
int (*submain)(struct ipmi_intf *, int, char **);
|
||||
struct ipmi_intf * intf = NULL;
|
||||
char * hostname = NULL, * password = NULL;
|
||||
int argflag, rc=0, port = 623;
|
||||
|
||||
while ((argflag = getopt(argc, (char **)argv, "hVvcI:H:P:p:")) != -1)
|
||||
{
|
||||
switch (argflag) {
|
||||
case 'h':
|
||||
usage();
|
||||
break;
|
||||
case 'V':
|
||||
printf("ipmitool version %s\n", VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 'c':
|
||||
csv_output = 1;
|
||||
break;
|
||||
case 'I':
|
||||
if (!strncmp(optarg, "lan", 3))
|
||||
intf = &ipmi_lan_intf;
|
||||
else if (!strncmp(optarg, "dev", 3))
|
||||
intf = &ipmi_dev_intf;
|
||||
break;
|
||||
case 'H':
|
||||
hostname = strdup(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
password = strdup(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
port = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argc-optind <= 0) {
|
||||
printf("No command provided!\n");
|
||||
usage();
|
||||
}
|
||||
|
||||
if (!intf) {
|
||||
printf("No interface specified!\n");
|
||||
usage();
|
||||
}
|
||||
|
||||
if (!strncmp(argv[optind], "help", 4)) {
|
||||
printf("Commands: chassis, fru, lan, sdr, sel\n");
|
||||
goto out_free;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "chassis", 7)) {
|
||||
submain = ipmi_chassis_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "fru", 3)) {
|
||||
submain = ipmi_fru_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "lan", 3)) {
|
||||
submain = ipmi_lan_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "sdr", 3)) {
|
||||
submain = ipmi_sdr_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "sel", 3)) {
|
||||
submain = ipmi_sel_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "raw", 3)) {
|
||||
submain = ipmi_raw_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "chaninfo", 8)) {
|
||||
if (argc-optind-1 > 0) {
|
||||
unsigned char c = strtod(argv[optind+1], NULL);
|
||||
if (intf->open(intf, hostname, port, password) < 0)
|
||||
goto out_free;
|
||||
verbose++;
|
||||
ipmi_get_channel_info(intf, c);
|
||||
verbose--;
|
||||
goto out_close;
|
||||
}
|
||||
else {
|
||||
printf("chaninfo <channel>\n");
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("Invalid comand: %s\n", argv[optind]);
|
||||
rc = -1;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
if (!submain)
|
||||
goto out_free;
|
||||
|
||||
if (intf->open) {
|
||||
rc = intf->open(intf, hostname, port, password);
|
||||
if (rc < 0) {
|
||||
printf("unable to open interface\n");
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
|
||||
rc = submain(intf, argc-optind-1, &(argv[optind+1]));
|
||||
|
||||
out_close:
|
||||
if (intf->close)
|
||||
intf->close(intf);
|
||||
|
||||
out_free:
|
||||
if (hostname)
|
||||
free(hostname);
|
||||
if (password)
|
||||
free(password);
|
||||
|
||||
if (!rc)
|
||||
exit(EXIT_SUCCESS);
|
||||
else
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
@ -38,23 +38,17 @@ SUBDIRS = plugins
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
if IPMIEVD
|
||||
|
||||
EXTRA_DIST = bmcautoconf.sh
|
||||
bin_PROGRAMS = ipmievd ipmitool
|
||||
ipmievd_SOURCES = ipmievd.c
|
||||
ipmievd_LDADD = $(top_srcdir)/lib/libipmitool.la
|
||||
ipmievd_LDFLAGS =
|
||||
|
||||
ipmievd_LDADD = $(top_srcdir)/lib/libipmitool.la $(top_srcdir)/src/plugins/libintf.la
|
||||
else
|
||||
|
||||
EXTRA_DIST = bmcautoconf.sh ipmievd.c
|
||||
bin_PROGRAMS = ipmitool
|
||||
|
||||
endif
|
||||
|
||||
ipmitool_SOURCES = ipmitool.c
|
||||
ipmitool_LDADD = $(top_srcdir)/lib/libipmitool.la
|
||||
ipmitool_LDFLAGS =
|
||||
ipmitool_LDADD = $(top_srcdir)/lib/libipmitool.la $(top_srcdir)/src/plugins/libintf.la
|
||||
|
||||
bin_SCRIPTS = bmcautoconf.sh
|
||||
|
||||
|
@ -129,7 +129,7 @@ fi
|
||||
|
||||
# Default Route MAC Address
|
||||
# (ping it first to populate arp table)
|
||||
$PING -q -c1 >/dev/null 2>&1
|
||||
$PING -q -c1 $DEF_ROUTE_IP >/dev/null 2>&1
|
||||
DEF_ROUTE_MAC=$( $ARP -an -i $IFACE | grep "$DEF_ROUTE_IP[^0-9]" | awk '{ print $4 }' )
|
||||
if [ X$DEF_ROUTE_MAC = X ]; then
|
||||
echo "Unable to determine default route MAC address"
|
||||
@ -145,5 +145,8 @@ ipmitool_lan_set "defgw macaddr" $DEF_ROUTE_MAC
|
||||
ipmitool_lan_set "auth callback,user,operator,admin" "md2,md5"
|
||||
ipmitool_lan_set "access" "on"
|
||||
ipmitool_lan_set "user"
|
||||
ipmitool_lan_set "arp generate" "on"
|
||||
ipmitool_lan_set "arp interval" "8"
|
||||
|
||||
exit 0
|
||||
|
||||
|
@ -56,7 +56,6 @@
|
||||
extern int errno;
|
||||
int verbose = 0;
|
||||
int csv_output = 0;
|
||||
int num = 0;
|
||||
|
||||
static int enable_event_msg_buffer(struct ipmi_intf * intf)
|
||||
{
|
||||
@ -145,7 +144,7 @@ static void read_event(struct ipmi_intf * intf)
|
||||
if (verbose)
|
||||
ipmi_sel_print_std_entry_verbose((struct sel_event_record *)recv.msg.data);
|
||||
else
|
||||
ipmi_sel_print_std_entry(num++, (struct sel_event_record *)recv.msg.data);
|
||||
ipmi_sel_print_std_entry((struct sel_event_record *)recv.msg.data);
|
||||
}
|
||||
|
||||
static int do_exit(struct ipmi_intf * intf, int rv)
|
||||
@ -205,7 +204,7 @@ int main(int argc, char ** argv)
|
||||
printf("Connecting to OpenIPMI device.\n");
|
||||
|
||||
/* open connection to openipmi device */
|
||||
r = intf->open(intf, NULL, 0, NULL);
|
||||
r = intf->open(intf, NULL, 0, NULL, NULL);
|
||||
if (r < 0) {
|
||||
printf("ERROR: Unable to open OpenIPMI device\n");
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include <ipmitool/ipmi_lanp.h>
|
||||
#include <ipmitool/ipmi_chassis.h>
|
||||
#include <ipmitool/ipmi_bmc.h>
|
||||
#include <ipmitool/ipmi_sensor.h>
|
||||
|
||||
struct ipmi_session lan_session;
|
||||
int csv_output = 0;
|
||||
@ -93,8 +94,8 @@ int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
netfn = strtod(argv[0], NULL);
|
||||
cmd = strtod(argv[1], NULL);
|
||||
netfn = (unsigned char)strtol(argv[0], NULL, 0);
|
||||
cmd = (unsigned char)strtol(argv[1], NULL, 0);
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -103,7 +104,7 @@ int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
req.msg.data = data;
|
||||
|
||||
for (i=2; i<argc; i++) {
|
||||
unsigned char val = strtod(argv[i], NULL);
|
||||
unsigned char val = (unsigned char)strtol(argv[i], NULL, 0);
|
||||
req.msg.data[i-2] = val;
|
||||
req.msg.data_len++;
|
||||
}
|
||||
@ -174,7 +175,7 @@ ipmi_get_user_access(struct ipmi_intf * intf, unsigned char channel, unsigned ch
|
||||
}
|
||||
|
||||
static int
|
||||
ipmi_send_platform_event(struct ipmi_intf * intf)
|
||||
ipmi_send_platform_event(struct ipmi_intf * intf, int num)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
@ -183,35 +184,61 @@ ipmi_send_platform_event(struct ipmi_intf * intf)
|
||||
memset(&req, 0, sizeof(req));
|
||||
memset(rqdata, 0, 8);
|
||||
|
||||
#if 0
|
||||
/* System Interface */
|
||||
rqdata[0] = 0x20; /* generator ID */
|
||||
rqdata[1] = 0x04; /* EvMRev */
|
||||
rqdata[2] = 0x01; /* Sensor Type */
|
||||
rqdata[3] = 0x30; /* Sensor # */
|
||||
rqdata[4] = 0x04; /* Event Dir / Event Type */
|
||||
rqdata[5] = 0x00; /* Event Data 1 */
|
||||
rqdata[6] = 0x00; /* Event Data 2 */
|
||||
rqdata[7] = 0x00; /* Event Data 3 */
|
||||
#else
|
||||
printf("Sending ");
|
||||
|
||||
/* IPMB/LAN/etc */
|
||||
rqdata[0] = 0x04; /* EvMRev */
|
||||
rqdata[1] = 0x01; /* Sensor Type */
|
||||
rqdata[2] = 0x30; /* Sensor # */
|
||||
rqdata[3] = 0x04; /* Event Dir / Event Type */
|
||||
rqdata[4] = 0x00; /* Event Data 1 */
|
||||
rqdata[5] = 0x00; /* Event Data 2 */
|
||||
rqdata[6] = 0x00; /* Event Data 3 */
|
||||
#endif
|
||||
switch (num) {
|
||||
case 0: /* temperature */
|
||||
printf("Temperature");
|
||||
rqdata[0] = 0x04; /* EvMRev */
|
||||
rqdata[1] = 0x01; /* Sensor Type */
|
||||
rqdata[2] = 0x30; /* Sensor # */
|
||||
rqdata[3] = 0x04; /* Event Dir / Event Type */
|
||||
rqdata[4] = 0x00; /* Event Data 1 */
|
||||
rqdata[5] = 0x00; /* Event Data 2 */
|
||||
rqdata[6] = 0x00; /* Event Data 3 */
|
||||
break;
|
||||
case 1: /* correctable ECC */
|
||||
printf("Memory Correctable ECC");
|
||||
rqdata[0] = 0x04; /* EvMRev */
|
||||
rqdata[1] = 0x0c; /* Sensor Type */
|
||||
rqdata[2] = 0x01; /* Sensor # */
|
||||
rqdata[3] = 0x6f; /* Event Dir / Event Type */
|
||||
rqdata[4] = 0x00; /* Event Data 1 */
|
||||
rqdata[5] = 0x00; /* Event Data 2 */
|
||||
rqdata[6] = 0x00; /* Event Data 3 */
|
||||
break;
|
||||
case 2: /* uncorrectable ECC */
|
||||
printf("Memory Uncorrectable ECC");
|
||||
rqdata[0] = 0x04; /* EvMRev */
|
||||
rqdata[1] = 0x0c; /* Sensor Type */
|
||||
rqdata[2] = 0x01; /* Sensor # */
|
||||
rqdata[3] = 0x6f; /* Event Dir / Event Type */
|
||||
rqdata[4] = 0x01; /* Event Data 1 */
|
||||
rqdata[5] = 0x00; /* Event Data 2 */
|
||||
rqdata[6] = 0x00; /* Event Data 3 */
|
||||
break;
|
||||
case 3: /* parity error */
|
||||
printf("Memory Parity Error");
|
||||
rqdata[0] = 0x04; /* EvMRev */
|
||||
rqdata[1] = 0x0c; /* Sensor Type */
|
||||
rqdata[2] = 0x01; /* Sensor # */
|
||||
rqdata[3] = 0x6f; /* Event Dir / Event Type */
|
||||
rqdata[4] = 0x02; /* Event Data 1 */
|
||||
rqdata[5] = 0x00; /* Event Data 2 */
|
||||
rqdata[6] = 0x00; /* Event Data 3 */
|
||||
break;
|
||||
default:
|
||||
printf("Invalid event number: %d\n", num);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf(" event to BMC\n");
|
||||
|
||||
req.msg.netfn = IPMI_NETFN_SE;
|
||||
req.msg.cmd = 0x02;
|
||||
req.msg.data = rqdata;
|
||||
#if 0
|
||||
req.msg.data_len = 8;
|
||||
#else
|
||||
req.msg.data_len = 7;
|
||||
#endif
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
@ -226,14 +253,14 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
int (*submain)(struct ipmi_intf *, int, char **);
|
||||
struct ipmi_intf * intf = NULL;
|
||||
char * hostname = NULL, * password = NULL;
|
||||
char * hostname = NULL, * password = NULL, * username = NULL;
|
||||
int argflag, i, rc=0, port = 623, pedantic = 0;
|
||||
char intfname[32];
|
||||
|
||||
if (ipmi_intf_init() < 0)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
while ((argflag = getopt(argc, (char **)argv, "hVvcgI:H:P:p:")) != -1)
|
||||
while ((argflag = getopt(argc, (char **)argv, "hVvcgI:H:P:U:p:")) != -1)
|
||||
{
|
||||
switch (argflag) {
|
||||
case 'h':
|
||||
@ -267,6 +294,9 @@ int main(int argc, char ** argv)
|
||||
case 'P':
|
||||
password = strdup(optarg);
|
||||
break;
|
||||
case 'U':
|
||||
username = strdup(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
port = atoi(optarg);
|
||||
break;
|
||||
@ -288,14 +318,20 @@ int main(int argc, char ** argv)
|
||||
intf->pedantic = pedantic;
|
||||
|
||||
if (!strncmp(argv[optind], "help", 4)) {
|
||||
printf("Commands: chassis, fru, lan, sdr, sel\n");
|
||||
printf("Commands: bmc, chaninfo, chassis, event, fru, lan, raw, sdr, sel, sensor, sol, userinfo\n");
|
||||
goto out_free;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "event", 5)) {
|
||||
if (intf->open(intf, hostname, port, password) < 0)
|
||||
if (argc-optind-1 > 0) {
|
||||
unsigned char c = (unsigned char)strtol(argv[optind+1], NULL, 0);
|
||||
if (intf->open(intf, hostname, port, username, password) < 0)
|
||||
goto out_free;
|
||||
ipmi_send_platform_event(intf, c);
|
||||
goto out_close;
|
||||
} else {
|
||||
printf("event <num>\n");
|
||||
goto out_free;
|
||||
ipmi_send_platform_event(intf);
|
||||
goto out_close;
|
||||
}
|
||||
}
|
||||
else if (!strncmp(argv[optind], "bmc", 3)) {
|
||||
submain = ipmi_bmc_main;
|
||||
@ -315,6 +351,9 @@ int main(int argc, char ** argv)
|
||||
else if (!strncmp(argv[optind], "sel", 3)) {
|
||||
submain = ipmi_sel_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "sensor", 6)) {
|
||||
submain = ipmi_sensor_main;
|
||||
}
|
||||
else if (!strncmp(argv[optind], "sol", 3)) {
|
||||
submain = ipmi_sol_main;
|
||||
}
|
||||
@ -323,8 +362,8 @@ int main(int argc, char ** argv)
|
||||
}
|
||||
else if (!strncmp(argv[optind], "userinfo", 8)) {
|
||||
if (argc-optind-1 > 0) {
|
||||
unsigned char c = strtod(argv[optind+1], NULL);
|
||||
rc = intf->open(intf, hostname, port, password);
|
||||
unsigned char c = (unsigned char)strtol(argv[optind+1], NULL, 0);
|
||||
rc = intf->open(intf, hostname, port, username, password);
|
||||
if (rc < 0)
|
||||
goto out_free;
|
||||
ipmi_get_user_access(intf, c, 1);
|
||||
@ -337,8 +376,8 @@ int main(int argc, char ** argv)
|
||||
}
|
||||
else if (!strncmp(argv[optind], "chaninfo", 8)) {
|
||||
if (argc-optind-1 > 0) {
|
||||
unsigned char c = strtod(argv[optind+1], NULL);
|
||||
rc = intf->open(intf, hostname, port, password);
|
||||
unsigned char c = (unsigned char)strtol(argv[optind+1], NULL, 0);
|
||||
rc = intf->open(intf, hostname, port, username, password);
|
||||
if (rc < 0)
|
||||
goto out_free;
|
||||
verbose++;
|
||||
@ -361,7 +400,7 @@ int main(int argc, char ** argv)
|
||||
goto out_free;
|
||||
|
||||
if (intf->open) {
|
||||
rc = intf->open(intf, hostname, port, password);
|
||||
rc = intf->open(intf, hostname, port, username, password);
|
||||
if (rc < 0)
|
||||
goto out_free;
|
||||
}
|
||||
@ -377,6 +416,8 @@ int main(int argc, char ** argv)
|
||||
out_free:
|
||||
if (hostname)
|
||||
free(hostname);
|
||||
if (username)
|
||||
free(username);
|
||||
if (password)
|
||||
free(password);
|
||||
|
||||
|
@ -32,8 +32,18 @@
|
||||
# in the design, construction, operation or maintenance of any nuclear
|
||||
# facility.
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
plugindir = $(pluginpath)
|
||||
|
||||
plugindir = $(pluginpath)
|
||||
INCLUDES = -I$(top_srcdir)/include $(INCLTDL)
|
||||
MAINTAINERCLEANFILES = Makefile.in ipmi_intf_static.c
|
||||
EXTRA_DIST = ipmi_intf_static.c.in
|
||||
|
||||
SUBDIRS = @INTF_LAN@ @INTF_OPEN@
|
||||
DIST_SUBDIRS = lan open
|
||||
|
||||
noinst_LTLIBRARIES = libintf.la
|
||||
libintf_la_SOURCES = ipmi_intf.c ipmi_intf_static.c
|
||||
libintf_la_LDFLAGS = -export-dynamic
|
||||
libintf_la_LIBADD = $(LIBLTDL) @STATIC_INTF_LIB@
|
||||
libintf_la_DEPENDENCIES = $(LIBLTDL) @STATIC_INTF_LIB@
|
||||
|
||||
SUBDIRS = @PLUGINS@
|
||||
|
@ -42,6 +42,8 @@
|
||||
#include <ipmitool/ipmi_intf.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
extern struct static_intf static_intf_list[];
|
||||
|
||||
/* ipmi_intf_init
|
||||
* initialize dynamic plugin interface
|
||||
*/
|
||||
@ -78,23 +80,43 @@ struct ipmi_intf * ipmi_intf_load(char * name)
|
||||
{
|
||||
lt_dlhandle handle;
|
||||
struct ipmi_intf * intf;
|
||||
int (*intf_setup)(struct ipmi_intf ** intf);
|
||||
int (*setup)(struct ipmi_intf ** intf);
|
||||
struct static_intf *i = static_intf_list;
|
||||
char libname[16];
|
||||
|
||||
handle = lt_dlopenext(name);
|
||||
if (handle == NULL) {
|
||||
while (i->name) {
|
||||
if (!strcmp(name, i->name)) {
|
||||
if (i->setup(&intf) < 0) {
|
||||
printf("ERROR: Unable to setup static interface %s\n", name);
|
||||
return NULL;
|
||||
}
|
||||
return intf;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
memset(libname, 0, 16);
|
||||
if (snprintf(libname, sizeof(libname), "lib%s", name) <= 0) {
|
||||
printf("ERROR: Unable to find plugin '%s' in '%s'\n",
|
||||
name, PLUGIN_PATH);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
intf_setup = lt_dlsym(handle, "intf_setup");
|
||||
if (!intf_setup) {
|
||||
handle = lt_dlopenext(libname);
|
||||
if (handle == NULL) {
|
||||
printf("ERROR: Unable to find plugin '%s' in '%s'\n",
|
||||
libname, PLUGIN_PATH);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
setup = lt_dlsym(handle, "intf_setup");
|
||||
if (!setup) {
|
||||
printf("ERROR: Unable to find interface setup symbol in plugin %s\n", name);
|
||||
lt_dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (intf_setup(&intf) < 0) {
|
||||
if (setup(&intf) < 0) {
|
||||
printf("ERROR: Unable to run interface setup for plugin %s\n", name);
|
||||
lt_dlclose(handle);
|
||||
return NULL;
|
@ -34,16 +34,16 @@
|
||||
* facility.
|
||||
*/
|
||||
|
||||
#ifndef _IPMI_DEV_H
|
||||
#define _IPMI_DEV_H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <linux/ipmi.h>
|
||||
#include "ipmi.h"
|
||||
#include <config.h>
|
||||
#include <ipmitool/ipmi_intf.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
|
||||
struct ipmi_rsp * ipmi_dev_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req);
|
||||
int ipmi_dev_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2);
|
||||
void ipmi_dev_close(struct ipmi_intf * intf);
|
||||
@STATIC_INTF_EXT@
|
||||
|
||||
struct ipmi_intf ipmi_dev_intf;
|
||||
|
||||
#endif
|
||||
struct static_intf static_intf_list[] = {
|
||||
@STATIC_INTF@
|
||||
{ 0, 0 }
|
||||
};
|
@ -38,7 +38,10 @@ plugindir = $(pluginpath)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
intf_lan_la_LDFLAGS = -module -avoid-version
|
||||
plugin_LTLIBRARIES = intf_lan.la
|
||||
intf_lan_la_SOURCES = lan.c lan.h asf.h rmcp.h md5.c md5.h
|
||||
EXTRA_LTLIBRARIES = libintf_lan.la
|
||||
plugin_LTLIBRARIES = @PLUGIN_INTF_LAN@
|
||||
noinst_LTLIBRARIES = @STATIC_INTF_LAN@
|
||||
libintf_lan_la_LDFLAGS = @LDFLAGS_INTF_LAN@
|
||||
libintf_lan_la_LIBADD = $(top_srcdir)/lib/libipmitool.la
|
||||
libintf_lan_la_SOURCES = lan.c lan.h asf.h rmcp.h md5.c md5.h
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -83,25 +84,6 @@ query_alarm(int signo)
|
||||
siglongjmp(jmpbuf, 1);
|
||||
}
|
||||
|
||||
const struct valstr ipmi_privlvl_vals[] = {
|
||||
{ IPMI_SESSION_PRIV_CALLBACK, "CALLBACK" },
|
||||
{ IPMI_SESSION_PRIV_USER, "USER" },
|
||||
{ IPMI_SESSION_PRIV_OPERATOR, "OPERATOR" },
|
||||
{ IPMI_SESSION_PRIV_ADMIN, "ADMINISTRATOR" },
|
||||
{ IPMI_SESSION_PRIV_OEM, "OEM" },
|
||||
{ 0xF, "NO ACCESS" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
const struct valstr ipmi_authtype_vals[] = {
|
||||
{ IPMI_SESSION_AUTHTYPE_NONE, "NONE" },
|
||||
{ IPMI_SESSION_AUTHTYPE_MD2, "MD2" },
|
||||
{ IPMI_SESSION_AUTHTYPE_MD5, "MD5" },
|
||||
{ IPMI_SESSION_AUTHTYPE_KEY, "PASSWORD" },
|
||||
{ IPMI_SESSION_AUTHTYPE_OEM, "OEM" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
static const struct valstr ipmi_channel_protocol_vals[] = {
|
||||
{ 0x00, "reserved" },
|
||||
{ 0x01, "IPMB-1.0" },
|
||||
@ -297,8 +279,8 @@ ipmi_handle_pong(struct ipmi_intf * intf, struct ipmi_rs * rsp)
|
||||
struct rmcp_pong {
|
||||
struct rmcp_hdr rmcp;
|
||||
struct asf_hdr asf;
|
||||
unsigned long iana;
|
||||
unsigned long oem;
|
||||
uint32_t iana;
|
||||
uint32_t oem;
|
||||
unsigned char sup_entities;
|
||||
unsigned char sup_interact;
|
||||
unsigned char reserved[6];
|
||||
@ -455,7 +437,8 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf)
|
||||
}
|
||||
|
||||
if (rmcp_rsp.class != RMCP_CLASS_IPMI) {
|
||||
printf("Invalid RMCP class: %x\n", rmcp_rsp.class);
|
||||
if (verbose > 1)
|
||||
printf("Invalid RMCP class: %x\n", rmcp_rsp.class);
|
||||
rsp = ipmi_lan_recv_packet(intf);
|
||||
continue;
|
||||
}
|
||||
@ -599,8 +582,10 @@ ipmi_lan_build_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
/* ipmi session header */
|
||||
msg[len++] = lan_session.active ? lan_session.authtype : 0;
|
||||
|
||||
memcpy(msg+len, &lan_session.in_seq, 4);
|
||||
len += 4;
|
||||
msg[len++] = lan_session.in_seq & 0xff;
|
||||
msg[len++] = (lan_session.in_seq >> 8) & 0xff;
|
||||
msg[len++] = (lan_session.in_seq >> 16) & 0xff;
|
||||
msg[len++] = (lan_session.in_seq >> 24) & 0xff;
|
||||
memcpy(msg+len, &lan_session.id, 4);
|
||||
len += 4;
|
||||
|
||||
@ -716,101 +701,6 @@ ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
return rsp;
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rq req;
|
||||
unsigned char rqdata[2];
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x42;
|
||||
req.msg.data = &channel;
|
||||
req.msg.data_len = 1;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x Get Channel Info Command (0x%x)\n",
|
||||
rsp ? rsp->ccode : 0, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!verbose)
|
||||
return;
|
||||
|
||||
printf("Channel 0x%x info:\n", rsp->data[0] & 0xf);
|
||||
|
||||
printf(" Channel Medium Type : %s\n",
|
||||
val2str(rsp->data[1] & 0x7f, ipmi_channel_medium_vals));
|
||||
|
||||
printf(" Channel Protocol Type : %s\n",
|
||||
val2str(rsp->data[2] & 0x1f, ipmi_channel_protocol_vals));
|
||||
|
||||
printf(" Session Support : ");
|
||||
switch (rsp->data[3] & 0xc0) {
|
||||
case 0x00:
|
||||
printf("session-less\n");
|
||||
break;
|
||||
case 0x40:
|
||||
printf("single-session\n");
|
||||
break;
|
||||
case 0x80:
|
||||
printf("multi-session\n");
|
||||
break;
|
||||
case 0xc0:
|
||||
default:
|
||||
printf("session-based\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" Active Session Count : %d\n",
|
||||
rsp->data[3] & 0x3f);
|
||||
printf(" Protocol Vendor ID : %d\n",
|
||||
rsp->data[4] | rsp->data[5] << 8 | rsp->data[6] << 16);
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
rqdata[0] = channel & 0xf;
|
||||
rqdata[1] = 0x80; /* 0x80=active, 0x40=non-volatile */
|
||||
req.msg.netfn = IPMI_NETFN_APP;
|
||||
req.msg.cmd = 0x41;
|
||||
req.msg.data = rqdata;
|
||||
req.msg.data_len = 2;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (!rsp || rsp->ccode) {
|
||||
printf("Error:%x Get Channel Access Command (0x%x)\n",
|
||||
rsp ? rsp->ccode : 0, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
printf(" Alerting : %sabled\n",
|
||||
(rsp->data[0] & 0x20) ? "dis" : "en");
|
||||
printf(" Per-message Auth : %sabled\n",
|
||||
(rsp->data[0] & 0x10) ? "dis" : "en");
|
||||
printf(" User Level Auth : %sabled\n",
|
||||
(rsp->data[0] & 0x08) ? "dis" : "en");
|
||||
printf(" Access Mode : ");
|
||||
switch (rsp->data[0] & 0x7) {
|
||||
case 0:
|
||||
printf("disabled\n");
|
||||
break;
|
||||
case 1:
|
||||
printf("pre-boot only\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("always available\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("shared\n");
|
||||
break;
|
||||
default:
|
||||
printf("unknown\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* IPMI Get Channel Authentication Capabilities Command
|
||||
*/
|
||||
@ -844,7 +734,7 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
if (verbose > 1) {
|
||||
printf("Channel %02x Authentication Capabilities:\n",
|
||||
rsp->data[0]);
|
||||
printf(" Privilege Level : %s\n",
|
||||
@ -890,7 +780,7 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
if (verbose > 1)
|
||||
printf("Proceeding with AuthType %s\n",
|
||||
val2str(lan_session.authtype, ipmi_authtype_vals));
|
||||
|
||||
@ -944,7 +834,7 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
|
||||
memcpy(&lan_session.id, rsp->data, 4);
|
||||
memcpy(lan_session.challenge, rsp->data + 4, 16);
|
||||
|
||||
if (verbose) {
|
||||
if (verbose > 1) {
|
||||
printf("Opening Session\n");
|
||||
printf(" Session ID : %08lx\n",
|
||||
lan_session.id);
|
||||
@ -976,15 +866,13 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
||||
|
||||
/* setup initial outbound sequence number */
|
||||
get_random(msg_data+18, 4);
|
||||
// lan_session.out_seq = 1;
|
||||
// memcpy(msg_data + 18, &lan_session.out_seq, 4);
|
||||
|
||||
req.msg.data = msg_data;
|
||||
req.msg.data_len = 22;
|
||||
|
||||
lan_session.active = 1;
|
||||
|
||||
if (verbose) {
|
||||
if (verbose > 1) {
|
||||
printf(" Privilege Level : %s\n",
|
||||
val2str(msg_data[1], ipmi_privlvl_vals));
|
||||
printf(" Auth Type : %s\n",
|
||||
@ -1033,9 +921,9 @@ ipmi_activate_session_cmd(struct ipmi_intf * intf)
|
||||
}
|
||||
|
||||
memcpy(&lan_session.id, rsp->data + 1, 4);
|
||||
memcpy(&lan_session.in_seq, rsp->data + 5, 4);
|
||||
lan_session.in_seq = rsp->data[8] << 24 | rsp->data[7] << 16 | rsp->data[6] << 8 | rsp->data[5];
|
||||
|
||||
if (verbose) {
|
||||
if (verbose > 1) {
|
||||
printf("\nSession Activated\n");
|
||||
printf(" Auth Type : %s\n",
|
||||
val2str(rsp->data[0], ipmi_authtype_vals));
|
||||
@ -1077,7 +965,7 @@ ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
|
||||
val2str(lan_session.privlvl, ipmi_privlvl_vals));
|
||||
return -1;
|
||||
}
|
||||
if (verbose)
|
||||
if (verbose > 1)
|
||||
printf("Set Session Privilege Level to %s\n\n",
|
||||
val2str(rsp->data[0], ipmi_privlvl_vals));
|
||||
return 0;
|
||||
@ -1119,7 +1007,7 @@ impi_close_session_cmd(struct ipmi_intf * intf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
if (verbose > 1)
|
||||
printf("\nClosed Session %08lx\n\n", lan_session.id);
|
||||
|
||||
return 0;
|
||||
@ -1179,7 +1067,7 @@ ipmi_lan_activate_session(struct ipmi_intf * intf)
|
||||
return -1;
|
||||
|
||||
/* channel 0xE will query current channel */
|
||||
ipmi_get_channel_info(intf, IPMI_LAN_CHANNEL_E);
|
||||
// ipmi_get_channel_info(intf, IPMI_LAN_CHANNEL_E);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1192,7 +1080,7 @@ void ipmi_lan_close(struct ipmi_intf * intf)
|
||||
ipmi_req_clear_entries();
|
||||
}
|
||||
|
||||
int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * password)
|
||||
int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * username, char * password)
|
||||
{
|
||||
int rc;
|
||||
struct sigaction act;
|
||||
@ -1211,6 +1099,10 @@ int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * pas
|
||||
memset(&lan_session, 0, sizeof(lan_session));
|
||||
curr_seq = 0;
|
||||
|
||||
if (username) {
|
||||
memcpy(lan_session.username, username, strlen(username));
|
||||
}
|
||||
|
||||
if (password) {
|
||||
lan_session.password = 1;
|
||||
memcpy(lan_session.authcode, password, strlen(password));
|
||||
@ -1227,14 +1119,14 @@ int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * pas
|
||||
if (rc <= 0) {
|
||||
struct hostent *host = gethostbyname(hostname);
|
||||
if (!host) {
|
||||
herror("address lookup failed");
|
||||
printf("address lookup failed\n");
|
||||
return -1;
|
||||
}
|
||||
intf->addr.sin_family = host->h_addrtype;
|
||||
memcpy(&intf->addr.sin_addr, host->h_addr, host->h_length);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
if (verbose > 1)
|
||||
printf("IPMI LAN host %s port %d\n",
|
||||
hostname, ntohs(intf->addr.sin_port));
|
||||
|
||||
@ -1271,8 +1163,10 @@ int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * pas
|
||||
return intf->fd;
|
||||
}
|
||||
|
||||
int intf_setup(struct ipmi_intf ** intf)
|
||||
int lan_intf_setup(struct ipmi_intf ** intf)
|
||||
{
|
||||
*intf = &ipmi_lan_intf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int intf_setup(struct ipmi_intf ** intf) __attribute__ ((weak, alias("lan_intf_setup")));
|
||||
|
@ -63,11 +63,12 @@ unsigned char * ipmi_auth_md5(unsigned char * data, int data_len);
|
||||
unsigned char ipmi_csum(unsigned char * d, int s);
|
||||
|
||||
struct ipmi_rs * ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req);
|
||||
int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * password);
|
||||
int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * username, char * password);
|
||||
void ipmi_lan_close(struct ipmi_intf * intf);
|
||||
void ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel);
|
||||
int ipmi_lan_ping(struct ipmi_intf * intf);
|
||||
|
||||
int lan_intf_setup(struct ipmi_intf ** intf);
|
||||
struct ipmi_intf ipmi_lan_intf;
|
||||
|
||||
#endif /*IPMI_LAN_H*/
|
||||
|
@ -38,6 +38,10 @@ plugindir = $(pluginpath)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
intf_open_la_LDFLAGS = -module -avoid-version
|
||||
plugin_LTLIBRARIES = intf_open.la
|
||||
intf_open_la_SOURCES = open.c open.h
|
||||
EXTRA_LTLIBRARIES = libintf_open.la
|
||||
plugin_LTLIBRARIES = @PLUGIN_INTF_OPEN@
|
||||
noinst_LTLIBRARIES = @STATIC_INTF_OPEN@
|
||||
libintf_open_la_LDFLAGS = @LDFLAGS_INTF_OPEN@
|
||||
libintf_open_la_LIBADD = $(top_srcdir)/lib/libipmitool.la
|
||||
libintf_open_la_SOURCES = open.c open.h
|
||||
|
||||
|
@ -53,6 +53,7 @@
|
||||
|
||||
static int curr_seq;
|
||||
extern int verbose;
|
||||
struct ipmi_session lan_session;
|
||||
|
||||
struct ipmi_intf ipmi_openipmi_intf = {
|
||||
.open = ipmi_openipmi_open,
|
||||
@ -66,7 +67,7 @@ void ipmi_openipmi_close(struct ipmi_intf * intf)
|
||||
close(intf->fd);
|
||||
}
|
||||
|
||||
int ipmi_openipmi_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2)
|
||||
int ipmi_openipmi_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2, char * __unused3)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@ -173,8 +174,10 @@ struct ipmi_rs * ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq
|
||||
return &rsp;
|
||||
}
|
||||
|
||||
int intf_setup(struct ipmi_intf ** intf)
|
||||
int open_intf_setup(struct ipmi_intf ** intf)
|
||||
{
|
||||
*intf = &ipmi_openipmi_intf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int intf_setup(struct ipmi_intf ** intf) __attribute__ ((weak, alias("open_intf_setup")));
|
||||
|
@ -42,7 +42,8 @@
|
||||
#define OPENIPMI_DEV "/dev/ipmi0"
|
||||
|
||||
struct ipmi_rs * ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req);
|
||||
int ipmi_openipmi_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2);
|
||||
int ipmi_openipmi_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2, char * __unused3);
|
||||
void ipmi_openipmi_close(struct ipmi_intf * intf);
|
||||
int open_intf_setup(struct ipmi_intf ** intf);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user