mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
dcmi: Refactor
- Refactor the ipmi_dcmi code for better readability; - Get rid of space indents; - Use tabs for indent, spaces for alignment; - Wrap too long lines;
This commit is contained in:
parent
f498e3e296
commit
724f7329a3
400
lib/ipmi_dcmi.c
400
lib/ipmi_dcmi.c
@ -83,29 +83,29 @@ static int ipmi_print_sensor_info(struct ipmi_intf *intf, uint16_t rec_id);
|
||||
|
||||
/* Main set of DCMI commands */
|
||||
const struct dcmi_cmd dcmi_cmd_vals[] = {
|
||||
{ 0x00, "discover", " Used to discover supported DCMI capabilities" },
|
||||
{ 0x01, "power", " Platform power limit command options" },
|
||||
{ 0x02, "sensors", " Prints the available DCMI sensors" },
|
||||
{ 0x03, "asset_tag", " Prints the platform's asset tag" },
|
||||
{ 0x04, "set_asset_tag", " Sets the platform's asset tag" },
|
||||
{ 0x05, "get_mc_id_string", " Get management controller ID string" },
|
||||
{ 0x06, "set_mc_id_string", " Set management controller ID string" },
|
||||
{ 0x07, "thermalpolicy", " Thermal policy get/set" },
|
||||
{ 0x08, "get_temp_reading", " Get Temperature Readings" },
|
||||
{ 0x09, "get_conf_param", " Get DCMI Config Parameters" },
|
||||
{ 0x0A, "set_conf_param", " Set DCMI Config Parameters" },
|
||||
{ 0x0B, "oob_discover", " Ping/Pong Message for DCMI Discovery" },
|
||||
{ 0x00, "discover", "Used to discover supported DCMI capabilities" },
|
||||
{ 0x01, "power", "Platform power limit command options" },
|
||||
{ 0x02, "sensors", "Prints the available DCMI sensors" },
|
||||
{ 0x03, "asset_tag", "Prints the platform's asset tag" },
|
||||
{ 0x04, "set_asset_tag", "Sets the platform's asset tag" },
|
||||
{ 0x05, "get_mc_id_string", "Get management controller ID string" },
|
||||
{ 0x06, "set_mc_id_string", "Set management controller ID string" },
|
||||
{ 0x07, "thermalpolicy", "Thermal policy get/set" },
|
||||
{ 0x08, "get_temp_reading", "Get Temperature Readings" },
|
||||
{ 0x09, "get_conf_param", "Get DCMI Config Parameters" },
|
||||
{ 0x0A, "set_conf_param", "Set DCMI Config Parameters" },
|
||||
{ 0x0B, "oob_discover", "Ping/Pong Message for DCMI Discovery" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
};
|
||||
|
||||
/* get capabilites */
|
||||
const struct dcmi_cmd dcmi_capable_vals[] = {
|
||||
{ 0x01, "platform", " Lists the system capabilities" },
|
||||
{ 0x01, "platform", "Lists the system capabilities" },
|
||||
{ 0x02, "mandatory_attributes", "Lists SEL, identification and"
|
||||
"temperature attributes" },
|
||||
{ 0x03, "optional_attributes", " Lists power capabilities" },
|
||||
{ 0x04, "managebility access", " Lists OOB channel information" },
|
||||
{ 0x03, "optional_attributes", "Lists power capabilities" },
|
||||
{ 0x04, "managebility access", "Lists OOB channel information" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
};
|
||||
@ -126,6 +126,7 @@ const struct dcmi_cmd dcmi_mandatory_platform_capabilities[] = {
|
||||
/* optional capabilities */
|
||||
const struct dcmi_cmd dcmi_optional_platform_capabilities[] = {
|
||||
{ 0x01, "Power management available", "" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
};
|
||||
|
||||
@ -152,7 +153,7 @@ const struct dcmi_cmd dcmi_id_capabilities_vals[] = {
|
||||
|
||||
/* Configuration parameters*/
|
||||
const struct dcmi_cmd dcmi_conf_param_vals[] = {
|
||||
{ 0x01, "activate_dhcp", "\tActivate DHCP"},
|
||||
{ 0x01, "activate_dhcp", "\tActivate DHCP" },
|
||||
{ 0x02, "dhcp_config", "\tDHCP Configuration" },
|
||||
{ 0x03, "init", "\t\tInitial timeout interval" },
|
||||
{ 0x04, "timeout", "\t\tServer contact timeout interval" },
|
||||
@ -164,8 +165,8 @@ const struct dcmi_cmd dcmi_conf_param_vals[] = {
|
||||
|
||||
/* temperature monitoring capabilities */
|
||||
const struct dcmi_cmd dcmi_temp_monitoring_vals[] = {
|
||||
{ 0x01, "inlet", " Inlet air temperature sensors" },
|
||||
{ 0x02, "cpu", " CPU temperature sensors" },
|
||||
{ 0x01, "inlet", "Inlet air temperature sensors" },
|
||||
{ 0x02, "cpu", "CPU temperature sensors" },
|
||||
{ 0x03, "baseboard", "Baseboard temperature sensors" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
@ -176,8 +177,8 @@ const struct dcmi_cmd dcmi_temp_monitoring_vals[] = {
|
||||
* sensor number
|
||||
*/
|
||||
const struct dcmi_cmd dcmi_discvry_snsr_vals[] = {
|
||||
{ 0x40, "Inlet", " Inlet air temperature sensors" },
|
||||
{ 0x41, "CPU", " CPU temperature sensors" },
|
||||
{ 0x40, "Inlet", "Inlet air temperature sensors" },
|
||||
{ 0x41, "CPU", "CPU temperature sensors" },
|
||||
{ 0x42, "Baseboard", "Baseboard temperature sensors" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
@ -185,19 +186,19 @@ const struct dcmi_cmd dcmi_discvry_snsr_vals[] = {
|
||||
|
||||
/* Temperature Readings */
|
||||
const struct dcmi_cmd dcmi_temp_read_vals[] = {
|
||||
{ 0x40, "Inlet", "Inlet air temperature(40h) " },
|
||||
{ 0x41, "CPU", "CPU temperature sensors(41h) " },
|
||||
{ 0x42, "Baseboard", "Baseboard temperature sensors(42h) " },
|
||||
{ 0x40, "Inlet", "Inlet air temperature(40h)" },
|
||||
{ 0x41, "CPU", "CPU temperature sensors(41h)" },
|
||||
{ 0x42, "Baseboard", "Baseboard temperature sensors(42h)" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
};
|
||||
|
||||
/* power management/control commands */
|
||||
const struct dcmi_cmd dcmi_pwrmgmt_vals[] = {
|
||||
{ 0x00, "reading", " Get power related readings from the system" },
|
||||
{ 0x01, "get_limit", " Get the configured power limits" },
|
||||
{ 0x02, "set_limit", " Set a power limit option" },
|
||||
{ 0x03, "activate", " Activate the set power limit" },
|
||||
{ 0x00, "reading", "Get power related readings from the system" },
|
||||
{ 0x01, "get_limit", "Get the configured power limits" },
|
||||
{ 0x02, "set_limit", "Set a power limit option" },
|
||||
{ 0x03, "activate", "Activate the set power limit" },
|
||||
{ 0x04, "deactivate", "Deactivate the set power limit" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
@ -205,61 +206,61 @@ const struct dcmi_cmd dcmi_pwrmgmt_vals[] = {
|
||||
|
||||
/* set power limit commands */
|
||||
const struct dcmi_cmd dcmi_pwrmgmt_set_usage_vals[] = {
|
||||
{ 0x00, "action", " <no_action | sel_logging | power_off>" },
|
||||
{ 0x01, "limit", " <number in Watts>" },
|
||||
{ 0x00, "action", "<no_action | sel_logging | power_off>" },
|
||||
{ 0x01, "limit", "<number in Watts>" },
|
||||
{ 0x02, "correction", "<number in milliseconds>" },
|
||||
{ 0x03, "sample", " <number in seconds>" },
|
||||
{ 0x03, "sample", "<number in seconds>" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
};
|
||||
|
||||
/* power management/get action commands */
|
||||
const struct dcmi_cmd dcmi_pwrmgmt_get_action_vals[] = {
|
||||
{ 0x00, "No Action", ""},
|
||||
{ 0x01, "Hard Power Off & Log Event to SEL", ""},
|
||||
{ 0x00, "No Action", "" },
|
||||
{ 0x01, "Hard Power Off & Log Event to SEL", "" },
|
||||
|
||||
{ 0x02, "OEM reserved (02h)", ""},
|
||||
{ 0x03, "OEM reserved (03h)", ""},
|
||||
{ 0x04, "OEM reserved (04h)", ""},
|
||||
{ 0x05, "OEM reserved (05h)", ""},
|
||||
{ 0x06, "OEM reserved (06h)", ""},
|
||||
{ 0x07, "OEM reserved (07h)", ""},
|
||||
{ 0x08, "OEM reserved (08h)", ""},
|
||||
{ 0x09, "OEM reserved (09h)", ""},
|
||||
{ 0x0a, "OEM reserved (0ah)", ""},
|
||||
{ 0x0b, "OEM reserved (0bh)", ""},
|
||||
{ 0x0c, "OEM reserved (0ch)", ""},
|
||||
{ 0x0d, "OEM reserved (0dh)", ""},
|
||||
{ 0x0e, "OEM reserved (0eh)", ""},
|
||||
{ 0x0f, "OEM reserved (0fh)", ""},
|
||||
{ 0x10, "OEM reserved (10h)", ""},
|
||||
{ 0x02, "OEM reserved (02h)", "" },
|
||||
{ 0x03, "OEM reserved (03h)", "" },
|
||||
{ 0x04, "OEM reserved (04h)", "" },
|
||||
{ 0x05, "OEM reserved (05h)", "" },
|
||||
{ 0x06, "OEM reserved (06h)", "" },
|
||||
{ 0x07, "OEM reserved (07h)", "" },
|
||||
{ 0x08, "OEM reserved (08h)", "" },
|
||||
{ 0x09, "OEM reserved (09h)", "" },
|
||||
{ 0x0a, "OEM reserved (0ah)", "" },
|
||||
{ 0x0b, "OEM reserved (0bh)", "" },
|
||||
{ 0x0c, "OEM reserved (0ch)", "" },
|
||||
{ 0x0d, "OEM reserved (0dh)", "" },
|
||||
{ 0x0e, "OEM reserved (0eh)", "" },
|
||||
{ 0x0f, "OEM reserved (0fh)", "" },
|
||||
{ 0x10, "OEM reserved (10h)", "" },
|
||||
|
||||
{ 0x11, "Log Event to SEL", ""},
|
||||
{ 0x11, "Log Event to SEL", "" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
};
|
||||
|
||||
/* power management/set action commands */
|
||||
const struct dcmi_cmd dcmi_pwrmgmt_action_vals[] = {
|
||||
{ 0x00, "no_action", "No Action"},
|
||||
{ 0x01, "power_off", "Hard Power Off & Log Event to SEL"},
|
||||
{ 0x11, "sel_logging", "Log Event to SEL"},
|
||||
{ 0x00, "no_action", "No Action" },
|
||||
{ 0x01, "power_off", "Hard Power Off & Log Event to SEL" },
|
||||
{ 0x11, "sel_logging", "Log Event to SEL" },
|
||||
|
||||
{ 0x02, "oem_02", "OEM reserved (02h)"},
|
||||
{ 0x03, "oem_03", "OEM reserved (03h)"},
|
||||
{ 0x04, "oem_04", "OEM reserved (04h)"},
|
||||
{ 0x05, "oem_05", "OEM reserved (05h)"},
|
||||
{ 0x06, "oem_06", "OEM reserved (06h)"},
|
||||
{ 0x07, "oem_07", "OEM reserved (07h)"},
|
||||
{ 0x08, "oem_08", "OEM reserved (08h)"},
|
||||
{ 0x09, "oem_09", "OEM reserved (09h)"},
|
||||
{ 0x0a, "oem_0a", "OEM reserved (0ah)"},
|
||||
{ 0x0b, "oem_0b", "OEM reserved (0bh)"},
|
||||
{ 0x0c, "oem_0c", "OEM reserved (0ch)"},
|
||||
{ 0x0d, "oem_0d", "OEM reserved (0dh)"},
|
||||
{ 0x0e, "oem_0e", "OEM reserved (0eh)"},
|
||||
{ 0x0f, "oem_0f", "OEM reserved (0fh)"},
|
||||
{ 0x10, "oem_10", "OEM reserved (10h)"},
|
||||
{ 0x02, "oem_02", "OEM reserved (02h)" },
|
||||
{ 0x03, "oem_03", "OEM reserved (03h)" },
|
||||
{ 0x04, "oem_04", "OEM reserved (04h)" },
|
||||
{ 0x05, "oem_05", "OEM reserved (05h)" },
|
||||
{ 0x06, "oem_06", "OEM reserved (06h)" },
|
||||
{ 0x07, "oem_07", "OEM reserved (07h)" },
|
||||
{ 0x08, "oem_08", "OEM reserved (08h)" },
|
||||
{ 0x09, "oem_09", "OEM reserved (09h)" },
|
||||
{ 0x0a, "oem_0a", "OEM reserved (0ah)" },
|
||||
{ 0x0b, "oem_0b", "OEM reserved (0bh)" },
|
||||
{ 0x0c, "oem_0c", "OEM reserved (0ch)" },
|
||||
{ 0x0d, "oem_0d", "OEM reserved (0dh)" },
|
||||
{ 0x0e, "oem_0e", "OEM reserved (0eh)" },
|
||||
{ 0x0f, "oem_0f", "OEM reserved (0fh)" },
|
||||
{ 0x10, "oem_10", "OEM reserved (10h)" },
|
||||
|
||||
DCMI_CMD_END(0xFF)
|
||||
};
|
||||
@ -282,13 +283,13 @@ const struct dcmi_cmd dcmi_confparameters_vals[] = {
|
||||
|
||||
/* entityIDs used in thermap policy */
|
||||
const struct dcmi_cmd dcmi_thermalpolicy_set_parameters_vals[] = {
|
||||
{ 0x00, "volatile", " Current Power Cycle" },
|
||||
{ 0x00, "volatile", "Current Power Cycle" },
|
||||
{ 0x01, "nonvolatile", "Set across power cycles" },
|
||||
{ 0x01, "poweroff", " Hard Power Off system" },
|
||||
{ 0x00, "nopoweroff", " No 'Hard Power Off' action" },
|
||||
{ 0x01, "sel", " Log event to SEL" },
|
||||
{ 0x00, "nosel", " No 'Log event to SEL' action" },
|
||||
{ 0x00, "disabled", " Disabled" },
|
||||
{ 0x01, "poweroff", "Hard Power Off system" },
|
||||
{ 0x00, "nopoweroff", "No 'Hard Power Off' action" },
|
||||
{ 0x01, "sel", "Log event to SEL" },
|
||||
{ 0x00, "nosel", "No 'Log event to SEL' action" },
|
||||
{ 0x00, "disabled", "Disabled" },
|
||||
|
||||
DCMI_CMD_END(0)
|
||||
};
|
||||
@ -331,14 +332,14 @@ const struct dcmi_cmd dcmi_sampling_vals[] = {
|
||||
{ 0x47, "7_min", "" },
|
||||
{ 0x4F, "15_min", "" },
|
||||
{ 0x5E, "30_min", "" },
|
||||
{ 0x81, "1_hour", ""},
|
||||
{ 0x81, "1_hour", "" },
|
||||
|
||||
DCMI_CMD_END(0)
|
||||
};
|
||||
|
||||
/* Primary Node Manager commands */
|
||||
const struct dcmi_cmd nm_cmd_vals[] = {
|
||||
{ 0x00, "discover", "Discover Node Manager " },
|
||||
{ 0x00, "discover", "Discover Node Manager" },
|
||||
{ 0x01, "capability", "Get Node Manager Capabilities" },
|
||||
{ 0x02, "control", "Enable/Disable Policy Control" },
|
||||
{ 0x03, "policy", "Add/Remove Policies" },
|
||||
@ -353,8 +354,8 @@ const struct dcmi_cmd nm_cmd_vals[] = {
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_ctl_cmds[] = {
|
||||
{ 0x01, "enable", " <control scope>" },
|
||||
{ 0x00, "disable", "<control scope>"},
|
||||
{ 0x01, "enable", "<control scope>" },
|
||||
{ 0x00, "disable", "<control scope>" },
|
||||
|
||||
DCMI_CMD_END(0xFF),
|
||||
};
|
||||
@ -431,9 +432,15 @@ const struct dcmi_cmd nm_stats_mode[] = {
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_policy_action[] = {
|
||||
{ 0x00, "get", "nm policy get policy_id <0-7> [domain <platform|CPU|Memory>]" },
|
||||
{ 0x04, "add", "nm policy add policy_id <0-7> [domain <platform|CPU|Memory>] correction auto|soft|hard power <watts>|inlet <temp> trig_lim <param> stats <seconds> enable|disable" },
|
||||
{ 0x05, "remove", "nm policy remove policy_id <0-7> [domain <platform|CPU|Memory>]" },
|
||||
{ 0x00, "get", "nm policy get policy_id <0-7> "
|
||||
"[domain <platform|CPU|Memory>]" },
|
||||
{ 0x04, "add", "nm policy add policy_id <0-7> "
|
||||
"[domain <platform|CPU|Memory>] "
|
||||
"correction auto|soft|hard power <watts> | "
|
||||
"inlet <temp> trig_lim <param> "
|
||||
"stats <seconds> enable|disable" },
|
||||
{ 0x05, "remove", "nm policy remove policy_id <0-7> "
|
||||
"[domain <platform|CPU|Memory>]" },
|
||||
{ 0x06, "limiting", "nm policy limiting [domain <platform|CPU|Memory>]" },
|
||||
|
||||
DCMI_CMD_END(0xFF),
|
||||
@ -442,8 +449,8 @@ const struct dcmi_cmd nm_policy_options[] = {
|
||||
{ 0x01, "enable", "" },
|
||||
{ 0x02, "disable", "" },
|
||||
{ 0x03, "domain", "" },
|
||||
{ 0x04, "inlet", "inlet air temp full limiting (SCRAM)"},
|
||||
{ 0x06, "correction", "auto, soft, hard" },
|
||||
{ 0x04, "inlet", "inlet air temp full limiting (SCRAM)" },
|
||||
{ 0x06, "correction" "auto, soft, hard" },
|
||||
{ 0x08, "power", "power limit in watts" },
|
||||
{ 0x09, "trig_lim", "time to send alert" },
|
||||
{ 0x0A, "stats", "moving window averaging time" },
|
||||
@ -497,7 +504,7 @@ const struct dcmi_cmd nm_reset_mode[] = {
|
||||
{ 0x1B, "requests", "" },
|
||||
{ 0x1C, "response", "" },
|
||||
{ 0x1D, "throttling", "" },
|
||||
{ 0x1E, "memory", "", },
|
||||
{ 0x1E, "memory", "" },
|
||||
{ 0x1F, "comm", "" },
|
||||
|
||||
DCMI_CMD_END(0xFF),
|
||||
@ -505,7 +512,7 @@ const struct dcmi_cmd nm_reset_mode[] = {
|
||||
|
||||
const struct dcmi_cmd nm_power_range[] = {
|
||||
{ 0x01, "domain", "domain <platform|CPU|Memory> (default is platform)" },
|
||||
{ 0x02, "min", " min <integer value>" },
|
||||
{ 0x02, "min", "min <integer value>" },
|
||||
{ 0x03, "max", "max <integer value>" },
|
||||
|
||||
DCMI_CMD_END(0xFF),
|
||||
@ -528,8 +535,10 @@ const struct dcmi_cmd nm_set_alert_param[] = {
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_thresh_cmds[] = {
|
||||
{ 0x01, "set", "nm thresh set [domain <platform|CPU|Memory>] policy_id <policy> thresh_array" },
|
||||
{ 0x02, "get", "nm thresh get [domain <platform|CPU|Memory>] policy_id <policy>" },
|
||||
{ 0x01, "set", "nm thresh set [domain <platform|CPU|Memory>] "
|
||||
"policy_id <policy> thresh_array" },
|
||||
{ 0x02, "get", "nm thresh get [domain <platform|CPU|Memory>] "
|
||||
"policy_id <policy>" },
|
||||
|
||||
DCMI_CMD_END(0xFF),
|
||||
};
|
||||
@ -542,27 +551,30 @@ const struct dcmi_cmd nm_thresh_param[] = {
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_suspend_cmds[] = {
|
||||
{ 0x01, "set", "nm suspend set [domain <platform|CPU|Memory]> policy_id <policy> <start> <stop> <pattern>" },
|
||||
{ 0x02, "get", "nm suspend get [domain <platform|CPU|Memory]> policy_id <policy>" },
|
||||
{ 0x01, "set", "nm suspend set [domain <platform|CPU|Memory]> "
|
||||
"policy_id <policy> <start> "
|
||||
"<stop> <pattern>" },
|
||||
{ 0x02, "get", "nm suspend get [domain <platform|CPU|Memory]> "
|
||||
"policy_id <policy>" },
|
||||
|
||||
DCMI_CMD_END(0xFF),
|
||||
};
|
||||
|
||||
const struct valstr nm_ccode_vals[] = {
|
||||
{ 0x80, "Policy ID Invalid"},
|
||||
{ 0x81, "Domain ID Invalid"},
|
||||
{ 0x82, "Unknown policy trigger type"},
|
||||
{ 0x84, "Power Limit out of range"},
|
||||
{ 0x85, "Correction Time out of range"},
|
||||
{ 0x86, "Policy Trigger value out of range"},
|
||||
{ 0x88, "Invalid Mode"},
|
||||
{ 0x89, "Statistics Reporting Period out of range"},
|
||||
{ 0x8B, "Invalid value for Aggressive CPU correction field"},
|
||||
{ 0xA1, "No policy is currently limiting for the specified domain ID"},
|
||||
{ 0xC4, "No space available"},
|
||||
{ 0xD4, "Insufficient privledge level due wrong responder LUN"},
|
||||
{ 0xD5, "Policy exists and param unchangeable while enabled"},
|
||||
{ 0xD6, "Command subfunction disabled or unavailable"},
|
||||
{ 0x80, "Policy ID Invalid" },
|
||||
{ 0x81, "Domain ID Invalid" },
|
||||
{ 0x82, "Unknown policy trigger type" },
|
||||
{ 0x84, "Power Limit out of range" },
|
||||
{ 0x85, "Correction Time out of range" },
|
||||
{ 0x86, "Policy Trigger value out of range" },
|
||||
{ 0x88, "Invalid Mode" },
|
||||
{ 0x89, "Statistics Reporting Period out of range" },
|
||||
{ 0x8B, "Invalid value for Aggressive CPU correction field" },
|
||||
{ 0xA1, "No policy is currently limiting for the specified domain ID" },
|
||||
{ 0xC4, "No space available" },
|
||||
{ 0xD4, "Insufficient privledge level due wrong responder LUN" },
|
||||
{ 0xD5, "Policy exists and param unchangeable while enabled" },
|
||||
{ 0xD6, "Command subfunction disabled or unavailable" },
|
||||
{ 0xFF, NULL },
|
||||
};
|
||||
|
||||
@ -643,11 +655,9 @@ str2val2(const char *str, const struct dcmi_cmd *vs)
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; vs[i].str != NULL; i++) {
|
||||
if (strncasecmp(vs[i].str, str,
|
||||
__maxlen(str, vs[i].str)) == 0) {
|
||||
if (strncasecmp(vs[i].str, str, __maxlen(str, vs[i].str)) == 0)
|
||||
return vs[i].val;
|
||||
}
|
||||
}
|
||||
return vs[i].val;
|
||||
}
|
||||
|
||||
@ -705,7 +715,8 @@ chk_rsp(struct ipmi_rs * rsp)
|
||||
}
|
||||
/* check to make sure this is a DCMI firmware */
|
||||
if(rsp->data[0] != IPMI_DCMI) {
|
||||
printf("\n A valid DCMI command was not returned! (%x)", rsp->data[0]);
|
||||
printf("\n A valid DCMI command was not returned! (%x)",
|
||||
rsp->data[0]);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -872,7 +883,8 @@ ipmi_dcmi_prnt_getcapabilities(struct ipmi_intf * intf, uint8_t selector)
|
||||
/* check to make sure that this is a 1.0/1.1/1.5 command */
|
||||
if ((cape.conformance != IPMI_DCMI_CONFORM)
|
||||
&& (cape.conformance != IPMI_DCMI_1_1_CONFORM)
|
||||
&& (cape.conformance != IPMI_DCMI_1_5_CONFORM)) {
|
||||
&& (cape.conformance != IPMI_DCMI_1_5_CONFORM))
|
||||
{
|
||||
lprintf(LOG_ERR,
|
||||
"ERROR! This command is not available on this platform");
|
||||
return -1;
|
||||
@ -897,20 +909,20 @@ ipmi_dcmi_prnt_getcapabilities(struct ipmi_intf * intf, uint8_t selector)
|
||||
* struct
|
||||
*/
|
||||
printf("\n Mandatory platform capabilties\n");
|
||||
display_capabilities_attributes(
|
||||
dcmi_mandatory_platform_capabilities, cape.data_byte1);
|
||||
display_capabilities_attributes(dcmi_mandatory_platform_capabilities,
|
||||
cape.data_byte1);
|
||||
/* loop through each of the entries in the second byte from the
|
||||
* struct
|
||||
*/
|
||||
printf("\n Optional platform capabilties\n");
|
||||
display_capabilities_attributes(
|
||||
dcmi_optional_platform_capabilities, cape.data_byte2);
|
||||
display_capabilities_attributes(dcmi_optional_platform_capabilities,
|
||||
cape.data_byte2);
|
||||
/* loop through each of the entries in the third byte from the
|
||||
* struct
|
||||
*/
|
||||
printf("\n Managebility access capabilties\n");
|
||||
display_capabilities_attributes(
|
||||
dcmi_management_access_capabilities, cape.data_byte3);
|
||||
display_capabilities_attributes(dcmi_management_access_capabilities,
|
||||
cape.data_byte3);
|
||||
break;
|
||||
case 0x02:
|
||||
printf("\n Mandatory platform attributes:\n");
|
||||
@ -934,8 +946,8 @@ ipmi_dcmi_prnt_getcapabilities(struct ipmi_intf * intf, uint8_t selector)
|
||||
printf("\n %d SEL entries\n", sel_entries & 0xFFF);
|
||||
/* byte 3 data */
|
||||
printf("\n Identification Attributes: \n");
|
||||
display_capabilities_attributes(
|
||||
dcmi_id_capabilities_vals, cape.data_byte3);
|
||||
display_capabilities_attributes(dcmi_id_capabilities_vals,
|
||||
cape.data_byte3);
|
||||
/* byte 4 data */
|
||||
printf("\n Temperature Monitoring Attributes: \n");
|
||||
display_capabilities_attributes(dcmi_temp_monitoring_vals,
|
||||
@ -957,11 +969,11 @@ ipmi_dcmi_prnt_getcapabilities(struct ipmi_intf * intf, uint8_t selector)
|
||||
printf(" Channel number is 0h (Primary BMC)\n");
|
||||
} else {
|
||||
printf(" Channel number is %xh \n",
|
||||
(cape.data_byte2>>4));
|
||||
(cape.data_byte2 >> 4));
|
||||
}
|
||||
/* Device revision (0-3) */
|
||||
printf(" Device revision is %d \n",
|
||||
cape.data_byte2 &0xf);
|
||||
cape.data_byte2 & 0xf);
|
||||
break;
|
||||
case 0x04:
|
||||
/* LAN */
|
||||
@ -1057,8 +1069,9 @@ ipmi_dcmi_prnt_getassettag(struct ipmi_intf * intf)
|
||||
taglength = rsp->data[1];
|
||||
printf("\n Asset tag: ");
|
||||
while (taglength) {
|
||||
getlength = taglength / DCMI_MAX_BYTE_SIZE ?
|
||||
DCMI_MAX_BYTE_SIZE : taglength%DCMI_MAX_BYTE_SIZE;
|
||||
/* TODO: Add parentheses for clarity */
|
||||
getlength = taglength / DCMI_MAX_BYTE_SIZE ? DCMI_MAX_BYTE_SIZE
|
||||
: taglength % DCMI_MAX_BYTE_SIZE;
|
||||
rsp = ipmi_dcmi_getassettag(intf, offset, getlength);
|
||||
/* macro has no effect here where can generate sig segv
|
||||
* if rsp occurs with null
|
||||
@ -1130,8 +1143,9 @@ ipmi_dcmi_prnt_setassettag(struct ipmi_intf * intf, uint8_t * data)
|
||||
}
|
||||
printf("\n Set Asset Tag: ");
|
||||
while (taglength) {
|
||||
getlength = taglength / DCMI_MAX_BYTE_SIZE ?
|
||||
DCMI_MAX_BYTE_SIZE : taglength%DCMI_MAX_BYTE_SIZE;
|
||||
/* TODO: Use a macro or an inline for this repeating calculation */
|
||||
getlength = taglength / DCMI_MAX_BYTE_SIZE ? DCMI_MAX_BYTE_SIZE
|
||||
: taglength % DCMI_MAX_BYTE_SIZE;
|
||||
memcpy(tmpData, data + offset, getlength);
|
||||
rsp = ipmi_dcmi_setassettag(intf, offset, getlength, tmpData);
|
||||
if (chk_rsp(rsp)) {
|
||||
@ -1195,8 +1209,9 @@ ipmi_dcmi_prnt_getmngctrlids(struct ipmi_intf * intf)
|
||||
|
||||
printf("\n Get Management Controller Identifier String: ");
|
||||
while (taglength) {
|
||||
getlength = taglength / DCMI_MAX_BYTE_SIZE ?
|
||||
DCMI_MAX_BYTE_SIZE : taglength%DCMI_MAX_BYTE_SIZE;
|
||||
/* TODO: Use a macro or an inline for this repeating calculation */
|
||||
getlength = taglength / DCMI_MAX_BYTE_SIZE ? DCMI_MAX_BYTE_SIZE
|
||||
: taglength % DCMI_MAX_BYTE_SIZE;
|
||||
rsp = ipmi_dcmi_getmngctrlids(intf, offset, getlength);
|
||||
|
||||
if (chk_rsp(rsp)) {
|
||||
@ -1272,8 +1287,9 @@ ipmi_dcmi_prnt_setmngctrlids(struct ipmi_intf * intf, uint8_t * data)
|
||||
|
||||
printf("\n Set Management Controller Identifier String Command: ");
|
||||
while (taglength) {
|
||||
getlength = taglength / DCMI_MAX_BYTE_SIZE ?
|
||||
DCMI_MAX_BYTE_SIZE : taglength%DCMI_MAX_BYTE_SIZE;
|
||||
/* TODO: Use a macro or an inline for this repeating calculation */
|
||||
getlength = taglength / DCMI_MAX_BYTE_SIZE ? DCMI_MAX_BYTE_SIZE
|
||||
: taglength % DCMI_MAX_BYTE_SIZE;
|
||||
memcpy(tmpData, data + offset, getlength);
|
||||
rsp = ipmi_dcmi_setmngctrlids(intf, offset, getlength, tmpData);
|
||||
/* because after call "Set mc id string" RMCP+ will go down
|
||||
@ -1579,7 +1595,8 @@ ipmi_dcmi_prnt_get_temp_readings(struct ipmi_intf * intf)
|
||||
for (i = 0; dcmi_temp_read_vals[i].str != NULL; i++) {
|
||||
/* get all of the information about this sensor */
|
||||
rsp = ipmi_dcmi_get_temp_readings(intf,
|
||||
dcmi_temp_read_vals[i].val, 0, 0);
|
||||
dcmi_temp_read_vals[i].val,
|
||||
0, 0);
|
||||
if (chk_rsp(rsp)) {
|
||||
continue;
|
||||
}
|
||||
@ -1591,7 +1608,8 @@ ipmi_dcmi_prnt_get_temp_readings(struct ipmi_intf * intf)
|
||||
DCMI_MAX_BYTE_TEMP_READ_SIZE :
|
||||
(tota_inst % DCMI_MAX_BYTE_TEMP_READ_SIZE));
|
||||
rsp = ipmi_dcmi_get_temp_readings(intf,
|
||||
dcmi_temp_read_vals[i].val, offset, 0);
|
||||
dcmi_temp_read_vals[i].val,
|
||||
offset, 0);
|
||||
if (chk_rsp(rsp)) {
|
||||
continue;
|
||||
}
|
||||
@ -1602,8 +1620,9 @@ ipmi_dcmi_prnt_get_temp_readings(struct ipmi_intf * intf)
|
||||
/* Print Instance temperature info */
|
||||
printf("\n%s",dcmi_temp_read_vals[i].desc);
|
||||
printf("\t\t%i\t\t%c%i C", rsp->data[j+4],
|
||||
((rsp->data[j+3]) >> 7) ?
|
||||
'-' : '+', (rsp->data[j+3] & 127));
|
||||
((rsp->data[j+3]) >> 7) ? '-'
|
||||
: '+',
|
||||
(rsp->data[j+3] & 127));
|
||||
}
|
||||
offset += get_inst;
|
||||
tota_inst -= get_inst;
|
||||
@ -1648,8 +1667,10 @@ ipmi_dcmi_prnt_getconfparam(struct ipmi_intf * intf)
|
||||
int param_selector;
|
||||
uint16_t tmp_value = 0;
|
||||
/* We are not interested in parameter 1 which always will return 0 */
|
||||
for (param_selector = 2 ; param_selector <= dcmi_conf_params;
|
||||
param_selector++) {
|
||||
for (param_selector = 2;
|
||||
param_selector <= dcmi_conf_params;
|
||||
param_selector++)
|
||||
{
|
||||
rsp = ipmi_dcmi_getconfparam(intf, param_selector);
|
||||
if (chk_rsp(rsp)) {
|
||||
return -1;
|
||||
@ -1661,7 +1682,8 @@ ipmi_dcmi_prnt_getconfparam(struct ipmi_intf * intf)
|
||||
printf("\n\tDHCP Discovery method\t: ");
|
||||
printf("\n\t\tManagement Controller ID String is %s",
|
||||
tmp_value ? "enabled" : "disabled");
|
||||
printf("\n\t\tVendor class identifier DCMI IANA and Vendor class-specific Informationa are %s",
|
||||
printf("\n\t\tVendor class identifier DCMI IANA and Vendor "
|
||||
"class-specific Informationa are %s",
|
||||
((rsp->data[4])& 2) ? "enabled" : "disabled" );
|
||||
break;
|
||||
case 3:
|
||||
@ -2073,7 +2095,8 @@ _ipmi_nm_discover(struct ipmi_intf * intf, struct nm_discover *disc)
|
||||
* @caps: fills in capability struct
|
||||
*/
|
||||
static int
|
||||
_ipmi_nm_getcapabilities(struct ipmi_intf * intf, uint8_t domain, uint8_t trigger, struct nm_capability *caps)
|
||||
_ipmi_nm_getcapabilities(struct ipmi_intf * intf, uint8_t domain,
|
||||
uint8_t trigger, struct nm_capability *caps)
|
||||
{
|
||||
struct ipmi_rq req; /* request data to send to the BMC */
|
||||
struct ipmi_rs *rsp;
|
||||
@ -2098,7 +2121,8 @@ _ipmi_nm_getcapabilities(struct ipmi_intf * intf, uint8_t domain, uint8_t trigge
|
||||
}
|
||||
|
||||
static int
|
||||
_ipmi_nm_get_policy(struct ipmi_intf * intf, uint8_t domain, uint8_t policy_id, struct nm_get_policy *policy)
|
||||
_ipmi_nm_get_policy(struct ipmi_intf * intf, uint8_t domain,
|
||||
uint8_t policy_id, struct nm_get_policy *policy)
|
||||
{
|
||||
struct ipmi_rq req; /* request data to send to the BMC */
|
||||
struct ipmi_rs *rsp;
|
||||
@ -2132,7 +2156,9 @@ _ipmi_nm_set_policy(struct ipmi_intf * intf, struct nm_policy *policy)
|
||||
req.msg.cmd = IPMI_NM_SET_POLICY;
|
||||
req.msg.data = (uint8_t *)policy;
|
||||
req.msg.data_len = sizeof(struct nm_policy);
|
||||
policy->intel_id[0] = 0x57; policy->intel_id[1] =1; policy->intel_id[2] =0;
|
||||
policy->intel_id[0] = 0x57;
|
||||
policy->intel_id[1] = 1;
|
||||
policy->intel_id[2] = 0;
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (chk_nm_rsp(rsp)) {
|
||||
return -1;
|
||||
@ -2166,7 +2192,8 @@ _ipmi_nm_policy_limiting(struct ipmi_intf * intf, uint8_t domain)
|
||||
}
|
||||
|
||||
static int
|
||||
_ipmi_nm_control(struct ipmi_intf * intf, uint8_t scope, uint8_t domain, uint8_t policy_id)
|
||||
_ipmi_nm_control(struct ipmi_intf * intf, uint8_t scope,
|
||||
uint8_t domain, uint8_t policy_id)
|
||||
{
|
||||
struct ipmi_rq req; /* request data to send to the BMC */
|
||||
struct ipmi_rs *rsp;
|
||||
@ -2200,7 +2227,8 @@ _ipmi_nm_control(struct ipmi_intf * intf, uint8_t scope, uint8_t domain, uint8_t
|
||||
* @selector: Parameter selector
|
||||
*/
|
||||
static int
|
||||
_ipmi_nm_statistics(struct ipmi_intf * intf, uint8_t mode, uint8_t domain, uint8_t policy_id, struct nm_statistics *caps)
|
||||
_ipmi_nm_statistics(struct ipmi_intf * intf, uint8_t mode, uint8_t domain,
|
||||
uint8_t policy_id, struct nm_statistics *caps)
|
||||
{
|
||||
struct ipmi_rq req; /* request data to send to the BMC */
|
||||
struct ipmi_rs *rsp;
|
||||
@ -2226,7 +2254,8 @@ _ipmi_nm_statistics(struct ipmi_intf * intf, uint8_t mode, uint8_t domain, uint8
|
||||
}
|
||||
|
||||
static int
|
||||
_ipmi_nm_reset_stats(struct ipmi_intf * intf, uint8_t mode, uint8_t domain, uint8_t policy_id)
|
||||
_ipmi_nm_reset_stats(struct ipmi_intf * intf, uint8_t mode,
|
||||
uint8_t domain, uint8_t policy_id)
|
||||
{
|
||||
struct ipmi_rq req; /* request data to send to the BMC */
|
||||
struct ipmi_rs *rsp;
|
||||
@ -2251,7 +2280,8 @@ _ipmi_nm_reset_stats(struct ipmi_intf * intf, uint8_t mode, uint8_t domain, uint
|
||||
}
|
||||
|
||||
static int
|
||||
_nm_set_range(struct ipmi_intf * intf, uint8_t domain, uint16_t minimum, uint16_t maximum)
|
||||
_nm_set_range(struct ipmi_intf * intf, uint8_t domain,
|
||||
uint16_t minimum, uint16_t maximum)
|
||||
{
|
||||
struct ipmi_rq req; /* request data to send to the BMC */
|
||||
struct ipmi_rs *rsp;
|
||||
@ -2333,7 +2363,8 @@ _ipmi_nm_set_alert(struct ipmi_intf * intf, struct nm_set_alert *alert)
|
||||
* This array is filled in for valid thresholds returned.
|
||||
*/
|
||||
static int
|
||||
_ipmi_nm_get_thresh(struct ipmi_intf * intf, uint8_t domain, uint8_t policy_id, uint16_t *list)
|
||||
_ipmi_nm_get_thresh(struct ipmi_intf * intf, uint8_t domain,
|
||||
uint8_t policy_id, uint16_t *list)
|
||||
{
|
||||
struct ipmi_rq req; /* request data to send to the BMC */
|
||||
struct ipmi_rs *rsp;
|
||||
@ -2406,7 +2437,8 @@ _ipmi_nm_set_thresh(struct ipmi_intf * intf, struct nm_thresh * thresh)
|
||||
*
|
||||
*/
|
||||
static int
|
||||
_ipmi_nm_get_suspend(struct ipmi_intf * intf, uint8_t domain, uint8_t policy_id, int *count, struct nm_period *periods)
|
||||
_ipmi_nm_get_suspend(struct ipmi_intf * intf, uint8_t domain,
|
||||
uint8_t policy_id, int *count, struct nm_period *periods)
|
||||
{
|
||||
struct ipmi_rq req; /* request data to send to the BMC */
|
||||
struct ipmi_rs *rsp;
|
||||
@ -2451,7 +2483,10 @@ _ipmi_nm_set_suspend(struct ipmi_intf * intf, struct nm_suspend *suspend)
|
||||
msg_data[3] = suspend->domain;
|
||||
msg_data[4] = suspend->policy_id;
|
||||
msg_data[5] = suspend->count;
|
||||
for (i = 0, periods = &suspend->period[0]; i < (suspend->count*3); i += 3, periods++) {
|
||||
for (i = 0, periods = &suspend->period[0];
|
||||
i < (suspend->count*3);
|
||||
i += 3, periods++)
|
||||
{
|
||||
msg_data[6+i] = periods->start;
|
||||
msg_data[7+i] = periods->stop;
|
||||
msg_data[8+i] = periods->repeat;
|
||||
@ -2612,7 +2647,8 @@ ipmi_nm_get_policy(struct ipmi_intf * intf, int argc, char **argv)
|
||||
policy.domain&0x20 ? "per Domain " : "",
|
||||
policy.domain&0x40 ? "Globally " : "",
|
||||
policy.domain&0x80 ? "via DCMI api " : "");
|
||||
printf(" Policy is %sa power control type.\n", (policy.policy_type & 0x10) ? "" : "not ");
|
||||
printf(" Policy is %sa power control type.\n",
|
||||
(policy.policy_type & 0x10) ? "" : "not ");
|
||||
printf(" Policy Trigger Type: %s\n",
|
||||
val2str2(policy.policy_type & 0xF, nm_policy_type_vals));
|
||||
printf(" Correction Aggressiveness: %s\n",
|
||||
@ -2659,7 +2695,9 @@ ipmi_nm_policy(struct ipmi_intf * intf, int argc, char **argv)
|
||||
return (ipmi_nm_get_policy(intf, argc, argv));
|
||||
memset(&policy, 0, sizeof(policy));
|
||||
/*
|
||||
* nm policy add [domain <param>] enable|disable policy_id <param> correction <opt> power <watts> limit <param> period <param>
|
||||
* nm policy add [domain <param>] enable|disable policy_id <param>
|
||||
* correction <opt> power <watts> limit <param>
|
||||
* period <param>
|
||||
* nm policy remove [domain <param>] policy_id <param>
|
||||
* nm policy limiting {domain <param>]
|
||||
*/
|
||||
@ -2782,7 +2820,8 @@ ipmi_nm_control(struct ipmi_intf * intf, int argc, char **argv)
|
||||
argc--;
|
||||
/* nm_ctl_cmds returns 0 for disable, 1 for enable */
|
||||
if ((argv[0] == NULL) ||
|
||||
((action = str2val2(argv[0], nm_ctl_cmds)) == 0xFF)) {
|
||||
((action = str2val2(argv[0], nm_ctl_cmds)) == 0xFF))
|
||||
{
|
||||
print_strs(nm_ctl_cmds, "Control parameters:", LOG_ERR, 0);
|
||||
print_strs(nm_ctl_domain, "control Scope (required):", LOG_ERR, 0);
|
||||
return -1;
|
||||
@ -2791,7 +2830,8 @@ ipmi_nm_control(struct ipmi_intf * intf, int argc, char **argv)
|
||||
while (--argc) {
|
||||
/* nm_ctl_domain returns correct bit field except for action */
|
||||
if ((argv[0] == NULL) ||
|
||||
((scope = str2val2(argv[0], nm_ctl_domain)) == 0xFF)) {
|
||||
((scope = str2val2(argv[0], nm_ctl_domain)) == 0xFF))
|
||||
{
|
||||
print_strs(nm_ctl_domain, "Control Scope (required):", LOG_ERR, 0);
|
||||
return -1;
|
||||
}
|
||||
@ -2803,7 +2843,6 @@ ipmi_nm_control(struct ipmi_intf * intf, int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
} else if (scope == 0x04) { /* per_policy */
|
||||
|
||||
if (str2uchar(argv[0], &policy_id) < 0) {
|
||||
lprintf(LOG_ERR,"Policy ID must be a positive integer.\n");
|
||||
return -1;
|
||||
@ -2839,7 +2878,8 @@ ipmi_nm_get_statistics(struct ipmi_intf * intf, int argc, char **argv)
|
||||
|
||||
argv++;
|
||||
if ((argv[0] == NULL) ||
|
||||
((mode = str2val2(argv[0], nm_stats_mode)) == 0xFF)) {
|
||||
((mode = str2val2(argv[0], nm_stats_mode)) == 0xFF))
|
||||
{
|
||||
print_strs(nm_stats_mode, "Statistics commands", LOG_ERR, 0);
|
||||
return -1;
|
||||
}
|
||||
@ -2903,10 +2943,15 @@ ipmi_nm_get_statistics(struct ipmi_intf * intf, int argc, char **argv)
|
||||
if (csv_output) {
|
||||
printf("%s,%s,%s,%s,%s,%d,%d,%d,%d,%s,%d\n",
|
||||
val2str2(stats.id_state & 0xF, nm_domain_vals),
|
||||
((stats.id_state >> 4) & 1) ? (policy_mode ? "Policy Enabled" : "Globally Enabled") : "Disabled" ,
|
||||
((stats.id_state >> 5) & 1) ? "active" : "suspended",
|
||||
((stats.id_state >> 6) & 1) ? "in progress" : "suspended",
|
||||
((stats.id_state >> 7) & 1) ? "triggered" : "not triggered",
|
||||
((stats.id_state >> 4) & 1) ? (policy_mode ? "Policy Enabled"
|
||||
: "Globally Enabled")
|
||||
: "Disabled" ,
|
||||
((stats.id_state >> 5) & 1) ? "active"
|
||||
: "suspended",
|
||||
((stats.id_state >> 6) & 1) ? "in progress"
|
||||
: "suspended",
|
||||
((stats.id_state >> 7) & 1) ? "triggered"
|
||||
: "not triggered",
|
||||
stats.curr_value,
|
||||
stats.min_value,
|
||||
stats.max_value,
|
||||
@ -2918,13 +2963,18 @@ ipmi_nm_get_statistics(struct ipmi_intf * intf, int argc, char **argv)
|
||||
printf(" Power domain: %s\n",
|
||||
val2str2(stats.id_state & 0xF, nm_domain_vals));
|
||||
printf(" Policy/Global Admin state %s\n",
|
||||
((stats.id_state >> 4) & 1) ? (policy_mode ? "Policy Enabled" : "Globally Enabled") : "Disabled" );
|
||||
((stats.id_state >> 4) & 1) ? (policy_mode ? "Policy Enabled"
|
||||
: "Globally Enabled")
|
||||
: "Disabled" );
|
||||
printf(" Policy/Global Operational state %s\n",
|
||||
((stats.id_state >> 5) & 1) ? "active" : "suspended");
|
||||
((stats.id_state >> 5) & 1) ? "active"
|
||||
: "suspended");
|
||||
printf(" Policy/Global Measurement state %s\n",
|
||||
((stats.id_state >> 6) & 1) ? "in progress" : "suspended");
|
||||
((stats.id_state >> 6) & 1) ? "in progress"
|
||||
: "suspended");
|
||||
printf(" Policy Activation state %s\n",
|
||||
((stats.id_state >> 7) & 1) ? "triggered" : "not triggered");
|
||||
((stats.id_state >> 7) & 1) ? "triggered"
|
||||
: "not triggered");
|
||||
printf(" Instantaneous reading: %8d %s\n",
|
||||
stats.curr_value, units);
|
||||
printf(" Minimum during sampling period: %8d %s\n",
|
||||
@ -2935,7 +2985,8 @@ ipmi_nm_get_statistics(struct ipmi_intf * intf, int argc, char **argv)
|
||||
stats.ave_value, units);
|
||||
printf(" IPMI timestamp: %s\n",
|
||||
datebuf);
|
||||
printf(" Sampling period: %08d Seconds.\n", stats.stat_period);
|
||||
printf(" Sampling period: %08d Seconds.\n",
|
||||
stats.stat_period);
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
@ -2950,7 +3001,8 @@ ipmi_nm_reset_statistics(struct ipmi_intf * intf, int argc, char **argv)
|
||||
|
||||
argv++;
|
||||
if ((argv[0] == NULL) ||
|
||||
((mode = str2val2(argv[0], nm_reset_mode)) == 0xFF)) {
|
||||
((mode = str2val2(argv[0], nm_reset_mode)) == 0xFF))
|
||||
{
|
||||
print_strs(nm_reset_mode, "Reset Statistics Modes:", LOG_ERR, 0);
|
||||
return -1;
|
||||
}
|
||||
@ -3030,7 +3082,8 @@ ipmi_nm_set_range(struct ipmi_intf * intf, int argc, char **argv)
|
||||
argv++;
|
||||
}
|
||||
if ((minimum == 0xFFFF) || (maximum == 0xFFFF)) {
|
||||
lprintf(LOG_ERR,"Missing parameters: nm power range min <minimum> max <maximum>.\n");
|
||||
lprintf(LOG_ERR,"Missing parameters: nm power range min <minimum> "
|
||||
"max <maximum>.\n");
|
||||
return -1;
|
||||
}
|
||||
if (_nm_set_range(intf, domain, minimum, maximum) < 0)
|
||||
@ -3048,15 +3101,17 @@ ipmi_nm_get_alert(struct ipmi_intf * intf)
|
||||
return -1;
|
||||
if (csv_output) {
|
||||
printf("%d,%s,0x%x,%s,0x%x\n",
|
||||
alert.chan&0xF,
|
||||
(alert.chan >> 7) ? "not registered" : "registered",
|
||||
alert.chan & 0xF,
|
||||
(alert.chan >> 7) ? "not registered"
|
||||
: "registered",
|
||||
alert.dest,
|
||||
(alert.string >> 7) ? "yes" : "no",
|
||||
(alert.string >> 7) ? "yes"
|
||||
: "no",
|
||||
alert.string & 0x7F);
|
||||
return 0;
|
||||
}
|
||||
printf(" Alert Chan: %d\n",
|
||||
alert.chan&0xF);
|
||||
alert.chan & 0xF);
|
||||
printf(" Alert Receiver: %s\n",
|
||||
(alert.chan >> 7) ? "not registered" : "registered");
|
||||
printf(" Alert Lan Destination: 0x%x\n",
|
||||
@ -3081,7 +3136,8 @@ ipmi_nm_alert(struct ipmi_intf * intf, int argc, char **argv)
|
||||
argv++;
|
||||
argc--;
|
||||
if ((argv[0] == NULL) ||
|
||||
((action = str2val2(argv[0], nm_alert_opts)) == 0xFF)) {
|
||||
((action = str2val2(argv[0], nm_alert_opts)) == 0xFF))
|
||||
{
|
||||
print_strs(nm_alert_opts, "Alert commands", LOG_ERR, 0);
|
||||
return -1;
|
||||
}
|
||||
@ -3171,7 +3227,8 @@ ipmi_nm_thresh(struct ipmi_intf * intf, int argc, char **argv)
|
||||
argc--;
|
||||
/* set or get */
|
||||
if ((argv[0] == NULL) || (argc < 3) ||
|
||||
((action = str2val2(argv[0], nm_thresh_cmds)) == 0xFF)) {
|
||||
((action = str2val2(argv[0], nm_thresh_cmds)) == 0xFF))
|
||||
{
|
||||
print_strs(nm_thresh_cmds, "Theshold commands", LOG_ERR, 0);
|
||||
return -1;
|
||||
}
|
||||
@ -3264,7 +3321,8 @@ ipmi_nm_get_suspend(struct ipmi_intf *intf, uint8_t domain, uint8_t policy_id)
|
||||
printf(" Suspend Period %d: %02d:%02d to %02d:%02d",
|
||||
i, click2hour(periods[i].start), click2min(periods[i].start),
|
||||
click2hour(periods[i].stop), click2min(periods[i].stop));
|
||||
if (periods[i].repeat) printf(", ");
|
||||
if (periods[i].repeat)
|
||||
printf(", ");
|
||||
for (j = 0; j < 7; j++)
|
||||
printf("%s", (periods[i].repeat >> j)&1 ? days[j] : "");
|
||||
printf("\n");
|
||||
@ -3287,7 +3345,8 @@ ipmi_nm_suspend(struct ipmi_intf * intf, int argc, char **argv)
|
||||
argc--;
|
||||
/* set or get */
|
||||
if ((argv[0] == NULL) || (argc < 3) ||
|
||||
((action = str2val2(argv[0], nm_suspend_cmds)) == 0xFF)) {
|
||||
((action = str2val2(argv[0], nm_suspend_cmds)) == 0xFF))
|
||||
{
|
||||
print_strs(nm_suspend_cmds, "Suspend commands", LOG_ERR, 0);
|
||||
return -1;
|
||||
}
|
||||
@ -3759,8 +3818,7 @@ ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char **argv)
|
||||
} else {
|
||||
uint16_t tmp_val = 0;
|
||||
if (str2ushort(argv[2], &tmp_val) != 0) {
|
||||
lprintf(LOG_ERR,
|
||||
"Given %s '%s' is invalid.",
|
||||
lprintf(LOG_ERR, "Given %s '%s' is invalid.",
|
||||
argv[1], argv[2]);
|
||||
return (-1);
|
||||
}
|
||||
@ -3769,8 +3827,7 @@ ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char **argv)
|
||||
tmp_val);
|
||||
}
|
||||
if (chk_rsp(rsp)) {
|
||||
lprintf(LOG_ERR,
|
||||
"Error Set DCMI Configuration Parameters!");
|
||||
lprintf(LOG_ERR, "Error Set DCMI Configuration Parameters!");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3918,7 +3975,8 @@ ipmi_print_sensor_info(struct ipmi_intf *intf, uint16_t rec_id)
|
||||
return (-1);
|
||||
}
|
||||
if ((header->type == SDR_RECORD_TYPE_FULL_SENSOR) ||
|
||||
(header->type == SDR_RECORD_TYPE_COMPACT_SENSOR)) {
|
||||
(header->type == SDR_RECORD_TYPE_COMPACT_SENSOR))
|
||||
{
|
||||
rc = ipmi_sdr_print_rawentry(intf, header->type,
|
||||
rec, header->length);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user