diff options
Diffstat (limited to 'src/plugins/bmc')
-rw-r--r-- | src/plugins/bmc/Makefile.am | 41 | ||||
-rw-r--r-- | src/plugins/bmc/Makefile.in | 541 | ||||
-rw-r--r-- | src/plugins/bmc/bmc.c | 351 | ||||
-rw-r--r-- | src/plugins/bmc/bmc.h | 52 | ||||
-rw-r--r-- | src/plugins/bmc/bmc_intf.h | 207 |
5 files changed, 1192 insertions, 0 deletions
diff --git a/src/plugins/bmc/Makefile.am b/src/plugins/bmc/Makefile.am new file mode 100644 index 0000000..66080d6 --- /dev/null +++ b/src/plugins/bmc/Makefile.am @@ -0,0 +1,41 @@ +# Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistribution of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistribution in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of Sun Microsystems, Inc. or the names of +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# This software is provided "AS IS," without a warranty of any kind. +# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. +# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE +# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF +# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, +# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +MAINTAINERCLEANFILES = Makefile.in + +INCLUDES = -I$(top_srcdir)/include + +EXTRA_LTLIBRARIES = libintf_bmc.la +noinst_LTLIBRARIES = @INTF_BMC_LIB@ +libintf_bmc_la_LIBADD = $(top_builddir)/lib/libipmitool.la +libintf_bmc_la_SOURCES = \ + bmc.c bmc.h \ + bmc_intf.h + diff --git a/src/plugins/bmc/Makefile.in b/src/plugins/bmc/Makefile.in new file mode 100644 index 0000000..0b67a01 --- /dev/null +++ b/src/plugins/bmc/Makefile.in @@ -0,0 +1,541 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistribution of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistribution in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# Neither the name of Sun Microsystems, Inc. or the names of +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# This software is provided "AS IS," without a warranty of any kind. +# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. +# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE +# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL +# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, +# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF +# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, +# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = src/plugins/bmc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libintf_bmc_la_DEPENDENCIES = $(top_builddir)/lib/libipmitool.la +am_libintf_bmc_la_OBJECTS = bmc.lo +libintf_bmc_la_OBJECTS = $(am_libintf_bmc_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libintf_bmc_la_SOURCES) +DIST_SOURCES = $(libintf_bmc_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +ARCH = @ARCH@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASEDIR = @BASEDIR@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTRO = @DISTRO@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTF_BMC = @INTF_BMC@ +INTF_BMC_LIB = @INTF_BMC_LIB@ +INTF_DUMMY = @INTF_DUMMY@ +INTF_DUMMY_LIB = @INTF_DUMMY_LIB@ +INTF_FREE = @INTF_FREE@ +INTF_FREE_LIB = @INTF_FREE_LIB@ +INTF_IMB = @INTF_IMB@ +INTF_IMB_LIB = @INTF_IMB_LIB@ +INTF_LAN = @INTF_LAN@ +INTF_LANPLUS = @INTF_LANPLUS@ +INTF_LANPLUS_LIB = @INTF_LANPLUS_LIB@ +INTF_LAN_LIB = @INTF_LAN_LIB@ +INTF_LIPMI = @INTF_LIPMI@ +INTF_LIPMI_LIB = @INTF_LIPMI_LIB@ +INTF_OPEN = @INTF_OPEN@ +INTF_OPEN_LIB = @INTF_OPEN_LIB@ +INTF_SERIAL = @INTF_SERIAL@ +INTF_SERIAL_LIB = @INTF_SERIAL_LIB@ +IPMITOOL_INTF_LIB = @IPMITOOL_INTF_LIB@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OS = @OS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ +PSTAMP = @PSTAMP@ +RANLIB = @RANLIB@ +RPMBUILD = @RPMBUILD@ +RPM_RELEASE = @RPM_RELEASE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +MAINTAINERCLEANFILES = Makefile.in +INCLUDES = -I$(top_srcdir)/include +EXTRA_LTLIBRARIES = libintf_bmc.la +noinst_LTLIBRARIES = @INTF_BMC_LIB@ +libintf_bmc_la_LIBADD = $(top_builddir)/lib/libipmitool.la +libintf_bmc_la_SOURCES = \ + bmc.c bmc.h \ + bmc_intf.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(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 src/plugins/bmc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/plugins/bmc/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): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libintf_bmc.la: $(libintf_bmc_la_OBJECTS) $(libintf_bmc_la_DEPENDENCIES) $(EXTRA_libintf_bmc_la_DEPENDENCIES) + $(LINK) $(libintf_bmc_la_OBJECTS) $(libintf_bmc_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bmc.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +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 clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile 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 -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile 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-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/plugins/bmc/bmc.c b/src/plugins/bmc/bmc.c new file mode 100644 index 0000000..b88b077 --- /dev/null +++ b/src/plugins/bmc/bmc.c @@ -0,0 +1,351 @@ +/* + * Copyright (c) 2004 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. + */ + + +/* + * interface routines between ipmitool and the bmc kernel driver + */ + +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <sys/ioctl.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stropts.h> +#include <stddef.h> +#include <stropts.h> + +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_intf.h> +#include "bmc_intf.h" + +#include "bmc.h" + +static int curr_seq; +static int bmc_method(int fd, int *if_type); +struct ipmi_rs *(*sendrecv_fn)(struct ipmi_intf *, struct ipmi_rq *) = NULL; +extern int verbose; + +static void dump_request(bmc_req_t *request); +static void dump_response(bmc_rsp_t *response); +static struct ipmi_rs *ipmi_bmc_send_cmd_ioctl(struct ipmi_intf *intf, + struct ipmi_rq *req); +static struct ipmi_rs *ipmi_bmc_send_cmd_putmsg(struct ipmi_intf *intf, + struct ipmi_rq *req); + +#define MESSAGE_BUFSIZE 1024 + +struct ipmi_intf ipmi_bmc_intf = { + name: "bmc", + desc: "IPMI v2.0 BMC interface", + open: ipmi_bmc_open, + close: ipmi_bmc_close, + sendrecv: ipmi_bmc_send_cmd}; + +void +ipmi_bmc_close(struct ipmi_intf *intf) +{ + if (intf && intf->fd >= 0) + close(intf->fd); + + intf->opened = 0; + intf->manufacturer_id = IPMI_OEM_UNKNOWN; + intf->fd = -1; +} + +int +ipmi_bmc_open(struct ipmi_intf *intf) +{ + int method; + + if (!intf) + return -1; + + /* Open local device */ + intf->fd = open(BMC_DEV, O_RDWR); + + if (intf->fd <= 0) { + perror("Could not open bmc device"); + return (-1); + } + curr_seq = 0; + + intf->opened = 1; + + if (bmc_method(intf->fd, &method) < 0) { + perror("Could not determine bmc messaging interface"); + return (-1); + } + + sendrecv_fn = (method == BMC_PUTMSG_METHOD) ? + ipmi_bmc_send_cmd_putmsg : ipmi_bmc_send_cmd_ioctl; + + intf->manufacturer_id = ipmi_get_oem(intf); + return (intf->fd); +} + +struct ipmi_rs * +ipmi_bmc_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req) +{ + /* If not already opened open the device or network connection */ + if (!intf->opened && intf->open && intf->open(intf) < 0) + return NULL; + + /* sendrecv_fn cannot be NULL at this point */ + return ((*sendrecv_fn)(intf, req)); +} + +static struct ipmi_rs * +ipmi_bmc_send_cmd_ioctl(struct ipmi_intf *intf, struct ipmi_rq *req) +{ + struct strioctl istr; + static struct bmc_reqrsp reqrsp; + static struct ipmi_rs rsp; + + memset(&reqrsp, 0, sizeof (reqrsp)); + reqrsp.req.fn = req->msg.netfn; + reqrsp.req.lun = 0; + reqrsp.req.cmd = req->msg.cmd; + reqrsp.req.datalength = req->msg.data_len; + memcpy(reqrsp.req.data, req->msg.data, req->msg.data_len); + reqrsp.rsp.datalength = RECV_MAX_PAYLOAD_SIZE; + + istr.ic_cmd = IOCTL_IPMI_KCS_ACTION; + istr.ic_timout = 0; + istr.ic_dp = (char *)&reqrsp; + istr.ic_len = sizeof (struct bmc_reqrsp); + + if (verbose) { + printf("--\n"); + dump_request(&reqrsp.req); + printf("--\n"); + } + + if (ioctl(intf->fd, I_STR, &istr) < 0) { + perror("BMC IOCTL: I_STR"); + return (NULL); + } + + if (verbose > 2) { + dump_response(&reqrsp.rsp); + printf("--\n"); + } + + memset(&rsp, 0, sizeof (struct ipmi_rs)); + rsp.ccode = reqrsp.rsp.ccode; + rsp.data_len = reqrsp.rsp.datalength; + + /* Decrement for sizeof lun, cmd and ccode */ + rsp.data_len -= 3; + + if (!rsp.ccode && (rsp.data_len > 0)) + memcpy(rsp.data, reqrsp.rsp.data, rsp.data_len); + + return (&rsp); +} + +static struct ipmi_rs * +ipmi_bmc_send_cmd_putmsg(struct ipmi_intf *intf, struct ipmi_rq *req) +{ + struct strbuf sb; + int flags = 0; + static uint32_t msg_seq = 0; + + /* + * The length of the message structure is equal to the size of the + * bmc_req_t structure, PLUS any additional data space in excess of + * the data space already reserved in the data member + <n> for + * the rest of the members in the bmc_msg_t structure. + */ + int msgsz = offsetof(bmc_msg_t, msg) + sizeof(bmc_req_t) + + ((req->msg.data_len > SEND_MAX_PAYLOAD_SIZE) ? + (req->msg.data_len - SEND_MAX_PAYLOAD_SIZE) : 0); + bmc_msg_t *msg = malloc(msgsz); + bmc_req_t *request = (bmc_req_t *)&msg->msg[0]; + bmc_rsp_t *response; + static struct ipmi_rs rsp; + struct ipmi_rs *ret = NULL; + + msg->m_type = BMC_MSG_REQUEST; + msg->m_id = msg_seq++; + request->fn = req->msg.netfn; + request->lun = 0; + request->cmd = req->msg.cmd; + request->datalength = req->msg.data_len; + memcpy(request->data, req->msg.data, req->msg.data_len); + + sb.len = msgsz; + sb.buf = (unsigned char *)msg; + + if (verbose) { + printf("--\n"); + dump_request(request); + printf("--\n"); + } + + if (putmsg(intf->fd, NULL, &sb, 0) < 0) { + perror("BMC putmsg: "); + free(msg); + msg = NULL; + return (NULL); + } + + free(msg); + msg = NULL; + + sb.buf = malloc(MESSAGE_BUFSIZE); + sb.maxlen = MESSAGE_BUFSIZE; + + if (getmsg(intf->fd, NULL, &sb, &flags) < 0) { + perror("BMC getmsg: "); + free(sb.buf); + sb.buf = NULL; + return (NULL); + } + + msg = (bmc_msg_t *)sb.buf; + + if (verbose > 3) { + printf("Got msg (id 0x%x) type 0x%x\n", msg->m_id, msg->m_type); + } + + + /* Did we get an error back from the stream? */ + switch (msg->m_type) { + + case BMC_MSG_RESPONSE: + response = (bmc_rsp_t *)&msg->msg[0]; + + if (verbose > 2) { + dump_response(response); + printf("--\n"); + } + + memset(&rsp, 0, sizeof (struct ipmi_rs)); + rsp.ccode = response->ccode; + rsp.data_len = response->datalength; + + if (!rsp.ccode && (rsp.data_len > 0)) + memcpy(rsp.data, response->data, rsp.data_len); + + ret = &rsp; + break; + + case BMC_MSG_ERROR: + /* In case of an error, msg->msg[0] has the error code */ + printf("bmc_send_cmd: %s\n", strerror(msg->msg[0])); + break; + + } + + free(sb.buf); + sb.buf = NULL; + return (ret); +} + +/* + * Determine which interface to use. Returns the interface method + * to use. + */ +static int +bmc_method(int fd, int *if_type) +{ + struct strioctl istr; + int retval = 0; + uint8_t method = BMC_PUTMSG_METHOD; + + istr.ic_cmd = IOCTL_IPMI_INTERFACE_METHOD; + istr.ic_timout = 0; + istr.ic_dp = (uint8_t *)&method; + istr.ic_len = 1; + + /* + * If the ioctl doesn't exist, we should get an EINVAL back. + * Bail out on any other error. + */ + if (ioctl(fd, I_STR, &istr) < 0) { + + if (errno != EINVAL) + retval = -1; + else + method = BMC_IOCTL_METHOD; + } + + if (retval == 0) + *if_type = method; + + return (retval); +} + +static void +dump_request(bmc_req_t *request) +{ + int i; + + printf("BMC req.fn : 0x%x\n", request->fn); + printf("BMC req.lun : 0x%x\n", request->lun); + printf("BMC req.cmd : 0x%x\n", request->cmd); + printf("BMC req.datalength : 0x%x\n", request->datalength); + printf("BMC req.data : "); + + if (request->datalength > 0) { + for (i = 0; i < request->datalength; i++) + printf("0x%x ", request->data[i]); + } else { + printf("<NONE>"); + } + printf("\n"); +} + +static void +dump_response(bmc_rsp_t *response) +{ + int i; + + printf("BMC rsp.fn : 0x%x\n", response->fn); + printf("BMC rsp.lun : 0x%x\n", response->lun); + printf("BMC rsp.cmd : 0x%x\n", response->cmd); + printf("BMC rsp.ccode : 0x%x\n", response->ccode); + printf("BMC rsp.datalength : 0x%x\n", response->datalength); + printf("BMC rsp.data : "); + + if (response->datalength > 0) { + for (i = 0; i < response->datalength; i++) + printf("0x%x ", response->data[i]); + } else { + printf("<NONE>"); + } + printf("\n"); +} diff --git a/src/plugins/bmc/bmc.h b/src/plugins/bmc/bmc.h new file mode 100644 index 0000000..0138710 --- /dev/null +++ b/src/plugins/bmc/bmc.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2004 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_BMC_H_ +#define _IPMI_BMC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <ipmitool/ipmi.h> + +#define BMC_DEV "/dev/bmc" + +struct ipmi_rs *ipmi_bmc_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req); +int ipmi_bmc_open(struct ipmi_intf *intf); +void ipmi_bmc_close(struct ipmi_intf *intf); + +#ifdef __cplusplus +} +#endif + +#endif /* _IPMI_BMC_H_ */ diff --git a/src/plugins/bmc/bmc_intf.h b/src/plugins/bmc/bmc_intf.h new file mode 100644 index 0000000..c73e4c1 --- /dev/null +++ b/src/plugins/bmc/bmc_intf.h @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2004 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 _BMC_INTF_H +#define _BMC_INTF_H + +#pragma ident "@(#)bmc_intf.h 1.2 05/03/07 SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define BMC_SUCCESS 0x0 +#define BMC_FAILURE 0x1 + +#define BMC_NETFN_CHASSIS 0x0 +#define BMC_NETFN_BRIDGE 0x2 +#define BMC_NETFN_SE 0x4 +#define BMC_NETFN_APP 0x6 +#define BMC_NETFN_FIRMWARE 0x8 +#define BMC_NETFN_STORAGE 0xa +#define BMC_NETFN_TRANSPORT 0xc + +#define SEND_MAX_PAYLOAD_SIZE 34 /* MAX payload */ +#define RECV_MAX_PAYLOAD_SIZE 33 /* MAX payload */ +#define BMC_MIN_RESPONSE_SIZE 3 +#define BMC_MIN_REQUEST_SIZE 2 +#define BMC_MAX_RESPONSE_SIZE (BMC_MIN_RESPONSE_SIZE + RECV_MAX_PAYLOAD_SIZE) +#define BMC_MAX_REQUEST_SIZE (BMC_MIN_REQUEST_SIZE + BMC_MAX_RESPONSE_SIZE) + +#define BUF_SIZE 256 +#define MAX_BUF_SIZE 256 + +/* + * Useful macros + */ +#define FORM_NETFNLUN(net, lun) ((((net) << 2) | ((lun) & 0x3))) +#define GET_NETFN(netfn) (((netfn) >> 2) & 0x3f) +#define GET_LUN(netfn) (netfn & 0x3) +#define RESP_NETFN(nflun) ((nflun) | 1) +#define ISREQUEST(nl) (((nl) & 1) == 0) /* test for request */ +#define ISRESPONSE(nl) (((nl) & 1) == 1) /* test for response */ + + +/* for checking BMC specific stuff */ +#define BMC_GET_DEVICE_ID 0x1 /* GET DEVICE ID COMMAND */ +#define BMC_IPMI_15_VER 0x51 /* IPMI 1.5 definion */ + +/* BMC Completion Code and OEM Completion Code */ +#define BMC_IPMI_UNSPECIFIC_ERROR 0xFF /* Unspecific Error */ +#define BMC_IPMI_INVALID_COMMAND 0xC1 /* Invalid Command */ +#define BMC_IPMI_COMMAND_TIMEOUT 0xC3 /* Command Timeout */ +#define BMC_IPMI_DATA_LENGTH_EXCEED 0xC8 /* DataLength exceeded limit */ +#define BMC_IPMI_OEM_FAILURE_SENDBMC 0x7E /* Cannot send BMC req */ + + +#define IOCTL_IPMI_KCS_ACTION 0x01 +#define IOCTL_IPMI_INTERFACE_METHOD 0x02 + +/* Interface methods returned from IOCTL_IPMI_INTERFACE_METHOD ioctl: */ + +#define BMC_IOCTL_METHOD 0 /* Not returned from ioctl, */ + /* but can be used by */ + /* applications that want to */ + /* compare against an */ + /* alternative method. */ +#define BMC_PUTMSG_METHOD 1 + +/* + * bmc_req_t is the data structure to send + * request packet from applications to the driver + * module. + * + * the request pkt is mainly for KCS-interface-BMC + * messages. Since the system interface is session-less + * connections, the packet won't have any session + * information. + * + * the data payload will be 2 bytes less than max + * BMC supported packet size. + * the address of the responder is always BMC and so + * rsSa field is not required. + */ +typedef struct bmc_req { + uint8_t fn; /* netFn for command */ + uint8_t lun; /* logical unit on responder */ + uint8_t cmd; /* command */ + uint8_t datalength; /* length of following data */ + uint8_t data[SEND_MAX_PAYLOAD_SIZE]; /* request data */ +} bmc_req_t; + +/* + * bmc_rsp_t is the data structure to send + * respond packet from applications to the driver + * module. + * + * the respond pkt is mainly for KCS-interface-BMC + * messages. Since the system interface is session-less + * connections, the packet won't have any session + * information. + * + * the data payload will be 2 bytes less than max + * BMC supported packet size. + */ +typedef struct bmc_rsp { + uint8_t fn; /* netFn for command */ + uint8_t lun; /* logical unit on responder */ + uint8_t cmd; /* command */ + uint8_t ccode; /* completion code */ + uint8_t datalength; /* Length */ + uint8_t data[RECV_MAX_PAYLOAD_SIZE]; /* response */ +} bmc_rsp_t; + +/* + * the data structure for synchronous operation via ioctl (DEPRECATED) + */ +typedef struct bmc_reqrsp { + bmc_req_t req; /* request half */ + bmc_rsp_t rsp; /* response half */ +} bmc_reqrsp_t; + + +/* + * The new way of communicating with the bmc driver is to use putmsg() to + * send a message of a particular type. Replies from the driver also have this + * form, and will require the user to process the type field before examining + * the rest of the reply. + * + * The only change that must be observed when using the request and response + * structures defined above is as follows: + * when sending messages to the bmc driver, the data portion is now variable + * (the caller must allocate enough space to store the all structure members, + * plus enough space to cover the amount of data in the request), e.g.: + * + * bmc_msg_t *msg = malloc(offsetof(bmc_msg_t, msg) + sizeof(bmc_req_t) + 10); + * + * The amount allocated for the message is (# of bytes before the msg field) + + * the size of a bmc_req_t (which includes SEND_MAX_PAYLOAD_SIZE + * bytes in the data field), plus an additional 10 bytes for the data + * field (so the data field would occupy (SEND_MAX_PAYLOAD_SIZE + 10) + * bytes). The datalength member must reflect the amount of data in the + * request's data field (as was required when using the ioctl interface). + */ +typedef struct bmc_msg { + uint8_t m_type; /* Message type (see below) */ + uint32_t m_id; /* Message ID */ + uint8_t reserved[32]; + uint8_t msg[1]; /* Variable length message data */ +} bmc_msg_t; + + +/* + * An error response passed back from the bmc driver will have its m_id + * field set to BMC_UNKNOWN_MSG_ID if a message is sent to it that is not + * at least as large as a bmc_msg_t. + */ +#define BMC_UNKNOWN_MSG_ID ~((uint32_t)0) + + +/* + * Possible values for the m_type field in bmc_msg_t: + */ +#define BMC_MSG_REQUEST 1 /* BMC request (as above, sent to the */ + /* driver by the user), bmc_msg.msg */ + /* begins with the bmc_req_t */ + /* structure. */ +#define BMC_MSG_RESPONSE 2 /* BMC response (sent by the driver) */ + /* bmc_msg.msg begins with the */ + /* bmc_rsp_t structure. */ +#define BMC_MSG_ERROR 3 /* Error while processing a user msg */ + /* msg[0] is the error code */ + /* (interpret as an errno value) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _BMC_INTF_H */ |