mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Hook ipmi_get_channel_info() to _ipmi_get_*()
Commit hooks ipmi_get_channel_info() to new _ipmi_get_*() functions.
This commit is contained in:
parent
238d3c4ea9
commit
56aa025dc2
@ -264,8 +264,6 @@ ipmi_get_channel_auth_cap(struct ipmi_intf *intf, uint8_t channel, uint8_t priv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ipmi_get_channel_info
|
* ipmi_get_channel_info
|
||||||
*
|
*
|
||||||
@ -276,105 +274,69 @@ ipmi_get_channel_auth_cap(struct ipmi_intf *intf, uint8_t channel, uint8_t priv)
|
|||||||
int
|
int
|
||||||
ipmi_get_channel_info(struct ipmi_intf *intf, uint8_t channel)
|
ipmi_get_channel_info(struct ipmi_intf *intf, uint8_t channel)
|
||||||
{
|
{
|
||||||
struct ipmi_rs *rsp;
|
struct channel_info_t channel_info = {0};
|
||||||
struct ipmi_rq req;
|
struct channel_access_t channel_access = {0};
|
||||||
uint8_t rqdata[2];
|
int ccode = 0;
|
||||||
uint8_t medium;
|
|
||||||
struct get_channel_info_rsp channel_info;
|
|
||||||
struct get_channel_access_rsp channel_access;
|
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
channel_info.channel = channel;
|
||||||
req.msg.netfn = IPMI_NETFN_APP;
|
ccode = _ipmi_get_channel_info(intf, &channel_info);
|
||||||
req.msg.cmd = IPMI_GET_CHANNEL_INFO;
|
if (eval_ccode(ccode) != 0) {
|
||||||
req.msg.data = &channel;
|
|
||||||
req.msg.data_len = 1;
|
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
|
||||||
if (rsp == NULL) {
|
|
||||||
lprintf(LOG_ERR, "Unable to Get Channel Info");
|
lprintf(LOG_ERR, "Unable to Get Channel Info");
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
|
||||||
if (rsp->ccode > 0) {
|
|
||||||
lprintf(LOG_ERR, "Get Channel Info failed: %s",
|
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&channel_info, rsp->data, sizeof(struct get_channel_info_rsp));
|
printf("Channel 0x%x info:\n", channel_info.channel);
|
||||||
|
|
||||||
printf("Channel 0x%x info:\n", channel_info.channel_number);
|
|
||||||
|
|
||||||
printf(" Channel Medium Type : %s\n",
|
printf(" Channel Medium Type : %s\n",
|
||||||
val2str(channel_info.channel_medium, ipmi_channel_medium_vals));
|
val2str(channel_info.medium,
|
||||||
|
ipmi_channel_medium_vals));
|
||||||
printf(" Channel Protocol Type : %s\n",
|
printf(" Channel Protocol Type : %s\n",
|
||||||
val2str(channel_info.channel_protocol, ipmi_channel_protocol_vals));
|
val2str(channel_info.protocol,
|
||||||
|
ipmi_channel_protocol_vals));
|
||||||
printf(" Session Support : ");
|
printf(" Session Support : ");
|
||||||
switch (channel_info.session_support) {
|
switch (channel_info.session_support) {
|
||||||
case 0x0:
|
case IPMI_CHANNEL_SESSION_LESS:
|
||||||
printf("session-less\n");
|
printf("session-less\n");
|
||||||
break;
|
break;
|
||||||
case 0x1:
|
case IPMI_CHANNEL_SESSION_SINGLE:
|
||||||
printf("single-session\n");
|
printf("single-session\n");
|
||||||
break;
|
break;
|
||||||
case 0x2:
|
case IPMI_CHANNEL_SESSION_MULTI:
|
||||||
printf("multi-session\n");
|
printf("multi-session\n");
|
||||||
break;
|
break;
|
||||||
case 0x3:
|
case IPMI_CHANNEL_SESSION_BASED:
|
||||||
default:
|
|
||||||
printf("session-based\n");
|
printf("session-based\n");
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
printf("unknown\n");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" Active Session Count : %d\n",
|
printf(" Active Session Count : %d\n",
|
||||||
channel_info.active_sessions);
|
channel_info.active_sessions);
|
||||||
|
|
||||||
printf(" Protocol Vendor ID : %d\n",
|
printf(" Protocol Vendor ID : %d\n",
|
||||||
channel_info.vendor_id[0] |
|
channel_info.vendor_id[0] |
|
||||||
channel_info.vendor_id[1] << 8 |
|
channel_info.vendor_id[1] << 8 |
|
||||||
channel_info.vendor_id[2] << 16);
|
channel_info.vendor_id[2] << 16);
|
||||||
|
|
||||||
|
|
||||||
/* only proceed if this is LAN channel */
|
/* only proceed if this is LAN channel */
|
||||||
medium = ipmi_get_channel_medium(intf, channel);
|
if (channel_info.medium != IPMI_CHANNEL_MEDIUM_LAN
|
||||||
if (medium != IPMI_CHANNEL_MEDIUM_LAN &&
|
&& channel_info.medium != IPMI_CHANNEL_MEDIUM_LAN_OTHER) {
|
||||||
medium != IPMI_CHANNEL_MEDIUM_LAN_OTHER) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
channel_access.channel = channel_info.channel;
|
||||||
rqdata[0] = channel & 0xf;
|
ccode = _ipmi_get_channel_access(intf, &channel_access, 1);
|
||||||
|
if (eval_ccode(ccode) != 0) {
|
||||||
/* get volatile settings */
|
|
||||||
rqdata[1] = 0x80; /* 0x80=active */
|
|
||||||
req.msg.netfn = IPMI_NETFN_APP;
|
|
||||||
req.msg.cmd = IPMI_GET_CHANNEL_ACCESS;
|
|
||||||
req.msg.data = rqdata;
|
|
||||||
req.msg.data_len = 2;
|
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
|
||||||
if (rsp == NULL) {
|
|
||||||
lprintf(LOG_ERR, "Unable to Get Channel Access (volatile)");
|
lprintf(LOG_ERR, "Unable to Get Channel Access (volatile)");
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
|
||||||
lprintf(LOG_ERR, "Get Channel Access (volatile) failed: %s",
|
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&channel_access, rsp->data, sizeof(struct get_channel_access_rsp));
|
|
||||||
|
|
||||||
|
|
||||||
printf(" Volatile(active) Settings\n");
|
printf(" Volatile(active) Settings\n");
|
||||||
printf(" Alerting : %sabled\n",
|
printf(" Alerting : %sabled\n",
|
||||||
(channel_access.alerting) ? "dis" : "en");
|
(channel_access.alerting) ? "dis" : "en");
|
||||||
printf(" Per-message Auth : %sabled\n",
|
printf(" Per-message Auth : %sabled\n",
|
||||||
(channel_access.per_message_auth) ? "dis" : "en");
|
(channel_access.per_message_auth) ? "dis" : "en");
|
||||||
printf(" User Level Auth : %sabled\n",
|
printf(" User Level Auth : %sabled\n",
|
||||||
(channel_access.user_level_auth) ? "dis" : "en");
|
(channel_access.user_level_auth) ? "dis" : "en");
|
||||||
|
|
||||||
printf(" Access Mode : ");
|
printf(" Access Mode : ");
|
||||||
switch (channel_access.access_mode) {
|
switch (channel_access.access_mode) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -394,30 +356,22 @@ ipmi_get_channel_info(struct ipmi_intf *intf, uint8_t channel)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(&channel_access, 0, sizeof(channel_access));
|
||||||
|
channel_access.channel = channel_info.channel;
|
||||||
/* get non-volatile settings */
|
/* get non-volatile settings */
|
||||||
|
ccode = _ipmi_get_channel_access(intf, &channel_access, 0);
|
||||||
rqdata[1] = 0x40; /* 0x40=non-volatile */
|
if (eval_ccode(ccode) != 0) {
|
||||||
rsp = intf->sendrecv(intf, &req);
|
|
||||||
if (rsp == NULL) {
|
|
||||||
lprintf(LOG_ERR, "Unable to Get Channel Access (non-volatile)");
|
lprintf(LOG_ERR, "Unable to Get Channel Access (non-volatile)");
|
||||||
return -1;
|
return (-1);
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
|
||||||
lprintf(LOG_ERR, "Get Channel Access (non-volatile) failed: %s",
|
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&channel_access, rsp->data, sizeof(struct get_channel_access_rsp));
|
|
||||||
|
|
||||||
printf(" Non-Volatile Settings\n");
|
printf(" Non-Volatile Settings\n");
|
||||||
printf(" Alerting : %sabled\n",
|
printf(" Alerting : %sabled\n",
|
||||||
(channel_access.alerting) ? "dis" : "en");
|
(channel_access.alerting) ? "dis" : "en");
|
||||||
printf(" Per-message Auth : %sabled\n",
|
printf(" Per-message Auth : %sabled\n",
|
||||||
(channel_access.per_message_auth) ? "dis" : "en");
|
(channel_access.per_message_auth) ? "dis" : "en");
|
||||||
printf(" User Level Auth : %sabled\n",
|
printf(" User Level Auth : %sabled\n",
|
||||||
(channel_access.user_level_auth) ? "dis" : "en");
|
(channel_access.user_level_auth) ? "dis" : "en");
|
||||||
|
|
||||||
printf(" Access Mode : ");
|
printf(" Access Mode : ");
|
||||||
switch (channel_access.access_mode) {
|
switch (channel_access.access_mode) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -436,7 +390,6 @@ ipmi_get_channel_info(struct ipmi_intf *intf, uint8_t channel)
|
|||||||
printf("unknown\n");
|
printf("unknown\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user