ipmi_mc.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. #ifndef IPMI_MC_H
  33. #define IPMI_MC_H
  34. #include <ipmitool/ipmi.h>
  35. #define BMC_GET_DEVICE_ID 0x01
  36. #define BMC_COLD_RESET 0x02
  37. #define BMC_WARM_RESET 0x03
  38. #define BMC_GET_SELF_TEST 0x04
  39. #define BMC_RESET_WATCHDOG_TIMER 0x22
  40. #define BMC_SET_WATCHDOG_TIMER 0x24
  41. #define BMC_GET_WATCHDOG_TIMER 0x25
  42. #define BMC_SET_GLOBAL_ENABLES 0x2e
  43. #define BMC_GET_GLOBAL_ENABLES 0x2f
  44. #define BMC_GET_GUID 0x37
  45. int ipmi_mc_main(struct ipmi_intf *, int, char **);
  46. /*
  47. * Response data from IPM Get Device ID Command (IPMI rev 1.5, section 17.1)
  48. * The following really apply to any IPM device, not just BMCs...
  49. */
  50. #ifdef HAVE_PRAGMA_PACK
  51. #pragma pack(1)
  52. #endif
  53. struct ipm_devid_rsp {
  54. uint8_t device_id;
  55. uint8_t device_revision;
  56. uint8_t fw_rev1;
  57. uint8_t fw_rev2;
  58. uint8_t ipmi_version;
  59. uint8_t adtl_device_support;
  60. uint8_t manufacturer_id[3];
  61. uint8_t product_id[2];
  62. uint8_t aux_fw_rev[4];
  63. } ATTRIBUTE_PACKING;
  64. #ifdef HAVE_PRAGMA_PACK
  65. #pragma pack(0)
  66. #endif
  67. #define IPM_DEV_DEVICE_ID_SDR_MASK (0x80) /* 1 = provides SDRs */
  68. #define IPM_DEV_DEVICE_ID_REV_MASK (0x0F) /* BCD-enoded */
  69. #define IPM_DEV_FWREV1_AVAIL_MASK (0x80) /* 0 = normal operation */
  70. #define IPM_DEV_FWREV1_MAJOR_MASK (0x3f) /* Major rev, BCD-encoded */
  71. #define IPM_DEV_IPMI_VER_MAJOR_MASK (0x0F) /* Major rev, BCD-encoded */
  72. #define IPM_DEV_IPMI_VER_MINOR_MASK (0xF0) /* Minor rev, BCD-encoded */
  73. #define IPM_DEV_IPMI_VER_MINOR_SHIFT (4) /* Minor rev shift */
  74. #define IPM_DEV_IPMI_VERSION_MAJOR(x) \
  75. (x & IPM_DEV_IPMI_VER_MAJOR_MASK)
  76. #define IPM_DEV_IPMI_VERSION_MINOR(x) \
  77. ((x & IPM_DEV_IPMI_VER_MINOR_MASK) >> IPM_DEV_IPMI_VER_MINOR_SHIFT)
  78. #define IPM_DEV_MANUFACTURER_ID(x) \
  79. ((uint32_t) ((x[2] & 0x0F) << 16 | x[1] << 8 | x[0]))
  80. #define IPM_DEV_ADTL_SUPPORT_BITS (8)
  81. /* Structure follow the IPMI V.2 Rev 1.0
  82. * See Table 20-10 */
  83. #ifdef HAVE_PRAGMA_PACK
  84. #pragma pack(1)
  85. #endif
  86. struct ipmi_guid_t {
  87. uint32_t time_low; /* timestamp low field */
  88. uint16_t time_mid; /* timestamp middle field */
  89. uint16_t time_hi_and_version; /* timestamp high field and version number */
  90. uint8_t clock_seq_hi_variant;/* clock sequence high field and variant */
  91. uint8_t clock_seq_low; /* clock sequence low field */
  92. uint8_t node[6]; /* node */
  93. } ATTRIBUTE_PACKING;
  94. #ifdef HAVE_PRAGMA_PACK
  95. #pragma pack(0)
  96. #endif
  97. int _ipmi_mc_get_guid(struct ipmi_intf *, struct ipmi_guid_t *);
  98. #ifdef HAVE_PRAGMA_PACK
  99. #pragma pack(1)
  100. #endif
  101. struct ipm_selftest_rsp {
  102. unsigned char code;
  103. unsigned char test;
  104. } ATTRIBUTE_PACKING;
  105. #ifdef HAVE_PRAGMA_PACK
  106. #pragma pack(0)
  107. #endif
  108. #define IPM_SFT_CODE_OK 0x55
  109. #define IPM_SFT_CODE_NOT_IMPLEMENTED 0x56
  110. #define IPM_SFT_CODE_DEV_CORRUPTED 0x57
  111. #define IPM_SFT_CODE_FATAL_ERROR 0x58
  112. #define IPM_SFT_CODE_RESERVED 0xff
  113. #define IPM_SELFTEST_SEL_ERROR 0x80
  114. #define IPM_SELFTEST_SDR_ERROR 0x40
  115. #define IPM_SELFTEST_FRU_ERROR 0x20
  116. #define IPM_SELFTEST_IPMB_ERROR 0x10
  117. #define IPM_SELFTEST_SDRR_EMPTY 0x08
  118. #define IPM_SELFTEST_INTERNAL_USE 0x04
  119. #define IPM_SELFTEST_FW_BOOTBLOCK 0x02
  120. #define IPM_SELFTEST_FW_CORRUPTED 0x01
  121. #ifdef HAVE_PRAGMA_PACK
  122. #pragma pack(1)
  123. #endif
  124. struct ipm_get_watchdog_rsp {
  125. unsigned char timer_use;
  126. unsigned char timer_actions;
  127. unsigned char pre_timeout;
  128. unsigned char timer_use_exp;
  129. unsigned char initial_countdown_lsb;
  130. unsigned char initial_countdown_msb;
  131. unsigned char present_countdown_lsb;
  132. unsigned char present_countdown_msb;
  133. } ATTRIBUTE_PACKING;
  134. #ifdef HAVE_PRAGMA_PACK
  135. #pragma pack(0)
  136. #endif
  137. #define IPM_WATCHDOG_RESET_ERROR 0x80
  138. #define IPM_WATCHDOG_BIOS_FRB2 0x01
  139. #define IPM_WATCHDOG_BIOS_POST 0x02
  140. #define IPM_WATCHDOG_OS_LOAD 0x03
  141. #define IPM_WATCHDOG_SMS_OS 0x04
  142. #define IPM_WATCHDOG_OEM 0x05
  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. #define IPM_WATCHDOG_CLEAR_OEM 0x20
  148. #define IPM_WATCHDOG_CLEAR_SMS_OS 0x10
  149. #define IPM_WATCHDOG_CLEAR_OS_LOAD 0x08
  150. #define IPM_WATCHDOG_CLEAR_BIOS_POST 0x04
  151. #define IPM_WATCHDOG_CLEAR_BIOS_FRB2 0x02
  152. /* IPMI 2.0 command for system information*/
  153. #define IPMI_SET_SYS_INFO 0x58
  154. #define IPMI_GET_SYS_INFO 0x59
  155. #define IPMI_SYSINFO_SET0_SIZE 14
  156. #define IPMI_SYSINFO_SETN_SIZE 16
  157. /* System Information "Parameter selector" values: */
  158. #define IPMI_SYSINFO_SET_STATE 0x00
  159. #define IPMI_SYSINFO_SYSTEM_FW_VERSION 0x01
  160. #define IPMI_SYSINFO_HOSTNAME 0x02
  161. #define IPMI_SYSINFO_PRIMARY_OS_NAME 0x03
  162. #define IPMI_SYSINFO_OS_NAME 0x04
  163. #define IPMI_SYSINFO_DELL_OS_VERSION 0xe4
  164. #define IPMI_SYSINFO_DELL_URL 0xde
  165. #define IPMI_SYSINFO_DELL_IPV6_COUNT 0xe6
  166. #define IPMI_SYSINFO_DELL_IPV6_DESTADDR 0xf0
  167. int ipmi_mc_getsysinfo(struct ipmi_intf * intf, int param, int block, int set,
  168. int len, void *buffer);
  169. int ipmi_mc_setsysinfo(struct ipmi_intf * intf, int len, void *buffer);
  170. #endif /*IPMI_MC_H */