From a9ee361f27e0439530387765924574e5358c8a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 10 Sep 2022 15:44:41 +0200 Subject: New upstream version 1.8.19 --- include/ipmitool/Makefile.am | 3 +- include/ipmitool/Makefile.in | 564 --------------------------------- include/ipmitool/bswap.h | 5 +- include/ipmitool/helper.h | 113 ++++++- include/ipmitool/hpm2.h | 2 + include/ipmitool/ipmi.h | 12 +- include/ipmitool/ipmi_cc.h | 6 +- include/ipmitool/ipmi_cfgp.h | 6 +- include/ipmitool/ipmi_channel.h | 94 +++++- include/ipmitool/ipmi_chassis.h | 5 +- include/ipmitool/ipmi_constants.h | 9 +- include/ipmitool/ipmi_dcmi.h | 11 +- include/ipmitool/ipmi_delloem.h | 6 +- include/ipmitool/ipmi_ekanalyzer.h | 5 +- include/ipmitool/ipmi_entity.h | 5 +- include/ipmitool/ipmi_event.h | 32 +- include/ipmitool/ipmi_firewall.h | 5 +- include/ipmitool/ipmi_fru.h | 46 +-- include/ipmitool/ipmi_fwum.h | 5 +- include/ipmitool/ipmi_gendev.h | 5 +- include/ipmitool/ipmi_hpmfwupg.h | 24 +- include/ipmitool/ipmi_ime.h | 5 +- include/ipmitool/ipmi_intf.h | 50 ++- include/ipmitool/ipmi_isol.h | 5 +- include/ipmitool/ipmi_kontronoem.h | 89 +++--- include/ipmitool/ipmi_lanp.h | 55 +--- include/ipmitool/ipmi_lanp6.h | 6 +- include/ipmitool/ipmi_main.h | 5 +- include/ipmitool/ipmi_mc.h | 182 +++++++++-- include/ipmitool/ipmi_oem.h | 5 +- include/ipmitool/ipmi_pef.h | 301 +----------------- include/ipmitool/ipmi_picmg.h | 96 +----- include/ipmitool/ipmi_quantaoem.h | 52 +++ include/ipmitool/ipmi_raw.h | 5 +- include/ipmitool/ipmi_sdr.h | 101 +++--- include/ipmitool/ipmi_sdradd.h | 7 +- include/ipmitool/ipmi_sel.h | 15 +- include/ipmitool/ipmi_sel_supermicro.h | 6 +- include/ipmitool/ipmi_sensor.h | 4 +- include/ipmitool/ipmi_session.h | 5 +- include/ipmitool/ipmi_sol.h | 23 +- include/ipmitool/ipmi_strings.h | 12 +- include/ipmitool/ipmi_sunoem.h | 6 +- include/ipmitool/ipmi_time.h | 90 ++++++ include/ipmitool/ipmi_tsol.h | 5 +- include/ipmitool/ipmi_user.h | 8 +- include/ipmitool/ipmi_vita.h | 5 +- include/ipmitool/log.h | 9 +- 48 files changed, 748 insertions(+), 1367 deletions(-) delete mode 100644 include/ipmitool/Makefile.in mode change 100755 => 100644 include/ipmitool/ipmi_ime.h create mode 100644 include/ipmitool/ipmi_quantaoem.h create mode 100644 include/ipmitool/ipmi_time.h (limited to 'include/ipmitool') diff --git a/include/ipmitool/Makefile.am b/include/ipmitool/Makefile.am index 9093a56..bb34920 100644 --- a/include/ipmitool/Makefile.am +++ b/include/ipmitool/Makefile.am @@ -39,4 +39,5 @@ noinst_HEADERS = log.h bswap.h hpm2.h helper.h ipmi.h ipmi_cc.h ipmi_intf.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 ipmi_vita.h ipmi_sel_supermicro.h \ - ipmi_cfgp.h ipmi_lanp6.h + ipmi_cfgp.h ipmi_lanp6.h ipmi_quantaoem.h ipmi_time.h + diff --git a/include/ipmitool/Makefile.in b/include/ipmitool/Makefile.in deleted file mode 100644 index 96e0624..0000000 --- a/include/ipmitool/Makefile.in +++ /dev/null @@ -1,564 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 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@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -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 = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(noinst_HEADERS) -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -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 = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -HEADERS = $(noinst_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -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@ -INTF_USB = @INTF_USB@ -INTF_USB_LIB = @INTF_USB_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 ipmi_vita.h ipmi_sel_supermicro.h \ - ipmi_cfgp.h ipmi_lanp6.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: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - 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-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - 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" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -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 TAGS all all-am check check-am clean clean-generic \ - clean-libtool cscopelist-am ctags ctags-am 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 tags-am 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 index 9948208..968de7e 100644 --- a/include/ipmitool/bswap.h +++ b/include/ipmitool/bswap.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_BSWAP_H -#define IPMI_BSWAP_H +#pragma once #if HAVE_CONFIG_H # include @@ -49,5 +48,3 @@ # 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 index bfaf284..79a5c5b 100644 --- a/include/ipmitool/helper.h +++ b/include/ipmitool/helper.h @@ -30,13 +30,16 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_HELPER_H -#define IPMI_HELPER_H +#pragma once #include #include #include #include +#include /* For free() */ +#include + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) #ifndef TRUE #define TRUE 1 @@ -50,6 +53,12 @@ #define tboolean int #endif +#ifdef __GNUC__ + #define __UNUSED__(x) x __attribute__((unused)) +#else + #define __UNUSED__(x) x +#endif + /* IPMI spec. - UID 0 reserved, 63 maximum UID which can be used */ #ifndef IPMI_UID_MIN # define IPMI_UID_MIN 1 @@ -61,7 +70,7 @@ struct ipmi_intf; struct valstr { - uint16_t val; + uint32_t val; const char * str; }; struct oemvalstr { @@ -70,8 +79,12 @@ struct oemvalstr { 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); +const char * +specific_val2str(uint32_t val, + const struct valstr *specific, + const struct valstr *generic); +const char *val2str(uint32_t val, const struct valstr * vs); +const char *oemval2str(uint32_t oem, uint32_t val, const struct oemvalstr * vs); int str2double(const char * str, double * double_ptr); int str2long(const char * str, int64_t * lng_ptr); @@ -83,6 +96,8 @@ 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); +bool args2buf(int argc, char *argv[], uint8_t *out, size_t len); + int eval_ccode(const int ccode); int is_fru_id(const char *argv_ptr, uint8_t *fru_id_ptr); @@ -90,7 +105,11 @@ 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); int is_ipmi_user_priv_limit(const char *argv_ptr, uint8_t *ipmi_priv_limit_ptr); -uint16_t str2val(const char * str, const struct valstr * vs); +uint32_t str2val32(const char *str, const struct valstr *vs); +static inline uint16_t str2val(const char *str, const struct valstr *vs) +{ + return (uint16_t)str2val32(str, 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); @@ -109,6 +128,86 @@ 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 IS_SET(v, b) ((v) & (1 << (b))) + +/** + * Free the memory and clear the pointer. + * @param[in] ptr - a pointer to your pointer to free. + */ +static inline void free_n(void *ptr) { + void **pptr = (void **)ptr; + + if (pptr && *pptr) { + free(*pptr); + *pptr = NULL; + } +} + +/* le16toh(), hto16le(), et. al. don't exist for Windows or Apple */ +/* For portability, let's simply define our own versions here */ + +/* IPMI is always little-endian */ +static inline uint16_t ipmi16toh(void *ipmi16) +{ + uint8_t *ipmi = (uint8_t *)ipmi16; + uint16_t h; + + h = (uint16_t)ipmi[1] << 8; /* MSB */ + h |= ipmi[0]; /* LSB */ + + return h; +} + +static inline void htoipmi16(uint16_t h, uint8_t *ipmi) +{ + ipmi[0] = h & 0xFF; /* LSB */ + ipmi[1] = h >> 8; /* MSB */ +} + +static inline uint32_t ipmi24toh(void *ipmi24) +{ + uint8_t *ipmi = (uint8_t *)ipmi24; + uint32_t h = 0; + + h = (uint32_t)ipmi[2] << 16; /* MSB */ + h |= ipmi[1] << 8; + h |= ipmi[0]; /* LSB */ + + return h; +} + +static inline void htoipmi24(uint32_t h, uint8_t *ipmi) +{ + ipmi[0] = h & 0xFF; /* LSB */ + ipmi[1] = (h >> 8) & 0xFF; + ipmi[2] = (h >> 16) & 0xFF; /* MSB */ +} + +static inline uint32_t ipmi32toh(void *ipmi32) +{ + uint8_t *ipmi = ipmi32; + uint32_t h; + + h = (uint32_t)ipmi[3] << 24; /* MSB */ + h |= ipmi[2] << 16; + h |= ipmi[1] << 8; + h |= ipmi[0]; /* LSB */ + + return h; +} + +static inline void htoipmi32(uint32_t h, uint8_t *ipmi) +{ + ipmi[0] = h & 0xFF; /* LSB */ + ipmi[1] = (h >> 8) & 0xFF; + ipmi[2] = (h >> 16) & 0xFF; + ipmi[3] = (h >> 24) & 0xFF; /* MSB */ +} + +uint8_t *array_byteswap(uint8_t *buffer, size_t length); +uint8_t *array_ntoh(uint8_t *buffer, size_t length); +uint8_t *array_letoh(uint8_t *buffer, size_t length); + #define ipmi_open_file_read(file) ipmi_open_file(file, 0) #define ipmi_open_file_write(file) ipmi_open_file(file, 1) @@ -127,5 +226,3 @@ uint16_t ipmi_get_oem_id(struct ipmi_intf *intf); #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 index 09b6237..ebf9842 100644 --- a/include/ipmitool/hpm2.h +++ b/include/ipmitool/hpm2.h @@ -30,6 +30,8 @@ * EVEN IF PPS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ +#pragma once + #include #include diff --git a/include/ipmitool/ipmi.h b/include/ipmitool/ipmi.h index 6e42d06..7555596 100644 --- a/include/ipmitool/ipmi.h +++ b/include/ipmitool/ipmi.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_H -#define IPMI_H +#pragma once #include #include @@ -259,6 +258,8 @@ struct ipmi_rs { typedef enum IPMI_OEM { IPMI_OEM_UNKNOWN = 0, + IPMI_OEM_DEBUG = 0xFFFFFE, /* Hoping IANA won't hit this soon */ + IPMI_OEM_RESERVED = 0x0FFFFF, /* As per IPMI 2.0 specification */ /* 2 for [IBM] */ IPMI_OEM_IBM_2 = 2, IPMI_OEM_HP = 11, @@ -281,7 +282,7 @@ typedef enum IPMI_OEM { IPMI_OEM_MAGNUM = 5593, IPMI_OEM_TYAN = 6653, IPMI_OEM_QUANTA = 7244, - IPMI_OEM_NEWISYS = 9237, + IPMI_OEM_VIKING = 9237, IPMI_OEM_ADVANTECH = 10297, IPMI_OEM_FUJITSU_SIEMENS = 10368, IPMI_OEM_AVOCENT = 10418, @@ -300,9 +301,8 @@ typedef enum IPMI_OEM { IPMI_OEM_ADLINK_24339 = 24339, IPMI_OEM_NOKIA_SOLUTIONS_AND_NETWORKS = 28458, IPMI_OEM_VITA = 33196, - IPMI_OEM_SUPERMICRO_47488 = 47488 + IPMI_OEM_SUPERMICRO_47488 = 47488, + IPMI_OEM_YADRO = 49769, } 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 index 237b1ee..99ba231 100644 --- a/include/ipmitool/ipmi_cc.h +++ b/include/ipmitool/ipmi_cc.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_CC_H -#define IPMI_CC_H +#pragma once /* Thu Jan 11 09:32:41 2007 @@ -71,6 +70,3 @@ #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_cfgp.h b/include/ipmitool/ipmi_cfgp.h index ab8acb3..479e91e 100644 --- a/include/ipmitool/ipmi_cfgp.h +++ b/include/ipmitool/ipmi_cfgp.h @@ -29,8 +29,8 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef IPMI_CFGP_H -#define IPMI_CFGP_H + +#pragma once #include @@ -193,5 +193,3 @@ extern int ipmi_cfgp_save(struct ipmi_cfgp_ctx *ctx, /* Print parameter data in user-friendly format. */ extern int ipmi_cfgp_print(struct ipmi_cfgp_ctx *ctx, const struct ipmi_cfgp_sel *sel, FILE *file); - -#endif /* IPMI_CFGP_H */ diff --git a/include/ipmitool/ipmi_channel.h b/include/ipmitool/ipmi_channel.h index b138c26..d9be57e 100644 --- a/include/ipmitool/ipmi_channel.h +++ b/include/ipmitool/ipmi_channel.h @@ -30,13 +30,13 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_CHANNEL_H -#define IPMI_CHANNEL_H +#pragma once #if HAVE_CONFIG_H # include #endif #include +#include #define IPMI_GET_CHANNEL_AUTH_CAP 0x38 @@ -56,6 +56,28 @@ #define IPMI_CHANNEL_SESSION_MULTI 0x80 #define IPMI_CHANNEL_SESSION_BASED 0xC0 +/* Fixed channel numbers as per Table 6-1 */ +typedef enum { + CH_PRIMARY_IPMB, + CH_IMP_SPECIFIC_1, + CH_IMP_SPECIFIC_2, + CH_IMP_SPECIFIC_3, + CH_IMP_SPECIFIC_4, + CH_IMP_SPECIFIC_5, + CH_IMP_SPECIFIC_6, + CH_IMP_SPECIFIC_7, + CH_IMP_SPECIFIC_8, + CH_IMP_SPECIFIC_9, + CH_IMP_SPECIFIC_A, + CH_IMP_SPECIFIC_B, + CH_RSVD1, + CH_RSVD2, + CH_CURRENT, + CH_SYSTEM, + CH_TOTAL, + CH_UNKNOWN = UINT8_MAX +} ipmi_channel_num_t; + /* (22.24) Get Channel Info */ struct channel_info_t { uint8_t channel; @@ -77,6 +99,50 @@ struct channel_access_t { uint8_t user_level_auth; }; +/* + * The Cipher Suite Record Format from table 22-18 of the IPMI v2.0 spec + */ +enum cipher_suite_format_tag { + STANDARD_CIPHER_SUITE = 0xc0, + OEM_CIPHER_SUITE = 0xc1, +}; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +struct std_cipher_suite_record_t { + uint8_t start_of_record; + uint8_t cipher_suite_id; + uint8_t auth_alg; + uint8_t integrity_alg; + uint8_t crypt_alg; +} ATTRIBUTE_PACKING; +struct oem_cipher_suite_record_t { + uint8_t start_of_record; + uint8_t cipher_suite_id; + uint8_t iana[3]; + uint8_t auth_alg; + uint8_t integrity_alg; + uint8_t crypt_alg; +} ATTRIBUTE_PACKING; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif +#define CIPHER_ALG_MASK 0x3f +#define MAX_CIPHER_SUITE_RECORD_OFFSET 0x40 +#define MAX_CIPHER_SUITE_DATA_LEN 0x10 +#define LIST_ALGORITHMS_BY_CIPHER_SUITE 0x80 + +/* Below is the theoretical maximum number of cipher suites that could be + * reported by a BMC. That is with the Get Channel Cipher Suites Command, at 16 + * bytes at a time and 0x40 requests, it can report 1024 bytes, which is about + * 204 standard records or 128 OEM records. Really, we probably don't need more + * than about 20, which is the full set of standard records plus a few OEM + * records. + */ +#define MAX_CIPHER_SUITE_COUNT (MAX_CIPHER_SUITE_RECORD_OFFSET * \ + MAX_CIPHER_SUITE_DATA_LEN / \ + sizeof(struct std_cipher_suite_record_t)) + /* * The Get Authentication Capabilities response structure * From table 22-15 of the IPMI v2.0 spec @@ -129,18 +195,24 @@ struct get_channel_auth_cap_rsp { #endif int _ipmi_get_channel_access(struct ipmi_intf *intf, - struct channel_access_t *channel_access, - uint8_t get_volatile_settings); + struct channel_access_t *channel_access, + uint8_t get_volatile_settings); +int ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, + const char *payload_type, + uint8_t channel, + struct cipher_suite_info *suites, + size_t *count); int _ipmi_get_channel_info(struct ipmi_intf *intf, - struct channel_info_t *channel_info); + struct channel_info_t *channel_info); int _ipmi_set_channel_access(struct ipmi_intf *intf, - struct channel_access_t channel_access, uint8_t access_option, - uint8_t privilege_option); + struct channel_access_t channel_access, + uint8_t access_option, + uint8_t privilege_option); uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel); -uint8_t ipmi_current_channel_medium(struct ipmi_intf * intf); +void ipmi_current_channel_info(struct ipmi_intf *intf, + struct channel_info_t *chinfo); 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_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 index 3f56924..31d4141 100644 --- a/include/ipmitool/ipmi_chassis.h +++ b/include/ipmitool/ipmi_chassis.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_CHASSIS_H -#define IPMI_CHASSIS_H +#pragma once #include @@ -51,5 +50,3 @@ 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 index 8f2bc87..1a91940 100644 --- a/include/ipmitool/ipmi_constants.h +++ b/include/ipmitool/ipmi_constants.h @@ -30,9 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_CONSTANTS_H -#define IPMI_CONSTANTS_H - +#pragma once /* * COMMANDS @@ -74,6 +72,7 @@ #define IPMI_SESSION_PRIV_OPERATOR 0x3 #define IPMI_SESSION_PRIV_ADMIN 0x4 #define IPMI_SESSION_PRIV_OEM 0x5 +#define IPMI_SESSION_PRIV_NOACCESS 0xF #define IPMI_SET_IN_PROGRESS_SET_COMPLETE 0x00 #define IPMI_SET_IN_PROGRESS_IN_PROGRESS 0x01 @@ -127,10 +126,8 @@ #define IPMI_INTEGRITY_MD5_128 0x03 #define IPMI_INTEGRITY_HMAC_SHA256_128 0x04 -/* From table 13-19 of the IPMI v2 specfication */ +/* From table 13-19 of the IPMI v2 specification */ #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 index 15a959f..c872f56 100644 --- a/include/ipmitool/ipmi_dcmi.h +++ b/include/ipmitool/ipmi_dcmi.h @@ -16,9 +16,7 @@ * */ - -#ifndef IPMI_DCMI_H -#define IPMI_DCMI_H +#pragma once #include @@ -129,7 +127,7 @@ struct power_reading { uint8_t state; } __attribute__ ((packed)); -/* make a struct for the return from the capabilites command */ +/* make a struct for the return from the capabilities command */ struct capabilities { uint8_t grp_id; /* first byte: Group Extension ID */ uint16_t conformance; @@ -183,7 +181,7 @@ struct nm_discover { uint8_t minor_rev; } __attribute__ ((packed)); -/* Node Manager get capabilites command */ +/* Node Manager get capabilities command */ struct nm_capability { uint8_t intel_id[3]; uint8_t max_settings; @@ -236,7 +234,7 @@ struct nm_get_policy { /* Node Manager set alert destination */ struct nm_set_alert { uint8_t intel_id[3]; - uint8_t chan; /* 0:3 BMC chan, 4:6 reserved, bit 7=0 register alert reciever =1 invalidate */ + uint8_t chan; /* 0:3 BMC chan, 4:6 reserved, bit 7=0 register alert receiver =1 invalidate */ uint8_t dest; /* lan destination */ uint8_t string; /* alert string selector */ } __attribute__ ((packed)); @@ -267,4 +265,3 @@ struct nm_suspend { } __attribute__ ((packed)); int ipmi_nm_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 index 7543e4f..915a36c 100644 --- a/include/ipmitool/ipmi_delloem.h +++ b/include/ipmitool/ipmi_delloem.h @@ -26,8 +26,8 @@ POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#ifndef IPMI_DELLOEM_H -#define IPMI_DELLOEM_H + +#pragma once #if HAVE_CONFIG_H # include @@ -366,5 +366,3 @@ typedef struct _SensorReadingType }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 index 7c43220..08698e4 100644 --- a/include/ipmitool/ipmi_ekanalyzer.h +++ b/include/ipmitool/ipmi_ekanalyzer.h @@ -33,8 +33,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_EKANALYZER_H -#define IPMI_EKANALYZER_H +#pragma once #include #include @@ -64,5 +63,3 @@ #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 index 6e5198c..e439560 100644 --- a/include/ipmitool/ipmi_entity.h +++ b/include/ipmitool/ipmi_entity.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_ENTITY_H -#define IPMI_ENTITY_H +#pragma once #ifdef HAVE_PRAGMA_PACK #pragma pack(1) @@ -49,5 +48,3 @@ struct entity_id { #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 index 2ba2fa5..375eb3d 100644 --- a/include/ipmitool/ipmi_event.h +++ b/include/ipmitool/ipmi_event.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_EVENT_H -#define IPMI_EVENT_H +#pragma once #if HAVE_CONFIG_H # include @@ -61,6 +60,31 @@ struct platform_event_msg { #pragma pack(0) #endif -int ipmi_event_main(struct ipmi_intf *, int, char **); +/* See IPMI 2.0 Specification, Appendix G, Table G-1, "Event Commands" */ +typedef enum { + IPMI_CMD_SET_EVENT_RCVR = 0, + IPMI_CMD_GET_EVENT_RCVR, + IPMI_CMD_PLATFORM_EVENT +} ipmi_event_cmd_t; + +typedef enum { + PLATFORM_EVENT_DATA_LEN_NON_SI = sizeof(struct platform_event_msg), + PLATFORM_EVENT_DATA_LEN_SI, /* System interfaces require generator ID */ + PLATFORM_EVENT_DATA_LEN_MAX = PLATFORM_EVENT_DATA_LEN_SI +} ipmi_platform_event_data_len_t; + +/* See Table 5-4 */ +typedef enum { + EVENT_SWID_BIOS_BASE = 0x00, /* BIOS */ + EVENT_SWID_SMI_BASE = 0x10, /* SMI Handler */ + EVENT_SWID_SMS_BASE = 0x20, /* System Management Software */ + EVENT_SWID_OEM_BASE = 0x30, /* OEM */ + EVENT_SWID_REMOTE_CONSOLE_BASE = 0x40, /* Remote Console SW */ + EVENT_SWID_TERMINAL_MODE_BASE = 0x47 /* Terminal Mode RC SW */ +} ipmi_event_swid_t; +#define EVENT_SWID(base, index) ((EVENT_SWID_##base##_BASE + index) & 0x7F) -#endif /*IPMI_EVENT_H*/ +/* See Figure 29-2, Table 32-1 */ +#define EVENT_GENERATOR(base, index) (EVENT_SWID(base,index) << 1 | 1) + +int ipmi_event_main(struct ipmi_intf *, int, char **); diff --git a/include/ipmitool/ipmi_firewall.h b/include/ipmitool/ipmi_firewall.h index f18770e..da48d79 100644 --- a/include/ipmitool/ipmi_firewall.h +++ b/include/ipmitool/ipmi_firewall.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_FIREWALL_H -#define IPMI_FIREWALL_H +#pragma once #include @@ -102,5 +101,3 @@ static inline int bit_test(const unsigned char * bf, int n) { 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 index 65696ba..4d4d6c6 100644 --- a/include/ipmitool/ipmi_fru.h +++ b/include/ipmitool/ipmi_fru.h @@ -30,17 +30,19 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_FRU_H -#define IPMI_FRU_H +#pragma once #include #include #include +#include #if HAVE_CONFIG_H # include #endif +#define FRU_END_OF_FIELDS 0xc1 + #define GET_FRU_INFO 0x10 #define GET_FRU_DATA 0x11 #define SET_FRU_DATA 0x12 @@ -193,9 +195,6 @@ struct fru_multirec_powersupply { #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 @@ -590,20 +589,28 @@ struct fru_picmgext_amc_link_desc_record { #pragma pack(0) #endif +/* IPMI Return codes for Get FRU Inventory Area and Write FRU Inventory Area */ +/* PROTECTED_OFFSET Only expected on write command failures. */ +#define IPMI_CC_FRU_WRITE_PROTECTED_OFFSET 0x80 +#define IPMI_CC_FRU_DEVICE_BUSY 0x81 + /* 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" -}; +#define FRU_BOARD_DATE_UNSPEC 0 /* IPMI FRU Information Storage Definition + v1.0 rev 1.3, Table 11-1 */ +static inline time_t ipmi_fru2time_t(void *mfg_date) { + const uint64_t secs_from_1970_1996 = 820454400; + uint32_t fru_ts = ipmi24toh(mfg_date); + time_t ts; + + if (FRU_BOARD_DATE_UNSPEC == fru_ts) { + ts = IPMI_TIME_UNSPECIFIED; + } + else { + ts = fru_ts * 60 + secs_from_1970_1996; + } + + return ts; +} typedef struct ipmi_fru_bloc { struct ipmi_fru_bloc * next; @@ -614,5 +621,4 @@ typedef struct ipmi_fru_bloc { 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 */ +char *get_fru_area_str(uint8_t *data, uint32_t *offset); diff --git a/include/ipmitool/ipmi_fwum.h b/include/ipmitool/ipmi_fwum.h index c19a582..e15b517 100644 --- a/include/ipmitool/ipmi_fwum.h +++ b/include/ipmitool/ipmi_fwum.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_KFWUM_H -# define IPMI_KFWUM_H +#pragma once #include #include @@ -239,5 +238,3 @@ struct KfwumFinishFirmwareDownloadReq { # 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 index cb18699..9291b30 100644 --- a/include/ipmitool/ipmi_gendev.h +++ b/include/ipmitool/ipmi_gendev.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_GENDEV_H -#define IPMI_GENDEV_H +#pragma once #if HAVE_CONFIG_H # include @@ -44,5 +43,3 @@ #include 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 index de65292..5ac8299 100644 --- a/include/ipmitool/ipmi_hpmfwupg.h +++ b/include/ipmitool/ipmi_hpmfwupg.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_HPMFWUPG_H -#define IPMI_HPMFWUPG_H +#pragma once #include #include @@ -72,23 +71,6 @@ int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **); #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++ #include 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 index 982f645..49a9ecd 100644 --- a/include/ipmitool/ipmi_intf.h +++ b/include/ipmitool/ipmi_intf.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_INTF_H -#define IPMI_INTF_H +#pragma once #include #include @@ -62,13 +61,45 @@ enum LANPLUS_SESSION_STATE { #define IPMI_SIK_BUFFER_SIZE IPMI_MAX_MD_SIZE #define IPMI_KG_BUFFER_SIZE 21 /* key plus null byte */ +enum cipher_suite_ids { + IPMI_LANPLUS_CIPHER_SUITE_0 = 0, + IPMI_LANPLUS_CIPHER_SUITE_1 = 1, + IPMI_LANPLUS_CIPHER_SUITE_2 = 2, + IPMI_LANPLUS_CIPHER_SUITE_3 = 3, + IPMI_LANPLUS_CIPHER_SUITE_4 = 4, + IPMI_LANPLUS_CIPHER_SUITE_5 = 5, + IPMI_LANPLUS_CIPHER_SUITE_6 = 6, + IPMI_LANPLUS_CIPHER_SUITE_7 = 7, + IPMI_LANPLUS_CIPHER_SUITE_8 = 8, + IPMI_LANPLUS_CIPHER_SUITE_9 = 9, + IPMI_LANPLUS_CIPHER_SUITE_10 = 10, + IPMI_LANPLUS_CIPHER_SUITE_11 = 11, + IPMI_LANPLUS_CIPHER_SUITE_12 = 12, + IPMI_LANPLUS_CIPHER_SUITE_13 = 13, + IPMI_LANPLUS_CIPHER_SUITE_14 = 14, +#ifdef HAVE_CRYPTO_SHA256 + IPMI_LANPLUS_CIPHER_SUITE_15 = 15, + IPMI_LANPLUS_CIPHER_SUITE_16 = 16, + IPMI_LANPLUS_CIPHER_SUITE_17 = 17, +#endif /* HAVE_CRYPTO_SHA256 */ + IPMI_LANPLUS_CIPHER_SUITE_RESERVED = 0xff, +}; + +struct cipher_suite_info { + enum cipher_suite_ids cipher_suite_id; + uint8_t auth_alg; + uint8_t integrity_alg; + uint8_t crypt_alg; + uint32_t iana; +}; + struct ipmi_session_params { char * hostname; uint8_t username[17]; uint8_t authcode_set[IPMI_AUTHCODE_BUFFER_SIZE + 1]; uint8_t authtype_set; uint8_t privlvl; - uint8_t cipher_suite_id; + enum cipher_suite_ids cipher_suite_id; char sol_escape_char; int password; int port; @@ -119,7 +150,7 @@ struct ipmi_session { uint32_t bmc_id; /* - * Values required for RAKP mesages + * Values required for RAKP messages */ /* Random number generated byt the console */ @@ -201,7 +232,6 @@ struct ipmi_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); @@ -210,6 +240,10 @@ struct ipmi_intf { void (*set_max_response_data_size)(struct ipmi_intf * intf, uint16_t size); }; +uint16_t ipmi_intf_get_max_request_data_size(struct ipmi_intf *intf); +uint16_t ipmi_intf_get_max_response_data_size(struct ipmi_intf *intf); +uint8_t ipmi_intf_get_bridging_level(const struct ipmi_intf *intf); + struct ipmi_intf * ipmi_intf_load(char * name); void ipmi_intf_print(struct ipmi_intf_support * intflist); @@ -218,7 +252,10 @@ 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); +#ifdef IPMI_INTF_LANPLUS +void ipmi_intf_session_set_cipher_suite_id(struct ipmi_intf * intf, + enum cipher_suite_ids cipher_suite_id); +#endif /* IPMI_INTF_LANPLUS */ 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, const uint8_t *kgkey); void ipmi_intf_session_set_port(struct ipmi_intf * intf, int port); @@ -231,4 +268,3 @@ 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 index e52279e..5514c21 100644 --- a/include/ipmitool/ipmi_isol.h +++ b/include/ipmitool/ipmi_isol.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_ISOL_H -#define IPMI_ISOL_H +#pragma once #include @@ -53,5 +52,3 @@ struct isol_config_parameters { }; 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 index d3925df..10222bd 100644 --- a/include/ipmitool/ipmi_kontronoem.h +++ b/include/ipmitool/ipmi_kontronoem.h @@ -1,46 +1,43 @@ -/* - * 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 -#include - - -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 */ +/* + * 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. + */ + +#pragma once + +#include +#include + + +int ipmi_kontronoem_main(struct ipmi_intf *, int, char **); +int ipmi_kontronoem_set_large_buffer(struct ipmi_intf *, unsigned char size); diff --git a/include/ipmitool/ipmi_lanp.h b/include/ipmitool/ipmi_lanp.h index 0ef2d96..e312b25 100644 --- a/include/ipmitool/ipmi_lanp.h +++ b/include/ipmitool/ipmi_lanp.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_LANP_H -#define IPMI_LANP_H +#pragma once #include @@ -50,6 +49,13 @@ #define IPMI_LANP_WRITE_LOCK 1 #define IPMI_LANP_WRITE_COMMIT 2 +#define IPMI_LANP_VLAN_ID_MAX 4094 +#define IPMI_LANP_VLAN_ID_MIN 1 +#define IPMI_LANP_VLAN_DISABLE 0 /* ID 0 = VLAN is disabled for the channel */ + +#define IPMI_LANP_IS_VLAN_VALID(x) \ + ((x) >= IPMI_LANP_VLAN_ID_MIN && (x) <= IPMI_LANP_VLAN_ID_MAX) + enum { IPMI_LANP_SET_IN_PROGRESS, IPMI_LANP_AUTH_TYPE, @@ -118,51 +124,6 @@ enum { 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", NULL, 0 }, - { IPMI_LANP_AUTH_TYPE, 1, "Auth Type Support", NULL, 0 }, - { IPMI_LANP_AUTH_TYPE_ENABLE, 5, "Auth Type Enable", NULL, 0 }, - { IPMI_LANP_IP_ADDR, 4, "IP Address", NULL, 0 }, - { IPMI_LANP_IP_ADDR_SRC, 1, "IP Address Source", NULL, 0 }, - { IPMI_LANP_MAC_ADDR, 6, "MAC Address", NULL, 0 }, /* 5 */ - { IPMI_LANP_SUBNET_MASK, 4, "Subnet Mask", NULL, 0 }, - { IPMI_LANP_IP_HEADER, 3, "IP Header", NULL, 0 }, - { IPMI_LANP_PRI_RMCP_PORT, 2, "Primary RMCP Port", NULL, 0 }, - { IPMI_LANP_SEC_RMCP_PORT, 2, "Secondary RMCP Port", NULL, 0 }, - { IPMI_LANP_BMC_ARP, 1, "BMC ARP Control", NULL, 0}, /* 10 */ - { IPMI_LANP_GRAT_ARP, 1, "Gratituous ARP Intrvl", NULL, 0 }, - { IPMI_LANP_DEF_GATEWAY_IP, 4, "Default Gateway IP", NULL, 0 }, - { IPMI_LANP_DEF_GATEWAY_MAC, 6, "Default Gateway MAC", NULL, 0 }, - { IPMI_LANP_BAK_GATEWAY_IP, 4, "Backup Gateway IP", NULL, 0 }, - { IPMI_LANP_BAK_GATEWAY_MAC, 6, "Backup Gateway MAC", NULL, 0 }, /* 15 */ - { IPMI_LANP_SNMP_STRING, 18, "SNMP Community String", NULL, 0 }, - { IPMI_LANP_NUM_DEST, 1, "Number of Destinations", NULL, 0 }, - { IPMI_LANP_DEST_TYPE, 4, "Destination Type", NULL, 0 }, - { IPMI_LANP_DEST_ADDR, 13, "Destination Addresses", NULL, 0 }, - { IPMI_LANP_VLAN_ID, 2, "802.1q VLAN ID", NULL, 0 }, /* 20 */ - { IPMI_LANP_VLAN_PRIORITY, 1, "802.1q VLAN Priority", NULL, 0 }, - { IPMI_LANP_RMCP_CIPHER_SUPPORT,1, "RMCP+ Cipher Suite Count", NULL, 0 }, - { IPMI_LANP_RMCP_CIPHERS, 16, "RMCP+ Cipher Suites", NULL, 0 }, - { IPMI_LANP_RMCP_PRIV_LEVELS, 9, "Cipher Suite Priv Max", NULL, 0 }, - { IPMI_LANP_BAD_PASS_THRESH, 6, "Bad Password Threshold", NULL, 0 }, - { IPMI_LANP_OEM_ALERT_STRING, 28, "OEM Alert String", NULL, 0 }, /* 25 */ - { IPMI_LANP_ALERT_RETRY, 1, "Alert Retry Algorithm", NULL, 0 }, - { IPMI_LANP_UTC_OFFSET, 3, "UTC Offset", NULL, 0 }, - { IPMI_LANP_DHCP_SERVER_IP, 4, "DHCP Server IP", NULL, 0 }, - { IPMI_LANP_DHCP_SERVER_MAC, 6, "DHDP Server MAC", NULL, 0}, - { IPMI_LANP_DHCP_ENABLE, 1, "DHCP Enable", NULL, 0 }, /* 30 */ - { IPMI_LANP_CHAN_ACCESS_MODE, 2, "Channel Access Mode", NULL, 0 }, - { -1, -1, "", NULL, -1 } -}; - int ipmi_lanp_main(struct ipmi_intf *, int, char **); uint8_t find_lan_channel(struct ipmi_intf *intf, uint8_t start); - -#endif /*IPMI_LANP_H*/ diff --git a/include/ipmitool/ipmi_lanp6.h b/include/ipmitool/ipmi_lanp6.h index 91799e5..fe987d3 100644 --- a/include/ipmitool/ipmi_lanp6.h +++ b/include/ipmitool/ipmi_lanp6.h @@ -29,8 +29,8 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef IPMI_LANP6_H -#define IPMI_LANP6_H + +#pragma once #include @@ -50,5 +50,3 @@ struct ipmi_lanp_priv { struct ipmi_intf *intf; int channel; }; - -#endif /* IPMI_LANP6_H */ diff --git a/include/ipmitool/ipmi_main.h b/include/ipmitool/ipmi_main.h index e32360a..76fe602 100644 --- a/include/ipmitool/ipmi_main.h +++ b/include/ipmitool/ipmi_main.h @@ -30,13 +30,10 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_MAIN_H -#define IPMI_MAIN_H +#pragma once #include 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 index 0e3c59f..65cba84 100644 --- a/include/ipmitool/ipmi_mc.h +++ b/include/ipmitool/ipmi_mc.h @@ -30,10 +30,19 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_MC_H -#define IPMI_MC_H +#pragma once + +#include #include +#include +#include + +#define OEM_MFG_STRING(oem) val2str(IPM_DEV_MANUFACTURER_ID(oem),\ + ipmi_oem_info) +#define OEM_PROD_STRING(oem, p) oemval2str(IPM_DEV_MANUFACTURER_ID(oem),\ + ipmi16toh(p),\ + ipmi_oem_product_info) #define BMC_GET_DEVICE_ID 0x01 #define BMC_COLD_RESET 0x02 @@ -74,7 +83,7 @@ struct ipm_devid_rsp { #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_FWREV1_MAJOR_MASK (0x7f) /* 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 */ @@ -84,29 +93,125 @@ struct ipm_devid_rsp { #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_MANUFACTURER_ID_RESERVED 0x0FFFFF +#define IPM_DEV_MANUFACTURER_ID(x) ipmi24toh(x) #define IPM_DEV_ADTL_SUPPORT_BITS (8) -/* Structure follow the IPMI V.2 Rev 1.0 - * See Table 20-10 */ +/* There are lots of BMC implementations that don't follow the IPMI + * specification for GUID encoding. Some send data encoded as in + * RFC4122, some follow SMBIOS specification. We support all users + * of those buggy implementations here. + * + * Most implementations like AMI MegaRAC do it the SMBIOS way. + * This is the legacy behavior we don't want to break yet. + * That's why the last real mode is GUID_SMBIOS. If automatic + * detection finds more than one possible candidate, and + * GUID_SMBIOS is one of them, then it will take precedence. + * + * For the same reason GUID_IPMI is right before GUID_SMBIOS. + * If both RFC4122 and IPMI encodings have a valid version + * field, then IPMI takes precedence. + */ +typedef enum { + /* Real modes, in reverse precedence order */ + GUID_RFC4122, + GUID_IPMI, + GUID_SMBIOS, + GUID_REAL_MODES, /* Real mode count*/ + /* Pseudo modes start here */ + GUID_AUTO = GUID_REAL_MODES, /* Automatically detect mode */ + GUID_DUMP, /* Just dump the data */ + GUID_TOTAL_MODES +} ipmi_guid_mode_t; + +#define GUID_NODE_SZ 6 + +#define GUID_VER_MASK 0x0F +#define GUID_VER_SHIFT 12 +#define GUID_VERSION(t_hi) (((t_hi) >> GUID_VER_SHIFT) & GUID_VER_MASK) +#define GUID_TIME_HI(t_hi) ((t_hi) & ~(GUID_VER_MASK << GUID_VER_SHIFT)) + +typedef enum { + GUID_VERSION_UNKNOWN = 0, /* Not valid according to any specification */ + + /* The following are according to IPMI/SMBIOS/RFC4122 */ + GUID_VERSION_TIME, /* Time-based, recommended for IPMI */ + GUID_VERSION_DCE, /* DCE Security with POSIX UIDs, not for IPMI */ + GUID_VERSION_MD5, /* Name-based, using MD5 */ + GUID_VERSION_RND, /* Randomly generated */ + GUID_VERSION_SHA1, /* Name-based, using SHA-1 */ + + GUID_VERSION_MAX = GUID_VERSION_SHA1, /* The maximum supported version */ + GUID_VERSION_COUNT /* The number of supported versions */ +} guid_version_t; + +static inline bool is_guid_version_valid(guid_version_t ver) +{ + return (ver > GUID_VERSION_UNKNOWN) && (ver <= GUID_VERSION_MAX); +} + +/* The structure follows IPMI v2.0, rev 1.1 + * See section 20.8 */ #ifdef HAVE_PRAGMA_PACK #pragma pack(1) #endif -struct ipmi_guid_t { - uint32_t time_low; /* timestamp low field */ - uint16_t time_mid; /* timestamp middle field */ - uint16_t time_hi_and_version; /* timestamp high field and version number */ - uint8_t clock_seq_hi_variant;/* clock sequence high field and variant */ - uint8_t clock_seq_low; /* clock sequence low field */ - uint8_t node[6]; /* node */ -} ATTRIBUTE_PACKING; +typedef struct { + uint8_t node[GUID_NODE_SZ]; /* Byte 0 is LSB */ + union { + struct { + uint8_t clock_seq_low; /* clock sequence low field */ + uint8_t clock_seq_hi_and_rsvd;/* clock sequence high field */ + }; + uint16_t clock_seq_and_rsvd; + }; + uint16_t time_hi_and_version; /* timestamp high field and version number */ + uint16_t time_mid; /* timestamp middle field */ + uint32_t time_low; /* timestamp low field */ +} ATTRIBUTE_PACKING ipmi_guid_t; +#ifdef HAVE_PRAGMA_PACK +#pragma pack(0) +#endif + +/* The structure follows RFC4122 (section 4.1.2) + * and SMBIOS v3.0.0 (section 7.2.1) */ +#ifdef HAVE_PRAGMA_PACK +#pragma pack(1) +#endif +typedef struct { + uint32_t time_low; /* timestamp low field */ + uint16_t time_mid; /* timestamp middle field */ + uint16_t time_hi_and_version; /* timestamp high field and version number */ + union { + struct { + uint8_t clock_seq_hi_and_rsvd;/* clock sequence high field */ + uint8_t clock_seq_low; /* clock sequence low field */ + }; + uint16_t clock_seq_and_rsvd; + }; + uint8_t node[GUID_NODE_SZ]; /* Byte 0 is MSB */ +} ATTRIBUTE_PACKING rfc_guid_t; #ifdef HAVE_PRAGMA_PACK #pragma pack(0) #endif -int _ipmi_mc_get_guid(struct ipmi_intf *, struct ipmi_guid_t *); +/* Parsed GUID structure */ +typedef struct { + uint8_t node[GUID_NODE_SZ]; /* MSB first */ + /* These are architecture-specific for easy output with printf() */ + uint16_t clock_seq_and_rsvd; + uint64_t time_hi_and_version; + uint64_t time_mid; + uint64_t time_low; + /* These are the parsed values */ + time_t time; + ipmi_guid_mode_t mode; + guid_version_t ver; /* Version from time_hi_and_version, if valid */ +} parsed_guid_t; + +parsed_guid_t ipmi_parse_guid(void *guid, ipmi_guid_mode_t guid_mode); + +int _ipmi_mc_get_guid(struct ipmi_intf *intf, ipmi_guid_t *guid); #ifdef HAVE_PRAGMA_PACK #pragma pack(1) @@ -138,14 +243,24 @@ struct ipm_selftest_rsp { #pragma pack(1) #endif struct ipm_get_watchdog_rsp { - unsigned char timer_use; - unsigned char timer_actions; + unsigned char use; + unsigned char intr_action; 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; + unsigned char exp_flags; + union { + struct { + unsigned char initial_countdown_lsb; + unsigned char initial_countdown_msb; + }; + uint16_t init_cnt_le; + }; + union { + struct { + unsigned char present_countdown_lsb; + unsigned char present_countdown_msb; + }; + uint16_t pres_cnt_le; + }; } ATTRIBUTE_PACKING; #ifdef HAVE_PRAGMA_PACK #pragma pack(0) @@ -170,6 +285,25 @@ struct ipm_get_watchdog_rsp { #define IPM_WATCHDOG_CLEAR_BIOS_POST 0x04 #define IPM_WATCHDOG_CLEAR_BIOS_FRB2 0x02 +/* Use */ +#define IPMI_WDT_USE_NOLOG_SHIFT 7 +#define IPMI_WDT_USE_DONTSTOP_SHIFT 6 /* For 'set' */ +#define IPMI_WDT_USE_RUNNING_SHIFT 6 /* For 'get' */ +#define IPMI_WDT_USE_SHIFT 0 +#define IPMI_WDT_USE_MASK 0x07 + +/* Pre-timeout interrupt type */ +#define IPMI_WDT_INTR_SHIFT 4 +#define IPMI_WDT_INTR_MASK 0x07 /* Apply to the intr value, not to the data byte */ + +/* Action */ +#define IPMI_WDT_ACTION_SHIFT 0 +#define IPMI_WDT_ACTION_MASK 0x07 + +#define IPMI_WDT_GET(b, s) (((b) >> (IPMI_WDT_##s##_SHIFT)) & (IPMI_WDT_##s##_MASK)) + +#define IS_WDT_BIT(b, s) IS_SET((b), IPMI_WDT_##s##_SHIFT) + /* IPMI 2.0 command for system information*/ #define IPMI_SET_SYS_INFO 0x58 #define IPMI_GET_SYS_INFO 0x59 @@ -190,5 +324,3 @@ struct ipm_get_watchdog_rsp { 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 index ad22fde..4d4c518 100644 --- a/include/ipmitool/ipmi_oem.h +++ b/include/ipmitool/ipmi_oem.h @@ -28,8 +28,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_OEM_H -#define IPMI_OEM_H +#pragma once #include @@ -43,5 +42,3 @@ struct ipmi_oem_handle { 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 index 14c6e18..a324997 100644 --- a/include/ipmitool/ipmi_pef.h +++ b/include/ipmitool/ipmi_pef.h @@ -30,8 +30,7 @@ * EVEN IF DELL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_PEF_H -#define IPMI_PEF_H +#pragma once #include @@ -111,224 +110,6 @@ struct bit_desc_map { /* description text container */ 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", 1}, /* '>' : getting better */ - {"LC", 3}, - {"LNR", 5}, - {">UNC", 6}, - {"UC", 8}, - {"UNR", 10}, - {"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", 4}, /* '>' : getting better */ - {"non-redundant/insufficient", 5}, - {"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) @@ -356,46 +137,6 @@ struct pef_policy_entry { #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) @@ -450,15 +191,6 @@ struct pef_cfgparm_control { #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) @@ -656,15 +388,6 @@ struct pef_lan_cfgparm_dest_type { #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) @@ -755,18 +478,6 @@ struct pef_serial_cfgparm_dest_info { #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) @@ -835,14 +546,6 @@ struct pef_serial_cfgparm_tap_svc_settings { #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 */ @@ -963,5 +666,3 @@ 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 index 3d70454..f1b4963 100644 --- a/include/ipmitool/ipmi_picmg.h +++ b/include/ipmitool/ipmi_picmg.h @@ -3,8 +3,7 @@ (C) Kontron */ -#ifndef _IPMI_PICMG_H_ -#define _IPMI_PICMG_H_ +#pragma once #include @@ -12,6 +11,7 @@ #define PICMG_CPCI_MAJOR_VERSION 1 #define PICMG_ATCA_MAJOR_VERSION 2 #define PICMG_AMC_MAJOR_VERSION 4 +#define PICMG_UTCA_MAJOR_VERSION 5 /* PICMG commands */ #define PICMG_GET_PICMG_PROPERTIES_CMD 0x00 @@ -91,95 +91,7 @@ typedef enum picmg_busres_resource_id { 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", - "", "", "", "", "", - "", "", "", "", "", "", "", "" - } -}; +const char *picmg_led_color_str(int color); struct sAmcPortState { #ifndef WORDS_BIGENDIAN @@ -207,5 +119,3 @@ struct sAmcPortState { 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_quantaoem.h b/include/ipmitool/ipmi_quantaoem.h new file mode 100644 index 0000000..a222320 --- /dev/null +++ b/include/ipmitool/ipmi_quantaoem.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018 Quanta Computer 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 Quanta Computer 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. + * Quanta Computer Inc. 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 + * Quanta Computer Inc. 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. + */ + +#pragma once + +#if HAVE_CONFIG_H +# include +#endif +#include +#include + +#define OEM_QCT_NETFN 0x36 +#define OEM_QCT_GET_INFO 0x65 + +typedef enum +{ + OEM_QCT_PLATFORM_UNKNOWN = 0, + OEM_QCT_PLATFORM_GRANTLEY, + OEM_QCT_PLATFORM_PURLEY +} qct_platform_t; + +qct_platform_t oem_qct_get_platform_id(struct ipmi_intf *intf); +char *oem_qct_get_evt_desc(struct ipmi_intf *intf, struct sel_event_record *rec); diff --git a/include/ipmitool/ipmi_raw.h b/include/ipmitool/ipmi_raw.h index f4364f3..45fdd6b 100644 --- a/include/ipmitool/ipmi_raw.h +++ b/include/ipmitool/ipmi_raw.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_RAW_H -#define IPMI_RAW_H +#pragma once #include @@ -40,5 +39,3 @@ struct ipmi_rs * ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, ui 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 index 41bb533..85231c6 100644 --- a/include/ipmitool/ipmi_sdr.h +++ b/include/ipmitool/ipmi_sdr.h @@ -30,13 +30,13 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_SDR_H -#define IPMI_SDR_H +#pragma once #if HAVE_CONFIG_H # include #endif +#include #include #include #include @@ -381,6 +381,29 @@ struct sdr_record_common_sensor { struct sdr_record_mask mask; +/* IPMI 2.0, Table 43-1, byte 21[7:6] Analog (numeric) Data Format */ +#define SDR_UNIT_FMT_UNSIGNED 0 /* unsigned */ +#define SDR_UNIT_FMT_1S_COMPL 1 /* 1's complement (signed) */ +#define SDR_UNIT_FMT_2S_COMPL 2 /* 2's complement (signed) */ +#define SDR_UNIT_FMT_NA 3 /* does not return analog (numeric) reading */ +/* IPMI 2.0, Table 43-1, byte 21[5:3] Rate */ +#define SDR_UNIT_RATE_NONE 0 /* none */ +#define SDR_UNIT_RATE_MICROSEC 1 /* per us */ +#define SDR_UNIT_RATE_MILLISEC 2 /* per ms */ +#define SDR_UNIT_RATE_SEC 3 /* per s */ +#define SDR_UNIT_RATE_MIN 4 /* per min */ +#define SDR_UNIT_RATE_HR 5 /* per hour */ +#define SDR_UNIT_RATE_DAY 6 /* per day */ +#define SDR_UNIT_RATE_RSVD 7 /* reserved */ +/* IPMI 2.0, Table 43-1, byte 21[2:1] Modifier Unit */ +#define SDR_UNIT_MOD_NONE 0 /* none */ +#define SDR_UNIT_MOD_DIV 1 /* Basic Unit / Modifier Unit */ +#define SDR_UNIT_MOD_MUL 2 /* Basic Unit * Mofifier Unit */ +#define SDR_UNIT_MOD_RSVD 3 /* Reserved */ +/* IPMI 2.0, Table 43-1, byte 21[0] Percentage */ +#define SDR_UNIT_PCT_NO 0 +#define SDR_UNIT_PCT_YES 1 + struct { #if WORDS_BIGENDIAN uint8_t analog:2; @@ -394,8 +417,8 @@ struct sdr_record_common_sensor { uint8_t analog:2; #endif struct { - uint8_t base; - uint8_t modifier; + uint8_t base; /* Base unit type code per IPMI 2.0 Table 43-15 */ + uint8_t modifier; /* Modifier unit type code per Table 43-15 */ } ATTRIBUTE_PACKING type; } ATTRIBUTE_PACKING unit; } ATTRIBUTE_PACKING; @@ -773,50 +796,7 @@ struct sdr_record_list { #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 */ @@ -864,11 +844,10 @@ 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); +void ipmi_sdr_end(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_name_from_rawentry(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, @@ -877,8 +856,8 @@ 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); +const char *ipmi_sdr_get_unit_string(bool 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, @@ -912,15 +891,9 @@ int ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin, 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); +int ipmi_sdr_print_sensor_generic_locator(struct sdr_record_generic_locator *fru); +int ipmi_sdr_print_sensor_fru_locator(struct sdr_record_fru_locator *fru); +int ipmi_sdr_print_sensor_mc_locator(struct sdr_record_mc_locator *mc); struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf, struct entity_id *entity); @@ -933,8 +906,8 @@ struct sdr_record_list *ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, 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_list_cache_fromfile(const char *ifile); +void ipmi_sdr_list_empty(void); int ipmi_sdr_print_info(struct ipmi_intf *intf); void ipmi_sdr_print_discrete_state(struct ipmi_intf *intf, const char *desc, uint8_t sensor_type, @@ -952,5 +925,3 @@ 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 index b39e82b..032246f 100644 --- a/include/ipmitool/ipmi_sdradd.h +++ b/include/ipmitool/ipmi_sdradd.h @@ -27,9 +27,8 @@ * 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 + +#pragma once /* * Methods to add SDRs to repository from built-in sensors or files @@ -42,5 +41,3 @@ 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 index 1c325db..8a5354f 100644 --- a/include/ipmitool/ipmi_sel.h +++ b/include/ipmitool/ipmi_sel.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_SEL_H -#define IPMI_SEL_H +#pragma once #include #include @@ -257,7 +256,7 @@ static const struct ipmi_event_sensor_types sensor_specific_event_types[] = { { 0x08, 0x06, 0x03, "Config Error: Power Supply Rating Mismatch" }, { 0x08, 0x06, 0x04, "Config Error: Voltage Rating Mismatch" }, { 0x08, 0x06, 0xff, "Config Error" }, - { 0x08, 0x06, 0xff, "Power Supply Inactive" }, + { 0x08, 0x07, 0xff, "Power Supply Inactive" }, /* Power Unit */ { 0x09, 0x00, 0xff, "Power off/down" }, { 0x09, 0x01, 0xff, "Power cycle" }, @@ -579,8 +578,8 @@ static const struct ipmi_event_sensor_types sensor_specific_event_types[] = { { 0xF1, 0x00, 0xff, "IPMB-A disabled, IPMB-B disabled" }, { 0xF1, 0x01, 0xff, "IPMB-A enabled, IPMB-B disabled" }, { 0xF1, 0x02, 0xff, "IPMB-A disabled, IPMB-B enabled" }, - { 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMP-B enabled" }, - /* PICNG Moduke Hot Swap */ + { 0xF1, 0x03, 0xff, "IPMB-A enabled, IPMB-B enabled" }, + /* PICMG Module Hot Swap */ { 0xF2, 0x00, 0xff, "Module Handle Closed" }, { 0xF2, 0x01, 0xff, "Module Handle Opened" }, { 0xF2, 0x02, 0xff, "Quiesced" }, @@ -599,7 +598,7 @@ static const struct ipmi_event_sensor_types vita_sensor_event_types[] = { { 0xF1, 0x00, 0xFF, "IPMB-A disabled, IPMB-B disabled" }, { 0xF1, 0x01, 0xFF, "IPMB-A enabled, IPMB-B disabled" }, { 0xF1, 0x02, 0xFF, "IPMB-A disabled, IPMB-B enabled" }, - { 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMP-B enabled" }, + { 0xF1, 0x03, 0xFF, "IPMB-A enabled, IPMB-B enabled" }, /* VITA FRU Temperature */ { 0xF3, 0x00, 0xff, "At or below Lower Non-critical" }, { 0xF3, 0x01, 0xff, "At or below Lower Critical" }, @@ -679,7 +678,7 @@ void ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_e void ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char ** desc); const char * ipmi_get_sensor_type(struct ipmi_intf *intf, uint8_t code); 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); +char * get_viking_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); @@ -687,5 +686,3 @@ const struct ipmi_event_sensor_types * ipmi_get_first_event_sensor_type(struct ipmi_intf *intf, uint8_t sensor_type, uint8_t event_type); const struct ipmi_event_sensor_types * ipmi_get_next_event_sensor_type(const struct ipmi_event_sensor_types *evt); - -#endif /* IPMI_SEL_H */ diff --git a/include/ipmitool/ipmi_sel_supermicro.h b/include/ipmitool/ipmi_sel_supermicro.h index 98960e6..55f04d7 100644 --- a/include/ipmitool/ipmi_sel_supermicro.h +++ b/include/ipmitool/ipmi_sel_supermicro.h @@ -30,9 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ - -#ifndef IPMI_SEL_SUPERMICRO_H -# define IPMI_SEL_SUPERMICRO_H +#pragma once static uint16_t supermicro_x11[] = { 0x0958, 0x0955, 0x0953, 0x0952, 0x0941, 0x093A, 0x0939, 0x0938, 0x0937, 0x0930, 0x0927, 0x091D, @@ -151,5 +149,3 @@ static uint16_t supermicro_older[] = { 0x0944, 0x0945, 0x0947, 0x0948, 0x0949, 0x094A, 0x094B, 0x094C, 0x094D, 0x094E, 0x0954, 0x0956, 0x0957, 0x0959, 0xFFFF }; - -#endif /* IPMI_SEL_SUPERMICRO_H */ diff --git a/include/ipmitool/ipmi_sensor.h b/include/ipmitool/ipmi_sensor.h index 63fc4aa..48f7337 100644 --- a/include/ipmitool/ipmi_sensor.h +++ b/include/ipmitool/ipmi_sensor.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_SENSOR_H -#define IPMI_SENSOR_H +#pragma once #include #include @@ -86,4 +85,3 @@ struct sensor_set_thresh_rq { 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 index 21ff12f..b01f9d9 100644 --- a/include/ipmitool/ipmi_session.h +++ b/include/ipmitool/ipmi_session.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_SESSION_H -#define IPMI_SESSION_H +#pragma once #if HAVE_CONFIG_H # include @@ -127,5 +126,3 @@ struct get_session_info_rsp 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 index 6e2fd24..0cbbe0e 100644 --- a/include/ipmitool/ipmi_sol.h +++ b/include/ipmitool/ipmi_sol.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_SOL_H -#define IPMI_SOL_H +#pragma once #include @@ -92,17 +91,13 @@ struct activate_payload_rsp { * 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_set_param_isvalid_uint8_t(const char *strval, + const char *name, + 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 */ +int ipmi_get_sol_info(struct ipmi_intf *intf, + uint8_t channel, + struct sol_config_parameters *params); diff --git a/include/ipmitool/ipmi_strings.h b/include/ipmitool/ipmi_strings.h index 63bbea9..17c37c6 100644 --- a/include/ipmitool/ipmi_strings.h +++ b/include/ipmitool/ipmi_strings.h @@ -30,11 +30,12 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_STRINGS_H -#define IPMI_STRINGS_H +#pragma once #include +#define CC_STRING(cc) val2str(cc, completion_code_vals) + extern const struct valstr completion_code_vals[]; extern const struct valstr entity_id_vals[]; extern const struct valstr entity_device_type_vals[]; @@ -48,11 +49,14 @@ 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_chassis_restart_cause_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 ipmi_user_enable_status_vals[]; +extern const struct valstr *ipmi_oem_info; +int ipmi_oem_info_init(); +void ipmi_oem_info_free(); extern const struct valstr picmg_frucontrol_vals[]; extern const struct valstr picmg_clk_family_vals[]; @@ -71,5 +75,3 @@ extern const struct oemvalstr picmg_busres_shmc_status_vals[]; extern const struct oemvalstr ipmi_oem_product_info[]; extern const char *ipmi_generic_sensor_type_vals[]; extern const struct oemvalstr ipmi_oem_sensor_type_vals[]; - -#endif /*IPMI_STRINGS_H*/ diff --git a/include/ipmitool/ipmi_sunoem.h b/include/ipmitool/ipmi_sunoem.h index 78afbf2..664bc7d 100644 --- a/include/ipmitool/ipmi_sunoem.h +++ b/include/ipmitool/ipmi_sunoem.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_SUNOEM_H -#define IPMI_SUNOEM_H +#pragma once #if HAVE_CONFIG_H # include @@ -68,6 +67,3 @@ typedef enum { } sunoem_ec_t; int ipmi_sunoem_main(struct ipmi_intf *, int, char **); - -#endif /*IPMI_SUNOEM_H*/ - diff --git a/include/ipmitool/ipmi_time.h b/include/ipmitool/ipmi_time.h new file mode 100644 index 0000000..fc7a23a --- /dev/null +++ b/include/ipmitool/ipmi_time.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2018 Alexander Amelkin. 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 the copyright holder, 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. + * THE COPYRIGHT HOLDER 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 + * THE COPYRIGHT HOLDER 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 THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGES. + */ + +#pragma once + +#include +#include + +extern bool time_in_utc; + +/* Special values according to IPMI v2.0, rev. 1.1, section 37.1 */ +#define IPMI_TIME_UNSPECIFIED 0xFFFFFFFFu +#define IPMI_TIME_INIT_DONE 0x20000000u + +#define SECONDS_A_DAY (24 * 60 * 60) + +/* + * Check whether the timestamp is in seconds since Epoch or since + * the system startup. + */ +static inline bool ipmi_timestamp_is_special(time_t ts) +{ + return (ts < IPMI_TIME_INIT_DONE); +} + +/* + * Check whether the timestamp is valid at all + */ +static inline bool ipmi_timestamp_is_valid(time_t ts) +{ + return (ts != IPMI_TIME_UNSPECIFIED); +} + +/* + * Just 26 characters are required for asctime_r(), plus timezone info. + * However just to be safe locale-wise and assuming that in no locale + * the date/time string exceeds the 'standard' legacy terminal width, + * the buffer size is set here to 80. + */ +#define IPMI_ASCTIME_SZ 80 +typedef char ipmi_datebuf_t[IPMI_ASCTIME_SZ]; + +/* + * These are ipmitool-specific versions that take + * in account the command line options + */ +char *ipmi_asctime_r(time_t stamp, ipmi_datebuf_t outbuf); +size_t ipmi_strftime(char *s, size_t max, const char *format, time_t stamp) + __attribute__((format(strftime, 3, 0))); + +/* These return pointers to static arrays and aren't thread safe */ +char *ipmi_timestamp_fmt(uint32_t stamp, const char *fmt) + __attribute__((format(strftime, 2, 0))); +char *ipmi_timestamp_string(uint32_t stamp); /* Day Mon DD HH:MM:SS YYYY ZZZ */ +char *ipmi_timestamp_numeric(uint32_t stamp); /* MM/DD/YYYY HH:MM:SS ZZZ */ +char *ipmi_timestamp_date(uint32_t stamp); /* MM/DD/YYYY ZZZ */ +char *ipmi_timestamp_time(uint32_t stamp); /* HH:MM:SS ZZZ */ + +/* Subtract the UTC offset from local time_t */ +time_t ipmi_localtime2utc(time_t local); diff --git a/include/ipmitool/ipmi_tsol.h b/include/ipmitool/ipmi_tsol.h index 8157cd8..8baf21e 100644 --- a/include/ipmitool/ipmi_tsol.h +++ b/include/ipmitool/ipmi_tsol.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_TSOL_H -#define IPMI_TSOL_H +#pragma once #include @@ -42,5 +41,3 @@ #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 index fd727ca..a3cebd9 100644 --- a/include/ipmitool/ipmi_user.h +++ b/include/ipmitool/ipmi_user.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMI_USER_H -#define IPMI_USER_H +#pragma once #if HAVE_CONFIG_H # include @@ -48,6 +47,9 @@ #define IPMI_USER_ENABLE_DISABLED 0x80 #define IPMI_USER_ENABLE_RESERVED 0xC0 +#define IPMI_UID_MASK 0x3F /* The user_id is 6-bit and is usually in bits [5:0] */ +#define IPMI_UID(id) ((id) & IPMI_UID_MASK) + /* (22.27) Get and (22.26) Set User Access */ struct user_access_t { uint8_t callin_callback; @@ -79,5 +81,3 @@ int _ipmi_set_user_access(struct ipmi_intf *intf, int _ipmi_set_user_password(struct ipmi_intf *intf, uint8_t user_id, uint8_t operation, const char *password, uint8_t is_twenty_byte); - -#endif /* IPMI_USER_H */ diff --git a/include/ipmitool/ipmi_vita.h b/include/ipmitool/ipmi_vita.h index 71d471a..b62fb12 100644 --- a/include/ipmitool/ipmi_vita.h +++ b/include/ipmitool/ipmi_vita.h @@ -2,8 +2,7 @@ * Copyright (c) Pigeon Point Systems. All right reserved */ -#ifndef _IPMI_VITA_H_ -#define _IPMI_VITA_H_ +#pragma once /* VITA 46.11 commands */ #define VITA_GET_VSO_CAPABILITIES_CMD 0x00 @@ -45,5 +44,3 @@ ipmi_vita_ipmb_address(struct ipmi_intf *intf); extern int ipmi_vita_main(struct ipmi_intf * intf, int argc, char ** argv); - -#endif /* _IPMI_VITA_H_ */ diff --git a/include/ipmitool/log.h b/include/ipmitool/log.h index 7199fdb..dcdd760 100644 --- a/include/ipmitool/log.h +++ b/include/ipmitool/log.h @@ -30,8 +30,7 @@ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -#ifndef IPMITOOL_LOG_H -#define IPMITOOL_LOG_H +#pragma once #include @@ -54,10 +53,6 @@ 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 log_level_set(int verbose); void lprintf(int level, const char * format, ...); void lperror(int level, const char * format, ...); - -#endif /*IPMITOOL_LOG_H*/ - -- cgit v1.2.3