1 /* 2 * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * Redistribution of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 11 * Redistribution in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * Neither the name of Sun Microsystems, Inc. or the names of 16 * contributors may be used to endorse or promote products derived 17 * from this software without specific prior written permission. 18 * 19 * This software is provided "AS IS," without a warranty of any kind. 20 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, 21 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A 22 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. 23 * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE 24 * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING 25 * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL 26 * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, 27 * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR 28 * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF 29 * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, 30 * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 31 */ 32 33 #ifndef IPMI_MC_H 34 #define IPMI_MC_H 35 36 #include <ipmitool/ipmi.h> 37 38 #define BMC_GET_DEVICE_ID 0x01 39 #define BMC_COLD_RESET 0x02 40 #define BMC_WARM_RESET 0x03 41 #define BMC_GET_SELF_TEST 0x04 42 #define BMC_RESET_WATCHDOG_TIMER 0x22 43 #define BMC_SET_WATCHDOG_TIMER 0x24 44 #define BMC_GET_WATCHDOG_TIMER 0x25 45 #define BMC_SET_GLOBAL_ENABLES 0x2e 46 #define BMC_GET_GLOBAL_ENABLES 0x2f 47 #define BMC_GET_GUID 0x37 48 49 int ipmi_mc_main(struct ipmi_intf *, int, char **); 50 51 /* 52 * Response data from IPM Get Device ID Command (IPMI rev 1.5, section 17.1) 53 * The following really apply to any IPM device, not just BMCs... 54 */ 55 #ifdef HAVE_PRAGMA_PACK 56 #pragma pack(1) 57 #endif 58 struct ipm_devid_rsp { 59 uint8_t device_id; 60 uint8_t device_revision; 61 uint8_t fw_rev1; 62 uint8_t fw_rev2; 63 uint8_t ipmi_version; 64 uint8_t adtl_device_support; 65 uint8_t manufacturer_id[3]; 66 uint8_t product_id[2]; 67 uint8_t aux_fw_rev[4]; 68 } ATTRIBUTE_PACKING; 69 #ifdef HAVE_PRAGMA_PACK 70 #pragma pack(0) 71 #endif 72 73 #define IPM_DEV_DEVICE_ID_SDR_MASK (0x80) /* 1 = provides SDRs */ 74 #define IPM_DEV_DEVICE_ID_REV_MASK (0x0F) /* BCD-enoded */ 75 76 #define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */ 77 #define IPM_DEV_FWREV1_MAJOR_MASK (0x3f) /* Major rev, BCD-encoded */ 78 79 #define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */ 80 #define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */ 81 #define IPM_DEV_IPMI_VER_MINOR_SHIFT (4) /* Minor rev shift */ 82 #define IPM_DEV_IPMI_VERSION_MAJOR(x) \ 83 (x & IPM_DEV_IPMI_VER_MAJOR_MASK) 84 #define IPM_DEV_IPMI_VERSION_MINOR(x) \ 85 ((x & IPM_DEV_IPMI_VER_MINOR_MASK) >> IPM_DEV_IPMI_VER_MINOR_SHIFT) 86 87 #define IPM_DEV_MANUFACTURER_ID(x) \ 88 ((uint32_t) ((x[2] & 0x0F) << 16 | x[1] << 8 | x[0])) 89 90 #define IPM_DEV_ADTL_SUPPORT_BITS (8) 91 92 #ifdef HAVE_PRAGMA_PACK 93 #pragma pack(1) 94 #endif 95 struct ipm_selftest_rsp { 96 unsigned char code; 97 unsigned char test; 98 } ATTRIBUTE_PACKING; 99 #ifdef HAVE_PRAGMA_PACK 100 #pragma pack(0) 101 #endif 102 103 #define IPM_SFT_CODE_OK 0x55 104 #define IPM_SFT_CODE_NOT_IMPLEMENTED 0x56 105 #define IPM_SFT_CODE_DEV_CORRUPTED 0x57 106 #define IPM_SFT_CODE_FATAL_ERROR 0x58 107 #define IPM_SFT_CODE_RESERVED 0xff 108 109 #define IPM_SELFTEST_SEL_ERROR 0x80 110 #define IPM_SELFTEST_SDR_ERROR 0x40 111 #define IPM_SELFTEST_FRU_ERROR 0x20 112 #define IPM_SELFTEST_IPMB_ERROR 0x10 113 #define IPM_SELFTEST_SDRR_EMPTY 0x08 114 #define IPM_SELFTEST_INTERNAL_USE 0x04 115 #define IPM_SELFTEST_FW_BOOTBLOCK 0x02 116 #define IPM_SELFTEST_FW_CORRUPTED 0x01 117 118 #ifdef HAVE_PRAGMA_PACK 119 #pragma pack(1) 120 #endif 121 struct ipm_get_watchdog_rsp { 122 unsigned char timer_use; 123 unsigned char timer_actions; 124 unsigned char pre_timeout; 125 unsigned char timer_use_exp; 126 unsigned char initial_countdown_lsb; 127 unsigned char initial_countdown_msb; 128 unsigned char present_countdown_lsb; 129 unsigned char present_countdown_msb; 130 } ATTRIBUTE_PACKING; 131 #ifdef HAVE_PRAGMA_PACK 132 #pragma pack(0) 133 #endif 134 135 #define IPM_WATCHDOG_RESET_ERROR 0x80 136 137 #define IPM_WATCHDOG_BIOS_FRB2 0x01 138 #define IPM_WATCHDOG_BIOS_POST 0x02 139 #define IPM_WATCHDOG_OS_LOAD 0x03 140 #define IPM_WATCHDOG_SMS_OS 0x04 141 #define IPM_WATCHDOG_OEM 0x05 142 143 #define IPM_WATCHDOG_NO_ACTION 0x00 144 #define IPM_WATCHDOG_HARD_RESET 0x01 145 #define IPM_WATCHDOG_POWER_DOWN 0x02 146 #define IPM_WATCHDOG_POWER_CYCLE 0x03 147 148 #define IPM_WATCHDOG_CLEAR_OEM 0x20 149 #define IPM_WATCHDOG_CLEAR_SMS_OS 0x10 150 #define IPM_WATCHDOG_CLEAR_OS_LOAD 0x08 151 #define IPM_WATCHDOG_CLEAR_BIOS_POST 0x04 152 #define IPM_WATCHDOG_CLEAR_BIOS_FRB2 0x02 153 154 /* IPMI 2.0 command for system information*/ 155 #define IPMI_SET_SYS_INFO 0x58 156 #define IPMI_GET_SYS_INFO 0x59 157 #define IPMI_SYSINFO_SET0_SIZE 14 158 #define IPMI_SYSINFO_SETN_SIZE 16 159 160 /* System Information "Parameter selector" values: */ 161 #define IPMI_SYSINFO_SET_STATE 0x00 162 #define IPMI_SYSINFO_SYSTEM_FW_VERSION 0x01 163 #define IPMI_SYSINFO_HOSTNAME 0x02 164 #define IPMI_SYSINFO_PRIMARY_OS_NAME 0x03 165 #define IPMI_SYSINFO_OS_NAME 0x04 166 #define IPMI_SYSINFO_DELL_OS_VERSION 0xe4 167 #define IPMI_SYSINFO_DELL_URL 0xde 168 169 int ipmi_mc_getsysinfo(struct ipmi_intf * intf, int param, int block, int set, 170 int len, void *buffer); 171 int ipmi_mc_setsysinfo(struct ipmi_intf * intf, int len, void *buffer); 172 173 #endif /*IPMI_MC_H */ 174