libipmi.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #ifndef LIBIPMI_H
  2. #define LIBIPMI_H
  3. /*! Return value that indicates a specified sensor is disabled, and cannot be read */
  4. #define IPMI_SENSOR_DISABLED ( -3 )
  5. /* IPMI threshold state definitions for monitoring */
  6. #define THRESH_UNINITIALIZED ( (uint16_t)0x00 ) /*!< Threshold state on first run */
  7. #define THRESH_NORMAL ( (uint16_t)0x01 ) /*!< Sensor is normal (unused in IPMI ) */
  8. #define THRESH_UP_NONCRIT ( (uint16_t)0x02 ) /*!< IPMI Upper Non-Critical Threshold */
  9. #define THRESH_UP_CRITICAL ( (uint16_t)0x04 ) /*!< IPMI Upper Critical Threshold */
  10. #define THRESH_LOW_NONCRIT ( (uint16_t)0x08 ) /*!< IPMI Lower Non-Critical Threshold */
  11. #define THRESH_LOW_CRITICAL ( (uint16_t)0x10 ) /*!< IPMI Lower Critical Threshold */
  12. #define THRESH_ACCESS_FAILED ( (uint16_t)0x20 ) /*!< Access failed sensor state */
  13. #define THRESH_UP_NON_RECOV ( (uint16_t)0x40 ) /*!< IPMI Upper Non-Recoverable Threshold */
  14. #define THRESH_LOW_NON_RECOV ( (uint16_t)0x80 ) /*!< IPMI Lower Non-Recoverable Threshold */
  15. /* Macros for converting netfn/lun combos */
  16. #define NETFN( netfnlun ) ( ( netfnlun & (uint8_t)0xFC ) >> 2 )
  17. #define NETLUN( netfnlun ) ( ( netfnlun & (uint8_t)0x03 ) )
  18. #define NETFNLUN( netfn,lun ) ( ( netfn << 2 ) | ( lun ) )
  19. /* Macros for converting seq/lun combos */
  20. #define SEQ( seqlun ) ( ( seqlun & (uint8_t)0xFC ) >> 2 )
  21. #define SLUN( seqlun ) ( ( seqlun & (uint8_t)0x03 ) )
  22. #define SEQLUN( seq, lun ) ( ( seq << 2 ) | ( lun ) )
  23. /***** IPMI Constant Definitions *****/
  24. /* Completion Codes */
  25. #define IPMI_SUCCESS ( (uint8_t)0x00 )
  26. /* Sensor Data Record types */
  27. #define SDR_FULL ( (uint8_t)0x01 ) /**< SDR RecordType for Full Sensor Record */
  28. #define SDR_COMPACT ( (uint8_t)0x02 ) /**< SDR RecordType for Compact Sensor Record */
  29. /* Raw sensor reading numeric format codes */
  30. #define SDR_READING_UNSIGNED ( (uint8_t)0 )
  31. #define SDR_READING_1SCOMP ( (uint8_t)1 )
  32. #define SDR_READING_2SCOMP ( (uint8_t)2 )
  33. #define SDR_READING_NONANALOG ( (uint8_t)3 )
  34. /* Max size of an SDR of type SDR_FULL. SDR_COMPACT records are smaller. */
  35. #define SDR_MAX_SIZE ( 64 )
  36. /* Chassis control codes */
  37. #define CHASSIS_POWER_DOWN ( (uint8_t)0x00 )
  38. #define CHASSIS_POWER_UP ( (uint8_t)0x01 )
  39. #define CHASSIS_POWER_CYCLE ( (uint8_t)0x02 )
  40. #define CHASSIS_HARD_RESET ( (uint8_t)0x03 )
  41. #define CHASSIS_PULSE_DUMP ( (uint8_t)0x04 )
  42. #define CHASSIS_ACPI_POWER_DOWN ( (uint8_t)0x05 )
  43. /* Sensor Type Codes */
  44. #define IPMI_SENSOR_TEMPERATURE ( (uint8_t)0x01 )
  45. #define IPMI_SENSOR_VOLTAGE ( (uint8_t)0x02 )
  46. #define IPMI_SENSOR_CURRENT ( (uint8_t)0x03 )
  47. #define IPMI_SENSOR_FAN ( (uint8_t)0x04 )
  48. #define IPMI_SENSOR_POWER_SUPPLY ( (uint8_t)0x08 )
  49. #define IPMI_SENSOR_POWER_UNIT ( (uint8_t)0x09 )
  50. #define IPMI_SENSOR_COOLING_DEVICE ( (uint8_t)0x0A )
  51. #define IPMI_SENSOR_MEMORY ( (uint8_t)0x0C )
  52. /* Sensor Unit Type Codes from the IPMI spec */
  53. #define IPMI_UNIT_UNSPECIFIED 0
  54. #define IPMI_UNIT_DEGREES_C 1
  55. #define IPMI_UNIT_DEGREES_F 2
  56. #define IPMI_UNIT_DEGREES_K 3
  57. #define IPMI_UNIT_VOLTS 4
  58. #define IPMI_UNIT_AMPS 5
  59. #define IPMI_UNIT_WATTS 6
  60. #define IPMI_UNIT_JOULES 7
  61. #define IPMI_UNIT_COULOMBS 8
  62. #define IPMI_UNIT_VA 9
  63. #define IPMI_UNIT_NITS 10
  64. #define IPMI_UNIT_LUMEN 11
  65. #define IPMI_UNIT_LUX 12
  66. #define IPMI_UNIT_CANDELA 13
  67. #define IPMI_UNIT_KPA 14
  68. #define IPMI_UNIT_PSI 15
  69. #define IPMI_UNIT_NEWTON 16
  70. #define IPMI_UNIT_CFM 17
  71. #define IPMI_UNIT_RPM 18
  72. #define IPMI_UNIT_HZ 19
  73. #define IPMI_UNIT_MICROSECOND 20
  74. #define IPMI_UNIT_MILLISECOND 21
  75. #define IPMI_UNIT_SECOND 22
  76. #define IPMI_UNIT_MINUTE 23
  77. #define IPMI_UNIT_HOUR 24
  78. #define IPMI_UNIT_DAY 25
  79. #define IPMI_UNIT_WEEK 26
  80. #define IPMI_UNIT_MIL 27
  81. #define IPMI_UNIT_INCHES 28
  82. #define IPMI_UNIT_FEET 29
  83. #define IPMI_UNIT_CUIN 30
  84. #define IPMI_UNIT_CUFEET 31
  85. #define IPMI_UNIT_MM 32
  86. #define IPMI_UNIT_CM 33
  87. #define IPMI_UNIT_M 34
  88. #define IPMI_UNIT_CUCM 35
  89. #define IPMI_UNIT_CUM 36
  90. #define IPMI_UNIT_LITERS 37
  91. #define IPMI_UNIT_FLUIDOUNCE 38
  92. #define IPMI_UNIT_RADIANS 39
  93. #define IPMI_UNIT_STERADIANS 40
  94. #define IPMI_UNIT_REVOLUTIONS 41
  95. #define IPMI_UNIT_CYCLES 42
  96. #define IPMI_UNIT_GRAVITIES 43
  97. #define IPMI_UNIT_OUNCE 44
  98. #define IPMI_UNIT_POUND 45
  99. #define IPMI_UNIT_FTLB 46
  100. #define IPMI_UNIT_OZIN 47
  101. #define IPMI_UNIT_GAUSS 48
  102. #define IPMI_UNIT_GILBERTS 49
  103. #define IPMI_UNIT_HENRY 50
  104. #define IPMI_UNIT_MILLIHENRY 51
  105. #define IPMI_UNIT_FARAD 52
  106. #define IPMI_UNIT_MICROFARAD 53
  107. #define IPMI_UNIT_OHMS 54
  108. #define IPMI_UNIT_SIEMENS 55
  109. #define IPMI_UNIT_MOLE 56
  110. #define IPMI_UNIT_BECQUEREL 57
  111. #define IPMI_UNIT_PPM 58
  112. #define IPMI_UNIT_RESERVED 59
  113. #define IPMI_UNIT_DECIBELS 60
  114. #define IPMI_UNIT_DBA 61
  115. #define IPMI_UNIT_DBC 62
  116. #define IPMI_UNIT_GRAY 63
  117. #define IPMI_UNIT_SIEVERT 64
  118. #define IPMI_UNIT_COLORTEMPDK 65
  119. #define IPMI_UNIT_BIT 66
  120. #define IPMI_UNIT_KILOBIT 67
  121. #define IPMI_UNIT_MEGABIT 68
  122. #define IPMI_UNIT_GIGABIT 69
  123. #define IPMI_UNIT_BYTE 70
  124. #define IPMI_UNIT_KILOBYTE 71
  125. #define IPMI_UNIT_MEGABYTE 72
  126. #define IPMI_UNIT_GIGABYTE 73
  127. #define IPMI_UNIT_WORD 74
  128. #define IPMI_UNIT_DWORD 75
  129. #define IPMI_UNIT_QWORD 76
  130. #define IPMI_UNIT_LINE 77
  131. #define IPMI_UNIT_HIT 78
  132. #define IPMI_UNIT_MISS 79
  133. #define IPMI_UNIT_RETRY 80
  134. #define IPMI_UNIT_RESET 81
  135. #define IPMI_UNIT_OVERRUNFLOW 82
  136. #define IPMI_UNIT_UNDERRUN 83
  137. #define IPMI_UNIT_COLLISION 84
  138. #define IPMI_UNIT_PACKETS 85
  139. #define IPMI_UNIT_MESSAGES 86
  140. #define IPMI_UNIT_CHARACTERS 87
  141. #define IPMI_UNIT_ERROR 88
  142. #define IPMI_UNIT_CORRERROR 89
  143. #define IPMI_UNIT_UNCORRERROR 90
  144. #endif