mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
export function for other use
This commit is contained in:
parent
3af858eecf
commit
b1cf8c6a2b
@ -39,6 +39,7 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/ipmi_sdr.h>
|
||||
|
||||
#define IPMI_CMD_GET_SEL_INFO 0x40
|
||||
#define IPMI_CMD_GET_SEL_ALLOC_INFO 0x41
|
||||
@ -75,8 +76,13 @@ struct sel_event_record {
|
||||
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 */
|
||||
@ -446,6 +452,8 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu
|
||||
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 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);
|
||||
|
@ -333,6 +333,14 @@ ipmi_sel_print_event_file(struct ipmi_intf * intf, struct sel_event_record * evt
|
||||
free(description);
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_sel_print_extended_entry(struct ipmi_intf * intf, struct sel_event_record * evt)
|
||||
{
|
||||
sel_extended++;
|
||||
ipmi_sel_print_std_entry(intf, evt);
|
||||
sel_extended--;
|
||||
}
|
||||
|
||||
void
|
||||
ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt)
|
||||
{
|
||||
@ -525,12 +533,20 @@ ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_recor
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt, struct sdr_record_list * sdr)
|
||||
void
|
||||
ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt)
|
||||
{
|
||||
char * description;
|
||||
if (!evt || !sdr)
|
||||
struct sdr_record_list * sdr;
|
||||
char * description;
|
||||
|
||||
if (!evt)
|
||||
return;
|
||||
|
||||
sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt->sensor_num, evt->sensor_type);
|
||||
if (sdr == NULL) {
|
||||
ipmi_sel_print_std_entry_verbose(intf, evt);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("SEL Record ID : %04x\n", evt->record_id);
|
||||
|
||||
@ -1070,39 +1086,17 @@ ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
}
|
||||
|
||||
/* lookup SDR entry based on sensor number and type */
|
||||
ipmi_sel_print_extended_entry_verbose(intf, &evt);
|
||||
|
||||
sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt.sensor_num, evt.sensor_type);
|
||||
if (sdr == NULL) {
|
||||
ipmi_sel_print_std_entry_verbose(intf, &evt);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
/* print SEL extended entry */
|
||||
ipmi_sel_print_extended_entry_verbose(intf, &evt, sdr);
|
||||
}
|
||||
|
||||
/* print SDR entry */
|
||||
oldv = verbose;
|
||||
verbose = verbose ? : 1;
|
||||
switch (sdr->type) {
|
||||
case SDR_RECORD_TYPE_FULL_SENSOR:
|
||||
ipmi_sensor_print_full(intf, sdr->record.full);
|
||||
entity.id = sdr->record.full->entity.id;
|
||||
entity.instance = sdr->record.full->entity.instance;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
||||
ipmi_sensor_print_compact(intf, sdr->record.compact);
|
||||
entity.id = sdr->record.compact->entity.id;
|
||||
entity.instance = sdr->record.compact->entity.instance;
|
||||
break;
|
||||
case SDR_RECORD_TYPE_EVENTONLY_SENSOR:
|
||||
ipmi_sdr_print_sensor_eventonly(intf, sdr->record.eventonly);
|
||||
entity.id = sdr->record.eventonly->entity.id;
|
||||
entity.instance = sdr->record.eventonly->entity.instance;
|
||||
break;
|
||||
default:
|
||||
verbose = oldv;
|
||||
continue;
|
||||
}
|
||||
ipmi_sdr_print_listentry(intf, sdr);
|
||||
verbose = oldv;
|
||||
|
||||
/* lookup SDR entry based on entity id */
|
||||
|
Loading…
x
Reference in New Issue
Block a user