From a7f89980e5b3f4b9a74c70dbc5ffe8aabd28be28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 6 Jul 2014 18:04:32 +0200 Subject: Imported Upstream version 2.9.3 --- hpiutil/COPYING | 28 + hpiutil/ChangeLog | 106 + hpiutil/INSTALL | 27 + hpiutil/Makefile | 77 + hpiutil/README | 249 ++ hpiutil/SaHpi.h | 4509 +++++++++++++++++++++++++++++++ hpiutil/SaHpi.h-A | 4509 +++++++++++++++++++++++++++++++ hpiutil/SaHpi.h-B | 6785 +++++++++++++++++++++++++++++++++++++++++++++++ hpiutil/TODO | 65 + hpiutil/env.hpi | 11 + hpiutil/env.openhpi | 2 + hpiutil/hpialarmpanel.c | 373 +++ hpiutil/hpievent.c | 621 +++++ hpiutil/hpifru.c | 19 + hpiutil/hpifrua.c | 550 ++++ hpiutil/hpifrub.c | 619 +++++ hpiutil/hpiinit.sh | 69 + hpiutil/hpireset.c | 225 ++ hpiutil/hpisel.c | 934 +++++++ hpiutil/hpisensor.c | 467 ++++ hpiutil/hpiutil.spec | 199 ++ hpiutil/hpiwdt.c | 272 ++ hpiutil/mkrpm | 135 + hpiutil/upd | 24 + 24 files changed, 20875 insertions(+) create mode 100644 hpiutil/COPYING create mode 100644 hpiutil/ChangeLog create mode 100644 hpiutil/INSTALL create mode 100644 hpiutil/Makefile create mode 100644 hpiutil/README create mode 100644 hpiutil/SaHpi.h create mode 100644 hpiutil/SaHpi.h-A create mode 100644 hpiutil/SaHpi.h-B create mode 100644 hpiutil/TODO create mode 100755 hpiutil/env.hpi create mode 100755 hpiutil/env.openhpi create mode 100644 hpiutil/hpialarmpanel.c create mode 100644 hpiutil/hpievent.c create mode 100644 hpiutil/hpifru.c create mode 100644 hpiutil/hpifrua.c create mode 100644 hpiutil/hpifrub.c create mode 100755 hpiutil/hpiinit.sh create mode 100644 hpiutil/hpireset.c create mode 100644 hpiutil/hpisel.c create mode 100644 hpiutil/hpisensor.c create mode 100644 hpiutil/hpiutil.spec create mode 100644 hpiutil/hpiwdt.c create mode 100755 hpiutil/mkrpm create mode 100755 hpiutil/upd (limited to 'hpiutil') diff --git a/hpiutil/COPYING b/hpiutil/COPYING new file mode 100644 index 0000000..1a27065 --- /dev/null +++ b/hpiutil/COPYING @@ -0,0 +1,28 @@ +The BSD License + +Copyright (c) 2003, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + a.. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + b.. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + c.. Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/hpiutil/ChangeLog b/hpiutil/ChangeLog new file mode 100644 index 0000000..755db47 --- /dev/null +++ b/hpiutil/ChangeLog @@ -0,0 +1,106 @@ +06/20/03 hpiutil 1.0.0 ARCress - initial release, includes: + hpisensor + hpisel + hpifru + hpireset + hpiwdt + hpialarmpanel + SpiLibd + libSpi*.so +06/26/03 hpiutil 1.0.1 ARCress + SpiLibd code: disabled RestoreDefault functions, + fixed Entity path root truncation, + tweaked EventTranslation for event data + hpisel: changed event data logic + hpisensor: added -t for thresholds + hpireset: cut out functions not supported in HPI 1.0 +06/27/03 hpiutil 1.0.2 ARCress + hpiutil.spec: check for ipmidrvr rpm, since no /dev/imb until reboot + Build MV CGE 2.1 rpm (gcc 2) + README: change test suite contact, added Test Notes + env.hpi: increased log level to 5 for errors only + hpiinit.sh: increased log level to 5 for errors only +07/08/03 hpiutil 1.0.3 ARCress + README: added list of APIs +07/22/03 hpiutil 1.0.4 ARCress + Makefile: added changes for OpenHPI + INSTALL: created build/install instructions + env.openhpi: created + hpisel.c: added BUGGY section for OpenHPI Discover workaround + hpisensor.c: added BUGGY section for OpenHPI Discover workaround +08/12/03 hpiutil 1.0.4-2 ARCress + built rh80open rpm with everything for OpenIPMI +09/25/03 hpiutil 1.0.5 ARCress + don't include libraries in rpms +11/12/03 hpiutil 1.0.6 ARCress + hpisel.c: check for CAPABLITY_SEL in RPT +02/19/04 hpiutil 1.1.0 ARCress + hpifru.c: added IsBmcTag() to generalize tag parsing + hpiinit.sh: added LD_ASSUME_KERNEL to avoid RH EL 3 NPTL + hpiutil.spec: changed /etc/init.d name to just "hpi" + hpisensor.c: recognize common errors for Compact & mBMC sensors. + SpiLibd: rebuilt lib objects with Gold Intel HPI 1.0 libraries + README updated for new OSs, etc. +02/23/04 hpiutil 1.1.1 ARCress + hpialarmpanel: added checking/setting disk LEDs + SpiLibd: fixed disk LEDs for mBMC + fixed IPMI timeout for mBMC +03/16/04 hpiutil 1.1.2 ARCress + hpievent 0.8: added general search for any Fan sensor + hpisel 1.2: use better free space logic now + hpiwdt 1.0: use description strings for use and action values, + fixed another 0xcc error w pretimeout byte. + SpiLibd: recognize special Watchdog sensor for mBMC + recognize System Boot records in domain SEL + skip Hysteresis if mBMC (caused ThresholdsGet error) + special code to allow mBMC ThresholdsSet +03/18/04 hpiutil 1.1.3 ARCress + SpiLibd: Check for bad SdrLock at init if mBMC + fix to mBMC ThresholdsSet + fix to not abort if SEL delete timestamp changes + hpievent 1.0: changed general search to a Temp sensor (has Low Major) +03/26/04 hpiutil 1.1.4 ARCress + hpiutil.spec - changes for kill scripts + hpiinit.sh - changes for chkconfig + SpiLibd: Changed timeouts for GetEvent, etc. +06/24/04 hpiutil 1.1.5 ARCress + SpiLibd: Fixed GetIpmiEvent for fast events, more than 1 per second. + test/hpieventloop.c Created for testing fast events, not in rpm + spi-lib.conf: Changed SpiLibHlpResponseTimeout from 9000 to 11000 + for "hpifru -a" client timeout error. +09/02/04 hpiutil 1.1.6 ARCress + SpiLibd: Changed saHpiInitialize to report version 0x010101 (A.01.01) + rather than 0x000101 (pre HPI 1.0) +09/15/04 hpiutil 1.1.7 ARCress + SpiLibd: fixed uninitialized pointer in debug printf for GetEvent +01/12/05 hpiutil 1.1.8 ARCress + SpiLibd: fixed spiCpsRptInfoGetRspCodec for 32bit UpdateCount + SaHpi.h-A: new file, include file for HPI A.01.01 spec + (SaHpi.h is the working copy) + SaHpi.h-B: new file, include file for HPI B.01.01 spec + hpialarmpanel.c: added HPI_A/HPI_B logic, misc changes + hpisel.c: added HPI_A/HPI_B logic + hpisensor.c: added HPI_A/HPI_B logic, misc changes + hpiwdt v1.1 - fixed RPT loop, added more decoding, + added flags for HPI_A/HPI_B. + hpireset v1.1 - added HPI_A/B flags + hpifru v1.3 - added HPI_A/B flags, + increased buffer sizes, check null ptr in fixstr + hpifrub.c new file, fully ported to HPI B + hpifrua.c new file, changed to skip read errors + hpievent.c - added HPI_A/B flags + Makefile - added a common HPI_A/B compile option + +03/16/05 hpiutil 1.1.9 ARCress + SpiLibd: various changes for new TIGI2U platform + hpifrub.c - added FieldSet for asset tag, Changed IsTagBmc usage + hpifrua.c - only write asset tag if IsTagBmc + hpisel.c - decode more of the record for IPMI sensor events + +04/07/05 hpiutil 1.1.10 ARCress + hpievent.c - set UpMajor if not Fan threshold + hpisel.c - add logic to show domain event log if HPI_B + +08/30/11 hpiutil 1.1.11 ARCress + hpiutil.spec - updated Version, syntax of header + hpiinit.sh - use /var/run if /var/lock/subsys is not present. diff --git a/hpiutil/INSTALL b/hpiutil/INSTALL new file mode 100644 index 0000000..ef5790f --- /dev/null +++ b/hpiutil/INSTALL @@ -0,0 +1,27 @@ +hpiutil + +BUILD & INSTALL INSTRUCTIONS + +This package uses the Intel HPI library implementation (closed source), +but there is also an OpenHPI library implementation that could also be +linked with these utilities. There are comments in the Makefile to show +how this can be done. + +How to make the utilities: +1) If OpenHPI, edit the makefile to uncomment the 2 lines indicated. +2) do ". env.hpi" or ". env.openhpi" to set the environment variables +3) make clean +4) make + +How to make the rpms: +(Only valid for Intel HPI at this time.) +mkrpm $OS + where OS = rh80 | as21 | mv21 | mv30 | mv30wv | el3 | mv31 + +How to install the rpms: +(Only valid for Intel HPI at this time.) +rpm -i hpiutil-1.0.3-as21.i386.rpm + The hpi utilities will be in /usr/bin. + The SaHpi libraries will be in /usr/lib. + The *.conf files will be in /etc/hpi. + diff --git a/hpiutil/Makefile b/hpiutil/Makefile new file mode 100644 index 0000000..e1faa35 --- /dev/null +++ b/hpiutil/Makefile @@ -0,0 +1,77 @@ +################################################################################ +# +# Makefile for hpiutils +# +################################################################################ + +# All items listed will be linked. By default, each has a dependency of the corresponding .o file. +# Each .o file has a default dependency of the correspoonding .c file. +TARGETS = hpialarmpanel hpisensor hpisel hpireset hpiwdt hpifru hpievent + +ifeq ($(DEBUG),y) +DEBFLAGS = -O -g3 -DDEBUG +else +DEBFLAGS = -O2 +endif +CFLAGS = $(DEBFLAGS) -Wall -D_REENTRANT -DLINUX -DUNIX -DUWSVR4 +INCLUDES = + +# Intel HPI parameters +LIBDIR = /root/hpi/lib +#LIBDIR = /usr/lib +#LIBDIR = ./rpm/usr/lib +LIBHPI = SaHpi +HPIA = -DHPI_A +# OpenHPI parameters (uncomment the next 3 lines) +#LIBDIR = /usr/local/lib +#LIBHPI = openhpi +#HPIA = +# (If openhpi is less than version 2.0.0, don't uncomment #HPIA.) + +# Additional compile flags +CC = gcc +CFLAGS += +LIBHPIF = $(LIBDIR)/lib$(LIBHPI).so + +# Link flags +LDFLAGS = -pthread +LDFLAGS += -lc +LDFLAGS += -lm +LDFLAGS += -L $(LIBDIR) +LD_LIBRARY_PATH = $(LIBDIR) + +all: $(TARGETS) + +hpialarmpanel: hpialarmpanel.o $(LIBHPIF) + $(CC) $(LDFLAGS) -l$(LIBHPI) -o hpialarmpanel hpialarmpanel.o + +hpisensor: hpisensor.o $(LIBHPIF) + $(CC) $(LDFLAGS) -l$(LIBHPI) -o hpisensor hpisensor.o + +hpisel: hpisel.o $(LIBHPIF) + $(CC) $(LDFLAGS) -l$(LIBHPI) -o hpisel hpisel.o + +hpifru: hpifru.o $(LIBHPIF) + $(CC) $(LDFLAGS) -l$(LIBHPI) -o hpifru hpifru.o + +hpireset: hpireset.o $(LIBHPIF) + $(CC) $(LDFLAGS) -l$(LIBHPI) -o hpireset hpireset.o + +hpiwdt: hpiwdt.o $(LIBHPIF) + $(CC) $(LDFLAGS) -l$(LIBHPI) -o hpiwdt hpiwdt.o + +hpievent: hpievent.o $(LIBHPIF) + $(CC) $(LDFLAGS) -l$(LIBHPI) -o hpievent hpievent.o + +hpieventloop: hpieventloop.o $(LIBHPIF) + $(CC) $(LDFLAGS) -l$(LIBHPI) -o hpieventloop hpieventloop.o + +clean: + rm -f *.o *.i *.s $(TARGETS) + +distclean: clean + rm -f Makefile.deps + +%.o: %.c + $(CC) -c $(CFLAGS) $(INCLUDES) $(HPIA) -o $@ $< + diff --git a/hpiutil/README b/hpiutil/README new file mode 100644 index 0000000..75594f0 --- /dev/null +++ b/hpiutil/README @@ -0,0 +1,249 @@ +hpiutil + +OVERVIEW + +The HPI utilities package provides system management utilities that +conform to the SA Forum's Hardware Platform Interface specification, and +as such are hardware-independent across platforms that have an HPI +library implementation. The HPI library on Intel platforms requires +an IPMI driver. An IPMI driver can be provided by either the Intel +IPMI driver (/dev/imb) or the OpenIPMI driver (/dev/ipmi0) in Linux +kernel versions 2.4.20 and greater. + +This Intel HPI library is currently configured to use the /dev/imb +interface, since that will coexist well with Intel Server Management +software. The hpiutil rpms default to the /dev/imb interface. +Note that the OpenIPMI driver also has imb emulation +as an option. + +To switch to using the OpenIPMI driver's /dev/ipmi0 interface with +this hpiutil package, do this after installing the rpm: + cp /usr/lib/libSpiModIpmi.so /usr/lib/libSpiModIpmi.so-imb + cp /usr/lib/libSpiModIpmi.so-open /usr/lib/libSpiModIpmi.so + sed -e 's/imb/ipmi0/' /etc/hpi/spi-daemon.conf >/tmp/spi + cp /tmp/spi /etc/hpi/spi-daemon.conf + +This package includes the Intel HPI binary libraries and the +following HPI utilities. + hpialarmpanel + hpisel + hpifru + hpisensor + hpireset + hpiwdt + +NOTES +This package uses the Intel HPI library implementation, but there +is also an OpenHPI library implementation that could also be linked +with these utilities. There are comments in the Makefile to show +how this can be done. +The hpiutil utilities are included in OpenHPI 1.0.0 and greater +as openhpi-clients. +The openhpi-2.6.3 and greater releases with the ipmidirect plugin +have been tested to work well on IPMI systems. + +Variations from HPI 1.0 spec: + +- SystemGUID added. Implemented as a FRU Product Custom field. + The IPMI SystemGUID was not supported in the HPI FRU fields. + This library implementation shows SystemGUID as part of FRU, but + does not try to write GUID as part of FRU. + See HPI 1.0 spec errata #66 + +- Power down added to Chassis/Cold Reset RDR via ControlStateSet(OFF) + There was no mechanism defined in the HPI 1.0 spec to support chassis + power down. Here is the way this was implemented with this library. + Doing ControlStateSet(ON) with the Reset RDR causes a hard reset. + Doing ControlStateSet(OFF) with the Reset RDR causes a power down. + See HPI 1.0 spec errata #30 + +- Alarm LED RDRs were not differentiated. + This variation is required to implement ControlStateSet for Alarm LEDs. + See also HPI 1.0 spec errata #75 + The oem field values are used to do this according to the following schema. + + Control.Type Control.OutputType Control.Oem Meaning + Digital (=0) LED (=1) 0x10 Alarm panel Power LED + Digital (=0) LED (=1) 0x11 Alarm panel Critical LED + Digital (=0) LED (=1) 0x12 Alarm panel Major LED + Digital (=0) LED (=1) 0x13 Alarm panel Minor LED + Digital (=0) LED (=1) 0x14 - 0x1F Alarm panel other LEDs + Digital (=0) LED (=1) 0x20 - 0x2F Disk LEDs (if used) + Digital (=0) LED (=1) 0x30 - 0x3F NIC LEDs (if used) + Analog (=2) LED (=1) 0x60 Chassis Identify LED + Analog (=2) LED (=1) 0x61 - 0x6F Other Analog LEDs (if used) + Digital (=0) Generic (=0) 0x70 - 0x7F Chassis Reset Control + + +SUPPORT + +The following error codes are returned by HPI APIs and are defined in SaHpi.h. + 0 SA_OK +-1001 SA_ERR_HPI_ERROR +-1002 SA_ERR_HPI_UNSUPPORTED_API +-1003 SA_ERR_HPI_BUSY +-1004 SA_ERR_HPI_INVALID +-1005 SA_ERR_HPI_INVALID_CMD +-1006 SA_ERR_HPI_TIMEOUT +-1007 SA_ERR_HPI_OUT_OF_SPACE +-1008 SA_ERR_HPI_DATA_TRUNCATED +-1009 SA_ERR_HPI_DATA_LEN_INVALID +-1010 SA_ERR_HPI_DATA_EX_LIMITS +-1011 SA_ERR_HPI_INVALID_PARAMS +-1012 SA_ERR_HPI_INVALID_DATA +-1013 SA_ERR_HPI_NOT_PRESENT +-1014 SA_ERR_HPI_INVALID_DATA_FIELD +-1015 SA_ERR_HPI_INVALID_SENSOR_CMD +-1016 SA_ERR_HPI_NO_RESPONSE +-1017 SA_ERR_HPI_DUPLICATE +-1018 SA_ERR_HPI_UPDATING +-1019 SA_ERR_HPI_INITIALIZING +-1020 SA_ERR_HPI_UNKNOWN +-1021 SA_ERR_HPI_INVALID_SESSION +-1022 SA_ERR_HPI_INVALID_DOMAIN +-1023 SA_ERR_HPI_INVALID_RESOURCE +-1024 SA_ERR_HPI_INVALID_REQUEST +-1025 SA_ERR_HPI_ENTITY_NOT_PRESENT +-1026 SA_ERR_HPI_UNINITIALIZED + +If problems occur, additional debug information can be obtained by +editing the SPI_DAEMON_LOG_LEVEL variable in the /etc/rc.d/init.d/hpi +script to change the log level. +SPI_DAEMON_LOG_LEVEL - Level at which to log debug information. The + following list describes each of the logging + switches. Multiple switches may be used at once. + -l: Logs data at a given level. Where num... + 1 = Logs debug low through fatal errors. + 2 = Logs debug high through fatal errors. + 3 = Logs informational through fatal errors. + 4 = Logs warnings through fatal errors. + 5 = Log non-fatal errors and fatal errors. + 6 = Logs fatal errors only. + -lf: Logs function entrance and exit.* + -lm: Logs memory usage.* + -ls: Logs semaphore usage.* + * = In order to use these options, the -l + option must also be set. + +Support for the hpiutil rpm is provided on a best-effort basis via + tltsupport@linux.intel.com + + +REFERENCES + +IPMI 1.5 specification: http://www.intel.com/design/servers/ipmi/ +Open source IPMI utilities: http://panicsel.sourceforge.net +SA Forum HPI 1.0 spec: http://www.saforum.org/specification/HPI_Specification +Intel HPI 1.0 compliance test suite: Contact Keith.L.Perrin@Intel.com +OpenHPI project: http://openhpi.sourceforge.net + +TESTING + + The binary HPI libraries included in this package have been tested to be + HPI 1.0 compliant via the Intel HPI 1.0 compliance test suite. + + This package has been tested and is supported on the following Intel + servers: TSRLT2, TSRMT2, TIGPR2U, TIGPT1U. + See also http://www.saforum.org for platform support information. + Most of the utilities (except hpialarmpanel) should work on other + platforms as well, if they have IPMI 1.5 support. + Note that mBMC platforms, such as TIGPT1U, do not support the + Power On Hours function, which is optional in IPMI 1.5. + + This hpiutil package is not inherently dependent on any OS variance, + as long as there is an IPMI driver. However, the version of glibc/gcc + does matter, since the library includes shared object files. + This HPI library and the HPI utilities have been tested on the + following Linux OSs. + RedHat EL 3 (gcc 3.2.3, glibc 2.3.2) + RedHat AS 2.1 (gcc 2.96, glibc 2.2.4) + RedHat 8.0 (gcc 3.2, glibc 2.2.93) + MontaVista CGE 2.1 (gcc 2.95.3, glibc 2.2.3 ) + MontaVista CGE 3.0 (gcc 3.2.1, glibc 2.2.5) + MontaVista CGE 3.1 (gcc 3.2.1, glibc 2.2.5) + Other Linux OSs should work fine using an rpm with similar gcc/glibc. + + SA-HPI Release 1.0 Library APIs + The following APIs are supported in this release: + +Initialization and Cleanup +saHpiInitialize() +saHpiFinalize() +Session Management +saHpiSessionOpen() +saHpiSessionClose() + +Discovery of Resources +saHpiResourcesDiscover() +saHpiRptInfoGet() +saHpiRptEntryGet() +saHpiRptEntryGetByResourceId() +saHpiResourceSeveritySet() +saHpiResourceTagSet() +saHpiResourceIdGet() +saHpiEntitySchemaGet() + +Event Log Management +saHpiEventLogInfoGet() +saHpiEventLogEntryGet() +saHpiEventLogEntryAdd() +saHpiEventLogEntryDelete () +saHpiEventLogClear() +saHpiEventLogTimeGet() +saHpiEventLogTimeSet() +saHpiEventLogStateGet() +saHpiEventLogStateSet() + +Events +saHpiSubscribe() +saHpiUnsubscribe() +saHpiEventGet() + +RDR Repository Management +saHpiRdrGet() + +Sensor Functions +saHpiSensorReadingGet() +saHpiSensorReadingConvert() +saHpiSensorThresholdsGet() +saHpiSensorThresholdsSet() +saHpiSensorTypeGet() +saHpiSensorEventEnablesGet() +saHpiSensorEventEnablesSet() + +Controls +saHpiControlTypeGet() +saHpiControlStateGet() +saHpiControlStateSet() + +Entity Inventory Data +saHpiEntityInventoryDataRead() +saHpiEntityInventoryDataWrite() + +Watchdog Timer +saHpiWatchdogTimerGet() +saHpiWatchdogTimerSet() +saHpiWatchdogTimerReset() + +Reset +saHpiResourceResetStateGet() +saHpiResourceResetStateSet() + +Hot Swap Routines +saHpiHotSwapControlRequest() +saHpiResourceActiveSet() +saHpiResourceInactiveSet() +saHpiAutoInsertTimeoutGet() +saHpiAutoInsertTimeoutSet() +saHpiAutoExtractTimeoutGet() +saHpiAutoExtractTimeoutSet() +saHpiHotSwapStateGet() +saHpiHotSwapActionRequest() +saHpiResourcePowerStateGet() +saHpiResourcePowerStateSet() +saHpiHotSwapIndicatorStateGet() +saHpiHotSwapIndicatorStateSet() + +Configuration +saHpiParmControl() - disabled for this library by design + diff --git a/hpiutil/SaHpi.h b/hpiutil/SaHpi.h new file mode 100644 index 0000000..6efd5e9 --- /dev/null +++ b/hpiutil/SaHpi.h @@ -0,0 +1,4509 @@ +/******************************************************************************* +** +** FILE: +** SaHpi.h +** +** DESCRIPTION: +** This file provides the C language binding for the Service +** Availability(TM) Forum Platform Interface. It contains all of +** the prototypes and type definitions. Note, this file was +** generated from the Platform Interface specification document. +** +** SPECIFICATION VERSION: +** SAI-HPI-A.01.01 +** +** DATE: +** Thu Oct 3 14:48:41 2002 +** +** LEGAL: +** OWNERSHIP OF SPECIFICATION AND COPYRIGHTS. +** The Specification and all worldwide copyrights therein are +** the exclusive property of Licensor. You may not remove, obscure, or +** alter any copyright or other proprietary rights notices that are in or +** on the copy of the Specification you download. You must reproduce all +** such notices on all copies of the Specification you make. Licensor +** may make changes to the Specification, or to items referenced therein, +** at any time without notice. Licensor is not obligated to support or +** update the Specification. +** +** Copyright(c) 2002, Service Availability(TM) Forum. All rights +** reserved. +** +*******************************************************************************/ + +#ifndef __SAHPI_H +#define __SAHPI_H + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Basic Data Types and Values ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* General Types - need to be specified correctly for the host architecture */ +typedef unsigned char SaHpiUint8T; +typedef unsigned short SaHpiUint16T; +typedef unsigned int SaHpiUint32T; +typedef char SaHpiInt8T; +typedef short SaHpiInt16T; +typedef int SaHpiInt32T; +typedef long long SaHpiInt64T; +typedef float SaHpiFloat32T; +typedef double SaHpiFloat64T; + +typedef SaHpiUint8T SaHpiBoolT; +#define SAHPI_TRUE 1 +#define SAHPI_FALSE 0 + +/* Platform, O/S, or Vendor dependent */ +#define SAHPI_API +#define SAHPI_IN +#define SAHPI_OUT +#define SAHPI_INOUT + +/* +** Identifier for the manufacturer +** +** This is the IANA-assigned private enterprise number for the +** manufacturer of the resource or FRU, or of the manufacturer +** defining an OEM control or event type. A list of current +** IANA-assigned private enterprise numbers may be obtained at +** +** http://www.iana.org/assignments/enterprise-numbers +** +** If a manufacturer does not currently have an assigned number, one +** may be obtained by following the instructions located at +** +** http://www.iana.org/cgi-bin/enterprise.pl +*/ +typedef SaHpiUint32T SaHpiManufacturerIdT; +#define SAHPI_MANUFACTURER_ID_UNSPECIFIED (SaHpiManufacturerIdT)0 + +/* Version Types */ +typedef SaHpiUint32T SaHpiVersionT; + +/* +** Interface Version +** +** The interface version is the version of the actual interface and not the +** version of the implementation. It is a 24 bit value where +** the most significant 8 bits represent the compatibility level +** (with letters represented as the corresponding numbers); +** the next 8 bits represent the major version number; and +** the least significant 8 bits represent the minor version number. +*/ +#define SAHPI_INTERFACE_VERSION (SaHpiVersionT)0x010101 /* A.01.01 */ + +/* +** Return Codes +** +** SaErrorT is defined in the HPI specification. In the future a +** common SAF types definition may be created to contain this type. At +** that time, this typedef should be removed. +*/ +typedef SaHpiInt32T SaErrorT; /* Return code */ + +/* +** SA_OK: This code indicates that a command completed successfully. +*/ +#define SA_OK (SaErrorT)0x0000 + +/* This value is the base for all HPI-specific error codes. */ +#define SA_HPI_ERR_BASE -1000 + +/* +** SA_ERR_HPI_ERROR: An unspecified error occurred. This code should +** be returned only as a last resort; eg. if the cause of an error +** cannot be determined. +*/ +#define SA_ERR_HPI_ERROR (SaErrorT)(SA_HPI_ERR_BASE - 1) + +/* +** SA_ERR_HPI_UNSUPPORTED_API: The HPI implementation does not support +** this API. This code is appropriate, for example, if invoking the +** Hot Swap functions on an HPI implementation which has no hot swap +** support. Note that such an implementation would not report any hot +** swap capabilities via its RDRs. +*/ +#define SA_ERR_HPI_UNSUPPORTED_API (SaErrorT)(SA_HPI_ERR_BASE - 2) + +/* +** SA_ERR_HPI_BUSY: The command cannot be performed because the +** targeted device is busy. +*/ +#define SA_ERR_HPI_BUSY (SaErrorT)(SA_HPI_ERR_BASE - 3) + +/* +** SA_ERR_HPI_INVALID: The request is fundamentally invalid. +*/ +#define SA_ERR_HPI_INVALID (SaErrorT)(SA_HPI_ERR_BASE - 4) + +/* +** SA_ERR_HPI_INVALID_CMD: The specific object to which a command was +** directed does not support that command (which was otherwise valid). +*/ +#define SA_ERR_HPI_INVALID_CMD (SaErrorT)(SA_HPI_ERR_BASE - 5) + +/* +** SA_ERR_HPI_TIMEOUT: The requested operation, which had a timeout +** value specified, timed out. For example, when reading input with a +** timeout value, if no input arrives within the timeout interval, +** this code should be returned. This should only be returned in +** cases where a timeout is anticipated as a valid consequence of the +** operation; if the addressed entity is not responding due to a +** fault, use SA_ERR_HPI_NO_RESPONSE (qv). +*/ +#define SA_ERR_HPI_TIMEOUT (SaErrorT)(SA_HPI_ERR_BASE - 6) + +/* +** SA_ERR_HPI_OUT_OF_SPACE: The requested command failed due to +** resource limits. +*/ +#define SA_ERR_HPI_OUT_OF_SPACE (SaErrorT)(SA_HPI_ERR_BASE - 7) + +/* +** SA_ERR_HPI_DATA_TRUNCATED: The returned data was truncated. For +** example, when reading data into a fixed-size buffer, if the data is +** larger than the buffer, this code should be returned. +*/ +#define SA_ERR_HPI_DATA_TRUNCATED (SaErrorT)(SA_HPI_ERR_BASE - 8) + +/* +** SA_ERR_HPI_DATA_LEN_INVALID: The specified data length is invalid. +*/ +#define SA_ERR_HPI_DATA_LEN_INVALID (SaErrorT)(SA_HPI_ERR_BASE - 9) + +/* +** SA_ERR_HPI_DATA_EX_LIMITS: The supplied data exceeds limits. +*/ +#define SA_ERR_HPI_DATA_EX_LIMITS (SaErrorT)(SA_HPI_ERR_BASE - 10) + +/* +** SA_ERR_HPI_INVALID_PARAMS: One or more parameters to the command +** were invalid. +*/ +#define SA_ERR_HPI_INVALID_PARAMS (SaErrorT)(SA_HPI_ERR_BASE - 11) + +/* +** SA_ERR_HPI_INVALID_DATA: Cannot return requested data; eg. the +** specific object to which a command was directed does not support +** the data required by the command. +*/ +#define SA_ERR_HPI_INVALID_DATA (SaErrorT)(SA_HPI_ERR_BASE - 12) + +/* +** SA_ERR_HPI_NOT_PRESENT: The requested object was not present. For +** example, this code would be returned when attempting to access an +** entry in a RPT or RDR which is not present. As another example, this +** code would also be returned when accessing an invalid management +** instrument on a valid resource. +*/ +#define SA_ERR_HPI_NOT_PRESENT (SaErrorT)(SA_HPI_ERR_BASE - 13) + +/* +** SA_ERR_HPI_INVALID_DATA_FIELD: Invalid data field. +*/ +#define SA_ERR_HPI_INVALID_DATA_FIELD (SaErrorT)(SA_HPI_ERR_BASE - 14) + +/* +** SA_ERR_HPI_INVALID_SENSOR_CMD: Invalid sensor command. +*/ +#define SA_ERR_HPI_INVALID_SENSOR_CMD (SaErrorT)(SA_HPI_ERR_BASE - 15) + +/* +** SA_ERR_HPI_NO_RESPONSE: There was no response from the domain or +** object targeted by the command, due to some fault. This code +** indicates an un-anticipated failure to respond; compare with +** SA_ERR_HPI_TIMEOUT. +*/ +#define SA_ERR_HPI_NO_RESPONSE (SaErrorT)(SA_HPI_ERR_BASE - 16) + +/* +** SA_ERR_HPI_DUPLICATE: Duplicate request -- such as attempting to +** initialize something which has already been initialized (and which +** cannot be initialized twice). +*/ +#define SA_ERR_HPI_DUPLICATE (SaErrorT)(SA_HPI_ERR_BASE - 17) + +/* +** SA_ERR_HPI_UPDATING: The command could not be completed because +** the targeted object is in update mode. +*/ +#define SA_ERR_HPI_UPDATING (SaErrorT)(SA_HPI_ERR_BASE - 18) + +/* +** SA_ERR_HPI_INITIALIZING: The command could not be completed because +** the targeted object is initializing. +*/ +#define SA_ERR_HPI_INITIALIZING (SaErrorT)(SA_HPI_ERR_BASE - 19) + +/* +** SA_ERR_HPI_UNKNOWN: This code should be returned if, for some +** reason, the HPI implementation cannot determine the proper response +** to a command. For example, there may be a proper value to return +** for a given call, but the implementation may be unable to determine +** which one it is. +*/ +#define SA_ERR_HPI_UNKNOWN (SaErrorT)(SA_HPI_ERR_BASE - 20) + +/* +** SA_ERR_HPI_INVALID_SESSION: An invalid session ID was specified in +** the command. +*/ +#define SA_ERR_HPI_INVALID_SESSION (SaErrorT)(SA_HPI_ERR_BASE - 21) + +/* +** SA_ERR_HPI_INVALID_DOMAIN: Invalid domain ID specified -- ie. a +** domain ID which does not correspond to any real domain was +** specified in the command. +*/ +#define SA_ERR_HPI_INVALID_DOMAIN (SaErrorT)(SA_HPI_ERR_BASE - 22) + +/* +** SA_ERR_HPI_INVALID_RESOURCE: Invalid resource ID specified -- ie. a +** resource ID which does not correspond to a resource in the addressed +** domain was specified in the command. +*/ +#define SA_ERR_HPI_INVALID_RESOURCE (SaErrorT)(SA_HPI_ERR_BASE - 23) + +/* +** SA_ERR_HPI_INVALID_REQUEST: The request is invalid in the current +** context. An example would be attempting to unsubscribe for events, +** when the caller has not subscribed to events. +*/ +#define SA_ERR_HPI_INVALID_REQUEST (SaErrorT)(SA_HPI_ERR_BASE - 24) + +/* +** SA_ERR_HPI_ENTITY_NOT_PRESENT: The addressed management instrument is not active +** because the entity with which it is associated is not present. This +** condition could occur, for instance, when an alarm module is managing a +** fan tray FRU. The alarm module would contain management instruments (sensors, +** etc) for the fan tray. The fan tray may be removed, even though the +** management instruments are still represented in the alarm module. In this +** case, SA_ERR_HPI_ENTITY_NOT_PRESENT would be returned if a management instrument +** associated with a removed entity is accessed. +*/ +#define SA_ERR_HPI_ENTITY_NOT_PRESENT (SaErrorT)(SA_HPI_ERR_BASE - 25) + +/* +** SA_ERR_HPI_UNINITIALIZED: This code is returned when a request is +** made, and the HPI has not, yet, been initialized via saHpiInitialize(). +*/ +#define SA_ERR_HPI_UNINITIALIZED (SaErrorT)(SA_HPI_ERR_BASE - 26) + + +/* +** Domain, Session and Resource Type Definitions +*/ + +/* Domain ID. */ +typedef SaHpiUint32T SaHpiDomainIdT; +#define SAHPI_DEFAULT_DOMAIN_ID (SaHpiDomainIdT)0 + +/* The SAHPI_UNSPECIFIED_DOMAIN_ID value may be used by an implementation +** when populating the ResourceId value for an RPT entry that is a +** domain only. +*/ +#define SAHPI_UNSPECIFIED_DOMAIN_ID (SaHpiDomainIdT) 0xFFFFFFFF + +/* Session ID. */ +typedef SaHpiUint32T SaHpiSessionIdT; + +/* Resource identifier. */ +typedef SaHpiUint32T SaHpiResourceIdT; + +/* The SAHPI_UNSPECIFIED_RESOURCE_ID value may be used by an implementation +** when populating the DomainId value for an RPT entry that is a +** resource only. Note that this reserved value (0xFFFFFFFF) is also used +** to designate the domain controller, for domain-based event log access. +*/ +#define SAHPI_UNSPECIFIED_RESOURCE_ID (SaHpiResourceIdT) 0xFFFFFFFF + +/* The SAHPI_DOMAIN_CONTROLLER_ID value is a reserved resource ID +** value which is used to select the domain controller's event log +** (as opposed to a real resource's event log) when accessing logs. +** This value must not be used as the ID of any real resource. +*/ +#define SAHPI_DOMAIN_CONTROLLER_ID (SaHpiResourceIdT) 0xFFFFFFFE + +/* Table Related Type Definitions */ +typedef SaHpiUint32T SaHpiEntryIdT; +#define SAHPI_FIRST_ENTRY (SaHpiEntryIdT)0x00000000 +#define SAHPI_LAST_ENTRY (SaHpiEntryIdT)0xFFFFFFFF + +/* +** Time Related Type Definitions +** +** An HPI time value represents the local time as the number of nanoseconds +** from 00:00:00, January 1, 1970, in a 64-bit signed integer. This format +** is sufficient to represent times with nano-second resolution from the +** year 1678 to 2262. Every API which deals with time values must define +** the timezone used. +** +** It should be noted that although nano-second resolution is supported +** in the data type, the actual resolution provided by an implementation +** may be more limited than this. +** +** The value -2**63, which is 0x8000000000000000, is used to indicate +** "unknown/unspecified time". +** +** Conversion to/from POSIX and other common time representations is +** relatively straightforward. The following code framgment converts +** between SaHpiTimeT and time_t: +** +** time_t tt1, tt2; +** SaHpiTimeT saHpiTime; +** +** time(&tt1); +** saHpiTime = (SaHpiTimeT) tt1 * 1000000000; +** tt2 = saHpiTime / 1000000000; +** +** The following fragment converts between SaHpiTimeT and a struct timeval: +** +** struct timeval tv1, tv2; +** SaHpiTimeT saHpiTime; +** +** gettimeofday(&tv1, NULL); +** saHpiTime = (SaHpiTimeT) tv1.tv_sec * 1000000000 + tv1.tv_usec * 1000; +** tv2.tv_sec = saHpiTime / 1000000000; +** tv2.tv_usec = saHpiTime % 1000000000 / 1000; +** +** The following fragment converts between SaHpiTimeT and a struct timespec: +** +** struct timespec ts1, ts2; +** SaHpiTimeT saHpiTime; +** +** clock_gettime(CLOCK_REALTIME, &ts1); +** saHpiTime = (SaHpiTimeT) ts1.tv_sec * 1000000000 + ts1.tv_nsec; +** ts2.tv_sec = saHpiTime / 1000000000; +** ts2.tv_nsec = saHpiTime % 1000000000; +** +** Note, however, that since time_t is (effectively) universally 32 bits, +** all of these conversions will cease to work on January 18, 2038. +** +** Some subsystems may need the flexibility to report either absolute or +** relative (eg. to system boot) times. This will typically be in the +** case of a board which may or may not, depending on the system setup, +** have an idea of absolute time. For example, some boards may have +** "time of day" clocks which start at zero, and never get set to the +** time of day. +** +** In these cases, times which represent "current" time (in events, for +** example) can be reported based on the clock value, whether it has been +** set to the actual date/time, or whether it represents the elapsed time +** since boot. If it is the time since boot, the value will be (for 27 +** years) less than 0x0C00000000000000, which is Mon May 26 16:58:48 1997. +** If the value is greater than this, then it can be assumed to be an +** absolute time. +** +** Every API which can report either absolute or relative times must +** state this rule clearly in its interface specification. +*/ +typedef SaHpiInt64T SaHpiTimeT; /* Time in nanoseconds */ + +/* Unspecified or unknown time */ +#define SAHPI_TIME_UNSPECIFIED (SaHpiTimeT) 0x8000000000000000 + +/* Maximum time that can be specified as relative */ +#define SAHPI_TIME_MAX_RELATIVE (SaHpiTimeT) 0x0C00000000000000 +typedef SaHpiInt64T SaHpiTimeoutT; /* Timeout in nanoseconds */ + +/* Non-blocking call */ +#define SAHPI_TIMEOUT_IMMEDIATE (SaHpiTimeoutT) 0x0000000000000000 + +/* Blocking call, wait indefinitely for call to complete */ +#define SAHPI_TIMEOUT_BLOCK (SaHpiTimeoutT) -1 + +/* +** Language +** +** This enumeration lists all of the languages that can be associated with text. +** +** SAHPI_LANG_UNDEF indicates that the language is unspecified or +** unknown. +*/ +typedef enum { + SAHPI_LANG_UNDEF = 0, SAHPI_LANG_AFAR, SAHPI_LANG_ABKHAZIAN, + SAHPI_LANG_AFRIKAANS, SAHPI_LANG_AMHARIC, SAHPI_LANG_ARABIC, + SAHPI_LANG_ASSAMESE, SAHPI_LANG_AYMARA, SAHPI_LANG_AZERBAIJANI, + SAHPI_LANG_BASHKIR, SAHPI_LANG_BYELORUSSIAN, SAHPI_LANG_BULGARIAN, + SAHPI_LANG_BIHARI, SAHPI_LANG_BISLAMA, SAHPI_LANG_BENGALI, + SAHPI_LANG_TIBETAN, SAHPI_LANG_BRETON, SAHPI_LANG_CATALAN, + SAHPI_LANG_CORSICAN, SAHPI_LANG_CZECH, SAHPI_LANG_WELSH, + SAHPI_LANG_DANISH, SAHPI_LANG_GERMAN, SAHPI_LANG_BHUTANI, + SAHPI_LANG_GREEK, SAHPI_LANG_ENGLISH, SAHPI_LANG_ESPERANTO, + SAHPI_LANG_SPANISH, SAHPI_LANG_ESTONIAN, SAHPI_LANG_BASQUE, + SAHPI_LANG_PERSIAN, SAHPI_LANG_FINNISH, SAHPI_LANG_FIJI, + SAHPI_LANG_FAEROESE, SAHPI_LANG_FRENCH, SAHPI_LANG_FRISIAN, + SAHPI_LANG_IRISH, SAHPI_LANG_SCOTSGAELIC, SAHPI_LANG_GALICIAN, + SAHPI_LANG_GUARANI, SAHPI_LANG_GUJARATI, SAHPI_LANG_HAUSA, + SAHPI_LANG_HINDI, SAHPI_LANG_CROATIAN, SAHPI_LANG_HUNGARIAN, + SAHPI_LANG_ARMENIAN, SAHPI_LANG_INTERLINGUA, SAHPI_LANG_INTERLINGUE, + SAHPI_LANG_INUPIAK, SAHPI_LANG_INDONESIAN, SAHPI_LANG_ICELANDIC, + SAHPI_LANG_ITALIAN, SAHPI_LANG_HEBREW, SAHPI_LANG_JAPANESE, + SAHPI_LANG_YIDDISH, SAHPI_LANG_JAVANESE, SAHPI_LANG_GEORGIAN, + SAHPI_LANG_KAZAKH, SAHPI_LANG_GREENLANDIC, SAHPI_LANG_CAMBODIAN, + SAHPI_LANG_KANNADA, SAHPI_LANG_KOREAN, SAHPI_LANG_KASHMIRI, + SAHPI_LANG_KURDISH, SAHPI_LANG_KIRGHIZ, SAHPI_LANG_LATIN, + SAHPI_LANG_LINGALA, SAHPI_LANG_LAOTHIAN, SAHPI_LANG_LITHUANIAN, + SAHPI_LANG_LATVIANLETTISH, SAHPI_LANG_MALAGASY, SAHPI_LANG_MAORI, + SAHPI_LANG_MACEDONIAN, SAHPI_LANG_MALAYALAM, SAHPI_LANG_MONGOLIAN, + SAHPI_LANG_MOLDAVIAN, SAHPI_LANG_MARATHI, SAHPI_LANG_MALAY, + SAHPI_LANG_MALTESE, SAHPI_LANG_BURMESE, SAHPI_LANG_NAURU, + SAHPI_LANG_NEPALI, SAHPI_LANG_DUTCH, SAHPI_LANG_NORWEGIAN, + SAHPI_LANG_OCCITAN, SAHPI_LANG_AFANOROMO, SAHPI_LANG_ORIYA, + SAHPI_LANG_PUNJABI, SAHPI_LANG_POLISH, SAHPI_LANG_PASHTOPUSHTO, + SAHPI_LANG_PORTUGUESE, SAHPI_LANG_QUECHUA, SAHPI_LANG_RHAETOROMANCE, + SAHPI_LANG_KIRUNDI, SAHPI_LANG_ROMANIAN, SAHPI_LANG_RUSSIAN, + SAHPI_LANG_KINYARWANDA, SAHPI_LANG_SANSKRIT, SAHPI_LANG_SINDHI, + SAHPI_LANG_SANGRO, SAHPI_LANG_SERBOCROATIAN, SAHPI_LANG_SINGHALESE, + SAHPI_LANG_SLOVAK, SAHPI_LANG_SLOVENIAN, SAHPI_LANG_SAMOAN, + SAHPI_LANG_SHONA, SAHPI_LANG_SOMALI, SAHPI_LANG_ALBANIAN, + SAHPI_LANG_SERBIAN, SAHPI_LANG_SISWATI, SAHPI_LANG_SESOTHO, + SAHPI_LANG_SUDANESE, SAHPI_LANG_SWEDISH, SAHPI_LANG_SWAHILI, + SAHPI_LANG_TAMIL, SAHPI_LANG_TELUGU, SAHPI_LANG_TAJIK, + SAHPI_LANG_THAI, SAHPI_LANG_TIGRINYA, SAHPI_LANG_TURKMEN, + SAHPI_LANG_TAGALOG, SAHPI_LANG_SETSWANA, SAHPI_LANG_TONGA, + SAHPI_LANG_TURKISH, SAHPI_LANG_TSONGA, SAHPI_LANG_TATAR, + SAHPI_LANG_TWI, SAHPI_LANG_UKRAINIAN, SAHPI_LANG_URDU, + SAHPI_LANG_UZBEK, SAHPI_LANG_VIETNAMESE, SAHPI_LANG_VOLAPUK, + SAHPI_LANG_WOLOF, SAHPI_LANG_XHOSA, SAHPI_LANG_YORUBA, + SAHPI_LANG_CHINESE, SAHPI_LANG_ZULU +} SaHpiLanguageT; + +/* +** Text Buffers +** +** These structures are used for defining the type of data in the text buffer +** and the length of the buffer. Text buffers are used in the inventory data, +** RDR, RPT, etc. for variable length strings of data. +*/ + +#define SAHPI_MAX_TEXT_BUFFER_LENGTH 255 + +typedef enum { + SAHPI_TL_TYPE_BINARY = 0, /* String of bytes, any values legal */ + SAHPI_TL_TYPE_BCDPLUS, /* String of 0-9, space, dash, period ONLY */ + SAHPI_TL_TYPE_ASCII6, /* Reduced ASCII character set: 0x20-0x5F + ONLY */ + SAHPI_TL_TYPE_LANGUAGE /* ASCII or UNICODE depending on language */ +} SaHpiTextTypeT; + +typedef struct { + SaHpiTextTypeT DataType; + SaHpiLanguageT Language; /* Language the text is in. */ + SaHpiUint8T DataLength; /* Bytes used in Data buffer */ + SaHpiUint8T Data[SAHPI_MAX_TEXT_BUFFER_LENGTH]; /* Data buffer */ +} SaHpiTextBufferT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Entities ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* +** Entity Types +** +** Entities are used to associate specific hardware components with sensors, +** controls, watchdogs, or resources. Entities are defined with an entity +** type enumeration, and an entity instance number (to distinguish between +** multiple instances of a particular type of entity; e.g., multiple power +** supplies in a system). +** +** Entities are uniquely identified in a system with an ordered series of +** Entity Type / Entity Instance pairs called an "Entity Path". Each subsequent +** Entity Type/Entity Instance in the path is the next higher "containing" +** entity. The "root" of the Entity Path (the outermost level of containment) +** is designated with an Entity Type of SAHPI_ENT_ROOT if the entire Entity Path +** is fewer than SAHPI_MAX_ENTITY_PATH entries in length. +** +** Enumerated Entity Types include those types enumerated by the IPMI Consortium +** for IPMI-managed entities, as well as additional types defined by the +** HPI specification. Room is left in the enumeration for the inclusion of +** Entity Types taken from other lists, if needed in the future. +*/ +/* Base values for entity types from various sources. */ +#define SAHPI_ENT_IPMI_GROUP 0 +#define SAHPI_ENT_SAFHPI_GROUP 0x10000 +#define SAHPI_ENT_ROOT_VALUE 0xFFFF +typedef enum +{ + SAHPI_ENT_UNSPECIFIED = SAHPI_ENT_IPMI_GROUP, + SAHPI_ENT_OTHER, + SAHPI_ENT_UNKNOWN, + SAHPI_ENT_PROCESSOR, + SAHPI_ENT_DISK_BAY, /* Disk or disk bay */ + SAHPI_ENT_PERIPHERAL_BAY, + SAHPI_ENT_SYS_MGMNT_MODULE, /* System management module */ + SAHPI_ENT_SYSTEM_BOARD, /* Main system board, may also be + processor board and/or internal + expansion board */ + SAHPI_ENT_MEMORY_MODULE, /* Board holding memory devices */ + SAHPI_ENT_PROCESSOR_MODULE, /* Holds processors, use this + designation when processors are not + mounted on system board */ + SAHPI_ENT_POWER_SUPPLY, /* Main power supply (supplies) for the + system */ + SAHPI_ENT_ADD_IN_CARD, + SAHPI_ENT_FRONT_PANEL_BOARD, /* Control panel */ + SAHPI_ENT_BACK_PANEL_BOARD, + SAHPI_ENT_POWER_SYSTEM_BOARD, + SAHPI_ENT_DRIVE_BACKPLANE, + SAHPI_ENT_SYS_EXPANSION_BOARD, /* System internal expansion board + (contains expansion slots). */ + SAHPI_ENT_OTHER_SYSTEM_BOARD, /* Part of board set */ + SAHPI_ENT_PROCESSOR_BOARD, /* Holds 1 or more processors. Includes + boards that hold SECC modules) */ + SAHPI_ENT_POWER_UNIT, /* Power unit / power domain (typically + used as a pre-defined logical entity + for grouping power supplies)*/ + SAHPI_ENT_POWER_MODULE, /* Power module / DC-to-DC converter. + Use this value for internal + converters. Note: You should use + entity ID (power supply) for the + main power supply even if the main + supply is a DC-to-DC converter */ + SAHPI_ENT_POWER_MGMNT, /* Power management/distribution + board */ + SAHPI_ENT_CHASSIS_BACK_PANEL_BOARD, + SAHPI_ENT_SYSTEM_CHASSIS, + SAHPI_ENT_SUB_CHASSIS, + SAHPI_ENT_OTHER_CHASSIS_BOARD, + SAHPI_ENT_DISK_DRIVE_BAY, + SAHPI_ENT_PERIPHERAL_BAY_2, + SAHPI_ENT_DEVICE_BAY, + SAHPI_ENT_COOLING_DEVICE, /* Fan/cooling device */ + SAHPI_ENT_COOLING_UNIT, /* Can be used as a pre-defined logical + entity for grouping fans or other + cooling devices. */ + SAHPI_ENT_INTERCONNECT, /* Cable / interconnect */ + SAHPI_ENT_MEMORY_DEVICE, /* This Entity ID should be used for + replaceable memory devices, e.g. + DIMM/SIMM. It is recommended that + Entity IDs not be used for + individual non-replaceable memory + devices. Rather, monitoring and + error reporting should be associated + with the FRU [e.g. memory card] + holding the memory. */ + SAHPI_ENT_SYS_MGMNT_SOFTWARE, /* System Management Software */ + SAHPI_ENT_BIOS, + SAHPI_ENT_OPERATING_SYSTEM, + SAHPI_ENT_SYSTEM_BUS, + SAHPI_ENT_GROUP, /* This is a logical entity for use with + Entity Association records. It is + provided to allow a sensor data + record to point to an entity- + association record when there is no + appropriate pre-defined logical + entity for the entity grouping. + This Entity should not be used as a + physical entity. */ + SAHPI_ENT_REMOTE, /* Out of band management communication + device */ + SAHPI_ENT_EXTERNAL_ENVIRONMENT, + SAHPI_ENT_BATTERY, + SAHPI_ENT_CHASSIS_SPECIFIC = SAHPI_ENT_IPMI_GROUP + 0x90, + SAHPI_ENT_BOARD_SET_SPECIFIC = SAHPI_ENT_IPMI_GROUP + 0xB0, + SAHPI_ENT_OEM_SYSINT_SPECIFIC = SAHPI_ENT_IPMI_GROUP + 0xD0, + SAHPI_ENT_ROOT = SAHPI_ENT_ROOT_VALUE, + SAHPI_ENT_RACK = SAHPI_ENT_SAFHPI_GROUP, + SAHPI_ENT_SUBRACK, + SAHPI_ENT_COMPACTPCI_CHASSIS, + SAHPI_ENT_ADVANCEDTCA_CHASSIS, + SAHPI_ENT_SYSTEM_SLOT, + SAHPI_ENT_SBC_BLADE, + SAHPI_ENT_IO_BLADE, + SAHPI_ENT_DISK_BLADE, + SAHPI_ENT_DISK_DRIVE, + SAHPI_ENT_FAN, + SAHPI_ENT_POWER_DISTRIBUTION_UNIT, + SAHPI_ENT_SPEC_PROC_BLADE, /* Special Processing Blade, + including DSP */ + SAHPI_ENT_IO_SUBBOARD, /* I/O Sub-Board, including + PMC I/O board */ + SAHPI_ENT_SBC_SUBBOARD, /* SBC Sub-Board, including PMC + SBC board */ + SAHPI_ENT_ALARM_MANAGER, /* Chassis alarm manager board */ + SAHPI_ENT_ALARM_MANAGER_BLADE, /* Blade-based alarm manager */ + SAHPI_ENT_SUBBOARD_CARRIER_BLADE /* Includes PMC Carrier Blade -- + Use only if "carrier" is only + function of blade. Else use + primary function (SBC_BLADE, + DSP_BLADE, etc.). */ + } SaHpiEntityTypeT; + +typedef SaHpiUint32T SaHpiEntityInstanceT; + +typedef struct { + SaHpiEntityTypeT EntityType; + SaHpiEntityInstanceT EntityInstance; +} SaHpiEntityT; + +#define SAHPI_MAX_ENTITY_PATH 16 + +typedef struct { + SaHpiEntityT Entry[SAHPI_MAX_ENTITY_PATH]; +} SaHpiEntityPathT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Events, part 1 ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** Category +** +** Sensor events contain an event category and event state. Depending on the +** event category, the event states take on different meanings for events +** generated by specific sensors. +** +** The SAHPI_EC_GENERIC category can be used for discrete sensors which have +** state meanings other than those identified with other event categories. +*/ +typedef SaHpiUint8T SaHpiEventCategoryT; + +#define SAHPI_EC_UNSPECIFIED (SaHpiEventCategoryT)0x00 /* Unspecified */ +#define SAHPI_EC_THRESHOLD (SaHpiEventCategoryT)0x01 /* Threshold + events */ +#define SAHPI_EC_USAGE (SaHpiEventCategoryT)0x02 /* Usage state + events */ +#define SAHPI_EC_STATE (SaHpiEventCategoryT)0x03 /* Generic state + events */ +#define SAHPI_EC_PRED_FAIL (SaHpiEventCategoryT)0x04 /* Predictive fail + events */ +#define SAHPI_EC_LIMIT (SaHpiEventCategoryT)0x05 /* Limit events */ +#define SAHPI_EC_PERFORMANCE (SaHpiEventCategoryT)0x06 /* Performance + events */ +#define SAHPI_EC_SEVERITY (SaHpiEventCategoryT)0x07 /* Severity + indicating + events */ +#define SAHPI_EC_PRESENCE (SaHpiEventCategoryT)0x08 /* Device presence + events */ +#define SAHPI_EC_ENABLE (SaHpiEventCategoryT)0x09 /* Device enabled + events */ +#define SAHPI_EC_AVAILABILITY (SaHpiEventCategoryT)0x0A /* Availability + state events */ + +#define SAHPI_EC_REDUNDANCY (SaHpiEventCategoryT)0x0B /* Redundancy + state events */ +#define SAHPI_EC_USER (SaHpiEventCategoryT)0x7E /* User defined + events */ +#define SAHPI_EC_GENERIC (SaHpiEventCategoryT)0x7F /* OEM defined + events */ + +/* +** Event States +** +** The following event states are specified relative to the categories listed +** above. The event types are only valid for their given category. Each set of +** events is labeled as to which category it belongs to. +** Each event will have only one event state associated with it. When retrieving +** the event status or event enabled status a bit mask of all applicable event +** states is used. Similarly, when setting the event enabled status a bit mask +** of all applicable event states is used. +*/ +typedef SaHpiUint16T SaHpiEventStateT; + +/* +** SaHpiEventCategoryT == +*/ +#define SAHPI_ES_UNSPECIFIED (SaHpiEventStateT)0x0000 + +/* +** SaHpiEventCategoryT == SAHPI_EC_THRESHOLD +** When using these event states, the event state should match +** the event severity (for example SAHPI_ES_LOWER_MINOR should have an +** event severity of SAHPI_MINOR). +*/ +#define SAHPI_ES_LOWER_MINOR (SaHpiEventStateT)0x0001 +#define SAHPI_ES_LOWER_MAJOR (SaHpiEventStateT)0x0002 +#define SAHPI_ES_LOWER_CRIT (SaHpiEventStateT)0x0004 +#define SAHPI_ES_UPPER_MINOR (SaHpiEventStateT)0x0008 +#define SAHPI_ES_UPPER_MAJOR (SaHpiEventStateT)0x0010 +#define SAHPI_ES_UPPER_CRIT (SaHpiEventStateT)0x0020 + +/* SaHpiEventCategoryT == SAHPI_EC_USAGE */ +#define SAHPI_ES_IDLE (SaHpiEventStateT)0x0001 +#define SAHPI_ES_ACTIVE (SaHpiEventStateT)0x0002 +#define SAHPI_ES_BUSY (SaHpiEventStateT)0x0004 + +/* SaHpiEventCategoryT == SAHPI_EC_STATE */ +#define SAHPI_ES_STATE_DEASSERTED (SaHpiEventStateT)0x0001 +#define SAHPI_ES_STATE_ASSERTED (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_PRED_FAIL */ +#define SAHPI_ES_PRED_FAILURE_DEASSERT (SaHpiEventStateT)0x0001 +#define SAHPI_ES_PRED_FAILURE_ASSERT (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_LIMIT */ +#define SAHPI_ES_LIMIT_NOT_EXCEEDED (SaHpiEventStateT)0x0001 +#define SAHPI_ES_LIMIT_EXCEEDED (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_PERFORMANCE */ +#define SAHPI_ES_PERFORMANCE_MET (SaHpiEventStateT)0x0001 +#define SAHPI_ES_PERFORMANCE_LAGS (SaHpiEventStateT)0x0002 + +/* +** SaHpiEventCategoryT == SAHPI_EC_SEVERITY +** When using these event states, the event state should match +** the event severity +*/ +#define SAHPI_ES_OK (SaHpiEventStateT)0x0001 +#define SAHPI_ES_MINOR_FROM_OK (SaHpiEventStateT)0x0002 +#define SAHPI_ES_MAJOR_FROM_LESS (SaHpiEventStateT)0x0004 +#define SAHPI_ES_CRITICAL_FROM_LESS (SaHpiEventStateT)0x0008 +#define SAHPI_ES_MINOR_FROM_MORE (SaHpiEventStateT)0x0010 +#define SAHPI_ES_MAJOR_FROM_CRITICAL (SaHpiEventStateT)0x0020 +#define SAHPI_ES_CRITICAL (SaHpiEventStateT)0x0040 +#define SAHPI_ES_MONITOR (SaHpiEventStateT)0x0080 +#define SAHPI_ES_INFORMATIONAL (SaHpiEventStateT)0x0100 + +/* SaHpiEventCategoryT == SAHPI_EC_PRESENCE */ +#define SAHPI_ES_ABSENT (SaHpiEventStateT)0x0001 +#define SAHPI_ES_PRESENT (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_ENABLE */ +#define SAHPI_ES_DISABLED (SaHpiEventStateT)0x0001 +#define SAHPI_ES_ENABLED (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_AVAILABILITY */ +#define SAHPI_ES_RUNNING (SaHpiEventStateT)0x0001 +#define SAHPI_ES_TEST (SaHpiEventStateT)0x0002 +#define SAHPI_ES_POWER_OFF (SaHpiEventStateT)0x0004 +#define SAHPI_ES_ON_LINE (SaHpiEventStateT)0x0008 +#define SAHPI_ES_OFF_LINE (SaHpiEventStateT)0x0010 +#define SAHPI_ES_OFF_DUTY (SaHpiEventStateT)0x0020 +#define SAHPI_ES_DEGRADED (SaHpiEventStateT)0x0040 +#define SAHPI_ES_POWER_SAVE (SaHpiEventStateT)0x0080 +#define SAHPI_ES_INSTALL_ERROR (SaHpiEventStateT)0x0100 + +/* SaHpiEventCategoryT == SAHPI_EC_REDUNDANCY */ +#define SAHPI_ES_FULLY_REDUNDANT (SaHpiEventStateT)0x0001 +#define SAHPI_ES_REDUNDANCY_LOST (SaHpiEventStateT)0x0002 +#define SAHPI_ES_REDUNDANCY_DEGRADED (SaHpiEventStateT)0x0004 +#define SAHPI_ES_REDUNDANCY_LOST_SUFFICIENT_RESOURCES \ + (SaHpiEventStateT)0x0008 +#define SAHPI_ES_NON_REDUNDANT_SUFFICIENT_RESOURCES \ + (SaHpiEventStateT)0x0010 +#define SAHPI_ES_NON_REDUNDANT_INSUFFICIENT_RESOURCES \ + (SaHpiEventStateT)0x0020 +#define SAHPI_ES_REDUNDANCY_DEGRADED_FROM_FULL (SaHpiEventStateT)0x0040 +#define SAHPI_ES_REDUNDANCY_DEGRADED_FROM_NON (SaHpiEventStateT)0x0080 + +/* +** SaHpiEventCategoryT == SAHPI_EC_GENERIC || SAHPI_EC_USER +** These event states are defined by the OEM or the user of the +** implementation. +*/ +#define SAHPI_ES_STATE_00 (SaHpiEventStateT)0x0001 +#define SAHPI_ES_STATE_01 (SaHpiEventStateT)0x0002 +#define SAHPI_ES_STATE_02 (SaHpiEventStateT)0x0004 +#define SAHPI_ES_STATE_03 (SaHpiEventStateT)0x0008 +#define SAHPI_ES_STATE_04 (SaHpiEventStateT)0x0010 +#define SAHPI_ES_STATE_05 (SaHpiEventStateT)0x0020 +#define SAHPI_ES_STATE_06 (SaHpiEventStateT)0x0040 +#define SAHPI_ES_STATE_07 (SaHpiEventStateT)0x0080 +#define SAHPI_ES_STATE_08 (SaHpiEventStateT)0x0100 +#define SAHPI_ES_STATE_09 (SaHpiEventStateT)0x0200 +#define SAHPI_ES_STATE_10 (SaHpiEventStateT)0x0400 +#define SAHPI_ES_STATE_11 (SaHpiEventStateT)0x0800 +#define SAHPI_ES_STATE_12 (SaHpiEventStateT)0x1000 +#define SAHPI_ES_STATE_13 (SaHpiEventStateT)0x2000 +#define SAHPI_ES_STATE_14 (SaHpiEventStateT)0x4000 + + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Sensors ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Sensor Number */ +typedef SaHpiUint8T SaHpiSensorNumT; + +/* Type of Sensor */ +typedef enum { + SAHPI_TEMPERATURE = 0x01, + SAHPI_VOLTAGE, + SAHPI_CURRENT, + SAHPI_FAN, + SAHPI_PHYSICAL_SECURITY, + SAHPI_PLATFORM_VIOLATION, + SAHPI_PROCESSOR, + SAHPI_POWER_SUPPLY, + SAHPI_POWER_UNIT, + SAHPI_COOLING_DEVICE, + SAHPI_OTHER_UNITS_BASED_SENSOR, + SAHPI_MEMORY, + SAHPI_DRIVE_SLOT, + SAHPI_POST_MEMORY_RESIZE, + SAHPI_SYSTEM_FW_PROGRESS, + SAHPI_EVENT_LOGGING_DISABLED, + SAHPI_RESERVED1, + SAHPI_SYSTEM_EVENT, + SAHPI_CRITICAL_INTERRUPT, + SAHPI_BUTTON, + SAHPI_MODULE_BOARD, + SAHPI_MICROCONTROLLER_COPROCESSOR, + SAHPI_ADDIN_CARD, + SAHPI_CHASSIS, + SAHPI_CHIP_SET, + SAHPI_OTHER_FRU, + SAHPI_CABLE_INTERCONNECT, + SAHPI_TERMINATOR, + SAHPI_SYSTEM_BOOT_INITIATED, + SAHPI_BOOT_ERROR, + SAHPI_OS_BOOT, + SAHPI_OS_CRITICAL_STOP, + SAHPI_SLOT_CONNECTOR, + SAHPI_SYSTEM_ACPI_POWER_STATE, + SAHPI_RESERVED2, + SAHPI_PLATFORM_ALERT, + SAHPI_ENTITY_PRESENCE, + SAHPI_MONITOR_ASIC_IC, + SAHPI_LAN, + SAHPI_MANAGEMENT_SUBSYSTEM_HEALTH, + SAHPI_BATTERY, + SAHPI_OPERATIONAL = 0xA0, + SAHPI_OEM_SENSOR=0xC0 +} SaHpiSensorTypeT; + +/* +** Interpreted Sensor Reading Type +** +** These definitions list the available data types that can be +** used for interpreted sensor readings. Interpreted sensor readings are provided +** because typically sensors measure their associated entities in a way that is +** not human readable/understandable. For example a fan sensor may measure the +** number of ticks that it takes a fan blade to move passed a sensor. The human +** readable reading type would be revolutions per minute (RPM). +*/ + +#define SAHPI_SENSOR_BUFFER_LENGTH 32 + +typedef enum { + SAHPI_SENSOR_INTERPRETED_TYPE_UINT8, + SAHPI_SENSOR_INTERPRETED_TYPE_UINT16, + SAHPI_SENSOR_INTERPRETED_TYPE_UINT32, + SAHPI_SENSOR_INTERPRETED_TYPE_INT8, + SAHPI_SENSOR_INTERPRETED_TYPE_INT16, + SAHPI_SENSOR_INTERPRETED_TYPE_INT32, + SAHPI_SENSOR_INTERPRETED_TYPE_FLOAT32, + SAHPI_SENSOR_INTERPRETED_TYPE_BUFFER /* 32 byte array */ +} SaHpiSensorInterpretedTypeT; + +typedef union { + SaHpiUint8T SensorUint8; + SaHpiUint16T SensorUint16; + SaHpiUint32T SensorUint32; + SaHpiInt8T SensorInt8; + SaHpiInt16T SensorInt16; + SaHpiInt32T SensorInt32; + SaHpiFloat32T SensorFloat32; + SaHpiUint8T SensorBuffer[SAHPI_SENSOR_BUFFER_LENGTH]; +} SaHpiSensorInterpretedUnionT; + +typedef struct { + SaHpiSensorInterpretedTypeT Type; + SaHpiSensorInterpretedUnionT Value; +} SaHpiSensorInterpretedT; + +/* +** Sensor Status +** +** The sensor status structure is used to determine if sensor scanning is +** enabled and if events are enabled. If events are enabled, the structure will +** have valid data for the outstanding sensor event states. +*/ +typedef SaHpiUint8T SaHpiSensorStatusT; +#define SAHPI_SENSTAT_EVENTS_ENABLED (SaHpiSensorStatusT)0x80 +#define SAHPI_SENSTAT_SCAN_ENABLED (SaHpiSensorStatusT)0x40 +#define SAHPI_SENSTAT_BUSY (SaHpiSensorStatusT)0x20 + +typedef struct { + SaHpiSensorStatusT SensorStatus; + SaHpiEventStateT EventStatus; +} SaHpiSensorEvtStatusT; + +/* Sensor Event Enables */ +typedef struct { + SaHpiSensorStatusT SensorStatus; + SaHpiEventStateT AssertEvents; + SaHpiEventStateT DeassertEvents; +} SaHpiSensorEvtEnablesT; + +/* +** Sensor Reading +** +** The sensor reading type is the data structure returned from a call to get +** sensor reading. The structure is also used when setting and getting sensor +** threshold values and reporting sensor ranges. +** Each sensor may support one or more of raw, interpreted, or event status +** representations of the sensor data. For analog sensors the raw value is the +** raw value from the sensor (such as ticks per fan blade) and the interpreted +** value is the raw value converted in to a usable format (such as RPM). The +** interpreted value can be calculated by the HPI implementation using the +** sensor factors or by another OEM means. +*/ +typedef SaHpiUint8T SaHpiSensorReadingFormatsT; +#define SAHPI_SRF_RAW (SaHpiSensorReadingFormatsT)0x01 +#define SAHPI_SRF_INTERPRETED (SaHpiSensorReadingFormatsT)0x02 +#define SAHPI_SRF_EVENT_STATE (SaHpiSensorReadingFormatsT)0x04 + +typedef struct { + SaHpiSensorReadingFormatsT ValuesPresent; + SaHpiUint32T Raw; + SaHpiSensorInterpretedT Interpreted; + SaHpiSensorEvtStatusT EventStatus; +} SaHpiSensorReadingT; + +/* +** Threshold Values +** This structure encompasses all of the thresholds that can be set. +*/ +typedef struct { + SaHpiSensorReadingT LowCritical; /* Lower Critical Threshold */ + SaHpiSensorReadingT LowMajor; /* Lower Major Threshold */ + SaHpiSensorReadingT LowMinor; /* Lower Minor Threshold */ + SaHpiSensorReadingT UpCritical; /* Upper critical Threshold */ + SaHpiSensorReadingT UpMajor; /* Upper major Threshold */ + SaHpiSensorReadingT UpMinor; /* Upper minor Threshold */ + SaHpiSensorReadingT PosThdHysteresis; /* Positive Threshold Hysteresis */ + SaHpiSensorReadingT NegThdHysteresis; /* Negative Threshold Hysteresis */ +}SaHpiSensorThresholdsT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Sensor Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** Sensor Factors +** +** The sensor factors structure defines the conversion factors for linear and +** linearized sensors. +** The SaHpiSensorLinearizationT enumeration coupled with the various other +** sensor factors define a formula that can be applied to raw sensor data to +** convert it to appropriate engineering units. If linearization is +** SAHPI_SL_NONLINEAR, SAHPI_SL_UNSPECIFIED, or SAHPI_SL_OEM then there is no +** predefined conversion from raw to interpreted and the sensor factors may or +** may not be meaningful depending on the implementation. +** For other linearization values, raw readings may be converted to interpreted +** values using the formula: +**Interpreted = L [( M*raw + B*10^ExpB )*10^ExpR ] +**where "L[x]" is the indicated linearization function +** (for SAHPI_SL_LINEAR, L[x]=x). +** The Tolerance Factor is given as +/- 1/2 raw counts, so tolerance in +** interpreted values can be calculated as: +** L[ M * ToleranceFactor/2 * 10^ExpR ] +** The Accuracy Factor is given as 1/100 of a percent, scaled up by ExpA. Thus +** the accuracy is: +**( ( AccuracyFactor/100 ) / 10^ExpA )% +*/ +typedef enum { + SAHPI_SL_LINEAR = 0, /* Already linear */ + SAHPI_SL_LN, + SAHPI_SL_LOG10, + SAHPI_SL_LOG2, + SAHPI_SL_E, + SAHPI_SL_EXP10, + SAHPI_SL_EXP2, + SAHPI_SL_1OVERX, + SAHPI_SL_SQRX, + SAHPI_SL_CUBEX, + SAHPI_SL_SQRTX, + SAHPI_SL_CUBERTX, + SAHPI_SL_NONLINEAR = 0x70, /* Cannot be linearized with a predefind formula*/ + SAHPI_SL_OEM, + SAHPI_SL_UNSPECIFIED = 0xFF +} SaHpiSensorLinearizationT; + +typedef struct { + SaHpiInt16T M_Factor; /* M Factor */ + SaHpiInt16T B_Factor; /* B Factor */ + SaHpiUint16T AccuracyFactor; /* Accuracy */ + SaHpiUint8T ToleranceFactor; /* Tolerance */ + SaHpiUint8T ExpA; /* Accuracy Exp */ + SaHpiInt8T ExpR; /* Result Exp */ + SaHpiInt8T ExpB; /* B Exp */ + SaHpiSensorLinearizationT Linearization; +} SaHpiSensorFactorsT; + +/* +** Sensor Range +** Sensor range values can include minimum, maximum, normal minimum, normal +** maximum, and nominal values. +*/ +typedef SaHpiUint8T SaHpiSensorRangeFlagsT; +#define SAHPI_SRF_MIN (SaHpiSensorRangeFlagsT)0x10 +#define SAHPI_SRF_MAX (SaHpiSensorRangeFlagsT)0x08 +#define SAHPI_SRF_NORMAL_MIN (SaHpiSensorRangeFlagsT)0x04 +#define SAHPI_SRF_NORMAL_MAX (SaHpiSensorRangeFlagsT)0x02 +#define SAHPI_SRF_NOMINAL (SaHpiSensorRangeFlagsT)0x01 + +typedef struct { + SaHpiSensorRangeFlagsT Flags; + SaHpiSensorReadingT Max; + SaHpiSensorReadingT Min; + SaHpiSensorReadingT Nominal; + SaHpiSensorReadingT NormalMax; + SaHpiSensorReadingT NormalMin; +} SaHpiSensorRangeT; + +/* +** Sensor Units +** This is a list of all the sensor units supported by HPI. +*/ +typedef enum { + SAHPI_SU_UNSPECIFIED = 0, SAHPI_SU_DEGREES_C, SAHPI_SU_DEGREES_F, + SAHPI_SU_DEGREES_K, SAHPI_SU_VOLTS, SAHPI_SU_AMPS, + SAHPI_SU_WATTS, SAHPI_SU_JOULES, SAHPI_SU_COULOMBS, + SAHPI_SU_VA, SAHPI_SU_NITS, SAHPI_SU_LUMEN, + SAHPI_SU_LUX, SAHPI_SU_CANDELA, SAHPI_SU_KPA, + SAHPI_SU_PSI, SAHPI_SU_NEWTON, SAHPI_SU_CFM, + SAHPI_SU_RPM, SAHPI_SU_HZ, SAHPI_SU_MICROSECOND, + SAHPI_SU_MILLISECOND, SAHPI_SU_SECOND, SAHPI_SU_MINUTE, + SAHPI_SU_HOUR, SAHPI_SU_DAY, SAHPI_SU_WEEK, + SAHPI_SU_MIL, SAHPI_SU_INCHES, SAHPI_SU_FEET, + SAHPI_SU_CU_IN, SAHPI_SU_CU_FEET, SAHPI_SU_MM, + SAHPI_SU_CM, SAHPI_SU_M, SAHPI_SU_CU_CM, + SAHPI_SU_CU_M, SAHPI_SU_LITERS, SAHPI_SU_FLUID_OUNCE, + SAHPI_SU_RADIANS, SAHPI_SU_STERADIANS, SAHPI_SU_REVOLUTIONS, + SAHPI_SU_CYCLES, SAHPI_SU_GRAVITIES, SAHPI_SU_OUNCE, + SAHPI_SU_POUND, SAHPI_SU_FT_LB, SAHPI_SU_OZ_IN, + SAHPI_SU_GAUSS, SAHPI_SU_GILBERTS, SAHPI_SU_HENRY, + SAHPI_SU_MILLIHENRY, SAHPI_SU_FARAD, SAHPI_SU_MICROFARAD, + SAHPI_SU_OHMS, SAHPI_SU_SIEMENS, SAHPI_SU_MOLE, + SAHPI_SU_BECQUEREL, SAHPI_SU_PPM, SAHPI_SU_RESERVED, + SAHPI_SU_DECIBELS, SAHPI_SU_DBA, SAHPI_SU_DBC, + SAHPI_SU_GRAY, SAHPI_SU_SIEVERT, SAHPI_SU_COLOR_TEMP_DEG_K, + SAHPI_SU_BIT, SAHPI_SU_KILOBIT, SAHPI_SU_MEGABIT, + SAHPI_SU_GIGABIT, SAHPI_SU_BYTE, SAHPI_SU_KILOBYTE, + SAHPI_SU_MEGABYTE, SAHPI_SU_GIGABYTE, SAHPI_SU_WORD, + SAHPI_SU_DWORD, SAHPI_SU_QWORD, SAHPI_SU_LINE, + SAHPI_SU_HIT, SAHPI_SU_MISS, SAHPI_SU_RETRY, + SAHPI_SU_RESET, SAHPI_SU_OVERRUN, SAHPI_SU_UNDERRUN, + SAHPI_SU_COLLISION, SAHPI_SU_PACKETS, SAHPI_SU_MESSAGES, + SAHPI_SU_CHARACTERS, SAHPI_SU_ERRORS, SAHPI_SU_CORRECTABLE_ERRORS, + SAHPI_SU_UNCORRECTABLE_ERRORS +} SaHpiSensorUnitsT; + +/* +** Modifier Unit Use +** This type defines how the modifier unit is used. For example: base unit == +** meter, modifier unit == seconds, and modifier unit use == +** SAHPI_SMUU_BASIC_OVER_MODIFIER. The resulting unit would be meters per second. +*/ +typedef enum { + SAHPI_SMUU_NONE = 0, + SAHPI_SMUU_BASIC_OVER_MODIFIER, /* Basic Unit / Modifier Unit */ + SAHPI_SMUU_BASIC_TIMES_MODIFIER /* Basic Unit * Modifier Unit */ +} SaHpiSensorModUnitUseT; + +/* +** Sign Format +** This type defines what the sign format of the sensor's raw value is (1's +** complement, unsigned, etc.). +*/ +typedef enum { + SAHPI_SDF_UNSIGNED = 0, + SAHPI_SDF_1S_COMPLEMENT, + SAHPI_SDF_2S_COMPLEMENT +} SaHpiSensorSignFormatT; + +/* +** Data Format +** This structure encapsulates all of the various types that make up the +** definition of sensor data. +*/ +typedef struct { + SaHpiSensorReadingFormatsT ReadingFormats; /* Indicates if sensor supports + readings in raw, interpreted, + and/or event status formats */ + SaHpiBoolT IsNumeric; /* If FALSE, rest of this + structure is not + meaningful */ + SaHpiSensorSignFormatT SignFormat; /* Signed format */ + SaHpiSensorUnitsT BaseUnits; /* Base units (meters, etc.) */ + SaHpiSensorUnitsT ModifierUnits; /* Modifier unit (second, etc.) */ + SaHpiSensorModUnitUseT ModifierUse; /* Modifier use(m/sec, etc.) */ + SaHpiBoolT FactorsStatic; /* True if the sensor factors + are static. If false + factors vary over sensor + range, and are not + accessible through HPI */ + SaHpiSensorFactorsT Factors; + SaHpiBoolT Percentage; /* Is value a percentage */ + SaHpiSensorRangeT Range; /* Valid range of sensor */ +} SaHpiSensorDataFormatT; + +/* +** Threshold Support +** +** These types define what threshold values are readable, writable, and fixed. +** It also defines how the threshold values are read and written. +*/ +typedef SaHpiUint8T SaHpiSensorThdMaskT; +#define SAHPI_STM_LOW_MINOR (SaHpiSensorThdMaskT)0x01 +#define SAHPI_STM_LOW_MAJOR (SaHpiSensorThdMaskT)0x02 +#define SAHPI_STM_LOW_CRIT (SaHpiSensorThdMaskT)0x04 +#define SAHPI_STM_UP_MINOR (SaHpiSensorThdMaskT)0x08 +#define SAHPI_STM_UP_MAJOR (SaHpiSensorThdMaskT)0x10 +#define SAHPI_STM_UP_CRIT (SaHpiSensorThdMaskT)0x20 +#define SAHPI_STM_UP_HYSTERESIS (SaHpiSensorThdMaskT)0x40 +#define SAHPI_STM_LOW_HYSTERESIS (SaHpiSensorThdMaskT)0x80 + +typedef SaHpiUint8T SaHpiSensorThdCapT; +#define SAHPI_STC_RAW (SaHpiSensorThdMaskT)0x01 /* read/write as + raw counts */ +#define SAHPI_STC_INTERPRETED (SaHpiSensorThdMaskT)0x02 /* read/write as + interpreted */ + +typedef struct { + SaHpiBoolT IsThreshold; /* True if the sensor + supports thresholds. If false, + rest of structure is not + meaningful. */ + SaHpiSensorThdCapT TholdCapabilities; + SaHpiSensorThdMaskT ReadThold; /* Readable thresholds */ + SaHpiSensorThdMaskT WriteThold; /* Writable thresholds */ + SaHpiSensorThdMaskT FixedThold; /* Fixed thresholds */ +} SaHpiSensorThdDefnT; + +/* +** Event Control +** +** This type defines how sensor event messages can be controlled (can be turned +** off and on for each type of event, etc.). +*/ +typedef enum { + SAHPI_SEC_PER_EVENT = 0, /* Event message control per event */ + SAHPI_SEC_ENTIRE_SENSOR, /* Control for entire sensor only */ + SAHPI_SEC_GLOBAL_DISABLE, /* Global disable of events only */ + SAHPI_SEC_NO_EVENTS /* Events not supported */ +} SaHpiSensorEventCtrlT; + +/* +** Record +** +** This is the sensor resource data record which describes all of the static +** data associated with a sensor. +*/ +typedef struct { + SaHpiSensorNumT Num; /* Sensor Number/Index */ + SaHpiSensorTypeT Type; /* General Sensor Type */ + SaHpiEventCategoryT Category; /* Event category */ + SaHpiSensorEventCtrlT EventCtrl; /* How events can be controlled */ + SaHpiEventStateT Events; /* Bit mask of event states + supported */ + SaHpiBoolT Ignore; /* Ignore sensor (entity not + present, disabled, etc.) */ + SaHpiSensorDataFormatT DataFormat; /* Format of the data */ + SaHpiSensorThdDefnT ThresholdDefn; /* Threshold Definition */ + SaHpiUint32T Oem; /* Reserved for OEM use */ +} SaHpiSensorRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Aggregate Status ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* These are the default sensor numbers for aggregate status. */ +#define SAHPI_DEFAGSENS_OPER (SaHpiSensorNumT)0xFE +#define SAHPI_DEFAGSENS_PWR (SaHpiSensorNumT)0xFD +#define SAHPI_DEFAGSENS_TEMP (SaHpiSensorNumT)0xFC + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Controls ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Control Number */ +typedef SaHpiUint8T SaHpiCtrlNumT; + +/* +** Type of Control +** +** This enumerated type defines the different types of generic controls. +*/ +typedef enum { + SAHPI_CTRL_TYPE_DIGITAL = 0x00, + SAHPI_CTRL_TYPE_DISCRETE, + SAHPI_CTRL_TYPE_ANALOG, + SAHPI_CTRL_TYPE_STREAM, + SAHPI_CTRL_TYPE_TEXT, + SAHPI_CTRL_TYPE_OEM = 0xC0 +} SaHpiCtrlTypeT; + +/* +** Control State Type Definitions +** +** Defines the types of control states. +*/ +typedef enum { + SAHPI_CTRL_STATE_OFF = 0, + SAHPI_CTRL_STATE_ON, + SAHPI_CTRL_STATE_PULSE_OFF, + SAHPI_CTRL_STATE_PULSE_ON, + SAHPI_CTRL_STATE_AUTO = 0xFF +} SaHpiCtrlStateDigitalT; + +typedef SaHpiUint32T SaHpiCtrlStateDiscreteT; + +typedef SaHpiInt32T SaHpiCtrlStateAnalogT; + +#define SAHPI_CTRL_MAX_STREAM_LENGTH 4 +typedef struct { + SaHpiBoolT Repeat; /* Repeat flag */ + SaHpiUint32T StreamLength; /* Length of the data, in bytes, + ** stored in the stream. */ + SaHpiUint8T Stream[SAHPI_CTRL_MAX_STREAM_LENGTH]; +} SaHpiCtrlStateStreamT; + +typedef SaHpiUint8T SaHpiTxtLineNumT; + +/* Reserved number for sending output to all lines */ +#define SAHPI_TLN_ALL_LINES (SaHpiTxtLineNumT)0xFF + +typedef struct { + SaHpiTxtLineNumT Line; /* Operate on line # */ + SaHpiTextBufferT Text; /* Text to display */ +} SaHpiCtrlStateTextT; + +#define SAHPI_CTRL_MAX_OEM_BODY_LENGTH 255 +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiUint8T BodyLength; + SaHpiUint8T Body[SAHPI_CTRL_MAX_OEM_BODY_LENGTH]; /* OEM Specific */ +} SaHpiCtrlStateOemT; + +typedef union { + SaHpiCtrlStateDigitalT Digital; + SaHpiCtrlStateDiscreteT Discrete; + SaHpiCtrlStateAnalogT Analog; + SaHpiCtrlStateStreamT Stream; + SaHpiCtrlStateTextT Text; + SaHpiCtrlStateOemT Oem; +} SaHpiCtrlStateUnionT; + +typedef struct { + SaHpiCtrlTypeT Type; /* Type of control */ + SaHpiCtrlStateUnionT StateUnion; /* Data for control type */ +} SaHpiCtrlStateT; + + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Control Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** Output Type +** +** This enumeration defines the what the control's output will be. +*/ +typedef enum { + SAHPI_CTRL_GENERIC = 0, + SAHPI_CTRL_LED, + SAHPI_CTRL_FAN_SPEED, + SAHPI_CTRL_DRY_CONTACT_CLOSURE, + SAHPI_CTRL_POWER_SUPPLY_INHIBIT, + SAHPI_CTRL_AUDIBLE, + SAHPI_CTRL_FRONT_PANEL_LOCKOUT, + SAHPI_CTRL_POWER_INTERLOCK, + SAHPI_CTRL_POWER_STATE, + SAHPI_CTRL_LCD_DISPLAY, + SAHPI_CTRL_OEM +} SaHpiCtrlOutputTypeT; + +/* +** Specific Record Types +** These types represent the specific types of control resource data records. +*/ +typedef struct { + SaHpiCtrlStateDigitalT Default; +} SaHpiCtrlRecDigitalT; + +typedef struct { + SaHpiCtrlStateDiscreteT Default; +} SaHpiCtrlRecDiscreteT; + +typedef struct { + SaHpiCtrlStateAnalogT Min; /* Minimum Value */ + SaHpiCtrlStateAnalogT Max; /* Maximum Value */ + SaHpiCtrlStateAnalogT Default; +} SaHpiCtrlRecAnalogT; + +typedef struct { + SaHpiCtrlStateStreamT Default; +} SaHpiCtrlRecStreamT; + +typedef struct { + SaHpiUint8T MaxChars; /* Maximum chars per line */ + SaHpiUint8T MaxLines; /* Maximum # of lines */ + SaHpiLanguageT Language; /* Language Code */ + SaHpiTextTypeT DataType; /* Permitted Data */ + SaHpiCtrlStateTextT Default; +} SaHpiCtrlRecTextT; + +#define SAHPI_CTRL_OEM_CONFIG_LENGTH 10 +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiUint8T ConfigData[SAHPI_CTRL_OEM_CONFIG_LENGTH]; + SaHpiCtrlStateOemT Default; +} SaHpiCtrlRecOemT; + +typedef union { + SaHpiCtrlRecDigitalT Digital; + SaHpiCtrlRecDiscreteT Discrete; + SaHpiCtrlRecAnalogT Analog; + SaHpiCtrlRecStreamT Stream; + SaHpiCtrlRecTextT Text; + SaHpiCtrlRecOemT Oem; +} SaHpiCtrlRecUnionT; + +/* +** Record Definition +** Definition of the control resource data record. +*/ +typedef struct { + SaHpiCtrlNumT Num; /* Control Number/Index */ + SaHpiBoolT Ignore; /* Ignore control (entity + not present, disabled, etc.) */ + SaHpiCtrlOutputTypeT OutputType; + SaHpiCtrlTypeT Type; /* Type of control */ + SaHpiCtrlRecUnionT TypeUnion; /* Specific control record */ + SaHpiUint32T Oem; /* Reserved for OEM use */ +} SaHpiCtrlRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Entity Inventory Data ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* +** These structures are used to read and write inventory data to entity inventory +** repositories within a resource. +*/ +/* +** Entity Inventory Repository ID +** Identifier for an entity inventory repository. +*/ +typedef SaHpiUint8T SaHpiEirIdT; +#define SAHPI_DEFAULT_INVENTORY_ID (SaHpiEirIdT)0x00 + +/* Data Validity */ +typedef enum { + SAHPI_INVENT_DATA_VALID, + SAHPI_INVENT_DATA_INVALID, + SAHPI_INVENT_DATA_OVERFLOW +} SaHpiInventDataValidityT; + +/* Inventory Record definitions */ +typedef enum { + SAHPI_INVENT_RECTYPE_INTERNAL_USE = 0xB0, + SAHPI_INVENT_RECTYPE_CHASSIS_INFO, + SAHPI_INVENT_RECTYPE_BOARD_INFO, + SAHPI_INVENT_RECTYPE_PRODUCT_INFO, + SAHPI_INVENT_RECTYPE_OEM = 0xC0 +} SaHpiInventDataRecordTypeT; + +typedef enum { + SAHPI_INVENT_CTYP_OTHER = 1, + SAHPI_INVENT_CTYP_UNKNOWN, + SAHPI_INVENT_CTYP_DESKTOP, + SAHPI_INVENT_CTYP_LOW_PROFILE_DESKTOP, + SAHPI_INVENT_CTYP_PIZZA_BOX, + SAHPI_INVENT_CTYP_MINI_TOWER, + SAHPI_INVENT_CTYP_TOWER, + SAHPI_INVENT_CTYP_PORTABLE, + SAHPI_INVENT_CTYP_LAPTOP, + SAHPI_INVENT_CTYP_NOTEBOOK, + SAHPI_INVENT_CTYP_HANDHELD, + SAHPI_INVENT_CTYP_DOCKING_STATION, + SAHPI_INVENT_CTYP_ALLINONE, + SAHPI_INVENT_CTYP_SUBNOTEBOOK, + SAHPI_INVENT_CTYP_SPACE_SAVING, + SAHPI_INVENT_CTYP_LUNCH_BOX, + SAHPI_INVENT_CTYP_MAIN_SERVER, + SAHPI_INVENT_CTYP_EXPANSION, + SAHPI_INVENT_CTYP_SUBCHASSIS, + SAHPI_INVENT_CTYP_BUS_EXPANSION_CHASSIS, + SAHPI_INVENT_CTYP_PERIPHERAL_CHASSIS, + SAHPI_INVENT_CTYP_RAID_CHASSIS, + SAHPI_INVENT_CTYP_RACKMOUNT +} SaHpiInventChassisTypeT; + +typedef struct { + SaHpiUint8T Data[1]; /* Variable length opaque data */ +} SaHpiInventInternalUseDataT; + +typedef struct { + SaHpiTimeT MfgDateTime; /* May be set to + SAHPI_TIME_UNSPECIFIED + if manufacturing + date/time not available */ + SaHpiTextBufferT *Manufacturer; + SaHpiTextBufferT *ProductName; + SaHpiTextBufferT *ProductVersion; + SaHpiTextBufferT *ModelNumber; + SaHpiTextBufferT *SerialNumber; + SaHpiTextBufferT *PartNumber; + SaHpiTextBufferT *FileId; + SaHpiTextBufferT *AssetTag; + SaHpiTextBufferT *CustomField[1]; /* Variable number of fields, + last is NULL */ +} SaHpiInventGeneralDataT; + +typedef struct { + SaHpiInventChassisTypeT Type; /* Type of chassis */ + SaHpiInventGeneralDataT GeneralData; +} SaHpiInventChassisDataT; + +typedef struct { + SaHpiManufacturerIdT MId;/* OEM Manuf. ID */ + SaHpiUint8T Data[1]; /* Variable length data, defined by OEM, + Length derived from DataLength in + SaHpiInventDataRecordT structure: + DataLength - 4(because DataLength + includes the MId) */ +} SaHpiInventOemDataT; + +typedef union { + SaHpiInventInternalUseDataT InternalUse; + SaHpiInventChassisDataT ChassisInfo; + SaHpiInventGeneralDataT BoardInfo; + SaHpiInventGeneralDataT ProductInfo; + SaHpiInventOemDataT OemData; +} SaHpiInventDataUnionT; + +typedef struct { + SaHpiInventDataRecordTypeT RecordType; + SaHpiUint32T DataLength; /* Length of Data field for + this record */ + SaHpiInventDataUnionT RecordData; /* Variable length data */ +} SaHpiInventDataRecordT; + +typedef struct { + SaHpiInventDataValidityT Validity; /* Indication as to whether data + Returned by + saHpiEntityInventoryDataRead() is + complete and valid. Unless this + flag indicates valid data, + saHpiEntityInventoryDataWrite() will + not take any actions except to + return an error.*/ + SaHpiInventDataRecordT *DataRecords[1]; /* Array of pointers to inventory + Data Records. Variable + number of entries. Last + entry is NULL. */ +} SaHpiInventoryDataT; + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Inventory Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** All inventory data contained in an entity inventory repository +** must be represented in the RDR repository +** with an SaHpiInventoryRecT. +*/ +typedef struct { + SaHpiEirIdT EirId; + SaHpiUint32T Oem; +} SaHpiInventoryRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Watchdogs ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** This section defines all of the data types associated with watchdog timers. +*/ + +/* Watchdog Number - Identifier for a watchdog timer. */ +typedef SaHpiUint8T SaHpiWatchdogNumT; +#define SAHPI_DEFAULT_WATCHDOG_NUM (SaHpiWatchdogNumT)0x00 + +/* +** Watchdog Timer Action +** +** These enumerations represent the possible actions to be taken upon watchdog +** timer timeout and the events that are generated for watchdog actions. +*/ +typedef enum { + SAHPI_WA_NO_ACTION = 0, + SAHPI_WA_RESET, + SAHPI_WA_POWER_DOWN, + SAHPI_WA_POWER_CYCLE +} SaHpiWatchdogActionT; + +typedef enum { + SAHPI_WAE_NO_ACTION = 0, + SAHPI_WAE_RESET, + SAHPI_WAE_POWER_DOWN, + SAHPI_WAE_POWER_CYCLE, + SAHPI_WAE_TIMER_INT=0x08 /* Used if Timer Preinterrupt only */ +} SaHpiWatchdogActionEventT; + +/* +** Watchdog Pre-timer Interrupt +** +** These enumerations represent the possible types of interrupts that may be +** triggered by a watchdog pre-timer event. The actual meaning of these +** operations may differ depending on the hardware architecture. +*/ +typedef enum { + SAHPI_WPI_NONE = 0, + SAHPI_WPI_SMI, + SAHPI_WPI_NMI, + SAHPI_WPI_MESSAGE_INTERRUPT, + SAHPI_WPI_OEM = 0x0F +} SaHpiWatchdogPretimerInterruptT; + +/* +** Watchdog Timer Use +** +** These enumerations represent the possible watchdog users that may have caused +** the watchdog to expire. For instance, if watchdog is being used during power +** on self test (POST), and it expires, the SAHPI_WTU_BIOS_POST expiration type +** will be set. Most specific uses for Watchdog timer by users of HPI should +** indicate SAHPI_WTU_SMS_OS if the use is to provide an OS-healthy heartbeat, +** or SAHPI_WTU_OEM if it is used for some other purpose. +*/ +typedef enum { + SAHPI_WTU_NONE = 0, + SAHPI_WTU_BIOS_FRB2, + SAHPI_WTU_BIOS_POST, + SAHPI_WTU_OS_LOAD, + SAHPI_WTU_SMS_OS, /* System Management System providing + heartbeat for OS */ + SAHPI_WTU_OEM, + SAHPI_WTU_UNSPECIFIED = 0x0F +} SaHpiWatchdogTimerUseT; + +/* +** Timer Use Expiration Flags +** These values are used for the Watchdog Timer Use Expiration flags in the +** SaHpiWatchdogT structure. +*/ +typedef SaHpiUint8T SaHpiWatchdogExpFlagsT; +#define SAHPI_WATCHDOG_EXP_BIOS_FRB2 (SaHpiWatchdogExpFlagsT)0x02 +#define SAHPI_WATCHDOG_EXP_BIOS_POST (SaHpiWatchdogExpFlagsT)0x04 +#define SAHPI_WATCHDOG_EXP_OS_LOAD (SaHpiWatchdogExpFlagsT)0x08 +#define SAHPI_WATCHDOG_EXP_SMS_OS (SaHpiWatchdogExpFlagsT)0x10 +#define SAHPI_WATCHDOG_EXP_OEM (SaHpiWatchdogExpFlagsT)0x20 + +/* +** Watchdog Structure +** +** This structure is used by the saHpiWatchdogTimerGet() and +** saHpiWatchdogTimerSet() functions. The use of the structure varies slightly by +** each function. +** +** For saHpiWatchdogTimerGet() : +** +** Log - indicates whether or not the Watchdog is configured to +** issue an event when it next times out. TRUE=event will +** be issued on timeout. +** Running - indicates whether or not the Watchdog is currently +** running or stopped. TRUE=Watchdog is running. +** TimerUse - indicates the current use of the timer; one of five +** preset uses which was included on the last +** saHpiWatchdogTimerSet() function call, or through some +** other implementation-dependent means to start the +** Watchdog timer. +** TimerAction - indicates what action will be taken when the Watchdog +** times out. +** PretimerInterrupt - indicates which action will be taken +** "PreTimeoutInterval" seconds prior to Watchdog timer +** expiration. +** PreTimeoutInterval - indicates how many milliseconds prior to timer time +** out the PretimerInterrupt action will be taken. If +** "PreTimeoutInterval" = 0, the PretimerInterrupt action +** will occur concurrently with "TimerAction." HPI +** implementations may not be able to support millisecond +** resolution and may have a maximum value restriction. +** These restrictions should be documented by the +** provider of the HPI interface. +** TimerUseExpFlags - set of five bit flags which indicate that a Watchdog +** timer timeout has occurred while the corresponding +** TimerUse value was set. Once set, these flags stay +** set until specifically cleared with a +** saHpiWatchdogTimerSet() call, or by some other +** implementation-dependent means. +** InitialCount - The time, in milliseconds, before the timer will time +** out after a saHpiWatchdogTimerReset() function call is +** made, or some other implementation-dependent strobe is +** sent to the Watchdog. HPI implementations may not be +** able to support millisecond resolution and may have a +** maximum value restriction. These restrictions should +** be documented by the provider of the HPI interface. +** PresentCount - The remaining time in milliseconds before the timer +** will time out unless a saHpiWatchdogTimerReset() +** function call is made, or some other implementation- +** dependent strobe is sent to the Watchdog. +** HPI implementations may not be able to support +** millisecond resolution on watchdog timers, but will +** return the number of clock ticks remaining times the +** number of milliseconds between each tick. +** +** For saHpiWatchdogTimerSet(): +** +** Log - indicates whether or not the Watchdog should issue +** an event when it next times out. TRUE=event will be +** issued on timeout. +** Running - indicates whether or not the Watchdog should be +** stopped before updating. +** TRUE = Watchdog is not stopped. If it is already +** stopped, it will remain stopped, but if it is +** running, it will continue to run, with the +** countdown timer reset to the new InitialCount. +** Note that there is a race condition possible +** with this setting, so it should be used with +** care. +** FALSE = Watchdog is stopped. After +** saHpiWatchdogTimerSet() is called, a subsequent +** call to saHpiWatchdogTimerReset() is required to +** start the timer. +** TimerUse - indicates the current use of the timer. Will control +** which TimerUseExpFlag is set if the timer expires. +** TimerAction - indicates what action will be taken when the Watchdog +** times out. +** PretimerInterrupt - indicates which action will be taken +** "PreTimeoutInterval" seconds prior to Watchdog timer +** expiration. +** PreTimeoutInterval - indicates how many milliseconds prior to timer time +** out the PretimerInterrupt action will be taken. If +** "PreTimeoutInterval" = 0, the PretimerInterrupt action +** will occur concurrently with "TimerAction." HPI +** implementations may not be able to support millisecond +** resolution and may have a maximum value restriction. +** These restrictions should be documented by the +** provider of the HPI interface. +** TimerUseExpFlags - Set of five bit flags corresponding to the five +** TimerUse values. For each bit set, the corresponding +** Timer Use Expiration Flag will be CLEARED. Generally, +** a program should only clear the Timer Use Expiration +** Flag corresponding to its own TimerUse, so that other +** software, which may have used the timer for another +** purpose in the past can still read its TimerUseExpFlag +** to determine whether or not the timer expired during +** that use. +** InitialCount - The time, in milliseconds, before the timer will time +** out after a saHpiWatchdogTimerReset() function call is +** made, or some other implementation-dependent strobe is +** sent to the Watchdog. HPI implementations may not be +** able to support millisecond resolution and may have a +** maximum value restriction. These restrictions should +** be documented by the provider of the HPI interface. +** PresentCount - Not used on saHpiWatchdogTimerSet() function. Ignored. +** +*/ + +typedef struct { + SaHpiBoolT Log; + SaHpiBoolT Running; + SaHpiWatchdogTimerUseT TimerUse; + SaHpiWatchdogActionT TimerAction; + SaHpiWatchdogPretimerInterruptT PretimerInterrupt; + SaHpiUint32T PreTimeoutInterval; + SaHpiWatchdogExpFlagsT TimerUseExpFlags; + SaHpiUint32T InitialCount; + SaHpiUint32T PresentCount; +} SaHpiWatchdogT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Watchdog Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** When the "Watchdog" capability is set in a resource, a watchdog with an +** identifier of SAHPI_DEFAULT_WATCHDOG_NUM is required. All watchdogs must be +** represented in the RDR repository with an SaHpiWatchdogRecT, including the +** watchdog with an identifier of SAHPI_DEFAULT_WATCHDOG_NUM. +*/ +typedef struct { + SaHpiWatchdogNumT WatchdogNum; + SaHpiUint32T Oem; +} SaHpiWatchdogRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Resource Data Record ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** The following describes the different types of records that exist within a +** RDR repository and the RDR super-structure to all of the specific RDR types +** (sensor, inventory data, watchdog, etc.). +*/ +typedef enum { + SAHPI_NO_RECORD, + SAHPI_CTRL_RDR, + SAHPI_SENSOR_RDR, + SAHPI_INVENTORY_RDR, + SAHPI_WATCHDOG_RDR +} SaHpiRdrTypeT; + +typedef union { + SaHpiCtrlRecT CtrlRec; + SaHpiSensorRecT SensorRec; + SaHpiInventoryRecT InventoryRec; + SaHpiWatchdogRecT WatchdogRec; +} SaHpiRdrTypeUnionT; + +typedef struct { + SaHpiEntryIdT RecordId; + SaHpiRdrTypeT RdrType; + SaHpiEntityPathT Entity; /* Entity to which this RDR relates. */ + SaHpiRdrTypeUnionT RdrTypeUnion; + SaHpiTextBufferT IdString; +} SaHpiRdrT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Hot Swap ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Power State */ +typedef enum { + SAHPI_HS_POWER_OFF = 0, + SAHPI_HS_POWER_ON, + SAHPI_HS_POWER_CYCLE +} SaHpiHsPowerStateT; + +/* Hot Swap Indicator State */ +typedef enum { + SAHPI_HS_INDICATOR_OFF = 0, + SAHPI_HS_INDICATOR_ON +} SaHpiHsIndicatorStateT; + +/* Hot Swap Action */ +typedef enum { + SAHPI_HS_ACTION_INSERTION = 0, + SAHPI_HS_ACTION_EXTRACTION +} SaHpiHsActionT; + +/* Hot Swap State */ +typedef enum { + SAHPI_HS_STATE_INACTIVE = 0, + SAHPI_HS_STATE_INSERTION_PENDING, + SAHPI_HS_STATE_ACTIVE_HEALTHY, + SAHPI_HS_STATE_ACTIVE_UNHEALTHY, + SAHPI_HS_STATE_EXTRACTION_PENDING, + SAHPI_HS_STATE_NOT_PRESENT +} SaHpiHsStateT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Events, Part 2 ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Event Data Structures */ + +/* +** Sensor Optional Data +** +** Sensor events may contain optional data items passed and stored with the +** event. If these optional data items are present, they will be included with +** the event data returned in response to a saHpiEventGet() or +** saHpiEventLogEntryGet() function call. Also, the optional data items may be +** included with the event data passed to the saHpiEventLogEntryAdd() function. +** +** Specific implementations of HPI may have restrictions on how much data may +** be passed to saHpiEventLogEntryAdd(). These restrictions should be documented +** by the provider of the HPI interface. +*/ +typedef enum { + SAHPI_CRITICAL = 0, + SAHPI_MAJOR, + SAHPI_MINOR, + SAHPI_INFORMATIONAL, + SAHPI_OK, + SAHPI_DEBUG = 0xF0 +} SaHpiSeverityT; + +typedef SaHpiUint8T SaHpiSensorOptionalDataT; + +#define SAHPI_SOD_TRIGGER_READING (SaHpiSensorOptionalDataT)0x01 +#define SAHPI_SOD_TRIGGER_THRESHOLD (SaHpiSensorOptionalDataT)0x02 +#define SAHPI_SOD_OEM (SaHpiSensorOptionalDataT)0x04 +#define SAHPI_SOD_PREVIOUS_STATE (SaHpiSensorOptionalDataT)0x08 +#define SAHPI_SOD_SENSOR_SPECIFIC (SaHpiSensorOptionalDataT)0x10 + +typedef struct { + SaHpiSensorNumT SensorNum; + SaHpiSensorTypeT SensorType; + SaHpiEventCategoryT EventCategory; + SaHpiBoolT Assertion; /* TRUE = Event State asserted + FALSE = deasserted */ + SaHpiEventStateT EventState; /* State being asserted + deasserted */ + SaHpiSensorOptionalDataT OptionalDataPresent; + SaHpiSensorReadingT TriggerReading; /* Reading that triggered + the event */ + SaHpiSensorReadingT TriggerThreshold; + SaHpiEventStateT PreviousState; + SaHpiUint32T Oem; + SaHpiUint32T SensorSpecific; +} SaHpiSensorEventT; + +typedef struct { + SaHpiHsStateT HotSwapState; + SaHpiHsStateT PreviousHotSwapState; +} SaHpiHotSwapEventT; + +typedef struct { + SaHpiWatchdogNumT WatchdogNum; + SaHpiWatchdogActionEventT WatchdogAction; + SaHpiWatchdogPretimerInterruptT WatchdogPreTimerAction; + SaHpiWatchdogTimerUseT WatchdogUse; +} SaHpiWatchdogEventT; + +#define SAHPI_OEM_EVENT_DATA_SIZE 32 +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiUint8T OemEventData[SAHPI_OEM_EVENT_DATA_SIZE]; +} SaHpiOemEventT; + +/* +** User events may be used for storing custom events created by the application / middleware; +** eg. when injecting events into the event log using saHpiEventLogEntryAdd(). +*/ +#define SAHPI_USER_EVENT_DATA_SIZE 32 +typedef struct { + SaHpiUint8T UserEventData[SAHPI_USER_EVENT_DATA_SIZE]; +} SaHpiUserEventT; + +typedef enum { + SAHPI_ET_SENSOR, + SAHPI_ET_HOTSWAP, + SAHPI_ET_WATCHDOG, + SAHPI_ET_OEM, + SAHPI_ET_USER +} SaHpiEventTypeT; + +typedef union { + SaHpiSensorEventT SensorEvent; + SaHpiHotSwapEventT HotSwapEvent; + SaHpiWatchdogEventT WatchdogEvent; + SaHpiOemEventT OemEvent; + SaHpiUserEventT UserEvent; +} SaHpiEventUnionT; + +typedef struct { + SaHpiResourceIdT Source; + SaHpiEventTypeT EventType; + SaHpiTimeT Timestamp; + SaHpiSeverityT Severity; + SaHpiEventUnionT EventDataUnion; +} SaHpiEventT; + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Parameter Control ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +typedef enum { + SAHPI_DEFAULT_PARM = 0, + SAHPI_SAVE_PARM, + SAHPI_RESTORE_PARM +} SaHpiParmActionT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Reset ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +typedef enum { + SAHPI_COLD_RESET = 0, + SAHPI_WARM_RESET, + SAHPI_RESET_ASSERT, + SAHPI_RESET_DEASSERT +} SaHpiResetActionT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Resource Presence Table ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* This section defines the types associated with the RPT. */ + +typedef struct { + SaHpiUint32T UpdateCount; /* This count is incremented any time the table + is changed. It rolls over to zero when the + maximum value is reached */ + SaHpiTimeT UpdateTimestamp; /* This time is set any time the table is + changed. If the implementation cannot + supply an absolute timestamp, then it may + supply a timestamp relative to some system- + defined epoch, such as system boot. The + value SAHPI_TIME_UNSPECIFIED indicates that + the time of the update cannot be determined. + Otherwise, If the value is less than or + equal to SAHPI_TIME_MAX_RELATIVE, then it + is relative; if it is greater than + SAHPI_TIME_MAX_RELATIVE, then it is absolute. */ +} SaHpiRptInfoT; + +/* +** Resource Info Type Definitions +** +** +** SaHpiResourceInfoT contains static configuration data concerning the +** management controller associated with the resource, or the resource itself. +** Note this information is used to describe the resource; that is, the piece of +** infrastructure which manages an entity (or multiple entities) - NOT the entities +** for which the resource provides management. The purpose of the +** SaHpiResourceInfoT structure is to provide information that the HPI user may +** need in order to interact correctly with the resource (e.g., recognize a +** specific management controller which may have defined OEM fields in sensors, +** OEM controls, etc.). +** +** All of the fields in the following structure may or may not be used by a +** given resource. +*/ +typedef struct { + SaHpiUint8T ResourceRev; + SaHpiUint8T SpecificVer; + SaHpiUint8T DeviceSupport; + SaHpiManufacturerIdT ManufacturerId; + SaHpiUint16T ProductId; + SaHpiUint8T FirmwareMajorRev; + SaHpiUint8T FirmwareMinorRev; + SaHpiUint8T AuxFirmwareRev; +} SaHpiResourceInfoT; + +/* +** Resource Capabilities +** +** This definition defines the capabilities of a given resource. One resource +** may support any number of capabilities using the bit mask. Every resource +** must set at least one of these capabilities; ie. zero is not a valid value +** for a resource's capabilities. +** +** SAHPI_CAPABILITY_DOMAIN +** SAHPI_CAPABILITY_RESOURCE +** SAHPI_CAPABILITY_EVT_DEASSERTS +** Indicates that all sensors on the resource have the property that their +** Assertion and Deassertion event enable flags are the same. That is, +** for all event states whose assertion triggers an event, it is +** guaranteed that the deassertion of that event will also +** trigger an event. Thus, the user may track the state of sensors on the +** resource by monitoring events rather than polling for state changes. +** SAHPI_CAPABILITY_AGGREGATE_STATUS +** SAHPI_CAPABILITY_CONFIGURATION +** SAHPI_CAPABILITY_MANAGED_HOTSWAP +** Indicates that the resource supports managed hotswap. Since hotswap only +** makes sense for field-replaceable units, the SAHPI_CAPABILITY_FRU +** capability bit must also be set for this resource. +** SAHPI_CAPABILITY_WATCHDOG +** SAHPI_CAPABILITY_CONTROL +** SAHPI_CAPABILITY_FRU +** Indicates that the resource is a field-replaceable unit; i.e., it is +** capable of being removed and replaced in a live system. This does not +** necessarily imply that the resource supports managed hotswap. +** SAHPI_CAPABILITY_INVENTORY_DATA +** SAHPI_CAPABILITY_SEL +** SAHPI_CAPABILITY_RDR +** Indicates that a resource data record (RDR) repository is supplied +** by the resource. Since the existence of an RDR is mandatory, this +** capability must be asserted. +** SAHPI_CAPABILITY_SENSOR +*/ + +typedef SaHpiUint32T SaHpiCapabilitiesT; +#define SAHPI_CAPABILITY_DOMAIN (SaHpiCapabilitiesT)0x80000000 +#define SAHPI_CAPABILITY_RESOURCE (SaHpiCapabilitiesT)0X40000000 +#define SAHPI_CAPABILITY_EVT_DEASSERTS (SaHpiCapabilitiesT)0x00008000 +#define SAHPI_CAPABILITY_AGGREGATE_STATUS (SaHpiCapabilitiesT)0x00002000 +#define SAHPI_CAPABILITY_CONFIGURATION (SaHpiCapabilitiesT)0x00001000 +#define SAHPI_CAPABILITY_MANAGED_HOTSWAP (SaHpiCapabilitiesT)0x00000800 +#define SAHPI_CAPABILITY_WATCHDOG (SaHpiCapabilitiesT)0x00000400 +#define SAHPI_CAPABILITY_CONTROL (SaHpiCapabilitiesT)0x00000200 +#define SAHPI_CAPABILITY_FRU (SaHpiCapabilitiesT)0x00000100 +#define SAHPI_CAPABILITY_INVENTORY_DATA (SaHpiCapabilitiesT)0x00000008 +#define SAHPI_CAPABILITY_SEL (SaHpiCapabilitiesT)0x00000004 +#define SAHPI_CAPABILITY_RDR (SaHpiCapabilitiesT)0x00000002 +#define SAHPI_CAPABILITY_SENSOR (SaHpiCapabilitiesT)0x00000001 + +/* +** RPT Entry +** +** This structure is used to store the RPT entry information. +** +** The ResourceCapabilities field definies the capabilities of the resource. +** This field must be non-zero for all valid resources. +** +** The ResourceTag field is an informational value that supplies the caller with naming +** information for the resource. This should be set to the "user-visible" name for a +** resource, which can be used to identify the resource in messages to a human operator. +** For example, it could be set to match a physical printed label attached to the primary +** entity which the resource manages. See section 5.2.6, saHpiResourceTagSet(), on page 33. +*/ +typedef struct { + SaHpiEntryIdT EntryId; + SaHpiResourceIdT ResourceId; + SaHpiResourceInfoT ResourceInfo; + SaHpiEntityPathT ResourceEntity; /* If resource manages a FRU, entity path of the FRU */ + /* If resource manages a single entity, entity path of + that entity. */ + /* If resource manages multiple entities, the + entity path of the "primary" entity managed by the + resource */ + /* Must be set to the same value in every domain which + contains this resource */ + SaHpiCapabilitiesT ResourceCapabilities; /* Must be non-0. */ + SaHpiSeverityT ResourceSeverity; /* Indicates the criticality that + should be raised when the resource + is not responding */ + SaHpiDomainIdT DomainId; /* The Domain ID is used when the resource + is also a domain. */ + SaHpiTextBufferT ResourceTag; +} SaHpiRptEntryT; + + + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** System Event Log ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* This section defines the types associated with the SEL. */ +/* +** Event Log Information +** +** The Entries entry denotes the number of active entries contained in the log. +** The Size entry denotes the total number of entries the log is able to hold. +** The UpdateTimestamp entry denotes the timestamp of the last addition, +** deletion or log clear operation. +** The CurrentTime entry denotes the log's idea of the current time; i.e the +** timestamp that would be placed on an entry if it was added now. +** The Enabled entry indicates whether the log is enabled. If the event log +** is "disabled" no events generated within the HPI implementation will be +** added to the event log. Events may still be added to the event log with +** the saHpiEventLogEntryAdd() function. When the event log is "enabled" +** events may be automatically added to the event log as they are generated +** in a resource or a domain, however, it is implementation-specific which +** events are automatically added to any event log. +** The OverflowFlag entry indicates the log has overflowed. Events have been +** dropped or overwritten due to a table overflow. +** The OverflowAction entry indicates the behavior of the SEL when an overflow +** occurs. +** The DeleteEntrySupported indicates whether the delete command is supported for +** event log entries. Note that clearing an entire log is valid even if this +** flag is not set. +*/ +typedef enum { + SAHPI_SEL_OVERFLOW_DROP, /* New entries are dropped when log is full*/ + SAHPI_SEL_OVERFLOW_WRAP, /* Log wraps when log is full */ + SAHPI_SEL_OVERFLOW_WRITELAST /* Last entry overwritten when log is full */ +} SaHpiSelOverflowActionT; + +typedef struct { + SaHpiUint32T Entries; + SaHpiUint32T Size; + SaHpiTimeT UpdateTimestamp; + SaHpiTimeT CurrentTime; + SaHpiBoolT Enabled; + SaHpiBoolT OverflowFlag; + SaHpiSelOverflowActionT OverflowAction; + SaHpiBoolT DeleteEntrySupported; +} SaHpiSelInfoT; +/* +** Event Log Entry +** These types define the event log entry. +*/ +typedef SaHpiUint32T SaHpiSelEntryIdT; +/* Reserved values for event log entry IDs */ +#define SAHPI_OLDEST_ENTRY (SaHpiSelEntryIdT)0x00000000 +#define SAHPI_NEWEST_ENTRY (SaHpiSelEntryIdT)0xFFFFFFFF +#define SAHPI_NO_MORE_ENTRIES (SaHpiSelEntryIdT)0xFFFFFFFE + + + +typedef struct { + SaHpiSelEntryIdT EntryId; /* Entry ID for record */ + SaHpiTimeT Timestamp; /* Time at which the event was placed + in the event log. The value + SAHPI_TIME_UNSPECIFIED indicates that + the time of the event cannot be + determined; otherwise, if less than + or equal to SAHPI_TIME_MAX_RELATIVE, + then it relative; if it is greater than + SAHPI_TIME_MAX_RELATIVE, then it is absolute. */ + SaHpiEventT Event; /* Logged Event */ +} SaHpiSelEntryT; + + + + + +/******************************************************************************* +** +** Name: saHpiInitialize +** +** Description: +** This function allows the management service an opportunity to perform +** platform-specific initialization. saHpiInitialize() must be called +** before any other functions are called. +** +** Parameters: +** HpiImplVersion - [out] Pointer to the version of the HPI +** implementation. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_DUPLICATE is returned when the HPI has already +** been initialized. Once one saHpiInitialize() call has been made, +** another one cannot be made until after a saHpiFinalize() call is made. +** +** +** Remarks: +** This function returns the version of the HPI implementation. Note: If +** the HPI interface version is needed it can be retrieved from the +** SAHPI_INTERFACE_VERSION definition. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiInitialize( + SAHPI_OUT SaHpiVersionT *HpiImplVersion +); + + +/******************************************************************************* +** +** Name: saHpiFinalize +** +** Description: +** This function allows the management service an opportunity to perform +** platform-specific cleanup. All sessions should be closed (see +** saHpiSessionClose()), before this function is executed. All open +** sessions will be forcibly closed upon execution of this command. +** +** Parameters: +** None. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. 5 Domains +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiFinalize ( +); + + +/******************************************************************************* +** +** Name: saHpiSessionOpen +** +** Description: +** This function opens a HPI session for a given domain and set of +** security characteristics (future). This function call assumes that a +** pre-arranged agreement between caller and the HPI implementation +** identifies the resources within the specified domain. As a future +** roadmap item, functions for discovery of domains and allocation of +** resources within domains may be developed. +** +** Parameters: +** DomainId - [in] Domain ID to be controlled by middleware/application. +** A domain ID of SAHPI_DEFAULT_DOMAIN_ID indicates the default domain. +** SessionId - [out] Pointer to a location to store a handle to the newly +** opened session. This handle is used for subsequent access to domain +** resources and events. +** SecurityParams - [in] Pointer to security and permissions data +** structure. This parameter is reserved for future use, and must be set +** to NULL. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_INVALID_DOMAIN is returned if no domain +** matching the specified domain ID exists. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSessionOpen ( + SAHPI_IN SaHpiDomainIdT DomainId, + SAHPI_OUT SaHpiSessionIdT *SessionId, + SAHPI_IN void *SecurityParams +); + + +/******************************************************************************* +** +** Name: saHpiSessionClose +** +** Description: +** This function closes a HPI session. After closing a session, the +** session ID will no longer be valid. +** +** Parameters: +** SessionId - [in] Session handle previously obtained using +** saHpiSessionOpen(). +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSessionClose ( + SAHPI_IN SaHpiSessionIdT SessionId +); + + +/******************************************************************************* +** +** Name: saHpiResourcesDiscover +** +** Description: +** This function requests the underlying management service to discover +** information about the resources it controls for the domain associated +** with the open session. This function may be called during operation to +** regenerate the RPT table. For those FRUs that must be discovered by +** polling, latency between FRU insertion and actual addition of the +** resource associated with that FRU to the RPT exists. To overcome this +** latency, a discovery of all present resources may be forced by calling +** saHpiResourcesDiscover (). +** +** Parameters: +** SessionId - [in] Handle to session context. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourcesDiscover ( + SAHPI_IN SaHpiSessionIdT SessionId +); + + +/******************************************************************************* +** +** Name: saHpiRptInfoGet +** +** Description: +** This function is used for requesting information about the resource +** presence table (RPT) such as an update counter and timestamp. This is +** particularly useful when using saHpiRptEntryGet() (see page 31). +** +** Parameters: +** SessionId - [in] Handle to session context. +** RptInfo - [out] Pointer to the information describing the resource +** presence table. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRptInfoGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiRptInfoT *RptInfo +); + + +/******************************************************************************* +** +** Name: saHpiRptEntryGet +** +** Description: +** This function retrieves resource information for the specified entry +** of the resource presence table. This function allows the caller to +** read the RPT entry-by-entry. If the EntryID parameter is set to +** SAHPI_FIRST_ENTRY, the first entry in the RPT will be returned. When +** an entry is successfully retrieved, *NextEntryID will be set to the +** ID of the next valid entry; however, when the last entry has been +** retrieved, *NextEntryID will be set to SAHPI_LAST_ENTRY. To retrieve +** an entire list of entries, call this function first with an EntryID of +** SAHPI_FIRST_ENTRY and then use the returned NextEntryID in the next +** call. Proceed until the NextEntryID returned is SAHPI_LAST_ENTRY. At +** initialization, the user may not wish to turn on eventing, since the +** context of the events, as provided by the RPT, is not known. In this +** instance, if a FRU is inserted into the system while the RPT is being +** read entry by entry, the resource associated with that FRU may be +** missed. (Keep in mind that there is no specified ordering for the RPT +** entries.) The update counter provides a means for insuring that no +** resources are missed when stepping through the RPT. In order to use +** this feature, the user should invoke saHpiRptInfoGet(), and get the +** update counter value before retrieving the first RPT entry. After +** reading the last entry, the user should again invoke the +** saHpiRptInfoGet() to get the update counter value. If the update +** counter has not been incremented, no new records have been added. +** +** Parameters: +** SessionId - [in] Handle to session context. +** EntryId - [in] Handle of the entry to retrieve from the RPT. Reserved +** entry ID values: SAHPI_FIRST_ENTRY Get first entry SAHPI_LAST_ENTRY +** Reserved as delimiter for end of list. Not a valid entry identifier. +** +** NextEntryId - [out] Pointer to location to store the record ID of next +** entry in RPT. +** RptEntry - [out] Pointer to the structure to hold the returned RPT +** entry. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRptEntryGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEntryIdT *NextEntryId, + SAHPI_OUT SaHpiRptEntryT *RptEntry +); + + +/******************************************************************************* +** +** Name: saHpiRptEntryGetByResourceId +** +** Description: +** This function retrieves resource information from the resource +** presence table for the specified resource using its resource ID. +** Typically at start-up, the RPT is read entry-by-entry, using +** saHpiRptEntryGet(). From this, the caller can establish the set of +** resource IDs to use for future calls to the HPI functions. However, +** there may be other ways of learning resource IDs without first reading +** the RPT. For example, resources may be added to the domain while the +** system is running in response to a hot-swap action. When a resource is +** added, the application will receive a hot-swap event containing the +** resource ID of the new resource. The application may then want to +** search the RPT for more detailed information on the newly added +** resource. In this case, the resource ID can be used to locate the +** applicable RPT entry information. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource whose RPT entry should +** be returned. +** RptEntry - [out] Pointer to structure to hold the returned RPT entry. +** +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRptEntryGetByResourceId ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiRptEntryT *RptEntry +); + + +/******************************************************************************* +** +** Name: saHpiResourceSeveritySet +** +** Description: +** This function allows the caller to set the severity level applied to +** an event issued if a resource unexpectedly becomes unavailable to the +** HPI. A resource may become unavailable for several reasons including: +** ? The FRU associated with the resource is no longer present in the +** system (a surprise extraction has occurred) ? A catastrophic failure +** has occurred Typically, the HPI implementation will provide an +** appropriate default value for this parameter, which may vary by +** resource; management software can override this default value by use +** of this function ? If a resource is removed from, then re-added to the +** RPT (e.g., because of a hot-swap action), the HPI implementation may +** reset the value of this parameter. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource for which the severity +** level will be set. +** Severity - [in] Severity level of event issued when the resource +** unexpectedly becomes unavailable to the HPI. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceSeveritySet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSeverityT Severity +); + + +/******************************************************************************* +** +** Name: saHpiResourceTagSet +** +** Description: +** This function allows the caller to set the resource tag for a +** particular resource. The resource tag is an informational value that +** supplies the caller with naming information for the resource. This +** should be set to the "user-visible" name for a resource, which can be +** used to identify the resource in messages to a human operator. For +** example, it could be set to match a physical, printed label attached +** to the entity associated with the resource. Typically, the HPI +** implementation will provide an appropriate default value for this +** parameter; this function is provided so that management software can +** override the default, if desired. The value of the resource tag may be +** retrieved from the resource's RPT entry. Note: If a resource is +** removed from, then re-added to the RPT (e.g., because of a hot-swap +** action), the HPI implementation may reset the value of this parameter. +** +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource for which the resource +** tag should be set. +** ResourceTag - [in] Pointer to string representing the resource tag. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceTagSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTextBufferT *ResourceTag +); + + +/******************************************************************************* +** +** Name: saHpiResourceIdGet +** +** Description: +** This function returns the resource ID of the resource associated with +** the entity upon which the caller is running. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [out] Pointer to location to hold the returned resource +** ID. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_NOT_PRESENT is returned if the entity the +** caller is running on is not manageable in the addressed domain. +** SA_ERR_HPI_UNKNOWN is returned if the domain controller cannot +** determine an appropriate response. That is, there may be an +** appropriate resource ID in the domain to return, but it cannot be +** determined. +** +** Remarks: +** This function must be issued within a session to a domain that +** includes a resource associated with the entity upon which the caller +** is running, or the SA_ERR_HPI_NOT_PRESENT return will be issued. Since +** entities are contained within other entities, there may be multiple +** possible resources that could be returned to this call. For example, +** if there is a resource ID associated with a particular compute blade +** upon which the caller is running, and another associated with the +** chassis which contains the compute blade, either could logically be +** returned as an indication of a resource associated with the entity +** upon which the caller was running. The function should return the +** resource ID of the "smallest" resource that is associated with the +** caller. So, in the example above, the function should return the +** resource ID of the compute blade. Once the function has returned the +** resourceID, the caller may issue further HPI calls using that +** resourceID to learn the type of resource that been identified. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceIdGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiResourceIdT *ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiEntitySchemaGet +** +** Description: +** This function returns the identifier of the Entity Schema for the HPI +** implementation. This schema defines valid Entity Paths that may be +** returned by the HPI implementation. +** +** Parameters: +** SessionId - [in] Handle to session context. +** SchemaId - [out] Pointer to the ID of the schema in use; zero +** indicates that a custom schema is in use. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** This function may be issued on any session opened to any domain in the +** system, and will return the same identifier. The identifier returned +** should either be zero, indicating that the HPI implementation uses a +** custom schema; or one of the schema identifiers defined in Appendix A, +** "Pre-Defined Entity Schemas," page 107. In the case of a custom +** schema, the HPI implementation may use arbitrary entity paths to +** describe resources in the system; in the case of a pre-defined schema, +** all entity paths should conform to the schema. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEntitySchemaGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiUint32T *SchemaId +); + + +/******************************************************************************* +** +** Name: saHpiEventLogInfoGet +** +** Description: +** This function retrieves the number of entries in the system event log, +** total size of the event log, timestamp for the most recent entry, the +** log's idea of the current time (i.e., timestamp that would be placed +** on an entry at this moment), enabled/disabled status of the log (see +** saHpiEventLogStateSet()), the overflow flag, the overflow action, and +** whether the log supports deletion of individual entries. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** Info - [out] Pointer to the returned SEL information. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogInfoGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiSelInfoT *Info +); + + +/******************************************************************************* +** +** Name: saHpiEventLogEntryGet +** +** Description: +** This function retrieves an event log entry from a system event log. +** The special entry IDs SAHPI_OLDEST_ENTRY and SAHPI_NEWEST_ENTRY are +** used to select the oldest and newest entries, respectively, in the log +** being read. A returned NextEntryID of SAHPI_NO_MORE_ENTRIES indicates +** that the newest entry has been returned; there are no more entries +** going forward (time-wise) in the log. A returned PrevEntryID of +** SAHPI_NO_MORE_ENTRIES indicates that the oldest entry has been +** returned. To retrieve an entire list of entries going forward (oldest +** entry to newest entry) in the log, call this function first with an +** EntryID of SAHPI_OLDEST_ENTRY and then use the returned NextEntryID as +** the EntryID in the next call. Proceed until the NextEntryID returned +** is SAHPI_NO_MORE_ENTRIES. To retrieve an entire list of entries going +** backward (newest entry to oldest entry) in the log, call this function +** first with an EntryID of SAHPI_NEWEST_ENTRY and then use the returned +** PrevEntryID as the EntryID in the next call. Proceed until the +** PrevEntryID returned is SAHPI_NO_MORE_ENTRIES. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be read. Set to SAHPI_DOMAIN_CONTROLLER_ID to address the +** domain system event log. +** EntryId - [in] Handle of the entry to retrieve from the SEL. Reserved +** event log entry ID values: SAHPI_OLDEST_ENTRY Oldest entry in the +** log. SAHPI_NEWEST_ENTRY Newest entry in the log. +** SAHPI_NO_MORE_ENTRIES Not valid for this parameter. Used only when +** retrieving the next and previous entry IDs. +** PrevEntryId - [out] Handle of previous (older adjacent) entry in event +** log. Reserved event log entry ID values: SAHPI_OLDEST_ENTRY Not valid +** for this parameter. Used only for the EntryID parameter. +** SAHPI_NEWEST_ENTRY Not valid for this parameter. Used only for the +** EntryID parameter. SAHPI_NO_MORE_ENTRIES No more entries in the log +** before the one referenced by the EntryId parameter. +** NextEntryId - [out] Handle of next (newer adjacent) entry in event +** log. Reserved event log entry ID values: SAHPI_OLDEST_ENTRY Not valid +** for this parameter. Used only for the EntryID parameter. +** SAHPI_NEWEST_ENTRY Not valid for this parameter. Used only for the +** EntryID parameter. SAHPI_NO_MORE_ENTRIES No more entries in the log +** after the one referenced by the EntryId parameter. +** EventLogEntry - [out] Pointer to retrieved event log entry. +** Rdr - [in/out] Pointer to structure to receive resource data record +** associated with the event, if available. If NULL, no RDR data will be +** returned. +** RptEntry - [in/out] Pointer to structure to receive RPT Entry +** associated with the event, if available. If NULL, no RPT entry data +** will be returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Event logs may include RPT entries and resource data records +** associated with the resource and sensor issuing an event along with +** the basic event data in the log. Because the system may be +** reconfigured after the event was entered in the log, this stored +** information may be important to interpret the event. If the event log +** includes logged RPT Entries and/or RDRs, and if the caller provides a +** pointer to a structure to receive this information, it will be +** returned along with the event log entry. If the caller provides a +** pointer for an RPT entry, but the event log does not include a logged +** RPT entry for the event being returned, RptEntry->ResourceCapabilities +** will be set to zero. No valid RPTEntry will have a zero value here. If +** the caller provides a pointer for an RDR, but the event log does not +** include a logged RDR for the event being returned, Rdr->RdrType will +** be set to SAHPI_NO_RECORD. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogEntryGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSelEntryIdT EntryId, + SAHPI_OUT SaHpiSelEntryIdT *PrevEntryId, + SAHPI_OUT SaHpiSelEntryIdT *NextEntryId, + SAHPI_OUT SaHpiSelEntryT *EventLogEntry, + SAHPI_INOUT SaHpiRdrT *Rdr, + SAHPI_INOUT SaHpiRptEntryT *RptEntry +); + + +/******************************************************************************* +** +** Name: saHpiEventLogEntryAdd +** +** Description: +** This function enables system management software to add entries to the +** system event log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the Domain System Event Log. +** EvtEntry - [in] Pointer to event log entry data to write to the system +** event log. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** This function forces a write of the event to the addressed event log. +** Nothing else is done with the event. Specific implementations of HPI +** may have restrictions on how much data may be passed to the +** saHpiEventLogEntryAdd() function. These restrictions should be +** documented by the provider of the HPI interface. If more event log +** data is provided than can be written, an error will be returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogEntryAdd ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSelEntryT *EvtEntry +); + + +/******************************************************************************* +** +** Name: saHpiEventLogEntryDelete +** +** Description: +** This function deletes an event log entry. This operation is only valid +** if so indicated by saHpiEventLogInfoGet(), via the +** DeleteEntrySupported field in the SaHpiSelInfoT structure. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] ResourceID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** EntryId - [in] Entry ID on the event log entry to delete. Reserved +** event log entry ID values: SAHPI_OLDEST_ENTRY - Oldest entry in the +** log. SAHPI_NEWEST_ENTRY - Newest entry in the log. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_INVALID_CMD is returned if this log does not +** support this operation. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogEntryDelete ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSelEntryIdT EntryId +); + + +/******************************************************************************* +** +** Name: saHpiEventLogClear +** +** Description: +** This function erases the contents of the specified system event log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] ResourceID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Note that all event logs must support the "clear" operation, +** regardless of the setting of the DeleteEntrySupported field in the +** SaHpiSelInfoT structure returned by saHpiEventLogInfoGet(). +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogClear ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiEventLogTimeGet +** +** Description: +** This function retrieves the current time from the event log's own time +** clock. The value of this clock is used to timestamp log entries +** written into the log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] ResourceID of the resource that contains the System +** Event Log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the Domain System Event Log. +** Time - [out] Pointer to the returned SEL current time. If the +** implementation cannot supply an absolute time value, then it may +** supply a time relative to some system-defined epoch, such as system +** boot. If the time value is less than or equal to +** SAHPI_TIME_MAX_RELATIVE, but not SAHPI_TIME_UNSPECIFIED, then it is +** relative; if it is greater than SAHPI_TIME_MAX_RELATIVE, then it is +** absolute. The value SAHPI_TIME_UNSPECIFIED indicates that the time is +** not set, or cannot be determined. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogTimeGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiTimeT *Time +); + + +/******************************************************************************* +** +** Name: saHpiEventLogTimeSet +** +** Description: +** This function sets the event log's time clock, which is used to +** timestamp events written into the log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be managed. set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** Time - [in] time to set the SEL clock to. If the implementation cannot +** supply an absolute time, then it may supply a time relative to some +** system-defined epoch, such as system boot. If the timestamp value is +** less than or equal to SAHPI_TIME_MAX_RELATIVE, but not +** SAHPI_TIME_UNSPECIFIED, then it is relative; if it is greater than +** SAHPI_TIME_MAX_RELATIVE, then it is absolute. The value +** SAHPI_TIME_UNSPECIFIED indicates that the time of the event cannot be +** determined. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogTimeSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTimeT Time +); + + +/******************************************************************************* +** +** Name: saHpiEventLogStateGet +** +** Description: +** This function enables system management software to get the event log +** state. If the event log is "disabled" no events generated within the +** HPI implementation will be added to the event log. Events may still be +** added to the event log with the saHpiEventLogEntryAdd() function. When +** the event log is "enabled" events may be automatically added to the +** event log as they are generated in a resource or a domain, however, it +** is implementation-specific which events are automatically added to any +** event log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] ResourceID of the resource that contains the System +** Event Log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the Domain System Event Log. +** Enable - [out] Pointer to the current SEL state. True indicates that +** the SEL is enabled; false indicates that it is disabled. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiBoolT *Enable +); + + +/******************************************************************************* +** +** Name: saHpiEventLogStateSet +** +** Description: +** This function enables system management software to set the event log +** enabled state. If the event log is "disabled" no events generated +** within the HPI implementation will be added to the event log. Events +** may still be added to the event log using the saHpiEventLogEntryAdd() +** function. When the event log is "enabled" events may be automatically +** added to the event log as they are generated in a resource or a +** domain. The actual set of events that are automatically added to any +** event log is implementation-specific. Typically, the HPI +** implementation will provide an appropriate default value for this +** parameter, which may vary by resource. This function is provided so +** that management software can override the default, if desired. Note: +** If a resource hosting an event log is re-initialized (e.g., because of +** a hot-swap action), the HPI implementation may reset the value of this +** parameter. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** Enable - [in] SEL state to be set. True indicates that the SEL is to +** be enabled; false indicates that it is to be disabled. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiBoolT Enable +); + + +/******************************************************************************* +** +** Name: saHpiSubscribe +** +** Description: +** This function allows the caller to subscribe for session events. This +** single call provides subscription to all session events, regardless of +** event type or event severity. Only one subscription is allowed per +** session, and additional subscribers will receive an appropriate error +** code. No event filtering will be done by the underlying management +** service. +** +** Parameters: +** SessionId - [in] Session for which event subscription will be opened. +** ProvideActiveAlarms - [in] Indicates whether or not alarms which are +** active at the time of subscription should be queued for future +** retrieval via the saHpiEventGet() function. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_DUPLICATE is returned when a subscription is +** already in place for this session. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSubscribe ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiBoolT ProvideActiveAlarms +); + + +/******************************************************************************* +** +** Name: saHpiUnsubscribe +** +** Description: +** This function removes the event subscription for the session. After +** removal of a subscription, additional saHpiEventGet() calls will not +** be allowed unless the caller re-subscribes for events first. Any +** events that are still in the event queue when this function is called +** will be cleared from it. +** +** Parameters: +** SessionId - [in] Session for which event subscription will be closed. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_INVALID_REQUEST is returned if the caller is +** not currently subscribed for events in this session. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiUnsubscribe ( + SAHPI_IN SaHpiSessionIdT SessionId +); + + +/******************************************************************************* +** +** Name: saHpiEventGet +** +** Description: +** This function allows the caller to get an event. This call is only +** valid within a session, which has subscribed for events. If the +** ProvideActiveAlarms parameter was set in the subscription, the first +** events retrieved will reflect the state of currently active alarms for +** the resources belonging to the domain. After all active alarms are +** retrieved this function will begin returning newly generated events as +** the domain controller receives them. If there are one or more events +** on the event queue when this function is called, it will immediately +** return the next event on the queue. Otherwise, if the Timeout +** parameter is SAHPI_TIMEOUT_IMMEDIATE, it will return +** SA_ERR_HPI_TIMEOUT immediately. Otherwise, it will block for a time +** specified by the timeout parameter; if an event is added to the queue +** within that time, it will be returned immediately; if not, +** saHpiEventGet() will return SA_ERR_HPI_TIMEOUT. If the Timeout +** parameter is SAHPI_TIMEOUT_BLOCK, then saHpiEventGet() will block +** indefinitely, until an event becomes available, and then return that +** event. This provides for notification of events as they occur. +** +** Parameters: +** SessionId - [in] Session for which events are retrieved. +** Timeout - [in] The number of nanoseconds to wait for an event to +** arrive. Reserved time out values: SAHPI_TIMEOUT_IMMEDIATE Time out +** immediately if there are no events available (non-blocking call). +** SAHPI_TIMEOUT_BLOCK Call should not return until an event is +** retrieved. +** Event - [out] Pointer to the next available event. +** Rdr - [in/out] Pointer to structure to receive the resource data +** associated with the event. If NULL, no RDR will be returned. +** RptEntry - [in/out] Pointer to structure to receive the RPT entry +** associated with the resource that generated the event. If NULL, no RPT +** entry will be returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_TIMEOUT is returned if no event is available +** to return within the timeout period. If SAHPI_TIMEOUT_IMMEDIATE is +** passed in the Timeout parameter, this error return will be used if +** there is no event queued when the function is called. +** +** Remarks: +** If the caller provides a pointer for an RPT entry, but the event does +** not include a valid resource ID for a resource in the domain (possible +** on OEM or USER type event), then the ResourceCapabilities field in +** *RptEntry will be set to zero. No valid RPT entry will have a zero +** value here. If the caller provides a pointer for an RDR, but there is +** no valid RDR associated with the event being returned (e.g., returned +** event is not a sensor event), Rdr->RdrType will be set to +** SAHPI_NO_RECORD. The timestamp reported in the returned event +** structure is the best approximation an implementation has to when the +** event actually occurred. The implementation may need to make an +** approximation (such as the time the event was placed on the event +** queue) because it may not have access to the actual time the event +** occurred. The value SAHPI_TIME_UNSPECIFIED indicates that the time of +** the event cannot be determined. If the implementation cannot supply an +** absolute timestamp, then it may supply a timestamp relative to some +** system-defined epoch, such as system boot. If the timestamp value is +** less than or equal to SAHPI_TIME_MAX_RELATIVE, but not +** SAHPI_TIME_UNSPECIFIED, then it is relative; if it is greater than +** SAHPI_TIME_MAX_RELATIVE, then it is absolute. 6 Resource Functions +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiTimeoutT Timeout, + SAHPI_OUT SaHpiEventT *Event, + SAHPI_INOUT SaHpiRdrT *Rdr, + SAHPI_INOUT SaHpiRptEntryT *RptEntry +); + + +/******************************************************************************* +** +** Name: saHpiRdrGet +** +** Description: +** This function returns a resource data record from the addressed +** resource. Submitting an EntryId of SAHPI_FIRST_ENTRY results in the +** first RDR being read. A returned NextEntryID of SAHPI_LAST_ENTRY +** indicates the last RDR has been returned. A successful retrieval will +** include the next valid EntryId. To retrieve the entire list of RDRs, +** call this function first with an EntryId of SAHPI_FIRST_ENTRY and then +** use the returned NextEntryId in the next call. Proceed until the +** NextEntryId returned is SAHPI_LAST_ENTRY. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** EntryId - [in] Handle of the RDR to retrieve. Reserved entry ID +** values: SAHPI_FIRST_ENTRY Get first entry SAHPI_LAST_ENTRY Reserved as +** delimiter for end of list. Not a valid entry identifier. +** NextEntryId - [out] Pointer to location to store Entry ID of next +** entry in RDR repository. +** Rdr - [out] Pointer to the structure to receive the requested resource +** data record. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** A resource's RDR repository is static over the lifetime of the +** resource; therefore no precautions are required against changes to the +** content of the RDR repository while it is being accessed. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRdrGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEntryIdT *NextEntryId, + SAHPI_OUT SaHpiRdrT *Rdr +); + + +/******************************************************************************* +** +** Name: saHpiSensorReadingGet +** +** Description: +** This function is used to retrieve a sensor reading. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which the sensor reading is being +** retrieved. +** Reading - [out] Pointer to a structure to receive sensor reading +** values. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorReadingGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorReadingT *Reading +); + + +/******************************************************************************* +** +** Name: saHpiSensorReadingConvert +** +** Description: +** This function converts between raw and interpreted sensor reading +** values. The type of conversion done depends on the passed-in +** ReadingInput parameter. If it contains only a raw value, then this is +** converted to an interpreted value in ConvertedReading; if it contains +** only an interpreted value, then this is converted to a raw value in +** ConvertedReading. If it contains neither type of value, or both, then +** an error is returned. The ReadingInput parameter is not altered in any +** case. If the sensor does not use raw values - i.e., it directly +** returns interpreted values - then this routine returns an error. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which reading is associated. +** ReadingInput - [in] Pointer to the structure that contains raw or +** interpreted reading to be converted. +** ConvertedReading - [out] Pointer to structure to hold converted +** reading. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_INVALID_PARAMS is returned if the ReadingInput +** parameter is invalid; e.g. if it contains neither a raw nor an +** interpreted value; or if it contains both; or if it contains an +** invalid value. SA_ERR_HPI_INVALID_DATA is returned if the sensor does +** not support raw readings. SA_ERR_HPI_NOT_PRESENT is returned if the +** sensor is not present. +** +** Remarks: +** The EventStatus field in ReadingInput is not used by this function. To +** make conversions, sensor-specific data may be required. Thus, the +** function references a particular sensor in the system through the +** SessionID/ResourceID/SensorNum parameters. If this sensor is not +** present, and sensor- specific information is required, the conversion +** will fail and SA_ERR_HPI_NOT_PRESENT will be returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorReadingConvert ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiSensorReadingT *ReadingInput, + SAHPI_OUT SaHpiSensorReadingT *ConvertedReading +); + + +/******************************************************************************* +** +** Name: saHpiSensorThresholdsGet +** +** Description: +** This function retrieves the thresholds for the given sensor. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which threshold values are being +** retrieved. +** SensorThresholds - [out] Pointer to returned sensor thresholds. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorThresholdsGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorThresholdsT *SensorThresholds +); + + +/******************************************************************************* +** +** Name: saHpiSensorThresholdsSet +** +** Description: +** This function sets the specified thresholds for the given sensor. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of addressed resource. +** SensorNum - [in] Sensor number for which threshold values are being +** set. +** SensorThresholds - [in] Pointer to the sensor thresholds values being +** set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** For each threshold or hysteresis value to be set, the corresponding +** sensor reading structure must indicate whether a raw or interpreted +** value is present. If neither are present, then that threshold or +** hysteresis value will not be set. Each sensor may require settings to +** be done with raw, or interpreted values, or may permit either; this is +** defined by the field ThresholdDefn.TholdCapabilities in the sensor's +** RDR (saHpiSensorRecT). If the interpreted value and raw value are both +** provided, and both are legal for the sensor, the interpreted value +** will be ignored and the raw value will be used. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorThresholdsSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiSensorThresholdsT *SensorThresholds +); + + +/******************************************************************************* +** +** Name: saHpiSensorTypeGet +** +** Description: +** This function retrieves the sensor type and event category for the +** specified sensor. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which the type is being retrieved +** Type - [out] Pointer to returned enumerated sensor type for the +** specified sensor. +** Category - [out] Pointer to location to receive the returned sensor +** event category. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorTypeGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorTypeT *Type, + SAHPI_OUT SaHpiEventCategoryT *Category +); + + +/******************************************************************************* +** +** Name: saHpiSensorEventEnablesGet +** +** Description: +** This function provides the ability to get the disable or enable event +** message generation status for individual sensor events. The sensor +** event states are relative to the event category specified by the +** sensor. See the SaHpiEventCategoryT definition in section 7.3, +** "Events, Part 1," on page 83 for more information. Within the +** structure returned, there are two elements that contain bit flags; one +** for assertion events and one for de-assertion events. A bit set to '1' +** in the "AssertEvents" element in the structure indicates that an event +** will be generated when the corresponding event state changes from +** de-asserted to asserted on that sensor. A bit set to '1' in the +** "DeassertEvents" element in the structure indicates that an event will +** be generated when the corresponding event state changes from asserted +** to de-asserted on that sensor. The saHpiSensorEventEnablesGet() +** function also returns the general sensor status - whether the sensor +** is completely disabled, or event generation is completely disabled. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which the event enable +** configuration is being requested +** Enables - [out] Pointer to the structure for returning sensor status +** and event enable information. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Disabling events means that events are disabled for all sessions, not +** just the session referenced by the SessionId parameter. For sensors +** hosted by resources that have the "SAHPI_CAPABILITY_EVT_DEASSERTS" +** flag set in its RPT entry, the "AssertEvents" element and the +** "DeassertsEvents" element will always have same value. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEventEnablesGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorEvtEnablesT *Enables +); + + +/******************************************************************************* +** +** Name: saHpiSensorEventEnablesSet +** +** Description: +** This function provides the ability to set the disable or enable event +** message generation status for individual sensor events. The sensor +** event states are relative to the event category specified by the +** sensor. See the SaHpiEventCategoryT definition for more information. +** Within the structure passed, there are two elements, which contain bit +** flags; one for assertion events and one for de-assertion events. +** However, the use of these two elements depends on whether the resource +** addressed has the "SAHPI_CAPABILITY_EVT_DEASSERTS" flag set in its RPT +** entry. This capability, if set, advertises that all sensors hosted by +** the resource will always send a "de-assert" event when any state is +** de-asserted whose assertion generates an "assert" event. Thus, for +** sensors hosted by resources that advertise this behavior, it is not +** meaningful to control assert events and de-assert events separately. +** For sensors on resources that do not have the +** "SAHPI_CAPABILITY_EVT_DEASSERTS" flag set, a bit set to '1' in the +** "AssertEvents" element in the structure indicates that an event will +** be generated when the corresponding event state changes from +** de-asserted to asserted on that sensor., and a bit set to '1' in the +** "DeassertEvents" element in the structure indicates that an event will +** be generated when the corresponding event state changes from asserted +** to de-asserted on that sensor. For sensors on resources, which do have +** the "SAHPI_CAPABILITY_EVT_DEASSERTS" flag set, the "DeassertEvents" +** element is not used. For sensors on these resources, a bit set to '1' +** in the "AssertEvents" element in the structure indicates that an event +** will be generated when the corresponding event state changes in either +** direction (de-asserted to asserted or asserted to de-asserted). The +** saHpiSensorEventEnablesSet() function also allows setting of general +** sensor status - whether the sensor is completely disabled, or event +** generation is completely disabled. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which the event enables are being +** set. +** Enables - [in] Pointer to the structure containing the enabled status +** for each event. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Disabling events means that events are disabled for all sessions, not +** just the session referenced by the SessionId parameter. +** saHpiSensorEventEnablesGet () will return the values which were last +** set by saHpiSensorEventEnablesSet() for the "AssertEvents" and +** "DeassertEvents" elements in the passed data structures. However, for +** sensors hosted by any resource that has the +** SAHPI_CAPABILITY_EVT_DEASSERTS flag set in its RPT entry, the passed +** "AssertEvents" element on the saHpiSensorEventEnablesSet () function +** is used for both assertion and de-assertion event enable flags. In +** this case, this value will be returned in both the "AssertEvents" and +** "DeassertEvents" elements on a subsequent saHpiSensorEventEnablesGet +** () call. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEventEnablesSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiSensorEvtEnablesT *Enables +); + + +/******************************************************************************* +** +** Name: saHpiControlTypeGet +** +** Description: +** This function retrieves the control type of a control object. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** CtrlNum - [in] Control number +** Type - [out] Pointer to SaHpiCtrlTypeT variable to receive the +** enumerated control type for the specified control. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** The Type parameter must point to a variable of type SaHpiCtrlTypeT. +** Upon successful completion, the enumerated control type is returned in +** the variable pointed to by Type. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiControlTypeGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiCtrlNumT CtrlNum, + SAHPI_OUT SaHpiCtrlTypeT *Type +); + + +/******************************************************************************* +** +** Name: saHpiControlStateGet +** +** Description: +** This function retrieves the current state (generally the last state +** set) of a control object. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of addressed resource. +** CtrlNum - [in] Number of the control for which the state is being +** retrieved. +** CtrlState - [in/out] Pointer to a control data structure into which +** the current control state will be placed. For text controls, the line +** number to read is passed in via CtrlState->StateUnion.Text.Line. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Note that Text controls are unique in that they have a state +** associated with each line of the control - the state being the text on +** that line. The line number to be read is passed in to +** sahpiControlStateGet()via CtrlState- >StateUnion.Text.Line; the +** contents of that line of the control will be returned in CtrlState- +** >StateUnion.Text.Text. If the line number passed in is +** SAHPI_TLN_ALL_LINES, then sahpiControlStateGet() will return the +** entire text of the control, or as much of it as will fit in a single +** SaHpiTextBufferT, in CtrlState- >StateUnion.Text.Text. This value will +** consist of the text of all the lines concatenated, using the maximum +** number of characters for each line (no trimming of trailing blanks). +** Note that depending on the data type and language, the text may be +** encoded in 2-byte Unicode, which requires two bytes of data per +** character. Note that the number of lines and columns in a text control +** can be obtained from the control's Resource Data Record. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiControlStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiCtrlNumT CtrlNum, + SAHPI_INOUT SaHpiCtrlStateT *CtrlState +); + + +/******************************************************************************* +** +** Name: saHpiControlStateSet +** +** Description: +** This function is used for setting the state of the specified control +** object. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** CtrlNum - [in] Number of the control for which the state is being set. +** +** CtrlState - [in] Pointer to a control state data structure holding the +** state to be set +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** The CtrlState parameter must be of the correct type for the specified +** control. Text controls include a line number and a line of text in the +** CtrlState parameter, allowing update of just a single line of a text +** control. If less than a full line of data is written, the control will +** clear all spaces beyond those written on the line. Thus writing a +** zero-length string will clear the addressed line. It is also possible +** to include more characters in the text passed in the CtrlState +** structure than will fit on one line; in this case, the control will +** "wrap" to the next line (still clearing the trailing characters on the +** last line written). Thus, there are two ways to write multiple lines +** to a text control: (a) call saHpiControlStateSet() repeatedly for each +** line, or (b) call saHpiControlStateSet() once and send more characters +** than will fit on one line. The caller should not assume any "cursor +** positioning" characters are available to use, but rather should always +** write full lines and allow "wrapping" to occur. When calling +** saHpiControlStateSet() for a text control, the caller may set the line +** number to SAHPI_TLN_ALL_LINES; in this case, the entire control will +** be cleared, and the data will be written starting on line 0. (This is +** different from simply writing at line 0, which only alters the lines +** written to.) This feature may be used to clear the entire control, +** which can be accomplished by setting: CtrlState->StateUnion.Text.Line +** = SAHPI_TLN_ALL_LINES; CtrlState->StateUnion.Text.Text.DataLength = 0; +** Note that the number of lines and columns in a text control can be +** obtained from the control's Resource Data Record. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiControlStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiCtrlNumT CtrlNum, + SAHPI_IN SaHpiCtrlStateT *CtrlState +); + + +/******************************************************************************* +** +** Name: saHpiEntityInventoryDataRead +** +** Description: +** This function returns inventory data for a particular entity +** associated with a resource. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** EirId - [in] Identifier for the entity inventory repository. +** BufferSize - [in] Size of the InventData buffer passed in. +** InventData - [out] Pointer to the buffer for the returned data. +** ActualSize - [out] Pointer to size of the actual amount of data +** returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_INVENT_DATA_TRUNCATED is returned if the buffer +** passed in the InventData structure is not large enough (as indicated +** by the "BufferSize" parameter) to hold the entire InventData +** structure. +** +** Remarks: +** Before calling saHpiEntityInventoryDataRead() the caller should +** allocate a sufficiently large buffer to hold the data, and pass the +** size of the buffer in the "BufferSize" parameter. The +** saHpiEntityInventoryDataRead() function will return, at the location +** pointed to by the ActualSize parameter, the actual space used in the +** buffer to hold the returned data. If the data will not fit in the +** buffer, as much as will fit will be returned, *ActualSize will be set +** to indicated a suggested buffer size for the entire inventory data, +** the "Validity" field in the InventData buffer will be set to +** "SAHPI_INVENT_DATA_OVERFLOW," and an error return will be made. Since +** it is impossible to know how large the inventory data may be without +** actually reading and processing it from the entity inventory +** repository, it may be advisable to err on the large side in allocating +** the buffer. Note that the data includes many pointers to +** SaHpiTextBufferT structures. The implementation of +** saHpiEntityInventoryDataRead() may not reserve space for the maximum +** size of each of these structures when formatting the data in the +** returned buffer. Thus, if a user wishes to lengthen the data in one of +** these structures, a new SaHpiTextBufferT structure should be +** allocated, and the appropriate pointer reset to point to this new +** structure in memory. See the description of the SaHpiInventoryDataT +** structure in section 7.9, "Entity Inventory Data," on page 94, for +** details on the format of the returned data. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEntityInventoryDataRead ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEirIdT EirId, + SAHPI_IN SaHpiUint32T BufferSize, + SAHPI_OUT SaHpiInventoryDataT *InventData, + SAHPI_OUT SaHpiUint32T *ActualSize +); + + +/******************************************************************************* +** +** Name: saHpiEntityInventoryDataWrite +** +** Description: +** This function writes the specified data to the inventory information +** area. Note: If the resource hosting the inventory data is +** re-initialized, or if the entity itself is removed and reinserted, the +** inventory data may be reset to its default settings, losing data +** written to the repository with this function. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** EirId - [in] Identifier for the entity inventory repository. +** InventData - [in] Pointer to data to write to the repository. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** The SaHpiInventoryDataT structure consists of a Validity field and +** then a set of pointers to record structures. It is not required that +** all pointers point to data within a single contiguous buffer. The +** "Validity" field in the SaHpiInventoryDataT structure must be set to +** "SAHPI_INVENT_DATA_VALID," or else the saHpiEntityInventoryDataWrite() +** function will take no action and return an error. This is to help +** prevent invalid data returned by a saHpiEntityInventoryDataRead() +** function from being inadvertently written to the resource. For this +** protection to work, the caller should not change the value of the +** "Validity" field in the SaHpiInventoryDataT structure unless building +** an entire Inventory Data set from scratch. Some implementations may +** impose limitations on the languages of the strings passed in within +** the InventData parameter. Implementation-specific documentation +** should identify these restrictions. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEntityInventoryDataWrite ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEirIdT EirId, + SAHPI_IN SaHpiInventoryDataT *InventData +); + + +/******************************************************************************* +** +** Name: saHpiWatchdogTimerGet +** +** Description: +** This function retrieves the current watchdog timer settings and +** configuration. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource, which contains the +** watchdog timer being addressed. +** WatchdogNum - [in] The watchdog number that specifies the watchdog +** timer on a resource. +** Watchdog - [out] Pointer to watchdog data structure. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** See the description of the SaHpiWatchdogT structure in 7.11, +** "Watchdogs" on page 96 for details on what information is returned by +** this function. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiWatchdogTimerGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiWatchdogNumT WatchdogNum, + SAHPI_OUT SaHpiWatchdogT *Watchdog +); + + +/******************************************************************************* +** +** Name: saHpiWatchdogTimerSet +** +** Description: +** This function provides a method for initializing the watchdog timer +** configuration. Once the appropriate configuration has be set using +** saHpiWatchdogTimerSet(), the user must then call +** saHpiWatchdogTimerReset() to initially start the watchdog timer. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the +** watchdog timer being addressed. +** WatchdogNum - [in] The watchdog number specifying the specific +** watchdog timer on a resource. +** Watchdog - [in] Pointer to watchdog data structure. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** If the initial counter value in the SaHpiWatchdogT structure is set to +** 0, the Watchdog will immediately time out and take the pre-timeout and +** timeout actions, as well as log an event. This provides a mechanism +** for software to force an immediate recovery action should that be +** dependent on a Watchdog timeout occurring. See the description of the +** SaHpiWatchdogT structure for more details on the effects of this +** command related to specific data passed in that structure. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiWatchdogTimerSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiWatchdogNumT WatchdogNum, + SAHPI_IN SaHpiWatchdogT *Watchdog +); + + +/******************************************************************************* +** +** Name: saHpiWatchdogTimerReset +** +** Description: +** This function provides a method to start or restart the watchdog timer +** from the initial countdown value. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID for the resource that contains the +** watchdog timer being addressed. +** WatchdogNum - [in] The watchdog number specifying the specific +** watchdog timer on a resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** If the Watchdog has been configured to issue a Pre-Timeout interrupt, +** and that interrupt has already occurred, the saHpiWatchdogTimerReset() +** function will not reset the watchdog counter. The only way to stop a +** Watchdog from timing out once a Pre-Timeout interrupt has occurred is +** to use the saHpiWatchdogTimerSet() function to reset and/or stop the +** timer. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiWatchdogTimerReset ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiWatchdogNumT WatchdogNum +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapControlRequest +** +** Description: +** A resource supporting hot swap typically supports default policies for +** insertion and extraction. On insertion, the default policy may be for +** the resource to turn the associated FRU's local power on and to +** de-assert reset. On extraction, the default policy may be for the +** resource to immediately power off the FRU and turn on a hot swap +** indicator. This function allows a caller, after receiving a hot swap +** event with HotSwapState equal to SAHPI_HS_STATE_INSERTION_PENDING or +** SAHPI_HS_STATE_EXTRACTION_PENDING, to request control of the hot swap +** policy and prevent the default policy from being invoked. Because a +** resource that supports the simplified hot swap model will never +** transition into Insertion Pending or Extraction Pending states, this +** function is not applicable to those resources. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapControlRequest ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiResourceActiveSet +** +** Description: +** During insertion, a resource supporting hot swap will generate an +** event to indicate that it is in the INSERTION PENDING state. If the +** management middleware or other user software calls +** saHpiHotSwapControlRequest() before the resource begins an auto-insert +** operation, then the resource will remain in INSERTION PENDING state +** while the user acts on the resource to integrate it into the system. +** During this state, the user can instruct the resource to power on the +** associated FRU, to de-assert reset, or to turn off its hot swap +** indicator using the saHpiResourcePowerStateSet(), +** saHpiResourceResetStateSet(), or saHpiHotSwapIndicatorStateSet() +** functions, respectively. Once the user has completed with the +** integration of the FRU, this function must be called to signal that +** the resource should now transition into ACTIVE/HEALTHY or +** ACTIVE/UNHEALTHY state (depending on whether or not there are active +** faults). The user may also use this function to request a resource to +** return to the ACTIVE/HEALTHY or ACTIVE/UNHEALTHY state from the +** EXTRACTION PENDING state in order to reject an extraction request. +** Because a resource that supports the simplified hot swap model will +** never transition into Insertion Pending or Extraction Pending states, +** this function is not applicable to those resources. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Only valid if resource is in INSERTION PENDING or EXTRACTION PENDING +** state and an auto-insert or auto-extract policy action has not been +** initiated. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceActiveSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiResourceInactiveSet +** +** Description: +** During extraction, a resource supporting hot swap will generate an +** event to indicate that it is in the EXTRACTION PENDING state. If the +** management middleware or other user software calls +** saHpiHotSwapControlRequest() before the resource begins an +** auto-extract operation, then the resource will remain in EXTRACTION +** PENDING state while the user acts on the resource to isolate the +** associated FRU from the system. During this state, the user can +** instruct the resource to power off the FRU, to assert reset, or to +** turn on its hot swap indicator using the saHpiResourcePowerStateSet(), +** saHpiResourceResetStateSet(), or saHpiHotSwapIndicatorStateSet() +** functions, respectively. Once the user has completed the shutdown of +** the FRU, this function must be called to signal that the resource +** should now transition into INACTIVE state. The user may also use this +** function to request a resource to return to the INACTIVE state from +** the INSERTION PENDING state to abort a hot-swap insertion action. +** Because a resource that supports the simplified hot swap model will +** never transition into Insertion Pending or Extraction Pending states, +** this function is not applicable to those resources. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Only valid if resource is in EXTRACTION PENDING or INSERTION PENDING +** state and an auto-extract or auto-insert policy action has not been +** initiated. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceInactiveSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiAutoInsertTimeoutGet +** +** Description: +** This function allows the caller to request the auto-insert timeout +** value. This value indicates how long the HPI implementation will wait +** before the default auto-insertion policy is invoked. Further +** information on the auto-insert timeout can be found in the function +** saHpiAutoInsertTimeoutSet(). +** +** Parameters: +** SessionId - [in] Handle to session context. +** Timeout - [out] Pointer to location to store the number of nanoseconds +** to wait before autonomous handling of the hotswap event. Reserved time +** out values: SAHPI_TIMEOUT_IMMEDIATE indicates autonomous handling is +** immediate. SAHPI_TIMEOUT_BLOCK indicates autonomous handling does not +** occur. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoInsertTimeoutGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiTimeoutT *Timeout +); + + +/******************************************************************************* +** +** Name: saHpiAutoInsertTimeoutSet +** +** Description: +** This function allows the caller to configure a timeout for how long to +** wait before the default auto-insertion policy is invoked. This +** function accepts a parameter instructing the implementation to impose +** a delay before a resource will perform its default hot swap policy for +** auto-insertion. The parameter may be set to SAHPI_TIMEOUT_IMMEDIATE to +** direct resources to proceed immediately to auto-insertion, or to +** SAHPI_TIMEOUT_BLOCK to prevent auto-insertion from ever occurring. If +** the parameter is set to another value, then it defines the number of +** nanoseconds between the time a hot swap event with HotSwapState = +** SAHPI_HS_STATE_INSERTION_PENDING is generated, and the time that the +** auto-insertion policy will be invoked for that resource. If, during +** this time period, a saHpiHotSwapControlRequest() function is +** processed, the timer will be stopped, and the auto-insertion policy +** will not be invoked. Once the auto-insertion process begins, the user +** software will not be allowed to take control of the insertion process; +** hence, the timeout should be set appropriately to allow for this +** condition. Note that the timeout period begins when the hot swap event +** with HotSwapState = SAHPI_HS_STATE_INSERTION_PENDING is initially +** generated; not when it is received by a caller with a saHpiEventGet() +** function call, or even when it is placed in a session event queue. +** +** Parameters: +** SessionId - [in] Handle to session context. +** Timeout - [in] The number of nanoseconds to wait before autonomous +** handling of the hotswap event. Reserved time out values: +** SAHPI_TIMEOUT_IMMEDIATE indicates proceed immediately to autonomous +** handling. SAHPI_TIMEOUT_BLOCK indicates prevent autonomous handling. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoInsertTimeoutSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiTimeoutT Timeout +); + + +/******************************************************************************* +** +** Name: saHpiAutoExtractTimeoutGet +** +** Description: +** This function allows the caller to request the timeout for how long +** the implementation will wait before the default auto-extraction policy +** is invoked. Further information on auto-extract time outs is detailed +** in saHpiAutoExtractTimeoutSet(). +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** Timeout - [out] Pointer to location to store the number of nanoseconds +** to wait before autonomous handling of the hotswap event. Reserved time +** out values: SAHPI_TIMEOUT_IMMEDIATE indicates autonomous handling is +** immediate. SAHPI_TIMEOUT_BLOCK indicates autonomous handling does not +** occur. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoExtractTimeoutGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiTimeoutT *Timeout +); + + +/******************************************************************************* +** +** Name: saHpiAutoExtractTimeoutSet +** +** Description: +** This function allows the caller to configure a timeout for how long to +** wait before the default auto-extraction policy is invoked. This +** function accepts a parameter instructing the implementation to impose +** a delay before a resource will perform its default hot swap policy for +** auto-extraction. The parameter may be set to SAHPI_TIMEOUT_IMMEDIATE +** to direct the resource to proceed immediately to auto-extraction, or +** to SAHPI_TIMEOUT_BLOCK to prevent auto-extraction from ever occurring +** on a resource. If the parameter is set to another value, then it +** defines the number of nanoseconds between the time a hot swap event +** with HotSwapState = SAHPI_HS_STATE_EXTRACTION_PENDING is generated, +** and the time that the auto- extraction policy will be invoked for the +** resource. If, during this time period, a saHpiHotSwapControlRequest() +** function is processed, the timer will be stopped, and the +** auto-extraction policy will not be invoked. Once the auto-extraction +** process begins, the user software will not be allowed to take control +** of the extraction process; hence, the timeout should be set +** appropriately to allow for this condition. Note that the timeout +** period begins when the hot swap event with HotSwapState = +** SAHPI_HS_STATE_EXTRACTION_PENDING is initially generated; not when it +** is received by a caller with a saHpiEventGet() function call, or even +** when it is placed in a session event queue. The auto-extraction policy +** is set at the resource level and is only supported by resources +** supporting the "Managed Hot Swap" capability. After discovering that a +** newly inserted resource supports "Managed Hot Swap," middleware or +** other user software may use this function to change the default +** auto-extraction policy for that resource. If a resource supports the +** simplified hot-swap model, setting this timer has no effect since the +** resource will transition directly to "Not Present" state on an +** extraction. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** Timeout - [in] The number of nanoseconds to wait before autonomous +** handling of the hotswap event. Reserved time out values: +** SAHPI_TIMEOUT_IMMEDIATE indicates proceed immediately to autonomous +** handling. SAHPI_TIMEOUT_BLOCK indicates prevent autonomous handling. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoExtractTimeoutSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTimeoutT Timeout +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapStateGet +** +** Description: +** This function allows the caller to retrieve the current hot swap state +** of a resource. The returned state will be one of the following five +** states: ? SAHPI_HS_STATE_INSERTION_PENDING ? +** SAHPI_HS_STATE_ACTIVE_HEALTHY ? SAHPI_HS_STATE_ACTIVE_UNHEALTHY ? +** SAHPI_HS_STATE_EXTRACTION_PENDING ? SAHPI_HS_STATE_INACTIVE The state +** SAHPI_HS_STATE_NOT_PRESENT will never be returned, because a resource +** that is not present cannot be addressed by this function in the first +** place. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** State - [out] Pointer to location to store returned state information. +** +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiHsStateT *State +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapActionRequest +** +** Description: +** A resource supporting hot swap typically requires a physical action on +** the associated FRU to invoke an insertion or extraction process. An +** insertion process is invoked by physically inserting the FRU into a +** chassis. Physically opening an ejector latch or pressing a button +** invokes the extraction process. This function allows the caller to +** invoke an insertion or extraction process via software. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** Action - [in] Requested action: SAHPI_HS_ACTION_INSERTION or +** SAHPI_HS_ACTION_EXTRACTION +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** There may be limitations on when saHpiHotSwapActionRequest() may be +** called, and what value may be used for the "Action" parameter +** depending on what state the resource is currently in. At the least, +** this function may be called: ? To request an Insertion action when the +** resource is in INACTIVE state ? To request an Extraction action when +** the resource is in the ACTIVE/HEALTHY or ACTIVE/ UNHEALTHY state. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapActionRequest ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiHsActionT Action +); + + +/******************************************************************************* +** +** Name: saHpiResourcePowerStateGet +** +** Description: +** A typical resource supporting hot swap will have the ability to +** control local power on the FRU associated with the resource. During +** insertion, the FRU can be instructed to power on. During extraction +** the FRU can be requested to power off. This function allows the caller +** to retrieve the current power state of the FRU associated with the +** specified resource. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** State - [out] The current power state of the resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** This function returns the actual low-level power state of the FRU, +** regardless of what hot-swap state the resource is in. Not all +** resources supporting managed hot swap will necessarily support this +** function. In particular, resources that use the simplified hot swap +** model may not have the ability to control FRU power. An appropriate +** error code will be returned if the resource does not support power +** control on the FRU. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourcePowerStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiHsPowerStateT *State +); + + +/******************************************************************************* +** +** Name: saHpiResourcePowerStateSet +** +** Description: +** A typical resource supporting hot swap will have to ability to control +** local power on the FRU associated with the resource. During insertion, +** the FRU can be instructed to power on. During extraction the FRU can +** be requested to power off. This function allows the caller to set the +** current power state of the FRU associated with the specified resource. +** +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** State - [in] the new power state that the specified resource will be +** set to. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** This function controls the hardware power on the FRU of what hot-swap +** state the resource is in. For example, it is legal (and may be +** desirable) to cycle power on the FRU even while it is in ACTIVE state +** in order to attempt to clear a fault condition. Similarly, a resource +** could be instructed to power on a FRU even while it is in INACTIVE +** state, for example, in order to run off-line diagnostics. Not all +** resources supporting managed hot swap will necessarily support this +** function. In particular, resources that use the simplified hot swap +** model may not have the ability to control FRU power. An appropriate +** error code will be returned if the resource does not support power +** control on the FRU. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourcePowerStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiHsPowerStateT State +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapIndicatorStateGet +** +** Description: +** A FRU associated with a hot-swappable resource may include a hot swap +** indicator such as a blue LED. This indicator signifies that the FRU is +** ready for removal.. This function allows the caller to retrieve the +** state of this indicator. The returned state is either +** SAHPI_HS_INDICATOR_OFF or SAHPI_HS_INDICATOR_ON. This function will +** return the state of the indicator, regardless of what hot swap state +** the resource is in. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** State - [out] Pointer to location to store state of hot swap +** indicator. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Not all resources supporting managed hot swap will necessarily support +** this function. In particular, resources that use the simplified hot +** swap model may not have the ability to control a FRU hot swap +** indicator (it is likely that none exists). An appropriate error code +** will be returned if the resource does not support control of a hot +** swap indicator on the FRU. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapIndicatorStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiHsIndicatorStateT *State +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapIndicatorStateSet +** +** Description: +** A FRU associated with a hot-swappable resource may include a hot swap +** indicator such as a blue LED. This indicator signifies that the FRU is +** ready for removal. This function allows the caller to set the state of +** this indicator. Valid states include SAHPI_HS_INDICATOR_OFF or +** SAHPI_HS_INDICATOR_ON. This function will set the indicator regardless +** of what hot swap state the resource is in, though it is recommended +** that this function be used only in conjunction with moving the +** resource to the appropriate hot swap state. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource +** State - [in] State of hot swap indicator to be set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Not all resources supporting managed hot swap will necessarily support +** this function. In particular, resources that use the simplified hot +** swap model may not have the ability to control a FRU hot swap +** indicator (it is likely that none exists). An appropriate error code +** will be returned if the resource does not support control of a hot +** swap indicator on the FRU. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapIndicatorStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiHsIndicatorStateT State +); + + +/******************************************************************************* +** +** Name: saHpiParmControl +** +** Description: +** This function allows the user to save and restore parameters +** associated with a specific resource. Valid actions for this function +** include: SAHPI_DEFAULT_PARM Restores the factory default settings for +** a specific resource. Factory defaults include sensor thresholds and +** configurations, and resource- specific configuration parameters. +** SAHPI_SAVE_PARM Stores the resource configuration parameters in +** non-volatile storage. Resource configuration parameters stored in +** non-volatile storage will survive power cycles and resource resets. +** SAHPI_RESTORE_PARM Restores resource configuration parameters from +** non-volatile storage. Resource configuration parameters include sensor +** thresholds and sensor configurations, as well as resource-specific +** parameters. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** Action - [in] Action to perform on resource parameters. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Resource-specific parameters should be documented in an implementation +** guide for the HPI implementation. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiParmControl ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiParmActionT Action +); + + +/******************************************************************************* +** +** Name: saHpiResourceResetStateGet +** +** Description: +** This function gets the reset state of an entity, allowing the user to +** determine if the entity is being held with its reset asserted. If a +** resource manages multiple entities, this function will address the +** entity which is identified in the RPT entry for the resource. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** ResetAction - [out] The current reset state of the entity. Valid reset +** states are: SAHPI_RESET_ASSERT: The entity's reset is asserted, e.g., +** for hot swap insertion/extraction purposes SAHPI_RESET_DEASSERT: The +** entity's reset is not asserted +** +** Return Value: +** SA_OK is returned if the resource has reset control, and the reset +** state has successfully been determined; otherwise, an error code is +** returned. SA_ERR_HPI_INVALID_CMD is returned if the resource has no +** reset control. +** +** Remarks: +** SAHPI_RESET_COLD and SAHPI_RESET_WARM are pulsed resets, and are not +** valid return values for ResetAction. If the entity is not being held +** in reset (using SAHPI_RESET_ASSERT), the appropriate return value is +** SAHPI_RESET_DEASSERT. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceResetStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiResetActionT *ResetAction +); + + +/******************************************************************************* +** +** Name: saHpiResourceResetStateSet +** +** Description: +** This function directs the resource to perform the specified reset type +** on the entity that it manages. If a resource manages multiple +** entities, this function addresses the entity that is identified in the +** RPT entry for the resource. Entities may be reset for a variety of +** reasons. A misbehaving entity may be reset to bring it to a known +** state. In these cases, either a warm reset or a cold reset may be +** performed. A warm reset preserves entity state, whereas a cold reset +** does not. Both of these reset types are pulsed asserted and then +** de-asserted by the HPI implementation. This allows the HPI +** implementation to hold the reset asserted for the appropriate length +** of time, as needed by each entity. saHpiResourceResetStateSet() can +** also be used for insertion and extraction scenarios. A typical +** resource supporting hot swap will have to ability to control local +** reset within the FRU. During insertion, a resource can be instructed +** to assert reset, while the FRU powers on. During extraction a resource +** can be requested to assert reset before the FRU is powered off. This +** function allows the caller to set the reset state of the specified +** FRU. SAHPI_RESET_ASSERT is used to hold the resource in reset; the FRU +** is brought out of the reset state by using either SAHPI_COLD_RESET or +** SAHPI_WARM_RESET. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** ResetAction - [in] Type of reset to perform on the entity. Valid reset +** actions are: SAHPI_COLD_RESET: Perform a 'Cold Reset' on the entity +** (pulse), leaving reset de-asserted SAHPI_WARM_RESET: Perform a 'Warm +** Reset' on the entity (pulse), leaving reset de-asserted +** SAHPI_RESET_ASSERT: Put the entity into reset state and hold reset +** asserted, e.g., for hot swap insertion/extraction purposes +** +** Return Value: +** SA_OK is returned if the resource has reset control, and the requested +** reset action has succeeded; otherwise, an error code is returned. +** SA_ERR_HPI_INVALID_CMD is returned if the resource has no reset +** control, or if the requested reset action is not supported by the +** resource. +** +** Remarks: +** Some resources may not support reset, or may only support a subset of +** the defined reset action types. Also, on some resources, cold and warm +** resets may be equivalent. 7 Data Type Definitions +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceResetStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiResetActionT ResetAction +); + + + +#endif + diff --git a/hpiutil/SaHpi.h-A b/hpiutil/SaHpi.h-A new file mode 100644 index 0000000..6efd5e9 --- /dev/null +++ b/hpiutil/SaHpi.h-A @@ -0,0 +1,4509 @@ +/******************************************************************************* +** +** FILE: +** SaHpi.h +** +** DESCRIPTION: +** This file provides the C language binding for the Service +** Availability(TM) Forum Platform Interface. It contains all of +** the prototypes and type definitions. Note, this file was +** generated from the Platform Interface specification document. +** +** SPECIFICATION VERSION: +** SAI-HPI-A.01.01 +** +** DATE: +** Thu Oct 3 14:48:41 2002 +** +** LEGAL: +** OWNERSHIP OF SPECIFICATION AND COPYRIGHTS. +** The Specification and all worldwide copyrights therein are +** the exclusive property of Licensor. You may not remove, obscure, or +** alter any copyright or other proprietary rights notices that are in or +** on the copy of the Specification you download. You must reproduce all +** such notices on all copies of the Specification you make. Licensor +** may make changes to the Specification, or to items referenced therein, +** at any time without notice. Licensor is not obligated to support or +** update the Specification. +** +** Copyright(c) 2002, Service Availability(TM) Forum. All rights +** reserved. +** +*******************************************************************************/ + +#ifndef __SAHPI_H +#define __SAHPI_H + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Basic Data Types and Values ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* General Types - need to be specified correctly for the host architecture */ +typedef unsigned char SaHpiUint8T; +typedef unsigned short SaHpiUint16T; +typedef unsigned int SaHpiUint32T; +typedef char SaHpiInt8T; +typedef short SaHpiInt16T; +typedef int SaHpiInt32T; +typedef long long SaHpiInt64T; +typedef float SaHpiFloat32T; +typedef double SaHpiFloat64T; + +typedef SaHpiUint8T SaHpiBoolT; +#define SAHPI_TRUE 1 +#define SAHPI_FALSE 0 + +/* Platform, O/S, or Vendor dependent */ +#define SAHPI_API +#define SAHPI_IN +#define SAHPI_OUT +#define SAHPI_INOUT + +/* +** Identifier for the manufacturer +** +** This is the IANA-assigned private enterprise number for the +** manufacturer of the resource or FRU, or of the manufacturer +** defining an OEM control or event type. A list of current +** IANA-assigned private enterprise numbers may be obtained at +** +** http://www.iana.org/assignments/enterprise-numbers +** +** If a manufacturer does not currently have an assigned number, one +** may be obtained by following the instructions located at +** +** http://www.iana.org/cgi-bin/enterprise.pl +*/ +typedef SaHpiUint32T SaHpiManufacturerIdT; +#define SAHPI_MANUFACTURER_ID_UNSPECIFIED (SaHpiManufacturerIdT)0 + +/* Version Types */ +typedef SaHpiUint32T SaHpiVersionT; + +/* +** Interface Version +** +** The interface version is the version of the actual interface and not the +** version of the implementation. It is a 24 bit value where +** the most significant 8 bits represent the compatibility level +** (with letters represented as the corresponding numbers); +** the next 8 bits represent the major version number; and +** the least significant 8 bits represent the minor version number. +*/ +#define SAHPI_INTERFACE_VERSION (SaHpiVersionT)0x010101 /* A.01.01 */ + +/* +** Return Codes +** +** SaErrorT is defined in the HPI specification. In the future a +** common SAF types definition may be created to contain this type. At +** that time, this typedef should be removed. +*/ +typedef SaHpiInt32T SaErrorT; /* Return code */ + +/* +** SA_OK: This code indicates that a command completed successfully. +*/ +#define SA_OK (SaErrorT)0x0000 + +/* This value is the base for all HPI-specific error codes. */ +#define SA_HPI_ERR_BASE -1000 + +/* +** SA_ERR_HPI_ERROR: An unspecified error occurred. This code should +** be returned only as a last resort; eg. if the cause of an error +** cannot be determined. +*/ +#define SA_ERR_HPI_ERROR (SaErrorT)(SA_HPI_ERR_BASE - 1) + +/* +** SA_ERR_HPI_UNSUPPORTED_API: The HPI implementation does not support +** this API. This code is appropriate, for example, if invoking the +** Hot Swap functions on an HPI implementation which has no hot swap +** support. Note that such an implementation would not report any hot +** swap capabilities via its RDRs. +*/ +#define SA_ERR_HPI_UNSUPPORTED_API (SaErrorT)(SA_HPI_ERR_BASE - 2) + +/* +** SA_ERR_HPI_BUSY: The command cannot be performed because the +** targeted device is busy. +*/ +#define SA_ERR_HPI_BUSY (SaErrorT)(SA_HPI_ERR_BASE - 3) + +/* +** SA_ERR_HPI_INVALID: The request is fundamentally invalid. +*/ +#define SA_ERR_HPI_INVALID (SaErrorT)(SA_HPI_ERR_BASE - 4) + +/* +** SA_ERR_HPI_INVALID_CMD: The specific object to which a command was +** directed does not support that command (which was otherwise valid). +*/ +#define SA_ERR_HPI_INVALID_CMD (SaErrorT)(SA_HPI_ERR_BASE - 5) + +/* +** SA_ERR_HPI_TIMEOUT: The requested operation, which had a timeout +** value specified, timed out. For example, when reading input with a +** timeout value, if no input arrives within the timeout interval, +** this code should be returned. This should only be returned in +** cases where a timeout is anticipated as a valid consequence of the +** operation; if the addressed entity is not responding due to a +** fault, use SA_ERR_HPI_NO_RESPONSE (qv). +*/ +#define SA_ERR_HPI_TIMEOUT (SaErrorT)(SA_HPI_ERR_BASE - 6) + +/* +** SA_ERR_HPI_OUT_OF_SPACE: The requested command failed due to +** resource limits. +*/ +#define SA_ERR_HPI_OUT_OF_SPACE (SaErrorT)(SA_HPI_ERR_BASE - 7) + +/* +** SA_ERR_HPI_DATA_TRUNCATED: The returned data was truncated. For +** example, when reading data into a fixed-size buffer, if the data is +** larger than the buffer, this code should be returned. +*/ +#define SA_ERR_HPI_DATA_TRUNCATED (SaErrorT)(SA_HPI_ERR_BASE - 8) + +/* +** SA_ERR_HPI_DATA_LEN_INVALID: The specified data length is invalid. +*/ +#define SA_ERR_HPI_DATA_LEN_INVALID (SaErrorT)(SA_HPI_ERR_BASE - 9) + +/* +** SA_ERR_HPI_DATA_EX_LIMITS: The supplied data exceeds limits. +*/ +#define SA_ERR_HPI_DATA_EX_LIMITS (SaErrorT)(SA_HPI_ERR_BASE - 10) + +/* +** SA_ERR_HPI_INVALID_PARAMS: One or more parameters to the command +** were invalid. +*/ +#define SA_ERR_HPI_INVALID_PARAMS (SaErrorT)(SA_HPI_ERR_BASE - 11) + +/* +** SA_ERR_HPI_INVALID_DATA: Cannot return requested data; eg. the +** specific object to which a command was directed does not support +** the data required by the command. +*/ +#define SA_ERR_HPI_INVALID_DATA (SaErrorT)(SA_HPI_ERR_BASE - 12) + +/* +** SA_ERR_HPI_NOT_PRESENT: The requested object was not present. For +** example, this code would be returned when attempting to access an +** entry in a RPT or RDR which is not present. As another example, this +** code would also be returned when accessing an invalid management +** instrument on a valid resource. +*/ +#define SA_ERR_HPI_NOT_PRESENT (SaErrorT)(SA_HPI_ERR_BASE - 13) + +/* +** SA_ERR_HPI_INVALID_DATA_FIELD: Invalid data field. +*/ +#define SA_ERR_HPI_INVALID_DATA_FIELD (SaErrorT)(SA_HPI_ERR_BASE - 14) + +/* +** SA_ERR_HPI_INVALID_SENSOR_CMD: Invalid sensor command. +*/ +#define SA_ERR_HPI_INVALID_SENSOR_CMD (SaErrorT)(SA_HPI_ERR_BASE - 15) + +/* +** SA_ERR_HPI_NO_RESPONSE: There was no response from the domain or +** object targeted by the command, due to some fault. This code +** indicates an un-anticipated failure to respond; compare with +** SA_ERR_HPI_TIMEOUT. +*/ +#define SA_ERR_HPI_NO_RESPONSE (SaErrorT)(SA_HPI_ERR_BASE - 16) + +/* +** SA_ERR_HPI_DUPLICATE: Duplicate request -- such as attempting to +** initialize something which has already been initialized (and which +** cannot be initialized twice). +*/ +#define SA_ERR_HPI_DUPLICATE (SaErrorT)(SA_HPI_ERR_BASE - 17) + +/* +** SA_ERR_HPI_UPDATING: The command could not be completed because +** the targeted object is in update mode. +*/ +#define SA_ERR_HPI_UPDATING (SaErrorT)(SA_HPI_ERR_BASE - 18) + +/* +** SA_ERR_HPI_INITIALIZING: The command could not be completed because +** the targeted object is initializing. +*/ +#define SA_ERR_HPI_INITIALIZING (SaErrorT)(SA_HPI_ERR_BASE - 19) + +/* +** SA_ERR_HPI_UNKNOWN: This code should be returned if, for some +** reason, the HPI implementation cannot determine the proper response +** to a command. For example, there may be a proper value to return +** for a given call, but the implementation may be unable to determine +** which one it is. +*/ +#define SA_ERR_HPI_UNKNOWN (SaErrorT)(SA_HPI_ERR_BASE - 20) + +/* +** SA_ERR_HPI_INVALID_SESSION: An invalid session ID was specified in +** the command. +*/ +#define SA_ERR_HPI_INVALID_SESSION (SaErrorT)(SA_HPI_ERR_BASE - 21) + +/* +** SA_ERR_HPI_INVALID_DOMAIN: Invalid domain ID specified -- ie. a +** domain ID which does not correspond to any real domain was +** specified in the command. +*/ +#define SA_ERR_HPI_INVALID_DOMAIN (SaErrorT)(SA_HPI_ERR_BASE - 22) + +/* +** SA_ERR_HPI_INVALID_RESOURCE: Invalid resource ID specified -- ie. a +** resource ID which does not correspond to a resource in the addressed +** domain was specified in the command. +*/ +#define SA_ERR_HPI_INVALID_RESOURCE (SaErrorT)(SA_HPI_ERR_BASE - 23) + +/* +** SA_ERR_HPI_INVALID_REQUEST: The request is invalid in the current +** context. An example would be attempting to unsubscribe for events, +** when the caller has not subscribed to events. +*/ +#define SA_ERR_HPI_INVALID_REQUEST (SaErrorT)(SA_HPI_ERR_BASE - 24) + +/* +** SA_ERR_HPI_ENTITY_NOT_PRESENT: The addressed management instrument is not active +** because the entity with which it is associated is not present. This +** condition could occur, for instance, when an alarm module is managing a +** fan tray FRU. The alarm module would contain management instruments (sensors, +** etc) for the fan tray. The fan tray may be removed, even though the +** management instruments are still represented in the alarm module. In this +** case, SA_ERR_HPI_ENTITY_NOT_PRESENT would be returned if a management instrument +** associated with a removed entity is accessed. +*/ +#define SA_ERR_HPI_ENTITY_NOT_PRESENT (SaErrorT)(SA_HPI_ERR_BASE - 25) + +/* +** SA_ERR_HPI_UNINITIALIZED: This code is returned when a request is +** made, and the HPI has not, yet, been initialized via saHpiInitialize(). +*/ +#define SA_ERR_HPI_UNINITIALIZED (SaErrorT)(SA_HPI_ERR_BASE - 26) + + +/* +** Domain, Session and Resource Type Definitions +*/ + +/* Domain ID. */ +typedef SaHpiUint32T SaHpiDomainIdT; +#define SAHPI_DEFAULT_DOMAIN_ID (SaHpiDomainIdT)0 + +/* The SAHPI_UNSPECIFIED_DOMAIN_ID value may be used by an implementation +** when populating the ResourceId value for an RPT entry that is a +** domain only. +*/ +#define SAHPI_UNSPECIFIED_DOMAIN_ID (SaHpiDomainIdT) 0xFFFFFFFF + +/* Session ID. */ +typedef SaHpiUint32T SaHpiSessionIdT; + +/* Resource identifier. */ +typedef SaHpiUint32T SaHpiResourceIdT; + +/* The SAHPI_UNSPECIFIED_RESOURCE_ID value may be used by an implementation +** when populating the DomainId value for an RPT entry that is a +** resource only. Note that this reserved value (0xFFFFFFFF) is also used +** to designate the domain controller, for domain-based event log access. +*/ +#define SAHPI_UNSPECIFIED_RESOURCE_ID (SaHpiResourceIdT) 0xFFFFFFFF + +/* The SAHPI_DOMAIN_CONTROLLER_ID value is a reserved resource ID +** value which is used to select the domain controller's event log +** (as opposed to a real resource's event log) when accessing logs. +** This value must not be used as the ID of any real resource. +*/ +#define SAHPI_DOMAIN_CONTROLLER_ID (SaHpiResourceIdT) 0xFFFFFFFE + +/* Table Related Type Definitions */ +typedef SaHpiUint32T SaHpiEntryIdT; +#define SAHPI_FIRST_ENTRY (SaHpiEntryIdT)0x00000000 +#define SAHPI_LAST_ENTRY (SaHpiEntryIdT)0xFFFFFFFF + +/* +** Time Related Type Definitions +** +** An HPI time value represents the local time as the number of nanoseconds +** from 00:00:00, January 1, 1970, in a 64-bit signed integer. This format +** is sufficient to represent times with nano-second resolution from the +** year 1678 to 2262. Every API which deals with time values must define +** the timezone used. +** +** It should be noted that although nano-second resolution is supported +** in the data type, the actual resolution provided by an implementation +** may be more limited than this. +** +** The value -2**63, which is 0x8000000000000000, is used to indicate +** "unknown/unspecified time". +** +** Conversion to/from POSIX and other common time representations is +** relatively straightforward. The following code framgment converts +** between SaHpiTimeT and time_t: +** +** time_t tt1, tt2; +** SaHpiTimeT saHpiTime; +** +** time(&tt1); +** saHpiTime = (SaHpiTimeT) tt1 * 1000000000; +** tt2 = saHpiTime / 1000000000; +** +** The following fragment converts between SaHpiTimeT and a struct timeval: +** +** struct timeval tv1, tv2; +** SaHpiTimeT saHpiTime; +** +** gettimeofday(&tv1, NULL); +** saHpiTime = (SaHpiTimeT) tv1.tv_sec * 1000000000 + tv1.tv_usec * 1000; +** tv2.tv_sec = saHpiTime / 1000000000; +** tv2.tv_usec = saHpiTime % 1000000000 / 1000; +** +** The following fragment converts between SaHpiTimeT and a struct timespec: +** +** struct timespec ts1, ts2; +** SaHpiTimeT saHpiTime; +** +** clock_gettime(CLOCK_REALTIME, &ts1); +** saHpiTime = (SaHpiTimeT) ts1.tv_sec * 1000000000 + ts1.tv_nsec; +** ts2.tv_sec = saHpiTime / 1000000000; +** ts2.tv_nsec = saHpiTime % 1000000000; +** +** Note, however, that since time_t is (effectively) universally 32 bits, +** all of these conversions will cease to work on January 18, 2038. +** +** Some subsystems may need the flexibility to report either absolute or +** relative (eg. to system boot) times. This will typically be in the +** case of a board which may or may not, depending on the system setup, +** have an idea of absolute time. For example, some boards may have +** "time of day" clocks which start at zero, and never get set to the +** time of day. +** +** In these cases, times which represent "current" time (in events, for +** example) can be reported based on the clock value, whether it has been +** set to the actual date/time, or whether it represents the elapsed time +** since boot. If it is the time since boot, the value will be (for 27 +** years) less than 0x0C00000000000000, which is Mon May 26 16:58:48 1997. +** If the value is greater than this, then it can be assumed to be an +** absolute time. +** +** Every API which can report either absolute or relative times must +** state this rule clearly in its interface specification. +*/ +typedef SaHpiInt64T SaHpiTimeT; /* Time in nanoseconds */ + +/* Unspecified or unknown time */ +#define SAHPI_TIME_UNSPECIFIED (SaHpiTimeT) 0x8000000000000000 + +/* Maximum time that can be specified as relative */ +#define SAHPI_TIME_MAX_RELATIVE (SaHpiTimeT) 0x0C00000000000000 +typedef SaHpiInt64T SaHpiTimeoutT; /* Timeout in nanoseconds */ + +/* Non-blocking call */ +#define SAHPI_TIMEOUT_IMMEDIATE (SaHpiTimeoutT) 0x0000000000000000 + +/* Blocking call, wait indefinitely for call to complete */ +#define SAHPI_TIMEOUT_BLOCK (SaHpiTimeoutT) -1 + +/* +** Language +** +** This enumeration lists all of the languages that can be associated with text. +** +** SAHPI_LANG_UNDEF indicates that the language is unspecified or +** unknown. +*/ +typedef enum { + SAHPI_LANG_UNDEF = 0, SAHPI_LANG_AFAR, SAHPI_LANG_ABKHAZIAN, + SAHPI_LANG_AFRIKAANS, SAHPI_LANG_AMHARIC, SAHPI_LANG_ARABIC, + SAHPI_LANG_ASSAMESE, SAHPI_LANG_AYMARA, SAHPI_LANG_AZERBAIJANI, + SAHPI_LANG_BASHKIR, SAHPI_LANG_BYELORUSSIAN, SAHPI_LANG_BULGARIAN, + SAHPI_LANG_BIHARI, SAHPI_LANG_BISLAMA, SAHPI_LANG_BENGALI, + SAHPI_LANG_TIBETAN, SAHPI_LANG_BRETON, SAHPI_LANG_CATALAN, + SAHPI_LANG_CORSICAN, SAHPI_LANG_CZECH, SAHPI_LANG_WELSH, + SAHPI_LANG_DANISH, SAHPI_LANG_GERMAN, SAHPI_LANG_BHUTANI, + SAHPI_LANG_GREEK, SAHPI_LANG_ENGLISH, SAHPI_LANG_ESPERANTO, + SAHPI_LANG_SPANISH, SAHPI_LANG_ESTONIAN, SAHPI_LANG_BASQUE, + SAHPI_LANG_PERSIAN, SAHPI_LANG_FINNISH, SAHPI_LANG_FIJI, + SAHPI_LANG_FAEROESE, SAHPI_LANG_FRENCH, SAHPI_LANG_FRISIAN, + SAHPI_LANG_IRISH, SAHPI_LANG_SCOTSGAELIC, SAHPI_LANG_GALICIAN, + SAHPI_LANG_GUARANI, SAHPI_LANG_GUJARATI, SAHPI_LANG_HAUSA, + SAHPI_LANG_HINDI, SAHPI_LANG_CROATIAN, SAHPI_LANG_HUNGARIAN, + SAHPI_LANG_ARMENIAN, SAHPI_LANG_INTERLINGUA, SAHPI_LANG_INTERLINGUE, + SAHPI_LANG_INUPIAK, SAHPI_LANG_INDONESIAN, SAHPI_LANG_ICELANDIC, + SAHPI_LANG_ITALIAN, SAHPI_LANG_HEBREW, SAHPI_LANG_JAPANESE, + SAHPI_LANG_YIDDISH, SAHPI_LANG_JAVANESE, SAHPI_LANG_GEORGIAN, + SAHPI_LANG_KAZAKH, SAHPI_LANG_GREENLANDIC, SAHPI_LANG_CAMBODIAN, + SAHPI_LANG_KANNADA, SAHPI_LANG_KOREAN, SAHPI_LANG_KASHMIRI, + SAHPI_LANG_KURDISH, SAHPI_LANG_KIRGHIZ, SAHPI_LANG_LATIN, + SAHPI_LANG_LINGALA, SAHPI_LANG_LAOTHIAN, SAHPI_LANG_LITHUANIAN, + SAHPI_LANG_LATVIANLETTISH, SAHPI_LANG_MALAGASY, SAHPI_LANG_MAORI, + SAHPI_LANG_MACEDONIAN, SAHPI_LANG_MALAYALAM, SAHPI_LANG_MONGOLIAN, + SAHPI_LANG_MOLDAVIAN, SAHPI_LANG_MARATHI, SAHPI_LANG_MALAY, + SAHPI_LANG_MALTESE, SAHPI_LANG_BURMESE, SAHPI_LANG_NAURU, + SAHPI_LANG_NEPALI, SAHPI_LANG_DUTCH, SAHPI_LANG_NORWEGIAN, + SAHPI_LANG_OCCITAN, SAHPI_LANG_AFANOROMO, SAHPI_LANG_ORIYA, + SAHPI_LANG_PUNJABI, SAHPI_LANG_POLISH, SAHPI_LANG_PASHTOPUSHTO, + SAHPI_LANG_PORTUGUESE, SAHPI_LANG_QUECHUA, SAHPI_LANG_RHAETOROMANCE, + SAHPI_LANG_KIRUNDI, SAHPI_LANG_ROMANIAN, SAHPI_LANG_RUSSIAN, + SAHPI_LANG_KINYARWANDA, SAHPI_LANG_SANSKRIT, SAHPI_LANG_SINDHI, + SAHPI_LANG_SANGRO, SAHPI_LANG_SERBOCROATIAN, SAHPI_LANG_SINGHALESE, + SAHPI_LANG_SLOVAK, SAHPI_LANG_SLOVENIAN, SAHPI_LANG_SAMOAN, + SAHPI_LANG_SHONA, SAHPI_LANG_SOMALI, SAHPI_LANG_ALBANIAN, + SAHPI_LANG_SERBIAN, SAHPI_LANG_SISWATI, SAHPI_LANG_SESOTHO, + SAHPI_LANG_SUDANESE, SAHPI_LANG_SWEDISH, SAHPI_LANG_SWAHILI, + SAHPI_LANG_TAMIL, SAHPI_LANG_TELUGU, SAHPI_LANG_TAJIK, + SAHPI_LANG_THAI, SAHPI_LANG_TIGRINYA, SAHPI_LANG_TURKMEN, + SAHPI_LANG_TAGALOG, SAHPI_LANG_SETSWANA, SAHPI_LANG_TONGA, + SAHPI_LANG_TURKISH, SAHPI_LANG_TSONGA, SAHPI_LANG_TATAR, + SAHPI_LANG_TWI, SAHPI_LANG_UKRAINIAN, SAHPI_LANG_URDU, + SAHPI_LANG_UZBEK, SAHPI_LANG_VIETNAMESE, SAHPI_LANG_VOLAPUK, + SAHPI_LANG_WOLOF, SAHPI_LANG_XHOSA, SAHPI_LANG_YORUBA, + SAHPI_LANG_CHINESE, SAHPI_LANG_ZULU +} SaHpiLanguageT; + +/* +** Text Buffers +** +** These structures are used for defining the type of data in the text buffer +** and the length of the buffer. Text buffers are used in the inventory data, +** RDR, RPT, etc. for variable length strings of data. +*/ + +#define SAHPI_MAX_TEXT_BUFFER_LENGTH 255 + +typedef enum { + SAHPI_TL_TYPE_BINARY = 0, /* String of bytes, any values legal */ + SAHPI_TL_TYPE_BCDPLUS, /* String of 0-9, space, dash, period ONLY */ + SAHPI_TL_TYPE_ASCII6, /* Reduced ASCII character set: 0x20-0x5F + ONLY */ + SAHPI_TL_TYPE_LANGUAGE /* ASCII or UNICODE depending on language */ +} SaHpiTextTypeT; + +typedef struct { + SaHpiTextTypeT DataType; + SaHpiLanguageT Language; /* Language the text is in. */ + SaHpiUint8T DataLength; /* Bytes used in Data buffer */ + SaHpiUint8T Data[SAHPI_MAX_TEXT_BUFFER_LENGTH]; /* Data buffer */ +} SaHpiTextBufferT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Entities ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* +** Entity Types +** +** Entities are used to associate specific hardware components with sensors, +** controls, watchdogs, or resources. Entities are defined with an entity +** type enumeration, and an entity instance number (to distinguish between +** multiple instances of a particular type of entity; e.g., multiple power +** supplies in a system). +** +** Entities are uniquely identified in a system with an ordered series of +** Entity Type / Entity Instance pairs called an "Entity Path". Each subsequent +** Entity Type/Entity Instance in the path is the next higher "containing" +** entity. The "root" of the Entity Path (the outermost level of containment) +** is designated with an Entity Type of SAHPI_ENT_ROOT if the entire Entity Path +** is fewer than SAHPI_MAX_ENTITY_PATH entries in length. +** +** Enumerated Entity Types include those types enumerated by the IPMI Consortium +** for IPMI-managed entities, as well as additional types defined by the +** HPI specification. Room is left in the enumeration for the inclusion of +** Entity Types taken from other lists, if needed in the future. +*/ +/* Base values for entity types from various sources. */ +#define SAHPI_ENT_IPMI_GROUP 0 +#define SAHPI_ENT_SAFHPI_GROUP 0x10000 +#define SAHPI_ENT_ROOT_VALUE 0xFFFF +typedef enum +{ + SAHPI_ENT_UNSPECIFIED = SAHPI_ENT_IPMI_GROUP, + SAHPI_ENT_OTHER, + SAHPI_ENT_UNKNOWN, + SAHPI_ENT_PROCESSOR, + SAHPI_ENT_DISK_BAY, /* Disk or disk bay */ + SAHPI_ENT_PERIPHERAL_BAY, + SAHPI_ENT_SYS_MGMNT_MODULE, /* System management module */ + SAHPI_ENT_SYSTEM_BOARD, /* Main system board, may also be + processor board and/or internal + expansion board */ + SAHPI_ENT_MEMORY_MODULE, /* Board holding memory devices */ + SAHPI_ENT_PROCESSOR_MODULE, /* Holds processors, use this + designation when processors are not + mounted on system board */ + SAHPI_ENT_POWER_SUPPLY, /* Main power supply (supplies) for the + system */ + SAHPI_ENT_ADD_IN_CARD, + SAHPI_ENT_FRONT_PANEL_BOARD, /* Control panel */ + SAHPI_ENT_BACK_PANEL_BOARD, + SAHPI_ENT_POWER_SYSTEM_BOARD, + SAHPI_ENT_DRIVE_BACKPLANE, + SAHPI_ENT_SYS_EXPANSION_BOARD, /* System internal expansion board + (contains expansion slots). */ + SAHPI_ENT_OTHER_SYSTEM_BOARD, /* Part of board set */ + SAHPI_ENT_PROCESSOR_BOARD, /* Holds 1 or more processors. Includes + boards that hold SECC modules) */ + SAHPI_ENT_POWER_UNIT, /* Power unit / power domain (typically + used as a pre-defined logical entity + for grouping power supplies)*/ + SAHPI_ENT_POWER_MODULE, /* Power module / DC-to-DC converter. + Use this value for internal + converters. Note: You should use + entity ID (power supply) for the + main power supply even if the main + supply is a DC-to-DC converter */ + SAHPI_ENT_POWER_MGMNT, /* Power management/distribution + board */ + SAHPI_ENT_CHASSIS_BACK_PANEL_BOARD, + SAHPI_ENT_SYSTEM_CHASSIS, + SAHPI_ENT_SUB_CHASSIS, + SAHPI_ENT_OTHER_CHASSIS_BOARD, + SAHPI_ENT_DISK_DRIVE_BAY, + SAHPI_ENT_PERIPHERAL_BAY_2, + SAHPI_ENT_DEVICE_BAY, + SAHPI_ENT_COOLING_DEVICE, /* Fan/cooling device */ + SAHPI_ENT_COOLING_UNIT, /* Can be used as a pre-defined logical + entity for grouping fans or other + cooling devices. */ + SAHPI_ENT_INTERCONNECT, /* Cable / interconnect */ + SAHPI_ENT_MEMORY_DEVICE, /* This Entity ID should be used for + replaceable memory devices, e.g. + DIMM/SIMM. It is recommended that + Entity IDs not be used for + individual non-replaceable memory + devices. Rather, monitoring and + error reporting should be associated + with the FRU [e.g. memory card] + holding the memory. */ + SAHPI_ENT_SYS_MGMNT_SOFTWARE, /* System Management Software */ + SAHPI_ENT_BIOS, + SAHPI_ENT_OPERATING_SYSTEM, + SAHPI_ENT_SYSTEM_BUS, + SAHPI_ENT_GROUP, /* This is a logical entity for use with + Entity Association records. It is + provided to allow a sensor data + record to point to an entity- + association record when there is no + appropriate pre-defined logical + entity for the entity grouping. + This Entity should not be used as a + physical entity. */ + SAHPI_ENT_REMOTE, /* Out of band management communication + device */ + SAHPI_ENT_EXTERNAL_ENVIRONMENT, + SAHPI_ENT_BATTERY, + SAHPI_ENT_CHASSIS_SPECIFIC = SAHPI_ENT_IPMI_GROUP + 0x90, + SAHPI_ENT_BOARD_SET_SPECIFIC = SAHPI_ENT_IPMI_GROUP + 0xB0, + SAHPI_ENT_OEM_SYSINT_SPECIFIC = SAHPI_ENT_IPMI_GROUP + 0xD0, + SAHPI_ENT_ROOT = SAHPI_ENT_ROOT_VALUE, + SAHPI_ENT_RACK = SAHPI_ENT_SAFHPI_GROUP, + SAHPI_ENT_SUBRACK, + SAHPI_ENT_COMPACTPCI_CHASSIS, + SAHPI_ENT_ADVANCEDTCA_CHASSIS, + SAHPI_ENT_SYSTEM_SLOT, + SAHPI_ENT_SBC_BLADE, + SAHPI_ENT_IO_BLADE, + SAHPI_ENT_DISK_BLADE, + SAHPI_ENT_DISK_DRIVE, + SAHPI_ENT_FAN, + SAHPI_ENT_POWER_DISTRIBUTION_UNIT, + SAHPI_ENT_SPEC_PROC_BLADE, /* Special Processing Blade, + including DSP */ + SAHPI_ENT_IO_SUBBOARD, /* I/O Sub-Board, including + PMC I/O board */ + SAHPI_ENT_SBC_SUBBOARD, /* SBC Sub-Board, including PMC + SBC board */ + SAHPI_ENT_ALARM_MANAGER, /* Chassis alarm manager board */ + SAHPI_ENT_ALARM_MANAGER_BLADE, /* Blade-based alarm manager */ + SAHPI_ENT_SUBBOARD_CARRIER_BLADE /* Includes PMC Carrier Blade -- + Use only if "carrier" is only + function of blade. Else use + primary function (SBC_BLADE, + DSP_BLADE, etc.). */ + } SaHpiEntityTypeT; + +typedef SaHpiUint32T SaHpiEntityInstanceT; + +typedef struct { + SaHpiEntityTypeT EntityType; + SaHpiEntityInstanceT EntityInstance; +} SaHpiEntityT; + +#define SAHPI_MAX_ENTITY_PATH 16 + +typedef struct { + SaHpiEntityT Entry[SAHPI_MAX_ENTITY_PATH]; +} SaHpiEntityPathT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Events, part 1 ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** Category +** +** Sensor events contain an event category and event state. Depending on the +** event category, the event states take on different meanings for events +** generated by specific sensors. +** +** The SAHPI_EC_GENERIC category can be used for discrete sensors which have +** state meanings other than those identified with other event categories. +*/ +typedef SaHpiUint8T SaHpiEventCategoryT; + +#define SAHPI_EC_UNSPECIFIED (SaHpiEventCategoryT)0x00 /* Unspecified */ +#define SAHPI_EC_THRESHOLD (SaHpiEventCategoryT)0x01 /* Threshold + events */ +#define SAHPI_EC_USAGE (SaHpiEventCategoryT)0x02 /* Usage state + events */ +#define SAHPI_EC_STATE (SaHpiEventCategoryT)0x03 /* Generic state + events */ +#define SAHPI_EC_PRED_FAIL (SaHpiEventCategoryT)0x04 /* Predictive fail + events */ +#define SAHPI_EC_LIMIT (SaHpiEventCategoryT)0x05 /* Limit events */ +#define SAHPI_EC_PERFORMANCE (SaHpiEventCategoryT)0x06 /* Performance + events */ +#define SAHPI_EC_SEVERITY (SaHpiEventCategoryT)0x07 /* Severity + indicating + events */ +#define SAHPI_EC_PRESENCE (SaHpiEventCategoryT)0x08 /* Device presence + events */ +#define SAHPI_EC_ENABLE (SaHpiEventCategoryT)0x09 /* Device enabled + events */ +#define SAHPI_EC_AVAILABILITY (SaHpiEventCategoryT)0x0A /* Availability + state events */ + +#define SAHPI_EC_REDUNDANCY (SaHpiEventCategoryT)0x0B /* Redundancy + state events */ +#define SAHPI_EC_USER (SaHpiEventCategoryT)0x7E /* User defined + events */ +#define SAHPI_EC_GENERIC (SaHpiEventCategoryT)0x7F /* OEM defined + events */ + +/* +** Event States +** +** The following event states are specified relative to the categories listed +** above. The event types are only valid for their given category. Each set of +** events is labeled as to which category it belongs to. +** Each event will have only one event state associated with it. When retrieving +** the event status or event enabled status a bit mask of all applicable event +** states is used. Similarly, when setting the event enabled status a bit mask +** of all applicable event states is used. +*/ +typedef SaHpiUint16T SaHpiEventStateT; + +/* +** SaHpiEventCategoryT == +*/ +#define SAHPI_ES_UNSPECIFIED (SaHpiEventStateT)0x0000 + +/* +** SaHpiEventCategoryT == SAHPI_EC_THRESHOLD +** When using these event states, the event state should match +** the event severity (for example SAHPI_ES_LOWER_MINOR should have an +** event severity of SAHPI_MINOR). +*/ +#define SAHPI_ES_LOWER_MINOR (SaHpiEventStateT)0x0001 +#define SAHPI_ES_LOWER_MAJOR (SaHpiEventStateT)0x0002 +#define SAHPI_ES_LOWER_CRIT (SaHpiEventStateT)0x0004 +#define SAHPI_ES_UPPER_MINOR (SaHpiEventStateT)0x0008 +#define SAHPI_ES_UPPER_MAJOR (SaHpiEventStateT)0x0010 +#define SAHPI_ES_UPPER_CRIT (SaHpiEventStateT)0x0020 + +/* SaHpiEventCategoryT == SAHPI_EC_USAGE */ +#define SAHPI_ES_IDLE (SaHpiEventStateT)0x0001 +#define SAHPI_ES_ACTIVE (SaHpiEventStateT)0x0002 +#define SAHPI_ES_BUSY (SaHpiEventStateT)0x0004 + +/* SaHpiEventCategoryT == SAHPI_EC_STATE */ +#define SAHPI_ES_STATE_DEASSERTED (SaHpiEventStateT)0x0001 +#define SAHPI_ES_STATE_ASSERTED (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_PRED_FAIL */ +#define SAHPI_ES_PRED_FAILURE_DEASSERT (SaHpiEventStateT)0x0001 +#define SAHPI_ES_PRED_FAILURE_ASSERT (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_LIMIT */ +#define SAHPI_ES_LIMIT_NOT_EXCEEDED (SaHpiEventStateT)0x0001 +#define SAHPI_ES_LIMIT_EXCEEDED (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_PERFORMANCE */ +#define SAHPI_ES_PERFORMANCE_MET (SaHpiEventStateT)0x0001 +#define SAHPI_ES_PERFORMANCE_LAGS (SaHpiEventStateT)0x0002 + +/* +** SaHpiEventCategoryT == SAHPI_EC_SEVERITY +** When using these event states, the event state should match +** the event severity +*/ +#define SAHPI_ES_OK (SaHpiEventStateT)0x0001 +#define SAHPI_ES_MINOR_FROM_OK (SaHpiEventStateT)0x0002 +#define SAHPI_ES_MAJOR_FROM_LESS (SaHpiEventStateT)0x0004 +#define SAHPI_ES_CRITICAL_FROM_LESS (SaHpiEventStateT)0x0008 +#define SAHPI_ES_MINOR_FROM_MORE (SaHpiEventStateT)0x0010 +#define SAHPI_ES_MAJOR_FROM_CRITICAL (SaHpiEventStateT)0x0020 +#define SAHPI_ES_CRITICAL (SaHpiEventStateT)0x0040 +#define SAHPI_ES_MONITOR (SaHpiEventStateT)0x0080 +#define SAHPI_ES_INFORMATIONAL (SaHpiEventStateT)0x0100 + +/* SaHpiEventCategoryT == SAHPI_EC_PRESENCE */ +#define SAHPI_ES_ABSENT (SaHpiEventStateT)0x0001 +#define SAHPI_ES_PRESENT (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_ENABLE */ +#define SAHPI_ES_DISABLED (SaHpiEventStateT)0x0001 +#define SAHPI_ES_ENABLED (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_AVAILABILITY */ +#define SAHPI_ES_RUNNING (SaHpiEventStateT)0x0001 +#define SAHPI_ES_TEST (SaHpiEventStateT)0x0002 +#define SAHPI_ES_POWER_OFF (SaHpiEventStateT)0x0004 +#define SAHPI_ES_ON_LINE (SaHpiEventStateT)0x0008 +#define SAHPI_ES_OFF_LINE (SaHpiEventStateT)0x0010 +#define SAHPI_ES_OFF_DUTY (SaHpiEventStateT)0x0020 +#define SAHPI_ES_DEGRADED (SaHpiEventStateT)0x0040 +#define SAHPI_ES_POWER_SAVE (SaHpiEventStateT)0x0080 +#define SAHPI_ES_INSTALL_ERROR (SaHpiEventStateT)0x0100 + +/* SaHpiEventCategoryT == SAHPI_EC_REDUNDANCY */ +#define SAHPI_ES_FULLY_REDUNDANT (SaHpiEventStateT)0x0001 +#define SAHPI_ES_REDUNDANCY_LOST (SaHpiEventStateT)0x0002 +#define SAHPI_ES_REDUNDANCY_DEGRADED (SaHpiEventStateT)0x0004 +#define SAHPI_ES_REDUNDANCY_LOST_SUFFICIENT_RESOURCES \ + (SaHpiEventStateT)0x0008 +#define SAHPI_ES_NON_REDUNDANT_SUFFICIENT_RESOURCES \ + (SaHpiEventStateT)0x0010 +#define SAHPI_ES_NON_REDUNDANT_INSUFFICIENT_RESOURCES \ + (SaHpiEventStateT)0x0020 +#define SAHPI_ES_REDUNDANCY_DEGRADED_FROM_FULL (SaHpiEventStateT)0x0040 +#define SAHPI_ES_REDUNDANCY_DEGRADED_FROM_NON (SaHpiEventStateT)0x0080 + +/* +** SaHpiEventCategoryT == SAHPI_EC_GENERIC || SAHPI_EC_USER +** These event states are defined by the OEM or the user of the +** implementation. +*/ +#define SAHPI_ES_STATE_00 (SaHpiEventStateT)0x0001 +#define SAHPI_ES_STATE_01 (SaHpiEventStateT)0x0002 +#define SAHPI_ES_STATE_02 (SaHpiEventStateT)0x0004 +#define SAHPI_ES_STATE_03 (SaHpiEventStateT)0x0008 +#define SAHPI_ES_STATE_04 (SaHpiEventStateT)0x0010 +#define SAHPI_ES_STATE_05 (SaHpiEventStateT)0x0020 +#define SAHPI_ES_STATE_06 (SaHpiEventStateT)0x0040 +#define SAHPI_ES_STATE_07 (SaHpiEventStateT)0x0080 +#define SAHPI_ES_STATE_08 (SaHpiEventStateT)0x0100 +#define SAHPI_ES_STATE_09 (SaHpiEventStateT)0x0200 +#define SAHPI_ES_STATE_10 (SaHpiEventStateT)0x0400 +#define SAHPI_ES_STATE_11 (SaHpiEventStateT)0x0800 +#define SAHPI_ES_STATE_12 (SaHpiEventStateT)0x1000 +#define SAHPI_ES_STATE_13 (SaHpiEventStateT)0x2000 +#define SAHPI_ES_STATE_14 (SaHpiEventStateT)0x4000 + + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Sensors ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Sensor Number */ +typedef SaHpiUint8T SaHpiSensorNumT; + +/* Type of Sensor */ +typedef enum { + SAHPI_TEMPERATURE = 0x01, + SAHPI_VOLTAGE, + SAHPI_CURRENT, + SAHPI_FAN, + SAHPI_PHYSICAL_SECURITY, + SAHPI_PLATFORM_VIOLATION, + SAHPI_PROCESSOR, + SAHPI_POWER_SUPPLY, + SAHPI_POWER_UNIT, + SAHPI_COOLING_DEVICE, + SAHPI_OTHER_UNITS_BASED_SENSOR, + SAHPI_MEMORY, + SAHPI_DRIVE_SLOT, + SAHPI_POST_MEMORY_RESIZE, + SAHPI_SYSTEM_FW_PROGRESS, + SAHPI_EVENT_LOGGING_DISABLED, + SAHPI_RESERVED1, + SAHPI_SYSTEM_EVENT, + SAHPI_CRITICAL_INTERRUPT, + SAHPI_BUTTON, + SAHPI_MODULE_BOARD, + SAHPI_MICROCONTROLLER_COPROCESSOR, + SAHPI_ADDIN_CARD, + SAHPI_CHASSIS, + SAHPI_CHIP_SET, + SAHPI_OTHER_FRU, + SAHPI_CABLE_INTERCONNECT, + SAHPI_TERMINATOR, + SAHPI_SYSTEM_BOOT_INITIATED, + SAHPI_BOOT_ERROR, + SAHPI_OS_BOOT, + SAHPI_OS_CRITICAL_STOP, + SAHPI_SLOT_CONNECTOR, + SAHPI_SYSTEM_ACPI_POWER_STATE, + SAHPI_RESERVED2, + SAHPI_PLATFORM_ALERT, + SAHPI_ENTITY_PRESENCE, + SAHPI_MONITOR_ASIC_IC, + SAHPI_LAN, + SAHPI_MANAGEMENT_SUBSYSTEM_HEALTH, + SAHPI_BATTERY, + SAHPI_OPERATIONAL = 0xA0, + SAHPI_OEM_SENSOR=0xC0 +} SaHpiSensorTypeT; + +/* +** Interpreted Sensor Reading Type +** +** These definitions list the available data types that can be +** used for interpreted sensor readings. Interpreted sensor readings are provided +** because typically sensors measure their associated entities in a way that is +** not human readable/understandable. For example a fan sensor may measure the +** number of ticks that it takes a fan blade to move passed a sensor. The human +** readable reading type would be revolutions per minute (RPM). +*/ + +#define SAHPI_SENSOR_BUFFER_LENGTH 32 + +typedef enum { + SAHPI_SENSOR_INTERPRETED_TYPE_UINT8, + SAHPI_SENSOR_INTERPRETED_TYPE_UINT16, + SAHPI_SENSOR_INTERPRETED_TYPE_UINT32, + SAHPI_SENSOR_INTERPRETED_TYPE_INT8, + SAHPI_SENSOR_INTERPRETED_TYPE_INT16, + SAHPI_SENSOR_INTERPRETED_TYPE_INT32, + SAHPI_SENSOR_INTERPRETED_TYPE_FLOAT32, + SAHPI_SENSOR_INTERPRETED_TYPE_BUFFER /* 32 byte array */ +} SaHpiSensorInterpretedTypeT; + +typedef union { + SaHpiUint8T SensorUint8; + SaHpiUint16T SensorUint16; + SaHpiUint32T SensorUint32; + SaHpiInt8T SensorInt8; + SaHpiInt16T SensorInt16; + SaHpiInt32T SensorInt32; + SaHpiFloat32T SensorFloat32; + SaHpiUint8T SensorBuffer[SAHPI_SENSOR_BUFFER_LENGTH]; +} SaHpiSensorInterpretedUnionT; + +typedef struct { + SaHpiSensorInterpretedTypeT Type; + SaHpiSensorInterpretedUnionT Value; +} SaHpiSensorInterpretedT; + +/* +** Sensor Status +** +** The sensor status structure is used to determine if sensor scanning is +** enabled and if events are enabled. If events are enabled, the structure will +** have valid data for the outstanding sensor event states. +*/ +typedef SaHpiUint8T SaHpiSensorStatusT; +#define SAHPI_SENSTAT_EVENTS_ENABLED (SaHpiSensorStatusT)0x80 +#define SAHPI_SENSTAT_SCAN_ENABLED (SaHpiSensorStatusT)0x40 +#define SAHPI_SENSTAT_BUSY (SaHpiSensorStatusT)0x20 + +typedef struct { + SaHpiSensorStatusT SensorStatus; + SaHpiEventStateT EventStatus; +} SaHpiSensorEvtStatusT; + +/* Sensor Event Enables */ +typedef struct { + SaHpiSensorStatusT SensorStatus; + SaHpiEventStateT AssertEvents; + SaHpiEventStateT DeassertEvents; +} SaHpiSensorEvtEnablesT; + +/* +** Sensor Reading +** +** The sensor reading type is the data structure returned from a call to get +** sensor reading. The structure is also used when setting and getting sensor +** threshold values and reporting sensor ranges. +** Each sensor may support one or more of raw, interpreted, or event status +** representations of the sensor data. For analog sensors the raw value is the +** raw value from the sensor (such as ticks per fan blade) and the interpreted +** value is the raw value converted in to a usable format (such as RPM). The +** interpreted value can be calculated by the HPI implementation using the +** sensor factors or by another OEM means. +*/ +typedef SaHpiUint8T SaHpiSensorReadingFormatsT; +#define SAHPI_SRF_RAW (SaHpiSensorReadingFormatsT)0x01 +#define SAHPI_SRF_INTERPRETED (SaHpiSensorReadingFormatsT)0x02 +#define SAHPI_SRF_EVENT_STATE (SaHpiSensorReadingFormatsT)0x04 + +typedef struct { + SaHpiSensorReadingFormatsT ValuesPresent; + SaHpiUint32T Raw; + SaHpiSensorInterpretedT Interpreted; + SaHpiSensorEvtStatusT EventStatus; +} SaHpiSensorReadingT; + +/* +** Threshold Values +** This structure encompasses all of the thresholds that can be set. +*/ +typedef struct { + SaHpiSensorReadingT LowCritical; /* Lower Critical Threshold */ + SaHpiSensorReadingT LowMajor; /* Lower Major Threshold */ + SaHpiSensorReadingT LowMinor; /* Lower Minor Threshold */ + SaHpiSensorReadingT UpCritical; /* Upper critical Threshold */ + SaHpiSensorReadingT UpMajor; /* Upper major Threshold */ + SaHpiSensorReadingT UpMinor; /* Upper minor Threshold */ + SaHpiSensorReadingT PosThdHysteresis; /* Positive Threshold Hysteresis */ + SaHpiSensorReadingT NegThdHysteresis; /* Negative Threshold Hysteresis */ +}SaHpiSensorThresholdsT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Sensor Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** Sensor Factors +** +** The sensor factors structure defines the conversion factors for linear and +** linearized sensors. +** The SaHpiSensorLinearizationT enumeration coupled with the various other +** sensor factors define a formula that can be applied to raw sensor data to +** convert it to appropriate engineering units. If linearization is +** SAHPI_SL_NONLINEAR, SAHPI_SL_UNSPECIFIED, or SAHPI_SL_OEM then there is no +** predefined conversion from raw to interpreted and the sensor factors may or +** may not be meaningful depending on the implementation. +** For other linearization values, raw readings may be converted to interpreted +** values using the formula: +**Interpreted = L [( M*raw + B*10^ExpB )*10^ExpR ] +**where "L[x]" is the indicated linearization function +** (for SAHPI_SL_LINEAR, L[x]=x). +** The Tolerance Factor is given as +/- 1/2 raw counts, so tolerance in +** interpreted values can be calculated as: +** L[ M * ToleranceFactor/2 * 10^ExpR ] +** The Accuracy Factor is given as 1/100 of a percent, scaled up by ExpA. Thus +** the accuracy is: +**( ( AccuracyFactor/100 ) / 10^ExpA )% +*/ +typedef enum { + SAHPI_SL_LINEAR = 0, /* Already linear */ + SAHPI_SL_LN, + SAHPI_SL_LOG10, + SAHPI_SL_LOG2, + SAHPI_SL_E, + SAHPI_SL_EXP10, + SAHPI_SL_EXP2, + SAHPI_SL_1OVERX, + SAHPI_SL_SQRX, + SAHPI_SL_CUBEX, + SAHPI_SL_SQRTX, + SAHPI_SL_CUBERTX, + SAHPI_SL_NONLINEAR = 0x70, /* Cannot be linearized with a predefind formula*/ + SAHPI_SL_OEM, + SAHPI_SL_UNSPECIFIED = 0xFF +} SaHpiSensorLinearizationT; + +typedef struct { + SaHpiInt16T M_Factor; /* M Factor */ + SaHpiInt16T B_Factor; /* B Factor */ + SaHpiUint16T AccuracyFactor; /* Accuracy */ + SaHpiUint8T ToleranceFactor; /* Tolerance */ + SaHpiUint8T ExpA; /* Accuracy Exp */ + SaHpiInt8T ExpR; /* Result Exp */ + SaHpiInt8T ExpB; /* B Exp */ + SaHpiSensorLinearizationT Linearization; +} SaHpiSensorFactorsT; + +/* +** Sensor Range +** Sensor range values can include minimum, maximum, normal minimum, normal +** maximum, and nominal values. +*/ +typedef SaHpiUint8T SaHpiSensorRangeFlagsT; +#define SAHPI_SRF_MIN (SaHpiSensorRangeFlagsT)0x10 +#define SAHPI_SRF_MAX (SaHpiSensorRangeFlagsT)0x08 +#define SAHPI_SRF_NORMAL_MIN (SaHpiSensorRangeFlagsT)0x04 +#define SAHPI_SRF_NORMAL_MAX (SaHpiSensorRangeFlagsT)0x02 +#define SAHPI_SRF_NOMINAL (SaHpiSensorRangeFlagsT)0x01 + +typedef struct { + SaHpiSensorRangeFlagsT Flags; + SaHpiSensorReadingT Max; + SaHpiSensorReadingT Min; + SaHpiSensorReadingT Nominal; + SaHpiSensorReadingT NormalMax; + SaHpiSensorReadingT NormalMin; +} SaHpiSensorRangeT; + +/* +** Sensor Units +** This is a list of all the sensor units supported by HPI. +*/ +typedef enum { + SAHPI_SU_UNSPECIFIED = 0, SAHPI_SU_DEGREES_C, SAHPI_SU_DEGREES_F, + SAHPI_SU_DEGREES_K, SAHPI_SU_VOLTS, SAHPI_SU_AMPS, + SAHPI_SU_WATTS, SAHPI_SU_JOULES, SAHPI_SU_COULOMBS, + SAHPI_SU_VA, SAHPI_SU_NITS, SAHPI_SU_LUMEN, + SAHPI_SU_LUX, SAHPI_SU_CANDELA, SAHPI_SU_KPA, + SAHPI_SU_PSI, SAHPI_SU_NEWTON, SAHPI_SU_CFM, + SAHPI_SU_RPM, SAHPI_SU_HZ, SAHPI_SU_MICROSECOND, + SAHPI_SU_MILLISECOND, SAHPI_SU_SECOND, SAHPI_SU_MINUTE, + SAHPI_SU_HOUR, SAHPI_SU_DAY, SAHPI_SU_WEEK, + SAHPI_SU_MIL, SAHPI_SU_INCHES, SAHPI_SU_FEET, + SAHPI_SU_CU_IN, SAHPI_SU_CU_FEET, SAHPI_SU_MM, + SAHPI_SU_CM, SAHPI_SU_M, SAHPI_SU_CU_CM, + SAHPI_SU_CU_M, SAHPI_SU_LITERS, SAHPI_SU_FLUID_OUNCE, + SAHPI_SU_RADIANS, SAHPI_SU_STERADIANS, SAHPI_SU_REVOLUTIONS, + SAHPI_SU_CYCLES, SAHPI_SU_GRAVITIES, SAHPI_SU_OUNCE, + SAHPI_SU_POUND, SAHPI_SU_FT_LB, SAHPI_SU_OZ_IN, + SAHPI_SU_GAUSS, SAHPI_SU_GILBERTS, SAHPI_SU_HENRY, + SAHPI_SU_MILLIHENRY, SAHPI_SU_FARAD, SAHPI_SU_MICROFARAD, + SAHPI_SU_OHMS, SAHPI_SU_SIEMENS, SAHPI_SU_MOLE, + SAHPI_SU_BECQUEREL, SAHPI_SU_PPM, SAHPI_SU_RESERVED, + SAHPI_SU_DECIBELS, SAHPI_SU_DBA, SAHPI_SU_DBC, + SAHPI_SU_GRAY, SAHPI_SU_SIEVERT, SAHPI_SU_COLOR_TEMP_DEG_K, + SAHPI_SU_BIT, SAHPI_SU_KILOBIT, SAHPI_SU_MEGABIT, + SAHPI_SU_GIGABIT, SAHPI_SU_BYTE, SAHPI_SU_KILOBYTE, + SAHPI_SU_MEGABYTE, SAHPI_SU_GIGABYTE, SAHPI_SU_WORD, + SAHPI_SU_DWORD, SAHPI_SU_QWORD, SAHPI_SU_LINE, + SAHPI_SU_HIT, SAHPI_SU_MISS, SAHPI_SU_RETRY, + SAHPI_SU_RESET, SAHPI_SU_OVERRUN, SAHPI_SU_UNDERRUN, + SAHPI_SU_COLLISION, SAHPI_SU_PACKETS, SAHPI_SU_MESSAGES, + SAHPI_SU_CHARACTERS, SAHPI_SU_ERRORS, SAHPI_SU_CORRECTABLE_ERRORS, + SAHPI_SU_UNCORRECTABLE_ERRORS +} SaHpiSensorUnitsT; + +/* +** Modifier Unit Use +** This type defines how the modifier unit is used. For example: base unit == +** meter, modifier unit == seconds, and modifier unit use == +** SAHPI_SMUU_BASIC_OVER_MODIFIER. The resulting unit would be meters per second. +*/ +typedef enum { + SAHPI_SMUU_NONE = 0, + SAHPI_SMUU_BASIC_OVER_MODIFIER, /* Basic Unit / Modifier Unit */ + SAHPI_SMUU_BASIC_TIMES_MODIFIER /* Basic Unit * Modifier Unit */ +} SaHpiSensorModUnitUseT; + +/* +** Sign Format +** This type defines what the sign format of the sensor's raw value is (1's +** complement, unsigned, etc.). +*/ +typedef enum { + SAHPI_SDF_UNSIGNED = 0, + SAHPI_SDF_1S_COMPLEMENT, + SAHPI_SDF_2S_COMPLEMENT +} SaHpiSensorSignFormatT; + +/* +** Data Format +** This structure encapsulates all of the various types that make up the +** definition of sensor data. +*/ +typedef struct { + SaHpiSensorReadingFormatsT ReadingFormats; /* Indicates if sensor supports + readings in raw, interpreted, + and/or event status formats */ + SaHpiBoolT IsNumeric; /* If FALSE, rest of this + structure is not + meaningful */ + SaHpiSensorSignFormatT SignFormat; /* Signed format */ + SaHpiSensorUnitsT BaseUnits; /* Base units (meters, etc.) */ + SaHpiSensorUnitsT ModifierUnits; /* Modifier unit (second, etc.) */ + SaHpiSensorModUnitUseT ModifierUse; /* Modifier use(m/sec, etc.) */ + SaHpiBoolT FactorsStatic; /* True if the sensor factors + are static. If false + factors vary over sensor + range, and are not + accessible through HPI */ + SaHpiSensorFactorsT Factors; + SaHpiBoolT Percentage; /* Is value a percentage */ + SaHpiSensorRangeT Range; /* Valid range of sensor */ +} SaHpiSensorDataFormatT; + +/* +** Threshold Support +** +** These types define what threshold values are readable, writable, and fixed. +** It also defines how the threshold values are read and written. +*/ +typedef SaHpiUint8T SaHpiSensorThdMaskT; +#define SAHPI_STM_LOW_MINOR (SaHpiSensorThdMaskT)0x01 +#define SAHPI_STM_LOW_MAJOR (SaHpiSensorThdMaskT)0x02 +#define SAHPI_STM_LOW_CRIT (SaHpiSensorThdMaskT)0x04 +#define SAHPI_STM_UP_MINOR (SaHpiSensorThdMaskT)0x08 +#define SAHPI_STM_UP_MAJOR (SaHpiSensorThdMaskT)0x10 +#define SAHPI_STM_UP_CRIT (SaHpiSensorThdMaskT)0x20 +#define SAHPI_STM_UP_HYSTERESIS (SaHpiSensorThdMaskT)0x40 +#define SAHPI_STM_LOW_HYSTERESIS (SaHpiSensorThdMaskT)0x80 + +typedef SaHpiUint8T SaHpiSensorThdCapT; +#define SAHPI_STC_RAW (SaHpiSensorThdMaskT)0x01 /* read/write as + raw counts */ +#define SAHPI_STC_INTERPRETED (SaHpiSensorThdMaskT)0x02 /* read/write as + interpreted */ + +typedef struct { + SaHpiBoolT IsThreshold; /* True if the sensor + supports thresholds. If false, + rest of structure is not + meaningful. */ + SaHpiSensorThdCapT TholdCapabilities; + SaHpiSensorThdMaskT ReadThold; /* Readable thresholds */ + SaHpiSensorThdMaskT WriteThold; /* Writable thresholds */ + SaHpiSensorThdMaskT FixedThold; /* Fixed thresholds */ +} SaHpiSensorThdDefnT; + +/* +** Event Control +** +** This type defines how sensor event messages can be controlled (can be turned +** off and on for each type of event, etc.). +*/ +typedef enum { + SAHPI_SEC_PER_EVENT = 0, /* Event message control per event */ + SAHPI_SEC_ENTIRE_SENSOR, /* Control for entire sensor only */ + SAHPI_SEC_GLOBAL_DISABLE, /* Global disable of events only */ + SAHPI_SEC_NO_EVENTS /* Events not supported */ +} SaHpiSensorEventCtrlT; + +/* +** Record +** +** This is the sensor resource data record which describes all of the static +** data associated with a sensor. +*/ +typedef struct { + SaHpiSensorNumT Num; /* Sensor Number/Index */ + SaHpiSensorTypeT Type; /* General Sensor Type */ + SaHpiEventCategoryT Category; /* Event category */ + SaHpiSensorEventCtrlT EventCtrl; /* How events can be controlled */ + SaHpiEventStateT Events; /* Bit mask of event states + supported */ + SaHpiBoolT Ignore; /* Ignore sensor (entity not + present, disabled, etc.) */ + SaHpiSensorDataFormatT DataFormat; /* Format of the data */ + SaHpiSensorThdDefnT ThresholdDefn; /* Threshold Definition */ + SaHpiUint32T Oem; /* Reserved for OEM use */ +} SaHpiSensorRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Aggregate Status ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* These are the default sensor numbers for aggregate status. */ +#define SAHPI_DEFAGSENS_OPER (SaHpiSensorNumT)0xFE +#define SAHPI_DEFAGSENS_PWR (SaHpiSensorNumT)0xFD +#define SAHPI_DEFAGSENS_TEMP (SaHpiSensorNumT)0xFC + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Controls ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Control Number */ +typedef SaHpiUint8T SaHpiCtrlNumT; + +/* +** Type of Control +** +** This enumerated type defines the different types of generic controls. +*/ +typedef enum { + SAHPI_CTRL_TYPE_DIGITAL = 0x00, + SAHPI_CTRL_TYPE_DISCRETE, + SAHPI_CTRL_TYPE_ANALOG, + SAHPI_CTRL_TYPE_STREAM, + SAHPI_CTRL_TYPE_TEXT, + SAHPI_CTRL_TYPE_OEM = 0xC0 +} SaHpiCtrlTypeT; + +/* +** Control State Type Definitions +** +** Defines the types of control states. +*/ +typedef enum { + SAHPI_CTRL_STATE_OFF = 0, + SAHPI_CTRL_STATE_ON, + SAHPI_CTRL_STATE_PULSE_OFF, + SAHPI_CTRL_STATE_PULSE_ON, + SAHPI_CTRL_STATE_AUTO = 0xFF +} SaHpiCtrlStateDigitalT; + +typedef SaHpiUint32T SaHpiCtrlStateDiscreteT; + +typedef SaHpiInt32T SaHpiCtrlStateAnalogT; + +#define SAHPI_CTRL_MAX_STREAM_LENGTH 4 +typedef struct { + SaHpiBoolT Repeat; /* Repeat flag */ + SaHpiUint32T StreamLength; /* Length of the data, in bytes, + ** stored in the stream. */ + SaHpiUint8T Stream[SAHPI_CTRL_MAX_STREAM_LENGTH]; +} SaHpiCtrlStateStreamT; + +typedef SaHpiUint8T SaHpiTxtLineNumT; + +/* Reserved number for sending output to all lines */ +#define SAHPI_TLN_ALL_LINES (SaHpiTxtLineNumT)0xFF + +typedef struct { + SaHpiTxtLineNumT Line; /* Operate on line # */ + SaHpiTextBufferT Text; /* Text to display */ +} SaHpiCtrlStateTextT; + +#define SAHPI_CTRL_MAX_OEM_BODY_LENGTH 255 +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiUint8T BodyLength; + SaHpiUint8T Body[SAHPI_CTRL_MAX_OEM_BODY_LENGTH]; /* OEM Specific */ +} SaHpiCtrlStateOemT; + +typedef union { + SaHpiCtrlStateDigitalT Digital; + SaHpiCtrlStateDiscreteT Discrete; + SaHpiCtrlStateAnalogT Analog; + SaHpiCtrlStateStreamT Stream; + SaHpiCtrlStateTextT Text; + SaHpiCtrlStateOemT Oem; +} SaHpiCtrlStateUnionT; + +typedef struct { + SaHpiCtrlTypeT Type; /* Type of control */ + SaHpiCtrlStateUnionT StateUnion; /* Data for control type */ +} SaHpiCtrlStateT; + + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Control Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** Output Type +** +** This enumeration defines the what the control's output will be. +*/ +typedef enum { + SAHPI_CTRL_GENERIC = 0, + SAHPI_CTRL_LED, + SAHPI_CTRL_FAN_SPEED, + SAHPI_CTRL_DRY_CONTACT_CLOSURE, + SAHPI_CTRL_POWER_SUPPLY_INHIBIT, + SAHPI_CTRL_AUDIBLE, + SAHPI_CTRL_FRONT_PANEL_LOCKOUT, + SAHPI_CTRL_POWER_INTERLOCK, + SAHPI_CTRL_POWER_STATE, + SAHPI_CTRL_LCD_DISPLAY, + SAHPI_CTRL_OEM +} SaHpiCtrlOutputTypeT; + +/* +** Specific Record Types +** These types represent the specific types of control resource data records. +*/ +typedef struct { + SaHpiCtrlStateDigitalT Default; +} SaHpiCtrlRecDigitalT; + +typedef struct { + SaHpiCtrlStateDiscreteT Default; +} SaHpiCtrlRecDiscreteT; + +typedef struct { + SaHpiCtrlStateAnalogT Min; /* Minimum Value */ + SaHpiCtrlStateAnalogT Max; /* Maximum Value */ + SaHpiCtrlStateAnalogT Default; +} SaHpiCtrlRecAnalogT; + +typedef struct { + SaHpiCtrlStateStreamT Default; +} SaHpiCtrlRecStreamT; + +typedef struct { + SaHpiUint8T MaxChars; /* Maximum chars per line */ + SaHpiUint8T MaxLines; /* Maximum # of lines */ + SaHpiLanguageT Language; /* Language Code */ + SaHpiTextTypeT DataType; /* Permitted Data */ + SaHpiCtrlStateTextT Default; +} SaHpiCtrlRecTextT; + +#define SAHPI_CTRL_OEM_CONFIG_LENGTH 10 +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiUint8T ConfigData[SAHPI_CTRL_OEM_CONFIG_LENGTH]; + SaHpiCtrlStateOemT Default; +} SaHpiCtrlRecOemT; + +typedef union { + SaHpiCtrlRecDigitalT Digital; + SaHpiCtrlRecDiscreteT Discrete; + SaHpiCtrlRecAnalogT Analog; + SaHpiCtrlRecStreamT Stream; + SaHpiCtrlRecTextT Text; + SaHpiCtrlRecOemT Oem; +} SaHpiCtrlRecUnionT; + +/* +** Record Definition +** Definition of the control resource data record. +*/ +typedef struct { + SaHpiCtrlNumT Num; /* Control Number/Index */ + SaHpiBoolT Ignore; /* Ignore control (entity + not present, disabled, etc.) */ + SaHpiCtrlOutputTypeT OutputType; + SaHpiCtrlTypeT Type; /* Type of control */ + SaHpiCtrlRecUnionT TypeUnion; /* Specific control record */ + SaHpiUint32T Oem; /* Reserved for OEM use */ +} SaHpiCtrlRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Entity Inventory Data ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* +** These structures are used to read and write inventory data to entity inventory +** repositories within a resource. +*/ +/* +** Entity Inventory Repository ID +** Identifier for an entity inventory repository. +*/ +typedef SaHpiUint8T SaHpiEirIdT; +#define SAHPI_DEFAULT_INVENTORY_ID (SaHpiEirIdT)0x00 + +/* Data Validity */ +typedef enum { + SAHPI_INVENT_DATA_VALID, + SAHPI_INVENT_DATA_INVALID, + SAHPI_INVENT_DATA_OVERFLOW +} SaHpiInventDataValidityT; + +/* Inventory Record definitions */ +typedef enum { + SAHPI_INVENT_RECTYPE_INTERNAL_USE = 0xB0, + SAHPI_INVENT_RECTYPE_CHASSIS_INFO, + SAHPI_INVENT_RECTYPE_BOARD_INFO, + SAHPI_INVENT_RECTYPE_PRODUCT_INFO, + SAHPI_INVENT_RECTYPE_OEM = 0xC0 +} SaHpiInventDataRecordTypeT; + +typedef enum { + SAHPI_INVENT_CTYP_OTHER = 1, + SAHPI_INVENT_CTYP_UNKNOWN, + SAHPI_INVENT_CTYP_DESKTOP, + SAHPI_INVENT_CTYP_LOW_PROFILE_DESKTOP, + SAHPI_INVENT_CTYP_PIZZA_BOX, + SAHPI_INVENT_CTYP_MINI_TOWER, + SAHPI_INVENT_CTYP_TOWER, + SAHPI_INVENT_CTYP_PORTABLE, + SAHPI_INVENT_CTYP_LAPTOP, + SAHPI_INVENT_CTYP_NOTEBOOK, + SAHPI_INVENT_CTYP_HANDHELD, + SAHPI_INVENT_CTYP_DOCKING_STATION, + SAHPI_INVENT_CTYP_ALLINONE, + SAHPI_INVENT_CTYP_SUBNOTEBOOK, + SAHPI_INVENT_CTYP_SPACE_SAVING, + SAHPI_INVENT_CTYP_LUNCH_BOX, + SAHPI_INVENT_CTYP_MAIN_SERVER, + SAHPI_INVENT_CTYP_EXPANSION, + SAHPI_INVENT_CTYP_SUBCHASSIS, + SAHPI_INVENT_CTYP_BUS_EXPANSION_CHASSIS, + SAHPI_INVENT_CTYP_PERIPHERAL_CHASSIS, + SAHPI_INVENT_CTYP_RAID_CHASSIS, + SAHPI_INVENT_CTYP_RACKMOUNT +} SaHpiInventChassisTypeT; + +typedef struct { + SaHpiUint8T Data[1]; /* Variable length opaque data */ +} SaHpiInventInternalUseDataT; + +typedef struct { + SaHpiTimeT MfgDateTime; /* May be set to + SAHPI_TIME_UNSPECIFIED + if manufacturing + date/time not available */ + SaHpiTextBufferT *Manufacturer; + SaHpiTextBufferT *ProductName; + SaHpiTextBufferT *ProductVersion; + SaHpiTextBufferT *ModelNumber; + SaHpiTextBufferT *SerialNumber; + SaHpiTextBufferT *PartNumber; + SaHpiTextBufferT *FileId; + SaHpiTextBufferT *AssetTag; + SaHpiTextBufferT *CustomField[1]; /* Variable number of fields, + last is NULL */ +} SaHpiInventGeneralDataT; + +typedef struct { + SaHpiInventChassisTypeT Type; /* Type of chassis */ + SaHpiInventGeneralDataT GeneralData; +} SaHpiInventChassisDataT; + +typedef struct { + SaHpiManufacturerIdT MId;/* OEM Manuf. ID */ + SaHpiUint8T Data[1]; /* Variable length data, defined by OEM, + Length derived from DataLength in + SaHpiInventDataRecordT structure: + DataLength - 4(because DataLength + includes the MId) */ +} SaHpiInventOemDataT; + +typedef union { + SaHpiInventInternalUseDataT InternalUse; + SaHpiInventChassisDataT ChassisInfo; + SaHpiInventGeneralDataT BoardInfo; + SaHpiInventGeneralDataT ProductInfo; + SaHpiInventOemDataT OemData; +} SaHpiInventDataUnionT; + +typedef struct { + SaHpiInventDataRecordTypeT RecordType; + SaHpiUint32T DataLength; /* Length of Data field for + this record */ + SaHpiInventDataUnionT RecordData; /* Variable length data */ +} SaHpiInventDataRecordT; + +typedef struct { + SaHpiInventDataValidityT Validity; /* Indication as to whether data + Returned by + saHpiEntityInventoryDataRead() is + complete and valid. Unless this + flag indicates valid data, + saHpiEntityInventoryDataWrite() will + not take any actions except to + return an error.*/ + SaHpiInventDataRecordT *DataRecords[1]; /* Array of pointers to inventory + Data Records. Variable + number of entries. Last + entry is NULL. */ +} SaHpiInventoryDataT; + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Inventory Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** All inventory data contained in an entity inventory repository +** must be represented in the RDR repository +** with an SaHpiInventoryRecT. +*/ +typedef struct { + SaHpiEirIdT EirId; + SaHpiUint32T Oem; +} SaHpiInventoryRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Watchdogs ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** This section defines all of the data types associated with watchdog timers. +*/ + +/* Watchdog Number - Identifier for a watchdog timer. */ +typedef SaHpiUint8T SaHpiWatchdogNumT; +#define SAHPI_DEFAULT_WATCHDOG_NUM (SaHpiWatchdogNumT)0x00 + +/* +** Watchdog Timer Action +** +** These enumerations represent the possible actions to be taken upon watchdog +** timer timeout and the events that are generated for watchdog actions. +*/ +typedef enum { + SAHPI_WA_NO_ACTION = 0, + SAHPI_WA_RESET, + SAHPI_WA_POWER_DOWN, + SAHPI_WA_POWER_CYCLE +} SaHpiWatchdogActionT; + +typedef enum { + SAHPI_WAE_NO_ACTION = 0, + SAHPI_WAE_RESET, + SAHPI_WAE_POWER_DOWN, + SAHPI_WAE_POWER_CYCLE, + SAHPI_WAE_TIMER_INT=0x08 /* Used if Timer Preinterrupt only */ +} SaHpiWatchdogActionEventT; + +/* +** Watchdog Pre-timer Interrupt +** +** These enumerations represent the possible types of interrupts that may be +** triggered by a watchdog pre-timer event. The actual meaning of these +** operations may differ depending on the hardware architecture. +*/ +typedef enum { + SAHPI_WPI_NONE = 0, + SAHPI_WPI_SMI, + SAHPI_WPI_NMI, + SAHPI_WPI_MESSAGE_INTERRUPT, + SAHPI_WPI_OEM = 0x0F +} SaHpiWatchdogPretimerInterruptT; + +/* +** Watchdog Timer Use +** +** These enumerations represent the possible watchdog users that may have caused +** the watchdog to expire. For instance, if watchdog is being used during power +** on self test (POST), and it expires, the SAHPI_WTU_BIOS_POST expiration type +** will be set. Most specific uses for Watchdog timer by users of HPI should +** indicate SAHPI_WTU_SMS_OS if the use is to provide an OS-healthy heartbeat, +** or SAHPI_WTU_OEM if it is used for some other purpose. +*/ +typedef enum { + SAHPI_WTU_NONE = 0, + SAHPI_WTU_BIOS_FRB2, + SAHPI_WTU_BIOS_POST, + SAHPI_WTU_OS_LOAD, + SAHPI_WTU_SMS_OS, /* System Management System providing + heartbeat for OS */ + SAHPI_WTU_OEM, + SAHPI_WTU_UNSPECIFIED = 0x0F +} SaHpiWatchdogTimerUseT; + +/* +** Timer Use Expiration Flags +** These values are used for the Watchdog Timer Use Expiration flags in the +** SaHpiWatchdogT structure. +*/ +typedef SaHpiUint8T SaHpiWatchdogExpFlagsT; +#define SAHPI_WATCHDOG_EXP_BIOS_FRB2 (SaHpiWatchdogExpFlagsT)0x02 +#define SAHPI_WATCHDOG_EXP_BIOS_POST (SaHpiWatchdogExpFlagsT)0x04 +#define SAHPI_WATCHDOG_EXP_OS_LOAD (SaHpiWatchdogExpFlagsT)0x08 +#define SAHPI_WATCHDOG_EXP_SMS_OS (SaHpiWatchdogExpFlagsT)0x10 +#define SAHPI_WATCHDOG_EXP_OEM (SaHpiWatchdogExpFlagsT)0x20 + +/* +** Watchdog Structure +** +** This structure is used by the saHpiWatchdogTimerGet() and +** saHpiWatchdogTimerSet() functions. The use of the structure varies slightly by +** each function. +** +** For saHpiWatchdogTimerGet() : +** +** Log - indicates whether or not the Watchdog is configured to +** issue an event when it next times out. TRUE=event will +** be issued on timeout. +** Running - indicates whether or not the Watchdog is currently +** running or stopped. TRUE=Watchdog is running. +** TimerUse - indicates the current use of the timer; one of five +** preset uses which was included on the last +** saHpiWatchdogTimerSet() function call, or through some +** other implementation-dependent means to start the +** Watchdog timer. +** TimerAction - indicates what action will be taken when the Watchdog +** times out. +** PretimerInterrupt - indicates which action will be taken +** "PreTimeoutInterval" seconds prior to Watchdog timer +** expiration. +** PreTimeoutInterval - indicates how many milliseconds prior to timer time +** out the PretimerInterrupt action will be taken. If +** "PreTimeoutInterval" = 0, the PretimerInterrupt action +** will occur concurrently with "TimerAction." HPI +** implementations may not be able to support millisecond +** resolution and may have a maximum value restriction. +** These restrictions should be documented by the +** provider of the HPI interface. +** TimerUseExpFlags - set of five bit flags which indicate that a Watchdog +** timer timeout has occurred while the corresponding +** TimerUse value was set. Once set, these flags stay +** set until specifically cleared with a +** saHpiWatchdogTimerSet() call, or by some other +** implementation-dependent means. +** InitialCount - The time, in milliseconds, before the timer will time +** out after a saHpiWatchdogTimerReset() function call is +** made, or some other implementation-dependent strobe is +** sent to the Watchdog. HPI implementations may not be +** able to support millisecond resolution and may have a +** maximum value restriction. These restrictions should +** be documented by the provider of the HPI interface. +** PresentCount - The remaining time in milliseconds before the timer +** will time out unless a saHpiWatchdogTimerReset() +** function call is made, or some other implementation- +** dependent strobe is sent to the Watchdog. +** HPI implementations may not be able to support +** millisecond resolution on watchdog timers, but will +** return the number of clock ticks remaining times the +** number of milliseconds between each tick. +** +** For saHpiWatchdogTimerSet(): +** +** Log - indicates whether or not the Watchdog should issue +** an event when it next times out. TRUE=event will be +** issued on timeout. +** Running - indicates whether or not the Watchdog should be +** stopped before updating. +** TRUE = Watchdog is not stopped. If it is already +** stopped, it will remain stopped, but if it is +** running, it will continue to run, with the +** countdown timer reset to the new InitialCount. +** Note that there is a race condition possible +** with this setting, so it should be used with +** care. +** FALSE = Watchdog is stopped. After +** saHpiWatchdogTimerSet() is called, a subsequent +** call to saHpiWatchdogTimerReset() is required to +** start the timer. +** TimerUse - indicates the current use of the timer. Will control +** which TimerUseExpFlag is set if the timer expires. +** TimerAction - indicates what action will be taken when the Watchdog +** times out. +** PretimerInterrupt - indicates which action will be taken +** "PreTimeoutInterval" seconds prior to Watchdog timer +** expiration. +** PreTimeoutInterval - indicates how many milliseconds prior to timer time +** out the PretimerInterrupt action will be taken. If +** "PreTimeoutInterval" = 0, the PretimerInterrupt action +** will occur concurrently with "TimerAction." HPI +** implementations may not be able to support millisecond +** resolution and may have a maximum value restriction. +** These restrictions should be documented by the +** provider of the HPI interface. +** TimerUseExpFlags - Set of five bit flags corresponding to the five +** TimerUse values. For each bit set, the corresponding +** Timer Use Expiration Flag will be CLEARED. Generally, +** a program should only clear the Timer Use Expiration +** Flag corresponding to its own TimerUse, so that other +** software, which may have used the timer for another +** purpose in the past can still read its TimerUseExpFlag +** to determine whether or not the timer expired during +** that use. +** InitialCount - The time, in milliseconds, before the timer will time +** out after a saHpiWatchdogTimerReset() function call is +** made, or some other implementation-dependent strobe is +** sent to the Watchdog. HPI implementations may not be +** able to support millisecond resolution and may have a +** maximum value restriction. These restrictions should +** be documented by the provider of the HPI interface. +** PresentCount - Not used on saHpiWatchdogTimerSet() function. Ignored. +** +*/ + +typedef struct { + SaHpiBoolT Log; + SaHpiBoolT Running; + SaHpiWatchdogTimerUseT TimerUse; + SaHpiWatchdogActionT TimerAction; + SaHpiWatchdogPretimerInterruptT PretimerInterrupt; + SaHpiUint32T PreTimeoutInterval; + SaHpiWatchdogExpFlagsT TimerUseExpFlags; + SaHpiUint32T InitialCount; + SaHpiUint32T PresentCount; +} SaHpiWatchdogT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Watchdog Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** When the "Watchdog" capability is set in a resource, a watchdog with an +** identifier of SAHPI_DEFAULT_WATCHDOG_NUM is required. All watchdogs must be +** represented in the RDR repository with an SaHpiWatchdogRecT, including the +** watchdog with an identifier of SAHPI_DEFAULT_WATCHDOG_NUM. +*/ +typedef struct { + SaHpiWatchdogNumT WatchdogNum; + SaHpiUint32T Oem; +} SaHpiWatchdogRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Resource Data Record ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** The following describes the different types of records that exist within a +** RDR repository and the RDR super-structure to all of the specific RDR types +** (sensor, inventory data, watchdog, etc.). +*/ +typedef enum { + SAHPI_NO_RECORD, + SAHPI_CTRL_RDR, + SAHPI_SENSOR_RDR, + SAHPI_INVENTORY_RDR, + SAHPI_WATCHDOG_RDR +} SaHpiRdrTypeT; + +typedef union { + SaHpiCtrlRecT CtrlRec; + SaHpiSensorRecT SensorRec; + SaHpiInventoryRecT InventoryRec; + SaHpiWatchdogRecT WatchdogRec; +} SaHpiRdrTypeUnionT; + +typedef struct { + SaHpiEntryIdT RecordId; + SaHpiRdrTypeT RdrType; + SaHpiEntityPathT Entity; /* Entity to which this RDR relates. */ + SaHpiRdrTypeUnionT RdrTypeUnion; + SaHpiTextBufferT IdString; +} SaHpiRdrT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Hot Swap ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Power State */ +typedef enum { + SAHPI_HS_POWER_OFF = 0, + SAHPI_HS_POWER_ON, + SAHPI_HS_POWER_CYCLE +} SaHpiHsPowerStateT; + +/* Hot Swap Indicator State */ +typedef enum { + SAHPI_HS_INDICATOR_OFF = 0, + SAHPI_HS_INDICATOR_ON +} SaHpiHsIndicatorStateT; + +/* Hot Swap Action */ +typedef enum { + SAHPI_HS_ACTION_INSERTION = 0, + SAHPI_HS_ACTION_EXTRACTION +} SaHpiHsActionT; + +/* Hot Swap State */ +typedef enum { + SAHPI_HS_STATE_INACTIVE = 0, + SAHPI_HS_STATE_INSERTION_PENDING, + SAHPI_HS_STATE_ACTIVE_HEALTHY, + SAHPI_HS_STATE_ACTIVE_UNHEALTHY, + SAHPI_HS_STATE_EXTRACTION_PENDING, + SAHPI_HS_STATE_NOT_PRESENT +} SaHpiHsStateT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Events, Part 2 ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Event Data Structures */ + +/* +** Sensor Optional Data +** +** Sensor events may contain optional data items passed and stored with the +** event. If these optional data items are present, they will be included with +** the event data returned in response to a saHpiEventGet() or +** saHpiEventLogEntryGet() function call. Also, the optional data items may be +** included with the event data passed to the saHpiEventLogEntryAdd() function. +** +** Specific implementations of HPI may have restrictions on how much data may +** be passed to saHpiEventLogEntryAdd(). These restrictions should be documented +** by the provider of the HPI interface. +*/ +typedef enum { + SAHPI_CRITICAL = 0, + SAHPI_MAJOR, + SAHPI_MINOR, + SAHPI_INFORMATIONAL, + SAHPI_OK, + SAHPI_DEBUG = 0xF0 +} SaHpiSeverityT; + +typedef SaHpiUint8T SaHpiSensorOptionalDataT; + +#define SAHPI_SOD_TRIGGER_READING (SaHpiSensorOptionalDataT)0x01 +#define SAHPI_SOD_TRIGGER_THRESHOLD (SaHpiSensorOptionalDataT)0x02 +#define SAHPI_SOD_OEM (SaHpiSensorOptionalDataT)0x04 +#define SAHPI_SOD_PREVIOUS_STATE (SaHpiSensorOptionalDataT)0x08 +#define SAHPI_SOD_SENSOR_SPECIFIC (SaHpiSensorOptionalDataT)0x10 + +typedef struct { + SaHpiSensorNumT SensorNum; + SaHpiSensorTypeT SensorType; + SaHpiEventCategoryT EventCategory; + SaHpiBoolT Assertion; /* TRUE = Event State asserted + FALSE = deasserted */ + SaHpiEventStateT EventState; /* State being asserted + deasserted */ + SaHpiSensorOptionalDataT OptionalDataPresent; + SaHpiSensorReadingT TriggerReading; /* Reading that triggered + the event */ + SaHpiSensorReadingT TriggerThreshold; + SaHpiEventStateT PreviousState; + SaHpiUint32T Oem; + SaHpiUint32T SensorSpecific; +} SaHpiSensorEventT; + +typedef struct { + SaHpiHsStateT HotSwapState; + SaHpiHsStateT PreviousHotSwapState; +} SaHpiHotSwapEventT; + +typedef struct { + SaHpiWatchdogNumT WatchdogNum; + SaHpiWatchdogActionEventT WatchdogAction; + SaHpiWatchdogPretimerInterruptT WatchdogPreTimerAction; + SaHpiWatchdogTimerUseT WatchdogUse; +} SaHpiWatchdogEventT; + +#define SAHPI_OEM_EVENT_DATA_SIZE 32 +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiUint8T OemEventData[SAHPI_OEM_EVENT_DATA_SIZE]; +} SaHpiOemEventT; + +/* +** User events may be used for storing custom events created by the application / middleware; +** eg. when injecting events into the event log using saHpiEventLogEntryAdd(). +*/ +#define SAHPI_USER_EVENT_DATA_SIZE 32 +typedef struct { + SaHpiUint8T UserEventData[SAHPI_USER_EVENT_DATA_SIZE]; +} SaHpiUserEventT; + +typedef enum { + SAHPI_ET_SENSOR, + SAHPI_ET_HOTSWAP, + SAHPI_ET_WATCHDOG, + SAHPI_ET_OEM, + SAHPI_ET_USER +} SaHpiEventTypeT; + +typedef union { + SaHpiSensorEventT SensorEvent; + SaHpiHotSwapEventT HotSwapEvent; + SaHpiWatchdogEventT WatchdogEvent; + SaHpiOemEventT OemEvent; + SaHpiUserEventT UserEvent; +} SaHpiEventUnionT; + +typedef struct { + SaHpiResourceIdT Source; + SaHpiEventTypeT EventType; + SaHpiTimeT Timestamp; + SaHpiSeverityT Severity; + SaHpiEventUnionT EventDataUnion; +} SaHpiEventT; + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Parameter Control ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +typedef enum { + SAHPI_DEFAULT_PARM = 0, + SAHPI_SAVE_PARM, + SAHPI_RESTORE_PARM +} SaHpiParmActionT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Reset ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +typedef enum { + SAHPI_COLD_RESET = 0, + SAHPI_WARM_RESET, + SAHPI_RESET_ASSERT, + SAHPI_RESET_DEASSERT +} SaHpiResetActionT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Resource Presence Table ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* This section defines the types associated with the RPT. */ + +typedef struct { + SaHpiUint32T UpdateCount; /* This count is incremented any time the table + is changed. It rolls over to zero when the + maximum value is reached */ + SaHpiTimeT UpdateTimestamp; /* This time is set any time the table is + changed. If the implementation cannot + supply an absolute timestamp, then it may + supply a timestamp relative to some system- + defined epoch, such as system boot. The + value SAHPI_TIME_UNSPECIFIED indicates that + the time of the update cannot be determined. + Otherwise, If the value is less than or + equal to SAHPI_TIME_MAX_RELATIVE, then it + is relative; if it is greater than + SAHPI_TIME_MAX_RELATIVE, then it is absolute. */ +} SaHpiRptInfoT; + +/* +** Resource Info Type Definitions +** +** +** SaHpiResourceInfoT contains static configuration data concerning the +** management controller associated with the resource, or the resource itself. +** Note this information is used to describe the resource; that is, the piece of +** infrastructure which manages an entity (or multiple entities) - NOT the entities +** for which the resource provides management. The purpose of the +** SaHpiResourceInfoT structure is to provide information that the HPI user may +** need in order to interact correctly with the resource (e.g., recognize a +** specific management controller which may have defined OEM fields in sensors, +** OEM controls, etc.). +** +** All of the fields in the following structure may or may not be used by a +** given resource. +*/ +typedef struct { + SaHpiUint8T ResourceRev; + SaHpiUint8T SpecificVer; + SaHpiUint8T DeviceSupport; + SaHpiManufacturerIdT ManufacturerId; + SaHpiUint16T ProductId; + SaHpiUint8T FirmwareMajorRev; + SaHpiUint8T FirmwareMinorRev; + SaHpiUint8T AuxFirmwareRev; +} SaHpiResourceInfoT; + +/* +** Resource Capabilities +** +** This definition defines the capabilities of a given resource. One resource +** may support any number of capabilities using the bit mask. Every resource +** must set at least one of these capabilities; ie. zero is not a valid value +** for a resource's capabilities. +** +** SAHPI_CAPABILITY_DOMAIN +** SAHPI_CAPABILITY_RESOURCE +** SAHPI_CAPABILITY_EVT_DEASSERTS +** Indicates that all sensors on the resource have the property that their +** Assertion and Deassertion event enable flags are the same. That is, +** for all event states whose assertion triggers an event, it is +** guaranteed that the deassertion of that event will also +** trigger an event. Thus, the user may track the state of sensors on the +** resource by monitoring events rather than polling for state changes. +** SAHPI_CAPABILITY_AGGREGATE_STATUS +** SAHPI_CAPABILITY_CONFIGURATION +** SAHPI_CAPABILITY_MANAGED_HOTSWAP +** Indicates that the resource supports managed hotswap. Since hotswap only +** makes sense for field-replaceable units, the SAHPI_CAPABILITY_FRU +** capability bit must also be set for this resource. +** SAHPI_CAPABILITY_WATCHDOG +** SAHPI_CAPABILITY_CONTROL +** SAHPI_CAPABILITY_FRU +** Indicates that the resource is a field-replaceable unit; i.e., it is +** capable of being removed and replaced in a live system. This does not +** necessarily imply that the resource supports managed hotswap. +** SAHPI_CAPABILITY_INVENTORY_DATA +** SAHPI_CAPABILITY_SEL +** SAHPI_CAPABILITY_RDR +** Indicates that a resource data record (RDR) repository is supplied +** by the resource. Since the existence of an RDR is mandatory, this +** capability must be asserted. +** SAHPI_CAPABILITY_SENSOR +*/ + +typedef SaHpiUint32T SaHpiCapabilitiesT; +#define SAHPI_CAPABILITY_DOMAIN (SaHpiCapabilitiesT)0x80000000 +#define SAHPI_CAPABILITY_RESOURCE (SaHpiCapabilitiesT)0X40000000 +#define SAHPI_CAPABILITY_EVT_DEASSERTS (SaHpiCapabilitiesT)0x00008000 +#define SAHPI_CAPABILITY_AGGREGATE_STATUS (SaHpiCapabilitiesT)0x00002000 +#define SAHPI_CAPABILITY_CONFIGURATION (SaHpiCapabilitiesT)0x00001000 +#define SAHPI_CAPABILITY_MANAGED_HOTSWAP (SaHpiCapabilitiesT)0x00000800 +#define SAHPI_CAPABILITY_WATCHDOG (SaHpiCapabilitiesT)0x00000400 +#define SAHPI_CAPABILITY_CONTROL (SaHpiCapabilitiesT)0x00000200 +#define SAHPI_CAPABILITY_FRU (SaHpiCapabilitiesT)0x00000100 +#define SAHPI_CAPABILITY_INVENTORY_DATA (SaHpiCapabilitiesT)0x00000008 +#define SAHPI_CAPABILITY_SEL (SaHpiCapabilitiesT)0x00000004 +#define SAHPI_CAPABILITY_RDR (SaHpiCapabilitiesT)0x00000002 +#define SAHPI_CAPABILITY_SENSOR (SaHpiCapabilitiesT)0x00000001 + +/* +** RPT Entry +** +** This structure is used to store the RPT entry information. +** +** The ResourceCapabilities field definies the capabilities of the resource. +** This field must be non-zero for all valid resources. +** +** The ResourceTag field is an informational value that supplies the caller with naming +** information for the resource. This should be set to the "user-visible" name for a +** resource, which can be used to identify the resource in messages to a human operator. +** For example, it could be set to match a physical printed label attached to the primary +** entity which the resource manages. See section 5.2.6, saHpiResourceTagSet(), on page 33. +*/ +typedef struct { + SaHpiEntryIdT EntryId; + SaHpiResourceIdT ResourceId; + SaHpiResourceInfoT ResourceInfo; + SaHpiEntityPathT ResourceEntity; /* If resource manages a FRU, entity path of the FRU */ + /* If resource manages a single entity, entity path of + that entity. */ + /* If resource manages multiple entities, the + entity path of the "primary" entity managed by the + resource */ + /* Must be set to the same value in every domain which + contains this resource */ + SaHpiCapabilitiesT ResourceCapabilities; /* Must be non-0. */ + SaHpiSeverityT ResourceSeverity; /* Indicates the criticality that + should be raised when the resource + is not responding */ + SaHpiDomainIdT DomainId; /* The Domain ID is used when the resource + is also a domain. */ + SaHpiTextBufferT ResourceTag; +} SaHpiRptEntryT; + + + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** System Event Log ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* This section defines the types associated with the SEL. */ +/* +** Event Log Information +** +** The Entries entry denotes the number of active entries contained in the log. +** The Size entry denotes the total number of entries the log is able to hold. +** The UpdateTimestamp entry denotes the timestamp of the last addition, +** deletion or log clear operation. +** The CurrentTime entry denotes the log's idea of the current time; i.e the +** timestamp that would be placed on an entry if it was added now. +** The Enabled entry indicates whether the log is enabled. If the event log +** is "disabled" no events generated within the HPI implementation will be +** added to the event log. Events may still be added to the event log with +** the saHpiEventLogEntryAdd() function. When the event log is "enabled" +** events may be automatically added to the event log as they are generated +** in a resource or a domain, however, it is implementation-specific which +** events are automatically added to any event log. +** The OverflowFlag entry indicates the log has overflowed. Events have been +** dropped or overwritten due to a table overflow. +** The OverflowAction entry indicates the behavior of the SEL when an overflow +** occurs. +** The DeleteEntrySupported indicates whether the delete command is supported for +** event log entries. Note that clearing an entire log is valid even if this +** flag is not set. +*/ +typedef enum { + SAHPI_SEL_OVERFLOW_DROP, /* New entries are dropped when log is full*/ + SAHPI_SEL_OVERFLOW_WRAP, /* Log wraps when log is full */ + SAHPI_SEL_OVERFLOW_WRITELAST /* Last entry overwritten when log is full */ +} SaHpiSelOverflowActionT; + +typedef struct { + SaHpiUint32T Entries; + SaHpiUint32T Size; + SaHpiTimeT UpdateTimestamp; + SaHpiTimeT CurrentTime; + SaHpiBoolT Enabled; + SaHpiBoolT OverflowFlag; + SaHpiSelOverflowActionT OverflowAction; + SaHpiBoolT DeleteEntrySupported; +} SaHpiSelInfoT; +/* +** Event Log Entry +** These types define the event log entry. +*/ +typedef SaHpiUint32T SaHpiSelEntryIdT; +/* Reserved values for event log entry IDs */ +#define SAHPI_OLDEST_ENTRY (SaHpiSelEntryIdT)0x00000000 +#define SAHPI_NEWEST_ENTRY (SaHpiSelEntryIdT)0xFFFFFFFF +#define SAHPI_NO_MORE_ENTRIES (SaHpiSelEntryIdT)0xFFFFFFFE + + + +typedef struct { + SaHpiSelEntryIdT EntryId; /* Entry ID for record */ + SaHpiTimeT Timestamp; /* Time at which the event was placed + in the event log. The value + SAHPI_TIME_UNSPECIFIED indicates that + the time of the event cannot be + determined; otherwise, if less than + or equal to SAHPI_TIME_MAX_RELATIVE, + then it relative; if it is greater than + SAHPI_TIME_MAX_RELATIVE, then it is absolute. */ + SaHpiEventT Event; /* Logged Event */ +} SaHpiSelEntryT; + + + + + +/******************************************************************************* +** +** Name: saHpiInitialize +** +** Description: +** This function allows the management service an opportunity to perform +** platform-specific initialization. saHpiInitialize() must be called +** before any other functions are called. +** +** Parameters: +** HpiImplVersion - [out] Pointer to the version of the HPI +** implementation. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_DUPLICATE is returned when the HPI has already +** been initialized. Once one saHpiInitialize() call has been made, +** another one cannot be made until after a saHpiFinalize() call is made. +** +** +** Remarks: +** This function returns the version of the HPI implementation. Note: If +** the HPI interface version is needed it can be retrieved from the +** SAHPI_INTERFACE_VERSION definition. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiInitialize( + SAHPI_OUT SaHpiVersionT *HpiImplVersion +); + + +/******************************************************************************* +** +** Name: saHpiFinalize +** +** Description: +** This function allows the management service an opportunity to perform +** platform-specific cleanup. All sessions should be closed (see +** saHpiSessionClose()), before this function is executed. All open +** sessions will be forcibly closed upon execution of this command. +** +** Parameters: +** None. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. 5 Domains +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiFinalize ( +); + + +/******************************************************************************* +** +** Name: saHpiSessionOpen +** +** Description: +** This function opens a HPI session for a given domain and set of +** security characteristics (future). This function call assumes that a +** pre-arranged agreement between caller and the HPI implementation +** identifies the resources within the specified domain. As a future +** roadmap item, functions for discovery of domains and allocation of +** resources within domains may be developed. +** +** Parameters: +** DomainId - [in] Domain ID to be controlled by middleware/application. +** A domain ID of SAHPI_DEFAULT_DOMAIN_ID indicates the default domain. +** SessionId - [out] Pointer to a location to store a handle to the newly +** opened session. This handle is used for subsequent access to domain +** resources and events. +** SecurityParams - [in] Pointer to security and permissions data +** structure. This parameter is reserved for future use, and must be set +** to NULL. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_INVALID_DOMAIN is returned if no domain +** matching the specified domain ID exists. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSessionOpen ( + SAHPI_IN SaHpiDomainIdT DomainId, + SAHPI_OUT SaHpiSessionIdT *SessionId, + SAHPI_IN void *SecurityParams +); + + +/******************************************************************************* +** +** Name: saHpiSessionClose +** +** Description: +** This function closes a HPI session. After closing a session, the +** session ID will no longer be valid. +** +** Parameters: +** SessionId - [in] Session handle previously obtained using +** saHpiSessionOpen(). +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSessionClose ( + SAHPI_IN SaHpiSessionIdT SessionId +); + + +/******************************************************************************* +** +** Name: saHpiResourcesDiscover +** +** Description: +** This function requests the underlying management service to discover +** information about the resources it controls for the domain associated +** with the open session. This function may be called during operation to +** regenerate the RPT table. For those FRUs that must be discovered by +** polling, latency between FRU insertion and actual addition of the +** resource associated with that FRU to the RPT exists. To overcome this +** latency, a discovery of all present resources may be forced by calling +** saHpiResourcesDiscover (). +** +** Parameters: +** SessionId - [in] Handle to session context. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourcesDiscover ( + SAHPI_IN SaHpiSessionIdT SessionId +); + + +/******************************************************************************* +** +** Name: saHpiRptInfoGet +** +** Description: +** This function is used for requesting information about the resource +** presence table (RPT) such as an update counter and timestamp. This is +** particularly useful when using saHpiRptEntryGet() (see page 31). +** +** Parameters: +** SessionId - [in] Handle to session context. +** RptInfo - [out] Pointer to the information describing the resource +** presence table. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRptInfoGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiRptInfoT *RptInfo +); + + +/******************************************************************************* +** +** Name: saHpiRptEntryGet +** +** Description: +** This function retrieves resource information for the specified entry +** of the resource presence table. This function allows the caller to +** read the RPT entry-by-entry. If the EntryID parameter is set to +** SAHPI_FIRST_ENTRY, the first entry in the RPT will be returned. When +** an entry is successfully retrieved, *NextEntryID will be set to the +** ID of the next valid entry; however, when the last entry has been +** retrieved, *NextEntryID will be set to SAHPI_LAST_ENTRY. To retrieve +** an entire list of entries, call this function first with an EntryID of +** SAHPI_FIRST_ENTRY and then use the returned NextEntryID in the next +** call. Proceed until the NextEntryID returned is SAHPI_LAST_ENTRY. At +** initialization, the user may not wish to turn on eventing, since the +** context of the events, as provided by the RPT, is not known. In this +** instance, if a FRU is inserted into the system while the RPT is being +** read entry by entry, the resource associated with that FRU may be +** missed. (Keep in mind that there is no specified ordering for the RPT +** entries.) The update counter provides a means for insuring that no +** resources are missed when stepping through the RPT. In order to use +** this feature, the user should invoke saHpiRptInfoGet(), and get the +** update counter value before retrieving the first RPT entry. After +** reading the last entry, the user should again invoke the +** saHpiRptInfoGet() to get the update counter value. If the update +** counter has not been incremented, no new records have been added. +** +** Parameters: +** SessionId - [in] Handle to session context. +** EntryId - [in] Handle of the entry to retrieve from the RPT. Reserved +** entry ID values: SAHPI_FIRST_ENTRY Get first entry SAHPI_LAST_ENTRY +** Reserved as delimiter for end of list. Not a valid entry identifier. +** +** NextEntryId - [out] Pointer to location to store the record ID of next +** entry in RPT. +** RptEntry - [out] Pointer to the structure to hold the returned RPT +** entry. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRptEntryGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEntryIdT *NextEntryId, + SAHPI_OUT SaHpiRptEntryT *RptEntry +); + + +/******************************************************************************* +** +** Name: saHpiRptEntryGetByResourceId +** +** Description: +** This function retrieves resource information from the resource +** presence table for the specified resource using its resource ID. +** Typically at start-up, the RPT is read entry-by-entry, using +** saHpiRptEntryGet(). From this, the caller can establish the set of +** resource IDs to use for future calls to the HPI functions. However, +** there may be other ways of learning resource IDs without first reading +** the RPT. For example, resources may be added to the domain while the +** system is running in response to a hot-swap action. When a resource is +** added, the application will receive a hot-swap event containing the +** resource ID of the new resource. The application may then want to +** search the RPT for more detailed information on the newly added +** resource. In this case, the resource ID can be used to locate the +** applicable RPT entry information. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource whose RPT entry should +** be returned. +** RptEntry - [out] Pointer to structure to hold the returned RPT entry. +** +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRptEntryGetByResourceId ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiRptEntryT *RptEntry +); + + +/******************************************************************************* +** +** Name: saHpiResourceSeveritySet +** +** Description: +** This function allows the caller to set the severity level applied to +** an event issued if a resource unexpectedly becomes unavailable to the +** HPI. A resource may become unavailable for several reasons including: +** ? The FRU associated with the resource is no longer present in the +** system (a surprise extraction has occurred) ? A catastrophic failure +** has occurred Typically, the HPI implementation will provide an +** appropriate default value for this parameter, which may vary by +** resource; management software can override this default value by use +** of this function ? If a resource is removed from, then re-added to the +** RPT (e.g., because of a hot-swap action), the HPI implementation may +** reset the value of this parameter. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource for which the severity +** level will be set. +** Severity - [in] Severity level of event issued when the resource +** unexpectedly becomes unavailable to the HPI. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceSeveritySet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSeverityT Severity +); + + +/******************************************************************************* +** +** Name: saHpiResourceTagSet +** +** Description: +** This function allows the caller to set the resource tag for a +** particular resource. The resource tag is an informational value that +** supplies the caller with naming information for the resource. This +** should be set to the "user-visible" name for a resource, which can be +** used to identify the resource in messages to a human operator. For +** example, it could be set to match a physical, printed label attached +** to the entity associated with the resource. Typically, the HPI +** implementation will provide an appropriate default value for this +** parameter; this function is provided so that management software can +** override the default, if desired. The value of the resource tag may be +** retrieved from the resource's RPT entry. Note: If a resource is +** removed from, then re-added to the RPT (e.g., because of a hot-swap +** action), the HPI implementation may reset the value of this parameter. +** +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource for which the resource +** tag should be set. +** ResourceTag - [in] Pointer to string representing the resource tag. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceTagSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTextBufferT *ResourceTag +); + + +/******************************************************************************* +** +** Name: saHpiResourceIdGet +** +** Description: +** This function returns the resource ID of the resource associated with +** the entity upon which the caller is running. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [out] Pointer to location to hold the returned resource +** ID. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_NOT_PRESENT is returned if the entity the +** caller is running on is not manageable in the addressed domain. +** SA_ERR_HPI_UNKNOWN is returned if the domain controller cannot +** determine an appropriate response. That is, there may be an +** appropriate resource ID in the domain to return, but it cannot be +** determined. +** +** Remarks: +** This function must be issued within a session to a domain that +** includes a resource associated with the entity upon which the caller +** is running, or the SA_ERR_HPI_NOT_PRESENT return will be issued. Since +** entities are contained within other entities, there may be multiple +** possible resources that could be returned to this call. For example, +** if there is a resource ID associated with a particular compute blade +** upon which the caller is running, and another associated with the +** chassis which contains the compute blade, either could logically be +** returned as an indication of a resource associated with the entity +** upon which the caller was running. The function should return the +** resource ID of the "smallest" resource that is associated with the +** caller. So, in the example above, the function should return the +** resource ID of the compute blade. Once the function has returned the +** resourceID, the caller may issue further HPI calls using that +** resourceID to learn the type of resource that been identified. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceIdGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiResourceIdT *ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiEntitySchemaGet +** +** Description: +** This function returns the identifier of the Entity Schema for the HPI +** implementation. This schema defines valid Entity Paths that may be +** returned by the HPI implementation. +** +** Parameters: +** SessionId - [in] Handle to session context. +** SchemaId - [out] Pointer to the ID of the schema in use; zero +** indicates that a custom schema is in use. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** This function may be issued on any session opened to any domain in the +** system, and will return the same identifier. The identifier returned +** should either be zero, indicating that the HPI implementation uses a +** custom schema; or one of the schema identifiers defined in Appendix A, +** "Pre-Defined Entity Schemas," page 107. In the case of a custom +** schema, the HPI implementation may use arbitrary entity paths to +** describe resources in the system; in the case of a pre-defined schema, +** all entity paths should conform to the schema. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEntitySchemaGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiUint32T *SchemaId +); + + +/******************************************************************************* +** +** Name: saHpiEventLogInfoGet +** +** Description: +** This function retrieves the number of entries in the system event log, +** total size of the event log, timestamp for the most recent entry, the +** log's idea of the current time (i.e., timestamp that would be placed +** on an entry at this moment), enabled/disabled status of the log (see +** saHpiEventLogStateSet()), the overflow flag, the overflow action, and +** whether the log supports deletion of individual entries. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** Info - [out] Pointer to the returned SEL information. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogInfoGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiSelInfoT *Info +); + + +/******************************************************************************* +** +** Name: saHpiEventLogEntryGet +** +** Description: +** This function retrieves an event log entry from a system event log. +** The special entry IDs SAHPI_OLDEST_ENTRY and SAHPI_NEWEST_ENTRY are +** used to select the oldest and newest entries, respectively, in the log +** being read. A returned NextEntryID of SAHPI_NO_MORE_ENTRIES indicates +** that the newest entry has been returned; there are no more entries +** going forward (time-wise) in the log. A returned PrevEntryID of +** SAHPI_NO_MORE_ENTRIES indicates that the oldest entry has been +** returned. To retrieve an entire list of entries going forward (oldest +** entry to newest entry) in the log, call this function first with an +** EntryID of SAHPI_OLDEST_ENTRY and then use the returned NextEntryID as +** the EntryID in the next call. Proceed until the NextEntryID returned +** is SAHPI_NO_MORE_ENTRIES. To retrieve an entire list of entries going +** backward (newest entry to oldest entry) in the log, call this function +** first with an EntryID of SAHPI_NEWEST_ENTRY and then use the returned +** PrevEntryID as the EntryID in the next call. Proceed until the +** PrevEntryID returned is SAHPI_NO_MORE_ENTRIES. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be read. Set to SAHPI_DOMAIN_CONTROLLER_ID to address the +** domain system event log. +** EntryId - [in] Handle of the entry to retrieve from the SEL. Reserved +** event log entry ID values: SAHPI_OLDEST_ENTRY Oldest entry in the +** log. SAHPI_NEWEST_ENTRY Newest entry in the log. +** SAHPI_NO_MORE_ENTRIES Not valid for this parameter. Used only when +** retrieving the next and previous entry IDs. +** PrevEntryId - [out] Handle of previous (older adjacent) entry in event +** log. Reserved event log entry ID values: SAHPI_OLDEST_ENTRY Not valid +** for this parameter. Used only for the EntryID parameter. +** SAHPI_NEWEST_ENTRY Not valid for this parameter. Used only for the +** EntryID parameter. SAHPI_NO_MORE_ENTRIES No more entries in the log +** before the one referenced by the EntryId parameter. +** NextEntryId - [out] Handle of next (newer adjacent) entry in event +** log. Reserved event log entry ID values: SAHPI_OLDEST_ENTRY Not valid +** for this parameter. Used only for the EntryID parameter. +** SAHPI_NEWEST_ENTRY Not valid for this parameter. Used only for the +** EntryID parameter. SAHPI_NO_MORE_ENTRIES No more entries in the log +** after the one referenced by the EntryId parameter. +** EventLogEntry - [out] Pointer to retrieved event log entry. +** Rdr - [in/out] Pointer to structure to receive resource data record +** associated with the event, if available. If NULL, no RDR data will be +** returned. +** RptEntry - [in/out] Pointer to structure to receive RPT Entry +** associated with the event, if available. If NULL, no RPT entry data +** will be returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Event logs may include RPT entries and resource data records +** associated with the resource and sensor issuing an event along with +** the basic event data in the log. Because the system may be +** reconfigured after the event was entered in the log, this stored +** information may be important to interpret the event. If the event log +** includes logged RPT Entries and/or RDRs, and if the caller provides a +** pointer to a structure to receive this information, it will be +** returned along with the event log entry. If the caller provides a +** pointer for an RPT entry, but the event log does not include a logged +** RPT entry for the event being returned, RptEntry->ResourceCapabilities +** will be set to zero. No valid RPTEntry will have a zero value here. If +** the caller provides a pointer for an RDR, but the event log does not +** include a logged RDR for the event being returned, Rdr->RdrType will +** be set to SAHPI_NO_RECORD. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogEntryGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSelEntryIdT EntryId, + SAHPI_OUT SaHpiSelEntryIdT *PrevEntryId, + SAHPI_OUT SaHpiSelEntryIdT *NextEntryId, + SAHPI_OUT SaHpiSelEntryT *EventLogEntry, + SAHPI_INOUT SaHpiRdrT *Rdr, + SAHPI_INOUT SaHpiRptEntryT *RptEntry +); + + +/******************************************************************************* +** +** Name: saHpiEventLogEntryAdd +** +** Description: +** This function enables system management software to add entries to the +** system event log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the Domain System Event Log. +** EvtEntry - [in] Pointer to event log entry data to write to the system +** event log. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** This function forces a write of the event to the addressed event log. +** Nothing else is done with the event. Specific implementations of HPI +** may have restrictions on how much data may be passed to the +** saHpiEventLogEntryAdd() function. These restrictions should be +** documented by the provider of the HPI interface. If more event log +** data is provided than can be written, an error will be returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogEntryAdd ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSelEntryT *EvtEntry +); + + +/******************************************************************************* +** +** Name: saHpiEventLogEntryDelete +** +** Description: +** This function deletes an event log entry. This operation is only valid +** if so indicated by saHpiEventLogInfoGet(), via the +** DeleteEntrySupported field in the SaHpiSelInfoT structure. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] ResourceID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** EntryId - [in] Entry ID on the event log entry to delete. Reserved +** event log entry ID values: SAHPI_OLDEST_ENTRY - Oldest entry in the +** log. SAHPI_NEWEST_ENTRY - Newest entry in the log. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_INVALID_CMD is returned if this log does not +** support this operation. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogEntryDelete ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSelEntryIdT EntryId +); + + +/******************************************************************************* +** +** Name: saHpiEventLogClear +** +** Description: +** This function erases the contents of the specified system event log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] ResourceID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Note that all event logs must support the "clear" operation, +** regardless of the setting of the DeleteEntrySupported field in the +** SaHpiSelInfoT structure returned by saHpiEventLogInfoGet(). +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogClear ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiEventLogTimeGet +** +** Description: +** This function retrieves the current time from the event log's own time +** clock. The value of this clock is used to timestamp log entries +** written into the log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] ResourceID of the resource that contains the System +** Event Log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the Domain System Event Log. +** Time - [out] Pointer to the returned SEL current time. If the +** implementation cannot supply an absolute time value, then it may +** supply a time relative to some system-defined epoch, such as system +** boot. If the time value is less than or equal to +** SAHPI_TIME_MAX_RELATIVE, but not SAHPI_TIME_UNSPECIFIED, then it is +** relative; if it is greater than SAHPI_TIME_MAX_RELATIVE, then it is +** absolute. The value SAHPI_TIME_UNSPECIFIED indicates that the time is +** not set, or cannot be determined. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogTimeGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiTimeT *Time +); + + +/******************************************************************************* +** +** Name: saHpiEventLogTimeSet +** +** Description: +** This function sets the event log's time clock, which is used to +** timestamp events written into the log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be managed. set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** Time - [in] time to set the SEL clock to. If the implementation cannot +** supply an absolute time, then it may supply a time relative to some +** system-defined epoch, such as system boot. If the timestamp value is +** less than or equal to SAHPI_TIME_MAX_RELATIVE, but not +** SAHPI_TIME_UNSPECIFIED, then it is relative; if it is greater than +** SAHPI_TIME_MAX_RELATIVE, then it is absolute. The value +** SAHPI_TIME_UNSPECIFIED indicates that the time of the event cannot be +** determined. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogTimeSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTimeT Time +); + + +/******************************************************************************* +** +** Name: saHpiEventLogStateGet +** +** Description: +** This function enables system management software to get the event log +** state. If the event log is "disabled" no events generated within the +** HPI implementation will be added to the event log. Events may still be +** added to the event log with the saHpiEventLogEntryAdd() function. When +** the event log is "enabled" events may be automatically added to the +** event log as they are generated in a resource or a domain, however, it +** is implementation-specific which events are automatically added to any +** event log. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] ResourceID of the resource that contains the System +** Event Log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the Domain System Event Log. +** Enable - [out] Pointer to the current SEL state. True indicates that +** the SEL is enabled; false indicates that it is disabled. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiBoolT *Enable +); + + +/******************************************************************************* +** +** Name: saHpiEventLogStateSet +** +** Description: +** This function enables system management software to set the event log +** enabled state. If the event log is "disabled" no events generated +** within the HPI implementation will be added to the event log. Events +** may still be added to the event log using the saHpiEventLogEntryAdd() +** function. When the event log is "enabled" events may be automatically +** added to the event log as they are generated in a resource or a +** domain. The actual set of events that are automatically added to any +** event log is implementation-specific. Typically, the HPI +** implementation will provide an appropriate default value for this +** parameter, which may vary by resource. This function is provided so +** that management software can override the default, if desired. Note: +** If a resource hosting an event log is re-initialized (e.g., because of +** a hot-swap action), the HPI implementation may reset the value of this +** parameter. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the system +** event log to be managed. Set to SAHPI_DOMAIN_CONTROLLER_ID to address +** the domain system event log. +** Enable - [in] SEL state to be set. True indicates that the SEL is to +** be enabled; false indicates that it is to be disabled. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiBoolT Enable +); + + +/******************************************************************************* +** +** Name: saHpiSubscribe +** +** Description: +** This function allows the caller to subscribe for session events. This +** single call provides subscription to all session events, regardless of +** event type or event severity. Only one subscription is allowed per +** session, and additional subscribers will receive an appropriate error +** code. No event filtering will be done by the underlying management +** service. +** +** Parameters: +** SessionId - [in] Session for which event subscription will be opened. +** ProvideActiveAlarms - [in] Indicates whether or not alarms which are +** active at the time of subscription should be queued for future +** retrieval via the saHpiEventGet() function. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_DUPLICATE is returned when a subscription is +** already in place for this session. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSubscribe ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiBoolT ProvideActiveAlarms +); + + +/******************************************************************************* +** +** Name: saHpiUnsubscribe +** +** Description: +** This function removes the event subscription for the session. After +** removal of a subscription, additional saHpiEventGet() calls will not +** be allowed unless the caller re-subscribes for events first. Any +** events that are still in the event queue when this function is called +** will be cleared from it. +** +** Parameters: +** SessionId - [in] Session for which event subscription will be closed. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_INVALID_REQUEST is returned if the caller is +** not currently subscribed for events in this session. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiUnsubscribe ( + SAHPI_IN SaHpiSessionIdT SessionId +); + + +/******************************************************************************* +** +** Name: saHpiEventGet +** +** Description: +** This function allows the caller to get an event. This call is only +** valid within a session, which has subscribed for events. If the +** ProvideActiveAlarms parameter was set in the subscription, the first +** events retrieved will reflect the state of currently active alarms for +** the resources belonging to the domain. After all active alarms are +** retrieved this function will begin returning newly generated events as +** the domain controller receives them. If there are one or more events +** on the event queue when this function is called, it will immediately +** return the next event on the queue. Otherwise, if the Timeout +** parameter is SAHPI_TIMEOUT_IMMEDIATE, it will return +** SA_ERR_HPI_TIMEOUT immediately. Otherwise, it will block for a time +** specified by the timeout parameter; if an event is added to the queue +** within that time, it will be returned immediately; if not, +** saHpiEventGet() will return SA_ERR_HPI_TIMEOUT. If the Timeout +** parameter is SAHPI_TIMEOUT_BLOCK, then saHpiEventGet() will block +** indefinitely, until an event becomes available, and then return that +** event. This provides for notification of events as they occur. +** +** Parameters: +** SessionId - [in] Session for which events are retrieved. +** Timeout - [in] The number of nanoseconds to wait for an event to +** arrive. Reserved time out values: SAHPI_TIMEOUT_IMMEDIATE Time out +** immediately if there are no events available (non-blocking call). +** SAHPI_TIMEOUT_BLOCK Call should not return until an event is +** retrieved. +** Event - [out] Pointer to the next available event. +** Rdr - [in/out] Pointer to structure to receive the resource data +** associated with the event. If NULL, no RDR will be returned. +** RptEntry - [in/out] Pointer to structure to receive the RPT entry +** associated with the resource that generated the event. If NULL, no RPT +** entry will be returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_TIMEOUT is returned if no event is available +** to return within the timeout period. If SAHPI_TIMEOUT_IMMEDIATE is +** passed in the Timeout parameter, this error return will be used if +** there is no event queued when the function is called. +** +** Remarks: +** If the caller provides a pointer for an RPT entry, but the event does +** not include a valid resource ID for a resource in the domain (possible +** on OEM or USER type event), then the ResourceCapabilities field in +** *RptEntry will be set to zero. No valid RPT entry will have a zero +** value here. If the caller provides a pointer for an RDR, but there is +** no valid RDR associated with the event being returned (e.g., returned +** event is not a sensor event), Rdr->RdrType will be set to +** SAHPI_NO_RECORD. The timestamp reported in the returned event +** structure is the best approximation an implementation has to when the +** event actually occurred. The implementation may need to make an +** approximation (such as the time the event was placed on the event +** queue) because it may not have access to the actual time the event +** occurred. The value SAHPI_TIME_UNSPECIFIED indicates that the time of +** the event cannot be determined. If the implementation cannot supply an +** absolute timestamp, then it may supply a timestamp relative to some +** system-defined epoch, such as system boot. If the timestamp value is +** less than or equal to SAHPI_TIME_MAX_RELATIVE, but not +** SAHPI_TIME_UNSPECIFIED, then it is relative; if it is greater than +** SAHPI_TIME_MAX_RELATIVE, then it is absolute. 6 Resource Functions +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiTimeoutT Timeout, + SAHPI_OUT SaHpiEventT *Event, + SAHPI_INOUT SaHpiRdrT *Rdr, + SAHPI_INOUT SaHpiRptEntryT *RptEntry +); + + +/******************************************************************************* +** +** Name: saHpiRdrGet +** +** Description: +** This function returns a resource data record from the addressed +** resource. Submitting an EntryId of SAHPI_FIRST_ENTRY results in the +** first RDR being read. A returned NextEntryID of SAHPI_LAST_ENTRY +** indicates the last RDR has been returned. A successful retrieval will +** include the next valid EntryId. To retrieve the entire list of RDRs, +** call this function first with an EntryId of SAHPI_FIRST_ENTRY and then +** use the returned NextEntryId in the next call. Proceed until the +** NextEntryId returned is SAHPI_LAST_ENTRY. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** EntryId - [in] Handle of the RDR to retrieve. Reserved entry ID +** values: SAHPI_FIRST_ENTRY Get first entry SAHPI_LAST_ENTRY Reserved as +** delimiter for end of list. Not a valid entry identifier. +** NextEntryId - [out] Pointer to location to store Entry ID of next +** entry in RDR repository. +** Rdr - [out] Pointer to the structure to receive the requested resource +** data record. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** A resource's RDR repository is static over the lifetime of the +** resource; therefore no precautions are required against changes to the +** content of the RDR repository while it is being accessed. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRdrGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEntryIdT *NextEntryId, + SAHPI_OUT SaHpiRdrT *Rdr +); + + +/******************************************************************************* +** +** Name: saHpiSensorReadingGet +** +** Description: +** This function is used to retrieve a sensor reading. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which the sensor reading is being +** retrieved. +** Reading - [out] Pointer to a structure to receive sensor reading +** values. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorReadingGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorReadingT *Reading +); + + +/******************************************************************************* +** +** Name: saHpiSensorReadingConvert +** +** Description: +** This function converts between raw and interpreted sensor reading +** values. The type of conversion done depends on the passed-in +** ReadingInput parameter. If it contains only a raw value, then this is +** converted to an interpreted value in ConvertedReading; if it contains +** only an interpreted value, then this is converted to a raw value in +** ConvertedReading. If it contains neither type of value, or both, then +** an error is returned. The ReadingInput parameter is not altered in any +** case. If the sensor does not use raw values - i.e., it directly +** returns interpreted values - then this routine returns an error. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which reading is associated. +** ReadingInput - [in] Pointer to the structure that contains raw or +** interpreted reading to be converted. +** ConvertedReading - [out] Pointer to structure to hold converted +** reading. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_HPI_INVALID_PARAMS is returned if the ReadingInput +** parameter is invalid; e.g. if it contains neither a raw nor an +** interpreted value; or if it contains both; or if it contains an +** invalid value. SA_ERR_HPI_INVALID_DATA is returned if the sensor does +** not support raw readings. SA_ERR_HPI_NOT_PRESENT is returned if the +** sensor is not present. +** +** Remarks: +** The EventStatus field in ReadingInput is not used by this function. To +** make conversions, sensor-specific data may be required. Thus, the +** function references a particular sensor in the system through the +** SessionID/ResourceID/SensorNum parameters. If this sensor is not +** present, and sensor- specific information is required, the conversion +** will fail and SA_ERR_HPI_NOT_PRESENT will be returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorReadingConvert ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiSensorReadingT *ReadingInput, + SAHPI_OUT SaHpiSensorReadingT *ConvertedReading +); + + +/******************************************************************************* +** +** Name: saHpiSensorThresholdsGet +** +** Description: +** This function retrieves the thresholds for the given sensor. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which threshold values are being +** retrieved. +** SensorThresholds - [out] Pointer to returned sensor thresholds. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorThresholdsGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorThresholdsT *SensorThresholds +); + + +/******************************************************************************* +** +** Name: saHpiSensorThresholdsSet +** +** Description: +** This function sets the specified thresholds for the given sensor. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of addressed resource. +** SensorNum - [in] Sensor number for which threshold values are being +** set. +** SensorThresholds - [in] Pointer to the sensor thresholds values being +** set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** For each threshold or hysteresis value to be set, the corresponding +** sensor reading structure must indicate whether a raw or interpreted +** value is present. If neither are present, then that threshold or +** hysteresis value will not be set. Each sensor may require settings to +** be done with raw, or interpreted values, or may permit either; this is +** defined by the field ThresholdDefn.TholdCapabilities in the sensor's +** RDR (saHpiSensorRecT). If the interpreted value and raw value are both +** provided, and both are legal for the sensor, the interpreted value +** will be ignored and the raw value will be used. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorThresholdsSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiSensorThresholdsT *SensorThresholds +); + + +/******************************************************************************* +** +** Name: saHpiSensorTypeGet +** +** Description: +** This function retrieves the sensor type and event category for the +** specified sensor. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which the type is being retrieved +** Type - [out] Pointer to returned enumerated sensor type for the +** specified sensor. +** Category - [out] Pointer to location to receive the returned sensor +** event category. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorTypeGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorTypeT *Type, + SAHPI_OUT SaHpiEventCategoryT *Category +); + + +/******************************************************************************* +** +** Name: saHpiSensorEventEnablesGet +** +** Description: +** This function provides the ability to get the disable or enable event +** message generation status for individual sensor events. The sensor +** event states are relative to the event category specified by the +** sensor. See the SaHpiEventCategoryT definition in section 7.3, +** "Events, Part 1," on page 83 for more information. Within the +** structure returned, there are two elements that contain bit flags; one +** for assertion events and one for de-assertion events. A bit set to '1' +** in the "AssertEvents" element in the structure indicates that an event +** will be generated when the corresponding event state changes from +** de-asserted to asserted on that sensor. A bit set to '1' in the +** "DeassertEvents" element in the structure indicates that an event will +** be generated when the corresponding event state changes from asserted +** to de-asserted on that sensor. The saHpiSensorEventEnablesGet() +** function also returns the general sensor status - whether the sensor +** is completely disabled, or event generation is completely disabled. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which the event enable +** configuration is being requested +** Enables - [out] Pointer to the structure for returning sensor status +** and event enable information. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Disabling events means that events are disabled for all sessions, not +** just the session referenced by the SessionId parameter. For sensors +** hosted by resources that have the "SAHPI_CAPABILITY_EVT_DEASSERTS" +** flag set in its RPT entry, the "AssertEvents" element and the +** "DeassertsEvents" element will always have same value. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEventEnablesGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorEvtEnablesT *Enables +); + + +/******************************************************************************* +** +** Name: saHpiSensorEventEnablesSet +** +** Description: +** This function provides the ability to set the disable or enable event +** message generation status for individual sensor events. The sensor +** event states are relative to the event category specified by the +** sensor. See the SaHpiEventCategoryT definition for more information. +** Within the structure passed, there are two elements, which contain bit +** flags; one for assertion events and one for de-assertion events. +** However, the use of these two elements depends on whether the resource +** addressed has the "SAHPI_CAPABILITY_EVT_DEASSERTS" flag set in its RPT +** entry. This capability, if set, advertises that all sensors hosted by +** the resource will always send a "de-assert" event when any state is +** de-asserted whose assertion generates an "assert" event. Thus, for +** sensors hosted by resources that advertise this behavior, it is not +** meaningful to control assert events and de-assert events separately. +** For sensors on resources that do not have the +** "SAHPI_CAPABILITY_EVT_DEASSERTS" flag set, a bit set to '1' in the +** "AssertEvents" element in the structure indicates that an event will +** be generated when the corresponding event state changes from +** de-asserted to asserted on that sensor., and a bit set to '1' in the +** "DeassertEvents" element in the structure indicates that an event will +** be generated when the corresponding event state changes from asserted +** to de-asserted on that sensor. For sensors on resources, which do have +** the "SAHPI_CAPABILITY_EVT_DEASSERTS" flag set, the "DeassertEvents" +** element is not used. For sensors on these resources, a bit set to '1' +** in the "AssertEvents" element in the structure indicates that an event +** will be generated when the corresponding event state changes in either +** direction (de-asserted to asserted or asserted to de-asserted). The +** saHpiSensorEventEnablesSet() function also allows setting of general +** sensor status - whether the sensor is completely disabled, or event +** generation is completely disabled. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** SensorNum - [in] Sensor number for which the event enables are being +** set. +** Enables - [in] Pointer to the structure containing the enabled status +** for each event. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Disabling events means that events are disabled for all sessions, not +** just the session referenced by the SessionId parameter. +** saHpiSensorEventEnablesGet () will return the values which were last +** set by saHpiSensorEventEnablesSet() for the "AssertEvents" and +** "DeassertEvents" elements in the passed data structures. However, for +** sensors hosted by any resource that has the +** SAHPI_CAPABILITY_EVT_DEASSERTS flag set in its RPT entry, the passed +** "AssertEvents" element on the saHpiSensorEventEnablesSet () function +** is used for both assertion and de-assertion event enable flags. In +** this case, this value will be returned in both the "AssertEvents" and +** "DeassertEvents" elements on a subsequent saHpiSensorEventEnablesGet +** () call. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEventEnablesSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiSensorEvtEnablesT *Enables +); + + +/******************************************************************************* +** +** Name: saHpiControlTypeGet +** +** Description: +** This function retrieves the control type of a control object. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** CtrlNum - [in] Control number +** Type - [out] Pointer to SaHpiCtrlTypeT variable to receive the +** enumerated control type for the specified control. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** The Type parameter must point to a variable of type SaHpiCtrlTypeT. +** Upon successful completion, the enumerated control type is returned in +** the variable pointed to by Type. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiControlTypeGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiCtrlNumT CtrlNum, + SAHPI_OUT SaHpiCtrlTypeT *Type +); + + +/******************************************************************************* +** +** Name: saHpiControlStateGet +** +** Description: +** This function retrieves the current state (generally the last state +** set) of a control object. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of addressed resource. +** CtrlNum - [in] Number of the control for which the state is being +** retrieved. +** CtrlState - [in/out] Pointer to a control data structure into which +** the current control state will be placed. For text controls, the line +** number to read is passed in via CtrlState->StateUnion.Text.Line. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Note that Text controls are unique in that they have a state +** associated with each line of the control - the state being the text on +** that line. The line number to be read is passed in to +** sahpiControlStateGet()via CtrlState- >StateUnion.Text.Line; the +** contents of that line of the control will be returned in CtrlState- +** >StateUnion.Text.Text. If the line number passed in is +** SAHPI_TLN_ALL_LINES, then sahpiControlStateGet() will return the +** entire text of the control, or as much of it as will fit in a single +** SaHpiTextBufferT, in CtrlState- >StateUnion.Text.Text. This value will +** consist of the text of all the lines concatenated, using the maximum +** number of characters for each line (no trimming of trailing blanks). +** Note that depending on the data type and language, the text may be +** encoded in 2-byte Unicode, which requires two bytes of data per +** character. Note that the number of lines and columns in a text control +** can be obtained from the control's Resource Data Record. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiControlStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiCtrlNumT CtrlNum, + SAHPI_INOUT SaHpiCtrlStateT *CtrlState +); + + +/******************************************************************************* +** +** Name: saHpiControlStateSet +** +** Description: +** This function is used for setting the state of the specified control +** object. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** CtrlNum - [in] Number of the control for which the state is being set. +** +** CtrlState - [in] Pointer to a control state data structure holding the +** state to be set +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** The CtrlState parameter must be of the correct type for the specified +** control. Text controls include a line number and a line of text in the +** CtrlState parameter, allowing update of just a single line of a text +** control. If less than a full line of data is written, the control will +** clear all spaces beyond those written on the line. Thus writing a +** zero-length string will clear the addressed line. It is also possible +** to include more characters in the text passed in the CtrlState +** structure than will fit on one line; in this case, the control will +** "wrap" to the next line (still clearing the trailing characters on the +** last line written). Thus, there are two ways to write multiple lines +** to a text control: (a) call saHpiControlStateSet() repeatedly for each +** line, or (b) call saHpiControlStateSet() once and send more characters +** than will fit on one line. The caller should not assume any "cursor +** positioning" characters are available to use, but rather should always +** write full lines and allow "wrapping" to occur. When calling +** saHpiControlStateSet() for a text control, the caller may set the line +** number to SAHPI_TLN_ALL_LINES; in this case, the entire control will +** be cleared, and the data will be written starting on line 0. (This is +** different from simply writing at line 0, which only alters the lines +** written to.) This feature may be used to clear the entire control, +** which can be accomplished by setting: CtrlState->StateUnion.Text.Line +** = SAHPI_TLN_ALL_LINES; CtrlState->StateUnion.Text.Text.DataLength = 0; +** Note that the number of lines and columns in a text control can be +** obtained from the control's Resource Data Record. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiControlStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiCtrlNumT CtrlNum, + SAHPI_IN SaHpiCtrlStateT *CtrlState +); + + +/******************************************************************************* +** +** Name: saHpiEntityInventoryDataRead +** +** Description: +** This function returns inventory data for a particular entity +** associated with a resource. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** EirId - [in] Identifier for the entity inventory repository. +** BufferSize - [in] Size of the InventData buffer passed in. +** InventData - [out] Pointer to the buffer for the returned data. +** ActualSize - [out] Pointer to size of the actual amount of data +** returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. SA_ERR_INVENT_DATA_TRUNCATED is returned if the buffer +** passed in the InventData structure is not large enough (as indicated +** by the "BufferSize" parameter) to hold the entire InventData +** structure. +** +** Remarks: +** Before calling saHpiEntityInventoryDataRead() the caller should +** allocate a sufficiently large buffer to hold the data, and pass the +** size of the buffer in the "BufferSize" parameter. The +** saHpiEntityInventoryDataRead() function will return, at the location +** pointed to by the ActualSize parameter, the actual space used in the +** buffer to hold the returned data. If the data will not fit in the +** buffer, as much as will fit will be returned, *ActualSize will be set +** to indicated a suggested buffer size for the entire inventory data, +** the "Validity" field in the InventData buffer will be set to +** "SAHPI_INVENT_DATA_OVERFLOW," and an error return will be made. Since +** it is impossible to know how large the inventory data may be without +** actually reading and processing it from the entity inventory +** repository, it may be advisable to err on the large side in allocating +** the buffer. Note that the data includes many pointers to +** SaHpiTextBufferT structures. The implementation of +** saHpiEntityInventoryDataRead() may not reserve space for the maximum +** size of each of these structures when formatting the data in the +** returned buffer. Thus, if a user wishes to lengthen the data in one of +** these structures, a new SaHpiTextBufferT structure should be +** allocated, and the appropriate pointer reset to point to this new +** structure in memory. See the description of the SaHpiInventoryDataT +** structure in section 7.9, "Entity Inventory Data," on page 94, for +** details on the format of the returned data. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEntityInventoryDataRead ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEirIdT EirId, + SAHPI_IN SaHpiUint32T BufferSize, + SAHPI_OUT SaHpiInventoryDataT *InventData, + SAHPI_OUT SaHpiUint32T *ActualSize +); + + +/******************************************************************************* +** +** Name: saHpiEntityInventoryDataWrite +** +** Description: +** This function writes the specified data to the inventory information +** area. Note: If the resource hosting the inventory data is +** re-initialized, or if the entity itself is removed and reinserted, the +** inventory data may be reset to its default settings, losing data +** written to the repository with this function. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** EirId - [in] Identifier for the entity inventory repository. +** InventData - [in] Pointer to data to write to the repository. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** The SaHpiInventoryDataT structure consists of a Validity field and +** then a set of pointers to record structures. It is not required that +** all pointers point to data within a single contiguous buffer. The +** "Validity" field in the SaHpiInventoryDataT structure must be set to +** "SAHPI_INVENT_DATA_VALID," or else the saHpiEntityInventoryDataWrite() +** function will take no action and return an error. This is to help +** prevent invalid data returned by a saHpiEntityInventoryDataRead() +** function from being inadvertently written to the resource. For this +** protection to work, the caller should not change the value of the +** "Validity" field in the SaHpiInventoryDataT structure unless building +** an entire Inventory Data set from scratch. Some implementations may +** impose limitations on the languages of the strings passed in within +** the InventData parameter. Implementation-specific documentation +** should identify these restrictions. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEntityInventoryDataWrite ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEirIdT EirId, + SAHPI_IN SaHpiInventoryDataT *InventData +); + + +/******************************************************************************* +** +** Name: saHpiWatchdogTimerGet +** +** Description: +** This function retrieves the current watchdog timer settings and +** configuration. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource, which contains the +** watchdog timer being addressed. +** WatchdogNum - [in] The watchdog number that specifies the watchdog +** timer on a resource. +** Watchdog - [out] Pointer to watchdog data structure. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** See the description of the SaHpiWatchdogT structure in 7.11, +** "Watchdogs" on page 96 for details on what information is returned by +** this function. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiWatchdogTimerGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiWatchdogNumT WatchdogNum, + SAHPI_OUT SaHpiWatchdogT *Watchdog +); + + +/******************************************************************************* +** +** Name: saHpiWatchdogTimerSet +** +** Description: +** This function provides a method for initializing the watchdog timer +** configuration. Once the appropriate configuration has be set using +** saHpiWatchdogTimerSet(), the user must then call +** saHpiWatchdogTimerReset() to initially start the watchdog timer. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the resource that contains the +** watchdog timer being addressed. +** WatchdogNum - [in] The watchdog number specifying the specific +** watchdog timer on a resource. +** Watchdog - [in] Pointer to watchdog data structure. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** If the initial counter value in the SaHpiWatchdogT structure is set to +** 0, the Watchdog will immediately time out and take the pre-timeout and +** timeout actions, as well as log an event. This provides a mechanism +** for software to force an immediate recovery action should that be +** dependent on a Watchdog timeout occurring. See the description of the +** SaHpiWatchdogT structure for more details on the effects of this +** command related to specific data passed in that structure. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiWatchdogTimerSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiWatchdogNumT WatchdogNum, + SAHPI_IN SaHpiWatchdogT *Watchdog +); + + +/******************************************************************************* +** +** Name: saHpiWatchdogTimerReset +** +** Description: +** This function provides a method to start or restart the watchdog timer +** from the initial countdown value. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID for the resource that contains the +** watchdog timer being addressed. +** WatchdogNum - [in] The watchdog number specifying the specific +** watchdog timer on a resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** If the Watchdog has been configured to issue a Pre-Timeout interrupt, +** and that interrupt has already occurred, the saHpiWatchdogTimerReset() +** function will not reset the watchdog counter. The only way to stop a +** Watchdog from timing out once a Pre-Timeout interrupt has occurred is +** to use the saHpiWatchdogTimerSet() function to reset and/or stop the +** timer. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiWatchdogTimerReset ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiWatchdogNumT WatchdogNum +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapControlRequest +** +** Description: +** A resource supporting hot swap typically supports default policies for +** insertion and extraction. On insertion, the default policy may be for +** the resource to turn the associated FRU's local power on and to +** de-assert reset. On extraction, the default policy may be for the +** resource to immediately power off the FRU and turn on a hot swap +** indicator. This function allows a caller, after receiving a hot swap +** event with HotSwapState equal to SAHPI_HS_STATE_INSERTION_PENDING or +** SAHPI_HS_STATE_EXTRACTION_PENDING, to request control of the hot swap +** policy and prevent the default policy from being invoked. Because a +** resource that supports the simplified hot swap model will never +** transition into Insertion Pending or Extraction Pending states, this +** function is not applicable to those resources. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapControlRequest ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiResourceActiveSet +** +** Description: +** During insertion, a resource supporting hot swap will generate an +** event to indicate that it is in the INSERTION PENDING state. If the +** management middleware or other user software calls +** saHpiHotSwapControlRequest() before the resource begins an auto-insert +** operation, then the resource will remain in INSERTION PENDING state +** while the user acts on the resource to integrate it into the system. +** During this state, the user can instruct the resource to power on the +** associated FRU, to de-assert reset, or to turn off its hot swap +** indicator using the saHpiResourcePowerStateSet(), +** saHpiResourceResetStateSet(), or saHpiHotSwapIndicatorStateSet() +** functions, respectively. Once the user has completed with the +** integration of the FRU, this function must be called to signal that +** the resource should now transition into ACTIVE/HEALTHY or +** ACTIVE/UNHEALTHY state (depending on whether or not there are active +** faults). The user may also use this function to request a resource to +** return to the ACTIVE/HEALTHY or ACTIVE/UNHEALTHY state from the +** EXTRACTION PENDING state in order to reject an extraction request. +** Because a resource that supports the simplified hot swap model will +** never transition into Insertion Pending or Extraction Pending states, +** this function is not applicable to those resources. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Only valid if resource is in INSERTION PENDING or EXTRACTION PENDING +** state and an auto-insert or auto-extract policy action has not been +** initiated. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceActiveSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiResourceInactiveSet +** +** Description: +** During extraction, a resource supporting hot swap will generate an +** event to indicate that it is in the EXTRACTION PENDING state. If the +** management middleware or other user software calls +** saHpiHotSwapControlRequest() before the resource begins an +** auto-extract operation, then the resource will remain in EXTRACTION +** PENDING state while the user acts on the resource to isolate the +** associated FRU from the system. During this state, the user can +** instruct the resource to power off the FRU, to assert reset, or to +** turn on its hot swap indicator using the saHpiResourcePowerStateSet(), +** saHpiResourceResetStateSet(), or saHpiHotSwapIndicatorStateSet() +** functions, respectively. Once the user has completed the shutdown of +** the FRU, this function must be called to signal that the resource +** should now transition into INACTIVE state. The user may also use this +** function to request a resource to return to the INACTIVE state from +** the INSERTION PENDING state to abort a hot-swap insertion action. +** Because a resource that supports the simplified hot swap model will +** never transition into Insertion Pending or Extraction Pending states, +** this function is not applicable to those resources. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Only valid if resource is in EXTRACTION PENDING or INSERTION PENDING +** state and an auto-extract or auto-insert policy action has not been +** initiated. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceInactiveSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + + +/******************************************************************************* +** +** Name: saHpiAutoInsertTimeoutGet +** +** Description: +** This function allows the caller to request the auto-insert timeout +** value. This value indicates how long the HPI implementation will wait +** before the default auto-insertion policy is invoked. Further +** information on the auto-insert timeout can be found in the function +** saHpiAutoInsertTimeoutSet(). +** +** Parameters: +** SessionId - [in] Handle to session context. +** Timeout - [out] Pointer to location to store the number of nanoseconds +** to wait before autonomous handling of the hotswap event. Reserved time +** out values: SAHPI_TIMEOUT_IMMEDIATE indicates autonomous handling is +** immediate. SAHPI_TIMEOUT_BLOCK indicates autonomous handling does not +** occur. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoInsertTimeoutGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiTimeoutT *Timeout +); + + +/******************************************************************************* +** +** Name: saHpiAutoInsertTimeoutSet +** +** Description: +** This function allows the caller to configure a timeout for how long to +** wait before the default auto-insertion policy is invoked. This +** function accepts a parameter instructing the implementation to impose +** a delay before a resource will perform its default hot swap policy for +** auto-insertion. The parameter may be set to SAHPI_TIMEOUT_IMMEDIATE to +** direct resources to proceed immediately to auto-insertion, or to +** SAHPI_TIMEOUT_BLOCK to prevent auto-insertion from ever occurring. If +** the parameter is set to another value, then it defines the number of +** nanoseconds between the time a hot swap event with HotSwapState = +** SAHPI_HS_STATE_INSERTION_PENDING is generated, and the time that the +** auto-insertion policy will be invoked for that resource. If, during +** this time period, a saHpiHotSwapControlRequest() function is +** processed, the timer will be stopped, and the auto-insertion policy +** will not be invoked. Once the auto-insertion process begins, the user +** software will not be allowed to take control of the insertion process; +** hence, the timeout should be set appropriately to allow for this +** condition. Note that the timeout period begins when the hot swap event +** with HotSwapState = SAHPI_HS_STATE_INSERTION_PENDING is initially +** generated; not when it is received by a caller with a saHpiEventGet() +** function call, or even when it is placed in a session event queue. +** +** Parameters: +** SessionId - [in] Handle to session context. +** Timeout - [in] The number of nanoseconds to wait before autonomous +** handling of the hotswap event. Reserved time out values: +** SAHPI_TIMEOUT_IMMEDIATE indicates proceed immediately to autonomous +** handling. SAHPI_TIMEOUT_BLOCK indicates prevent autonomous handling. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoInsertTimeoutSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiTimeoutT Timeout +); + + +/******************************************************************************* +** +** Name: saHpiAutoExtractTimeoutGet +** +** Description: +** This function allows the caller to request the timeout for how long +** the implementation will wait before the default auto-extraction policy +** is invoked. Further information on auto-extract time outs is detailed +** in saHpiAutoExtractTimeoutSet(). +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** Timeout - [out] Pointer to location to store the number of nanoseconds +** to wait before autonomous handling of the hotswap event. Reserved time +** out values: SAHPI_TIMEOUT_IMMEDIATE indicates autonomous handling is +** immediate. SAHPI_TIMEOUT_BLOCK indicates autonomous handling does not +** occur. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoExtractTimeoutGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiTimeoutT *Timeout +); + + +/******************************************************************************* +** +** Name: saHpiAutoExtractTimeoutSet +** +** Description: +** This function allows the caller to configure a timeout for how long to +** wait before the default auto-extraction policy is invoked. This +** function accepts a parameter instructing the implementation to impose +** a delay before a resource will perform its default hot swap policy for +** auto-extraction. The parameter may be set to SAHPI_TIMEOUT_IMMEDIATE +** to direct the resource to proceed immediately to auto-extraction, or +** to SAHPI_TIMEOUT_BLOCK to prevent auto-extraction from ever occurring +** on a resource. If the parameter is set to another value, then it +** defines the number of nanoseconds between the time a hot swap event +** with HotSwapState = SAHPI_HS_STATE_EXTRACTION_PENDING is generated, +** and the time that the auto- extraction policy will be invoked for the +** resource. If, during this time period, a saHpiHotSwapControlRequest() +** function is processed, the timer will be stopped, and the +** auto-extraction policy will not be invoked. Once the auto-extraction +** process begins, the user software will not be allowed to take control +** of the extraction process; hence, the timeout should be set +** appropriately to allow for this condition. Note that the timeout +** period begins when the hot swap event with HotSwapState = +** SAHPI_HS_STATE_EXTRACTION_PENDING is initially generated; not when it +** is received by a caller with a saHpiEventGet() function call, or even +** when it is placed in a session event queue. The auto-extraction policy +** is set at the resource level and is only supported by resources +** supporting the "Managed Hot Swap" capability. After discovering that a +** newly inserted resource supports "Managed Hot Swap," middleware or +** other user software may use this function to change the default +** auto-extraction policy for that resource. If a resource supports the +** simplified hot-swap model, setting this timer has no effect since the +** resource will transition directly to "Not Present" state on an +** extraction. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** Timeout - [in] The number of nanoseconds to wait before autonomous +** handling of the hotswap event. Reserved time out values: +** SAHPI_TIMEOUT_IMMEDIATE indicates proceed immediately to autonomous +** handling. SAHPI_TIMEOUT_BLOCK indicates prevent autonomous handling. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoExtractTimeoutSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTimeoutT Timeout +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapStateGet +** +** Description: +** This function allows the caller to retrieve the current hot swap state +** of a resource. The returned state will be one of the following five +** states: ? SAHPI_HS_STATE_INSERTION_PENDING ? +** SAHPI_HS_STATE_ACTIVE_HEALTHY ? SAHPI_HS_STATE_ACTIVE_UNHEALTHY ? +** SAHPI_HS_STATE_EXTRACTION_PENDING ? SAHPI_HS_STATE_INACTIVE The state +** SAHPI_HS_STATE_NOT_PRESENT will never be returned, because a resource +** that is not present cannot be addressed by this function in the first +** place. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** State - [out] Pointer to location to store returned state information. +** +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiHsStateT *State +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapActionRequest +** +** Description: +** A resource supporting hot swap typically requires a physical action on +** the associated FRU to invoke an insertion or extraction process. An +** insertion process is invoked by physically inserting the FRU into a +** chassis. Physically opening an ejector latch or pressing a button +** invokes the extraction process. This function allows the caller to +** invoke an insertion or extraction process via software. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** Action - [in] Requested action: SAHPI_HS_ACTION_INSERTION or +** SAHPI_HS_ACTION_EXTRACTION +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** There may be limitations on when saHpiHotSwapActionRequest() may be +** called, and what value may be used for the "Action" parameter +** depending on what state the resource is currently in. At the least, +** this function may be called: ? To request an Insertion action when the +** resource is in INACTIVE state ? To request an Extraction action when +** the resource is in the ACTIVE/HEALTHY or ACTIVE/ UNHEALTHY state. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapActionRequest ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiHsActionT Action +); + + +/******************************************************************************* +** +** Name: saHpiResourcePowerStateGet +** +** Description: +** A typical resource supporting hot swap will have the ability to +** control local power on the FRU associated with the resource. During +** insertion, the FRU can be instructed to power on. During extraction +** the FRU can be requested to power off. This function allows the caller +** to retrieve the current power state of the FRU associated with the +** specified resource. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** State - [out] The current power state of the resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** This function returns the actual low-level power state of the FRU, +** regardless of what hot-swap state the resource is in. Not all +** resources supporting managed hot swap will necessarily support this +** function. In particular, resources that use the simplified hot swap +** model may not have the ability to control FRU power. An appropriate +** error code will be returned if the resource does not support power +** control on the FRU. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourcePowerStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiHsPowerStateT *State +); + + +/******************************************************************************* +** +** Name: saHpiResourcePowerStateSet +** +** Description: +** A typical resource supporting hot swap will have to ability to control +** local power on the FRU associated with the resource. During insertion, +** the FRU can be instructed to power on. During extraction the FRU can +** be requested to power off. This function allows the caller to set the +** current power state of the FRU associated with the specified resource. +** +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** State - [in] the new power state that the specified resource will be +** set to. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** This function controls the hardware power on the FRU of what hot-swap +** state the resource is in. For example, it is legal (and may be +** desirable) to cycle power on the FRU even while it is in ACTIVE state +** in order to attempt to clear a fault condition. Similarly, a resource +** could be instructed to power on a FRU even while it is in INACTIVE +** state, for example, in order to run off-line diagnostics. Not all +** resources supporting managed hot swap will necessarily support this +** function. In particular, resources that use the simplified hot swap +** model may not have the ability to control FRU power. An appropriate +** error code will be returned if the resource does not support power +** control on the FRU. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourcePowerStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiHsPowerStateT State +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapIndicatorStateGet +** +** Description: +** A FRU associated with a hot-swappable resource may include a hot swap +** indicator such as a blue LED. This indicator signifies that the FRU is +** ready for removal.. This function allows the caller to retrieve the +** state of this indicator. The returned state is either +** SAHPI_HS_INDICATOR_OFF or SAHPI_HS_INDICATOR_ON. This function will +** return the state of the indicator, regardless of what hot swap state +** the resource is in. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** State - [out] Pointer to location to store state of hot swap +** indicator. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Not all resources supporting managed hot swap will necessarily support +** this function. In particular, resources that use the simplified hot +** swap model may not have the ability to control a FRU hot swap +** indicator (it is likely that none exists). An appropriate error code +** will be returned if the resource does not support control of a hot +** swap indicator on the FRU. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapIndicatorStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiHsIndicatorStateT *State +); + + +/******************************************************************************* +** +** Name: saHpiHotSwapIndicatorStateSet +** +** Description: +** A FRU associated with a hot-swappable resource may include a hot swap +** indicator such as a blue LED. This indicator signifies that the FRU is +** ready for removal. This function allows the caller to set the state of +** this indicator. Valid states include SAHPI_HS_INDICATOR_OFF or +** SAHPI_HS_INDICATOR_ON. This function will set the indicator regardless +** of what hot swap state the resource is in, though it is recommended +** that this function be used only in conjunction with moving the +** resource to the appropriate hot swap state. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource +** State - [in] State of hot swap indicator to be set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Not all resources supporting managed hot swap will necessarily support +** this function. In particular, resources that use the simplified hot +** swap model may not have the ability to control a FRU hot swap +** indicator (it is likely that none exists). An appropriate error code +** will be returned if the resource does not support control of a hot +** swap indicator on the FRU. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapIndicatorStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiHsIndicatorStateT State +); + + +/******************************************************************************* +** +** Name: saHpiParmControl +** +** Description: +** This function allows the user to save and restore parameters +** associated with a specific resource. Valid actions for this function +** include: SAHPI_DEFAULT_PARM Restores the factory default settings for +** a specific resource. Factory defaults include sensor thresholds and +** configurations, and resource- specific configuration parameters. +** SAHPI_SAVE_PARM Stores the resource configuration parameters in +** non-volatile storage. Resource configuration parameters stored in +** non-volatile storage will survive power cycles and resource resets. +** SAHPI_RESTORE_PARM Restores resource configuration parameters from +** non-volatile storage. Resource configuration parameters include sensor +** thresholds and sensor configurations, as well as resource-specific +** parameters. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** Action - [in] Action to perform on resource parameters. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code +** is returned. +** +** Remarks: +** Resource-specific parameters should be documented in an implementation +** guide for the HPI implementation. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiParmControl ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiParmActionT Action +); + + +/******************************************************************************* +** +** Name: saHpiResourceResetStateGet +** +** Description: +** This function gets the reset state of an entity, allowing the user to +** determine if the entity is being held with its reset asserted. If a +** resource manages multiple entities, this function will address the +** entity which is identified in the RPT entry for the resource. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** ResetAction - [out] The current reset state of the entity. Valid reset +** states are: SAHPI_RESET_ASSERT: The entity's reset is asserted, e.g., +** for hot swap insertion/extraction purposes SAHPI_RESET_DEASSERT: The +** entity's reset is not asserted +** +** Return Value: +** SA_OK is returned if the resource has reset control, and the reset +** state has successfully been determined; otherwise, an error code is +** returned. SA_ERR_HPI_INVALID_CMD is returned if the resource has no +** reset control. +** +** Remarks: +** SAHPI_RESET_COLD and SAHPI_RESET_WARM are pulsed resets, and are not +** valid return values for ResetAction. If the entity is not being held +** in reset (using SAHPI_RESET_ASSERT), the appropriate return value is +** SAHPI_RESET_DEASSERT. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceResetStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiResetActionT *ResetAction +); + + +/******************************************************************************* +** +** Name: saHpiResourceResetStateSet +** +** Description: +** This function directs the resource to perform the specified reset type +** on the entity that it manages. If a resource manages multiple +** entities, this function addresses the entity that is identified in the +** RPT entry for the resource. Entities may be reset for a variety of +** reasons. A misbehaving entity may be reset to bring it to a known +** state. In these cases, either a warm reset or a cold reset may be +** performed. A warm reset preserves entity state, whereas a cold reset +** does not. Both of these reset types are pulsed asserted and then +** de-asserted by the HPI implementation. This allows the HPI +** implementation to hold the reset asserted for the appropriate length +** of time, as needed by each entity. saHpiResourceResetStateSet() can +** also be used for insertion and extraction scenarios. A typical +** resource supporting hot swap will have to ability to control local +** reset within the FRU. During insertion, a resource can be instructed +** to assert reset, while the FRU powers on. During extraction a resource +** can be requested to assert reset before the FRU is powered off. This +** function allows the caller to set the reset state of the specified +** FRU. SAHPI_RESET_ASSERT is used to hold the resource in reset; the FRU +** is brought out of the reset state by using either SAHPI_COLD_RESET or +** SAHPI_WARM_RESET. +** +** Parameters: +** SessionId - [in] Handle to session context. +** ResourceId - [in] Resource ID of the addressed resource. +** ResetAction - [in] Type of reset to perform on the entity. Valid reset +** actions are: SAHPI_COLD_RESET: Perform a 'Cold Reset' on the entity +** (pulse), leaving reset de-asserted SAHPI_WARM_RESET: Perform a 'Warm +** Reset' on the entity (pulse), leaving reset de-asserted +** SAHPI_RESET_ASSERT: Put the entity into reset state and hold reset +** asserted, e.g., for hot swap insertion/extraction purposes +** +** Return Value: +** SA_OK is returned if the resource has reset control, and the requested +** reset action has succeeded; otherwise, an error code is returned. +** SA_ERR_HPI_INVALID_CMD is returned if the resource has no reset +** control, or if the requested reset action is not supported by the +** resource. +** +** Remarks: +** Some resources may not support reset, or may only support a subset of +** the defined reset action types. Also, on some resources, cold and warm +** resets may be equivalent. 7 Data Type Definitions +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceResetStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiResetActionT ResetAction +); + + + +#endif + diff --git a/hpiutil/SaHpi.h-B b/hpiutil/SaHpi.h-B new file mode 100644 index 0000000..38d666b --- /dev/null +++ b/hpiutil/SaHpi.h-B @@ -0,0 +1,6785 @@ +/******************************************************************************* +** +** FILE: +** SaHpi.h +** +** DESCRIPTION: +** This file provides the C language binding for the Service +** Availability(TM) Forum Platform Interface. It contains all of +** the prototypes and type definitions. Note, this file was +** generated from the Platform Interface specification document. +** +** SPECIFICATION VERSION: +** SAI-HPI-B.01.01 +** +** DATE: +** Tue Jun 1 2004 09:33 +** +** LEGAL: +** OWNERSHIP OF SPECIFICATION AND COPYRIGHTS. +** The Specification and all worldwide copyrights therein are +** the exclusive property of Licensor. You may not remove, obscure, or +** alter any copyright or other proprietary rights notices that are in or +** on the copy of the Specification you download. You must reproduce all +** such notices on all copies of the Specification you make. Licensor +** may make changes to the Specification, or to items referenced therein, +** at any time without notice. Licensor is not obligated to support or +** update the Specification. +** +** Copyright(c) 2004, Service Availability(TM) Forum. All rights +** reserved. +** +*******************************************************************************/ + +#ifndef __SAHPI_H +#define __SAHPI_H + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Basic Data Types and Values ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* General Types - need to be specified correctly for the host architecture */ + +/* +** It is recommended that these types be defined such that the data sizes +** and alignment of each data type are as indicated. The only requirement +** for source compatibility is that the types be defined to be able to +** contain at least the required data (e.g., at least signed 8-bit values +** must be contained in the data type defined as SaHpiInt8T, etc.) +** Following the full recommendations for data size and alignment, however, +** may promote more binary compatibility. +*/ + +/* The following definitions produce the recommended sizes and alignments +** using the gcc compiler for the i386 (IA-32) platform. +** +** Note, some recent versions of the gcc compiler exhibit an apparent bug +** that makes the __attribute__ statements applied to the typdef's on +** the 64-bit types below ineffective when those types are used in structures. +** To workaround that bug, it may be required to add similar __attribute__ +** statements on the typedefs of the derived types SaHpiTimeT and +** SaHpiTimeoutT, plus on individual 64-bit data items within structure and +** union definitions in order to align the HPI structures as recommended. +** The structures and unions that contain 64-bit data items are: +** SaHpiSensorReadingUnionT, SaHpiSensorDataFormatT, SaHpiEventT, +** SaHpiAnnouncementT, SaHpiDomainInfoT, SaHpiAlarmT, SaHpiEventLogInfoT, +** and SaHpiEventLogEntryT. For more information, see: +** https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109911 +*/ + + +/* unsigned 8-bit data, 1-byte alignment */ +typedef unsigned char SaHpiUint8T; + +/* unsigned 16-bit data, 2-byte alignment */ +typedef unsigned short SaHpiUint16T; + +/* unsigned 32-bit data, 4-byte alignment */ +typedef unsigned int SaHpiUint32T; + +/* unsigned 64-bit data, 8-byte alignment */ +typedef unsigned long long int SaHpiUint64T __attribute__((__aligned__(8))); + +/* signed 8-bit data, 1-byte alignment */ +typedef signed char SaHpiInt8T; + +/* signed 16-bit data, 2-byte alignment */ +typedef signed short SaHpiInt16T; + +/* signed 32-bit data, 4-byte alignment */ +typedef signed int SaHpiInt32T; + +/* signed 64-bit data, 8-byte alignment */ +typedef signed long long int SaHpiInt64T __attribute__((__aligned__(8))); + +/* 64-bit floating point, 8-byte alignment */ +typedef double SaHpiFloat64T __attribute__((__aligned__(8))); + + +typedef SaHpiUint8T SaHpiBoolT; +#define SAHPI_TRUE 1 /* While SAHPI_TRUE = 1, any non-zero + value is also considered to be True + and HPI Users/Implementers of this + specification should not test for + equality against SAHPI_TRUE. */ + +#define SAHPI_FALSE 0 + +/* Platform, O/S, or Vendor dependent */ +#define SAHPI_API +#define SAHPI_IN +#define SAHPI_OUT +#define SAHPI_INOUT + +/* +** Identifier for the manufacturer +** +** This is the IANA-assigned private enterprise number for the +** manufacturer of the resource or FRU, or of the manufacturer +** defining an OEM control or event type. A list of current +** IANA-assigned private enterprise numbers may be obtained at +** +** http://www.iana.org/assignments/enterprise-numbers +** +** If a manufacturer does not currently have an assigned number, one +** may be obtained by following the instructions located at +** +** http://www.iana.org/cgi-bin/enterprise.pl +*/ +typedef SaHpiUint32T SaHpiManufacturerIdT; +#define SAHPI_MANUFACTURER_ID_UNSPECIFIED (SaHpiManufacturerIdT)0 + +/* Version Types */ +typedef SaHpiUint32T SaHpiVersionT; + +/* +** Interface Version +** +** The interface version is the version of the actual interface and not the +** version of the implementation. It is a 24 bit value where +** the most significant 8 bits represent the compatibility level +** (with letters represented as the corresponding numbers); +** the next 8 bits represent the major version number; and +** the least significant 8 bits represent the minor version number. +*/ +#define SAHPI_INTERFACE_VERSION (SaHpiVersionT)0x020101 /* B.01.01 */ + +/* +** Return Codes +** +** SaErrorT is defined in the HPI specification. In the future a +** common SAF types definition may be created to contain this type. At +** that time, this typedef should be removed. Each of the return codes +** is defined in Section 4.1 of the specification. +*/ +typedef SaHpiInt32T SaErrorT; /* Return code */ + +/* +** SA_OK: +*/ +#define SA_OK (SaErrorT)0x0000 + +/* This value is the base for all HPI-specific error codes. */ +#define SA_HPI_ERR_BASE -1000 + +#define SA_ERR_HPI_ERROR (SaErrorT)(SA_HPI_ERR_BASE - 1) +#define SA_ERR_HPI_UNSUPPORTED_API (SaErrorT)(SA_HPI_ERR_BASE - 2) +#define SA_ERR_HPI_BUSY (SaErrorT)(SA_HPI_ERR_BASE - 3) +#define SA_ERR_HPI_INTERNAL_ERROR (SaErrorT)(SA_HPI_ERR_BASE - 4) +#define SA_ERR_HPI_INVALID_CMD (SaErrorT)(SA_HPI_ERR_BASE - 5) +#define SA_ERR_HPI_TIMEOUT (SaErrorT)(SA_HPI_ERR_BASE - 6) +#define SA_ERR_HPI_OUT_OF_SPACE (SaErrorT)(SA_HPI_ERR_BASE - 7) +#define SA_ERR_HPI_OUT_OF_MEMORY (SaErrorT)(SA_HPI_ERR_BASE - 8) +#define SA_ERR_HPI_INVALID_PARAMS (SaErrorT)(SA_HPI_ERR_BASE - 9) +#define SA_ERR_HPI_INVALID_DATA (SaErrorT)(SA_HPI_ERR_BASE - 10) +#define SA_ERR_HPI_NOT_PRESENT (SaErrorT)(SA_HPI_ERR_BASE - 11) +#define SA_ERR_HPI_NO_RESPONSE (SaErrorT)(SA_HPI_ERR_BASE - 12) +#define SA_ERR_HPI_DUPLICATE (SaErrorT)(SA_HPI_ERR_BASE - 13) +#define SA_ERR_HPI_INVALID_SESSION (SaErrorT)(SA_HPI_ERR_BASE - 14) +#define SA_ERR_HPI_INVALID_DOMAIN (SaErrorT)(SA_HPI_ERR_BASE - 15) +#define SA_ERR_HPI_INVALID_RESOURCE (SaErrorT)(SA_HPI_ERR_BASE - 16) +#define SA_ERR_HPI_INVALID_REQUEST (SaErrorT)(SA_HPI_ERR_BASE - 17) +#define SA_ERR_HPI_ENTITY_NOT_PRESENT (SaErrorT)(SA_HPI_ERR_BASE - 18) +#define SA_ERR_HPI_READ_ONLY (SaErrorT)(SA_HPI_ERR_BASE - 19) +#define SA_ERR_HPI_CAPABILITY (SaErrorT)(SA_HPI_ERR_BASE - 20) +#define SA_ERR_HPI_UNKNOWN (SaErrorT)(SA_HPI_ERR_BASE - 21) + +/* +** Domain, Session and Resource Type Definitions +*/ + +/* Domain ID. */ +typedef SaHpiUint32T SaHpiDomainIdT; + +/* The SAHPI_UNSPECIFIED_DOMAIN_ID value is used to specify the default +** domain. +*/ +#define SAHPI_UNSPECIFIED_DOMAIN_ID (SaHpiDomainIdT) 0xFFFFFFFF + +/* Session ID. */ +typedef SaHpiUint32T SaHpiSessionIdT; + +/* Resource identifier. */ +typedef SaHpiUint32T SaHpiResourceIdT; + +/* The SAHPI_UNSPECIFIED_RESOURCE_ID value is used to specify the Domain +** Event Log and to specify that there is no resource for such things as HPI +** User events/alarms. +*/ +#define SAHPI_UNSPECIFIED_RESOURCE_ID (SaHpiResourceIdT) 0xFFFFFFFF + +/* Table Related Type Definitions */ +typedef SaHpiUint32T SaHpiEntryIdT; +#define SAHPI_FIRST_ENTRY (SaHpiEntryIdT)0x00000000 +#define SAHPI_LAST_ENTRY (SaHpiEntryIdT)0xFFFFFFFF +#define SAHPI_ENTRY_UNSPECIFIED SAHPI_FIRST_ENTRY + +/* +** Time Related Type Definitions +** +** An HPI time value represents the local time as the number of nanoseconds +** from 00:00:00, January 1, 1970, in a 64-bit signed integer. This format +** is sufficient to represent times with nano-second resolution from the +** year 1678 to 2262. Every API which deals with time values must define +** the timezone used. +** +** It should be noted that although nano-second resolution is supported +** in the data type, the actual resolution provided by an implementation +** may be more limited than this. +** +** The value -2**63, which is 0x8000000000000000, is used to indicate +** "unknown/unspecified time". +** +** Conversion to/from POSIX and other common time representations is +** relatively straightforward. The following code framgment converts +** between SaHpiTimeT and time_t: +** +** time_t tt1, tt2; +** SaHpiTimeT saHpiTime; +** +** time(&tt1); +** saHpiTime = (SaHpiTimeT) tt1 * 1000000000; +** tt2 = saHpiTime / 1000000000; +** +** The following fragment converts between SaHpiTimeT and a struct timeval: +** +** struct timeval tv1, tv2; +** SaHpiTimeT saHpiTime; +** +** gettimeofday(&tv1, NULL); +** saHpiTime = (SaHpiTimeT) tv1.tv_sec * 1000000000 + tv1.tv_usec * 1000; +** tv2.tv_sec = saHpiTime / 1000000000; +** tv2.tv_usec = saHpiTime % 1000000000 / 1000; +** +** The following fragment converts between SaHpiTimeT and a struct timespec: +** +** struct timespec ts1, ts2; +** SaHpiTimeT saHpiTime; +** +** clock_gettime(CLOCK_REALTIME, &ts1); +** saHpiTime = (SaHpiTimeT) ts1.tv_sec * 1000000000 + ts1.tv_nsec; +** ts2.tv_sec = saHpiTime / 1000000000; +** ts2.tv_nsec = saHpiTime % 1000000000; +** +** Note, however, that since time_t is (effectively) universally 32 bits, +** all of these conversions will cease to work on January 18, 2038. +** +** Some subsystems may need the flexibility to report either absolute or +** relative (eg. to system boot) times. This will typically be in the +** case of a board which may or may not, depending on the system setup, +** have an idea of absolute time. For example, some boards may have +** "time of day" clocks which start at zero, and never get set to the +** time of day. +** +** In these cases, times which represent "current" time (in events, for +** example) can be reported based on the clock value, whether it has been +** set to the actual date/time, or whether it represents the elapsed time +** since boot. If it is the time since boot, the value will be (for 27 +** years) less than 0x0C00000000000000, which is Mon May 26 16:58:48 1997. +** If the value is greater than this, then it can be assumed to be an +** absolute time. +** +** There is no practical need within the interface for expressing dates prior +** to the publication of this specification (which is more than five years +** after the "break point" between relative and absolute time). Thus, in all +** instances a time value should be interpreted as "relative" times if the +** value is less than or equal to SAHPI_TIME_MAX_RELATIVE (but not equal to +** SAHPI_TIME_UNSPECIFIED which always means the time is not available), or +** "absolute" times if the value is greater than SAHPI_TIME_MAX_RELATIVE. +*/ +typedef SaHpiInt64T SaHpiTimeT; /* Time in nanoseconds */ + +/* Unspecified or unknown time */ +#define SAHPI_TIME_UNSPECIFIED (SaHpiTimeT) 0x8000000000000000LL + +/* Maximum time that can be specified as relative */ +#define SAHPI_TIME_MAX_RELATIVE (SaHpiTimeT) 0x0C00000000000000LL +typedef SaHpiInt64T SaHpiTimeoutT; /* Timeout in nanoseconds */ + +/* Non-blocking call */ +#define SAHPI_TIMEOUT_IMMEDIATE (SaHpiTimeoutT) 0x0000000000000000LL + +/* Blocking call, wait indefinitely for call to complete */ +#define SAHPI_TIMEOUT_BLOCK (SaHpiTimeoutT) -1LL + +/* +** Language +** +** This enumeration lists all of the languages that can be associated with text. +** +** SAHPI_LANG_UNDEF indicates that the language is unspecified or +** unknown. +*/ +typedef enum { + SAHPI_LANG_UNDEF = 0, SAHPI_LANG_AFAR, SAHPI_LANG_ABKHAZIAN, + SAHPI_LANG_AFRIKAANS, SAHPI_LANG_AMHARIC, SAHPI_LANG_ARABIC, + SAHPI_LANG_ASSAMESE, SAHPI_LANG_AYMARA, SAHPI_LANG_AZERBAIJANI, + SAHPI_LANG_BASHKIR, SAHPI_LANG_BYELORUSSIAN, SAHPI_LANG_BULGARIAN, + SAHPI_LANG_BIHARI, SAHPI_LANG_BISLAMA, SAHPI_LANG_BENGALI, + SAHPI_LANG_TIBETAN, SAHPI_LANG_BRETON, SAHPI_LANG_CATALAN, + SAHPI_LANG_CORSICAN, SAHPI_LANG_CZECH, SAHPI_LANG_WELSH, + SAHPI_LANG_DANISH, SAHPI_LANG_GERMAN, SAHPI_LANG_BHUTANI, + SAHPI_LANG_GREEK, SAHPI_LANG_ENGLISH, SAHPI_LANG_ESPERANTO, + SAHPI_LANG_SPANISH, SAHPI_LANG_ESTONIAN, SAHPI_LANG_BASQUE, + SAHPI_LANG_PERSIAN, SAHPI_LANG_FINNISH, SAHPI_LANG_FIJI, + SAHPI_LANG_FAEROESE, SAHPI_LANG_FRENCH, SAHPI_LANG_FRISIAN, + SAHPI_LANG_IRISH, SAHPI_LANG_SCOTSGAELIC, SAHPI_LANG_GALICIAN, + SAHPI_LANG_GUARANI, SAHPI_LANG_GUJARATI, SAHPI_LANG_HAUSA, + SAHPI_LANG_HINDI, SAHPI_LANG_CROATIAN, SAHPI_LANG_HUNGARIAN, + SAHPI_LANG_ARMENIAN, SAHPI_LANG_INTERLINGUA, SAHPI_LANG_INTERLINGUE, + SAHPI_LANG_INUPIAK, SAHPI_LANG_INDONESIAN, SAHPI_LANG_ICELANDIC, + SAHPI_LANG_ITALIAN, SAHPI_LANG_HEBREW, SAHPI_LANG_JAPANESE, + SAHPI_LANG_YIDDISH, SAHPI_LANG_JAVANESE, SAHPI_LANG_GEORGIAN, + SAHPI_LANG_KAZAKH, SAHPI_LANG_GREENLANDIC, SAHPI_LANG_CAMBODIAN, + SAHPI_LANG_KANNADA, SAHPI_LANG_KOREAN, SAHPI_LANG_KASHMIRI, + SAHPI_LANG_KURDISH, SAHPI_LANG_KIRGHIZ, SAHPI_LANG_LATIN, + SAHPI_LANG_LINGALA, SAHPI_LANG_LAOTHIAN, SAHPI_LANG_LITHUANIAN, + SAHPI_LANG_LATVIANLETTISH, SAHPI_LANG_MALAGASY, SAHPI_LANG_MAORI, + SAHPI_LANG_MACEDONIAN, SAHPI_LANG_MALAYALAM, SAHPI_LANG_MONGOLIAN, + SAHPI_LANG_MOLDAVIAN, SAHPI_LANG_MARATHI, SAHPI_LANG_MALAY, + SAHPI_LANG_MALTESE, SAHPI_LANG_BURMESE, SAHPI_LANG_NAURU, + SAHPI_LANG_NEPALI, SAHPI_LANG_DUTCH, SAHPI_LANG_NORWEGIAN, + SAHPI_LANG_OCCITAN, SAHPI_LANG_AFANOROMO, SAHPI_LANG_ORIYA, + SAHPI_LANG_PUNJABI, SAHPI_LANG_POLISH, SAHPI_LANG_PASHTOPUSHTO, + SAHPI_LANG_PORTUGUESE, SAHPI_LANG_QUECHUA, SAHPI_LANG_RHAETOROMANCE, + SAHPI_LANG_KIRUNDI, SAHPI_LANG_ROMANIAN, SAHPI_LANG_RUSSIAN, + SAHPI_LANG_KINYARWANDA, SAHPI_LANG_SANSKRIT, SAHPI_LANG_SINDHI, + SAHPI_LANG_SANGRO, SAHPI_LANG_SERBOCROATIAN, SAHPI_LANG_SINGHALESE, + SAHPI_LANG_SLOVAK, SAHPI_LANG_SLOVENIAN, SAHPI_LANG_SAMOAN, + SAHPI_LANG_SHONA, SAHPI_LANG_SOMALI, SAHPI_LANG_ALBANIAN, + SAHPI_LANG_SERBIAN, SAHPI_LANG_SISWATI, SAHPI_LANG_SESOTHO, + SAHPI_LANG_SUDANESE, SAHPI_LANG_SWEDISH, SAHPI_LANG_SWAHILI, + SAHPI_LANG_TAMIL, SAHPI_LANG_TELUGU, SAHPI_LANG_TAJIK, + SAHPI_LANG_THAI, SAHPI_LANG_TIGRINYA, SAHPI_LANG_TURKMEN, + SAHPI_LANG_TAGALOG, SAHPI_LANG_SETSWANA, SAHPI_LANG_TONGA, + SAHPI_LANG_TURKISH, SAHPI_LANG_TSONGA, SAHPI_LANG_TATAR, + SAHPI_LANG_TWI, SAHPI_LANG_UKRAINIAN, SAHPI_LANG_URDU, + SAHPI_LANG_UZBEK, SAHPI_LANG_VIETNAMESE, SAHPI_LANG_VOLAPUK, + SAHPI_LANG_WOLOF, SAHPI_LANG_XHOSA, SAHPI_LANG_YORUBA, + SAHPI_LANG_CHINESE, SAHPI_LANG_ZULU +} SaHpiLanguageT; + +/* +** Text Buffers +** +** These structures are used for defining the type of data in the text buffer +** and the length of the buffer. Text buffers are used in the inventory data, +** RDR, RPT, etc. for variable length strings of data. +** +** The encoding of the Data field in the SaHpiTextBufferT structure is defined +** by the value of the DataType field in the buffer. The following table +** describes the various encodings: +** +** DataType Encoding +** -------- -------- +** +** SAHPI_TL_TYPE_UNICODE 16-bit Unicode, least significant byte first. +** Buffer must contain even number of bytes. +** +** SAHPI_TL_TYPE_BCDPLUS 8-bit ASCII, '0'-'9' or space, dash, period, +** colon, comma, or underscore only. +** +** SAHPI_TL_TYPE_ASCII6 8-bit ASCII, reduced set, 0x20=0x5f only. +** +** SAHPI_TL_TYPE_TEXT 8-bit ASCII+Latin 1 +** +** SAHPI_TL_TYPE_BINARY 8-bit bytes, any values legal +** +** Note: "ASCII+Latin 1" is derived from the first 256 characters of +** Unicode 2.0. The first 256 codes of Unicode follow ISO 646 (ASCII) +** and ISO 8859/1 (Latin 1). The Unicode "C0 Controls and Basic Latin" +** set defines the first 128 8-bit characters (00h-7Fh) and the +** "C1 Controls and Latin 1 Supplement" defines the second 128 (80h-FFh). +** +** Note: The SAHPI_TL_TYPE_BCDPLUS and SAHPI_TL_TYPE_ASCII6 encodings +** use normal ASCII character encodings, but restrict the allowed +** characters to a subset of the entire ASCII character set. These +** encodings are used when the target device contains restrictions +** on which characters it can store or display. SAHPI_TL_TYPE_BCDPLUS +** data may be stored externally as 4-bit values, and +** SAHPI_TL_TYPE_ASCII6 may be stored externally as 6-bit values. +** But, regardless of how the data is stored externally, it is +** encoded as 8-bit ASCII in the SaHpiTextBufferT structure passed +** across the HPI. +*/ + +#define SAHPI_MAX_TEXT_BUFFER_LENGTH 255 + +typedef enum { + SAHPI_TL_TYPE_UNICODE = 0, /* 2-byte UNICODE characters; DataLength + must be even. */ + SAHPI_TL_TYPE_BCDPLUS, /* String of ASCII characters, '0'-'9', space, + dash, period, colon, comma or underscore + ONLY */ + SAHPI_TL_TYPE_ASCII6, /* Reduced ASCII character set: 0x20-0x5F + ONLY */ + SAHPI_TL_TYPE_TEXT, /* ASCII+Latin 1 */ + SAHPI_TL_TYPE_BINARY /* Binary data, any values legal */ +} SaHpiTextTypeT; + +typedef struct { + SaHpiTextTypeT DataType; + SaHpiLanguageT Language; /* Language the text is in. */ + SaHpiUint8T DataLength; /* Bytes used in Data buffer */ + SaHpiUint8T Data[SAHPI_MAX_TEXT_BUFFER_LENGTH]; /* Data buffer */ +} SaHpiTextBufferT; + +/* +** Instrument Id +** +** The following data type is used for all management instrument identifiers - +** sensor numbers, control numbers, watchdog timer numbers, etc. +** +*/ + +typedef SaHpiUint32T SaHpiInstrumentIdT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Entities ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* +** Entity Types +** +** Entities are used to associate specific hardware components with sensors, +** controls, watchdogs, or resources. Entities are defined with an entity +** type enumeration, and an entity location number (to identify +** the physical location of a particular type of entity). +** +** Entities are uniquely identified in a system with an ordered series of +** Entity Type / Entity Location pairs called an "Entity Path". Each subsequent +** Entity Type/Entity Location in the path is the next higher "containing" +** entity. The "root" of the Entity Path (the outermost level of containment) +** is designated with an Entity Type of SAHPI_ENT_ROOT if the entire Entity Path +** is fewer than SAHPI_MAX_ENTITY_PATH entries in length. +** +** Enumerated Entity Types include those types enumerated by the IPMI Consortium +** for IPMI-managed entities, as well as additional types defined by the +** HPI specification. Room is left in the enumeration for the inclusion of +** Entity Types taken from other lists, if needed in the future. +*/ +/* Base values for entity types from various sources. */ +#define SAHPI_ENT_IPMI_GROUP 0 +#define SAHPI_ENT_SAFHPI_GROUP 0x10000 +#define SAHPI_ENT_ROOT_VALUE 0xFFFF +typedef enum +{ + SAHPI_ENT_UNSPECIFIED = SAHPI_ENT_IPMI_GROUP, + SAHPI_ENT_OTHER, + SAHPI_ENT_UNKNOWN, + SAHPI_ENT_PROCESSOR, + SAHPI_ENT_DISK_BAY, /* Disk or disk bay */ + SAHPI_ENT_PERIPHERAL_BAY, + SAHPI_ENT_SYS_MGMNT_MODULE, /* System management module */ + SAHPI_ENT_SYSTEM_BOARD, /* Main system board, may also be + processor board and/or internal + expansion board */ + SAHPI_ENT_MEMORY_MODULE, /* Board holding memory devices */ + SAHPI_ENT_PROCESSOR_MODULE, /* Holds processors, use this + designation when processors are not + mounted on system board */ + SAHPI_ENT_POWER_SUPPLY, /* Main power supply (supplies) for the + system */ + SAHPI_ENT_ADD_IN_CARD, + SAHPI_ENT_FRONT_PANEL_BOARD, /* Control panel */ + SAHPI_ENT_BACK_PANEL_BOARD, + SAHPI_ENT_POWER_SYSTEM_BOARD, + SAHPI_ENT_DRIVE_BACKPLANE, + SAHPI_ENT_SYS_EXPANSION_BOARD, /* System internal expansion board + (contains expansion slots). */ + SAHPI_ENT_OTHER_SYSTEM_BOARD, /* Part of board set */ + SAHPI_ENT_PROCESSOR_BOARD, /* Holds 1 or more processors. Includes + boards that hold SECC modules) */ + SAHPI_ENT_POWER_UNIT, /* Power unit / power domain (typically + used as a pre-defined logical entity + for grouping power supplies)*/ + SAHPI_ENT_POWER_MODULE, /* Power module / DC-to-DC converter. + Use this value for internal + converters. Note: You should use + entity ID (power supply) for the + main power supply even if the main + supply is a DC-to-DC converter */ + SAHPI_ENT_POWER_MGMNT, /* Power management/distribution + board */ + SAHPI_ENT_CHASSIS_BACK_PANEL_BOARD, + SAHPI_ENT_SYSTEM_CHASSIS, + SAHPI_ENT_SUB_CHASSIS, + SAHPI_ENT_OTHER_CHASSIS_BOARD, + SAHPI_ENT_DISK_DRIVE_BAY, + SAHPI_ENT_PERIPHERAL_BAY_2, + SAHPI_ENT_DEVICE_BAY, + SAHPI_ENT_COOLING_DEVICE, /* Fan/cooling device */ + SAHPI_ENT_COOLING_UNIT, /* Can be used as a pre-defined logical + entity for grouping fans or other + cooling devices. */ + SAHPI_ENT_INTERCONNECT, /* Cable / interconnect */ + SAHPI_ENT_MEMORY_DEVICE, /* This Entity ID should be used for + replaceable memory devices, e.g. + DIMM/SIMM. It is recommended that + Entity IDs not be used for + individual non-replaceable memory + devices. Rather, monitoring and + error reporting should be associated + with the FRU [e.g. memory card] + holding the memory. */ + SAHPI_ENT_SYS_MGMNT_SOFTWARE, /* System Management Software */ + SAHPI_ENT_BIOS, + SAHPI_ENT_OPERATING_SYSTEM, + SAHPI_ENT_SYSTEM_BUS, + SAHPI_ENT_GROUP, /* This is a logical entity for use with + Entity Association records. It is + provided to allow a sensor data + record to point to an entity- + association record when there is no + appropriate pre-defined logical + entity for the entity grouping. + This Entity should not be used as a + physical entity. */ + SAHPI_ENT_REMOTE, /* Out of band management communication + device */ + SAHPI_ENT_EXTERNAL_ENVIRONMENT, + SAHPI_ENT_BATTERY, + SAHPI_ENT_CHASSIS_SPECIFIC = SAHPI_ENT_IPMI_GROUP + 0x90, + SAHPI_ENT_BOARD_SET_SPECIFIC = SAHPI_ENT_IPMI_GROUP + 0xB0, + SAHPI_ENT_OEM_SYSINT_SPECIFIC = SAHPI_ENT_IPMI_GROUP + 0xD0, + SAHPI_ENT_ROOT = SAHPI_ENT_ROOT_VALUE, + SAHPI_ENT_RACK = SAHPI_ENT_SAFHPI_GROUP, + SAHPI_ENT_SUBRACK, + SAHPI_ENT_COMPACTPCI_CHASSIS, + SAHPI_ENT_ADVANCEDTCA_CHASSIS, + SAHPI_ENT_RACK_MOUNTED_SERVER, + SAHPI_ENT_SYSTEM_BLADE, + SAHPI_ENT_SWITCH, /* Network switch, such as a + rack-mounted ethernet or fabric + switch. */ + SAHPI_ENT_SWITCH_BLADE, /* Network switch, as above, but in + a bladed system. */ + SAHPI_ENT_SBC_BLADE, + SAHPI_ENT_IO_BLADE, + SAHPI_ENT_DISK_BLADE, + SAHPI_ENT_DISK_DRIVE, + SAHPI_ENT_FAN, + SAHPI_ENT_POWER_DISTRIBUTION_UNIT, + SAHPI_ENT_SPEC_PROC_BLADE, /* Special Processing Blade, + including DSP */ + SAHPI_ENT_IO_SUBBOARD, /* I/O Sub-Board, including + PMC I/O board */ + SAHPI_ENT_SBC_SUBBOARD, /* SBC Sub-Board, including PMC + SBC board */ + SAHPI_ENT_ALARM_MANAGER, /* Chassis alarm manager board */ + SAHPI_ENT_SHELF_MANAGER, /* Blade-based shelf manager */ + SAHPI_ENT_DISPLAY_PANEL, /* Display panel, such as an + alarm display panel. */ + SAHPI_ENT_SUBBOARD_CARRIER_BLADE, /* Includes PMC Carrier Blade -- + Use only if "carrier" is only + function of blade. Else use + primary function (SBC_BLADE, + DSP_BLADE, etc.). */ + SAHPI_ENT_PHYSICAL_SLOT /* Indicates the physical slot into + which a blade is inserted. */ +} SaHpiEntityTypeT; + +typedef SaHpiUint32T SaHpiEntityLocationT; + +typedef struct { + SaHpiEntityTypeT EntityType; + SaHpiEntityLocationT EntityLocation; +} SaHpiEntityT; + + +#define SAHPI_MAX_ENTITY_PATH 16 + +typedef struct { + SaHpiEntityT Entry[SAHPI_MAX_ENTITY_PATH]; +} SaHpiEntityPathT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Events, part 1 ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* +** Category +** +** Sensor events contain an event category and event state. Depending on the +** event category, the event states take on different meanings for events +** generated by specific sensors. +** +** It is recommended that implementations map their sensor specific +** event categories into the set of categories listed here. When such a mapping +** is impractical or impossible, the SAHPI_EC_SENSOR_SPECIFIC category should +** be used. +** +** The SAHPI_EC_GENERIC category can be used for discrete sensors which have +** state meanings other than those identified with other event categories. +*/ +typedef SaHpiUint8T SaHpiEventCategoryT; + +#define SAHPI_EC_UNSPECIFIED (SaHpiEventCategoryT)0x00 /* Unspecified */ +#define SAHPI_EC_THRESHOLD (SaHpiEventCategoryT)0x01 /* Threshold + events */ +#define SAHPI_EC_USAGE (SaHpiEventCategoryT)0x02 /* Usage state + events */ +#define SAHPI_EC_STATE (SaHpiEventCategoryT)0x03 /* Generic state + events */ +#define SAHPI_EC_PRED_FAIL (SaHpiEventCategoryT)0x04 /* Predictive fail + events */ +#define SAHPI_EC_LIMIT (SaHpiEventCategoryT)0x05 /* Limit events */ +#define SAHPI_EC_PERFORMANCE (SaHpiEventCategoryT)0x06 /* Performance + events */ +#define SAHPI_EC_SEVERITY (SaHpiEventCategoryT)0x07 /* Severity + indicating + events */ +#define SAHPI_EC_PRESENCE (SaHpiEventCategoryT)0x08 /* Device presence + events */ +#define SAHPI_EC_ENABLE (SaHpiEventCategoryT)0x09 /* Device enabled + events */ +#define SAHPI_EC_AVAILABILITY (SaHpiEventCategoryT)0x0A /* Availability + state events */ +#define SAHPI_EC_REDUNDANCY (SaHpiEventCategoryT)0x0B /* Redundancy + state events */ +#define SAHPI_EC_SENSOR_SPECIFIC (SaHpiEventCategoryT)0x7E /* Sensor- + specific events */ +#define SAHPI_EC_GENERIC (SaHpiEventCategoryT)0x7F /* OEM defined + events */ + +/* +** Event States +** +** The following event states are specified relative to the categories listed +** above. The event types are only valid for their given category. Each set of +** events is labeled as to which category it belongs to. +** Each event will have only one event state associated with it. When retrieving +** the event status or event enabled status a bit mask of all applicable event +** states is used. Similarly, when setting the event enabled status a bit mask +** of all applicable event states is used. +*/ +typedef SaHpiUint16T SaHpiEventStateT; + +/* +** SaHpiEventCategoryT == +*/ +#define SAHPI_ES_UNSPECIFIED (SaHpiEventStateT)0x0000 + +/* +** SaHpiEventCategoryT == SAHPI_EC_THRESHOLD +** When using these event states, the event state should match +** the event severity (for example SAHPI_ES_LOWER_MINOR should have an +** event severity of SAHPI_MINOR). +*/ +#define SAHPI_ES_LOWER_MINOR (SaHpiEventStateT)0x0001 +#define SAHPI_ES_LOWER_MAJOR (SaHpiEventStateT)0x0002 +#define SAHPI_ES_LOWER_CRIT (SaHpiEventStateT)0x0004 +#define SAHPI_ES_UPPER_MINOR (SaHpiEventStateT)0x0008 +#define SAHPI_ES_UPPER_MAJOR (SaHpiEventStateT)0x0010 +#define SAHPI_ES_UPPER_CRIT (SaHpiEventStateT)0x0020 + +/* SaHpiEventCategoryT == SAHPI_EC_USAGE */ +#define SAHPI_ES_IDLE (SaHpiEventStateT)0x0001 +#define SAHPI_ES_ACTIVE (SaHpiEventStateT)0x0002 +#define SAHPI_ES_BUSY (SaHpiEventStateT)0x0004 + +/* SaHpiEventCategoryT == SAHPI_EC_STATE */ +#define SAHPI_ES_STATE_DEASSERTED (SaHpiEventStateT)0x0001 +#define SAHPI_ES_STATE_ASSERTED (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_PRED_FAIL */ +#define SAHPI_ES_PRED_FAILURE_DEASSERT (SaHpiEventStateT)0x0001 +#define SAHPI_ES_PRED_FAILURE_ASSERT (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_LIMIT */ +#define SAHPI_ES_LIMIT_NOT_EXCEEDED (SaHpiEventStateT)0x0001 +#define SAHPI_ES_LIMIT_EXCEEDED (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_PERFORMANCE */ +#define SAHPI_ES_PERFORMANCE_MET (SaHpiEventStateT)0x0001 +#define SAHPI_ES_PERFORMANCE_LAGS (SaHpiEventStateT)0x0002 + +/* +** SaHpiEventCategoryT == SAHPI_EC_SEVERITY +** When using these event states, the event state should match +** the event severity +*/ +#define SAHPI_ES_OK (SaHpiEventStateT)0x0001 +#define SAHPI_ES_MINOR_FROM_OK (SaHpiEventStateT)0x0002 +#define SAHPI_ES_MAJOR_FROM_LESS (SaHpiEventStateT)0x0004 +#define SAHPI_ES_CRITICAL_FROM_LESS (SaHpiEventStateT)0x0008 +#define SAHPI_ES_MINOR_FROM_MORE (SaHpiEventStateT)0x0010 +#define SAHPI_ES_MAJOR_FROM_CRITICAL (SaHpiEventStateT)0x0020 +#define SAHPI_ES_CRITICAL (SaHpiEventStateT)0x0040 +#define SAHPI_ES_MONITOR (SaHpiEventStateT)0x0080 +#define SAHPI_ES_INFORMATIONAL (SaHpiEventStateT)0x0100 + +/* SaHpiEventCategoryT == SAHPI_EC_PRESENCE */ +#define SAHPI_ES_ABSENT (SaHpiEventStateT)0x0001 +#define SAHPI_ES_PRESENT (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_ENABLE */ +#define SAHPI_ES_DISABLED (SaHpiEventStateT)0x0001 +#define SAHPI_ES_ENABLED (SaHpiEventStateT)0x0002 + +/* SaHpiEventCategoryT == SAHPI_EC_AVAILABILITY */ +#define SAHPI_ES_RUNNING (SaHpiEventStateT)0x0001 +#define SAHPI_ES_TEST (SaHpiEventStateT)0x0002 +#define SAHPI_ES_POWER_OFF (SaHpiEventStateT)0x0004 +#define SAHPI_ES_ON_LINE (SaHpiEventStateT)0x0008 +#define SAHPI_ES_OFF_LINE (SaHpiEventStateT)0x0010 +#define SAHPI_ES_OFF_DUTY (SaHpiEventStateT)0x0020 +#define SAHPI_ES_DEGRADED (SaHpiEventStateT)0x0040 +#define SAHPI_ES_POWER_SAVE (SaHpiEventStateT)0x0080 +#define SAHPI_ES_INSTALL_ERROR (SaHpiEventStateT)0x0100 + +/* SaHpiEventCategoryT == SAHPI_EC_REDUNDANCY */ +#define SAHPI_ES_FULLY_REDUNDANT (SaHpiEventStateT)0x0001 +#define SAHPI_ES_REDUNDANCY_LOST (SaHpiEventStateT)0x0002 +#define SAHPI_ES_REDUNDANCY_DEGRADED (SaHpiEventStateT)0x0004 +#define SAHPI_ES_REDUNDANCY_LOST_SUFFICIENT_RESOURCES \ + (SaHpiEventStateT)0x0008 +#define SAHPI_ES_NON_REDUNDANT_SUFFICIENT_RESOURCES \ + (SaHpiEventStateT)0x0010 +#define SAHPI_ES_NON_REDUNDANT_INSUFFICIENT_RESOURCES \ + (SaHpiEventStateT)0x0020 +#define SAHPI_ES_REDUNDANCY_DEGRADED_FROM_FULL (SaHpiEventStateT)0x0040 +#define SAHPI_ES_REDUNDANCY_DEGRADED_FROM_NON (SaHpiEventStateT)0x0080 + +/* +** SaHpiEventCategoryT == SAHPI_EC_GENERIC || SAHPI_EC_SENSOR_SPECIFIC +** These event states are implementation-specific. +*/ +#define SAHPI_ES_STATE_00 (SaHpiEventStateT)0x0001 +#define SAHPI_ES_STATE_01 (SaHpiEventStateT)0x0002 +#define SAHPI_ES_STATE_02 (SaHpiEventStateT)0x0004 +#define SAHPI_ES_STATE_03 (SaHpiEventStateT)0x0008 +#define SAHPI_ES_STATE_04 (SaHpiEventStateT)0x0010 +#define SAHPI_ES_STATE_05 (SaHpiEventStateT)0x0020 +#define SAHPI_ES_STATE_06 (SaHpiEventStateT)0x0040 +#define SAHPI_ES_STATE_07 (SaHpiEventStateT)0x0080 +#define SAHPI_ES_STATE_08 (SaHpiEventStateT)0x0100 +#define SAHPI_ES_STATE_09 (SaHpiEventStateT)0x0200 +#define SAHPI_ES_STATE_10 (SaHpiEventStateT)0x0400 +#define SAHPI_ES_STATE_11 (SaHpiEventStateT)0x0800 +#define SAHPI_ES_STATE_12 (SaHpiEventStateT)0x1000 +#define SAHPI_ES_STATE_13 (SaHpiEventStateT)0x2000 +#define SAHPI_ES_STATE_14 (SaHpiEventStateT)0x4000 + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Sensors ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Sensor Number */ +typedef SaHpiInstrumentIdT SaHpiSensorNumT; +/* The following specifies the named range for standard sensor numbers. */ +#define SAHPI_STANDARD_SENSOR_MIN (SaHpiSensorNumT)0x00000100 +#define SAHPI_STANDARD_SENSOR_MAX (SaHpiSensorNumT)0x000001FF + +/* Type of Sensor */ +typedef enum { + SAHPI_TEMPERATURE = 0x01, + SAHPI_VOLTAGE, + SAHPI_CURRENT, + SAHPI_FAN, + SAHPI_PHYSICAL_SECURITY, + SAHPI_PLATFORM_VIOLATION, + SAHPI_PROCESSOR, + SAHPI_POWER_SUPPLY, + SAHPI_POWER_UNIT, + SAHPI_COOLING_DEVICE, + SAHPI_OTHER_UNITS_BASED_SENSOR, + SAHPI_MEMORY, + SAHPI_DRIVE_SLOT, + SAHPI_POST_MEMORY_RESIZE, + SAHPI_SYSTEM_FW_PROGRESS, + SAHPI_EVENT_LOGGING_DISABLED, + SAHPI_RESERVED1, + SAHPI_SYSTEM_EVENT, + SAHPI_CRITICAL_INTERRUPT, + SAHPI_BUTTON, + SAHPI_MODULE_BOARD, + SAHPI_MICROCONTROLLER_COPROCESSOR, + SAHPI_ADDIN_CARD, + SAHPI_CHASSIS, + SAHPI_CHIP_SET, + SAHPI_OTHER_FRU, + SAHPI_CABLE_INTERCONNECT, + SAHPI_TERMINATOR, + SAHPI_SYSTEM_BOOT_INITIATED, + SAHPI_BOOT_ERROR, + SAHPI_OS_BOOT, + SAHPI_OS_CRITICAL_STOP, + SAHPI_SLOT_CONNECTOR, + SAHPI_SYSTEM_ACPI_POWER_STATE, + SAHPI_RESERVED2, + SAHPI_PLATFORM_ALERT, + SAHPI_ENTITY_PRESENCE, + SAHPI_MONITOR_ASIC_IC, + SAHPI_LAN, + SAHPI_MANAGEMENT_SUBSYSTEM_HEALTH, + SAHPI_BATTERY, + SAHPI_OPERATIONAL = 0xA0, + SAHPI_OEM_SENSOR=0xC0 +} SaHpiSensorTypeT; + +/* +** Sensor Reading Type +** +** These definitions list the available data types that can be +** used for sensor readings. +** +*/ + +#define SAHPI_SENSOR_BUFFER_LENGTH 32 + +typedef enum { + SAHPI_SENSOR_READING_TYPE_INT64, + SAHPI_SENSOR_READING_TYPE_UINT64, + SAHPI_SENSOR_READING_TYPE_FLOAT64, + SAHPI_SENSOR_READING_TYPE_BUFFER /* 32 byte array. The format of + the buffer is implementation- + specific. Sensors that use + this reading type may not have + thresholds that are settable + or readable. */ +} SaHpiSensorReadingTypeT; + +typedef union { + SaHpiInt64T SensorInt64; + SaHpiUint64T SensorUint64; + SaHpiFloat64T SensorFloat64; + SaHpiUint8T SensorBuffer[SAHPI_SENSOR_BUFFER_LENGTH]; +} SaHpiSensorReadingUnionT; + +/* +** Sensor Reading +** +** The sensor reading data structure is returned from a call to get +** sensor reading. The structure is also used when setting and getting sensor +** threshold values and reporting sensor ranges. +** +** IsSupported is set when a sensor reading/threshold value is available. +** Otherwise, if no reading or threshold is supported, this flag is set to +** False. +** +*/ + +typedef struct { + SaHpiBoolT IsSupported; + SaHpiSensorReadingTypeT Type; + SaHpiSensorReadingUnionT Value; +} SaHpiSensorReadingT; + + +/* Sensor Event Mask Actions - used with saHpiSensorEventMasksSet() */ + +typedef enum { + SAHPI_SENS_ADD_EVENTS_TO_MASKS, + SAHPI_SENS_REMOVE_EVENTS_FROM_MASKS +} SaHpiSensorEventMaskActionT; + +/* Value to use for AssertEvents or DeassertEvents parameter + in saHpiSensorEventMasksSet() to set or clear all supported + event states for a sensor in the mask */ + +#define SAHPI_ALL_EVENT_STATES (SaHpiEventStateT)0xFFFF + +/* +** Threshold Values +** This structure encompasses all of the thresholds that can be set. +** These are set and read with the same units as sensors report in +** saHpiSensorReadingGet(). When hysteresis is not constant over the +** range of sensor values, it is calculated at the nominal sensor reading, +** as given in the Range field of the sensor RDR. +** +** Thresholds are required to be set in-order (such that the setting for +** UpCritical is greater than or equal to the setting for UpMajor, etc.).*/ + +typedef struct { + SaHpiSensorReadingT LowCritical; /* Lower Critical Threshold */ + SaHpiSensorReadingT LowMajor; /* Lower Major Threshold */ + SaHpiSensorReadingT LowMinor; /* Lower Minor Threshold */ + SaHpiSensorReadingT UpCritical; /* Upper critical Threshold */ + SaHpiSensorReadingT UpMajor; /* Upper major Threshold */ + SaHpiSensorReadingT UpMinor; /* Upper minor Threshold */ + SaHpiSensorReadingT PosThdHysteresis; /* Positive Threshold Hysteresis */ + SaHpiSensorReadingT NegThdHysteresis; /* Negative Threshold Hysteresis */ +}SaHpiSensorThresholdsT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Sensor Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** Sensor Range +** Sensor range values can include minimum, maximum, normal minimum, normal +** maximum, and nominal values. +** +** Sensor thresholds cannot be set outside of the range defined by SAHPI_SRF_MIN +** through SAHPI_SRF_MAX, if these limits are present (as indicated by the +** SaHpiSensorRangeFlagsT). If the MIN limit is not present, no lower bound +** will be enforced on sensor thresholds. If the MAX limit is not present, no +** upper bound will be enforced on sensor thresholds. +*/ +typedef SaHpiUint8T SaHpiSensorRangeFlagsT; +#define SAHPI_SRF_MIN (SaHpiSensorRangeFlagsT)0x10 +#define SAHPI_SRF_MAX (SaHpiSensorRangeFlagsT)0x08 +#define SAHPI_SRF_NORMAL_MIN (SaHpiSensorRangeFlagsT)0x04 +#define SAHPI_SRF_NORMAL_MAX (SaHpiSensorRangeFlagsT)0x02 +#define SAHPI_SRF_NOMINAL (SaHpiSensorRangeFlagsT)0x01 + +typedef struct { + SaHpiSensorRangeFlagsT Flags; + SaHpiSensorReadingT Max; + SaHpiSensorReadingT Min; + SaHpiSensorReadingT Nominal; + SaHpiSensorReadingT NormalMax; + SaHpiSensorReadingT NormalMin; +} SaHpiSensorRangeT; + +/* +** Sensor Units +** This is a list of all the sensor units supported by HPI. +*/ +typedef enum { + SAHPI_SU_UNSPECIFIED = 0, SAHPI_SU_DEGREES_C, SAHPI_SU_DEGREES_F, + SAHPI_SU_DEGREES_K, SAHPI_SU_VOLTS, SAHPI_SU_AMPS, + SAHPI_SU_WATTS, SAHPI_SU_JOULES, SAHPI_SU_COULOMBS, + SAHPI_SU_VA, SAHPI_SU_NITS, SAHPI_SU_LUMEN, + SAHPI_SU_LUX, SAHPI_SU_CANDELA, SAHPI_SU_KPA, + SAHPI_SU_PSI, SAHPI_SU_NEWTON, SAHPI_SU_CFM, + SAHPI_SU_RPM, SAHPI_SU_HZ, SAHPI_SU_MICROSECOND, + SAHPI_SU_MILLISECOND, SAHPI_SU_SECOND, SAHPI_SU_MINUTE, + SAHPI_SU_HOUR, SAHPI_SU_DAY, SAHPI_SU_WEEK, + SAHPI_SU_MIL, SAHPI_SU_INCHES, SAHPI_SU_FEET, + SAHPI_SU_CU_IN, SAHPI_SU_CU_FEET, SAHPI_SU_MM, + SAHPI_SU_CM, SAHPI_SU_M, SAHPI_SU_CU_CM, + SAHPI_SU_CU_M, SAHPI_SU_LITERS, SAHPI_SU_FLUID_OUNCE, + SAHPI_SU_RADIANS, SAHPI_SU_STERADIANS, SAHPI_SU_REVOLUTIONS, + SAHPI_SU_CYCLES, SAHPI_SU_GRAVITIES, SAHPI_SU_OUNCE, + SAHPI_SU_POUND, SAHPI_SU_FT_LB, SAHPI_SU_OZ_IN, + SAHPI_SU_GAUSS, SAHPI_SU_GILBERTS, SAHPI_SU_HENRY, + SAHPI_SU_MILLIHENRY, SAHPI_SU_FARAD, SAHPI_SU_MICROFARAD, + SAHPI_SU_OHMS, SAHPI_SU_SIEMENS, SAHPI_SU_MOLE, + SAHPI_SU_BECQUEREL, SAHPI_SU_PPM, SAHPI_SU_RESERVED, + SAHPI_SU_DECIBELS, SAHPI_SU_DBA, SAHPI_SU_DBC, + SAHPI_SU_GRAY, SAHPI_SU_SIEVERT, SAHPI_SU_COLOR_TEMP_DEG_K, + SAHPI_SU_BIT, SAHPI_SU_KILOBIT, SAHPI_SU_MEGABIT, + SAHPI_SU_GIGABIT, SAHPI_SU_BYTE, SAHPI_SU_KILOBYTE, + SAHPI_SU_MEGABYTE, SAHPI_SU_GIGABYTE, SAHPI_SU_WORD, + SAHPI_SU_DWORD, SAHPI_SU_QWORD, SAHPI_SU_LINE, + SAHPI_SU_HIT, SAHPI_SU_MISS, SAHPI_SU_RETRY, + SAHPI_SU_RESET, SAHPI_SU_OVERRUN, SAHPI_SU_UNDERRUN, + SAHPI_SU_COLLISION, SAHPI_SU_PACKETS, SAHPI_SU_MESSAGES, + SAHPI_SU_CHARACTERS, SAHPI_SU_ERRORS, SAHPI_SU_CORRECTABLE_ERRORS, + SAHPI_SU_UNCORRECTABLE_ERRORS +} SaHpiSensorUnitsT; + +/* +** Modifier Unit Use +** This type defines how the modifier unit is used. For example: base unit == +** meter, modifier unit == seconds, and modifier unit use == +** SAHPI_SMUU_BASIC_OVER_MODIFIER. The resulting unit would be meters per +** second. +*/ +typedef enum { + SAHPI_SMUU_NONE = 0, + SAHPI_SMUU_BASIC_OVER_MODIFIER, /* Basic Unit / Modifier Unit */ + SAHPI_SMUU_BASIC_TIMES_MODIFIER /* Basic Unit * Modifier Unit */ +} SaHpiSensorModUnitUseT; + +/* +** Data Format +** When IsSupported is False, the sensor does not support data readings +** (it only supports event states). A False setting for this flag +** indicates that the rest of the structure is not meaningful. +** +** This structure encapsulates all of the various types that make up the +** definition of sensor data. For reading type of +** SAHPI_SENSOR_READING_TYPE_BUFFER, the rest of the structure +** (beyond ReadingType) is not meaningful. +** +** The Accuracy Factor is expressed as a floating point percentage +** (e.g. 0.05 = 5%) and represents statistically how close the measured +** reading is to the actual value. It is an interpreted value that +** figures in all sensor accuracies, resolutions, and tolerances. +*/ + +typedef struct { + SaHpiBoolT IsSupported; /* Indicates if sensor data + readings are supported.*/ + SaHpiSensorReadingTypeT ReadingType; /* Type of value for sensor + reading. */ + SaHpiSensorUnitsT BaseUnits; /* Base units (meters, etc.) */ + SaHpiSensorUnitsT ModifierUnits; /* Modifier unit (second, etc.)*/ + SaHpiSensorModUnitUseT ModifierUse; /* Modifier use(m/sec, etc.) */ + SaHpiBoolT Percentage; /* Is value a percentage */ + SaHpiSensorRangeT Range; /* Valid range of sensor */ + SaHpiFloat64T AccuracyFactor; /* Accuracy */ +} SaHpiSensorDataFormatT; + +/* +** Threshold Support +** +** These types define what threshold values are readable and writable. +** Thresholds are read/written in the same ReadingType as is used for sensor +** readings. +*/ +typedef SaHpiUint8T SaHpiSensorThdMaskT; +#define SAHPI_STM_LOW_MINOR (SaHpiSensorThdMaskT)0x01 +#define SAHPI_STM_LOW_MAJOR (SaHpiSensorThdMaskT)0x02 +#define SAHPI_STM_LOW_CRIT (SaHpiSensorThdMaskT)0x04 +#define SAHPI_STM_UP_MINOR (SaHpiSensorThdMaskT)0x08 +#define SAHPI_STM_UP_MAJOR (SaHpiSensorThdMaskT)0x10 +#define SAHPI_STM_UP_CRIT (SaHpiSensorThdMaskT)0x20 +#define SAHPI_STM_UP_HYSTERESIS (SaHpiSensorThdMaskT)0x40 +#define SAHPI_STM_LOW_HYSTERESIS (SaHpiSensorThdMaskT)0x80 + +typedef struct { + SaHpiBoolT IsAccessible; /* True if the sensor + supports readable or writable + thresholds. If False, + rest of structure is not + meaningful. Sensors that have the + IsAccessible flag set must also + support the threshold event category + A sensor of reading type SAHPI_ + SENSOR_READING_TYPE_BUFFER cannot + have accessible thresholds.*/ + SaHpiSensorThdMaskT ReadThold; /* Readable thresholds */ + SaHpiSensorThdMaskT WriteThold; /* Writable thresholds */ + SaHpiBoolT Nonlinear; /* If this flag is set, hysteresis + values are calculated at the nominal + sensor value. */ +} SaHpiSensorThdDefnT; + +/* +** Event Control +** +** This type defines how sensor event messages can be controlled (can be turned +** off and on for each type of event, etc.). +*/ +typedef enum { + SAHPI_SEC_PER_EVENT = 0, /* Event message control per event, + or by entire sensor; sensor event enable + status can be changed, and assert/deassert + masks can be changed */ + SAHPI_SEC_READ_ONLY_MASKS, /* Control for entire sensor only; sensor + event enable status can be changed, but + assert/deassert masks cannot be changed */ + SAHPI_SEC_READ_ONLY /* Event control not supported; sensor event + enable status cannot be changed and + assert/deassert masks cannot be changed */ +} SaHpiSensorEventCtrlT; + +/* +** Record +** +** This is the sensor resource data record which describes all of the static +** data associated with a sensor. +*/ +typedef struct { + SaHpiSensorNumT Num; /* Sensor Number/Index */ + SaHpiSensorTypeT Type; /* General Sensor Type */ + SaHpiEventCategoryT Category; /* Event category */ + SaHpiBoolT EnableCtrl; /* True if HPI User can enable + or disable sensor via + saHpiSensorEnableSet() */ + SaHpiSensorEventCtrlT EventCtrl; /* How events can be controlled */ + SaHpiEventStateT Events; /* Bit mask of event states + supported */ + SaHpiSensorDataFormatT DataFormat; /* Format of the data */ + SaHpiSensorThdDefnT ThresholdDefn; /* Threshold Definition */ + SaHpiUint32T Oem; /* Reserved for OEM use */ +} SaHpiSensorRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Aggregate Status ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* These are the default sensor numbers for aggregate status. */ +#define SAHPI_DEFAGSENS_OPER (SaHpiSensorNumT)0x00000100 +#define SAHPI_DEFAGSENS_PWR (SaHpiSensorNumT)0x00000101 +#define SAHPI_DEFAGSENS_TEMP (SaHpiSensorNumT)0x00000102 + +/* The following specifies the named range for aggregate status. */ +#define SAHPI_DEFAGSENS_MIN (SaHpiSensorNumT)0x00000100 +#define SAHPI_DEFAGSENS_MAX (SaHpiSensorNumT)0x0000010F + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Controls ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Control Number */ +typedef SaHpiInstrumentIdT SaHpiCtrlNumT; + +/* +** Type of Control +** +** This enumerated type defines the different types of generic controls. +*/ +typedef enum { + SAHPI_CTRL_TYPE_DIGITAL = 0x00, + SAHPI_CTRL_TYPE_DISCRETE, + SAHPI_CTRL_TYPE_ANALOG, + SAHPI_CTRL_TYPE_STREAM, + SAHPI_CTRL_TYPE_TEXT, + SAHPI_CTRL_TYPE_OEM = 0xC0 +} SaHpiCtrlTypeT; + +/* +** Control State Type Definitions +*/ + +/* +** Digital Control State Definition +** +** Defines the types of digital control states. +** Any of the four states may be set using saHpiControlSet(). +** Only ON or OFF are appropriate returns from saHpiControlGet(). +** (PULSE_ON and PULSE_OFF are transitory and end in OFF and ON states, +** respectively.) +** OFF - the control is off +** ON - the control is on +** PULSE_OFF - the control is briefly turned off, and then turned back on +** PULSE_ON - the control is briefly turned on, and then turned back off +** +*/ +typedef enum { + SAHPI_CTRL_STATE_OFF = 0, + SAHPI_CTRL_STATE_ON, + SAHPI_CTRL_STATE_PULSE_OFF, + SAHPI_CTRL_STATE_PULSE_ON +} SaHpiCtrlStateDigitalT; + +/* +** Discrete Control State Definition +*/ +typedef SaHpiUint32T SaHpiCtrlStateDiscreteT; + +/* +** Analog Control State Definition +*/ +typedef SaHpiInt32T SaHpiCtrlStateAnalogT; + +/* +** Stream Control State Definition +*/ +#define SAHPI_CTRL_MAX_STREAM_LENGTH 4 +typedef struct { + SaHpiBoolT Repeat; /* Repeat flag */ + SaHpiUint32T StreamLength; /* Length of the data, in bytes, + stored in the stream. */ + SaHpiUint8T Stream[SAHPI_CTRL_MAX_STREAM_LENGTH]; +} SaHpiCtrlStateStreamT; + +/* +** Text Control State Definition +*/ +typedef SaHpiUint8T SaHpiTxtLineNumT; + +/* Reserved number for sending output to all lines */ +#define SAHPI_TLN_ALL_LINES (SaHpiTxtLineNumT)0x00 + +typedef struct { + SaHpiTxtLineNumT Line; /* Operate on line # */ + SaHpiTextBufferT Text; /* Text to display */ +} SaHpiCtrlStateTextT; + +/* +** OEM Control State Definition +*/ +#define SAHPI_CTRL_MAX_OEM_BODY_LENGTH 255 +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiUint8T BodyLength; + SaHpiUint8T Body[SAHPI_CTRL_MAX_OEM_BODY_LENGTH]; /* OEM Specific */ +} SaHpiCtrlStateOemT; + +typedef union { + SaHpiCtrlStateDigitalT Digital; + SaHpiCtrlStateDiscreteT Discrete; + SaHpiCtrlStateAnalogT Analog; + SaHpiCtrlStateStreamT Stream; + SaHpiCtrlStateTextT Text; + SaHpiCtrlStateOemT Oem; +} SaHpiCtrlStateUnionT; + +typedef struct { + SaHpiCtrlTypeT Type; /* Type of control */ + SaHpiCtrlStateUnionT StateUnion; /* Data for control type */ +} SaHpiCtrlStateT; +/* +** Control Mode Type Definition +** +** Controls may be in either AUTO mode or MANUAL mode. +** +*/ +typedef enum { + SAHPI_CTRL_MODE_AUTO, + SAHPI_CTRL_MODE_MANUAL +} SaHpiCtrlModeT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Control Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** Output Type +** +** This enumeration defines the what the control's output will be. +*/ +typedef enum { + SAHPI_CTRL_GENERIC = 0, + SAHPI_CTRL_LED, + SAHPI_CTRL_FAN_SPEED, + SAHPI_CTRL_DRY_CONTACT_CLOSURE, + SAHPI_CTRL_POWER_SUPPLY_INHIBIT, + SAHPI_CTRL_AUDIBLE, + SAHPI_CTRL_FRONT_PANEL_LOCKOUT, + SAHPI_CTRL_POWER_INTERLOCK, + SAHPI_CTRL_POWER_STATE, + SAHPI_CTRL_LCD_DISPLAY, + SAHPI_CTRL_OEM +} SaHpiCtrlOutputTypeT; + +/* +** Specific Record Types +** These types represent the specific types of control resource data records. +*/ +typedef struct { + SaHpiCtrlStateDigitalT Default; +} SaHpiCtrlRecDigitalT; + +typedef struct { + SaHpiCtrlStateDiscreteT Default; +} SaHpiCtrlRecDiscreteT; + +typedef struct { + SaHpiCtrlStateAnalogT Min; /* Minimum Value */ + SaHpiCtrlStateAnalogT Max; /* Maximum Value */ + SaHpiCtrlStateAnalogT Default; +} SaHpiCtrlRecAnalogT; + +typedef struct { + SaHpiCtrlStateStreamT Default; +} SaHpiCtrlRecStreamT; + +typedef struct { + SaHpiUint8T MaxChars; /* Maximum chars per line. + If the control DataType is + SAHPI_TL_TYPE_UNICODE, there will + be two bytes required for each + character. This field reports the + number of characters per line- not the + number of bytes. MaxChars must not be + larger than the number of characters + that can be placed in a single + SaHpiTextBufferT structure. */ + SaHpiUint8T MaxLines; /* Maximum # of lines */ + SaHpiLanguageT Language; /* Language Code */ + SaHpiTextTypeT DataType; /* Permitted Data */ + SaHpiCtrlStateTextT Default; +} SaHpiCtrlRecTextT; + +#define SAHPI_CTRL_OEM_CONFIG_LENGTH 10 +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiUint8T ConfigData[SAHPI_CTRL_OEM_CONFIG_LENGTH]; + SaHpiCtrlStateOemT Default; +} SaHpiCtrlRecOemT; + +typedef union { + SaHpiCtrlRecDigitalT Digital; + SaHpiCtrlRecDiscreteT Discrete; + SaHpiCtrlRecAnalogT Analog; + SaHpiCtrlRecStreamT Stream; + SaHpiCtrlRecTextT Text; + SaHpiCtrlRecOemT Oem; +} SaHpiCtrlRecUnionT; + +/* +** Default Control Mode Structure +** This structure tells an HPI User if the control comes up in Auto mode or +** in Manual mode, by default. It also indicates if the mode can be +** changed (using saHpiControlSet()). When ReadOnly is False, the mode +** can be changed from its default setting; otherwise attempting to +** change the mode will result in an error. +*/ +typedef struct { + SaHpiCtrlModeT Mode; /* Auto or Manual */ + SaHpiBoolT ReadOnly; /* Indicates if mode is read-only */ +} SaHpiCtrlDefaultModeT; + +/* +** Record Definition +** Definition of the control resource data record. +*/ +typedef struct { + SaHpiCtrlNumT Num; /* Control Number/Index */ + SaHpiCtrlOutputTypeT OutputType; + SaHpiCtrlTypeT Type; /* Type of control */ + SaHpiCtrlRecUnionT TypeUnion; /* Specific control record */ + SaHpiCtrlDefaultModeT DefaultMode; /*Indicates if the control comes up + in Auto or Manual mode. */ + SaHpiBoolT WriteOnly; /* Indicates if the control is + write-only. */ + SaHpiUint32T Oem; /* Reserved for OEM use */ +} SaHpiCtrlRecT; + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Inventory Data Repositories ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* +** These structures are used to read and write inventory data to entity +** inventory data repositories within a resource. +*/ +/* +** Inventory Data Repository ID +** Identifier for an inventory data repository. +*/ +typedef SaHpiInstrumentIdT SaHpiIdrIdT; +#define SAHPI_DEFAULT_INVENTORY_ID (SaHpiIdrIdT)0x00000000 + +/* Inventory Data Area type definitions */ +typedef enum { + SAHPI_IDR_AREATYPE_INTERNAL_USE = 0xB0, + SAHPI_IDR_AREATYPE_CHASSIS_INFO, + SAHPI_IDR_AREATYPE_BOARD_INFO, + SAHPI_IDR_AREATYPE_PRODUCT_INFO, + SAHPI_IDR_AREATYPE_OEM = 0xC0, + SAHPI_IDR_AREATYPE_UNSPECIFIED = 0xFF +} SaHpiIdrAreaTypeT; + +/* Inventory Data Field type definitions */ +typedef enum { + SAHPI_IDR_FIELDTYPE_CHASSIS_TYPE, + SAHPI_IDR_FIELDTYPE_MFG_DATETIME, + SAHPI_IDR_FIELDTYPE_MANUFACTURER, + SAHPI_IDR_FIELDTYPE_PRODUCT_NAME, + SAHPI_IDR_FIELDTYPE_PRODUCT_VERSION, + SAHPI_IDR_FIELDTYPE_SERIAL_NUMBER, + SAHPI_IDR_FIELDTYPE_PART_NUMBER, + SAHPI_IDR_FIELDTYPE_FILE_ID, + SAHPI_IDR_FIELDTYPE_ASSET_TAG, + SAHPI_IDR_FIELDTYPE_CUSTOM, + SAHPI_IDR_FIELDTYPE_UNSPECIFIED = 0xFF +} SaHpiIdrFieldTypeT; + +/* Inventory Data Field structure definition */ +typedef struct { + SaHpiEntryIdT AreaId; /* AreaId for the IDA to which */ + /* the Field belongs */ + SaHpiEntryIdT FieldId; /* Field Identifier */ + SaHpiIdrFieldTypeT Type; /* Field Type */ + SaHpiBoolT ReadOnly; /* Describes if a field is read-only. */ + /* All fields in a read-only area are */ + /* flagged as read-only as well.*/ + SaHpiTextBufferT Field; /* Field Data */ +} SaHpiIdrFieldT; + +/* Inventory Data Area header structure definition */ +typedef struct { + SaHpiEntryIdT AreaId; /* Area Identifier */ + SaHpiIdrAreaTypeT Type; /* Type of area */ + SaHpiBoolT ReadOnly; /* Describes if an area is read-only. */ + /* All area headers in a read-only IDR */ + /* are flagged as read-only as well.*/ + SaHpiUint32T NumFields; /* Number of Fields contained in Area */ +} SaHpiIdrAreaHeaderT; + +/* Inventory Data Repository Information structure definition */ +typedef struct { + SaHpiIdrIdT IdrId; /* Repository Identifier */ + SaHpiUint32T UpdateCount; /* The count is incremented any time the */ + /* IDR is changed. It rolls over to zero */ + /* when the maximum value is reached */ + SaHpiBoolT ReadOnly; /* Describes if the IDR is read-only. */ + /* All area headers and fields in a */ + /* read-only IDR are flagged as */ + /* read-only as well.*/ + SaHpiUint32T NumAreas; /* Number of Area contained in IDR */ +} SaHpiIdrInfoT; + + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Inventory Data Repository Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** All inventory data contained in an inventory data repository +** must be represented in the RDR repository +** with an SaHpiInventoryRecT. +*/ +typedef struct { + SaHpiIdrIdT IdrId; + SaHpiBoolT Persistent; /* True indicates that updates to IDR are + automatically and immediately persisted. + False indicates that updates are not + immediately persisted; but optionally may be + persisted via saHpiParmControl() function, as + defined in implementation documentation.*/ + SaHpiUint32T Oem; +} SaHpiInventoryRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Watchdogs ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** This section defines all of the data types associated with watchdog timers. +*/ + +/* Watchdog Number - Identifier for a watchdog timer. */ +typedef SaHpiInstrumentIdT SaHpiWatchdogNumT; +#define SAHPI_DEFAULT_WATCHDOG_NUM (SaHpiWatchdogNumT)0x00000000 + +/* +** Watchdog Timer Action +** +** These enumerations represent the possible actions to be taken upon watchdog +** timer timeout and the events that are generated for watchdog actions. +*/ +typedef enum { + SAHPI_WA_NO_ACTION = 0, + SAHPI_WA_RESET, + SAHPI_WA_POWER_DOWN, + SAHPI_WA_POWER_CYCLE +} SaHpiWatchdogActionT; + +typedef enum { + SAHPI_WAE_NO_ACTION = 0, + SAHPI_WAE_RESET, + SAHPI_WAE_POWER_DOWN, + SAHPI_WAE_POWER_CYCLE, + SAHPI_WAE_TIMER_INT=0x08 /* Used if Timer Preinterrupt only */ +} SaHpiWatchdogActionEventT; + +/* +** Watchdog Pre-timer Interrupt +** +** These enumerations represent the possible types of interrupts that may be +** triggered by a watchdog pre-timer event. The actual meaning of these +** operations may differ depending on the hardware architecture. +*/ +typedef enum { + SAHPI_WPI_NONE = 0, + SAHPI_WPI_SMI, + SAHPI_WPI_NMI, + SAHPI_WPI_MESSAGE_INTERRUPT, + SAHPI_WPI_OEM = 0x0F +} SaHpiWatchdogPretimerInterruptT; + +/* +** Watchdog Timer Use +** +** These enumerations represent the possible watchdog users that may have caused +** the watchdog to expire. For instance, if watchdog is being used during power +** on self test (POST), and it expires, the SAHPI_WTU_BIOS_POST expiration type +** will be set. Most specific uses for Watchdog timer by users of HPI should +** indicate SAHPI_WTU_SMS_OS if the use is to provide an OS-healthy heartbeat, +** or SAHPI_WTU_OEM if it is used for some other purpose. +*/ +typedef enum { + SAHPI_WTU_NONE = 0, + SAHPI_WTU_BIOS_FRB2, + SAHPI_WTU_BIOS_POST, + SAHPI_WTU_OS_LOAD, + SAHPI_WTU_SMS_OS, /* System Management System providing + heartbeat for OS */ + SAHPI_WTU_OEM, + SAHPI_WTU_UNSPECIFIED = 0x0F +} SaHpiWatchdogTimerUseT; + +/* +** Timer Use Expiration Flags +** These values are used for the Watchdog Timer Use Expiration flags in the +** SaHpiWatchdogT structure. +*/ +typedef SaHpiUint8T SaHpiWatchdogExpFlagsT; +#define SAHPI_WATCHDOG_EXP_BIOS_FRB2 (SaHpiWatchdogExpFlagsT)0x02 +#define SAHPI_WATCHDOG_EXP_BIOS_POST (SaHpiWatchdogExpFlagsT)0x04 +#define SAHPI_WATCHDOG_EXP_OS_LOAD (SaHpiWatchdogExpFlagsT)0x08 +#define SAHPI_WATCHDOG_EXP_SMS_OS (SaHpiWatchdogExpFlagsT)0x10 +#define SAHPI_WATCHDOG_EXP_OEM (SaHpiWatchdogExpFlagsT)0x20 + +/* +** Watchdog Structure +** +** This structure is used by the saHpiWatchdogTimerGet() and +** saHpiWatchdogTimerSet() functions. The use of the structure varies slightly +** by each function. +** +** For saHpiWatchdogTimerGet() : +** +** Log - indicates whether or not the Watchdog is configured to +** issue events. True=events will be generated. +** Running - indicates whether or not the Watchdog is currently +** running or stopped. True=Watchdog is running. +** TimerUse - indicates the current use of the timer; one of the +** enumerated preset uses which was included on the last +** saHpiWatchdogTimerSet() function call, or through some +** other implementation-dependent means to start the +** Watchdog timer. +** TimerAction - indicates what action will be taken when the Watchdog +** times out. +** PretimerInterrupt - indicates which action will be taken +** "PreTimeoutInterval" milliseconds prior to Watchdog +** timer expiration. +** PreTimeoutInterval - indicates how many milliseconds prior to timer time +** out the PretimerInterrupt action will be taken. If +** "PreTimeoutInterval" = 0, the PretimerInterrupt action +** will occur concurrently with "TimerAction." HPI +** implementations may not be able to support millisecond +** resolution, and because of this may have rounded the +** set value to whatever resolution could be supported. +** The HPI implementation will return this rounded value. +** TimerUseExpFlags - set of five bit flags which indicate that a Watchdog +** timer timeout has occurred while the corresponding +** TimerUse value was set. Once set, these flags stay +** set until specifically cleared with a +** saHpiWatchdogTimerSet() call, or by some other +** implementation-dependent means. +** InitialCount - The time, in milliseconds, before the timer will time +** out after the watchdog is started/restarted, or some +** other implementation-dependent strobe is +** sent to the Watchdog. HPI implementations may not be +** able to support millisecond resolution, and because +** of this may have rounded the set value to whatever +** resolution could be supported. The HPI implementation +** will return this rounded value. +** PresentCount - The remaining time in milliseconds before the timer +** will time out unless a saHpiWatchdogTimerReset() +** function call is made, or some other implementation- +** dependent strobe is sent to the Watchdog. +** HPI implementations may not be able to support +** millisecond resolution on watchdog timers, but will +** return the number of clock ticks remaining times the +** number of milliseconds between each tick. +** +** For saHpiWatchdogTimerSet(): +** +** Log - indicates whether or not the Watchdog should issue +** events. True=event will be generated. +** Running - indicates whether or not the Watchdog should be +** stopped before updating. +** True = Watchdog is not stopped. If it is +** already stopped, it will remain stopped, +** but if it is running, it will continue +** to run, with the countown timer reset +** to the new InitialCount. Note that +** there is a race condition possible +** with this setting, so it should be used +** with care. +** False = Watchdog is stopped. After +** saHpiWatchdogTimerSet() is called, a +** subsequent call to +** saHpiWatchdogTimerReset() is required +** to start the timer. +** TimerUse - indicates the current use of the timer. Will control +** which TimerUseExpFlag is set if the timer expires. +** TimerAction - indicates what action will be taken when the Watchdog +** times out. +** PretimerInterrupt - indicates which action will be taken +** "PreTimeoutInterval" milliseconds prior to Watchdog +** timer expiration. +** PreTimeoutInterval - indicates how many milliseconds prior to timer time +** out the PretimerInterrupt action will be taken. If +** "PreTimeoutInterval" = 0, the PretimerInterrupt action +** will occur concurrently with "TimerAction." HPI +** implementations may not be able to support millisecond +** resolution and may have a maximum value restriction. +** These restrictions should be documented by the +** provider of the HPI interface. +** TimerUseExpFlags - Set of five bit flags corresponding to the five +** TimerUse values. For each bit set, the corresponding +** Timer Use Expiration Flag will be CLEARED. Generally, +** a program should only clear the Timer Use Expiration +** Flag corresponding to its own TimerUse, so that other +** software, which may have used the timer for another +** purpose in the past can still read its TimerUseExpFlag +** to determine whether or not the timer expired during +** that use. +** InitialCount - The time, in milliseconds, before the timer will time +** out after a saHpiWatchdogTimerReset() function call is +** made, or some other implementation-dependent strobe is +** sent to the Watchdog. HPI implementations may not be +** able to support millisecond resolution and may have a +** maximum value restriction. These restrictions should +** be documented by the provider of the HPI interface. +** PresentCount - Not used on saHpiWatchdogTimerSet() function. Ignored. +** +*/ + +typedef struct { + SaHpiBoolT Log; + SaHpiBoolT Running; + SaHpiWatchdogTimerUseT TimerUse; + SaHpiWatchdogActionT TimerAction; + SaHpiWatchdogPretimerInterruptT PretimerInterrupt; + SaHpiUint32T PreTimeoutInterval; + SaHpiWatchdogExpFlagsT TimerUseExpFlags; + SaHpiUint32T InitialCount; + SaHpiUint32T PresentCount; +} SaHpiWatchdogT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Watchdog Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** When the "Watchdog" capability is set in a resource, a watchdog with an +** identifier of SAHPI_DEFAULT_WATCHDOG_NUM is required. All watchdogs must be +** represented in the RDR repository with an SaHpiWatchdogRecT, including the +** watchdog with an identifier of SAHPI_DEFAULT_WATCHDOG_NUM. +*/ +typedef struct { + SaHpiWatchdogNumT WatchdogNum; + SaHpiUint32T Oem; +} SaHpiWatchdogRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Hot Swap ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Hot Swap Indicator State */ +typedef enum { + SAHPI_HS_INDICATOR_OFF = 0, + SAHPI_HS_INDICATOR_ON +} SaHpiHsIndicatorStateT; + +/* Hot Swap Action */ +typedef enum { + SAHPI_HS_ACTION_INSERTION = 0, + SAHPI_HS_ACTION_EXTRACTION +} SaHpiHsActionT; + +/* Hot Swap State */ +typedef enum { + SAHPI_HS_STATE_INACTIVE = 0, + SAHPI_HS_STATE_INSERTION_PENDING, + SAHPI_HS_STATE_ACTIVE, + SAHPI_HS_STATE_EXTRACTION_PENDING, + SAHPI_HS_STATE_NOT_PRESENT +} SaHpiHsStateT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Events, Part 2 ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* Event Data Structures */ + +typedef enum { + SAHPI_CRITICAL = 0, + SAHPI_MAJOR, + SAHPI_MINOR, + SAHPI_INFORMATIONAL, + SAHPI_OK, + SAHPI_DEBUG = 0xF0, + SAHPI_ALL_SEVERITIES = 0xFF /* Only used with DAT and Annunciator */ + /* functions. This is not a valid */ + /* severity for events or alarms */ +} SaHpiSeverityT; + + +typedef enum { + SAHPI_RESE_RESOURCE_FAILURE, + SAHPI_RESE_RESOURCE_RESTORED, + SAHPI_RESE_RESOURCE_ADDED +} SaHpiResourceEventTypeT; + + +typedef struct { + SaHpiResourceEventTypeT ResourceEventType; +} SaHpiResourceEventT; + + +/* +** Domain events are used to announce the addition of domain references +** and the removal of domain references to the DRT. +*/ +typedef enum { + SAHPI_DOMAIN_REF_ADDED, + SAHPI_DOMAIN_REF_REMOVED +} SaHpiDomainEventTypeT; + +typedef struct { + SaHpiDomainEventTypeT Type; /* Type of domain event */ + SaHpiDomainIdT DomainId; /* Domain Id of domain added + to or removed from DRT. */ +} SaHpiDomainEventT; + + +/* +** Sensor Optional Data +** +** Sensor events may contain optional data items passed and stored with the +** event. If these optional data items are present, they will be included with +** the event data returned in response to a saHpiEventGet() or +** saHpiEventLogEntryGet() function call. Also, the optional data items may be +** included with the event data passed to the saHpiEventLogEntryAdd() function. +** +** Specific implementations of HPI may have restrictions on how much data may +** be passed to saHpiEventLogEntryAdd(). These restrictions should be documented +** by the provider of the HPI interface. +*/ +typedef SaHpiUint8T SaHpiSensorOptionalDataT; + +#define SAHPI_SOD_TRIGGER_READING (SaHpiSensorOptionalDataT)0x01 +#define SAHPI_SOD_TRIGGER_THRESHOLD (SaHpiSensorOptionalDataT)0x02 +#define SAHPI_SOD_OEM (SaHpiSensorOptionalDataT)0x04 +#define SAHPI_SOD_PREVIOUS_STATE (SaHpiSensorOptionalDataT)0x08 +#define SAHPI_SOD_CURRENT_STATE (SaHpiSensorOptionalDataT)0x10 +#define SAHPI_SOD_SENSOR_SPECIFIC (SaHpiSensorOptionalDataT)0x20 +typedef struct { + SaHpiSensorNumT SensorNum; + SaHpiSensorTypeT SensorType; + SaHpiEventCategoryT EventCategory; + SaHpiBoolT Assertion; /* True = Event State + asserted + False = deasserted */ + SaHpiEventStateT EventState; /* single state being asserted + or deasserted*/ + SaHpiSensorOptionalDataT OptionalDataPresent; + /* the following fields are only valid if the corresponding flag is set + in the OptionalDataPresent field */ + SaHpiSensorReadingT TriggerReading; /* Reading that triggered + the event */ + SaHpiSensorReadingT TriggerThreshold; /* Value of the threshold + that was crossed. Will not + be present if threshold is + not readable. */ + SaHpiEventStateT PreviousState; /* Previous set of asserted + event states. If multiple + event states change at once, + multiple events may be + generated for each changing + event state. This field + should indicate the status of + the sensor event states prior + to any of the simultaneous + changes. + + Thus, it will be the same in + each event generated due to + multiple simultaneous event + state changes. */ + + SaHpiEventStateT CurrentState; /* Current set of asserted + event states. */ + SaHpiUint32T Oem; + SaHpiUint32T SensorSpecific; +} SaHpiSensorEventT; + +typedef SaHpiUint8T SaHpiSensorEnableOptDataT; + +#define SAHPI_SEOD_CURRENT_STATE (SaHpiSensorEnableOptDataT)0x10 + +typedef struct { + SaHpiSensorNumT SensorNum; + SaHpiSensorTypeT SensorType; + SaHpiEventCategoryT EventCategory; + SaHpiBoolT SensorEnable; /* current sensor enable status */ + SaHpiBoolT SensorEventEnable; /* current evt enable status */ + SaHpiEventStateT AssertEventMask; /* current assert event mask */ + SaHpiEventStateT DeassertEventMask; /* current deassert evt mask */ + SaHpiSensorEnableOptDataT OptionalDataPresent; + /* the following fields are only valid if the corresponding flag is set + in the OptionalDataPresent field */ + SaHpiEventStateT CurrentState; /* Current set of asserted + Event states. */ +} SaHpiSensorEnableChangeEventT; + +typedef struct { + SaHpiHsStateT HotSwapState; + SaHpiHsStateT PreviousHotSwapState; +} SaHpiHotSwapEventT; + +typedef struct { + SaHpiWatchdogNumT WatchdogNum; + SaHpiWatchdogActionEventT WatchdogAction; + SaHpiWatchdogPretimerInterruptT WatchdogPreTimerAction; + SaHpiWatchdogTimerUseT WatchdogUse; +} SaHpiWatchdogEventT; + +/* +** The following type defines the types of events that can be reported +** by the HPI software implementation. +** +** Audit events report a discrepancy in the audit process. Audits are typically +** performed by HA software to detect problems. Audits may look for such things +** as corrupted data stores, inconsistent RPT information, or improperly managed +** queues. +** +** Startup events report a failure to start-up properly, or inconsistencies in +** persisted data. +*/ +typedef enum { + SAHPI_HPIE_AUDIT, + SAHPI_HPIE_STARTUP, + SAHPI_HPIE_OTHER +} SaHpiSwEventTypeT; + +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiSwEventTypeT Type; + SaHpiTextBufferT EventData; +} SaHpiHpiSwEventT; + +typedef struct { + SaHpiManufacturerIdT MId; + SaHpiTextBufferT OemEventData; +} SaHpiOemEventT; + +/* +** User events may be used for storing custom events created by an HPI User +** when injecting events into the Event Log using saHpiEventLogEntryAdd(). +*/ +typedef struct { + SaHpiTextBufferT UserEventData; +} SaHpiUserEventT; + +typedef enum { + SAHPI_ET_RESOURCE, + SAHPI_ET_DOMAIN, + SAHPI_ET_SENSOR, + SAHPI_ET_SENSOR_ENABLE_CHANGE, + SAHPI_ET_HOTSWAP, + SAHPI_ET_WATCHDOG, + SAHPI_ET_HPI_SW, + SAHPI_ET_OEM, + SAHPI_ET_USER +} SaHpiEventTypeT; + +typedef union { + SaHpiResourceEventT ResourceEvent; + SaHpiDomainEventT DomainEvent; + SaHpiSensorEventT SensorEvent; + SaHpiSensorEnableChangeEventT SensorEnableChangeEvent; + SaHpiHotSwapEventT HotSwapEvent; + SaHpiWatchdogEventT WatchdogEvent; + SaHpiHpiSwEventT HpiSwEvent; + SaHpiOemEventT OemEvent; + SaHpiUserEventT UserEvent; +} SaHpiEventUnionT; + +typedef struct { + SaHpiResourceIdT Source; + SaHpiEventTypeT EventType; + SaHpiTimeT Timestamp; /*Equal to SAHPI_TIME_UNSPECIFED if time is + not available; Absolute time if greater + than SAHPI_TIME_MAX_RELATIVE, Relative + time if less than or equal to + SAHPI_TIME_MAX_RELATIVE */ + SaHpiSeverityT Severity; + SaHpiEventUnionT EventDataUnion; +} SaHpiEventT; + +/* +** Event Queue Status +** +** This status word is returned to HPI Users that request it +** when saHpiEventGet() is called. +** +*/ + +typedef SaHpiUint32T SaHpiEvtQueueStatusT; + +#define SAHPI_EVT_QUEUE_OVERFLOW (SaHpiEvtQueueStatusT)0x0001 + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Annunciators ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** Annunciator Number +** Identifier for an Annunciator management instrument. +*/ +typedef SaHpiInstrumentIdT SaHpiAnnunciatorNumT; + +/* +** The following data type is equivalent to the AIS data type SaNameT. +** it is defined in this header file, so that inclusion of the AIS +** header file is not required. This data type is based on version 1.0 +** of the AIS specification +*/ +#define SA_HPI_MAX_NAME_LENGTH 256 + +typedef struct { + SaHpiUint16T Length; + unsigned char Value[SA_HPI_MAX_NAME_LENGTH]; +} SaHpiNameT; + +/* +** Enumeration of Announcement Types +*/ +typedef enum { + SAHPI_STATUS_COND_TYPE_SENSOR, + SAHPI_STATUS_COND_TYPE_RESOURCE, + SAHPI_STATUS_COND_TYPE_OEM, + SAHPI_STATUS_COND_TYPE_USER +} SaHpiStatusCondTypeT; + + +/* Condition structure definition */ +typedef struct { + + SaHpiStatusCondTypeT Type; /* Status Condition Type */ + SaHpiEntityPathT Entity; /* Entity assoc. with status condition */ + SaHpiDomainIdT DomainId; /* Domain associated with status. + May be SAHPI_UNSPECIFIED_DOMAIND_ID + meaning current domain, or domain + not meaningful for status condition*/ + SaHpiResourceIdT ResourceId; /* Resource associated with status. + May be SAHPI_UNSPECIFIED_RESOURCE_ID + if Type is SAHPI_STATUS_COND_USER. + Must be set to valid ResourceId in + domain specified by DomainId, + or in current domain, if DomainId + is SAHPI_UNSPECIFIED_DOMAIN_ID */ + SaHpiSensorNumT SensorNum; /* Sensor associated with status + Only valid if Type is + SAHPI_STATUS_COND_TYPE_SENSOR */ + SaHpiEventStateT EventState; /* Sensor event state. + Only valid if Type is + SAHPI_STATUS_COND_TYPE_SENSOR. */ + SaHpiNameT Name; /* AIS compatible identifier associated + with Status condition */ + SaHpiManufacturerIdT Mid; /* Manufacturer Id associated with + status condition, required when type + is SAHPI_STATUS_COND_TYPE_OEM. */ + SaHpiTextBufferT Data; /* Optional Data associated with + Status condition */ +} SaHpiConditionT; + + +/* Announcement structure definition */ +typedef struct { + SaHpiEntryIdT EntryId; /* Announcment Entry Id */ + SaHpiTimeT Timestamp; /* Time when announcement added to set */ + SaHpiBoolT AddedByUser; /* True if added to set by HPI User, + False if added automatically by + HPI implementation */ + SaHpiSeverityT Severity; /* Severity of announcement */ + SaHpiBoolT Acknowledged; /* Acknowledged flag */ + SaHpiConditionT StatusCond; /* Detailed status condition */ +} SaHpiAnnouncementT; + + +/* Annunciator Mode - defines who may add or delete entries in set. */ + +typedef enum { + SAHPI_ANNUNCIATOR_MODE_AUTO, + SAHPI_ANNUNCIATOR_MODE_USER, + SAHPI_ANNUNCIATOR_MODE_SHARED +} SaHpiAnnunciatorModeT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Annunciator Resource Data Records ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** The following enumerated type defines the possible output types +** which can be associated with an Annunciator Management Instrument +*/ +typedef enum { + SAHPI_ANNUNCIATOR_TYPE_LED = 0, + SAHPI_ANNUNCIATOR_TYPE_DRY_CONTACT_CLOSURE, + SAHPI_ANNUNCIATOR_TYPE_AUDIBLE, + SAHPI_ANNUNCIATOR_TYPE_LCD_DISPLAY, + SAHPI_ANNUNCIATOR_TYPE_MESSAGE, + SAHPI_ANNUNCIATOR_TYPE_COMPOSITE, + SAHPI_ANNUNCIATOR_TYPE_OEM +} SaHpiAnnunciatorTypeT; + + +/* +** All annunciator management instruments +** must be represented in the RDR repository +** with an SaHpiAnnunciatorRecT. +*/ +typedef struct { + SaHpiAnnunciatorNumT AnnunciatorNum; + SaHpiAnnunciatorTypeT AnnunciatorType; /* Annunciator Output Type */ + SaHpiBoolT ModeReadOnly; /* if True, Mode may + not be changed by HPI User */ + SaHpiUint32T MaxConditions; /* maximum number of conditions + that can be held in current + set. 0 means no fixed + limit. */ + SaHpiUint32T Oem; +} SaHpiAnnunciatorRecT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Resource Data Record ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* +** The following describes the different types of records that exist within a +** RDR repository and the RDR super-structure to all of the specific RDR types +** (sensor, inventory data, watchdog, etc.). +*/ +typedef enum { + SAHPI_NO_RECORD, + SAHPI_CTRL_RDR, + SAHPI_SENSOR_RDR, + SAHPI_INVENTORY_RDR, + SAHPI_WATCHDOG_RDR, + SAHPI_ANNUNCIATOR_RDR +} SaHpiRdrTypeT; + +typedef union { + SaHpiCtrlRecT CtrlRec; + SaHpiSensorRecT SensorRec; + SaHpiInventoryRecT InventoryRec; + SaHpiWatchdogRecT WatchdogRec; + SaHpiAnnunciatorRecT AnnunciatorRec; +} SaHpiRdrTypeUnionT; + +typedef struct { + SaHpiEntryIdT RecordId; + SaHpiRdrTypeT RdrType; + SaHpiEntityPathT Entity; /* Entity to which this RDR relates. */ + SaHpiBoolT IsFru; /* Entity is a FRU. This field is + Only valid if the Entity path given + in the "Entity" field is different + from the Entity path in the RPT + entry for the resource. */ + SaHpiRdrTypeUnionT RdrTypeUnion; + SaHpiTextBufferT IdString; +} SaHpiRdrT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Parameter Control ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +typedef enum { + SAHPI_DEFAULT_PARM = 0, + SAHPI_SAVE_PARM, + SAHPI_RESTORE_PARM +} SaHpiParmActionT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Reset ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +typedef enum { + SAHPI_COLD_RESET = 0, + SAHPI_WARM_RESET, + SAHPI_RESET_ASSERT, + SAHPI_RESET_DEASSERT +} SaHpiResetActionT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Power ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +typedef enum { + SAHPI_POWER_OFF = 0, + SAHPI_POWER_ON, + SAHPI_POWER_CYCLE +} SaHpiPowerStateT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Resource Presence Table ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* This section defines the types associated with the RPT. */ + +/* +** GUID - Globally Unique Identifier +** +** The format if the ID follows that specified by the Wired for Management +** Baseline, Version 2.0 specification. HPI uses version 1 of the GUID +** format, with a 3-bit variant field of 10x (where x indicates 'don't care') +*/ +typedef SaHpiUint8T SaHpiGuidT[16]; + +/* +** Resource Info Type Definitions +** +** +** SaHpiResourceInfoT contains static configuration data concerning the +** management controller associated with the resource, or the resource itself. +** Note this information is used to describe the resource; that is, the piece of +** infrastructure which manages an entity (or multiple entities) - NOT the +** entities for which the resource provides management. The purpose of the +** SaHpiResourceInfoT structure is to provide information that an HPI User may +** need in order to interact correctly with the resource (e.g., recognize a +** specific management controller which may have defined OEM fields in sensors, +** OEM controls, etc.). +** +** The GUID is used to uniquely identify a Resource. A GUID value of zero is not +** valid and indicates that the Resource does not have an associated GUID. +** +** All of the fields in the following structure may or may not be used by a +** given resource. +*/ +typedef struct { + SaHpiUint8T ResourceRev; + SaHpiUint8T SpecificVer; + SaHpiUint8T DeviceSupport; + SaHpiManufacturerIdT ManufacturerId; + SaHpiUint16T ProductId; + SaHpiUint8T FirmwareMajorRev; + SaHpiUint8T FirmwareMinorRev; + SaHpiUint8T AuxFirmwareRev; + SaHpiGuidT Guid; +} SaHpiResourceInfoT; + +/* +** Resource Capabilities +** +** This definition defines the capabilities of a given resource. One resource +** may support any number of capabilities using the bit mask. Because each entry +** in an RPT will have the SAHPI_CAPABILITY_RESOURCE bit set, zero is not a +** valid value for the capability flag, and is thus used to indicate "no RPT +** entry present" in some function calls. +** +** SAHPI_CAPABILITY_RESOURCE +** SAHPI_CAPABILITY_EVT_DEASSERTS +** Indicates that all sensors on the resource have the property that their +** Assertion and Deassertion event enable flags are the same. That is, +** for all event states whose assertion triggers an event, it is +** guaranteed that the deassertion of that event will also +** trigger an event. Thus, an HPI User may track the state of sensors on the +** resource by monitoring events rather than polling for state changes. +** SAHPI_CAPABILITY_AGGREGATE_STATUS +** SAHPI_CAPABILITY_CONFIGURATION +** SAHPI_CAPABILITY_MANAGED_HOTSWAP +** Indicates that the resource supports the full managed hot swap model. +** Since hot swap only makes sense for field-replaceable units, the +** SAHPI_CAPABILITY_FRU capability bit must also be set for this resource. +** SAHPI_CAPABILITY_WATCHDOG +** SAHPI_CAPABILITY_CONTROL +** SAHPI_CAPABILITY_FRU +** Indicates that the resource is a field-replaceable unit; i.e., it is +** capable of being removed and replaced in a live system. If +** SAHPI_CAPABILITY_MANAGED_HOTSWAP is also set, the resource supports +** the full hot swap model. If SAHPI_CAPABILITY_MANAGED_HOTSWAP is not +** set, the resource supports the simplified hot swap model. +** SAHPI_CAPABILITY_ANNUNCIATOR +** SAHPI_CAPABILITY_POWER +** SAHPI_CAPABILITY_RESET +** SAHPI_CAPABILITY_INVENTORY_DATA +** SAHPI_CAPABILITY_EVENT_LOG +** SAHPI_CAPABILITY_RDR +** Indicates that a resource data record (RDR) repository is supplied +** by the resource. Since the existence of an RDR is mandatory for all +** management instruments, this +** capability must be asserted if the resource +** contains any sensors, controls, watchdog timers, or inventory +** data repositories. +** SAHPI_CAPABILITY_SENSOR +*/ + +typedef SaHpiUint32T SaHpiCapabilitiesT; +#define SAHPI_CAPABILITY_RESOURCE (SaHpiCapabilitiesT)0X40000000 +#define SAHPI_CAPABILITY_EVT_DEASSERTS (SaHpiCapabilitiesT)0x00008000 +#define SAHPI_CAPABILITY_AGGREGATE_STATUS (SaHpiCapabilitiesT)0x00002000 +#define SAHPI_CAPABILITY_CONFIGURATION (SaHpiCapabilitiesT)0x00001000 +#define SAHPI_CAPABILITY_MANAGED_HOTSWAP (SaHpiCapabilitiesT)0x00000800 +#define SAHPI_CAPABILITY_WATCHDOG (SaHpiCapabilitiesT)0x00000400 +#define SAHPI_CAPABILITY_CONTROL (SaHpiCapabilitiesT)0x00000200 +#define SAHPI_CAPABILITY_FRU (SaHpiCapabilitiesT)0x00000100 +#define SAHPI_CAPABILITY_ANNUNCIATOR (SaHpiCapabilitiesT)0x00000040 +#define SAHPI_CAPABILITY_POWER (SaHpiCapabilitiesT)0x00000020 +#define SAHPI_CAPABILITY_RESET (SaHpiCapabilitiesT)0x00000010 +#define SAHPI_CAPABILITY_INVENTORY_DATA (SaHpiCapabilitiesT)0x00000008 +#define SAHPI_CAPABILITY_EVENT_LOG (SaHpiCapabilitiesT)0x00000004 +#define SAHPI_CAPABILITY_RDR (SaHpiCapabilitiesT)0x00000002 +#define SAHPI_CAPABILITY_SENSOR (SaHpiCapabilitiesT)0x00000001 + +/* +** Resource Managed Hot Swap Capabilities +** +** This definition defines the managed hot swap capabilities of a given +** resource. +** +** SAHPI_HS_CAPABILITY_AUTOEXTRACT_READ_ONLY +** This capability indicates if the hot swap autoextract timer is read-only. +** SAHPI_HS_CAPABILITY_INDICATOR_SUPPORTED +** Indicates whether or not the resource has a hot swap indicator. +*/ + +typedef SaHpiUint32T SaHpiHsCapabilitiesT; +#define SAHPI_HS_CAPABILITY_AUTOEXTRACT_READ_ONLY \ + (SaHpiHsCapabilitiesT)0x80000000 +#define SAHPI_HS_CAPABILITY_INDICATOR_SUPPORTED \ + (SaHpiHsCapabilitiesT)0X40000000 +/* +** RPT Entry +** +** This structure is used to store the RPT entry information. +** +** The ResourceCapabilities field definies the capabilities of the resource. +** This field must be non-zero for all valid resources. +** +** The HotSwapCapabilities field denotes the capabilities of the resource, +** specifically related to hot swap. This field is only valid if the +** resource supports managed hot swap, as indicated by the +** SAHPI_CAPABILITY_MANAGED_HOT_SWAP resource capability. +** +** The ResourceTag is a data field within an RPT entry available to the HPI +** User for associating application specific data with a resource. The HPI +** User supplied data is purely informational and is not used by the HPI +** implementation, domain, or associated resource. For example, an HPI User +** can set the resource tag to a "descriptive" value, which can be used to +** identify the resource in messages to a human operator. +*/ +typedef struct { + SaHpiEntryIdT EntryId; + SaHpiResourceIdT ResourceId; + SaHpiResourceInfoT ResourceInfo; + SaHpiEntityPathT ResourceEntity; /* If resource manages a FRU, entity + path of the FRU */ + /* If resource manages a single + entity, entity path of that + entity. */ + /* If resource manages multiple + entities, the entity path of the + "primary" entity managed by the + resource */ + /* Must be set to the same value in + every domain which contains this + resource */ + SaHpiCapabilitiesT ResourceCapabilities; /* Must be non-0. */ + SaHpiHsCapabilitiesT HotSwapCapabilities; /* Indicates the hot swap + capabilities of the resource */ + SaHpiSeverityT ResourceSeverity; /* Indicates the criticality that + should be raised when the resource + is not responding */ + SaHpiBoolT ResourceFailed; /* Indicates that the resource is not + currently functional */ + SaHpiTextBufferT ResourceTag; +} SaHpiRptEntryT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Domain Information ********** +********** ********** +******************************************************************************** +*******************************************************************************/ + +/* This section defines the types associated with the domain controller. */ + +/* +** Domain Capabilities +** +** This definition defines the capabilities of a given domain. A domain +** may support any number of capabilities using the bit mask. +** +** SAHPI_DOMAIN_CAP_AUTOINSERT_READ_ONLY +** Indicates that the domain auto insert timeout value is read-only +** and may not be modified using the saHpiHotSwapAutoInsertTimeoutSet() +** function. +*/ + +typedef SaHpiUint32T SaHpiDomainCapabilitiesT; +#define SAHPI_DOMAIN_CAP_AUTOINSERT_READ_ONLY \ + (SaHpiDomainCapabilitiesT)0X00000001 + +/* +** Domain Info +** +** This structure is used to store the information regarding the domain +** including information regarding the domain reference table (DRT) and +** the resource presence table (RPT). +** +** The DomainTag field is an informational value that supplies an HPI User +** with naming information for the domain. +** +** NOTE: Regarding timestamps - If the implementation cannot supply an absolute +** timestamp, then it may supply a timestamp relative to some system-defined +** epoch, such as system boot. The value SAHPI_TIME_UNSPECIFIED indicates that +** the time of the update cannot be determined. Otherwise, If the value is less +** than or equal to SAHPI_TIME_MAX_RELATIVE, then it is relative; if it is +** greater than SAHPI_TIME_MAX_RELATIVE, then it is absolute. +** +** The GUID is used to uniquely identify a domain. A GUID value of zero is not +** valid and indicates that the domain does not have an associated GUID. +*/ + +typedef struct { + SaHpiDomainIdT DomainId; /* Unique Domain Id associated with + domain */ + SaHpiDomainCapabilitiesT DomainCapabilities; /* Domain Capabilities */ + SaHpiBoolT IsPeer; /* Indicates that this domain + participates in a peer + relationship. */ + SaHpiTextBufferT DomainTag; /* Information tag associated with + domain */ + SaHpiUint32T DrtUpdateCount; /* This count is incremented any time the + table is changed. It rolls over to + zero when the maximum value is + reached */ + SaHpiTimeT DrtUpdateTimestamp; /* This timestamp is set any time the + DRT table is changed. */ + SaHpiUint32T RptUpdateCount; /* This count is incremented any time + the RPT is changed. It rolls over + to zero when the maximum value is + reached */ + SaHpiTimeT RptUpdateTimestamp; /* This timestamp is set any time the + RPT table is changed. */ + SaHpiUint32T DatUpdateCount; /* This count is incremented any time + the DAT is changed. It rolls over to + zero when the maximum value is + reached */ + SaHpiTimeT DatUpdateTimestamp; /* This timestamp is set any time the + DAT is changed. */ + SaHpiUint32T ActiveAlarms; /* Count of active alarms in the DAT */ + SaHpiUint32T CriticalAlarms; /* Count of active critical alarms in + the DAT */ + SaHpiUint32T MajorAlarms; /* Count of active major alarms in the + DAT */ + SaHpiUint32T MinorAlarms; /* Count of active minor alarms in the + DAT */ + SaHpiUint32T DatUserAlarmLimit; /* Maximum User Alarms that can be + added to DAT. 0=no fixed limit */ + SaHpiBoolT DatOverflow; /* Set to True if there are one + or more non-User Alarms that + are missing from the DAT because + of space limitations */ + SaHpiGuidT Guid; /* GUID associated with domain.*/ +} SaHpiDomainInfoT; + +/* +** DRT Entry +** +** This structure is used to store the DRT entry information. +** +*/ +typedef struct { + SaHpiEntryIdT EntryId; + SaHpiDomainIdT DomainId; /* The Domain ID referenced by this entry */ + SaHpiBoolT IsPeer; /* Indicates if this domain reference + is a peer. If not, the domain reference + is a tier. */ +} SaHpiDrtEntryT; + + +/* +** DAT Entry +** +** This structure is used to store alarm informatin in the DAT +** +*/ + + +typedef SaHpiEntryIdT SaHpiAlarmIdT; + +typedef struct { + SaHpiAlarmIdT AlarmId; /* Alarm Id */ + SaHpiTimeT Timestamp; /* Time when alarm added to DAT */ + SaHpiSeverityT Severity; /* Severity of alarm */ + SaHpiBoolT Acknowledged; /* Acknowledged flag */ + SaHpiConditionT AlarmCond; /* Detailed alarm condition */ +} SaHpiAlarmT; + +/******************************************************************************* +******************************************************************************** +********** ********** +********** Event Log ********** +********** ********** +******************************************************************************** +*******************************************************************************/ +/* This section defines the types associated with the Event Log. */ +/* +** Event Log Information +** +** The Entries entry denotes the number of active entries contained in the Event +** Log. +** The Size entry denotes the total number of entries the Event Log is able to +** hold. +** The UserEventMaxSize entry indicates the maximum size of the text buffer +** data field in an HPI User event that is supported by the Event Log +** implementation. If the implementation does not enforce a more restrictive +** data length, it should be set to SAHPI_MAX_TEXT_BUFFER_LENGTH. +** The UpdateTimestamp entry denotes the time of the last update to the Event +** Log. +** The CurrentTime entry denotes the Event Log's idea of the current time; i.e +** the timestamp that would be placed on an entry if it was added now. +** The Enabled entry indicates whether the Event Log is enabled. If the Event +** Log is "disabled" no events generated within the HPI implementation will be +** added to the Event Log. Events may still be added to the Event Log with +** the saHpiEventLogEntryAdd() function. When the Event Log is "enabled" +** events may be automatically added to the Event Log as they are generated +** in a resource or a domain, however, it is implementation-specific which +** events are automatically added to any Event Log. +** The OverflowFlag entry indicates the Event Log has overflowed. Events have +** been dropped or overwritten due to a table overflow. +** The OverflowAction entry indicates the behavior of the Event Log when an +** overflow occurs. +** The OverflowResetable entry indicates if the overflow flag can be +** cleared by an HPI User with the saHpiEventLogOverflowReset() function. +*/ +typedef enum { + SAHPI_EL_OVERFLOW_DROP, /* New entries are dropped when Event Log is + full*/ + SAHPI_EL_OVERFLOW_OVERWRITE /* Event Log overwrites existing entries + when Event Log is full */ +} SaHpiEventLogOverflowActionT; + +typedef struct { + SaHpiUint32T Entries; + SaHpiUint32T Size; + SaHpiUint32T UserEventMaxSize; + SaHpiTimeT UpdateTimestamp; + SaHpiTimeT CurrentTime; + SaHpiBoolT Enabled; + SaHpiBoolT OverflowFlag; + SaHpiBoolT OverflowResetable; + SaHpiEventLogOverflowActionT OverflowAction; +} SaHpiEventLogInfoT; +/* +** Event Log Entry +** These types define the Event Log entry. +*/ +typedef SaHpiUint32T SaHpiEventLogEntryIdT; +/* Reserved values for Event Log entry IDs */ +#define SAHPI_OLDEST_ENTRY (SaHpiEventLogEntryIdT)0x00000000 +#define SAHPI_NEWEST_ENTRY (SaHpiEventLogEntryIdT)0xFFFFFFFF +#define SAHPI_NO_MORE_ENTRIES (SaHpiEventLogEntryIdT)0xFFFFFFFE + +typedef struct { + SaHpiEventLogEntryIdT EntryId; /* Entry ID for record */ + SaHpiTimeT Timestamp; /* Time at which the event was placed + in the Event Log. If less than or equal to + SAHPI_TIME_MAX_RELATIVE, then it is + relative; if it is greater than SAHPI_TIME_ + MAX_RELATIVE, then it is absolute. */ + SaHpiEventT Event; /* Logged Event */ +} SaHpiEventLogEntryT; + + +/******************************************************************************* +** +** Name: saHpiVersionGet() +** +** Description: +** This function returns the version identifier of the SaHpi specification +** version supported by the HPI implementation. +** +** Parameters: +** None. +** +** Return Value: +** The interface version identifier, of type SaHpiVersionT is returned. +** +** Remarks: +** This function differs from all other interface functions in that it +** returns the version identifier rather than a standard return code. This is +** because the version itself is necessary in order for an HPI User to +** properly interpret subsequent API return codes. Thus, the +** saHpiVersionGet() function returns the interface version identifier +** unconditionally. +** +** This function returns the value of the header file symbol +** SAHPI_INTERFACE_VERSION in the SaHpi.h header file used when the library +** was compiled. An HPI User may compare the returned value to the +** SAHPI_INTERFACE_VERSION symbol in the SaHpi.h header file used by the +** calling program to determine if the accessed library is compatible with the +** calling program. +** +*******************************************************************************/ +SaHpiVersionT SAHPI_API saHpiVersionGet ( void ); + +/******************************************************************************* +** +** Name: saHpiSessionOpen() +** +** Description: +** This function opens an HPI session for a given domain and set of security +** characteristics (future). +** +** Parameters: +** DomainId - [in] Domain identifier of the domain to be accessed by the HPI +** User. A domain identifier of SAHPI_UNSPECIFIED_DOMAIN_ID requests that +** a session be opened to a default domain. +** SessionId - [out] Pointer to a location to store an identifier for the +** newly opened session. This identifier is used for subsequent access to +** domain resources and events. +** SecurityParams - [in] Pointer to security and permissions data structure. +** This parameter is reserved for future use, and must be set to NULL. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_DOMAIN is returned if no domain matching the specified +** domain identifier exists. +** SA_ERR_HPI_INVALID_PARAMS is returned if: +** * A non-null SecurityParams pointer is passed. +** * The SessionId pointer is passed in as NULL. +** SA_ERR_HPI_OUT_OF_SPACE is returned if no more sessions can be opened. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSessionOpen ( + SAHPI_IN SaHpiDomainIdT DomainId, + SAHPI_OUT SaHpiSessionIdT *SessionId, + SAHPI_IN void *SecurityParams +); + +/******************************************************************************* +** +** Name: saHpiSessionClose() +** +** Description: +** This function closes an HPI session. After closing a session, the SessionId +** will no longer be valid. +** +** Parameters: +** SessionId - [in] Session identifier previously obtained using +** saHpiSessionOpen(). +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSessionClose ( + SAHPI_IN SaHpiSessionIdT SessionId +); + +/******************************************************************************* +** +** Name: saHpiDiscover() +** +** Description: +** This function requests the underlying management service to discover +** information about resources and associated domains. +** +** This function may be called during operation to update the DRT table and +** the RPT table. An HPI implementation may exhibit latency between when +** hardware changes occur and when the domain DRT and RPT are updated. To +** overcome this latency, the saHpiDiscover() function may be called. When +** this function returns, the DRT and RPT should be updated to reflect the +** current system configuration and status. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained +** using saHpiSessionOpen(). +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiDiscover ( + SAHPI_IN SaHpiSessionIdT SessionId +); + +/******************************************************************************* +** +** Name: saHpiDomainInfoGet() +** +** Description: +** This function is used for requesting information about the domain, the +** Domain Reference Table (DRT), the Resource Presence Table (RPT), and the +** Domain Alarm Table (DAT), such as table update counters and timestamps, and +** the unique domain identifier associated with the domain. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained +** using saHpiSessionOpen(). +** DomainInfo - [out] Pointer to the information describing the domain and +** DRT. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned if the DomainInfo pointer is passed +** in as NULL. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiDomainInfoGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiDomainInfoT *DomainInfo +); + +/******************************************************************************* +** +** Name: saHpiDrtEntryGet() +** +** Description: +** This function retrieves domain information for the specified entry of the +** DRT. This function allows an HPI User to read the DRT entry-by-entry. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** EntryId - [in] Identifier of the DRT entry to retrieve. Reserved EntryId +** values: +** * SAHPI_FIRST_ENTRY Get first entry +** * SAHPI_LAST_ENTRY Reserved as delimiter for end of list. Not a +** valid entry identifier. +** NextEntryId - [out] Pointer to location to store the EntryId of next entry +** in DRT. +** DrtEntry - [out] Pointer to the structure to hold the returned DRT entry. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_NOT_PRESENT is returned if the: +** * Entry identified by EntryId is not present. +** * EntryId is SAHPI_FIRST_ENTRY and the DRT is empty. +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * DrtEntry pointer is passed in as NULL. +** * NextEntryId pointer is passed in as NULL. +** * EntryId is an invalid reserved value such as SAHPI_LAST_ENTRY. +** +** Remarks: +** If the EntryId parameter is set to SAHPI_FIRST_ENTRY, the first entry in +** the DRT will be returned. When an entry is successfully retrieved, +** NextEntryId will be set to the identifier of the next valid entry; however, +** when the last entry has been retrieved, NextEntryId will be set to +** SAHPI_LAST_ENTRY. To retrieve an entire list of entries, call this function +** first with an EntryId of SAHPI_FIRST_ENTRY and then use the returned +** NextEntryId in the next call. Proceed until the NextEntryId returned is +** SAHPI_LAST_ENTRY. +** +** If an HPI User has not subscribed to receive events and a DRT entry is +** added while the DRT is being read, that new entry may be missed. The +** update counter provides a means for insuring that no domains are missed +** when stepping through the DRT. In order to use this feature, an HPI User +** should call saHpiDomainInfoGet() to get the update counter value before +** retrieving the first DRT entry. After reading the last entry, the HPI User +** should again call saHpiDomainInfoGet() to get the update counter value. If +** the update counter has not been incremented, no new entries have been +** added. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiDrtEntryGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEntryIdT *NextEntryId, + SAHPI_OUT SaHpiDrtEntryT *DrtEntry +); + +/******************************************************************************* +** +** Name: saHpiDomainTagSet() +** +** Description: +** This function allows an HPI User to set a descriptive tag for a particular +** domain. The domain tag is an informational value that supplies an HPI User +** with naming information for the domain. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** DomainTag - [in] Pointer to SaHpiTextBufferT containing the domain tag. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned if the SaHpiTextBufferT structure +** passed as DomainTag is not valid. This would occur when: +** * The DataType is not one of the enumerated values for that type, or +** * The data field contains characters that are not legal according to +** the value of DataType, or +** * The Language is not one of the enumerated values for that type when +** the DataType is SAHPI_TL_TYPE_UNICODE or SAHPI_TL_TYPE_TEXT. +** SA_ERR_HPI_INVALID_PARAMS is returned if the DomainTag pointer is passed in +** as NULL. +** +** Remarks: +** Typically, the HPI implementation will provide an appropriate default value +** for the domain tag; this function is provided so that an HPI User can +** override the default, if desired. The value of the domain tag may be +** retrieved from the domain's information structure. +** +** The domain tag is not necessarily persistent, and may return to its default +** value if the domain controller function for the domain restarts. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiDomainTagSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiTextBufferT *DomainTag +); + +/******************************************************************************* +** +** Name: saHpiRptEntryGet() +** +** Description: +** This function retrieves resource information for the specified entry of the +** resource presence table. This function allows an HPI User to read the RPT +** entry-by-entry. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** EntryId - [in] Identifier of the RPT entry to retrieve. Reserved EntryId +** values: +** * SAHPI_FIRST_ENTRY Get first entry. +** * SAHPI_LAST_ENTRY Reserved as delimiter for end of list. Not a +** valid entry identifier. +** NextEntryId - [out] Pointer to location to store the EntryId of next entry +** in RPT. +** RptEntry - [out] Pointer to the structure to hold the returned RPT entry. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_NOT_PRESENT is returned when the: +** * Entry identified by EntryId is not present. +** * EntryId is SAHPI_FIRST_ENTRY and the RPT is empty. +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * RptEntry pointer is passed in as NULL. +** * NextEntryId pointer is passed in as NULL. +** * EntryId is an invalid reserved value such as SAHPI_LAST_ENTRY. +** +** Remarks: +** If the EntryId parameter is set to SAHPI_FIRST_ENTRY, the first entry in +** the RPT will be returned. When an entry is successfully retrieved, +** NextEntryId will be set to the identifier of the next valid entry; however, +** when the last entry has been retrieved, NextEntryId will be set to +** SAHPI_LAST_ENTRY. To retrieve an entire list of entries, call this function +** first with an EntryId of SAHPI_FIRST_ENTRY and then use the returned +** NextEntryId in the next call. Proceed until the NextEntryId returned is +** SAHPI_LAST_ENTRY. +** +** At initialization, an HPI User may not wish to turn on eventing, since the +** context of the events, as provided by the RPT, is not known. In this +** instance, if a FRU is inserted into the system while the RPT is being read +** entry by entry, the resource associated with that FRU may be missed. (Keep +** in mind that there is no specified ordering for the RPT entries.) The +** update counter provides a means for insuring that no resources are missed +** when stepping through the RPT. In order to use this feature, an HPI User +** should invoke saHpiDomainInfoGet(), and get the update counter value before +** retrieving the first RPT entry. After reading the last entry, an HPI User +** should again invoke the saHpiDomainInfoGet() to get the RPT update counter +** value. If the update counter has not been incremented, no new records have +** been added. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRptEntryGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEntryIdT *NextEntryId, + SAHPI_OUT SaHpiRptEntryT *RptEntry +); + +/******************************************************************************* +** +** Name: saHpiRptEntryGetByResourceId() +** +** Description: +** This function retrieves resource information from the resource presence +** table for the specified resource using its ResourceId. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained +** using saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** RptEntry - [out] Pointer to structure to hold the returned RPT entry. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned if the RptEntry pointer is passed +** in as NULL. +** +** Remarks: +** Typically at start-up, the RPT is read entry-by-entry, using +** saHpiRptEntryGet(). From this, an HPI User can establish the set of +** ResourceIds to use for future calls to the HPI functions. +** +** However, there may be other ways of learning ResourceIds without first +** reading the RPT. For example, resources may be added to the domain while +** the system is running in response to a hot swap action. When a resource is +** added, the application will receive a hot swap event containing the +** ResourceId of the new resource. The application may then want to search the +** RPT for more detailed information on the newly added resource. In this +** case, the ResourceId can be used to locate the applicable RPT entry +** information. +** +** Note that saHpiRptEntryGetByResourceId() is valid in any hot swap state, +** except for SAHPI_HS_STATE_NOT_PRESENT. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRptEntryGetByResourceId ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiRptEntryT *RptEntry +); + +/******************************************************************************* +** +** Name: saHpiResourceSeveritySet() +** +** Description: +** This function allows an HPI User to set the severity level applied to an +** event issued if a resource unexpectedly becomes unavailable to the HPI. A +** resource may become unavailable for several reasons including: +** * The FRU associated with the resource is no longer present in the +** system (a surprise extraction has occurred.) +** * A catastrophic failure has occurred. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** Severity - [in] Severity level of event issued when the resource +** unexpectedly becomes unavailable to the HPI. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned when the value for Severity is not +** one of the valid enumerated values for this type. +** +** Remarks: +** Typically, the HPI implementation will provide an appropriate default value +** for the resource severity, which may vary by resource; an HPI User can +** override this default value by use of this function. +** +** If a resource is removed from, then re-added to the RPT (e.g., because of a +** hot swap action), the HPI implementation may reset the value of the +** resource severity. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceSeveritySet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSeverityT Severity +); + +/******************************************************************************* +** +** Name: saHpiResourceTagSet() +** +** Description: +** This function allows an HPI User to set the resource tag of an RPT entry +** for a particular resource. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** ResourceTag - [in] Pointer to SaHpiTextBufferT containing the resource tag. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned if the SaHpiTextBufferT structure +** passed as ResourceTag is not valid. This would occur when: +** * The DataType is not one of the enumerated values for that type, or +** * The data field contains characters that are not legal according to the +** value of DataType, or +** * The Language is not one of the enumerated values for that type when +** the DataType is SAHPI_TL_TYPE_UNICODE or SAHPI_TL_TYPE_TEXT. +** SA_ERR_HPI_INVALID_PARAMS is returned if the ResourceTag pointer is passed +** in as NULL. +** +** Remarks: +** The resource tag is a data field within an RPT entry available to an HPI +** User for associating application specific data with a resource. HPI User +** supplied data is purely informational and is not used by the HPI +** implementation, domain, or associated resource. For example, an HPI User +** can set the resource tag to a "descriptive" value, which can be used to +** identify the resource in messages to a human operator. +** +** Since the resource tag is contained within an RPT entry, its scope is +** limited to a single domain. A resource that exists in more than one domain +** will have independent resource tags within each domain. +** +** Typically, the HPI implementation will provide an appropriate default value +** for the resource tag; this function is provided so that an HPI User can +** override the default, if desired. The value of the resource tag may be +** retrieved from the resource's RPT entry. +** +** If a resource is removed from, then re-added to the RPT (e.g., because of a +** hot swap action), the HPI implementation may reset the value of the +** resource tag. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceTagSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTextBufferT *ResourceTag +); + +/******************************************************************************* +** +** Name: saHpiResourceIdGet() +** +** Description: +** This function returns the ResourceId of the resource associated with the +** entity upon which the HPI User is running. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [out] Pointer to location to hold the returned ResourceId. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned if the ResourceId pointer is passed +** in as NULL. +** SA_ERR_HPI_NOT_PRESENT is returned if the entity the HPI User is running on +** is not manageable in the addressed domain. +** SA_ERR_HPI_UNKNOWN is returned if the domain controller cannot determine an +** appropriate response. That is, there may be an appropriate ResourceId in +** the domain to return, but it cannot be determined. +** +** Remarks: +** This function must be issued within a session to a domain that includes a +** resource associated with the entity upon which the HPI User is running, or +** the SA_ERR_HPI_NOT_PRESENT return will be issued. +** +** Since entities are contained within other entities, there may be multiple +** possible resources that could be returned to this call. For example, if +** there is a ResourceId associated with a particular compute blade upon which +** the HPI User is running, and another associated with the chassis which +** contains the compute blade, either could logically be returned as an +** indication of a resource associated with the entity upon which the HPI User +** was running. The function should return the ResourceId of the "smallest" +** resource that is associated with the HPI User. So, in the example above, +** the function should return the ResourceId of the compute blade. +** +** Once the function has returned the ResourceId, the HPI User may issue +** further HPI calls using that ResourceId to learn the type of resource that +** been identified. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceIdGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiResourceIdT *ResourceId +); + +/******************************************************************************* +** +** Name: saHpiEventLogInfoGet() +** +** Description: +** This function retrieves the current number of entries in the Event Log, +** total size of the Event Log, the time of the most recent update to the +** Event Log, the current value of the Event Log's clock (i.e., timestamp that +** would be placed on an entry at this moment), the enabled/disabled status of +** the Event Log (see Section 6.4.8 on page 57), the overflow flag, and the +** action taken by the Event Log if an overflow occurs. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Identifier for the Resource containing the Event Log. +** Set to SAHPI_UNSPECIFIED_RESOURCE_ID to address the Domain Event Log. +** Info - [out] Pointer to the returned Event Log information. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not have an Event +** Log capability (SAHPI_CAPABILITY_EVENT_LOG) set. Note this condition +** only applies to Resource Event Logs. Domain Event Logs are mandatory, +** and should not return this code. +** SA_ERR_HPI_INVALID_PARAMS is returned if the Info pointer is passed in as +** NULL. +** +** Remarks: +** The size field in the returned Event Log information indicates the maximum +** number of entries that can be held in the Event Log. This number should be +** constant for a particular Event Log. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogInfoGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiEventLogInfoT *Info +); + +/******************************************************************************* +** +** Name: saHpiEventLogEntryGet() +** +** Description: +** This function retrieves an Event Log entry. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Identifier for the Resource containing the Event Log. +** Set to SAHPI_UNSPECIFIED_RESOURCE_ID to address the Domain Event Log. +** EntryId - [in] Identifier of event log entry to retrieve. Reserved values: +** * SAHPI_OLDEST_ENTRY Oldest entry in the Event Log. +** * SAHPI_NEWEST_ENTRY Newest entry in the Event Log. +** * SAHPI_NO_MORE_ENTRIES Not valid for this parameter. Used only when +** retrieving the next and previous EntryIds. +** PrevEntryId - [out] Event Log entry identifier for the previous (older +** adjacent) entry. Reserved values: +** * SAHPI_OLDEST_ENTRY Not valid for this parameter. Used only for +** the EntryId parameter. +** * SAHPI_NEWEST_ENTRY Not valid for this parameter. Used only for +** the EntryId parameter. +** * SAHPI_NO_MORE_ENTRIES No more entries in the Event Log before the +** one referenced by the EntryId parameter. +** NextEntryId - [out] Event Log entry identifier for the next (newer +** adjacent) entry. Reserved values: +** * SAHPI_OLDEST_ENTRY Not valid for this parameter. Used only for +** the EntryId parameter. +** * SAHPI_NEWEST_ENTRY Not valid for this parameter. Used only for +** the EntryId parameter. +** * SAHPI_NO_MORE_ENTRIES No more entries in the Event Log after the one +** referenced by the EntryId parameter. +** EventLogEntry - [out] Pointer to retrieved Event Log entry. +** Rdr - [in/out] Pointer to structure to receive resource data record +** associated with the Event Log entry, if available. If NULL, no RDR data +** will be returned. +** RptEntry - [in/out] Pointer to structure to receive RPT entry associated +** with the Event Log entry, if available. If NULL, no RPT entry data will +** be returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not have an Event +** Log capability (SAHPI_CAPABILITY_EVENT_LOG) set. Note this condition +** only applies to Resource Event Logs. Domain Event Logs are mandatory, +** and should not return this code. +** SA_ERR_HPI_NOT_PRESENT is returned when: +** * The Event Log has no entries. +** * The entry identified by EntryId is not present. +** SA_ERR_HPI_INVALID_PARAMS is returned when: +** * Any of PrevEntryId, NextEntryId and EventLogEntry pointers are passed +** in as NULL. +** * SAHPI_NO_MORE_ENTRIES is passed in to EntryId. +** +** Remarks: +** The special EntryIds SAHPI_OLDEST_ENTRY and SAHPI_NEWEST_ENTRY are used to +** select the oldest and newest entries, respectively, in the Event Log being +** read. A returned NextEntryId of SAHPI_NO_MORE_ENTRIES indicates that the +** newest entry has been returned; there are no more entries going forward +** (time-wise) in the Event Log. A returned PrevEntryId of +** SAHPI_NO_MORE_ENTRIES indicates that the oldest entry has been returned. +** +** To retrieve an entire list of entries going forward (oldest entry to newest +** entry) in the Event Log, call this function first with an EntryId of +** SAHPI_OLDEST_ENTRY and then use the returned NextEntryId as the EntryId in +** the next call. Proceed until the NextEntryId returned is +** SAHPI_NO_MORE_ENTRIES. +** +** To retrieve an entire list of entries going backward (newest entry to +** oldest entry) in the Event Log, call this function first with an EntryId of +** SAHPI_NEWEST_ENTRY and then use the returned PrevEntryId as the EntryId in +** the next call. Proceed until the PrevEntryId returned is +** SAHPI_NO_MORE_ENTRIES. +** +** Event Logs may include RPT entries and resource data records associated +** with the resource and sensor issuing an event along with the basic event +** data in the Event Log. Because the system may be reconfigured after the +** event was entered in the Event Log, this stored information may be +** important to interpret the event. If the Event Log includes logged RPT +** entries and/or RDRs, and if an HPI User provides a pointer to a structure +** to receive this information, it will be returned along with the Event Log +** entry. +** +** If an HPI User provides a pointer for an RPT entry, but the Event Log does +** not include a logged RPT entry for the Event Log entry being returned, +** RptEntry->ResourceCapabilities will be set to zero. No valid RptEntry will +** have a zero Capabilities field value. +** +** If an HPI User provides a pointer for an RDR, but the Event Log does not +** include a logged RDR for the Event Log entry being returned, Rdr->RdrType +** will be set to SAHPI_NO_RECORD. +** +** The EntryIds returned via the PrevEntryId and NextEntryId parameters may +** not be in sequential order, but will reflect the previous and next entries +** in a chronological ordering of the Event Log, respectively. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogEntryGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEventLogEntryIdT EntryId, + SAHPI_OUT SaHpiEventLogEntryIdT *PrevEntryId, + SAHPI_OUT SaHpiEventLogEntryIdT *NextEntryId, + SAHPI_OUT SaHpiEventLogEntryT *EventLogEntry, + SAHPI_INOUT SaHpiRdrT *Rdr, + SAHPI_INOUT SaHpiRptEntryT *RptEntry +); + +/******************************************************************************* +** +** Name: saHpiEventLogEntryAdd() +** +** Description: +** This function enables an HPI user to add entries to the Event Log. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Identifier for the Resource containing the Event Log. +** Set to SAHPI_UNSPECIFIED_RESOURCE_ID to address the Domain Event Log. +** EvtEntry - [in] Pointer to event data to write to the Event Log. The Event +** field must be of type SAHPI_ET_USER, and the Source field must be +** SAHPI_UNSPECIFIED_RESOURCE_ID. +** +** Return Value: +** SA_OK is returned if the event is successfully written in the Event Log; +** otherwise, an error code is returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not have an Event +** Log capability (SAHPI_CAPABILITY_EVENT_LOG) set. Note this condition +** only applies to Resource Event Logs. Domain Event Logs are mandatory, +** and should not return this code. +** SA_ERR_HPI_INVALID_DATA is returned if the event DataLength is larger than +** that supported by the implementation and reported in the Event Log info +** record. +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * EvtEntry pointer is passed in as NULL. +** * Event structure passed via the EvtEntry parameter is not an event of +** type SAHPI_ET_USER with the Source field set to +** SAHPI_UNSPECIFIED_RESOURCE_ID. +** * The Severity is not one of the valid enumerated values for this type. +** * SaHpiTextBufferT structure passed as part of the User Event structure +** is not valid. This would occur when: +** * The DataType is not one of the enumerated values for that type, or +** * The data field contains characters that are not legal according to +** the value of DataType, or +** * The Language is not one of the enumerated values for that type when +** the DataType is SAHPI_TL_TYPE_UNICODE or SAHPI_TL_TYPE_TEXT. +** SA_ERR_HPI_OUT_OF_SPACE is returned if the event cannot be written to the +** Event Log because the Event Log is full, and the Event Log +** OverflowAction is SAHPI_EL_OVERFLOW_DROP. +** +** Remarks: +** This function writes an event in the addressed Event Log. Nothing else is +** done with the event. +** +** If the Event Log is full, overflow processing occurs as defined by the +** Event Log's OverflowAction setting, reported in the Event Log info record. +** If, due to an overflow condition, the event is not written, or if existing +** events are overwritten, then the OverflowFlag in the Event Log info record +** will be set, just as it would be if an internally generated event caused +** an overflow condition. If the Event Log's OverflowAction is +** SAHPI_EL_OVERFLOW_DROP, then an error will be returned +** (SA_ERR_HPI_OUT_OF_SPACE) indicating that the saHpiEventLogEntryAdd() +** function did not add the event to the Event Log. If the Event Log's +** OverflowAction is SAHPI_EL_OVERFLOW_OVERWRITE, then the +** saHpiEventLogEntryAdd() function will return SA_OK, indicating that the +** event was added to the Event Log, even though an overflow occurred as a +** side-effect of this operation. The overflow may be detected by checking +** the OverflowFlag in the Event Log info record. +** +** Specific implementations of HPI may have restrictions on how much data may +** be passed to the saHpiEventLogEntryAdd() function. The Event Log info +** record reports the maximum DataLength that is supported by the Event Log +** for User Events. If saHpiEventLogEntryAdd() is called with a User Event +** that has a larger DataLength than is supported, the event will not be added +** to the Event Log, and an error will be returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogEntryAdd ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEventT *EvtEntry +); + +/******************************************************************************* +** +** Name: saHpiEventLogClear() +** +** Description: +** This function erases the contents of the specified Event Log. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Identifier for the Resource containing the Event Log. +** Set to SAHPI_UNSPECIFIED_RESOURCE_ID to address the Domain Event Log. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not have an Event +** Log capability (SAHPI_CAPABILITY_EVENT_LOG) set. Note this condition +** only applies to Resource Event Logs. Domain Event Logs are mandatory, +** and should not return this code +** +** Remarks: +** The OverflowFlag field in the Event Log info record will be reset when this +** function is called. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogClear ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + +/******************************************************************************* +** +** Name: saHpiEventLogTimeGet() +** +** Description: +** This function retrieves the current time from the Event Log's clock. This +** clock is used to timestamp entries written into the Event Log. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Identifier for the Resource containing the Event Log. +** Set to SAHPI_UNSPECIFIED_RESOURCE_ID to address the Domain Event Log. +** Time - [out] Pointer to the returned current Event Log time. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not have an Event +** Log capability (SAHPI_CAPABILITY_EVENT_LOG) set. Note this condition +** only applies to Resource Event Logs. Domain Event Logs are mandatory, +** and should not return this code. +** SA_ERR_HPI_INVALID_PARAMS is returned if the Time pointer is passed in as +** NULL. +** +** Remarks: +** If the implementation cannot supply an absolute time value, then it may +** supply a time relative to some system-defined epoch, such as system boot. +** If the time value is less than or equal to SAHPI_TIME_MAX_RELATIVE, then it +** is relative; if it is greater than SAHPI_TIME_MAX_RELATIVE, then it is +** absolute. The HPI implementation must provide valid timestamps for Event +** Log entries, using a default time base if no time has been set. Thus, the +** value SAHPI_TIME_UNSPECIFIED is never returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogTimeGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiTimeT *Time +); + +/******************************************************************************* +** +** Name: saHpiEventLogTimeSet() +** +** Description: +** This function sets the Event Log's clock, which is used to timestamp events +** written into the Event Log. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Identifier for the Resource containing the Event Log. +** Set to SAHPI_UNSPECIFIED_RESOURCE_ID to address the Domain Event Log. +** Time - [in] Time to which the Event Log clock should be set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not have an Event +** Log capability (SAHPI_CAPABILITY_EVENT_LOG) set. Note this condition +** only applies to Resource Event Logs. Domain Event Logs are mandatory, +** and should not return this code. +** SA_ERR_HPI_INVALID_PARAMS is returned when the Time parameter is set to +** SAHPI_TIME_UNSPECIFIED. +** For situations when the underlying implementation cannot represent a time +** value that is specified in Time, SA_ERR_HPI_INVALID_DATA is returned. +** +** Remarks: +** If the Time parameter value is less than or equal to +** SAHPI_TIME_MAX_RELATIVE, but not SAHPI_TIME_UNSPECIFIED, then it is +** relative; if it is greater than SAHPI_TIME_MAX_RELATIVE, then it is +** absolute. Setting this parameter to the value SAHPI_TIME_UNSPECIFIED is +** invalid and will result in an error return code of +** SA_ERR_HPI_INVALID_PARAMS. +** +** Entries placed in the Event Log after this function is called will have +** Event Log timestamps (i.e., the Timestamp field in the SaHpiEventLogEntryT +** structure) based on the new time. Setting the clock does not affect +** existing Event Log entries. If the time is set to a relative time, +** subsequent entries placed in the Event Log will have an Event Log timestamp +** expressed as a relative time; if the time is set to an absolute time, +** subsequent entries will have an Event Log timestamp expressed as an +** absolute time. +** +** This function only sets the Event Log time clock and does not have any +** direct bearing on the timestamps placed on events (i.e., the Timestamp +** field in the SaHpiEventT structure), or the timestamps placed in the domain +** RPT info record. Setting the clocks used to generate timestamps other than +** Event Log timestamps is implementation-dependent, and should be documented +** by the HPI implementation provider. +** +** Some underlying implementations may not be able to handle the same relative +** and absolute time ranges, as those defined in HPI. Such limitations will +** be documented. When a time value is set in a region that is not supported +** by the implementation, an error code of SA_ERR_HPI_INVALID_DATA will be +** returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogTimeSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTimeT Time +); + +/******************************************************************************* +** +** Name: saHpiEventLogStateGet() +** +** Description: +** This function enables an HPI User to get the Event Log state. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Identifier for the Resource containing the Event Log. +** Set to SAHPI_UNSPECIFIED_RESOURCE_ID to address the Domain Event Log. +** EnableState - [out] Pointer to the current Event Log enable state. True +** indicates that the Event Log is enabled; False indicates that it is +** disabled. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not have an Event +** Log capability (SAHPI_CAPABILITY_EVENT_LOG) set. Note this condition +** only applies to Resource Event Logs. Domain Event Logs are mandatory, +** and should not return this code. +** SA_ERR_HPI_INVALID_PARAMS is returned if the EnableState pointer is passed +** in as NULL. +** +** Remarks: +** If the Event Log is disabled, no events generated within the HPI +** implementation will be added to the Event Log. Events may still be added to +** the Event Log with the saHpiEventLogEntryAdd() function. When the Event Log +** is enabled, events may be automatically added to the Event Log as they are +** generated in a resource or a domain, however, it is implementation-specific +** which events are automatically added to any Event Log. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiBoolT *EnableState +); + +/******************************************************************************* +** +** Name: saHpiEventLogStateSet() +** +** Description: +** This function enables an HPI User to set the Event Log enabled state. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Identifier for the Resource containing the Event Log. +** Set to SAHPI_UNSPECIFIED_RESOURCE_ID to address the Domain Event Log. +** EnableState - [in] Event Log state to be set. True indicates that the Event +** Log is to be enabled; False indicates that it is to be disabled. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not have an Event +** Log capability (SAHPI_CAPABILITY_EVENT_LOG) set. Note this condition +** only applies to Resource Event Logs. Domain Event Logs are mandatory, +** and should not return this code. +** +** Remarks: +** If the Event Log is disabled no events generated within the HPI +** implementation will be added to the Event Log. Events may still be added to +** the Event Log using the saHpiEventLogEntryAdd() function. When the Event +** Log is enabled events may be automatically added to the Event Log as they +** are generated in a resource or a domain. The actual set of events that are +** automatically added to any Event Log is implementation-specific. +** +** Typically, the HPI implementation will provide an appropriate default value +** for this parameter, which may vary by resource. This function is provided +** so that an HPI User can override the default, if desired. +** +** If a resource hosting an Event Log is re-initialized (e.g., because of a +** hot swap action), the HPI implementation may reset the value of this +** parameter. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiBoolT EnableState +); + +/******************************************************************************* +** +** Name: saHpiEventLogOverflowReset() +** +** Description: +** This function resets the OverflowFlag in the Event Log info record of the +** specified Event Log. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Identifier for the Resource containing the Event Log. +** Set to SAHPI_UNSPECIFIED_RESOURCE_ID to address the Domain Event Log. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_CMD is returned if the implementation does not support +** independent clearing of the OverflowFlag on this Event Log. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not have an Event +** Log capability (SAHPI_CAPABILITY_EVENT_LOG) set. Note this condition +** only applies to Resource Event Logs. Domain Event Logs are mandatory, +** and should not return this code. +** +** Remarks: +** The only effect of this function is to clear the OverflowFlag field in the +** Event Log info record for the specified Event Log. If the Event Log is +** still full, the OverflowFlag will be set again as soon as another entry +** needs to be added to the Event Log. +** +** Some Event Log implementations may not allow resetting of the OverflowFlag +** except as a by-product of clearing the entire Event Log with the +** saHpiEventLogClear() function. Such an implementation will return the +** error code, SA_ERR_HPI_INVALID_CMD to this function. The OverflowResetable +** flag in the Event Log info record indicates whether or not the +** implementation supports resetting the OverflowFlag without clearing the +** Event Log. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventLogOverflowReset ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + +/******************************************************************************* +** +** Name: saHpiSubscribe() +** +** Description: +** This function allows an HPI User to subscribe for events. This single call +** provides subscription to all session events, regardless of event type or +** event severity. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_DUPLICATE is returned when a subscription is already in place +** for this session. +** +** Remarks: +** Only one subscription is allowed per session, and additional subscribers +** will receive an appropriate error code. No event filtering will be done by +** the HPI implementation. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSubscribe ( + SAHPI_IN SaHpiSessionIdT SessionId +); + +/******************************************************************************* +** +** Name: saHpiUnsubscribe() +** +** Description: +** This function removes the event subscription for the session. +** +** Parameters: +** SessionId - [in] Session for which event subscription will be closed. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_REQUEST is returned if the session is not currently +** subscribed for events. +** +** Remarks: +** After removal of a subscription, additional saHpiEventGet() calls will not +** be allowed on the session unless an HPI User re-subscribes for events on +** the session first. Any events that are still in the event queue when this +** function is called will be cleared from it. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiUnsubscribe ( + SAHPI_IN SaHpiSessionIdT SessionId +); + +/******************************************************************************* +** +** Name: saHpiEventGet() +** +** Description: +** This function allows an HPI User to get an event. This call is only valid +** within a session that has subscribed for events. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** Timeout - [in] The number of nanoseconds to wait for an event to arrive. +** Reserved time out values: +** * SAHPI_TIMEOUT_IMMEDIATE Time out immediately if there are no events +** available (non-blocking call). +** * SAHPI_TIMEOUT_BLOCK Call should not return until an event is +** retrieved. +** Event - [out] Pointer to the next available event. +** Rdr - [in/out] Pointer to structure to receive the resource data associated +** with the event. If NULL, no RDR will be returned. +** RptEntry - [in/out] Pointer to structure to receive the RPT entry +** associated with the resource that generated the event. If NULL, no RPT +** entry will be returned. +** EventQueueStatus - [in/out] Pointer to location to store event queue +** status. If NULL, event queue status will not be returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_REQUEST is returned if an HPI User is not currently +** subscribed for events in this session. +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * Event pointer is passed in as NULL. +** * Timeout parameter is not set to SAHPI_TIMEOUT_BLOCK, +** SAHPI_TIMEOUT_IMMEDIATE or a positive value. +** SA_ERR_HPI_TIMEOUT is returned if no event is available to return within +** the timeout period. If SAHPI_TIMEOUT_IMMEDIATE is passed in the +** Timeout parameter, this error return will be used if there is no event +** queued when the function is called. +** +** Remarks: +** SaHpiEventGet() will also return an EventQueueStatus flag to an HPI User. +** This flag indicates whether or not a queue overflow has occurred. The +** overflow flag is set if any events were unable to be queued because of +** space limitations in the interface implementation. The overflow flag is +** reset whenever saHpiEventGet() is called. +** +** If there are one or more events on the event queue when this function is +** called, it will immediately return the next event on the queue. Otherwise, +** if the Timeout parameter is SAHPI_TIMEOUT_IMMEDIATE, it will return +** SA_ERR_HPI_TIMEOUT immediately. Otherwise, it will block for time +** specified by the timeout parameter; if an event is added to the queue +** within that time it will be returned immediately; if not, saHpiEventGet() +** will return SA_ERR_HPI_TIMEOUT. If the Timeout parameter is +** SAHPI_TIMEOUT_BLOCK, the saHpiEventGet() will block indefinitely, until +** an event becomes available, and then return that event. This provides for +** notification of events as they occur. +** +** If an HPI User provides a pointer for an RPT entry, but the event does not +** include a valid ResourceId for a resource in the domain (e.g., OEM or USER +** type event), then the RptEntry->ResourceCapabilities field will be set to +** zero. No valid RPT entry will have a zero ResourceCapabilities. +** +** If an HPI User provides a pointer for an RDR, but there is no valid RDR +** associated with the event being returned (e.g., returned event is not a +** sensor event), then the Rdr->RdrType field will be set to SAHPI_NO_RECORD. +** +** The timestamp reported in the returned event structure is the best +** approximation an implementation has to when the event actually occurred. +** The implementation may need to make an approximation (such as the time the +** event was placed on the event queue) because it may not have access to the +** actual time the event occurred. The value SAHPI_TIME_UNSPECIFIED indicates +** that the time of the event cannot be determined. +** +** If the implementation cannot supply an absolute timestamp, then it may +** supply a timestamp relative to some system-defined epoch, such as system +** boot. If the timestamp value is less than or equal to +** SAHPI_TIME_MAX_RELATIVE, but not SAHPI_TIME_UNSPECIFIED, then it is +** relative; if it is greater than SAHPI_TIME_MAX_RELATIVE, then it is +** absolute. +** +** If an HPI User passes a NULL pointer for the returned EventQueueStatus +** pointer, the event status will not be returned, but the overflow flag, if +** set, will still be reset. Thus, if an HPI User needs to know about event +** queue overflows, the EventQueueStatus parameter should never be NULL, and +** the overflow flag should be checked after every call to saHpiEventGet(). +** +** If saHpiEventGet() is called with a timeout value other than +** SAHPI_TIMEOUT_IMMEDIATE, and the session is subsequently closed from +** another thread, this function will return with SA_ERR_HPI_INVALID_SESSION. +** If saHpiEventGet() is called with a timeout value other than +** SAHPI_TIMEOUT_IMMEDIATE, and an HPI User subsequently calls +** saHpiUnsubscribe() from another thread, this function will return with +** SA_ERR_HPI_INVALID_REQUEST. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiTimeoutT Timeout, + SAHPI_OUT SaHpiEventT *Event, + SAHPI_INOUT SaHpiRdrT *Rdr, + SAHPI_INOUT SaHpiRptEntryT *RptEntry, + SAHPI_INOUT SaHpiEvtQueueStatusT *EventQueueStatus +); + +/******************************************************************************* +** +** Name: saHpiEventAdd() +** +** Description: +** This function enables an HPI User to add events to the HPI domain +** identified by the SessionId. The domain controller processes an event +** added with this function as if the event originated from within the +** domain. The domain controller will attempt to publish events to all active +** event subscribers and will attempt to log events in the Domain Event Log, +** if room is available. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** EvtEntry - [in] Pointer to event to add to the domain. Event must be of +** type SAHPI_ET_USER, and the Source field must be +** SAHPI_UNSPECIFIED_RESOURCE_ID. +** +** Return Value: +** SA_OK is returned if the event is successfully added to the domain; +** otherwise, an error code is returned. +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * EvtEntry parameter is NULL. +** * Event structure passed via the EvtEntry parameter is not an event of +** type SAHPI_ET_USER with the Source field being +** SAHPI_UNSPECIFIED_RESOURCE_ID. +** * Event structure passed via the EvtEntry parameter has an invalid +** Severity. +** * SaHpiTextBufferT structure passed as part of the User Event structure +** is not valid. This would occur when: +** * The DataType is not one of the enumerated values for that type, or +** * The data field contains characters that are not legal according to +** the value of DataType, or +** * The Language is not one of the enumerated values for that type when +** the DataType is SAHPI_TL_TYPE_UNICODE or SAHPI_TL_TYPE_TEXT. +** SA_ERR_HPI_INVALID_DATA is returned if the event data does not meet +** implementation-specific restrictions on how much event data may be +** provided in a SAHPI_ET_USER event. +** +** Remarks: +** Specific implementations of HPI may have restrictions on how much data may +** be included in a SAHPI_ET_USER event. If more event data is provided than +** can be processed, an error will be returned. The event data size +** restriction for the SAHPI_ET_USER event type is provided in the +** UserEventMaxSize field in the domain Event Log info structure. An HPI User +** should call the function saHpiEventLogInfoGet() to retrieve the Event +** Log info structure. +** +** The domain controller will attempt to publish the event to all sessions +** within the domain with active event subscriptions; however, a session's +** event queue may overflow due to the addition of the new event. +** +** The domain controller will attempt to log the event in the Domain Event +** Log; however, the Domain Event Log may overflow due to the addition of the +** new event +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiEventAdd ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEventT *EvtEntry +); + +/******************************************************************************* +** +** Name: saHpiAlarmGetNext() +** +** Description: +** This function allows retrieval of an alarm from the current set of alarms +** held in the Domain Alarm Table (DAT). +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** Severity - [in] Severity level of alarms to retrieve. Set to +** SAHPI_ALL_SEVERITIES to retrieve alarms of any severity; otherwise, set +** to requested severity level. +** UnacknowledgedOnly - [in] Set to True to indicate only unacknowledged +** alarms should be returned. Set to False to indicate either an +** acknowledged or unacknowledged alarm may be returned. +** Alarm - [in/out] Pointer to the structure to hold the returned alarm entry. +** Also, on input, Alarm->AlarmId and Alarm->Timestamp are used to +** identify the previous alarm. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned when: +** * Severity is not one of the valid enumerated values for this type. +** * The Alarm parameter is passed in as NULL. +** SA_ERR_HPI_NOT_PRESENT is returned: +** * If there are no additional alarms in the DAT that meet the criteria +** specified by the Severity and UnacknowledgedOnly parameters. +** * If the passed Alarm->AlarmId field was set to SAHPI_FIRST_ENTRY and +** there are no alarms in the DAT that meet the criteria specified by +** the Severity and UnacknowledgedOnly parameters. +** SA_ERR_HPI_INVALID_DATA is returned if the passed Alarm->AlarmId matches an +** alarm in the DAT, but the passed Alarm->Timestamp does not match the +** timestamp of that alarm. +** +** Remarks: +** All alarms contained in the DAT are maintained in the order in which they +** were added. This function will return the next alarm meeting the +** specifications given by an HPI User that was added to the DAT after the +** alarm whose AlarmId and Timestamp is passed by an HPI User, even if the +** alarm associated with the AlarmId and Timestamp has been deleted. If +** SAHPI_FIRST_ENTRY is passed as the AlarmId, the first alarm in the DAT +** meeting the specifications given by an HPI User is returned. +** +** Alarm selection can be restricted to only alarms of a specified severity, +** and/or only unacknowledged alarms. +** +** To retrieve all alarms contained within the DAT meeting specific +** requirements, call saHpiAlarmGetNext() with the Alarm->AlarmId field set to +** SAHPI_FIRST_ENTRY and the Severity and UnacknowledgedOnly parameters set to +** select what alarms should be returned. Then, repeatedly call +** saHpiAlarmGetNext() passing the previously returned alarm as the Alarm +** parameter, and the same values for Severity and UnacknowledgedOnly until +** the function returns with the error code SA_ERR_HPI_NOT_PRESENT. +** +** SAHPI_FIRST_ENTRY and SAHPI_LAST_ENTRY are reserved AlarmId values, and +** will never be assigned to an alarm in the DAT. +** +** The elements AlarmId and Timestamp are used in the Alarm parameter to +** identify the previous alarm; the next alarm added to the table after this +** alarm that meets the Severity and UnacknowledgedOnly requirements will be +** returned. Alarm->AlarmId may be set to SAHPI_FIRST_ENTRY to select the +** first alarm in the DAT meeting the Severity and UnacknowledgedOnly +** requirements. If Alarm->AlarmId is SAHPI_FIRST_ENTRY, then +** Alarm->Timestamp is ignored. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAlarmGetNext( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiSeverityT Severity, + SAHPI_IN SaHpiBoolT UnacknowledgedOnly, + SAHPI_INOUT SaHpiAlarmT *Alarm +); + +/******************************************************************************* +** +** Name: saHpiAlarmGet() +** +** Description: +** This function allows retrieval of a specific alarm in the Domain Alarm +** Table (DAT) by referencing its AlarmId. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** AlarmId - [in] AlarmId of the alarm to be retrieved from the DAT. +** Alarm - [out] Pointer to the structure to hold the returned alarm entry. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_NOT_PRESENT is returned if the requested AlarmId does not +** correspond to an alarm contained in the DAT. +** SA_ERR_HPI_INVALID_PARAMS is returned when the Alarm parameter is passed in +** as NULL. +** +** Remarks: +** SAHPI_FIRST_ENTRY and SAHPI_LAST_ENTRY are reserved AlarmId values, and +** will never be assigned to an alarm in the DAT. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAlarmGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiAlarmIdT AlarmId, + SAHPI_OUT SaHpiAlarmT *Alarm +); + +/******************************************************************************* +** +** Name: saHpiAlarmAcknowledge() +** +** Description: +** This function allows an HPI User to acknowledge a single alarm entry or a +** group of alarm entries by severity. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** AlarmId - [in] Identifier of the alarm to be acknowledged. Reserved +** AlarmId values: +** * SAHPI_ENTRY_UNSPECIFIED Ignore this parameter. +** Severity - [in] Severity level of alarms to acknowledge. Ignored unless +** AlarmId is SAHPI_ENTRY_UNSPECIFIED. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_NOT_PRESENT is returned if an alarm entry identified by the +** AlarmId parameter does not exist in the DAT. +** SA_ERR_HPI_INVALID_PARAMS is returned if AlarmId is SAHPI_ENTRY_UNSPECIFIED +** and Severity is not one of the valid enumerated values for this type. +** +** Remarks: +** An HPI User acknowledges an alarm to indicate that it is aware of the alarm +** and to influence platform-specific alarm annunciation that may be provided +** by the implementation. Typically, an implementation ignores acknowledged +** alarms when announcing an alarm on annunciation devices such as audible +** sirens and dry contact closures. However, alarm annunciation is +** implementation-specific. +** +** An acknowledged alarm will have the Acknowledged field in the alarm entry +** set to True. +** +** Alarms are acknowledged by one of two ways: a single alarm entry by AlarmId +** regardless of severity or as a group of alarm entries by Severity +** regardless of AlarmId. +** +** To acknowledge all alarms contained within the DAT, set the Severity +** parameter to SAHPI_ALL_SEVERITIES, and set the AlarmId parameter to +** SAHPI_ENTRY_UNSPECIFIED. +** +** To acknowledge all alarms of a specific severity contained within the DAT, +** set the Severity parameter to the appropriate value, and set the AlarmId +** parameter to SAHPI_ENTRY_UNSPECIFIED. +** +** To acknowledge a single alarm entry, set the AlarmId parameter to a value +** other than SAHPI_ENTRY_UNSPECIFIED. The AlarmId must be a valid identifier +** for an alarm entry present in the DAT at the time of the function call. +** +** If an alarm has been previously acknowledged, acknowledging it again has no +** effect. However, this is not an error. +** +** If the AlarmId parameter has a value other than SAHPI_ENTRY_UNSPECIFIED, +** the Severity parameter is ignored. +** +** If the AlarmId parameter is passed as SAHPI_ENTRY_UNSPECIFIED, and no +** alarms are present that meet the requested Severity, this function will +** have no effect. However, this is not an error. +** +** SAHPI_ENTRY_UNSPECIFIED is defined as the same value as SAHPI_FIRST_ENTRY, +** so using either symbol will have the same effect. However, +** SAHPI_ENTRY_UNSPECIFIED should be used with this function for clarity. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAlarmAcknowledge( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiAlarmIdT AlarmId, + SAHPI_IN SaHpiSeverityT Severity +); + +/******************************************************************************* +** +** Name: saHpiAlarmAdd() +** +** Description: +** This function is used to add a User Alarm to the DAT. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** Alarm - [in/out] Pointer to the alarm entry structure that contains the new +** User Alarm to add to the DAT. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned when the Alarm pointer is passed in +** as NULL. +** SA_ERR_HPI_INVALID_PARAMS is returned when Alarm->Severity is not one of +** the following enumerated values: SAHPI_MINOR, SAHPI_MAJOR, or +** SAHPI_CRITICAL. +** SA_ERR_HPI_INVALID_PARAMS is returned when Alarm->AlarmCond.Type is not +** SAHPI_STATUS_COND_TYPE_USER. +** SA_ERR_HPI_OUT_OF_SPACE is returned if the DAT is not able to add an +** additional User Alarm due to space limits or limits imposed on the +** number of User Alarms permitted in the DAT. +** +** Remarks: +** The AlarmId, and Timestamp fields within the Alarm parameter are not used +** by this function. Instead, on successful completion, these fields are set +** to new values associated with the added alarm. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAlarmAdd( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_INOUT SaHpiAlarmT *Alarm +); + +/******************************************************************************* +** +** Name: saHpiAlarmDelete() +** +** Description: +** This function allows an HPI User to delete a single User Alarm or a group +** of User Alarms from the DAT. Alarms may be deleted individually by +** specifying a specific AlarmId, or they may be deleted as a group by +** specifying a Severity. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** AlarmId - [in] Alarm identifier of the alarm entry to delete. Reserved +** values: +** * SAHPI_ENTRY_UNSPECIFIED Ignore this parameter. +** Severity - [in] Severity level of alarms to delete. Ignored unless AlarmId +** is SAHPI_ENTRY_UNSPECIFIED. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned if AlarmId is SAHPI_ENTRY_UNSPECIFIED +** and Severity is not one of the valid enumerated values for this type. +** SA_ERR_HPI_NOT_PRESENT is returned if an alarm entry identified by the +** AlarmId parameter does not exist in the DAT. +** SA_ERR_HPI_READ_ONLY is returned if the AlarmId parameter indicates a +** non-User Alarm. +** +** Remarks: +** Only User Alarms added to the DAT can be deleted. When deleting alarms by +** severity, only User Alarms of the requested severity will be deleted. +** +** To delete a single, specific alarm, set the AlarmId parameter to a value +** representing an actual User Alarm in the DAT. The Severity parameter is +** ignored when the AlarmId parameter is set to a value other than +** SAHPI_ENTRY_UNSPECIFIED. +** +** To delete a group of User Alarms, set the AlarmId parameter to +** SAHPI_ENTRY_UNSPECIFIED, and set the Severity parameter to identify which +** severity of alarms should be deleted. To clear all User Alarms contained +** within the DAT, set the Severity parameter to SAHPI_ALL_SEVERITIES. +** +** If the AlarmId parameter is passed as SAHPI_ENTRY_UNSPECIFIED, and no User +** Alarms are present that meet the specified Severity, this function will +** have no effect. However, this is not an error. +** +** SAHPI_ENTRY_UNSPECIFIED is defined as the same value as SAHPI_FIRST_ENTRY, +** so using either symbol will have the same effect. However, +** SAHPI_ENTRY_UNSPECIFIED should be used with this function for clarity. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAlarmDelete( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiAlarmIdT AlarmId, + SAHPI_IN SaHpiSeverityT Severity +); + +/******************************************************************************* +** +** Name: saHpiRdrGet() +** +** Description: +** This function returns a resource data record from the addressed resource. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** EntryId - [in] Identifier of the RDR entry to retrieve. Reserved EntryId +** values: +** * SAHPI_FIRST_ENTRY Get first entry. +** * SAHPI_LAST_ENTRY Reserved as delimiter for end of list. Not a +** valid entry identifier. +** NextEntryId - [out] Pointer to location to store EntryId of next entry in +** RDR repository. +** Rdr - [out] Pointer to the structure to receive the requested resource data +** record. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource contains no RDR records +** (and thus does not have the SAHPI_CAPABILITY_RDR flag set in its RPT +** entry). +** SA_ERR_HPI_NOT_PRESENT is returned if an EntryId (other than +** SAHPI_FIRST_ENTRY) is passed that does not correspond to an actual +** EntryId in the resource's RDR repository. +** SA_ERR_HPI_INVALID_PARAMS is returned if: +** * SAHPI_LAST_ENTRY is passed in to EntryId. +** * NextEntryId pointer is passed in as NULL. +** * Rdr pointer is passed in as NULL. +** +** Remarks: +** Submitting an EntryId of SAHPI_FIRST_ENTRY results in the first RDR being +** read. A returned NextEntryId of SAHPI_LAST_ENTRY indicates the last RDR has +** been returned. A successful retrieval will include the next valid EntryId. +** To retrieve the entire list of RDRs, call this function first with an +** EntryId of SAHPI_FIRST_ENTRY and then use the returned NextEntryId in the +** next call. Proceed until the NextEntryId returned is SAHPI_LAST_ENTRY. +** +** A resource's RDR repository is static over the lifetime of the resource; +** therefore no precautions are required against changes to the content of the +** RDR repository while it is being accessed. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRdrGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEntryIdT *NextEntryId, + SAHPI_OUT SaHpiRdrT *Rdr +); + +/******************************************************************************* +** +** Name: saHpiRdrGetByInstrumentId() +** +** Description: +** This function returns the Resource Data Record (RDR) for a specific +** management instrument hosted by the addressed resource. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** RdrType - [in] Type of RDR being requested. +** InstrumentId - [in] Instrument number identifying the specific RDR to be +** returned. This is a sensor number, control number, watchdog timer +** number, IDR number, or annunciator number, depending on the value of +** the RdrType parameter. +** Rdr - [out] Pointer to the structure to receive the requested RDR. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the: +** * Resource contains no RDR records (and thus does not have the +** SAHPI_CAPABILITY_RDR flag set in its RPT entry). +** * Type of management instrument specified in the RdrType parameter is +** not supported by the resource, as indicated by the Capability field +** in its RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the specific management instrument +** identified in the InstrumentId parameter is not present in the addressed +** resource. +** SA_ERR_HPI_INVALID_PARAMS is returned when the: +** * RdrType parameter is not a valid enumerated value for the type. +** * RdrType is SAHPI_NO_RECORD. +** * Rdr pointer is passed in as NULL. +** +** Remarks: +** The RDR to be returned is identified by RdrType (sensor, control, watchdog +** timer, inventory data repository, or annunciator) and InstrumentId (sensor +** number, control number, watchdog number, IDR number, or annunciator number) +** for the specific management instrument for the RDR being requested. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiRdrGetByInstrumentId ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiRdrTypeT RdrType, + SAHPI_IN SaHpiInstrumentIdT InstrumentId, + SAHPI_OUT SaHpiRdrT *Rdr +); + +/******************************************************************************* +** +** Name: saHpiSensorReadingGet() +** +** Description: +** This function is used to retrieve a sensor reading. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which the sensor reading is being +** retrieved. +** Reading - [in/out] Pointer to a structure to receive sensor reading values +** If NULL, the sensor reading value will not be returned. +** EventState - [in/out] Pointer to location to receive sensor event states. +** If NULL, the sensor event states will not be returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support sensors, +** as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT entry. +** SA_ERR_HPI_INVALID_REQUEST is returned if the sensor is currently disabled. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** +** Remarks: +** For sensors that return a type of SAHPI_SENSOR_READING_TYPE_BUFFER, the +** format of the returned data buffer is implementation-specific. +** +** If the sensor does not provide a reading, the Reading structure returned by +** the saHpiSensorReadingGet() function will indicate the reading is not +** supported by setting the IsSupported flag to False. +** +** If the sensor does not support any event states, a value of 0x0000 will be +** returned for the EventState value. This is indistinguishable from the +** return for a sensor that does support event states, but currently has no +** event states asserted. The Sensor RDR Events field can be examined to +** determine if the sensor supports any event states. +** +** It is legal for both the Reading parameter and the EventState parameter to +** be NULL. In this case, no data is returned other than the return code. +** This can be used to determine if a sensor is present and enabled without +** actually returning current sensor data. If the sensor is present and +** enabled, SA_OK is returned; otherwise, an error code is returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorReadingGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_INOUT SaHpiSensorReadingT *Reading, + SAHPI_INOUT SaHpiEventStateT *EventState +); + +/******************************************************************************* +** +** Name: saHpiSensorThresholdsGet() +** +** Description: +** This function retrieves the thresholds for the given sensor. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which threshold values are being +** retrieved. +** SensorThresholds - [out] Pointer to returned sensor thresholds. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support sensors, +** as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned if the SensorThresholds pointer is +** passed in as NULL. +** SA_ERR_HPI_INVALID_CMD is returned if: +** * Getting a threshold on a sensor that is not a threshold type. +** * The sensor does not have any readable threshold values. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** +** Remarks: +** This function only applies to sensors that support readable thresholds, as +** indicated by the IsAccessible field in the SaHpiSensorThdDefnT structure +** of the sensor's RDR being set to True and the ReadThold field in the same +** structure having a non-zero value. +** +** For thresholds that do not apply to the identified sensor, the IsSupported +** flag of the threshold value field will be set to False. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorThresholdsGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorThresholdsT *SensorThresholds +); + + +/******************************************************************************* +** +** Name: saHpiSensorThresholdsSet() +** +** Description: +** This function sets the specified thresholds for the given sensor. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which threshold values are being set. +** SensorThresholds - [in] Pointer to the sensor thresholds values being set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_DATA is returned if any of the threshold values are +** provided in a format not supported by the sensor. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support sensors, +** as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** SA_ERR_HPI_INVALID_CMD is returned when: +** * Writing to a threshold that is not writable. +** * Setting a threshold on a sensor that is not a threshold type as +** indicated by the IsAccessible field of the SaHpiSensorThdDefnT +** structure. +** * Setting a threshold outside of the Min-Max range as defined by the +** Range field of the SensorDataFormat of the RDR. +** SA_ERR_HPI_INVALID_DATA is returned when: +** * Thresholds are set out-of-order (see Remarks). +** * A negative hysteresis value is provided. +** +** Remarks: +** This function only applies to sensors that support writable thresholds, +** as indicated by the IsAccessible field in the SaHpiSensorThdDefnT +** structure of the sensor's RDR being set to True and the WriteThold field +** in the same structure having a non-zero value. +** +** The type of value provided for each threshold setting must correspond to +** the reading format supported by the sensor, as defined by the reading type +** in the DataFormat field of the sensor's RDR (saHpiSensorRecT). +** +** Sensor thresholds cannot be set outside of the range defined by the Range +** field of the SensorDataFormat of the Sensor RDR. If SAHPI_SRF_MAX +** indicates that a maximum reading exists, no sensor threshold may be set +** greater than the Max value. If SAHPI_SRF_MIN indicates that a minimum +** reading exists, no sensor threshold may be set less than the Min value. +** +** Thresholds are required to be set progressively in-order, so that +** Upper Critical >= Upper Major >= Upper Minor >= Lower Minor >= Lower Major +** >= Lower Critical. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorThresholdsSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiSensorThresholdsT *SensorThresholds +); + +/******************************************************************************* +** +** Name: saHpiSensorTypeGet() +** +** Description: +** This function retrieves the sensor type and event category for the +** specified sensor. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which the type is being retrieved. +** Type - [out] Pointer to returned enumerated sensor type for the specified +** sensor. +** Category - [out] Pointer to location to receive the returned sensor event +** category. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support sensors, +** as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * Type pointer is passed in as NULL. +** * Category pointer is passed in as NULL. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorTypeGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiSensorTypeT *Type, + SAHPI_OUT SaHpiEventCategoryT *Category +); + +/******************************************************************************* +** +** Name: saHpiSensorEnableGet() +** +** Description: +** This function returns the current sensor enable status for an addressed +** sensor. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which the sensor enable status is being +** requested. +** SensorEnabled - [out] Pointer to the location to store the sensor enable +** status. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support sensors, +** as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned when the SensorEnabled pointer is set +** to NULL. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** +** Remarks: +** The SaHpiBoolT value pointed to by the SensorEnabled parameter will be set +** to True if the sensor is enabled, or False if the sensor is disabled. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEnableGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiBoolT *SensorEnabled +); + +/******************************************************************************* +** +** Name: saHpiSensorEnableSet() +** +** Description: +** This function sets the sensor enable status for an addressed sensor. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which the sensor enable status is being +** set. +** SensorEnabled - [in] Sensor enable status to be set for the sensor. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support sensors, +** as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** SA_ERR_HPI_READ_ONLY is returned if the sensor does not support changing +** the enable status (i.e., the EnableCtrl field in the Sensor RDR is set +** to False). +** +** Remarks: +** If a sensor is disabled, any calls to saHpiSensorReadingGet() for that +** sensor will return an error, and no events will be generated for the +** sensor. +** +** Calling saHpiSensorEnableSet() with a SensorEnabled parameter of True +** will enable the sensor. A SensorEnabled parameter of False will disable +** the sensor. +** +** If the sensor enable status changes as the result of this function call, +** an event will be generated. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEnableSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiBoolT SensorEnabled +); + +/******************************************************************************* +** +** Name: saHpiSensorEventEnableGet() +** +** Description: +** This function returns the current sensor event enable status for an +** addressed sensor. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which the sensor event enable status is +** being requested. +** SensorEventsEnabled - [out] Pointer to the location to store the sensor +** event enable status. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support sensors, +** as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned when the SensorEventsEnabled pointer +** is set to NULL. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** +** Remarks: +** The SaHpiBoolT value pointed to by the SensorEventsEnabled parameter will +** be set to True if event generation for the sensor is enabled, or False if +** event generation for the sensor is disabled. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEventEnableGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_OUT SaHpiBoolT *SensorEventsEnabled +); + +/******************************************************************************* +** +** Name: saHpiSensorEventEnableSet() +** +** Description: +** This function sets the sensor event enable status for an addressed sensor. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which the sensor enable status is being +** set. +** SensorEventsEnabled - [in] Sensor event enable status to be set for the +** sensor. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support sensors, +** as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** SA_ERR_HPI_READ_ONLY is returned if the sensor does not support changing +** the event enable status (i.e., the EventCtrl field in the Sensor RDR is +** set to SAHPI_SEC_READ_ONLY). +** +** Remarks: +** If event generation for a sensor is disabled, no events will be generated +** as a result of the assertion or deassertion of any event state, regardless +** of the setting of the assert or deassert event masks for the sensor. If +** event generation for a sensor is enabled, events will be generated when +** event states are asserted or deasserted, according to the settings of the +** assert and deassert event masks for the sensor. Event states may still be +** read for a sensor even if event generation is disabled, by using the +** saHpiSensorReadingGet() function. +** +** Calling saHpiSensorEventEnableSet() with a SensorEventsEnabled parameter +** of True will enable event generation for the sensor. A SensorEventsEnabled +** parameter of False will disable event generation for the sensor. +** +** If the sensor event enabled status changes as a result of this function +** call, an event will be generated. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEventEnableSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiBoolT SensorEventsEnabled +); + +/******************************************************************************* +** +** Name: saHpiSensorEventMasksGet() +** +** Description: +** This function returns the assert and deassert event masks for a sensor. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which the event enable configuration is +** being requested. +** AssertEventMask - [in/out] Pointer to location to store sensor assert event +** mask. If NULL, assert event mask is not returned. +** DeassertEventMask - [in/out] Pointer to location to store sensor deassert +** event mask. If NULL, deassert event mask is not returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** sensors, as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT +** entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** +** Remarks: +** Two bit-mask values are returned by the saHpiSensorEventMasksGet() +** function; one for the sensor assert event mask, and one for the sensor +** deassert event mask. A bit set to '1' in the AssertEventMask value +** indicates that an event will be generated by the sensor when the +** corresponding event state for that sensor changes from deasserted to +** asserted. A bit set to '1' in the DeassertEventMask value indicates that +** an event will be generated by the sensor when the corresponding event +** state for that sensor changes from asserted to deasserted. +** +** Events will only be generated by the sensor if the appropriate +** AssertEventMask or DeassertEventMask bit is set, sensor events are +** enabled, and the sensor is enabled. +** +** For sensors hosted by resources that have the +** SAHPI_CAPABILITY_EVT_DEASSERTS flag set in its RPT entry, the +** AssertEventMask and the DeassertEventMask values will always be the same. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEventMasksGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_INOUT SaHpiEventStateT *AssertEventMask, + SAHPI_INOUT SaHpiEventStateT *DeassertEventMask +); + +/******************************************************************************* +** +** Name: saHpiSensorEventMasksSet() +** +** Description: +** This function provides the ability to change the settings of the sensor +** assert and deassert event masks. Two parameters contain bit-mask values +** indicating which bits in the sensor assert and deassert event masks should +** be updated. In addition, there is an Action parameter. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** SensorNum - [in] Sensor number for which the event enable configuration +** is being set. +** Action - [in] Enumerated value describing what change should be made to +** the sensor event masks: +** * SAHPI_SENS_ADD_EVENTS_TO_MASKS - for each bit set in the +** AssertEventMask and DeassertEventMask parameters, set the +** corresponding bit in the sensor's assert and deassert event masks, +** respectively. +** * SAHPI_SENS_REMOVE_EVENTS_FROM_MASKS - for each bit set in the +** AssertEventMask and DeassertEventMask parameters, clear the +** corresponding bit in the sensor's assert and deassert event masks, +** respectively. +** AssertEventMask - [in] Bit mask or special value indicating which bits in +** the sensor's assert event mask should be set or cleared. (But see +** Remarks concerning resources with the SAHPI_EVT_DEASSERTS_CAPABILITY +** flag set.) +** DeassertEventMask - [in] Bit mask or special value indicating which bits +** in the sensor's deassert event mask should be set or cleared. (But see +** Remarks concerning resources with the SAHPI_EVT_DEASSERTS_CAPABILITY +** flag set.) +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** sensors, as indicated by SAHPI_CAPABILITY_SENSOR in the resource's RPT +** entry. +** SA_ERR_HPI_INVALID_DATA is returned if the Action parameter is +** SAHPI_SENS_ADD_EVENTS_TO_MASKS, and either of the AssertEventMask or +** DeassertEventMask parameters include a bit for an event state that is +** not supported by the sensor. +** SA_ERR_HPI_INVALID_PARAMS is returned if the Action parameter is out of +** range. +** SA_ERR_HPI_NOT_PRESENT is returned if the sensor is not present. +** SA_ERR_HPI_READ_ONLY is returned if the sensor does not support updating +** the assert and deassert event masks (i.e., the EventCtrl field in the +** Sensor RDR is set to SAHPI_SEC_READ_ONLY_MASKS or SAHPI_SEC_READ_ONLY). +** +** Remarks: +** The bits in the sensor assert and deassert event masks that correspond to +** '1' bits in the bit-mask parameters will be set or cleared, as indicated +** by the Action parameter. The bits in the sensor assert and deassert event +** masks corresponding to '0' bits in the bit-mask parameters will be +** unchanged. +** +** Assuming that a sensor is enabled and event generation for the sensor is +** enabled, then for each bit set in the sensor's assert event mask, an event +** will be generated when the sensor's corresponding event state changes from +** deasserted to asserted. Similarly, for each bit set in the sensor's +** deassert event mask, an event will be generated when the sensor's +** corresponding event state changes from asserted to deasserted. +** +** For sensors hosted by a resource that has the +** SAHPI_CAPABILITY_EVT_DEASSERTS flag set in its RPT entry, the assert and +** deassert event masks cannot be independently configured. When +** saHpiSensorEventMasksSet() is called for sensors in a resource with this +** capability, the DeassertEventMask parameter is ignored, and the +** AssertEventMask parameter is used to determine which bits to set or clear +** in both the assert event mask and deassert event mask for the sensor. +** +** The AssertEventMask or DeassertEventMask parameter may be set to the +** special value, SAHPI_ALL_EVENT_STATES, indicating that all event states +** supported by the sensor should be added to or removed from, the +** corresponding sensor event mask. +** +** If the sensor assert and/or deassert event masks change as a result of +** this function call, an event will be generated. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiSensorEventMasksSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSensorNumT SensorNum, + SAHPI_IN SaHpiSensorEventMaskActionT Action, + SAHPI_IN SaHpiEventStateT AssertEventMask, + SAHPI_IN SaHpiEventStateT DeassertEventMask +); + +/******************************************************************************* +** +** Name: saHpiControlTypeGet() +** +** Description: +** This function retrieves the control type of a control object. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** CtrlNum - [in] Control number for which the type is being retrieved. +** Type - [out] Pointer to SaHpiCtrlTypeT variable to receive the enumerated +** control type for the specified control. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** controls, as indicated by SAHPI_CAPABILITY_CONTROL in the resource's +** RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the control is not present. +** SA_ERR_HPI_INVALID_PARAMS is returned if the Type pointer is passed in as +** NULL. +** +** Remarks: +** The Type parameter must point to a variable of type SaHpiCtrlTypeT. Upon +** successful completion, the enumerated control type is returned in the +** variable pointed to by Type. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiControlTypeGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiCtrlNumT CtrlNum, + SAHPI_OUT SaHpiCtrlTypeT *Type +); + +/******************************************************************************* +** +** Name: saHpiControlGet() +** +** Description: +** This function retrieves the current state and mode of a control object. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** CtrlNum - [in] Control number for which the state and mode are being +** retrieved. +** CtrlMode - [out] Pointer to the mode of the control. If NULL, the +** control's mode will not be returned. +** CtrlState - [in/out] Pointer to a control data structure into which the +** current control state will be placed. For text controls, the line +** number to read is passed in via CtrlState->StateUnion.Text.Line. +** If NULL, the control's state will not be returned. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_CMD is returned if the control is a write-only control, +** as indicated by the WriteOnly flag in the control's RDR (see remarks). +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** controls, as indicated by the SAHPI_CAPABILITY_CONTROL in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_DATA is returned if the addressed control is a text +** control, and the line number passed in CtrlState->StateUnion.Text.Line +** does not exist in the control and is not SAHPI_TLN_ALL_LINES. +** SA_ERR_HPI_NOT_PRESENT is returned if the control is not present. +** +** Remarks: +** Note that the CtrlState parameter is both an input and an output parameter +** for this function. This is necessary to support line number inputs for +** text controls, as discussed below. +** +** In some cases, the state of a control may be set, but the corresponding +** state cannot be read at a later time. Such controls are delineated with +** the WriteOnly flag in the Control's RDR. +** +** Note that text controls are unique in that they have a state associated +** with each line of the control - the state being the text on that line. The +** line number to be read is passed in to saHpiControlGet() via +** CtrlState->StateUnion.Text.Line; the contents of that line of the control +** will be returned in CtrlState->StateUnion.Text.Text. The first line of +** the text control is line number "1". +** +** If the line number passed in is SAHPI_TLN_ALL_LINES, then +** saHpiControlGet() will return the entire text of the control, or as much +** of it as will fit in a single SaHpiTextBufferT, in +** CtrlState->StateUnion.Text.Text. This value will consist of the text of +** all the lines concatenated, using the maximum number of characters for +** each line (no trimming of trailing blanks). +** +** Note that depending on the data type and language, the text may be encoded +** in 2-byte Unicode, which requires two bytes of data per character. +** +** Note that the number of lines and columns in a text control can be +** obtained from the control's Resource Data Record. +** +** Write-only controls allow the control's state to be set, but the control +** state cannot be subsequently read. Such controls are indicated in the RDR, +** when the WriteOnly flag is set. SA_ERR_HPI_INVALID_CMD is returned when +** calling this function for a write-only control. +** +** It is legal for both the CtrlMode parameter and the CtrlState parameter to +** be NULL. In this case, no data is returned other than the return code. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiControlGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiCtrlNumT CtrlNum, + SAHPI_OUT SaHpiCtrlModeT *CtrlMode, + SAHPI_INOUT SaHpiCtrlStateT *CtrlState +); + +/******************************************************************************* +** +** Name: saHpiControlSet() +** +** Description: +** This function is used for setting the state and/or mode of the specified +** control object. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** CtrlNum - [in] Control number for which the state and/or mode is being set. +** CtrlMode - [in] The mode to set on the control. +** CtrlState - [in] Pointer to a control state data structure holding the +** state to be set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** controls, as indicated by the SAHPI_CAPABILITY_CONTROL in the +** resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the control is not present. +** SA_ERR_HPI_INVALID_DATA is returned when the: +** * CtrlState->Type field is not the correct type for the control +** identified by the CtrlNum parameter. +** * CtrlState->StateUnion.Analog is out of range of the control record's +** analog Min and Max values. +** * CtrlState->StateUnion.Text.Text.DataLength, combined with the +** CtrlState->StateUnion.Text.Line, overflows the remaining text +** control space. +** * CtrlState->StateUnion.Text.Text.DataType is not set to the DataType +** specified in the RDR. +** * DataType specified in the RDR is SAHPI_TL_TYPE_UNICODE or +** SAHPI_TL_TYPE_TEXT and CtrlState->StateUnion.Text.Text.Language is +** not set to the Language specified in the RDR. +** * OEM control data is invalid (see remarks below). +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * CtrlMode is not one of the valid enumerated values for this type. +** * CtrlMode parameter is not SAHPI_CTRL_MODE_AUTO and the CtrlState +** pointer is passed in as NULL. +** * CtrlState->StateUnion.Digital is not one of the valid enumerated +** values for this type. +** * CtrlState->StateUnion.Stream.StreamLength is bigger than +** SAHPI_CTRL_MAX_STREAM_LENGTH. +** * SaHpiTextBufferT structure passed as CtrlState->StateUnion.Text.Text +** contains text characters that are not allowed according to the value +** of CtrlState->StateUnion.Text.Text.DataType. +** SA_ERR_HPI_INVALID_REQUEST is returned when SAHPI_CTRL_STATE_PULSE_ON is +** issued to a digital control, which is ON (in either manual or auto +** mode). It is also returned when SAHPI_CTRL_STATE_PULSE_OFF is issued +** to a digital control, which is OFF (in either manual or auto mode). +** SA_ERR_HPI_READ_ONLY is returned when attempting to change the mode of a +** control with a read-only mode. +** +** Remarks: +** When the mode is set to SAHPI_CTRL_MODE_AUTO, the state input is ignored. +** Ignored state inputs are not checked by the implementation. +** +** The CtrlState parameter must be of the correct type for the specified +** control. +** +** If the CtrlMode parameter is set to SAHPI_CTRL_MODE_AUTO, then the +** CtrlState parameter is not evaluated, and may be set to any value by an +** HPI User, including a NULL pointer. Text controls include a line number +** and a line of text in the CtrlState parameter, allowing update of just a +** single line of a text control. The first line of the text control is line +** number "1". If less than a full line of data is written, the control will +** clear all spaces beyond those written on the line. Thus writing a +** zero-length string will clear the addressed line. It is also possible to +** include more characters in the text passed in the CtrlState structure than +** will fit on one line; in this case, the control will wrap to the next line +** (still clearing the trailing characters on the last line written). Thus, +** there are two ways to write multiple lines to a text control: (a) call +** saHpiControlSet() repeatedly for each line, or (b) call saHpiControlSet() +** once and send more characters than will fit on one line. An HPI User +** should not assume any "cursor positioning" characters are available to +** use, but rather should always write full lines and allow "wrapping" to +** occur. When calling saHpiControlSet() for a text control, an HPI User may +** set the line number to SAHPI_TLN_ALL_LINES; in this case, the entire +** control will be cleared, and the data will be written starting on line 1. +** (This is different from simply writing at line 1, which only alters the +** lines written to.) +** +** This feature may be used to clear the entire control, which can be +** accomplished by setting: +** CtrlState->StateUnion.Text.Line = SAHPI_TLN_ALL_LINES; +** CtrlState->StateUnion.Text.Text.DataLength = 0; +** +** Note that the number of lines and columns in a text control can be +** obtained from the control's RDR. +** +** The ManufacturerId (MId) field of an OEM control is ignored by the +** implementation when calling saHpiControlSet(). +** +** On an OEM control, it is up to the implementation to determine what is +** invalid data, and to return the specified error code. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiControlSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiCtrlNumT CtrlNum, + SAHPI_IN SaHpiCtrlModeT CtrlMode, + SAHPI_IN SaHpiCtrlStateT *CtrlState +); + +/******************************************************************************* +** +** Name: saHpiIdrInfoGet() +** +** Description: +** This function returns the Inventory Data Repository information including +** the number of areas contained within the IDR and the update counter. The +** Inventory Data Repository is associated with a specific entity. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** IdrId - [in] Identifier for the Inventory Data Repository. +** IdrInfo - [out] Pointer to the information describing the requested +** Inventory Data Repository. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support an +** inventory data repository, as indicated by +** SAHPI_CAPABILITY_INVENTORY_DATA in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the IDR is not present. +** SA_ERR_HPI_INVALID_PARAMS is returned if the IdrInfo pointer is passed in +** as NULL. +** +** Remarks: +** The update counter provides a means for insuring that no additions or +** changes are missed when retrieving the IDR data. In order to use this +** feature, an HPI User should invoke the saHpiIdrInfoGet(), and retrieve the +** update counter value before retrieving the first Area. After retrieving +** all Areas and Fields of the IDR, an HPI User should again invoke the +** saHpiIdrInfoGet() to get the update counter value. If the update counter +** value has not been incremented, no modification or additions were made to +** the IDR during data retrieval. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiIdrInfoGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiIdrIdT IdrId, + SAHPI_OUT SaHpiIdrInfoT *IdrInfo +); + +/******************************************************************************* +** +** Name: saHpiIdrAreaHeaderGet() +** +** Description: +** This function returns the Inventory Data Area header information for a +** specific area associated with a particular Inventory Data Repository. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** IdrId - [in] Identifier for the Inventory Data Repository. +** AreaType - [in] Type of Inventory Data Area. +** AreaId - [in] Identifier of Area entry to retrieve from the IDR. Reserved +** AreaId values: +** * SAHPI_FIRST_ENTRY Get first entry. +** * SAHPI_LAST_ENTRY Reserved as a delimiter for end of list. Not a +** valid AreaId. +** NextAreaId - [out] Pointer to location to store the AreaId of next area of +** the requested type within the IDR. +** Header - [out] Pointer to Inventory Data Area Header into which the header +** information will be placed. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support an +** inventory data repository, as indicated by +** SAHPI_CAPABILITY_INVENTORY_DATA in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the: +** * IDR is not present. +** * AreaType parameter is set to SAHPI_IDR_AREATYPE_UNSPECIFIED, and the +** area specified by the AreaId parameter does not exist in the IDR. +** * AreaType parameter is set to a specific area type, but an area +** matching both the AreaId parameter and AreaType parameter does not +** exist. +** SA_ERR_HPI_INVALID_PARAMS is returned if: +** * AreaType is not one of the valid enumerated values for this type. +** * The AreaId is an invalid reserved value such as SAHPI_LAST_ENTRY. +** * The NextAreaId pointer is passed in as NULL. +** * The Header pointer is passed in as NULL. +** +** Remarks: +** This function allows retrieval of an Inventory Data Area Header by one of +** two ways: by AreaId regardless of type or by AreaType and AreaId. +** +** To retrieve all areas contained within an IDR, set the AreaType parameter +** to SAHPI_IDR_AREATYPE_UNSPECIFIED, and set the AreaId parameter to +** SAHPI_FIRST_ENTRY for the first call. For each subsequent call, set the +** AreaId parameter to the value returned in the NextAreaId parameter. +** Continue calling this function until the NextAreaId parameter contains the +** value SAHPI_LAST_ENTRY. +** +** To retrieve areas of specific type within an IDR, set the AreaType +** parameter to a valid AreaType enumeration. Use the AreaId parameter in +** the same manner described above to retrieve all areas of the specified +** type. Set the AreaId parameter to SAHPI_FIRST_ENTRY to retrieve the first +** area of that type. Use the value returned in NextAreaId to retrieve the +** remaining areas of that type until SAHPI_LAST_ENTRY is returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiIdrAreaHeaderGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiIdrIdT IdrId, + SAHPI_IN SaHpiIdrAreaTypeT AreaType, + SAHPI_IN SaHpiEntryIdT AreaId, + SAHPI_OUT SaHpiEntryIdT *NextAreaId, + SAHPI_OUT SaHpiIdrAreaHeaderT *Header +); + +/******************************************************************************* +** +** Name: saHpiIdrAreaAdd() +** +** Description: +** This function is used to add an Area to the specified Inventory Data +** Repository. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** IdrId - [in] Identifier for the Inventory Data Repository. +** AreaType - [in] Type of Area to add. +** AreaId- [out] Pointer to location to store the AreaId of the newly created +** area. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support an +** inventory data repository, as indicated by +** SAHPI_CAPABILITY_INVENTORY_DATA in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the IDR is not present. +** SA_ERR_HPI_INVALID_DATA is returned when attempting to add an area with an +** AreaType of SAHPI_IDR_AREATYPE_UNSPECIFIED or when adding an area that +** does not meet the implementation-specific restrictions. +** SA_ERR_HPI_OUT_OF_SPACE is returned if the IDR does not have enough free +** space to allow the addition of the area. +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * AreaId pointer is passed in as NULL. +** * AreaType is not one of the valid enumerated values for this type. +** SA_ERR_HPI_READ_ONLY is returned if the IDR is read-only and does not +** allow the addition of the area. +** +** Remarks: +** On successful completion, the AreaId parameter will contain the AreaId of +** the newly created area. +** +** On successful completion, the ReadOnly element in the new Area's header +** will always be False. +** +** SAHPI_IDR_AREATYPE_UNSPECIFIED is not a valid area type, and should not be +** used with this function. If SAHPI_IDR_AREATYPE_UNSPECIFIED is specified +** as the area type, an error code of SA_ERR_HPI_INVALID_DATA is returned. +** This area type is only valid when used with the saHpiIdrAreaHeaderGet() +** function to retrieve areas of an unspecified type. +** +** Some implementations may restrict the types of areas that may be added. +** These restrictions should be documented. SA_ERR_HPI_INVALID_DATA is +** returned when attempting to add an invalid area type. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiIdrAreaAdd( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiIdrIdT IdrId, + SAHPI_IN SaHpiIdrAreaTypeT AreaType, + SAHPI_OUT SaHpiEntryIdT *AreaId +); + +/******************************************************************************* +** +** Name: saHpiIdrAreaDelete() +** +** Description: +** This function is used to delete an Inventory Data Area, including the Area +** header and all fields contained with the area, from a particular Inventory +** Data Repository. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** IdrId - [in] Identifier for the Inventory Data Repository. +** AreaId - [in] Identifier of Area entry to delete from the IDR. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support an +** inventory data repository, as indicated by +** SAHPI_CAPABILITY_INVENTORY_DATA in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the: +** * IDR is not present. +** * Area identified by the AreaId parameter does not exist within the IDR. +** SA_ERR_HPI_INVALID_PARAMS is returned when the AreaId is an invalid +** reserved value such as SAHPI_LAST_ENTRY. +** SA_ERR_HPI_READ_ONLY is returned if the: +** * IDA is read-only and therefore cannot be deleted. +** * IDA contains a read-only Field and therefore cannot be deleted. +** * IDR is read-only as deletions are not permitted for an area from a +** read-only IDR. +** +** Remarks: +** Deleting an Inventory Data Area also deletes all fields contained within +** the area. +** +** In some implementations, certain Areas are intrinsically read-only. The +** ReadOnly flag, in the area header, indicates if the Area is read-only. +** +** If the Inventory Data Area is not read-only, but contains a Field that is +** read-only, the Area cannot be deleted. An attempt to delete an Area that +** contains a read-only Field will return an error. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiIdrAreaDelete( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiIdrIdT IdrId, + SAHPI_IN SaHpiEntryIdT AreaId +); + +/******************************************************************************* +** +** Name: saHpiIdrFieldGet() +** +** Description: +** This function returns the Inventory Data Field information from a +** particular Inventory Data Area and Repository. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** IdrId - [in] Identifier for the Inventory Data Repository. +** AreaId - [in] Area identifier for the IDA. +** FieldType - [in] Type of Inventory Data Field. +** FieldId - [in] Identifier of Field to retrieve from the IDA. Reserved +** FieldId values: +** * SAHPI_FIRST_ENTRY Get first entry. +** * SAHPI_LAST_ENTRY Reserved as a delimiter for end of list. Not +** a valid FieldId. +** NextFieldId - [out] Pointer to location to store the FieldId of next field +** of the requested type in the IDA. +** Field - [out] Pointer to Inventory Data Field into which the field +** information will be placed. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support an +** inventory data repository, as indicated by +** SAHPI_CAPABILITY_INVENTORY_DATA in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the: +** * IDR is not present. +** * Area identified by AreaId is not present. +** * FieldType parameter is set to SAHPI_IDR_FIELDTYPE_UNSPECIFIED, and +** the field specified by the FieldId parameter does not exist in the +** IDA. +** * FieldType parameter is set to a specific field type, but a field +** matching both the FieldId parameter and FieldType parameter does not +** exist. +** SA_ERR_HPI_INVALID_PARAMS is returned if: +** * FieldType is not one of the valid enumerated values for this type. +** * The AreaId or FieldId is an invalid reserved value such as +** SAHPI_LAST_ENTRY. +** * The NextFieldId pointer is passed in as NULL. +** * The Field pointer is passed in as NULL. +** +** Remarks: +** This function allows retrieval of an Inventory Data Field by one of two +** ways: by FieldId regardless of type or by FieldType and FieldId. +** +** To retrieve all fields contained within an IDA, set the FieldType parameter +** to SAHPI_IDR_FIELDTYPE_UNSPECIFIED, and set the FieldId parameter to +** SAHPI_FIRST_ENTRY for the first call. For each subsequent call, set the +** FieldId parameter to the value returned in the NextFieldId parameter. +** Continue calling this function until the NextFieldId parameter contains the +** value SAHPI_LAST_ENTRY. +** +** To retrieve fields of a specific type within an IDA, set the FieldType +** parameter to a valid Field type enumeration. Use the FieldId parameter in +** the same manner described above to retrieve all fields of the specified +** type. Set the FieldId parameter to SAHPI_FIRST_ENTRY to retrieve the first +** field of that type. Use the value returned in NextFieldId to retrieve the +** remaining fields of that type until SAHPI_LAST_ENTRY is returned. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiIdrFieldGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiIdrIdT IdrId, + SAHPI_IN SaHpiEntryIdT AreaId, + SAHPI_IN SaHpiIdrFieldTypeT FieldType, + SAHPI_IN SaHpiEntryIdT FieldId, + SAHPI_OUT SaHpiEntryIdT *NextFieldId, + SAHPI_OUT SaHpiIdrFieldT *Field +); + +/******************************************************************************* +** +** Name: saHpiIdrFieldAdd() +** +** Description: +** This function is used to add a field to the specified Inventory Data Area +** with a specific Inventory Data Repository. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** IdrId - [in] Identifier for the Inventory Data Repository. +** Field - [in/out] Pointer to Inventory Data Field, which contains the new +** field information to add to the IDA. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support an +** inventory data repository, as indicated by +** SAHPI_CAPABILITY_INVENTORY_DATA in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the: +** * IDR is not present. +** * Area identified by Field?AreaId does not exist within the IDR. +** SA_ERR_HPI_INVALID_DATA is returned if the Field data is incorrectly +** formatted or does not meet the restrictions for the implementation. +** SA_ERR_HPI_OUT_OF_SPACE is returned if the IDR does not have enough free +** space to allow the addition of the field. +** SA_ERR_HPI_READ_ONLY is returned if the: +** * Area identified by Field?AreaId is read-only and does not allow +** modification to its fields. +** * IDR is identified by IdrId, is read-only, and does not allow +** modification to its fields. +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * The Field type is not one of the valid field type enumerated values. +** * Field type, Field?Type, is set to SAHPI_IDR_FIELDTYPE_UNSPECIFIED. +** * SaHpiTextBufferT structure passed as part of the Field parameter is +** not valid. This occurs when: +** * The DataType is not one of the enumerated values for that type, or +** * The data field contains characters that are not legal according to +** the value of DataType, or +** * The Language is not one of the enumerated values for that type +** when the DataType is SAHPI_TL_TYPE_UNICODE or SAHPI_TL_TYPE_TEXT. +** * Field pointer is passed in as NULL. +** +** Remarks: +** The FieldId element within the Field parameter is not used by this +** function. Instead, on successful completion, the FieldId field is set to +** the new value associated with the added Field. +** +** The ReadOnly element in the Field parameter is not used by this function. +** On successful completion, the ReadOnly element in the new Field will +** always be False. +** +** Addition of a read-only Inventory Data Field is not allowed; therefore the +** ReadOnly element in the SaHpiIdrFieldT parameter is ignored. +** +** SAHPI_IDR_FIELDTYPE_UNSPECIFIED is not a valid field type, and should not +** be used with this function. If SAHPI_IDR_FIELDTYPE_UNSPECIFIED is +** specified as the field type, an error code of SA_ERR_HPI_INVALID_DATA is +** returned. This field type is only valid when used with the +** saHpiIdrFieldGet() function to retrieve fields of an unspecified type. +** +** Some implementations have restrictions on what fields are valid in specific +** areas and/or the data format of some fields. These restrictions should be +** documented. SA_ERR_HPI_INVALID_DATA is returned when the field type or +** field data does not meet the implementation-specific restrictions. +** +** The AreaId element within the Field parameter identifies the specific IDA +** into which the new field is added. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiIdrFieldAdd( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiIdrIdT IdrId, + SAHPI_INOUT SaHpiIdrFieldT *Field +); + +/******************************************************************************* +** +** Name: saHpiIdrFieldSet() +** +** Description: +** This function is used to update an Inventory Data Field for a particular +** Inventory Data Area and Repository. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** IdrId - [in] Identifier for the Inventory Data Repository. +** Field - [in] Pointer to Inventory Data Field, which contains the updated +** field information. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support an +** inventory data repository, as indicated by +** SAHPI_CAPABILITY_INVENTORY_DATA in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the: +** * IDR is not present. +** * Area identified by Field?AreaId does not exist within the IDR or if +** the Field does not exist within the Inventory Data Area. +** SA_ERR_HPI_INVALID_PARAMS is returned if the: +** * Field pointer is passed in as NULL. +** * Field type, Field?Type, is not set to one of the valid field type +** enumerated values. +** * Field type, Field?Type, is set to SAHPI_IDR_FIELDTYPE_UNSPECIFIED. +** SA_ERR_HPI_INVALID_DATA is returned if the field data is incorrectly +** formatted or does not meet the restrictions for the implementation. +** SA_ERR_HPI_OUT_OF_SPACE is returned if the IDR does not have enough free +** space to allow the modification of the field due to an increase in the +** field size. +** SA_ERR_HPI_READ_ONLY is returned if the: +** * Field is read-only and does not allow modifications. +** * Area is read-only and does not allow modifications to its fields. +** * IDR is read-only and does not allow modifications to its fields. +** SA_ERR_HPI_INVALID_PARAMS is returned if the SaHpiTextBufferT structure +** passed as part of the Field parameter is not valid. This occurs when: +** * The DataType is not one of the enumerated values for that type, or +** * The data field contains characters that are not legal according to +** the value of DataType, or +** * The Language is not one of the enumerated values for that type when +** the DataType is SAHPI_TL_TYPE_UNICODE or SAHPI_TL_TYPE_TEXT. +** +** Remarks: +** This function allows modification of both the FieldType and Field data of +** a given Inventory Data Field. This function does not allow modification of +** the read-only attribute of the Inventory Data Field; therefore after a +** successful update, the ReadOnly element in the updated Field will always be +** False. The input value for ReadOnly is ignored. +** +** SAHPI_IDR_FIELDTYPE_UNSPECIFIED is not a valid field type, and should not +** be used with this function. If SAHPI_IDR_FIELDTYPE_UNSPECIFIED is +** specified as the new field type, an error code of SA_ERR_HPI_INVALID_DATA +** is returned. This field type is only valid when used with the +** saHpiIdrFieldGet() function to retrieve fields of an unspecified type. +** +** Some implementations have restrictions on what fields are valid in specific +** areas and/or the data format of some fields. These restrictions should be +** documented. SA_ERR_HPI_INVALID_DATA is returned when the field type or +** field data does not meet the implementation-specific restrictions. +** +** In some implementations, certain Fields are intrinsically read-only. The +** ReadOnly flag, in the field structure, indicates if the Field is read-only. +** +** The Field to update is identified by the AreaId and FieldId elements within +** the Field parameter. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiIdrFieldSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiIdrIdT IdrId, + SAHPI_IN SaHpiIdrFieldT *Field +); + +/******************************************************************************* +** +** Name: saHpiIdrFieldDelete() +** +** Description: +** This function is used to delete an Inventory Data Field from a particular +** Inventory Data Area and Repository. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** IdrId - [in] Identifier for the Inventory Data Repository. +** AreaId - [in] Area identifier for the IDA. +** FieldId - [in] Identifier of Field to delete from the IDA. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support an +** inventory data repository, as indicated by +** SAHPI_CAPABILITY_INVENTORY_DATA in the resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the: +** * IDR is not present. +** * Area identified by the AreaId parameter does not exist within the IDR, +** or if the Field identified by the FieldId parameter does not exist +** within the IDA. +** SA_ERR_HPI_READ_ONLY is returned if the field, the IDA, or the IDR is +** read-only and does not allow deletion. +** SA_ERR_HPI_INVALID_PARAMS is returned when the AreaId or FieldId is an +** invalid reserved value such as SAHPI_LAST_ENTRY. +** +** Remarks: +** In some implementations, certain fields are intrinsically read-only. The +** ReadOnly flag, in the field structure, indicates if the field is read-only. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiIdrFieldDelete( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiIdrIdT IdrId, + SAHPI_IN SaHpiEntryIdT AreaId, + SAHPI_IN SaHpiEntryIdT FieldId +); + +/******************************************************************************* +** +** Name: saHpiWatchdogTimerGet() +** +** Description: +** This function retrieves the current watchdog timer settings and +** configuration. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** WatchdogNum - [in] Watchdog number that specifies the watchdog timer on a +** resource. +** Watchdog - [out] Pointer to watchdog data structure. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support a +** watchdog timer, as indicated by SAHPI_CAPABILITY_WATCHDOG in the +** resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the WatchdogNum is not present. +** SA_ERR_HPI_INVALID_PARAMS is returned when the Watchdog pointer is passed +** in as NULL. +** +** Remarks: +** See the description of the SaHpiWatchdogT structure in Section 8.11 on +** page 180 for details on what information is returned by this function. +** +** When the watchdog action is SAHPI_WA_RESET, the type of reset (warm or +** cold) is implementation-dependent. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiWatchdogTimerGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiWatchdogNumT WatchdogNum, + SAHPI_OUT SaHpiWatchdogT *Watchdog +); + +/******************************************************************************* +** +** Name: saHpiWatchdogTimerSet() +** +** Description: +** This function provides a method for initializing the watchdog timer +** configuration. +** +** Once the appropriate configuration has been set using +** saHpiWatchdogTimerSet(), an HPI User must then call +** saHpiWatchdogTimerReset() to initially start the watchdog timer, unless +** the watchdog timer was already running prior to calling +** saHpiWatchdogTimerSet() and the Running field in the passed Watchdog +** structure is True. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** WatchdogNum - [in] The watchdog number specifying the specific watchdog +** timer on a resource. +** Watchdog - [in] Pointer to watchdog data structure. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support a +** watchdog timer, as indicated by SAHPI_CAPABILITY_WATCHDOG in the +** resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the WatchdogNum is not present. +** SA_ERR_HPI_INVALID_PARAMS is returned when the: +** * Watchdog->TimerUse is not one of the valid enumerated values for this +** type. +** * Watchdog->TimerAction is not one of the valid enumerated values for +** this type. +** * Watchdog->PretimerInterrupt is not one of the valid enumerated values +** for this type. +** * Watchdog pointer is passed in as NULL. +** SA_ERR_HPI_INVALID_DATA is returned when the: +** * Watchdog->PreTimeoutInterval is outside the acceptable range for the +** implementation. +** * Watchdog->InitialCount is outside the acceptable range for the +** implementation. +** * Value of Watchdog->PreTimeoutInterval is greater than the value of +** Watchdog->InitialCount. +** * Watchdog->PretimerInterrupt is set to an unsupported value. See +** remarks. +** * Watchdog->TimerAction is set to an unsupported value. See remarks. +** * Watchdog->TimerUse is set to an unsupported value. See remarks. +** +** Remarks: +** Configuring the watchdog timer with the saHpiWatchdogTimerSet() function +** does not start the timer running. If the timer was previously stopped +** when this function is called, then it will remain stopped, and must be +** started by calling saHpiWatchdogTimerReset(). If the timer was previously +** running, then it will continue to run if the Watchdog->Running field passed +** is True, or will be stopped if the Watchdog->Running field passed is False. +** If it continues to run, it will restart its count-down from the newly +** configured initial count value. +** +** If the initial counter value is set to 0, then any configured pre-timer +** interrupt action or watchdog timer expiration action will be taken +** immediately when the watchdog timer is started. This provides a mechanism +** for software to force an immediate recovery action should that be dependent +** on a Watchdog timeout occurring. +** +** See the description of the SaHpiWatchdogT structure for more details on the +** effects of this command related to specific data passed in that structure. +** +** Some implementations impose a limit on the acceptable ranges for the +** PreTimeoutInterval or InitialCount. These limitations must be documented. +** SA_ERR_HPI_INVALID_DATA is returned if an attempt is made to set a value +** outside of the supported range. +** +** Some implementations cannot accept all of the enumerated values for +** TimerUse, TimerAction, or PretimerInterrupt. These restrictions should be +** documented. SA_ERR_HPI_INVALID_DATA is returned if an attempt is made to +** select an unsupported option. +** +** When the watchdog action is set to SAHPI_WA_RESET, the type of reset (warm +** or cold) is implementation-dependent. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiWatchdogTimerSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiWatchdogNumT WatchdogNum, + SAHPI_IN SaHpiWatchdogT *Watchdog +); + +/******************************************************************************* +** +** Name: saHpiWatchdogTimerReset() +** +** Description: +** This function provides a method to start or restart the watchdog timer from +** the initial countdown value. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** WatchdogNum - [in] The watchdog number specifying the specific watchdog +** timer on a resource. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support a +** watchdog timer, as indicated by SAHPI_CAPABILITY_WATCHDOG in the +** resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the WatchdogNum is not present. +** SA_ERR_HPI_INVALID_REQUEST is returned if the current watchdog state does +** not allow a reset. +** +** Remarks: +** If the Watchdog has been configured to issue a Pre-Timeout interrupt, and +** that interrupt has already occurred, the saHpiWatchdogTimerReset() function +** will not reset the watchdog counter. The only way to stop a Watchdog from +** timing out once a Pre-Timeout interrupt has occurred is to use the +** saHpiWatchdogTimerSet() function to reset and/or stop the timer. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiWatchdogTimerReset ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiWatchdogNumT WatchdogNum +); + +/******************************************************************************* +** +** Name: saHpiAnnunciatorGetNext() +** +** Description: +** This function allows retrieval of an announcement from the current set of +** announcements held in the Annunciator. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** AnnunciatorNum - [in] Annunciator number for the addressed Annunciator. +** Severity - [in] Severity level of announcements to retrieve. Set to +** SAHPI_ALL_SEVERITIES to retrieve announcement of any severity; +** otherwise, set to requested severity level. +** UnacknowledgedOnly - [in] Set to True to indicate only unacknowledged +** announcements should be returned. Set to False to indicate either an +** acknowledged or unacknowledged announcement may be returned. +** Announcement - [in/out] Pointer to the structure to hold the returned +** announcement. Also, on input, Announcement->EntryId and +** Announcement->Timestamp are used to identify the "previous" +** announcement. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** Annunciators, as indicated by SAHPI_CAPABILITY_ANNUNCIATOR in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned when Severity is not one of the +** valid enumerated values for this type. +** SA_ERR_HPI_NOT_PRESENT is returned if: +** * The AnnunciatorNum passed does not address a valid Annunciator +** supported by the resource. +** * There are no announcements (or no unacknowledged announcements if +** UnacknowledgedOnly is True) that meet the specified Severity in the +** current set after the announcement identified by +** Announcement->EntryId and Announcement->Timestamp. +** * There are no announcements (or no unacknowledged announcements if +** UnacknowledgedOnly is True) that meet the specified Severity in the +** current set if the passed Announcement->EntryId field was set to +** SAHPI_FIRST_ENTRY. +** SA_ERR_HPI_INVALID_PARAMS is returned when the Announcement parameter is +** passed in as NULL. +** SA_ERR_HPI_INVALID_DATA is returned if the passed Announcement->EntryId +** matches an announcement in the current set, but the passed +** Announcement->Timestamp does not match the timestamp of that announcement. +** +** Remarks: +** All announcements contained in the set are maintained in the order in which +** they were added. This function will return the next announcement meeting +** the specifications given by an HPI User that was added to the set after the +** announcement whose EntryId and timestamp is passed by an HPI User. If +** SAHPI_FIRST_ENTRY is passed as the EntryId, the first announcement in the +** set meeting the specifications given by an HPI User is returned. This +** function should operate even if the announcement associated with the +** EntryId and Timestamp passed by an HPI User has been deleted. +** +** Selection can be restricted to only announcements of a specified severity, +** and/or only unacknowledged announcements. To retrieve all announcements +** contained meeting specific requirements, call saHpiAnnunciatorGetNext() +** with the Status->EntryId field set to SAHPI_FIRST_ENTRY and the Severity +** and UnacknowledgedOnly parameters set to select what announcements should +** be returned. Then, repeatedly call saHpiAnnunciatorGetNext() passing the +** previously returned announcement as the Announcement parameter, and the +** same values for Severity and UnacknowledgedOnly until the function returns +** with the error code SA_ERR_HPI_NOT_PRESENT. +** +** SAHPI_FIRST_ENTRY and SAHPI_LAST_ENTRY are reserved EntryId values, and +** will never be assigned to an announcement. +** +** The elements EntryId and Timestamp are used in the Announcement parameter +** to identify the "previous" announcement; the next announcement added to the +** table after this announcement that meets the Severity and +** UnacknowledgedOnly requirements will be returned. Announcement->EntryId +** may be set to SAHPI_FIRST_ENTRY to select the first announcement in the +** current set meeting the Severity and UnacknowledgedOnly requirements. If +** Announcement->EntryId is SAHPI_FIRST_ENTRY, then Announcement->Timestamp +** is ignored. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAnnunciatorGetNext( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiAnnunciatorNumT AnnunciatorNum, + SAHPI_IN SaHpiSeverityT Severity, + SAHPI_IN SaHpiBoolT UnacknowledgedOnly, + SAHPI_INOUT SaHpiAnnouncementT *Announcement +); + +/******************************************************************************* +** +** Name: saHpiAnnunciatorGet() +** +** Description: +** This function allows retrieval of a specific announcement in the +** Annunciator's current set by referencing its EntryId. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained +** using saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** AnnunciatorNum - [in] Annunciator number for the addressed Annunciator. +** EntryId - [in] Identifier of the announcement to retrieve from the +** Annunciator. +** Announcement - [out] Pointer to the structure to hold the returned +** announcement. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** Annunciators, as indicated by SAHPI_CAPABILITY_ANNUNCIATOR in the +** resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if: +** * The AnnunciatorNum passed does not address a valid Annunciator +** supported by the resource. +** * The requested EntryId does not correspond to an announcement +** contained in the Annunciator. +** SA_ERR_HPI_INVALID_PARAMS is returned when the Announcement parameter is +** passed in as NULL. +** +** Remarks: +** SAHPI_FIRST_ENTRY and SAHPI_LAST_ENTRY are reserved EntryId values, and +** will never be assigned to announcements. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAnnunciatorGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiAnnunciatorNumT AnnunciatorNum, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiAnnouncementT *Announcement +); + +/******************************************************************************* +** +** Name: saHpiAnnunciatorAcknowledge() +** +** Description: +** This function allows an HPI User to acknowledge a single announcement or a +** group of announcements by severity. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** AnnunciatorNum - [in] Annunciator number for the addressed Annunciator. +** EntryId - [in] Entry identifier of the announcement to acknowledge. +** Reserved EntryId values: +** * SAHPI_ENTRY_UNSPECIFIED Ignore this parameter. +** Severity - [in] Severity level of announcements to acknowledge. Ignored +** unless EntryId is SAHPI_ENTRY_UNSPECIFIED. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** Annunciators, as indicated by SAHPI_CAPABILITY_ANNUNCIATOR in the +** resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if: +** * The AnnunciatorNum passed does not address a valid Annunciator +** supported by the resource. +** * An announcement identified by the EntryId parameter does not exist in +** the current set. +** SA_ERR_HPI_INVALID_PARAMS is returned if EntryId is SAHPI_ENTRY_UNSPECIFIED +** and Severity is not one of the valid enumerated values for this type. +** +** Remarks: +** Announcements are acknowledged by one of two ways: a single announcement +** by EntryId regardless of severity or as a group of announcements by +** severity regardless of EntryId. +** +** An HPI User acknowledges an announcement to influence the platform-specific +** annunciation provided by the Annunciator management instrument. +** +** An acknowledged announcement will have the Acknowledged field set to True. +** +** To acknowledge all announcements contained within the current set, set the +** Severity parameter to SAHPI_ALL_SEVERITIES, and set the EntryId parameter +** to SAHPI_ENTRY_UNSPECIFIED. +** +** To acknowledge all announcements of a specific severity, set the Severity +** parameter to the appropriate value, and set the EntryId parameter to +** SAHPI_ENTRY_UNSPECIFIED. +** +** To acknowledge a single announcement, set the EntryId parameter to a value +** other than SAHPI_ENTRY_UNSPECIFIED. The EntryId must be a valid identifier +** for an announcement present in the current set. +** +** If an announcement has been previously acknowledged, acknowledging it again +** has no effect. However, this is not an error. +** +** If the EntryId parameter has a value other than SAHPI_ENTRY_UNSPECIFIED, +** the Severity parameter is ignored. +** +** If the EntryId parameter is passed as SAHPI_ENTRY_UNSPECIFIED, and no +** announcements are present that meet the requested Severity, this function +** will have no effect. However, this is not an error. +** +** SAHPI_ENTRY_UNSPECIFIED is defined as the same value as SAHPI_FIRST_ENTRY, +** so using either symbol will have the same effect. However, +** SAHPI_ENTRY_UNSPECIFIED should be used with this function for clarity. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAnnunciatorAcknowledge( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiAnnunciatorNumT AnnunciatorNum, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_IN SaHpiSeverityT Severity +); + +/******************************************************************************* +** +** Name: saHpiAnnunciatorAdd() +** +** Description: +** This function is used to add an announcement to the set of items held by an +** Annunciator management instrument. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** AnnunciatorNum - [in] Annunciator number for the addressed Annunciator. +** Announcement - [in/out] Pointer to structure that contains the new +** announcement to add to the set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** Annunciators, as indicated by SAHPI_CAPABILITY_ANNUNCIATOR in the +** resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the AnnunciatorNum passed does not +** address a valid Annunciator supported by the resource. +** SA_ERR_HPI_INVALID_PARAMS is returned when: +** * The Announcement pointer is passed in as NULL. +** * The Announcement->Severity passed is not valid. +** * The Announcement->StatusCond structure passed in is not valid. +** SA_ERR_HPI_OUT_OF_SPACE is returned if the Annunciator is not able to add +** an additional announcement due to resource limits. +** SA_ERR_HPI_READ_ONLY is returned if the Annunciator is in auto mode. +** +** Remarks: +** The EntryId, Timestamp, and AddedByUser fields within the Announcement +** parameter are not used by this function. Instead, on successful +** completion, these fields are set to new values associated with the added +** announcement. AddedByUser will always be set to True. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAnnunciatorAdd( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiAnnunciatorNumT AnnunciatorNum, + SAHPI_INOUT SaHpiAnnouncementT *Announcement +); + +/******************************************************************************* +** +** Name: saHpiAnnunciatorDelete() +** +** Description: +** This function allows an HPI User to delete a single announcement or a group +** of announcements from the current set of an Annunciator. Announcements may +** be deleted individually by specifying a specific EntryId, or they may be +** deleted as a group by specifying a severity. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** AnnunciatorNum - [in] Annunciator number for the addressed Annunciator. +** EntryId - [in] Entry identifier of the announcement to delete. Reserved +** EntryId values: +** * SAHPI_ENTRY_UNSPECIFIED Ignore this parameter. +** Severity - [in] Severity level of announcements to delete. Ignored unless +** EntryId is SAHPI_ENTRY_UNSPECIFIED. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** Annunciators, as indicated by SAHPI_CAPABILITY_ANNUNCIATOR in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned if EntryId is SAHPI_ENTRY_UNSPECIFIED +** and Severity is not one of the valid enumerated values for this type. +** SA_ERR_HPI_NOT_PRESENT is returned if: +** * The AnnunciatorNum passed does not address a valid Annunciator +** supported by the resource +** * An announcement identified by the EntryId parameter does not exist in +** the current set of the Annunciator. +** SA_ERR_HPI_READ_ONLY is returned if the Annunciator is in auto mode. +** +** Remarks: +** To delete a single, specific announcement, set the EntryId parameter to a +** value representing an actual announcement in the current set. The Severity +** parameter is ignored when the EntryId parameter is set to a value other +** than SAHPI_ENTRY_UNSPECIFIED. +** +** To delete a group of announcements, set the EntryId parameter to +** SAHPI_ENTRY_UNSPECIFIED, and set the Severity parameter to identify which +** severity of announcements should be deleted. To clear all announcements +** contained within the Annunciator, set the Severity parameter to +** SAHPI_ALL_SEVERITIES. +** +** If the EntryId parameter is passed as SAHPI_ENTRY_UNSPECIFIED, and no +** announcements are present that meet the specified Severity, this function +** will have no effect. However, this is not an error. +** +** SAHPI_ENTRY_UNSPECIFIED is defined as the same value as SAHPI_FIRST_ENTRY, +** so using either symbol will have the same effect. However, +** SAHPI_ENTRY_UNSPECIFIED should be used with this function for clarity. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAnnunciatorDelete( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiAnnunciatorNumT AnnunciatorNum, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_IN SaHpiSeverityT Severity +); + +/******************************************************************************* +** +** Name: saHpiAnnunciatorModeGet() +** +** Description: +** This function allows an HPI User to retrieve the current operating mode of +** an Annunciator. The mode indicates whether or not an HPI User is allowed to +** add or delete items in the set, and whether or not the HPI implementation +** will automatically add or delete items in the set. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** AnnunciatorNum - [in] Annunciator number for the addressed Annunciator. +** Mode - [out] Pointer to location to store the current operating mode of the +** Annunciator where the returned value will be one of the following: +** * SAHPI_ANNUNCIATOR_MODE_AUTO - the HPI implementation may add or delete +** announcements in the set; an HPI User may not add or delete +** announcements in the set. +** * SAHPI_ANNUNCIATOR_MODE_USER - the HPI implementation may not add or +** delete announcements in the set; an HPI User may add or delete +** announcements in the set. +** * SAHPI_ANNUNCIATOR_MODE_SHARED - both the HPI implementation and an HPI +** User may add or delete announcements in the set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** Annunciators, as indicated by SAHPI_CAPABILITY_ANNUNCIATOR in the +** resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the AnnunciatorNum passed does not +** address a valid Annunciator supported by the resource. +** SA_ERR_HPI_INVALID_PARAMS is returned if Mode is passed in as NULL. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAnnunciatorModeGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiAnnunciatorNumT AnnunciatorNum, + SAHPI_OUT SaHpiAnnunciatorModeT *Mode +); + +/******************************************************************************* +** +** Name: saHpiAnnunciatorModeSet() +** +** Description: +** This function allows an HPI User to change the current operating mode of an +** Annunciator. The mode indicates whether or not an HPI User is allowed to +** add or delete announcements in the set, and whether or not the HPI +** implementation will automatically add or delete announcements in the set. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** AnnunciatorNum - [in] Annunciator number for the addressed Annunciator. +** Mode - [out] Mode to set for the Annunciator: +** * SAHPI_ANNUNCIATOR_MODE_AUTO - the HPI implementation may add or delete +** announcements in the set; an HPI User may not add or delete +** announcements in the set. +** * SAHPI_ANNUNCIATOR_MODE_USER - the HPI implementation may not add or +** delete announcements in the set; an HPI User may add or delete +** announcements in the set. +** * SAHPI_ANNUNCIATOR_MODE_SHARED - both the HPI implementation and an HPI +** User may add or delete announcements in the set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** Annunciators, as indicated by SAHPI_CAPABILITY_ANNUNCIATOR in the +** resource's RPT entry. +** SA_ERR_HPI_NOT_PRESENT is returned if the AnnunciatorNum passed does not +** address a valid Annunciator supported by the resource. +** SA_ERR_HPI_INVALID_PARAMS is returned if Mode is not a valid enumerated +** value for this type. +** SA_ERR_HPI_READ_ONLY is returned if mode changing is not permitted for +** this Annunciator. +** +** Remarks: +** None. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAnnunciatorModeSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiAnnunciatorNumT AnnunciatorNum, + SAHPI_IN SaHpiAnnunciatorModeT Mode +); + +/******************************************************************************* +** +** Name: saHpiHotSwapPolicyCancel() +** +** Description: +** A resource supporting hot swap typically supports default policies for +** insertion and extraction. On insertion, the default policy may be for the +** resource to turn the associated FRU's local power on and to de-assert +** reset. On extraction, the default policy may be for the resource to +** immediately power off the FRU and turn on a hot swap indicator. This +** function allows an HPI User, after receiving a hot swap event with +** HotSwapState equal to SAHPI_HS_STATE_INSERTION_PENDING or +** SAHPI_HS_STATE_EXTRACTION_PENDING, to prevent the default policy from +** being executed. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** managed hot swap, as indicated by SAHPI_CAPABILITY_MANAGED_HOTSWAP in +** the resource's RPT entry. +** SA_ERR_HPI_INVALID_REQUEST is returned if the resource is: +** * Not in the INSERTION PENDING or EXTRACTION PENDING state. +** * Processing an auto-insertion or auto-extraction policy. +** +** Remarks: +** Each time the resource transitions to either the INSERTION PENDING or +** EXTRACTION PENDING state, the default policies will execute after the +** configured timeout period, unless cancelled using +** saHpiHotSwapPolicyCancel() after the transition to INSERTION PENDING or +** EXTRACTION PENDING state and before the timeout expires.The default policy +** cannot be canceled once it has begun to execute. +** +** Because a resource that supports the simplified hot swap model will never +** transition into INSERTION PENDING or EXTRACTION PENDING states, this +** function is not applicable to those resources. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapPolicyCancel ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + +/******************************************************************************* +** +** Name: saHpiResourceActiveSet() +** +** Description: +** This function allows an HPI User to request a resource to transition to the +** ACTIVE state from the INSERTION PENDING or EXTRACTION PENDING state. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support managed +** hot swap, as indicated by SAHPI_CAPABILITY_MANAGED_HOTSWAP in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_REQUEST is returned if the resource is: +** * Not in the INSERTION PENDING or EXTRACTION PENDING state. +** * Processing an auto-insertion or auto-extraction policy. +** +** Remarks: +** During insertion, a resource supporting hot swap will generate an event to +** indicate that it is in the INSERTION PENDING state. If an HPI User calls +** saHpiHotSwapPolicyCancel() before the resource begins an auto-insert +** operation, then the resource will remain in INSERTION PENDING state while +** an HPI User acts on the resource to integrate it into the system. During +** this state, an HPI User can instruct the resource to power on the +** associated FRU, to de-assert reset, or to turn off its hot swap indicator +** using the saHpiResourcePowerStateSet(), saHpiResourceResetStateSet(), or +** saHpiHotSwapIndicatorStateSet() functions, respectively, if the resource +** has those associated capabilities. Once an HPI User has completed with the +** integration of the FRU, this function must be called to signal that the +** resource should now transition into the ACTIVE state. +** +** An HPI User may also use this function to request a resource to return to +** the ACTIVE state from the EXTRACTION PENDING state in order to reject an +** extraction request. +** +** Because a resource that supports the simplified hot swap model will never +** transition into INSERTION PENDING or EXTRACTION PENDING states, this +** function is not applicable to those resources. +** +** Only valid if resource is in INSERTION PENDING or EXTRACTION PENDING state +** and an auto-insert or auto-extract policy action has not been initiated. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceActiveSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + +/******************************************************************************* +** +** Name: saHpiResourceInactiveSet() +** +** Description: +** This function allows an HPI User to request a resource to transition to the +** INACTIVE state from the INSERTION PENDING or EXTRACTION PENDING state. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support managed +** hot swap, as indicated by SAHPI_CAPABILITY_MANAGED_HOTSWAP in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_REQUEST is returned if the resource is: +** * Not in the INSERTION PENDING or EXTRACTION PENDING state. +** * Processing an auto-insertion or auto-extraction policy. +** +** Remarks: +** During extraction, a resource supporting hot swap will generate an event +** to indicate that it is in the EXTRACTION PENDING state. If an HPI User +** calls saHpiHotSwapPolicyCancel() before the resource begins an auto-extract +** operation, then the resource will remain in EXTRACTION PENDING state while +** an HPI User acts on the resource to isolate the associated FRU from the +** system. During this state, an HPI User can instruct the resource to power +** off the FRU, to assert reset, or to turn on its hot swap indicator using +** the saHpiResourcePowerStateSet(), saHpiResourceResetStateSet(), or +** saHpiHotSwapIndicatorStateSet() functions, respectively, if the resource +** has these associated capabilities. Once an HPI User has completed the +** shutdown of the FRU, this function must be called to signal that the +** resource should now transition into the INACTIVE state. +** +** An HPI User may also use this function to request a resource to return to +** the INACTIVE state from the INSERTION PENDING state to abort a hot-swap +** insertion action. +** +** Because a resource that supports the simplified hot swap model will never +** transition into INSERTION PENDING or EXTRACTION PENDING states, this +** function is not applicable to those resources. +** +** Only valid if resource is in EXTRACTION PENDING or INSERTION PENDING state +** and an auto-extract or auto-insert policy action has not been initiated. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceInactiveSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId +); + +/******************************************************************************* +** +** Name: saHpiAutoInsertTimeoutGet() +** +** Description: +** This function allows an HPI User to request the auto-insert timeout value +** within a specific domain. This value indicates how long the resource will +** wait before the default auto-insertion policy is invoked. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** Timeout - [out] Pointer to location to store the number of nanoseconds to +** wait before autonomous handling of the hot swap event. Reserved time +** outvalues: +** * SAHPI_TIMEOUT_IMMEDIATE indicates autonomous handling is immediate. +** * SAHPI_TIMEOUT_BLOCK indicates autonomous handling does not occur. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_INVALID_PARAMS is returned if the Timeout pointer is passed in +** as NULL. +** +** Remarks: +** Each domain maintains a single auto-insert timeout value and it is applied +** to all contained resources upon insertion, which support managed hot swap. +** Further information on the auto-insert timeout can be found in the +** function saHpiAutoInsertTimeoutSet(). +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoInsertTimeoutGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiTimeoutT *Timeout +); + +/******************************************************************************* +** +** Name: saHpiAutoInsertTimeoutSet() +** +** Description: +** This function allows an HPI User to configure a timeout for how long to +** wait before the default auto-insertion policy is invoked on a resource +** within a specific domain. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** Timeout - [in] The number of nanoseconds to wait before autonomous handling +** of the hot swap event. Reserved time out values: +** * SAHPI_TIMEOUT_IMMEDIATE indicates proceed immediately to autonomous +** handling. +** * SAHPI_TIMEOUT_BLOCK indicates prevent autonomous handling. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_READ_ONLY is returned if the auto-insert timeout for the domain +** is fixed as indicated by the SAHPI_DOMAIN_CAP_AUTOINSERT_READ_ONLY flag +** in the DomainInfo structure. +** SA_ERR_HPI_INVALID_PARAMS is returned when the Timeout parameter is not set +** to SAHPI_TIMEOUT_BLOCK, SAHPI_TIMEOUT_IMMEDIATE or a positive value. +** +** Remarks: +** This function accepts a parameter instructing each resource to impose a +** delay before performing its default hot swap policy for auto-insertion. +** The parameter may be set to SAHPI_TIMEOUT_IMMEDIATE to direct resources to +** proceed immediately to auto-insertion, or to SAHPI_TIMEOUT_BLOCK to prevent +** auto-insertion from ever occurring. If the parameter is set to another +** value, then it defines the number of nanoseconds between the time a hot +** swap event with HotSwapState = SAHPI_HS_STATE_INSERTION_PENDING is +** generated, and the time that the auto-insertion policy will be invoked for +** that resource. If, during this time period, a saHpiHotSwapPolicyCancel() +** function call is processed, the timer will be stopped, and the +** auto-insertion policy will not be invoked. Each domain maintains a single +** auto-insert timeout value and it is applied to all contained resources upon +** insertion, which support managed hot swap. +** +** Once the auto-insertion policy begins, an HPI User will not be allowed to +** cancel the insertion policy; hence, the timeout should be set appropriately +** to allow for this condition. Note that the timeout period begins when the +** hot swap event with HotSwapState = SAHPI_HS_STATE_INSERTION_PENDING is +** initially generated; not when it is received by an HPI User with a +** saHpiEventGet() function call, or even when it is placed in a session +** event queue. +** +** A resource may exist in multiple domains, which themselves may have +** different auto-insertion timeout values. Upon insertion, the resource will +** begin its auto-insertion policy based on the smallest auto-insertion +** timeout value. As an example, if a resource is inserted into two domains, +** one with an auto-insertion timeout of 5 seconds, and one with an +** auto-insertion timeout of 10 seconds, the resource will begin its +** auto-insertion policy at 5 seconds. +** +** An implementation may enforce a fixed, preset timeout value. In such +** cases, the SAHPI_DOMAIN_CAP_AUTOINSERT_READ_ONLY flag will be set to +** indicate that an HPI User cannot change the auto-insert Timeout value. +** SA_ERR_HPI_READ_ONLY is returned if an HPI User attempts to change a +** read-only timeout. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoInsertTimeoutSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiTimeoutT Timeout +); + +/******************************************************************************* +** +** Name: saHpiAutoExtractTimeoutGet() +** +** Description: +** This function allows an HPI User to request the timeout for how long a +** resource will wait before the default auto-extraction policy is invoked. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** Timeout - [out] Pointer to location to store the number of nanoseconds to +** wait before autonomous handling of the hot swap event. Reserved time +** out values: +** * SAHPI_TIMEOUT_IMMEDIATE indicates autonomous handling is immediate. +** * SAHPI_TIMEOUT_BLOCK indicates autonomous handling does not occur. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support managed +** hot swap, as indicated by SAHPI_CAPABILITY_MANAGED_HOTSWAP in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned if the Timeout pointer is passed in +** as NULL. +** +** Remarks: +** Further information on auto-extract timeouts is detailed in +** saHpiAutoExtractTimeoutSet(). +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoExtractTimeoutGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiTimeoutT *Timeout +); + +/******************************************************************************* +** +** Name: saHpiAutoExtractTimeoutSet() +** +** Description: +** This function allows an HPI User to configure a timeout for how long to +** wait before the default auto-extraction policy is invoked. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** Timeout - [in] The number of nanoseconds to wait before autonomous handling +** of the hot swap event. Reserved timeout values: +** * SAHPI_TIMEOUT_IMMEDIATE indicates proceed immediately to autonomous +** handling. +** * SAHPI_TIMEOUT_BLOCK indicates prevent autonomous handling. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support managed +** hot swap, as indicated by SAHPI_CAPABILITY_MANAGED_HOTSWAP in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned when the Timeout parameter is not set +** to SAHPI_TIMEOUT_BLOCK, SAHPI_TIMEOUT_IMMEDIATE or a positive value. +** SA_ERR_HPI_READ_ONLY is returned if the auto-extract timeout for the +** resource is fixed, as indicated by the +** SAHPI_HS_CAPABILITY_AUTOEXTRACT_READ_ONLY in the resource's RPT entry. +** +** Remarks: +** This function accepts a parameter instructing the resource to impose a +** delay before performing its default hot swap policy for auto-extraction. +** The parameter may be set to SAHPI_TIMEOUT_IMMEDIATE to direct the resource +** to proceed immediately to auto-extraction, or to SAHPI_TIMEOUT_BLOCK to +** prevent auto-extraction from ever occurring on a resource. If the parameter +** is set to another value, then it defines the number of nanoseconds between +** the time a hot swap event with +** HotSwapState = SAHPI_HS_STATE_EXTRACTION_PENDING is generated and the time +** that the auto-extraction policy will be invoked for the resource. If, +** during this time period, a saHpiHotSwapPolicyCancel() function call is +** processed, the timer will be stopped, and the auto-extraction policy will +** not be invoked. +** +** Once the auto-extraction policy begins, an HPI User will not be allowed to +** cancel the extraction policy; hence, the timeout should be set +** appropriately to allow for this condition. Note that the timeout period +** begins when the hot swap event with +** HotSwapState = SAHPI_HS_STATE_EXTRACTION_PENDING is initially generated; +** not when it is received by a HPI User with a saHpiEventGet() function call, +** or even when it is placed in a session event queue. +** +** The auto-extraction policy is set at the resource level and is only +** supported by resources supporting the Managed Hot Swap capability. The +** auto-extraction timeout value cannot be modified if the resource's "Hot +** Swap AutoExtract Read-only" capability is set. After discovering that a +** newly inserted resource supports Managed Hot Swap, and read-write +** auto-extract timeouts, an HPI User may use this function to change the +** timeout of the auto-extraction policy for that resource. If a resource +** supports the simplified hot swap model, setting this timer has no effect +** since the resource will transition directly to NOT PRESENT state on an +** extraction. +** +** An implementation may enforce a fixed, preset timeout value. In such +** cases, the SAHPI_HS_CAPABILITY_AUTOEXTRACT_READ_ONLY flag will be set to +** indicate that an HPI User cannot change the auto-extract Timeout value. +** SA_ERR_HPI_READ_ONLY is returned if an HPI User attempts to change a +** read-only timeout. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiAutoExtractTimeoutSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTimeoutT Timeout +); + +/******************************************************************************* +** +** Name: saHpiHotSwapStateGet() +** +** Description: +** This function allows an HPI User to retrieve the current hot swap state of +** a resource. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** State - [out] Pointer to location to store returned state information. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support managed +** hot swap, as indicated by SAHPI_CAPABILITY_MANAGED_HOTSWAP in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned if the State pointer is passed in as +** NULL. +** +** Remarks: +** The returned state will be one of the following four states: +** * SAHPI_HS_STATE_INSERTION_PENDING +** * SAHPI_HS_STATE_ACTIVE +** * SAHPI_HS_STATE_EXTRACTION_PENDING +** * SAHPI_HS_STATE_INACTIVE +** +** The state SAHPI_HS_STATE_NOT_PRESENT will never be returned, because a +** resource that is not present cannot be addressed by this function in the +** first place. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiHsStateT *State +); + +/******************************************************************************* +** +** Name: saHpiHotSwapActionRequest() +** +** Description: +** This function allows an HPI User to invoke an insertion or extraction +** process via software. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** Action - [in] Requested action: +** * SAHPI_HS_ACTION_INSERTION +** * SAHPI_HS_ACTION_EXTRACTION +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support managed +** hot swap, as indicated by SAHPI_CAPABILITY_MANAGED_HOTSWAP in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_REQUEST is returned if the resource is not in an +** appropriate hot swap state, or if the requested action is inappropriate +** for the current hot swap state. See the Remarks section below. +** SA_ERR_HPI_INVALID_PARAMS is returned when Action is not one of the valid +** enumerated values for this type. +** +** Remarks: +** A resource supporting hot swap typically requires a physical action on the +** associated FRU to invoke an insertion or extraction process. An insertion +** process is invoked by physically inserting the FRU into a chassis. +** Physically opening an ejector latch or pressing a button invokes the +** extraction process. This function provides an alternative means to invoke +** an insertion or extraction process via software. +** +** This function may only be called: +** * To request an insertion action when the resource is in INACTIVE state. +** * To request an extraction action when the resource is in the ACTIVE +** state. +** The function may not be called when the resource is in any other state. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapActionRequest ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiHsActionT Action +); + +/******************************************************************************* +** +** Name: saHpiHotSwapIndicatorStateGet() +** +** Description: +** This function allows an HPI User to retrieve the state of the hot swap +** indicator. A FRU associated with a hot-swappable resource may include a hot +** swap indicator such as a blue LED. This indicator signifies that the FRU is +** ready for removal. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** State - [out] Pointer to location to store state of hot swap indicator. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support: +** * Managed hot swap, as indicated by SAHPI_CAPABILITY_MANAGED_HOTSWAP in +** the resource's RPT entry. +** * A hot swap indicator on the FRU as indicated by the +** SAHPI_HS_CAPABILITY_INDICATOR_SUPPORTED in the resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned if the State pointer is passed in as +** NULL. +** +** Remarks: +** The returned state is either SAHPI_HS_INDICATOR_OFF or +** SAHPI_HS_INDICATOR_ON. This function will return the state of the +** indicator, regardless of what hot swap state the resource is in. +** +** Not all resources supporting managed hot swap will necessarily support +** this function. Whether or not a resource supports the hot swap indicator +** is specified in the Hot Swap Capabilities field of the RPT entry. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapIndicatorStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiHsIndicatorStateT *State +); + +/******************************************************************************* +** +** Name: saHpiHotSwapIndicatorStateSet() +** +** Description: +** This function allows an HPI User to set the state of the hot swap +** indicator. A FRU associated with a hot-swappable resource may include a hot +** swap indicator such as a blue LED. This indicator signifies that the FRU is +** ready for removal. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** State - [in] State of hot swap indicator to be set. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support: +** * Managed hot swap, as indicated by SAHPI_CAPABILITY_MANAGED_HOTSWAP in +** the resource's RPT entry. +** * A hot swap indicator on the FRU as indicated by the +** SAHPI_HS_CAPABILITY_INDICATOR_SUPPORTED in the resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned when State is not one of the valid +** enumerated values for this type. +** +** Remarks: +** Valid states include SAHPI_HS_INDICATOR_OFF or SAHPI_HS_INDICATOR_ON. This +** function will set the indicator regardless of what hot swap state the +** resource is in, though it is recommended that this function be used only +** in conjunction with moving the resource to the appropriate hot swap state. +** +** Not all resources supporting managed hot swap will necessarily support this +** function. Whether or not a resource supports the hot swap indicator is +** specified in the Hot Swap Capabilities field of the RPT entry. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiHotSwapIndicatorStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiHsIndicatorStateT State +); + +/******************************************************************************* +** +** Name: saHpiParmControl() +** +** Description: +** This function allows an HPI User to save and restore parameters associated +** with a specific resource. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** Action - [in] Action to perform on resource parameters. +** * SAHPI_DEFAULT_PARM Restores the factory default settings for a +** specific resource. Factory defaults include sensor thresholds and +** configurations, and resource- specific configuration parameters. +** * SAHPI_SAVE_PARM Stores the resource configuration parameters in +** non-volatile storage. Resource configuration parameters stored in +** non-volatile storage will survive power cycles and resource resets. +** * SAHPI_RESTORE_PARM Restores resource configuration parameters from +** non-volatile storage. Resource configuration parameters include +** sensor thresholds and sensor configurations, as well as +** resource-specific parameters. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support +** parameter control, as indicated by SAHPI_CAPABILITY_CONFIGURATION in the +** resource's RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned when Action is not set to a proper +** value. +** +** Remarks: +** Resource-specific parameters should be documented in an implementation +** guide for the HPI implementation. +** +** When this API is called with SAHPI_RESTORE_PARM as the action prior to +** having made a call with this API where the action parameter was set to +** SAHPI_SAVE_PARM, the default parameters will be restored. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiParmControl ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiParmActionT Action +); + +/******************************************************************************* +** +** Name: saHpiResourceResetStateGet() +** +** Description: +** This function gets the reset state of an entity, allowing an HPI User to +** determine if the entity is being held with its reset asserted. If a +** resource manages multiple entities, this function will address the entity +** which is identified in the RPT entry for the resource. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** ResetAction - [out] The current reset state of the entity. Valid reset +** states are: +** * SAHPI_RESET_ASSERT: The entity's reset is asserted, e.g., for hot +** swap insertion/extraction purposes. +** * SAHPI_RESET_DEASSERT: The entity's reset is not asserted. +** +** Return Value: +** SA_OK is returned if the resource has reset control, and the reset state +** has successfully been determined; otherwise, an error code is returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support reset +** control as indicated by SAHPI_CAPABILITY_RESET in the resource's RPT +** entry. +** SA_ERR_HPI_INVALID_PARAMS is returned if the ResetAction pointer is passed +** in as NULL. +** +** Remarks: +** SAHPI_COLD_RESET and SAHPI_WARM_RESET are pulsed resets, and are not valid +** values to be returned in ResetAction. If the entity is not being held in +** reset (using SAHPI_RESET_ASSERT), the appropriate value is +** SAHPI_RESET_DEASSERT. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceResetStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiResetActionT *ResetAction +); + +/******************************************************************************* +** +** Name: saHpiResourceResetStateSet() +** +** Description: +** This function directs the resource to perform the specified reset type on +** the entity that it manages. If a resource manages multiple entities, this +** function addresses the entity that is identified in the RPT entry for the +** resource. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** ResetAction - [in] Type of reset to perform on the entity. Valid reset +** actions are: +** * SAHPI_COLD_RESET: Perform a 'Cold Reset' on the entity (pulse), +** leaving reset de-asserted, +** * SAHPI_WARM_RESET: Perform a 'Warm Reset' on the entity (pulse), +** leaving reset de-asserted, +** * SAHPI_RESET_ASSERT: Put the entity into reset state and hold reset +** asserted, e.g., for hot swap insertion/extraction purposes, +** * SAHPI_RESET_DEASSERT: Bring the entity out of the reset state. +** +** Return Value: +** SA_OK is returned if the resource has reset control, and the requested +** reset action has succeeded; otherwise, an error code is returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support resource +** reset control, as indicated by SAHPI_CAPABILITY_RESET in the resource's +** RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned when the ResetAction is not set to a +** proper value. +** SA_ERR_HPI_INVALID_CMD is returned if the requested ResetAction is +** SAHPI_RESET_ASSERT and the resource does not support this action. +** SA_ERR_HPI_INVALID_REQUEST is returned if the ResetAction is +** SAHPI_COLD_RESET or SAHPI_WARM_RESET and reset is currently asserted. +** +** Remarks: +** Some resources may not support holding the entity in reset. If this is the +** case, the resource should return SA_ERR_HPI_INVALID_CMD if the +** SAHPI_RESET_ASSERT action is requested. All resources that have the +** SAHPI_CAPABILITY_RESET flag set in their RPTs should support +** SAHPI_COLD_RESET and SAHPI_WARM_RESET. However, it is not required that +** these actions be different. That is, some resources may only have one +** sort of reset action (e.g., a "cold" reset) which is executed when either +** SAHPI_COLD_RESET or SAHPI_WARM_RESET is requested. +** +** The SAHPI_RESET_ASSERT is used to hold an entity in reset, and +** SAHPI_RESET_DEASSERT is used to bring the entity out of an asserted reset +** state. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourceResetStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiResetActionT ResetAction +); + +/******************************************************************************* +** +** Name: saHpiResourcePowerStateGet() +** +** Description: +** This function gets the power state of an entity, allowing an HPI User to +** determine if the entity is currently powered on or off. If a resource +** manages multiple entities, this function will address the entity which is +** identified in the RPT entry for the resource. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** State - [out] The current power state of the resource. Valid power states +** are: +** * SAHPI_POWER_OFF: The entity's primary power is OFF, +** * SAHPI_POWER_ON: The entity's primary power is ON. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support power +** management, as indicated by SAHPI_CAPABILITY_POWER in the resource's +** RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned if the State pointer is passed in +** as NULL. +** +** Remarks: +** SAHPI_POWER_CYCLE is a pulsed power operation and is not a valid return +** for the power state. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourcePowerStateGet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiPowerStateT *State +); + +/******************************************************************************* +** +** Name: saHpiResourcePowerStateSet() +** +** Description: +** This function directs the resource to perform the power control action on +** the entity that it manages. If a resource manages multiple entities, this +** function addresses the entity that is identified in the RPT entry for the +** resource. +** +** Parameters: +** SessionId - [in] Identifier for a session context previously obtained using +** saHpiSessionOpen(). +** ResourceId - [in] Resource identified for this operation. +** State - [in] the requested power control action. Valid values are: +** * SAHPI_POWER_OFF: The entity's primary power is turned OFF, +** * SAHPI_POWER_ON: The entity's primary power is turned ON, +** * SAHPI_POWER_CYCLE: The entity's primary power is turned OFF, then +** turned ON. +** +** Return Value: +** SA_OK is returned on successful completion; otherwise, an error code is +** returned. +** SA_ERR_HPI_CAPABILITY is returned if the resource does not support power +** management, as indicated by SAHPI_CAPABILITY_POWER in the resource's +** RPT entry. +** SA_ERR_HPI_INVALID_PARAMS is returned when State is not one of the valid +** enumerated values for this type. +** +** Remarks: +** This function controls the hardware power on a FRU entity regardless of +** what hot-swap state the resource is in. For example, it is legal (and may +** be desirable) to cycle power on the FRU even while it is in ACTIVE state in +** order to attempt to clear a fault condition. Similarly, a resource could be +** instructed to power on a FRU even while it is in INACTIVE state, for +** example, in order to run off-line diagnostics. +** +** Not all resources supporting hot swap will necessarily support this +** function. In particular, resources that use the simplified hot swap model +** may not have the ability to control FRU power. +** +** This function may also be supported for non-FRU entities if power control +** is available for those entities. +** +*******************************************************************************/ +SaErrorT SAHPI_API saHpiResourcePowerStateSet ( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiPowerStateT State +); + +#endif diff --git a/hpiutil/TODO b/hpiutil/TODO new file mode 100644 index 0000000..5ab06da --- /dev/null +++ b/hpiutil/TODO @@ -0,0 +1,65 @@ +HPIUTIL TODO + +x Porting the utilities in hpiutil from HPI_A to HPI_B + These can be built for either version of HPI via a compile flag. + They default to HPI_A, since HPI_B libraries are not fully released yet. + Ported to HPI B with OpenHPI: + hpialarmpanel.c done, with compile flags 10/13/04 + hpireset.c, hpisensor.c, hpisel.c hpiwdt.c - done + hpifru.c (hpifrub.c) - done + hpievent.c (runs, but ThresholdSet error -1010 due to lib bug) + COMPLETE + +x SpiLibd supplies inventory capability for DIMMs, but gives error when + trying to get its inventory data. + COMPLETE in hpiutil-1.1.9 + +Intel HPI library/daemon (SpiLibd) known issues: +- If the SEL is totally empty (not even a 'cleared' message), the SpiLibd + will not start because the GetSelEntry returns 0xcb. + The lib probably needs to set eventid to zero and proceed in this case. + +OpenHPI library/daemon with ipmidirect plugin: + 11/10/06 completed adding LEDs, watchdog, and Intel RMS features + 12/07/06 openhpi-2.6.3 released, fully tested + +OpenHPI library with ipmi plugin testing & issues: + Continuing testing of hpiutil with OpenHPI using its ipmi plugin, + but currently there are blocking bugs open (see latest date below). + 02/11/04 OpenHPI 0.5 dies during discovery + 05/24/04 OpenHPI 1.0.0 testing, wrote more bugzillas + 10/14/04 openhpi-1.9.1 testing, then added alarm panel code + With patches to 1.9.1, alarm panel controls are operational now. + 12/02/04 Submitted fixes for watchdog 932510 & 1077934. + 01/10/05 Submitted fixes for several inventory bugs into openhpi-2.0.1 cvs. + Bug list: (f=fixed, x=rejected, o=open) + x 924280 IPMI plug-in takes too long to discover 2004-03-26 18:24 + (ref #959765) + x 932486 wrong string terminator for Compact SDRs 2004-04-09 15:37 + f 932492 Lots of FRU errors displayed during discovery 2004-04-09 15:47 + f 932496 EventLog RecordId and Time are invalid 2004-04-09 15:55 + f 932510 Watchdog values incorrect 2004-04-09 16:09 + f 933737 hpievent test failed (EventGet & hyst_set) 2004-04-12 12:29 + f 933741 Reset Controls not implemented 2004-04-12 12:33 + f 934475 Add some alarm panel logic 2004-04-13 16:23 + f 948551 RdrGet returns -1024 with hpifru 2004-05-05 11:25 + f 948644 ResetStateSet returns error -1005 2004-05-05 14:01 + o 959749 hpithres returns -1006 from ThresholdsGet 2004-05-24 18:02 + f 959753 No Inventory RDRs are populated 2004-05-24 18:13 + f 959765 IPMI plug-in takes too long to discover 2004-05-24 18:27 + (some progress, 10 min down to 3 min - now 2.5 min) + f 1040276 Event in SEL not mapped to HPI 2004-10-04 19:22 + f 1068098 EventLogEntryGet returns less than 16 data by 2004-11-17 11:04 + o 1070785 OpenHPI discover method hangs if system is no 2004-11-21 23:54 + f 1077934 some entity tags have zero length 2004-12-02 16:46 + o 1086122 Can't set (write) Inventory fields 2004-12-15 18:02 + f 1090496 FLOAT64 decoding should not be scientific not 2004-12-23 13:39 + f 1095266 Inventory Product Fields report Board Area ty 2005-01-03 16:24 + f 1095262 Inventory Custom field not retrieved 2005-01-03 16:14 + o 1095256 Takes 5 Discovery passes to fill in FRU data 2005-01-03 16:09 + f 1095225 Inventory content truncated 2005-01-03 15:04 + f 1098067 hpisensor output usability 2005-01-07 13:37 + f 1098073 ThresholdsGet sometimes returns TIMEOUT 2005-01-07 13:49 + 09/26/06 Submitted bug against openhpi-2.6.2 ipmi plugin discovery failure + o 1565999 ohoi: domain not fully up, sel support = 0 2006-09-26 17;16 + diff --git a/hpiutil/env.hpi b/hpiutil/env.hpi new file mode 100755 index 0000000..2d14c96 --- /dev/null +++ b/hpiutil/env.hpi @@ -0,0 +1,11 @@ +export SAHPI_HOME=/etc/hpi +export SPI_LIB_LOG_LOCATION=/var/log/spilib +export SPI_LIB_CFG_LOCATION=$SAHPI_HOME/spi-lib.conf +export SPI_DAEMON_LOG_LOCATION=/var/log/spidaemon +export SPI_DAEMON_CFG_LOCATION=$SAHPI_HOME/spi-daemon.conf +export SPI_DAEMON_LOG_LEVEL=-l5 +export SPI_LIB_LOG_LEVEL=-l5 +export LD_LIBRARY_PATH=/usr/lib:/lib +# export LD_LIBRARY_PATH=$SAHPI_HOME/lib +# export LD_ASSUME_KERNEL=2.4.1 +# make sure to "mkdir -p /etc/hpi" diff --git a/hpiutil/env.openhpi b/hpiutil/env.openhpi new file mode 100755 index 0000000..53bdee6 --- /dev/null +++ b/hpiutil/env.openhpi @@ -0,0 +1,2 @@ +export LD_LIBRARY_PATH=/usr/local/lib +# make sure to "mkdir -p /etc/hpi" diff --git a/hpiutil/hpialarmpanel.c b/hpiutil/hpialarmpanel.c new file mode 100644 index 0000000..f918636 --- /dev/null +++ b/hpiutil/hpialarmpanel.c @@ -0,0 +1,373 @@ +/* + * hpialarmpanel.c + * + * Author: Andy Cress arcress at users.sourceforge.net + * Copyright (c) 2003 Intel Corporation. + * + * 04/15/03 Andy Cress - created + * 04/17/03 Andy Cress - mods for resourceid, first good run + * 04/23/03 Andy Cress - first run with good ControlStateGet + * 04/24/03 Andy Cress - v0.5 with good ControlStateSet + * 04/29/03 Andy Cress - v0.6 changed control.oem values + * 06/06/03 Andy Cress - v1.0 check for Analog States + * 02/23/04 Andy Cress - v1.1 add checking/setting disk LEDs + * 10/13/04 Andy Cress - v1.2 add ifdefs for HPI_A & HPI_B, added -d/raw + */ +/*M* +Copyright (c) 2003, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + a.. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + b.. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + c.. Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *M*/ + +#include +#include +#include +#include "SaHpi.h" + +#define uchar unsigned char +#define SAHPI_OEM_ALARM_LED 0x10 +#define SAHPI_OEM_DISK_LED 0x20 +#ifdef HPI_A +char *progver = "1.2 HPI-A"; +#else +char *progver = "1.2 HPI-B"; +#endif +char fdebug = 0; +char *states[3] = {"off", "ON ", "unknown" }; +uchar fsetid = 0; +uchar fid = 0; +#define NLEDS 6 +struct { + uchar fset; + uchar val; +} leds[NLEDS] = { /* rdr.RdrTypeUnion.CtrlRec.Oem is an index for this */ +{/*pwr*/ 0, 0}, +{/*crt*/ 0, 0}, +{/*maj*/ 0, 0}, +{/*min*/ 0, 0}, +{/*diska*/ 0, 0}, +{/*diskb*/ 0, 0} }; + + +int +main(int argc, char **argv) +{ + int c; + SaErrorT rv; + SaHpiSessionIdT sessionid; +#ifdef HPI_A + SaHpiVersionT hpiVer; + SaHpiRptInfoT rptinfo; +#endif + SaHpiRptEntryT rptentry; + SaHpiEntryIdT rptentryid; + SaHpiEntryIdT nextrptentryid; + SaHpiEntryIdT entryid; + SaHpiEntryIdT nextentryid; + SaHpiResourceIdT resourceid; + SaHpiRdrT rdr; + SaHpiCtrlTypeT ctltype; + SaHpiCtrlNumT ctlnum; + SaHpiCtrlStateT ctlstate; + int raw_val = 0; + int j; + uchar b = 0; + + printf("%s ver %s\n", argv[0],progver); + while ( (c = getopt( argc, argv,"rxa:b:c:m:n:p:i:d:o?")) != EOF ) + switch(c) { + + case 'c': b = atoi(optarg); /* set crit alarm value */ + leds[1].fset = 1; + leds[1].val = b; + break; + case 'm': b = atoi(optarg); /* set major alarm value */ + leds[2].fset = 1; + leds[2].val = b; + break; + case 'n': b = atoi(optarg); /* set minor alarm value */ + leds[3].fset = 1; + leds[3].val = b; + break; + case 'a': b = atoi(optarg); /* set disk a fault led */ + leds[4].fset = 1; + leds[4].val = b; + break; + case 'b': b = atoi(optarg); /* set disk b fault led */ + leds[5].fset = 1; + leds[5].val = b; + break; + case 'p': b = atoi(optarg); /* set power alarm value */ + leds[0].fset = 1; + leds[0].val = b; + break; + case 'i': fid = atoi(optarg); /* set chassis id on/off */ + fsetid = 1; + break; + case 'd': raw_val = atoi(optarg); /* set raw alarm byte */ + break; + case 'o': fsetid=1; fid=0; /* set all alarms off */ + for (j = 0; j < NLEDS; j++) { + leds[j].fset = 1; + leds[j].val = 0; + } + break; + case 'x': fdebug = 1; break; /* debug messages */ + default: + printf("Usage: %s [-a -b -c -i -m -n -p -o -x]\n", argv[0]); + printf(" where -c1 sets Critical Alarm on\n"); + printf(" -c0 sets Critical Alarm off\n"); + printf(" -m1 sets Major Alarm on\n"); + printf(" -m0 sets Major Alarm off\n"); + printf(" -n1 sets Minor Alarm on\n"); + printf(" -n0 sets Minor Alarm off\n"); + printf(" -p1 sets Power Alarm on\n"); + printf(" -p0 sets Power Alarm off\n"); + printf(" -i5 sets Chassis ID on for 5 sec\n"); + printf(" -i0 sets Chassis ID off\n"); + printf(" -a1 sets Disk A fault on\n"); + printf(" -a0 sets Disk A fault off\n"); + printf(" -b1 sets Disk B fault on\n"); + printf(" -b0 sets Disk B fault off\n"); +#ifndef HPI_A + printf(" -d[byte] sets raw Alarm byte\n"); +#endif + printf(" -o sets all Alarms off\n"); + printf(" -x show eXtra debug messages\n"); + exit(1); + } + +#ifdef HPI_A + rv = saHpiInitialize(&hpiVer); + if (rv != SA_OK) { + printf("saHpiInitialize error %d\n",rv); + exit(-1); + } + if (fdebug) printf("Initialize complete, rv = %d\n",rv); + rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + if (rv == SA_ERR_HPI_ERROR) + printf("saHpiSessionOpen: error %d, HPI daemon not running\n",rv); + else + printf("saHpiSessionOpen error %d\n",rv); + exit(-1); + } + rv = saHpiResourcesDiscover(sessionid); + if (fdebug) printf("saHpiResourcesDiscover complete, rv = %d\n",rv); + rv = saHpiRptInfoGet(sessionid,&rptinfo); + if (fdebug) printf("saHpiRptInfoGet rv = %d\n",rv); + printf("RptInfo: UpdateCount = %x, UpdateTime = %lx\n", + rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp); +#else /* HPI B.01.01 */ + rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + printf("saHpiSessionOpen error %d\n",rv); + exit(-1); + } + rv = saHpiDiscover(sessionid); + if (fdebug) printf("saHpiDiscover complete, rv = %d\n",rv); + + if (fsetid) { /* HPI B.01.01 Identify logic */ + printf("Setting ID led to %d sec\n", fid); + /* do saHpiIdentify function */ + printf("Not yet supported\n"); + } +#endif + + /* walk the RPT list */ + rptentryid = SAHPI_FIRST_ENTRY; + while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry); + if (rv != SA_OK) printf("RptEntryGet: rv = %d\n",rv); + if (rv == SA_OK) { + /* Walk the RDR list for this RPT entry */ + entryid = SAHPI_FIRST_ENTRY; + resourceid = rptentry.ResourceId; +#ifdef HPI_A + rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0; +#else + /* + * Don't stringify here, since OpenHPI returns a valid string, but + * a DataLength of zero here (for processor, bios). + */ +#endif + //if (fdebug) + printf("rptentry[%d] resourceid=%d tag: %s\n", + rptentryid, resourceid, rptentry.ResourceTag.Data); + while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRdrGet(sessionid,resourceid, + entryid,&nextentryid, &rdr); + if (fdebug) printf("saHpiRdrGet[%d] rv = %d\n",entryid,rv); + if (rv == SA_OK) { + if (rdr.RdrType == SAHPI_CTRL_RDR) { + /*type 1 includes alarm LEDs*/ + ctlnum = rdr.RdrTypeUnion.CtrlRec.Num; + rdr.IdString.Data[rdr.IdString.DataLength] = 0; + if (fdebug) printf("Ctl[%d]: %d %d %s\n", + ctlnum, rdr.RdrTypeUnion.CtrlRec.Type, + rdr.RdrTypeUnion.CtrlRec.OutputType, + rdr.IdString.Data); + rv = saHpiControlTypeGet(sessionid,resourceid, + ctlnum,&ctltype); + if (fdebug) printf("saHpiControlTypeGet[%d] rv = %d, type = %d\n",ctlnum,rv,ctltype); +#ifdef HPI_A + rv = saHpiControlStateGet(sessionid,resourceid, + ctlnum,&ctlstate); +#else + rv = saHpiControlGet(sessionid, resourceid, ctlnum, + NULL, &ctlstate); +#endif + if (fdebug) + printf("saHpiControlStateGet[%d] rv = %d v = %x\n", + ctlnum,rv,ctlstate.StateUnion.Digital); + printf("RDR[%d]: ctltype=%d:%d oem=%02x %s \t", + rdr.RecordId, + rdr.RdrTypeUnion.CtrlRec.Type, + rdr.RdrTypeUnion.CtrlRec.OutputType, + rdr.RdrTypeUnion.CtrlRec.Oem, + rdr.IdString.Data); + if (rv == SA_OK) { + if (ctlstate.Type == SAHPI_CTRL_TYPE_ANALOG) + b = 2; /*Identify*/ + else { + b = ctlstate.StateUnion.Digital; + if (b > 2) b = 2; + } + printf("state = %s\n",states[b]); + } else { printf("\n"); } + + if (rdr.RdrTypeUnion.CtrlRec.Type == SAHPI_CTRL_TYPE_ANALOG && + rdr.RdrTypeUnion.CtrlRec.OutputType == SAHPI_CTRL_LED) { + /* This is a Chassis Identify */ + if (fsetid) { + printf("Setting ID led to %d sec\n", fid); + ctlstate.Type = SAHPI_CTRL_TYPE_ANALOG; + ctlstate.StateUnion.Analog = fid; +#ifdef HPI_A + rv = saHpiControlStateSet(sessionid, + resourceid, ctlnum,&ctlstate); +#else + rv = saHpiControlSet(sessionid, resourceid, + ctlnum, SAHPI_CTRL_MODE_MANUAL, + &ctlstate); +#endif + printf("saHpiControlStateSet[%d] rv = %d\n",ctlnum,rv); + } + } else + if (rdr.RdrTypeUnion.CtrlRec.Type == SAHPI_CTRL_TYPE_DIGITAL && + (rdr.RdrTypeUnion.CtrlRec.Oem & 0xf0) == SAHPI_OEM_ALARM_LED && + rdr.RdrTypeUnion.CtrlRec.OutputType == SAHPI_CTRL_LED) { + /* this is an alarm LED */ + b = (uchar)rdr.RdrTypeUnion.CtrlRec.Oem & 0x0f; + if ((b < NLEDS) && leds[b].fset) { + printf("Setting alarm led %d to %d\n",b,leds[b].val); + if (leds[b].val == 0) + ctlstate.StateUnion.Digital = SAHPI_CTRL_STATE_OFF; + else + ctlstate.StateUnion.Digital = SAHPI_CTRL_STATE_ON; +#ifdef HPI_A + rv = saHpiControlStateSet(sessionid, + resourceid, ctlnum,&ctlstate); +#else + rv = saHpiControlSet(sessionid, resourceid, + ctlnum, SAHPI_CTRL_MODE_MANUAL, + &ctlstate); +#endif + /* if (fdebug) */ + printf("saHpiControlStateSet[%d] rv = %d\n",ctlnum,rv); + } + } + else if (rdr.RdrTypeUnion.CtrlRec.Type == SAHPI_CTRL_TYPE_DIGITAL && + (rdr.RdrTypeUnion.CtrlRec.Oem & 0xf0) == SAHPI_OEM_DISK_LED && + rdr.RdrTypeUnion.CtrlRec.OutputType == SAHPI_CTRL_LED) { + /* this is a disk LED */ + b = (uchar)rdr.RdrTypeUnion.CtrlRec.Oem & 0x0f; + if ((b < NLEDS) && leds[b].fset) { + printf("Setting disk led %d to %d\n",b,leds[b].val); + if (leds[b].val == 0) + ctlstate.StateUnion.Digital = SAHPI_CTRL_STATE_OFF; + else + ctlstate.StateUnion.Digital = SAHPI_CTRL_STATE_ON; +#ifdef HPI_A + rv = saHpiControlStateSet(sessionid, + resourceid, ctlnum,&ctlstate); +#else + rv = saHpiControlSet(sessionid, resourceid, + ctlnum, SAHPI_CTRL_MODE_MANUAL, + &ctlstate); +#endif + printf("saHpiControlStateSet[%d] rv = %d\n",ctlnum,rv); + } + } +#ifndef HPI_A + else if (rdr.RdrTypeUnion.CtrlRec.Type == SAHPI_CTRL_TYPE_OEM && + rdr.RdrTypeUnion.CtrlRec.OutputType == SAHPI_CTRL_FRONT_PANEL_LOCKOUT) { + /* This is a raw control for alarm panel, + * but HPI never populates an RDR for this. */ + printf("Found raw alarm control\n"); + if (raw_val != 0) { + ctlstate.Type = SAHPI_CTRL_TYPE_OEM; + ctlstate.StateUnion.Oem.BodyLength = 1; + ctlstate.StateUnion.Oem.Body[0] = raw_val; + printf("Set raw alarm control to %x\n",raw_val); + rv = saHpiControlSet(sessionid, resourceid, ctlnum, + SAHPI_CTRL_MODE_MANUAL, &ctlstate); + printf("saHpiControlSet[%d] raw, rv = %d\n",ctlnum,rv); + } + } +#endif + rv = SA_OK; /* ignore errors & continue */ + } + j++; + entryid = nextentryid; + } + } /* RdrGet loop */ + rptentryid = nextrptentryid; + } + } /* RptEntryGet loop */ + + rv = saHpiSessionClose(sessionid); +#ifdef HPI_A + rv = saHpiFinalize(); +#endif + + exit(0); + return(0); +} + +/*-----------Sample output----------------------------------- +hpialarmpanel ver 0.6 +RptInfo: UpdateCount = 5, UpdateTime = 8a2dc6c0 +rptentry[0] resourceid=1 tag: Mullins +RDR[45]: ctltype=2:1 oem=0 Chassis Identify Control +RDR[48]: ctltype=0:1 oem=10 Front Panel Power Alarm LED state = off +RDR[51]: ctltype=0:1 oem=13 Front Panel Minor Alarm LED state = ON +RDR[46]: ctltype=0:0 oem=0 Cold Reset Control +RDR[49]: ctltype=0:1 oem=11 Front Panel Critical Alarm LED state = off +RDR[50]: ctltype=0:1 oem=12 Front Panel Major Alarm LED state = off + *-----------------------------------------------------------*/ +/* end hpialarmpanel.c */ diff --git a/hpiutil/hpievent.c b/hpiutil/hpievent.c new file mode 100644 index 0000000..56a5930 --- /dev/null +++ b/hpiutil/hpievent.c @@ -0,0 +1,621 @@ +/* + * hpievent.c + * + * Author: Bill Barkley + * Copyright (c) 2003 Intel Corporation. + * + * 05/14/03 + * 06/06/03 - complete working version + * 06/20/03 ARCress - added option for Mullins w default=Langley-type sensor + * added progver + * 02/26/04 ARCress - added general search for any Fan sensor. + * 03/17/04 ARCress - changed to Temp sensor (always has Lower Major) + * 03/30/04 ARCress - fixed rv with saHpiSensorThresholdsSet + * 01/03/05 ARCress - some edits for HPI_A/B + * 01/07/05 ARCress - clean compile for HPI B, but ThresholdGet returns -1006 + * 04/01/05 ARCress - set UpMajor if not fFan + */ +/*M* +Copyright (c) 2003, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + a.. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + b.. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + c.. Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *M*/ + +#include +#include +#include +#include +#include +#include "SaHpi.h" + +char progname[] = "hpievent"; +char progver[] = "1.2"; +char s_name[] = "80mm Sys Fan (R)"; /*TSRLT2, default*/ +char sm_name[] = "Baseboard Fan 2"; /*TSRMT2, Mullins*/ +int fFan = 1; +char s_pattn[] = "Temp"; /* else use the first temperature SDR found */ +char *sensor_name; +int sensor_name_len = 0; +int fdebug = 0; +int fxdebug = 0; +int fsensor = 0; +int slist = 0; +int i,j,k = 0; +char inbuff[1024]; +char outbuff[256]; +SaHpiUint32T buffersize; +SaHpiUint32T actualsize; +SaHpiTextBufferT *strptr; +#ifdef HPI_A +SaHpiInventoryDataT *inv; +SaHpiInventGeneralDataT *dataptr; +SaHpiSensorEvtEnablesT enables1; +SaHpiSensorEvtEnablesT enables2; +#endif + +char *rdrtypes[5] = { + "None ", + "Control ", + "Sensor ", + "Invent ", + "Watchdog"}; + +#define HPI_NSEC_PER_SEC 1000000000LL +#define NSU 32 +char *units[NSU] = { + "units", "deg C", "deg F", "deg K", "volts", "amps", + "watts", "joules", "coulombs", "va", "nits", "lumen", + "lux", "candela", "kpa", "psi", "newton", "cfm", + "rpm", "Hz", "us", "ms", "sec", "min", + "hours", "days", "weeks", "mil", "in", "ft", + "mm", "cm" +}; + +#ifdef NOT +void +fixstr(SaHpiTextBufferT *strptr) +{ + size_t datalen; + outbuff[0] = 0; + if (strptr == NULL) return; + datalen = strptr->DataLength; + if (datalen != 0) { + strncpy ((char *)outbuff, (char *)strptr->Data, datalen); + outbuff[datalen] = 0; + } +} +#endif + +static void ShowThresh( + SaHpiSensorThresholdsT *sensbuff, SaHpiSensorThdMaskT ReadThold) +{ + printf( " Supported Thresholds:\n"); +#ifdef HPI_A + if (sensbuff->LowCritical.ValuesPresent & SAHPI_SRF_INTERPRETED) + printf( " Lower Critical Threshold: %5.2f\n", + sensbuff->LowCritical.Interpreted.Value.SensorFloat32); + if (sensbuff->LowMajor.ValuesPresent & SAHPI_SRF_INTERPRETED) + printf( " Lower Major Threshold: %5.2f\n", + sensbuff->LowMajor.Interpreted.Value.SensorFloat32); + if (sensbuff->LowMinor.ValuesPresent & SAHPI_SRF_INTERPRETED) + printf( " Lower Minor Threshold: %5.2f\n", + sensbuff->LowMinor.Interpreted.Value.SensorFloat32); + + if (sensbuff->UpCritical.ValuesPresent & SAHPI_SRF_INTERPRETED) + printf( " Upper Critical Threshold: %5.2f\n", + sensbuff->UpCritical.Interpreted.Value.SensorFloat32); + if (sensbuff->UpMajor.ValuesPresent & SAHPI_SRF_INTERPRETED) + printf( " Upper Major Threshold: %5.2f\n", + sensbuff->UpMajor.Interpreted.Value.SensorFloat32); + if (sensbuff->UpMinor.ValuesPresent & SAHPI_SRF_INTERPRETED) + printf( " Upper Minor Threshold: %5.2f\n", + sensbuff->UpMinor.Interpreted.Value.SensorFloat32); + + if (sensbuff->PosThdHysteresis.ValuesPresent & SAHPI_SRF_RAW) + printf( " Positive Threshold Hysteresis in RAW\n"); + if (sensbuff->PosThdHysteresis.ValuesPresent & SAHPI_SRF_INTERPRETED) + printf( " Positive Threshold Hysteresis: %5.2f\n", + sensbuff->PosThdHysteresis.Interpreted.Value.SensorFloat32); + if (sensbuff->NegThdHysteresis.ValuesPresent & SAHPI_SRF_RAW) + printf( " Negative Threshold Hysteresis in RAW\n"); + if (sensbuff->NegThdHysteresis.ValuesPresent & SAHPI_SRF_INTERPRETED) + printf( " Negative Threshold Hysteresis: %5.2f\n", + sensbuff->NegThdHysteresis.Interpreted.Value.SensorFloat32); +#else + if ( ReadThold & SAHPI_STM_LOW_CRIT ) { + printf( " Lower Critical Threshold: %5.2f\n", + sensbuff->LowCritical.Value.SensorFloat64); + } + if ( ReadThold & SAHPI_STM_LOW_MAJOR ) { + printf( " Lower Major Threshold: %5.2f\n", + sensbuff->LowMajor.Value.SensorFloat64); + } + if ( ReadThold & SAHPI_STM_LOW_MINOR ) { + printf( " Lower Minor Threshold: %5.2f\n", + sensbuff->LowMinor.Value.SensorFloat64); + } + + if ( ReadThold & SAHPI_STM_UP_CRIT ) { + printf( " Upper Critical Threshold: %5.2f\n", + sensbuff->UpCritical.Value.SensorFloat64); + } + if ( ReadThold & SAHPI_STM_UP_MAJOR ) { + printf( " Upper Major Threshold: %5.2f\n", + sensbuff->UpMajor.Value.SensorFloat64); + } + if ( ReadThold & SAHPI_STM_UP_MINOR ) { + printf( " Upper Minor Threshold: %5.2f\n", + sensbuff->UpMinor.Value.SensorFloat64); + } + + if ( ReadThold & SAHPI_STM_UP_HYSTERESIS ) { + printf( " Positive Threshold Hysteresis: %5.2f\n", + sensbuff->PosThdHysteresis.Value.SensorFloat64); + } + if ( ReadThold & SAHPI_STM_LOW_HYSTERESIS ) { + printf( " Negative Threshold Hysteresis: %5.2f\n", + sensbuff->NegThdHysteresis.Value.SensorFloat64); + } +#endif + printf( "\n"); +} + +static +SaErrorT DoEvent( + SaHpiSessionIdT sessionid, + SaHpiResourceIdT resourceid, + SaHpiSensorRecT *sensorrec ) +{ + SaHpiSensorNumT sensornum; + SaHpiSensorReadingT reading; + SaHpiSensorThresholdsT senstbuff1; + SaHpiSensorThresholdsT senstbuff2; + SaErrorT rv, rv2; +#ifdef HPI_A + SaHpiSensorReadingT conv_reading; +#else + SaHpiEventStateT evtstate; +#endif + + SaHpiTimeoutT timeout = (SaHpiInt64T)(12 * HPI_NSEC_PER_SEC); /* 12 seconds*/ + SaHpiEventT event; + SaHpiRptEntryT rptentry; + SaHpiRdrT rdr; + char *unit; + int eventflag = 0; + int i; + + sensornum = sensorrec->Num; + +/* Get current sensor reading */ +#ifdef HPI_A + rv = saHpiSensorReadingGet( sessionid, resourceid, sensornum, &reading); +#else + rv = saHpiSensorReadingGet(sessionid,resourceid, sensornum, &reading,&evtstate); +#endif + if (rv != SA_OK) { + printf( "saHpiSensorReadingGet error %d\n",rv); +/* printf("ReadingGet ret=%d\n", rv); */ + return(rv); + } + +#ifdef HPI_A + /* HPI A has both interpreted and raw. HPI B has only interpreted. */ + if ((reading.ValuesPresent & SAHPI_SRF_INTERPRETED) == 0 && + (reading.ValuesPresent & SAHPI_SRF_RAW)) { + /* only try convert if intrepreted not available. */ + rv = saHpiSensorReadingConvert(sessionid, resourceid, sensornum, + &reading, &conv_reading); + if (rv != SA_OK) { + printf("raw=%x conv_ret=%d\n", reading.Raw, rv); + /* printf("conv_rv=%s\n", decode_error(rv)); */ + return(rv); + } else { + reading.Interpreted.Type = conv_reading.Interpreted.Type; + reading.Interpreted.Value.SensorUint32 = + conv_reading.Interpreted.Value.SensorUint32; + } + } +#endif + + /* Determine units of interpreted reading */ + i = sensorrec->DataFormat.BaseUnits; + if (i > NSU) i = 0; + unit = units[i]; + /* We know that reading.Type is float for the chosen sensor. */ +#ifdef HPI_A + printf(" = %05.2f %s \n", + reading.Interpreted.Value.SensorFloat32, unit); +#else + printf(" = %05.2f %s \n", reading.Value.SensorFloat64, unit); +#endif + +/* Retrieve current threshold setings, twice */ +/* once for backup and once for modification */ + + /* Get backup copy */ + rv = saHpiSensorThresholdsGet( + sessionid, resourceid, sensornum, &senstbuff1); + if (rv != SA_OK) { + printf( "saHpiSensorThresholdsGet error %d\n",rv); return(rv); } + /* OpenHPI 2.0.0 ipmi plugin returns -1006 timeout here, why ???? */ + + /* Get modification copy */ + rv = saHpiSensorThresholdsGet( + sessionid, resourceid, sensornum, &senstbuff2); + if (rv != SA_OK) { + printf( "saHpiSensorThresholdsGet error %d\n",rv); return(rv); } + + /* Display current thresholds */ + if (rv == SA_OK) { + printf( " Current\n"); + ShowThresh( &senstbuff2, sensorrec->ThresholdDefn.ReadThold); + } + +/* Set new threshold to current reading + 10% */ +#ifdef HPI_A + if (fFan) { + senstbuff2.LowMajor.Interpreted.Value.SensorFloat32 = + reading.Interpreted.Value.SensorFloat32 * (SaHpiFloat32T)1.10; + } else { + senstbuff2.UpMinor.Interpreted.Value.SensorFloat32 = + reading.Interpreted.Value.SensorFloat32 * (SaHpiFloat32T)0.90; + senstbuff2.UpMajor.Interpreted.Value.SensorFloat32 = + reading.Interpreted.Value.SensorFloat32 * (SaHpiFloat32T)0.05; + } + if (fdebug) { + printf( "ValuesPresent = %x\n", senstbuff2.LowMajor.ValuesPresent); + printf( "Values Mask = %x\n", (SAHPI_SRF_RAW)); + } + senstbuff2.LowMajor.ValuesPresent = + senstbuff2.LowMajor.ValuesPresent ^ (SAHPI_SRF_RAW); + if (fdebug) + printf( "ValuesPresent = %x\n", senstbuff2.LowMajor.ValuesPresent); +#else + /* If fan type, set LowMajor, if temp type, set HighMinor. */ + if (fFan) { + senstbuff2.LowMajor.Value.SensorFloat64 = + reading.Value.SensorFloat64 * (SaHpiFloat64T)1.10; + } else { /* usually Temperature sensor */ + senstbuff2.UpMinor.Value.SensorFloat64 = + reading.Value.SensorFloat64 * (SaHpiFloat64T)0.90; + senstbuff2.UpMajor.Value.SensorFloat64 = + reading.Value.SensorFloat64 * (SaHpiFloat64T)0.95; + } +#endif + + /* Display new current thresholds */ + if (rv == SA_OK) { + printf( " New\n"); + ShowThresh( &senstbuff2, sensorrec->ThresholdDefn.ReadThold); + } + +#ifdef HPI_A + /* See what Events are Enabled */ + rv = saHpiSensorEventEnablesGet( + sessionid, resourceid, sensornum, &enables1); + if (rv != SA_OK) { + printf( "saHpiSensorEventEnablesGet error %d\n",rv); return(rv); } + + printf( "Sensor Event Enables: \n"); + printf( " Sensor Status = %x\n", enables1.SensorStatus); + printf( " Assert Events = %x\n", enables1.AssertEvents); + printf( " Deassert Events = %x\n", enables1.DeassertEvents); +#endif + +/* + enables1.AssertEvents = 0x0400; + enables1.DeassertEvents = 0x0400; + rv = saHpiSensorEventEnablesSet( + sessionid, resourceid, sensornum, &enables1); + if (rv != SA_OK) return(rv); +*/ + + +/************************ + Temporary exit */ +/* + return(rv); +*/ + +/* Subscribe to New Events, only */ +printf( "Subscribe to events\n"); +#ifdef HPI_A + rv = saHpiSubscribe( sessionid, (SaHpiBoolT)0 ); +#else + rv = saHpiSubscribe( sessionid ); +#endif + if (rv != SA_OK) { + printf( "saHpiSubscribe error %d\n",rv); return(rv); } + +/* Set new thresholds */ +printf( "Set new thresholds\n"); + + rv = saHpiSensorThresholdsSet( + sessionid, resourceid, sensornum, &senstbuff2); + if (rv != SA_OK) { + printf( "saHpiSensorThresholdsSet error %d\n",rv); + /* rv2 = saHpiUnsubscribe( sessionid ); + if (fxdebug) printf("saHpiUnsubscribe, rv = %d\n",rv2); + return(rv); */ + } + +/* Go wait on event to occur */ +printf( "Go and get the event\n"); + eventflag = 0; + while ( eventflag == 0) { +#ifdef HPI_A + rv = saHpiEventGet( sessionid, timeout, &event, &rdr, &rptentry ); +#else + timeout = SAHPI_TIMEOUT_BLOCK; + timeout = SAHPI_TIMEOUT_IMMEDIATE; /* use this if not threaded */ + rv = saHpiEventGet( sessionid, timeout, &event, &rdr, &rptentry, NULL); +#endif + if (rv != SA_OK) { + if (rv == SA_ERR_HPI_TIMEOUT) { + printf( "Time expired during EventGet - Test FAILED\n"); + /* Reset to the original thresholds */ + printf( "Reset thresholds\n"); + rv = saHpiSensorThresholdsSet( + sessionid, resourceid, sensornum, &senstbuff1); + if (rv != SA_OK) return(rv); + + /* Re-read threshold values */ + rv = saHpiSensorThresholdsGet( + sessionid, resourceid, sensornum, &senstbuff2); + if (rv != SA_OK) return(rv); + return(rv); + } else { + printf( "Error %d during EventGet - Test FAILED\n",rv); + return(rv); + } + } + +/* Decode the event information */ +printf( "Decode event info\n"); + if (event.EventType == SAHPI_ET_SENSOR) { + printf( "Sensor # = %2d Severity = %2x\n", + event.EventDataUnion.SensorEvent.SensorNum, event.Severity ); + if (event.EventDataUnion.SensorEvent.SensorNum == sensornum) { + eventflag = 1; + printf( "Got it - Test PASSED\n"); + } + } + } +/* Reset to the original thresholds */ +printf( "Reset thresholds\n"); + rv = saHpiSensorThresholdsSet( + sessionid, resourceid, sensornum, &senstbuff1); + if (rv != SA_OK) { + printf( "saHpiSensorThresholdsSet error %d\n",rv); + rv2 = saHpiUnsubscribe( sessionid ); + if (fxdebug) printf("saHpiUnsubscribe, rv = %d\n",rv2); + return(rv); + } else { + /* Re-read threshold values */ + rv = saHpiSensorThresholdsGet( sessionid, resourceid, sensornum, + &senstbuff2); + if (rv != SA_OK) { + printf( "saHpiSensorThresholdsGet error %d\n",rv); + } else { /* rv == SA_OK */ + /* Display reset thresholds */ + printf( " Reset\n"); + ShowThresh( &senstbuff2, sensorrec->ThresholdDefn.ReadThold); + } + } /*end-else SA_OK*/ + +/* Unsubscribe to future events */ +printf( "Unsubscribe\n"); + rv2 = saHpiUnsubscribe( sessionid ); + if (fxdebug) printf("saHpiUnsubscribe, rv = %d\n",rv2); + + return(rv); +} /*end DoEvent*/ + +/* + * findmatch + * returns offset of the match if found, or -1 if not found. + */ +static int +findmatch(char *buffer, int sbuf, char *pattern, int spattern, char figncase) +{ + int c, j, imatch; + j = 0; + imatch = 0; + for (j = 0; j < sbuf; j++) { + if (sbuf - j < spattern && imatch == 0) return (-1); + c = buffer[j]; + if (c == pattern[imatch]) { + imatch++; + if (imatch == spattern) return (++j - imatch); + } else if (pattern[imatch] == '?') { /*wildcard char*/ + imatch++; + if (imatch == spattern) return (++j - imatch); + } else if (figncase == 1) { + if ((c & 0x5f) == (pattern[imatch] & 0x5f)) { + imatch++; + if (imatch == spattern) return (++j - imatch); + } else + imatch = 0; + } else + imatch = 0; + } + return (-1); +} /*end findmatch */ + +int +main(int argc, char **argv) +{ + int c; +#ifdef HPI_A + SaHpiVersionT hpiVer; + SaHpiRptInfoT rptinfo; +#endif + SaHpiSessionIdT sessionid; + SaHpiRptEntryT rptentry; + SaHpiEntryIdT rptentryid; + SaHpiEntryIdT nextrptentryid; + SaHpiEntryIdT entryid; + SaHpiEntryIdT nextentryid; + SaHpiResourceIdT resourceid; + SaHpiRdrT rdr; + int firstpass = 1; + SaErrorT rv; + + printf("%s ver %s\n", progname,progver); + sensor_name = (char *)strdup(s_name); + while ( (c = getopt( argc, argv,"ms:xz?")) != EOF ) + switch(c) + { + case 'z': fxdebug = 1; /* fall thru to include next setting */ + case 'x': fdebug = 1; break; + case 'm': + sensor_name = (char *)strdup(sm_name); + fFan = 0; /*assume not a Fan */ + break; + case 's': + fsensor = 1; + if (optarg) { + sensor_name = (char *)strdup(optarg); + } + break; + default: + printf("Usage: %s [-xm] [-s sensor_descriptor]\n", progname); + printf(" -s Sensor descriptor\n"); + printf(" -m use Mullins sensor descriptor\n"); + printf(" -x Display debug messages\n"); + printf(" -z Display extra debug messages\n"); + exit(1); + } +#ifdef HPI_A + inv = (SaHpiInventoryDataT *)&inbuff[0]; + + rv = saHpiInitialize(&hpiVer); + + if (rv != SA_OK) { + printf("saHpiInitialize error %d\n",rv); + exit(-1); + } + rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + printf("saHpiSessionOpen error %d\n",rv); + exit(-1); + } + + if (fdebug) printf("Starting Discovery ...\n"); + rv = saHpiResourcesDiscover(sessionid); + if (fdebug) printf("saHpiResourcesDiscover rv = %d\n",rv); + + rv = saHpiRptInfoGet(sessionid,&rptinfo); + if (fxdebug) printf("saHpiRptInfoGet rv = %d\n",rv); + if (fdebug) printf("RptInfo: UpdateCount = %x, UpdateTime = %lx\n", + rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp); + +#else + rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + printf("saHpiSessionOpen error %d\n",rv); + exit(-1); + } + if (fdebug) printf("Starting Discovery ...\n"); + rv = saHpiDiscover(sessionid); + if (fdebug) printf("saHpiResourcesDiscover rv = %d\n",rv); + + // rv = saHpiDomainInfoGet(sessionid,&rptinfo); + { + /* + * If OpenHPI, we need to wait extra time before doing + * ThresholdsGet because its discovery isn't really done. + */ + sleep(5); + } +#endif + + /* walk the RPT list */ + rptentryid = SAHPI_FIRST_ENTRY; + while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry); + if (rv == SA_OK) + { + /* walk the RDR list for this RPT entry */ + entryid = SAHPI_FIRST_ENTRY; +#ifdef HPI_A + rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0; +#endif + resourceid = rptentry.ResourceId; + + if (fdebug) printf("rptentry[%d] resourceid=%d\n", entryid,resourceid); + + printf("Resource Tag: %s\n", rptentry.ResourceTag.Data); + while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRdrGet(sessionid,resourceid, entryid,&nextentryid, &rdr); + + if (fxdebug) printf("saHpiRdrGet[%d] rv = %d\n",entryid,rv); + + if (rv == SA_OK) + { + if (rdr.RdrType == SAHPI_SENSOR_RDR) + { + /*type 2 includes sensor and control records*/ + rdr.IdString.Data[rdr.IdString.DataLength] = 0; +#ifdef OLD + if (strncmp(rdr.IdString.Data, sensor_name, + rdr.IdString.DataLength) == 0) +#else + if (findmatch(rdr.IdString.Data,rdr.IdString.DataLength, + sensor_name, strlen(sensor_name),0) >= 0) +#endif + { + printf( "%02d %s\t", rdr.RecordId, rdr.IdString.Data); + rv = DoEvent( sessionid, resourceid, &rdr.RdrTypeUnion.SensorRec); + if (rv != SA_OK) + printf( "Returned Error from DoEvent: rv=%d\n", rv); + break; /* done with rdr loop */ + } + } + if (rv != SA_OK) + printf( "Returned HPI Error: rv=%d\n", rv); + entryid = nextentryid; + } + if (firstpass && entryid == SAHPI_LAST_ENTRY) { + /* Not found yet, so try again, looking for any Temp */ + sensor_name = s_pattn; + entryid = SAHPI_FIRST_ENTRY; + firstpass = 0; + fFan = 0; /*Temp not Fan*/ + } + } /*while rdr loop */ + rptentryid = nextrptentryid; + } + } /*while rpt loop*/ + rv = saHpiSessionClose(sessionid); +#ifdef HPI_A + rv = saHpiFinalize(); +#endif + exit(0); +} + /* end hpievent.c */ diff --git a/hpiutil/hpifru.c b/hpiutil/hpifru.c new file mode 100644 index 0000000..c18a5e2 --- /dev/null +++ b/hpiutil/hpifru.c @@ -0,0 +1,19 @@ +/* + * hpifru.c + * + * Author: Bill Barkley & Andy Cress + * Copyright (c) 2003-2004 Intel Corporation. + * + * 04/18/03 + * 06/09/03 - new CustomField parsing, including SystemGUID + * 02/19/04 ARCress - generalized BMC tag parsing, created IsTagBmc() + * 05/05/04 ARCress - added OpenHPI Mgt Ctlr tag to IsTagBmc() + * 09/22/04 ARCress - invbuf size bigger, check null ptr in fixstr + * 10/14/04 ARCress - added HPI_B logic, incomplete + */ +#ifdef HPI_A +#include "hpifrua.c" +#else +#include "hpifrub.c" +#endif +/* end hpifru.c */ diff --git a/hpiutil/hpifrua.c b/hpiutil/hpifrua.c new file mode 100644 index 0000000..ae41a7d --- /dev/null +++ b/hpiutil/hpifrua.c @@ -0,0 +1,550 @@ +/* + * hpifrua.c (hpifru.c for HPI_A) + * + * Author: Bill Barkley & Andy Cress + * Copyright (c) 2003-2005 Intel Corporation. + * + * 04/18/03 + * 06/09/03 - new CustomField parsing, including SystemGUID + * 02/19/04 ARCress - generalized BMC tag parsing, created IsTagBmc() + * 05/05/04 ARCress - added OpenHPI Mgt Ctlr tag to IsTagBmc() + * 09/22/04 ARCress - inbuff size bigger, check null ptr in fixstr + * 01/11/05 ARCress - skip INVENTORY RDRs that return errors + * 03/16/05 ARCress - make sure asset tag is BMC for writes + */ +/*M* +Copyright (c) 2003-2005, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + a.. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + b.. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + c.. Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *M*/ + +#include +#include +#include +#include +#include +#include "SaHpi.h" + +#define NCT 25 + +char progver[] = "1.4 HPI-A"; +char progname[] = "hpifru"; +char *chasstypes[NCT] = { + "Not Defined", "Other", "Unknown", "Desktop", "Low Profile Desktop", + "Pizza Box", "Mini Tower", "Tower", "Portable", "Laptop", + "Notebook", "Handheld", "Docking Station", "All in One", "Subnotebook", + "Space Saving", "Lunch Box", "Main Server", "Expansion", "SubChassis", + "Buss Expansion Chassis", "Peripheral Chassis", "RAID Chassis", + "Rack-Mount Chassis", "New" +}; +int fasset = 0; +int fdebug = 0; +int fxdebug = 0; +int i,j,k = 0; +SaHpiUint32T buffersize; +SaHpiUint32T actualsize; +char *asset_tag; +char inbuff[2048]; +char outbuff[1024]; +SaHpiInventoryDataT *inv; +SaHpiInventChassisTypeT chasstype; +SaHpiInventGeneralDataT *dataptr; +SaHpiTextBufferT *strptr; + +#ifdef ANYINVENT +static int +IsTagBmc(char *dstr, int dlen) +{ + /* if OpenHPI, always return TRUE for any Inventory RDR */ + return(1); +} +#else +char bmctag[] = "Basbrd Mgmt Ctlr"; /* see IsTagBmc() */ +char bmctag2[] = "Management Controller"; /* see IsTagBmc() */ +/* + * findmatch + * returns offset of the match if found, or -1 if not found. + */ +static int +findmatch(char *buffer, int sbuf, char *pattern, int spattern, char figncase) +{ + int c, j, imatch; + j = 0; + imatch = 0; + for (j = 0; j < sbuf; j++) { + if (sbuf - j < spattern && imatch == 0) return (-1); + c = buffer[j]; + if (c == pattern[imatch]) { + imatch++; + if (imatch == spattern) return (++j - imatch); + } else if (pattern[imatch] == '?') { /*wildcard char*/ + imatch++; + if (imatch == spattern) return (++j - imatch); + } else if (figncase == 1) { + if ((c & 0x5f) == (pattern[imatch] & 0x5f)) { + imatch++; + if (imatch == spattern) return (++j - imatch); + } else + imatch = 0; + } else + imatch = 0; + } + return (-1); +} /*end findmatch */ + +static int +IsTagBmc(char *dstr, int dlen) +{ + int ret = 0; + if (strncmp(dstr, bmctag, sizeof(bmctag)) == 0) /* Sahalee */ + ret = 1; + else if (findmatch(dstr,dlen,"BMC",3,1) >= 0) /* mBMC or other */ + ret = 1; + else if (findmatch(dstr,dlen,bmctag2,sizeof(bmctag2),1) >= 0) + ret = 1; /* BMC tag for OpenHPI with ipmi plugin */ + return(ret); +} +#endif + +static void +fixstr(SaHpiTextBufferT *strptr) +{ + size_t datalen; + + outbuff[0] = 0; + if (strptr == NULL) return; + datalen = strptr->DataLength; + if (datalen > sizeof(outbuff)) datalen = sizeof(outbuff) - 1; + if (datalen != 0) { + strncpy ((char *)outbuff, (char *)strptr->Data, datalen); + outbuff[datalen] = 0; + if (fdebug) { + printf("TextBuffer: %s, len=%d, dtype=%x lang=%d\n", + outbuff, strptr->DataLength, + strptr->DataType, strptr->Language); + } + } +} + +static void +prtchassinfo(void) +{ + chasstype = (SaHpiInventChassisTypeT)inv->DataRecords[i]->RecordData.ChassisInfo.Type; + for (k=0; kDataRecords[i]->RecordData.ChassisInfo.GeneralData; + strptr=dataptr->Manufacturer; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Chassis Manufacturer: %s\n", outbuff); + + strptr=dataptr->ProductName; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Chassis Name : %s\n", outbuff); + + strptr=dataptr->ProductVersion; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Chassis Version : %s\n", outbuff); + + strptr=dataptr->ModelNumber; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Chassis Model Number: %s\n", outbuff); + + strptr=dataptr->SerialNumber; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Chassis Serial # : %s\n", outbuff); + + strptr=dataptr->PartNumber; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Chassis Part Number : %s\n", outbuff); + + strptr=dataptr->FileId; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Chassis FRU File ID : %s\n", outbuff); + + strptr=dataptr->AssetTag; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Chassis Asset Tag : %s\n", outbuff); + if (dataptr->CustomField[0] != 0) + { + if (dataptr->CustomField[0]->DataLength != 0) + strncpy ((char *)outbuff, (char *)dataptr->CustomField[0]->Data, + dataptr->CustomField[0]->DataLength); + outbuff[dataptr->CustomField[0]->DataLength] = 0; + printf( "Chassis OEM Field : %s\n", outbuff); + } +} + +static void +prtprodtinfo(void) +{ + int j; + dataptr = (SaHpiInventGeneralDataT *)&inv->DataRecords[i]->RecordData.ProductInfo; + strptr=dataptr->Manufacturer; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Product Manufacturer: %s\n", outbuff); + + strptr=dataptr->ProductName; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Product Name : %s\n", outbuff); + + strptr=dataptr->ProductVersion; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Product Version : %s\n", outbuff); + + strptr=dataptr->ModelNumber; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Product Model Number: %s\n", outbuff); + + strptr=dataptr->SerialNumber; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Product Serial # : %s\n", outbuff); + + strptr=dataptr->PartNumber; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Product Part Number : %s\n", outbuff); + + strptr=dataptr->FileId; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Product FRU File ID : %s\n", outbuff); + + strptr=dataptr->AssetTag; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Product Asset Tag : %s\n", outbuff); + + for (j = 0; j < 10; j++) { + int ii; + if (dataptr->CustomField[j] != NULL) { + if ((dataptr->CustomField[j]->DataType == 0) && + (dataptr->CustomField[j]->DataLength == 16)) { /*binary GUID*/ + printf( "IPMI SystemGUID : "); + for (ii=0; ii< dataptr->CustomField[j]->DataLength; ii++) + printf("%02x", dataptr->CustomField[j]->Data[ii]); + printf("\n"); + } else { /* other text field */ + dataptr->CustomField[j]->Data[ + dataptr->CustomField[j]->DataLength] = 0; + if (fdebug) { + printf("TextBuffer: %s, len=%d, dtype=%x lang=%d\n", + dataptr->CustomField[j]->Data, + dataptr->CustomField[j]->DataLength, + dataptr->CustomField[j]->DataType, + dataptr->CustomField[j]->Language); + } + printf( "Product OEM Field : %s\n", + dataptr->CustomField[j]->Data); + } + } else /* NULL pointer */ + break; + } /*end for*/ +} + +static void +prtboardinfo(void) +{ + dataptr = (SaHpiInventGeneralDataT *)&inv->DataRecords[i]->RecordData.BoardInfo; + strptr=dataptr->Manufacturer; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Board Manufacturer : %s\n", outbuff); + + strptr=dataptr->ProductName; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Board Product Name : %s\n", outbuff); + + strptr=dataptr->ModelNumber; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Board Model Number : %s\n", outbuff); + + strptr=dataptr->PartNumber; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Board Part Number : %s\n", outbuff); + + strptr=dataptr->ProductVersion; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Board Version : %s\n", outbuff); + + strptr=dataptr->SerialNumber; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Board Serial # : %s\n", outbuff); + + strptr=dataptr->FileId; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Board FRU File ID : %s\n", outbuff); + + strptr=dataptr->AssetTag; + fixstr((SaHpiTextBufferT *)strptr); + printf( "Board Asset Tag : %s\n", outbuff); + + if (dataptr->CustomField[0] != 0) + { + if (dataptr->CustomField[0]->DataLength != 0) + strncpy ((char *)outbuff, (char *)dataptr->CustomField[0]->Data, + dataptr->CustomField[0]->DataLength); + outbuff[dataptr->CustomField[0]->DataLength] = 0; + printf( "Board OEM Field : %s\n", outbuff); + } +} + +int +main(int argc, char **argv) +{ + int prodrecindx=0; + int asset_len=0; + int c; + SaErrorT rv; + SaHpiVersionT hpiVer; + SaHpiSessionIdT sessionid; + SaHpiRptInfoT rptinfo; + SaHpiRptEntryT rptentry; + SaHpiEntryIdT rptentryid; + SaHpiEntryIdT nextrptentryid; + SaHpiEntryIdT entryid; + SaHpiEntryIdT nextentryid; + SaHpiResourceIdT resourceid; + SaHpiRdrT rdr; + SaHpiEirIdT eirid; + + printf("%s ver %s\n",progname,progver); + + while ( (c = getopt( argc, argv,"a:xz?")) != EOF ) + switch(c) { + case 'z': fxdebug = 1; /* fall thru to include next setting */ + case 'x': fdebug = 1; break; + case 'a': + fasset = 1; + if (optarg) + { + asset_tag = (char *)strdup(optarg); + asset_len = strlen(optarg); + } + /* + printf( "String Length = %d\n", asset_len); + printf( "String Length = %d\n", strlen(optarg)); + */ + break; + default: + printf("Usage: %s [-x] [-a asset_tag]\n", progname); + printf(" -a Sets the asset tag\n"); + printf(" -x Display debug messages\n"); + printf(" -z Display extra debug messages\n"); + exit(1); + } + inv = (SaHpiInventoryDataT *)&inbuff[0]; + rv = saHpiInitialize(&hpiVer); + if (rv != SA_OK) { + printf("saHpiInitialize error %d\n",rv); + exit(-1); + } + rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + printf("saHpiSessionOpen error %d\n",rv); + exit(-1); + } + + rv = saHpiResourcesDiscover(sessionid); + if (fxdebug) printf("saHpiResourcesDiscover rv = %d\n",rv); + rv = saHpiRptInfoGet(sessionid,&rptinfo); + if (fxdebug) printf("saHpiRptInfoGet rv = %d\n",rv); + if (fdebug) printf("RptInfo: UpdateCount = %x, UpdateTime = %lx\n", + rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp); + + /* walk the RPT list */ + rptentryid = SAHPI_FIRST_ENTRY; + while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry); + if (rv != SA_OK) printf("RptEntryGet: rv = %d\n",rv); + if (rv == SA_OK) + { + /* walk the RDR list for this RPT entry */ + entryid = SAHPI_FIRST_ENTRY; + /* OpenHPI sometimes has bad RPT DataLength here. */ + rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0; + resourceid = rptentry.ResourceId; + printf("Resource Tag: %s\n", rptentry.ResourceTag.Data); + if (fdebug) printf("rptentry[%d] resourceid=%d\n", rptentryid,resourceid); + while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRdrGet(sessionid,resourceid, entryid,&nextentryid, &rdr); + if (fxdebug) printf("saHpiRdrGet[%d] rv = %d\n",entryid,rv); + if (rv == SA_OK) + { + if (rdr.RdrType == SAHPI_INVENTORY_RDR) + { + /*type 3 includes inventory records*/ + eirid = rdr.RdrTypeUnion.InventoryRec.EirId; + rdr.IdString.Data[rdr.IdString.DataLength] = 0; + if (fdebug) printf( "RDR[%d]: Inventory, type=%d num=%d %s\n", + rdr.RecordId, rdr.RdrType, eirid, rdr.IdString.Data); + else printf("RDR[%d]: %s \n",rdr.RecordId,rdr.IdString.Data); + + buffersize = sizeof(inbuff); + if (fdebug) printf("BufferSize=%d InvenDataRecSize=%d\n", + buffersize, sizeof(inbuff)); + /* Always get inventory data, not just for BMC */ + /* if ( IsTagBmc(rdr.IdString.Data, rdr.IdString.DataLength) ) */ + { + memset(inv,0,buffersize); + if (fdebug) printf("InventoryDataRead (%d, %d, %d, %d, %p, %d)\n", + sessionid, resourceid, eirid, buffersize, inv, + actualsize); + + rv = saHpiEntityInventoryDataRead( sessionid, resourceid, + eirid, buffersize, inv, &actualsize); + if (fdebug) { + printf("saHpiEntityInventoryDataRead[%d] rv = %d\n",eirid,rv); + printf("buffersize = %d, ActualSize=%d\n", + buffersize,actualsize); + } + if (rv == SA_OK || rv == -2000) // (0 - buffersize)) + { + /* Walk thru the list of inventory data */ + for (i=0; inv->DataRecords[i] != NULL; i++) + { + if (fdebug) printf( "Record index=%d type=%x len=%d\n", + i, inv->DataRecords[i]->RecordType, + inv->DataRecords[i]->DataLength); + if (inv->Validity == SAHPI_INVENT_DATA_VALID) + { + switch (inv->DataRecords[i]->RecordType) + { + case SAHPI_INVENT_RECTYPE_INTERNAL_USE: + if (fdebug) printf( "Internal Use\n"); + break; + case SAHPI_INVENT_RECTYPE_PRODUCT_INFO: + if (fdebug) printf( "Product Info\n"); + prodrecindx = i; + prtprodtinfo(); + break; + case SAHPI_INVENT_RECTYPE_CHASSIS_INFO: + if (fdebug) printf( "Chassis Info\n"); + prtchassinfo(); + break; + case SAHPI_INVENT_RECTYPE_BOARD_INFO: + if (fdebug) printf( "Board Info\n"); + prtboardinfo(); + break; + case SAHPI_INVENT_RECTYPE_OEM: + if (fdebug) printf( "OEM Record\n"); + break; + default: + printf(" Invalid Invent Rec Type =%x\n", + inv->DataRecords[i]->RecordType); + break; + } + } + } + /* Cannot guarantee writable unless it is the BMC. */ + if (IsTagBmc(rdr.IdString.Data,rdr.IdString.DataLength) + && (fasset == 1)) + { /* handle asset tag */ + SaHpiTextBufferT aTag; + if (fdebug) printf( "Inventory = %s\n", rdr.IdString.Data); + /* prodrecindx contains index for Prod Rec Type */ + dataptr = (SaHpiInventGeneralDataT *) + &inv->DataRecords[prodrecindx]->RecordData.ProductInfo; + dataptr->AssetTag = &aTag; + strptr=dataptr->AssetTag; + strptr->DataType = SAHPI_TL_TYPE_LANGUAGE; + strptr->Language = SAHPI_LANG_ENGLISH; + strptr->DataLength = (SaHpiUint8T)asset_len; + strncpy( (char *)strptr->Data, (char *)asset_tag,asset_len); + strptr->Data[asset_len] = 0; + + printf( "Writing new asset tag: %s\n",(char *)strptr->Data); + rv = saHpiEntityInventoryDataWrite( sessionid, + resourceid, eirid, inv); + printf("Return Write Status = %d\n", rv); + + if (rv == SA_OK) + { + printf ("Good write - re-reading!\n"); + rv = saHpiEntityInventoryDataRead( sessionid, resourceid, + eirid, buffersize, inv, &actualsize); + if (fxdebug) printf( + "saHpiEntityInventoryDataRead[%d] rv = %d\n", eirid, rv); + if (fdebug) printf("ActualSize=%d\n", actualsize); + if (rv == SA_OK) + { + /* Walk thru the list of inventory data */ + for (i=0; inv->DataRecords[i] != NULL; i++) + { + if (inv->Validity == SAHPI_INVENT_DATA_VALID) + { + if (fdebug) printf( "Index = %d type=%x len=%d\n", + i, inv->DataRecords[i]->RecordType, + inv->DataRecords[i]->DataLength); + switch (inv->DataRecords[i]->RecordType) + { + case SAHPI_INVENT_RECTYPE_INTERNAL_USE: + if (fdebug) printf( "Internal Use\n"); + break; + case SAHPI_INVENT_RECTYPE_PRODUCT_INFO: + if (fdebug) printf( "Product Info\n"); + prtprodtinfo(); + break; + case SAHPI_INVENT_RECTYPE_CHASSIS_INFO: + if (fdebug) printf( "Chassis Info\n"); + prtchassinfo(); + break; + case SAHPI_INVENT_RECTYPE_BOARD_INFO: + if (fdebug) printf( "Board Info\n"); + prtboardinfo(); + break; + case SAHPI_INVENT_RECTYPE_OEM: + if (fdebug) printf( "OEM Record\n"); + break; + default: + printf(" Invalid Invent Rec Type =%x\n", + inv->DataRecords[i]->RecordType); + break; + } + } + } + } /*re-walk the inventory record list */ + } /* Good write - re-read */ + } /* check asset tag flag */ + } else { + /* It is an Inventory RDR, but gets error reading FRU. */ + if (fdebug) printf("\tinventory read error, rv=%d\n", rv); + rv = 0; /* keep trying another RDR */ + entryid = nextentryid; + continue; + } + } + } /* Inventory Data Records - Type 3 */ + entryid = nextentryid; + } + } + rptentryid = nextrptentryid; + } + } + rv = saHpiSessionClose(sessionid); + rv = saHpiFinalize(); + exit(0); +} + /* end hpifru.c */ diff --git a/hpiutil/hpifrub.c b/hpiutil/hpifrub.c new file mode 100644 index 0000000..822127c --- /dev/null +++ b/hpiutil/hpifrub.c @@ -0,0 +1,619 @@ +/* -*- linux-c -*- + * + * hpiinv.c + * + * Copyright (c) 2003-2005 by Intel Corp. + * (C) Copyright IBM Corp. 2004 + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This + * file and program are licensed under a BSD style license. See + * the Copying file included with the OpenHPI distribution for + * full licensing terms. + * + * Authors: + * Andy Cress + * Peter D. Phan + * Renier Morales + * Tariq Shureih + * Racing Guo + * + * Log: + * 6/29/04 Copied from hpifru.c and modified for general use + * 11/30/04 ver 0.2 for openhpi-2.0.0 + * 2/09/05 ARCress re-merged with hpifru.c, adding IdrFieldSet, + * generalized for other HPI libraris also. + */ +// #define OPENHPI_USED 1 + +#include +#include +#include +#include +#include +#include +#ifdef OPENHPI_USED +#include +#endif + +#define NCT 25 +#define MAX_STRSIZE 64 + +char progver[] = "1.5 HPI-B"; +char progname[] = "hpiinv"; +char *chasstypes[NCT] = { + "Not Defined", "Other", "Unknown", "Desktop", "Low Profile Desktop", + "Pizza Box", "Mini Tower", "Tower", "Portable", "Laptop", + "Notebook", "Handheld", "Docking Station", "All in One", "Subnotebook", + "Space Saving", "Lunch Box", "Main Server", "Expansion", "SubChassis", + "Buss Expansion Chassis", "Peripheral Chassis", "RAID Chassis", + "Rack-Mount Chassis", "New" +}; +int fasset = 0; +int fverbose = 0; +int foundasset = 0; +int fdebug = 0; +int fzdebug = 0; +int i,j,k = 0; +SaHpiUint32T buffersize; +SaHpiUint32T actualsize; +char inbuff[2048]; +char outbuff[1024]; +SaHpiIdrAreaHeaderT *inv; +SaHpiIdrFieldTypeT chasstype; +SaHpiTextBufferT *strptr; +struct { + SaHpiResourceIdT rid; + SaHpiEntryIdT idrid; + SaHpiEntryIdT areaid; + SaHpiEntryIdT fieldid; + char *tag; + int tlen; + } atag; +#define NRW_ENTS 12 +SaHpiEntityTypeT rw_entities[NRW_ENTS] = { /*read-writable entities*/ + SAHPI_ENT_SYS_MGMNT_MODULE, + SAHPI_ENT_SYSTEM_BOARD, + SAHPI_ENT_FRONT_PANEL_BOARD, + SAHPI_ENT_SYSTEM_CHASSIS, + SAHPI_ENT_SYS_MGMNT_SOFTWARE, + SAHPI_ENT_COMPACTPCI_CHASSIS, + SAHPI_ENT_ADVANCEDTCA_CHASSIS, + SAHPI_ENT_RACK_MOUNTED_SERVER, + SAHPI_ENT_SYSTEM_BLADE, + SAHPI_ENT_SWITCH_BLADE, + SAHPI_ENT_SPEC_PROC_BLADE, + SAHPI_ENT_ALARM_MANAGER }; + +#ifdef BMCONLY +char bmctag[] = "Basbrd Mgmt Ctlr"; /* see IsTagBmc() */ +char bmctag2[] = "Management Controller"; /* see IsTagBmc() */ + +/* + * findmatch + * returns offset of the match if found, or -1 if not found. + */ +static int +findmatch(char *buffer, int sbuf, char *pattern, int spattern, char figncase) +{ + int c, j, imatch; + j = 0; + imatch = 0; + for (j = 0; j < sbuf; j++) { + if (sbuf - j < spattern && imatch == 0) return (-1); + c = buffer[j]; + if (c == pattern[imatch]) { + imatch++; + if (imatch == spattern) return (++j - imatch); + } else if (pattern[imatch] == '?') { /*wildcard char*/ + imatch++; + if (imatch == spattern) return (++j - imatch); + } else if (figncase == 1) { + if ((c & 0x5f) == (pattern[imatch] & 0x5f)) { + imatch++; + if (imatch == spattern) return (++j - imatch); + } else + imatch = 0; + } else + imatch = 0; + } + return (-1); +} /*end findmatch */ + +static int +IsTagBmc(char *dstr, int dlen) +{ + int ret = 0; + + if (strncmp(dstr, bmctag, sizeof(bmctag)) == 0) /* Sahalee */ + ret = 1; + else if (findmatch(dstr,dlen,"BMC",3,1) >= 0) /* mBMC or other */ + ret = 1; + else if (findmatch(dstr,dlen,bmctag2,sizeof(bmctag2),1) >= 0) + ret = 1; /* BMC tag for OpenHPI with ipmi plugin */ + return(ret); +} +#else +static int +IsTagBmc(char *dstr, int dlen) +{ + /* if OpenHPI, always return TRUE for any Inventory RDR */ + return(1); +} +#endif + +static int +ent_writable(SaHpiEntityPathT *ep, SaHpiIdrInfoT *idrinfo) +{ + int i, rv; + /* The IdrInfo ReadOnly field might be ok, but we don't + even want to attempt to write to DIMMs or Power Supplies, + even if the plugin reports it otherwise, so only check + for known writable entity types. */ + for (i = 0; i < NRW_ENTS; i++) + if (rw_entities[i] == ep->Entry[0].EntityType) break; + if (i >= NRW_ENTS) rv = 0; + else rv = 1; + return(rv); +} + +static void +fixstr(SaHpiTextBufferT *strptr, char *outstr) +{ + size_t datalen; + + if (outstr == NULL) return; + outstr[0] = 0; + if (strptr == NULL) return; + datalen = strptr->DataLength; + if (datalen > MAX_STRSIZE) datalen = MAX_STRSIZE-1; + if (datalen != 0) { + strncpy ((char *)outstr, (char *)strptr->Data, datalen); + outstr[datalen] = 0; + if (fdebug) { + printf("TextBuffer len=%d, dtype=%x lang=%d: %s\n", + strptr->DataLength,strptr->DataType,strptr->Language, + strptr->Data ); + } + } +#ifdef LENGTH_BAD + else /* may be bogus length, try anyway */ + strcpy ((char *)outstr, (char *)strptr->Data); +#endif +} + +#define NAREATYP 6 +static struct { SaHpiUint8T type; char *str; +} map_areatype[NAREATYP] = { + { SAHPI_IDR_AREATYPE_INTERNAL_USE, "Internal Area" }, + { SAHPI_IDR_AREATYPE_CHASSIS_INFO, "Chassis Area" }, + { SAHPI_IDR_AREATYPE_BOARD_INFO, "Board Area" }, + { SAHPI_IDR_AREATYPE_PRODUCT_INFO, "Product Area" }, + { SAHPI_IDR_AREATYPE_OEM, "OEM Area" }, + { SAHPI_IDR_AREATYPE_UNSPECIFIED, "Unspecified Area" } +}; + +#define NFIELDTYP 11 +static struct { SaHpiUint8T type; char *str; +} map_fieldtype[NFIELDTYP] = { + { SAHPI_IDR_FIELDTYPE_CHASSIS_TYPE, "Chassis Type "}, + { SAHPI_IDR_FIELDTYPE_MFG_DATETIME, "Mfg DateTime "}, + { SAHPI_IDR_FIELDTYPE_MANUFACTURER, "Manufacturer "}, + { SAHPI_IDR_FIELDTYPE_PRODUCT_NAME, "Product Name "}, + { SAHPI_IDR_FIELDTYPE_PRODUCT_VERSION, "Product Versn"}, + { SAHPI_IDR_FIELDTYPE_SERIAL_NUMBER, "Serial Number"}, + { SAHPI_IDR_FIELDTYPE_PART_NUMBER, "Part Number "}, + { SAHPI_IDR_FIELDTYPE_FILE_ID, "File ID "}, + { SAHPI_IDR_FIELDTYPE_ASSET_TAG, "Asset Tag "}, + { SAHPI_IDR_FIELDTYPE_CUSTOM, "Custom Field "}, + { SAHPI_IDR_FIELDTYPE_UNSPECIFIED, "Unspecified "} +}; + +#define NEPTYPES 67 +struct { SaHpiEntityTypeT type; char *str; } map_epstr[NEPTYPES] = { + { SAHPI_ENT_ADD_IN_CARD, "ADD_IN_CARD" }, + { SAHPI_ENT_ADVANCEDTCA_CHASSIS, "ADVANCEDTCA_CHASSIS" }, + { SAHPI_ENT_ALARM_MANAGER, "ALARM_MANAGER" }, + { SAHPI_ENT_BACK_PANEL_BOARD, "BACK_PANEL_BOARD" }, + { SAHPI_ENT_BATTERY, "BATTERY" }, + { SAHPI_ENT_BIOS, "BIOS" }, + { SAHPI_ENT_BOARD_SET_SPECIFIC, "BOARD_SET_SPECIFIC" }, + { SAHPI_ENT_CHASSIS_BACK_PANEL_BOARD, "CHASSIS_BACK_PANEL_BOARD" }, + { SAHPI_ENT_CHASSIS_SPECIFIC, "CHASSIS_SPECIFIC" }, + { SAHPI_ENT_COMPACTPCI_CHASSIS, "COMPACTPCI_CHASSIS" }, + { SAHPI_ENT_COOLING_DEVICE, "COOLING_DEVICE" }, + { SAHPI_ENT_COOLING_UNIT, "COOLING_UNIT" }, + { SAHPI_ENT_DEVICE_BAY, "DEVICE_BAY" }, + { SAHPI_ENT_DISK_BAY, "DISK_BAY" }, + { SAHPI_ENT_DISK_BLADE, "DISK_BLADE" }, + { SAHPI_ENT_DISK_DRIVE, "DISK_DRIVE" }, + { SAHPI_ENT_DISK_DRIVE_BAY, "DISK_DRIVE_BAY" }, + { SAHPI_ENT_DISPLAY_PANEL, "DISPLAY_PANEL" }, + { SAHPI_ENT_DRIVE_BACKPLANE, "DRIVE_BACKPLANE" }, + { SAHPI_ENT_EXTERNAL_ENVIRONMENT, "EXTERNAL_ENVIRONMENT" }, + { SAHPI_ENT_FAN, "FAN" }, + { SAHPI_ENT_FRONT_PANEL_BOARD, "FRONT_PANEL_BOARD" }, + { SAHPI_ENT_GROUP, "GROUP" }, + { SAHPI_ENT_INTERCONNECT, "INTERCONNECT" }, + { SAHPI_ENT_IO_BLADE, "IO_BLADE" }, + { SAHPI_ENT_IO_SUBBOARD, "IO_SUBBOARD" }, + { SAHPI_ENT_MEMORY_DEVICE, "MEMORY_DEVICE" }, + { SAHPI_ENT_MEMORY_MODULE, "MEMORY_MODULE" }, + { SAHPI_ENT_OEM_SYSINT_SPECIFIC, "OEM_SYSINT_SPECIFIC" }, + { SAHPI_ENT_OPERATING_SYSTEM, "OPERATING_SYSTEM" }, + { SAHPI_ENT_OTHER, "OTHER" }, + { SAHPI_ENT_OTHER_CHASSIS_BOARD, "OTHER_CHASSIS_BOARD" }, + { SAHPI_ENT_OTHER_SYSTEM_BOARD, "OTHER_SYSTEM_BOARD" }, + { SAHPI_ENT_PERIPHERAL_BAY, "PERIPHERAL_BAY" }, + { SAHPI_ENT_PERIPHERAL_BAY_2, "PERIPHERAL_BAY_2" }, + { SAHPI_ENT_PHYSICAL_SLOT, "PHYSICAL_SLOT" }, + { SAHPI_ENT_POWER_DISTRIBUTION_UNIT, "POWER_DISTRIBUTION_UNIT" }, + { SAHPI_ENT_POWER_MGMNT, "POWER_MGMNT" }, + { SAHPI_ENT_POWER_MODULE, "POWER_MODULE" }, + { SAHPI_ENT_POWER_SUPPLY, "POWER_SUPPLY" }, + { SAHPI_ENT_POWER_SYSTEM_BOARD, "POWER_SYSTEM_BOARD" }, + { SAHPI_ENT_POWER_UNIT, "POWER_UNIT" }, + { SAHPI_ENT_PROCESSOR, "PROCESSOR" }, + { SAHPI_ENT_PROCESSOR_BOARD, "PROCESSOR_BOARD" }, + { SAHPI_ENT_PROCESSOR_MODULE, "PROCESSOR_MODULE" }, + { SAHPI_ENT_RACK, "RACK" }, + { SAHPI_ENT_RACK_MOUNTED_SERVER, "RACK_MOUNTED_SERVER" }, + { SAHPI_ENT_REMOTE, "REMOTE" }, + { SAHPI_ENT_ROOT, "ROOT" }, + { SAHPI_ENT_SBC_BLADE, "SBC_BLADE" }, + { SAHPI_ENT_SBC_SUBBOARD, "SBC_SUBBOARD" }, + { SAHPI_ENT_SHELF_MANAGER, "SHELF_MANAGER" }, + { SAHPI_ENT_SPEC_PROC_BLADE, "SPEC_PROC_BLADE" }, + { SAHPI_ENT_SUBBOARD_CARRIER_BLADE, "SUBBOARD_CARRIER_BLADE" }, + { SAHPI_ENT_SUB_CHASSIS, "SUB_CHASSIS" }, + { SAHPI_ENT_SUBRACK, "SUBRACK" }, + { SAHPI_ENT_SWITCH, "SWITCH" }, + { SAHPI_ENT_SWITCH_BLADE, "SWITCH_BLADE" }, + { SAHPI_ENT_SYS_EXPANSION_BOARD, "SYS_EXPANSION_BOARD" }, + { SAHPI_ENT_SYS_MGMNT_MODULE, "SYS_MGMNT_MODULE" }, + { SAHPI_ENT_SYS_MGMNT_SOFTWARE, "SYS_MGMNT_SOFTWARE" }, + { SAHPI_ENT_SYSTEM_BLADE, "SYSTEM_BLADE" }, + { SAHPI_ENT_SYSTEM_BOARD, "SYSTEM_BOARD" }, + { SAHPI_ENT_SYSTEM_BUS, "SYSTEM_BUS" }, + { SAHPI_ENT_SYSTEM_CHASSIS, "SYSTEM_CHASSIS" }, + { SAHPI_ENT_UNKNOWN, "UNKNOWN" }, + { SAHPI_ENT_UNSPECIFIED, "UNSPECIFIED" }, +}; + +static void print_epath(SaHpiEntityPathT *epath, int len); +static void print_epath(SaHpiEntityPathT *epath, int len) +{ + int i,j; + SaHpiEntityTypeT t; + char *pstr; + +#ifdef OPENHPI_USED + if (fverbose) { + oh_print_ep(epath, len); + } else +#endif + { + for (i = 0; i < SAHPI_MAX_ENTITY_PATH; i++) { + t = epath->Entry[i].EntityType; + pstr = ""; + for (j = 0; j < NEPTYPES; j++) { + if (t == map_epstr[j].type) { + pstr = map_epstr[j].str; + break; + } + } + if (j == NEPTYPES) j--; + printf("{%s:%d} ",pstr, epath->Entry[i].EntityLocation); + if (t == SAHPI_ENT_ROOT) break; + } + printf("\n"); + } + return; +} + +static void print_idrinfo(SaHpiIdrInfoT *idrInfo,int len); +static void print_idrinfo(SaHpiIdrInfoT *idrInfo,int len) +{ +#ifdef OPENHPI_USED + if (fverbose) { + oh_print_idrinfo(idrInfo, len); + } else +#endif + { /* don't need to show this if not fverbose */ + } +} + +static void print_idrareaheader(SaHpiIdrAreaHeaderT *areaHeader, int len); +static void print_idrareaheader(SaHpiIdrAreaHeaderT *areaHeader, int len) +{ + int i; +#ifdef OPENHPI_USED + if (fverbose) { + oh_print_idrareaheader(areaHeader, len); + } else +#endif + { + for (i = 0; i < NAREATYP; i++) { + if (map_areatype[i].type == areaHeader->Type) break; + } + if (i == NAREATYP) i--; + printf("AreaId[%d] %s\n",areaHeader->AreaId,map_areatype[i].str); + } +} + +static void print_idrfield(SaHpiIdrFieldT *field, int len); +static void print_idrfield(SaHpiIdrFieldT *field, int len) +{ + SaHpiTextBufferT *strptr; + char fieldstr[MAX_STRSIZE]; + int i; + +#ifdef OPENHPI_USED + if (fverbose) { + oh_print_idrfield(field, len); + } else +#endif + { + for (i = 0; i < NFIELDTYP; i++) { + if (map_fieldtype[i].type == field->Type) break; + } + if (i == NFIELDTYP) i--; + strptr = &(field->Field); + fixstr(strptr,fieldstr); /*stringify if needed*/ + printf(" FieldId[%d] %s : %s\n", + field->FieldId,map_fieldtype[i].str ,fieldstr); + } +} + +int walkInventory(SaHpiSessionIdT sessionid, SaHpiResourceIdT resourceid, + SaHpiIdrInfoT *idrInfo); +int walkInventory(SaHpiSessionIdT sessionid, SaHpiResourceIdT resourceid, + SaHpiIdrInfoT *idrInfo) +{ + + SaErrorT rv = SA_OK, + rvField = SA_OK; + + SaHpiUint32T numAreas; + SaHpiUint32T countAreas = 0; + SaHpiUint32T countFields = 0; + + SaHpiEntryIdT areaId; + SaHpiEntryIdT nextareaId; + SaHpiIdrAreaTypeT areaType; + SaHpiIdrAreaHeaderT areaHeader; + + SaHpiEntryIdT fieldId; + SaHpiEntryIdT nextFieldId; + SaHpiIdrFieldTypeT fieldType; + SaHpiIdrFieldT thisField; + + numAreas = idrInfo->NumAreas; + areaType = SAHPI_IDR_AREATYPE_UNSPECIFIED; + areaId = SAHPI_FIRST_ENTRY; + foundasset = 0; + while ((rv == SA_OK) && (areaId != SAHPI_LAST_ENTRY)) + { + rv = saHpiIdrAreaHeaderGet(sessionid, resourceid, + idrInfo->IdrId, areaType, + areaId, &nextareaId, + &areaHeader); + if (rv == SA_OK) { + countAreas++; + print_idrareaheader(&areaHeader, 8); + + fieldType = SAHPI_IDR_FIELDTYPE_UNSPECIFIED; + fieldId = SAHPI_FIRST_ENTRY; + countFields = 0; + + while ((rvField == SA_OK) && (fieldId != SAHPI_LAST_ENTRY)) + { + rvField = saHpiIdrFieldGet( sessionid, resourceid, + idrInfo->IdrId, + areaHeader.AreaId, fieldType, + fieldId, &nextFieldId, + &thisField); + if (fdebug) + printf("saHpiIdrFieldGet[%x] rv = %d type=%d\n", + idrInfo->IdrId,rvField, + thisField.Type); + if (rvField == SA_OK) { + countFields++; + print_idrfield(&thisField, 12); + if (thisField.Type == SAHPI_IDR_FIELDTYPE_ASSET_TAG) { + atag.rid = resourceid; + atag.idrid = idrInfo->IdrId; + atag.areaid = areaHeader.AreaId; + atag.fieldid = fieldId; + foundasset = 1; + } + } + fieldId = nextFieldId; + } /*while fields*/ + + if ( countFields != areaHeader.NumFields) + printf("Area Header error: areaHeader.NumFields %d, countFields %d\n", + areaHeader.NumFields, countFields); + } else { + printf("saHpiIdrAreaHeaderGet error %d\n",rv); + } + areaId = nextareaId; + + } /*while areas*/ + + if ((rv == SA_OK) && (countAreas != numAreas)) + printf("idrInfo error! idrInfo.NumAreas = %d; countAreas = %d\n", + numAreas, countAreas); + + if (countFields > 0) rv = 0; + return(rv); +} /*end walkInventory*/ + +int +main(int argc, char **argv) +{ + int c; + SaErrorT rv; + SaHpiSessionIdT sessionid; + SaHpiDomainInfoT rptinfo; + SaHpiRptEntryT rptentry; + SaHpiEntryIdT rptentryid; + SaHpiEntryIdT nextrptentryid; + SaHpiEntryIdT entryid; + SaHpiEntryIdT nextentryid; + SaHpiResourceIdT resourceid; + SaHpiRdrT rdr; + SaHpiIdrInfoT idrInfo; + SaHpiIdrIdT idrid; + int invfound = 0; + int nloops = 0; + + printf("%s ver %s\n",progname,progver); + atag.tlen = 0; + + while ( (c = getopt( argc, argv,"a:vxz?")) != EOF ) + switch(c) { + case 'z': fzdebug = 1; /* fall thru to include next setting */ + case 'x': fdebug = 1; break; + case 'v': fverbose = 1; break; + case 'a': + fasset = 1; + if (optarg) { + atag.tag = (char *)strdup(optarg); + atag.tlen = strlen(optarg); + } + break; + default: + printf("Usage: %s [-x] [-a asset_tag]\n", progname); + printf(" -a Sets the asset tag\n"); + printf(" -x Display debug messages\n"); + printf(" -z Display extra debug messages\n"); + exit(1); + } + + inv = (SaHpiIdrAreaHeaderT *)&inbuff[0]; + rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (fdebug) printf("saHpiSessionOpen rv = %d sessionid = %x\n",rv,sessionid); + if (rv != SA_OK) { + printf("saHpiSessionOpen error %d\n",rv); + exit(-1); + } + + rv = saHpiDomainInfoGet(sessionid,&rptinfo); + if (fdebug) printf("saHpiDomainInfoGet rv = %d\n",rv); + // if (fdebug) printf("RptInfo: UpdateCount = %x, UpdateTime = %lx\n", + // rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp); + + while (!invfound && (nloops < 7)) + { + /* + * The OpenHPI ipmi plugin has a bug whereby the FRU RDR is added + * much later, and always requires a rediscovery. (bug #1095256) + * This should not apply to other well-behaved plugins. + */ + nloops++; + if (fdebug) printf("Starting Discovery, pass %d ...\n",nloops); + rv = saHpiDiscover(sessionid); + if (fdebug) printf("saHpiDiscover rv = %d\n",rv); + if (rv != SA_OK) { + printf("saHpiDiscover error %d\n",rv); + break; + } + + /* walk the RPT list */ + rptentryid = SAHPI_FIRST_ENTRY; + while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry); + if (rv != SA_OK) printf("RptEntryGet: rid=%d rv = %d\n",rptentryid,rv); + if (rv == SA_OK) + { + /* walk the RDR list for this RPT entry */ + entryid = SAHPI_FIRST_ENTRY; + /* OpenHPI plugin sometimes has bad RPT Tag DataLength here. */ + // rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0; + resourceid = rptentry.ResourceId; + if (fdebug) printf("rptentry[%d] resourceid=%d\n", rptentryid,resourceid); + if (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_INVENTORY_DATA) + { + printf("Resource[%d] Tag: %s \thas inventory capability\n", rptentryid,rptentry.ResourceTag.Data); + while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRdrGet(sessionid,resourceid, entryid,&nextentryid, &rdr); + if (fdebug) printf("saHpiRdrGet[%x] rv = %d\n",entryid,rv); + if (rv == SA_OK) + { + if (fdebug) printf("Rdr[%x] type = %d tag = %s\n",entryid, + rdr.RdrType,rdr.IdString.Data); + if (rdr.RdrType == SAHPI_INVENTORY_RDR) + { + invfound = 1; + /*type 3 includes inventory records*/ + rdr.IdString.Data[rdr.IdString.DataLength] = 0; + idrid = rdr.RdrTypeUnion.InventoryRec.IdrId; + buffersize = sizeof(inbuff); + if (fdebug) { + printf("Rdr[%x] is inventory, IdrId=%x\n",rdr.RecordId,idrid); + printf("Inv BufferSize=%d\n", buffersize); + } + if ( IsTagBmc(rdr.IdString.Data, rdr.IdString.DataLength) ) + { + /* Get all of the inventory data areas and fields */ + memset(inv,0,buffersize); + rv = saHpiIdrInfoGet(sessionid, resourceid, idrid, &idrInfo); + if (rv != SA_OK) { + printf("IDR Info error: rv = %d\n",rv); + } else { /* idrInfo is ok */ + if (fdebug) printf("IDR Info: ok \n"); + print_epath(&rptentry.ResourceEntity, 1); + printf("RDR[%x]: Inventory, IdrId=%x %s\n",rdr.RecordId, + idrid,rdr.IdString.Data); + print_idrinfo(&idrInfo,4); + rv = walkInventory(sessionid, resourceid, &idrInfo); + if (fdebug) printf("walkInventory rv = %d\n",rv); + } + + if (!ent_writable(&rptentry.ResourceEntity,&idrInfo)) + foundasset = 0; + if ((fasset == 1) && (foundasset == 1)) { + SaHpiIdrFieldT atagField; + atagField.Type = SAHPI_IDR_FIELDTYPE_ASSET_TAG; + atagField.ReadOnly = SAHPI_FALSE; + atagField.AreaId = atag.areaid; + atagField.FieldId = atag.fieldid; + strptr=&(atagField.Field); + strptr->DataType = SAHPI_TL_TYPE_TEXT; + strptr->Language = SAHPI_LANG_ENGLISH; + strptr->DataLength = (SaHpiUint8T)atag.tlen; + strncpy((char *)strptr->Data, atag.tag, atag.tlen); + strptr->Data[atag.tlen] = 0; + printf( "Writing new asset tag: %s\n",strptr->Data); + rv = saHpiIdrFieldSet(sessionid, resourceid, + atag.idrid, &atagField); + printf("Return Write Status = %d\n", rv); + if (rv == SA_OK) { + printf ("Good write - re-reading!\n"); + rv = walkInventory(sessionid, resourceid, &idrInfo); + if (fdebug) printf("walkInventory rv = %d\n",rv); + } /* Good write - re-read */ + } /*endif fasset*/ + } /*endif RDR tag ok*/ + } /* Inventory Data Records - Type 3 */ + else if (fdebug) printf("rdr type = %d\n", rdr.RdrType); + } /*endif RdrGet ok*/ + entryid = nextentryid; + } /*end while rdr*/ + } /*endif rpt invent capab*/ + else + if (fdebug) printf("Resource[%d] Tag: %s\n", rptentryid, + rptentry.ResourceTag.Data); + } /*endif rpt ok*/ + rptentryid = nextrptentryid; + } /*end rpt loop */ + if (fdebug) printf("loop %d inventory found = %d\n",nloops,invfound); + } /*end while no inv */ + rv = saHpiSessionClose(sessionid); + exit(0); +} + /* end hpifru.c */ diff --git a/hpiutil/hpiinit.sh b/hpiutil/hpiinit.sh new file mode 100755 index 0000000..eace400 --- /dev/null +++ b/hpiutil/hpiinit.sh @@ -0,0 +1,69 @@ +#!/bin/sh +# +# hpi init script to start/stop the Intel hpi library daemon +# process name: SpiLibd +# +# For RedHat and MontaVista +# chkconfig: 345 50 35 +# +### BEGIN SuSE INIT INFO +# Provides: tam +# Required-Start: $network +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Description: tam is used to start/stop Telco Alarm Manager +### END INIT INFO +name=hpiutil +lockfile=/var/lock/subsys/$name + +if [ ! -d /var/lock/subsys ]; then + lockfile=/var/run/$name.pid +fi + +case "$1" in +"start") + # Is it already started? + ps -ef | grep -v grep | grep SpiLibd + if [ $? -eq 0 ] + then + echo "SpiLibd is already started" + exit 1 + fi + SAHPI_HOME=/etc/hpi + LD_LIBRARY_PATH=/usr/lib + #LD_LIBRARY_PATH=$SAHPI_HOME/lib + # Use default config locations (/etc/hpi/*.conf) + #SPI_LIB_CFG_LOCATION=$SAHPI_HOME/spi-lib.conf + #SPI_DAEMON_CFG_LOCATION=$SAHPI_HOME/spi-daemon.conf + SPI_LIB_LOG_LOCATION=/var/log/spilib + SPI_DAEMON_LOG_LOCATION=/var/log/spidaemon + SPI_DAEMON_LOG_LEVEL=-l5 + SPI_LIB_LOG_LEVEL=-l5 +# LD_ASSUME_KERNEL=2.4.1 + # flush the logs before starting daemon + export SAHPI_HOME LD_LIBRARY_PATH SPI_LIB_LOG_LOCATION + export SPI_DAEMON_LOG_LOCATION SPI_DAEMON_LOG_LEVEL SPI_LIB_LOG_LEVEL +# export SPI_LIB_CFG_LOCATION SPI_DAEMON_CFG_LOCATION + rm -f ${SPI_DAEMON_LOG_LOCATION}.1 $SPI_LIB_LOG_LOCATION 2>/dev/null + mv $SPI_DAEMON_LOG_LOCATION ${SPI_DAEMON_LOG_LOCATION}.1 2>/dev/null + # see /usr/bin/SpiLibd + SpiLibd + touch $lockfile + ;; +"stop") + spid=`ps -ef |greo SpiLibd | grep -v grep |awk '{ print $2 }'` + if [ "$spid" != "" ] + then + kill $spid + sleep 5 + kill -9 $spid 2>/dev/null + fi + rm -f $lockfile + ;; +*) + echo "Usage: $0 start|stop" + exit 1 + ;; +esac + +exit 0 diff --git a/hpiutil/hpireset.c b/hpiutil/hpireset.c new file mode 100644 index 0000000..aeddd03 --- /dev/null +++ b/hpiutil/hpireset.c @@ -0,0 +1,225 @@ +/* + * hpireset.c + * + * Author: Andy Cress arcress at users.sourceforge.net + * Copyright (c) 2003 Intel Corporation. + * + * 05/02/03 Andy Cress - created + * 06/06/03 Andy Cress - beta2 + * 06/26/03 Andy Cress - exclude stuff that isn't in HPI 1.0 (MAYBELATER) + * 12/07/04 Andy Cress - added HPI_A/B compile flags + */ +/*M* +Copyright (c) 2003, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + a.. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + b.. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + c.. Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *M*/ + +#include +#include +#include +#include "SaHpi.h" + +#define uchar unsigned char +char *progver = "1.1"; +char fdebug = 0; + +static void Usage(char *pname) +{ + printf("Usage: %s [-r -d -x]\n", pname); + printf(" where -r hard Resets the system\n"); + printf(" -d powers Down the system\n"); +#ifdef MAYBELATER +/*++++ not implemented in HPI 1.0 ++++ + printf(" -c power Cycles the system\n"); + printf(" -n sends NMI to the system\n"); + printf(" -o soft-shutdown OS\n"); + printf(" -s reboots to Service Partition\n"); + ++++*/ +#endif + printf(" -x show eXtra debug messages\n"); +} + +int +main(int argc, char **argv) +{ + int c; + SaErrorT rv; +#ifdef HPI_A + SaHpiVersionT hpiVer; + SaHpiRptInfoT rptinfo; +#endif + SaHpiSessionIdT sessionid; + SaHpiRptEntryT rptentry; + SaHpiEntryIdT rptentryid; + SaHpiEntryIdT nextrptentryid; + SaHpiEntryIdT entryid; + SaHpiEntryIdT nextentryid; + SaHpiResourceIdT resourceid; + SaHpiRdrT rdr; + SaHpiCtrlNumT ctlnum; + int j; + uchar breset; + uchar bopt; + uchar fshutdown = 0; + SaHpiCtrlStateT ctlstate; + + printf("%s ver %s\n", argv[0],progver); + breset = 3; /* hard reset as default */ + bopt = 0; /* Boot Options default */ + while ( (c = getopt( argc, argv,"rdx?")) != EOF ) + switch(c) { + case 'd': breset = 0; break; /* power down */ + case 'r': breset = 3; break; /* hard reset */ + case 'x': fdebug = 1; break; /* debug messages */ +#ifdef MAYBELATER + case 'c': breset = 2; break; /* power cycle */ + case 'o': fshutdown = 1; break; /* shutdown OS */ + case 'n': breset = 4; break; /* interrupt (NMI) */ + case 's': bopt = 1; break; /* hard reset to svc part */ +#endif + default: + Usage(argv[0]); + exit(1); + } + if (fshutdown) breset = 5; /* soft shutdown option */ + +#ifdef HPI_A + rv = saHpiInitialize(&hpiVer); + if (rv != SA_OK) { + printf("saHpiInitialize error %d\n",rv); + exit(-1); + } + rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + if (rv == SA_ERR_HPI_ERROR) + printf("saHpiSessionOpen: error %d, HPI Library not running\n",rv); + else + printf("saHpiSessionOpen error %d\n",rv); + exit(-1); + } + rv = saHpiResourcesDiscover(sessionid); + if (fdebug) printf("saHpiResourcesDiscover rv = %d\n",rv); + rv = saHpiRptInfoGet(sessionid,&rptinfo); + if (fdebug) printf("saHpiRptInfoGet rv = %d\n",rv); + printf("RptInfo: UpdateCount = %x, UpdateTime = %lx\n", + rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp); +#else + rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + printf("saHpiSessionOpen: error %d\n",rv); + exit(-1); + } + rv = saHpiDiscover(sessionid); + if (fdebug) printf("saHpiDiscover error %d\n",rv); +#endif + + /* walk the RPT list */ + rptentryid = SAHPI_FIRST_ENTRY; + while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry); + if (rv != SA_OK) printf("RptEntryGet: rv = %d\n",rv); + if (rv == SA_OK) { + /* walk the RDR list for this RPT entry */ + entryid = SAHPI_FIRST_ENTRY; + resourceid = rptentry.ResourceId; +#ifdef HPI_A + rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0; +#endif + printf("rptentry[%d] resourceid=%d tag: %s\n", + entryid,resourceid, rptentry.ResourceTag.Data); + while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRdrGet(sessionid,resourceid, + entryid,&nextentryid, &rdr); + if (fdebug) printf("saHpiRdrGet[%d] rv = %d\n",entryid,rv); + if (rv == SA_OK) { + if (rdr.RdrType == SAHPI_CTRL_RDR) { + /*type 1 includes Cold Reset Control */ + ctlnum = rdr.RdrTypeUnion.CtrlRec.Num; + rdr.IdString.Data[rdr.IdString.DataLength] = 0; + if (fdebug) printf("Ctl[%d]: %d %d %s\n", + ctlnum, rdr.RdrTypeUnion.CtrlRec.Type, + rdr.RdrTypeUnion.CtrlRec.OutputType, + rdr.IdString.Data); + if ((rdr.RdrTypeUnion.CtrlRec.Type == SAHPI_CTRL_TYPE_DIGITAL) && + (rdr.RdrTypeUnion.CtrlRec.OutputType == SAHPI_CTRL_GENERIC)) + { /* This is the Reset control */ + printf("RDR[%d]: %d,%d %s\n", + rdr.RecordId, + rdr.RdrTypeUnion.CtrlRec.Type, + rdr.RdrTypeUnion.CtrlRec.OutputType, + rdr.IdString.Data); +#ifdef MAYBELATER + { + SaHpiResetActionT resetact; + rv = saHpiResourceResetStateGet(sessionid, + resourceid, &resetact); + printf("ResetStateGet status = %d, act=%d\n", + rv,resetact); + rv = saHpiResourceResetStateSet(sessionid, + resourceid, resetact); + printf("ResetStateSet status = %d\n",rv); + } +#endif + + ctlstate.Type = SAHPI_CTRL_TYPE_DIGITAL; + if (breset == 0) { /*power off*/ + ctlstate.StateUnion.Digital = SAHPI_CTRL_STATE_OFF; + printf("Powering down ... \n"); + } else { + ctlstate.StateUnion.Digital = SAHPI_CTRL_STATE_ON; + printf("Resetting ... \n"); + } +#ifdef HPI_A + rv = saHpiControlStateSet(sessionid, + resourceid, ctlnum,&ctlstate); +#else + rv = saHpiControlSet(sessionid, resourceid, + ctlnum, SAHPI_CTRL_MODE_MANUAL, + &ctlstate); +#endif + printf("Reset status = %d\n",rv); + break; + } + } + j++; + entryid = nextentryid; + } + } + rptentryid = nextrptentryid; + } + } + + rv = saHpiSessionClose(sessionid); +#ifdef HPI_A + rv = saHpiFinalize(); +#endif + + exit(0); +} + +/* end hpireset.c */ diff --git a/hpiutil/hpisel.c b/hpiutil/hpisel.c new file mode 100644 index 0000000..e922b81 --- /dev/null +++ b/hpiutil/hpisel.c @@ -0,0 +1,934 @@ +/* + * hpisel.c + * + * Author: Andy Cress arcress at users.sourceforge.net + * Copyright (c) 2003-2005 Intel Corporation. + * + * 04/28/03 Andy Cress - created + * 04/30/03 Andy Cress v0.6 first good run with common use cases + * 05/06/03 Andy Cress v0.7 added -c option to clear it + * 05/29/03 Andy Cress v0.8 fixed pstr warnings + * 06/13/03 Andy Cress v0.9 fixed strcpy bug, + * workaround for SensorEvent.data3 + * 06/19/03 Andy Cress 0.91 added low SEL free space warning + * 06/25/03 Andy Cress v1.0 rework event data logic + * 07/23/03 Andy Cress workaround for OpenHPI BUGGY stuff + * 11/12/03 Andy Cress v1.1 check for CAPABILITY_SEL + * 03/03/04 Andy Cress v1.2 use better free space logic now + * 10/14/04 Andy Cress v1.3 added HPI_A/HPI_B logic + * 02/11/05 Andy Cress v1.4 added decode routines from showsel.c + * 03/30/05 Dave Howell v1.5 added support to enable displaying domain + * event log for HPI_B + * 04/07/05 Andy Cress v1.6 fix domain resourceid & HPI_A/B flags, + * add logic to clear domain event log. + * + * Note that hpiutil 1.0.0 did not return all event data fields, so event + * types other than 'user' did not have all bytes filled in as they + * would have from IPMI alone. A patch to the Intel HPI library in + * version 1.0.1 resolved this. + */ +/*M* +Copyright (c) 2003-2005, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + a.. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + b.. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + c.. Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *M*/ + +#include +#include +#include +#include +#include +#include "SaHpi.h" + +#ifdef HPI_A +/* HPI A (1.0) spec */ +char progver[] = "1.6 HPI-A"; +#else +/* HPI B name changes */ +#define SaHpiSelEntryT SaHpiEventLogEntryT +#define SaHpiSelEntryIdT SaHpiEventLogEntryIdT +#define SaHpiSelInfoT SaHpiEventLogInfoT +#define SAHPI_CAPABILITY_SEL SAHPI_CAPABILITY_EVENT_LOG /*0x00000004*/ +#define SAHPI_EC_USER SAHPI_EC_SENSOR_SPECIFIC /*0x7E*/ +char progver[] = "1.6 HPI-B"; +#endif +int fdebug = 0; +int fclear = 0; +int fdomain = 0; + +#ifdef HPI_A +#define NEVTYPES 5 +char *evtypes[NEVTYPES] = {"sensor","hotswap","watchdog","oem ","user "}; +#else +#define NEVTYPES 9 +char *evtypes[NEVTYPES] = {"resource","domain","sensor","sens_enable", + "hotswap","watchdog","HPI sw", "oem ","user "}; +#endif + +#define NECODES 27 +struct { int code; char *str; +} ecodes[NECODES] = { + { 0, "Success" }, + { -1001, "HPI unspecified error" }, + { -1002, "HPI unsupported function" }, + { -1003, "HPI busy" }, + { -1004, "HPI request invalid" }, + { -1005, "HPI command invalid" }, + { -1006, "HPI timeout" }, + { -1007, "HPI out of space" }, + { -1008, "HPI data truncated" }, +#ifdef HPI_A + { -1009, "HPI data length invalid" }, +#else + { -1009, "HPI invalid parameter" }, +#endif + { -1010, "HPI data exceeds limits" }, + { -1011, "HPI invalid params" }, + { -1012, "HPI invalid data" }, + { -1013, "HPI not present" }, + { -1014, "HPI invalid data field" }, + { -1015, "HPI invalid sensor command" }, + { -1016, "HPI no response" }, + { -1017, "HPI duplicate request" }, + { -1018, "HPI updating" }, + { -1019, "HPI initializing" }, + { -1020, "HPI unknown error" }, + { -1021, "HPI invalid session" }, + { -1022, "HPI invalid domain" }, + { -1023, "HPI invalid resource id" }, + { -1024, "HPI invalid request" }, + { -1025, "HPI entity not present" }, + { -1026, "HPI uninitialized" } +}; +char def_estr[15] = "HPI error %d "; + +#define NUM_EC 14 +struct { int val; char *str; +} eventcats[NUM_EC] = { +{ /*0x00*/ SAHPI_EC_UNSPECIFIED, "unspecified"}, +{ /*0x01*/ SAHPI_EC_THRESHOLD, "Threshold"}, +{ /*0x02*/ SAHPI_EC_USAGE, "Usage "}, +{ /*0x03*/ SAHPI_EC_STATE, "State "}, +{ /*0x04*/ SAHPI_EC_PRED_FAIL, "Predictive"}, +{ /*0x05*/ SAHPI_EC_LIMIT, "Limit "}, +{ /*0x06*/ SAHPI_EC_PERFORMANCE, "Performnc"}, +{ /*0x07*/ SAHPI_EC_SEVERITY, "Severity "}, +{ /*0x08*/ SAHPI_EC_PRESENCE, "DevPresen"}, +{ /*0x09*/ SAHPI_EC_ENABLE, "DevEnable"}, +{ /*0x0a*/ SAHPI_EC_AVAILABILITY, "Availabil"}, +{ /*0x0b*/ SAHPI_EC_REDUNDANCY, "Redundanc"}, +{ /*0x7e*/ SAHPI_EC_USER, "SensorSpc"}, /*UserDefin*/ +{ /*0x7f*/ SAHPI_EC_GENERIC, "OemDefin " }}; + +#define NUM_ES 6 +struct { int val; char *str; } eventstates[NUM_ES] = { +{ SAHPI_ES_LOWER_MINOR , "lo-min" }, +{ SAHPI_ES_LOWER_MAJOR , "lo-maj" }, +{ SAHPI_ES_LOWER_CRIT , "lo-crt" }, +{ SAHPI_ES_UPPER_MINOR , "hi-min" }, +{ SAHPI_ES_UPPER_MAJOR , "hi-maj" }, +{ SAHPI_ES_UPPER_CRIT , "hi-crt" } }; + +#define uchar unsigned char +#define ushort unsigned short +#define uint unsigned int +#define ulong unsigned long +typedef struct +{ + short record_id; + uchar record_type; + uint timestamp; + short generator_id; /*slave_addr/channel*/ + uchar evm_rev; //event message revision + uchar sensor_type; + uchar sensor_number; + uchar event_trigger; + uchar event_data1; + uchar event_data2; + uchar event_data3; +} SEL_RECORD; + +/* sensor_types: See IPMI 1.5 Table 36-3, IPMI 2.0 Table 42-3 */ +#define NSTYPES 0x2D +static char *sensor_types[NSTYPES] = { +/* 00h */ "reserved", +/* 01h */ "Temperature", +/* 02h */ "Voltage", +/* 03h */ "Current", +/* 04h */ "Fan", +/* 05h */ "Platform Chassis Intrusion", +/* 06h */ "Security Violation", +/* 07h */ "Processor", +/* 08h */ "Power Supply", +/* 09h */ "Power Unit", +/* 0Ah */ "Cooling Device", +/* 0Bh */ "FRU Sensor", +/* 0Ch */ "Memory", +/* 0Dh */ "Drive Slot", +/* 0Eh */ "POST Memory Resize", +/* 0Fh */ "System Firmware", /*incl POST code errors*/ +/* 10h */ "SEL Disabled", +/* 11h */ "Watchdog 1", +/* 12h */ "System Event", /* offset 0,1,2 */ +/* 13h */ "Critical Interrupt", /* offset 0,1,2 */ +/* 14h */ "Button", /* offset 0,1,2 */ +/* 15h */ "Board", +/* 16h */ "Microcontroller", +/* 17h */ "Add-in Card", +/* 18h */ "Chassis", +/* 19h */ "Chip Set", +/* 1Ah */ "Other FRU", +/* 1Bh */ "Cable/Interconnect", +/* 1Ch */ "Terminator", +/* 1Dh */ "System Boot Initiated", +/* 1Eh */ "Boot Error", +/* 1Fh */ "OS Boot", +/* 20h */ "OS Critical Stop", +/* 21h */ "Slot/Connector", +/* 22h */ "ACPI Power State", +/* 23h */ "Watchdog 2", +/* 24h */ "Platform Alert", +/* 25h */ "Entity Presence", +/* 26h */ "Monitor ASIC", +/* 27h */ "LAN", +/* 28h */ "Management Subsystem Health", +/* 29h */ "Battery", +/* 2Ah */ "Session Audit", +/* 2Bh */ "Version Change", +/* 2Ch */ "FRU State" +}; + +#define NFWERRS 15 +static struct { /* See Table 36-3, type 0Fh, offset 00h */ + int code; char *msg; + } fwerrs[NFWERRS] = { + { 0x00, "Unspecified"}, + { 0x01, "No system memory"}, + { 0x02, "No usable memory"}, + { 0x03, "Unrecovered Hard Disk"}, + { 0x04, "Unrecovered System Board"}, + { 0x05, "Unrecovered Diskette"}, + { 0x06, "Unrecovered Hard Disk Ctlr"}, + { 0x07, "Unrecovered PS2 USB"}, + { 0x08, "Boot media not found"}, + { 0x09, "Unrecovered video controller"}, + { 0x0A, "No video device"}, + { 0x0B, "Firmware ROM corruption"}, + { 0x0C, "CPU voltage mismatch"}, + { 0x0D, "CPU speed mismatch"}, + { 0x0E, "Reserved" } +}; + +#define NFWSTAT 27 +static struct { /* See Table 36-3, type 0Fh, offset 01h & 02h */ + int code; char *msg; + } fwstat[NFWSTAT] = { + { 0x00, "Unspecified"}, + { 0x01, "Memory init"}, + { 0x02, "Hard disk init"}, + { 0x03, "Secondary processor"}, + { 0x04, "User authentication"}, + { 0x05, "User-init sys setup"}, + { 0x06, "USB configuration"}, + { 0x07, "PCI configuration"}, + { 0x08, "Option ROM init"}, + { 0x09, "Video init"}, + { 0x0a, "Cache init"}, + { 0x0b, "SM Bus init"}, + { 0x0c, "Keyboard init"}, + { 0x0d, "Mgt controller"}, + { 0x0e, "Docking attach"}, + { 0x0f, "Enabling docking"}, + { 0x10, "Docking eject"}, + { 0x11, "Disabling docking"}, + { 0x12, "OS wake-up"}, + { 0x13, "Starting OS boot"}, + { 0x14, "Baseboard init"}, + { 0x15, "reserved"}, + { 0x16, "Floppy init"}, + { 0x17, "Keyboard test"}, + { 0x18, "Mouse test"}, + { 0x19, "Primary processor"}, + { 0x1A, "Reserved"} +}; + +#define NGDESC 7 +struct { + ushort g_id; + char desc[10]; +} gen_desc[NGDESC] = { /*empirical, format defined in IPMI 1.5 Table 23-5 */ + { 0x0000, "IPMB"}, + { 0x0001, "EFI "}, + { 0x0003, "BIOS"}, + { 0x0020, "BMC "}, + { 0x0021, "SMI "}, + { 0x0028, "CHAS"}, /* Chassis Bridge Controller */ +/*{0x0031, "SMI/IPMB"}, * ia64/mBMC POST errors (rqSa/rqLun) */ +/*{0x0033, "MemCtlr"}, * ia64 memory controller? (rqSa/rqLun) */ + { 0x00c0, "HSC "} /* SAF-TE Hot-Swap Controller*/ +}; + +#define NCRITS 10 +char * crit_int_str[NCRITS] = { /* Critical Interrupt descriptions */ + /*00*/ "FP NMI ", /* Front Panel NMI */ + /*01*/ "Bus Timout", + /*02*/ "IOch NMI ", /* IO channel check NMI */ + /*03*/ "Soft NMI ", + /*04*/ "PCI PERR ", + /*05*/ "PCI SERR ", + /*06*/ "EISA Timout", + /*07*/ "Bus Warn ", /* Bus Correctable Error */ + /*08*/ "Bus Error", /* Bus Uncorrectable Error */ + /*09*/ "Fatal NMI" }; + +#define NSLOTC 9 +char * slot_str[NSLOTC] = { /* Slot/Connector descriptions */ + /*00*/ "Fault ", + /*01*/ "Identify", + /*02*/ "Inserted", + /*03*/ "InsReady", + /*04*/ "RemReady", + /*05*/ "PowerOff", + /*06*/ "RemRequest", + /*07*/ "Interlock", + /*08*/ "Disabled" }; + +#define NSDESC 47 +struct { + ushort genid; /*generator id: BIOS, BMC, etc. (slave_addr/channel)*/ + uchar s_typ; /*1=temp,2=voltage,4=fan,... */ + uchar s_num; + uchar evtrg; /*event trigger/type, see IPMI 1.5 table 36.1 & 36.2 */ + uchar data1; + uchar data2; + uchar data3; + char desc[40]; +} sens_desc[NSDESC] = { +{0xffff,0x05, 0x05, 0x6f, 0x44, 0xff, 0xff, "LAN unplugged"}, /*chassis*/ +{0xffff,0x05, 0x05, 0xef, 0x44, 0xff, 0xff, "LAN restored "}, /*chassis*/ +{0xffff,0x06, 0xff, 0xff, 0x45, 0xff, 0xff, "Password"}, /*security*/ +{0xffff,0x07, 0xff, 0xff, 0x41, 0xff, 0xff, "Thermal trip"}, /*processor*/ +{0xffff,0x08, 0xff, 0x6f, 0x40, 0xff, 0xff, "Presence detected"},/*PowerSupply*/ +{0xffff,0x08, 0xff, 0x6f, 0x41, 0xff, 0xff, "Failure detected"},/*power supply*/ +{0xffff,0x08, 0xff, 0x6f, 0x42, 0xff, 0xff, "Predictive failure"}, +{0xffff,0x08, 0xff, 0x6f, 0x43, 0xff, 0xff, "AC Lost"}, +{0xffff,0x08, 0xff, 0xef, 0x40, 0xff, 0xff, "not present"}, /*power supply*/ +{0xffff,0x08, 0xff, 0xef, 0x41, 0xff, 0xff, "is OK "}, /*power supply*/ +{0xffff,0x08, 0xff, 0xef, 0x42, 0xff, 0xff, "Predictive OK"}, +{0xffff,0x08, 0xff, 0xef, 0x43, 0xff, 0xff, "AC Regained"}, /*power supply*/ +{0xffff,0x09, 0xff, 0xff, 0x40, 0xff, 0xff, "Redundancy OK "}, /*power unit*/ +{0xffff,0x09, 0xff, 0xff, 0x41, 0xff, 0xff, "Redundancy Lost"}, +{0xffff,0x09, 0xff, 0xff, 0x44, 0xff, 0xff, "AC Lost"}, +{0xffff,0x09, 0xff, 0xff, 0x46, 0xff, 0xff, "Failure detected"}, +{0xffff,0x09, 0xff, 0xff, 0x47, 0xff, 0xff, "Predictive failure"},/*power unit*/ +{0xffff,0x0c, 0xff, 0xff, 0x00, 0xff, 0xff, "Correctable ECC"}, /*memory*/ +{0xffff,0x0f, 0x06, 0xff, 0xff, 0xff, 0xff, "POST Code"}, +{0xffff,0x10, 0x09, 0xff, 0x42, 0x0f, 0xff, "Log Cleared"}, +{0xffff,0x10, 0x09, 0xff, 0xc0, 0x03, 0xff, "ECC Memory Errors"}, + /* Often see these 3 Boot records with reboot: + * 12 83 6f 05 00 ff = System/SEL Time Sync 1 (going down) + * 12 83 6f 05 80 ff = System/SEL Time Sync 2 (coming up) + * 12 83 6f 01 ff ff = OEM System Boot Event (Completed POST) */ +{0xffff,0x12, 0x83, 0xff, 0x05, 0x00, 0xff, "Boot: ClockSync 1"}, +{0xffff,0x12, 0x83, 0xff, 0x05, 0x80, 0xff, "Boot: ClockSync 2"}, +{0xffff,0x12, 0x83, 0xff, 0x01, 0xff, 0xff, "OEM System Booted"}, +{0xffff,0x12, 0x08, 0xff, 0x01, 0xff, 0xff, "OEM System Booted"}, /*ia64*/ +{0xffff,0x12, 0x00, 0x6f, 0xff, 0xff, 0xff, "PEF Action"}, /*ia64*/ +{0xffff,0x12, 0x83, 0x6f, 0x80, 0xff, 0xff, "System Reconfigured"}, /*BMC*/ +{0x00c0,0x0d, 0xff, 0x08, 0x00, 0xff, 0xff, "Device Removed"}, /*HSC*/ +{0x00c0,0x0d, 0xff, 0x08, 0x01, 0xff, 0xff, "Device Inserted"}, /*HSC*/ +{0xffff,0x14, 0xff, 0xff, 0x42, 0xff, 0xff, "Reset Button pressed"}, +{0xffff,0x14, 0xff, 0xff, 0x40, 0xff, 0xff, "Power Button pressed"}, +{0xffff,0x14, 0xff, 0xff, 0x01, 0xff, 0xff, "ID Button pressed"}, +{0xffff,0x23, 0xff, 0xff, 0x40, 0xff, 0xff, "Expired, no action"},/*watchdog2*/ +{0xffff,0x23, 0xff, 0xff, 0x41, 0xff, 0xff, "Hard Reset action"}, /*watchdog2*/ +{0xffff,0x23, 0xff, 0xff, 0x42, 0xff, 0xff, "Power down action"}, /*watchdog2*/ +{0xffff,0x23, 0xff, 0xff, 0x43, 0xff, 0xff, "Power cycle action"},/*watchdog2*/ +{0xffff,0x23, 0xff, 0xff, 0x48, 0xff, 0xff, "Timer interrupt"}, /*watchdog2*/ +{0xffff,0xf3, 0x85, 0xff, 0x41, 0xff, 0xff, "State is now OK"}, +{0xffff,0x20, 0x00, 0xff, 0xff, 0xff, 0xff, "OS Kernel Panic"}, +{0xffff,0xff, 0xff, 0x01, 0x57, 0xff, 0xff, "Hi Noncrit thresh"}, +{0xffff,0xff, 0xff, 0x01, 0x59, 0xff, 0xff, "Hi Crit thresh"}, +{0xffff,0xff, 0xff, 0x01, 0x50, 0xff, 0xff, "Lo Noncrit thresh"}, +{0xffff,0xff, 0xff, 0x01, 0x52, 0xff, 0xff, "Lo Crit thresh"}, +{0xffff,0xff, 0xff, 0x81, 0x57, 0xff, 0xff, "HiN thresh OK now"}, +{0xffff,0xff, 0xff, 0x81, 0x59, 0xff, 0xff, "HiC thresh OK now"}, +{0xffff,0xff, 0xff, 0x81, 0x50, 0xff, 0xff, "LoN thresh OK now"}, +{0xffff,0xff, 0xff, 0x81, 0x52, 0xff, 0xff, "LoC thresh OK now"} + /*Thresholds apply to sensor types 1=temp, 2=voltage, 4=fan */ + /*Note that last 2 bytes usu show actual & threshold values*/ + /*evtrg: 0x01=thresh, 0x81=restored */ +}; + +/*------------------------------------------------------------------------ + * get_misc_desc + * Uses the sens_desc array to decode misc entries not otherwise handled. + * Called by decode_sel_entry + *------------------------------------------------------------------------*/ +char * get_misc_desc(uchar type, uchar num, ushort genid, uchar trig, + uchar data1, uchar data2, uchar data3); +char * +get_misc_desc(uchar type, uchar num, ushort genid, uchar trig, + uchar data1, uchar data2, uchar data3) +{ + int i; + char *pstr = NULL; + + /* Use sens_desc array for other misc descriptions */ + data1 &= 0x0f; /*ignore top half of sensor offset for matching */ + for (i = 0; i < NSDESC; i++) { + if ((sens_desc[i].s_typ == 0xff) || + (sens_desc[i].s_typ == type)) { + if (sens_desc[i].s_num != 0xff && + sens_desc[i].s_num != num) + continue; + if (sens_desc[i].genid != 0xffff && + sens_desc[i].genid != genid) + continue; + if (sens_desc[i].evtrg != 0xff && + sens_desc[i].evtrg != trig) + continue; + if (sens_desc[i].data1 != 0xff && + (sens_desc[i].data1 & 0x0f) != data1) + continue; + if (sens_desc[i].data2 != 0xff && + sens_desc[i].data2 != data2) + continue; + if (sens_desc[i].data3 != 0xff && + sens_desc[i].data3 != data3) + continue; + /* have a match, use description */ + pstr = (char *)sens_desc[i].desc; + break; + } + } /*end for*/ + return(pstr); +} /* end get_misc_desc() */ + +void decode_sensor_event(uchar sensor_type, uchar sensor_number, ushort gen_id, + uchar event_trigger, uchar data1, uchar data2, uchar data3, + char *outbuf); +void +decode_sensor_event(uchar sensor_type, uchar sensor_number, ushort gen_id, + uchar event_trigger, uchar data1, uchar data2, uchar data3, + char *outbuf) +{ + char mystr[26] = "(123)"; /*for panic string*/ + char poststr[24] = "OEM Post Code = %x%x"; + char genstr[10] = "03 "; + char *gstr; + char *pstr; + uchar dtype; + int i; + + /* set dtype, used as array index below */ + if (sensor_type >= NSTYPES) dtype = 0; + else dtype = sensor_type; + switch(sensor_type) { + case 0x20: /*OS Crit Stop*/ + /* Show first 3 chars of panic string */ + mystr[0] = '('; + mystr[1] = sensor_number & 0x7f; + mystr[2] = data2 & 0x7f; + mystr[3] = data3 & 0x7f; + mystr[4] = ')'; + mystr[5] = 0; + pstr = mystr; + if (sensor_number & 0x80) strcat(mystr,"Oops!"); + if (data2 & 0x80) strcat(mystr,"Int!"); + if (data3 & 0x80) strcat(mystr,"NullPtr!"); + break; + case 0x0f: /*Post Errs*/ + switch (data1) + { + case 0x00: /* System firmware errors */ + i = data2; + if (i >= NFWERRS) i = NFWERRS - 1; + pstr = fwerrs[i].msg; + break; + case 0x01: /* System firmware hang */ + i = data2; + if (i >= NFWSTAT) i = NFWSTAT - 1; + sprintf(poststr,"hang, %s",fwstat[i].msg); + pstr = poststr; + break; + case 0x02: /* System firmware progress */ + i = data2; + if (i >= NFWSTAT) i = NFWSTAT - 1; + sprintf(poststr,"prog, %s",fwstat[i].msg); + pstr = poststr; + break; + case 0xa0: /* OEM post codes */ + /* OEM post codes in bytes 2 & 3 (lo-hi) */ + sprintf(poststr,"POST Code %02x%02x", + data3,data2); + pstr = poststr; + break; + default: + pstr = "POST Error"; /*default string*/ + } /*end switch(data1)*/ + break; + case 0x13: /*Crit Int*/ + i = data1 & 0x0f; + if (i >= NCRITS) i = NCRITS - 1; + pstr = crit_int_str[i]; + break; + case 0x21: /*Slot/Con*/ + i = data1 & 0x0f; + if (i >= NSLOTC) i = NSLOTC - 1; + sprintf(mystr,"%s",slot_str[i]); + /* could also decode data2/data3 here if valid */ + pstr = mystr; + break; + default: /* all other sensor types, see sens_desc */ + pstr = get_misc_desc( sensor_type, + sensor_number, gen_id, + event_trigger, data1, data2, data3); + if (pstr == NULL) { + mystr[0] = '-'; mystr[1] = 0; + pstr = mystr; + } + + } /*end switch(sensor_type)*/ + + /* show the Generator ID */ + sprintf(genstr,"%04x",gen_id); + gstr = genstr; /* default */ + for (i = 0; i < NGDESC; i++) + { + if (gen_desc[i].g_id == gen_id) + gstr = (char *)gen_desc[i].desc; + } + + /*firmware timestamp is #seconds since 1/1/1970 localtime*/ + /* timestamp handled by caller in HPI */ + + if ((event_trigger == 0x01) || /*threshold*/ + (event_trigger == 0x81)) { /*threshold ok*/ + sprintf(outbuf, + "%s %02x %s act=%02x thr=%02x", + sensor_types[dtype], sensor_number, pstr, + data2, /*actual reading*/ + data3 ); /*threshold value*/ + } else { + sprintf(outbuf, + "%s %02x %s %02x [%02x %02x %02x]", + sensor_types[dtype] , sensor_number, pstr, + event_trigger, data1, data2, data3 ); + } +} + +/*------------------------------------------------------------------------ + * decode_ipmi_event + * Parse and decode the SEL record into readable format. + * This routine is constructed so that it could be used as a library + * function. + * Input: psel, a pointer to the IPMI SEL record + * Output: outbuf, a description of the event, max 80 chars. + * Called by ReadSEL + *------------------------------------------------------------------------*/ +void decode_ipmi_event( SEL_RECORD *psel, char *outbuf); +void decode_ipmi_event( SEL_RECORD *psel, char *outbuf) +{ + char genstr[10] = "03 "; + int i, j; + + if (psel->record_type >= 0xe0) { /*OEM Record 26.3*/ + char *pc; + pc = (char *)&psel->timestamp; /*bytes 4:16*/ + sprintf(outbuf," OEM Event %02x %02x ", pc[0], pc[1]); + j = strlen(outbuf); + for (i = 2; i < 13; i++) { /* 4:16 = 13 bytes data */ + if (psel->record_type == 0xf0) { + /* panic string will be type 0xf0 */ + if (pc[i] == 0) break; + outbuf[j++] = pc[i]; + } else { + sprintf(&outbuf[j],"%02x ",pc[i]); + j += 3; + } + } + outbuf[j++] = '\n'; + outbuf[j++] = 0; + } else if (psel->record_type == 0x02) { + /* most records are record type 2 */ + decode_sensor_event(psel->sensor_type, + psel->sensor_number, psel->generator_id, + psel->event_trigger, psel->event_data1, + psel->event_data2, psel->event_data3, outbuf); + + } /*endif type 2 */ + else { /* other misc record type */ + uchar *pc; + pc = (uchar *)&psel->record_type; + sprintf(outbuf," Type%02x ", pc[0]); + j = strlen(outbuf); + for (i = 1; i < 14; i++) { + sprintf(genstr,"%02x ",pc[i]); + strcat(outbuf,genstr); + } + } /*endif misc type*/ + return; +} /*end decode_ipmi_event()*/ + +#define IF_IPMI 0 /* other interfaces, like H8, have diff numbers */ + /*Note that OpenHPI 2.0.0 does not yet fill this in*/ + +/*------------------------------------------------------------------------ + * decode_hpi_event + * Parse and decode the SensorEvent record into readable format. + * Input: pevent, a pointer to the HPI SensorEvent record + * Output: outbuf, a description of the event, max 80 chars. + * Called by ReadSEL + *------------------------------------------------------------------------*/ +void decode_hpi_event( SaHpiSensorEventT *pevent, char *outbuf); +void decode_hpi_event( SaHpiSensorEventT *pevent, char *outbuf) +{ + int ec, eci; + int es, esi; + int styp; + uchar data1, data2, data3, if_type; + uchar etrig; + ushort genid; + char estag[8]; + char sbuf[80]; + char *ecstr; + // char *pstr; + + /* decode event category */ + ec = pevent->EventCategory; + for (eci = 0; eci < NUM_EC; eci++) + if (eventcats[eci].val == ec) break; + if (eci >= NUM_EC) eci = 0; + ecstr = eventcats[eci].str; + genid = 0x0020; /* default to BMC */ + etrig = 0x6f; /* default to sensor-specific*/ + /* decode event state */ + es = pevent->EventState; + if (ec == SAHPI_EC_USER) { /*OpenHPI usu returns this (0x7e)*/ + sprintf(estag,"%02x",es); + } else if (eci == SAHPI_EC_THRESHOLD ) { /*0x01*/ + for (esi = 0; esi < NUM_ES; esi++) + if (eventstates[esi].val == es) break; + if (esi >= NUM_ES) esi = 0; + strcpy(estag,eventstates[esi].str); + if (pevent->Assertion) etrig = 0x01; + else etrig = 0x81; + } else { + sprintf(estag,"%02x:%02x",ec,es); + } + + /* decode sensor type */ + styp = pevent->SensorType; + if (styp >= NSTYPES) { styp = 0; } + + /* get if_type from SensorSpecific h.o. byte */ + if_type = (pevent->SensorSpecific & 0xff000000) >> 24; + data3 = (pevent->SensorSpecific & 0x00ff0000) >> 16; + data2 = (pevent->SensorSpecific & 0x0000ff00) >> 8; + data1 = (pevent->SensorSpecific & 0x000000ff); + if (if_type == IF_IPMI) { /* handle IPMI SensorSpecific stuff */ + /* fortunately, HPI & IPMI have the same sensor_type values */ + decode_sensor_event(styp, pevent->SensorNum, genid, + etrig, data1, data2, data3, sbuf); + sprintf(outbuf,"%s %s", estag, sbuf); + } + else { + sprintf(outbuf,"%s, %s %s %x [%02x %02x %02x]", + sensor_types[styp], ecstr, estag, + pevent->SensorNum, data1, data2, data3); + } + + return; +} + +static +char *decode_error(SaErrorT code) +{ + int i; + char *str = NULL; + for (i = 0; i < NECODES; i++) { + if (code == ecodes[i].code) { str = ecodes[i].str; break; } + } + if (str == NULL) { + sprintf(&def_estr[10],"%d",code); + str = &def_estr[0]; + } + return(str); +} + +void ShowSel( SaHpiSelEntryT *sel, SaHpiRdrT *rdr, SaHpiRptEntryT *rptentry); +void ShowSel( SaHpiSelEntryT *sel, SaHpiRdrT *rdr, + SaHpiRptEntryT *rptentry ) +{ + unsigned char evtype; + char timestr[40]; + time_t tt1; + char *srctag; + char *rdrtag; + char *pstr; + unsigned char *pd; + int outlen; + char outbuf[132]; + int styp; + unsigned char data3; + + /*format & print the EventLog entry*/ + if (sel->Event.Timestamp > SAHPI_TIME_MAX_RELATIVE) { /*absolute time*/ + tt1 = sel->Event.Timestamp / 1000000000; + strftime(timestr,sizeof(timestr),"%x %H:%M:%S", localtime(&tt1)); + } else if (sel->Event.Timestamp > SAHPI_TIME_UNSPECIFIED) { /*invalid time*/ + strcpy(timestr,"invalid time "); + } else { /*relative time*/ + tt1 = sel->Event.Timestamp / 1000000000; + sprintf(timestr,"rel(%lx)", (unsigned long)tt1); + } + if (rptentry->ResourceId == sel->Event.Source) + srctag = rptentry->ResourceTag.Data; + else srctag = "unspec "; /* SAHPI_UNSPECIFIED_RESOURCE_ID */ + evtype = sel->Event.EventType; + if (evtype > NEVTYPES) evtype = NEVTYPES - 1; + if (rdr->RdrType == SAHPI_NO_RECORD) rdrtag = "rdr-unkn"; + else { + rdr->IdString.Data[rdr->IdString.DataLength] = 0; + rdrtag = &rdr->IdString.Data[0]; + } + sprintf(outbuf,"%04x %s %s ", sel->EntryId, timestr, evtypes[evtype] ); + outlen = strlen(outbuf); + pstr = ""; +#ifdef HPI_A + pd = &sel->Event.EventDataUnion.UserEvent.UserEventData[0]; +#else + pd = &sel->Event.EventDataUnion.UserEvent.UserEventData.Data[0]; +#endif + + switch(evtype) + { + case SAHPI_ET_SENSOR: /*Sensor*/ + pd = (void *)&(sel->Event.EventDataUnion.SensorEvent); + decode_hpi_event((void *)pd,&outbuf[outlen]); + break; + case SAHPI_ET_USER: /*User, usu 16-byte IPMI SEL record */ + decode_ipmi_event((void *)pd,&outbuf[outlen]); + break; + default: + // decode_ipmi_event((void *)pd,&outbuf[outlen]); + styp = pd[10]; + data3 = pd[15]; + /* *sel->Event.EventDataUnion.SensorEvent.SensorSpecific+1 */ + if (styp >= NSTYPES) { + if (fdebug) printf("sensor type %d >= max %d\n",styp,NSTYPES); + styp = 0; + } + pstr = (char *)sensor_types[styp]; + sprintf(&outbuf[outlen], "%s, %x %x, %02x %02x %02x [%02x %02x %02x/%02x]", + pstr, pd[0], pd[7], pd[10], pd[11], pd[12], + pd[13], pd[14], pd[15], data3); + break; + } + printf("%s\n",outbuf); +} + +static SaErrorT +DoEventLogForResource(SaHpiSessionIdT sessionid, + SaHpiResourceIdT resourceid, + char *tagname) +{ + SaErrorT rv; + SaHpiSelInfoT info; + int free = 50; + SaHpiSelEntryIdT entryid; + SaHpiSelEntryIdT nextentryid; + SaHpiSelEntryIdT preventryid; + SaHpiSelEntryT sel; + SaHpiRdrT rdr; + SaHpiRptEntryT rptentry; + + printf("rptentry[%d] tag: %s\n", resourceid, tagname); + + rv = saHpiEventLogInfoGet(sessionid, resourceid, &info); + if (fdebug) + printf("saHpiEventLogInfoGet %s\n", decode_error(rv)); + if (rv == SA_OK) { + free = info.Size - info.Entries; + printf("EventLog entries=%d, size=%d, enabled=%d, free=%d\n", + info.Entries, info.Size, info.Enabled, free); + } + + entryid = SAHPI_OLDEST_ENTRY; + while ((rv == SA_OK) && (entryid != SAHPI_NO_MORE_ENTRIES)) + { + /* rv = saHpiEventLogEntryGet(sessionid,SAHPI_DOMAIN_CONTROLLER_ID,entryid, */ + rv = saHpiEventLogEntryGet(sessionid, resourceid, entryid, + &preventryid, &nextentryid, &sel, &rdr, &rptentry); + if (fdebug) + printf("saHpiEventLogEntryGet[%x] %s, next=%x\n", + entryid, decode_error(rv), nextentryid); + if (rv == SA_OK) { + ShowSel(&sel, &rdr, &rptentry); + if (entryid == nextentryid) + break; + preventryid = entryid; + entryid = nextentryid; + } + } + + if (free < 6) { + /* + * This test could be more generic if the log info fields above + * were accurate. IPMI SEL logs have a fixed size of 0x10000 + * bytes. New log records are thrown away when it gets full. + * (OLDEST = 0, NO_MORE = fffffffe , so these are ok.) + */ + /* free = (0x10000 - 20) - preventryid; */ + printf( "WARNING: Log free space is very low (%d records)\n" + " Clear log with hpisel -c\n", free); + } + + return SA_OK; +} + +int +main(int argc, char **argv) +{ + int c; + SaErrorT rv; + SaHpiSessionIdT sessionid; +#ifdef HPI_A + SaHpiVersionT hpiVer; + SaHpiRptInfoT rptinfo; +#endif + SaHpiRptEntryT rptentry; + SaHpiEntryIdT rptentryid; + SaHpiEntryIdT nextrptentryid; + SaHpiResourceIdT resourceid; + + printf("%s: version %s\n",argv[0],progver); + +#ifdef HPI_A +#define ARGSTR "cx?" +#else +#define ARGSTR "cdx?" +#endif + + while ( (c = getopt( argc, argv, ARGSTR)) != EOF ) + switch(c) { + case 'c': fclear = 1; break; +#ifndef HPI_A + case 'd': fdomain = 1; break; +#endif + case 'x': fdebug = 1; break; + default: + printf("Usage %s [-cx]\n",argv[0]); + printf("where -c clears the event log\n"); +#ifndef HPI_A + printf(" -d displays the domain event log\n"); +#endif + printf(" -x displays eXtra debug messages\n"); + exit(1); + } +#ifdef HPI_A + rv = saHpiInitialize(&hpiVer); + if (rv != SA_OK) { + printf("saHpiInitialize: %s\n",decode_error(rv)); + exit(-1); + } + rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + if (rv == SA_ERR_HPI_ERROR) + printf("saHpiSessionOpen: error %d, SpiLibd not running\n",rv); + else + printf("saHpiSessionOpen: %s\n",decode_error(rv)); + exit(-1); + } + rv = saHpiResourcesDiscover(sessionid); + if (fdebug) printf("saHpiResourcesDiscover %s\n",decode_error(rv)); + rv = saHpiRptInfoGet(sessionid,&rptinfo); + if (fdebug) printf("saHpiRptInfoGet %s\n",decode_error(rv)); + printf("RptInfo: UpdateCount = %x, UpdateTime = %lx\n", + rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp); +#else + rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + printf("saHpiSessionOpen: %s\n",decode_error(rv)); + exit(-1); + } + rv = saHpiDiscover(sessionid); + if (fdebug) printf("saHpiDiscover %s\n",decode_error(rv)); +#endif + +#ifndef HPI_A + if (fdomain != 0) /* saw option for domain event log */ + { + /* resourceid = 1; * oh_get_default_domain_id() */ + resourceid = SAHPI_UNSPECIFIED_DOMAIN_ID; + if (fclear) { + rv = saHpiEventLogClear(sessionid,resourceid); + if (rv == SA_OK) printf("Domain EventLog successfully cleared\n"); + else printf("Domain EventLog clear, error = %d\n",rv); + } else { + rv = DoEventLogForResource(sessionid, resourceid, "Domain Event Log"); + } + } + else /* walk the RPT list */ +#endif + { + rptentryid = SAHPI_OLDEST_ENTRY; + while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry); + if (fdebug) + printf("saHpiRptEntryGet[%d] %s\n",rptentryid,decode_error(rv)); + if (rv != SA_OK) + goto skip_to_next; + resourceid = rptentry.ResourceId; + if (fdebug) printf("RPT %x capabilities = %x\n", resourceid, + rptentry.ResourceCapabilities); + if ((rptentry.ResourceCapabilities & SAHPI_CAPABILITY_SEL) == 0) + goto skip_to_next; + if (fclear) { + rv = saHpiEventLogClear(sessionid,resourceid); + if (rv == SA_OK) printf("EventLog successfully cleared\n"); + else printf("EventLog clear, error = %d\n",rv); + break; + } + // rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0; + + rv = DoEventLogForResource(sessionid, resourceid, + rptentry.ResourceTag.Data); + skip_to_next: + rptentryid = nextrptentryid; + } + } + + rv = saHpiSessionClose(sessionid); +#ifdef HPI_A + rv = saHpiFinalize(); +#endif + + exit(0); +} + +/* end hpisel.c */ diff --git a/hpiutil/hpisensor.c b/hpiutil/hpisensor.c new file mode 100644 index 0000000..f7eef8f --- /dev/null +++ b/hpiutil/hpisensor.c @@ -0,0 +1,467 @@ +/* + * hpisensor.c + * + * Author: Andy Cress arcress at users.sourceforge.net + * Copyright (c) 2003 Intel Corporation. + * + * 04/15/03 Andy Cress - created + * 04/17/03 Andy Cress - mods for resourceid, first good run + * 04/28/03 Andy Cress - adding Convert + * 05/02/03 Andy Cress v0.6 more Convert changes in ShowSensor (e.g. units) + * 06/06/03 Andy Cress v0.7 add more units, and buffer type + * 06/09/03 Andy Cress v0.8 added more for Compact Sensors + * 06/26/03 Andy Cress v1.0 added -t for thresholds + * 02/19/04 Andy Cress v1.1 recognize common errors for Compact & mBMC sensors. + * 10/14/04 Andy Cress v1.2 added HPI_A/HPI_B logic + * 01/07/05 Andy Cress v1.3 added HPI_B sleep for OpenHPI bug + */ +/*M* +Copyright (c) 2003, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + a.. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + b.. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + c.. Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *M*/ + +#include +#include +#include +#include +#include +#include "SaHpi.h" + +#ifdef HPI_A +char progver[] = "1.3 HPI-A"; +#else +char progver[] = "1.3 HPI-B"; +#endif +int fdebug = 0; +int fshowthr = 0; +char *rtypes[5] = {"None ", "Control ", "Sensor ", "Invent ", "Watchdog"}; + +#define NSU 77 +char *units[NSU] = { +"units", "degrees C", "degrees F", "degrees K", "volts", "amps", +"watts", "joules", "coulombs", "va", "nits", "lumen", +"lux", "candela", "kpa", "psi", "newton", "cfm", +"rpm", "Hz", "us", "ms", "sec", "min", +"hours", "days", "weeks", "mil", "in", "ft", +/*30*/ "cu in", "cu ft", "mm", "cm", "m", "cu cm", "cu m", +"liters", "fl oz", "radians", "sterad", "rev", +"cycles", "grav", "oz", "lbs", "ft lb", "oz in", "gauss", +"gilberts", "henry", "mhenry", "farad", "ufarad", "ohms", +/*55*/ "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "Gb", +/*70*/ "bytes", "KB", "MB", "GB", +/*74*/ "", "", "line" +}; + +#define NECODES 27 +struct { int code; char *str; +} ecodes[NECODES] = { + { 0, "Success" }, + { -1001, "HPI unspecified error" }, + { -1002, "HPI unsupported function" }, + { -1003, "HPI busy" }, + { -1004, "HPI request invalid" }, + { -1005, "HPI command invalid" }, + { -1006, "HPI timeout" }, + { -1007, "HPI out of space" }, + { -1008, "HPI data truncated" }, +#ifdef HPI_A + { -1009, "HPI data length invalid" }, +#else + { -1009, "HPI invalid parameter" }, +#endif + { -1010, "HPI data exceeds limits" }, + { -1011, "HPI invalid params" }, + { -1012, "HPI invalid data" }, + { -1013, "HPI not present" }, + { -1014, "HPI invalid data field" }, + { -1015, "HPI invalid sensor command" }, + { -1016, "HPI no response" }, + { -1017, "HPI duplicate request" }, + { -1018, "HPI updating" }, + { -1019, "HPI initializing" }, + { -1020, "HPI unknown error" }, + { -1021, "HPI invalid session" }, + { -1022, "HPI invalid domain" }, + { -1023, "HPI invalid resource id" }, + { -1024, "HPI invalid request" }, + { -1025, "HPI entity not present" }, + { -1026, "HPI uninitialized" } +}; +char def_estr[15] = "HPI error %d "; + +static +char *decode_error(SaErrorT code) +{ + int i; + char *str = NULL; + for (i = 0; i < NECODES; i++) { + if (code == ecodes[i].code) { str = ecodes[i].str; break; } + } + if (str == NULL) { + sprintf(&def_estr[10],"%d",code); + str = &def_estr[0]; + } + return(str); +} + +static +void ShowSensor( + SaHpiSessionIdT sessionid, + SaHpiResourceIdT resourceid, + SaHpiSensorRecT *sensorrec ) +{ + SaHpiSensorNumT sensornum; + SaHpiSensorReadingT reading; + SaHpiSensorThresholdsT senstbuff; +#ifdef HPI_A + SaHpiSensorReadingT conv_reading; +#else + SaHpiEventStateT evtstate; +#endif + SaErrorT rv; + char *unit; + int i; + + sensornum = sensorrec->Num; +#ifdef HPI_A + rv = saHpiSensorReadingGet(sessionid,resourceid, sensornum, &reading); +#else + rv = saHpiSensorReadingGet(sessionid,resourceid, sensornum, &reading,&evtstate); +#endif + /* ReadingGet returns -1024 if SDR type is mBMC */ + if (!fdebug && rv == SA_ERR_HPI_INVALID_REQUEST) { + printf(" = no reading\n"); + return; + } else if (rv != SA_OK) { + printf("ReadingGet ret=%d\n", rv); + return; + } + +#ifdef HPI_A + if ((reading.ValuesPresent & SAHPI_SRF_INTERPRETED) == 0) { + if ((reading.ValuesPresent & SAHPI_SRF_RAW) == 0) { + /* no raw or interpreted, so just show event status */ + /* This is a Compact Sensor */ + if (reading.ValuesPresent & SAHPI_SRF_EVENT_STATE) + printf(" = %x %x\n", reading.EventStatus.SensorStatus, + reading.EventStatus.EventStatus); + else printf(" = no reading\n"); + return; + } else { + /* have raw, but not interpreted, so try convert. */ + rv = saHpiSensorReadingConvert(sessionid, resourceid, sensornum, + &reading, &conv_reading); + if (rv != SA_OK) { + /* conv rv=-1012 on Compact sensors */ + if (!fdebug && rv == SA_ERR_HPI_INVALID_DATA) + printf(" = %02x raw\n", reading.Raw); + else printf("raw=%x conv_ret=%d\n", reading.Raw, rv); + /* printf("conv_rv=%s\n", decode_error(rv)); */ + return; + } + else { + if (fdebug) printf("conv ok: raw=%x conv=%x\n", reading.Raw, + conv_reading.Interpreted.Value.SensorUint32); + reading.Interpreted.Type = conv_reading.Interpreted.Type; + if (reading.Interpreted.Type == SAHPI_SENSOR_INTERPRETED_TYPE_BUFFER) + { + memcpy(reading.Interpreted.Value.SensorBuffer, + conv_reading.Interpreted.Value.SensorBuffer, + 4); /* SAHPI_SENSOR_BUFFER_LENGTH); */ + /* IPMI 1.5 only returns 4 bytes */ + } else + reading.Interpreted.Value.SensorUint32 = + conv_reading.Interpreted.Value.SensorUint32; + } + } + } + /* Also show units of interpreted reading */ + i = sensorrec->DataFormat.BaseUnits; + if (i >= NSU) i = 0; + unit = units[i]; + switch(reading.Interpreted.Type) + { + case SAHPI_SENSOR_INTERPRETED_TYPE_FLOAT32: + printf(" = %5.2f %s\n", + reading.Interpreted.Value.SensorFloat32,unit); + break; + case SAHPI_SENSOR_INTERPRETED_TYPE_UINT32: + printf(" = %d %s\n", + reading.Interpreted.Value.SensorUint32, unit); + break; + case SAHPI_SENSOR_INTERPRETED_TYPE_BUFFER: + printf(" = %02x %02x %02x %02x\n", + reading.Interpreted.Value.SensorBuffer[0], + reading.Interpreted.Value.SensorBuffer[1], + reading.Interpreted.Value.SensorBuffer[2], + reading.Interpreted.Value.SensorBuffer[3]); + break; + default: + printf(" = %x (itype=%x)\n", + reading.Interpreted.Value.SensorUint32, + reading.Interpreted.Type); + } + + if (fshowthr) { /* Show thresholds, if any */ +#ifdef SHOWMAX + if ( sensorrec->DataFormat.Range.Flags & SAHPI_SRF_MAX ) + printf( " Max of Range: %5.2f\n", + sensorrec->DataFormat.Range.Max.Interpreted.Value.SensorFloat32); + if ( sensorrec->DataFormat.Range.Flags & SAHPI_SRF_MIN ) + printf( " Min of Range: %5.2f\n", + sensorrec->DataFormat.Range.Min.Interpreted.Value.SensorFloat32); +#endif + if ((!sensorrec->Ignore) && (sensorrec->ThresholdDefn.IsThreshold)) { + rv = saHpiSensorThresholdsGet(sessionid, resourceid, + sensornum, &senstbuff); + if (rv != 0) { printf("ThresholdsGet ret=%d\n", rv); return; } + printf( "\t\t\t"); + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_LOW_MINOR ) { + printf( "LoMin %5.2f ", + senstbuff.LowMinor.Interpreted.Value.SensorFloat32); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_LOW_MAJOR ) { + printf( "LoMaj %5.2f ", + senstbuff.LowMajor.Interpreted.Value.SensorFloat32); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_LOW_CRIT ) { + printf( "LoCri %5.2f ", + senstbuff.LowCritical.Interpreted.Value.SensorFloat32); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_UP_MINOR ) { + printf( "HiMin %5.2f ", + senstbuff.UpMinor.Interpreted.Value.SensorFloat32); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_UP_MAJOR ) { + printf( "HiMaj %5.2f ", + senstbuff.UpMajor.Interpreted.Value.SensorFloat32); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_UP_CRIT ) { + printf( "HiCri %5.2f ", + senstbuff.UpCritical.Interpreted.Value.SensorFloat32); + } +#ifdef SHOWMAX + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_UP_HYSTERESIS ) { + printf( "Hi Hys %5.2f ", + senstbuff.PosThdHysteresis.Interpreted.Value.SensorFloat32); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_LOW_HYSTERESIS ) { + printf( "Lo Hys %5.2f ", + senstbuff.NegThdHysteresis.Interpreted.Value.SensorFloat32); + } +#endif + printf( "\n"); + } /* endif valid threshold */ + } /* endif showthr */ + +#else /* HPI_B: HPI B.01.01 logic */ + i = sensorrec->DataFormat.BaseUnits; + if (i >= NSU) i = 0; + unit = units[i]; + switch(reading.Type) + { + case SAHPI_SENSOR_READING_TYPE_FLOAT64: + printf(" = %5.2f %s\n", + reading.Value.SensorFloat64,unit); + break; + case SAHPI_SENSOR_READING_TYPE_UINT64: + printf(" = %lld %s\n", + reading.Value.SensorUint64, unit); + break; + case SAHPI_SENSOR_READING_TYPE_INT64: + printf(" = %lld %s\n", + reading.Value.SensorInt64, unit); + break; + case SAHPI_SENSOR_READING_TYPE_BUFFER: + printf(" = %02x %02x %02x %02x\n", + reading.Value.SensorBuffer[0], + reading.Value.SensorBuffer[1], + reading.Value.SensorBuffer[2], + reading.Value.SensorBuffer[3]); + break; + default: + printf(" = %llx (itype=%x)\n", + reading.Value.SensorUint64, + reading.Type); + } + if (fshowthr) { /* Show thresholds, if any */ + if (sensorrec->ThresholdDefn.IsAccessible) { + rv = saHpiSensorThresholdsGet(sessionid, resourceid, + sensornum, &senstbuff); + if (rv != SA_OK) { printf("ThresholdsGet ret=%d\n", rv); + } else { + printf( "\t\t\t"); + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_LOW_MINOR ) { + printf( "LoMin %5.2f ", + senstbuff.LowMinor.Value.SensorFloat64); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_LOW_MAJOR ) { + printf( "LoMaj %5.2f ", + senstbuff.LowMajor.Value.SensorFloat64); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_LOW_CRIT ) { + printf( "LoCri %5.2f ", + senstbuff.LowCritical.Value.SensorFloat64); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_UP_MINOR ) { + printf( "HiMin %5.2f ", + senstbuff.UpMinor.Value.SensorFloat64); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_UP_MAJOR ) { + printf( "HiMaj %5.2f ", + senstbuff.UpMajor.Value.SensorFloat64); + } + if ( sensorrec->ThresholdDefn.ReadThold & SAHPI_STM_UP_CRIT ) { + printf( "HiCri %5.2f ", + senstbuff.UpCritical.Value.SensorFloat64); + } + printf( "\n"); + } /*endif get ok*/ + } /* endif valid threshold */ + } /* endif showthr */ +#endif + return; +} /*end ShowSensor*/ + +int +main(int argc, char **argv) +{ + int c; + SaErrorT rv; + SaHpiSessionIdT sessionid; +#ifdef HPI_A + SaHpiVersionT hpiVer; + SaHpiRptInfoT rptinfo; +#endif + SaHpiRptEntryT rptentry; + SaHpiEntryIdT rptentryid; + SaHpiEntryIdT nextrptentryid; + SaHpiEntryIdT entryid; + SaHpiEntryIdT nextentryid; + SaHpiResourceIdT resourceid; + SaHpiRdrT rdr; + + printf("%s: version %s\n",argv[0],progver); + + while ( (c = getopt( argc, argv,"tx?")) != EOF ) + switch(c) { + case 't': fshowthr = 1; break; + case 'x': fdebug = 1; break; + default: + printf("Usage %s [-t -x]\n",argv[0]); + printf("where -t = show Thresholds also\n"); + printf(" -x = show eXtra debug messages\n"); + exit(1); + } + if (fdebug) printf("fshowthr = %d, fdebug = %d\n",fshowthr,fdebug); +#ifdef HPI_A + rv = saHpiInitialize(&hpiVer); + if (rv != SA_OK) { + printf("saHpiInitialize: %s\n",decode_error(rv)); + exit(-1); + } + rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + if (rv == SA_ERR_HPI_ERROR) + printf("saHpiSessionOpen: error %d, SpiLibd not running\n",rv); + else + printf("saHpiSessionOpen: %s\n",decode_error(rv)); + exit(-1); + } + if (fdebug) printf("Starting Discovery ...\n"); + rv = saHpiResourcesDiscover(sessionid); + if (fdebug) printf("saHpiResourcesDiscover %s\n",decode_error(rv)); + rv = saHpiRptInfoGet(sessionid,&rptinfo); + if (fdebug) printf("saHpiRptInfoGet %s\n",decode_error(rv)); + printf("RptInfo: UpdateCount = %x, UpdateTime = %lx\n", + rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp); +#else + rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + printf("saHpiSessionOpen: %s\n",decode_error(rv)); + exit(-1); + } + if (fdebug) printf("Starting Discovery ...\n"); + rv = saHpiDiscover(sessionid); + if (fdebug) printf("saHpiDiscover %s\n",decode_error(rv)); + if (fshowthr) { + /* + * If OpenHPI, we need to wait extra time before doing + * ThresholdsGet because its discovery isn't really done. + */ + sleep(5); + } +#endif + + /* walk the RPT list */ + rptentryid = SAHPI_FIRST_ENTRY; + while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry); + if (fdebug) printf("saHpiRptEntryGet %s\n",decode_error(rv)); + if (rv == SA_OK) { + /* walk the RDR list for this RPT entry */ + entryid = SAHPI_FIRST_ENTRY; + resourceid = rptentry.ResourceId; +#ifdef HPI_A + rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0; +#endif + printf("rptentry[%d] resourceid=%d tag: %s\n", + rptentryid,resourceid, rptentry.ResourceTag.Data); + while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRdrGet(sessionid,resourceid, + entryid,&nextentryid, &rdr); + if (fdebug) printf("saHpiRdrGet[%d] rv = %d\n",entryid,rv); + if (rv == SA_OK) { + char *eol; + rdr.IdString.Data[rdr.IdString.DataLength] = 0; + if (rdr.RdrType == SAHPI_SENSOR_RDR) eol = " \t"; + else eol = "\n"; + printf("RDR[%02d]: %s %s %s",rdr.RecordId, + rtypes[rdr.RdrType],rdr.IdString.Data,eol); + if (rdr.RdrType == SAHPI_SENSOR_RDR) { + ShowSensor(sessionid,resourceid, + &rdr.RdrTypeUnion.SensorRec); + } + entryid = nextentryid; + } + } + rptentryid = nextrptentryid; + } + } + + rv = saHpiSessionClose(sessionid); +#ifdef HPI_A + rv = saHpiFinalize(); +#endif + + exit(0); + return(0); +} + +/* end hpisensor.c */ diff --git a/hpiutil/hpiutil.spec b/hpiutil/hpiutil.spec new file mode 100644 index 0000000..9fe7a5e --- /dev/null +++ b/hpiutil/hpiutil.spec @@ -0,0 +1,199 @@ +Name: hpiutil +%define Version 1.1.11 +Version: %Version +Release: 1 +Summary: Contains HPI server management utilities and library. +License: BSD +Group: System/Management +Source: hpiutil-%Version.tar.gz +URL: http://ipmiutil.sourceforge.net +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +BuildRequires: gcc + +%ifarch x86_pentium3 +AutoReqProv: No +%endif +%ifarch x86_pentium4 +AutoReqProv: No +%endif + +%description +The HPI utilities package provides system management utilities that +conform to the SA Forum's Hardware Platform Interface specification, and +as such are hardware-independent across platforms that have an HPI +library implementation. The HPI library on Intel platforms requires +an IPMI driver. An IPMI driver can be provided by either the Intel +IPMI driver (/dev/imb) or the OpenIPMI driver (/dev/ipmi0) in Linux +kernel versions 2.4.20 and greater. + +This package includes the HPI binary libraries and the following +HPI utilities. + hpisensor + hpisel + hpireset + hpiwdt + hpifru + hpialarmpanel + +%prep +#%setup -q + +#%build +#sh configure +#make + +#%install +#RPM_BUILD_ROOT=`pwd` +#make DESTDIR=${RPM_BUILD_ROOT} install +#( cd ${RPM_BUILD_ROOT}/usr/man/man8; gzip -f *.8 ) + +%files +%defattr(0755,root,root) +/usr/bin/hpifru +/usr/bin/hpisensor +/usr/bin/hpialarmpanel +/usr/bin/hpisel +/usr/bin/hpiwdt +/usr/bin/hpireset +/usr/bin/SpiLibd +/usr/lib/libSaHpi.so +/usr/lib/libSpiDaemonCore.so +/usr/lib/libSpiModGeneric.so +/usr/lib/libSpiModIpmi.so +/usr/lib/libSpiModIpmi.so-open +/usr/lib/libSpiIpmiImb.so +/usr/lib/libSpiIpmiOpenIpmi.so +/usr/lib/libSpiTsdMaplx.so +/etc/hpi/hpiinit.sh +/usr/share/hpiutil/env.hpi +%defattr(0664,root,root) +/usr/share/hpiutil/README +/usr/share/hpiutil/COPYING +/etc/hpi/spi-daemon.conf +/etc/hpi/spi-lib.conf +# %defattr(-,root,root) +# %doc README TODO COPYING ChangeLog + +%pre +# before install +sdir=/usr/share/hpiutil +edir=/etc/hpi +echo "Installing HPI Utilities ..." +mkdir -p $sdir +mkdir -p $edir + +# Check for an IPMI driver +rpm -qa |grep ipmidrvr >/dev/null +if [ $? -ne 0 ] +then + # Intel ipmidrvr package is not installed, but other IPMI drivers + # could also be used, so test for device files. + dev1=/dev/imb + dev2=/dev/ipmi0 + dev3=/dev/ipmi/0 + dev4=/dev/ipmikcs + if [ ! -c $dev1 ] + then + if [ ! -c $dev2 ] + then + if [ ! -c $dev3 ] + then + echo "WARNING: No IPMI devices found ($dev1, $dev2 or $dev3)." + echo "The HPI utilities depend on an IPMI driver. " + fi + fi + fi +fi + +%post +# after install +sdir=/usr/share/hpiutil +edir=/etc/hpi + +echo "hpiutil install started `date`" +# Assumes that the kernel modules are already in place. + +# The spi-daemon.conf file should have 'localhost' as the +# server name. User can modify this if remote. + +# set up the init.d jobs +loadhpi=/etc/hpi/hpiinit.sh +if [ -d /etc/rc.d/init.d ] +then + # RedHat init.d structure + cd /etc/rc.d/init.d + cp $loadhpi ./hpi + echo "To autostart hpi, enter: chkconfig --add hpi" +# chkconfig --add hpi +# Or manually create links +# cd ../rc3.d +# ln -s ../init.d/hpi S81hpi 2>/dev/null +# ln -s ../init.d/hpi K35hpi 2>/dev/null +# cd ../rc5.d +# ln -s ../init.d/hpi S81hpi 2>/dev/null +# ln -s ../init.d/hpi K35hpi 2>/dev/null +# cd ../rc6.d +# ln -s ../init.d/hpi K35hpi 2>/dev/null +# cd ../rc0.d +# ln -s ../init.d/hpi K35hpi 2>/dev/null +else + # SuSE init.d structure + cd /etc/init.d + cp $loadhpi ./hpi + echo "To autostart hpi, enter: /usr/lib/lsb/install_initd /etc/init.d/hpi " +# /usr/lib/lsb/install_initd /etc/init.d/hpi +# Or manually create links +# cd rc3.d +# ln -s ../hpi S81hpi 2>/dev/null +# ln -s ../hpi K35hpi 2>/dev/null +# cd ../rc5.d +# ln -s ../hpi S81hpi 2>/dev/null +# ln -s ../hpi K35hpi 2>/dev/null +# cd ../rc6.d +# ln -s ../hpi K35hpi 2>/dev/null +# cd ../rc0.d +# ln -s ../hpi K35hpi 2>/dev/null +fi + +echo "done `date`" + +%preun +# before uninstall +echo "Uninstalling HPI Utilities feature ..." +/etc/hpi/hpiinit.sh stop 2>/dev/null + +%postun +# after uninstall, clean up anything left over +sdir=/usr/share/hpiutil +edir=/etc/hpi +tmped=/tmp/edmk.tmp + +if [ -d /etc/rc.d/init.d ] +then + # RedHat init.d structure +# chkconfig --del hpi + cd /etc/rc.d/init.d + rm -f hpi ../rc?.d/S81hpi ../rc?.d/K35hpi +else + # SuSE init.d structure +# /usr/lib/lsb/remove_initd /etc/init.d/hpi + cd /etc/init.d + rm -f hpi rc?.d/S81hpi rc?.d/K35hpi +fi +rm -rf $sdir 2>/dev/null + +%changelog +* Tue Apr 06 2004 Andrew Cress + changed to not turn on hpi autostart scripts at rpm install +* Fri Mar 26 2004 Andrew Cress +- changed to include proper kill scripts and chkconfig info +* Thu Feb 12 2004 Andrew Cress +- changed naming from /etc/init.d/hpiinit.sh to /etc/init.d/hpi +* Fri Jun 27 2003 Andrew Cress +- updated to check for ipmidrvr rpm, since no /dev/imb until reboot. +* Fri Jun 20 2003 Andrew Cress +- updated for README & released file locations +* Thu Jun 12 2003 Andrew Cress +- updated for beta2 file naming +* Tue May 05 2003 Andrew Cress +- created diff --git a/hpiutil/hpiwdt.c b/hpiutil/hpiwdt.c new file mode 100644 index 0000000..efa732d --- /dev/null +++ b/hpiutil/hpiwdt.c @@ -0,0 +1,272 @@ +/* + * hpiwdt.c + * + * Copyright (c) 2003-2004 Intel Corporation. + * + * This tool reads and enables the watchdog timer via HPI. + * Note that there are other methods for doing this, and the + * standard interface is for the driver to expose a /dev/watchdog + * device interface. + * WARNING: If you enable/reset the watchdog, make sure you have + * something set up to keep resetting the timer at regular intervals, + * or it will reset your system. + * + * Author: Andy Cress arcress at users.sourceforge.net + * + * 05/02/03 Andy Cress - created + * 06/06/03 Andy Cress - added more logic with beta2 SPI release + * 06/11/03 Andy Cress - successful test of options to set WDT values. + * 03/15/04 Andy Cress v1.0 - added strings for use & actions in show_wdt + * 12/02/04 Andy Cress v1.1 - fixed RPT loop, added more decoding, + * added flags for HPI_A/HPI_B. + */ +/*M* +Copyright (c) 2004, Intel Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + a.. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + b.. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + c.. Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *M*/ + +#include +#include +#include +#include +#include "SaHpi.h" + +#define uchar unsigned char +#ifdef HPI_A +char *progver = "1.1 HPI-A"; +#else +char *progver = "1.1 HPI-B"; +#endif +char fdebug = 0; +#define NUSE 6 +char *usedesc[NUSE] = {"reserved", "BIOS FRB2", "BIOS/POST", + "OS Load", "SMS/OS", "OEM" }; +#define NACT 5 +char *actions[NACT] = {"No action", "Hard Reset", "Power down", + "Power cycle", "Reserved" }; + +static void +show_wdt(SaHpiWatchdogNumT wdnum, SaHpiWatchdogT *wdt) +{ + int icount, pcount; + char ustr[12]; + char astr[16]; + char estr[30]; + char *pstr; + icount = wdt->InitialCount /1000; /*1000 msec = 1 sec*/ + pcount = wdt->PresentCount /1000; + + if (wdt->TimerUse > NUSE) sprintf(ustr,"%d", wdt->TimerUse ); + else strcpy(ustr, usedesc[wdt->TimerUse]); + if (wdt->TimerAction > NACT) sprintf(astr,"%d", wdt->TimerAction ); + else strcpy(astr, actions[wdt->TimerAction]); + printf("Watchdog: Num=%d, Log=%d, Running=%d, TimerUse=%s, TimerAction=%s\n", + wdnum,wdt->Log,wdt->Running,ustr, astr); + if (wdt->TimerUseExpFlags == 0) strcpy(estr,"none"); + else { + estr[0] = 0; + if (wdt->TimerUseExpFlags & 0x01) strcat(estr,"FRB2 "); + if (wdt->TimerUseExpFlags & 0x02) strcat(estr,"POST "); + if (wdt->TimerUseExpFlags & 0x04) strcat(estr,"OS_Load "); + if (wdt->TimerUseExpFlags & 0x08) strcat(estr,"SMS_OS "); + if (wdt->TimerUseExpFlags & 0x10) strcat(estr,"OEM "); + } + printf(" ExpiredUse=%s, Timeout=%d sec, Counter=%d sec\n", + estr, icount,pcount); + switch(wdt->PretimerInterrupt) { + case 1: pstr = "SMI"; break; + case 2: pstr = "NMI"; break; + case 3: pstr = "MsgInt"; break; + default: pstr = "none"; break; + } + printf(" PreTimerInterrupt=%s, PreTimeoutInterval=%d msec\n", + pstr,wdt->PreTimeoutInterval); + return; +} /*end show_wdt*/ + +int +main(int argc, char **argv) +{ + int c; + SaErrorT rv; + SaHpiSessionIdT sessionid; +#ifdef HPI_A + SaHpiVersionT hpiVer; + SaHpiRptInfoT rptinfo; +#else + SaHpiDomainInfoT domainInfo; +#endif + SaHpiRptEntryT rptentry; + SaHpiEntryIdT rptentryid; + SaHpiEntryIdT nextrptentryid; + SaHpiResourceIdT resourceid; + SaHpiWatchdogNumT wdnum; + SaHpiWatchdogT wdt; + int t = 0; + char freset = 0; + char fenable = 0; + char fdisable = 0; + + printf("%s ver %s\n", argv[0],progver); + while ( (c = getopt( argc, argv,"dert:x?")) != EOF ) + switch(c) { + case 'r': /* reset wdt */ + freset = 1; + break; + case 'e': /* disable wdt */ + fenable = 1; + break; + case 'd': /* disable wdt */ + fdisable = 1; + break; + case 't': /* timeout (enable implied) */ + t = atoi(optarg); + fenable = 1; + break; + case 'x': fdebug = 1; break; /* debug messages */ + default: + printf("Usage: %s [-derx -t sec]\n", argv[0]); + printf(" where -e enables the watchdog timer\n"); + printf(" -d disables the watchdog timer\n"); + printf(" -r resets the watchdog timer\n"); + printf(" -t N sets timeout to N seconds\n"); + printf(" -x show eXtra debug messages\n"); + exit(1); + } + if (t == 0) t = 120; + +#ifdef HPI_A + rv = saHpiInitialize(&hpiVer); + if (rv != SA_OK) { + printf("saHpiInitialize error %d\n",rv); + exit(-1); + } + rv = saHpiSessionOpen(SAHPI_DEFAULT_DOMAIN_ID,&sessionid,NULL); + if (rv != SA_OK) { + if (rv == SA_ERR_HPI_ERROR) + printf("saHpiSessionOpen: error %d, library not running\n",rv); + else printf("saHpiSessionOpen error %d\n",rv); + exit(-1); + } + rv = saHpiResourcesDiscover(sessionid); + if (fdebug) printf("saHpiResourcesDiscover rv = %d\n",rv); + rv = saHpiRptInfoGet(sessionid,&rptinfo); + if (fdebug) printf("saHpiRptInfoGet rv = %d\n",rv); + printf("RptInfo: UpdateCount = %x, UpdateTime = %lx\n", + rptinfo.UpdateCount, (unsigned long)rptinfo.UpdateTimestamp); +#else + rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL); + if (rv != SA_OK) { + printf("saHpiSessionOpen error %d\n",rv); + exit(-1); + } + rv = saHpiDiscover(sessionid); + if (fdebug) printf("saHpiDiscover rv = %d\n",rv); + rv = saHpiDomainInfoGet(sessionid, &domainInfo); + if (fdebug) printf("saHpiDomainInfoGet rv = %d\n",rv); + printf("DomainInfo: UpdateCount = %x, UpdateTime = %lx\n", + domainInfo.RptUpdateCount, (unsigned long)domainInfo.RptUpdateTimestamp); +#endif + + /* walk the RPT list */ + rptentryid = SAHPI_FIRST_ENTRY; + while ((rv == SA_OK) && (rptentryid != SAHPI_LAST_ENTRY)) + { + rv = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry); + if (rv != SA_OK) printf("RptEntryGet: rv = %d\n",rv); + if (rv == SA_OK) { + /* handle WDT for this RPT entry */ + resourceid = rptentry.ResourceId; +#ifdef HPI_A + rptentry.ResourceTag.Data[rptentry.ResourceTag.DataLength] = 0; +#endif + if (fdebug) + printf("rptentry[%d] resourceid=%d capab=%x tag: %s\n", + rptentryid, resourceid, rptentry.ResourceCapabilities, + rptentry.ResourceTag.Data); + + if (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_WATCHDOG) { + printf("%s has watchdog capability\n",rptentry.ResourceTag.Data); + + wdnum = SAHPI_DEFAULT_WATCHDOG_NUM; + rv = saHpiWatchdogTimerGet(sessionid,resourceid,wdnum,&wdt); + if (fdebug) printf("saHpiWatchdogTimerGet rv = %d\n",rv); + if (rv != 0) { + printf("saHpiWatchdogTimerGet error = %d\n",rv); + rv = 0; + rptentryid = nextrptentryid; + continue; + } + show_wdt(wdnum,&wdt); + + if (fdisable) { + printf("Disabling watchdog timer ...\n"); + /* clear FRB2, timeout back to 120 sec */ + /* TODO: add setting wdt values here */ + wdt.TimerUse = SAHPI_WTU_NONE; /* 1=FRB2 2=POST 3=OSLoad 4=SMS_OS 5=OEM */ + wdt.TimerAction = SAHPI_WAE_NO_ACTION; /* 0=none 1=reset 2=powerdown 3=powercycle */ + wdt.PretimerInterrupt = SAHPI_WPI_NONE; /* 0=none 1=SMI 2=NMI 3=message */ + wdt.PreTimeoutInterval = 60000; /*msec*/ + wdt.InitialCount = 120000; /*msec*/ + wdt.PresentCount = 120000; /*msec*/ + + rv = saHpiWatchdogTimerSet(sessionid,resourceid,wdnum,&wdt); + if (fdebug) printf("saHpiWatchdogTimerSet rv = %d\n",rv); + if (rv == 0) show_wdt(wdnum,&wdt); + } else if (fenable) { + printf("Enabling watchdog timer ...\n"); + /* hard reset action, no pretimeout, clear SMS/OS when done */ + /* use t for timeout */ + wdt.TimerUse = SAHPI_WTU_SMS_OS; /* 1=FRB2 2=POST 3=OSLoad 4=SMS_OS 5=OEM */ + wdt.TimerAction = SAHPI_WAE_RESET; /* 0=none 1=reset 2=powerdown 3=powercycle */ + wdt.PretimerInterrupt = SAHPI_WPI_NMI; /* 0=none 1=SMI 2=NMI 3=message */ + wdt.PreTimeoutInterval = (t / 2) * 1000; /*msec*/ + wdt.InitialCount = t * 1000; /*msec*/ + wdt.PresentCount = t * 1000; /*msec*/ + + rv = saHpiWatchdogTimerSet(sessionid,resourceid,wdnum,&wdt); + if (fdebug) printf("saHpiWatchdogTimerSet rv = %d\n",rv); + if (rv == 0) show_wdt(wdnum,&wdt); + } + if (freset && !fdisable) { + printf("Resetting watchdog timer ...\n"); + rv = saHpiWatchdogTimerReset(sessionid,resourceid,wdnum); + if (fdebug) printf("saHpiWatchdogTimerReset rv = %d\n",rv); + } + } /*watchdog capability*/ + rptentryid = nextrptentryid; /* get next RPT (usu only one anyway) */ + } /*endif RPT ok*/ + } /*end while loop*/ + + rv = saHpiSessionClose(sessionid); + +#ifdef HPI_A + rv = saHpiFinalize(); +#endif + exit(0); +} + +/* end hpiwdt.c */ diff --git a/hpiutil/mkrpm b/hpiutil/mkrpm new file mode 100755 index 0000000..e64f995 --- /dev/null +++ b/hpiutil/mkrpm @@ -0,0 +1,135 @@ +# mkrpm +# Make the rpms for hpiutil +# +# Reliab11 = RedHat 8.0 (rh80) +# Reliab12 = RedHat 9.0 (rh90) +# Reliab13 = MV CGE 2.1 (mv21) +# Reliab14 = MV CGE 3.0 (mv30p3) +# Reliab01 = MV CGE 3.1 (mv31p3) +# Reliab03 = RedHat AS 2.1 (as21) +# chapin4 = MV CGE 3.1 (mv31p4) +# grumpy = RedHat EL 3 (el3) +# chesnee1 = RedHat EL 3 (el3) +# telcoraid= SuSE UL 1.0 (ul10) +# +ROOT=`pwd` +# usually /mnt/pub/panich/hpi/hpiutil +RTARG=rpm +RSPEC=hpiutil.spec +RTO=$ROOT/$RTARG/usr/bin +STO=$ROOT/$RTARG/usr/share/hpiutil +ETO=$ROOT/$RTARG/etc/hpi +OS=el3 +VER=`grep "^%define Version" $RSPEC |cut -f3 -d' '` +tmpe=/tmp/ed.tmp +rpmcmd=rpmbuild + +if [ $# -ge 1 ] +then + OS=$1 +fi +case $OS in +"mv21") + archv=x86_pentium3 + ;; +"mv30") + archv=x86_pentium3 + ;; +"mv30wv") + archv=x86_pentium4 + ;; +"mv31p4") + archv=x86_pentium4 + ;; +"mv31p3") + archv=x86_pentium3 + ;; +"ul10") + rpmcmd=rpm + archv=i386 + ;; +*) + archv=i386 + ;; +esac + +# Modify the env for EL3 & others +if [ "$OS" = "el3" ] +then + cmt= +else + cmt="#" +fi +cat - <<%%% >$tmpe +1 +/LD_ASSUME_KERNEL +c +$cmt export LD_ASSUME_KERNEL=2.4.1 +. +w +q +%%% +ed hpiinit.sh <$tmpe +ed env.hpi <$tmpe +ed obj/env.hpi <$tmpe + +echo "Copying lib files to rpm, OS=$OS ..." +mkdir -p $RTO +mkdir -p $ROOT/$RTARG/usr/lib +cp -uf $ROOT/obj/${OS}/SpiLibd $RTO +cp -uf $ROOT/obj/${OS}/*.so $ROOT/$RTARG/usr/lib +cp -uf $ROOT/obj/${OS}/*.so-open $ROOT/$RTARG/usr/lib + +# Make the matching hpiutil binaries +cd $ROOT +make clean +make +echo "Copying files for rpm, OS=$OS ..." +mkdir -p $ETO +mkdir -p $ROOT/$RTARG/etc/init.d +mkdir -p $STO +cp -uf $ROOT/hpialarmpanel $RTO +cp -uf $ROOT/hpisensor $RTO +cp -uf $ROOT/hpisel $RTO +cp -uf $ROOT/hpifru $RTO +cp -uf $ROOT/hpiwdt $RTO +cp -uf $ROOT/hpireset $RTO +cp -uf $ROOT/hpiinit.sh $ETO +cp -uf $ROOT/README $STO +cp -uf $ROOT/COPYING $STO +cp -uf $ROOT/obj/env.hpi $STO +cp -uf $ROOT/obj/spi-daemon.conf $ETO +cp -uf $ROOT/obj/spi-lib.conf $ETO + + +# (new:) +# libSaHpi.so libSpiIpmiImb.so libSpiModIpmi.so SpiLibd +# libSpiDaemonCore.so libSpiModGeneric.so libSpiTsdMaplx.so +# (old:) +# libSaHpi.so libSpiDaemonCore.so libSpiGenericMaplx.so libSpiModGeneric.so +# libSpiModIpmi.so libSpiModMullins.so libSpiMullinsMaplx.so +# libSpiIpmiImb.so libSpiIpmiOpenIpmi.so + +echo "Making hpiutil rpm ..." +#rpmbuild -bb $RSPEC +#HOME=`pwd` +#export HOME +rm -f $ROOT/$RTARG/$archv/hpiutil*.rpm +echo "%_rpmdir ${ROOT}/${RTARG}" > $HOME/.rpmmacros +$rpmcmd -bb --buildroot ${ROOT}/${RTARG} $RSPEC +rm -f $HOME/.rpmmacros + +# save the rpm +rfil=$ROOT/$RTARG/$archv/hpiutil-$VER-?.$archv.rpm +echo $OS |grep mv31p4 >/dev/null 2>&1 +if [ $? -eq 0 ] +then + rfil=/usr/src/montavista/RPMS/$archv/hpiutil-$VER-?.$archv.rpm +fi +cp $rfil $ROOT/obj/hpiutil-$VER-$OS.$archv.rpm +if [ $? -eq 0 ] +then + # remove the directory + rm -rf $ROOT/$RTARG +fi + diff --git a/hpiutil/upd b/hpiutil/upd new file mode 100755 index 0000000..0967595 --- /dev/null +++ b/hpiutil/upd @@ -0,0 +1,24 @@ +# upd +# update hpi library objects to public share +# +# todir=/mnt/pub/panich/hpi/hpiutil +todir=/mnt/pub/cress/hpi/hpiutil +hdir=/root/hpi +cdir=`pwd` + +if [ $# -ge 1 ] +then + OS=$1 +else + OS=el3 +fi +mkdir -p $todir/obj/$OS +# cd $SAHPI_HOME +cd $hdir +cp bin/SpiLibd $todir/obj/$OS +cp lib/*.so* $todir/obj/$OS +if [ -f lib/Server ] +then + cp lib/Server $todir/obj/$OS +fi +cd $cdir -- cgit v1.2.3