1656 lines
56 KiB
Diff
1656 lines
56 KiB
Diff
|
--- ipmitool-1.8.12/doc/ipmitool.1 2012-05-17 10:52:35.000000000 -0500
|
||
|
+++ ipmitool/doc/ipmitool.1 2012-08-13 13:48:38.000000000 -0500
|
||
|
@@ -350,6 +350,30 @@ OEM\-Defined option #1
|
||
|
.br
|
||
|
|
||
|
OEM\-Defined option #2
|
||
|
+
|
||
|
+.RE
|
||
|
+.TP
|
||
|
+\fIgetsysinfo\fP <\fBargument\fP>
|
||
|
+Retrieves system info from bmc for given argument.
|
||
|
+.br
|
||
|
+See \fIsetsysinfo\fP for argument definitions
|
||
|
+.TP
|
||
|
+\fIsetsysinfo\fP <\fBargument\fP> <\fBstring\fP>
|
||
|
+Stores system info string to bmc for given argument
|
||
|
+.RS
|
||
|
+.TP
|
||
|
+Possible arguments are:
|
||
|
+.RS
|
||
|
+.TP
|
||
|
+\fIprimary_os_name\fP Primary Operating System Name
|
||
|
+.TP
|
||
|
+\fIos_name\fP Operating System Name
|
||
|
+.TP
|
||
|
+\fIsystem_name\fP System Name of Server
|
||
|
+.TP
|
||
|
+\fIdelloem_os_version\fP Running versin of operating system
|
||
|
+.TP
|
||
|
+\fIdelloem_URL\fP URL of BMC Webserver
|
||
|
.RE
|
||
|
.RE
|
||
|
.TP
|
||
|
--- ipmitool-1.8.12/lib/ipmi_delloem.c 2012-08-03 12:07:07.000000000 -0500
|
||
|
+++ ipmitool/lib/ipmi_delloem.c 2012-08-14 12:46:30.000000000 -0500
|
||
|
@@ -216,8 +216,6 @@ static int ipmi_print_power_consmpt_hist
|
||
|
static int ipmi_get_power_cap(struct ipmi_intf* intf,IPMI_POWER_CAP* ipmipowercap );
|
||
|
static int ipmi_print_power_cap(struct ipmi_intf* intf,uint8_t unit );
|
||
|
static int ipmi_set_power_cap(struct ipmi_intf* intf,int unit,int val );
|
||
|
-static int getpowersupplyfruinfo(struct ipmi_intf *intf, uint8_t id,
|
||
|
- struct fru_header header, struct fru_info fru);
|
||
|
static void ipmi_powermonitor_usage(void);
|
||
|
|
||
|
/* vFlash Function prototypes */
|
||
|
@@ -663,45 +661,35 @@ ipmi_lcd_get_platform_model_name (struct
|
||
|
struct ipmi_rs * rsp = NULL;
|
||
|
struct ipmi_rq req = {0};
|
||
|
uint8_t data[4];
|
||
|
- IPMI_DELL_LCD_STRING * lcdstringblock;
|
||
|
+ IPMI_DELL_LCD_STRING lcdstringblock;
|
||
|
int lcdstring_len = 0;
|
||
|
int bytes_copied = 0;
|
||
|
+ int rc;
|
||
|
|
||
|
int ii;
|
||
|
|
||
|
for (ii = 0; ii < 4; ii++)
|
||
|
{
|
||
|
int bytes_to_copy;
|
||
|
- memset (&req,0,sizeof(req));
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0; /* get parameter*/
|
||
|
- data[1] = field_type;
|
||
|
- data[2] = ii;
|
||
|
- data[3] = 0;
|
||
|
-
|
||
|
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL) {
|
||
|
+ rc = ipmi_getsysinfo(intf, field_type, ii, 0,
|
||
|
+ sizeof(lcdstringblock),
|
||
|
+ &lcdstringblock);
|
||
|
+ if (rc < 0) {
|
||
|
lprintf(LOG_ERR, " Error getting platform model name");
|
||
|
- } else if (rsp->ccode > 0) {
|
||
|
+ } else if (rc > 0) {
|
||
|
lprintf(LOG_ERR, " Error getting platform model name: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
}
|
||
|
|
||
|
- lcdstringblock = (IPMI_DELL_LCD_STRING *) (void *) rsp->data;
|
||
|
-
|
||
|
/* first block is different - 14 bytes*/
|
||
|
if (0 == ii) {
|
||
|
- lcdstring_len = lcdstringblock->lcd_string.selector_0_string.length;
|
||
|
+ lcdstring_len = lcdstringblock.lcd_string.selector_0_string.length;
|
||
|
|
||
|
lcdstring_len = MIN (lcdstring_len,max_length);
|
||
|
|
||
|
bytes_to_copy = MIN(lcdstring_len, IPMI_DELL_LCD_STRING1_SIZE);
|
||
|
- memcpy (lcdstring, lcdstringblock->lcd_string.selector_0_string.data, bytes_to_copy);
|
||
|
+ memcpy (lcdstring, lcdstringblock.lcd_string.selector_0_string.data, bytes_to_copy);
|
||
|
} else {
|
||
|
int string_offset;
|
||
|
|
||
|
@@ -709,7 +697,7 @@ ipmi_lcd_get_platform_model_name (struct
|
||
|
if (bytes_to_copy < 1)
|
||
|
break;
|
||
|
string_offset = IPMI_DELL_LCD_STRING1_SIZE + IPMI_DELL_LCD_STRINGN_SIZE * (ii-1);
|
||
|
- memcpy (lcdstring+string_offset, lcdstringblock->lcd_string.selector_n_data, bytes_to_copy);
|
||
|
+ memcpy (lcdstring+string_offset, lcdstringblock.lcd_string.selector_n_data, bytes_to_copy);
|
||
|
}
|
||
|
|
||
|
|
||
|
@@ -737,37 +725,25 @@ ipmi_lcd_get_platform_model_name (struct
|
||
|
static int
|
||
|
ipmi_idracvalidator_command (struct ipmi_intf * intf)
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
-
|
||
|
- memset (&req,0,sizeof(req));
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0;
|
||
|
- data[1] = IPMI_DELL_IDRAC_VALIDATOR;
|
||
|
- data[2] = 2;
|
||
|
- data[3] = 0;
|
||
|
+ int rc;
|
||
|
+ uint8_t data[11];
|
||
|
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL) {
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_IDRAC_VALIDATOR, 2, 0, sizeof(data), data);
|
||
|
+ if (rc < 0) {
|
||
|
/*lprintf(LOG_ERR, " Error getting IMC type"); */
|
||
|
return -1;
|
||
|
- } else if (rsp->ccode > 0) {
|
||
|
+ } else if (rc > 0) {
|
||
|
/*lprintf(LOG_ERR, " Error getting IMC type: %s",
|
||
|
val2str(rsp->ccode, completion_code_vals)); */
|
||
|
return -1;
|
||
|
}
|
||
|
/* Support the 11G Monolithic, modular, Maisy and Coaster */
|
||
|
- if( (IMC_IDRAC_11G_MONOLITHIC == rsp->data[10]) || (IMC_IDRAC_11G_MODULAR ==rsp->data[10]) ||
|
||
|
- (IMC_MASER_LITE_BMC == rsp->data[10]) || (IMC_MASER_LITE_NU ==rsp->data[10]) )
|
||
|
+ if( (IMC_IDRAC_11G_MONOLITHIC == data[10]) || (IMC_IDRAC_11G_MODULAR == data[10]) ||
|
||
|
+ (IMC_MASER_LITE_BMC == data[10]) || (IMC_MASER_LITE_NU == data[10]) )
|
||
|
{
|
||
|
iDRAC_FLAG=IDRAC_11G;
|
||
|
}
|
||
|
- else if( (IMC_IDRAC_12G_MONOLITHIC == rsp->data[10]) || (IMC_IDRAC_12G_MODULAR==rsp->data[10]) )
|
||
|
+ else if( (IMC_IDRAC_12G_MONOLITHIC == data[10]) || (IMC_IDRAC_12G_MODULAR == data[10]) )
|
||
|
{
|
||
|
iDRAC_FLAG=IDRAC_12G;
|
||
|
}
|
||
|
@@ -775,7 +751,7 @@ ipmi_idracvalidator_command (struct ipmi
|
||
|
{
|
||
|
iDRAC_FLAG=0;
|
||
|
}
|
||
|
- IMC_Type = rsp->data[10];
|
||
|
+ IMC_Type = data[10];
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
@@ -797,35 +773,20 @@ ipmi_idracvalidator_command (struct ipmi
|
||
|
static int
|
||
|
ipmi_lcd_get_configure_command_wh (struct ipmi_intf * intf)
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
uint8_t data[4];
|
||
|
+ int rc;
|
||
|
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0;
|
||
|
- data[1] = IPMI_DELL_LCD_CONFIG_SELECTOR;
|
||
|
- data[2] = 0;
|
||
|
- data[3] = 0;
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL) {
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_LCD_CONFIG_SELECTOR, 0, 0, sizeof(lcd_mode), &lcd_mode);
|
||
|
+ if (rc < 0) {
|
||
|
lprintf(LOG_ERR, " Error getting LCD configuration");
|
||
|
return -1;
|
||
|
- }else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb)){
|
||
|
-
|
||
|
+ } else if ((rc == 0xc1)||(rc == 0xcb)){
|
||
|
lprintf(LOG_ERR, " Error getting LCD configuration: Command not supported on this system.");
|
||
|
-
|
||
|
- } else if (rsp->ccode > 0) {
|
||
|
+ } else if (rc > 0) {
|
||
|
lprintf(LOG_ERR, " Error getting LCD configuration: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
-
|
||
|
- lcd_mode= *((LCD_MODE*)(rsp->data));
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
@@ -846,40 +807,29 @@ static int
|
||
|
ipmi_lcd_get_configure_command (struct ipmi_intf * intf,
|
||
|
uint8_t *command)
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
uint8_t data[4];
|
||
|
+ int rc;
|
||
|
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0;
|
||
|
- data[1] = IPMI_DELL_LCD_CONFIG_SELECTOR;
|
||
|
- data[2] = 0;
|
||
|
- data[3] = 0;
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_LCD_CONFIG_SELECTOR, 0, 0, sizeof(data), data);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD configuration");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
+ else if ((rc == 0xc1)||(rc == 0xcb))
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD configuration: Command not supported on this system.");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if (rsp->ccode > 0)
|
||
|
+ else if (rc > 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD configuration: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
/* rsp->data[0] is the rev */
|
||
|
- *command = rsp->data[1];
|
||
|
+ *command = data[1];
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
@@ -900,35 +850,26 @@ static int
|
||
|
ipmi_lcd_set_configure_command (struct ipmi_intf * intf, int command)
|
||
|
{
|
||
|
#define LSCC_DATA_LEN 2
|
||
|
-
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
uint8_t data[2];
|
||
|
+ int rc;
|
||
|
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_SET_SYS_INFO;
|
||
|
- req.msg.data_len = 2;
|
||
|
- req.msg.data = data;
|
||
|
data[0] = IPMI_DELL_LCD_CONFIG_SELECTOR;
|
||
|
data[1] = command; /* command - custom, default, none */
|
||
|
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_setsysinfo(intf, 2, data);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error setting LCD configuration");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
+ else if ((rc == 0xc1)||(rc == 0xcb))
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error setting LCD configuration: Command not supported on this system.");
|
||
|
-
|
||
|
}
|
||
|
- else if (rsp->ccode > 0)
|
||
|
+ else if (rc > 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error setting LCD configuration: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
-
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
@@ -955,17 +896,10 @@ ipmi_lcd_set_configure_command_wh (struc
|
||
|
uint8_t errordisp)
|
||
|
{
|
||
|
#define LSCC_DATA_LEN 2
|
||
|
-
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
uint8_t data[13];
|
||
|
+ int rc;
|
||
|
|
||
|
ipmi_lcd_get_configure_command_wh(intf);
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_SET_SYS_INFO;
|
||
|
- req.msg.data_len = 13;
|
||
|
- req.msg.data = data;
|
||
|
data[0] = IPMI_DELL_LCD_CONFIG_SELECTOR;
|
||
|
|
||
|
if(mode!=0xFF)
|
||
|
@@ -1016,20 +950,21 @@ ipmi_lcd_set_configure_command_wh (struc
|
||
|
{
|
||
|
data[11]=lcd_mode.error_display;
|
||
|
}
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
+
|
||
|
+ rc = ipmi_setsysinfo(intf, 13, data);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error setting LCD configuration");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
+ else if ((rc == 0xc1)||(rc == 0xcb))
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error setting LCD configuration: Command not supported on this system.");
|
||
|
}
|
||
|
- else if (rsp->ccode > 0)
|
||
|
+ else if (rc > 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error setting LCD configuration: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
|
||
|
return -1;
|
||
|
}
|
||
|
@@ -1054,49 +989,34 @@ ipmi_lcd_set_configure_command_wh (struc
|
||
|
static int
|
||
|
ipmi_lcd_get_single_line_text (struct ipmi_intf * intf, char* lcdstring, uint8_t max_length)
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
- IPMI_DELL_LCD_STRING * lcdstringblock;
|
||
|
+ IPMI_DELL_LCD_STRING lcdstringblock;
|
||
|
int lcdstring_len = 0;
|
||
|
int bytes_copied = 0;
|
||
|
- int ii;
|
||
|
+ int ii, rc;
|
||
|
|
||
|
for (ii = 0; ii < 4; ii++) {
|
||
|
int bytes_to_copy;
|
||
|
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0; /* get parameter*/
|
||
|
- data[1] = IPMI_DELL_LCD_STRING_SELECTOR;
|
||
|
- data[2] = ii; /* block selector*/
|
||
|
- data[3] = 00; /* set selector (n/a)*/
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL) {
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_LCD_STRING_SELECTOR, ii, 0, sizeof(lcdstringblock), &lcdstringblock);
|
||
|
+ if (rc < 0) {
|
||
|
lprintf(LOG_ERR, " Error getting text data");
|
||
|
return -1;
|
||
|
- } else if (rsp->ccode > 0) {
|
||
|
+ } else if (rc > 0) {
|
||
|
lprintf(LOG_ERR, " Error getting text data: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
- lcdstringblock = (IPMI_DELL_LCD_STRING *) (void *) rsp->data;
|
||
|
-
|
||
|
/* first block is different - 14 bytes*/
|
||
|
if (0 == ii)
|
||
|
{
|
||
|
- lcdstring_len = lcdstringblock->lcd_string.selector_0_string.length;
|
||
|
+ lcdstring_len = lcdstringblock.lcd_string.selector_0_string.length;
|
||
|
|
||
|
if (lcdstring_len < 1 || lcdstring_len > max_length)
|
||
|
break;
|
||
|
|
||
|
bytes_to_copy = MIN(lcdstring_len, IPMI_DELL_LCD_STRING1_SIZE);
|
||
|
- memcpy (lcdstring, lcdstringblock->lcd_string.selector_0_string.data, bytes_to_copy);
|
||
|
+ memcpy (lcdstring, lcdstringblock.lcd_string.selector_0_string.data, bytes_to_copy);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
@@ -1106,7 +1026,7 @@ ipmi_lcd_get_single_line_text (struct ip
|
||
|
if (bytes_to_copy < 1)
|
||
|
break;
|
||
|
string_offset = IPMI_DELL_LCD_STRING1_SIZE + IPMI_DELL_LCD_STRINGN_SIZE * (ii-1);
|
||
|
- memcpy (lcdstring+string_offset, lcdstringblock->lcd_string.selector_n_data, bytes_to_copy);
|
||
|
+ memcpy (lcdstring+string_offset, lcdstringblock.lcd_string.selector_n_data, bytes_to_copy);
|
||
|
}
|
||
|
|
||
|
bytes_copied += bytes_to_copy;
|
||
|
@@ -1130,14 +1050,10 @@ static int
|
||
|
ipmi_lcd_get_info_wh(struct ipmi_intf * intf)
|
||
|
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
- IPMI_DELL_LCD_CAPS* lcd_caps;
|
||
|
+ IPMI_DELL_LCD_CAPS lcd_caps;
|
||
|
char lcdstring[IPMI_DELL_LCD_STRING_LENGTH_MAX+1] = {0};
|
||
|
int rc;
|
||
|
|
||
|
-
|
||
|
printf("LCD info\n");
|
||
|
|
||
|
if (ipmi_lcd_get_configure_command_wh (intf) != 0)
|
||
|
@@ -1165,41 +1081,28 @@ ipmi_lcd_get_info_wh(struct ipmi_intf *
|
||
|
}
|
||
|
else if (lcd_mode.lcdmode == IPMI_DELL_LCD_CONFIG_USER_DEFINED)
|
||
|
{
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0; /* get parameter*/
|
||
|
- data[1] = IPMI_DELL_LCD_GET_CAPS_SELECTOR;
|
||
|
- data[2] = 0; /* set selector (n/a)*/
|
||
|
- data[3] = 0; /* block selector (n/a)*/
|
||
|
-
|
||
|
printf(" Setting: User defined\n");
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_LCD_GET_CAPS_SELECTOR, 0, 0, sizeof(lcd_caps), &lcd_caps);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD capabilities.");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
+ else if ((rc == 0xc1)||(rc == 0xcb))
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD capabilities: Command not supported on this system.");
|
||
|
}
|
||
|
- else if (rsp->ccode > 0)
|
||
|
+ else if (rc > 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD capabilities: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
-
|
||
|
- lcd_caps = (IPMI_DELL_LCD_CAPS *)rsp->data;
|
||
|
- if (lcd_caps->number_lines > 0)
|
||
|
+ if (lcd_caps.number_lines > 0)
|
||
|
{
|
||
|
memset(lcdstring, 0, IPMI_DELL_LCD_STRING_LENGTH_MAX+1);
|
||
|
|
||
|
- rc = ipmi_lcd_get_single_line_text (intf, lcdstring, lcd_caps->max_chars[0]);
|
||
|
+ rc = ipmi_lcd_get_single_line_text (intf, lcdstring, lcd_caps.max_chars[0]);
|
||
|
printf(" Text: %s\n", lcdstring);
|
||
|
}
|
||
|
else
|
||
|
@@ -1269,10 +1172,7 @@ ipmi_lcd_get_info_wh(struct ipmi_intf *
|
||
|
******************************************************************/
|
||
|
static int ipmi_lcd_get_info(struct ipmi_intf * intf)
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
- IPMI_DELL_LCD_CAPS * lcd_caps;
|
||
|
+ IPMI_DELL_LCD_CAPS lcd_caps;
|
||
|
uint8_t command = 0;
|
||
|
char lcdstring[IPMI_DELL_LCD_STRING_LENGTH_MAX+1] = {0};
|
||
|
int rc;
|
||
|
@@ -1301,40 +1201,28 @@ static int ipmi_lcd_get_info(struct ipmi
|
||
|
}
|
||
|
else if (command == IPMI_DELL_LCD_CONFIG_USER_DEFINED)
|
||
|
{
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0; /* get parameter */
|
||
|
- data[1] = IPMI_DELL_LCD_GET_CAPS_SELECTOR;
|
||
|
- data[2] = 0; /* set selector (n/a) */
|
||
|
- data[3] = 0; /* block selector (n/a) */
|
||
|
-
|
||
|
printf(" Setting: custom\n");
|
||
|
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_LCD_GET_CAPS_SELECTOR, 0, 0, sizeof(lcd_caps), &lcd_caps);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD capabilities.");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
+ else if ((rc == 0xc1)||(rc == 0xcb))
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD capabilities: Command not supported on this system.");
|
||
|
}
|
||
|
- else if (rsp->ccode > 0)
|
||
|
+ else if (rc > 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD capabilities: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
-
|
||
|
- lcd_caps = (IPMI_DELL_LCD_CAPS *)(void *)rsp->data;
|
||
|
- if (lcd_caps->number_lines > 0)
|
||
|
+ if (lcd_caps.number_lines > 0)
|
||
|
{
|
||
|
memset (lcdstring,0,IPMI_DELL_LCD_STRING_LENGTH_MAX+1);
|
||
|
- rc = ipmi_lcd_get_single_line_text (intf, lcdstring, lcd_caps->max_chars[0]);
|
||
|
+ rc = ipmi_lcd_get_single_line_text (intf, lcdstring, lcd_caps.max_chars[0]);
|
||
|
printf(" Text: %s\n", lcdstring);
|
||
|
}
|
||
|
else
|
||
|
@@ -1360,44 +1248,26 @@ static int ipmi_lcd_get_info(struct ipmi
|
||
|
static int
|
||
|
ipmi_lcd_get_status_val(struct ipmi_intf * intf, LCD_STATUS* lcdstatus)
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
-
|
||
|
+ int rc;
|
||
|
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0; /* get parameter */
|
||
|
- data[1] = IPMI_DELL_LCD_STATUS_SELECTOR;
|
||
|
- data[2] = 0; /* block selector */
|
||
|
- data[3] = 0;
|
||
|
- /* set selector (n/a) */
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_LCD_STATUS_SELECTOR, 0, 0, sizeof(*lcdstatus), lcdstatus);
|
||
|
+ printf("lcd %x %x\n", lcdstatus->vKVM_status, lcdstatus->lock_status);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD Status");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
+ else if ((rc == 0xc1)||(rc == 0xcb))
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD status: Command not supported on this system.");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if (rsp->ccode > 0)
|
||
|
+ else if (rc > 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD Status: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
-
|
||
|
- /*lcdstatus= (LCD_STATUS* ) rsp->data; */
|
||
|
-
|
||
|
- lcdstatus->vKVM_status=rsp->data[1];
|
||
|
- lcdstatus->lock_status=rsp->data[2];
|
||
|
-
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
@@ -1427,36 +1297,13 @@ static int IsLCDSupported ()
|
||
|
******************************************************************/
|
||
|
static void CheckLCDSupport(struct ipmi_intf * intf)
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
+ int rc;
|
||
|
|
||
|
LcdSupported = 0;
|
||
|
-
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0; /* get parameter */
|
||
|
- data[1] = IPMI_DELL_LCD_STATUS_SELECTOR;
|
||
|
- data[2] = 0; /* block selector */
|
||
|
- data[3] = 0;
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
- {
|
||
|
- return;
|
||
|
- }
|
||
|
- else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
- {
|
||
|
- return;
|
||
|
- }
|
||
|
- else if (rsp->ccode > 0)
|
||
|
- {
|
||
|
- return;
|
||
|
- }
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_LCD_STATUS_SELECTOR, 0, 0, 0, NULL);
|
||
|
+ if (rc == 0) {
|
||
|
LcdSupported = 1;
|
||
|
-
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
/*****************************************************************
|
||
|
@@ -1644,8 +1491,6 @@ ipmi_lcd_set_lock(struct ipmi_intf * int
|
||
|
static int
|
||
|
ipmi_lcd_set_single_line_text (struct ipmi_intf * intf, char * text)
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
uint8_t data[18];
|
||
|
int bytes_to_store = strlen(text);
|
||
|
int bytes_stored = 0;
|
||
|
@@ -1667,11 +1512,6 @@ ipmi_lcd_set_single_line_text (struct ip
|
||
|
MIN((bytes_to_store - bytes_stored), IPMI_DELL_LCD_STRING1_SIZE);
|
||
|
if (size_of_copy < 0) /* allow 0 string length*/
|
||
|
break;
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_SET_SYS_INFO;
|
||
|
- req.msg.data_len = size_of_copy + 4; /* chars, selectors and sizes*/
|
||
|
- req.msg.data = data;
|
||
|
data[0] = IPMI_DELL_LCD_STRING_SELECTOR;
|
||
|
data[1] = ii; /* block number to use (0)*/
|
||
|
data[2] = 0; /*string encoding*/
|
||
|
@@ -1683,24 +1523,18 @@ ipmi_lcd_set_single_line_text (struct ip
|
||
|
MIN((bytes_to_store - bytes_stored), IPMI_DELL_LCD_STRINGN_SIZE);
|
||
|
if (size_of_copy <= 0)
|
||
|
break;
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_SET_SYS_INFO;
|
||
|
- req.msg.data_len = size_of_copy + 2;
|
||
|
- req.msg.data = data;
|
||
|
data[0] = IPMI_DELL_LCD_STRING_SELECTOR;
|
||
|
data[1] = ii; /* block number to use (1,2,3)*/
|
||
|
memcpy (data+2, text+bytes_stored, size_of_copy);
|
||
|
bytes_stored += size_of_copy;
|
||
|
}
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL) {
|
||
|
+ rc = ipmi_setsysinfo(intf, 18, data);
|
||
|
+ if (rc < 0) {
|
||
|
lprintf(LOG_ERR, " Error setting text data");
|
||
|
rc = -1;
|
||
|
- } else if (rsp->ccode > 0) {
|
||
|
+ } else if (rc > 0) {
|
||
|
lprintf(LOG_ERR, " Error setting text data: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
rc = -1;
|
||
|
}
|
||
|
}
|
||
|
@@ -1726,46 +1560,29 @@ static int
|
||
|
ipmi_lcd_set_text(struct ipmi_intf * intf, char * text, int line_number)
|
||
|
{
|
||
|
int rc = 0;
|
||
|
+ IPMI_DELL_LCD_CAPS lcd_caps;
|
||
|
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
- IPMI_DELL_LCD_CAPS * lcd_caps;
|
||
|
-
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0; /* get parameter*/
|
||
|
- data[1] = IPMI_DELL_LCD_GET_CAPS_SELECTOR;
|
||
|
- data[2] = 0; /* set selector (n/a)*/
|
||
|
- data[3] = 0; /* block selector (n/a)*/
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_LCD_GET_CAPS_SELECTOR, 0, 0, sizeof(lcd_caps), &lcd_caps);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD capabilities");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if (rsp->ccode > 0)
|
||
|
+ else if (rc > 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting LCD capabilities: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
- lcd_caps = (IPMI_DELL_LCD_CAPS *)(void *)rsp->data;
|
||
|
-
|
||
|
- if (lcd_caps->number_lines > 0) {
|
||
|
+ if (lcd_caps.number_lines > 0) {
|
||
|
rc = ipmi_lcd_set_single_line_text (intf, text);
|
||
|
} else {
|
||
|
lprintf(LOG_ERR, "LCD does not have any lines that can be set");
|
||
|
rc = -1;
|
||
|
}
|
||
|
|
||
|
-
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
@@ -2209,7 +2026,6 @@ static int ipmi_macinfo_10g (struct ipmi
|
||
|
req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
req.msg.data = msg_data;
|
||
|
|
||
|
-
|
||
|
req.msg.data_len = input_length;
|
||
|
|
||
|
rsp = intf->sendrecv(intf, &req);
|
||
|
@@ -3980,52 +3796,40 @@ static int ipmi_print_get_power_consmpt_
|
||
|
******************************************************************/
|
||
|
static int ipmi_get_avgpower_consmpt_history(struct ipmi_intf* intf,IPMI_AVGPOWER_CONSUMP_HISTORY* pavgpower )
|
||
|
{
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
-
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0;
|
||
|
- data[1] = 0xeb;
|
||
|
- data[2] = 0;
|
||
|
- data[3] = 0;
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
+ int rc;
|
||
|
+ uint8_t *rdata;
|
||
|
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_getsysinfo(intf, 0xeb, 0, 0, sizeof(*pavgpower), pavgpower);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting average power consumption history data .\n");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if((iDRAC_FLAG == IDRAC_12G) && (rsp->ccode == LICENSE_NOT_SUPPORTED)) {
|
||
|
+ else if((iDRAC_FLAG == IDRAC_12G) && (rc == LICENSE_NOT_SUPPORTED)) {
|
||
|
printf("FM001 : A required license is missing or expired\n");
|
||
|
return -1;
|
||
|
- } else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
+ } else if ((rc == 0xc1)||(rc == 0xcb))
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting average power consumption history data: Command not supported on this system.");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if (rsp->ccode != 0)
|
||
|
+ else if (rc != 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting average power consumption historydata: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
if (verbose > 1)
|
||
|
{
|
||
|
+ rdata = (void *)pavgpower;
|
||
|
+
|
||
|
printf("Average power consumption history Data :%x %x %x %x %x %x %x\n\n",
|
||
|
- rsp->data[0], rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7]);
|
||
|
+ rdata[0], rdata[1], rdata[2], rdata[3],
|
||
|
+ rdata[4], rdata[5], rdata[6], rdata[7]);
|
||
|
|
||
|
}
|
||
|
-
|
||
|
- *pavgpower = *( (IPMI_AVGPOWER_CONSUMP_HISTORY*) rsp->data);
|
||
|
#if WORDS_BIGENDIAN
|
||
|
pavgpower->lastminutepower = BSWAP_16(pavgpower->lastminutepower);
|
||
|
pavgpower->lasthourpower = BSWAP_16(pavgpower->lasthourpower);
|
||
|
@@ -4048,56 +3852,44 @@ static int ipmi_get_avgpower_consmpt_his
|
||
|
******************************************************************/
|
||
|
static int ipmi_get_peakpower_consmpt_history(struct ipmi_intf* intf,IPMI_POWER_CONSUMP_HISTORY * pstPeakpower)
|
||
|
{
|
||
|
+ uint8_t *rdata;
|
||
|
+ int rc;
|
||
|
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
-
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0;
|
||
|
- data[1] = 0xec;
|
||
|
- data[2] = 0;
|
||
|
- data[3] = 0;
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
-
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_getsysinfo(intf, 0xEC, 0, 0, sizeof(*pstPeakpower), pstPeakpower);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting peak power consumption history data .\n");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if((iDRAC_FLAG == IDRAC_12G) && (rsp->ccode == LICENSE_NOT_SUPPORTED)) {
|
||
|
+ else if((iDRAC_FLAG == IDRAC_12G) && (rc == LICENSE_NOT_SUPPORTED)) {
|
||
|
printf("FM001 : A required license is missing or expired\n");
|
||
|
return -1;
|
||
|
- } else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
+ } else if ((rc == 0xc1)||(rc == 0xcb))
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting peak power consumption history data: Command not supported on this system.");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if (rsp->ccode != 0)
|
||
|
+ else if (rc != 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting peak power consumption history data: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
if (verbose > 1)
|
||
|
{
|
||
|
+ rdata = (void *)pstPeakpower;
|
||
|
+
|
||
|
printf("Peak power consmhistory Data : %x %x %x %x %x %x %x %x %x %x\n %x %x %x %x %x %x %x %x %x %x %x %x %x\n\n",
|
||
|
- rsp->data[0], rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10], rsp->data[11],
|
||
|
- rsp->data[12], rsp->data[13], rsp->data[14], rsp->data[15],
|
||
|
- rsp->data[16], rsp->data[17], rsp->data[18], rsp->data[19],
|
||
|
- rsp->data[20], rsp->data[21], rsp->data[22], rsp->data[23]
|
||
|
+ rdata[0], rdata[1], rdata[2], rdata[3],
|
||
|
+ rdata[4], rdata[5], rdata[6], rdata[7],
|
||
|
+ rdata[8], rdata[9], rdata[10], rdata[11],
|
||
|
+ rdata[12], rdata[13], rdata[14], rdata[15],
|
||
|
+ rdata[16], rdata[17], rdata[18], rdata[19],
|
||
|
+ rdata[20], rdata[21], rdata[22], rdata[23]
|
||
|
);
|
||
|
|
||
|
}
|
||
|
- *pstPeakpower =* ((IPMI_POWER_CONSUMP_HISTORY*)rsp->data);
|
||
|
#if WORDS_BIGENDIAN
|
||
|
pstPeakpower->lastminutepower = BSWAP_16(pstPeakpower->lastminutepower);
|
||
|
pstPeakpower->lasthourpower = BSWAP_16(pstPeakpower->lasthourpower);
|
||
|
@@ -4124,56 +3916,43 @@ static int ipmi_get_peakpower_consmpt_hi
|
||
|
******************************************************************/
|
||
|
static int ipmi_get_minpower_consmpt_history(struct ipmi_intf* intf,IPMI_POWER_CONSUMP_HISTORY * pstMinpower)
|
||
|
{
|
||
|
+ uint8_t *rdata;
|
||
|
+ int rc;
|
||
|
|
||
|
- struct ipmi_rs * rsp = NULL;
|
||
|
- struct ipmi_rq req = {0};
|
||
|
- uint8_t data[4];
|
||
|
-
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
- data[0] = 0;
|
||
|
- data[1] = 0xed;
|
||
|
- data[2] = 0;
|
||
|
- data[3] = 0;
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
-
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_getsysinfo(intf, 0xED, 0, 0, sizeof(*pstMinpower), pstMinpower);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting peak power consumption history data .\n");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if((iDRAC_FLAG == IDRAC_12G) && (rsp->ccode == LICENSE_NOT_SUPPORTED)) {
|
||
|
+ else if((iDRAC_FLAG == IDRAC_12G) && (rc == LICENSE_NOT_SUPPORTED)) {
|
||
|
printf("FM001 : A required license is missing or expired\n");
|
||
|
return -1;
|
||
|
- } else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb))
|
||
|
- {
|
||
|
+ } else if ((rc == 0xc1)||(rc == 0xcb)) {
|
||
|
lprintf(LOG_ERR, " Error getting peak power consumption history data: Command not supported on this system.");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if (rsp->ccode != 0)
|
||
|
+ else if (rc != 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting peak power consumption history data: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
if (verbose > 1)
|
||
|
{
|
||
|
+ rdata = (void *)pstMinpower;
|
||
|
+
|
||
|
printf("Peak power consmhistory Data : %x %x %x %x %x %x %x %x %x %x\n %x %x %x %x %x %x %x %x %x %x %x %x %x\n\n",
|
||
|
- rsp->data[0], rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10], rsp->data[11],
|
||
|
- rsp->data[12], rsp->data[13], rsp->data[14], rsp->data[15],
|
||
|
- rsp->data[16], rsp->data[17], rsp->data[18], rsp->data[19],
|
||
|
- rsp->data[20], rsp->data[21], rsp->data[22], rsp->data[23]
|
||
|
+ rdata[0], rdata[1], rdata[2], rdata[3],
|
||
|
+ rdata[4], rdata[5], rdata[6], rdata[7],
|
||
|
+ rdata[8], rdata[9], rdata[10], rdata[11],
|
||
|
+ rdata[12], rdata[13], rdata[14], rdata[15],
|
||
|
+ rdata[16], rdata[17], rdata[18], rdata[19],
|
||
|
+ rdata[20], rdata[21], rdata[22], rdata[23]
|
||
|
);
|
||
|
|
||
|
}
|
||
|
- *pstMinpower =* ((IPMI_POWER_CONSUMP_HISTORY*)rsp->data);
|
||
|
#if WORDS_BIGENDIAN
|
||
|
pstMinpower->lastminutepower = BSWAP_16(pstMinpower->lastminutepower);
|
||
|
pstMinpower->lasthourpower = BSWAP_16(pstMinpower->lasthourpower);
|
||
|
@@ -4355,70 +4134,35 @@ static int ipmi_print_power_consmpt_hist
|
||
|
|
||
|
static int ipmi_get_power_cap(struct ipmi_intf* intf,IPMI_POWER_CAP* ipmipowercap )
|
||
|
{
|
||
|
- struct ipmi_rs * rsp=NULL;
|
||
|
- struct ipmi_rq req={0};
|
||
|
uint64_t tempbtuphrconv;
|
||
|
- uint8_t data[4];
|
||
|
-
|
||
|
- /* power supply rating command*/
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
-
|
||
|
- data[0] = 0;
|
||
|
- data[1] = IPMI_DELL_POWER_CAP;
|
||
|
- data[2] = 0;
|
||
|
- data[3] = 0;
|
||
|
-
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
+ uint8_t *rdata;
|
||
|
+ int rc;
|
||
|
|
||
|
- if (rsp == NULL) {
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_POWER_CAP, 0, 0, sizeof(*ipmipowercap), ipmipowercap);
|
||
|
+ if (rc < 0) {
|
||
|
lprintf(LOG_ERR, " Error getting power cap .\n");
|
||
|
- if (verbose > 1){
|
||
|
- printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ",
|
||
|
- rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10],rsp->data[11]);
|
||
|
- }
|
||
|
return -1;
|
||
|
|
||
|
- } else if((iDRAC_FLAG == IDRAC_12G) && (rsp->ccode == LICENSE_NOT_SUPPORTED)) {
|
||
|
+ } else if((iDRAC_FLAG == IDRAC_12G) && (rc == LICENSE_NOT_SUPPORTED)) {
|
||
|
printf("FM001 : A required license is missing or expired\n");
|
||
|
return -1;
|
||
|
- } else if ((rsp->ccode == 0xc1)||(rsp->ccode == 0xcb)) {
|
||
|
-
|
||
|
+ } else if ((rc == 0xc1)||(rc == 0xcb)) {
|
||
|
lprintf(LOG_ERR, " Error getting power cap: Command not supported on this system.");
|
||
|
- if (verbose > 1){
|
||
|
- printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ",
|
||
|
- rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10],rsp->data[11]);
|
||
|
-
|
||
|
- }
|
||
|
return -1;
|
||
|
- } else if (rsp->ccode != 0){
|
||
|
+ } else if (rc != 0){
|
||
|
lprintf(LOG_ERR, " Error getting power cap: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
- if (verbose > 1){
|
||
|
- printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ",
|
||
|
- rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10],rsp->data[11]);
|
||
|
- }
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
if (verbose > 1){
|
||
|
+ rdata = (void*)ipmipowercap;
|
||
|
+
|
||
|
printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ",
|
||
|
- rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10],rsp->data[11]);
|
||
|
+ rdata[1], rdata[2], rdata[3],
|
||
|
+ rdata[4], rdata[5], rdata[6], rdata[7],
|
||
|
+ rdata[8], rdata[9], rdata[10],rdata[11]);
|
||
|
|
||
|
}
|
||
|
-
|
||
|
- * ipmipowercap = *((IPMI_POWER_CAP*)(rsp->data));
|
||
|
#if WORDS_BIGENDIAN
|
||
|
ipmipowercap->PowerCap = BSWAP_16(ipmipowercap->PowerCap);
|
||
|
ipmipowercap->MaximumPowerConsmp = BSWAP_16(ipmipowercap->MaximumPowerConsmp);
|
||
|
@@ -4485,9 +4229,8 @@ static int ipmi_print_power_cap(struct i
|
||
|
******************************************************************/
|
||
|
static int ipmi_set_power_cap(struct ipmi_intf* intf,int unit,int val )
|
||
|
{
|
||
|
- struct ipmi_rs *rsp = NULL;
|
||
|
- struct ipmi_rq req={0};;
|
||
|
- uint8_t data[13];
|
||
|
+ int rc;
|
||
|
+ uint8_t data[13], *rdata;
|
||
|
uint16_t powercapval;
|
||
|
uint64_t maxpowerbtuphr;
|
||
|
uint64_t maxpowerbtuphr1;
|
||
|
@@ -4508,86 +4251,48 @@ static int ipmi_set_power_cap(struct ipm
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- memset(data, 0, 4);
|
||
|
- req.msg.data = data;
|
||
|
-
|
||
|
- data[0] = 0;
|
||
|
- data[1] = IPMI_DELL_POWER_CAP;
|
||
|
- data[2] = 0;
|
||
|
- data[3] = 0;
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_getsysinfo(intf, IPMI_DELL_POWER_CAP, 0, 0, sizeof(ipmipowercap), &ipmipowercap);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting power cap .\n");
|
||
|
- if (verbose > 1)
|
||
|
- {
|
||
|
- printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ",
|
||
|
- rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10],rsp->data[11]);
|
||
|
- }
|
||
|
return -1;
|
||
|
-
|
||
|
}
|
||
|
- else if((iDRAC_FLAG == IDRAC_12G) && (rsp->ccode == LICENSE_NOT_SUPPORTED)) {
|
||
|
+ else if((iDRAC_FLAG == IDRAC_12G) && (rc == LICENSE_NOT_SUPPORTED)) {
|
||
|
printf("FM001 : A required license is missing or expired\n");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if (rsp->ccode == 0xc1)
|
||
|
+ else if (rc == 0xc1)
|
||
|
{
|
||
|
-
|
||
|
lprintf(LOG_ERR, " Error getting power cap, command not supported on this system.\n");
|
||
|
- if (verbose > 1){
|
||
|
- printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ",
|
||
|
- rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10],rsp->data[11]);
|
||
|
-
|
||
|
- }
|
||
|
return -1;
|
||
|
}
|
||
|
- else if (rsp->ccode != 0)
|
||
|
+ else if (rc != 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error getting power cap: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
- if (verbose > 1)
|
||
|
- {
|
||
|
- printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ",
|
||
|
- rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10],rsp->data[11]);
|
||
|
- }
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
if (verbose > 1)
|
||
|
{
|
||
|
+ rdata = (void *)&ipmipowercap;
|
||
|
printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ",
|
||
|
- rsp->data[1], rsp->data[2], rsp->data[3],
|
||
|
- rsp->data[4], rsp->data[5], rsp->data[6], rsp->data[7],
|
||
|
- rsp->data[8], rsp->data[9], rsp->data[10],rsp->data[11]);
|
||
|
+ rdata[1], rdata[2], rdata[3],
|
||
|
+ rdata[4], rdata[5], rdata[6], rdata[7],
|
||
|
+ rdata[8], rdata[9], rdata[10],rdata[11]);
|
||
|
|
||
|
}
|
||
|
-
|
||
|
- ipmipowercap.PowerCap=((rsp->data[1]<<8)+rsp->data[2]);
|
||
|
- ipmipowercap.unit=rsp->data[3];
|
||
|
- ipmipowercap.MaximumPowerConsmp=((rsp->data[4]<<8)+rsp->data[5]);
|
||
|
- ipmipowercap.MinimumPowerConsmp=((rsp->data[6]<<8)+rsp->data[7]);
|
||
|
+#if WORDS_BIGENDIAN
|
||
|
+ ipmipowercap.PowerCap = BSWAP_16(ipmipowercap.PowerCap);
|
||
|
+ ipmipowercap.MaximumPowerConsump = BSWAP_16(ipmipowercap.MaximumPowerConsump);
|
||
|
+ ipmipowercap.MinumumPowerConsump = BSWAP_16(ipmipowercap.MinimumPowerConsump);
|
||
|
+ ipmipowercap.AvailablePower = BSWAP_16(ipmipowercap.AvailablePower);
|
||
|
+ ipmipowercap.totalnumpowersupp = BSWP_16(ipmipowercap.totalnumpowersupp);
|
||
|
+#endif
|
||
|
|
||
|
memset(data, 0, 13);
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_SET_SYS_INFO;
|
||
|
- req.msg.data_len = 13;
|
||
|
- req.msg.data = data;
|
||
|
data[0] = IPMI_DELL_POWER_CAP;
|
||
|
powercapval=val;
|
||
|
|
||
|
-
|
||
|
data[1] = (powercapval&0XFF);
|
||
|
data[2] = ((powercapval&0XFF00)>>8);
|
||
|
data[3] = unit;
|
||
|
@@ -4602,9 +4307,6 @@ static int ipmi_set_power_cap(struct ipm
|
||
|
data[11]=(ipmipowercap.SystemThrottling);
|
||
|
data[12]=0x00;
|
||
|
|
||
|
- ipmipowercap.MaximumPowerConsmp = BSWAP_16(ipmipowercap.MaximumPowerConsmp);
|
||
|
- ipmipowercap.MinimumPowerConsmp = BSWAP_16(ipmipowercap.MinimumPowerConsmp);
|
||
|
- ipmipowercap.PowerCap = BSWAP_16(ipmipowercap.PowerCap);
|
||
|
if(unit==btuphr)
|
||
|
{
|
||
|
val = btuphr_to_watt_conversion(val);
|
||
|
@@ -4641,123 +4343,30 @@ static int ipmi_set_power_cap(struct ipm
|
||
|
|
||
|
return -1;
|
||
|
}
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL)
|
||
|
+ rc = ipmi_setsysinfo(intf, 13, data);
|
||
|
+ if (rc < 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error setting power cap");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if((iDRAC_FLAG == IDRAC_12G) && (rsp->ccode == LICENSE_NOT_SUPPORTED)) {
|
||
|
+ else if((iDRAC_FLAG == IDRAC_12G) && (rc == LICENSE_NOT_SUPPORTED)) {
|
||
|
printf("FM001 : A required license is missing or expired\n");
|
||
|
return -1;
|
||
|
}
|
||
|
- else if (rsp->ccode > 0)
|
||
|
+ else if (rc > 0)
|
||
|
{
|
||
|
lprintf(LOG_ERR, " Error setting power cap: %s",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
+ val2str(rc, completion_code_vals));
|
||
|
return -1;
|
||
|
}
|
||
|
if (verbose > 1)
|
||
|
{
|
||
|
- printf("CC for setpowercap :%d ",rsp->ccode);
|
||
|
+ printf("CC for setpowercap :%d ",rc);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*****************************************************************
|
||
|
-* Function Name: getpowersupplyfruinfo
|
||
|
-*
|
||
|
-* Description: This function retrieves the FRU header
|
||
|
-* Input: intf - ipmi interface
|
||
|
-* header - watt / btuphr
|
||
|
-* fru - FRU information
|
||
|
-* Output: header - FRU header
|
||
|
-* Return:
|
||
|
-*
|
||
|
-******************************************************************/
|
||
|
-static int getpowersupplyfruinfo(struct ipmi_intf *intf, uint8_t id,
|
||
|
- struct fru_header header, struct fru_info fru)
|
||
|
-{
|
||
|
- struct ipmi_rs * rsp;
|
||
|
- struct ipmi_rq req;
|
||
|
-
|
||
|
- uint8_t msg_data[4];
|
||
|
-
|
||
|
- memset(&fru, 0, sizeof(struct fru_info));
|
||
|
- memset(&header, 0, sizeof(struct fru_header));
|
||
|
-
|
||
|
- /*
|
||
|
- * get info about this FRU
|
||
|
- */
|
||
|
- memset(msg_data, 0, 4);
|
||
|
- msg_data[0] = id;
|
||
|
-
|
||
|
- memset(&req, 0, sizeof(req));
|
||
|
- req.msg.netfn = IPMI_NETFN_STORAGE;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = GET_FRU_INFO;
|
||
|
- req.msg.data = msg_data;
|
||
|
- req.msg.data_len = 1;
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL) {
|
||
|
- printf(" Device not present (No Response)\n");
|
||
|
- return -1;
|
||
|
- }
|
||
|
- if (rsp->ccode > 0) {
|
||
|
- printf(" Device not present (%s)\n",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
- return -1;
|
||
|
- }
|
||
|
-
|
||
|
- fru.size = (rsp->data[1] << 8) | rsp->data[0];
|
||
|
- fru.access = rsp->data[2] & 0x1;
|
||
|
-
|
||
|
- lprintf(LOG_DEBUG, "fru.size = %d bytes (accessed by %s)",
|
||
|
- fru.size, fru.access ? "words" : "bytes");
|
||
|
-
|
||
|
- if (fru.size < 1) {
|
||
|
- lprintf(LOG_ERR, " Invalid FRU size %d", fru.size);
|
||
|
- return -1;
|
||
|
- }
|
||
|
-
|
||
|
- /*
|
||
|
- * retrieve the FRU header
|
||
|
- */
|
||
|
- msg_data[0] = id;
|
||
|
- msg_data[1] = 0;
|
||
|
- msg_data[2] = 0;
|
||
|
- msg_data[3] = 8;
|
||
|
-
|
||
|
- memset(&req, 0, sizeof(req));
|
||
|
- req.msg.netfn = IPMI_NETFN_STORAGE;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = GET_FRU_DATA;
|
||
|
- req.msg.data = msg_data;
|
||
|
- req.msg.data_len = 4;
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp == NULL) {
|
||
|
- printf(" Device not present (No Response)\n");
|
||
|
- return 1;
|
||
|
- }
|
||
|
- if (rsp->ccode > 0) {
|
||
|
- printf(" Device not present (%s)\n",
|
||
|
- val2str(rsp->ccode, completion_code_vals));
|
||
|
- return 1;
|
||
|
- }
|
||
|
-
|
||
|
- if (verbose > 1)
|
||
|
- printbuf(rsp->data, rsp->data_len, "FRU DATA");
|
||
|
-
|
||
|
- memcpy(&header, rsp->data + 1, 8);
|
||
|
-
|
||
|
- return 0;
|
||
|
-
|
||
|
-
|
||
|
-}
|
||
|
-
|
||
|
-/*****************************************************************
|
||
|
* Function Name: ipmi_powermonitor_usage
|
||
|
*
|
||
|
* Description: This function prints help message for powermonitor command
|
||
|
@@ -5291,53 +4900,3 @@ ipmi_delloem_setled_main(struct ipmi_int
|
||
|
/* Set drive LEDs */
|
||
|
return ipmi_setled_state (intf, bayId, slotId, mask);
|
||
|
}
|
||
|
-
|
||
|
-
|
||
|
-/*****************************************************************
|
||
|
- * Function Name: ipmi_getsysinfo
|
||
|
- *
|
||
|
- * Description: This function processes the IPMI Get System Info command
|
||
|
- * Input: intf - ipmi interface
|
||
|
- * param - Parameter # (0xC0..0xFF = OEM)
|
||
|
- * block/set - Block/Set number of parameter
|
||
|
- * len - Length of buffer
|
||
|
- * buffer - Pointer to buffer
|
||
|
- * Output:
|
||
|
- *
|
||
|
- * Return: return code 0 - success
|
||
|
- * -1 - failure
|
||
|
- * other = IPMI ccode
|
||
|
- *
|
||
|
- ******************************************************************/
|
||
|
-static int
|
||
|
-ipmi_getsysinfo(struct ipmi_intf * intf, int param, int block, int set, int len, void *buffer)
|
||
|
-{
|
||
|
- uint8_t data[4];
|
||
|
- struct ipmi_rs *rsp = NULL;
|
||
|
- struct ipmi_rq req={0};
|
||
|
-
|
||
|
- memset(buffer, 0, len);
|
||
|
- memset(data, 0, 4);
|
||
|
- req.msg.netfn = IPMI_NETFN_APP;
|
||
|
- req.msg.lun = 0;
|
||
|
- req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
- req.msg.data_len = 4;
|
||
|
- req.msg.data = data;
|
||
|
-
|
||
|
- data[0] = 0; // get/set
|
||
|
- data[1] = param;
|
||
|
- data[2] = block;
|
||
|
- data[3] = set;
|
||
|
-
|
||
|
- rsp = intf->sendrecv(intf, &req);
|
||
|
- if (rsp != NULL) {
|
||
|
- if (rsp->ccode == 0) {
|
||
|
- if (len > rsp->data_len)
|
||
|
- len = rsp->data_len;
|
||
|
- if (len && buffer)
|
||
|
- memcpy(buffer, rsp->data, len);
|
||
|
- }
|
||
|
- return rsp->ccode;
|
||
|
- }
|
||
|
- return -1;
|
||
|
-}
|
||
|
--- ipmitool-1.8.12/lib/ipmi_mc.c 2010-05-04 09:44:19.000000000 -0500
|
||
|
+++ ipmitool/lib/ipmi_mc.c 2012-08-13 13:48:38.000000000 -0500
|
||
|
@@ -45,6 +45,8 @@
|
||
|
|
||
|
extern int verbose;
|
||
|
|
||
|
+static int ipmi_sysinfo_main(struct ipmi_intf *intf, int argc, char ** argv);
|
||
|
+
|
||
|
/* ipmi_mc_reset - attempt to reset an MC
|
||
|
*
|
||
|
* @intf: ipmi interface
|
||
|
@@ -168,10 +170,17 @@ printf_mc_usage(void)
|
||
|
printf(" selftest\n");
|
||
|
printf(" getenables\n");
|
||
|
printf(" setenables <option=on|off> ...\n");
|
||
|
-
|
||
|
for (bf = mc_enables_bf; bf->name != NULL; bf++) {
|
||
|
printf(" %-20s %s\n", bf->name, bf->desc);
|
||
|
}
|
||
|
+ printf(" getsysinfo argument\n");
|
||
|
+ printf(" setsysinfo argument string\n");
|
||
|
+ printf(" Valid arguments are:\n");
|
||
|
+ printf(" primary_os_name Primary operating system name\n");
|
||
|
+ printf(" os_name Operating system name\n");
|
||
|
+ printf(" system_name System Name of server (vendor dependent\n");
|
||
|
+ printf(" delloem_os_version Running version of operating system\n");
|
||
|
+ printf(" delloem_url Url of bmc webserver\n");
|
||
|
}
|
||
|
|
||
|
|
||
|
@@ -793,9 +802,237 @@ ipmi_mc_main(struct ipmi_intf * intf, in
|
||
|
print_watchdog_usage();
|
||
|
}
|
||
|
}
|
||
|
+ else if (!strncmp(argv[0], "getsysinfo", 10) ||
|
||
|
+ !strncmp(argv[0], "setsysinfo", 10)) {
|
||
|
+ rc = ipmi_sysinfo_main(intf, argc, argv);
|
||
|
+ }
|
||
|
else {
|
||
|
lprintf(LOG_ERR, "Invalid mc/bmc command: %s", argv[0]);
|
||
|
rc = -1;
|
||
|
}
|
||
|
return rc;
|
||
|
}
|
||
|
+
|
||
|
+
|
||
|
+static int sysinfo_param(struct ipmi_intf *intf, const char *str, int *maxset)
|
||
|
+{
|
||
|
+ *maxset = 4;
|
||
|
+ if (!strcmp(str, "system_name"))
|
||
|
+ return IPMI_SYSINFO_HOSTNAME;
|
||
|
+ if (!strcmp(str, "primary_os_name"))
|
||
|
+ return IPMI_SYSINFO_PRIMARY_OS_NAME;
|
||
|
+ if (!strcmp(str, "os_name"))
|
||
|
+ return IPMI_SYSINFO_OS_NAME;
|
||
|
+
|
||
|
+ if (!strcmp(str, "delloem_os_version")) {
|
||
|
+ *maxset = 4;
|
||
|
+ return IPMI_SYSINFO_DELL_OS_VERSION;
|
||
|
+ }
|
||
|
+ if (!strcmp(str, "delloem_url")) {
|
||
|
+ *maxset = 2;
|
||
|
+ return IPMI_SYSINFO_DELL_URL;
|
||
|
+ }
|
||
|
+ return strtoul(str, 0, 0);
|
||
|
+ return -1;
|
||
|
+}
|
||
|
+
|
||
|
+static void ipmi_sysinfo_usage()
|
||
|
+{
|
||
|
+ lprintf(LOG_NOTICE, "usage:");
|
||
|
+ lprintf(LOG_NOTICE, " getsysinfo argument");
|
||
|
+ lprintf(LOG_NOTICE, " Retrieves system info from bmc for given argument");
|
||
|
+ lprintf(LOG_NOTICE, " setsysinfo argument string");
|
||
|
+ lprintf(LOG_NOTICE, " Stores system info string for given argument to bmc");
|
||
|
+ lprintf(LOG_NOTICE, "");
|
||
|
+ lprintf(LOG_NOTICE, " Valid arguments are:");
|
||
|
+ lprintf(LOG_NOTICE, " primary_os_name Primary operating system name");
|
||
|
+ lprintf(LOG_NOTICE, " os_name Operating system name");
|
||
|
+ lprintf(LOG_NOTICE, " system_name System Name of server (vendor dependent");
|
||
|
+ lprintf(LOG_NOTICE, " delloem_os_version Running version of operating system");
|
||
|
+ lprintf(LOG_NOTICE, " delloem_url Url of bmc webserver");
|
||
|
+
|
||
|
+ lprintf(LOG_NOTICE, "");
|
||
|
+}
|
||
|
+
|
||
|
+/*****************************************************************
|
||
|
+ * Function Name: ipmi_getsysinfo
|
||
|
+ *
|
||
|
+ * Description: This function processes the IPMI Get System Info command
|
||
|
+ * Input: intf - ipmi interface
|
||
|
+ * param - Parameter # (0xC0..0xFF = OEM)
|
||
|
+ * block/set - Block/Set number of parameter
|
||
|
+ * len - Length of buffer
|
||
|
+ * buffer - Pointer to buffer
|
||
|
+ * Output:
|
||
|
+ *
|
||
|
+ * Return: return code 0 - success
|
||
|
+ * -1 - failure
|
||
|
+ * other = IPMI ccode
|
||
|
+ *
|
||
|
+ ******************************************************************/
|
||
|
+int
|
||
|
+ipmi_getsysinfo(struct ipmi_intf * intf, int param, int block, int set,
|
||
|
+ int len, void *buffer)
|
||
|
+{
|
||
|
+ uint8_t data[4];
|
||
|
+ struct ipmi_rs *rsp = NULL;
|
||
|
+ struct ipmi_rq req={0};
|
||
|
+
|
||
|
+ memset(buffer, 0, len);
|
||
|
+ memset(data, 0, 4);
|
||
|
+ req.msg.netfn = IPMI_NETFN_APP;
|
||
|
+ req.msg.lun = 0;
|
||
|
+ req.msg.cmd = IPMI_GET_SYS_INFO;
|
||
|
+ req.msg.data_len = 4;
|
||
|
+ req.msg.data = data;
|
||
|
+
|
||
|
+ if (verbose > 1)
|
||
|
+ printf("getsysinfo: %.2x/%.2x/%.2x\n", param, block, set);
|
||
|
+ data[0] = 0; // get/set
|
||
|
+ data[1] = param;
|
||
|
+ data[2] = block;
|
||
|
+ data[3] = set;
|
||
|
+
|
||
|
+ // Format of get output is:
|
||
|
+ // u8 param_rev
|
||
|
+ // u8 selector
|
||
|
+ // u8 encoding bit[0-3];
|
||
|
+ // u8 length
|
||
|
+ // u8 data0[14]
|
||
|
+ rsp = intf->sendrecv(intf, &req);
|
||
|
+ if (rsp != NULL) {
|
||
|
+ if (rsp->ccode == 0) {
|
||
|
+ if (len > rsp->data_len)
|
||
|
+ len = rsp->data_len;
|
||
|
+ if (len && buffer)
|
||
|
+ memcpy(buffer, rsp->data, len);
|
||
|
+ }
|
||
|
+ return rsp->ccode;
|
||
|
+ }
|
||
|
+ return -1;
|
||
|
+}
|
||
|
+
|
||
|
+/*****************************************************************
|
||
|
+ * Function Name: ipmi_setsysinfo
|
||
|
+ *
|
||
|
+ * Description: This function processes the IPMI Set System Info command
|
||
|
+ * Input: intf - ipmi interface
|
||
|
+ * len - Length of buffer
|
||
|
+ * buffer - Pointer to buffer
|
||
|
+ * Output:
|
||
|
+ *
|
||
|
+ * Return: return code 0 - success
|
||
|
+ * -1 - failure
|
||
|
+ * other = IPMI ccode
|
||
|
+ *
|
||
|
+ ******************************************************************/
|
||
|
+int
|
||
|
+ipmi_setsysinfo(struct ipmi_intf * intf, int len, void *buffer)
|
||
|
+{
|
||
|
+ struct ipmi_rs *rsp = NULL;
|
||
|
+ struct ipmi_rq req={0};
|
||
|
+
|
||
|
+ req.msg.netfn = IPMI_NETFN_APP;
|
||
|
+ req.msg.lun = 0;
|
||
|
+ req.msg.cmd = IPMI_SET_SYS_INFO;
|
||
|
+ req.msg.data_len = len;
|
||
|
+ req.msg.data = buffer;
|
||
|
+
|
||
|
+ // Format of set input:
|
||
|
+ // u8 param rev
|
||
|
+ // u8 selector
|
||
|
+ // u8 data1[16]
|
||
|
+ rsp = intf->sendrecv(intf, &req);
|
||
|
+ if (rsp != NULL) {
|
||
|
+ return rsp->ccode;
|
||
|
+ }
|
||
|
+ return -1;
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
+static int ipmi_sysinfo_main(struct ipmi_intf *intf, int argc, char ** argv)
|
||
|
+{
|
||
|
+ int param, isset;
|
||
|
+ char *str;
|
||
|
+ unsigned char infostr[256];
|
||
|
+ unsigned char paramdata[18];
|
||
|
+ int pos, set, rc, maxset, len;
|
||
|
+
|
||
|
+ /* Is this a setsysinfo or getsysinfo */
|
||
|
+ isset = !strncmp(argv[0], "setsysinfo\0",11);
|
||
|
+
|
||
|
+ if (argc == 1 || strcmp(argv[1], "help") == 0 ||
|
||
|
+ argc < (isset ? 3 : 2)) {
|
||
|
+ ipmi_sysinfo_usage();
|
||
|
+ return 0;
|
||
|
+ }
|
||
|
+ memset(infostr, 0, sizeof(infostr));
|
||
|
+
|
||
|
+ /* Get Parameters */
|
||
|
+ param = sysinfo_param(intf, argv[1], &maxset);
|
||
|
+ if (param < 0) {
|
||
|
+ ipmi_sysinfo_usage();
|
||
|
+ return 0;
|
||
|
+ }
|
||
|
+
|
||
|
+ rc = 0;
|
||
|
+ if (isset) {
|
||
|
+ str = argv[2];
|
||
|
+ set = pos = 0;
|
||
|
+ len = strlen(str);
|
||
|
+
|
||
|
+ /* first block holds 14 bytes, all others hold 16 */
|
||
|
+ if (((len + 2) + 15) / 16 >= maxset)
|
||
|
+ len = maxset * 16 - 2;
|
||
|
+ do {
|
||
|
+ memset(paramdata, 0, sizeof(paramdata));
|
||
|
+ paramdata[0] = param;
|
||
|
+ paramdata[1] = set;
|
||
|
+ if (set == 0) {
|
||
|
+ /* First block is special case */
|
||
|
+ paramdata[2] = 0; // ascii encoding
|
||
|
+ paramdata[3] = len; // length;
|
||
|
+ strncpy(paramdata+4, str+pos, IPMI_SYSINFO_SET0_SIZE);
|
||
|
+ pos += IPMI_SYSINFO_SET0_SIZE;
|
||
|
+ } else {
|
||
|
+ strncpy(paramdata+2, str+pos, IPMI_SYSINFO_SETN_SIZE);
|
||
|
+ pos += IPMI_SYSINFO_SETN_SIZE;
|
||
|
+ }
|
||
|
+ rc = ipmi_setsysinfo(intf, 18, paramdata);
|
||
|
+ if (rc)
|
||
|
+ break;
|
||
|
+ set++;
|
||
|
+ } while (pos < len);
|
||
|
+ } else {
|
||
|
+ /* Read blocks of data */
|
||
|
+ pos = 0;
|
||
|
+ for (set=0; set<maxset; set++) {
|
||
|
+ rc = ipmi_getsysinfo(intf, param, set, 0, 18, paramdata);
|
||
|
+ if (rc)
|
||
|
+ break;
|
||
|
+ if (set == 0) {
|
||
|
+ /* First block is special case */
|
||
|
+ if ((paramdata[2] & 0xF) == 0) {
|
||
|
+ /* Determine max number of blocks to read */
|
||
|
+ maxset = ((paramdata[3] + 2) + 15) / 16;
|
||
|
+ }
|
||
|
+ memcpy(infostr+pos, paramdata+4, IPMI_SYSINFO_SET0_SIZE);
|
||
|
+ pos += IPMI_SYSINFO_SET0_SIZE;
|
||
|
+ } else {
|
||
|
+ memcpy(infostr+pos, paramdata+2, IPMI_SYSINFO_SETN_SIZE);
|
||
|
+ pos += IPMI_SYSINFO_SETN_SIZE;
|
||
|
+ }
|
||
|
+ }
|
||
|
+ printf("%s\n", infostr);
|
||
|
+ }
|
||
|
+ if (rc < 0) {
|
||
|
+ lprintf(LOG_ERR, "%s %s set %d command failed", argv[0], argv[1], set);
|
||
|
+ }
|
||
|
+ else if (rc == 0x80) {
|
||
|
+ lprintf(LOG_ERR, "%s %s parameter not supported", argv[0], argv[1]);
|
||
|
+ }
|
||
|
+ else if (rc > 0) {
|
||
|
+ lprintf(LOG_ERR, "%s %s", argv[0], val2str(rc, completion_code_vals));
|
||
|
+ }
|
||
|
+ return rc;
|
||
|
+}
|
||
|
--- ipmitool-1.8.12/include/ipmitool/ipmi_delloem.h 2012-07-27 10:21:55.000000000 -0500
|
||
|
+++ ipmitool/include/ipmitool/ipmi_delloem.h 2012-08-14 12:50:18.000000000 -0500
|
||
|
@@ -39,10 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||
|
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||
|
|
||
|
|
||
|
-/* IPMI 2.0 command for system information*/
|
||
|
-#define IPMI_SET_SYS_INFO 0x58
|
||
|
-#define IPMI_GET_SYS_INFO 0x59
|
||
|
-
|
||
|
/* Dell selector for LCD control - get and set unless specified */
|
||
|
#define IPMI_DELL_LCD_STRING_SELECTOR 0xC1 /* RW get/set the user string */
|
||
|
#define IPMI_DELL_LCD_CONFIG_SELECTOR 0xC2 /* RW set to user/default/none */
|
||
|
@@ -139,6 +135,7 @@ typedef struct _tag_ipmi_dell_lcd_string
|
||
|
|
||
|
typedef struct _lcd_status
|
||
|
{
|
||
|
+ char parametersel;
|
||
|
char vKVM_status;
|
||
|
char lock_status;
|
||
|
char Resv1;
|
||
|
--- ipmitool-1.8.12/include/ipmitool/ipmi_mc.h 2009-06-09 10:38:09.000000000 -0500
|
||
|
+++ ipmitool/include/ipmitool/ipmi_mc.h 2012-08-13 13:48:38.000000000 -0500
|
||
|
@@ -151,4 +151,20 @@ struct ipm_get_watchdog_rsp {
|
||
|
#define IPM_WATCHDOG_CLEAR_BIOS_POST 0x04
|
||
|
#define IPM_WATCHDOG_CLEAR_BIOS_FRB2 0x02
|
||
|
|
||
|
+/* IPMI 2.0 command for system information*/
|
||
|
+#define IPMI_SET_SYS_INFO 0x58
|
||
|
+#define IPMI_GET_SYS_INFO 0x59
|
||
|
+#define IPMI_SYSINFO_SET0_SIZE 14
|
||
|
+#define IPMI_SYSINFO_SETN_SIZE 16
|
||
|
+
|
||
|
+#define IPMI_SYSINFO_HOSTNAME 0x02
|
||
|
+#define IPMI_SYSINFO_PRIMARY_OS_NAME 0x03
|
||
|
+#define IPMI_SYSINFO_OS_NAME 0x04
|
||
|
+#define IPMI_SYSINFO_DELL_OS_VERSION 0xe4
|
||
|
+#define IPMI_SYSINFO_DELL_URL 0xde
|
||
|
+
|
||
|
+int ipmi_getsysinfo(struct ipmi_intf * intf, int param, int block, int set,
|
||
|
+ int len, void *buffer);
|
||
|
+int ipmi_setsysinfo(struct ipmi_intf * intf, int len, void *buffer);
|
||
|
+
|
||
|
#endif /*IPMI_MC_H */
|