summaryrefslogtreecommitdiff
path: root/include/ipmitool/ipmi_sdr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ipmitool/ipmi_sdr.h')
-rw-r--r--include/ipmitool/ipmi_sdr.h101
1 files changed, 36 insertions, 65 deletions
diff --git a/include/ipmitool/ipmi_sdr.h b/include/ipmitool/ipmi_sdr.h
index 41bb533..85231c6 100644
--- a/include/ipmitool/ipmi_sdr.h
+++ b/include/ipmitool/ipmi_sdr.h
@@ -30,13 +30,13 @@
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-#ifndef IPMI_SDR_H
-#define IPMI_SDR_H
+#pragma once
#if HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdbool.h>
#include <inttypes.h>
#include <math.h>
#include <ipmitool/bswap.h>
@@ -381,6 +381,29 @@ struct sdr_record_common_sensor {
struct sdr_record_mask mask;
+/* IPMI 2.0, Table 43-1, byte 21[7:6] Analog (numeric) Data Format */
+#define SDR_UNIT_FMT_UNSIGNED 0 /* unsigned */
+#define SDR_UNIT_FMT_1S_COMPL 1 /* 1's complement (signed) */
+#define SDR_UNIT_FMT_2S_COMPL 2 /* 2's complement (signed) */
+#define SDR_UNIT_FMT_NA 3 /* does not return analog (numeric) reading */
+/* IPMI 2.0, Table 43-1, byte 21[5:3] Rate */
+#define SDR_UNIT_RATE_NONE 0 /* none */
+#define SDR_UNIT_RATE_MICROSEC 1 /* per us */
+#define SDR_UNIT_RATE_MILLISEC 2 /* per ms */
+#define SDR_UNIT_RATE_SEC 3 /* per s */
+#define SDR_UNIT_RATE_MIN 4 /* per min */
+#define SDR_UNIT_RATE_HR 5 /* per hour */
+#define SDR_UNIT_RATE_DAY 6 /* per day */
+#define SDR_UNIT_RATE_RSVD 7 /* reserved */
+/* IPMI 2.0, Table 43-1, byte 21[2:1] Modifier Unit */
+#define SDR_UNIT_MOD_NONE 0 /* none */
+#define SDR_UNIT_MOD_DIV 1 /* Basic Unit / Modifier Unit */
+#define SDR_UNIT_MOD_MUL 2 /* Basic Unit * Mofifier Unit */
+#define SDR_UNIT_MOD_RSVD 3 /* Reserved */
+/* IPMI 2.0, Table 43-1, byte 21[0] Percentage */
+#define SDR_UNIT_PCT_NO 0
+#define SDR_UNIT_PCT_YES 1
+
struct {
#if WORDS_BIGENDIAN
uint8_t analog:2;
@@ -394,8 +417,8 @@ struct sdr_record_common_sensor {
uint8_t analog:2;
#endif
struct {
- uint8_t base;
- uint8_t modifier;
+ uint8_t base; /* Base unit type code per IPMI 2.0 Table 43-15 */
+ uint8_t modifier; /* Modifier unit type code per Table 43-15 */
} ATTRIBUTE_PACKING type;
} ATTRIBUTE_PACKING unit;
} ATTRIBUTE_PACKING;
@@ -773,50 +796,7 @@ struct sdr_record_list {
#pragma pack(0)
#endif
-
-/* 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", "Watchdog1",
- "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", "Watchdog2", "Platform Alert",
- "Entity Presence", "Monitor ASIC", "LAN",
- "Management Subsys Health", "Battery", "Session Audit",
- "Version Change", "FRU State" };
struct sensor_reading {
char s_id[17]; /* name of the sensor */
@@ -864,11 +844,10 @@ 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);
+void ipmi_sdr_end(struct ipmi_sdr_iterator *i);
int ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type);
-int ipmi_sdr_print_name_from_rawentry(struct ipmi_intf *intf,uint16_t id,
- uint8_t type,uint8_t * raw);
+int ipmi_sdr_print_name_from_rawentry(uint16_t id, uint8_t type,uint8_t * raw);
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,
@@ -877,8 +856,8 @@ void ipmi_sdr_print_sensor_hysteresis(struct sdr_record_common_sensor *sensor,
struct sdr_record_full_sensor *full,
uint8_t hysteresis_value,
const char *hdrstr);
-const char *ipmi_sdr_get_unit_string(uint8_t pct, uint8_t type,
- uint8_t base, uint8_t modifier);
+const char *ipmi_sdr_get_unit_string(bool pct, uint8_t type,
+ uint8_t base, uint8_t modifier);
struct sensor_reading *
ipmi_sdr_read_sensor_value(struct ipmi_intf *intf,
struct sdr_record_common_sensor *sensor,
@@ -912,15 +891,9 @@ int ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin,
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);
+int ipmi_sdr_print_sensor_generic_locator(struct sdr_record_generic_locator *fru);
+int ipmi_sdr_print_sensor_fru_locator(struct sdr_record_fru_locator *fru);
+int ipmi_sdr_print_sensor_mc_locator(struct sdr_record_mc_locator *mc);
struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf,
struct entity_id *entity);
@@ -933,8 +906,8 @@ struct sdr_record_list *ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf,
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_list_cache_fromfile(const char *ifile);
+void ipmi_sdr_list_empty(void);
int ipmi_sdr_print_info(struct ipmi_intf *intf);
void ipmi_sdr_print_discrete_state(struct ipmi_intf *intf,
const char *desc, uint8_t sensor_type,
@@ -952,5 +925,3 @@ 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,
uint8_t target, uint8_t lun, uint8_t channel);
-
-#endif /* IPMI_SDR_H */