diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-06 18:04:32 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-06 18:04:32 +0200 |
commit | a7f89980e5b3f4b9a74c70dbc5ffe8aabd28be28 (patch) | |
tree | 41c4deec1fdfbafd7821b4ca7a9772ac0abd92f5 /lib/lanplus/inc/ipmitool |
Imported Upstream version 2.9.3upstream/2.9.3
Diffstat (limited to 'lib/lanplus/inc/ipmitool')
33 files changed, 5211 insertions, 0 deletions
diff --git a/lib/lanplus/inc/ipmitool/bswap.h b/lib/lanplus/inc/ipmitool/bswap.h new file mode 100644 index 0000000..9948208 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/bswap.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_BSWAP_H +#define IPMI_BSWAP_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#undef BSWAP_16 +#undef BSWAP_32 + +#if HAVE_BYTESWAP_H +# include <byteswap.h> +# define BSWAP_16(x) bswap_16(x) +# define BSWAP_32(x) bswap_32(x) +#else +# define BSWAP_16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8)) +# define BSWAP_32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) |\ + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) +#endif + +#endif /* IPMI_BSWAP_H */ diff --git a/lib/lanplus/inc/ipmitool/helper.h b/lib/lanplus/inc/ipmitool/helper.h new file mode 100644 index 0000000..7f8a06e --- /dev/null +++ b/lib/lanplus/inc/ipmitool/helper.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_HELPER_H +#define IPMI_HELPER_H + +#ifdef WIN32 +#include <inttypes-win.h> +#include <stdio.h> +#include <string.h> +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#define strncasecmp strnicmp +#define strcasecmp _stricmp +// #define strcasecmp stricmp +// extern int stricmp(const char *__s1, const char *__s2); +#else +#include <sys/types.h> +#include <inttypes.h> +#include <stdio.h> +#include <string.h> +#endif + + +struct ipmi_intf; + +struct valstr { + uint16_t val; + const char * str; +}; +struct oemvalstr { + uint16_t oem; + uint16_t val; + const char * str; +}; + +const char * val2str(uint16_t val, const struct valstr * vs); +const char * oemval2str(uint16_t oem,uint16_t val, const struct oemvalstr * vs); +uint16_t str2val(const char * str, const struct valstr * vs); +void print_valstr(const struct valstr * vs, const char * title, int loglevel); +void print_valstr_2col(const struct valstr * vs, const char * title, int loglevel); + + +uint16_t buf2short(uint8_t * buf); +uint32_t buf2long(uint8_t * buf); +const char * buf2str(uint8_t * buf, int len); +void printbuf(const uint8_t * buf, int len, const char * desc); +uint8_t ipmi_csum(uint8_t * d, int s); +FILE * ipmi_open_file(const char * file, int rw); +void ipmi_start_daemon(struct ipmi_intf *intf); + +#define ipmi_open_file_read(file) ipmi_open_file(file, 0) +#define ipmi_open_file_write(file) ipmi_open_file(file, 1) + +#ifndef WIN32 +#ifndef __min +# define __min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef __max +# define __max(a, b) ((a) > (b) ? (a) : (b)) +#endif +#endif + +#ifndef __minlen +# define __minlen(a, b) ({ int x=strlen(a); int y=strlen(b); (x < y) ? x : y;}) +#endif + +#ifndef __maxlen +# define __maxlen(a, b) ({ int x=strlen(a); int y=strlen(b); (x > y) ? x : y;}) +#endif + +#endif /* IPMI_HELPER_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi.h b/lib/lanplus/inc/ipmitool/ipmi.h new file mode 100644 index 0000000..39f3514 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi.h @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_H +#define IPMI_H + +#ifdef WIN32 +#include <stdio.h> +#include <inttypes-win.h> +#include <ipmitool/helper.h> +#include <ipmitool/ipmi_cc.h> +#else +#include <stdlib.h> +#include <stdio.h> +#include <inttypes.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <ipmitool/helper.h> +#include <ipmitool/ipmi_cc.h> +#endif + +#include <openssl/evp.h> + +#define IPMI_BUF_SIZE 1024 + +/* From table 13.16 of the IPMI v2 specification */ +#define IPMI_PAYLOAD_TYPE_IPMI 0x00 +#define IPMI_PAYLOAD_TYPE_SOL 0x01 +#define IPMI_PAYLOAD_TYPE_OEM 0x02 +#define IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST 0x10 +#define IPMI_PAYLOAD_TYPE_RMCP_OPEN_RESPONSE 0x11 +#define IPMI_PAYLOAD_TYPE_RAKP_1 0x12 +#define IPMI_PAYLOAD_TYPE_RAKP_2 0x13 +#define IPMI_PAYLOAD_TYPE_RAKP_3 0x14 +#define IPMI_PAYLOAD_TYPE_RAKP_4 0x15 + +extern int verbose; +extern int csv_output; + +#ifndef _IPMI_RQ_ +#define _IPMI_RQ_ +struct ipmi_rq { + struct { + uint8_t netfn:6; + uint8_t lun:2; + uint8_t cmd; + uint8_t target_cmd; + uint16_t data_len; + uint8_t *data; + } msg; +}; +#endif + +/* + * This is what the sendrcv_v2() function would take as an argument. The common case + * is for payload_type to be IPMI_PAYLOAD_TYPE_IPMI. + */ +struct ipmi_v2_payload { + uint16_t payload_length; + uint8_t payload_type; + + union { + + struct { + uint8_t rq_seq; + struct ipmi_rq *request; + } ipmi_request; + + struct { + uint8_t rs_seq; + struct ipmi_rs *response; + } ipmi_response; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *request; + } open_session_request; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *message; + } rakp_1_message; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *message; + } rakp_2_message; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *message; + } rakp_3_message; + + /* Only used internally by the lanplus interface */ + struct { + uint8_t *message; + } rakp_4_message; + + struct { + uint8_t data[IPMI_BUF_SIZE]; + uint16_t character_count; + uint8_t packet_sequence_number; + uint8_t acked_packet_number; + uint8_t accepted_character_count; + uint8_t is_nack; /* bool */ + uint8_t assert_ring_wor; /* bool */ + uint8_t generate_break; /* bool */ + uint8_t deassert_cts; /* bool */ + uint8_t deassert_dcd_dsr; /* bool */ + uint8_t flush_inbound; /* bool */ + uint8_t flush_outbound; /* bool */ + } sol_packet; + + } payload; +}; + +struct ipmi_rq_entry { + struct ipmi_rq req; + struct ipmi_intf *intf; + uint8_t rq_seq; + uint8_t *msg_data; + int msg_len; + struct ipmi_rq_entry *next; +}; + +struct ipmi_rs { + uint8_t ccode; + uint8_t data[IPMI_BUF_SIZE]; + + /* + * Looks like this is the length of the entire packet, including the RMCP + * stuff, then modified to be the length of the extra IPMI message data + */ + int data_len; + + struct { + uint8_t netfn; + uint8_t cmd; + uint8_t seq; + uint8_t lun; + } msg; + + struct { + uint8_t authtype; + uint32_t seq; + uint32_t id; + uint8_t bEncrypted; /* IPMI v2 only */ + uint8_t bAuthenticated; /* IPMI v2 only */ + uint8_t payloadtype; /* IPMI v2 only */ + /* This is the total length of the payload or + IPMI message. IPMI v2.0 requires this to + be 2 bytes. Not really used for much. */ + uint16_t msglen; + } session; + + /* + * A union of the different possible payload meta-data + */ + union { + struct { + uint8_t rq_addr; + uint8_t netfn; + uint8_t rq_lun; + uint8_t rs_addr; + uint8_t rq_seq; + uint8_t rs_lun; + uint8_t cmd; + } ipmi_response; + struct { + uint8_t message_tag; + uint8_t rakp_return_code; + uint8_t max_priv_level; + uint32_t console_id; + uint32_t bmc_id; + uint8_t auth_alg; + uint8_t integrity_alg; + uint8_t crypt_alg; + } open_session_response; + struct { + uint8_t message_tag; + uint8_t rakp_return_code; + uint32_t console_id; + uint8_t bmc_rand[16]; /* Random number generated by the BMC */ + uint8_t bmc_guid[16]; + uint8_t key_exchange_auth_code[EVP_MAX_MD_SIZE]; + } rakp2_message; + struct { + uint8_t message_tag; + uint8_t rakp_return_code; + uint32_t console_id; + uint8_t integrity_check_value[EVP_MAX_MD_SIZE]; + } rakp4_message; + struct { + uint8_t packet_sequence_number; + uint8_t acked_packet_number; + uint8_t accepted_character_count; + uint8_t is_nack; /* bool */ + uint8_t transfer_unavailable; /* bool */ + uint8_t sol_inactive; /* bool */ + uint8_t transmit_overrun; /* bool */ + uint8_t break_detected; /* bool */ + } sol_packet; + + } payload; +}; + +#define IPMI_NETFN_CHASSIS 0x0 +#define IPMI_NETFN_BRIDGE 0x2 +#define IPMI_NETFN_SE 0x4 +#define IPMI_NETFN_APP 0x6 +#define IPMI_NETFN_FIRMWARE 0x8 +#define IPMI_NETFN_STORAGE 0xa +#define IPMI_NETFN_TRANSPORT 0xc +#define IPMI_NETFN_PICMG 0x2C +#define IPMI_NETFN_ISOL 0x34 +#define IPMI_NETFN_TSOL 0x30 + +#define IPMI_BMC_SLAVE_ADDR 0x20 +#define IPMI_REMOTE_SWID 0x81 + + +/* These values are IANA numbers */ +typedef enum IPMI_OEM { + IPMI_OEM_UNKNOWN = 0, + IPMI_OEM_SUN = 42, + IPMI_OEM_NOKIA = 94, + IPMI_OEM_INTEL = 343, + IPMI_OEM_TYAN = 6653, + IPMI_OEM_NEWISYS = 9237, + IPMI_OEM_SUPERMICRO = 10876, + IPMI_OEM_GOOGLE = 11129, + IPMI_OEM_PICMG = 12634, + IPMI_OEM_KONTRON = 15000, +} IPMI_OEM; + +extern const struct valstr completion_code_vals[]; + +#endif /* IPMI_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_cc.h b/lib/lanplus/inc/ipmitool/ipmi_cc.h new file mode 100644 index 0000000..237b1ee --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_cc.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_CC_H +#define IPMI_CC_H + +/* + Thu Jan 11 09:32:41 2007 + francois.isabelle@ca.kontron.com + + I just noticed that most modules refer to IPMI completion codes using + hard coded values ... +*/ + +/* + * CC + * See IPMI specification table 5-2 Generic Completion Codes + */ + +#define IPMI_CC_OK 0x00 +#define IPMI_CC_NODE_BUSY 0xc0 +#define IPMI_CC_INV_CMD 0xc1 +#define IPMI_CC_INV_CMD_FOR_LUN 0xc2 +#define IPMI_CC_TIMEOUT 0xc3 +#define IPMI_CC_OUT_OF_SPACE 0xc4 +#define IPMI_CC_RES_CANCELED 0xc5 +#define IPMI_CC_REQ_DATA_TRUNC 0xc6 +#define IPMI_CC_REQ_DATA_INV_LENGTH 0xc7 +#define IPMI_CC_REQ_DATA_FIELD_EXCEED 0xc8 +#define IPMI_CC_PARAM_OUT_OF_RANGE 0xc9 +#define IPMI_CC_CANT_RET_NUM_REQ_BYTES 0xca +#define IPMI_CC_REQ_DATA_NOT_PRESENT 0xcb +#define IPMI_CC_INV_DATA_FIELD_IN_REQ 0xcc +#define IPMI_CC_ILL_SENSOR_OR_RECORD 0xcd +#define IPMI_CC_RESP_COULD_NOT_BE_PRV 0xce +#define IPMI_CC_CANT_RESP_DUPLI_REQ 0xcf +#define IPMI_CC_CANT_RESP_SDRR_UPDATE 0xd0 +#define IPMI_CC_CANT_RESP_FIRM_UPDATE 0xd1 +#define IPMI_CC_CANT_RESP_BMC_INIT 0xd2 +#define IPMI_CC_DESTINATION_UNAVAILABLE 0xd3 +#define IPMI_CC_INSUFFICIENT_PRIVILEGES 0xd4 +#define IPMI_CC_NOT_SUPPORTED_PRESENT_STATE 0xd5 +#define IPMI_CC_ILLEGAL_COMMAND_DISABLED 0xd6 +#define IPMI_CC_UNSPECIFIED_ERROR 0xff + + +#endif /*IPMI_CC_H*/ diff --git a/lib/lanplus/inc/ipmitool/ipmi_channel.h b/lib/lanplus/inc/ipmitool/ipmi_channel.h new file mode 100644 index 0000000..00fda96 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_channel.h @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_CHANNEL_H +#define IPMI_CHANNEL_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> + + +#define IPMI_GET_CHANNEL_AUTH_CAP 0x38 +#define IPMI_GET_CHANNEL_ACCESS 0x41 +#define IPMI_GET_CHANNEL_INFO 0x42 +#define IPMI_SET_USER_ACCESS 0x43 +#define IPMI_GET_USER_ACCESS 0x44 +#define IPMI_SET_USER_NAME 0x45 +#define IPMI_GET_USER_NAME 0x46 +#define IPMI_SET_USER_PASSWORD 0x47 +#define IPMI_GET_CHANNEL_CIPHER_SUITES 0x54 + + +/* + * The Get Authentication Capabilities response structure + * From table 22-15 of the IPMI v2.0 spec + */ +struct get_channel_auth_cap_rsp { + uint8_t channel_number; +#if WORDS_BIGENDIAN + uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */ + uint8_t __reserved1 : 1; + uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */ +#else + uint8_t enabled_auth_types : 6; /* IPMI v1.5 enabled auth types */ + uint8_t __reserved1 : 1; + uint8_t v20_data_available : 1; /* IPMI v2.0 data is available */ +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved2 : 2; + uint8_t kg_status : 1; /* two-key login status */ + uint8_t per_message_auth : 1; /* per-message authentication status */ + uint8_t user_level_auth : 1; /* user-level authentication status */ + uint8_t non_null_usernames : 1; /* one or more non-null users exist */ + uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */ + uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */ +#else + uint8_t anon_login_enabled : 1; /* a null-named, null-pwd user exists */ + uint8_t null_usernames : 1; /* one or more null usernames non-null pwds */ + uint8_t non_null_usernames : 1; /* one or more non-null users exist */ + uint8_t user_level_auth : 1; /* user-level authentication status */ + uint8_t per_message_auth : 1; /* per-message authentication status */ + uint8_t kg_status : 1; /* two-key login status */ + uint8_t __reserved2 : 2; +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved3 : 6; + uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */ + uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */ +#else + uint8_t ipmiv20_support : 1; /* channel supports IPMI v2.0 connections */ + uint8_t ipmiv15_support : 1; /* channel supports IPMI v1.5 connections */ + uint8_t __reserved3 : 6; +#endif + uint8_t oem_id[3]; /* IANA enterprise number for auth type */ + uint8_t oem_aux_data; /* Additional OEM specific data for oem auths */ +} __attribute__ ((packed)); + + + +/* + * The Get Channel Info response structure + * From table 22-29 of the IPMI v2.0 spec + */ +struct get_channel_info_rsp { +#if WORDS_BIGENDIAN + uint8_t __reserved1 : 4; + uint8_t channel_number : 4; /* channel number */ +#else + uint8_t channel_number : 4; /* channel number */ + uint8_t __reserved1 : 4; +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved2 : 1; + uint8_t channel_medium : 7; /* Channel medium type per table 6-3 */ +#else + uint8_t channel_medium : 7; /* Channel medium type per table 6-3 */ + uint8_t __reserved2 : 1; +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved3 : 3; + uint8_t channel_protocol : 5; /* Channel protocol per table 6-2 */ +#else + uint8_t channel_protocol : 5; /* Channel protocol per table 6-2 */ + uint8_t __reserved3 : 3; +#endif +#if WORDS_BIGENDIAN + uint8_t session_support : 2; /* Description of session support */ + uint8_t active_sessions : 6; /* Count of active sessions */ +#else + uint8_t active_sessions : 6; /* Count of active sessions */ + uint8_t session_support : 2; /* Description of session support */ +#endif + uint8_t vendor_id[3]; /* For OEM that specified the protocol */ + uint8_t aux_info[2]; /* Not used*/ +} __attribute__ ((packed)); + + + +/* + * The Get Channel Access response structure + * From table 22-28 of the IPMI v2.0 spec + */ +struct get_channel_access_rsp { +#if WORDS_BIGENDIAN + uint8_t __reserved1 : 2; + uint8_t alerting : 1; + uint8_t per_message_auth : 1; + uint8_t user_level_auth : 1; + uint8_t access_mode : 3; +#else + uint8_t access_mode : 3; + uint8_t user_level_auth : 1; + uint8_t per_message_auth : 1; + uint8_t alerting : 1; + uint8_t __reserved1 : 2; +#endif +#if WORDS_BIGENDIAN + uint8_t __reserved2 : 4; + uint8_t channel_priv_limit : 4; /* Channel privilege level limit */ +#else + uint8_t channel_priv_limit : 4; /* Channel privilege level limit */ + uint8_t __reserved2 : 4; +#endif +} __attribute__ ((packed)); + + +struct get_user_access_rsp { +#if WORDS_BIGENDIAN + uint8_t __reserved1 : 2; + uint8_t max_user_ids : 6; + uint8_t __reserved2 : 2; + uint8_t enabled_user_ids : 6; + uint8_t __reserved3 : 2; + uint8_t fixed_user_ids : 6; + uint8_t __reserved4 : 1; + uint8_t callin_callback : 1; + uint8_t link_auth : 1; + uint8_t ipmi_messaging : 1; + uint8_t privilege_limit : 4; +#else + uint8_t max_user_ids : 6; + uint8_t __reserved1 : 2; + uint8_t enabled_user_ids : 6; + uint8_t __reserved2 : 2; + uint8_t fixed_user_ids : 6; + uint8_t __reserved3 : 2; + uint8_t privilege_limit : 4; + uint8_t ipmi_messaging : 1; + uint8_t link_auth : 1; + uint8_t callin_callback : 1; + uint8_t __reserved4 : 1; +#endif +} __attribute__ ((packed)); + +struct set_user_access_data { +#if WORDS_BIGENDIAN + uint8_t change_bits : 1; + uint8_t callin_callback : 1; + uint8_t link_auth : 1; + uint8_t ipmi_messaging : 1; + uint8_t channel : 4; + uint8_t __reserved1 : 2; + uint8_t user_id : 6; + uint8_t __reserved2 : 4; + uint8_t privilege_limit : 4; + uint8_t __reserved3 : 4; + uint8_t session_limit : 4; +#else + uint8_t channel : 4; + uint8_t ipmi_messaging : 1; + uint8_t link_auth : 1; + uint8_t callin_callback : 1; + uint8_t change_bits : 1; + uint8_t user_id : 6; + uint8_t __reserved1 : 2; + uint8_t privilege_limit : 4; + uint8_t __reserved2 : 4; + uint8_t session_limit : 4; + uint8_t __reserved3 : 4; +#endif +} __attribute__ ((packed)); + +uint8_t ipmi_get_channel_medium(struct ipmi_intf * intf, uint8_t channel); +uint8_t ipmi_current_channel_medium(struct ipmi_intf * intf); +int ipmi_channel_main(struct ipmi_intf * intf, int argc, char ** argv); +int ipmi_get_channel_auth_cap(struct ipmi_intf * intf, uint8_t channel, uint8_t priv); +int ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel); + +#endif /*IPMI_CHANNEL_H*/ diff --git a/lib/lanplus/inc/ipmitool/ipmi_chassis.h b/lib/lanplus/inc/ipmitool/ipmi_chassis.h new file mode 100644 index 0000000..3f56924 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_chassis.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_CHASSIS_H +#define IPMI_CHASSIS_H + +#include <ipmitool/ipmi.h> + +#define IPMI_CHASSIS_CTL_POWER_DOWN 0x0 +#define IPMI_CHASSIS_CTL_POWER_UP 0x1 +#define IPMI_CHASSIS_CTL_POWER_CYCLE 0x2 +#define IPMI_CHASSIS_CTL_HARD_RESET 0x3 +#define IPMI_CHASSIS_CTL_PULSE_DIAG 0x4 +#define IPMI_CHASSIS_CTL_ACPI_SOFT 0x5 + +#define IPMI_CHASSIS_POLICY_NO_CHANGE 0x3 +#define IPMI_CHASSIS_POLICY_ALWAYS_ON 0x2 +#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1 +#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0 + +int ipmi_chassis_power_status(struct ipmi_intf * intf); +int ipmi_chassis_power_control(struct ipmi_intf * intf, uint8_t ctl); +int ipmi_chassis_main(struct ipmi_intf * intf, int argc, char ** argv); +int ipmi_power_main(struct ipmi_intf * intf, int argc, char ** argv); + +#endif /*IPMI_CHASSIS_H*/ diff --git a/lib/lanplus/inc/ipmitool/ipmi_constants.h b/lib/lanplus/inc/ipmitool/ipmi_constants.h new file mode 100644 index 0000000..654e0ae --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_constants.h @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_CONSTANTS_H +#define IPMI_CONSTANTS_H + + +/* + * COMMANDS + */ +#define IPMI_GET_SDR_REPOSITORY_INFO 0x20 +#define IMPI_SOL_ACTIVATING 0x20 +#define IMPI_SET_SOL_CONFIG_PARAMETERS 0x21 +#define IMPI_GET_SOL_CONFIG_PARAMETERS 0x22 +#define IPMI_SET_USER_ACCESS 0x43 +#define IPMI_GET_USER_ACCESS 0x44 +#define IPMI_SET_USER_NAME 0x45 +#define IPMI_GET_USER_NAME 0x46 +#define IPMI_SET_USER_PASSWORD 0x47 +#define IPMI_ACTIVATE_PAYLOAD 0x48 +#define IPMI_DEACTIVATE_PAYLOAD 0x49 +#define IPMI_SUSPEND_RESUME_PAYLOAD_ENCRYPTYION 0x55 +#define IPMI_GET_SEL_TIME 0x48 +#define IPMI_SET_SEL_TIME 0x49 +#define IPMI_SET_USER_PAYLOAD_ACCESS 0x4c +#define IPMI_GET_USER_PAYLOAD_ACCESS 0x4d + +#define IPMI_1_5_AUTH_TYPE_BIT_NONE 0x01 +#define IPMI_1_5_AUTH_TYPE_BIT_MD2 0x02 +#define IPMI_1_5_AUTH_TYPE_BIT_MD5 0x04 +#define IPMI_1_5_AUTH_TYPE_BIT_PASSWORD 0x10 +#define IPMI_1_5_AUTH_TYPE_BIT_OEM 0x20 + +#define IPMI_SESSION_AUTHTYPE_NONE 0x0 +#define IPMI_SESSION_AUTHTYPE_MD2 0x1 +#define IPMI_SESSION_AUTHTYPE_MD5 0x2 +#define IPMI_SESSION_AUTHTYPE_KEY 0x4 +#define IPMI_SESSION_AUTHTYPE_PASSWORD IPMI_SESSION_AUTHTYPE_KEY +#define IPMI_SESSION_AUTHTYPE_OEM 0x5 +#define IPMI_SESSION_AUTHTYPE_RMCP_PLUS 0x6 + +#define IPMI_SESSION_PRIV_UNSPECIFIED 0x0 +#define IPMI_SESSION_PRIV_CALLBACK 0x1 +#define IPMI_SESSION_PRIV_USER 0x2 +#define IPMI_SESSION_PRIV_OPERATOR 0x3 +#define IPMI_SESSION_PRIV_ADMIN 0x4 +#define IPMI_SESSION_PRIV_OEM 0x5 + +#define IPMI_SET_IN_PROGRESS_SET_COMPLETE 0x00 +#define IPMI_SET_IN_PROGRESS_IN_PROGRESS 0x01 +#define IPMI_SET_IN_PROGRESS_COMMIT_WRITE 0x02 + +#define IPMI_CHANNEL_MEDIUM_RESERVED 0x0 +#define IPMI_CHANNEL_MEDIUM_IPMB_I2C 0x1 +#define IPMI_CHANNEL_MEDIUM_ICMB_1 0x2 +#define IPMI_CHANNEL_MEDIUM_ICMB_09 0x3 +#define IPMI_CHANNEL_MEDIUM_LAN 0x4 +#define IPMI_CHANNEL_MEDIUM_SERIAL 0x5 +#define IPMI_CHANNEL_MEDIUM_LAN_OTHER 0x6 +#define IPMI_CHANNEL_MEDIUM_SMBUS_PCI 0x7 +#define IPMI_CHANNEL_MEDIUM_SMBUS_1 0x8 +#define IPMI_CHANNEL_MEDIUM_SMBUS_2 0x9 +#define IPMI_CHANNEL_MEDIUM_USB_1 0xa +#define IPMI_CHANNEL_MEDIUM_USB_2 0xb +#define IPMI_CHANNEL_MEDIUM_SYSTEM 0xc + +#define IPMI_CHASSIS_CTL_POWER_DOWN 0x0 +#define IPMI_CHASSIS_CTL_POWER_UP 0x1 +#define IPMI_CHASSIS_CTL_POWER_CYCLE 0x2 +#define IPMI_CHASSIS_CTL_HARD_RESET 0x3 +#define IPMI_CHASSIS_CTL_PULSE_DIAG 0x4 +#define IPMI_CHASSIS_CTL_ACPI_SOFT 0x5 + +#define IPMI_CHASSIS_POLICY_NO_CHANGE 0x3 +#define IPMI_CHASSIS_POLICY_ALWAYS_ON 0x2 +#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1 +#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0 + +#define IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS 0 +#define IPMI_CHASSIS_BOOTPARAM_SVCPART_SELECT 1 +#define IPMI_CHASSIS_BOOTPARAM_SVCPART_SCAN 2 +#define IPMI_CHASSIS_BOOTPARAM_FLAG_VALID 3 +#define IPMI_CHASSIS_BOOTPARAM_INFO_ACK 4 +#define IPMI_CHASSIS_BOOTPARAM_BOOT_FLAGS 5 +#define IPMI_CHASSIS_BOOTPARAM_INIT_INFO 6 +#define IPMI_CHASSIS_BOOTPARAM_INIT_MBOX 7 + +/* From table 13-17 of the IPMI v2 specification */ +#define IPMI_AUTH_RAKP_NONE 0x00 +#define IPMI_AUTH_RAKP_HMAC_SHA1 0x01 +#define IPMI_AUTH_RAKP_HMAC_MD5 0x02 +#define IPMI_AUTH_RAKP_HMAC_SHA256 0x03 + +/* From table 13-18 of the IPMI v2 specification */ +#define IPMI_INTEGRITY_NONE 0x00 +#define IPMI_INTEGRITY_HMAC_SHA1_96 0x01 +#define IPMI_INTEGRITY_HMAC_MD5_128 0x02 +#define IPMI_INTEGRITY_MD5_128 0x03 +#define IPMI_INTEGRITY_HMAC_SHA256_128 0x04 + +/* From table 13-19 of the IPMI v2 specfication */ +#define IPMI_CRYPT_NONE 0x00 +#define IPMI_CRYPT_AES_CBC_128 0x01 +#define IPMI_CRYPT_XRC4_128 0x02 +#define IPMI_CRYPT_XRC4_40 0x03 + +#endif /*IPMI_CONSTANTS_H*/ diff --git a/lib/lanplus/inc/ipmitool/ipmi_entity.h b/lib/lanplus/inc/ipmitool/ipmi_entity.h new file mode 100644 index 0000000..29f44d2 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_entity.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_ENTITY_H +#define IPMI_ENTITY_H + +struct entity_id { + uint8_t id; /* physical entity id */ +#if WORDS_BIGENDIAN + uint8_t logical : 1; /* physical/logical */ + uint8_t instance : 7; /* instance number */ +#else + uint8_t instance : 7; /* instance number */ + uint8_t logical : 1; /* physical/logical */ +#endif +} __attribute__ ((packed)); + +#endif /* IPMI_ENTITY_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_event.h b/lib/lanplus/inc/ipmitool/ipmi_event.h new file mode 100644 index 0000000..e78d453 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_event.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_EVENT_H +#define IPMI_EVENT_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> + +#define EVENT_DIR_ASSERT 0 +#define EVENT_DIR_DEASSERT 1 + +struct platform_event_msg { + uint8_t evm_rev; + uint8_t sensor_type; + uint8_t sensor_num; +#if WORDS_BIGENDIAN + uint8_t event_dir : 1; + uint8_t event_type : 7; +#else + uint8_t event_type : 7; + uint8_t event_dir : 1; +#endif + uint8_t event_data[3]; +} __attribute__((packed)); + +int ipmi_event_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_EVENT_H*/ diff --git a/lib/lanplus/inc/ipmitool/ipmi_firewall.h b/lib/lanplus/inc/ipmitool/ipmi_firewall.h new file mode 100644 index 0000000..f18770e --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_firewall.h @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_FIREWALL_H +#define IPMI_FIREWALL_H + +#include <ipmitool/ipmi.h> + +int ipmi_firewall_main(struct ipmi_intf *, int, char **); + +#define BMC_GET_NETFN_SUPPORT 0x09 +#define BMC_GET_COMMAND_SUPPORT 0x0A +#define BMC_GET_COMMAND_SUBFUNCTION_SUPPORT 0x0B +#define BMC_GET_CONFIGURABLE_COMMANDS 0x0C +#define BMC_GET_CONFIGURABLE_COMMAND_SUBFUNCTIONS 0x0D +#define BMC_SET_COMMAND_ENABLES 0x60 +#define BMC_GET_COMMAND_ENABLES 0x61 +#define BMC_SET_COMMAND_SUBFUNCTION_ENABLES 0x62 +#define BMC_GET_COMMAND_SUBFUNCTION_ENABLES 0x63 +#define BMC_OEM_NETFN_IANA_SUPPORT 0x64 + +#define SET_COMMAND_ENABLE_BYTE (BMC_SET_COMMAND_ENABLES / 8) +#define SET_COMMAND_ENABLE_BIT (BMC_SET_COMMAND_ENABLES % 8) + +#define MAX_LUN 4 +#define MAX_NETFN 64 +#define MAX_NETFN_PAIR (MAX_NETFN/2) +#define MAX_COMMAND 256 +#define MAX_SUBFN 32 +#define MAX_COMMAND_BYTES (MAX_COMMAND>>3) +#define MAX_SUBFN_BYTES (MAX_SUBFN>>3) + +// support is a bitfield with the following bits set... +#define BIT_AVAILABLE 0x01 +#define BIT_CONFIGURABLE 0x02 +#define BIT_ENABLED 0x04 + +extern int verbose; + +struct command_support { + unsigned char support; + unsigned char version[3]; + unsigned char subfn_support[MAX_SUBFN_BYTES]; + unsigned char subfn_config[MAX_SUBFN_BYTES]; + unsigned char subfn_enable[MAX_SUBFN_BYTES]; +}; +struct lun_netfn_support { + unsigned char support; + struct command_support command[MAX_COMMAND]; + unsigned char command_mask[MAX_COMMAND_BYTES]; + unsigned char config_mask[MAX_COMMAND_BYTES]; + unsigned char enable_mask[MAX_COMMAND_BYTES]; +}; +struct lun_support { + unsigned char support; + struct lun_netfn_support netfn[MAX_NETFN_PAIR]; +}; +struct bmc_fn_support { + struct lun_support lun[MAX_LUN]; +}; +struct ipmi_function_params { + int channel; + int lun; + int netfn; + int command; + int subfn; + unsigned char force; +}; + +static inline int bit_test(const unsigned char * bf, int n) { + return !!(bf[n>>3]&(1<<(n%8))); +} +static inline void bit_set(unsigned char * bf, int n, int v) { + bf[n>>3] = (bf[n>>3] & ~(1<<(n%8))) | ((v?1:0)<<(n%8)); +} + +#endif /*IPMI_FIREWALL_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_fru.h b/lib/lanplus/inc/ipmitool/ipmi_fru.h new file mode 100644 index 0000000..0fe594a --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_fru.h @@ -0,0 +1,381 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_FRU_H +#define IPMI_FRU_H + +#ifdef WIN32 +#include <inttypes-win.h> +#else +#include <inttypes.h> +#endif +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_sdr.h> + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#define GET_FRU_INFO 0x10 +#define GET_FRU_DATA 0x11 +#define SET_FRU_DATA 0x12 + +enum { + FRU_CHASSIS_PARTNO, + FRU_CHASSIS_SERIAL, + FRU_BOARD_MANUF, + FRU_BOARD_PRODUCT, + FRU_BOARD_SERIAL, + FRU_BOARD_PARTNO, + FRU_PRODUCT_MANUF, + FRU_PRODUCT_NAME, + FRU_PRODUCT_PARTNO, + FRU_PRODUCT_VERSION, + FRU_PRODUCT_SERIAL, + FRU_PRODUCT_ASSET, +}; + +struct fru_info { + uint16_t size; + uint8_t access:1; +} __attribute__ ((packed)); + +struct fru_header { + uint8_t version; + struct { + uint8_t internal; + uint8_t chassis; + uint8_t board; + uint8_t product; + uint8_t multi; + } offset; + uint8_t pad; + uint8_t checksum; +} __attribute__ ((packed)); + +struct fru_area_chassis { + uint8_t area_ver; + uint8_t type; + uint16_t area_len; + char *part; + char *serial; +}; + +struct fru_area_board { + uint8_t area_ver; + uint8_t lang; + uint16_t area_len; + uint32_t mfg_date_time; + char *mfg; + char *prod; + char *serial; + char *part; + char *fru; +}; + +struct fru_area_product { + uint8_t area_ver; + uint8_t lang; + uint16_t area_len; + char *mfg; + char *name; + char *part; + char *version; + char *serial; + char *asset; + char *fru; +}; + +struct fru_multirec_header { +#define FRU_RECORD_TYPE_POWER_SUPPLY_INFORMATION 0x00 +#define FRU_RECORD_TYPE_DC_OUTPUT 0x01 +#define FRU_RECORD_TYPE_DC_LOAD 0x02 +#define FRU_RECORD_TYPE_MANAGEMENT_ACCESS 0x03 +#define FRU_RECORD_TYPE_BASE_COMPATIBILITY 0x04 +#define FRU_RECORD_TYPE_EXTENDED_COMPATIBILITY 0x05 +#define FRU_RECORD_TYPE_OEM_EXTENSION 0xc0 + uint8_t type; + uint8_t format; + uint8_t len; + uint8_t record_checksum; + uint8_t header_checksum; +} __attribute__ ((packed)); + +struct fru_multirec_powersupply { +#if WORDS_BIGENDIAN + uint16_t capacity; +#else + uint16_t capacity:12; + uint16_t __reserved1:4; +#endif + uint16_t peak_va; + uint8_t inrush_current; + uint8_t inrush_interval; + uint16_t lowend_input1; + uint16_t highend_input1; + uint16_t lowend_input2; + uint16_t highend_input2; + uint8_t lowend_freq; + uint8_t highend_freq; + uint8_t dropout_tolerance; +#if WORDS_BIGENDIAN + uint8_t __reserved2:3; + uint8_t tach:1; + uint8_t hotswap:1; + uint8_t autoswitch:1; + uint8_t pfc:1; + uint8_t predictive_fail:1; +#else + uint8_t predictive_fail:1; + uint8_t pfc:1; + uint8_t autoswitch:1; + uint8_t hotswap:1; + uint8_t tach:1; + uint8_t __reserved2:3; +#endif + uint16_t peak_cap_ht; +#if WORDS_BIGENDIAN + uint8_t combined_voltage1:4; + uint8_t combined_voltage2:4; +#else + uint8_t combined_voltage2:4; + uint8_t combined_voltage1:4; +#endif + uint16_t combined_capacity; + uint8_t rps_threshold; +} __attribute__ ((packed)); + +static const char *combined_voltage_desc[] __attribute__ ((unused)) = { +"12 V", "-12 V", "5 V", "3.3 V"}; + +struct fru_multirec_dcoutput { +#if WORDS_BIGENDIAN + uint8_t standby:1; + uint8_t __reserved1:3; + uint8_t output_number:4; +#else + uint8_t output_number:4; + uint8_t __reserved1:3; + uint8_t standby:1; +#endif + short nominal_voltage; + short max_neg_dev; + short max_pos_dev; + uint16_t ripple_and_noise; + uint16_t min_current; + uint16_t max_current; +} __attribute__ ((packed)); + +struct fru_multirec_dcload { +#if WORDS_BIGENDIAN + uint8_t __reserved1:4; + uint8_t output_number:4; +#else + uint8_t output_number:4; + uint8_t __reserved1:4; +#endif + short nominal_voltage; + short min_voltage; + short max_voltage; + uint16_t ripple_and_noise; + uint16_t min_current; + uint16_t max_current; +} __attribute__ ((packed)); + +struct fru_multirec_oem_header { + unsigned char mfg_id[3]; +#define FRU_PICMG_BACKPLANE_P2P 0x04 +#define FRU_PICMG_ADDRESS_TABLE 0x10 +#define FRU_PICMG_SHELF_POWER_DIST 0x11 +#define FRU_PICMG_SHELF_ACTIVATION 0x12 +#define FRU_PICMG_SHMC_IP_CONN 0x13 +#define FRU_PICMG_BOARD_P2P 0x14 +#define FRU_AMC_CURRENT 0x16 +#define FRU_AMC_ACTIVATION 0x17 +#define FRU_AMC_CARRIER_P2P 0x18 +#define FRU_AMC_P2P 0x19 +#define FRU_AMC_CARRIER_INFO 0x1a + unsigned char record_id; + unsigned char record_version; +} __attribute__ ((packed)); + +struct fru_picmgext_guid { + unsigned char guid[16]; +} __attribute__ ((packed)); + +struct fru_picmgext_link_desc { +#ifndef WORDS_BIGENDIAN + unsigned int designator:12; +#define FRU_PICMGEXT_LINK_TYPE_BASE 0x01 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET 0x02 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND 0x03 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR 0x04 +#define FRU_PICMGEXT_LINK_TYPE_PCIE 0x05 + unsigned int type:8; + unsigned int ext:4; + unsigned int grouping:8; +#else + unsigned int grouping:8; + unsigned int ext:4; +#define FRU_PICMGEXT_LINK_TYPE_BASE 0x01 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET 0x02 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND 0x03 +#define FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR 0x04 +#define FRU_PICMGEXT_LINK_TYPE_PCIE 0x05 + unsigned int type:8; + unsigned int designator:12; +#endif +} __attribute__ ((packed)); + + +#define FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED 0x00 +#define FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 0x01 +#define FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS 0x02 +#define FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 0x03 +#define FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 0x04 +#define FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET 0x05 +#define FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO 0x06 +#define FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE 0x07 + +/* This is used in command, not in FRU */ +struct fru_picmgext_amc_link_info { + unsigned char linkInfo[3]; +} __attribute__ ((packed)); + +struct fru_picmgext_amc_link_desc_core { +#ifndef WORDS_BIGENDIAN + unsigned int designator:12; + unsigned int type:8; + unsigned int ext:4; + unsigned int grouping:8; +#else + unsigned int grouping:8; + unsigned int ext:4; + unsigned int type:8; + unsigned int designator:12; +#endif +} __attribute__ ((packed)); + +struct fru_picmgext_amc_link_desc_extra { +#ifndef WORDS_BIGENDIAN + unsigned char asymetricMatch:2; + unsigned char reserved:6; +#else + unsigned char reserved:6; + unsigned char asymetricMatch:2; +#endif +} __attribute__ ((packed)); + + +struct fru_picmgext_amc_link_desc { +#ifndef WORDS_BIGENDIAN + struct fru_picmgext_amc_link_desc_core core;/* lsb */ + struct fru_picmgext_amc_link_desc_extra extra; +#else + struct fru_picmgext_amc_link_desc_extra extra; + struct fru_picmgext_amc_link_desc_core core;/* lsb */ +#endif +} __attribute__ ((packed)); + + +struct fru_picmgext_chn_desc { +#ifndef WORDS_BIGENDIAN + unsigned char remote_slot:8; + unsigned char remote_chn:5; + unsigned char local_chn:5; + unsigned char:6; +#else + unsigned char:6; + unsigned char local_chn:5; + unsigned char remote_chn:5; + unsigned char remote_slot:8; +#endif +} __attribute__ ((packed)); + +struct fru_picmgext_slot_desc { + unsigned char chan_type; + unsigned char slot_addr; + unsigned char chn_count; +} __attribute__ ((packed)); + +#define FRU_PICMGEXT_DESIGN_IF_BASE 0x00 +#define FRU_PICMGEXT_DESIGN_IF_FABRIC 0x01 +#define FRU_PICMGEXT_DESIGN_IF_UPDATE_CHANNEL 0x02 +#define FRU_PICMGEXT_DESIGN_IF_RESERVED 0x03 + +struct fru_picmgext_carrier_activation_record { + unsigned short max_internal_curr; + unsigned char allowance_for_readiness; + unsigned char module_activation_record_count; +} __attribute__ ((packed)); + +struct fru_picmgext_activation_record { + unsigned char ibmb_addr; + unsigned char max_module_curr; + unsigned char reserved; +} __attribute__ ((packed)); + +struct fru_picmgext_carrier_p2p_record { + unsigned char resource_id; + unsigned char p2p_count; +} __attribute__ ((packed)); + +struct fru_picmgext_carrier_p2p_descriptor { +#ifndef WORDS_BIGENDIAN + unsigned char remote_resource_id; + unsigned short remote_port:5; + unsigned short local_port:5; + unsigned short reserved:6; +#else + unsigned short reserved:6; + unsigned short local_port:5; + unsigned short remote_port:5; + unsigned char remote_resource_id; +#endif +} __attribute__ ((packed)); + +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"}; + +int ipmi_fru_main(struct ipmi_intf *intf, int argc, char **argv); +int ipmi_fru_print(struct ipmi_intf *intf, struct sdr_record_fru_locator *fru); +int ipmi_spd_print(uint8_t *data, int len); +int ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id); + +#endif /* IPMI_FRU_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_fwum.h b/lib/lanplus/inc/ipmitool/ipmi_fwum.h new file mode 100644 index 0000000..1170abe --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_fwum.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_KFWUM_H +#define IPMI_KFWUM_H + +#ifdef WIN32 +#include <inttypes-win.h> +#else +#include <inttypes.h> +#endif +#include <ipmitool/ipmi.h> + + +int ipmi_fwum_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_KFWUM_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_hpmfwupg.h b/lib/lanplus/inc/ipmitool/ipmi_hpmfwupg.h new file mode 100644 index 0000000..4739d58 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_hpmfwupg.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_HPMFWUPG_H +#define IPMI_HPMFWUPG_H + +#ifdef WIN32 +#include <inttypes-win.h> +#else +#include <inttypes.h> +#endif +#include <ipmitool/ipmi.h> + +int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_KFWUM_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_intf.h b/lib/lanplus/inc/ipmitool/ipmi_intf.h new file mode 100644 index 0000000..db1ffd5 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_intf.h @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_INTF_H +#define IPMI_INTF_H + +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_oem.h> +#include <ipmitool/ipmi_constants.h> + +#ifdef WIN32 +#include <windows.h> +#include <winsock.h> +#include <inttypes-win.h> +#else +#include <sys/types.h> +#include <arpa/inet.h> +#include <sys/socket.h> +#include <netinet/in.h> +#endif + +#include <openssl/evp.h> +#include <openssl/sha.h> + +#ifdef MOVED +// moved this to "lanplus_defs.h" +/* + * An enumeration that describes every possible session state for + * an IPMIv2 / RMCP+ session. + */ +enum LANPLUS_SESSION_STATE { + LANPLUS_STATE_PRESESSION = 0, + LANPLUS_STATE_OPEN_SESSION_SENT, + LANPLUS_STATE_OPEN_SESSION_RECEIEVED, + LANPLUS_STATE_RAKP_1_SENT, + LANPLUS_STATE_RAKP_2_RECEIVED, + LANPLUS_STATE_RAKP_3_SENT, + LANPLUS_STATE_ACTIVE, + LANPLUS_STATE_CLOSE_SENT, +}; + +#define IPMI_AUTHCODE_BUFFER_SIZE 20 // KG or KUID +#define IPMI_SIK_BUFFER_SIZE EVP_MAX_MD_SIZE +#define IPMI_KG_BUFFER_SIZE 21 /* key plus null byte */ + +struct ipmi_session { + uint8_t hostname[64]; + uint8_t username[17]; + uint8_t authcode[IPMI_AUTHCODE_BUFFER_SIZE + 1]; + uint8_t challenge[16]; + uint8_t authtype; + uint8_t authtype_set; +#define IPMI_AUTHSTATUS_PER_MSG_DISABLED 0x10 +#define IPMI_AUTHSTATUS_PER_USER_DISABLED 0x08 +#define IPMI_AUTHSTATUS_NONNULL_USERS_ENABLED 0x04 +#define IPMI_AUTHSTATUS_NULL_USERS_ENABLED 0x02 +#define IPMI_AUTHSTATUS_ANONYMOUS_USERS_ENABLED 0x01 + uint8_t authstatus; + uint8_t authextra; + uint8_t privlvl; + uint8_t cipher_suite_id; + char sol_escape_char; + int password; + int port; + int active; + int retry; + + uint32_t session_id; + uint32_t in_seq; + uint32_t out_seq; + uint32_t timeout; + + struct sockaddr_in addr; /*old*/ + socklen_t addrlen; + + /* + * This struct holds state data specific to IPMI v2 / RMCP+ sessions + */ + struct { + enum LANPLUS_SESSION_STATE session_state; + + /* These are the algorithms agreed upon for the session */ + uint8_t requested_auth_alg; + uint8_t requested_integrity_alg; + uint8_t requested_crypt_alg; + uint8_t auth_alg; + uint8_t integrity_alg; + uint8_t crypt_alg; + uint8_t max_priv_level; + uint8_t lookupbit; + + uint32_t console_id; + uint32_t bmc_id; + + /* + * Values required for RAKP mesages + */ + + /* Random number generated byt the console */ + uint8_t console_rand[16]; + /* Random number generated by the BMC */ + uint8_t bmc_rand[16]; + + uint8_t bmc_guid[16]; + uint8_t requested_role; /* As sent in the RAKP 1 message */ + uint8_t rakp2_return_code; + + uint8_t sik[EVP_MAX_MD_SIZE]; /* Session integrity key */ + uint8_t kg[IPMI_KG_BUFFER_SIZE]; /* BMC key */ + uint8_t k1[EVP_MAX_MD_SIZE]; /* Used for Integrity checking? */ + uint8_t k2[EVP_MAX_MD_SIZE]; /* First 16 bytes used for AES */ + uint8_t sik_len; /* length of sik */ + uint8_t k1_len; /* length of k1 */ + uint8_t k2_len; /* length of k2 */ + } v2_data; + + + /* + * This data is specific to the Serial Over Lan session + */ + struct { + uint16_t max_inbound_payload_size; + uint16_t max_outbound_payload_size; + uint16_t port; + uint8_t sequence_number; + + /* This data describes the last SOL packet */ + uint8_t last_received_sequence_number; + uint8_t last_received_byte_count; + void (*sol_input_handler)(struct ipmi_rs * rsp); + } sol_data; +}; + +struct ipmi_cmd { + int (*func)(struct ipmi_intf * intf, int argc, char ** argv); + const char * name; + const char * desc; +}; + +struct ipmi_intf_support { + const char * name; + int supported; +}; + +struct ipmi_intf { + char name[16]; + char desc[128]; + int fd; + int opened; + int abort; + int noanswer; + + struct ipmi_session * session; + struct ipmi_oem_handle * oem; + struct ipmi_cmd * cmdlist; + uint32_t my_addr; + uint32_t target_addr; + uint8_t target_lun; + uint8_t target_channel; + uint32_t transit_addr; + uint8_t transit_channel; + uint8_t devnum; + + int (*setup)(struct ipmi_intf * intf); + int (*open)(struct ipmi_intf * intf); + void (*close)(struct ipmi_intf * intf); + struct ipmi_rs *(*sendrecv)(struct ipmi_intf * intf, struct ipmi_rq * req); + int (*sendrsp)(struct ipmi_intf * intf, struct ipmi_rs * rsp); + struct ipmi_rs *(*recv_sol)(struct ipmi_intf * intf); + struct ipmi_rs *(*send_sol)(struct ipmi_intf * intf, struct ipmi_v2_payload * payload); + int (*keepalive)(struct ipmi_intf * intf); +}; +#else + +#include "lanplus_defs.h" +#endif + +struct ipmi_intf * ipmi_intf_load(char * name); +void ipmi_intf_print(struct ipmi_intf_support * intflist); + +void ipmi_intf_session_set_hostname(struct ipmi_intf * intf, char * hostname); +void ipmi_intf_session_set_username(struct ipmi_intf * intf, char * username); +void ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password); +void ipmi_intf_session_set_privlvl(struct ipmi_intf * intf, uint8_t privlvl); +void ipmi_intf_session_set_lookupbit(struct ipmi_intf * intf, uint8_t lookupbit); +void ipmi_intf_session_set_cipher_suite_id(struct ipmi_intf * intf, uint8_t cipher_suite_id); +void ipmi_intf_session_set_sol_escape_char(struct ipmi_intf * intf, char sol_escape_char); +void ipmi_intf_session_set_kgkey(struct ipmi_intf * intf, char * kgkey); +void ipmi_intf_session_set_port(struct ipmi_intf * intf, int port); +void ipmi_intf_session_set_authtype(struct ipmi_intf * intf, uint8_t authtype); +void ipmi_intf_session_set_timeout(struct ipmi_intf * intf, uint32_t timeout); +void ipmi_intf_session_set_retry(struct ipmi_intf * intf, int retry); +void ipmi_cleanup(struct ipmi_intf * intf); + +#endif /* IPMI_INTF_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_isol.h b/lib/lanplus/inc/ipmitool/ipmi_isol.h new file mode 100644 index 0000000..6a41b07 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_isol.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_ISOL_H +#define IPMI_ISOL_H + +#include <ipmitool/ipmi.h> + +#define ACTIVATE_ISOL 0x01 +#define SET_ISOL_CONFIG 0x03 +#define GET_ISOL_CONFIG 0x04 + +#define ISOL_ENABLE_PARAM 0x01 +#define ISOL_AUTHENTICATION_PARAM 0x02 +#define ISOL_ENABLE_FLAG 0x01 +#define ISOL_PRIVILEGE_LEVEL_USER 0x02 +#define ISOL_BAUD_RATE_PARAM 0x05 +#define ISOL_BAUD_RATE_9600 0x06 +#define ISOL_BAUD_RATE_19200 0x07 +#define ISOL_BAUD_RATE_38400 0x08 +#define ISOL_BAUD_RATE_57600 0x09 +#define ISOL_BAUD_RATE_115200 0x0A +#define ISOL_PREFERRED_BAUD_RATE 0x07 + +int ipmi_isol_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_SOL_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_kontronoem.h b/lib/lanplus/inc/ipmitool/ipmi_kontronoem.h new file mode 100644 index 0000000..083e546 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_kontronoem.h @@ -0,0 +1,49 @@ +/*
+ * Copyright (c) 2004 Kontron Canada, Inc. All Rights Reserved.
+ *
+ * Base on code from
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind.
+ * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
+ * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
+ * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
+ * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
+ * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
+ * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+ * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
+ * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
+ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef IPMI_KONTRONOEM_H
+#define IPMI_KONTRONOEM_H
+
+#ifdef WIN32
+#include <inttypes-win.h>
+#else
+#include <inttypes.h>
+#endif
+#include <ipmitool/ipmi.h>
+
+
+int ipmi_kontronoem_main(struct ipmi_intf *, int, char **);
+
+#endif /* IPMI_KONTRONOEM_H */
diff --git a/lib/lanplus/inc/ipmitool/ipmi_lanp.h b/lib/lanplus/inc/ipmitool/ipmi_lanp.h new file mode 100644 index 0000000..1aaae5e --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_lanp.h @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_LANP_H +#define IPMI_LANP_H + +#include <ipmitool/ipmi.h> + +#define IPMI_LAN_SET_CONFIG 0x01 +#define IPMI_LAN_GET_CONFIG 0x02 +#define IPMI_LAN_SUSPEND_ARP 0x03 +# define IPMI_LAN_SUSPEND_ARP_RESP (2) +# define IPMI_LAN_SUSPEND_ARP_GRAT (1) +#define IPMI_LAN_GET_STAT 0x04 + +#define IPMI_CHANNEL_NUMBER_MAX 0xe + +#define IPMI_LANP_TIMEOUT 3 +#define IPMI_LANP_RETRIES 10 +#define IPMI_LANP_WRITE_UNLOCK 0 +#define IPMI_LANP_WRITE_LOCK 1 +#define IPMI_LANP_WRITE_COMMIT 2 + +enum { + IPMI_LANP_SET_IN_PROGRESS, + IPMI_LANP_AUTH_TYPE, + IPMI_LANP_AUTH_TYPE_ENABLE, + IPMI_LANP_IP_ADDR, + IPMI_LANP_IP_ADDR_SRC, + IPMI_LANP_MAC_ADDR, /* 5 */ + IPMI_LANP_SUBNET_MASK, + IPMI_LANP_IP_HEADER, + IPMI_LANP_PRI_RMCP_PORT, + IPMI_LANP_SEC_RMCP_PORT, + IPMI_LANP_BMC_ARP, /* 10 */ + IPMI_LANP_GRAT_ARP, + IPMI_LANP_DEF_GATEWAY_IP, + IPMI_LANP_DEF_GATEWAY_MAC, + IPMI_LANP_BAK_GATEWAY_IP, + IPMI_LANP_BAK_GATEWAY_MAC, /* 15 */ + IPMI_LANP_SNMP_STRING, + IPMI_LANP_NUM_DEST, + IPMI_LANP_DEST_TYPE, + IPMI_LANP_DEST_ADDR, + IPMI_LANP_VLAN_ID, /* 20 */ + IPMI_LANP_VLAN_PRIORITY, + IPMI_LANP_RMCP_CIPHER_SUPPORT, + IPMI_LANP_RMCP_CIPHERS, + IPMI_LANP_RMCP_PRIV_LEVELS, + IPMI_LANP_OEM_ALERT_STRING=96, + IPMI_LANP_ALERT_RETRY=97, + IPMI_LANP_UTC_OFFSET=98, + IPMI_LANP_DHCP_SERVER_IP=192, + IPMI_LANP_DHCP_SERVER_MAC=193, + IPMI_LANP_DHCP_ENABLE=194, + IPMI_LANP_CHAN_ACCESS_MODE=201, +}; + +static struct lan_param { + int cmd; + int size; + char desc[24]; + uint8_t * data; + int data_len; +} ipmi_lan_params[] __attribute__((unused)) = { + { IPMI_LANP_SET_IN_PROGRESS, 1, "Set in Progress" }, + { IPMI_LANP_AUTH_TYPE, 1, "Auth Type Support" }, + { IPMI_LANP_AUTH_TYPE_ENABLE, 5, "Auth Type Enable" }, + { IPMI_LANP_IP_ADDR, 4, "IP Address" }, + { IPMI_LANP_IP_ADDR_SRC, 1, "IP Address Source" }, + { IPMI_LANP_MAC_ADDR, 6, "MAC Address" }, /* 5 */ + { IPMI_LANP_SUBNET_MASK, 4, "Subnet Mask" }, + { IPMI_LANP_IP_HEADER, 3, "IP Header" }, + { IPMI_LANP_PRI_RMCP_PORT, 2, "Primary RMCP Port" }, + { IPMI_LANP_SEC_RMCP_PORT, 2, "Secondary RMCP Port" }, + { IPMI_LANP_BMC_ARP, 1, "BMC ARP Control" }, /* 10 */ + { IPMI_LANP_GRAT_ARP, 1, "Gratituous ARP Intrvl" }, + { IPMI_LANP_DEF_GATEWAY_IP, 4, "Default Gateway IP" }, + { IPMI_LANP_DEF_GATEWAY_MAC, 6, "Default Gateway MAC" }, + { IPMI_LANP_BAK_GATEWAY_IP, 4, "Backup Gateway IP" }, + { IPMI_LANP_BAK_GATEWAY_MAC, 6, "Backup Gateway MAC" }, /* 15 */ + { IPMI_LANP_SNMP_STRING, 18, "SNMP Community String" }, + { IPMI_LANP_NUM_DEST, 1, "Number of Destinations"}, + { IPMI_LANP_DEST_TYPE, 4, "Destination Type" }, + { IPMI_LANP_DEST_ADDR, 13, "Destination Addresses" }, + { IPMI_LANP_VLAN_ID, 2, "802.1q VLAN ID" }, /* 20 */ + { IPMI_LANP_VLAN_PRIORITY, 1, "802.1q VLAN Priority" }, + { IPMI_LANP_RMCP_CIPHER_SUPPORT,1, "RMCP+ Cipher Suite Count" }, + { IPMI_LANP_RMCP_CIPHERS, 16, "RMCP+ Cipher Suites" }, + { IPMI_LANP_RMCP_PRIV_LEVELS, 9, "Cipher Suite Priv Max" }, + { IPMI_LANP_OEM_ALERT_STRING, 28, "OEM Alert String" }, /* 25 */ + { IPMI_LANP_ALERT_RETRY, 1, "Alert Retry Algorithm" }, + { IPMI_LANP_UTC_OFFSET, 3, "UTC Offset" }, + { IPMI_LANP_DHCP_SERVER_IP, 4, "DHCP Server IP" }, + { IPMI_LANP_DHCP_SERVER_MAC, 6, "DHDP Server MAC" }, + { IPMI_LANP_DHCP_ENABLE, 1, "DHCP Enable" }, /* 30 */ + { IPMI_LANP_CHAN_ACCESS_MODE, 2, "Channel Access Mode" }, + { -1 } +}; + +int ipmi_lanp_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_LANP_H*/ diff --git a/lib/lanplus/inc/ipmitool/ipmi_main.h b/lib/lanplus/inc/ipmitool/ipmi_main.h new file mode 100644 index 0000000..e32360a --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_main.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_MAIN_H +#define IPMI_MAIN_H + +#include <ipmitool/ipmi_intf.h> + +int ipmi_main(int argc, char ** argv, struct ipmi_cmd * cmdlist, struct ipmi_intf_support * intflist); +void ipmi_cmd_print(struct ipmi_cmd * cmdlist); +int ipmi_cmd_run(struct ipmi_intf * intf, char * name, int argc, char ** argv); + +#endif /* IPMI_MAIN_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_mc.h b/lib/lanplus/inc/ipmitool/ipmi_mc.h new file mode 100644 index 0000000..601f40e --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_mc.h @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_MC_H +#define IPMI_MC_H + +#include <ipmitool/ipmi.h> + +#define BMC_GET_DEVICE_ID 0x01 +#define BMC_COLD_RESET 0x02 +#define BMC_WARM_RESET 0x03 +#define BMC_GET_SELF_TEST 0x04 +#define BMC_SET_GLOBAL_ENABLES 0x2e +#define BMC_GET_GLOBAL_ENABLES 0x2f +#define BMC_GET_GUID 0x37 + +int ipmi_mc_main(struct ipmi_intf *, int, char **); + +/* + * Response data from IPM Get Device ID Command (IPMI rev 1.5, section 17.1) + * The following really apply to any IPM device, not just BMCs... + */ +struct ipm_devid_rsp { + uint8_t device_id; + uint8_t device_revision; + uint8_t fw_rev1; + uint8_t fw_rev2; + uint8_t ipmi_version; + uint8_t adtl_device_support; + uint8_t manufacturer_id[3]; + uint8_t product_id[2]; + uint8_t aux_fw_rev[4]; +} __attribute__ ((packed)); + +#define IPM_DEV_DEVICE_ID_SDR_MASK (0x80) /* 1 = provides SDRs */ +#define IPM_DEV_DEVICE_ID_REV_MASK (0x07) /* BCD-enoded */ + +#define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */ +#define IPM_DEV_FWREV1_MAJOR_MASK (0x3f) /* Major rev, BCD-encoded */ + +#define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */ +#define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */ +#define IPM_DEV_IPMI_VER_MINOR_SHIFT (4) /* Minor rev shift */ +#define IPM_DEV_IPMI_VERSION_MAJOR(x) \ + (x & IPM_DEV_IPMI_VER_MAJOR_MASK) +#define IPM_DEV_IPMI_VERSION_MINOR(x) \ + ((x & IPM_DEV_IPMI_VER_MINOR_MASK) >> IPM_DEV_IPMI_VER_MINOR_SHIFT) + +#define IPM_DEV_MANUFACTURER_ID(x) \ + ((uint32_t) ((x[2] & 0x0F) << 16 | x[1] << 8 | x[0])) + +#define IPM_DEV_ADTL_SUPPORT_BITS (8) + +struct ipm_selftest_rsp { + unsigned char code; + unsigned char test; +} __attribute__ ((packed)); + +#define IPM_SFT_CODE_OK 0x55 +#define IPM_SFT_CODE_NOT_IMPLEMENTED 0x56 +#define IPM_SFT_CODE_DEV_CORRUPTED 0x57 +#define IPM_SFT_CODE_FATAL_ERROR 0x58 +#define IPM_SFT_CODE_RESERVED 0xff + +#define IPM_SELFTEST_SEL_ERROR 0x80 +#define IPM_SELFTEST_SDR_ERROR 0x40 +#define IPM_SELFTEST_FRU_ERROR 0x20 +#define IPM_SELFTEST_IPMB_ERROR 0x10 +#define IPM_SELFTEST_SDRR_EMPTY 0x08 +#define IPM_SELFTEST_INTERNAL_USE 0x04 +#define IPM_SELFTEST_FW_BOOTBLOCK 0x02 +#define IPM_SELFTEST_FW_CORRUPTED 0x01 + +#endif /*IPMI_MC_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_oem.h b/lib/lanplus/inc/ipmitool/ipmi_oem.h new file mode 100644 index 0000000..ad22fde --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_oem.h @@ -0,0 +1,47 @@ +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_OEM_H +#define IPMI_OEM_H + +#include <ipmitool/ipmi.h> + +/* oem handler, see lib/ipmi_oem.c */ +struct ipmi_oem_handle { + const char * name; + const char * desc; + int (*setup)(struct ipmi_intf * intf); +}; + +void ipmi_oem_print(void); +int ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype); +int ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype); + +#endif /*IPMI_OEM_H*/ diff --git a/lib/lanplus/inc/ipmitool/ipmi_pef.h b/lib/lanplus/inc/ipmitool/ipmi_pef.h new file mode 100644 index 0000000..904a2ac --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_pef.h @@ -0,0 +1,784 @@ +/* + * Copyright (c) 2004 Dell Computers. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Dell Computers, or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * DELL COMPUTERS ("DELL") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * DELL OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF DELL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_PEF_H +#define IPMI_PEF_H + +#include <ipmitool/ipmi.h> + +/* PEF */ + +struct pef_capabilities { /* "get pef capabilities" response */ + uint8_t version; + uint8_t actions; /* mapped by PEF_ACTION_xxx */ + uint8_t tblsize; +}; + +typedef enum { + P_TRUE, + P_SUPP, + P_ACTV, + P_ABLE, +} flg_e; + +struct pef_table_entry { +#define PEF_CONFIG_ENABLED 0x80 +#define PEF_CONFIG_PRECONFIGURED 0x40 + uint8_t config; +#define PEF_ACTION_DIAGNOSTIC_INTERRUPT 0x20 +#define PEF_ACTION_OEM 0x10 +#define PEF_ACTION_POWER_CYCLE 0x08 +#define PEF_ACTION_RESET 0x04 +#define PEF_ACTION_POWER_DOWN 0x02 +#define PEF_ACTION_ALERT 0x01 + uint8_t action; +#define PEF_POLICY_NUMBER_MASK 0x0f + uint8_t policy_number; +#define PEF_SEVERITY_NON_RECOVERABLE 0x20 +#define PEF_SEVERITY_CRITICAL 0x10 +#define PEF_SEVERITY_WARNING 0x08 +#define PEF_SEVERITY_OK 0x04 +#define PEF_SEVERITY_INFORMATION 0x02 +#define PEF_SEVERITY_MONITOR 0x01 + uint8_t severity; + uint8_t generator_ID_addr; + uint8_t generator_ID_lun; + uint8_t sensor_type; +#define PEF_SENSOR_NUMBER_MATCH_ANY 0xff + uint8_t sensor_number; +#define PEF_EVENT_TRIGGER_UNSPECIFIED 0x0 +#define PEF_EVENT_TRIGGER_THRESHOLD 0x1 +#define PEF_EVENT_TRIGGER_SENSOR_SPECIFIC 0x6f +#define PEF_EVENT_TRIGGER_MATCH_ANY 0xff + uint8_t event_trigger; + uint8_t event_data_1_offset_mask[2]; + uint8_t event_data_1_AND_mask; + uint8_t event_data_1_compare_1; + uint8_t event_data_1_compare_2; + uint8_t event_data_2_AND_mask; + uint8_t event_data_2_compare_1; + uint8_t event_data_2_compare_2; + uint8_t event_data_3_AND_mask; + uint8_t event_data_3_compare_1; + uint8_t event_data_3_compare_2; +} __attribute__ ((packed)); + +struct desc_map { /* maps a description to a value/mask */ + const char *desc; + uint32_t mask; +}; + +struct bit_desc_map { /* description text container */ +#define BIT_DESC_MAP_LIST 0x1 /* index-based text array */ +#define BIT_DESC_MAP_ANY 0x2 /* bitwise, but only print 1st one */ +#define BIT_DESC_MAP_ALL 0x3 /* bitwise, print them all */ + uint32_t desc_map_type; + struct desc_map desc_maps[128]; +}; + +static struct bit_desc_map +pef_b2s_actions __attribute__((unused)) = { +BIT_DESC_MAP_ALL, +{ {"Alert", PEF_ACTION_ALERT}, + {"Power-off", PEF_ACTION_POWER_DOWN}, + {"Reset", PEF_ACTION_RESET}, + {"Power-cycle", PEF_ACTION_POWER_CYCLE}, + {"OEM-defined", PEF_ACTION_OEM}, + {"Diagnostic-interrupt", PEF_ACTION_DIAGNOSTIC_INTERRUPT}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_severities __attribute__((unused)) = { +BIT_DESC_MAP_ANY, +{ {"Non-recoverable", PEF_SEVERITY_NON_RECOVERABLE}, + {"Critical", PEF_SEVERITY_CRITICAL}, + {"Warning", PEF_SEVERITY_WARNING}, + {"OK", PEF_SEVERITY_OK}, + {"Information", PEF_SEVERITY_INFORMATION}, + {"Monitor", PEF_SEVERITY_MONITOR}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_sensortypes __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"Any", 255}, + {"Temperature", 1}, + {"Voltage", 2}, + {"Current", 3}, + {"Fan", 4}, + {"Chassis Intrusion", 5}, + {"Platform security breach", 6}, + {"Processor", 7}, + {"Power supply", 8}, + {"Power Unit", 9}, + {"Cooling device", 10}, + {"Other (units-based)", 11}, + {"Memory", 12}, + {"Drive Slot", 13}, + {"POST memory resize", 14}, + {"POST error", 15}, + {"Logging disabled", 16}, + {"Watchdog 1", 17}, + {"System event", 18}, + {"Critical Interrupt", 19}, + {"Button", 20}, + {"Module/board", 21}, + {"uController/coprocessor", 22}, + {"Add-in card", 23}, + {"Chassis", 24}, + {"Chipset", 25}, + {"Other (FRU)", 26}, + {"Cable/interconnect", 27}, + {"Terminator", 28}, + {"System boot", 29}, + {"Boot error", 30}, + {"OS boot", 31}, + {"OS critical stop", 32}, + {"Slot/connector", 33}, + {"ACPI power state", 34}, + {"Watchdog 2", 35}, + {"Platform alert", 36}, + {"Entity presence", 37}, + {"Monitor ASIC/IC", 38}, + {"LAN", 39}, + {"Management subsytem health",40}, + {"Battery", 41}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_1 = { +BIT_DESC_MAP_LIST, +{ {"<LNC", 0}, /* '<' : getting worse */ + {">LNC", 1}, /* '>' : getting better */ + {"<LC", 2}, + {">LC", 3}, + {"<LNR", 4}, + {">LNR", 5}, + {">UNC", 6}, + {"<UNC", 7}, + {">UC", 8}, + {"<UC", 9}, + {">UNR", 10}, + {"<UNR", 11}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_2 = { +BIT_DESC_MAP_LIST, +{ {"transition to idle", 0}, + {"transition to active", 1}, + {"transition to busy", 2}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_3 = { +BIT_DESC_MAP_LIST, +{ {"state deasserted", 0}, + {"state asserted", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_4 = { +BIT_DESC_MAP_LIST, +{ {"predictive failure deasserted", 0}, + {"predictive failure asserted", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_5 = { +BIT_DESC_MAP_LIST, +{ {"limit not exceeded", 0}, + {"limit exceeded", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_6 = { +BIT_DESC_MAP_LIST, +{ {"performance met", 0}, + {"performance lags", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_7 = { +BIT_DESC_MAP_LIST, +{ {"ok", 0}, + {"<warn", 1}, /* '<' : getting worse */ + {"<fail", 2}, + {"<dead", 3}, + {">warn", 4}, /* '>' : getting better */ + {">fail", 5}, + {"dead", 6}, + {"monitor", 7}, + {"informational", 8}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_8 = { +BIT_DESC_MAP_LIST, +{ {"device removed/absent", 0}, + {"device inserted/present", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_9 = { +BIT_DESC_MAP_LIST, +{ {"device disabled", 0}, + {"device enabled", 1}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_10 = { +BIT_DESC_MAP_LIST, +{ {"transition to running", 0}, + {"transition to in test", 1}, + {"transition to power off", 2}, + {"transition to online", 3}, + {"transition to offline", 4}, + {"transition to off duty", 5}, + {"transition to degraded", 6}, + {"transition to power save", 7}, + {"install error", 8}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_11 = { +BIT_DESC_MAP_LIST, +{ {"fully redundant", 0}, + {"redundancy lost", 1}, + {"redundancy degraded", 2}, + {"<non-redundant/sufficient", 3}, /* '<' : getting worse */ + {">non-redundant/sufficient", 4}, /* '>' : getting better */ + {"non-redundant/insufficient", 5}, + {"<redundancy degraded", 6}, + {">redundancy degraded", 7}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_gentype_12 = { +BIT_DESC_MAP_LIST, +{ {"D0 power state", 0}, + {"D1 power state", 1}, + {"D2 power state", 2}, + {"D3 power state", 3}, + {NULL} +} }; + +static struct bit_desc_map * +pef_b2s_generic_ER[] __attribute__((unused)) = { + &pef_b2s_gentype_1, + &pef_b2s_gentype_2, + &pef_b2s_gentype_3, + &pef_b2s_gentype_4, + &pef_b2s_gentype_5, + &pef_b2s_gentype_6, + &pef_b2s_gentype_7, + &pef_b2s_gentype_8, + &pef_b2s_gentype_9, + &pef_b2s_gentype_10, + &pef_b2s_gentype_11, + &pef_b2s_gentype_12, +}; +#define PEF_B2S_GENERIC_ER_ENTRIES \ + (sizeof(pef_b2s_generic_ER) / sizeof(pef_b2s_generic_ER[0])) + +struct pef_policy_entry { +#define PEF_POLICY_ID_MASK 0xf0 +#define PEF_POLICY_ID_SHIFT 4 +#define PEF_POLICY_ENABLED 0x08 +#define PEF_POLICY_FLAGS_MASK 0x07 +#define PEF_POLICY_FLAGS_MATCH_ALWAYS 0 +#define PEF_POLICY_FLAGS_PREV_OK_SKIP 1 +#define PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET 2 +#define PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET 3 +#define PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET 4 + uint8_t policy; +#define PEF_POLICY_CHANNEL_MASK 0xf0 +#define PEF_POLICY_CHANNEL_SHIFT 4 +#define PEF_POLICY_DESTINATION_MASK 0x0f + uint8_t chan_dest; +#define PEF_POLICY_EVENT_SPECIFIC 0x80 + uint8_t alert_string_key; +} __attribute__ ((packed)); + +static struct bit_desc_map +pef_b2s_policies __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"Match-always", PEF_POLICY_FLAGS_MATCH_ALWAYS}, + {"Try-next-entry", PEF_POLICY_FLAGS_PREV_OK_SKIP}, + {"Try-next-set", PEF_POLICY_FLAGS_PREV_OK_NEXT_POLICY_SET}, + {"Try-next-channel", PEF_POLICY_FLAGS_PREV_OK_NEXT_CHANNEL_IN_SET}, + {"Try-next-destination", PEF_POLICY_FLAGS_PREV_OK_NEXT_DESTINATION_IN_SET}, + {NULL} +} }; + +static struct bit_desc_map +pef_b2s_ch_medium __attribute__((unused)) = { +#define PEF_CH_MEDIUM_TYPE_IPMB 1 +#define PEF_CH_MEDIUM_TYPE_ICMB_10 2 +#define PEF_CH_MEDIUM_TYPE_ICMB_09 3 +#define PEF_CH_MEDIUM_TYPE_LAN 4 +#define PEF_CH_MEDIUM_TYPE_SERIAL 5 +#define PEF_CH_MEDIUM_TYPE_XLAN 6 +#define PEF_CH_MEDIUM_TYPE_PCI_SMBUS 7 +#define PEF_CH_MEDIUM_TYPE_SMBUS_V1X 8 +#define PEF_CH_MEDIUM_TYPE_SMBUS_V2X 9 +#define PEF_CH_MEDIUM_TYPE_USB_V1X 10 +#define PEF_CH_MEDIUM_TYPE_USB_V2X 11 +#define PEF_CH_MEDIUM_TYPE_SYSTEM 12 +BIT_DESC_MAP_LIST, +{ {"IPMB (I2C)", PEF_CH_MEDIUM_TYPE_IPMB}, + {"ICMB v1.0", PEF_CH_MEDIUM_TYPE_ICMB_10}, + {"ICMB v0.9", PEF_CH_MEDIUM_TYPE_ICMB_09}, + {"802.3 LAN", PEF_CH_MEDIUM_TYPE_LAN}, + {"Serial/Modem (RS-232)", PEF_CH_MEDIUM_TYPE_SERIAL}, + {"Other LAN", PEF_CH_MEDIUM_TYPE_XLAN}, + {"PCI SMBus", PEF_CH_MEDIUM_TYPE_PCI_SMBUS}, + {"SMBus v1.0/1.1", PEF_CH_MEDIUM_TYPE_SMBUS_V1X}, + {"SMBus v2.0", PEF_CH_MEDIUM_TYPE_SMBUS_V2X}, + {"USB 1.x", PEF_CH_MEDIUM_TYPE_USB_V1X}, + {"USB 2.x", PEF_CH_MEDIUM_TYPE_USB_V2X}, + {"System I/F (KCS,SMIC,BT)", PEF_CH_MEDIUM_TYPE_SYSTEM}, + {NULL} +} }; + +struct pef_cfgparm_selector { +#define PEF_CFGPARM_ID_REVISION_ONLY_MASK 0x80 +#define PEF_CFGPARM_ID_SET_IN_PROGRESS 0 +#define PEF_CFGPARM_ID_PEF_CONTROL 1 +#define PEF_CFGPARM_ID_PEF_ACTION 2 +#define PEF_CFGPARM_ID_PEF_STARTUP_DELAY 3 +#define PEF_CFGPARM_ID_PEF_ALERT_STARTUP_DELAY 4 +#define PEF_CFGPARM_ID_PEF_FILTER_TABLE_SIZE 5 +#define PEF_CFGPARM_ID_PEF_FILTER_TABLE_ENTRY 6 +#define PEF_CFGPARM_ID_PEF_FILTER_TABLE_DATA_1 7 +#define PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_SIZE 8 +#define PEF_CFGPARM_ID_PEF_ALERT_POLICY_TABLE_ENTRY 9 +#define PEF_CFGPARM_ID_SYSTEM_GUID 10 +#define PEF_CFGPARM_ID_PEF_ALERT_STRING_TABLE_SIZE 11 +#define PEF_CFGPARM_ID_PEF_ALERT_STRING_KEY 12 +#define PEF_CFGPARM_ID_PEF_ALERT_STRING_TABLE_ENTRY 13 + uint8_t id; + uint8_t set; + uint8_t block; +} __attribute__ ((packed)); + +struct pef_cfgparm_set_in_progress { +#define PEF_SET_IN_PROGRESS_COMMIT_WRITE 0x02 +#define PEF_SET_IN_PROGRESS 0x01 + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_cfgparm_control { +#define PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY 0x08 +#define PEF_CONTROL_ENABLE_STARTUP_DELAY 0x04 +#define PEF_CONTROL_ENABLE_EVENT_MESSAGES 0x02 +#define PEF_CONTROL_ENABLE 0x01 + uint8_t data1; +} __attribute__ ((packed)); + +static struct bit_desc_map +pef_b2s_control __attribute__((unused)) = { +BIT_DESC_MAP_ALL, +{ {"PEF", PEF_CONTROL_ENABLE}, + {"PEF event messages", PEF_CONTROL_ENABLE_EVENT_MESSAGES}, + {"PEF startup delay", PEF_CONTROL_ENABLE_STARTUP_DELAY}, + {"Alert startup delay", PEF_CONTROL_ENABLE_ALERT_STARTUP_DELAY}, + {NULL} +} }; + +struct pef_cfgparm_action { +#define PEF_ACTION_ENABLE_DIAGNOSTIC_INTERRUPT 0x20 +#define PEF_ACTION_ENABLE_OEM 0x10 +#define PEF_ACTION_ENABLE_POWER_CYCLE 0x08 +#define PEF_ACTION_ENABLE_RESET 0x04 +#define PEF_ACTION_ENABLE_POWER_DOWN 0x02 +#define PEF_ACTION_ENABLE_ALERT 0x01 + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_cfgparm_startup_delay { + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_cfgparm_alert_startup_delay { + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_cfgparm_filter_table_size { +#define PEF_FILTER_TABLE_SIZE_MASK 0x7f + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_cfgparm_filter_table_entry { +#define PEF_FILTER_TABLE_ID_MASK 0x7f + uint8_t data1; + struct pef_table_entry entry; +} __attribute__ ((packed)); + +struct pef_cfgparm_filter_table_data_1 { + uint8_t data1; + uint8_t data2; +} __attribute__ ((packed)); + +struct pef_cfgparm_policy_table_size { +#define PEF_POLICY_TABLE_SIZE_MASK 0x7f + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_cfgparm_policy_table_entry { +#define PEF_POLICY_TABLE_ID_MASK 0x7f + uint8_t data1; + struct pef_policy_entry entry; +} __attribute__ ((packed)); + +struct pef_cfgparm_system_guid { +#define PEF_SYSTEM_GUID_USED_IN_PET 0x01 + uint8_t data1; + uint8_t guid[16]; +} __attribute__ ((packed)); + +struct pef_cfgparm_alert_string_table_size { +#define PEF_ALERT_STRING_TABLE_SIZE_MASK 0x7f + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_cfgparm_alert_string_keys { +#define PEF_ALERT_STRING_ID_MASK 0x7f + uint8_t data1; +#define PEF_EVENT_FILTER_ID_MASK 0x7f + uint8_t data2; +#define PEF_ALERT_STRING_SET_ID_MASK 0x7f + uint8_t data3; +} __attribute__ ((packed)); + +struct pef_cfgparm_alert_string_table_entry { + uint8_t id; + uint8_t blockno; + uint8_t block[16]; +} __attribute__ ((packed)); + +/* PEF - LAN */ + +struct pef_lan_cfgparm_selector { +#define PEF_LAN_CFGPARM_CH_REVISION_ONLY_MASK 0x80 +#define PEF_LAN_CFGPARM_CH_MASK 0x0f +#define PEF_LAN_CFGPARM_ID_PET_COMMUNITY 16 +#define PEF_LAN_CFGPARM_ID_DEST_COUNT 17 +#define PEF_LAN_CFGPARM_ID_DESTTYPE 18 +#define PEF_LAN_CFGPARM_ID_DESTADDR 19 + uint8_t ch; + uint8_t id; + uint8_t set; + uint8_t block; +} __attribute__ ((packed)); + +struct pef_lan_cfgparm_dest_size { +#define PEF_LAN_DEST_TABLE_SIZE_MASK 0x0f + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_lan_cfgparm_dest_type { +#define PEF_LAN_DEST_TYPE_ID_MASK 0x0f + uint8_t dest; +#define PEF_LAN_DEST_TYPE_ACK 0x80 +#define PEF_LAN_DEST_TYPE_MASK 0x07 +#define PEF_LAN_DEST_TYPE_PET 0 +#define PEF_LAN_DEST_TYPE_OEM_1 6 +#define PEF_LAN_DEST_TYPE_OEM_2 7 + uint8_t dest_type; + uint8_t alert_timeout; +#define PEF_LAN_RETRIES_MASK 0x07 + uint8_t retries; +} __attribute__ ((packed)); + +static struct bit_desc_map +pef_b2s_lan_desttype __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"Acknowledged", PEF_LAN_DEST_TYPE_ACK}, + {"PET", PEF_LAN_DEST_TYPE_PET}, + {"OEM 1", PEF_LAN_DEST_TYPE_OEM_1}, + {"OEM 2", PEF_LAN_DEST_TYPE_OEM_2}, + {NULL} +} }; + +struct pef_lan_cfgparm_dest_info { +#define PEF_LAN_DEST_MASK 0x0f + uint8_t dest; +#define PEF_LAN_DEST_ADDRTYPE_MASK 0xf0 +#define PEF_LAN_DEST_ADDRTYPE_SHIFT 4 +#define PEF_LAN_DEST_ADDRTYPE_IPV4_MAC 0x00 + uint8_t addr_type; +#define PEF_LAN_DEST_GATEWAY_USE_BACKUP 0x01 + uint8_t gateway; + uint8_t ip[4]; + uint8_t mac[6]; +} __attribute__ ((packed)); + +/* PEF - Serial/PPP */ + +struct pef_serial_cfgparm_selector { +#define PEF_SERIAL_CFGPARM_CH_REVISION_ONLY_MASK 0x80 +#define PEF_SERIAL_CFGPARM_CH_MASK 0x0f +#define PEF_SERIAL_CFGPARM_ID_DEST_COUNT 16 +#define PEF_SERIAL_CFGPARM_ID_DESTINFO 17 +#define PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING_COUNT 20 +#define PEF_SERIAL_CFGPARM_ID_DEST_DIAL_STRING 21 +#define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_COUNT 24 +#define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_INFO 25 +#define PEF_SERIAL_CFGPARM_ID_TAP_ACCT_PAGER_STRING 27 + uint8_t ch; + uint8_t id; + uint8_t set; + uint8_t block; +} __attribute__ ((packed)); + +struct pef_serial_cfgparm_dest_size { +#define PEF_SERIAL_DEST_TABLE_SIZE_MASK 0x0f + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_serial_cfgparm_dest_info { +#define PEF_SERIAL_DEST_MASK 0x0f + uint8_t dest; +#define PEF_SERIAL_DEST_TYPE_ACK 0x80 +#define PEF_SERIAL_DEST_TYPE_MASK 0x0f +#define PEF_SERIAL_DEST_TYPE_DIAL 0 +#define PEF_SERIAL_DEST_TYPE_TAP 1 +#define PEF_SERIAL_DEST_TYPE_PPP 2 +#define PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK 3 +#define PEF_SERIAL_DEST_TYPE_PPP_CALLBACK 4 +#define PEF_SERIAL_DEST_TYPE_OEM_1 14 +#define PEF_SERIAL_DEST_TYPE_OEM_2 15 + uint8_t dest_type; + uint8_t alert_timeout; +#define PEF_SERIAL_RETRIES_MASK 0x77 +#define PEF_SERIAL_RETRIES_POST_CONNECT_MASK 0x70 +#define PEF_SERIAL_RETRIES_PRE_CONNECT_MASK 0x07 + uint8_t retries; +#define PEF_SERIAL_DIALPAGE_STRING_ID_MASK 0xf0 +#define PEF_SERIAL_DIALPAGE_STRING_ID_SHIFT 4 +#define PEF_SERIAL_TAP_PAGE_SERVICE_ID_MASK 0x0f +#define PEF_SERIAL_PPP_ACCT_IPADDR_ID_MASK 0xf0 +#define PEF_SERIAL_PPP_ACCT_IPADDR_ID_SHIFT 4 +#define PEF_SERIAL_PPP_ACCT_ID_MASK 0x0f +#define PEF_SERIAL_CALLBACK_IPADDR_ID_MASK 0x0f +#define PEF_SERIAL_CALLBACK_IPADDR_ID_SHIFT 4 +#define PEF_SERIAL_CALLBACK_ACCT_ID_MASK 0xf0 + uint8_t data5; +} __attribute__ ((packed)); + +static struct bit_desc_map +pef_b2s_serial_desttype __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"Acknowledged", PEF_SERIAL_DEST_TYPE_ACK}, + {"TAP page", PEF_SERIAL_DEST_TYPE_TAP}, + {"PPP PET", PEF_SERIAL_DEST_TYPE_PPP}, + {"Basic callback", PEF_SERIAL_DEST_TYPE_BASIC_CALLBACK}, + {"PPP callback", PEF_SERIAL_DEST_TYPE_PPP_CALLBACK}, + {"OEM 1", PEF_SERIAL_DEST_TYPE_OEM_1}, + {"OEM 2", PEF_SERIAL_DEST_TYPE_OEM_2}, + {NULL} +} }; + +struct pef_serial_cfgparm_dial_string_count { +#define PEF_SERIAL_DIAL_STRING_COUNT_MASK 0x0f + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_serial_cfgparm_dial_string { +#define PEF_SERIAL_DIAL_STRING_MASK 0x0f + uint8_t data1; + uint8_t data2; + uint8_t data3; +} __attribute__ ((packed)); + +struct pef_serial_cfgparm_tap_acct_count { +#define PEF_SERIAL_TAP_ACCT_COUNT_MASK 0x0f + uint8_t data1; +} __attribute__ ((packed)); + +struct pef_serial_cfgparm_tap_acct_info { + uint8_t data1; +#define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_MASK 0xf0 +#define PEF_SERIAL_TAP_ACCT_INFO_DIAL_STRING_ID_SHIFT 4 +#define PEF_SERIAL_TAP_ACCT_INFO_SVC_SETTINGS_ID_MASK 0x0f + uint8_t data2; +} __attribute__ ((packed)); + +struct pef_serial_cfgparm_tap_svc_settings { + uint8_t data1; +#define PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX 0x0 +#define PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX 0x01 +#define PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX 0x02 + uint8_t confirmation_flags; + uint8_t service_type[3]; + uint8_t escape_mask[4]; + uint8_t timeout_parms[3]; + uint8_t retry_parms[2]; +} __attribute__ ((packed)); + +static struct bit_desc_map +pef_b2s_tap_svc_confirm __attribute__((unused)) = { +BIT_DESC_MAP_LIST, +{ {"ACK", PEF_SERIAL_TAP_CONFIRMATION_ACK_AFTER_ETX}, + {"211+ACK", PEF_SERIAL_TAP_CONFIRMATION_211_ACK_AFTER_ETX}, + {"{211|213}+ACK", PEF_SERIAL_TAP_CONFIRMATION_21X_ACK_AFTER_ETX}, + {NULL} +} }; + +#if 0 /* FYI : config parm groupings */ + struct pef_config_parms { /* PEF */ + struct pef_cfgparm_set_in_progress; + struct pef_cfgparm_control; + struct pef_cfgparm_action; + struct pef_cfgparm_startup_delay; /* in seconds, 1-based */ + struct pef_cfgparm_alert_startup_delay; /* in seconds, 1-based */ + struct pef_cfgparm_filter_table_size; /* 1-based, READ-ONLY */ + struct pef_cfgparm_filter_table_entry; + struct pef_cfgparm_filter_table_data_1; + struct pef_cfgparm_policy_table_size; + struct pef_cfgparm_policy_table_entry; + struct pef_cfgparm_system_guid; + struct pef_cfgparm_alert_string_table_size; + struct pef_cfgparm_alert_string_keys; + struct pef_cfgparm_alert_string_table_entry; + } __attribute__ ((packed)); + + struct pef_lan_config_parms { /* LAN */ + struct pef_lan_cfgparm_set_in_progress; + struct pef_lan_cfgparm_auth_capabilities; + struct pef_lan_cfgparm_auth_type; + struct pef_lan_cfgparm_ip_address; + struct pef_lan_cfgparm_ip_address_source; + struct pef_lan_cfgparm_mac_address; + struct pef_lan_cfgparm_subnet_mask; + struct pef_lan_cfgparm_ipv4_header_parms; + struct pef_lan_cfgparm_primary_rmcp_port; + struct pef_lan_cfgparm_secondary_rmcp_port; + struct pef_lan_cfgparm_bmc_generated_arp_control; + struct pef_lan_cfgparm_gratuitous_arp; + struct pef_lan_cfgparm_default_gateway_ipaddr; + struct pef_lan_cfgparm_default_gateway_macaddr; + struct pef_lan_cfgparm_backup_gateway_ipaddr; + struct pef_lan_cfgparm_backup_gateway_macaddr; + struct pef_lan_cfgparm_pet_community; + struct pef_lan_cfgparm_destination_count; + struct pef_lan_cfgparm_destination_type; + struct pef_lan_cfgparm_destination_ipaddr; + } __attribute__ ((packed)); + + struct pef_serial_config_parms { /* Serial/PPP */ + struct pef_serial_cfgparm_set_in_progress; + struct pef_serial_cfgparm_auth_capabilities; + struct pef_serial_cfgparm_auth_type; + struct pef_serial_cfgparm_connection_mode; + struct pef_serial_cfgparm_idle_timeout; + struct pef_serial_cfgparm_callback_control; + struct pef_serial_cfgparm_session_termination; + struct pef_serial_cfgparm_ipmi_settings; + struct pef_serial_cfgparm_mux_control; + struct pef_serial_cfgparm_modem_ring_time; + struct pef_serial_cfgparm_modem_init_string; + struct pef_serial_cfgparm_modem_escape_sequence; + struct pef_serial_cfgparm_modem_hangup_sequence; + struct pef_serial_cfgparm_modem_dial_command; + struct pef_serial_cfgparm_page_blackout_interval; + struct pef_serial_cfgparm_pet_community; + struct pef_serial_cfgparm_destination_count; + struct pef_serial_cfgparm_destination_info; + struct pef_serial_cfgparm_call_retry_interval; + struct pef_serial_cfgparm_destination_settings; + struct pef_serial_cfgparm_dialstring_count; + struct pef_serial_cfgparm_dialstring_info; + struct pef_serial_cfgparm_ipaddr_count; + struct pef_serial_cfgparm_ipaddr_info; + struct pef_serial_cfgparm_tap_acct_count; + struct pef_serial_cfgparm_tap_acct_info; + struct pef_serial_cfgparm_tap_acct_passwords; /* WRITE only */ + struct pef_serial_cfgparm_tap_pager_id_strings; + struct pef_serial_cfgparm_tap_service_settings; + struct pef_serial_cfgparm_terminal_mode_config; + struct pef_serial_cfgparm_ppp_otions; + struct pef_serial_cfgparm_ppp_primary_rmcp_port; + struct pef_serial_cfgparm_ppp_secondary_rmcp_port; + struct pef_serial_cfgparm_ppp_link_auth; + struct pef_serial_cfgparm_ppp_chap_name; + struct pef_serial_cfgparm_ppp_accm; + struct pef_serial_cfgparm_ppp_snoop_accm; + struct pef_serial_cfgparm_ppp_acct_count; + struct pef_serial_cfgparm_ppp_acct_dialstring_selector; + struct pef_serial_cfgparm_ppp_acct_ipaddrs; + struct pef_serial_cfgparm_ppp_acct_user_names; + struct pef_serial_cfgparm_ppp_acct_user_domains; + struct pef_serial_cfgparm_ppp_acct_user_passwords; /* WRITE only */ + struct pef_serial_cfgparm_ppp_acct_auth_settings; + struct pef_serial_cfgparm_ppp_acct_connect_hold_times; + struct pef_serial_cfgparm_ppp_udp_proxy_ipheader; + struct pef_serial_cfgparm_ppp_udp_proxy_xmit_bufsize; + struct pef_serial_cfgparm_ppp_udp_proxy_recv_bufsize; + struct pef_serial_cfgparm_ppp_remote_console_ipaddr; + } __attribute__ ((packed)); +#endif + +#define IPMI_CMD_GET_PEF_CAPABILITIES 0x10 +#define IPMI_CMD_GET_PEF_CONFIG_PARMS 0x13 +#define IPMI_CMD_GET_LAST_PROCESSED_EVT_ID 0x15 +#define IPMI_CMD_GET_SYSTEM_GUID 0x37 +#define IPMI_CMD_GET_CHANNEL_INFO 0x42 +#define IPMI_CMD_LAN_GET_CONFIG 0x02 +#define IPMI_CMD_SERIAL_GET_CONFIG 0x11 + +const char * ipmi_pef_bit_desc(struct bit_desc_map * map, uint32_t val); +void ipmi_pef_print_flags(struct bit_desc_map * map, flg_e type, uint32_t val); +void ipmi_pef_print_dec(const char * text, uint32_t val); +void ipmi_pef_print_hex(const char * text, uint32_t val); +void ipmi_pef_print_1xd(const char * text, uint32_t val); +void ipmi_pef_print_2xd(const char * text, uint8_t u1, uint8_t u2); +void ipmi_pef_print_str(const char * text, const char * val); + +int ipmi_pef_main(struct ipmi_intf * intf, int argc, char ** argv); + +#endif /* IPMI_PEF_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_picmg.h b/lib/lanplus/inc/ipmitool/ipmi_picmg.h new file mode 100644 index 0000000..ab234e4 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_picmg.h @@ -0,0 +1,90 @@ + +/* + (C) Kontron +*/ + +#ifndef _IPMI_PICMG_H_ +#define _IPMI_PICMG_H_ + +#include <ipmitool/ipmi.h> + +/* PICMG commands */ +#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00 +#define PICMG_GET_ADDRESS_INFO_CMD 0x01 +#define PICMG_GET_SHELF_ADDRESS_INFO_CMD 0x02 +#define PICMG_SET_SHELF_ADDRESS_INFO_CMD 0x03 +#define PICMG_FRU_CONTROL_CMD 0x04 +#define PICMG_GET_FRU_LED_PROPERTIES_CMD 0x05 +#define PICMG_GET_LED_COLOR_CAPABILITIES_CMD 0x06 +#define PICMG_SET_FRU_LED_STATE_CMD 0x07 +#define PICMG_GET_FRU_LED_STATE_CMD 0x08 +#define PICMG_SET_IPMB_CMD 0x09 +#define PICMG_SET_FRU_POLICY_CMD 0x0A +#define PICMG_GET_FRU_POLICY_CMD 0x0B +#define PICMG_FRU_ACTIVATION_CMD 0x0C +#define PICMG_GET_DEVICE_LOCATOR_RECORD_CMD 0x0D +#define PICMG_SET_PORT_STATE_CMD 0x0E +#define PICMG_GET_PORT_STATE_CMD 0x0F +#define PICMG_COMPUTE_POWER_PROPERTIES_CMD 0x10 +#define PICMG_SET_POWER_LEVEL_CMD 0x11 +#define PICMG_GET_POWER_LEVEL_CMD 0x12 +#define PICMG_RENEGOTIATE_POWER_CMD 0x13 +#define PICMG_GET_FAN_SPEED_PROPERTIES_CMD 0x14 +#define PICMG_SET_FAN_LEVEL_CMD 0x15 +#define PICMG_GET_FAN_LEVEL_CMD 0x16 +#define PICMG_BUSED_RESOURCE_CMD 0x17 + +/* AMC.0 commands */ +#define PICMG_AMC_SET_PORT_STATE_CMD 0x19 +#define PICMG_AMC_GET_PORT_STATE_CMD 0x1A + +/* Site Types */ +#define PICMG_ATCA_BOARD 0x00 +#define PICMG_POWER_ENTRY 0x01 +#define PICMG_SHELF_FRU 0x02 +#define PICMG_DEDICATED_SHMC 0x03 +#define PICMG_FAN_TRAY 0x04 +#define PICMG_FAN_FILTER_TRAY 0x05 +#define PICMG_ALARM 0x06 +#define PICMG_AMC 0x07 +#define PICMG_PMC 0x08 +#define PICMG_RTM 0x09 + + + +struct picmg_set_fru_activation_cmd { + unsigned char picmg_id; /* always 0*/ + unsigned char fru_id; /* threshold setting mask */ + unsigned char fru_state; /* fru activation/deactivation */ +} __attribute__ ((packed)); + + + +/* the LED color capabilities */ +static const char* led_color_str[] __attribute__((unused)) = { + "reserved", + "BLUE", + "RED", + "GREEN", + "AMBER", + "ORANGE", + "WHITE", + "reserved" +}; + + + +static const char* amc_link_type_str[] __attribute__((unused)) = { + " FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED", + " FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1", + " FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS", + " FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1", + " FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2", + " FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET", + " FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO", + " FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE", +}; + +int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv); + +#endif diff --git a/lib/lanplus/inc/ipmitool/ipmi_raw.h b/lib/lanplus/inc/ipmitool/ipmi_raw.h new file mode 100644 index 0000000..f4364f3 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_raw.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_RAW_H +#define IPMI_RAW_H + +#include <ipmitool/ipmi.h> + +int ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv); +struct ipmi_rs * ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, uint8_t addr, + uint8_t * wdata, uint8_t wsize, uint8_t rsize); +int ipmi_rawi2c_main(struct ipmi_intf * intf, int argc, char ** argv); +int ipmi_rawspd_main(struct ipmi_intf * intf, int argc, char ** argv); + +#endif /* IPMI_RAW_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_sdr.h b/lib/lanplus/inc/ipmitool/ipmi_sdr.h new file mode 100644 index 0000000..65b5a8c --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_sdr.h @@ -0,0 +1,876 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_SDR_H +#define IPMI_SDR_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#ifdef WIN32 +#include <inttypes-win.h> +#else +#include <inttypes.h> +#endif +#include <math.h> +#include <ipmitool/bswap.h> +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_entity.h> + +int ipmi_sdr_main(struct ipmi_intf *, int, char **); + +#define tos32(val, bits) ((val & ((1<<((bits)-1)))) ? (-((val) & (1<<((bits)-1))) | (val)) : (val)) + +#if WORDS_BIGENDIAN +# define __TO_TOL(mtol) (uint16_t)(mtol & 0x3f) +# define __TO_M(mtol) (int16_t)(tos32((((mtol & 0xff00) >> 8) | ((mtol & 0xc0) << 2)), 10)) +# define __TO_B(bacc) (int32_t)(tos32((((bacc & 0xff000000) >> 24) | ((bacc & 0xc00000) >> 14)), 10)) +# define __TO_ACC(bacc) (uint32_t)(((bacc & 0x3f0000) >> 16) | ((bacc & 0xf000) >> 6)) +# define __TO_ACC_EXP(bacc) (uint32_t)((bacc & 0xc00) >> 10) +# define __TO_R_EXP(bacc) (int32_t)(tos32(((bacc & 0xf0) >> 4), 4)) +# define __TO_B_EXP(bacc) (int32_t)(tos32((bacc & 0xf), 4)) +#else +# define __TO_TOL(mtol) (uint16_t)(BSWAP_16(mtol) & 0x3f) +# define __TO_M(mtol) (int16_t)(tos32((((BSWAP_16(mtol) & 0xff00) >> 8) | ((BSWAP_16(mtol) & 0xc0) << 2)), 10)) +# define __TO_B(bacc) (int32_t)(tos32((((BSWAP_32(bacc) & 0xff000000) >> 24) | \ + ((BSWAP_32(bacc) & 0xc00000) >> 14)), 10)) +# define __TO_ACC(bacc) (uint32_t)(((BSWAP_32(bacc) & 0x3f0000) >> 16) | ((BSWAP_32(bacc) & 0xf000) >> 6)) +# define __TO_ACC_EXP(bacc) (uint32_t)((BSWAP_32(bacc) & 0xc00) >> 10) +# define __TO_R_EXP(bacc) (int32_t)(tos32(((BSWAP_32(bacc) & 0xf0) >> 4), 4)) +# define __TO_B_EXP(bacc) (int32_t)(tos32((BSWAP_32(bacc) & 0xf), 4)) +#endif + +enum { + ANALOG_SENSOR, + DISCRETE_SENSOR, +}; + +#define READING_UNAVAILABLE 0x20 +#define SCANNING_DISABLED 0x40 +#define EVENT_MSG_DISABLED 0x80 + +#define IS_READING_UNAVAILABLE(val) ((val) & READING_UNAVAILABLE) +#define IS_SCANNING_DISABLED(val) (!((val) & SCANNING_DISABLED)) +#define IS_EVENT_MSG_DISABLED(val) (!((val) & EVENT_MSG_DISABLED)) + +#define GET_SDR_REPO_INFO 0x20 +#define GET_SDR_ALLOC_INFO 0x21 + +#define SDR_SENSOR_STAT_LO_NC (1<<0) +#define SDR_SENSOR_STAT_LO_CR (1<<1) +#define SDR_SENSOR_STAT_LO_NR (1<<2) +#define SDR_SENSOR_STAT_HI_NC (1<<3) +#define SDR_SENSOR_STAT_HI_CR (1<<4) +#define SDR_SENSOR_STAT_HI_NR (1<<5) + +#define GET_DEVICE_SDR_INFO 0x20 +#define GET_DEVICE_SDR 0x21 +#define GET_SENSOR_FACTORS 0x23 +#define GET_SENSOR_FACTORS 0x23 +#define SET_SENSOR_HYSTERESIS 0x24 +#define GET_SENSOR_HYSTERESIS 0x25 +#define SET_SENSOR_THRESHOLDS 0x26 +#define GET_SENSOR_THRESHOLDS 0x27 +#define SET_SENSOR_EVENT_ENABLE 0x28 +#define GET_SENSOR_EVENT_ENABLE 0x29 +#define GET_SENSOR_EVENT_STATUS 0x2b +#define GET_SENSOR_READING 0x2d +#define GET_SENSOR_TYPE 0x2f +#define GET_SENSOR_READING 0x2d +#define GET_SENSOR_TYPE 0x2f + +struct sdr_repo_info_rs { + uint8_t version; /* SDR version (51h) */ + uint16_t count; /* number of records */ + uint16_t free; /* free space in SDR */ + uint32_t add_stamp; /* last add timestamp */ + uint32_t erase_stamp; /* last del timestamp */ + uint8_t op_support; /* supported operations */ +} __attribute__ ((packed)); + +/* builtin (device) sdrs support */ +struct sdr_device_info_rs { + unsigned char count; /* number of records */ + unsigned char flags; /* flags */ + unsigned char popChangeInd[3]; /* free space in SDR */ +} __attribute__ ((packed)); + +#define GET_SDR_RESERVE_REPO 0x22 +struct sdr_reserve_repo_rs { + uint16_t reserve_id; /* reservation ID */ +} __attribute__ ((packed)); + +#define GET_SDR 0x23 +struct sdr_get_rq { + uint16_t reserve_id; /* reservation ID */ + uint16_t id; /* record ID */ + uint8_t offset; /* offset into SDR */ +#define GET_SDR_ENTIRE_RECORD 0xff + uint8_t length; /* length to read */ +} __attribute__ ((packed)); + +struct sdr_get_rs { + uint16_t next; /* next record id */ + uint16_t id; /* record ID */ + uint8_t version; /* SDR version (51h) */ +#define SDR_RECORD_TYPE_FULL_SENSOR 0x01 +#define SDR_RECORD_TYPE_COMPACT_SENSOR 0x02 +#define SDR_RECORD_TYPE_EVENTONLY_SENSOR 0x03 +#define SDR_RECORD_TYPE_ENTITY_ASSOC 0x08 +#define SDR_RECORD_TYPE_DEVICE_ENTITY_ASSOC 0x09 +#define SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR 0x10 +#define SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR 0x11 +#define SDR_RECORD_TYPE_MC_DEVICE_LOCATOR 0x12 +#define SDR_RECORD_TYPE_MC_CONFIRMATION 0x13 +#define SDR_RECORD_TYPE_BMC_MSG_CHANNEL_INFO 0x14 +#define SDR_RECORD_TYPE_OEM 0xc0 + uint8_t type; /* record type */ + uint8_t length; /* remaining record bytes */ +} __attribute__ ((packed)); + +struct sdr_record_mask { + union { + struct { + uint16_t assert_event; /* assertion event mask */ + uint16_t deassert_event; /* de-assertion event mask */ + uint16_t read; /* discrete reading mask */ + } discrete; + struct { +#if WORDS_BIGENDIAN + uint16_t reserved:1; + uint16_t status_lnr:1; + uint16_t status_lcr:1; + uint16_t status_lnc:1; + uint16_t assert_unr_high:1; + uint16_t assert_unr_low:1; + uint16_t assert_ucr_high:1; + uint16_t assert_ucr_low:1; + uint16_t assert_unc_high:1; + uint16_t assert_unc_low:1; + uint16_t assert_lnr_high:1; + uint16_t assert_lnr_low:1; + uint16_t assert_lcr_high:1; + uint16_t assert_lcr_low:1; + uint16_t assert_lnc_high:1; + uint16_t assert_lnc_low:1; +#else + uint16_t assert_lnc_low:1; + uint16_t assert_lnc_high:1; + uint16_t assert_lcr_low:1; + uint16_t assert_lcr_high:1; + uint16_t assert_lnr_low:1; + uint16_t assert_lnr_high:1; + uint16_t assert_unc_low:1; + uint16_t assert_unc_high:1; + uint16_t assert_ucr_low:1; + uint16_t assert_ucr_high:1; + uint16_t assert_unr_low:1; + uint16_t assert_unr_high:1; + uint16_t status_lnc:1; + uint16_t status_lcr:1; + uint16_t status_lnr:1; + uint16_t reserved:1; +#endif +#if WORDS_BIGENDIAN + uint16_t reserved_2:1; + uint16_t status_unr:1; + uint16_t status_ucr:1; + uint16_t status_unc:1; + uint16_t deassert_unr_high:1; + uint16_t deassert_unr_low:1; + uint16_t deassert_ucr_high:1; + uint16_t deassert_ucr_low:1; + uint16_t deassert_unc_high:1; + uint16_t deassert_unc_low:1; + uint16_t deassert_lnr_high:1; + uint16_t deassert_lnr_low:1; + uint16_t deassert_lcr_high:1; + uint16_t deassert_lcr_low:1; + uint16_t deassert_lnc_high:1; + uint16_t deassert_lnc_low:1; +#else + uint16_t deassert_lnc_low:1; + uint16_t deassert_lnc_high:1; + uint16_t deassert_lcr_low:1; + uint16_t deassert_lcr_high:1; + uint16_t deassert_lnr_low:1; + uint16_t deassert_lnr_high:1; + uint16_t deassert_unc_low:1; + uint16_t deassert_unc_high:1; + uint16_t deassert_ucr_low:1; + uint16_t deassert_ucr_high:1; + uint16_t deassert_unr_low:1; + uint16_t deassert_unr_high:1; + uint16_t status_unc:1; + uint16_t status_ucr:1; + uint16_t status_unr:1; + uint16_t reserved_2:1; +#endif + union { + struct { +#if WORDS_BIGENDIAN /* settable threshold mask */ + uint16_t reserved:2; + uint16_t unr:1; + uint16_t ucr:1; + uint16_t unc:1; + uint16_t lnr:1; + uint16_t lcr:1; + uint16_t lnc:1; + /* padding lower 8 bits */ + uint16_t readable:8; +#else + uint16_t readable:8; + uint16_t lnc:1; + uint16_t lcr:1; + uint16_t lnr:1; + uint16_t unc:1; + uint16_t ucr:1; + uint16_t unr:1; + uint16_t reserved:2; +#endif + } set; + struct { +#if WORDS_BIGENDIAN /* readable threshold mask */ + /* padding upper 8 bits */ + uint16_t settable:8; + uint16_t reserved:2; + uint16_t unr:1; + uint16_t ucr:1; + uint16_t unc:1; + uint16_t lnr:1; + uint16_t lcr:1; + uint16_t lnc:1; +#else + uint16_t lnc:1; + uint16_t lcr:1; + uint16_t lnr:1; + uint16_t unc:1; + uint16_t ucr:1; + uint16_t unr:1; + uint16_t reserved:2; + uint16_t settable:8; +#endif + } read; + }; + } threshold; + } type; +} __attribute__ ((packed)); + +struct sdr_record_compact_sensor { + struct { + uint8_t owner_id; +#if WORDS_BIGENDIAN + uint8_t channel:4; /* channel number */ + uint8_t __reserved1:2; + uint8_t lun:2; /* sensor owner lun */ +#else + uint8_t lun:2; /* sensor owner lun */ + uint8_t __reserved1:2; + uint8_t channel:4; /* channel number */ +#endif + uint8_t sensor_num; /* unique sensor number */ + } keys; + + struct entity_id entity; + + struct { + struct { +#if WORDS_BIGENDIAN + uint8_t __reserved2:1; + uint8_t scanning:1; + uint8_t events:1; + uint8_t thresholds:1; + uint8_t hysteresis:1; + uint8_t type:1; + uint8_t event_gen:1; + uint8_t sensor_scan:1; +#else + uint8_t sensor_scan:1; + uint8_t event_gen:1; + uint8_t type:1; + uint8_t hysteresis:1; + uint8_t thresholds:1; + uint8_t events:1; + uint8_t scanning:1; + uint8_t __reserved2:1; +#endif + } init; + struct { +#if WORDS_BIGENDIAN + uint8_t ignore:1; + uint8_t rearm:1; + uint8_t hysteresis:2; + uint8_t threshold:2; + uint8_t event_msg:2; +#else + uint8_t event_msg:2; + uint8_t threshold:2; + uint8_t hysteresis:2; + uint8_t rearm:1; + uint8_t ignore:1; +#endif + } capabilities; + uint8_t type; /* sensor type */ + } sensor; + + uint8_t event_type; /* event/reading type code */ + + struct sdr_record_mask mask; + + struct { +#if WORDS_BIGENDIAN + uint8_t analog:2; + uint8_t rate:3; + uint8_t modifier:2; + uint8_t pct:1; +#else + uint8_t pct:1; + uint8_t modifier:2; + uint8_t rate:3; + uint8_t analog:2; +#endif + struct { + uint8_t base; + uint8_t modifier; + } type; + } unit; + + struct { +#if WORDS_BIGENDIAN + uint8_t __reserved3:2; + uint8_t mod_type:2; + uint8_t count:4; +#else + uint8_t count:4; + uint8_t mod_type:2; + uint8_t __reserved3:2; +#endif +#if WORDS_BIGENDIAN + uint8_t entity_inst:1; + uint8_t mod_offset:7; +#else + uint8_t mod_offset:7; + uint8_t entity_inst:1; +#endif + } share; + + struct { + struct { + uint8_t positive; + uint8_t negative; + } hysteresis; + } threshold; + + uint8_t __reserved4[3]; + uint8_t oem; /* reserved for OEM use */ + uint8_t id_code; /* sensor ID string type/length code */ + uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ +} __attribute__ ((packed)); + +struct sdr_record_eventonly_sensor { + struct { + uint8_t owner_id; +#if WORDS_BIGENDIAN + uint8_t channel:4; /* channel number */ + uint8_t fru_owner:2; /* fru device owner lun */ + uint8_t lun:2; /* sensor owner lun */ +#else + uint8_t lun:2; /* sensor owner lun */ + uint8_t fru_owner:2; /* fru device owner lun */ + uint8_t channel:4; /* channel number */ +#endif + uint8_t sensor_num; /* unique sensor number */ + } keys; + + struct entity_id entity; + + uint8_t sensor_type; /* sensor type */ + uint8_t event_type; /* event/reading type code */ + + struct { +#if WORDS_BIGENDIAN + uint8_t __reserved1:2; + uint8_t mod_type:2; + uint8_t count:4; +#else + uint8_t count:4; + uint8_t mod_type:2; + uint8_t __reserved1:2; +#endif +#if WORDS_BIGENDIAN + uint8_t entity_inst:1; + uint8_t mod_offset:7; +#else + uint8_t mod_offset:7; + uint8_t entity_inst:1; +#endif + } share; + + uint8_t __reserved4; + uint8_t oem; /* reserved for OEM use */ + uint8_t id_code; /* sensor ID string type/length code */ + uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ + +} __attribute__ ((packed)); + +struct sdr_record_full_sensor { + struct { + uint8_t owner_id; +#if WORDS_BIGENDIAN + uint8_t channel:4; /* channel number */ + uint8_t __reserved1:2; + uint8_t lun:2; /* sensor owner lun */ +#else + uint8_t lun:2; /* sensor owner lun */ + uint8_t __reserved1:2; + uint8_t channel:4; /* channel number */ +#endif + uint8_t sensor_num; /* unique sensor number */ + } keys; + + struct entity_id entity; + + struct { + struct { +#if WORDS_BIGENDIAN + uint8_t __reserved2:1; + uint8_t scanning:1; + uint8_t events:1; + uint8_t thresholds:1; + uint8_t hysteresis:1; + uint8_t type:1; + uint8_t event_gen:1; + uint8_t sensor_scan:1; +#else + uint8_t sensor_scan:1; + uint8_t event_gen:1; + uint8_t type:1; + uint8_t hysteresis:1; + uint8_t thresholds:1; + uint8_t events:1; + uint8_t scanning:1; + uint8_t __reserved2:1; +#endif + } init; + struct { +#if WORDS_BIGENDIAN + uint8_t ignore:1; + uint8_t rearm:1; + uint8_t hysteresis:2; + uint8_t threshold:2; + uint8_t event_msg:2; +#else + uint8_t event_msg:2; + uint8_t threshold:2; + uint8_t hysteresis:2; + uint8_t rearm:1; + uint8_t ignore:1; +#endif + } capabilities; + uint8_t type; + } sensor; + + uint8_t event_type; /* event/reading type code */ + + struct sdr_record_mask mask; + + struct { +#if WORDS_BIGENDIAN + uint8_t analog:2; + uint8_t rate:3; + uint8_t modifier:2; + uint8_t pct:1; +#else + uint8_t pct:1; + uint8_t modifier:2; + uint8_t rate:3; + uint8_t analog:2; +#endif + struct { + uint8_t base; + uint8_t modifier; + } type; + } unit; + +#define SDR_SENSOR_L_LINEAR 0x00 +#define SDR_SENSOR_L_LN 0x01 +#define SDR_SENSOR_L_LOG10 0x02 +#define SDR_SENSOR_L_LOG2 0x03 +#define SDR_SENSOR_L_E 0x04 +#define SDR_SENSOR_L_EXP10 0x05 +#define SDR_SENSOR_L_EXP2 0x06 +#define SDR_SENSOR_L_1_X 0x07 +#define SDR_SENSOR_L_SQR 0x08 +#define SDR_SENSOR_L_CUBE 0x09 +#define SDR_SENSOR_L_SQRT 0x0a +#define SDR_SENSOR_L_CUBERT 0x0b +#define SDR_SENSOR_L_NONLINEAR 0x70 + + uint8_t linearization; /* 70h=non linear, 71h-7Fh=non linear, OEM */ + uint16_t mtol; /* M, tolerance */ + uint32_t bacc; /* accuracy, B, Bexp, Rexp */ + + struct { +#if WORDS_BIGENDIAN + uint8_t __reserved3:5; + uint8_t normal_min:1; /* normal min field specified */ + uint8_t normal_max:1; /* normal max field specified */ + uint8_t nominal_read:1; /* nominal reading field specified */ +#else + uint8_t nominal_read:1; /* nominal reading field specified */ + uint8_t normal_max:1; /* normal max field specified */ + uint8_t normal_min:1; /* normal min field specified */ + uint8_t __reserved3:5; +#endif + } analog_flag; + + uint8_t nominal_read; /* nominal reading, raw value */ + uint8_t normal_max; /* normal maximum, raw value */ + uint8_t normal_min; /* normal minimum, raw value */ + uint8_t sensor_max; /* sensor maximum, raw value */ + uint8_t sensor_min; /* sensor minimum, raw value */ + + struct { + struct { + uint8_t non_recover; + uint8_t critical; + uint8_t non_critical; + } upper; + struct { + uint8_t non_recover; + uint8_t critical; + uint8_t non_critical; + } lower; + struct { + uint8_t positive; + uint8_t negative; + } hysteresis; + } threshold; + uint8_t __reserved4[2]; + uint8_t oem; /* reserved for OEM use */ + uint8_t id_code; /* sensor ID string type/length code */ + uint8_t id_string[16]; /* sensor ID string bytes, only if id_code != 0 */ +} __attribute__ ((packed)); + +struct sdr_record_mc_locator { + uint8_t dev_slave_addr; +#if WORDS_BIGENDIAN + uint8_t __reserved2:4; + uint8_t channel_num:4; +#else + uint8_t channel_num:4; + uint8_t __reserved2:4; +#endif +#if WORDS_BIGENDIAN + uint8_t pwr_state_notif:3; + uint8_t __reserved3:1; + uint8_t global_init:4; +#else + uint8_t global_init:4; + uint8_t __reserved3:1; + uint8_t pwr_state_notif:3; +#endif + uint8_t dev_support; + uint8_t __reserved4[3]; + struct entity_id entity; + uint8_t oem; + uint8_t id_code; + uint8_t id_string[16]; +} __attribute__ ((packed)); + +struct sdr_record_fru_locator { + uint8_t dev_slave_addr; + uint8_t device_id; +#if WORDS_BIGENDIAN + uint8_t logical:1; + uint8_t __reserved2:2; + uint8_t lun:2; + uint8_t bus:3; +#else + uint8_t bus:3; + uint8_t lun:2; + uint8_t __reserved2:2; + uint8_t logical:1; +#endif +#if WORDS_BIGENDIAN + uint8_t channel_num:4; + uint8_t __reserved3:4; +#else + uint8_t __reserved3:4; + uint8_t channel_num:4; +#endif + uint8_t __reserved4; + uint8_t dev_type; + uint8_t dev_type_modifier; + struct entity_id entity; + uint8_t oem; + uint8_t id_code; + uint8_t id_string[16]; +} __attribute__ ((packed)); + +struct sdr_record_generic_locator { + uint8_t dev_access_addr; + uint8_t dev_slave_addr; +#if WORDS_BIGENDIAN + uint8_t channel_num:3; + uint8_t lun:2; + uint8_t bus:3; +#else + uint8_t bus:3; + uint8_t lun:2; + uint8_t channel_num:3; +#endif +#if WORDS_BIGENDIAN + uint8_t addr_span:3; + uint8_t __reserved1:5; +#else + uint8_t __reserved1:5; + uint8_t addr_span:3; +#endif + uint8_t __reserved2; + uint8_t dev_type; + uint8_t dev_type_modifier; + struct entity_id entity; + uint8_t oem; + uint8_t id_code; + uint8_t id_string[16]; +} __attribute__ ((packed)); + +struct sdr_record_entity_assoc { + struct entity_id entity; /* container entity ID and instance */ + struct { +#if WORDS_BIGENDIAN + uint8_t isrange:1; + uint8_t islinked:1; + uint8_t isaccessable:1; + uint8_t __reserved1:5; +#else + uint8_t __reserved1:5; + uint8_t isaccessable:1; + uint8_t islinked:1; + uint8_t isrange:1; +#endif + } flags; + uint8_t entity_id_1; /* entity ID 1 | range 1 entity */ + uint8_t entity_inst_1; /* entity inst 1 | range 1 first instance */ + uint8_t entity_id_2; /* entity ID 2 | range 1 entity */ + uint8_t entity_inst_2; /* entity inst 2 | range 1 last instance */ + uint8_t entity_id_3; /* entity ID 3 | range 2 entity */ + uint8_t entity_inst_3; /* entity inst 3 | range 2 first instance */ + uint8_t entity_id_4; /* entity ID 4 | range 2 entity */ + uint8_t entity_inst_4; /* entity inst 4 | range 2 last instance */ +} __attribute__ ((packed)); + +struct sdr_record_oem { + uint8_t *data; + int data_len; +}; + +/* + * The Get SDR Repository Info response structure + * From table 33-3 of the IPMI v2.0 spec + */ +struct get_sdr_repository_info_rsp { + uint8_t sdr_version; + uint8_t record_count_lsb; + uint8_t record_count_msb; + uint8_t free_space[2]; + uint8_t most_recent_addition_timestamp[4]; + uint8_t most_recent_erase_timestamp[4]; +#if WORDS_BIGENDIAN + uint8_t overflow_flag:1; + uint8_t modal_update_support:2; + uint8_t __reserved1:1; + uint8_t delete_sdr_supported:1; + uint8_t partial_add_sdr_supported:1; + uint8_t reserve_sdr_repository_supported:1; + uint8_t get_sdr_repository_allo_info_supported:1; +#else + uint8_t get_sdr_repository_allo_info_supported:1; + uint8_t reserve_sdr_repository_supported:1; + uint8_t partial_add_sdr_supported:1; + uint8_t delete_sdr_supported:1; + uint8_t __reserved1:1; + uint8_t modal_update_support:2; + uint8_t overflow_flag:1; +#endif +} __attribute__ ((packed)); + +struct ipmi_sdr_iterator { + uint16_t reservation; + int total; + int next; +}; + +struct sdr_record_list { + uint16_t id; + uint8_t version; + uint8_t type; + uint8_t length; + uint8_t *raw; + struct sdr_record_list *next; + union { + struct sdr_record_full_sensor *full; + struct sdr_record_compact_sensor *compact; + struct sdr_record_eventonly_sensor *eventonly; + struct sdr_record_generic_locator *genloc; + struct sdr_record_fru_locator *fruloc; + struct sdr_record_mc_locator *mcloc; + struct sdr_record_entity_assoc *entassoc; + struct sdr_record_oem *oem; + } record; +}; + +/* unit description codes (IPMI v1.5 section 37.16) */ +#define UNIT_MAX 0x90 +static const char *unit_desc[] __attribute__ ((unused)) = { +"unspecified", + "degrees C", "degrees F", "degrees K", + "Volts", "Amps", "Watts", "Joules", + "Coulombs", "VA", "Nits", + "lumen", "lux", "Candela", + "kPa", "PSI", "Newton", + "CFM", "RPM", "Hz", + "microsecond", "millisecond", "second", "minute", "hour", + "day", "week", "mil", "inches", "feet", "cu in", "cu feet", + "mm", "cm", "m", "cu cm", "cu m", "liters", "fluid ounce", + "radians", "steradians", "revolutions", "cycles", + "gravities", "ounce", "pound", "ft-lb", "oz-in", "gauss", + "gilberts", "henry", "millihenry", "farad", "microfarad", + "ohms", "siemens", "mole", "becquerel", "PPM", "reserved", + "Decibels", "DbA", "DbC", "gray", "sievert", + "color temp deg K", "bit", "kilobit", "megabit", "gigabit", + "byte", "kilobyte", "megabyte", "gigabyte", "word", "dword", + "qword", "line", "hit", "miss", "retry", "reset", + "overflow", "underrun", "collision", "packets", "messages", + "characters", "error", "correctable error", "uncorrectable error",}; + +/* sensor type codes (IPMI v1.5 table 36.3) + / Updated to v2.0 Table 42-3, Sensor Type Codes */ +#define SENSOR_TYPE_MAX 0x2C +static const char *sensor_type_desc[] __attribute__ ((unused)) = { +"reserved", + "Temperature", "Voltage", "Current", "Fan", + "Physical Security", "Platform Security", "Processor", + "Power Supply", "Power Unit", "Cooling Device", "Other", + "Memory", "Drive Slot / Bay", "POST Memory Resize", + "System Firmwares", "Event Logging Disabled", "Watchdog", + "System Event", "Critical Interrupt", "Button", + "Module / Board", "Microcontroller", "Add-in Card", + "Chassis", "Chip Set", "Other FRU", "Cable / Interconnect", + "Terminator", "System Boot Initiated", "Boot Error", + "OS Boot", "OS Critical Stop", "Slot / Connector", + "System ACPI Power State", "Watchdog", "Platform Alert", + "Entity Presence", "Monitor ASIC", "LAN", + "Management Subsystem Health", "Battery","Session Audit", + "Version Change","FRU State" }; + +struct ipmi_sdr_iterator *ipmi_sdr_start(struct ipmi_intf *intf); +struct sdr_get_rs *ipmi_sdr_get_next_header(struct ipmi_intf *intf, + struct ipmi_sdr_iterator *i); +uint8_t *ipmi_sdr_get_record(struct ipmi_intf *intf, struct sdr_get_rs *header, + struct ipmi_sdr_iterator *i); +void ipmi_sdr_end(struct ipmi_intf *intf, struct ipmi_sdr_iterator *i); +int ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type); +int ipmi_sdr_print_rawentry(struct ipmi_intf *intf, uint8_t type, uint8_t * raw, + int len); +int ipmi_sdr_print_listentry(struct ipmi_intf *intf, + struct sdr_record_list *entry); +char *ipmi_sdr_get_unit_string(uint8_t type, uint8_t base, uint8_t modifier); +const char *ipmi_sdr_get_status(struct sdr_record_full_sensor *sensor, + uint8_t stat); +double sdr_convert_sensor_tolerance(struct sdr_record_full_sensor *sensor, + uint8_t val); +double sdr_convert_sensor_reading(struct sdr_record_full_sensor *sensor, + uint8_t val); +double sdr_convert_sensor_hysterisis(struct sdr_record_full_sensor *sensor, + uint8_t val); +uint8_t sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor *sensor, + double val); +struct ipmi_rs *ipmi_sdr_get_sensor_reading(struct ipmi_intf *intf, + uint8_t sensor); +struct ipmi_rs *ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf, + uint8_t sensor, + uint8_t target, + uint8_t lun); +struct ipmi_rs *ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf, + uint8_t sensor); +struct ipmi_rs *ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf, + uint8_t sensor); +const char *ipmi_sdr_get_sensor_type_desc(const uint8_t type); +int ipmi_sdr_get_reservation(struct ipmi_intf *intf, uint16_t * reserve_id); + +int ipmi_sdr_print_sensor_full(struct ipmi_intf *intf, + struct sdr_record_full_sensor *sensor); +int ipmi_sdr_print_sensor_compact(struct ipmi_intf *intf, + struct sdr_record_compact_sensor *sensor); +int ipmi_sdr_print_sensor_eventonly(struct ipmi_intf *intf, + struct sdr_record_eventonly_sensor *sensor); +int ipmi_sdr_print_sensor_generic_locator(struct ipmi_intf *intf, + struct sdr_record_generic_locator + *fru); +int ipmi_sdr_print_sensor_fru_locator(struct ipmi_intf *intf, + struct sdr_record_fru_locator *fru); +int ipmi_sdr_print_sensor_mc_locator(struct ipmi_intf *intf, + struct sdr_record_mc_locator *mc); +int ipmi_sdr_print_sensor_entity_assoc(struct ipmi_intf *intf, + struct sdr_record_entity_assoc *assoc); + +struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf, + struct entity_id *entity); +struct sdr_record_list *ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, + uint8_t num, uint8_t type); +struct sdr_record_list *ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf *intf, + uint8_t type); +struct sdr_record_list *ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, + char *id); +struct sdr_record_list *ipmi_sdr_find_sdr_bytype(struct ipmi_intf *intf, + uint8_t type); +int ipmi_sdr_list_cache(struct ipmi_intf *intf); +int ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile); +void ipmi_sdr_list_empty(struct ipmi_intf *intf); +int ipmi_sdr_print_info(struct ipmi_intf *intf); +void ipmi_sdr_print_discrete_state(const char *desc, uint8_t sensor_type, + uint8_t event_type, uint8_t state1, + uint8_t state2); +void ipmi_sdr_print_discrete_state_mini(const char *separator, + uint8_t sensor_type, uint8_t event_type, + uint8_t state1, uint8_t state2); +int ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf, + uint8_t sensor_num, uint8_t sensor_type, + uint8_t event_type, int numeric_fmt); +int ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf, + uint8_t sensor_num, uint8_t sensor_type, + uint8_t event_type, int numeric_fmt); + +#endif /* IPMI_SDR_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_sel.h b/lib/lanplus/inc/ipmitool/ipmi_sel.h new file mode 100644 index 0000000..e4ce1d3 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_sel.h @@ -0,0 +1,542 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_SEL_H +#define IPMI_SEL_H + +#ifdef WIN32 +#include <inttypes-win.h> +#else +#include <inttypes.h> +#endif +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_sdr.h> + +#define IPMI_CMD_GET_SEL_INFO 0x40 +#define IPMI_CMD_GET_SEL_ALLOC_INFO 0x41 +#define IPMI_CMD_RESERVE_SEL 0x42 +#define IPMI_CMD_GET_SEL_ENTRY 0x43 +#define IPMI_CMD_ADD_SEL_ENTRY 0x44 +#define IPMI_CMD_PARTIAL_ADD_SEL_ENTRY 0x45 +#define IPMI_CMD_DELETE_SEL_ENTRY 0x46 +#define IPMI_CMD_CLEAR_SEL 0x47 +#define IPMI_CMD_GET_SEL_TIME 0x48 +#define IPMI_CMD_SET_SEL_TIME 0x49 +#define IPMI_CMD_GET_AUX_LOG_STATUS 0x5A +#define IPMI_CMD_SET_AUX_LOG_STATUS 0x5B + +enum { + IPMI_EVENT_CLASS_DISCRETE, + IPMI_EVENT_CLASS_DIGITAL, + IPMI_EVENT_CLASS_THRESHOLD, + IPMI_EVENT_CLASS_OEM, +}; + +struct sel_get_rq { + uint16_t reserve_id; + uint16_t record_id; + uint8_t offset; + uint8_t length; +} __attribute__ ((packed)); + +struct standard_spec_sel_rec{ + uint32_t timestamp; + uint16_t gen_id; + uint8_t evm_rev; + uint8_t sensor_type; + uint8_t sensor_num; +#if WORDS_BIGENDIAN + uint8_t event_dir : 1; + uint8_t event_type : 7; +#else + uint8_t event_type : 7; + uint8_t event_dir : 1; +#endif +#define DATA_BYTE2_SPECIFIED_MASK 0xc0 /* event_data[0] bit mask */ +#define DATA_BYTE3_SPECIFIED_MASK 0x30 /* event_data[0] bit mask */ +#define EVENT_OFFSET_MASK 0x0f /* event_data[0] bit mask */ + uint8_t event_data[3]; +}; + +#define SEL_OEM_TS_DATA_LEN 6 +#define SEL_OEM_NOTS_DATA_LEN 13 +struct oem_ts_spec_sel_rec{ + uint32_t timestamp; + uint8_t manf_id[3]; + uint8_t oem_defined[SEL_OEM_TS_DATA_LEN]; +}; + +struct oem_nots_spec_sel_rec{ + uint8_t oem_defined[SEL_OEM_NOTS_DATA_LEN]; +}; + +struct sel_event_record { + uint16_t record_id; + uint8_t record_type; + union{ + struct standard_spec_sel_rec standard_type; + struct oem_ts_spec_sel_rec oem_ts_type; + struct oem_nots_spec_sel_rec oem_nots_type; + } sel_type; +} __attribute__ ((packed)); + +struct ipmi_event_sensor_types { + uint8_t code; + uint8_t offset; +#define ALL_OFFSETS_SPECIFIED 0xff + uint8_t data; + uint8_t class; + const char * type; + const char * desc; +}; + +static struct ipmi_event_sensor_types generic_event_types[] __attribute__((unused)) = { + /* Threshold Based States */ + { 0x01, 0x00, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical going low " }, + { 0x01, 0x01, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-critical going high" }, + { 0x01, 0x02, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical going low " }, + { 0x01, 0x03, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Critical going high" }, + { 0x01, 0x04, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable going low " }, + { 0x01, 0x05, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Lower Non-recoverable going high" }, + { 0x01, 0x06, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical going low " }, + { 0x01, 0x07, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-critical going high" }, + { 0x01, 0x08, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical going low " }, + { 0x01, 0x09, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Critical going high" }, + { 0x01, 0x0a, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable going low " }, + { 0x01, 0x0b, 0xff, IPMI_EVENT_CLASS_THRESHOLD, "Threshold", "Upper Non-recoverable going high" }, + /* DMI-based "usage state" States */ + { 0x02, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Idle" }, + { 0x02, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Active" }, + { 0x02, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Usage State", "Transition to Busy" }, + /* Digital-Discrete Event States */ + { 0x03, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "State Deasserted" }, + { 0x03, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "State Asserted" }, + { 0x04, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Predictive Failure Deasserted" }, + { 0x04, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Predictive Failure Asserted" }, + { 0x05, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Limit Not Exceeded" }, + { 0x05, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Limit Exceeded" }, + { 0x06, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Performance Met" }, + { 0x06, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Digital State", "Performance Lags" }, + /* Severity Event States */ + { 0x07, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to OK" }, + { 0x07, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critical from OK" }, + { 0x07, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Critical from less severe" }, + { 0x07, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-recoverable from less severe" }, + { 0x07, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-critical from more severe" }, + { 0x07, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Critical from Non-recoverable" }, + { 0x07, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Transition to Non-recoverable" }, + { 0x07, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Monitor" }, + { 0x07, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Severity State", "Informational" }, + /* Availability Status States */ + { 0x08, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Absent" }, + { 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Present" }, + { 0x09, 0x00, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Disabled" }, + { 0x09, 0x01, 0xff, IPMI_EVENT_CLASS_DIGITAL, "Availability State", "Device Enabled" }, + { 0x0a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Running" }, + { 0x0a, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to In Test" }, + { 0x0a, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Power Off" }, + { 0x0a, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to On Line" }, + { 0x0a, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Off Line" }, + { 0x0a, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Off Duty" }, + { 0x0a, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Degraded" }, + { 0x0a, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Transition to Power Save" }, + { 0x0a, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Availability State", "Install Error" }, + /* Redundancy States */ + { 0x0b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Fully Redundant" }, + { 0x0b, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Lost" }, + { 0x0b, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded" }, + { 0x0b, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Sufficient from Redundant" }, + { 0x0b, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Sufficient from Insufficient" }, + { 0x0b, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Non-Redundant: Insufficient Resources" }, + { 0x0b, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded from Fully Redundant" }, + { 0x0b, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Redundancy State", "Redundancy Degraded from Non-Redundant" }, + /* ACPI Device Power States */ + { 0x0c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D0 Power State" }, + { 0x0c, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D1 Power State" }, + { 0x0c, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D2 Power State" }, + { 0x0c, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "ACPI Device Power State", "D3 Power State" }, + /* END */ + { 0x00, 0x00, 0xff, 0x00, NULL, NULL }, +}; + +static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unused)) = { + { 0x00, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Reserved", NULL }, + { 0x01, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Temperature", NULL }, + { 0x02, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Voltage", NULL }, + { 0x03, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Current", NULL }, + { 0x04, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Fan", NULL }, + + { 0x05, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "General Chassis intrusion" }, + { 0x05, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Drive Bay intrusion" }, + { 0x05, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "I/O Card area intrusion" }, + { 0x05, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Processor area intrusion" }, + { 0x05, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "System unplugged from LAN" }, + { 0x05, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "Unauthorized dock" }, + { 0x05, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Physical Security", "FAN area intrusion" }, + + { 0x06, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Front Panel Lockout violation attempted" }, + { 0x06, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - user password" }, + { 0x06, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - setup password" }, + { 0x06, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Pre-boot password violation - network boot password" }, + { 0x06, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Other pre-boot password violation" }, + { 0x06, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Security", "Out-of-band access password violation" }, + + { 0x07, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "IERR" }, + { 0x07, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Thermal Trip" }, + { 0x07, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB1/BIST failure" }, + { 0x07, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB2/Hang in POST failure" }, + { 0x07, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "FRB3/Processor startup/init failure" }, + { 0x07, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Configuration Error" }, + { 0x07, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "SM BIOS Uncorrectable CPU-complex Error" }, + { 0x07, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Presence detected" }, + { 0x07, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Disabled" }, + { 0x07, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Terminator presence detected" }, + { 0x07, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Processor", "Throttled" }, + + { 0x08, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Presence detected" }, + { 0x08, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Failure detected" }, + { 0x08, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Predictive failure" }, + { 0x08, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Power Supply AC lost" }, + { 0x08, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "AC lost or out-of-range" }, + { 0x08, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "AC out-of-range, but present" }, + { 0x08, 0x06, 0x00, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Vendor Mismatch" }, + { 0x08, 0x06, 0x01, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Revision Mismatch" }, + { 0x08, 0x06, 0x02, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error: Processor Missing" }, + { 0x08, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Supply", "Config Error" }, + + { 0x09, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power off/down" }, + { 0x09, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Power cycle" }, + { 0x09, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "240VA power down" }, + { 0x09, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Interlock power down" }, + { 0x09, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "AC lost" }, + { 0x09, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Soft-power control failure" }, + { 0x09, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Failure detected" }, + { 0x09, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Power Unit", "Predictive failure" }, + + { 0x0a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cooling Device", NULL }, + { 0x0b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Other Units-based Sensor", NULL }, + + { 0x0c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Correctable ECC" }, + { 0x0c, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Uncorrectable ECC" }, + { 0x0c, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Parity" }, + { 0x0c, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Scrub Failed" }, + { 0x0c, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Memory Device Disabled" }, + { 0x0c, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Correctable ECC logging limit reached" }, + { 0x0c, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Presence Detected" }, + { 0x0c, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Configuration Error" }, + { 0x0c, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Spare" }, + { 0x0c, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Memory", "Throttled" }, + + { 0x0d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Present" }, + { 0x0d, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Drive Fault" }, + { 0x0d, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Predictive Failure" }, + { 0x0d, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Hot Spare" }, + { 0x0d, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Parity Check In Progress" }, + { 0x0d, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "In Critical Array" }, + { 0x0d, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "In Failed Array" }, + { 0x0d, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Rebuild In Progress" }, + { 0x0d, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Drive Slot", "Rebuild Aborted" }, + + { 0x0e, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "POST Memory Resize", NULL }, + + { 0x0f, 0x00, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unspecified" }, + { 0x0f, 0x00, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "No system memory installed" }, + { 0x0f, 0x00, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "No usable system memory" }, + { 0x0f, 0x00, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable IDE device failure" }, + { 0x0f, 0x00, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable system-board failure" }, + { 0x0f, 0x00, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable diskette failure" }, + { 0x0f, 0x00, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable hard-disk controller failure" }, + { 0x0f, 0x00, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable PS/2 or USB keyboard failure" }, + { 0x0f, 0x00, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Removable boot media not found" }, + { 0x0f, 0x00, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unrecoverable video controller failure" }, + { 0x0f, 0x00, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "No video device selected" }, + { 0x0f, 0x00, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "BIOS corruption detected" }, + { 0x0f, 0x00, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "CPU voltage mismatch" }, + { 0x0f, 0x00, 0x0d, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "CPU speed mismatch failure" }, + { 0x0f, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Error", "Unknown Error" }, + + { 0x0f, 0x01, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Unspecified" }, + { 0x0f, 0x01, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Memory initialization" }, + { 0x0f, 0x01, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Hard-disk initialization" }, + { 0x0f, 0x01, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Secondary CPU Initialization" }, + { 0x0f, 0x01, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "User authentication" }, + { 0x0f, 0x01, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "User-initiated system setup" }, + { 0x0f, 0x01, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "USB resource configuration" }, + { 0x0f, 0x01, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "PCI resource configuration" }, + { 0x0f, 0x01, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Option ROM initialization" }, + { 0x0f, 0x01, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Video initialization" }, + { 0x0f, 0x01, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Cache initialization" }, + { 0x0f, 0x01, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "SMBus initialization" }, + { 0x0f, 0x01, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Keyboard controller initialization" }, + { 0x0f, 0x01, 0x0d, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Management controller initialization" }, + { 0x0f, 0x01, 0x0e, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Docking station attachment" }, + { 0x0f, 0x01, 0x0f, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Enabling docking station" }, + { 0x0f, 0x01, 0x10, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Docking station ejection" }, + { 0x0f, 0x01, 0x11, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Disabling docking station" }, + { 0x0f, 0x01, 0x12, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Calling operating system wake-up vector" }, + { 0x0f, 0x01, 0x13, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "System boot initiated" }, + { 0x0f, 0x01, 0x14, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Motherboard initialization" }, + { 0x0f, 0x01, 0x15, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "reserved" }, + { 0x0f, 0x01, 0x16, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Floppy initialization" }, + { 0x0f, 0x01, 0x17, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Keyboard test" }, + { 0x0f, 0x01, 0x18, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Pointing device test" }, + { 0x0f, 0x01, 0x19, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Primary CPU initialization" }, + { 0x0f, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Hang", "Unknown Hang" }, + + { 0x0f, 0x02, 0x00, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Unspecified" }, + { 0x0f, 0x02, 0x01, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Memory initialization" }, + { 0x0f, 0x02, 0x02, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Hard-disk initialization" }, + { 0x0f, 0x02, 0x03, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Secondary CPU Initialization" }, + { 0x0f, 0x02, 0x04, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "User authentication" }, + { 0x0f, 0x02, 0x05, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "User-initiated system setup" }, + { 0x0f, 0x02, 0x06, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "USB resource configuration" }, + { 0x0f, 0x02, 0x07, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "PCI resource configuration" }, + { 0x0f, 0x02, 0x08, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Option ROM initialization" }, + { 0x0f, 0x02, 0x09, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Video initialization" }, + { 0x0f, 0x02, 0x0a, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Cache initialization" }, + { 0x0f, 0x02, 0x0b, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "SMBus initialization" }, + { 0x0f, 0x02, 0x0c, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Keyboard controller initialization" }, + { 0x0f, 0x02, 0x0d, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Management controller initialization" }, + { 0x0f, 0x02, 0x0e, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Docking station attachment" }, + { 0x0f, 0x02, 0x0f, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Enabling docking station" }, + { 0x0f, 0x02, 0x10, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Docking station ejection" }, + { 0x0f, 0x02, 0x11, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Disabling docking station" }, + { 0x0f, 0x02, 0x12, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Calling operating system wake-up vector" }, + { 0x0f, 0x02, 0x13, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "System boot initiated" }, + { 0x0f, 0x02, 0x14, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Motherboard initialization" }, + { 0x0f, 0x02, 0x15, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "reserved" }, + { 0x0f, 0x02, 0x16, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Floppy initialization" }, + { 0x0f, 0x02, 0x17, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Keyboard test" }, + { 0x0f, 0x02, 0x18, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Pointing device test" }, + { 0x0f, 0x02, 0x19, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Primary CPU initialization" }, + { 0x0f, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Firmware Progress", "Unknown Progress" }, + + { 0x10, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Correctable memory error logging disabled" }, + { 0x10, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Event logging disabled" }, + { 0x10, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log area reset/cleared" }, + { 0x10, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "All event logging disabled" }, + { 0x10, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log full" }, + { 0x10, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Event Logging Disabled", "Log almost full" }, + + { 0x11, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "BIOS Reset" }, + { 0x11, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Reset" }, + { 0x11, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Shut Down" }, + { 0x11, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Down" }, + { 0x11, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Power Cycle" }, + { 0x11, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS NMI/Diag Interrupt" }, + { 0x11, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS Expired" }, + { 0x11, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 1", "OS pre-timeout Interrupt" }, + + { 0x12, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "System Reconfigured" }, + { 0x12, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "OEM System boot event" }, + { 0x12, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Undetermined system hardware failure" }, + { 0x12, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Entry added to auxiliary log" }, + { 0x12, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "PEF Action" }, + { 0x12, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Event", "Timestamp Clock Sync" }, + + { 0x13, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "NMI/Diag Interrupt" }, + { 0x13, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Timeout" }, + { 0x13, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "I/O Channel check NMI" }, + { 0x13, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Software NMI" }, + { 0x13, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "PCI PERR" }, + { 0x13, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "PCI SERR" }, + { 0x13, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "EISA failsafe timeout" }, + { 0x13, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Correctable error" }, + { 0x13, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Uncorrectable error" }, + { 0x13, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Fatal NMI" }, + { 0x13, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Critical Interrupt", "Bus Fatal Error" }, + + { 0x14, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Power Button pressed" }, + { 0x14, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Sleep Button pressed" }, + { 0x14, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "Reset Button pressed" }, + { 0x14, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "FRU Latch" }, + { 0x14, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Button", "FRU Service" }, + + { 0x15, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module/Board", NULL }, + { 0x16, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Microcontroller/Coprocessor", NULL }, + { 0x17, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Add-in Card", NULL }, + { 0x18, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chassis", NULL }, + { 0x19, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Chip Set", NULL }, + { 0x1a, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Other FRU", NULL }, + + { 0x1b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", "Connected" }, + { 0x1b, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Cable/Interconnect", "Config Error" }, + + { 0x1c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Terminator", NULL }, + + { 0x1d, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by power up" }, + { 0x1d, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by hard reset" }, + { 0x1d, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Initiated by warm reset" }, + { 0x1d, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "User requested PXE boot" }, + { 0x1d, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "Automatic boot to diagnostic" }, + { 0x1d, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "OS initiated hard reset" }, + { 0x1d, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "OS initiated warm reset" }, + { 0x1d, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System Boot Initiated", "System Restart" }, + + { 0x1e, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "No bootable media" }, + { 0x1e, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Non-bootable disk in drive" }, + { 0x1e, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "PXE server not found" }, + { 0x1e, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Invalid boot sector" }, + { 0x1e, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Boot Error", "Timeout waiting for selection" }, + + { 0x1f, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "A: boot completed" }, + { 0x1f, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "C: boot completed" }, + { 0x1f, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "PXE boot completed" }, + { 0x1f, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "Diagnostic boot completed" }, + { 0x1f, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "CD-ROM boot completed" }, + { 0x1f, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "ROM boot completed" }, + { 0x1f, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Boot", "boot completed - device not specified" }, + + { 0x20, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Error during system startup" }, + { 0x20, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Run-time critical stop" }, + { 0x20, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "OS graceful stop" }, + { 0x20, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "OS graceful shutdown" }, + { 0x20, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "PEF initiated soft shutdown" }, + { 0x20, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "OS Stop/Shutdown", "Agent not responding" }, + + { 0x21, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Fault Status" }, + { 0x21, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Identify Status" }, + { 0x21, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Device Installed" }, + { 0x21, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Ready for Device Installation" }, + { 0x21, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Ready for Device Removal" }, + { 0x21, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot Power is Off" }, + { 0x21, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Device Removal Request" }, + { 0x21, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Interlock" }, + { 0x21, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Slot is Disabled" }, + { 0x21, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Slot/Connector", "Spare Device" }, + + { 0x22, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S0/G0: working" }, + { 0x22, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S1: sleeping with system hw & processor context maintained" }, + { 0x22, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S2: sleeping, processor context lost" }, + { 0x22, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S3: sleeping, processor & hw context lost, memory retained" }, + { 0x22, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S4: non-volatile sleep/suspend-to-disk" }, + { 0x22, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S5/G2: soft-off" }, + { 0x22, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S4/S5: soft-off" }, + { 0x22, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "G3: mechanical off" }, + { 0x22, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Sleeping in S1/S2/S3 state" }, + { 0x22, 0x09, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "G1: sleeping" }, + { 0x22, 0x0a, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "S5: entered by override" }, + { 0x22, 0x0b, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Legacy ON state" }, + { 0x22, 0x0c, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Legacy OFF state" }, + { 0x22, 0x0e, 0xff, IPMI_EVENT_CLASS_DISCRETE, "System ACPI Power State", "Unknown" }, + + { 0x23, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Timer expired" }, + { 0x23, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Hard reset" }, + { 0x23, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Power down" }, + { 0x23, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Power cycle" }, + { 0x23, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" }, + { 0x23, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" }, + { 0x23, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" }, + { 0x23, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "reserved" }, + { 0x23, 0x08, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Watchdog 2", "Timer interrupt" }, + + { 0x24, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated page" }, + { 0x24, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated LAN alert" }, + { 0x24, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform Event Trap generated" }, + { 0x24, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Platform Alert", "Platform generated SNMP trap, OEM format" }, + + { 0x25, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Present" }, + { 0x25, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Absent" }, + { 0x25, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Entity Presence", "Disabled" }, + + { 0x26, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Monitor ASIC/IC", NULL }, + + { 0x27, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "LAN", "Heartbeat Lost" }, + { 0x27, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "LAN", "Heartbeat" }, + + { 0x28, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Sensor access degraded or unavailable" }, + { 0x28, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Controller access degraded or unavailable" }, + { 0x28, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Management controller off-line" }, + { 0x28, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Management controller unavailable" }, + { 0x28, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "Sensor failure" }, + { 0x28, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Management Subsystem Health", "FRU failure" }, + + { 0x29, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Low" }, + { 0x29, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Failed" }, + { 0x29, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Battery", "Presence Detected" }, + + { 0x2b, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Hardware change detected" }, + { 0x2b, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change detected" }, + { 0x2b, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Hardware incompatibility detected" }, + { 0x2b, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software incompatibility detected" }, + { 0x2b, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Invalid or unsupported hardware version" }, + { 0x2b, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Invalid or unsupported firmware or software version" }, + { 0x2b, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Hardware change success" }, + { 0x2b, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Version Change", "Firmware or software change success" }, + + { 0x2c, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Not Installed" }, + { 0x2c, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Inactive" }, + { 0x2c, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Activation Requested" }, + { 0x2c, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Activation in Progress" }, + { 0x2c, 0x04, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Active" }, + { 0x2c, 0x05, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Deactivation Requested" }, + { 0x2c, 0x06, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Deactivation in Progress" }, + { 0x2c, 0x07, 0xff, IPMI_EVENT_CLASS_DISCRETE, "FRU State", "Communication lost" }, + + { 0xF0, 0x00, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M0" }, + { 0xF0, 0x01, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M1" }, + { 0xF0, 0x02, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M2" }, + { 0xF0, 0x03, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M3" }, + { 0xF0, 0x04, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M4" }, + { 0xF0, 0x05, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M5" }, + { 0xF0, 0x06, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M6" }, + { 0xF0, 0x06, 0xFF, IPMI_EVENT_CLASS_DISCRETE, "FRU Hot Swap", "Transition to M7" }, + + { 0xF1, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A disabled, IPMB-B disabled" }, + { 0xF1, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A enabled, IPMB-B disabled" }, + { 0xF1, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A disabled, IPMB-B enabled" }, + { 0xF1, 0x03, 0xff, IPMI_EVENT_CLASS_DISCRETE, "IPMB-0 Status", "IPMB-A enabled, IPMP-B enabled" }, + + { 0xF2, 0x00, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Module Handle Closed" }, + { 0xF2, 0x01, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Module Handle Opened" }, + { 0xF2, 0x02, 0xff, IPMI_EVENT_CLASS_DISCRETE, "Module Hot Swap", "Quiesced" }, + + { 0xC0, 0x00, 0xff, 0x00, "OEM", "OEM Specific" }, + + { 0x00, 0x00, 0x00, 0x00, NULL, NULL }, +}; + +int ipmi_sel_main(struct ipmi_intf *, int, char **); +void ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt); +void ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt); +void ipmi_sel_print_extended_entry(struct ipmi_intf * intf, struct sel_event_record * evt); +void ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt); +void ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char ** desc); +const char * ipmi_sel_get_sensor_type(uint8_t code); +const char * ipmi_sel_get_sensor_type_offset(uint8_t code, uint8_t offset); +uint16_t ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id, struct sel_event_record * evt); +char * get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec); +IPMI_OEM ipmi_get_oem(struct ipmi_intf * intf); +char * ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec); +int ipmi_sel_oem_init(const char * filename); + +#endif /* IPMI_SEL_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_sensor.h b/lib/lanplus/inc/ipmitool/ipmi_sensor.h new file mode 100644 index 0000000..8c145cf --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_sensor.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_SENSOR_H +#define IPMI_SENSOR_H + +#include <math.h> +#include <ipmitool/bswap.h> +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_sdr.h> + +/* threshold specification bits for analog sensors for get sensor threshold command + * and set sensor threshold command + */ +#define UPPER_NON_RECOV_SPECIFIED 0x20 +#define UPPER_CRIT_SPECIFIED 0x10 +#define UPPER_NON_CRIT_SPECIFIED 0x08 +#define LOWER_NON_RECOV_SPECIFIED 0x04 +#define LOWER_CRIT_SPECIFIED 0x02 +#define LOWER_NON_CRIT_SPECIFIED 0x01 + +/* state assertion bits for discrete sensors for get sensor reading command */ +#define STATE_0_ASSERTED 0x01 +#define STATE_1_ASSERTED 0x02 +#define STATE_2_ASSERTED 0x04 +#define STATE_3_ASSERTED 0x08 +#define STATE_4_ASSERTED 0x10 +#define STATE_5_ASSERTED 0x20 +#define STATE_6_ASSERTED 0x40 +#define STATE_7_ASSERTED 0x80 +#define STATE_8_ASSERTED 0x01 +#define STATE_9_ASSERTED 0x02 +#define STATE_10_ASSERTED 0x04 +#define STATE_11_ASSERTED 0x08 +#define STATE_12_ASSERTED 0x10 +#define STATE_13_ASSERTED 0x20 +#define STATE_14_ASSERTED 0x40 + +struct sensor_set_thresh_rq { + uint8_t sensor_num; /* sensor # */ + uint8_t set_mask; /* threshold setting mask */ + uint8_t lower_non_crit; /* new lower non critical threshold*/ + uint8_t lower_crit; /* new lower critical threshold*/ + uint8_t lower_non_recov; /* new lower non recoverable threshold*/ + uint8_t upper_non_crit; /* new upper non critical threshold*/ + uint8_t upper_crit; /* new upper critical threshold*/ + uint8_t upper_non_recov; /* new upper non recoverable threshold*/ +} __attribute__ ((packed)); + + +int ipmi_sensor_main(struct ipmi_intf *, int, char **); +int ipmi_sensor_print_full(struct ipmi_intf *, struct sdr_record_full_sensor *); +int ipmi_sensor_print_compact(struct ipmi_intf *, struct sdr_record_compact_sensor *); + +#endif /* IPMI_SENSOR_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_session.h b/lib/lanplus/inc/ipmitool/ipmi_session.h new file mode 100644 index 0000000..ad7a09c --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_session.h @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_SESSION_H +#define IPMI_SESSION_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> + +#define IPMI_GET_SESSION_INFO 0x3D + +/* + * From table 22.25 of the IPMIv2 specification + */ +struct get_session_info_rsp +{ + uint8_t session_handle; + + #if WORDS_BIGENDIAN + uint8_t __reserved1 : 2; + uint8_t session_slot_count : 6; /* 1-based */ + #else + uint8_t session_slot_count : 6; /* 1-based */ + uint8_t __reserved1 : 2; + #endif + + #if WORDS_BIGENDIAN + uint8_t __reserved2 : 2; + uint8_t active_session_count : 6; /* 1-based */ + #else + uint8_t active_session_count : 6; /* 1-based */ + uint8_t __reserved2 : 2; + #endif + + #if WORDS_BIGENDIAN + uint8_t __reserved3 : 2; + uint8_t user_id : 6; + #else + uint8_t user_id : 6; + uint8_t __reserved3 : 2; + #endif + + #if WORDS_BIGENDIAN + uint8_t __reserved4 : 4; + uint8_t privilege_level : 4; + #else + uint8_t privilege_level : 4; + uint8_t __reserved4 : 4; + #endif + + #if WORDS_BIGENDIAN + uint8_t auxiliary_data : 4; + uint8_t channel_number : 4; + #else + uint8_t channel_number : 4; + uint8_t auxiliary_data : 4; + #endif + + union + { + /* Only exists if channel type is 802.3 LAN */ + struct + { + uint8_t console_ip[4]; /* MSBF */ + uint8_t console_mac[6]; /* MSBF */ + uint16_t console_port; /* LSBF */ + } lan_data; + + /* Only exists if channel type is async. serial modem */ + struct + { + uint8_t session_channel_activity_type; + + #if WORDS_BIGENDIAN + uint8_t __reserved5 : 4; + uint8_t destination_selector : 4; + #else + uint8_t destination_selector : 4; + uint8_t __reserved5 : 4; + #endif + + uint8_t console_ip[4]; /* MSBF */ + + /* Only exists if session is PPP */ + uint16_t console_port; /* LSBF */ + } modem_data; + } channel_data; +} __attribute__ ((packed)); + + + +int ipmi_session_main(struct ipmi_intf *, int, char **); + +#endif /*IPMI_CHANNEL_H*/ diff --git a/lib/lanplus/inc/ipmitool/ipmi_sol.h b/lib/lanplus/inc/ipmitool/ipmi_sol.h new file mode 100644 index 0000000..b4c0f6d --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_sol.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_SOL_H +#define IPMI_SOL_H + +#include <ipmitool/ipmi.h> + +#define SOL_ESCAPE_CHARACTER_DEFAULT '~' +#define SOL_KEEPALIVE_TIMEOUT 30 + +#define IPMI_SOL_SERIAL_ALERT_MASK_SUCCEED 0x08 +#define IPMI_SOL_SERIAL_ALERT_MASK_DEFERRED 0x04 +#define IPMI_SOL_SERIAL_ALERT_MASK_FAIL 0x00 +#define IPMI_SOL_BMC_ASSERTS_CTS_MASK_TRUE 0x00 +#define IPMI_SOL_BMC_ASSERTS_CTS_MASK_FALSE 0x02 + + +struct sol_config_parameters { + uint8_t set_in_progress; + uint8_t enabled; + uint8_t force_encryption; + uint8_t force_authentication; + uint8_t privilege_level; + uint8_t character_accumulate_level; + uint8_t character_send_threshold; + uint8_t retry_count; + uint8_t retry_interval; + uint8_t non_volatile_bit_rate; + uint8_t volatile_bit_rate; + uint8_t payload_channel; + uint16_t payload_port; +}; + + +/* + * The ACTIVATE PAYLOAD command reponse structure + * From table 24-2 of the IPMI v2.0 spec + */ +struct activate_payload_rsp { + uint8_t auxiliary_data[4]; + uint8_t inbound_payload_size[2]; /* LS byte first */ + uint8_t outbound_payload_size[2]; /* LS byte first */ + uint8_t payload_udp_port[2]; /* LS byte first */ + uint8_t payload_vlan_number[2]; /* LS byte first */ +} __attribute__ ((packed)); + + +int ipmi_sol_main(struct ipmi_intf *, int, char **); +int ipmi_get_sol_info(struct ipmi_intf * intf, + uint8_t channel, + struct sol_config_parameters * params); + + +#endif /* IPMI_SOL_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_strings.h b/lib/lanplus/inc/ipmitool/ipmi_strings.h new file mode 100644 index 0000000..4116431 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_strings.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_STRINGS_H +#define IPMI_STRINGS_H + +#include <ipmitool/helper.h> + +extern const struct valstr completion_code_vals[]; +extern const struct valstr entity_id_vals[]; +extern const struct valstr entity_device_type_vals[]; +extern const struct valstr ipmi_netfn_vals[]; +extern const struct valstr ipmi_channel_activity_type_vals[]; +extern const struct valstr ipmi_privlvl_vals[]; +extern const struct valstr impi_bit_rate_vals[]; +extern const struct valstr ipmi_set_in_progress_vals[]; +extern const struct valstr ipmi_authtype_session_vals[]; +extern const struct valstr ipmi_authtype_vals[]; +extern const struct valstr ipmi_channel_protocol_vals[]; +extern const struct valstr ipmi_channel_medium_vals[]; +extern const struct valstr ipmi_chassis_power_control_vals[]; +extern const struct valstr ipmi_auth_algorithms[]; +extern const struct valstr ipmi_integrity_algorithms[]; +extern const struct valstr ipmi_encryption_algorithms[]; +extern const struct valstr ipmi_oem_info[]; + +extern const struct oemvalstr ipmi_oem_sdr_type_vals[]; + + + +#endif /*IPMI_STRINGS_H*/ diff --git a/lib/lanplus/inc/ipmitool/ipmi_sunoem.h b/lib/lanplus/inc/ipmitool/ipmi_sunoem.h new file mode 100644 index 0000000..b2cddd1 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_sunoem.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_SUNOEM_H +#define IPMI_SUNOEM_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> +#include <ipmitool/ipmi_sdr.h> + +#define IPMI_NETFN_SUNOEM 0x2e + +#define IPMI_SUNOEM_SET_SSH_KEY 0x01 +#define IPMI_SUNOEM_DEL_SSH_KEY 0x02 +#define IPMI_SUNOEM_GET_HEALTH_STATUS 0x10 +#define IPMI_SUNOEM_SET_FAN_SPEED 0x20 +#define IPMI_SUNOEM_LED_GET 0x21 +#define IPMI_SUNOEM_LED_SET 0x22 + +int ipmi_sunoem_main(struct ipmi_intf *, int, char **); + +struct ipmi_rs * sunoem_led_get(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev, int ledtype); +struct ipmi_rs * sunoem_led_set(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev, int ledtype, int ledmode); + +#endif /*IPMI_SUNOEM_H*/ + diff --git a/lib/lanplus/inc/ipmitool/ipmi_tsol.h b/lib/lanplus/inc/ipmitool/ipmi_tsol.h new file mode 100644 index 0000000..8157cd8 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_tsol.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2005 Tyan Computer Corp. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_TSOL_H +#define IPMI_TSOL_H + +#include <ipmitool/ipmi.h> + +#define IPMI_TSOL_CMD_SENDKEY 0x03 +#define IPMI_TSOL_CMD_START 0x06 +#define IPMI_TSOL_CMD_STOP 0x02 + +#define IPMI_TSOL_DEF_PORT 6230 + +int ipmi_tsol_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_TSOL_H */ diff --git a/lib/lanplus/inc/ipmitool/ipmi_user.h b/lib/lanplus/inc/ipmitool/ipmi_user.h new file mode 100644 index 0000000..f8765ff --- /dev/null +++ b/lib/lanplus/inc/ipmitool/ipmi_user.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMI_USER_H +#define IPMI_USER_H + +#if HAVE_CONFIG_H +# include <config.h> +#endif +#include <ipmitool/ipmi.h> + + +/* + * The GET USER ACCESS response from table 22-32 of the IMPI v2.0 spec + */ +struct user_access_rsp { +#if WORDS_BIGENDIAN + uint8_t __reserved1 : 2; + uint8_t maximum_ids : 6; +#else + uint8_t maximum_ids : 6; + uint8_t __reserved1 : 2; +#endif + +#if WORDS_BIGENDIAN + uint8_t __reserved2 : 2; + uint8_t enabled_user_count : 6; +#else + uint8_t enabled_user_count : 6; + uint8_t __reserved2 : 2; +#endif + +#if WORDS_BIGENDIAN + uint8_t __reserved3 : 2; + uint8_t fixed_name_count : 6; +#else + uint8_t fixed_name_count : 6; + uint8_t __reserved3 : 2; +#endif + +#if WORDS_BIGENDIAN + uint8_t __reserved4 : 1; + uint8_t no_callin_access : 1; + uint8_t link_auth_access : 1; + uint8_t ipmi_messaging_access : 1; + uint8_t channel_privilege_limit : 4; +#else + uint8_t channel_privilege_limit : 4; + uint8_t ipmi_messaging_access : 1; + uint8_t link_auth_access : 1; + uint8_t no_callin_access : 1; + uint8_t __reserved4 : 1; +#endif +} __attribute__ ((packed)); + + + +int ipmi_user_main(struct ipmi_intf *, int, char **); + +#endif /* IPMI_USER_H */ diff --git a/lib/lanplus/inc/ipmitool/log.h b/lib/lanplus/inc/ipmitool/log.h new file mode 100644 index 0000000..b5dd8c4 --- /dev/null +++ b/lib/lanplus/inc/ipmitool/log.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. + * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE + * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING + * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL + * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, + * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF + * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, + * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#ifndef IPMITOOL_LOG_H +#define IPMITOOL_LOG_H + +#ifdef WIN32 +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 +#else +#include <syslog.h> + +/* sys/syslog.h: + * LOG_EMERG 0 system is unusable + * LOG_ALERT 1 action must be taken immediately + * LOG_CRIT 2 critical conditions + * LOG_ERR 3 error conditions + * LOG_WARNING 4 warning conditions + * LOG_NOTICE 5 normal but significant condition + * LOG_INFO 6 informational + * LOG_DEBUG 7 debug-level messages + */ +#endif + +#define LOG_ERROR LOG_ERR +#define LOG_WARN LOG_WARNING + +#define LOG_NAME_DEFAULT "ipmitool" +#define LOG_MSG_LENGTH 1024 + +void log_init(const char * name, int isdaemon, int verbose); +void log_halt(void); +void log_level_set(int level); +int log_level_get(void); +void lprintf(int level, const char * format, ...); +void lperror(int level, const char * format, ...); + +#endif /*IPMITOOL_LOG_H*/ + |