diff --git a/ipmitool/Makefile b/ipmitool/Makefile deleted file mode 100644 index 7a81b8f..0000000 --- a/ipmitool/Makefile +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# Redistribution of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# Redistribution in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# Neither the name of Sun Microsystems, Inc. or the names of -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# This software is provided "AS IS," without a warranty of any kind. -# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, -# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A -# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. -# SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE -# FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING -# OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL -# SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, -# OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -# PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF -# LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, -# EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -# -# You acknowledge that this software is not designed or intended for use -# in the design, construction, operation or maintenance of any nuclear -# facility. - -V_MAJ = 1 -V_MIN = 4 -V_REV = 1.1 -VERSION = $(V_MAJ).$(V_MIN).$(V_REV) - -PROG = ipmitool -SPEC = $(PROG).spec -MAN = $(PROG).1 -OBJS = main.o ipmi_sdr.o ipmi_sel.o ipmi_fru.o ipmi_chassis.o ipmi_lanp.o - -LIB = libipmitool.a -LIB_OBJS= lib/helper.o lib/ipmi_dev.o lib/ipmi_lan.o - -CC = gcc -RM = rm -f -AR = ar rc -RANLIB = ranlib -STRIP = strip - -INCLUDE = -I include -CFLAGS = -g -Wall -Werror -D_GNU_SOURCE -DVERSION=\"$(VERSION)\" -LDFLAGS = -L . -lm -lipmitool - -SBINDIR = $(DESTDIR)/usr/sbin -MANDIR = $(DESTDIR)/usr/share/man/man1 - -.PHONY: all -all: $(LIB) $(PROG) man - -$(PROG): $(OBJS) - $(CC) $(INCLUDE) -o $@ $(OBJS) $(LDFLAGS) - -$(LIB): $(LIB_OBJS) - $(AR) $(LIB) $? - $(RANLIB) $(LIB) - -install: $(PROG) - strip $(PROG) - install -m755 -o root -g root $(PROG) $(SBINDIR)/$(PROG) - -install-man: man - gzip -c $(PROG).1 > $(MANDIR)/$(PROG).1.gz - -clean: - -$(RM) $(PROG) $(SPEC) $(MAN) $(LIB) - -$(RM) $(OBJS) - -$(RM) $(LIB_OBJS) - -dist: clean spec - tar -C .. -czf ../$(PROG)-$(VERSION).tar.gz $(PROG) - -man: - sed -e "s/@@VERSION@@/$(VERSION)/" $(MAN).in > $(MAN) - -spec: - sed -e "s/@@VERSION@@/$(VERSION)/" $(SPEC).in > $(SPEC) - -rpm: spec - tar -C .. -czf $(PROG).tar.gz $(PROG); \ - RPM=`which rpmbuild`; \ - if [ -z "$$RPM" ]; then RPM=rpm; fi; \ - $$RPM -ta $(PROG).tar.gz; \ - rm $(PROG).tar.gz - -.c.o: - $(CC) $(CFLAGS) $(INCLUDE) -c $(@D)/$(/dev/null 2>&1 ; then - echo "Error: unable to find interface $IFACE" - exit 1 - fi -fi - -if [ $# -ge 2 ]; then - CHANNEL=$2 - if [ $CHANNEL -ne 6 ] && [ $CHANNEL -ne 7 ]; then - echo "Invalid channel: $CHANNEL" - exit 1 - fi -fi - -[ $DEBUG -gt 0 ] && echo "Auto-configuring $IFACE (channel $CHANNEL)" - -# IP Address -IP_ADDRESS=$( $IFCONFIG $IFACE | grep "inet addr:" | awk -F"[:[:space:]]+" '{ print $4 }' ) -if [ X$IP_ADDRESS = X ]; then - echo "Unable to determine IP address for interface $IFACE" - exit 2 -fi - -# Netmask -IP_NETMASK=$( $IFCONFIG $IFACE | grep "inet addr:" | awk -F"[:[:space:]]+" '{ print $8 }' ) -if [ X$IP_NETMASK = X ]; then - echo "Unable to determine IP netmask for interface $IFACE" - exit 3 -fi - -# MAC Address -MAC_ADDRESS=$( $IFCONFIG $IFACE | grep "HWaddr" | awk '{ print $5 }' ) -if [ X$MAC_ADDRESS = X ]; then - echo "Unable to determine MAC address for interface $IFACE" - exit 4 -fi - -# default route IP Address -DEF_ROUTE_IP=$( $ROUTE -n | awk '/^0.0.0.0/ { print $2 }' ) -if [ X$DEF_ROUTE_IP = X ]; then - echo "Unable to determine default route IP address" - exit 5 -fi - -# Default Route MAC Address -# (ping it first to populate arp table) -$PING -q -c1 >/dev/null 2>&1 -DEF_ROUTE_MAC=$( $ARP -an -i $IFACE | grep $DEF_ROUTE_IP | awk '{ print $4 }' ) -if [ X$DEF_ROUTE_MAC = X ]; then - echo "Unable to determine default route MAC address" - exit 6 -fi - -ipmitool_lan_set "ipsrc" "static" -ipmitool_lan_set "ipaddr" $IP_ADDRESS -ipmitool_lan_set "netmask" $IP_NETMASK -ipmitool_lan_set "macaddr" $MAC_ADDRESS -ipmitool_lan_set "defgw ipaddr" $DEF_ROUTE_IP -ipmitool_lan_set "defgw macaddr" $DEF_ROUTE_MAC -ipmitool_lan_set "auth callback,user,operator,admin" - -exit 0 diff --git a/ipmitool/debian/ipmitool.1 b/ipmitool/debian/ipmitool.1 deleted file mode 100644 index 65c82ca..0000000 --- a/ipmitool/debian/ipmitool.1 +++ /dev/null @@ -1,290 +0,0 @@ -.TH "ipmitool" "1" "1.4.1.1" "Duncan Laurie" "" -.SH "NAME" -.LP -ipmitool \- utility for IPMI control -.SH "SYNTAX" -.LP -ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIlan\fP \fB\-H\fR \fIaddress\fP [\fB\-P\fR \fIpassword\fP] <\fIexpression\fP> -.br -ipmitool [\fB\-hcvV\fR] \fB\-I\fR \fIdev\fP <\fIexpression\fP> -.SH "DESCRIPTION" -.LP -This program lets you perform various IPMI functions with either a kernel device driver or over a LAN interface. These functions include printing FRU information, LAN configuration, sensor readings, and remote chassis power control. -.SH "OPTIONS" -.LP -.TP -\fB\-h\fR -Get basic usage help from the command line. -.TP -\fB\-c\fR -Make output suitable for parsing where possible by separating fields with commas instead of spaces. -.TP -\fB\-V\fR -Display version information. -.TP -\fB\-v\fR -Increase verbose output level. This option may be specified multiple times to increase the level of debug output. If given three times you will get hexdumps of all incoming and outgoing packets. -.TP -\fB\-I\fR <\fIinterface\fP> -Selects IPMI interface to use. Possible interfaces are \fIlan\fP or \fIdev\fP. -.TP -\fB\-H\fR <\fIaddress\fP> -Remote server address, can be IP address or hostname. This option is required for the LAN interface connection. -.TP -\fB\-P\fR <\fIpassword\fP> -Remote server password, 16 character maximum. This is optional for the LAN interface, if it is not provided the session will not be authenticated. -.SH "EXPRESSIONS" -.LP -.TP -.I help -This can be used to get command-line help on ipmitool commands. It may also be placed at the end of commands to get option usage help. -.RS -.PP -ipmitool -I dev help -.br -Commands: chassis, fru, lan, sdr, sel -.LP -.PP -ipmitool -I dev chassis help -.br -Chassis Commands: status, power, identify, policy, restart_cause -.LP -.PP -ipmitool -I dev chassis power help -.br -Chassis Power Commands: status, on, off, cycle, reset, diag, soft -.LP -.RE -.TP -\fIraw\fP <\fBnetfn\fR> <\fBcmd\fR> [\fBdata\fR] -This will allow you to execute raw IPMI commands. For example to query the POH counter with a raw command: -.RS -.PP -ipmitool -I dev raw 0x0 0xf -.br -RAW REQ (netfn=0x0 cmd=0xf data_len=0) -.br -RAW RSP (5 bytes) -.br - 3c 72 0c 00 00 -.LP -.RE -.TP -\fIchaninfo\fP [\fBchannel\fR] -This command will display information about the selected channel. If no channel is given it will display information about the currently used channel: -.RS -.PP -ipmitool -I dev chaninfo -.br -Channel 0xf info: -.br - Channel Medium Type : System Interface -.br - Channel Protocol Type : KCS -.br - Session Support : session-less -.br - Active Session Count : 0 -.br - Protocol Vendor ID : 7154 -.LP -.RE -.TP -.I chassis -.RS -.TP -.I status -This command returns information about the high-level status of the system chassis and main power subsystem. -.TP -.I poh -This command will return the Power-On Hours counter. -.TP -\fIidentify\fP <\fBinterval\fR> -Control the front panel identify light. Default is 15. Use 0 to turn off. -.TP -.I restart_cause -Query the chassis for the cause of the last system restart. -.TP -.I policy -Set the chassis power policy in the event power failure. -.RS -.TP -.I list -Return supported policies. -.TP -.I always-on -Turn on when power is restored. -.TP -.I previous -Returned to previous state when power is restored. -.TP -.I always-off -Stay off after power is restored. -.RE -.TP -.I power -Performs a chassis control command to view and change the power state. -.RS -.TP -.I status -Show current chassis power status. -.TP -.I on -Power up chassis. -.TP -.I off -Power down chassis into soft off (S4/S5 state). WARNING: this command does not initiate a clean shutdown of the operating system prior to powering down the system. -.TP -.I cycle -This command provides a power off interval of at least 1 second. No action should occur if chassis power is in S4/S5 state, but it is recommended to check power state first and only issue a power cycle command if the system power is on or in lower sleep state than S4/S5. -.TP -.I reset -This command will perform a hard reset. -.TP -.I diag -Pulse a version of a diagnostic interrupt (NMI) that goes directly to the processor(s). -.TP -.I soft -Initiate a soft\-shutdown of OS via ACPI by emulating a fatal overtemperature. -.RE -.RE -.TP -.I lan -.RS -.TP -\fIprint\fP <\fBchannel\fR> -Print the current configuration for the given channel. -.TP -\fIset\fP <\fBchannel\fR> <\fBparameter\fR> -Set the given parameter on the given channel. Valid parameters are: -.RS -.TP -\fIipaddr\fP <\fBx.x.x.x\fR> -Set the IP address for this channel. -.TP -\fInetmask\fP <\fBx.x.x.x\fR> -Set the netmask for this channel. -.TP -\fImacaddr\fP <\fBxx:xx:xx:xx:xx:xx\fR> -Set the MAC adddress for this channel. -.TP -\fIdefgw\fP \fIipaddr\fP <\fBx.x.x.x\fR> -Set the default gateway IP address. -.TP -\fIdefgw\fP \fImacaddr\fP <\fBxx:xx:xx:xx:xx:xx\fR> -Set the default gateway MAC address. -.TP -\fIbakgw\fP \fIipaddr\fP <\fBx.x.x.x\fR> -Set the backup gateway IP address. -.TP -\fIbakgw\fP \fImacaddr\fP <\fBxx:xx:xx:xx:xx:xx\fR> -Set the backup gateway MAC address. -.TP -\fIpassword\fP <\fBpass\fR> -Set the null user password. -.TP -\fIauth\fP <\fBlevel,...\fR> <\fBtype,...\fR> -Set the valid authtypes for a given auth level. -.RS -Levels: -.B callback -.B user -.B operator -.B admin -.br -Types: -.B none -.B md2 -.B key -.RE -.RE -.RE -.TP -.I fru -.RS -.TP -.I print -This command will read all Field Replacable Unit inventory data and extract such information as serial number, part number, asset tags, and short strings describing the chassis, board, or product. -.RE -.TP -.I sdr -.RS -.TP -.I list -This command will read the SDR and extract sensor information, then query each sensor and print its name, reading, and status. -.RE -.TP -.I sel -.RS -.TP -.I info -This command will query the BMC for information about the SEL and its contents. -.TP -.I list -This command will list the contents of the SEL. -.RE -.SH "DEV INTERFACE" -.LP -The ipmitool \fIdev\fP interface utilizes the MontaVista OpenIPMI kernel device driver. This driver is present in 2.5.57 and later development kernels and in 2.4.21pre1 and later stable kernels. There are also IPMI driver kernel patches for different versions available from the OpenIPMI homepage. -.LP -The following kernel modules must be loaded in order for ipmitool to work: -.TP -.B ipmi_msghandler -Incoming and outgoing message handler for IPMI interfaces. -.TP -.B ipmi_kcs_drv -An IPMI Keyboard Controler Style (KCS) interface driver for the message handler. -.TP -.B ipmi_devintf -Linux character device interface for the message handler. -.LP -Once they are loaded there will be a dynamic char device entry that must exist at \fB/dev/ipmi/0\fR. Usually if this is the first dynamic device it will be major number \fB254\fR and minor number \fB0\fR so you would create the dev entry with: -.LP -.I mknod /dev/ipmi/0 c 254 0 -.LP -In order to force ipmitool to make use of the device interface you can specifiy it on the command line: -.PP -ipmitool \-I dev [option...] -.LP -Alternatively if you do not provide a hostname on the command line ipmitool will assume you want to use the dev interface. -.SH "LAN INTERFACE" -.LP -The ipmitool \fIlan\fP interface communicates with the BMC over an Ethernet LAN connection using UDP under IPv4. UDP datagrams are formatted to contain IPMI request/response messages with a IPMI session headers and RMCP headers. -.LP -IPMI\-over\-LAN uses version 1 of the Remote Management Control Protocol (RMCP) to support \fIpre\-OS\fP and \fIOS\-absent\fP management. RMCP is a request\-response protocol delivered using UDP datagrams to port 623. -.LP -The LAN interface is an authenticatiod multi\-session connection; messages delivered to the BMC can (and should) be authenticated with a challenge/response protocol with either straight password/key. ipmitool will attempt to connect with administrator privilege level as this is required to perform chassis power functions. -.LP -You can tell ipmitool to use the lan interface with the \fB\-I\fR option: -.PP -ipmitool \-I lan [option...]
[password] -.LP -A hostname \fBmust\fR be given on the command line in order to use the lan interface with ipmitool. The password field is optional; if you do not provide a password on the command line ipmitool will attempt to connect without authentication. If you specify a password it will use straight password/key. -.SH "FILES" -.TP -.I /dev/ipmi/0 -This character device file is used by the OpenIPMI kernel driver. -.SH "EXAMPLES" -.LP -If you want to remotely control the power of an IPMI\-over\-LAN enabled system you can use: -.LP -ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power on -.LP -Chassis Power is off. -.br -Chassis Power Control: on -.LP -ipmitool \-I lan \-H 192.168.1.1 \-P password chassis power status -.LP -Chassis Power is on. -.SH "AUTHOR" -.LP -Duncan Laurie -.SH "SEE ALSO" -.LP -.TP -Intelligent Platform Management Interface Specification -http://www.intel.com/design/servers/ipmi/spec.htm -.TP -OpenIPMI project (MontaVista IPMI kernel driver) -http://openipmi.sourceforge.net/ diff --git a/ipmitool/include/asf.h b/ipmitool/include/asf.h deleted file mode 100644 index 2f5dfaf..0000000 --- a/ipmitool/include/asf.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef __ASF_H -#define __ASF_H - -#include -#include - -#define ASF_RMCP_IANA 0x000011be - -#define ASF_TYPE_PING 0x80 -#define ASF_TYPE_PONG 0x40 - -static const struct valstr asf_type_vals[] __attribute__((unused)) = { - { 0x10, "Reset" }, - { 0x11, "Power-up" }, - { 0x12, "Unconditional Power-down" }, - { 0x13, "Power Cycle" }, - { 0x40, "Presence Pong" }, - { 0x41, "Capabilities Response" }, - { 0x42, "System State Response" }, - { 0x80, "Presence Ping" }, - { 0x81, "Capabilities Request" }, - { 0x82, "System State Request" }, - { 0x00, NULL } -}; - -/* ASF message header */ -struct asf_hdr { - unsigned long iana; - unsigned char type; - unsigned char tag; - unsigned char __reserved; - unsigned char len; -} __attribute__((packed)); - -int handle_asf(struct ipmi_intf * intf, unsigned char * data, int data_len); - -#endif /* __ASF_H */ diff --git a/ipmitool/include/helper.h b/ipmitool/include/helper.h deleted file mode 100644 index f1bf5d4..0000000 --- a/ipmitool/include/helper.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef __HELPER_H -#define __HELPER_H - -struct valstr { - unsigned char val; - const char * str; -}; -const char * val2str(unsigned char val, const struct valstr * vs); - -unsigned short buf2short(unsigned char * buf); -unsigned long buf2long(unsigned char * buf); -const char * buf2str(unsigned char * buf, int len); -void printbuf(unsigned char * buf, int len, char * desc); - -void signal_handler(int sig, void * handler); - -#define SIG_IGNORE(s) ((void)signal((s), SIG_IGN)) -#define SIG_DEFAULT(s) ((void)signal((s), SIG_DFL)) -#define SIG_HANDLE(s,h) ((void)signal_handler((s), (h))) - -#endif /* __HELPER_H */ - diff --git a/ipmitool/include/ipmi.h b/ipmitool/include/ipmi.h deleted file mode 100644 index 060030c..0000000 --- a/ipmitool/include/ipmi.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef _IPMI_H -#define _IPMI_H - -#include -#include -#include -#include - -#define BUF_SIZE 256 - -extern int verbose; -extern int csv_output; - -struct ipmi_session { - unsigned char username[16]; - unsigned char challenge[16]; - unsigned char password; - unsigned char authtype; - unsigned char authcode[16]; - unsigned char privlvl; - unsigned long in_seq; - unsigned long out_seq; - unsigned long id; - int active; -}; - -struct ipmi_req_entry { - struct ipmi_req req; - struct ipmi_intf * intf; - struct ipmi_session * session; - unsigned char rq_seq; - unsigned char * msg_data; - int msg_len; - struct ipmi_req_entry * next; -}; - -struct ipmi_rsp { - unsigned char ccode; - unsigned char data[BUF_SIZE]; - int data_len; - struct { - unsigned char authtype; - unsigned long seq; - unsigned long id; - } session; - unsigned char msglen; - struct { - unsigned char rq_addr; - unsigned char netfn; - unsigned char rq_lun; - unsigned char rs_addr; - unsigned char rq_seq; - unsigned char rs_lun; - unsigned char cmd; - } header; -}; - -struct ipmi_intf { - int fd; - struct sockaddr_in addr; - int (*open)(struct ipmi_intf *, char *, int, char *); - void (*close)(struct ipmi_intf *); - struct ipmi_rsp *(*sendrecv)(struct ipmi_intf *, struct ipmi_req *); - int (*ll_send)(struct ipmi_intf *, unsigned char *, int); - struct ipmi_rsp *(*ll_recv)(struct ipmi_intf *, int); -}; - -#define IPMI_NETFN_CHASSIS 0x0 -#define IPMI_NETFN_BRIDGE 0x2 -#define IPMI_NETFN_SE 0x4 -#define IPMI_NETFN_APP 0x6 -#define IPMI_NETFN_FIRMWARE 0x8 -#define IPMI_NETFN_STORAGE 0xa -#define IPMI_NETFN_TRANSPORT 0xc - -#define IPMI_BMC_SLAVE_ADDR 0x20 -#define IPMI_REMOTE_SWID 0x81 - -int handle_ipmi(struct ipmi_intf *intf, unsigned char * data, int data_len); - -#endif /* _IPMI_H */ diff --git a/ipmitool/include/ipmi_chassis.h b/ipmitool/include/ipmi_chassis.h deleted file mode 100644 index 712408e..0000000 --- a/ipmitool/include/ipmi_chassis.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef _IPMI_CHASSIS_H -#define _IPMI_CHASSIS_H - -#include - -#define IPMI_CHASSIS_CTL_POWER_DOWN 0x0 -#define IPMI_CHASSIS_CTL_POWER_UP 0x1 -#define IPMI_CHASSIS_CTL_POWER_CYCLE 0x2 -#define IPMI_CHASSIS_CTL_HARD_RESET 0x3 -#define IPMI_CHASSIS_CTL_PULSE_DIAG 0x4 -#define IPMI_CHASSIS_CTL_ACPI_SOFT 0x5 - -#define IPMI_CHASSIS_POLICY_NO_CHANGE 0x3 -#define IPMI_CHASSIS_POLICY_ALWAYS_ON 0x2 -#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1 -#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0 - -int ipmi_chassis_main(struct ipmi_intf *, int, char **); - -#endif /*_IPMI_CHASSIS_H*/ diff --git a/ipmitool/include/ipmi_dev.h b/ipmitool/include/ipmi_dev.h deleted file mode 100644 index f2f58b2..0000000 --- a/ipmitool/include/ipmi_dev.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef _IPMI_DEV_H -#define _IPMI_DEV_H - -#include -#include "ipmi.h" - -struct ipmi_rsp * ipmi_dev_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req); -int ipmi_dev_open(struct ipmi_intf * intf, char * dev, int __unused1, char * __unused2); -void ipmi_dev_close(struct ipmi_intf * intf); - -struct ipmi_intf ipmi_dev_intf; - -#endif diff --git a/ipmitool/include/ipmi_entity.h b/ipmitool/include/ipmi_entity.h deleted file mode 100644 index dfc9a6a..0000000 --- a/ipmitool/include/ipmi_entity.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef _IPMI_ENTITY -#define _IPMI_ENTITY - -#include - -const struct valstr entity_id_vals[] __attribute__((unused)) = { - { 0x00, "Unspecified" }, - { 0x01, "Other" }, - { 0x02, "Unknown" }, - { 0x03, "Processor" }, - { 0x04, "Disk or Disk Bay" }, - { 0x05, "Peripheral Bay" }, - { 0x06, "System Management Module" }, - { 0x07, "System Board" }, - { 0x08, "Memory Module" }, - { 0x09, "Processor Module" }, - { 0x0a, "Power Supply" }, - { 0x0b, "Add-in Card" }, - { 0x0c, "Front Panel Board" }, - { 0x0d, "Back Panel Board" }, - { 0x0e, "Power System Board" }, - { 0x0f, "Drive Backplane" }, - { 0x10, "System Internal Expansion Board" }, - { 0x11, "Other System Board" }, - { 0x12, "Processor Board" }, - { 0x13, "Power Unit" }, - { 0x14, "Power Module" }, - { 0x15, "Power Management" }, - { 0x16, "Chassis Back Panel Board" }, - { 0x17, "System Chassis" }, - { 0x18, "Sub-Chassis" }, - { 0x19, "Other Chassis Board" }, - { 0x1a, "Disk Drive Bay" }, - { 0x1b, "Peripheral Bay" }, - { 0x1c, "Device Bay" }, - { 0x1d, "Fan Device" }, - { 0x1e, "Cooling Unit" }, - { 0x1f, "Cable/Interconnect" }, - { 0x20, "Memory Device" }, - { 0x21, "System Management Software" }, - { 0x22, "BIOS" }, - { 0x23, "Operating System" }, - { 0x24, "System Bus" }, - { 0x25, "Group" }, - { 0x26, "Remote Management Device" }, - { 0x27, "External Environment" }, - { 0x28, "Battery" }, - { 0x00, NULL }, -}; - -#endif /* _IPMI_ENTITY */ - diff --git a/ipmitool/include/ipmi_fru.h b/ipmitool/include/ipmi_fru.h deleted file mode 100644 index 8b24b37..0000000 --- a/ipmitool/include/ipmi_fru.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef _IPMI_FRU_H -#define _IPMI_FRU_H - -#define GET_FRU_INFO 0x10 -#define GET_FRU_DATA 0x11 -#define SET_FRU_DATA 0x12 - -enum { - FRU_CHASSIS_PARTNO, - FRU_CHASSIS_SERIAL, - FRU_BOARD_MANUF, - FRU_BOARD_PRODUCT, - FRU_BOARD_SERIAL, - FRU_BOARD_PARTNO, - FRU_PRODUCT_MANUF, - FRU_PRODUCT_NAME, - FRU_PRODUCT_PARTNO, - FRU_PRODUCT_VERSION, - FRU_PRODUCT_SERIAL, - FRU_PRODUCT_ASSET, -}; - -struct fru_info { - unsigned short size; - unsigned char access : 1; -} __attribute__ ((packed)); - -struct fru_header { - unsigned char version; - struct { - unsigned char internal; - unsigned char chassis; - unsigned char board; - unsigned char product; - unsigned char multi; - } offset; - unsigned char pad; - unsigned char checksum; -} __attribute__ ((packed)); - -struct fru_area_chassis { - unsigned char area_ver; - unsigned char area_len; - unsigned char type; - char * part; - char * serial; -}; - -struct fru_area_board { - unsigned char area_ver; - unsigned char area_len; - unsigned char lang; - unsigned long mfg_date_time; - char * mfg; - char * prod; - char * serial; - char * part; -}; - -struct fru_area_product { - unsigned char area_ver; - unsigned char area_len; - unsigned char lang; - char * mfg; - char * name; - char * part; - char * version; - char * serial; - char * asset; -}; - -static const char * chassis_type_desc[] __attribute__((unused)) = { - "Unspecified", "Other", "Unknown", - "Desktop", "Low Profile Desktop", "Pizza Box", - "Mini Tower", "Tower", - "Portable", "LapTop", "Notebook", "Hand Held", "Docking Station", - "All in One", "Sub Notebook", "Space-saving", "Lunch Box", - "Main Server Chassis", "Expansion Chassis", "SubChassis", - "Bus Expansion Chassis", "Peripheral Chassis", "RAID Chassis", - "Rack Mount Chassis" -}; - -void ipmi_print_fru(struct ipmi_intf *, unsigned char); -int ipmi_fru_main(struct ipmi_intf *, int, char **); - -#endif /* _IPMI_FRU_H */ diff --git a/ipmitool/include/ipmi_lan.h b/ipmitool/include/ipmi_lan.h deleted file mode 100644 index 301812d..0000000 --- a/ipmitool/include/ipmi_lan.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef _IPMI_LAN_H -#define _IPMI_LAN_H - -#include -#include "ipmi.h" - -#define IPMI_LAN_SET_CONFIG 0x01 -#define IPMI_LAN_GET_CONFIG 0x02 -#define IPMI_LAN_SUSPEND_ARP 0x03 -# define IPMI_LAN_SUSPEND_ARP_RESP (2) -# define IPMI_LAN_SUSPEND_ARP_GRAT (1) -#define IPMI_LAN_GET_STAT 0x04 - -#define IPMI_LAN_CHANNEL_1 0x07 -#define IPMI_LAN_CHANNEL_2 0x06 -#define IPMI_LAN_CHANNEL_E 0x0e - -enum { - IPMI_LANP_SET_IN_PROGRESS, - IPMI_LANP_AUTH_TYPE, - IPMI_LANP_AUTH_TYPE_ENABLE, - IPMI_LANP_IP_ADDR, - IPMI_LANP_IP_ADDR_SRC, - IPMI_LANP_MAC_ADDR, - IPMI_LANP_SUBNET_MASK, - IPMI_LANP_IP_HEADER, - IPMI_LANP_PRI_RMCP_PORT, - IPMI_LANP_SEC_RMCP_PORT, - IPMI_LANP_BMC_ARP, - IPMI_LANP_GRAT_ARP, - IPMI_LANP_DEF_GATEWAY_IP, - IPMI_LANP_DEF_GATEWAY_MAC, - IPMI_LANP_BAK_GATEWAY_IP, - IPMI_LANP_BAK_GATEWAY_MAC, - IPMI_LANP_SNMP_STRING, - IPMI_LANP_NUM_DEST, - IPMI_LANP_DEST_TYPE, - IPMI_LANP_DEST_ADDR, - IPMI_LANP_OEM_ALERT_STRING=96, - IPMI_LANP_ALERT_RETRY=97, - IPMI_LANP_UTC_OFFSET=98, - IPMI_LANP_DHCP_SERVER_IP=192, - IPMI_LANP_DHCP_SERVER_MAC=193, - IPMI_LANP_DHCP_ENABLE=194, - IPMI_LANP_CHAN_ACCESS_MODE=201, -}; - -static struct lan_param { - int cmd; - int size; - char desc[24]; - unsigned char * data; -} ipmi_lan_params[] __attribute__((unused)) = { - { IPMI_LANP_SET_IN_PROGRESS, 1, "Set in Progress" }, - { IPMI_LANP_AUTH_TYPE, 1, "Auth Type" }, - { IPMI_LANP_AUTH_TYPE_ENABLE, 5, "Auth Type Enable" }, - { IPMI_LANP_IP_ADDR, 4, "IP Address" }, - { IPMI_LANP_IP_ADDR_SRC, 1, "IP Address Source" }, - { IPMI_LANP_MAC_ADDR, 6, "MAC Address" }, - { IPMI_LANP_SUBNET_MASK, 4, "Subnet Mask" }, - { IPMI_LANP_IP_HEADER, 3, "IP Header" }, - { IPMI_LANP_PRI_RMCP_PORT, 2, "Primary RMCP Port" }, - { IPMI_LANP_SEC_RMCP_PORT, 2, "Secondary RMCP Port" }, - { IPMI_LANP_BMC_ARP, 1, "BMC ARP Control" }, - { IPMI_LANP_GRAT_ARP, 1, "Gratituous ARP Intrvl" }, - { IPMI_LANP_DEF_GATEWAY_IP, 4, "Default Gateway IP" }, - { IPMI_LANP_DEF_GATEWAY_MAC, 6, "Default Gateway MAC" }, - { IPMI_LANP_BAK_GATEWAY_IP, 4, "Backup Gateway IP" }, - { IPMI_LANP_BAK_GATEWAY_MAC, 6, "Backup Gateway MAC" }, - { IPMI_LANP_SNMP_STRING, 18, "Community String" }, - { IPMI_LANP_NUM_DEST, 1, "Number of Destinations"}, - { IPMI_LANP_DEST_TYPE, 4, "Destination Type" }, - { IPMI_LANP_DEST_ADDR, 13, "Destination Addresses" }, - { IPMI_LANP_OEM_ALERT_STRING, 28, "OEM Alert String" }, - { IPMI_LANP_ALERT_RETRY, 1, "Alert Retry Algorithm" }, - { IPMI_LANP_UTC_OFFSET, 3, "UTC Offset" }, - { IPMI_LANP_DHCP_SERVER_IP, 4, "DHCP Server IP" }, - { IPMI_LANP_DHCP_SERVER_MAC, 6, "DHDP Server MAC" }, - { IPMI_LANP_DHCP_ENABLE, 1, "DHCP Enable" }, - { IPMI_LANP_CHAN_ACCESS_MODE, 2, "Channel Access Mode" }, - { -1 } -}; - -#define IPMI_SESSION_AUTHTYPE_NONE 0x0 -#define IPMI_SESSION_AUTHTYPE_MD2 0x1 -#define IPMI_SESSION_AUTHTYPE_KEY 0x4 -#define IPMI_SESSION_AUTHTYPE_OEM 0x5 - -#define IPMI_SESSION_PRIV_CALLBACK 0x1 -#define IPMI_SESSION_PRIV_USER 0x2 -#define IPMI_SESSION_PRIV_OPERATOR 0x3 -#define IPMI_SESSION_PRIV_ADMIN 0x4 -#define IPMI_SESSION_PRIV_OEM 0x5 - -extern struct ipmi_session lan_session; - -unsigned char ipmi_csum(unsigned char * d, int s); - -struct ipmi_rsp * ipmi_lan_send_cmd(struct ipmi_intf * intf, struct ipmi_req * req); -int ipmi_lan_open(struct ipmi_intf * intf, char * hostname, int port, char * password); -void ipmi_lan_close(struct ipmi_intf * intf); -void ipmi_get_channel_info(struct ipmi_intf * intf, unsigned char channel); -int ipmi_lan_main(struct ipmi_intf *, int, char **); - -struct ipmi_intf ipmi_lan_intf; - -#endif /*_IPMI_LAN_H*/ diff --git a/ipmitool/include/ipmi_sdr.h b/ipmitool/include/ipmi_sdr.h deleted file mode 100644 index 062c9d4..0000000 --- a/ipmitool/include/ipmi_sdr.h +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef _IPMI_SDR_H -#define _IPMI_SDR_H - -#include -#include -#include - -int ipmi_sdr_main(struct ipmi_intf *, int, char **); -int utos(unsigned val, unsigned bits); - -#define __TO_TOL(mtol) (bswap_16(mtol) & 0x3f) -#define __TO_M(mtol) (utos((((bswap_16(mtol) & 0xff00) >> 8) | ((bswap_16(mtol) & 0xc0) << 2)), 10)) -#define __TO_B(bacc) (utos((((bswap_32(bacc) & 0xff000000) >> 24) | \ - ((bswap_32(bacc) & 0xc00000) >> 14)), 10)) -#define __TO_ACC(bacc) (((bswap_32(bacc) & 0x3f0000) >> 16) | ((bswap_32(bacc) & 0xf000) >> 6)) -#define __TO_ACC_EXP(bacc) ((bswap_32(bacc) & 0xc00) >> 10) -#define __TO_R_EXP(bacc) (utos(((bswap_32(bacc) & 0xf0) >> 4), 4)) -#define __TO_B_EXP(bacc) (utos((bswap_32(bacc) & 0xf), 4)) - -#define CONVERT_RAW(val, m, b, k1, k2) (float)(((m * val) + (b * pow(10, k1))) * pow(10, k2)) -#define CONVERT_TOL(val, m, k2) (float)(((m * val) / 2) * pow(10, k2)) - -#define CONVERT_SENSOR_RAW(sensor, val) (float)(((__TO_M((sensor)->mtol) * val) + (__TO_B((sensor)->bacc) * pow(10, __TO_B_EXP((sensor)->bacc)))) * pow(10, __TO_R_EXP((sensor)->bacc))) -#define CONVERT_SENSOR_TOL(sensor) (float)((((__TO_M((sensor)->mtol) * __TO_TOL((sensor)->mtol)) / 2) * pow(10, __TO_R_EXP((sensor)->bacc)))) - -#define GET_SDR_REPO_INFO 0x20 -#define GET_SDR_ALLOC_INFO 0x21 - -#define SDR_SENSOR_STAT_LO_NC (1<<0) -#define SDR_SENSOR_STAT_LO_CR (1<<1) -#define SDR_SENSOR_STAT_LO_NR (1<<2) -#define SDR_SENSOR_STAT_HI_NC (1<<3) -#define SDR_SENSOR_STAT_HI_CR (1<<4) -#define SDR_SENSOR_STAT_HI_NR (1<<5) - -struct sdr_repo_info_rs { - unsigned char version; /* SDR version (51h) */ - unsigned short count; /* number of records */ - unsigned short free; /* free space in SDR */ - unsigned long add_stamp; /* last add timestamp */ - unsigned long erase_stamp; /* last del timestamp */ - unsigned char op_support; /* supported operations */ -} __attribute__ ((packed)); - -#define GET_SDR_RESERVE_REPO 0x22 -struct sdr_reserve_repo_rs { - unsigned short reserve_id; /* reservation ID */ -} __attribute__ ((packed)); - -#define GET_SDR 0x23 -struct sdr_get_rq { - unsigned short reserve_id; /* reservation ID */ - unsigned short id; /* record ID */ - unsigned char offset; /* offset into SDR */ -#define GET_SDR_ENTIRE_RECORD 0xff -#define GET_SDR_MAX_LEN 30 - unsigned char length; /* length to read */ -} __attribute__ ((packed)); - -struct sdr_get_rs { - unsigned short next; /* next record id */ - unsigned short id; /* record ID */ - unsigned char version; /* SDR version (51h) */ -#define SDR_RECORD_TYPE_FULL_SENSOR 0x01 -#define SDR_RECORD_TYPE_COMPACT_SENSOR 0x02 - unsigned char type; /* record type */ - unsigned char length; /* remaining record bytes */ -} __attribute__ ((packed)); - -struct sdr_record_compact_sensor { - struct { - unsigned char owner_id; - unsigned char lun : 2, /* sensor owner lun */ - __reserved : 2, - channel : 4; /* channel number */ - unsigned char sensor_num; /* unique sensor number */ - } keys; - - struct { - unsigned char id; /* physical entity id */ - unsigned char instance : 7, /* instance number */ - logical : 1; /* physical/logical */ - } entity; - - struct { - struct { - unsigned char sensor_scan : 1, - event_gen : 1, - type : 1, - hysteresis : 1, - thresholds : 1, - events : 1, - scanning : 1, - __reserved : 1; - } init; - struct { - unsigned char event_msg : 2, - threshold : 2, - hysteresis : 2, - rearm : 1, - ignore : 1; - } capabilities; - unsigned char type; /* sensor type */ - } sensor; - - unsigned char event_type; /* event/reading type code */ - - union { - struct { - unsigned short assert_event; /* assertion event mask */ - unsigned short deassert_event; /* de-assertion event mask */ - unsigned short read; /* discrete reaading mask */ - } discrete; - struct { - unsigned short lower; /* lower threshold reading mask */ - unsigned short upper; /* upper threshold reading mask */ - unsigned char set; /* settable threshold mask */ - unsigned char read; /* readable threshold mask */ - } threshold; - } mask; - - struct { - unsigned char pct : 1, - modifier : 2, - rate : 3, - analog : 2; - struct { - unsigned char base; - unsigned char modifier; - } type; - } unit; - - struct { - unsigned char count : 4, - mod_type : 2, - __reserved : 2; - unsigned char mod_offset : 7, - entity_inst : 1; - } share; - - struct { - struct { - unsigned char positive; - unsigned char negative; - } hysteresis; - } threshold; - - unsigned char __reserved[3]; - unsigned char oem; /* reserved for OEM use */ - unsigned char id_code; /* sensor ID string type/length code */ - unsigned char id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ - -} __attribute__ ((packed)); - -struct sdr_record_full_sensor { - struct { - unsigned char owner_id; - unsigned char lun : 2, /* sensor owner lun */ - __reserved : 2, - channel : 4; /* channel number */ - unsigned char sensor_num; /* unique sensor number */ - } keys; - - struct { - unsigned char id; /* physical entity id */ - unsigned char instance : 7, /* instance number */ - logical : 1; /* physical/logical */ - } entity; - - struct { - struct { - unsigned char sensor_scan : 1, - event_gen : 1, - type : 1, - hysteresis : 1, - thresholds : 1, - events : 1, - scanning : 1, - __reserved : 1; - } init; - struct { - unsigned char event_msg : 2, - threshold : 2, - hysteresis : 2, - rearm : 1, - ignore : 1; - } capabilities; - unsigned char type; - } sensor; - - unsigned char event_type; /* event/reading type code */ - - union { - struct { - unsigned short assert_event; /* assertion event mask */ - unsigned short deassert_event; /* de-assertion event mask */ - unsigned short read; /* discrete reaading mask */ - } discrete; - struct { - unsigned short lower; /* lower threshold reading mask */ - unsigned short upper; /* upper threshold reading mask */ - unsigned char set; /* settable threshold mask */ - unsigned char read; /* readable threshold mask */ - } threshold; - } mask; - - struct { - unsigned char pct : 1, - modifier : 2, - rate : 3, - analog : 2; - struct { - unsigned char base; - unsigned char modifier; - } type; - } unit; - - unsigned char linearization; /* 70h=non linear, 71h-7Fh=non linear, OEM */ - - unsigned short mtol; /* M, tolerance */ - - unsigned long bacc; /* accuracy, B, Bexp, Rexp */ - - struct { - unsigned char nominal_read : 1, /* nominal reading field specified */ - normal_max : 1, /* normal max field specified */ - normal_min : 1, /* normal min field specified */ - __reserved : 5; - } analog_flag; - - unsigned char nominal_read; /* nominal reading, raw value */ - unsigned char normal_max; /* normal maximum, raw value */ - unsigned char normal_min; /* normal minimum, raw value */ - unsigned char sensor_max; /* sensor maximum, raw value */ - unsigned char sensor_min; /* sensor minimum, raw value */ - - struct { - struct { - unsigned char non_recover; - unsigned char critical; - unsigned char non_critical; - } upper; - struct { - unsigned char non_recover; - unsigned char critical; - unsigned char non_critical; - } lower; - struct { - unsigned char positive; - unsigned char negative; - } hysteresis; - } threshold; - unsigned char __reserved[2]; - unsigned char oem; /* reserved for OEM use */ - unsigned char id_code; /* sensor ID string type/length code */ - unsigned char id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ -} __attribute__ ((packed)); - -/* unit description codes (IPMI v1.5 section 37.16) */ -#define UNIT_MAX 0x90 -static const char * unit_desc[] __attribute__((unused)) = { - "unspecified", - "degrees C", "degrees F", "degrees K", - "Volts", "Amps", "Watts", "Joules", - "Coulombs", "VA", "Nits", - "lumen", "lux", "Candela", - "kPa", "PSI", "Newton", - "CFM", "RPM", "Hz", - "microsecond", "millisecond", "second", "minute", "hour", "day", "week", - "mil", "inches", "feet", "cu in", "cu feet", "mm", "cm", "m", "cu cm", "cu m", - "liters", "fluid ounce", - "radians", "steradians", "revolutions", "cycles", "gravities", - "ounce", "pound", "ft-lb", "oz-in", - "gauss", "gilberts", "henry", "millihenry", - "farad", "microfarad", "ohms", "siemens", "mole", "becquerel", - "PPM", "reserved", - "Decibels", "DbA", "DbC", - "gray", "sievert", "color temp deg K", - "bit", "kilobit", "megabit", "gigabit", - "byte", "kilobyte", "megabyte", "gigabyte", - "word", "dword", "qword", "line", - "hit", "miss", "retry", "reset", - "overflow", "underrun", - "collision", "packets", - "messages", "characters", - "error", "correctable error", "uncorrectable error", -}; - -#endif /* _IPMI_SDR_H */ - diff --git a/ipmitool/include/ipmi_sel.h b/ipmitool/include/ipmi_sel.h deleted file mode 100644 index 1fa0a0e..0000000 --- a/ipmitool/include/ipmi_sel.h +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef _IPMI_SEL_H -#define _IPMI_SEL_H - -#include - -enum { - IPMI_EVENT_CLASS_DISCRETE, - IPMI_EVENT_CLASS_DIGITAL, - IPMI_EVENT_CLASS_THRESHOLD, - IPMI_EVENT_CLASS_OEM, -}; - -struct sel_get_rq { - unsigned short reserve_id; - unsigned short record_id; - unsigned char offset; - unsigned char length; -} __attribute__ ((packed)); - -struct sel_event_record { - unsigned short next_id; - unsigned short record_id; - unsigned char record_type; - unsigned long timestamp; - unsigned short gen_id; - unsigned char evm_rev; - unsigned char sensor_type; - unsigned char sensor_num; - unsigned char event_type : 7; - unsigned char event_dir : 1; - unsigned char event_data[3]; -} __attribute__ ((packed)); - -struct sel_oem_record_ts { - unsigned short next_id; - unsigned short record_id; - unsigned char record_type; - unsigned long timestamp; - unsigned char mfg_id[3]; - unsigned char oem_defined[6]; -} __attribute__ ((packed)); - -struct sel_oem_record_nots { - unsigned short next_id; - unsigned short record_id; - unsigned char record_type; - unsigned char oem_defined[13]; -} __attribute__ ((packed)); - - -struct ipmi_event_type { - unsigned char code; - unsigned char offset; - unsigned char class; - const char * desc; -}; - -static struct ipmi_event_type event_types[] __attribute__((unused)) = { - /* Threshold Based States */ - { 0x01, 0x00, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-critical - going low" }, - { 0x01, 0x01, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-critical - going high" }, - { 0x01, 0x02, IPMI_EVENT_CLASS_THRESHOLD, "Lower Critical - going low" }, - { 0x01, 0x03, IPMI_EVENT_CLASS_THRESHOLD, "Lower Critical - going high" }, - { 0x01, 0x04, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-recoverable - going low" }, - { 0x01, 0x05, IPMI_EVENT_CLASS_THRESHOLD, "Lower Non-recoverable - going high" }, - { 0x01, 0x06, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-critical - going low" }, - { 0x01, 0x07, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-critical - going high" }, - { 0x01, 0x08, IPMI_EVENT_CLASS_THRESHOLD, "Upper Critical - going low" }, - { 0x01, 0x09, IPMI_EVENT_CLASS_THRESHOLD, "Upper Critical - going high" }, - { 0x01, 0x0a, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-recoverable - going low" }, - { 0x01, 0x0b, IPMI_EVENT_CLASS_THRESHOLD, "Upper Non-recoverable - going high" }, - /* DMI-based "usage state" States */ - { 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Transition to Idle" }, - { 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Transition to Active" }, - { 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Transition to Busy" }, - /* Digital-Discrete Event States */ - { 0x03, 0x00, IPMI_EVENT_CLASS_DIGITAL, "State Deasserted" }, - { 0x03, 0x01, IPMI_EVENT_CLASS_DIGITAL, "State Asserted" }, - { 0x04, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Predictive Failure Deasserted" }, - { 0x04, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Predictive Failure Asserted" }, - { 0x05, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Limit Not Exceeded" }, - { 0x05, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Limit Exceeded" }, - { 0x06, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Performance Met" }, - { 0x06, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Performance Lags" }, - /* Severity Event States */ - { 0x07, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Transition to OK" }, - { 0x07, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-critial from OK" }, - { 0x07, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Transition to Critical from less severe" }, - { 0x07, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-recoverable from less severe" }, - { 0x07, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-critical from more severe" }, - { 0x07, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Transition to Critical from Non-recoverable" }, - { 0x07, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Transition to Non-recoverable" }, - { 0x07, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Monitor" }, - { 0x07, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Informational" }, - /* Availability Status States */ - { 0x08, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Device Removed/Absent" }, - { 0x08, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Device Inserted/Present" }, - { 0x09, 0x00, IPMI_EVENT_CLASS_DIGITAL, "Device Disabled" }, - { 0x09, 0x01, IPMI_EVENT_CLASS_DIGITAL, "Device Enabled" }, - { 0x0a, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Transition to Running" }, - { 0x0a, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Transition to In Test" }, - { 0x0a, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Transition to Power Off" }, - { 0x0a, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Transition to On Line" }, - { 0x0a, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Transition to Off Line" }, - { 0x0a, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Transition to Off Duty" }, - { 0x0a, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Transition to Degraded" }, - { 0x0a, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Transition to Power Save" }, - { 0x0a, 0x08, IPMI_EVENT_CLASS_DISCRETE, "Install Error" }, - /* Redundancy States */ - { 0x0b, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Fully Redundant" }, - { 0x0b, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Lost" }, - { 0x0b, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Degraded" }, - { 0x0b, 0x03, IPMI_EVENT_CLASS_DISCRETE, "Non-Redundant: Sufficient from Redundant" }, - { 0x0b, 0x04, IPMI_EVENT_CLASS_DISCRETE, "Non-Redundant: Sufficient from Insufficient" }, - { 0x0b, 0x05, IPMI_EVENT_CLASS_DISCRETE, "Non-Redundant: Insufficient Resources" }, - { 0x0b, 0x06, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Degraded from Fully Redundant" }, - { 0x0b, 0x07, IPMI_EVENT_CLASS_DISCRETE, "Redundancy Degraded from Non-Redundant" }, - /* ACPI Device Power States */ - { 0x0c, 0x00, IPMI_EVENT_CLASS_DISCRETE, "D0 Power State" }, - { 0x0c, 0x01, IPMI_EVENT_CLASS_DISCRETE, "D1 Power State" }, - { 0x0c, 0x02, IPMI_EVENT_CLASS_DISCRETE, "D2 Power State" }, - { 0x0c, 0x03, IPMI_EVENT_CLASS_DISCRETE, "D3 Power State" }, - /* END */ - { 0x00, 0x00, 0x00, NULL }, -}; - -struct ipmi_sensor_types { - unsigned char code; - unsigned char offset; - const char * type; - const char * event; -}; - -static struct ipmi_sensor_types sensor_types[] __attribute__((unused)) = { - { 0x00, 0x00, "Reserved", NULL }, - { 0x01, 0x00, "Temperature", NULL }, - { 0x02, 0x00, "Voltage", NULL }, - { 0x03, 0x00, "Current", NULL }, - { 0x04, 0x00, "Fan", NULL }, - - { 0x05, 0x00, "Chassis Intrusion", "General Chassis intrusion" }, - { 0x05, 0x01, "Chassis Intrusion", "Drive Bay intrusion" }, - { 0x05, 0x02, "Chassis Intrusion", "I/O Card area intrusion" }, - { 0x05, 0x03, "Chassis Intrusion", "Processor area intrusion" }, - { 0x05, 0x04, "Chassis Intrusion", "System unplugged from LAN" }, - { 0x05, 0x05, "Chassis Intrusion", "Unauthorized dock/undock" }, - { 0x05, 0x06, "Chassis Intrusion", "FAN area intrusion" }, - - { 0x06, 0x00, "Platform Security", "Front Panel Lockout violation attempted" }, - { 0x06, 0x01, "Platform Security", "Pre-boot password viiolation - user password" }, - { 0x06, 0x02, "Platform Security", "Pre-boot password violation - setup password" }, - { 0x06, 0x03, "Platform Security", "Pre-boot password violation - network boot password" }, - { 0x06, 0x04, "Platform Security", "Other pre-boot password violation" }, - { 0x06, 0x05, "Platform Security", "Out-of-band access password violation" }, - - { 0x07, 0x00, "Processor", "IERR" }, - { 0x07, 0x01, "Processor", "Thermal Trip" }, - { 0x07, 0x02, "Processor", "FRB1/BIST failure" }, - { 0x07, 0x03, "Processor", "FRB2/Hang in POST failure" }, - { 0x07, 0x04, "Processor", "FRB3/Processor startup/init failure" }, - { 0x07, 0x05, "Processor", "Configuration Error" }, - { 0x07, 0x06, "Processor", "SM BIOS Uncorrectable CPU-complex Error" }, - { 0x07, 0x07, "Processor", "Presence detected" }, - { 0x07, 0x08, "Processor", "Disabled" }, - { 0x07, 0x09, "Processor", "Terminator presence detected" }, - - { 0x08, 0x00, "Power Supply", "Presence detected" }, - { 0x08, 0x01, "Power Supply", "Failure detected" }, - { 0x08, 0x02, "Power Supply", "Predictive failure" }, - { 0x08, 0x03, "Power Supply", "Power Supply AC lost" }, - { 0x08, 0x04, "Power Supply", "AC lost or out-of-range" }, - { 0x08, 0x05, "Power Supply", "AC out-of-range, but present" }, - - { 0x09, 0x00, "Power Unit", "Power off/down" }, - { 0x09, 0x01, "Power Unit", "Power cycle" }, - { 0x09, 0x02, "Power Unit", "240VA power down" }, - { 0x09, 0x03, "Power Unit", "Interlock power down" }, - { 0x09, 0x04, "Power Unit", "AC lost" }, - { 0x09, 0x05, "Power Unit", "Soft-power control failure" }, - { 0x09, 0x06, "Power Unit", "Failure detected" }, - { 0x09, 0x07, "Power Unit", "Predictive failure" }, - - { 0x0a, 0x00, "Cooling Device", NULL }, - { 0x0b, 0x00, "Other Units-based Sensor", NULL }, - - { 0x0c, 0x00, "Memory", "Correctable ECC" }, - { 0x0c, 0x01, "Memory", "Uncorrectable ECC" }, - { 0x0c, 0x02, "Memory", "Parity" }, - { 0x0c, 0x03, "Memory", "Memory Scrub Failed" }, - { 0x0c, 0x04, "Memory", "Memory Device Disabled" }, - { 0x0c, 0x05, "Memory", "Correctable ECC logging limit reached" }, - - { 0x0d, 0x00, "Drive Slot", NULL }, - { 0x0e, 0x00, "POST Memory Resize", NULL }, - - { 0x0f, 0x00, "System Firmware", "Error" }, - { 0x0f, 0x01, "System Firmware", "Hang" }, - { 0x0f, 0x02, "System Firmware", "Progress" }, - - { 0x10, 0x00, "Event Logging Disabled", "Correctable memory error logging disabled" }, - { 0x10, 0x01, "Event Logging Disabled", "Event logging disabled" }, - { 0x10, 0x02, "Event Logging Disabled", "Log area reset/cleared" }, - { 0x10, 0x03, "Event Logging Disabled", "All event logging disabled" }, - - { 0x11, 0x00, "Watchdog 1", "BIOS Reset" }, - { 0x11, 0x01, "Watchdog 1", "OS Reset" }, - { 0x11, 0x02, "Watchdog 1", "OS Shut Down" }, - { 0x11, 0x03, "Watchdog 1", "OS Power Down" }, - { 0x11, 0x04, "Watchdog 1", "OS Power Cycle" }, - { 0x11, 0x05, "Watchdog 1", "OS NMI/diag Interrupt" }, - { 0x11, 0x06, "Watchdog 1", "OS Expired" }, - { 0x11, 0x07, "Watchdog 1", "OS pre-timeout Interrupt" }, - - { 0x12, 0x00, "System Event", "System Reconfigured" }, - { 0x12, 0x01, "System Event", "OEM System boot event" }, - { 0x12, 0x02, "System Event", "Undetermined system hardware failure" }, - { 0x12, 0x03, "System Event", "Entry added to auxillary log" }, - { 0x12, 0x04, "System Event", "PEF Action" }, - - { 0x13, 0x00, "Critical Interrupt", "Front Panel NMI" }, - { 0x13, 0x01, "Critical Interrupt", "Bus Timeout" }, - { 0x13, 0x02, "Critical Interrupt", "I/O Channel check NMI" }, - { 0x13, 0x03, "Critical Interrupt", "Software NMI" }, - { 0x13, 0x04, "Critical Interrupt", "PCI PERR" }, - { 0x13, 0x05, "Critical Interrupt", "PCI SERR" }, - { 0x13, 0x06, "Critical Interrupt", "EISA failsafe timeout" }, - { 0x13, 0x07, "Critical Interrupt", "Bus Correctable error" }, - { 0x13, 0x08, "Critical Interrupt", "Bus Uncorrectable error" }, - { 0x13, 0x09, "Critical Interrupt", "Fatal NMI" }, - - { 0x14, 0x00, "Button", "Power Button pressed" }, - { 0x14, 0x01, "Button", "Sleep Button pressed" }, - { 0x14, 0x02, "Button", "Reset Button pressed" }, - - { 0x15, 0x00, "Module/Board", NULL }, - { 0x16, 0x00, "Microcontroller/Coprocessor", NULL }, - { 0x17, 0x00, "Add-in Card", NULL }, - { 0x18, 0x00, "Chassis", NULL }, - { 0x19, 0x00, "Chip Set", NULL }, - { 0x1a, 0x00, "Other FRU", NULL }, - { 0x1b, 0x00, "Cable/Interconnect", NULL }, - { 0x1c, 0x00, "Terminator", NULL }, - - { 0x1d, 0x00, "System Boot Initiated", "Initiated by power up" }, - { 0x1d, 0x01, "System Boot Initiated", "Initiated by hard reset" }, - { 0x1d, 0x02, "System Boot Initiated", "Initiated by warm reset" }, - { 0x1d, 0x03, "System Boot Initiated", "User requested PXE boot" }, - { 0x1d, 0x04, "System Boot Initiated", "Automatic boot to diagnostic" }, - - { 0x1e, 0x00, "Boot Error", "No bootable media" }, - { 0x1e, 0x01, "Boot Error", "Non-bootable disk in drive" }, - { 0x1e, 0x02, "Boot Error", "PXE server not found" }, - { 0x1e, 0x03, "Boot Error", "Invalid boot sector" }, - { 0x1e, 0x04, "Boot Error", "Timeout waiting for selection" }, - - { 0x1f, 0x00, "OS Boot", "A: boot completed" }, - { 0x1f, 0x01, "OS Boot", "C: boot completed" }, - { 0x1f, 0x02, "OS Boot", "PXE boot completed" }, - { 0x1f, 0x03, "OS Boot", "Diagnostic boot completed" }, - { 0x1f, 0x04, "OS Boot", "CD-ROM boot completed" }, - { 0x1f, 0x05, "OS Boot", "ROM boot completed" }, - { 0x1f, 0x06, "OS Boot", "boot completed - device not specified" }, - - { 0x20, 0x00, "OS Critical Stop", "Stop during OS load/init" }, - { 0x20, 0x01, "OS Critical Stop", "Run-time stop" }, - - { 0x21, 0x00, "Slot/Connector", "Fault Status asserted" }, - { 0x21, 0x01, "Slot/Connector", "Identify Status asserted" }, - { 0x21, 0x02, "Slot/Connector", "Slot/Connector Device installed/attached" }, - { 0x21, 0x03, "Slot/Connector", "Slot/Connector ready for device installation" }, - { 0x21, 0x04, "Slot/Connector", "Slot/Connector ready for device removal" }, - { 0x21, 0x05, "Slot/Connector", "Slot Power is off" }, - { 0x21, 0x06, "Slot/Connector", "Slot/Connector device removal request" }, - { 0x21, 0x07, "Slot/Connector", "Interlock asserted" }, - { 0x21, 0x08, "Slot/Connector", "Slot is disabled" }, - - { 0x22, 0x00, "System ACPI Power State", "S0/G0: working" }, - { 0x22, 0x01, "System ACPI Power State", "S1: sleeping with system hw & processor context maintained" }, - { 0x22, 0x02, "System ACPI Power State", "S2: sleeping, processor context lost" }, - { 0x22, 0x03, "System ACPI Power State", "S3: sleeping, processor & hw context lost, memory retained" }, - { 0x22, 0x04, "System ACPI Power State", "S4: non-volatile sleep/suspend-to-disk" }, - { 0x22, 0x05, "System ACPI Power State", "S5/G2: soft-off" }, - { 0x22, 0x06, "System ACPI Power State", "S4/S5: soft-off" }, - { 0x22, 0x07, "System ACPI Power State", "G3: mechanical off" }, - { 0x22, 0x08, "System ACPI Power State", "Sleeping in S1/S2/S3 state" }, - { 0x22, 0x09, "System ACPI Power State", "G1: sleeping" }, - { 0x22, 0x0a, "System ACPI Power State", "S5: entered by override" }, - { 0x22, 0x0b, "System ACPI Power State", "Legacy ON state" }, - { 0x22, 0x0c, "System ACPI Power State", "Legacy OFF state" }, - { 0x22, 0x0e, "System ACPI Power State", "Unknown" }, - - { 0x23, 0x00, "Watchdog 2", "Timer expired" }, - { 0x23, 0x01, "Watchdog 2", "Hard reset" }, - { 0x23, 0x02, "Watchdog 2", "Power down" }, - { 0x23, 0x03, "Watchdog 2", "Power cycle" }, - { 0x23, 0x04, "Watchdog 2", "reserved" }, - { 0x23, 0x05, "Watchdog 2", "reserved" }, - { 0x23, 0x06, "Watchdog 2", "reserved" }, - { 0x23, 0x07, "Watchdog 2", "reserved" }, - { 0x23, 0x08, "Watchdog 2", "Timer interrupt" }, - - { 0x24, 0x00, "Platform Alert", "Platform generated page" }, - { 0x24, 0x01, "Platform Alert", "Platform generated LAN alert" }, - { 0x24, 0x02, "Platform Alert", "Platform Event Trap generated" }, - { 0x24, 0x03, "Platform Alert", "Platform generated SNMP trap, OEM format" }, - - { 0x25, 0x00, "Entity Presence", "Present" }, - { 0x25, 0x01, "Entity Presence", "Absent" }, - { 0x25, 0x02, "Entity Presence", "Disabled" }, - - { 0x26, 0x00, "Monitor ASIC/IC", NULL }, - - { 0x27, 0x00, "LAN", "Heartbeat Lost" }, - { 0x27, 0x01, "LAN", "Heartbeat" }, - - { 0x28, 0x00, "Management Subsystem Health", "Sensor access degraded or unavailable" }, - { 0x28, 0x01, "Management Subsystem Health", "Controller access degraded or unavailable" }, - { 0x28, 0x02, "Management Subsystem Health", "Management controller off-line" }, - { 0x28, 0x03, "Management Subsystem Health", "Management controller unavailable" }, - - { 0x29, 0x00, "Battery", "Low" }, - { 0x29, 0x01, "Battery", "Failed" }, - { 0x29, 0x02, "Battery", "Presence Detected" }, - - { 0x00, 0x00, NULL, NULL }, -}; - -int ipmi_sel_main(struct ipmi_intf *, int, char **); - -#endif /*_IPMI_SEL_H*/ diff --git a/ipmitool/include/rmcp.h b/ipmitool/include/rmcp.h deleted file mode 100644 index a7e1cdf..0000000 --- a/ipmitool/include/rmcp.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#ifndef __RMCP_H -#define __RMCP_H - -#include -#include - -#define RMCP_VERSION_1 0x06 - -#define RMCP_UDP_PORT 0x26f /* port 623 */ -#define RMCP_UDP_SECURE_PORT 0x298 /* port 664 */ - -#define RMCP_TYPE_MASK 0x80 -#define RMCP_TYPE_NORM 0x00 -#define RMCP_TYPE_ACK 0x01 - -static const struct valstr rmcp_type_vals[] __attribute__((unused)) = { - { RMCP_TYPE_NORM, "Normal RMCP" }, - { RMCP_TYPE_ACK, "RMCP ACK" }, - { 0, NULL } -}; - -#define RMCP_CLASS_MASK 0x1f -#define RMCP_CLASS_ASF 0x06 -#define RMCP_CLASS_IPMI 0x07 -#define RMCP_CLASS_OEM 0x08 - -static const struct valstr rmcp_class_vals[] __attribute__((unused)) = { - { RMCP_CLASS_ASF, "ASF" }, - { RMCP_CLASS_IPMI, "IPMI" }, - { RMCP_CLASS_OEM, "OEM" }, - { 0, NULL } -}; - -/* RMCP message header */ -struct rmcp_hdr { - unsigned char ver; - unsigned char __reserved; - unsigned char seq; - unsigned char class; -} __attribute__((packed)); - -int handle_rmcp(struct ipmi_intf * intf, unsigned char * data, int data_len); - -#endif /* __RMCP_H */ diff --git a/ipmitool/ipmi_chassis.c b/ipmitool/ipmi_chassis.c deleted file mode 100644 index ea003d2..0000000 --- a/ipmitool/ipmi_chassis.c +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. - * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. - * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE - * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING - * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL - * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, - * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR - * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF - * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -#include -#include -#include - -#include -#include -#include - -static int ipmi_chassis_power_status(struct ipmi_intf * intf) -{ - struct ipmi_rsp * rsp; - struct ipmi_req req; - - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_CHASSIS; - req.msg.cmd = 0x1; - req.msg.data_len = 0; - - rsp = intf->sendrecv(intf, &req); - if (!rsp || rsp->ccode) { - printf("error in Chassis Status Command\n"); - return 0; - } - - printf("Chassis Power is %s\n", (rsp->data[0] & 0x1) ? "on" : "off"); - - return rsp->data[0] & 0x1; -} - -static const struct valstr ipmi_chassis_power_control_vals[] = { - { 0x00, "Down/Off" }, - { 0x01, "Up/On" }, - { 0x02, "Cycle" }, - { 0x03, "Reset" }, - { 0x04, "Pulse" }, - { 0x05, "Soft" }, - { 0x00, NULL }, -}; - -static void ipmi_chassis_power_control(struct ipmi_intf * intf, unsigned char ctl) -{ - struct ipmi_req req; - - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_CHASSIS; - req.msg.cmd = 0x2; - req.msg.data = &ctl; - req.msg.data_len = 1; - - printf("Chassis Power Control: %s\n", val2str(ctl, ipmi_chassis_power_control_vals)); - - intf->sendrecv(intf, &req); -} - -static void ipmi_chassis_identify(struct ipmi_intf * intf, char * arg) -{ - struct ipmi_req req; - - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_CHASSIS; - req.msg.cmd = 0x4; - - printf("Chassis identify interval: "); - - if (arg) { - unsigned char interval = (unsigned char)atoi(arg); - - req.msg.data = &interval; - req.msg.data_len = 1; - - if (interval) - printf("%d seconds\n", interval); - else - printf("off\n"); - } else { - printf("default (15 seconds)\n"); - } - - intf->sendrecv(intf, &req); -} - -static void ipmi_chassis_poh(struct ipmi_intf * intf) -{ - struct ipmi_rsp * rsp; - struct ipmi_req req; - unsigned long count; - - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_CHASSIS; - req.msg.cmd = 0xf; - - rsp = intf->sendrecv(intf, &req); - - if (!rsp || rsp->ccode) - return; - - memcpy(&count, rsp->data+1, 4); - - printf("POH Counter : %li hours total (%li days, %li hours)\n", - count, (unsigned long)(count / 24), (unsigned long)(count % 24)); -} - -static void ipmi_chassis_restart_cause(struct ipmi_intf * intf) -{ - struct ipmi_rsp * rsp; - struct ipmi_req req; - - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_CHASSIS; - req.msg.cmd = 0x7; - - rsp = intf->sendrecv(intf, &req); - - if (!rsp || rsp->ccode) - return; - - printf("System restart cause: "); - - switch (rsp->data[0] & 0xf) { - case 0: - printf("unknown\n"); - break; - case 1: - printf("chassis power control command\n"); - break; - case 2: - printf("reset via pushbutton\n"); - break; - case 3: - printf("power-up via pushbutton\n"); - break; - case 4: - printf("watchdog expired\n"); - break; - case 5: - printf("OEM\n"); - break; - case 6: - printf("power-up due to always-restore power policy\n"); - break; - case 7: - printf("power-up due to restore-previous power policy\n"); - break; - case 8: - printf("reset via PEF\n"); - break; - case 9: - printf("power-cycle via PEF\n"); - break; - default: - printf("error!\n"); - } -} - -static void ipmi_chassis_status(struct ipmi_intf * intf) -{ - struct ipmi_rsp * rsp; - struct ipmi_req req; - - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_CHASSIS; - req.msg.cmd = 0x1; - - rsp = intf->sendrecv(intf, &req); - if (!rsp || rsp->ccode) - return; - - /* byte 1 */ - printf("System Power : %s\n", (rsp->data[0] & 0x1) ? "on" : "off"); - printf("Power Overload : %s\n", (rsp->data[0] & 0x2) ? "true" : "false"); - printf("Power Interlock : %s\n", (rsp->data[0] & 0x4) ? "active" : "inactive"); - printf("Main Power Fault : %s\n", (rsp->data[0] & 0x8) ? "true" : "false"); - printf("Power Control Fault : %s\n", (rsp->data[0] & 0x10) ? "true" : "false"); - printf("Power Restore Policy : "); - switch ((rsp->data[0] & 0x60) >> 5) { - case 0x0: - printf("always-off\n"); - break; - case 0x1: - printf("previous\n"); - break; - case 0x2: - printf("always-on\n"); - break; - case 0x3: - default: - printf("unknown\n"); - } - - /* byte 2 */ - printf("Last Power Event : "); - if (rsp->data[1] & 0x1) - printf("ac-failed "); - if (rsp->data[1] & 0x2) - printf("overload "); - if (rsp->data[1] & 0x4) - printf("interlock "); - if (rsp->data[1] & 0x8) - printf("fault "); - if (rsp->data[1] & 0x10) - printf("command"); - printf("\n"); - - /* byte 3 */ - printf("Chassis Intrusion : %s\n", (rsp->data[2] & 0x1) ? "active" : "inactive"); - printf("Front-Panel Lockout : %s\n", (rsp->data[2] & 0x2) ? "active" : "inactive"); - printf("Drive Fault : %s\n", (rsp->data[2] & 0x4) ? "true" : "false"); - printf("Cooling/Fan Fault : %s\n", (rsp->data[2] & 0x8) ? "true" : "false"); -} - -static void ipmi_chassis_set_bootparam(struct ipmi_intf * intf, unsigned char param, unsigned char * data, int len) -{ - struct ipmi_rsp * rsp; - struct ipmi_req req; - unsigned char msg_data[16]; - - memset(msg_data, 0, 16); - msg_data[0] = param & 0x7f; - memcpy(msg_data+1, data, len); - - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_CHASSIS; - req.msg.cmd = 0x8; - req.msg.data = msg_data; - req.msg.data_len = len + 1; - - rsp = intf->sendrecv(intf, &req); - if (!rsp || rsp->ccode) { - printf("Error setting Chassis Boot Parameter %d\n", param); - return; - } - - printf("Chassis Set Boot Param %d to %s\n", param, data); -} - -static void ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg) -{ - struct ipmi_rsp * rsp; - struct ipmi_req req; - unsigned char msg_data[3]; - - if (!arg) - return; - - memset(msg_data, 0, 3); - - msg_data[0] = (unsigned char)atoi(arg) & 0x7f; - msg_data[1] = 0; - msg_data[2] = 0; - - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_CHASSIS; - req.msg.cmd = 0x9; - req.msg.data = msg_data; - req.msg.data_len = 3; - - rsp = intf->sendrecv(intf, &req); - if (!rsp || rsp->ccode) - return; - - if (verbose > 2) - printbuf(rsp->data, rsp->data_len, "Boot Option"); - - printf("Boot parameter version: %d\n", rsp->data[0]); - printf("Boot parameter %d is %s\n", rsp->data[1] & 0x7f, - (rsp->data[1] & 0x80) ? "invalid/locked" : "valid/unlocked"); - printf("Boot parameter data: %s\n", buf2str(rsp->data+2, rsp->data_len - 2)); -} - -static void ipmi_chassis_set_bootflag(struct ipmi_intf * intf, char * arg) -{ - unsigned char flags[5]; - - if (!arg) { - printf("Error: no bootflag argument supplied\n"); - return; - } - - if (!strncmp(arg, "force_pxe", 9)) { - flags[1] = 0x04; // 00000100 - } - else if (!strncmp(arg, "force_disk", 10)) { - flags[1] = 0x08; // 00001000 - } - else if (!strncmp(arg, "force_diag", 10)) { - flags[1] = 0x10; // 00010000 - } - else if (!strncmp(arg, "force_cdrom", 11)) { - flags[1] = 0x14; // 00010100 - } - else if (!strncmp(arg, "force_floppy", 12)) { - flags[1] = 0x3c; // 00111100 - } - else { - printf("Invalid bootflag: %s\n", arg); - return; - } - - flags[0] = 0x80; /* set flag valid bit */ - ipmi_chassis_set_bootparam(intf, 5, flags, 5); - - flags[0] = 0x08; /* don't automatically clear boot flag valid bit in 60 seconds */ - ipmi_chassis_set_bootparam(intf, 3, flags, 1); -} - -static void ipmi_chassis_power_policy(struct ipmi_intf * intf, unsigned char policy) -{ - struct ipmi_rsp * rsp; - struct ipmi_req req; - - if (!policy) - return; - - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_CHASSIS; - req.msg.cmd = 0x6; - req.msg.data = &policy; - req.msg.data_len = 1; - - rsp = intf->sendrecv(intf, &req); - if (!rsp || rsp->ccode) - return; - - if (policy == IPMI_CHASSIS_POLICY_NO_CHANGE) { - printf("Supported chassis power policy: "); - if (rsp->data[0] & (1<data[0] & (1<data[0] & (1<\n"); - printf(" default is 15 seconds\n"); - printf(" 0 to turn off\n"); - } else { - ipmi_chassis_identify(intf, argv[1]); - } - } - else if (!strncmp(argv[0], "poh", 3)) { - ipmi_chassis_poh(intf); - } - else if (!strncmp(argv[0], "restart_cause", 13)) { - ipmi_chassis_restart_cause(intf); - } - else if (!strncmp(argv[0], "policy", 4)) { - if (argc < 2 || !strncmp(argv[1], "help", 4)) { - printf("chassis policy \n"); - printf(" list : return supported policies\n"); - printf(" always-on : turn on when power is restored\n"); - printf(" previous : return to previous state when power is restored\n"); - printf(" always-off : stay off after power is restored\n"); - } else { - unsigned char ctl; - - if (!strncmp(argv[1], "list", 4)) - ctl = IPMI_CHASSIS_POLICY_NO_CHANGE; - else if (!strncmp(argv[1], "always-on", 9)) - ctl = IPMI_CHASSIS_POLICY_ALWAYS_ON; - else if (!strncmp(argv[1], "previous", 8)) - ctl = IPMI_CHASSIS_POLICY_PREVIOUS; - else if (!strncmp(argv[1], "always-off", 10)) - ctl = IPMI_CHASSIS_POLICY_ALWAYS_OFF; - else { - printf("invalid chassis policy: %s\n", argv[1]); - return -1; - } - - ipmi_chassis_power_policy(intf, ctl); - } - } - else if (!strncmp(argv[0], "bootparam", 7)) { - if (argc < 3 || !strncmp(argv[1], "help", 4)) { - printf("bootparam get|set