diff options
Diffstat (limited to 'include/ipmitool')
42 files changed, 8519 insertions, 0 deletions
diff --git a/include/ipmitool/Makefile.am b/include/ipmitool/Makefile.am new file mode 100644 index 0000000..925881e --- /dev/null +++ b/include/ipmitool/Makefile.am @@ -0,0 +1,42 @@ +# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistribution of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistribution in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of Sun Microsystems, Inc. or the names of +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# This software is provided "AS IS," without a warranty of any kind. +# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. +# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE +# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF +# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, +# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +MAINTAINERCLEANFILES = Makefile.in + +noinst_HEADERS = log.h bswap.h hpm2.h helper.h ipmi.h ipmi_cc.h ipmi_intf.h \ + ipmi_chassis.h ipmi_entity.h ipmi_fru.h ipmi_hpmfwupg.h ipmi_lanp.h \ + ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_mc.h ipmi_raw.h \ + ipmi_channel.h ipmi_sensor.h ipmi_event.h ipmi_session.h \ + ipmi_strings.h ipmi_constants.h ipmi_user.h ipmi_pef.h \ + ipmi_oem.h ipmi_sdradd.h ipmi_isol.h ipmi_sunoem.h ipmi_picmg.h \ + ipmi_fwum.h ipmi_main.h ipmi_tsol.h ipmi_firewall.h \ + ipmi_kontronoem.h ipmi_ekanalyzer.h ipmi_gendev.h ipmi_ime.h \ + ipmi_delloem.h ipmi_dcmi.h + diff --git a/include/ipmitool/Makefile.in b/include/ipmitool/Makefile.in new file mode 100644 index 0000000..8b5a908 --- /dev/null +++ b/include/ipmitool/Makefile.in @@ -0,0 +1,482 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# 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. + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = include/ipmitool +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +ARCH = @ARCH@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASEDIR = @BASEDIR@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTRO = @DISTRO@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTF_BMC = @INTF_BMC@ +INTF_BMC_LIB = @INTF_BMC_LIB@ +INTF_DUMMY = @INTF_DUMMY@ +INTF_DUMMY_LIB = @INTF_DUMMY_LIB@ +INTF_FREE = @INTF_FREE@ +INTF_FREE_LIB = @INTF_FREE_LIB@ +INTF_IMB = @INTF_IMB@ +INTF_IMB_LIB = @INTF_IMB_LIB@ +INTF_LAN = @INTF_LAN@ +INTF_LANPLUS = @INTF_LANPLUS@ +INTF_LANPLUS_LIB = @INTF_LANPLUS_LIB@ +INTF_LAN_LIB = @INTF_LAN_LIB@ +INTF_LIPMI = @INTF_LIPMI@ +INTF_LIPMI_LIB = @INTF_LIPMI_LIB@ +INTF_OPEN = @INTF_OPEN@ +INTF_OPEN_LIB = @INTF_OPEN_LIB@ +INTF_SERIAL = @INTF_SERIAL@ +INTF_SERIAL_LIB = @INTF_SERIAL_LIB@ +IPMITOOL_INTF_LIB = @IPMITOOL_INTF_LIB@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OS = @OS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ +PSTAMP = @PSTAMP@ +RANLIB = @RANLIB@ +RPMBUILD = @RPMBUILD@ +RPM_RELEASE = @RPM_RELEASE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +MAINTAINERCLEANFILES = Makefile.in +noinst_HEADERS = log.h bswap.h hpm2.h helper.h ipmi.h ipmi_cc.h ipmi_intf.h \ + ipmi_chassis.h ipmi_entity.h ipmi_fru.h ipmi_hpmfwupg.h ipmi_lanp.h \ + ipmi_sdr.h ipmi_sel.h ipmi_sol.h ipmi_mc.h ipmi_raw.h \ + ipmi_channel.h ipmi_sensor.h ipmi_event.h ipmi_session.h \ + ipmi_strings.h ipmi_constants.h ipmi_user.h ipmi_pef.h \ + ipmi_oem.h ipmi_sdradd.h ipmi_isol.h ipmi_sunoem.h ipmi_picmg.h \ + ipmi_fwum.h ipmi_main.h ipmi_tsol.h ipmi_firewall.h \ + ipmi_kontronoem.h ipmi_ekanalyzer.h ipmi_gendev.h ipmi_ime.h \ + ipmi_delloem.h ipmi_dcmi.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/ipmitool/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/ipmitool/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/include/ipmitool/bswap.h b/include/ipmitool/bswap.h new file mode 100644 index 0000000..9948208 --- /dev/null +++ b/include/ipmitool/bswap.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef IPMI_BSWAP_H +#define IPMI_BSWAP_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#undef BSWAP_16 +#undef BSWAP_32 + +#if HAVE_BYTESWAP_H +# include <byteswap.h> +# define BSWAP_16(x) bswap_16(x) +# define BSWAP_32(x) bswap_32(x) +#else +# 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 */ diff --git a/include/ipmitool/helper.h b/include/ipmitool/helper.h new file mode 100644 index 0000000..b6ee7fa --- /dev/null +++ b/include/ipmitool/helper.h @@ -0,0 +1,123 @@ +/* + * 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. + */ + +#ifndef IPMI_HELPER_H +#define IPMI_HELPER_H + +#include <sys/types.h> +#include <inttypes.h> +#include <stdio.h> +#include <string.h> + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef tboolean +#define tboolean int +#endif + +/* IPMI spec. - UID 0 reserved, 63 maximum UID which can be used */ +#ifndef IPMI_UID_MIN +# define IPMI_UID_MIN 1 +#endif +#ifndef IPMI_UID_MAX +# define IPMI_UID_MAX 63 +#endif + +struct ipmi_intf; + +struct valstr { + uint16_t val; + const char * str; +}; +struct oemvalstr { + uint32_t oem; + uint16_t val; + const char * str; +}; + +const char * val2str(uint16_t val, const struct valstr * vs); +const char * oemval2str(uint32_t oem,uint16_t val, const struct oemvalstr * vs); + +int str2double(const char * str, double * double_ptr); +int str2long(const char * str, int64_t * lng_ptr); +int str2ulong(const char * str, uint64_t * ulng_ptr); +int str2int(const char * str, int32_t * int_ptr); +int str2uint(const char * str, uint32_t * uint_ptr); +int str2short(const char * str, int16_t * shrt_ptr); +int str2ushort(const char * str, uint16_t * ushrt_ptr); +int str2char(const char * str, int8_t * chr_ptr); +int str2uchar(const char * str, uint8_t * uchr_ptr); + +int is_fru_id(const char *argv_ptr, uint8_t *fru_id_ptr); +int is_ipmi_channel_num(const char *argv_ptr, uint8_t *channel_ptr); +int is_ipmi_user_id(const char *argv_ptr, uint8_t *ipmi_uid_ptr); + +uint16_t str2val(const char * str, const struct valstr * vs); +void print_valstr(const struct valstr * vs, const char * title, int loglevel); +void print_valstr_2col(const struct valstr * vs, const char * title, int loglevel); + + +uint16_t buf2short(uint8_t * buf); +uint32_t buf2long(uint8_t * buf); +const char * buf2str(uint8_t * buf, int len); +void printbuf(const uint8_t * buf, int len, const char * desc); +uint8_t ipmi_csum(uint8_t * d, int s); +FILE * ipmi_open_file(const char * file, int rw); +void ipmi_start_daemon(struct ipmi_intf *intf); +uint16_t ipmi_get_oem_id(struct ipmi_intf *intf); + +#define ipmi_open_file_read(file) ipmi_open_file(file, 0) +#define ipmi_open_file_write(file) ipmi_open_file(file, 1) + +#ifndef __min +# define __min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef __max +# define __max(a, b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef __minlen +# define __minlen(a, b) ({ int x=strlen(a); int y=strlen(b); (x < y) ? x : y;}) +#endif + +#ifndef __maxlen +# define __maxlen(a, b) ({ int x=strlen(a); int y=strlen(b); (x > y) ? x : y;}) +#endif + +#endif /* IPMI_HELPER_H */ diff --git a/include/ipmitool/hpm2.h b/include/ipmitool/hpm2.h new file mode 100644 index 0000000..1c0a612 --- /dev/null +++ b/include/ipmitool/hpm2.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2012 Pigeon Point Systems. 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 Pigeon Point Systems nor 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. + * PIGEON POINT SYSTEMS ("PPS") 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 + * PPS 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 PPS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#include <stdint.h> +#include <ipmitool/ipmi_intf.h> + +/* Global HPM.2 defines */ +#define HPM2_REVISION 0x01 +#define HPM3_REVISION 0x01 +#define HPM2_LAN_PARAMS_REV 0x01 +#define HPM2_SOL_PARAMS_REV 0x01 +#define HPM3_LAN_PARAMS_REV 0x01 + +/* HPM.2 capabilities */ +#define HPM2_CAPS_SOL_EXTENSION 0x01 +#define HPM2_CAPS_PACKET_TRACE 0x02 +#define HPM2_CAPS_EXT_MANAGEMENT 0x04 +#define HPM2_CAPS_VERSION_SENSOR 0x08 +#define HPM2_CAPS_DYNAMIC_SESSIONS 0x10 + +#if HAVE_PRAGMA_PACK +# pragma pack(push, 1) +#endif + +/* HPM.2 LAN attach capabilities */ +struct hpm2_lan_attach_capabilities { + uint8_t hpm2_revision_id; + uint16_t lan_channel_mask; + uint8_t hpm2_caps; + uint8_t hpm2_lan_params_start; + uint8_t hpm2_lan_params_rev; + uint8_t hpm2_sol_params_start; + uint8_t hpm2_sol_params_rev; +} ATTRIBUTE_PACKING; + +/* HPM.2 LAN channel capabilities */ +struct hpm2_lan_channel_capabilities { + uint8_t capabilities; + uint8_t attach_type; + uint8_t bandwidth_class; + uint16_t max_inbound_pld_size; + uint16_t max_outbound_pld_size; +} ATTRIBUTE_PACKING; + +#if HAVE_PRAGMA_PACK +# pragma pack(pop) +#endif + +/* HPM.2 command assignments */ +#define HPM2_GET_LAN_ATTACH_CAPABILITIES 0x3E + +extern int hpm2_get_capabilities(struct ipmi_intf * intf, + struct hpm2_lan_attach_capabilities * caps); +extern int hpm2_get_lan_channel_capabilities(struct ipmi_intf * intf, + uint8_t hpm2_lan_params_start, + struct hpm2_lan_channel_capabilities * caps); +extern int hpm2_detect_max_payload_size(struct ipmi_intf * intf); diff --git a/include/ipmitool/ipmi.h b/include/ipmitool/ipmi.h new file mode 100644 index 0000000..1fd3e2a --- /dev/null +++ b/include/ipmitool/ipmi.h @@ -0,0 +1,290 @@ +/* + * 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. + */ + +#ifndef IPMI_H +#define IPMI_H + +#include <stdlib.h> +#include <stdio.h> +#include <inttypes.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <ipmitool/helper.h> +#include <ipmitool/ipmi_cc.h> + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#define IPMI_BUF_SIZE 1024 + +#if HAVE_PRAGMA_PACK +#define ATTRIBUTE_PACKING +#else +#define ATTRIBUTE_PACKING __attribute__ ((packed)) +#endif + + +/* From table 13.16 of the IPMI v2 specification */ +#define IPMI_PAYLOAD_TYPE_IPMI 0x00 +#define IPMI_PAYLOAD_TYPE_SOL 0x01 +#define IPMI_PAYLOAD_TYPE_OEM 0x02 +#define IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST 0x10 +#define IPMI_PAYLOAD_TYPE_RMCP_OPEN_RESPONSE 0x11 +#define IPMI_PAYLOAD_TYPE_RAKP_1 0x12 +#define IPMI_PAYLOAD_TYPE_RAKP_2 0x13 +#define IPMI_PAYLOAD_TYPE_RAKP_3 0x14 +#define IPMI_PAYLOAD_TYPE_RAKP_4 0x15 + +extern int verbose; +extern int csv_output; + +struct ipmi_rq { + struct { + uint8_t netfn:6; + uint8_t lun:2; + uint8_t cmd; + uint8_t target_cmd; + uint16_t data_len; + uint8_t *data; + } msg; +}; + +/* + * This is what the sendrcv_v2() function would take as an argument. The common case + * is for payload_type to be IPMI_PAYLOAD_TYPE_IPMI. + */ +struct ipmi_v2_payload { + uint16_t payload_length; + uint8_t payload_type; + + union { + + struct { + uint8_t rq_seq; + struct ipmi_rq *request; + } ipmi_request; + + struct { + uint8_t rs_seq; + struct ipmi_rs *response; + } ipmi_response; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *request; + } open_session_request; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *message; + } rakp_1_message; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *message; + } rakp_2_message; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *message; + } rakp_3_message; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *message; + } rakp_4_message; + + struct { + uint8_t data[IPMI_BUF_SIZE]; + uint16_t character_count; + uint8_t packet_sequence_number; + uint8_t acked_packet_number; + uint8_t accepted_character_count; + uint8_t is_nack; /* bool */ + uint8_t assert_ring_wor; /* bool */ + uint8_t generate_break; /* bool */ + uint8_t deassert_cts; /* bool */ + uint8_t deassert_dcd_dsr; /* bool */ + uint8_t flush_inbound; /* bool */ + uint8_t flush_outbound; /* bool */ + } sol_packet; + + } payload; +}; + +struct ipmi_rq_entry { + struct ipmi_rq req; + struct ipmi_intf *intf; + uint8_t rq_seq; + uint8_t *msg_data; + int msg_len; + int bridging_level; + struct ipmi_rq_entry *next; +}; + +struct ipmi_rs { + uint8_t ccode; + uint8_t data[IPMI_BUF_SIZE]; + + /* + * Looks like this is the length of the entire packet, including the RMCP + * stuff, then modified to be the length of the extra IPMI message data + */ + int data_len; + + struct { + uint8_t netfn; + uint8_t cmd; + uint8_t seq; + uint8_t lun; + } msg; + + struct { + uint8_t authtype; + uint32_t seq; + uint32_t id; + uint8_t bEncrypted; /* IPMI v2 only */ + uint8_t bAuthenticated; /* IPMI v2 only */ + uint8_t payloadtype; /* IPMI v2 only */ + /* This is the total length of the payload or + IPMI message. IPMI v2.0 requires this to + be 2 bytes. Not really used for much. */ + uint16_t msglen; + } session; + + /* + * A union of the different possible payload meta-data + */ + union { + struct { + uint8_t rq_addr; + uint8_t netfn; + uint8_t rq_lun; + uint8_t rs_addr; + uint8_t rq_seq; + uint8_t rs_lun; + uint8_t cmd; + } ipmi_response; + struct { + uint8_t message_tag; + uint8_t rakp_return_code; + uint8_t max_priv_level; + uint32_t console_id; + uint32_t bmc_id; + uint8_t auth_alg; + uint8_t integrity_alg; + uint8_t crypt_alg; + } open_session_response; + struct { + uint8_t message_tag; + uint8_t rakp_return_code; + uint32_t console_id; + uint8_t bmc_rand[16]; /* Random number generated by the BMC */ + uint8_t bmc_guid[16]; + uint8_t key_exchange_auth_code[20]; + } rakp2_message; + struct { + uint8_t message_tag; + uint8_t rakp_return_code; + uint32_t console_id; + uint8_t integrity_check_value[20]; + } rakp4_message; + struct { + uint8_t packet_sequence_number; + uint8_t acked_packet_number; + uint8_t accepted_character_count; + uint8_t is_nack; /* bool */ + uint8_t transfer_unavailable; /* bool */ + uint8_t sol_inactive; /* bool */ + uint8_t transmit_overrun; /* bool */ + uint8_t break_detected; /* bool */ + } sol_packet; + + } payload; +}; + +#define IPMI_NETFN_CHASSIS 0x0 +#define IPMI_NETFN_BRIDGE 0x2 +#define IPMI_NETFN_SE 0x4 +#define IPMI_NETFN_APP 0x6 +#define IPMI_NETFN_FIRMWARE 0x8 +#define IPMI_NETFN_STORAGE 0xa +#define IPMI_NETFN_TRANSPORT 0xc +#define IPMI_NETFN_PICMG 0x2C +#define IPMI_NETFN_DCGRP 0x2C +#define IPMI_NETFN_OEM 0x2E +#define IPMI_NETFN_ISOL 0x34 +#define IPMI_NETFN_TSOL 0x30 + +#define IPMI_BMC_SLAVE_ADDR 0x20 +#define IPMI_REMOTE_SWID 0x81 + + +/* These values are IANA numbers */ +typedef enum IPMI_OEM { + IPMI_OEM_UNKNOWN = 0, + IPMI_OEM_HP = 11, + IPMI_OEM_SUN = 42, + IPMI_OEM_NOKIA = 94, + IPMI_OEM_BULL = 107, + IPMI_OEM_HITACHI_116 = 116, + IPMI_OEM_NEC = 119, + IPMI_OEM_TOSHIBA = 186, + IPMI_OEM_INTEL = 343, + IPMI_OEM_TATUNG = 373, + IPMI_OEM_HITACHI_399 = 399, + IPMI_OEM_DELL = 674, + IPMI_OEM_LMC = 2168, + IPMI_OEM_RADISYS = 4337, + IPMI_OEM_BROADCOM = 4413, + IPMI_OEM_MAGNUM = 5593, + IPMI_OEM_TYAN = 6653, + IPMI_OEM_NEWISYS = 9237, + IPMI_OEM_FUJITSU_SIEMENS = 10368, + IPMI_OEM_AVOCENT = 10418, + IPMI_OEM_PEPPERCON = 10437, + IPMI_OEM_SUPERMICRO = 10876, + IPMI_OEM_OSA = 11102, + IPMI_OEM_GOOGLE = 11129, + IPMI_OEM_PICMG = 12634, + IPMI_OEM_RARITAN = 13742, + IPMI_OEM_KONTRON = 15000, + IPMI_OEM_PPS = 16394, + IPMI_OEM_AMI = 20974, + IPMI_OEM_NOKIA_SIEMENS_NETWORKS = 28458, + IPMI_OEM_SUPERMICRO_47488 = 47488 +} IPMI_OEM; + +extern const struct valstr completion_code_vals[]; + +#endif /* IPMI_H */ diff --git a/include/ipmitool/ipmi_cc.h b/include/ipmitool/ipmi_cc.h new file mode 100644 index 0000000..237b1ee --- /dev/null +++ b/include/ipmitool/ipmi_cc.h @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#ifndef IPMI_CC_H +#define IPMI_CC_H + +/* + Thu Jan 11 09:32:41 2007 + francois.isabelle@ca.kontron.com + + I just noticed that most modules refer to IPMI completion codes using + hard coded values ... +*/ + +/* + * CC + * See IPMI specification table 5-2 Generic Completion Codes + */ + +#define IPMI_CC_OK 0x00 +#define IPMI_CC_NODE_BUSY 0xc0 +#define IPMI_CC_INV_CMD 0xc1 +#define IPMI_CC_INV_CMD_FOR_LUN 0xc2 +#define IPMI_CC_TIMEOUT 0xc3 +#define IPMI_CC_OUT_OF_SPACE 0xc4 +#define IPMI_CC_RES_CANCELED 0xc5 +#define IPMI_CC_REQ_DATA_TRUNC 0xc6 +#define IPMI_CC_REQ_DATA_INV_LENGTH 0xc7 +#define IPMI_CC_REQ_DATA_FIELD_EXCEED 0xc8 +#define IPMI_CC_PARAM_OUT_OF_RANGE 0xc9 +#define IPMI_CC_CANT_RET_NUM_REQ_BYTES 0xca +#define IPMI_CC_REQ_DATA_NOT_PRESENT 0xcb +#define IPMI_CC_INV_DATA_FIELD_IN_REQ 0xcc +#define IPMI_CC_ILL_SENSOR_OR_RECORD 0xcd +#define IPMI_CC_RESP_COULD_NOT_BE_PRV 0xce +#define IPMI_CC_CANT_RESP_DUPLI_REQ 0xcf +#define IPMI_CC_CANT_RESP_SDRR_UPDATE 0xd0 +#define IPMI_CC_CANT_RESP_FIRM_UPDATE 0xd1 +#define IPMI_CC_CANT_RESP_BMC_INIT 0xd2 +#define IPMI_CC_DESTINATION_UNAVAILABLE 0xd3 +#define IPMI_CC_INSUFFICIENT_PRIVILEGES 0xd4 +#define IPMI_CC_NOT_SUPPORTED_PRESENT_STATE 0xd5 +#define IPMI_CC_ILLEGAL_COMMAND_DISABLED 0xd6 +#define IPMI_CC_UNSPECIFIED_ERROR 0xff + + +#endif /*IPMI_CC_H*/ diff --git a/include/ipmitool/ipmi_channel.h b/include/ipmitool/ipmi_channel.h new file mode 100644 index 0000000..7cbb9ad --- /dev/null +++ b/include/ipmitool/ipmi_channel.h @@ -0,0 +1,258 @@ +/* + * 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. + */ + +#ifndef IPMI_CHANNEL_H +#define IPMI_CHANNEL_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> + + +#define IPMI_GET_CHANNEL_AUTH_CAP 0x38 +#define IPMI_GET_CHANNEL_ACCESS 0x41 +#define IPMI_GET_CHANNEL_INFO 0x42 +#define IPMI_SET_USER_ACCESS 0x43 +#define IPMI_GET_USER_ACCESS 0x44 +#define IPMI_SET_USER_NAME 0x45 +#define IPMI_GET_USER_NAME 0x46 +#define IPMI_SET_USER_PASSWORD 0x47 +#define IPMI_GET_CHANNEL_CIPHER_SUITES 0x54 + + +/* + * The Get Authentication Capabilities response structure + * From table 22-15 of the IPMI v2.0 spec + */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct get_channel_auth_cap_rsp { + uint8_t channel_number; +#if WORDS_BIGENDIAN + uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */ + uint8_t __reserved1 : 1; + uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */ +#else + uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */ + uint8_t __reserved1 : 1; + uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */ +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved2 : 2; + uint8_t kg_status : 1; /* two-key login status */ + uint8_t per_message_auth : 1; /* per-message authentication status */ + uint8_t user_level_auth : 1; /* user-level authentication status */ + uint8_t non_null_usernames : 1; /* one or more non-null users exist */ + uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */ + uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */ +#else + uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */ + uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */ + uint8_t non_null_usernames : 1; /* one or more non-null users exist */ + uint8_t user_level_auth : 1; /* user-level authentication status */ + uint8_t per_message_auth : 1; /* per-message authentication status */ + uint8_t kg_status : 1; /* two-key login status */ + uint8_t __reserved2 : 2; +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved3 : 6; + uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */ + uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */ +#else + uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */ + uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */ + uint8_t __reserved3 : 6; +#endif + uint8_t oem_id[3]; /* IANA enterprise number for auth type */ + uint8_t oem_aux_data; /* Additional OEM specific data for oem auths */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + + +/* + * The Get Channel Info response structure + * From table 22-29 of the IPMI v2.0 spec + */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct get_channel_info_rsp { +#if WORDS_BIGENDIAN + uint8_t __reserved1 : 4; + uint8_t channel_number : 4; /* channel number */ +#else + uint8_t channel_number : 4; /* channel number */ + uint8_t __reserved1 : 4; +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved2 : 1; + uint8_t channel_medium : 7; /* Channel medium type per table 6-3 */ +#else + uint8_t channel_medium : 7; /* Channel medium type per table 6-3 */ + uint8_t __reserved2 : 1; +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved3 : 3; + uint8_t channel_protocol : 5; /* Channel protocol per table 6-2 */ +#else + uint8_t channel_protocol : 5; /* Channel protocol per table 6-2 */ + uint8_t __reserved3 : 3; +#endif +#if WORDS_BIGENDIAN + uint8_t session_support : 2; /* Description of session support */ + uint8_t active_sessions : 6; /* Count of active sessions */ +#else + uint8_t active_sessions : 6; /* Count of active sessions */ + uint8_t session_support : 2; /* Description of session support */ +#endif + uint8_t vendor_id[3]; /* For OEM that specified the protocol */ + uint8_t aux_info[2]; /* Not used*/ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + + +/* + * The Get Channel Access response structure + * From table 22-28 of the IPMI v2.0 spec + */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct get_channel_access_rsp { +#if WORDS_BIGENDIAN + uint8_t __reserved1 : 2; + uint8_t alerting : 1; + uint8_t per_message_auth : 1; + uint8_t user_level_auth : 1; + uint8_t access_mode : 3; +#else + uint8_t access_mode : 3; + uint8_t user_level_auth : 1; + uint8_t per_message_auth : 1; + uint8_t alerting : 1; + uint8_t __reserved1 : 2; +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved2 : 4; + uint8_t channel_priv_limit : 4; /* Channel privilege level limit */ +#else + uint8_t channel_priv_limit : 4; /* Channel privilege level limit */ + uint8_t __reserved2 : 4; +#endif +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct get_user_access_rsp { +#if WORDS_BIGENDIAN + uint8_t __reserved1 : 2; + uint8_t max_user_ids : 6; + uint8_t __reserved2 : 2; + uint8_t enabled_user_ids : 6; + uint8_t __reserved3 : 2; + uint8_t fixed_user_ids : 6; + uint8_t __reserved4 : 1; + uint8_t callin_callback : 1; + uint8_t link_auth : 1; + uint8_t ipmi_messaging : 1; + uint8_t privilege_limit : 4; +#else + uint8_t max_user_ids : 6; + uint8_t __reserved1 : 2; + uint8_t enabled_user_ids : 6; + uint8_t __reserved2 : 2; + uint8_t fixed_user_ids : 6; + uint8_t __reserved3 : 2; + uint8_t privilege_limit : 4; + uint8_t ipmi_messaging : 1; + uint8_t link_auth : 1; + uint8_t callin_callback : 1; + uint8_t __reserved4 : 1; +#endif +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct set_user_access_data { +#if WORDS_BIGENDIAN + uint8_t change_bits : 1; + uint8_t callin_callback : 1; + uint8_t link_auth : 1; + uint8_t ipmi_messaging : 1; + uint8_t channel : 4; + uint8_t __reserved1 : 2; + uint8_t user_id : 6; + uint8_t __reserved2 : 4; + uint8_t privilege_limit : 4; + uint8_t __reserved3 : 4; + uint8_t session_limit : 4; +#else + uint8_t channel : 4; + uint8_t ipmi_messaging : 1; + uint8_t link_auth : 1; + uint8_t callin_callback : 1; + uint8_t change_bits : 1; + uint8_t user_id : 6; + uint8_t __reserved1 : 2; + uint8_t privilege_limit : 4; + uint8_t __reserved2 : 4; + uint8_t session_limit : 4; + uint8_t __reserved3 : 4; +#endif +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel); +uint8_t ipmi_current_channel_medium(struct ipmi_intf * intf); +int ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv); +int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, uint8_t channel, uint8_t priv); +int ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel); + +#endif /*IPMI_CHANNEL_H*/ diff --git a/include/ipmitool/ipmi_chassis.h b/include/ipmitool/ipmi_chassis.h new file mode 100644 index 0000000..3f56924 --- /dev/null +++ b/include/ipmitool/ipmi_chassis.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_CHASSIS_H +#define IPMI_CHASSIS_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 IPMI_CHASSIS_POLICY_NO_CHANGE 0x3 +#define IPMI_CHASSIS_POLICY_ALWAYS_ON 0x2 +#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1 +#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0 + +int ipmi_chassis_power_status(struct ipmi_intf * intf); +int ipmi_chassis_power_control(struct ipmi_intf * intf, uint8_t ctl); +int ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv); +int ipmi_power_main(struct ipmi_intf * intf, int argc, char ** argv); + +#endif /*IPMI_CHASSIS_H*/ diff --git a/include/ipmitool/ipmi_constants.h b/include/ipmitool/ipmi_constants.h new file mode 100644 index 0000000..2aad2cf --- /dev/null +++ b/include/ipmitool/ipmi_constants.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_CONSTANTS_H +#define IPMI_CONSTANTS_H + + +/* + * COMMANDS + */ +#define IPMI_GET_SDR_REPOSITORY_INFO 0x20 +#define IPMI_SOL_ACTIVATING 0x20 +#define IPMI_SET_SOL_CONFIG_PARAMETERS 0x21 +#define IPMI_GET_SOL_CONFIG_PARAMETERS 0x22 +#define IPMI_SET_USER_ACCESS 0x43 +#define IPMI_GET_USER_ACCESS 0x44 +#define IPMI_SET_USER_NAME 0x45 +#define IPMI_GET_USER_NAME 0x46 +#define IPMI_SET_USER_PASSWORD 0x47 +#define IPMI_ACTIVATE_PAYLOAD 0x48 +#define IPMI_DEACTIVATE_PAYLOAD 0x49 +#define IPMI_SUSPEND_RESUME_PAYLOAD_ENCRYPTYION 0x55 +#define IPMI_GET_SEL_TIME 0x48 +#define IPMI_SET_SEL_TIME 0x49 +#define IPMI_SET_USER_PAYLOAD_ACCESS 0x4c +#define IPMI_GET_USER_PAYLOAD_ACCESS 0x4d + +#define IPMI_1_5_AUTH_TYPE_BIT_NONE 0x01 +#define IPMI_1_5_AUTH_TYPE_BIT_MD2 0x02 +#define IPMI_1_5_AUTH_TYPE_BIT_MD5 0x04 +#define IPMI_1_5_AUTH_TYPE_BIT_PASSWORD 0x10 +#define IPMI_1_5_AUTH_TYPE_BIT_OEM 0x20 + +#define IPMI_SESSION_AUTHTYPE_NONE 0x0 +#define IPMI_SESSION_AUTHTYPE_MD2 0x1 +#define IPMI_SESSION_AUTHTYPE_MD5 0x2 +#define IPMI_SESSION_AUTHTYPE_KEY 0x4 +#define IPMI_SESSION_AUTHTYPE_PASSWORD IPMI_SESSION_AUTHTYPE_KEY +#define IPMI_SESSION_AUTHTYPE_OEM 0x5 +#define IPMI_SESSION_AUTHTYPE_RMCP_PLUS 0x6 + +#define IPMI_SESSION_PRIV_UNSPECIFIED 0x0 +#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 + +#define IPMI_SET_IN_PROGRESS_SET_COMPLETE 0x00 +#define IPMI_SET_IN_PROGRESS_IN_PROGRESS 0x01 +#define IPMI_SET_IN_PROGRESS_COMMIT_WRITE 0x02 + +#define IPMI_CHANNEL_MEDIUM_RESERVED 0x0 +#define IPMI_CHANNEL_MEDIUM_IPMB_I2C 0x1 +#define IPMI_CHANNEL_MEDIUM_ICMB_1 0x2 +#define IPMI_CHANNEL_MEDIUM_ICMB_09 0x3 +#define IPMI_CHANNEL_MEDIUM_LAN 0x4 +#define IPMI_CHANNEL_MEDIUM_SERIAL 0x5 +#define IPMI_CHANNEL_MEDIUM_LAN_OTHER 0x6 +#define IPMI_CHANNEL_MEDIUM_SMBUS_PCI 0x7 +#define IPMI_CHANNEL_MEDIUM_SMBUS_1 0x8 +#define IPMI_CHANNEL_MEDIUM_SMBUS_2 0x9 +#define IPMI_CHANNEL_MEDIUM_USB_1 0xa +#define IPMI_CHANNEL_MEDIUM_USB_2 0xb +#define IPMI_CHANNEL_MEDIUM_SYSTEM 0xc + +#define IPMI_CHASSIS_CTL_POWER_DOWN 0x0 +#define IPMI_CHASSIS_CTL_POWER_UP 0x1 +#define IPMI_CHASSIS_CTL_POWER_CYCLE 0x2 +#define IPMI_CHASSIS_CTL_HARD_RESET 0x3 +#define IPMI_CHASSIS_CTL_PULSE_DIAG 0x4 +#define IPMI_CHASSIS_CTL_ACPI_SOFT 0x5 + +#define IPMI_CHASSIS_POLICY_NO_CHANGE 0x3 +#define IPMI_CHASSIS_POLICY_ALWAYS_ON 0x2 +#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1 +#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0 + +#define IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS 0 +#define IPMI_CHASSIS_BOOTPARAM_SVCPART_SELECT 1 +#define IPMI_CHASSIS_BOOTPARAM_SVCPART_SCAN 2 +#define IPMI_CHASSIS_BOOTPARAM_FLAG_VALID 3 +#define IPMI_CHASSIS_BOOTPARAM_INFO_ACK 4 +#define IPMI_CHASSIS_BOOTPARAM_BOOT_FLAGS 5 +#define IPMI_CHASSIS_BOOTPARAM_INIT_INFO 6 +#define IPMI_CHASSIS_BOOTPARAM_INIT_MBOX 7 + +/* From table 13-17 of the IPMI v2 specification */ +#define IPMI_AUTH_RAKP_NONE 0x00 +#define IPMI_AUTH_RAKP_HMAC_SHA1 0x01 +#define IPMI_AUTH_RAKP_HMAC_MD5 0x02 + +/* From table 13-18 of the IPMI v2 specification */ +#define IPMI_INTEGRITY_NONE 0x00 +#define IPMI_INTEGRITY_HMAC_SHA1_96 0x01 +#define IPMI_INTEGRITY_HMAC_MD5_128 0x02 +#define IPMI_INTEGRITY_MD5_128 0x03 + +/* From table 13-19 of the IPMI v2 specfication */ +#define IPMI_CRYPT_NONE 0x00 +#define IPMI_CRYPT_AES_CBC_128 0x01 +#define IPMI_CRYPT_XRC4_128 0x02 +#define IPMI_CRYPT_XRC4_40 0x03 + +#endif /*IPMI_CONSTANTS_H*/ diff --git a/include/ipmitool/ipmi_dcmi.h b/include/ipmitool/ipmi_dcmi.h new file mode 100644 index 0000000..ce90857 --- /dev/null +++ b/include/ipmitool/ipmi_dcmi.h @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2008 Intel Corporation. + * All rights reserved + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef IPMI_DCMI_H +#define IPMI_DCMI_H + +#include <ipmitool/ipmi.h> + +/* DCMI commands per DCMI 1.5 SPEC */ + +#define IPMI_DCMI 0xDC /* Group Extension Identification */ +#define IPMI_DCMI_COMPAT 0x01 +#define IPMI_DCMI_GETRED 0x02 +#define IPMI_DCMI_GETLMT 0x03 +#define IPMI_DCMI_SETLMT 0x04 +#define IPMI_DCMI_PWRACT 0x05 +#define IPMI_DCMI_GETASSET 0x06 +#define IPMI_DCMI_SETASSET 0x08 +#define IPMI_DCMI_GETMNGCTRLIDS 0x09 +#define IPMI_DCMI_SETMNGCTRLIDS 0x0A +#define IPMI_DCMI_SETTERMALLIMIT 0x0B +#define IPMI_DCMI_GETTERMALLIMIT 0x0C +#define IPMI_DCMI_GETSNSR 0x07 +#define IPMI_DCMI_PWRMGT 0x08 +#define IPMI_DCMI_GETTEMPRED 0x10 +#define IPMI_DCMI_SETCONFPARAM 0x12 +#define IPMI_DCMI_GETCONFPARAM 0x13 + +#define IPMI_DCMI_CONFORM 0x0001 +#define IPMI_DCMI_1_1_CONFORM 0x0101 +#define IPMI_DCMI_1_5_CONFORM 0x0501 + +#define DCMI_MAX_BYTE_SIZE 0x10 +#define DCMI_MAX_BYTE_TEMP_READ_SIZE 0x08 + +#define GOOD_PWR_GLIMIT_CCODE(ccode) ((ccode = ((ccode == 0x80) ? 0 : ccode))) +#define GOOD_ASSET_TAG_CCODE(ccode) ((ccode = (((ccode == 0x80) || (ccode == 0x81) || (ccode == 0x82) || (ccode == 0x83)) ? 0 : ccode))) + + +struct dcmi_cmd { + uint16_t val; + const char * str; + const char * desc; +}; + +/* make a struct for the return from the get limit command */ +struct power_limit { + uint8_t grp_id; /* first byte: Group Extension ID */ + uint16_t reserved_1; /* second and third bytes are reserved */ + uint8_t action; /* fourth byte is the exception action */ + uint16_t limit; /* fifth through sixth byte are the power limit in watts */ + uint32_t correction; /* seventh - 10th bytes are the correction period */ + uint16_t reserved_2; /* 11th - 12th are reserved bytes */ + uint16_t sample; /* 13th - 14th are sample period time */ +} __attribute__ ((packed)); + +/* make a struct for the return from the reading command */ +struct power_reading { + uint8_t grp_id; /* first byte: Group Extension ID */ + uint16_t curr_pwr; + uint16_t min_sample; + uint16_t max_sample; + uint16_t avg_pwr; + uint32_t time_stamp; /* time since epoch */ + uint32_t sample; + uint8_t state; +} __attribute__ ((packed)); + +/* make a struct for the return from the capabilites command */ +struct capabilities { + uint8_t grp_id; /* first byte: Group Extension ID */ + uint16_t conformance; + uint8_t revision; + uint8_t data_byte1; + uint8_t data_byte2; + uint8_t data_byte3; + uint8_t data_byte4; +} __attribute__ ((packed)); + +/* make a struct for the return from the sensor info command */ +struct sensor_info { + uint8_t grp_id; /* first byte: Group Extension ID */ + uint8_t i_instances; + uint8_t i_records; + +} __attribute__ ((packed)); + +/* make a struct for the return from the get asset tag command */ +struct asset_tag { + uint8_t grp_id; /* first byte: Group Extension ID */ + uint8_t length; + const char tag[16]; +} __attribute__ ((packed)); + +/* make a struct for the return from the set asset tag command */ +struct set_asset_tag { + uint8_t grp_id; /* first byte: Group Extension ID */ + uint8_t length; + const char tag[16]; + uint8_t *data; +} __attribute__ ((packed)); + +/* make a struct for the return from the get thermal limit command */ +struct thermal_limit { + uint8_t grp_id; /* first byte: Group Extension ID */ + uint8_t exceptionActions; + uint8_t tempLimit; + uint16_t exceptionTime; +} __attribute__ ((packed)); + +int ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char ** argv); + +#endif /*IPMI_DCMI_H*/ diff --git a/include/ipmitool/ipmi_delloem.h b/include/ipmitool/ipmi_delloem.h new file mode 100644 index 0000000..88f5c22 --- /dev/null +++ b/include/ipmitool/ipmi_delloem.h @@ -0,0 +1,366 @@ +/**************************************************************************** +Copyright (c) 2008, Dell 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: +- Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +- Redistributions 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 Dell Inc nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + +*****************************************************************************/ +#ifndef IPMI_DELLOEM_H +#define IPMI_DELLOEM_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#pragma pack(1) + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + + +/* Dell selector for LCD control - get and set unless specified */ +#define IPMI_DELL_LCD_STRING_SELECTOR 0xC1 /* RW get/set the user string */ +#define IPMI_DELL_LCD_CONFIG_SELECTOR 0xC2 /* RW set to user/default/none */ +#define IPMI_DELL_LCD_GET_CAPS_SELECTOR 0xCF /* RO use when available*/ +#define IPMI_DELL_LCD_STRINGEX_SELECTOR 0xD0 /* RW get/set the user string use first when available*/ +#define IPMI_DELL_LCD_STATUS_SELECTOR 0xE7 /* LCD string when config set to default.*/ +#define IPMI_DELL_PLATFORM_MODEL_NAME_SELECTOR 0xD1 /* LCD string when config set to default.*/ + +/* Dell defines for picking which string to use */ +#define IPMI_DELL_LCD_CONFIG_USER_DEFINED 0x00 /* use string set by user*/ +#define IPMI_DELL_LCD_CONFIG_DEFAULT 0x01 /* use platform model name*/ +#define IPMI_DELL_LCD_CONFIG_NONE 0x02 /* blank*/ +#define IPMI_DELL_LCD_iDRAC_IPV4ADRESS 0x04 /* use string set by user*/ +#define IPMI_DELL_LCD_IDRAC_MAC_ADDRESS 0x08 /* use platform model name*/ +#define IPMI_DELL_LCD_OS_SYSTEM_NAME 0x10 /* blank*/ + +#define IPMI_DELL_LCD_SERVICE_TAG 0x20 /* use string set by user*/ +#define IPMI_DELL_LCD_iDRAC_IPV6ADRESS 0x40 /* use string set by user*/ +#define IPMI_DELL_LCD_AMBEINT_TEMP 0x80 /* use platform model name*/ +#define IPMI_DELL_LCD_SYSTEM_WATTS 0x100 /* blank*/ +#define IPMI_DELL_LCD_ASSET_TAG 0x200 + +#define IPMI_DELL_LCD_ERROR_DISP_SEL 0x01 /* use platform model name*/ +#define IPMI_DELL_LCD_ERROR_DISP_VERBOSE 0x02 /* blank*/ + +#define IPMI_DELL_IDRAC_VALIDATOR 0xDD +#define IPMI_DELL_POWER_CAP_STATUS 0xBA +#define IPMI_DELL_AVG_POWER_CONSMP_HST 0xEB +#define IPMI_DELL_PEAK_POWER_CONSMP_HST 0xEC +#define SYSTEM_BOARD_SYSTEM_LEVEL_SENSOR_NUM 0x98 + +#define IDRAC_11G 1 +#define IDRAC_12G 2 +// Return Error code for license +#define LICENSE_NOT_SUPPORTED 0x6F +#define VFL_NOT_LICENSED 0x33 +#define btuphr 0x01 +#define watt 0x00 +#define IPMI_DELL_POWER_CAP 0xEA +#define percent 0x03 + +/* Not on all Dell servers. If there, use it.*/ +typedef struct _tag_ipmi_dell_lcd_caps +{ + uint8_t parm_rev; /* 0x11 for IPMI 2.0 */ + uint8_t char_set; /* always 1 for printable ASCII 0x20-0x7E */ + uint8_t number_lines; /* 0-4, 1 for 9G. 10G tbd */ + uint8_t max_chars[4]; /* 62 for triathlon, 0 if not present (glacier) */ + /* [0] is max chars for line 1 */ +}IPMI_DELL_LCD_CAPS; + +#define IPMI_DELL_LCD_STRING_LENGTH_MAX 62 /* Valid for 9G. Glacier ??. */ +#define IPMI_DELL_LCD_STRING1_SIZE 14 +#define IPMI_DELL_LCD_STRINGN_SIZE 16 + +/* vFlash subcommands */ +#define IPMI_GET_EXT_SD_CARD_INFO 0xA4 + + +typedef struct _tag_ipmi_dell_lcd_string +{ + uint8_t parm_rev; /* 0x11 for IPMI 2.0 */ + uint8_t data_block_selector; /* 16-byte data block number to access, 0 based.*/ + union + { + struct + { + uint8_t encoding : 4; /* 0 is printable ASCII 7-bit */ + uint8_t length; /* 0 to max chars from lcd caps */ + uint8_t data[IPMI_DELL_LCD_STRING1_SIZE]; /* not zero terminated. */ + }selector_0_string; + uint8_t selector_n_data[IPMI_DELL_LCD_STRINGN_SIZE]; + }lcd_string; +} __attribute__ ((packed)) IPMI_DELL_LCD_STRING; + +/* Only found on servers with more than 1 line. Use if available. */ +typedef struct _tag_ipmi_dell_lcd_stringex +{ + uint8_t parm_rev; /* 0x11 for IPMI 2.0 */ + uint8_t line_number; /* LCD line number 1 to 4 */ + uint8_t data_block_selector; /* 16-byte data block number to access, 0 based.*/ + union + { + struct + { + uint8_t encoding : 4; /* 0 is printable ASCII 7-bit */ + uint8_t length; /* 0 to max chars from lcd caps */ + uint8_t data[IPMI_DELL_LCD_STRING1_SIZE]; /* not zero terminated. */ + } selector_0_string; + uint8_t selector_n_data[IPMI_DELL_LCD_STRINGN_SIZE]; + } lcd_string; +} __attribute__ ((packed)) IPMI_DELL_LCD_STRINGEX; + + +typedef struct _lcd_status +{ + char parametersel; + char vKVM_status; + char lock_status; + char Resv1; + char Resv; +} __attribute__ ((packed)) LCD_STATUS; + +typedef struct _lcd_mode +{ + uint8_t parametersel; + uint32_t lcdmode; + uint16_t lcdquallifier; + uint32_t capabilites; + uint8_t error_display; + uint8_t Resv; +} __attribute__ ((packed)) LCD_MODE; + +#define PARAM_REV_OFFSET (uint8_t)(0x1) +#define VIRTUAL_MAC_OFFSET (uint8_t)(0x1) + +#define LOM_MACTYPE_ETHERNET 0 +#define LOM_MACTYPE_ISCSI 1 +#define LOM_MACTYPE_RESERVED 3 + +#define LOM_ETHERNET_ENABLED 0 +#define LOM_ETHERNET_DISABLED 1 +#define LOM_ETHERNET_PLAYINGDEAD 2 +#define LOM_ETHERNET_RESERVED 3 + +#define LOM_ACTIVE 1 +#define LOM_INACTIVE 0 + +#define MACADDRESSLENGH 6 +#define MAX_LOM 8 + + +#define EMB_NIC_MAC_ADDRESS_11G (uint8_t)(0xDA) +#define EMB_NIC_MAC_ADDRESS_9G_10G (uint8_t)(0xCB) + +#define IMC_IDRAC_10G (uint8_t) (0x08) +#define IMC_CMC (uint8_t) (0x09) +#define IMC_IDRAC_11G_MONOLITHIC (uint8_t) (0x0A) +#define IMC_IDRAC_11G_MODULAR (uint8_t) (0x0B) +#define IMC_UNUSED (uint8_t) (0x0C) +#define IMC_MASER_LITE_BMC (uint8_t) (0x0D) +#define IMC_MASER_LITE_NU (uint8_t) (0x0E) +#define IMC_IDRAC_12G_MONOLITHIC (uint8_t) (0x10) +#define IMC_IDRAC_12G_MODULAR (uint8_t) (0x11) + + + +typedef struct +{ + unsigned int BladSlotNumber : 4; + unsigned int MacType : 2; + unsigned int EthernetStatus : 2; + unsigned int NICNumber : 5; + unsigned int Reserved : 3; + uint8_t MacAddressByte[MACADDRESSLENGH]; +} LOMMacAddressType; + + +typedef struct +{ + LOMMacAddressType LOMMacAddress [MAX_LOM]; +} EmbeddedNICMacAddressType; + +typedef struct +{ + uint8_t MacAddressByte[MACADDRESSLENGH]; +} MacAddressType; + +typedef struct +{ + MacAddressType MacAddress [MAX_LOM]; +} EmbeddedNICMacAddressType_10G; + + + +#define TRANSPORT_NETFN (uint8_t)(0xc) +#define GET_LAN_PARAM_CMD (uint8_t)(0x02) +#define MAC_ADDR_PARAM (uint8_t)(0x05) +#define LAN_CHANNEL_NUMBER (uint8_t)(0x01) + +#define IDRAC_NIC_NUMBER (uint8_t)(0x8) + +#define TOTAL_N0_NICS_INDEX (uint8_t)(0x1) + + +// 12g supported +#define SET_NIC_SELECTION_12G_CMD (uint8_t)(0x28) +#define GET_NIC_SELECTION_12G_CMD (uint8_t)(0x29) + +// 11g supported +#define SET_NIC_SELECTION_CMD (uint8_t)(0x24) +#define GET_NIC_SELECTION_CMD (uint8_t)(0x25) +#define GET_ACTIVE_NIC_CMD (uint8_t)(0xc1) +#define POWER_EFFICENCY_CMD (uint8_t)(0xc0) +#define SERVER_POWER_CONSUMPTION_CMD (uint8_t)(0x8F) + +#define POWER_SUPPLY_INFO (uint8_t)(0xb0) +#define IPMI_ENTITY_ID_POWER_SUPPLY (uint8_t)(0x0a) +#define SENSOR_STATE_STR_SIZE (uint8_t)(64) +#define SENSOR_NAME_STR_SIZE (uint8_t)(64) + +#define GET_PWRMGMT_INFO_CMD (uint8_t)(0x9C) +#define CLEAR_PWRMGMT_INFO_CMD (uint8_t)(0x9D) +#define GET_PWR_HEADROOM_CMD (uint8_t)(0xBB) +#define GET_PWR_CONSUMPTION_CMD (uint8_t)(0xB3) +#define GET_FRONT_PANEL_INFO_CMD (uint8_t)0xb5 + + +typedef struct _ipmi_power_monitor +{ + uint32_t cumStartTime; + uint32_t cumReading; + uint32_t maxPeakStartTime; + uint32_t ampPeakTime; + uint16_t ampReading; + uint32_t wattPeakTime; + uint16_t wattReading; +} __attribute__ ((packed)) IPMI_POWER_MONITOR; + + +#define MAX_POWER_FW_VERSION 8 + +typedef struct _ipmi_power_supply_infoo +{ + /*No param_rev it is not a System Information Command */ + uint16_t ratedWatts; + uint16_t ratedAmps; + uint16_t ratedVolts; + uint32_t vendorid; + uint8_t FrimwareVersion[MAX_POWER_FW_VERSION]; + uint8_t Powersupplytype; + uint16_t ratedDCWatts; + uint16_t Resv; + +} __attribute__ ((packed)) IPMI_POWER_SUPPLY_INFO; + + +typedef struct ipmi_power_consumption_data +{ + uint16_t actualpowerconsumption; + uint16_t powerthreshold; + uint16_t warningthreshold; + uint8_t throttlestate; + uint16_t maxpowerconsumption; + uint16_t throttlepowerconsumption; + uint16_t Resv; +} __attribute__ ((packed)) IPMI_POWER_CONSUMPTION_DATA; + + +typedef struct ipmi_inst_power_consumption_data +{ + uint16_t instanpowerconsumption; + uint16_t instanApms; + uint16_t resv1; + uint8_t resv; +} __attribute__ ((packed)) IPMI_INST_POWER_CONSUMPTION_DATA; + +typedef struct _ipmi_avgpower_consump_histroy +{ + uint8_t parameterselector; + uint16_t lastminutepower; + uint16_t lasthourpower; + uint16_t lastdaypower; + uint16_t lastweakpower; + +} __attribute__ ((packed)) IPMI_AVGPOWER_CONSUMP_HISTORY; + +typedef struct _ipmi_power_consump_histroy +{ + uint8_t parameterselector; + uint16_t lastminutepower; + uint16_t lasthourpower; + uint16_t lastdaypower; + uint16_t lastweakpower; + uint32_t lastminutepowertime; + uint32_t lasthourpowertime; + uint32_t lastdaypowertime; + uint32_t lastweekpowertime; +} __attribute__ ((packed)) IPMI_POWER_CONSUMP_HISTORY; + + +typedef struct _ipmi_delloem_power_cap +{ + uint8_t parameterselector; + uint16_t PowerCap; + uint8_t unit; + uint16_t MaximumPowerConsmp; + uint16_t MinimumPowerConsmp; + uint16_t totalnumpowersupp; + uint16_t AvailablePower ; + uint16_t SystemThrottling; + uint16_t Resv; +} __attribute__ ((packed)) IPMI_POWER_CAP; + +typedef struct _power_headroom +{ + uint16_t instheadroom; + uint16_t peakheadroom; +} __attribute__ ((packed)) POWER_HEADROOM; + +struct vFlashstr { + uint8_t val; + const char * str; +}; +typedef struct ipmi_vFlash_extended_info +{ + uint8_t vflashcompcode; + uint8_t sdcardstatus; + uint32_t sdcardsize; + uint32_t sdcardavailsize; + uint8_t bootpartion; + uint8_t Resv; +} __attribute__ ((packed)) IPMI_DELL_SDCARD_INFO; + + +typedef struct _SensorReadingType +{ + uint8_t sensorReading; + uint8_t sensorFlags; + uint16_t sensorState; +}SensorReadingType; +uint16_t compareinputwattage(IPMI_POWER_SUPPLY_INFO* powersupplyinfo, uint16_t inputwattage); +int ipmi_delloem_main(struct ipmi_intf * intf, int argc, char ** argv); + +#endif /*IPMI_DELLOEM_H*/ diff --git a/include/ipmitool/ipmi_ekanalyzer.h b/include/ipmitool/ipmi_ekanalyzer.h new file mode 100644 index 0000000..7c43220 --- /dev/null +++ b/include/ipmitool/ipmi_ekanalyzer.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007 Kontron Canada, Inc. All Rights Reserved. + * + * Base on code from + * 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. + */ + +#ifndef IPMI_EKANALYZER_H +#define IPMI_EKANALYZER_H + +#include <inttypes.h> +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_fru.h> + +#define RTM_FRU_FILE 0x00 +#define A1_AMC_FRU_FILE 0x01 +#define A2_AMC_FRU_FILE 0x02 +#define A3_AMC_FRU_FILE 0x03 +#define A4_AMC_FRU_FILE 0x04 +#define B1_AMC_FRU_FILE 0x05 +#define B2_AMC_FRU_FILE 0x06 +#define B3_AMC_FRU_FILE 0x07 +#define B4_AMC_FRU_FILE 0x08 +#define ON_CARRIER_FRU_FILE 0x09 +#define CONFIG_FILE 0x0A +#define SHELF_MANAGER_FRU_FILE 0x0B + +#define MIN_ARGUMENT 0x02 +#define RTM_IPMB_L 0x90 + +#define MAX_FILE_NUMBER 8 +/* this voltag is specified in AMC.0 specification Table 3-10 */ +#define AMC_VOLTAGE 12 /*volts*/ + +#define SIZE_OF_GUID 16 +#define FRU_RADIAL_IPMB0_LINK_MAPPING 0x15 + +int ipmi_ekanalyzer_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_EKANALYZER_H */ diff --git a/include/ipmitool/ipmi_entity.h b/include/ipmitool/ipmi_entity.h new file mode 100644 index 0000000..6e5198c --- /dev/null +++ b/include/ipmitool/ipmi_entity.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef IPMI_ENTITY_H +#define IPMI_ENTITY_H + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct entity_id { + uint8_t id; /* physical entity id */ +#if WORDS_BIGENDIAN + uint8_t logical : 1; /* physical/logical */ + uint8_t instance : 7; /* instance number */ +#else + uint8_t instance : 7; /* instance number */ + uint8_t logical : 1; /* physical/logical */ +#endif +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#endif /* IPMI_ENTITY_H */ diff --git a/include/ipmitool/ipmi_event.h b/include/ipmitool/ipmi_event.h new file mode 100644 index 0000000..2ba2fa5 --- /dev/null +++ b/include/ipmitool/ipmi_event.h @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#ifndef IPMI_EVENT_H +#define IPMI_EVENT_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> + +#define EVENT_DIR_ASSERT 0 +#define EVENT_DIR_DEASSERT 1 + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct platform_event_msg { + uint8_t evm_rev; + uint8_t sensor_type; + uint8_t sensor_num; +#if WORDS_BIGENDIAN + uint8_t event_dir : 1; + uint8_t event_type : 7; +#else + uint8_t event_type : 7; + uint8_t event_dir : 1; +#endif + uint8_t event_data[3]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +int ipmi_event_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_EVENT_H*/ diff --git a/include/ipmitool/ipmi_firewall.h b/include/ipmitool/ipmi_firewall.h new file mode 100644 index 0000000..f18770e --- /dev/null +++ b/include/ipmitool/ipmi_firewall.h @@ -0,0 +1,106 @@ +/* + * 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. + */ + +#ifndef IPMI_FIREWALL_H +#define IPMI_FIREWALL_H + +#include <ipmitool/ipmi.h> + +int ipmi_firewall_main(struct ipmi_intf *, int, char **); + +#define BMC_GET_NETFN_SUPPORT 0x09 +#define BMC_GET_COMMAND_SUPPORT 0x0A +#define BMC_GET_COMMAND_SUBFUNCTION_SUPPORT 0x0B +#define BMC_GET_CONFIGURABLE_COMMANDS 0x0C +#define BMC_GET_CONFIGURABLE_COMMAND_SUBFUNCTIONS 0x0D +#define BMC_SET_COMMAND_ENABLES 0x60 +#define BMC_GET_COMMAND_ENABLES 0x61 +#define BMC_SET_COMMAND_SUBFUNCTION_ENABLES 0x62 +#define BMC_GET_COMMAND_SUBFUNCTION_ENABLES 0x63 +#define BMC_OEM_NETFN_IANA_SUPPORT 0x64 + +#define SET_COMMAND_ENABLE_BYTE (BMC_SET_COMMAND_ENABLES / 8) +#define SET_COMMAND_ENABLE_BIT (BMC_SET_COMMAND_ENABLES % 8) + +#define MAX_LUN 4 +#define MAX_NETFN 64 +#define MAX_NETFN_PAIR (MAX_NETFN/2) +#define MAX_COMMAND 256 +#define MAX_SUBFN 32 +#define MAX_COMMAND_BYTES (MAX_COMMAND>>3) +#define MAX_SUBFN_BYTES (MAX_SUBFN>>3) + +// support is a bitfield with the following bits set... +#define BIT_AVAILABLE 0x01 +#define BIT_CONFIGURABLE 0x02 +#define BIT_ENABLED 0x04 + +extern int verbose; + +struct command_support { + unsigned char support; + unsigned char version[3]; + unsigned char subfn_support[MAX_SUBFN_BYTES]; + unsigned char subfn_config[MAX_SUBFN_BYTES]; + unsigned char subfn_enable[MAX_SUBFN_BYTES]; +}; +struct lun_netfn_support { + unsigned char support; + struct command_support command[MAX_COMMAND]; + unsigned char command_mask[MAX_COMMAND_BYTES]; + unsigned char config_mask[MAX_COMMAND_BYTES]; + unsigned char enable_mask[MAX_COMMAND_BYTES]; +}; +struct lun_support { + unsigned char support; + struct lun_netfn_support netfn[MAX_NETFN_PAIR]; +}; +struct bmc_fn_support { + struct lun_support lun[MAX_LUN]; +}; +struct ipmi_function_params { + int channel; + int lun; + int netfn; + int command; + int subfn; + unsigned char force; +}; + +static inline int bit_test(const unsigned char * bf, int n) { + return !!(bf[n>>3]&(1<<(n%8))); +} +static inline void bit_set(unsigned char * bf, int n, int v) { + bf[n>>3] = (bf[n>>3] & ~(1<<(n%8))) | ((v?1:0)<<(n%8)); +} + +#endif /*IPMI_FIREWALL_H */ diff --git a/include/ipmitool/ipmi_fru.h b/include/ipmitool/ipmi_fru.h new file mode 100644 index 0000000..4d255a8 --- /dev/null +++ b/include/ipmitool/ipmi_fru.h @@ -0,0 +1,623 @@ +/* + * 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. + */ + +#ifndef IPMI_FRU_H +#define IPMI_FRU_H + +#include <inttypes.h> +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_sdr.h> + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#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 { + uint16_t size; + uint8_t access:1; + uint8_t max_read_size; + uint8_t max_write_size; +}; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_header { + uint8_t version; + union { + struct { + uint8_t internal; + uint8_t chassis; + uint8_t board; + uint8_t product; + uint8_t multi; + } offset; + uint8_t offsets[5]; + }; + uint8_t pad; + uint8_t checksum; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +struct fru_area_chassis { + uint8_t area_ver; + uint8_t type; + uint16_t area_len; + char * part; + char * serial; +}; + +struct fru_area_board { + uint8_t area_ver; + uint8_t lang; + uint16_t area_len; + uint32_t mfg_date_time; + char * mfg; + char * prod; + char * serial; + char * part; + char * fru; +}; + +struct fru_area_product { + uint8_t area_ver; + uint8_t lang; + uint16_t area_len; + char * mfg; + char * name; + char * part; + char * version; + char * serial; + char * asset; + char * fru; +}; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +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 +#define FRU_RECORD_TYPE_OEM_EXTENSION 0xc0 + uint8_t type; + uint8_t format; + uint8_t len; + uint8_t record_checksum; + uint8_t header_checksum; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_multirec_powersupply { +#if WORDS_BIGENDIAN + uint16_t capacity; +#else + uint16_t capacity:12; + uint16_t __reserved1:4; +#endif + uint16_t peak_va; + uint8_t inrush_current; + uint8_t inrush_interval; + uint16_t lowend_input1; + uint16_t highend_input1; + uint16_t lowend_input2; + uint16_t highend_input2; + uint8_t lowend_freq; + uint8_t highend_freq; + uint8_t dropout_tolerance; +#if WORDS_BIGENDIAN + uint8_t __reserved2:3; + uint8_t tach:1; + uint8_t hotswap:1; + uint8_t autoswitch:1; + uint8_t pfc:1; + uint8_t predictive_fail:1; +#else + uint8_t predictive_fail:1; + uint8_t pfc:1; + uint8_t autoswitch:1; + uint8_t hotswap:1; + uint8_t tach:1; + uint8_t __reserved2:3; +#endif + uint16_t peak_cap_ht; +#if WORDS_BIGENDIAN + uint8_t combined_voltage1:4; + uint8_t combined_voltage2:4; +#else + uint8_t combined_voltage2:4; + uint8_t combined_voltage1:4; +#endif + uint16_t combined_capacity; + uint8_t rps_threshold; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +static const char * combined_voltage_desc[] __attribute__((unused)) = { +"12 V", "-12 V", "5 V", "3.3 V"}; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_multirec_dcoutput { +#if WORDS_BIGENDIAN + uint8_t standby:1; + uint8_t __reserved:3; + uint8_t output_number:4; +#else + uint8_t output_number:4; + uint8_t __reserved:3; + uint8_t standby:1; +#endif + short nominal_voltage; + short max_neg_dev; + short max_pos_dev; + uint16_t ripple_and_noise; + uint16_t min_current; + uint16_t max_current; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_multirec_dcload { +#if WORDS_BIGENDIAN + uint8_t __reserved:4; + uint8_t output_number:4; +#else + uint8_t output_number:4; + uint8_t __reserved:4; +#endif + short nominal_voltage; + short min_voltage; + short max_voltage; + uint16_t ripple_and_noise; + uint16_t min_current; + uint16_t max_current; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_multirec_oem_header { + unsigned char mfg_id[3]; +#define FRU_PICMG_BACKPLANE_P2P 0x04 +#define FRU_PICMG_ADDRESS_TABLE 0x10 +#define FRU_PICMG_SHELF_POWER_DIST 0x11 +#define FRU_PICMG_SHELF_ACTIVATION 0x12 +#define FRU_PICMG_SHMC_IP_CONN 0x13 +#define FRU_PICMG_BOARD_P2P 0x14 +#define FRU_AMC_CURRENT 0x16 +#define FRU_AMC_ACTIVATION 0x17 +#define FRU_AMC_CARRIER_P2P 0x18 +#define FRU_AMC_P2P 0x19 +#define FRU_AMC_CARRIER_INFO 0x1a +#define FRU_UTCA_FRU_INFO_TABLE 0x20 +#define FRU_UTCA_CARRIER_MNG_IP 0x21 +#define FRU_UTCA_CARRIER_INFO 0x22 +#define FRU_UTCA_CARRIER_LOCATION 0x23 +#define FRU_UTCA_SHMC_IP_LINK 0x24 +#define FRU_UTCA_POWER_POLICY 0x25 +#define FRU_UTCA_ACTIVATION 0x26 +#define FRU_UTCA_PM_CAPABILTY 0x27 +#define FRU_UTCA_FAN_GEOGRAPHY 0x28 +#define FRU_UTCA_CLOCK_MAPPING 0x29 +#define FRU_UTCA_MSG_BRIDGE_POLICY 0x2A +#define FRU_UTCA_OEM_MODULE_DESC 0x2B +#define FRU_PICMG_CLK_CARRIER_P2P 0x2C +#define FRU_PICMG_CLK_CONFIG 0x2D + unsigned char record_id; + unsigned char record_version; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_guid { + unsigned char guid[16]; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_link_desc { +#ifndef WORDS_BIGENDIAN + unsigned int desig_channel:6; + unsigned int desig_if:2; + unsigned int desig_port:4; +#define FRU_PICMGEXT_LINK_TYPE_BASE 0x01 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET 0x02 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND 0x03 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR 0x04 +#define FRU_PICMGEXT_LINK_TYPE_PCIE 0x05 + unsigned int type:8; + unsigned int ext:4; + unsigned int grouping:8; +#else + unsigned int grouping:8; + unsigned int ext:4; +#define FRU_PICMGEXT_LINK_TYPE_BASE 0x01 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET 0x02 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND 0x03 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR 0x04 +#define FRU_PICMGEXT_LINK_TYPE_PCIE 0x05 + unsigned int type:8; + unsigned int desig_port:4; + unsigned int desig_if:2; + unsigned int desig_channel:6; +#endif +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + +#define FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED 0x00 +#define FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 0x01 +#define FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS 0x02 +#define FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 0x03 +#define FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 0x04 +#define FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET 0x05 +#define FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO 0x06 +#define FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE 0x07 + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +/* This is used in command, not in FRU */ +struct fru_picmgext_amc_link_info { + unsigned char linkInfo[3]; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_amc_link_desc_core { +#ifndef WORDS_BIGENDIAN + unsigned int designator:12; + unsigned int type:8; + unsigned int ext:4; + unsigned int grouping:8; +#else + unsigned int grouping:8; + unsigned int ext:4; + unsigned int type:8; + unsigned int designator:12; +#endif +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_amc_link_desc_extra { +#ifndef WORDS_BIGENDIAN + unsigned char asymetricMatch:2; + unsigned char reserved:6; +#else + unsigned char reserved:6; + unsigned char asymetricMatch:2; +#endif +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_amc_link_desc { +#ifndef WORDS_BIGENDIAN + struct fru_picmgext_amc_link_desc_core core;/* lsb */ + struct fru_picmgext_amc_link_desc_extra extra; +#else + struct fru_picmgext_amc_link_desc_extra extra; + struct fru_picmgext_amc_link_desc_core core;/* lsb */ +#endif +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + +#define FRU_PICMGEXT_OEM_SWFW 0x03 +#define OEM_SWFW_NBLOCK_OFFSET 0x05 +#define OEM_SWFW_FIELD_START_OFFSET 0x06 + +#define FRU_PICMGEXT_CHN_DESC_RECORD_SIZE 3 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_chn_desc { +#ifndef WORDS_BIGENDIAN + unsigned int remote_slot:8; + unsigned int remote_chn:5; + unsigned int local_chn:5; + unsigned int res:14; +#else + unsigned int res:14; + unsigned int local_chn:5; + unsigned int remote_chn:5; + unsigned int remote_slot:8; +#endif +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_slot_desc { + unsigned char chan_type; + unsigned char slot_addr; + unsigned char chn_count; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#define FRU_PICMGEXT_DESIGN_IF_BASE 0x00 +#define FRU_PICMGEXT_DESIGN_IF_FABRIC 0x01 +#define FRU_PICMGEXT_DESIGN_IF_UPDATE_CHANNEL 0x02 +#define FRU_PICMGEXT_DESIGN_IF_RESERVED 0x03 + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_carrier_activation_record { + unsigned short max_internal_curr; + unsigned char allowance_for_readiness; + unsigned char module_activation_record_count; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_activation_record { + unsigned char ibmb_addr; + unsigned char max_module_curr; + unsigned char reserved; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_carrier_p2p_record { + unsigned char resource_id; + unsigned char p2p_count; +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_carrier_p2p_descriptor { +#ifndef WORDS_BIGENDIAN + unsigned char remote_resource_id; + unsigned short remote_port:5; + unsigned short local_port:5; + unsigned short reserved:6; +#else + unsigned short reserved:6; + unsigned short local_port:5; + unsigned short remote_port:5; + unsigned char remote_resource_id; +#endif +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_amc_p2p_record { +#ifndef WORDS_BIGENDIAN + unsigned char resource_id :4; + unsigned char /* reserved */ :3; + unsigned char record_type :1; +#else + unsigned char record_type :1; + unsigned char /* reserved */ :3; + unsigned char resource_id :4; +#endif +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#define FRU_PICMGEXT_AMC_CHANNEL_DESC_RECORD_SIZE 3 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_amc_channel_desc_record { +#ifndef WORDS_BIGENDIAN + unsigned int lane0port :5; + unsigned int lane1port :5; + unsigned int lane2port :5; + unsigned int lane3port :5; + unsigned int /* reserved */ :12; +#else + unsigned int /* reserved */ :12; + unsigned int lane3port :5; + unsigned int lane2port :5; + unsigned int lane1port :5; + unsigned int lane0port :5; +#endif +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#define FRU_PICMGEXT_AMC_LINK_DESC_RECORD_SIZE 5 +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct fru_picmgext_amc_link_desc_record { + #define FRU_PICMGEXT_AMC_LINK_TYPE_PCIE 0x02 + #define FRU_PICMGEXT_AMC_LINK_TYPE_PCIE_AS1 0x03 + #define FRU_PICMGEXT_AMC_LINK_TYPE_PCIE_AS2 0x04 + #define FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET 0x05 + #define FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO 0x06 + #define FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE 0x07 + + #define AMC_LINK_TYPE_EXT_PCIE_G1_NSSC 0x00 + #define AMC_LINK_TYPE_EXT_PCIE_G1_SSC 0x01 + #define AMC_LINK_TYPE_EXT_PCIE_G2_NSSC 0x02 + #define AMC_LINK_TYPE_EXT_PCIE_G2_SSC 0x03 + + #define AMC_LINK_TYPE_EXT_ETH_1000_BX 0x00 + #define AMC_LINK_TYPE_EXT_ETH_10G_XAUI 0x01 + + #define AMC_LINK_TYPE_EXT_STORAGE_FC 0x00 + #define AMC_LINK_TYPE_EXT_STORAGE_SATA 0x01 + #define AMC_LINK_TYPE_EXT_STORAGE_SAS 0x02 +#ifndef WORDS_BIGENDIAN + unsigned int channel_id :8; + unsigned int port_flag_0 :1; + unsigned int port_flag_1 :1; + unsigned int port_flag_2 :1; + unsigned int port_flag_3 :1; + unsigned int type :8; + unsigned int type_ext :4; + unsigned int group_id :8; + unsigned int asym_match :2; + unsigned int /* reserved */ :30; +#else + unsigned int group_id :8; + unsigned int type_ext :4; + unsigned int type :8; + unsigned int port_flag_3 :1; + unsigned int port_flag_2 :1; + unsigned int port_flag_1 :1; + unsigned int port_flag_0 :1; + unsigned int channel_id :8; + + unsigned int /* reserved */ :30; + unsigned int asym_match :2; +#endif +}ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +/* FRU Board manufacturing date */ +static const uint64_t secs_from_1970_1996 = 820454400; +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", + "Sealed-case PC", "Multi-system Chassis", "CompactPCI", + "AdvancedTCA", "Blade", "Blade Enclosure" +}; + +typedef struct ipmi_fru_bloc { + struct ipmi_fru_bloc * next; + uint16_t start; + uint16_t size; + uint8_t blocId[32]; +} t_ipmi_fru_bloc; + +static const char *section_id[4] = { + "Internal Use Section", + "Chassis Section", + "Board Section", + "Product Section" +}; + +int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv); +int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru); + +#endif /* IPMI_FRU_H */ diff --git a/include/ipmitool/ipmi_fwum.h b/include/ipmitool/ipmi_fwum.h new file mode 100644 index 0000000..c19a582 --- /dev/null +++ b/include/ipmitool/ipmi_fwum.h @@ -0,0 +1,243 @@ +/* + * 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. + */ + +#ifndef IPMI_KFWUM_H +# define IPMI_KFWUM_H + +#include <inttypes.h> +#include <ipmitool/ipmi.h> + +/* KFWUM Version */ +# define VER_MAJOR 1 +# define VER_MINOR 3 +/* Minimum size (IPMB/IOL/old protocol) */ +# define KFWUM_SMALL_BUFFER 32 +/* Maximum size on KCS interface */ +# define KFWUM_BIG_BUFFER 32 +# define MAX_BUFFER_SIZE 1024*16 + +/* 3 address + 1 size + 1 checksum + 1 command */ +# define KFWUM_OLD_CMD_OVERHEAD 6 +/* 1 sequence + 1 size + 1 checksum + 1 command */ +# define KFWUM_NEW_CMD_OVERHEAD 4 +# define KFWUM_PAGE_SIZE 256 + +# define FWUM_SAVE_FIRMWARE_NO_RESPONSE_LIMIT 6 +# define FWUM_MAX_UPLOAD_RETRY 6 + +# define TRACE_LOG_CHUNK_COUNT 7 +# define TRACE_LOG_CHUNK_SIZE 7 +# define TRACE_LOG_ATT_COUNT 3 + +# define IN_FIRMWARE_INFO_OFFSET_LOCATION 0x5a0 +# define IN_FIRMWARE_INFO_SIZE 20 +# define IN_FIRMWARE_INFO_OFFSET_FILE_SIZE 0 +# define IN_FIRMWARE_INFO_OFFSET_CHECKSUM 4 +# define IN_FIRMWARE_INFO_OFFSET_BOARD_ID 6 +# define IN_FIRMWARE_INFO_OFFSET_DEVICE_ID 8 +# define IN_FIRMWARE_INFO_OFFSET_TABLE_VERSION 9 +# define IN_FIRMWARE_INFO_OFFSET_IMPLEMENT_REV 10 +# define IN_FIRMWARE_INFO_OFFSET_VER_MAJOROR 11 +# define IN_FIRMWARE_INFO_OFFSET_VER_MINORSUB 12 +# define IN_FIRMWARE_INFO_OFFSET_SDR_REV 13 +# define IN_FIRMWARE_INFO_OFFSET_IANA0 14 +# define IN_FIRMWARE_INFO_OFFSET_IANA1 15 +# define IN_FIRMWARE_INFO_OFFSET_IANA2 16 + +# define KWUM_GET_BYTE_AT_OFFSET(pBuffer,os) pBuffer[os] + +int ipmi_fwum_main(struct ipmi_intf *, int, char **); + +typedef enum eKFWUM_BoardList +{ + KFWUM_BOARD_KONTRON_UNKNOWN = 0, + KFWUM_BOARD_KONTRON_5002 = 5002, +} tKFWUM_BoardList; + +typedef struct sKFWUM_BoardInfo +{ + tKFWUM_BoardList boardId; + IPMI_OEM iana; +} tKFWUM_BoardInfo; + +typedef enum eKFWUM_DownloadType +{ + KFWUM_DOWNLOAD_TYPE_ADDRESS = 0, + KFWUM_DOWNLOAD_TYPE_SEQUENCE, +} tKFWUM_DownloadType; + +typedef enum eKFWUM_DownloadBuffferType +{ + KFWUM_SMALL_BUFFER_TYPE = 0, + KFUMW_BIG_BUFFER_TYPE +} tKFWUM_DownloadBuffferType; + +typedef struct sKFWUM_InFirmwareInfo +{ + unsigned long fileSize; + unsigned short checksum; + unsigned short sumToRemoveFromChecksum; + /* Since the checksum is added in the bin + * after the checksum is calculated, we + * need to remove the each byte value. This + * byte will contain the addition of both bytes + */ + tKFWUM_BoardList boardId; + unsigned char deviceId; + unsigned char tableVers; + unsigned char implRev; + unsigned char versMajor; + unsigned char versMinor; + unsigned char versSubMinor; + unsigned char sdrRev; + IPMI_OEM iana; +} tKFWUM_InFirmwareInfo; + +typedef struct sKFWUM_SaveFirmwareInfo +{ + tKFWUM_DownloadType downloadType; + unsigned char bufferSize; + unsigned char overheadSize; +} tKFWUM_SaveFirmwareInfo; + +/* COMMANDS */ +# ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +# endif +struct KfwumGetInfoResp { + unsigned char protocolRevision; + unsigned char controllerDeviceId; + struct { + unsigned char mode:1; + unsigned char seqAdd:1; + unsigned char res : 6; + } byte; + unsigned char firmRev1; + unsigned char firmRev2; + unsigned char numBank; +} ATTRIBUTE_PACKING; +# ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +# endif + +# ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +# endif +struct KfwumGetStatusResp { + unsigned char bankState; + unsigned char firmLengthLSB; + unsigned char firmLengthMid; + unsigned char firmLengthMSB; + unsigned char firmRev1; + unsigned char firmRev2; + unsigned char firmRev3; +} ATTRIBUTE_PACKING; +# ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +# endif + +# ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +# endif +struct KfwumManualRollbackReq { + unsigned char type; +} ATTRIBUTE_PACKING; +# ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +# endif + +# ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +# endif +struct KfwumStartFirmwareDownloadReq { + unsigned char lengthLSB; + unsigned char lengthMid; + unsigned char lengthMSB; + unsigned char paddingLSB; + unsigned char paddingMSB; + unsigned char useSequence; +} ATTRIBUTE_PACKING; +# ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +# endif + +# ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +# endif +struct KfwumStartFirmwareDownloadResp { + unsigned char bank; +} ATTRIBUTE_PACKING; +# ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +# endif + +# ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +# endif +struct KfwumSaveFirmwareAddressReq +{ + unsigned char addressLSB; + unsigned char addressMid; + unsigned char addressMSB; + unsigned char numBytes; + unsigned char txBuf[KFWUM_SMALL_BUFFER-KFWUM_OLD_CMD_OVERHEAD]; +} ATTRIBUTE_PACKING; +# ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +# endif + +# ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +# endif +struct KfwumSaveFirmwareSequenceReq +{ + unsigned char sequenceNumber; + unsigned char txBuf[KFWUM_BIG_BUFFER]; +} ATTRIBUTE_PACKING; +# ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +# endif + +# ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +# endif +struct KfwumFinishFirmwareDownloadReq { + unsigned char versionMaj; + unsigned char versionMinSub; + unsigned char versionSdr; + unsigned char reserved; +} ATTRIBUTE_PACKING; +# ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +# endif + +#endif /* IPMI_KFWUM_H */ diff --git a/include/ipmitool/ipmi_gendev.h b/include/ipmitool/ipmi_gendev.h new file mode 100644 index 0000000..cb18699 --- /dev/null +++ b/include/ipmitool/ipmi_gendev.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2003 Kontron Canada, 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. + */ + +#ifndef IPMI_GENDEV_H +#define IPMI_GENDEV_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <math.h> +#include <ipmitool/bswap.h> +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_entity.h> + +int ipmi_gendev_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_GENDEV_H */ diff --git a/include/ipmitool/ipmi_hpmfwupg.h b/include/ipmitool/ipmi_hpmfwupg.h new file mode 100644 index 0000000..305091e --- /dev/null +++ b/include/ipmitool/ipmi_hpmfwupg.h @@ -0,0 +1,808 @@ +/* + * 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. + */ + +#ifndef IPMI_HPMFWUPG_H +#define IPMI_HPMFWUPG_H + +#include <inttypes.h> +#include <ipmitool/ipmi.h> + +int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **); + +/* Agent version */ +#define HPMFWUPG_VERSION_MAJOR 1 +#define HPMFWUPG_VERSION_MINOR 0 +#define HPMFWUPG_VERSION_SUBMINOR 9 + +/* HPM.1 FIRMWARE UPGRADE COMMANDS (part of PICMG) */ +#define HPMFWUPG_GET_TARGET_UPG_CAPABILITIES 0x2E +#define HPMFWUPG_GET_COMPONENT_PROPERTIES 0x2F +#define HPMFWUPG_ABORT_UPGRADE 0x30 +#define HPMFWUPG_INITIATE_UPGRADE_ACTION 0x31 +#define HPMFWUPG_UPLOAD_FIRMWARE_BLOCK 0x32 +#define HPMFWUPG_FINISH_FIRMWARE_UPLOAD 0x33 +#define HPMFWUPG_GET_UPGRADE_STATUS 0x34 +#define HPMFWUPG_ACTIVATE_FIRMWARE 0x35 +#define HPMFWUPG_QUERY_SELFTEST_RESULT 0x36 +#define HPMFWUPG_QUERY_ROLLBACK_STATUS 0x37 +#define HPMFWUPG_MANUAL_FIRMWARE_ROLLBACK 0x38 + +/* HPM.1 SPECIFIC COMPLETION CODES */ +#define HPMFWUPG_ROLLBACK_COMPLETED 0x00 +#define HPMFWUPG_COMMAND_IN_PROGRESS 0x80 +#define HPMFWUPG_NOT_SUPPORTED 0x81 +#define HPMFWUPG_SIZE_MISMATCH 0x81 +#define HPMFWUPG_ROLLBACK_FAILURE 0x81 +#define HPMFWUPG_INV_COMP_MASK 0x81 +#define HPMFWUPG__ABORT_FAILURE 0x81 +#define HPMFWUPG_INV_COMP_ID 0x82 +#define HPMFWUPG_INT_CHECKSUM_ERROR 0x82 +#define HPMFWUPG_INV_UPLOAD_MODE 0x82 +#define HPMFWUPG_ROLLBACK_OVERRIDE 0x82 +#define HPMFWUPG_INV_COMP_PROP 0x83 +#define HPMFWUPG_FW_MISMATCH 0x83 +#define HPMFWUPG_ROLLBACK_DENIED 0x83 + +/* + * This error code is used as a temporary PATCH to + * the latest Open ipmi driver. This PATCH + * will be removed once a new Open IPMI driver is released. + * (Buggy version = 39) + */ +#define ENABLE_OPENIPMI_V39_PATCH + +#ifdef ENABLE_OPENIPMI_V39_PATCH +# define RETRY_COUNT_MAX 3 +static int errorCount; +# define HPMFWUPG_IS_RETRYABLE(error) \ + ((((error==0x83)||(error==0x82)||(error==0x80)) && (errorCount++<RETRY_COUNT_MAX))?TRUE:FALSE) +#else +# define HPMFWUPG_IS_RETRYABLE(error) FALSE +#endif + +/* HPM FIRMWARE UPGRADE GENERAL DEFINITIONS */ +#define HPMFWUPG_PICMG_IDENTIFIER 0 +#define HPMFWUPG_VERSION_SIZE 6 +#define HPMFWUPG_DESC_STRING_LENGTH 12 +#define HPMFWUPG_DEFAULT_INACCESS_TIMEOUT 60 /* sec */ +#define HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT 60 /* sec */ +#define HPMFWUPG_MD5_SIGNATURE_LENGTH 16 + +/* Component IDs */ +typedef enum eHpmfwupgComponentId { + HPMFWUPG_COMPONENT_ID_0 = 0, + HPMFWUPG_COMPONENT_ID_1, + HPMFWUPG_COMPONENT_ID_2, + HPMFWUPG_COMPONENT_ID_3, + HPMFWUPG_COMPONENT_ID_4, + HPMFWUPG_COMPONENT_ID_5, + HPMFWUPG_COMPONENT_ID_6, + HPMFWUPG_COMPONENT_ID_7, + HPMFWUPG_COMPONENT_ID_MAX +} tHpmfwupgComponentId; + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgComponentBitMask { + union { + unsigned char byte; + struct { +#ifdef WORDS_BIGENDIAN + unsigned char component7 : 1; + unsigned char component6 : 1; + unsigned char component5 : 1; + unsigned char component4 : 1; + unsigned char component3 : 1; + unsigned char component2 : 1; + unsigned char component1 : 1; + unsigned char component0 : 1; +#else + unsigned char component0 : 1; + unsigned char component1 : 1; + unsigned char component2 : 1; + unsigned char component3 : 1; + unsigned char component4 : 1; + unsigned char component5 : 1; + unsigned char component6 : 1; + unsigned char component7 : 1; +#endif + } ATTRIBUTE_PACKING bitField; + } ATTRIBUTE_PACKING ComponentBits; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + + +static const int HPMFWUPG_SUCCESS = 0; +static const int HPMFWUPG_ERROR = -1; +/* Upload firmware specific error codes */ +static const int HPMFWUPG_UPLOAD_BLOCK_LENGTH = 1; +static const int HPMFWUPG_UPLOAD_RETRY = 2; + + +/* TARGET UPGRADE CAPABILITIES DEFINITIONS */ +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetTargetUpgCapabilitiesReq { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetTargetUpgCapabilitiesResp { + unsigned char picmgId; + unsigned char hpmVersion; + union { + unsigned char byte; + struct { +#if WORDS_BIGENDIAN + unsigned char fwUpgUndesirable : 1; + unsigned char autRollbackOverride : 1; + unsigned char ipmcDegradedDurinUpg: 1; + unsigned char deferActivation : 1; + unsigned char servAffectDuringUpg : 1; + unsigned char manualRollback : 1; + unsigned char autRollback : 1; + unsigned char ipmcSelftestCap : 1; +#else + unsigned char ipmcSelftestCap : 1; + unsigned char autRollback : 1; + unsigned char manualRollback : 1; + unsigned char servAffectDuringUpg : 1; + unsigned char deferActivation : 1; + unsigned char ipmcDegradedDurinUpg: 1; + unsigned char autRollbackOverride : 1; + unsigned char fwUpgUndesirable : 1; +#endif + } ATTRIBUTE_PACKING bitField; + } ATTRIBUTE_PACKING GlobalCapabilities; + unsigned char upgradeTimeout; + unsigned char selftestTimeout; + unsigned char rollbackTimeout; + unsigned char inaccessTimeout; + struct HpmfwupgComponentBitMask componentsPresent; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetTargetUpgCapabilitiesCtx { + struct HpmfwupgGetTargetUpgCapabilitiesReq req; + struct HpmfwupgGetTargetUpgCapabilitiesResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* COMPONENT PROPERTIES DEFINITIONS */ +typedef enum eHpmfwupgCompPropertiesSelect { + HPMFWUPG_COMP_GEN_PROPERTIES = 0, + HPMFWUPG_COMP_CURRENT_VERSION, + HPMFWUPG_COMP_DESCRIPTION_STRING, + HPMFWUPG_COMP_ROLLBACK_FIRMWARE_VERSION, + HPMFWUPG_COMP_DEFERRED_FIRMWARE_VERSION, + HPMFWUPG_COMP_RESERVED, + HPMFWUPG_COMP_OEM_PROPERTIES = 192 +} tHpmfwupgCompPropertiesSelect; + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetComponentPropertiesReq { + unsigned char picmgId; + unsigned char componentId; + unsigned char selector; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetGeneralPropResp { + unsigned char picmgId; + union { + unsigned char byte; + struct { +#if WORDS_BIGENDIAN + unsigned char reserved : 2; + unsigned char payloadColdReset : 1; + unsigned char deferredActivation : 1; + unsigned char comparisonSupport : 1; + unsigned char preparationSupport : 1; + unsigned char rollbackBackup : 2; +#else + unsigned char rollbackBackup : 2; + unsigned char preparationSupport : 1; + unsigned char comparisonSupport : 1; + unsigned char deferredActivation : 1; + unsigned char payloadColdReset : 1; + unsigned char reserved : 2; +#endif + } ATTRIBUTE_PACKING bitfield; + } ATTRIBUTE_PACKING GeneralCompProperties; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetCurrentVersionResp { + unsigned char picmgId; + unsigned char currentVersion[HPMFWUPG_VERSION_SIZE]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetDescStringResp { + unsigned char picmgId; + char descString[HPMFWUPG_DESC_STRING_LENGTH]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetRollbackFwVersionResp { + unsigned char picmgId; + unsigned char rollbackFwVersion[HPMFWUPG_VERSION_SIZE]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetDeferredFwVersionResp { + unsigned char picmgId; + unsigned char deferredFwVersion[HPMFWUPG_VERSION_SIZE]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* GetComponentProperties - OEM properties (192) */ +#define HPMFWUPG_OEM_LENGTH 4 +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetOemProperties { + unsigned char picmgId; + unsigned char oemRspData[HPMFWUPG_OEM_LENGTH]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetComponentPropertiesResp { + union { + struct HpmfwupgGetGeneralPropResp generalPropResp; + struct HpmfwupgGetCurrentVersionResp currentVersionResp; + struct HpmfwupgGetDescStringResp descStringResp; + struct HpmfwupgGetRollbackFwVersionResp rollbackFwVersionResp; + struct HpmfwupgGetDeferredFwVersionResp deferredFwVersionResp; + struct HpmfwupgGetOemProperties oemProperties; + } ATTRIBUTE_PACKING Response; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetComponentPropertiesCtx { + struct HpmfwupgGetComponentPropertiesReq req; + struct HpmfwupgGetComponentPropertiesResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* ABORT UPGRADE DEFINITIONS */ +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgAbortUpgradeReq { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgAbortUpgradeResp { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgAbortUpgradeCtx { + struct HpmfwupgAbortUpgradeReq req; + struct HpmfwupgAbortUpgradeResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* UPGRADE ACTIONS DEFINITIONS */ +typedef enum eHpmfwupgUpgradeAction { + HPMFWUPG_UPGRADE_ACTION_BACKUP = 0, + HPMFWUPG_UPGRADE_ACTION_PREPARE, + HPMFWUPG_UPGRADE_ACTION_UPGRADE, + HPMFWUPG_UPGRADE_ACTION_COMPARE, + HPMFWUPG_UPGRADE_ACTION_INVALID = 0xff +} tHpmfwupgUpgradeAction; + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgInitiateUpgradeActionReq { + unsigned char picmgId; + struct HpmfwupgComponentBitMask componentsMask; + unsigned char upgradeAction; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgInitiateUpgradeActionResp { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgInitiateUpgradeActionCtx { + struct HpmfwupgInitiateUpgradeActionReq req; + struct HpmfwupgInitiateUpgradeActionResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* UPLOAD FIRMWARE BLOCK DEFINITIONS */ +#define HPMFWUPG_SEND_DATA_COUNT_KCS 30 +#define HPMFWUPG_SEND_DATA_COUNT_LAN 25 +#define HPMFWUPG_SEND_DATA_COUNT_IPMB 26 +#define HPMFWUPG_SEND_DATA_COUNT_IPMBL 26 + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgUploadFirmwareBlockReq { + unsigned char picmgId; + unsigned char blockNumber; + unsigned char data[0]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgUploadFirmwareBlockResp { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgUploadFirmwareBlockCtx { + struct HpmfwupgUploadFirmwareBlockReq * req; + struct HpmfwupgUploadFirmwareBlockResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* FINISH FIRMWARE UPLOAD DEFINITIONS */ +#define HPMFWUPG_IMAGE_SIZE_BYTE_COUNT 4 + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgFinishFirmwareUploadReq { + unsigned char picmgId; + unsigned char componentId; + unsigned char imageLength[HPMFWUPG_IMAGE_SIZE_BYTE_COUNT]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgFinishFirmwareUploadResp { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgFinishFirmwareUploadCtx { + struct HpmfwupgFinishFirmwareUploadReq req; + struct HpmfwupgFinishFirmwareUploadResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* ACTIVATE FW DEFINITIONS */ +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgActivateFirmwareReq { + unsigned char picmgId; + unsigned char rollback_override; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgActivateFirmwareResp { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgActivateFirmwareCtx { + struct HpmfwupgActivateFirmwareReq req; + struct HpmfwupgActivateFirmwareResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* GET UPGRADE STATUS DEFINITIONS */ +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetUpgradeStatusReq { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetUpgradeStatusResp { + unsigned char picmgId; + unsigned char cmdInProcess; + unsigned char lastCmdCompCode; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgGetUpgradeStatusCtx { + struct HpmfwupgGetUpgradeStatusReq req; + struct HpmfwupgGetUpgradeStatusResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* MANUAL FW ROLLBACK DEFINITIONS */ +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgManualFirmwareRollbackReq { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgManualFirmwareRollbackResp { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif +struct HpmfwupgManualFirmwareRollbackCtx { + struct HpmfwupgManualFirmwareRollbackReq req; + struct HpmfwupgManualFirmwareRollbackResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* QUERY ROLLBACK STATUS DEFINITIONS */ +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgQueryRollbackStatusReq { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgQueryRollbackStatusResp { + unsigned char picmgId; + struct HpmfwupgComponentBitMask rollbackComp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgQueryRollbackStatusCtx { + struct HpmfwupgQueryRollbackStatusReq req; + struct HpmfwupgQueryRollbackStatusResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* QUERY SELF TEST RESULT DEFINITIONS */ +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgQuerySelftestResultReq { + unsigned char picmgId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgQuerySelftestResultResp { + unsigned char picmgId; + unsigned char result1; + unsigned char result2; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgQuerySelftestResultCtx { + struct HpmfwupgQuerySelftestResultReq req; + struct HpmfwupgQuerySelftestResultResp resp; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +/* HPM.1 IMAGE DEFINITIONS */ +#define HPMFWUPG_HEADER_SIGNATURE_LENGTH 8 +#define HPMFWUPG_MANUFATURER_ID_LENGTH 3 +#define HPMFWUPG_PRODUCT_ID_LENGTH 2 +#define HPMFWUPG_TIME_LENGTH 4 +#define HPMFWUPG_TIMEOUT_LENGTH 1 +#define HPMFWUPG_COMP_REVISION_LENGTH 2 +#define HPMFWUPG_FIRM_REVISION_LENGTH 6 +#define HPMFWUPG_IMAGE_HEADER_VERSION 0 +#define HPMFWUPG_IMAGE_SIGNATURE "PICMGFWU" + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct HpmfwupgImageHeader { + char signature[HPMFWUPG_HEADER_SIGNATURE_LENGTH]; + unsigned char formatVersion; + unsigned char deviceId; + unsigned char manId[HPMFWUPG_MANUFATURER_ID_LENGTH]; + unsigned char prodId[HPMFWUPG_PRODUCT_ID_LENGTH]; + unsigned char time[HPMFWUPG_TIME_LENGTH]; + union { + struct { +#if WORDS_BIGENDIAN + unsigned char imageSelfTest : 1; + unsigned char autRollback : 1; + unsigned char manRollback : 1; + unsigned char servAffected : 1; + unsigned char reserved : 4; +#else + unsigned char reserved : 4; + unsigned char servAffected : 1; + unsigned char manRollback : 1; + unsigned char autRollback : 1; + unsigned char imageSelfTest : 1; +#endif + } ATTRIBUTE_PACKING bitField; + unsigned char byte; + }ATTRIBUTE_PACKING imageCapabilities; + struct HpmfwupgComponentBitMask components; + unsigned char selfTestTimeout; + unsigned char rollbackTimeout; + unsigned char inaccessTimeout; + unsigned char compRevision[HPMFWUPG_COMP_REVISION_LENGTH]; + unsigned char firmRevision[HPMFWUPG_FIRM_REVISION_LENGTH]; + unsigned short oemDataLength; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#define HPMFWUPG_DESCRIPTION_LENGTH 21 + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgActionRecord { + unsigned char actionType; + struct HpmfwupgComponentBitMask components; + unsigned char checksum; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#define HPMFWUPG_FIRMWARE_SIZE_LENGTH 4 + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgFirmwareImage { + unsigned char version[HPMFWUPG_FIRM_REVISION_LENGTH]; + char desc[HPMFWUPG_DESCRIPTION_LENGTH]; + unsigned char length[HPMFWUPG_FIRMWARE_SIZE_LENGTH]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +# pragma pack(1) +#endif +struct HpmfwupgUpgradeCtx { + struct HpmfwupgComponentBitMask compUpdateMask; + unsigned int imageSize; + unsigned char* pImageData; + unsigned char componentId; + struct HpmfwupgGetTargetUpgCapabilitiesResp targetCap; + struct HpmfwupgGetGeneralPropResp genCompProp[HPMFWUPG_COMPONENT_ID_MAX]; + struct ipm_devid_rsp devId; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +# pragma pack(0) +#endif + +typedef enum eHpmfwupgActionType { + HPMFWUPG_ACTION_BACKUP_COMPONENTS = 0, + HPMFWUPG_ACTION_PREPARE_COMPONENTS, + HPMFWUPG_ACTION_UPLOAD_FIRMWARE, + HPMFWUPG_ACTION_RESERVED = 0xFF +} tHpmfwupgActionType; + +/* FUNCTIONS PROTOTYPES */ +#define HPMFWUPG_MAJORMINOR_VERSION_SIZE 2 + +/* Options added for user to check the version and to view both the FILE and + * TARGET Version + */ +#define VIEW_MODE 0x01 +#define DEBUG_MODE 0x02 +#define FORCE_MODE 0x04 +#define COMPARE_MODE 0x08 + +typedef struct _VERSIONINFO { + unsigned char componentId; + unsigned char targetMajor; + unsigned char targetMinor; + unsigned char targetAux[4]; + unsigned char rollbackMajor; + unsigned char rollbackMinor; + unsigned char rollbackAux[4]; + unsigned char deferredMajor; + unsigned char deferredMinor; + unsigned char deferredAux[4]; + unsigned char imageMajor; + unsigned char imageMinor; + unsigned char imageAux[4]; + unsigned char coldResetRequired; + unsigned char rollbackSupported; + char descString[HPMFWUPG_DESC_STRING_LENGTH + 1]; +}VERSIONINFO, *PVERSIONINFO; + +VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX]; + +#define TARGET_VER (0x01) +#define ROLLBACK_VER (0x02) +#define IMAGE_VER (0x04) + +#endif /* IPMI_KFWUM_H */ diff --git a/include/ipmitool/ipmi_ime.h b/include/ipmitool/ipmi_ime.h new file mode 100755 index 0000000..734ddb3 --- /dev/null +++ b/include/ipmitool/ipmi_ime.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007 Kontron Canada, Inc. All Rights Reserved. + * + * Base on code from + * 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. + */ + +#ifndef IPMI_IME_H +#define IPMI_IME_H + +#include <inttypes.h> +#include <ipmitool/ipmi.h> + + +int ipmi_ime_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_IME_H */ diff --git a/include/ipmitool/ipmi_intf.h b/include/ipmitool/ipmi_intf.h new file mode 100644 index 0000000..437a427 --- /dev/null +++ b/include/ipmitool/ipmi_intf.h @@ -0,0 +1,221 @@ +/* + * 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. + */ + +#ifndef IPMI_INTF_H +#define IPMI_INTF_H + +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_oem.h> +#include <ipmitool/ipmi_constants.h> + +#include <sys/types.h> +#include <arpa/inet.h> +#include <sys/socket.h> +#include <netinet/in.h> + +/* + * An enumeration that describes every possible session state for + * an IPMIv2 / RMCP+ session. + */ +enum LANPLUS_SESSION_STATE { + LANPLUS_STATE_PRESESSION = 0, + LANPLUS_STATE_OPEN_SESSION_SENT, + LANPLUS_STATE_OPEN_SESSION_RECEIEVED, + LANPLUS_STATE_RAKP_1_SENT, + LANPLUS_STATE_RAKP_2_RECEIVED, + LANPLUS_STATE_RAKP_3_SENT, + LANPLUS_STATE_ACTIVE, + LANPLUS_STATE_CLOSE_SENT, +}; + + +#define IPMI_AUTHCODE_BUFFER_SIZE 20 +#define IPMI_SIK_BUFFER_SIZE 20 +#define IPMI_KG_BUFFER_SIZE 21 /* key plus null byte */ + +struct ipmi_session { + uint8_t hostname[64]; + uint8_t username[17]; + uint8_t authcode[IPMI_AUTHCODE_BUFFER_SIZE + 1]; + uint8_t challenge[16]; + uint8_t authtype; + uint8_t authtype_set; +#define IPMI_AUTHSTATUS_PER_MSG_DISABLED 0x10 +#define IPMI_AUTHSTATUS_PER_USER_DISABLED 0x08 +#define IPMI_AUTHSTATUS_NONNULL_USERS_ENABLED 0x04 +#define IPMI_AUTHSTATUS_NULL_USERS_ENABLED 0x02 +#define IPMI_AUTHSTATUS_ANONYMOUS_USERS_ENABLED 0x01 + uint8_t authstatus; + uint8_t authextra; + uint8_t privlvl; + uint8_t cipher_suite_id; + char sol_escape_char; + int password; + int port; + int active; + int retry; + + uint32_t session_id; + uint32_t in_seq; + uint32_t out_seq; + uint32_t timeout; + + struct sockaddr_storage addr; + socklen_t addrlen; + int ai_family; /* Protocol family for socket. */ + + /* + * This struct holds state data specific to IPMI v2 / RMCP+ sessions + */ + struct { + enum LANPLUS_SESSION_STATE session_state; + + /* These are the algorithms agreed upon for the session */ + uint8_t requested_auth_alg; + uint8_t requested_integrity_alg; + uint8_t requested_crypt_alg; + uint8_t auth_alg; + uint8_t integrity_alg; + uint8_t crypt_alg; + uint8_t max_priv_level; + uint8_t lookupbit; + + uint32_t console_id; + uint32_t bmc_id; + + /* + * Values required for RAKP mesages + */ + + /* Random number generated byt the console */ + uint8_t console_rand[16]; + /* Random number generated by the BMC */ + uint8_t bmc_rand[16]; + + uint8_t bmc_guid[16]; + uint8_t requested_role; /* As sent in the RAKP 1 message */ + uint8_t rakp2_return_code; + + uint8_t sik[IPMI_SIK_BUFFER_SIZE]; /* Session integrity key */ + uint8_t kg[IPMI_KG_BUFFER_SIZE]; /* BMC key */ + uint8_t k1[20]; /* Used for Integrity checking? */ + uint8_t k2[20]; /* First 16 bytes used for AES */ + } v2_data; + + + /* + * This data is specific to the Serial Over Lan session + */ + struct { + uint16_t max_inbound_payload_size; + uint16_t max_outbound_payload_size; + uint16_t port; + uint8_t sequence_number; + + /* This data describes the last SOL packet */ + uint8_t last_received_sequence_number; + uint8_t last_received_byte_count; + void (*sol_input_handler)(struct ipmi_rs * rsp); + } sol_data; +}; + +struct ipmi_cmd { + int (*func)(struct ipmi_intf * intf, int argc, char ** argv); + const char * name; + const char * desc; +}; + +struct ipmi_intf_support { + const char * name; + int supported; +}; + +struct ipmi_intf { + char name[16]; + char desc[128]; + char *devfile; + int fd; + int opened; + int abort; + int noanswer; + int picmg_avail; + IPMI_OEM manufacturer_id; + + struct ipmi_session * session; + struct ipmi_oem_handle * oem; + struct ipmi_cmd * cmdlist; + uint8_t target_ipmb_addr; + uint32_t my_addr; + uint32_t target_addr; + uint8_t target_lun; + uint8_t target_channel; + uint32_t transit_addr; + uint8_t transit_channel; + uint16_t max_request_data_size; + uint16_t max_response_data_size; + + uint8_t devnum; + + int (*setup)(struct ipmi_intf * intf); + int (*open)(struct ipmi_intf * intf); + void (*close)(struct ipmi_intf * intf); + struct ipmi_rs *(*sendrecv)(struct ipmi_intf * intf, struct ipmi_rq * req); + int (*sendrsp)(struct ipmi_intf * intf, struct ipmi_rs * rsp); + struct ipmi_rs *(*recv_sol)(struct ipmi_intf * intf); + struct ipmi_rs *(*send_sol)(struct ipmi_intf * intf, struct ipmi_v2_payload * payload); + int (*keepalive)(struct ipmi_intf * intf); + int (*set_my_addr)(struct ipmi_intf * intf, uint8_t addr); + void (*set_max_request_data_size)(struct ipmi_intf * intf, uint16_t size); + void (*set_max_response_data_size)(struct ipmi_intf * intf, uint16_t size); +}; + +struct ipmi_intf * ipmi_intf_load(char * name); +void ipmi_intf_print(struct ipmi_intf_support * intflist); + +void ipmi_intf_session_set_hostname(struct ipmi_intf * intf, char * hostname); +void ipmi_intf_session_set_username(struct ipmi_intf * intf, char * username); +void ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password); +void ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, uint8_t privlvl); +void ipmi_intf_session_set_lookupbit(struct ipmi_intf * intf, uint8_t lookupbit); +void ipmi_intf_session_set_cipher_suite_id(struct ipmi_intf * intf, uint8_t cipher_suite_id); +void ipmi_intf_session_set_sol_escape_char(struct ipmi_intf * intf, char sol_escape_char); +void ipmi_intf_session_set_kgkey(struct ipmi_intf * intf, char * kgkey); +void ipmi_intf_session_set_port(struct ipmi_intf * intf, int port); +void ipmi_intf_session_set_authtype(struct ipmi_intf * intf, uint8_t authtype); +void ipmi_intf_session_set_timeout(struct ipmi_intf * intf, uint32_t timeout); +void ipmi_intf_session_set_retry(struct ipmi_intf * intf, int retry); +void ipmi_cleanup(struct ipmi_intf * intf); + +#if defined(IPMI_INTF_LAN) || defined (IPMI_INTF_LANPLUS) +int ipmi_intf_socket_connect(struct ipmi_intf * intf); +#endif +#endif /* IPMI_INTF_H */ diff --git a/include/ipmitool/ipmi_isol.h b/include/ipmitool/ipmi_isol.h new file mode 100644 index 0000000..e52279e --- /dev/null +++ b/include/ipmitool/ipmi_isol.h @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#ifndef IPMI_ISOL_H +#define IPMI_ISOL_H + +#include <ipmitool/ipmi.h> + +#define ACTIVATE_ISOL 0x01 +#define SET_ISOL_CONFIG 0x03 +#define GET_ISOL_CONFIG 0x04 + +#define ISOL_ENABLE_PARAM 0x01 +#define ISOL_AUTHENTICATION_PARAM 0x02 + +#define ISOL_BAUD_RATE_PARAM 0x05 + +#define ISOL_PREFERRED_BAUD_RATE 0x07 + +struct isol_config_parameters { + uint8_t enabled; + uint8_t privilege_level; + uint8_t bit_rate; +}; + +int ipmi_isol_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_SOL_H */ diff --git a/include/ipmitool/ipmi_kontronoem.h b/include/ipmitool/ipmi_kontronoem.h new file mode 100644 index 0000000..d3925df --- /dev/null +++ b/include/ipmitool/ipmi_kontronoem.h @@ -0,0 +1,46 @@ +/*
+ * Copyright (c) 2004 Kontron Canada, Inc. All Rights Reserved.
+ *
+ * Base on code from
+ * 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.
+ */
+
+#ifndef IPMI_KONTRONOEM_H
+#define IPMI_KONTRONOEM_H
+
+#include <inttypes.h>
+#include <ipmitool/ipmi.h>
+
+
+int ipmi_kontronoem_main(struct ipmi_intf *, int, char **);
+int ipmi_kontronoem_set_large_buffer(struct ipmi_intf *, unsigned char size);
+
+#endif /* IPMI_KONTRONOEM_H */
diff --git a/include/ipmitool/ipmi_lanp.h b/include/ipmitool/ipmi_lanp.h new file mode 100644 index 0000000..1aaae5e --- /dev/null +++ b/include/ipmitool/ipmi_lanp.h @@ -0,0 +1,132 @@ +/* + * 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. + */ + +#ifndef IPMI_LANP_H +#define IPMI_LANP_H + +#include <ipmitool/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_CHANNEL_NUMBER_MAX 0xe + +#define IPMI_LANP_TIMEOUT 3 +#define IPMI_LANP_RETRIES 10 +#define IPMI_LANP_WRITE_UNLOCK 0 +#define IPMI_LANP_WRITE_LOCK 1 +#define IPMI_LANP_WRITE_COMMIT 2 + +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, /* 5 */ + IPMI_LANP_SUBNET_MASK, + IPMI_LANP_IP_HEADER, + IPMI_LANP_PRI_RMCP_PORT, + IPMI_LANP_SEC_RMCP_PORT, + IPMI_LANP_BMC_ARP, /* 10 */ + IPMI_LANP_GRAT_ARP, + IPMI_LANP_DEF_GATEWAY_IP, + IPMI_LANP_DEF_GATEWAY_MAC, + IPMI_LANP_BAK_GATEWAY_IP, + IPMI_LANP_BAK_GATEWAY_MAC, /* 15 */ + IPMI_LANP_SNMP_STRING, + IPMI_LANP_NUM_DEST, + IPMI_LANP_DEST_TYPE, + IPMI_LANP_DEST_ADDR, + IPMI_LANP_VLAN_ID, /* 20 */ + IPMI_LANP_VLAN_PRIORITY, + IPMI_LANP_RMCP_CIPHER_SUPPORT, + IPMI_LANP_RMCP_CIPHERS, + IPMI_LANP_RMCP_PRIV_LEVELS, + 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]; + uint8_t * data; + int data_len; +} ipmi_lan_params[] __attribute__((unused)) = { + { IPMI_LANP_SET_IN_PROGRESS, 1, "Set in Progress" }, + { IPMI_LANP_AUTH_TYPE, 1, "Auth Type Support" }, + { 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" }, /* 5 */ + { 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" }, /* 10 */ + { 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" }, /* 15 */ + { IPMI_LANP_SNMP_STRING, 18, "SNMP 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_VLAN_ID, 2, "802.1q VLAN ID" }, /* 20 */ + { IPMI_LANP_VLAN_PRIORITY, 1, "802.1q VLAN Priority" }, + { IPMI_LANP_RMCP_CIPHER_SUPPORT,1, "RMCP+ Cipher Suite Count" }, + { IPMI_LANP_RMCP_CIPHERS, 16, "RMCP+ Cipher Suites" }, + { IPMI_LANP_RMCP_PRIV_LEVELS, 9, "Cipher Suite Priv Max" }, + { IPMI_LANP_OEM_ALERT_STRING, 28, "OEM Alert String" }, /* 25 */ + { 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" }, /* 30 */ + { IPMI_LANP_CHAN_ACCESS_MODE, 2, "Channel Access Mode" }, + { -1 } +}; + +int ipmi_lanp_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_LANP_H*/ diff --git a/include/ipmitool/ipmi_main.h b/include/ipmitool/ipmi_main.h new file mode 100644 index 0000000..e32360a --- /dev/null +++ b/include/ipmitool/ipmi_main.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_MAIN_H +#define IPMI_MAIN_H + +#include <ipmitool/ipmi_intf.h> + +int ipmi_main(int argc, char ** argv, struct ipmi_cmd * cmdlist, struct ipmi_intf_support * intflist); +void ipmi_cmd_print(struct ipmi_cmd * cmdlist); +int ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv); + +#endif /* IPMI_MAIN_H */ diff --git a/include/ipmitool/ipmi_mc.h b/include/ipmitool/ipmi_mc.h new file mode 100644 index 0000000..5546a3a --- /dev/null +++ b/include/ipmitool/ipmi_mc.h @@ -0,0 +1,170 @@ +/* + * 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. + */ + +#ifndef IPMI_MC_H +#define IPMI_MC_H + +#include <ipmitool/ipmi.h> + +#define BMC_GET_DEVICE_ID 0x01 +#define BMC_COLD_RESET 0x02 +#define BMC_WARM_RESET 0x03 +#define BMC_GET_SELF_TEST 0x04 +#define BMC_RESET_WATCHDOG_TIMER 0x22 +#define BMC_SET_WATCHDOG_TIMER 0x24 +#define BMC_GET_WATCHDOG_TIMER 0x25 +#define BMC_SET_GLOBAL_ENABLES 0x2e +#define BMC_GET_GLOBAL_ENABLES 0x2f +#define BMC_GET_GUID 0x37 + +int ipmi_mc_main(struct ipmi_intf *, int, char **); + +/* + * Response data from IPM Get Device ID Command (IPMI rev 1.5, section 17.1) + * The following really apply to any IPM device, not just BMCs... + */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct ipm_devid_rsp { + uint8_t device_id; + uint8_t device_revision; + uint8_t fw_rev1; + uint8_t fw_rev2; + uint8_t ipmi_version; + uint8_t adtl_device_support; + uint8_t manufacturer_id[3]; + uint8_t product_id[2]; + uint8_t aux_fw_rev[4]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#define IPM_DEV_DEVICE_ID_SDR_MASK (0x80) /* 1 = provides SDRs */ +#define IPM_DEV_DEVICE_ID_REV_MASK (0x0F) /* BCD-enoded */ + +#define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */ +#define IPM_DEV_FWREV1_MAJOR_MASK (0x3f) /* Major rev, BCD-encoded */ + +#define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */ +#define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */ +#define IPM_DEV_IPMI_VER_MINOR_SHIFT (4) /* Minor rev shift */ +#define IPM_DEV_IPMI_VERSION_MAJOR(x) \ + (x & IPM_DEV_IPMI_VER_MAJOR_MASK) +#define IPM_DEV_IPMI_VERSION_MINOR(x) \ + ((x & IPM_DEV_IPMI_VER_MINOR_MASK) >> IPM_DEV_IPMI_VER_MINOR_SHIFT) + +#define IPM_DEV_MANUFACTURER_ID(x) \ + ((uint32_t) ((x[2] & 0x0F) << 16 | x[1] << 8 | x[0])) + +#define IPM_DEV_ADTL_SUPPORT_BITS (8) + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct ipm_selftest_rsp { + unsigned char code; + unsigned char test; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#define IPM_SFT_CODE_OK 0x55 +#define IPM_SFT_CODE_NOT_IMPLEMENTED 0x56 +#define IPM_SFT_CODE_DEV_CORRUPTED 0x57 +#define IPM_SFT_CODE_FATAL_ERROR 0x58 +#define IPM_SFT_CODE_RESERVED 0xff + +#define IPM_SELFTEST_SEL_ERROR 0x80 +#define IPM_SELFTEST_SDR_ERROR 0x40 +#define IPM_SELFTEST_FRU_ERROR 0x20 +#define IPM_SELFTEST_IPMB_ERROR 0x10 +#define IPM_SELFTEST_SDRR_EMPTY 0x08 +#define IPM_SELFTEST_INTERNAL_USE 0x04 +#define IPM_SELFTEST_FW_BOOTBLOCK 0x02 +#define IPM_SELFTEST_FW_CORRUPTED 0x01 + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct ipm_get_watchdog_rsp { + unsigned char timer_use; + unsigned char timer_actions; + unsigned char pre_timeout; + unsigned char timer_use_exp; + unsigned char initial_countdown_lsb; + unsigned char initial_countdown_msb; + unsigned char present_countdown_lsb; + unsigned char present_countdown_msb; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#define IPM_WATCHDOG_RESET_ERROR 0x80 + +#define IPM_WATCHDOG_BIOS_FRB2 0x01 +#define IPM_WATCHDOG_BIOS_POST 0x02 +#define IPM_WATCHDOG_OS_LOAD 0x03 +#define IPM_WATCHDOG_SMS_OS 0x04 +#define IPM_WATCHDOG_OEM 0x05 + +#define IPM_WATCHDOG_NO_ACTION 0x00 +#define IPM_WATCHDOG_HARD_RESET 0x01 +#define IPM_WATCHDOG_POWER_DOWN 0x02 +#define IPM_WATCHDOG_POWER_CYCLE 0x03 + +#define IPM_WATCHDOG_CLEAR_OEM 0x20 +#define IPM_WATCHDOG_CLEAR_SMS_OS 0x10 +#define IPM_WATCHDOG_CLEAR_OS_LOAD 0x08 +#define IPM_WATCHDOG_CLEAR_BIOS_POST 0x04 +#define IPM_WATCHDOG_CLEAR_BIOS_FRB2 0x02 + +/* IPMI 2.0 command for system information*/ +#define IPMI_SET_SYS_INFO 0x58 +#define IPMI_GET_SYS_INFO 0x59 +#define IPMI_SYSINFO_SET0_SIZE 14 +#define IPMI_SYSINFO_SETN_SIZE 16 + +#define IPMI_SYSINFO_HOSTNAME 0x02 +#define IPMI_SYSINFO_PRIMARY_OS_NAME 0x03 +#define IPMI_SYSINFO_OS_NAME 0x04 +#define IPMI_SYSINFO_DELL_OS_VERSION 0xe4 +#define IPMI_SYSINFO_DELL_URL 0xde + +int ipmi_mc_getsysinfo(struct ipmi_intf * intf, int param, int block, int set, + int len, void *buffer); +int ipmi_mc_setsysinfo(struct ipmi_intf * intf, int len, void *buffer); + +#endif /*IPMI_MC_H */ diff --git a/include/ipmitool/ipmi_oem.h b/include/ipmitool/ipmi_oem.h new file mode 100644 index 0000000..ad22fde --- /dev/null +++ b/include/ipmitool/ipmi_oem.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +#ifndef IPMI_OEM_H +#define IPMI_OEM_H + +#include <ipmitool/ipmi.h> + +/* oem handler, see lib/ipmi_oem.c */ +struct ipmi_oem_handle { + const char * name; + const char * desc; + int (*setup)(struct ipmi_intf * intf); +}; + +void ipmi_oem_print(void); +int ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype); +int ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype); + +#endif /*IPMI_OEM_H*/ diff --git a/include/ipmitool/ipmi_pef.h b/include/ipmitool/ipmi_pef.h new file mode 100644 index 0000000..cdea4ec --- /dev/null +++ b/include/ipmitool/ipmi_pef.h @@ -0,0 +1,956 @@ +/* + * Copyright (c) 2004 Dell Computers. 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 Dell Computers, 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. + * DELL COMPUTERS ("DELL") 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 + * DELL 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 DELL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_PEF_H +#define IPMI_PEF_H + +#include <ipmitool/ipmi.h> + +/* PEF */ + +struct pef_capabilities { /* "get pef capabilities" response */ + uint8_t version; + uint8_t actions; /* mapped by PEF_ACTION_xxx */ + uint8_t tblsize; +}; + +typedef enum { + P_TRUE, + P_SUPP, + P_ACTV, + P_ABLE, +} flg_e; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_table_entry { +#define PEF_CONFIG_ENABLED 0x80 +#define PEF_CONFIG_PRECONFIGURED 0x40 + uint8_t config; +#define PEF_ACTION_DIAGNOSTIC_INTERRUPT 0x20 +#define PEF_ACTION_OEM 0x10 +#define PEF_ACTION_POWER_CYCLE 0x08 +#define PEF_ACTION_RESET 0x04 +#define PEF_ACTION_POWER_DOWN 0x02 +#define PEF_ACTION_ALERT 0x01 + uint8_t action; +#define PEF_POLICY_NUMBER_MASK 0x0f + uint8_t policy_number; +#define PEF_SEVERITY_NON_RECOVERABLE 0x20 +#define PEF_SEVERITY_CRITICAL 0x10 +#define PEF_SEVERITY_WARNING 0x08 +#define PEF_SEVERITY_OK 0x04 +#define PEF_SEVERITY_INFORMATION 0x02 +#define PEF_SEVERITY_MONITOR 0x01 + uint8_t severity; + uint8_t generator_ID_addr; + uint8_t generator_ID_lun; + uint8_t sensor_type; +#define PEF_SENSOR_NUMBER_MATCH_ANY 0xff + uint8_t sensor_number; +#define PEF_EVENT_TRIGGER_UNSPECIFIED 0x0 +#define PEF_EVENT_TRIGGER_THRESHOLD 0x1 +#define PEF_EVENT_TRIGGER_SENSOR_SPECIFIC 0x6f +#define PEF_EVENT_TRIGGER_MATCH_ANY 0xff + uint8_t event_trigger; + uint8_t event_data_1_offset_mask[2]; + uint8_t event_data_1_AND_mask; + uint8_t event_data_1_compare_1; + uint8_t event_data_1_compare_2; + uint8_t event_data_2_AND_mask; + uint8_t event_data_2_compare_1; + uint8_t event_data_2_compare_2; + uint8_t event_data_3_AND_mask; + uint8_t event_data_3_compare_1; + uint8_t event_data_3_compare_2; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +struct desc_map { /* maps a description to a value/mask */ + const char *desc; + uint32_t mask; +}; + +struct bit_desc_map { /* description text container */ +#define BIT_DESC_MAP_LIST 0x1 /* index-based text array */ +#define BIT_DESC_MAP_ANY 0x2 /* bitwise, but only print 1st one */ +#define BIT_DESC_MAP_ALL 0x3 /* bitwise, print them all */ + uint32_t desc_map_type; + struct desc_map desc_maps[128]; +}; + +static struct bit_desc_map +pef_b2s_actions __attribute__((unused)) = { +BIT_DESC_MAP_ALL, +{ {"Alert", PEF_ACTION_ALERT}, + {"Power-off", PEF_ACTION_POWER_DOWN}, + {"Reset", PEF_ACTION_RESET}, + {"Power-cycle", PEF_ACTION_POWER_CYCLE}, + {"OEM-defined", PEF_ACTION_OEM}, + {"Diagnostic-interrupt", PEF_ACTION_DIAGNOSTIC_INTERRUPT}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_severities __attribute__((unused)) = { +BIT_DESC_MAP_ANY, +{ {"Non-recoverable", PEF_SEVERITY_NON_RECOVERABLE}, + {"Critical", PEF_SEVERITY_CRITICAL}, + {"Warning", PEF_SEVERITY_WARNING}, + {"OK", PEF_SEVERITY_OK}, + {"Information", PEF_SEVERITY_INFORMATION}, + {"Monitor", PEF_SEVERITY_MONITOR}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_sensortypes __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"Any", 255}, + {"Temperature", 1}, + {"Voltage", 2}, + {"Current", 3}, + {"Fan", 4}, + {"Chassis Intrusion", 5}, + {"Platform security breach", 6}, + {"Processor", 7}, + {"Power supply", 8}, + {"Power Unit", 9}, + {"Cooling device", 10}, + {"Other (units-based)", 11}, + {"Memory", 12}, + {"Drive Slot", 13}, + {"POST memory resize", 14}, + {"POST error", 15}, + {"Logging disabled", 16}, + {"Watchdog 1", 17}, + {"System event", 18}, + {"Critical Interrupt", 19}, + {"Button", 20}, + {"Module/board", 21}, + {"uController/coprocessor", 22}, + {"Add-in card", 23}, + {"Chassis", 24}, + {"Chipset", 25}, + {"Other (FRU)", 26}, + {"Cable/interconnect", 27}, + {"Terminator", 28}, + {"System boot", 29}, + {"Boot error", 30}, + {"OS boot", 31}, + {"OS critical stop", 32}, + {"Slot/connector", 33}, + {"ACPI power state", 34}, + {"Watchdog 2", 35}, + {"Platform alert", 36}, + {"Entity presence", 37}, + {"Monitor ASIC/IC", 38}, + {"LAN", 39}, + {"Management subsytem health",40}, + {"Battery", 41}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_1 = { +BIT_DESC_MAP_LIST, +{ {"<LNC", 0}, /* '<' : getting worse */ + {">LNC", 1}, /* '>' : getting better */ + {"<LC", 2}, + {">LC", 3}, + {"<LNR", 4}, + {">LNR", 5}, + {">UNC", 6}, + {"<UNC", 7}, + {">UC", 8}, + {"<UC", 9}, + {">UNR", 10}, + {"<UNR", 11}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_2 = { +BIT_DESC_MAP_LIST, +{ {"transition to idle", 0}, + {"transition to active", 1}, + {"transition to busy", 2}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_3 = { +BIT_DESC_MAP_LIST, +{ {"state deasserted", 0}, + {"state asserted", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_4 = { +BIT_DESC_MAP_LIST, +{ {"predictive failure deasserted", 0}, + {"predictive failure asserted", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_5 = { +BIT_DESC_MAP_LIST, +{ {"limit not exceeded", 0}, + {"limit exceeded", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_6 = { +BIT_DESC_MAP_LIST, +{ {"performance met", 0}, + {"performance lags", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_7 = { +BIT_DESC_MAP_LIST, +{ {"ok", 0}, + {"<warn", 1}, /* '<' : getting worse */ + {"<fail", 2}, + {"<dead", 3}, + {">warn", 4}, /* '>' : getting better */ + {">fail", 5}, + {"dead", 6}, + {"monitor", 7}, + {"informational", 8}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_8 = { +BIT_DESC_MAP_LIST, +{ {"device removed/absent", 0}, + {"device inserted/present", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_9 = { +BIT_DESC_MAP_LIST, +{ {"device disabled", 0}, + {"device enabled", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_10 = { +BIT_DESC_MAP_LIST, +{ {"transition to running", 0}, + {"transition to in test", 1}, + {"transition to power off", 2}, + {"transition to online", 3}, + {"transition to offline", 4}, + {"transition to off duty", 5}, + {"transition to degraded", 6}, + {"transition to power save", 7}, + {"install error", 8}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_11 = { +BIT_DESC_MAP_LIST, +{ {"fully redundant", 0}, + {"redundancy lost", 1}, + {"redundancy degraded", 2}, + {"<non-redundant/sufficient", 3}, /* '<' : getting worse */ + {">non-redundant/sufficient", 4}, /* '>' : getting better */ + {"non-redundant/insufficient", 5}, + {"<redundancy degraded", 6}, + {">redundancy degraded", 7}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_12 = { +BIT_DESC_MAP_LIST, +{ {"D0 power state", 0}, + {"D1 power state", 1}, + {"D2 power state", 2}, + {"D3 power state", 3}, + {NULL} +} }; + +static struct bit_desc_map * +pef_b2s_generic_ER[] __attribute__((unused)) = { + &pef_b2s_gentype_1, + &pef_b2s_gentype_2, + &pef_b2s_gentype_3, + &pef_b2s_gentype_4, + &pef_b2s_gentype_5, + &pef_b2s_gentype_6, + &pef_b2s_gentype_7, + &pef_b2s_gentype_8, + &pef_b2s_gentype_9, + &pef_b2s_gentype_10, + &pef_b2s_gentype_11, + &pef_b2s_gentype_12, +}; +#define PEF_B2S_GENERIC_ER_ENTRIES \ + (sizeof(pef_b2s_generic_ER) / sizeof(pef_b2s_generic_ER[0])) + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_policy_entry { +#define PEF_POLICY_ID_MASK 0xf0 +#define PEF_POLICY_ID_SHIFT 4 +#define PEF_POLICY_ENABLED 0x08 +#define PEF_POLICY_FLAGS_MASK 0x07 +#define PEF_POLICY_FLAGS_MATCH_ALWAYS 0 +#define PEF_POLICY_FLAGS_PREV_OK_SKIP 1 +#define PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET 2 +#define PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET 3 +#define PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET 4 + uint8_t policy; +#define PEF_POLICY_CHANNEL_MASK 0xf0 +#define PEF_POLICY_CHANNEL_SHIFT 4 +#define PEF_POLICY_DESTINATION_MASK 0x0f + uint8_t chan_dest; +#define PEF_POLICY_EVENT_SPECIFIC 0x80 + uint8_t alert_string_key; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +static struct bit_desc_map +pef_b2s_policies __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"Match-always", PEF_POLICY_FLAGS_MATCH_ALWAYS}, + {"Try-next-entry", PEF_POLICY_FLAGS_PREV_OK_SKIP}, + {"Try-next-set", PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET}, + {"Try-next-channel", PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET}, + {"Try-next-destination", PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_ch_medium __attribute__((unused)) = { +#define PEF_CH_MEDIUM_TYPE_IPMB 1 +#define PEF_CH_MEDIUM_TYPE_ICMB_10 2 +#define PEF_CH_MEDIUM_TYPE_ICMB_09 3 +#define PEF_CH_MEDIUM_TYPE_LAN 4 +#define PEF_CH_MEDIUM_TYPE_SERIAL 5 +#define PEF_CH_MEDIUM_TYPE_XLAN 6 +#define PEF_CH_MEDIUM_TYPE_PCI_SMBUS 7 +#define PEF_CH_MEDIUM_TYPE_SMBUS_V1X 8 +#define PEF_CH_MEDIUM_TYPE_SMBUS_V2X 9 +#define PEF_CH_MEDIUM_TYPE_USB_V1X 10 +#define PEF_CH_MEDIUM_TYPE_USB_V2X 11 +#define PEF_CH_MEDIUM_TYPE_SYSTEM 12 +BIT_DESC_MAP_LIST, +{ {"IPMB (I2C)", PEF_CH_MEDIUM_TYPE_IPMB}, + {"ICMB v1.0", PEF_CH_MEDIUM_TYPE_ICMB_10}, + {"ICMB v0.9", PEF_CH_MEDIUM_TYPE_ICMB_09}, + {"802.3 LAN", PEF_CH_MEDIUM_TYPE_LAN}, + {"Serial/Modem (RS-232)", PEF_CH_MEDIUM_TYPE_SERIAL}, + {"Other LAN", PEF_CH_MEDIUM_TYPE_XLAN}, + {"PCI SMBus", PEF_CH_MEDIUM_TYPE_PCI_SMBUS}, + {"SMBus v1.0/1.1", PEF_CH_MEDIUM_TYPE_SMBUS_V1X}, + {"SMBus v2.0", PEF_CH_MEDIUM_TYPE_SMBUS_V2X}, + {"USB 1.x", PEF_CH_MEDIUM_TYPE_USB_V1X}, + {"USB 2.x", PEF_CH_MEDIUM_TYPE_USB_V2X}, + {"System I/F (KCS,SMIC,BT)", PEF_CH_MEDIUM_TYPE_SYSTEM}, + {NULL} +} }; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_selector { +#define PEF_CFGPARM_ID_REVISION_ONLY_MASK 0x80 +#define PEF_CFGPARM_ID_SET_IN_PROGRESS 0 +#define PEF_CFGPARM_ID_PEF_CONTROL 1 +#define PEF_CFGPARM_ID_PEF_ACTION 2 +#define PEF_CFGPARM_ID_PEF_STARTUP_DELAY 3 +#define PEF_CFGPARM_ID_PEF_ALERT_STARTUP_DELAY 4 +#define PEF_CFGPARM_ID_PEF_FILTER_TABLE_SIZE 5 +#define PEF_CFGPARM_ID_PEF_FILTER_TABLE_ENTRY 6 +#define PEF_CFGPARM_ID_PEF_FILTER_TABLE_DATA_1 7 +#define PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_SIZE 8 +#define PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_ENTRY 9 +#define PEF_CFGPARM_ID_SYSTEM_GUID 10 +#define PEF_CFGPARM_ID_PEF_ALERT_STRING_TABLE_SIZE 11 +#define PEF_CFGPARM_ID_PEF_ALERT_STRING_KEY 12 +#define PEF_CFGPARM_ID_PEF_ALERT_STRING_TABLE_ENTRY 13 + uint8_t id; + uint8_t set; + uint8_t block; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_set_in_progress { +#define PEF_SET_IN_PROGRESS_COMMIT_WRITE 0x02 +#define PEF_SET_IN_PROGRESS 0x01 + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_control { +#define PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY 0x08 +#define PEF_CONTROL_ENABLE_STARTUP_DELAY 0x04 +#define PEF_CONTROL_ENABLE_EVENT_MESSAGES 0x02 +#define PEF_CONTROL_ENABLE 0x01 + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +static struct bit_desc_map +pef_b2s_control __attribute__((unused)) = { +BIT_DESC_MAP_ALL, +{ {"PEF", PEF_CONTROL_ENABLE}, + {"PEF event messages", PEF_CONTROL_ENABLE_EVENT_MESSAGES}, + {"PEF startup delay", PEF_CONTROL_ENABLE_STARTUP_DELAY}, + {"Alert startup delay", PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY}, + {NULL} +} }; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_action { +#define PEF_ACTION_ENABLE_DIAGNOSTIC_INTERRUPT 0x20 +#define PEF_ACTION_ENABLE_OEM 0x10 +#define PEF_ACTION_ENABLE_POWER_CYCLE 0x08 +#define PEF_ACTION_ENABLE_RESET 0x04 +#define PEF_ACTION_ENABLE_POWER_DOWN 0x02 +#define PEF_ACTION_ENABLE_ALERT 0x01 + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_startup_delay { + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_alert_startup_delay { + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_filter_table_size { +#define PEF_FILTER_TABLE_SIZE_MASK 0x7f + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_filter_table_entry { +#define PEF_FILTER_TABLE_ID_MASK 0x7f + uint8_t data1; + struct pef_table_entry entry; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_filter_table_data_1 { + uint8_t data1; + uint8_t data2; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_policy_table_size { +#define PEF_POLICY_TABLE_SIZE_MASK 0x7f + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_policy_table_entry { +#define PEF_POLICY_TABLE_ID_MASK 0x7f + uint8_t data1; + struct pef_policy_entry entry; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_system_guid { +#define PEF_SYSTEM_GUID_USED_IN_PET 0x01 + uint8_t data1; + uint8_t guid[16]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_alert_string_table_size { +#define PEF_ALERT_STRING_TABLE_SIZE_MASK 0x7f + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_alert_string_keys { +#define PEF_ALERT_STRING_ID_MASK 0x7f + uint8_t data1; +#define PEF_EVENT_FILTER_ID_MASK 0x7f + uint8_t data2; +#define PEF_ALERT_STRING_SET_ID_MASK 0x7f + uint8_t data3; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_cfgparm_alert_string_table_entry { + uint8_t id; + uint8_t blockno; + uint8_t block[16]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +/* PEF - LAN */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_lan_cfgparm_selector { +#define PEF_LAN_CFGPARM_CH_REVISION_ONLY_MASK 0x80 +#define PEF_LAN_CFGPARM_CH_MASK 0x0f +#define PEF_LAN_CFGPARM_ID_PET_COMMUNITY 16 +#define PEF_LAN_CFGPARM_ID_DEST_COUNT 17 +#define PEF_LAN_CFGPARM_ID_DESTTYPE 18 +#define PEF_LAN_CFGPARM_ID_DESTADDR 19 + uint8_t ch; + uint8_t id; + uint8_t set; + uint8_t block; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_lan_cfgparm_dest_size { +#define PEF_LAN_DEST_TABLE_SIZE_MASK 0x0f + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_lan_cfgparm_dest_type { +#define PEF_LAN_DEST_TYPE_ID_MASK 0x0f + uint8_t dest; +#define PEF_LAN_DEST_TYPE_ACK 0x80 +#define PEF_LAN_DEST_TYPE_MASK 0x07 +#define PEF_LAN_DEST_TYPE_PET 0 +#define PEF_LAN_DEST_TYPE_OEM_1 6 +#define PEF_LAN_DEST_TYPE_OEM_2 7 + uint8_t dest_type; + uint8_t alert_timeout; +#define PEF_LAN_RETRIES_MASK 0x07 + uint8_t retries; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +static struct bit_desc_map +pef_b2s_lan_desttype __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"Acknowledged", PEF_LAN_DEST_TYPE_ACK}, + {"PET", PEF_LAN_DEST_TYPE_PET}, + {"OEM 1", PEF_LAN_DEST_TYPE_OEM_1}, + {"OEM 2", PEF_LAN_DEST_TYPE_OEM_2}, + {NULL} +} }; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_lan_cfgparm_dest_info { +#define PEF_LAN_DEST_MASK 0x0f + uint8_t dest; +#define PEF_LAN_DEST_ADDRTYPE_MASK 0xf0 +#define PEF_LAN_DEST_ADDRTYPE_SHIFT 4 +#define PEF_LAN_DEST_ADDRTYPE_IPV4_MAC 0x00 + uint8_t addr_type; +#define PEF_LAN_DEST_GATEWAY_USE_BACKUP 0x01 + uint8_t gateway; + uint8_t ip[4]; + uint8_t mac[6]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +/* PEF - Serial/PPP */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_serial_cfgparm_selector { +#define PEF_SERIAL_CFGPARM_CH_REVISION_ONLY_MASK 0x80 +#define PEF_SERIAL_CFGPARM_CH_MASK 0x0f +#define PEF_SERIAL_CFGPARM_ID_DEST_COUNT 16 +#define PEF_SERIAL_CFGPARM_ID_DESTINFO 17 +#define PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING_COUNT 20 +#define PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING 21 +#define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_COUNT 24 +#define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_INFO 25 +#define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_PAGER_STRING 27 + uint8_t ch; + uint8_t id; + uint8_t set; + uint8_t block; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_serial_cfgparm_dest_size { +#define PEF_SERIAL_DEST_TABLE_SIZE_MASK 0x0f + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_serial_cfgparm_dest_info { +#define PEF_SERIAL_DEST_MASK 0x0f + uint8_t dest; +#define PEF_SERIAL_DEST_TYPE_ACK 0x80 +#define PEF_SERIAL_DEST_TYPE_MASK 0x0f +#define PEF_SERIAL_DEST_TYPE_DIAL 0 +#define PEF_SERIAL_DEST_TYPE_TAP 1 +#define PEF_SERIAL_DEST_TYPE_PPP 2 +#define PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK 3 +#define PEF_SERIAL_DEST_TYPE_PPP_CALLBACK 4 +#define PEF_SERIAL_DEST_TYPE_OEM_1 14 +#define PEF_SERIAL_DEST_TYPE_OEM_2 15 + uint8_t dest_type; + uint8_t alert_timeout; +#define PEF_SERIAL_RETRIES_MASK 0x77 +#define PEF_SERIAL_RETRIES_POST_CONNECT_MASK 0x70 +#define PEF_SERIAL_RETRIES_PRE_CONNECT_MASK 0x07 + uint8_t retries; +#define PEF_SERIAL_DIALPAGE_STRING_ID_MASK 0xf0 +#define PEF_SERIAL_DIALPAGE_STRING_ID_SHIFT 4 +#define PEF_SERIAL_TAP_PAGE_SERVICE_ID_MASK 0x0f +#define PEF_SERIAL_PPP_ACCT_IPADDR_ID_MASK 0xf0 +#define PEF_SERIAL_PPP_ACCT_IPADDR_ID_SHIFT 4 +#define PEF_SERIAL_PPP_ACCT_ID_MASK 0x0f +#define PEF_SERIAL_CALLBACK_IPADDR_ID_MASK 0x0f +#define PEF_SERIAL_CALLBACK_IPADDR_ID_SHIFT 4 +#define PEF_SERIAL_CALLBACK_ACCT_ID_MASK 0xf0 + uint8_t data5; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +static struct bit_desc_map +pef_b2s_serial_desttype __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"Acknowledged", PEF_SERIAL_DEST_TYPE_ACK}, + {"TAP page", PEF_SERIAL_DEST_TYPE_TAP}, + {"PPP PET", PEF_SERIAL_DEST_TYPE_PPP}, + {"Basic callback", PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK}, + {"PPP callback", PEF_SERIAL_DEST_TYPE_PPP_CALLBACK}, + {"OEM 1", PEF_SERIAL_DEST_TYPE_OEM_1}, + {"OEM 2", PEF_SERIAL_DEST_TYPE_OEM_2}, + {NULL} +} }; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_serial_cfgparm_dial_string_count { +#define PEF_SERIAL_DIAL_STRING_COUNT_MASK 0x0f + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_serial_cfgparm_dial_string { +#define PEF_SERIAL_DIAL_STRING_MASK 0x0f + uint8_t data1; + uint8_t data2; + uint8_t data3; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_serial_cfgparm_tap_acct_count { +#define PEF_SERIAL_TAP_ACCT_COUNT_MASK 0x0f + uint8_t data1; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_serial_cfgparm_tap_acct_info { + uint8_t data1; +#define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_MASK 0xf0 +#define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_SHIFT 4 +#define PEF_SERIAL_TAP_ACCT_INFO_SVC_SETTINGS_ID_MASK 0x0f + uint8_t data2; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct pef_serial_cfgparm_tap_svc_settings { + uint8_t data1; +#define PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX 0x0 +#define PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX 0x01 +#define PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX 0x02 + uint8_t confirmation_flags; + uint8_t service_type[3]; + uint8_t escape_mask[4]; + uint8_t timeout_parms[3]; + uint8_t retry_parms[2]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +static struct bit_desc_map +pef_b2s_tap_svc_confirm __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"ACK", PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX}, + {"211+ACK", PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX}, + {"{211|213}+ACK", PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX}, + {NULL} +} }; + +#if 0 /* FYI : config parm groupings */ + struct pef_config_parms { /* PEF */ + struct pef_cfgparm_set_in_progress; + struct pef_cfgparm_control; + struct pef_cfgparm_action; + struct pef_cfgparm_startup_delay; /* in seconds, 1-based */ + struct pef_cfgparm_alert_startup_delay; /* in seconds, 1-based */ + struct pef_cfgparm_filter_table_size; /* 1-based, READ-ONLY */ + struct pef_cfgparm_filter_table_entry; + struct pef_cfgparm_filter_table_data_1; + struct pef_cfgparm_policy_table_size; + struct pef_cfgparm_policy_table_entry; + struct pef_cfgparm_system_guid; + struct pef_cfgparm_alert_string_table_size; + struct pef_cfgparm_alert_string_keys; + struct pef_cfgparm_alert_string_table_entry; + } ATTRIBUTE_PACKING; + + struct pef_lan_config_parms { /* LAN */ + struct pef_lan_cfgparm_set_in_progress; + struct pef_lan_cfgparm_auth_capabilities; + struct pef_lan_cfgparm_auth_type; + struct pef_lan_cfgparm_ip_address; + struct pef_lan_cfgparm_ip_address_source; + struct pef_lan_cfgparm_mac_address; + struct pef_lan_cfgparm_subnet_mask; + struct pef_lan_cfgparm_ipv4_header_parms; + struct pef_lan_cfgparm_primary_rmcp_port; + struct pef_lan_cfgparm_secondary_rmcp_port; + struct pef_lan_cfgparm_bmc_generated_arp_control; + struct pef_lan_cfgparm_gratuitous_arp; + struct pef_lan_cfgparm_default_gateway_ipaddr; + struct pef_lan_cfgparm_default_gateway_macaddr; + struct pef_lan_cfgparm_backup_gateway_ipaddr; + struct pef_lan_cfgparm_backup_gateway_macaddr; + struct pef_lan_cfgparm_pet_community; + struct pef_lan_cfgparm_destination_count; + struct pef_lan_cfgparm_destination_type; + struct pef_lan_cfgparm_destination_ipaddr; + } ATTRIBUTE_PACKING; + + struct pef_serial_config_parms { /* Serial/PPP */ + struct pef_serial_cfgparm_set_in_progress; + struct pef_serial_cfgparm_auth_capabilities; + struct pef_serial_cfgparm_auth_type; + struct pef_serial_cfgparm_connection_mode; + struct pef_serial_cfgparm_idle_timeout; + struct pef_serial_cfgparm_callback_control; + struct pef_serial_cfgparm_session_termination; + struct pef_serial_cfgparm_ipmi_settings; + struct pef_serial_cfgparm_mux_control; + struct pef_serial_cfgparm_modem_ring_time; + struct pef_serial_cfgparm_modem_init_string; + struct pef_serial_cfgparm_modem_escape_sequence; + struct pef_serial_cfgparm_modem_hangup_sequence; + struct pef_serial_cfgparm_modem_dial_command; + struct pef_serial_cfgparm_page_blackout_interval; + struct pef_serial_cfgparm_pet_community; + struct pef_serial_cfgparm_destination_count; + struct pef_serial_cfgparm_destination_info; + struct pef_serial_cfgparm_call_retry_interval; + struct pef_serial_cfgparm_destination_settings; + struct pef_serial_cfgparm_dialstring_count; + struct pef_serial_cfgparm_dialstring_info; + struct pef_serial_cfgparm_ipaddr_count; + struct pef_serial_cfgparm_ipaddr_info; + struct pef_serial_cfgparm_tap_acct_count; + struct pef_serial_cfgparm_tap_acct_info; + struct pef_serial_cfgparm_tap_acct_passwords; /* WRITE only */ + struct pef_serial_cfgparm_tap_pager_id_strings; + struct pef_serial_cfgparm_tap_service_settings; + struct pef_serial_cfgparm_terminal_mode_config; + struct pef_serial_cfgparm_ppp_otions; + struct pef_serial_cfgparm_ppp_primary_rmcp_port; + struct pef_serial_cfgparm_ppp_secondary_rmcp_port; + struct pef_serial_cfgparm_ppp_link_auth; + struct pef_serial_cfgparm_ppp_chap_name; + struct pef_serial_cfgparm_ppp_accm; + struct pef_serial_cfgparm_ppp_snoop_accm; + struct pef_serial_cfgparm_ppp_acct_count; + struct pef_serial_cfgparm_ppp_acct_dialstring_selector; + struct pef_serial_cfgparm_ppp_acct_ipaddrs; + struct pef_serial_cfgparm_ppp_acct_user_names; + struct pef_serial_cfgparm_ppp_acct_user_domains; + struct pef_serial_cfgparm_ppp_acct_user_passwords; /* WRITE only */ + struct pef_serial_cfgparm_ppp_acct_auth_settings; + struct pef_serial_cfgparm_ppp_acct_connect_hold_times; + struct pef_serial_cfgparm_ppp_udp_proxy_ipheader; + struct pef_serial_cfgparm_ppp_udp_proxy_xmit_bufsize; + struct pef_serial_cfgparm_ppp_udp_proxy_recv_bufsize; + struct pef_serial_cfgparm_ppp_remote_console_ipaddr; + } ATTRIBUTE_PACKING; +#endif + +#define IPMI_CMD_GET_PEF_CAPABILITIES 0x10 +#define IPMI_CMD_GET_PEF_CONFIG_PARMS 0x13 +#define IPMI_CMD_GET_LAST_PROCESSED_EVT_ID 0x15 +#define IPMI_CMD_GET_SYSTEM_GUID 0x37 +#define IPMI_CMD_GET_CHANNEL_INFO 0x42 +#define IPMI_CMD_LAN_GET_CONFIG 0x02 +#define IPMI_CMD_SERIAL_GET_CONFIG 0x11 + +const char * ipmi_pef_bit_desc(struct bit_desc_map * map, uint32_t val); +void ipmi_pef_print_flags(struct bit_desc_map * map, flg_e type, uint32_t val); +void ipmi_pef_print_dec(const char * text, uint32_t val); +void ipmi_pef_print_hex(const char * text, uint32_t val); +void ipmi_pef_print_1xd(const char * text, uint32_t val); +void ipmi_pef_print_2xd(const char * text, uint8_t u1, uint8_t u2); +void ipmi_pef_print_str(const char * text, const char * val); + +int ipmi_pef_main(struct ipmi_intf * intf, int argc, char ** argv); + +#endif /* IPMI_PEF_H */ diff --git a/include/ipmitool/ipmi_picmg.h b/include/ipmitool/ipmi_picmg.h new file mode 100644 index 0000000..3d70454 --- /dev/null +++ b/include/ipmitool/ipmi_picmg.h @@ -0,0 +1,211 @@ + +/* + (C) Kontron + */ + +#ifndef _IPMI_PICMG_H_ +#define _IPMI_PICMG_H_ + +#include <ipmitool/ipmi.h> + +/* PICMG version */ +#define PICMG_CPCI_MAJOR_VERSION 1 +#define PICMG_ATCA_MAJOR_VERSION 2 +#define PICMG_AMC_MAJOR_VERSION 4 + +/* PICMG commands */ +#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00 +#define PICMG_GET_ADDRESS_INFO_CMD 0x01 +#define PICMG_GET_SHELF_ADDRESS_INFO_CMD 0x02 +#define PICMG_SET_SHELF_ADDRESS_INFO_CMD 0x03 +#define PICMG_FRU_CONTROL_CMD 0x04 +#define PICMG_GET_FRU_LED_PROPERTIES_CMD 0x05 +#define PICMG_GET_LED_COLOR_CAPABILITIES_CMD 0x06 +#define PICMG_SET_FRU_LED_STATE_CMD 0x07 +#define PICMG_GET_FRU_LED_STATE_CMD 0x08 +#define PICMG_SET_IPMB_CMD 0x09 +#define PICMG_SET_FRU_POLICY_CMD 0x0A +#define PICMG_GET_FRU_POLICY_CMD 0x0B +#define PICMG_FRU_ACTIVATION_CMD 0x0C +#define PICMG_GET_DEVICE_LOCATOR_RECORD_CMD 0x0D +#define PICMG_SET_PORT_STATE_CMD 0x0E +#define PICMG_GET_PORT_STATE_CMD 0x0F +#define PICMG_COMPUTE_POWER_PROPERTIES_CMD 0x10 +#define PICMG_SET_POWER_LEVEL_CMD 0x11 +#define PICMG_GET_POWER_LEVEL_CMD 0x12 +#define PICMG_RENEGOTIATE_POWER_CMD 0x13 +#define PICMG_GET_FAN_SPEED_PROPERTIES_CMD 0x14 +#define PICMG_SET_FAN_LEVEL_CMD 0x15 +#define PICMG_GET_FAN_LEVEL_CMD 0x16 +#define PICMG_BUSED_RESOURCE_CMD 0x17 + +/* AMC.0 commands */ +#define PICMG_AMC_SET_PORT_STATE_CMD 0x19 +#define PICMG_AMC_GET_PORT_STATE_CMD 0x1A +/* AMC.0 R2.0 commands */ +#define PICMG_AMC_SET_CLK_STATE_CMD 0x2C +#define PICMG_AMC_GET_CLK_STATE_CMD 0x2D + +/* Site Types */ +#define PICMG_ATCA_BOARD 0x00 +#define PICMG_POWER_ENTRY 0x01 +#define PICMG_SHELF_FRU 0x02 +#define PICMG_DEDICATED_SHMC 0x03 +#define PICMG_FAN_TRAY 0x04 +#define PICMG_FAN_FILTER_TRAY 0x05 +#define PICMG_ALARM 0x06 +#define PICMG_AMC 0x07 +#define PICMG_PMC 0x08 +#define PICMG_RTM 0x09 + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct picmg_set_fru_activation_cmd { + unsigned char picmg_id; /* always 0*/ + unsigned char fru_id; /* threshold setting mask */ + unsigned char fru_state; /* fru activation/deactivation */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +typedef enum picmg_busres_board_cmd_types { + PICMG_BUSRES_BOARD_CMD_QUERY =0, + PICMG_BUSRES_BOARD_CMD_RELEASE, + PICMG_BUSRES_BOARD_CMD_FORCE, + PICMG_BUSRES_BOARD_CMD_BUS_FREE +} t_picmg_busres_board_cmd_types ; + +typedef enum picmg_busres_shmc_cmd_types { + PICMG_BUSRES_SHMC_CMD_REQUEST =0, + PICMG_BUSRES_SHMC_CMD_RELINQUISH, + PICMG_BUSRES_SHMC_CMD_NOTIFY +} t_picmg_busres_shmc_cmd_types ; + +typedef enum picmg_busres_resource_id { + PICMG_BUSRES_METAL_TEST_BUS_1=0, + PICMG_BUSRES_METAL_TEST_BUS_2, + PICMG_BUSRES_SYNC_CLOCK_GROUP_1, + PICMG_BUSRES_SYNC_CLOCK_GROUP_2, + PICMG_BUSRES_SYNC_CLOCK_GROUP_3 +} t_picmg_busres_resource_id; + +/* the LED color capabilities */ +static const char* led_color_str[] __attribute__((unused)) = { + "reserved", + "BLUE", + "RED", + "GREEN", + "AMBER", + "ORANGE", + "WHITE", + "reserved" +}; + + +static const char* amc_link_type_str[] __attribute__((unused)) = { + "RESERVED", + "RESERVED1", + "PCI EXPRESS", + "ADVANCED SWITCHING1", + "ADVANCED SWITCHING2", + "ETHERNET", + "RAPIDIO", + "STORAGE", +}; + +static const char* amc_link_type_ext_str[][16] __attribute__((unused)) = { + /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED */ + { + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 */ + { + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS */ + { + "Gen 1 - NSSC", + "Gen 1 - SSC", + "Gen 2 - NSSC", + "Gen 2 - SSC", + "", "", "", "", + "", "", "", "", + "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 */ + { + "Gen 1 - NSSC", + "Gen 1 - SSC", + "Gen 2 - NSSC", + "Gen 2 - SSC", + "", "", "", "", + "", "", "", "", + "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 */ + { + "Gen 1 - NSSC", + "Gen 1 - SSC", + "Gen 2 - NSSC", + "Gen 2 - SSC", + "", "", "", "", + "", "", "", "", + "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */ + { + "1000BASE-BX (SerDES Gigabit)", + "10GBASE-BX410 Gigabit XAUI", + "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */ + { + "1.25 Gbaud transmission rate", + "2.5 Gbaud transmission rate", + "3.125 Gbaud transmission rate", + "", "", "", "", "", + "", "", "", "", "", "", "", "" + }, + /* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */ + { + "Fibre Channel", + "Serial ATA", + "Serial Attached SCSI", + "", "", "", "", "", + "", "", "", "", "", "", "", "" + } +}; + +struct sAmcPortState { +#ifndef WORDS_BIGENDIAN + unsigned short lane0 : 1; + unsigned short lane1 : 1; + unsigned short lane2 : 1; + unsigned short lane3 : 1; + unsigned short type : 8; + unsigned short type_ext : 4; + unsigned char group_id : 8; +#else + unsigned char group_id : 8; + unsigned short type_ext : 4; + unsigned short type : 8; + unsigned short lane3 : 1; + unsigned short lane2 : 1; + unsigned short lane1 : 1; + unsigned short lane0 : 1; +#endif + + unsigned char state; +}; + + +int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv); +uint8_t picmg_discover(struct ipmi_intf *intf); +uint8_t ipmi_picmg_ipmb_address(struct ipmi_intf *intf); + +#endif diff --git a/include/ipmitool/ipmi_raw.h b/include/ipmitool/ipmi_raw.h new file mode 100644 index 0000000..f4364f3 --- /dev/null +++ b/include/ipmitool/ipmi_raw.h @@ -0,0 +1,44 @@ +/* + * 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. + */ + +#ifndef IPMI_RAW_H +#define IPMI_RAW_H + +#include <ipmitool/ipmi.h> + +int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv); +struct ipmi_rs * ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, uint8_t addr, + uint8_t * wdata, uint8_t wsize, uint8_t rsize); +int ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv); +int ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv); + +#endif /* IPMI_RAW_H */ diff --git a/include/ipmitool/ipmi_sdr.h b/include/ipmitool/ipmi_sdr.h new file mode 100644 index 0000000..724d0cd --- /dev/null +++ b/include/ipmitool/ipmi_sdr.h @@ -0,0 +1,957 @@ +/* + * 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. + */ + +#ifndef IPMI_SDR_H +#define IPMI_SDR_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <math.h> +#include <ipmitool/bswap.h> +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_entity.h> + +int ipmi_sdr_main(struct ipmi_intf *, int, char **); + +#define tos32(val, bits) ((val & ((1<<((bits)-1)))) ? (-((val) & (1<<((bits)-1))) | (val)) : (val)) + +#if WORDS_BIGENDIAN +# define __TO_TOL(mtol) (uint16_t)(mtol & 0x3f) +# define __TO_M(mtol) (int16_t)(tos32((((mtol & 0xff00) >> 8) | ((mtol & 0xc0) << 2)), 10)) +# define __TO_B(bacc) (int32_t)(tos32((((bacc & 0xff000000) >> 24) | ((bacc & 0xc00000) >> 14)), 10)) +# define __TO_ACC(bacc) (uint32_t)(((bacc & 0x3f0000) >> 16) | ((bacc & 0xf000) >> 6)) +# define __TO_ACC_EXP(bacc) (uint32_t)((bacc & 0xc00) >> 10) +# define __TO_R_EXP(bacc) (int32_t)(tos32(((bacc & 0xf0) >> 4), 4)) +# define __TO_B_EXP(bacc) (int32_t)(tos32((bacc & 0xf), 4)) +#else +# define __TO_TOL(mtol) (uint16_t)(BSWAP_16(mtol) & 0x3f) +# define __TO_M(mtol) (int16_t)(tos32((((BSWAP_16(mtol) & 0xff00) >> 8) | ((BSWAP_16(mtol) & 0xc0) << 2)), 10)) +# define __TO_B(bacc) (int32_t)(tos32((((BSWAP_32(bacc) & 0xff000000) >> 24) | \ + ((BSWAP_32(bacc) & 0xc00000) >> 14)), 10)) +# define __TO_ACC(bacc) (uint32_t)(((BSWAP_32(bacc) & 0x3f0000) >> 16) | ((BSWAP_32(bacc) & 0xf000) >> 6)) +# define __TO_ACC_EXP(bacc) (uint32_t)((BSWAP_32(bacc) & 0xc00) >> 10) +# define __TO_R_EXP(bacc) (int32_t)(tos32(((BSWAP_32(bacc) & 0xf0) >> 4), 4)) +# define __TO_B_EXP(bacc) (int32_t)(tos32((BSWAP_32(bacc) & 0xf), 4)) +#endif + +enum { + ANALOG_SENSOR, + DISCRETE_SENSOR, +}; + +#define READING_UNAVAILABLE 0x20 +#define SCANNING_DISABLED 0x40 +#define EVENT_MSG_DISABLED 0x80 + +#define IS_READING_UNAVAILABLE(val) ((val) & READING_UNAVAILABLE) +#define IS_SCANNING_DISABLED(val) (!((val) & SCANNING_DISABLED)) +#define IS_EVENT_MSG_DISABLED(val) (!((val) & EVENT_MSG_DISABLED)) + +#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) + +#define GET_DEVICE_SDR_INFO 0x20 +#define GET_DEVICE_SDR 0x21 +#define GET_SENSOR_FACTORS 0x23 +#define GET_SENSOR_FACTORS 0x23 +#define SET_SENSOR_HYSTERESIS 0x24 +#define GET_SENSOR_HYSTERESIS 0x25 +#define SET_SENSOR_THRESHOLDS 0x26 +#define GET_SENSOR_THRESHOLDS 0x27 +#define SET_SENSOR_EVENT_ENABLE 0x28 +#define GET_SENSOR_EVENT_ENABLE 0x29 +#define GET_SENSOR_EVENT_STATUS 0x2b +#define GET_SENSOR_READING 0x2d +#define GET_SENSOR_TYPE 0x2f +#define GET_SENSOR_READING 0x2d +#define GET_SENSOR_TYPE 0x2f + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_repo_info_rs { + uint8_t version; /* SDR version (51h) */ + uint16_t count; /* number of records */ + uint16_t free; /* free space in SDR */ + uint32_t add_stamp; /* last add timestamp */ + uint32_t erase_stamp; /* last del timestamp */ + uint8_t op_support; /* supported operations */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +/* builtin (device) sdrs support */ +struct sdr_device_info_rs { + unsigned char count; /* number of records */ + unsigned char flags; /* flags */ + unsigned char popChangeInd[3]; /* free space in SDR */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +#define GET_SDR_RESERVE_REPO 0x22 +struct sdr_reserve_repo_rs { + uint16_t reserve_id; /* reservation ID */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +#define GET_SDR 0x23 +struct sdr_get_rq { + uint16_t reserve_id; /* reservation ID */ + uint16_t id; /* record ID */ + uint8_t offset; /* offset into SDR */ +#define GET_SDR_ENTIRE_RECORD 0xff + uint8_t length; /* length to read */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_get_rs { + uint16_t next; /* next record id */ + uint16_t id; /* record ID */ + uint8_t version; /* SDR version (51h) */ +#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 + uint8_t type; /* record type */ + uint8_t length; /* remaining record bytes */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_record_mask { + union { + struct { + uint16_t assert_event; /* assertion event mask */ + uint16_t deassert_event; /* de-assertion event mask */ + uint16_t read; /* discrete reading mask */ + } ATTRIBUTE_PACKING discrete; + struct { +#if WORDS_BIGENDIAN + uint16_t reserved:1; + uint16_t status_lnr:1; + uint16_t status_lcr:1; + uint16_t status_lnc:1; + uint16_t assert_unr_high:1; + uint16_t assert_unr_low:1; + uint16_t assert_ucr_high:1; + uint16_t assert_ucr_low:1; + uint16_t assert_unc_high:1; + uint16_t assert_unc_low:1; + uint16_t assert_lnr_high:1; + uint16_t assert_lnr_low:1; + uint16_t assert_lcr_high:1; + uint16_t assert_lcr_low:1; + uint16_t assert_lnc_high:1; + uint16_t assert_lnc_low:1; +#else + uint16_t assert_lnc_low:1; + uint16_t assert_lnc_high:1; + uint16_t assert_lcr_low:1; + uint16_t assert_lcr_high:1; + uint16_t assert_lnr_low:1; + uint16_t assert_lnr_high:1; + uint16_t assert_unc_low:1; + uint16_t assert_unc_high:1; + uint16_t assert_ucr_low:1; + uint16_t assert_ucr_high:1; + uint16_t assert_unr_low:1; + uint16_t assert_unr_high:1; + uint16_t status_lnc:1; + uint16_t status_lcr:1; + uint16_t status_lnr:1; + uint16_t reserved:1; +#endif +#if WORDS_BIGENDIAN + uint16_t reserved_2:1; + uint16_t status_unr:1; + uint16_t status_ucr:1; + uint16_t status_unc:1; + uint16_t deassert_unr_high:1; + uint16_t deassert_unr_low:1; + uint16_t deassert_ucr_high:1; + uint16_t deassert_ucr_low:1; + uint16_t deassert_unc_high:1; + uint16_t deassert_unc_low:1; + uint16_t deassert_lnr_high:1; + uint16_t deassert_lnr_low:1; + uint16_t deassert_lcr_high:1; + uint16_t deassert_lcr_low:1; + uint16_t deassert_lnc_high:1; + uint16_t deassert_lnc_low:1; +#else + uint16_t deassert_lnc_low:1; + uint16_t deassert_lnc_high:1; + uint16_t deassert_lcr_low:1; + uint16_t deassert_lcr_high:1; + uint16_t deassert_lnr_low:1; + uint16_t deassert_lnr_high:1; + uint16_t deassert_unc_low:1; + uint16_t deassert_unc_high:1; + uint16_t deassert_ucr_low:1; + uint16_t deassert_ucr_high:1; + uint16_t deassert_unr_low:1; + uint16_t deassert_unr_high:1; + uint16_t status_unc:1; + uint16_t status_ucr:1; + uint16_t status_unr:1; + uint16_t reserved_2:1; +#endif + union { + struct { +#if WORDS_BIGENDIAN /* settable threshold mask */ + uint16_t reserved:2; + uint16_t unr:1; + uint16_t ucr:1; + uint16_t unc:1; + uint16_t lnr:1; + uint16_t lcr:1; + uint16_t lnc:1; + /* padding lower 8 bits */ + uint16_t readable:8; +#else + uint16_t readable:8; + uint16_t lnc:1; + uint16_t lcr:1; + uint16_t lnr:1; + uint16_t unc:1; + uint16_t ucr:1; + uint16_t unr:1; + uint16_t reserved:2; +#endif + } ATTRIBUTE_PACKING set; + struct { +#if WORDS_BIGENDIAN /* readable threshold mask */ + /* padding upper 8 bits */ + uint16_t settable:8; + uint16_t reserved:2; + uint16_t unr:1; + uint16_t ucr:1; + uint16_t unc:1; + uint16_t lnr:1; + uint16_t lcr:1; + uint16_t lnc:1; +#else + uint16_t lnc:1; + uint16_t lcr:1; + uint16_t lnr:1; + uint16_t unc:1; + uint16_t ucr:1; + uint16_t unr:1; + uint16_t reserved:2; + uint16_t settable:8; +#endif + } ATTRIBUTE_PACKING read; + } ATTRIBUTE_PACKING; + } ATTRIBUTE_PACKING threshold; + } ATTRIBUTE_PACKING type; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_record_common_sensor { + struct { + uint8_t owner_id; +#if WORDS_BIGENDIAN + uint8_t channel:4; /* channel number */ + uint8_t __reserved:2; + uint8_t lun:2; /* sensor owner lun */ +#else + uint8_t lun:2; /* sensor owner lun */ + uint8_t __reserved:2; + uint8_t channel:4; /* channel number */ +#endif + uint8_t sensor_num; /* unique sensor number */ + } ATTRIBUTE_PACKING keys; + + struct entity_id entity; + + struct { + struct { +#if WORDS_BIGENDIAN + uint8_t __reserved:1; + uint8_t scanning:1; + uint8_t events:1; + uint8_t thresholds:1; + uint8_t hysteresis:1; + uint8_t type:1; + uint8_t event_gen:1; + uint8_t sensor_scan:1; +#else + uint8_t sensor_scan:1; + uint8_t event_gen:1; + uint8_t type:1; + uint8_t hysteresis:1; + uint8_t thresholds:1; + uint8_t events:1; + uint8_t scanning:1; + uint8_t __reserved:1; +#endif + } ATTRIBUTE_PACKING init; + struct { +#if WORDS_BIGENDIAN + uint8_t ignore:1; + uint8_t rearm:1; + uint8_t hysteresis:2; + uint8_t threshold:2; + uint8_t event_msg:2; +#else + uint8_t event_msg:2; + uint8_t threshold:2; + uint8_t hysteresis:2; + uint8_t rearm:1; + uint8_t ignore:1; +#endif + } ATTRIBUTE_PACKING capabilities; + uint8_t type; + } ATTRIBUTE_PACKING sensor; + + uint8_t event_type; /* event/reading type code */ + + struct sdr_record_mask mask; + + struct { +#if WORDS_BIGENDIAN + uint8_t analog:2; + uint8_t rate:3; + uint8_t modifier:2; + uint8_t pct:1; +#else + uint8_t pct:1; + uint8_t modifier:2; + uint8_t rate:3; + uint8_t analog:2; +#endif + struct { + uint8_t base; + uint8_t modifier; + } ATTRIBUTE_PACKING type; + } ATTRIBUTE_PACKING unit; +} ATTRIBUTE_PACKING; + +/* SDR Record Common Sensor header macros */ +#define IS_THRESHOLD_SENSOR(s) ((s)->event_type == 1) +#define UNITS_ARE_DISCRETE(s) ((s)->unit.analog == 3) + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_record_compact_sensor { + struct sdr_record_common_sensor cmn; + struct { +#if WORDS_BIGENDIAN + uint8_t __reserved:2; + uint8_t mod_type:2; + uint8_t count:4; +#else + uint8_t count:4; + uint8_t mod_type:2; + uint8_t __reserved:2; +#endif +#if WORDS_BIGENDIAN + uint8_t entity_inst:1; + uint8_t mod_offset:7; +#else + uint8_t mod_offset:7; + uint8_t entity_inst:1; +#endif + } ATTRIBUTE_PACKING share; + + struct { + struct { + uint8_t positive; + uint8_t negative; + } ATTRIBUTE_PACKING hysteresis; + } ATTRIBUTE_PACKING threshold; + + uint8_t __reserved[3]; + uint8_t oem; /* reserved for OEM use */ + uint8_t id_code; /* sensor ID string type/length code */ + uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_record_eventonly_sensor { + struct { + uint8_t owner_id; +#if WORDS_BIGENDIAN + uint8_t channel:4; /* channel number */ + uint8_t fru_owner:2; /* fru device owner lun */ + uint8_t lun:2; /* sensor owner lun */ +#else + uint8_t lun:2; /* sensor owner lun */ + uint8_t fru_owner:2; /* fru device owner lun */ + uint8_t channel:4; /* channel number */ +#endif + uint8_t sensor_num; /* unique sensor number */ + } ATTRIBUTE_PACKING keys; + + struct entity_id entity; + + uint8_t sensor_type; /* sensor type */ + uint8_t event_type; /* event/reading type code */ + + struct { +#if WORDS_BIGENDIAN + uint8_t __reserved:2; + uint8_t mod_type:2; + uint8_t count:4; +#else + uint8_t count:4; + uint8_t mod_type:2; + uint8_t __reserved:2; +#endif +#if WORDS_BIGENDIAN + uint8_t entity_inst:1; + uint8_t mod_offset:7; +#else + uint8_t mod_offset:7; + uint8_t entity_inst:1; +#endif + } ATTRIBUTE_PACKING share; + + uint8_t __reserved; + uint8_t oem; /* reserved for OEM use */ + uint8_t id_code; /* sensor ID string type/length code */ + uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ + +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_record_full_sensor { + struct sdr_record_common_sensor cmn; + +#define SDR_SENSOR_L_LINEAR 0x00 +#define SDR_SENSOR_L_LN 0x01 +#define SDR_SENSOR_L_LOG10 0x02 +#define SDR_SENSOR_L_LOG2 0x03 +#define SDR_SENSOR_L_E 0x04 +#define SDR_SENSOR_L_EXP10 0x05 +#define SDR_SENSOR_L_EXP2 0x06 +#define SDR_SENSOR_L_1_X 0x07 +#define SDR_SENSOR_L_SQR 0x08 +#define SDR_SENSOR_L_CUBE 0x09 +#define SDR_SENSOR_L_SQRT 0x0a +#define SDR_SENSOR_L_CUBERT 0x0b +#define SDR_SENSOR_L_NONLINEAR 0x70 + + uint8_t linearization; /* 70h=non linear, 71h-7Fh=non linear, OEM */ + uint16_t mtol; /* M, tolerance */ + uint32_t bacc; /* accuracy, B, Bexp, Rexp */ + + struct { +#if WORDS_BIGENDIAN + uint8_t __reserved:5; + uint8_t normal_min:1; /* normal min field specified */ + uint8_t normal_max:1; /* normal max field specified */ + uint8_t nominal_read:1; /* nominal reading field specified */ +#else + uint8_t nominal_read:1; /* nominal reading field specified */ + uint8_t normal_max:1; /* normal max field specified */ + uint8_t normal_min:1; /* normal min field specified */ + uint8_t __reserved:5; +#endif + } ATTRIBUTE_PACKING analog_flag; + + uint8_t nominal_read; /* nominal reading, raw value */ + uint8_t normal_max; /* normal maximum, raw value */ + uint8_t normal_min; /* normal minimum, raw value */ + uint8_t sensor_max; /* sensor maximum, raw value */ + uint8_t sensor_min; /* sensor minimum, raw value */ + + struct { + struct { + uint8_t non_recover; + uint8_t critical; + uint8_t non_critical; + } ATTRIBUTE_PACKING upper; + struct { + uint8_t non_recover; + uint8_t critical; + uint8_t non_critical; + } ATTRIBUTE_PACKING lower; + struct { + uint8_t positive; + uint8_t negative; + } ATTRIBUTE_PACKING hysteresis; + } ATTRIBUTE_PACKING threshold; + uint8_t __reserved[2]; + uint8_t oem; /* reserved for OEM use */ + uint8_t id_code; /* sensor ID string type/length code */ + uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_record_mc_locator { + uint8_t dev_slave_addr; +#if WORDS_BIGENDIAN + uint8_t __reserved2:4; + uint8_t channel_num:4; +#else + uint8_t channel_num:4; + uint8_t __reserved2:4; +#endif +#if WORDS_BIGENDIAN + uint8_t pwr_state_notif:3; + uint8_t __reserved3:1; + uint8_t global_init:4; +#else + uint8_t global_init:4; + uint8_t __reserved3:1; + uint8_t pwr_state_notif:3; +#endif + uint8_t dev_support; + uint8_t __reserved4[3]; + struct entity_id entity; + uint8_t oem; + uint8_t id_code; + uint8_t id_string[16]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +struct sdr_record_fru_locator { + uint8_t dev_slave_addr; + uint8_t device_id; +#if WORDS_BIGENDIAN + uint8_t logical:1; + uint8_t __reserved2:2; + uint8_t lun:2; + uint8_t bus:3; +#else + uint8_t bus:3; + uint8_t lun:2; + uint8_t __reserved2:2; + uint8_t logical:1; +#endif +#if WORDS_BIGENDIAN + uint8_t channel_num:4; + uint8_t __reserved3:4; +#else + uint8_t __reserved3:4; + uint8_t channel_num:4; +#endif + uint8_t __reserved4; + uint8_t dev_type; + uint8_t dev_type_modifier; + struct entity_id entity; + uint8_t oem; + uint8_t id_code; + uint8_t id_string[16]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_record_generic_locator { + uint8_t dev_access_addr; + uint8_t dev_slave_addr; +#if WORDS_BIGENDIAN + uint8_t channel_num:3; + uint8_t lun:2; + uint8_t bus:3; +#else + uint8_t bus:3; + uint8_t lun:2; + uint8_t channel_num:3; +#endif +#if WORDS_BIGENDIAN + uint8_t addr_span:3; + uint8_t __reserved1:5; +#else + uint8_t __reserved1:5; + uint8_t addr_span:3; +#endif + uint8_t __reserved2; + uint8_t dev_type; + uint8_t dev_type_modifier; + struct entity_id entity; + uint8_t oem; + uint8_t id_code; + uint8_t id_string[16]; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_record_entity_assoc { + struct entity_id entity; /* container entity ID and instance */ + struct { +#if WORDS_BIGENDIAN + uint8_t isrange:1; + uint8_t islinked:1; + uint8_t isaccessable:1; + uint8_t __reserved:5; +#else + uint8_t __reserved:5; + uint8_t isaccessable:1; + uint8_t islinked:1; + uint8_t isrange:1; +#endif + } flags; + uint8_t entity_id_1; /* entity ID 1 | range 1 entity */ + uint8_t entity_inst_1; /* entity inst 1 | range 1 first instance */ + uint8_t entity_id_2; /* entity ID 2 | range 1 entity */ + uint8_t entity_inst_2; /* entity inst 2 | range 1 last instance */ + uint8_t entity_id_3; /* entity ID 3 | range 2 entity */ + uint8_t entity_inst_3; /* entity inst 3 | range 2 first instance */ + uint8_t entity_id_4; /* entity ID 4 | range 2 entity */ + uint8_t entity_inst_4; /* entity inst 4 | range 2 last instance */ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +struct sdr_record_oem { + uint8_t *data; + int data_len; +}; + +/* + * The Get SDR Repository Info response structure + * From table 33-3 of the IPMI v2.0 spec + */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct get_sdr_repository_info_rsp { + uint8_t sdr_version; + uint8_t record_count_lsb; + uint8_t record_count_msb; + uint8_t free_space[2]; + uint8_t most_recent_addition_timestamp[4]; + uint8_t most_recent_erase_timestamp[4]; +#if WORDS_BIGENDIAN + uint8_t overflow_flag:1; + uint8_t modal_update_support:2; + uint8_t __reserved1:1; + uint8_t delete_sdr_supported:1; + uint8_t partial_add_sdr_supported:1; + uint8_t reserve_sdr_repository_supported:1; + uint8_t get_sdr_repository_allo_info_supported:1; +#else + uint8_t get_sdr_repository_allo_info_supported:1; + uint8_t reserve_sdr_repository_supported:1; + uint8_t partial_add_sdr_supported:1; + uint8_t delete_sdr_supported:1; + uint8_t __reserved1:1; + uint8_t modal_update_support:2; + uint8_t overflow_flag:1; +#endif +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +struct ipmi_sdr_iterator { + uint16_t reservation; + int total; + int next; + int use_built_in; +}; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sdr_record_list { + uint16_t id; + uint8_t version; + uint8_t type; + uint8_t length; + uint8_t *raw; + struct sdr_record_list *next; + union { + struct sdr_record_common_sensor *common; + struct sdr_record_full_sensor *full; + struct sdr_record_compact_sensor *compact; + struct sdr_record_eventonly_sensor *eventonly; + struct sdr_record_generic_locator *genloc; + struct sdr_record_fru_locator *fruloc; + struct sdr_record_mc_locator *mcloc; + struct sdr_record_entity_assoc *entassoc; + struct sdr_record_oem *oem; + } ATTRIBUTE_PACKING record; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + +/* 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",}; + +/* sensor type codes (IPMI v1.5 table 36.3) + / Updated to v2.0 Table 42-3, Sensor Type Codes */ +#define SENSOR_TYPE_MAX 0x2C +static const char *sensor_type_desc[] __attribute__ ((unused)) = { +"reserved", + "Temperature", "Voltage", "Current", "Fan", + "Physical Security", "Platform Security", "Processor", + "Power Supply", "Power Unit", "Cooling Device", "Other", + "Memory", "Drive Slot / Bay", "POST Memory Resize", + "System Firmwares", "Event Logging Disabled", "Watchdog1", + "System Event", "Critical Interrupt", "Button", + "Module / Board", "Microcontroller", "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", "Watchdog2", "Platform Alert", + "Entity Presence", "Monitor ASIC", "LAN", + "Management Subsys Health", "Battery", "Session Audit", + "Version Change", "FRU State" }; + +struct sensor_reading { + char s_id[17]; /* name of the sensor */ + struct sdr_record_full_sensor *full; + struct sdr_record_compact_sensor *compact; + uint8_t s_reading_valid; /* read value valididity */ + uint8_t s_scanning_disabled; /* read of value disabled */ + uint8_t s_reading_unavailable; /* read value unavailable */ + uint8_t s_reading; /* value which was read */ + uint8_t s_data2; /* data2 value read */ + uint8_t s_data3; /* data3 value read */ + uint8_t s_has_analog_value; /* sensor has analog value */ + double s_a_val; /* read value converted to analog */ + char s_a_str[16]; /* analog value as a string */ + const char *s_a_units; /* analog value units string */ +}; + +/* + * Determine if bridging is necessary to address a sensor at the given + * address (_addr) and (_chan) via the interface (_intf). + * + * If the sensor is being addressed on channel zero, it resides on + * IPMB-0. If the interface target IPMB-0 address is exactly the same as + * the sensor address then the sensor resides on the target IPMB-0 + * so we don't need extra levels of bridging to address the sensor. + * Or + * If the sensor target address and channel match the interface target address + * and channel then there is no extra levels of bridging required. + * + * Note: + * The target IPMB-0 address is the address of the SDR repository that was + * accessed using the user specified bridging command line arguments. + * Access to any sensor on the target IPMB-0 can be addressed using the + * target address and transit address in the interface. + */ +#define BRIDGE_TO_SENSOR(_intf, _addr, _chan) \ + ( !((_chan == 0 && _intf->target_ipmb_addr && \ + _intf->target_ipmb_addr == _addr) || \ + (_addr == _intf->target_addr && _chan == _intf->target_channel)) ) + + +struct ipmi_sdr_iterator *ipmi_sdr_start(struct ipmi_intf *intf, + int use_builtin); +struct sdr_get_rs *ipmi_sdr_get_next_header(struct ipmi_intf *intf, + struct ipmi_sdr_iterator *i); +uint8_t *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); +int ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type); + +int ipmi_sdr_print_name_from_rawentry(struct ipmi_intf *intf,uint16_t id, + uint8_t type,uint8_t * raw); +int ipmi_sdr_print_rawentry(struct ipmi_intf *intf, uint8_t type, uint8_t * raw, + int len); +int ipmi_sdr_print_listentry(struct ipmi_intf *intf, + struct sdr_record_list *entry); +void ipmi_sdr_print_sensor_hysteresis(struct sdr_record_common_sensor *sensor, + struct sdr_record_full_sensor *full, + uint8_t hysteresis_value, + const char *hdrstr); +const char *ipmi_sdr_get_unit_string(uint8_t pct, uint8_t type, + uint8_t base, uint8_t modifier); +struct sensor_reading * +ipmi_sdr_read_sensor_value(struct ipmi_intf *intf, + struct sdr_record_common_sensor *sensor, + uint8_t sdr_record_type, int precision); +const char *ipmi_sdr_get_thresh_status(struct sensor_reading *sr, + const char *invalidstr); +const char *ipmi_sdr_get_status(int, const char *, uint8_t stat); +double sdr_convert_sensor_tolerance(struct sdr_record_full_sensor *sensor, + uint8_t val); +double sdr_convert_sensor_reading(struct sdr_record_full_sensor *sensor, + uint8_t val); +double sdr_convert_sensor_hysterisis(struct sdr_record_full_sensor *sensor, + uint8_t val); +uint8_t sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor *sensor, + double val); +struct ipmi_rs *ipmi_sdr_get_sensor_reading(struct ipmi_intf *intf, + uint8_t sensor); +struct ipmi_rs *ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf, + uint8_t sensor, + uint8_t target, + uint8_t lun, + uint8_t channel); +struct ipmi_rs *ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf, + uint8_t sensor, + uint8_t target, uint8_t lun, uint8_t channel); +struct ipmi_rs *ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf, + uint8_t sensor, + uint8_t target, uint8_t lun, uint8_t channel); +const char *ipmi_sdr_get_sensor_type_desc(const uint8_t type); +int ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin, + uint16_t * reserve_id); + +int ipmi_sdr_print_sensor_eventonly(struct ipmi_intf *intf, + struct sdr_record_eventonly_sensor *sensor); +int ipmi_sdr_print_sensor_generic_locator(struct ipmi_intf *intf, + struct sdr_record_generic_locator + *fru); +int ipmi_sdr_print_sensor_fru_locator(struct ipmi_intf *intf, + struct sdr_record_fru_locator *fru); +int ipmi_sdr_print_sensor_mc_locator(struct ipmi_intf *intf, + struct sdr_record_mc_locator *mc); +int ipmi_sdr_print_sensor_entity_assoc(struct ipmi_intf *intf, + struct sdr_record_entity_assoc *assoc); + +struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf, + struct entity_id *entity); +struct sdr_record_list *ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, + uint16_t gen_id, uint8_t num, uint8_t type); +struct sdr_record_list *ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf *intf, + uint8_t type); +struct sdr_record_list *ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, + char *id); +struct sdr_record_list *ipmi_sdr_find_sdr_bytype(struct ipmi_intf *intf, + uint8_t type); +int ipmi_sdr_list_cache(struct ipmi_intf *intf); +int ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile); +void ipmi_sdr_list_empty(struct ipmi_intf *intf); +int ipmi_sdr_print_info(struct ipmi_intf *intf); +void ipmi_sdr_print_discrete_state(const char *desc, uint8_t sensor_type, + uint8_t event_type, uint8_t state1, + uint8_t state2); +void ipmi_sdr_print_discrete_state_mini(const char *header, const char *separator, + uint8_t sensor_type, uint8_t event_type, + uint8_t state1, uint8_t state2); +int ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf, + uint8_t sensor_num, uint8_t sensor_type, + uint8_t event_type, int numeric_fmt, + uint8_t target, uint8_t lun, uint8_t channel); +int ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf, + uint8_t sensor_num, uint8_t sensor_type, + uint8_t event_type, int numeric_fmt, + uint8_t target, uint8_t lun, uint8_t channel); + +#endif /* IPMI_SDR_H */ diff --git a/include/ipmitool/ipmi_sdradd.h b/include/ipmitool/ipmi_sdradd.h new file mode 100644 index 0000000..b39e82b --- /dev/null +++ b/include/ipmitool/ipmi_sdradd.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +#ifndef IPMI_SDRADD_H +#define IPMI_SDRADD_H + +/* + * Methods to add SDRs to repository from built-in sensors or files + */ +int +ipmi_sdr_add_from_sensors(struct ipmi_intf *intf, int maxslot); + +int +ipmi_sdr_add_from_file(struct ipmi_intf *intf, const char *ifile); + +int +ipmi_sdr_add_from_list(struct ipmi_intf *intf, const char *rangeList); + +#endif /* IPMI_SDRADD_H */ diff --git a/include/ipmitool/ipmi_sel.h b/include/ipmitool/ipmi_sel.h new file mode 100644 index 0000000..cacdb2d --- /dev/null +++ b/include/ipmitool/ipmi_sel.h @@ -0,0 +1,756 @@ +/* + * 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. + */ + +#ifndef IPMI_SEL_H +#define IPMI_SEL_H + +#include <inttypes.h> +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_sdr.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, + IPMI_EVENT_CLASS_THRESHOLD, + IPMI_EVENT_CLASS_OEM, +}; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sel_get_rq { + uint16_t reserve_id; + uint16_t record_id; + uint8_t offset; + uint8_t length; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +struct standard_spec_sel_rec{ + uint32_t timestamp; + uint16_t gen_id; + uint8_t evm_rev; + uint8_t sensor_type; + uint8_t sensor_num; +#if WORDS_BIGENDIAN + uint8_t event_dir : 1; + uint8_t event_type : 7; +#else + uint8_t event_type : 7; + uint8_t event_dir : 1; +#endif +#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 */ + uint8_t event_data[3]; +}; +/* Dell Specific MACRO's */ +#define OEM_CODE_IN_BYTE2 0x80 /* Dell specific OEM Byte in Byte 2 Mask */ +#define OEM_CODE_IN_BYTE3 0x20 /* Dell specific OEM Byte in Byte 3 Mask */ +/* MASK MACROS */ +#define MASK_LOWER_NIBBLE 0x0F +#define MASK_HIGHER_NIBBLE 0xF0 +/*Senosr type Macro's */ +#define SENSOR_TYPE_MEMORY 0x0C +#define SENSOR_TYPE_CRIT_INTR 0x13 +#define SENSOR_TYPE_EVT_LOG 0x10 +#define SENSOR_TYPE_SYS_EVENT 0x12 +#define SENSOR_TYPE_PROCESSOR 0x07 +#define SENSOR_TYPE_OEM_SEC_EVENT 0xC1 +#define SENSOR_TYPE_VER_CHANGE 0x2B +#define SENSOR_TYPE_FRM_PROG 0x0F +#define SENSOR_TYPE_WTDOG 0x23 +#define SENSOR_TYPE_OEM_NFATAL_ERROR 0xC2 +#define SENSOR_TYPE_OEM_FATAL_ERROR 0xC3 +#define SENSOR_TYPE_TXT_CMD_ERROR 0x20 +#define SENSOR_TYPE_SUPERMICRO_OEM 0xD0 +/* End of Macro for DELL Specific */ +#define SEL_OEM_TS_DATA_LEN 6 +#define SEL_OEM_NOTS_DATA_LEN 13 +struct oem_ts_spec_sel_rec{ + uint32_t timestamp; + uint8_t manf_id[3]; + uint8_t oem_defined[SEL_OEM_TS_DATA_LEN]; +}; + +struct oem_nots_spec_sel_rec{ + uint8_t oem_defined[SEL_OEM_NOTS_DATA_LEN]; +}; + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sel_event_record { + uint16_t record_id; + uint8_t record_type; + union{ + struct standard_spec_sel_rec standard_type; + struct oem_ts_spec_sel_rec oem_ts_type; + struct oem_nots_spec_sel_rec oem_nots_type; + } sel_type; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +struct ipmi_event_sensor_types { + uint8_t code; + uint8_t offset; +#define ALL_OFFSETS_SPECIFIED 0xff + uint8_t data; + uint8_t class; + const char * type; + const char * desc; +}; + +/* The sel module uses the "iana" number to select the appropriate array at run time + This table if for iana number 15000 ( Kontron ), you can add you own OEM sensor types + using a similar constuct, look for switch(iana) in ipmi_sel.c + */ +static struct ipmi_event_sensor_types oem_kontron_event_types[] __attribute__((unused)) = { + + /* event type details uses an oem event type */ + { 0xC0 , 0xFF , 0xff, IPMI_EVENT_CLASS_DISCRETE , "OEM Firmware Info", NULL }, + { 0xC0 , 0xFF , 0xff, IPMI_EVENT_CLASS_DISCRETE , "OEM Firmware Info", NULL }, + + { 0xC1 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Push Button" }, + { 0xC1 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Bridge Reset" }, + { 0xC1 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Backplane" }, + { 0xC1 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Hotswap Fault" }, + { 0xC1 , 0x04 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Hotswap Healty" }, + { 0xC1 , 0x05 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Unknown" }, + { 0xC1 , 0x06 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "ITP" }, + { 0xC1 , 0x07 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Hardware Watchdog" }, + { 0xC1 , 0x08 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset(cPCI)", "Software Reset" }, + + /* Uses standard digital reading type */ + { 0xC2 , 0xFF , 0xff, IPMI_EVENT_CLASS_DIGITAL , "SDRR Init Agent", NULL }, + + /* based on PICMG IPMB-0 Link state sensor */ + { 0xC3 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "IPMB-L Link State", "IPMB L Disabled" }, + { 0xC3 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "IPMB-L Link State", "IPMB L Enabled" }, + + { 0xC4 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Push Button" }, + { 0xC4 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Hardware Power Failure" }, + { 0xC4 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Unknown" }, + { 0xC4 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Hardware Watchdog" }, + { 0xC4 , 0x04 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Soft Reset" }, + { 0xC4 , 0x05 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Warm Reset" }, + { 0xC4 , 0x06 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Cold Reset" }, + { 0xC4 , 0x07 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "IPMI Command" }, + { 0xC4 , 0x08 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Setup Reset (Save CMOS)" }, + { 0xC4 , 0x09 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Board Reset", "Power Up Reset" }, + + /* event type details uses a standard */ + { 0xC5 , 0xFF , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FRU Information Agent", NULL }, + + { 0xC6 , 0x0E , 0xff, IPMI_EVENT_CLASS_DISCRETE , "POST Value", "Post Error (see data2)" }, + + { 0xC7 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "First Boot After Upgrade" }, + { 0xC7 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "First Boot After Rollback(error)" }, + { 0xC7 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "First Boot After Errors (watchdog)" }, + { 0xC7 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "First Boot After Manual Rollback" }, + { 0xC7 , 0x08 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FWUM Status", "Firmware Watchdog Bite, reset occured" }, + + { 0xC8 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Switch Mngt Software Status", "Not Loaded" }, + { 0xC8 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Switch Mngt Software Status", "Initializing" }, + { 0xC8 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Switch Mngt Software Status", "Ready" }, + { 0xC8 , 0x03 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Switch Mngt Software Status", "Failure (see data2)" }, + + { 0xC9 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Diagnostic Status", "Started" }, + { 0xC9 , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Diagnostic Status", "Pass" }, + { 0xC9 , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Diagnostic Status", "Fail" }, + + { 0xCA , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Firmware Upgrade Status", "In progress"}, + { 0xCA , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Firmware Upgrade Status", "Success"}, + { 0xCA , 0x02 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Firmware Upgrade Status", "Failure"}, + + { 0xCB , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FRU Over Current", "Asserted"}, + { 0xCB , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FRU Over Current", "Deasserted"}, + + { 0xCC , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FRU Sensor Error", "Asserted"}, + { 0xCC , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FRU Sensor Error", "Deasserted"}, + + { 0xCD , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FRU Power Denied", "Asserted"}, + { 0xCD , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "FRU Power Denied", "Deasserted"}, + + { 0xCF , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Reset", "Asserted"}, + { 0xCF , 0x01 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "Reset", "Deasserted"}, + + /* END */ + { 0x00, 0x00, 0xff, 0x00, NULL, NULL }, +}; + +static struct ipmi_event_sensor_types generic_event_types[] __attribute__((unused)) = { + /* Threshold Based States */ + { 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, 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, 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, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to OK" }, + { 0x07, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critical 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, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Absent" }, + { 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device 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, 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, 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, 0xff, 0x00, NULL, NULL }, +}; + +static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unused)) = { + { 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, 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" }, + { 0x05, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "FAN area intrusion" }, + + { 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 violation - 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, 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" }, + { 0x07, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Throttled" }, + { 0x07, 0x0b, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Uncorrectable machine check exception" }, + { 0x07, 0x0c, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Correctable machine check error" }, + + { 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" }, + { 0x08, 0x06, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Vendor Mismatch" }, + { 0x08, 0x06, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Revision Mismatch" }, + { 0x08, 0x06, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Processor Missing" }, + { 0x08, 0x06, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Power Supply Rating Mismatch" }, + { 0x08, 0x06, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Voltage Rating Mismatch" }, + { 0x08, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error" }, + { 0x08, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Power Supply Inactive" }, + + { 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, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cooling Device", NULL }, + { 0x0b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Other Units-based Sensor", NULL }, + + { 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" }, + { 0x0c, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Presence Detected" }, + { 0x0c, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Configuration Error" }, + { 0x0c, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Spare" }, + { 0x0c, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Throttled" }, + { 0x0c, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Critical Overtemperature" }, + + { 0x0d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Present" }, + { 0x0d, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Fault" }, + { 0x0d, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Predictive Failure" }, + { 0x0d, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Hot Spare" }, + { 0x0d, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Parity Check In Progress" }, + { 0x0d, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "In Critical Array" }, + { 0x0d, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "In Failed Array" }, + { 0x0d, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Rebuild In Progress" }, + { 0x0d, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Rebuild Aborted" }, + + { 0x0e, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "POST Memory Resize", NULL }, + + { 0x0f, 0x00, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unspecified" }, + { 0x0f, 0x00, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "No system memory installed" }, + { 0x0f, 0x00, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "No usable system memory" }, + { 0x0f, 0x00, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable IDE device failure" }, + { 0x0f, 0x00, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable system-board failure" }, + { 0x0f, 0x00, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable diskette failure" }, + { 0x0f, 0x00, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable hard-disk controller failure" }, + { 0x0f, 0x00, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable PS/2 or USB keyboard failure" }, + { 0x0f, 0x00, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Removable boot media not found" }, + { 0x0f, 0x00, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable video controller failure" }, + { 0x0f, 0x00, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "No video device selected" }, + { 0x0f, 0x00, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "BIOS corruption detected" }, + { 0x0f, 0x00, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "CPU voltage mismatch" }, + { 0x0f, 0x00, 0x0d, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "CPU speed mismatch failure" }, + { 0x0f, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unknown Error" }, + + { 0x0f, 0x01, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Unspecified" }, + { 0x0f, 0x01, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Memory initialization" }, + { 0x0f, 0x01, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Hard-disk initialization" }, + { 0x0f, 0x01, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Secondary CPU Initialization" }, + { 0x0f, 0x01, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "User authentication" }, + { 0x0f, 0x01, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "User-initiated system setup" }, + { 0x0f, 0x01, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "USB resource configuration" }, + { 0x0f, 0x01, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "PCI resource configuration" }, + { 0x0f, 0x01, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Option ROM initialization" }, + { 0x0f, 0x01, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Video initialization" }, + { 0x0f, 0x01, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Cache initialization" }, + { 0x0f, 0x01, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "SMBus initialization" }, + { 0x0f, 0x01, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Keyboard controller initialization" }, + { 0x0f, 0x01, 0x0d, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Management controller initialization" }, + { 0x0f, 0x01, 0x0e, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Docking station attachment" }, + { 0x0f, 0x01, 0x0f, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Enabling docking station" }, + { 0x0f, 0x01, 0x10, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Docking station ejection" }, + { 0x0f, 0x01, 0x11, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Disabling docking station" }, + { 0x0f, 0x01, 0x12, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Calling operating system wake-up vector" }, + { 0x0f, 0x01, 0x13, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "System boot initiated" }, + { 0x0f, 0x01, 0x14, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Motherboard initialization" }, + { 0x0f, 0x01, 0x15, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "reserved" }, + { 0x0f, 0x01, 0x16, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Floppy initialization" }, + { 0x0f, 0x01, 0x17, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Keyboard test" }, + { 0x0f, 0x01, 0x18, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Pointing device test" }, + { 0x0f, 0x01, 0x19, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Primary CPU initialization" }, + { 0x0f, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Unknown Hang" }, + + { 0x0f, 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Unspecified" }, + { 0x0f, 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Memory initialization" }, + { 0x0f, 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Hard-disk initialization" }, + { 0x0f, 0x02, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Secondary CPU Initialization" }, + { 0x0f, 0x02, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "User authentication" }, + { 0x0f, 0x02, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "User-initiated system setup" }, + { 0x0f, 0x02, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "USB resource configuration" }, + { 0x0f, 0x02, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "PCI resource configuration" }, + { 0x0f, 0x02, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Option ROM initialization" }, + { 0x0f, 0x02, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Video initialization" }, + { 0x0f, 0x02, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Cache initialization" }, + { 0x0f, 0x02, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "SMBus initialization" }, + { 0x0f, 0x02, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Keyboard controller initialization" }, + { 0x0f, 0x02, 0x0d, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Management controller initialization" }, + { 0x0f, 0x02, 0x0e, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Docking station attachment" }, + { 0x0f, 0x02, 0x0f, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Enabling docking station" }, + { 0x0f, 0x02, 0x10, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Docking station ejection" }, + { 0x0f, 0x02, 0x11, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Disabling docking station" }, + { 0x0f, 0x02, 0x12, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Calling operating system wake-up vector" }, + { 0x0f, 0x02, 0x13, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "System boot initiated" }, + { 0x0f, 0x02, 0x14, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Motherboard initialization" }, + { 0x0f, 0x02, 0x15, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "reserved" }, + { 0x0f, 0x02, 0x16, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Floppy initialization" }, + { 0x0f, 0x02, 0x17, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Keyboard test" }, + { 0x0f, 0x02, 0x18, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Pointing device test" }, + { 0x0f, 0x02, 0x19, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Primary CPU initialization" }, + { 0x0f, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Unknown Progress" }, + + { 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" }, + { 0x10, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log almost full" }, + + { 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, 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 auxiliary 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, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "NMI/Diag Interrupt" }, + { 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" }, + { 0x13, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Fatal Error" }, + { 0x13, 0x0b, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Degraded" }, + + { 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" }, + { 0x14, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "FRU Latch" }, + { 0x14, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "FRU Service" }, + + { 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 }, + { 0x19, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", "Thermal Trip" }, + { 0x1a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Other FRU", NULL }, + + { 0x1b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", "Connected" }, + { 0x1b, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", "Config Error" }, + + { 0x1c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Terminator", NULL }, + + { 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" }, + { 0x1d, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "OS initiated hard reset" }, + { 0x1d, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "OS initiated warm reset" }, + { 0x1d, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "System Restart" }, + + { 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, 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" }, + { 0x1f, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation started" }, + { 0x1f, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation completed" }, + { 0x1f, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation aborted" }, + { 0x1f, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Installation failed" }, + + { 0x20, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Error during system startup" }, + { 0x20, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Run-time critical stop" }, + { 0x20, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "OS graceful stop" }, + { 0x20, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "OS graceful shutdown" }, + { 0x20, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "PEF initiated soft shutdown" }, + { 0x20, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Agent not responding" }, + + { 0x21, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Fault Status" }, + { 0x21, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Identify Status" }, + { 0x21, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Device Installed" }, + { 0x21, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Ready for Device Installation" }, + { 0x21, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "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", "Device Removal Request" }, + { 0x21, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Interlock" }, + { 0x21, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot is Disabled" }, + { 0x21, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Spare Device" }, + + { 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, 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, 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, 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, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Monitor ASIC/IC", NULL }, + + { 0x27, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "LAN", "Heartbeat Lost" }, + { 0x27, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "LAN", "Heartbeat" }, + + { 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" }, + { 0x28, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Sensor failure" }, + { 0x28, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "FRU failure" }, + + { 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" }, + + { 0x2b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Hardware change detected" }, + { 0x2b, 0x01, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected" }, + { 0x2b, 0x01, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt Ctrl Dev Id" }, + { 0x2b, 0x01, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt Ctrl Firm Rev" }, + { 0x2b, 0x01, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt Ctrl Dev Rev" }, + { 0x2b, 0x01, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt Ctrl Manuf Id" }, + { 0x2b, 0x01, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt Ctrl IPMI Vers" }, + { 0x2b, 0x01, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt Ctrl Aux Firm Id" }, + { 0x2b, 0x01, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt Ctrl Firm Boot Block" }, + { 0x2b, 0x01, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt Ctrl Other" }, + { 0x2b, 0x01, 0x09, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, BIOS/EFI change" }, + { 0x2b, 0x01, 0x0A, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, SMBIOS change" }, + { 0x2b, 0x01, 0x0B, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, O/S change" }, + { 0x2b, 0x01, 0x0C, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, O/S loader change" }, + { 0x2b, 0x01, 0x0D, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Service Diag change" }, + { 0x2b, 0x01, 0x0E, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt SW agent change" }, + { 0x2b, 0x01, 0x0F, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt SW App change" }, + { 0x2b, 0x01, 0x10, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Mngmt SW Middle" }, + { 0x2b, 0x01, 0x11, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, Prog HW Change (FPGA)" }, + { 0x2b, 0x01, 0x12, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, board/FRU module change" }, + { 0x2b, 0x01, 0x13, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, board/FRU component change" }, + { 0x2b, 0x01, 0x14, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, board/FRU replace equ ver" }, + { 0x2b, 0x01, 0x15, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, board/FRU replace new ver" }, + { 0x2b, 0x01, 0x16, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, board/FRU replace old ver" }, + { 0x2b, 0x01, 0x17, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected, board/FRU HW conf change" }, + { 0x2b, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Hardware incompatibility detected" }, + { 0x2b, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software incompatibility detected" }, + { 0x2b, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Invalid or unsupported hardware version" }, + { 0x2b, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Invalid or unsupported firmware or software version" }, + { 0x2b, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Hardware change success" }, + { 0x2b, 0x07, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success" }, + { 0x2b, 0x07, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt Ctrl Dev Id" }, + { 0x2b, 0x07, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt Ctrl Firm Rev" }, + { 0x2b, 0x07, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt Ctrl Dev Rev" }, + { 0x2b, 0x07, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt Ctrl Manuf Id" }, + { 0x2b, 0x07, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt Ctrl IPMI Vers" }, + { 0x2b, 0x07, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt Ctrl Aux Firm Id" }, + { 0x2b, 0x07, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt Ctrl Firm Boot Block" }, + { 0x2b, 0x07, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt Ctrl Other" }, + { 0x2b, 0x07, 0x09, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, BIOS/EFI change" }, + { 0x2b, 0x07, 0x0A, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, SMBIOS change" }, + { 0x2b, 0x07, 0x0B, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, O/S change" }, + { 0x2b, 0x07, 0x0C, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, O/S loader change" }, + { 0x2b, 0x07, 0x0D, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Service Diag change" }, + { 0x2b, 0x07, 0x0E, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt SW agent change" }, + { 0x2b, 0x07, 0x0F, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt SW App change" }, + { 0x2b, 0x07, 0x10, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Mngmt SW Middle" }, + { 0x2b, 0x07, 0x11, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, Prog HW Change (FPGA)" }, + { 0x2b, 0x07, 0x12, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, board/FRU module change" }, + { 0x2b, 0x07, 0x13, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, board/FRU component change" }, + { 0x2b, 0x07, 0x14, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, board/FRU replace equ ver" }, + { 0x2b, 0x07, 0x15, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, board/FRU replace new ver" }, + { 0x2b, 0x07, 0x16, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, board/FRU replace old ver" }, + { 0x2b, 0x07, 0x17, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success, board/FRU HW conf change" }, + + { 0x2c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Not Installed" }, + { 0x2c, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Inactive" }, + { 0x2c, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Activation Requested" }, + { 0x2c, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Activation in Progress" }, + { 0x2c, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Active" }, + { 0x2c, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Deactivation Requested" }, + { 0x2c, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Deactivation in Progress" }, + { 0x2c, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Communication lost" }, + + { 0xF0, 0x00, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M0" }, + { 0xF0, 0x01, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M1" }, + { 0xF0, 0x02, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M2" }, + { 0xF0, 0x03, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M3" }, + { 0xF0, 0x04, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M4" }, + { 0xF0, 0x05, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M5" }, + { 0xF0, 0x06, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M6" }, + { 0xF0, 0x07, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M7" }, + + { 0xF1, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A disabled, IPMB-B disabled" }, + { 0xF1, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A enabled, IPMB-B disabled" }, + { 0xF1, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A disabled, IPMB-B enabled" }, + { 0xF1, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A enabled, IPMP-B enabled" }, + + { 0xF2, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Module Handle Closed" }, + { 0xF2, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Module Handle Opened" }, + { 0xF2, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Quiesced" }, + + { 0xC0, 0x00, 0xff, 0x00, "OEM", "OEM Specific" }, + + { 0x00, 0x00, 0x00, 0x00, NULL, NULL }, +}; + +static uint16_t supermicro_x9dal[] = { + 0x0635 +}; + +static uint16_t supermicro_x9db[] = { + 0x0733, 0x0722, 0x0703, 0x0721, 0x0716, 0x0637 +}; + +static uint16_t supermicro_x9sb[] = { + 0x0651 +}; + +static uint16_t supermicro_x9[] = { + 0x0635, 0x0733, 0x0722, 0x0703, 0x0721, 0x0716, 0x0637, 0x0651 +}; + +static uint16_t supermicro_b8[] = { + 0x000A, 0x061c, 0x0620, 0x0101, 0x061f, 0x0612, 0x061e +}; + +static uint16_t supermicro_h8[] = { + 0xa111, 0x0408, 0x0811, 0x1411, 0x0911, 0x1211, 0x1011, 0xcd11, 0x1111, 0xbe11, 0xce11, 0xbd11, + 0xbc11, 0xa911, 0xaa11, 0xbd11, 0xcb11, 0xad11, 0xa811, 0xac11, 0xaf11, 0xa511, 0xa011, 0x1611, + 0x2511, 0xbf11, 0x1511, 0x2211, 0x2411, 0x1911, 0xab11, 0xd011, 0xae11, 0xca11, 0x0409, 0xa211, + 0xa311, 0x1311, 0xba11, 0xa711, 0xd111, 0x1711, 0xcf11, 0x2011, 0x1811 +}; + +static uint16_t supermicro_p8[] = { + 0x6480, 0x7380, 0x6280, 0x7480, 0x5980 +}; + +static uint16_t supermicro_x8[] = { + 0xa880, 0x0403, 0x0100, 0x0601, 0x0001, 0x0404, 0x0606, 0x0608, 0x0632, 0x0400, 0x0401, 0x0006, + 0x040a, 0xf280, 0x060f, 0x0609, 0x0008, 0x0613, 0x061b, 0x0007, 0x0600, 0x060c, 0x060d, 0x0614, + 0x060c, 0x0003, 0x040b, 0x0621, 0x0610, 0x0638, 0xf380, 0x060b, 0x040d, 0x0605, 0x062d, 0x060e, + 0x061a, 0xf580, 0x062e, 0x0009 +}; + +static uint16_t supermicro_X8[] = { + 0x000A, 0x061c, 0x0620, 0x0101, 0x061f, 0x0612, 0x061e, 0xa111, 0x0408, 0x0811, 0x1411, 0x0911, + 0x1211, 0x1011, 0xcd11, 0x1111, 0xbe11, 0xce11, 0xbd11, 0xbc11, 0xa911, 0xaa11, 0xbd11, 0xcb11, + 0xad11, 0xa811, 0xac11, 0xaf11, 0xa511, 0xa011, 0x1611, 0x2511, 0xbf11, 0x1511, 0x2211, 0x2411, + 0x1911, 0xab11, 0xd011, 0xae11, 0xca11, 0x0409, 0xa211, 0xa311, 0x1311, 0xba11, 0xa711, 0xd111, + 0x1711, 0xcf11, 0x2011, 0x1811, 0x6480, 0x7380, 0x6280, 0x7480, 0x5980, 0xa880, 0x0403, 0x0100, + 0x0601, 0x0001, 0x0404, 0x0606, 0x0608, 0x0632, 0x0400, 0x0401, 0x0006, 0x040a, 0xf280, 0x060f, + 0x0609, 0x0008, 0x0613, 0x061b, 0x0007, 0x0600, 0x060c, 0x060d, 0x0614, 0x060c, 0x0003, 0x040b, + 0x0621, 0x0610, 0x0638, 0xf380, 0x060b, 0x040d, 0x0605, 0x062d, 0x060e, 0x061a, 0xf580, 0x062e, + 0x0009 +}; + +int ipmi_sel_main(struct ipmi_intf *, int, char **); +void ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt); +void ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt); +void ipmi_sel_print_extended_entry(struct ipmi_intf * intf, struct sel_event_record * evt); +void ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt); +void ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char ** desc); +const char * ipmi_sel_get_sensor_type(uint8_t code); +const char * ipmi_sel_get_sensor_type_offset(uint8_t code, uint8_t offset); +uint16_t ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id, struct sel_event_record * evt); +char * get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec); +IPMI_OEM ipmi_get_oem(struct ipmi_intf * intf); +char * ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec); +int ipmi_sel_oem_init(const char * filename); + +#endif /* IPMI_SEL_H */ diff --git a/include/ipmitool/ipmi_sensor.h b/include/ipmitool/ipmi_sensor.h new file mode 100644 index 0000000..63fc4aa --- /dev/null +++ b/include/ipmitool/ipmi_sensor.h @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#ifndef IPMI_SENSOR_H +#define IPMI_SENSOR_H + +#include <math.h> +#include <ipmitool/bswap.h> +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_sdr.h> + +/* threshold specification bits for analog sensors for get sensor threshold command + * and set sensor threshold command + */ +#define UPPER_NON_RECOV_SPECIFIED 0x20 +#define UPPER_CRIT_SPECIFIED 0x10 +#define UPPER_NON_CRIT_SPECIFIED 0x08 +#define LOWER_NON_RECOV_SPECIFIED 0x04 +#define LOWER_CRIT_SPECIFIED 0x02 +#define LOWER_NON_CRIT_SPECIFIED 0x01 + +/* state assertion bits for discrete sensors for get sensor reading command */ +#define STATE_0_ASSERTED 0x01 +#define STATE_1_ASSERTED 0x02 +#define STATE_2_ASSERTED 0x04 +#define STATE_3_ASSERTED 0x08 +#define STATE_4_ASSERTED 0x10 +#define STATE_5_ASSERTED 0x20 +#define STATE_6_ASSERTED 0x40 +#define STATE_7_ASSERTED 0x80 +#define STATE_8_ASSERTED 0x01 +#define STATE_9_ASSERTED 0x02 +#define STATE_10_ASSERTED 0x04 +#define STATE_11_ASSERTED 0x08 +#define STATE_12_ASSERTED 0x10 +#define STATE_13_ASSERTED 0x20 +#define STATE_14_ASSERTED 0x40 + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct sensor_set_thresh_rq { + uint8_t sensor_num; /* sensor # */ + uint8_t set_mask; /* threshold setting mask */ + uint8_t lower_non_crit; /* new lower non critical threshold*/ + uint8_t lower_crit; /* new lower critical threshold*/ + uint8_t lower_non_recov; /* new lower non recoverable threshold*/ + uint8_t upper_non_crit; /* new upper non critical threshold*/ + uint8_t upper_crit; /* new upper critical threshold*/ + uint8_t upper_non_recov; /* new upper non recoverable threshold*/ +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + +int ipmi_sensor_main(struct ipmi_intf *, int, char **); +int ipmi_sensor_print_fc(struct ipmi_intf *, struct sdr_record_common_sensor *, uint8_t); +int ipmi_sensor_get_sensor_reading_factors( struct ipmi_intf * intf, struct sdr_record_full_sensor * sensor, uint8_t reading); +#endif /* IPMI_SENSOR_H */ diff --git a/include/ipmitool/ipmi_session.h b/include/ipmitool/ipmi_session.h new file mode 100644 index 0000000..21ff12f --- /dev/null +++ b/include/ipmitool/ipmi_session.h @@ -0,0 +1,131 @@ +/* + * 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. + */ + +#ifndef IPMI_SESSION_H +#define IPMI_SESSION_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> + +#define IPMI_GET_SESSION_INFO 0x3D + +/* + * From table 22.25 of the IPMIv2 specification + */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct get_session_info_rsp +{ + uint8_t session_handle; + + #if WORDS_BIGENDIAN + uint8_t __reserved1 : 2; + uint8_t session_slot_count : 6; /* 1-based */ + #else + uint8_t session_slot_count : 6; /* 1-based */ + uint8_t __reserved1 : 2; + #endif + + #if WORDS_BIGENDIAN + uint8_t __reserved2 : 2; + uint8_t active_session_count : 6; /* 1-based */ + #else + uint8_t active_session_count : 6; /* 1-based */ + uint8_t __reserved2 : 2; + #endif + + #if WORDS_BIGENDIAN + uint8_t __reserved3 : 2; + uint8_t user_id : 6; + #else + uint8_t user_id : 6; + uint8_t __reserved3 : 2; + #endif + + #if WORDS_BIGENDIAN + uint8_t __reserved4 : 4; + uint8_t privilege_level : 4; + #else + uint8_t privilege_level : 4; + uint8_t __reserved4 : 4; + #endif + + #if WORDS_BIGENDIAN + uint8_t auxiliary_data : 4; + uint8_t channel_number : 4; + #else + uint8_t channel_number : 4; + uint8_t auxiliary_data : 4; + #endif + + union + { + /* Only exists if channel type is 802.3 LAN */ + struct + { + uint8_t console_ip[4]; /* MSBF */ + uint8_t console_mac[6]; /* MSBF */ + uint16_t console_port; /* LSBF */ + } lan_data; + + /* Only exists if channel type is async. serial modem */ + struct + { + uint8_t session_channel_activity_type; + + #if WORDS_BIGENDIAN + uint8_t __reserved5 : 4; + uint8_t destination_selector : 4; + #else + uint8_t destination_selector : 4; + uint8_t __reserved5 : 4; + #endif + + uint8_t console_ip[4]; /* MSBF */ + + /* Only exists if session is PPP */ + uint16_t console_port; /* LSBF */ + } modem_data; + } channel_data; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + + +int ipmi_session_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_CHANNEL_H*/ diff --git a/include/ipmitool/ipmi_sol.h b/include/ipmitool/ipmi_sol.h new file mode 100644 index 0000000..6e6c0b2 --- /dev/null +++ b/include/ipmitool/ipmi_sol.h @@ -0,0 +1,108 @@ +/* + * 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. + */ + +#ifndef IPMI_SOL_H +#define IPMI_SOL_H + +#include <ipmitool/ipmi.h> + +#define SOL_ESCAPE_CHARACTER_DEFAULT '~' +#define SOL_KEEPALIVE_TIMEOUT 15 +#define SOL_KEEPALIVE_RETRIES 3 + +#define IPMI_SOL_SERIAL_ALERT_MASK_SUCCEED 0x08 +#define IPMI_SOL_SERIAL_ALERT_MASK_DEFERRED 0x04 +#define IPMI_SOL_SERIAL_ALERT_MASK_FAIL 0x00 +#define IPMI_SOL_BMC_ASSERTS_CTS_MASK_TRUE 0x00 +#define IPMI_SOL_BMC_ASSERTS_CTS_MASK_FALSE 0x02 + + +struct sol_config_parameters { + uint8_t set_in_progress; + uint8_t enabled; + uint8_t force_encryption; + uint8_t force_authentication; + uint8_t privilege_level; + uint8_t character_accumulate_level; + uint8_t character_send_threshold; + uint8_t retry_count; + uint8_t retry_interval; + uint8_t non_volatile_bit_rate; + uint8_t volatile_bit_rate; + uint8_t payload_channel; + uint16_t payload_port; +}; + + +/* + * The ACTIVATE PAYLOAD command reponse structure + * From table 24-2 of the IPMI v2.0 spec + */ +#ifdef PRAGMA_PACK +#pramga pack(1) +#endif +struct activate_payload_rsp { + uint8_t auxiliary_data[4]; + uint8_t inbound_payload_size[2]; /* LS byte first */ + uint8_t outbound_payload_size[2]; /* LS byte first */ + uint8_t payload_udp_port[2]; /* LS byte first */ + uint8_t payload_vlan_number[2]; /* LS byte first */ +} ATTRIBUTE_PACKING; +#ifdef PRAGMA_PACK +#pramga pack(0) +#endif + +/* + * Small function to validate that user-supplied SOL + * configuration parameter values we store in uint8_t + * data type falls within valid range. With minval + * and maxval parameters we can use the same function + * to validate parameters that have different ranges + * of values. + * + * function will return -1 if value is not valid, or + * will return 0 if valid. + */ +int ipmi_sol_set_param_isvalid_uint8_t( const char *strval, + const char *name, + int base, + uint8_t minval, + uint8_t maxval, + uint8_t *out_value); + +int ipmi_sol_main(struct ipmi_intf *, int, char **); +int ipmi_get_sol_info(struct ipmi_intf * intf, + uint8_t channel, + struct sol_config_parameters * params); + + +#endif /* IPMI_SOL_H */ diff --git a/include/ipmitool/ipmi_strings.h b/include/ipmitool/ipmi_strings.h new file mode 100644 index 0000000..10ec430 --- /dev/null +++ b/include/ipmitool/ipmi_strings.h @@ -0,0 +1,75 @@ +/* + * 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. + */ + +#ifndef IPMI_STRINGS_H +#define IPMI_STRINGS_H + +#include <ipmitool/helper.h> + +extern const struct valstr completion_code_vals[]; +extern const struct valstr entity_id_vals[]; +extern const struct valstr entity_device_type_vals[]; +extern const struct valstr ipmi_netfn_vals[]; +extern const struct valstr ipmi_channel_activity_type_vals[]; +extern const struct valstr ipmi_privlvl_vals[]; +extern const struct valstr ipmi_bit_rate_vals[]; +extern const struct valstr ipmi_set_in_progress_vals[]; +extern const struct valstr ipmi_authtype_session_vals[]; +extern const struct valstr ipmi_authtype_vals[]; +extern const struct valstr ipmi_channel_protocol_vals[]; +extern const struct valstr ipmi_channel_medium_vals[]; +extern const struct valstr ipmi_chassis_power_control_vals[]; +extern const struct valstr ipmi_auth_algorithms[]; +extern const struct valstr ipmi_integrity_algorithms[]; +extern const struct valstr ipmi_encryption_algorithms[]; +extern const struct valstr ipmi_oem_info[]; + +extern const struct valstr picmg_frucontrol_vals[]; +extern const struct valstr picmg_clk_family_vals[]; +extern const struct oemvalstr picmg_clk_accuracy_vals[]; +extern const struct oemvalstr picmg_clk_resource_vals[]; +extern const struct oemvalstr picmg_clk_id_vals[]; + +extern const struct valstr picmg_busres_id_vals[]; +extern const struct valstr picmg_busres_board_cmd_vals[]; +extern const struct valstr picmg_busres_shmc_cmd_vals[]; +extern const struct oemvalstr picmg_busres_board_status_vals[]; +extern const struct oemvalstr picmg_busres_shmc_status_vals[]; + +/* these are similar, expect that the lookup takes the IANA number + as first parameter */ +extern const struct oemvalstr ipmi_oem_product_info[]; +extern const struct oemvalstr ipmi_oem_sdr_type_vals[]; + + + +#endif /*IPMI_STRINGS_H*/ diff --git a/include/ipmitool/ipmi_sunoem.h b/include/ipmitool/ipmi_sunoem.h new file mode 100644 index 0000000..78afbf2 --- /dev/null +++ b/include/ipmitool/ipmi_sunoem.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2009, 2014, Oracle and/or its affiliates. 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. + */ + +#ifndef IPMI_SUNOEM_H +#define IPMI_SUNOEM_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_sdr.h> + +#define IPMI_NETFN_SUNOEM 0x2e + +#define IPMI_SUNOEM_SET_SSH_KEY 0x01 +#define IPMI_SUNOEM_DEL_SSH_KEY 0x02 +#define IPMI_SUNOEM_GET_HEALTH_STATUS 0x10 +#define IPMI_SUNOEM_CLI 0x19 +#define IPMI_SUNOEM_SET_FAN_SPEED 0x20 +#define IPMI_SUNOEM_LED_GET 0x21 +#define IPMI_SUNOEM_LED_SET 0x22 +#define IPMI_SUNOEM_ECHO 0x23 +#define IPMI_SUNOEM_VERSION 0x24 +#define IPMI_SUNOEM_NACNAME 0x29 +#define IPMI_SUNOEM_GETVAL 0x2A +#define IPMI_SUNOEM_SETVAL 0x2C +#define IPMI_SUNOEM_SENSOR_SET 0x3A +#define IPMI_SUNOEM_SET_FAN_MODE 0x41 +#define IPMI_SUNOEM_CORE_TUNNEL 0x44 + +/* + * Error codes of sunoem functions + */ +typedef enum { + SUNOEM_EC_SUCCESS = 0, + SUNOEM_EC_INVALID_ARG = 1, + SUNOEM_EC_BMC_NOT_RESPONDING = 2, + SUNOEM_EC_BMC_CCODE_NONZERO = 3 +} sunoem_ec_t; + +int ipmi_sunoem_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_SUNOEM_H*/ + diff --git a/include/ipmitool/ipmi_tsol.h b/include/ipmitool/ipmi_tsol.h new file mode 100644 index 0000000..8157cd8 --- /dev/null +++ b/include/ipmitool/ipmi_tsol.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2005 Tyan Computer Corp. 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. + */ + +#ifndef IPMI_TSOL_H +#define IPMI_TSOL_H + +#include <ipmitool/ipmi.h> + +#define IPMI_TSOL_CMD_SENDKEY 0x03 +#define IPMI_TSOL_CMD_START 0x06 +#define IPMI_TSOL_CMD_STOP 0x02 + +#define IPMI_TSOL_DEF_PORT 6230 + +int ipmi_tsol_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_TSOL_H */ diff --git a/include/ipmitool/ipmi_user.h b/include/ipmitool/ipmi_user.h new file mode 100644 index 0000000..4a8e481 --- /dev/null +++ b/include/ipmitool/ipmi_user.h @@ -0,0 +1,95 @@ +/* + * 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. + */ + +#ifndef IPMI_USER_H +#define IPMI_USER_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> + + +/* + * The GET USER ACCESS response from table 22-32 of the IPMI v2.0 spec + */ +struct user_access_rsp { +#if WORDS_BIGENDIAN + uint8_t __reserved1 : 2; + uint8_t maximum_ids : 6; +#else + uint8_t maximum_ids : 6; + uint8_t __reserved1 : 2; +#endif + +#if WORDS_BIGENDIAN + uint8_t __reserved2 : 2; + uint8_t enabled_user_count : 6; +#else + uint8_t enabled_user_count : 6; + uint8_t __reserved2 : 2; +#endif + +#if WORDS_BIGENDIAN + uint8_t __reserved3 : 2; + uint8_t fixed_name_count : 6; +#else + uint8_t fixed_name_count : 6; + uint8_t __reserved3 : 2; +#endif + +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved4 : 1; + uint8_t no_callin_access : 1; + uint8_t link_auth_access : 1; + uint8_t ipmi_messaging_access : 1; + uint8_t channel_privilege_limit : 4; +#else + uint8_t channel_privilege_limit : 4; + uint8_t ipmi_messaging_access : 1; + uint8_t link_auth_access : 1; + uint8_t no_callin_access : 1; + uint8_t __reserved4 : 1; +#endif +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + + + +int ipmi_user_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_USER_H */ diff --git a/include/ipmitool/log.h b/include/ipmitool/log.h new file mode 100644 index 0000000..7199fdb --- /dev/null +++ b/include/ipmitool/log.h @@ -0,0 +1,63 @@ +/* + * 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. + */ + +#ifndef IPMITOOL_LOG_H +#define IPMITOOL_LOG_H + +#include <syslog.h> + +/* sys/syslog.h: + * LOG_EMERG 0 system is unusable + * LOG_ALERT 1 action must be taken immediately + * LOG_CRIT 2 critical conditions + * LOG_ERR 3 error conditions + * LOG_WARNING 4 warning conditions + * LOG_NOTICE 5 normal but significant condition + * LOG_INFO 6 informational + * LOG_DEBUG 7 debug-level messages + */ + +#define LOG_ERROR LOG_ERR +#define LOG_WARN LOG_WARNING + +#define LOG_NAME_DEFAULT "ipmitool" +#define LOG_MSG_LENGTH 1024 + +void log_init(const char * name, int isdaemon, int verbose); +void log_halt(void); +void log_level_set(int level); +int log_level_get(void); +void lprintf(int level, const char * format, ...); +void lperror(int level, const char * format, ...); + +#endif /*IPMITOOL_LOG_H*/ + |