Bernard Manjou 6/10/08 patch to include I2c address and LUN so sensors are correctly managed; updated by BM for v1.8.10

This commit is contained in:
Carol Hebert 2009-01-27 01:20:01 +00:00
parent ca90a4b48b
commit 10f4a1a5c5
6 changed files with 157 additions and 45 deletions

View File

@ -822,9 +822,11 @@ struct ipmi_rs *ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf,
uint8_t target, uint8_t target,
uint8_t lun); uint8_t lun);
struct ipmi_rs *ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf, struct ipmi_rs *ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf,
uint8_t sensor); uint8_t sensor,
uint8_t target, uint8_t lun);
struct ipmi_rs *ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf, struct ipmi_rs *ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf,
uint8_t sensor); uint8_t sensor,
uint8_t target, uint8_t lun);
const char *ipmi_sdr_get_sensor_type_desc(const uint8_t type); const char *ipmi_sdr_get_sensor_type_desc(const uint8_t type);
int ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin, int ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin,
uint16_t * reserve_id); uint16_t * reserve_id);
@ -848,7 +850,7 @@ int ipmi_sdr_print_sensor_entity_assoc(struct ipmi_intf *intf,
struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf, struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf,
struct entity_id *entity); struct entity_id *entity);
struct sdr_record_list *ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, struct sdr_record_list *ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf,
uint8_t num, uint8_t type); uint16_t gen_id, uint8_t num, uint8_t type);
struct sdr_record_list *ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf *intf, struct sdr_record_list *ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf *intf,
uint8_t type); uint8_t type);
struct sdr_record_list *ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, struct sdr_record_list *ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf,
@ -867,9 +869,11 @@ void ipmi_sdr_print_discrete_state_mini(const char *separator,
uint8_t state1, uint8_t state2); uint8_t state1, uint8_t state2);
int ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf, int ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
uint8_t sensor_num, uint8_t sensor_type, uint8_t sensor_num, uint8_t sensor_type,
uint8_t event_type, int numeric_fmt); uint8_t event_type, int numeric_fmt,
uint8_t target, uint8_t lun);
int ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf, int ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
uint8_t sensor_num, uint8_t sensor_type, uint8_t sensor_num, uint8_t sensor_type,
uint8_t event_type, int numeric_fmt); uint8_t event_type, int numeric_fmt,
uint8_t target, uint8_t lun);
#endif /* IPMI_SDR_H */ #endif /* IPMI_SDR_H */

View File

@ -241,6 +241,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
struct sdr_record_list * sdr; struct sdr_record_list * sdr;
struct platform_event_msg emsg; struct platform_event_msg emsg;
int off; int off;
uint8_t target, lun;
if (id == NULL) { if (id == NULL) {
lprintf(LOG_ERR, "No sensor ID supplied"); lprintf(LOG_ERR, "No sensor ID supplied");
@ -276,6 +277,8 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
emsg.sensor_type = sdr->record.full->sensor.type; emsg.sensor_type = sdr->record.full->sensor.type;
emsg.sensor_num = sdr->record.full->keys.sensor_num; emsg.sensor_num = sdr->record.full->keys.sensor_num;
emsg.event_type = sdr->record.full->event_type; emsg.event_type = sdr->record.full->event_type;
target = sdr->record.full->keys.owner_id;
lun = sdr->record.full->keys.lun;
break; break;
case SDR_RECORD_TYPE_COMPACT_SENSOR: case SDR_RECORD_TYPE_COMPACT_SENSOR:
@ -283,6 +286,8 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
emsg.sensor_type = sdr->record.compact->sensor.type; emsg.sensor_type = sdr->record.compact->sensor.type;
emsg.sensor_num = sdr->record.compact->keys.sensor_num; emsg.sensor_num = sdr->record.compact->keys.sensor_num;
emsg.event_type = sdr->record.compact->event_type; emsg.event_type = sdr->record.compact->event_type;
target = sdr->record.compact->keys.owner_id;
lun = sdr->record.compact->keys.lun;
break; break;
default: default:
@ -347,14 +352,16 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
return -1; return -1;
} }
rsp = ipmi_sdr_get_sensor_thresholds(intf, emsg.sensor_num); rsp = ipmi_sdr_get_sensor_thresholds(intf, emsg.sensor_num,
target, lun);
if (rsp != NULL && rsp->ccode == 0) { if (rsp != NULL && rsp->ccode == 0) {
/* threshold reading */ /* threshold reading */
emsg.event_data[2] = rsp->data[(emsg.event_data[0] / 2) + 1]; emsg.event_data[2] = rsp->data[(emsg.event_data[0] / 2) + 1];
rsp = ipmi_sdr_get_sensor_hysteresis(intf, emsg.sensor_num); rsp = ipmi_sdr_get_sensor_hysteresis(intf, emsg.sensor_num,
target, lun);
if (rsp != NULL && rsp->ccode == 0) if (rsp != NULL && rsp->ccode == 0)
off = dir ? rsp->data[0] : rsp->data[1]; off = dir ? rsp->data[0] : rsp->data[1];
if (off <= 0) if (off <= 0)

View File

@ -364,13 +364,21 @@ sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor * sensor,
* *
* @intf: ipmi interface * @intf: ipmi interface
* @sensor: sensor number * @sensor: sensor number
* @target: sensor owner ID
* @lun: sensor lun
* *
* returns pointer to ipmi response * returns pointer to ipmi response
*/ */
struct ipmi_rs * struct ipmi_rs *
ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf, uint8_t sensor) ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf, uint8_t sensor,
uint8_t target, uint8_t lun)
{ {
struct ipmi_rq req; struct ipmi_rq req;
struct ipmi_rs *rsp;
uint8_t save_addr;
save_addr = intf->target_addr;
intf->target_addr = target;
memset(&req, 0, sizeof (req)); memset(&req, 0, sizeof (req));
req.msg.netfn = IPMI_NETFN_SE; req.msg.netfn = IPMI_NETFN_SE;
@ -378,21 +386,31 @@ ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf, uint8_t sensor)
req.msg.data = &sensor; req.msg.data = &sensor;
req.msg.data_len = sizeof (sensor); req.msg.data_len = sizeof (sensor);
return intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
intf->target_addr = save_addr;
return rsp;
} }
/* ipmi_sdr_get_sensor_hysteresis - return hysteresis for sensor /* ipmi_sdr_get_sensor_hysteresis - return hysteresis for sensor
* *
* @intf: ipmi interface * @intf: ipmi interface
* @sensor: sensor number * @sensor: sensor number
* @target: sensor owner ID
* @lun: sensor lun
* *
* returns pointer to ipmi response * returns pointer to ipmi response
*/ */
struct ipmi_rs * struct ipmi_rs *
ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf, uint8_t sensor) ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf, uint8_t sensor,
uint8_t target, uint8_t lun)
{ {
struct ipmi_rq req; struct ipmi_rq req;
uint8_t rqdata[2]; uint8_t rqdata[2];
struct ipmi_rs *rsp;
uint8_t save_addr;
save_addr = intf->target_addr;
intf->target_addr = target;
rqdata[0] = sensor; rqdata[0] = sensor;
rqdata[1] = 0xff; /* reserved */ rqdata[1] = 0xff; /* reserved */
@ -403,7 +421,9 @@ ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf, uint8_t sensor)
req.msg.data = rqdata; req.msg.data = rqdata;
req.msg.data_len = 2; req.msg.data_len = 2;
return intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
intf->target_addr = save_addr;
return rsp;
} }
/* ipmi_sdr_get_sensor_reading - retrieve a raw sensor reading /* ipmi_sdr_get_sensor_reading - retrieve a raw sensor reading
@ -444,8 +464,8 @@ ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf, uint8_t sensor,
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
uint8_t save_addr; uint8_t save_addr;
if ((strncmp(intf->name, "ipmb", 4)) != 0) // if ((strncmp(intf->name, "ipmb", 4)) != 0)
return ipmi_sdr_get_sensor_reading(intf, sensor); // return ipmi_sdr_get_sensor_reading(intf, sensor);
save_addr = intf->target_addr; save_addr = intf->target_addr;
intf->target_addr = target; intf->target_addr = target;
@ -465,13 +485,21 @@ ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf, uint8_t sensor,
* *
* @intf: ipmi interface * @intf: ipmi interface
* @sensor: sensor id * @sensor: sensor id
* @target: sensor owner ID
* @lun: sensor lun
* *
* returns ipmi response structure * returns ipmi response structure
*/ */
struct ipmi_rs * struct ipmi_rs *
ipmi_sdr_get_sensor_event_status(struct ipmi_intf *intf, uint8_t sensor) ipmi_sdr_get_sensor_event_status(struct ipmi_intf *intf, uint8_t sensor,
uint8_t target, uint8_t lun)
{ {
struct ipmi_rq req; struct ipmi_rq req;
struct ipmi_rs *rsp;
uint8_t save_addr;
save_addr = intf->target_addr;
intf->target_addr = target;
memset(&req, 0, sizeof (req)); memset(&req, 0, sizeof (req));
req.msg.netfn = IPMI_NETFN_SE; req.msg.netfn = IPMI_NETFN_SE;
@ -479,20 +507,30 @@ ipmi_sdr_get_sensor_event_status(struct ipmi_intf *intf, uint8_t sensor)
req.msg.data = &sensor; req.msg.data = &sensor;
req.msg.data_len = 1; req.msg.data_len = 1;
return intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
intf->target_addr = save_addr;
return rsp;
} }
/* ipmi_sdr_get_sensor_event_enable - retrieve sensor event enables /* ipmi_sdr_get_sensor_event_enable - retrieve sensor event enables
* *
* @intf: ipmi interface * @intf: ipmi interface
* @sensor: sensor id * @sensor: sensor id
* @target: sensor owner ID
* @lun: sensor lun
* *
* returns ipmi response structure * returns ipmi response structure
*/ */
struct ipmi_rs * struct ipmi_rs *
ipmi_sdr_get_sensor_event_enable(struct ipmi_intf *intf, uint8_t sensor) ipmi_sdr_get_sensor_event_enable(struct ipmi_intf *intf, uint8_t sensor,
uint8_t target, uint8_t lun)
{ {
struct ipmi_rq req; struct ipmi_rq req;
struct ipmi_rs *rsp;
uint8_t save_addr;
save_addr = intf->target_addr;
intf->target_addr = target;
memset(&req, 0, sizeof (req)); memset(&req, 0, sizeof (req));
req.msg.netfn = IPMI_NETFN_SE; req.msg.netfn = IPMI_NETFN_SE;
@ -500,7 +538,9 @@ ipmi_sdr_get_sensor_event_enable(struct ipmi_intf *intf, uint8_t sensor)
req.msg.data = &sensor; req.msg.data = &sensor;
req.msg.data_len = 1; req.msg.data_len = 1;
return intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
intf->target_addr = save_addr;
return rsp;
} }
/* ipmi_sdr_get_sensor_type_desc - Get sensor type descriptor /* ipmi_sdr_get_sensor_type_desc - Get sensor type descriptor
@ -745,7 +785,8 @@ int
ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf, ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
uint8_t sensor_num, uint8_t sensor_num,
uint8_t sensor_type, uint8_t sensor_type,
uint8_t event_type, int numeric_fmt) uint8_t event_type, int numeric_fmt,
uint8_t target, uint8_t lun)
{ {
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
int i; int i;
@ -768,7 +809,8 @@ ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
{0x00, NULL}, {0x00, NULL},
}; };
rsp = ipmi_sdr_get_sensor_event_status(intf, sensor_num); rsp = ipmi_sdr_get_sensor_event_status(intf, sensor_num,
target, lun);
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_DEBUG, lprintf(LOG_DEBUG,
@ -955,7 +997,8 @@ int
ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf, ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
uint8_t sensor_num, uint8_t sensor_num,
uint8_t sensor_type, uint8_t sensor_type,
uint8_t event_type, int numeric_fmt) uint8_t event_type, int numeric_fmt,
uint8_t target, uint8_t lun)
{ {
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
int i; int i;
@ -978,7 +1021,8 @@ ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
{0x00, NULL}, {0x00, NULL},
}; };
rsp = ipmi_sdr_get_sensor_event_enable(intf, sensor_num); rsp = ipmi_sdr_get_sensor_event_enable(intf, sensor_num,
target, lun);
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_DEBUG, lprintf(LOG_DEBUG,
@ -1089,10 +1133,14 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
int i = 0, validread = 1, do_unit = 1; int i = 0, validread = 1, do_unit = 1;
double val = 0.0, creading = 0.0; double val = 0.0, creading = 0.0;
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
uint8_t target, lun;
if (sensor == NULL) if (sensor == NULL)
return -1; return -1;
target = sensor->keys.owner_id;
lun = sensor->keys.lun;
memset(desc, 0, sizeof (desc)); memset(desc, 0, sizeof (desc));
snprintf(desc, (sensor->id_code & 0x1f) + 1, "%s", sensor->id_string); snprintf(desc, (sensor->id_code & 0x1f) + 1, "%s", sensor->id_string);
@ -1328,12 +1376,16 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
sensor->keys.sensor_num, sensor->keys.sensor_num,
sensor->sensor.type, sensor->sensor.type,
sensor->event_type, sensor->event_type,
DISCRETE_SENSOR); DISCRETE_SENSOR,
target,
lun);
ipmi_sdr_print_sensor_event_enable(intf, ipmi_sdr_print_sensor_event_enable(intf,
sensor->keys.sensor_num, sensor->keys.sensor_num,
sensor->sensor.type, sensor->sensor.type,
sensor->event_type, sensor->event_type,
DISCRETE_SENSOR); DISCRETE_SENSOR,
target,
lun);
printf("\n"); printf("\n");
return 0; /* done */ return 0; /* done */
@ -1502,12 +1554,16 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
ipmi_sdr_print_sensor_event_status(intf, ipmi_sdr_print_sensor_event_status(intf,
sensor->keys.sensor_num, sensor->keys.sensor_num,
sensor->sensor.type, sensor->sensor.type,
sensor->event_type, ANALOG_SENSOR); sensor->event_type, ANALOG_SENSOR,
target,
lun);
ipmi_sdr_print_sensor_event_enable(intf, ipmi_sdr_print_sensor_event_enable(intf,
sensor->keys.sensor_num, sensor->keys.sensor_num,
sensor->sensor.type, sensor->sensor.type,
sensor->event_type, ANALOG_SENSOR); sensor->event_type, ANALOG_SENSOR,
target,
lun);
printf("\n"); printf("\n");
return 0; return 0;
@ -1654,10 +1710,14 @@ ipmi_sdr_print_sensor_compact(struct ipmi_intf *intf,
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
char desc[17]; char desc[17];
int validread = 1; int validread = 1;
uint8_t target, lun;
if (sensor == NULL) if (sensor == NULL)
return -1; return -1;
target = sensor->keys.owner_id;
lun = sensor->keys.lun;
memset(desc, 0, sizeof (desc)); memset(desc, 0, sizeof (desc));
snprintf(desc, (sensor->id_code & 0x1f) + 1, "%s", sensor->id_string); snprintf(desc, (sensor->id_code & 0x1f) + 1, "%s", sensor->id_string);
@ -1721,12 +1781,16 @@ ipmi_sdr_print_sensor_compact(struct ipmi_intf *intf,
sensor->keys.sensor_num, sensor->keys.sensor_num,
sensor->sensor.type, sensor->sensor.type,
sensor->event_type, sensor->event_type,
DISCRETE_SENSOR); DISCRETE_SENSOR,
target,
lun);
ipmi_sdr_print_sensor_event_enable(intf, ipmi_sdr_print_sensor_event_enable(intf,
sensor->keys.sensor_num, sensor->keys.sensor_num,
sensor->sensor.type, sensor->sensor.type,
sensor->event_type, sensor->event_type,
DISCRETE_SENSOR); DISCRETE_SENSOR,
target,
lun);
printf("\n"); printf("\n");
} else { } else {
int dostate = 1; int dostate = 1;
@ -2837,6 +2901,7 @@ ipmi_sdr_list_empty(struct ipmi_intf *intf)
/* ipmi_sdr_find_sdr_bynumtype - lookup SDR entry by number/type /* ipmi_sdr_find_sdr_bynumtype - lookup SDR entry by number/type
* *
* @intf: ipmi interface * @intf: ipmi interface
* @gen_id: sensor owner ID/LUN - SEL generator ID
* @num: sensor number to search for * @num: sensor number to search for
* @type: sensor type to search for * @type: sensor type to search for
* *
@ -2844,7 +2909,7 @@ ipmi_sdr_list_empty(struct ipmi_intf *intf)
* returns NULL on error * returns NULL on error
*/ */
struct sdr_record_list * struct sdr_record_list *
ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, uint8_t num, uint8_t type) ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, uint16_t gen_id, uint8_t num, uint8_t type)
{ {
struct sdr_get_rs *header; struct sdr_get_rs *header;
struct sdr_record_list *e; struct sdr_record_list *e;
@ -2863,16 +2928,19 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, uint8_t num, uint8_t type)
switch (e->type) { switch (e->type) {
case SDR_RECORD_TYPE_FULL_SENSOR: case SDR_RECORD_TYPE_FULL_SENSOR:
if (e->record.full->keys.sensor_num == num && if (e->record.full->keys.sensor_num == num &&
e->record.full->keys.owner_id == (gen_id & 0x00ff) &&
e->record.full->sensor.type == type) e->record.full->sensor.type == type)
return e; return e;
break; break;
case SDR_RECORD_TYPE_COMPACT_SENSOR: case SDR_RECORD_TYPE_COMPACT_SENSOR:
if (e->record.compact->keys.sensor_num == num && if (e->record.compact->keys.sensor_num == num &&
e->record.compact->keys.owner_id == (gen_id & 0x00ff) &&
e->record.compact->sensor.type == type) e->record.compact->sensor.type == type)
return e; return e;
break; break;
case SDR_RECORD_TYPE_EVENTONLY_SENSOR: case SDR_RECORD_TYPE_EVENTONLY_SENSOR:
if (e->record.eventonly->keys.sensor_num == num && if (e->record.eventonly->keys.sensor_num == num &&
e->record.eventonly->keys.owner_id == (gen_id & 0x00ff) &&
e->record.eventonly->sensor_type == type) e->record.eventonly->sensor_type == type)
return e; return e;
break; break;
@ -2902,6 +2970,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, uint8_t num, uint8_t type)
sdrr->record.full = sdrr->record.full =
(struct sdr_record_full_sensor *) rec; (struct sdr_record_full_sensor *) rec;
if (sdrr->record.full->keys.sensor_num == num if (sdrr->record.full->keys.sensor_num == num
&& sdrr->record.full->keys.owner_id == (gen_id & 0x00ff)
&& sdrr->record.full->sensor.type == type) && sdrr->record.full->sensor.type == type)
found = 1; found = 1;
break; break;
@ -2909,6 +2978,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, uint8_t num, uint8_t type)
sdrr->record.compact = sdrr->record.compact =
(struct sdr_record_compact_sensor *) rec; (struct sdr_record_compact_sensor *) rec;
if (sdrr->record.compact->keys.sensor_num == num if (sdrr->record.compact->keys.sensor_num == num
&& sdrr->record.compact->keys.owner_id == (gen_id & 0x00ff)
&& sdrr->record.compact->sensor.type == type) && sdrr->record.compact->sensor.type == type)
found = 1; found = 1;
break; break;
@ -2916,6 +2986,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf, uint8_t num, uint8_t type)
sdrr->record.eventonly = sdrr->record.eventonly =
(struct sdr_record_eventonly_sensor *) rec; (struct sdr_record_eventonly_sensor *) rec;
if (sdrr->record.eventonly->keys.sensor_num == num if (sdrr->record.eventonly->keys.sensor_num == num
&& sdrr->record.eventonly->keys.owner_id == (gen_id & 0x00ff)
&& sdrr->record.eventonly->sensor_type == type) && sdrr->record.eventonly->sensor_type == type)
found = 1; found = 1;
break; break;

View File

@ -933,7 +933,7 @@ ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt)
int data_count; int data_count;
if (sel_extended && (evt->record_type < 0xc0)) if (sel_extended && (evt->record_type < 0xc0))
sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt->sel_type.standard_type.sensor_num, evt->sel_type.standard_type.sensor_type); sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt->sel_type.standard_type.gen_id, evt->sel_type.standard_type.sensor_num, evt->sel_type.standard_type.sensor_type);
if (!evt) if (!evt)
@ -1245,6 +1245,7 @@ ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_
return; return;
sdr = ipmi_sdr_find_sdr_bynumtype(intf, sdr = ipmi_sdr_find_sdr_bynumtype(intf,
evt->sel_type.standard_type.gen_id,
evt->sel_type.standard_type.sensor_num, evt->sel_type.standard_type.sensor_num,
evt->sel_type.standard_type.sensor_type); evt->sel_type.standard_type.sensor_type);
if (sdr == NULL) { if (sdr == NULL) {
@ -2053,7 +2054,7 @@ ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, char ** argv)
/* lookup SDR entry based on sensor number and type */ /* lookup SDR entry based on sensor number and type */
ipmi_sel_print_extended_entry_verbose(intf, &evt); ipmi_sel_print_extended_entry_verbose(intf, &evt);
sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt.sel_type.standard_type.sensor_num, evt.sel_type.standard_type.sensor_type); sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt.sel_type.standard_type.gen_id, evt.sel_type.standard_type.sensor_num, evt.sel_type.standard_type.sensor_type);
if (sdr == NULL) { if (sdr == NULL) {
continue; continue;
} }

View File

@ -50,10 +50,13 @@ static
struct ipmi_rs * struct ipmi_rs *
ipmi_sensor_set_sensor_thresholds(struct ipmi_intf *intf, ipmi_sensor_set_sensor_thresholds(struct ipmi_intf *intf,
uint8_t sensor, uint8_t sensor,
uint8_t threshold, uint8_t setting) uint8_t threshold, uint8_t setting,
uint8_t target, uint8_t lun)
{ {
struct ipmi_rq req; struct ipmi_rq req;
static struct sensor_set_thresh_rq set_thresh_rq; static struct sensor_set_thresh_rq set_thresh_rq;
struct ipmi_rs *rsp;
uint8_t save_addr;
memset(&set_thresh_rq, 0, sizeof (set_thresh_rq)); memset(&set_thresh_rq, 0, sizeof (set_thresh_rq));
set_thresh_rq.sensor_num = sensor; set_thresh_rq.sensor_num = sensor;
@ -73,13 +76,18 @@ ipmi_sensor_set_sensor_thresholds(struct ipmi_intf *intf,
else else
return NULL; return NULL;
save_addr = intf->target_addr;
intf->target_addr = target;
memset(&req, 0, sizeof (req)); memset(&req, 0, sizeof (req));
req.msg.netfn = IPMI_NETFN_SE; req.msg.netfn = IPMI_NETFN_SE;
req.msg.cmd = SET_SENSOR_THRESHOLDS; req.msg.cmd = SET_SENSOR_THRESHOLDS;
req.msg.data = (uint8_t *) & set_thresh_rq; req.msg.data = (uint8_t *) & set_thresh_rq;
req.msg.data_len = sizeof (set_thresh_rq); req.msg.data_len = sizeof (set_thresh_rq);
return intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
intf->target_addr = save_addr;
return rsp;
} }
static int static int
@ -234,7 +242,8 @@ ipmi_sensor_print_full_analog(struct ipmi_intf *intf,
/* /*
* Get sensor thresholds * Get sensor thresholds
*/ */
rsp = ipmi_sdr_get_sensor_thresholds(intf, sensor->keys.sensor_num); rsp = ipmi_sdr_get_sensor_thresholds(intf, sensor->keys.sensor_num,
sensor->keys.owner_id, sensor->keys.lun);
if (rsp == NULL) if (rsp == NULL)
thresh_available = 0; thresh_available = 0;
@ -384,13 +393,17 @@ ipmi_sensor_print_full_analog(struct ipmi_intf *intf,
sensor_num, sensor_num,
sensor->sensor.type, sensor->sensor.type,
sensor->event_type, sensor->event_type,
ANALOG_SENSOR); ANALOG_SENSOR,
sensor->keys.owner_id,
sensor->keys.lun);
ipmi_sdr_print_sensor_event_enable(intf, ipmi_sdr_print_sensor_event_enable(intf,
sensor->keys. sensor->keys.
sensor_num, sensor_num,
sensor->sensor.type, sensor->sensor.type,
sensor->event_type, sensor->event_type,
ANALOG_SENSOR); ANALOG_SENSOR,
sensor->keys.owner_id,
sensor->keys.lun);
printf("\n"); printf("\n");
} }
@ -556,11 +569,13 @@ static const struct valstr threshold_vals[] = {
static int static int
__ipmi_sensor_set_threshold(struct ipmi_intf *intf, __ipmi_sensor_set_threshold(struct ipmi_intf *intf,
uint8_t num, uint8_t mask, uint8_t setting) uint8_t num, uint8_t mask, uint8_t setting,
uint8_t target, uint8_t lun)
{ {
struct ipmi_rs *rsp; struct ipmi_rs *rsp;
rsp = ipmi_sensor_set_sensor_thresholds(intf, num, mask, setting); rsp = ipmi_sensor_set_sensor_thresholds(intf, num, mask, setting,
target, lun);
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error setting threshold"); lprintf(LOG_ERR, "Error setting threshold");
@ -685,7 +700,9 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
sdr->record.full->keys. sdr->record.full->keys.
sensor_num, settingMask, sensor_num, settingMask,
sdr_convert_sensor_value_to_raw sdr_convert_sensor_value_to_raw
(sdr->record.full, setting1)); (sdr->record.full, setting1),
sdr->record.full->keys.owner_id,
sdr->record.full->keys.lun);
settingMask = UPPER_CRIT_SPECIFIED; settingMask = UPPER_CRIT_SPECIFIED;
printf("Setting sensor \"%s\" %s threshold to %.3f\n", printf("Setting sensor \"%s\" %s threshold to %.3f\n",
@ -695,7 +712,9 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
sdr->record.full->keys. sdr->record.full->keys.
sensor_num, settingMask, sensor_num, settingMask,
sdr_convert_sensor_value_to_raw sdr_convert_sensor_value_to_raw
(sdr->record.full, setting2)); (sdr->record.full, setting2),
sdr->record.full->keys.owner_id,
sdr->record.full->keys.lun);
settingMask = UPPER_NON_RECOV_SPECIFIED; settingMask = UPPER_NON_RECOV_SPECIFIED;
printf("Setting sensor \"%s\" %s threshold to %.3f\n", printf("Setting sensor \"%s\" %s threshold to %.3f\n",
@ -705,7 +724,9 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
sdr->record.full->keys. sdr->record.full->keys.
sensor_num, settingMask, sensor_num, settingMask,
sdr_convert_sensor_value_to_raw sdr_convert_sensor_value_to_raw
(sdr->record.full, setting3)); (sdr->record.full, setting3),
sdr->record.full->keys.owner_id,
sdr->record.full->keys.lun);
} else if (allLower) { } else if (allLower) {
settingMask = LOWER_NON_RECOV_SPECIFIED; settingMask = LOWER_NON_RECOV_SPECIFIED;
printf("Setting sensor \"%s\" %s threshold to %.3f\n", printf("Setting sensor \"%s\" %s threshold to %.3f\n",
@ -715,7 +736,9 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
sdr->record.full->keys. sdr->record.full->keys.
sensor_num, settingMask, sensor_num, settingMask,
sdr_convert_sensor_value_to_raw sdr_convert_sensor_value_to_raw
(sdr->record.full, setting1)); (sdr->record.full, setting1),
sdr->record.full->keys.owner_id,
sdr->record.full->keys.lun);
settingMask = LOWER_CRIT_SPECIFIED; settingMask = LOWER_CRIT_SPECIFIED;
printf("Setting sensor \"%s\" %s threshold to %.3f\n", printf("Setting sensor \"%s\" %s threshold to %.3f\n",
@ -725,7 +748,9 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
sdr->record.full->keys. sdr->record.full->keys.
sensor_num, settingMask, sensor_num, settingMask,
sdr_convert_sensor_value_to_raw sdr_convert_sensor_value_to_raw
(sdr->record.full, setting2)); (sdr->record.full, setting2),
sdr->record.full->keys.owner_id,
sdr->record.full->keys.lun);
settingMask = LOWER_NON_CRIT_SPECIFIED; settingMask = LOWER_NON_CRIT_SPECIFIED;
printf("Setting sensor \"%s\" %s threshold to %.3f\n", printf("Setting sensor \"%s\" %s threshold to %.3f\n",
@ -735,7 +760,9 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
sdr->record.full->keys. sdr->record.full->keys.
sensor_num, settingMask, sensor_num, settingMask,
sdr_convert_sensor_value_to_raw sdr_convert_sensor_value_to_raw
(sdr->record.full, setting3)); (sdr->record.full, setting3),
sdr->record.full->keys.owner_id,
sdr->record.full->keys.lun);
} else { } else {
printf("Setting sensor \"%s\" %s threshold to %.3f\n", printf("Setting sensor \"%s\" %s threshold to %.3f\n",
sdr->record.full->id_string, sdr->record.full->id_string,
@ -745,7 +772,9 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
sdr->record.full->keys. sdr->record.full->keys.
sensor_num, settingMask, sensor_num, settingMask,
sdr_convert_sensor_value_to_raw sdr_convert_sensor_value_to_raw
(sdr->record.full, setting1)); (sdr->record.full, setting1),
sdr->record.full->keys.owner_id,
sdr->record.full->keys.lun);
} }
return ret; return ret;

View File

@ -212,7 +212,7 @@ log_event(struct ipmi_event_intf * eintf, struct sel_event_record * evt)
ipmi_get_event_desc(intf, evt, &desc); ipmi_get_event_desc(intf, evt, &desc);
sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt->sel_type.standard_type.sensor_num, sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt->sel_type.standard_type.gen_id, evt->sel_type.standard_type.sensor_num,
evt->sel_type.standard_type.sensor_type); evt->sel_type.standard_type.sensor_type);
if (sdr == NULL) { if (sdr == NULL) {