mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
add set-in-progress flag support to chassis bootdev
This commit is contained in:
parent
153965aca2
commit
96dec6ddc7
@ -105,6 +105,15 @@
|
|||||||
#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1
|
#define IPMI_CHASSIS_POLICY_PREVIOUS 0x1
|
||||||
#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0
|
#define IPMI_CHASSIS_POLICY_ALWAYS_OFF 0x0
|
||||||
|
|
||||||
|
#define IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS 0
|
||||||
|
#define IPMI_CHASSIS_BOOTPARAM_SVCPART_SELECT 1
|
||||||
|
#define IPMI_CHASSIS_BOOTPARAM_SVCPART_SCAN 2
|
||||||
|
#define IPMI_CHASSIS_BOOTPARAM_FLAG_VALID 3
|
||||||
|
#define IPMI_CHASSIS_BOOTPARAM_INFO_ACK 4
|
||||||
|
#define IPMI_CHASSIS_BOOTPARAM_BOOT_FLAGS 5
|
||||||
|
#define IPMI_CHASSIS_BOOTPARAM_INIT_INFO 6
|
||||||
|
#define IPMI_CHASSIS_BOOTPARAM_INIT_MBOX 7
|
||||||
|
|
||||||
/* From table 13-17 of the IPMI v2 specification */
|
/* From table 13-17 of the IPMI v2 specification */
|
||||||
#define IPMI_AUTH_RAKP_NONE 0x00
|
#define IPMI_AUTH_RAKP_NONE 0x00
|
||||||
#define IPMI_AUTH_RAKP_HMAC_SHA1 0x01
|
#define IPMI_AUTH_RAKP_HMAC_SHA1 0x01
|
||||||
|
@ -172,7 +172,7 @@ ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
|
|||||||
printf("default (15 seconds)\n");
|
printf("default (15 seconds)\n");
|
||||||
} else {
|
} else {
|
||||||
if (identify_data.force_on != 0) {
|
if (identify_data.force_on != 0) {
|
||||||
printf("indefinate\n");
|
printf("indefinite\n");
|
||||||
} else {
|
} else {
|
||||||
if (identify_data.interval == 0)
|
if (identify_data.interval == 0)
|
||||||
printf("off\n");
|
printf("off\n");
|
||||||
@ -448,8 +448,10 @@ ipmi_chassis_set_bootparam(struct ipmi_intf * intf, uint8_t param, uint8_t * dat
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rsp->ccode > 0) {
|
if (rsp->ccode > 0) {
|
||||||
lprintf(LOG_ERR, "Set Chassis Boot Parameter %d failed: %s",
|
if (param != 0) {
|
||||||
param, val2str(rsp->ccode, completion_code_vals));
|
lprintf(LOG_ERR, "Set Chassis Boot Parameter %d failed: %s",
|
||||||
|
param, val2str(rsp->ccode, completion_code_vals));
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,13 +508,32 @@ ipmi_chassis_set_bootdev(struct ipmi_intf * intf, char * arg, int clearcmos)
|
|||||||
{
|
{
|
||||||
uint8_t flags[5];
|
uint8_t flags[5];
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
int use_progress = 1;
|
||||||
|
|
||||||
|
/* set set-in-progress flag */
|
||||||
|
memset(flags, 0, 5);
|
||||||
|
flags[0] = 0x01;
|
||||||
|
rc = ipmi_chassis_set_bootparam(intf,
|
||||||
|
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS, flags, 1);
|
||||||
|
if (rc < 0)
|
||||||
|
use_progress = 0;
|
||||||
|
|
||||||
memset(flags, 0, 5);
|
memset(flags, 0, 5);
|
||||||
flags[0] = 0x01;
|
flags[0] = 0x01;
|
||||||
flags[1] = 0x01;
|
flags[1] = 0x01;
|
||||||
rc = ipmi_chassis_set_bootparam(intf, 4, flags, 2);
|
rc = ipmi_chassis_set_bootparam(intf, IPMI_CHASSIS_BOOTPARAM_INFO_ACK,
|
||||||
if (rc < 0)
|
flags, 2);
|
||||||
|
|
||||||
|
if (rc < 0) {
|
||||||
|
if (use_progress) {
|
||||||
|
/* set-in-progress = set-complete */
|
||||||
|
memset(flags, 0, 5);
|
||||||
|
ipmi_chassis_set_bootparam(intf,
|
||||||
|
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
|
||||||
|
flags, 1);
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
memset(flags, 0, 5);
|
memset(flags, 0, 5);
|
||||||
if (arg == NULL)
|
if (arg == NULL)
|
||||||
@ -542,6 +563,13 @@ ipmi_chassis_set_bootdev(struct ipmi_intf * intf, char * arg, int clearcmos)
|
|||||||
flags[1] = 0x18;
|
flags[1] = 0x18;
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR, "Invalid argument: %s", arg);
|
lprintf(LOG_ERR, "Invalid argument: %s", arg);
|
||||||
|
if (use_progress) {
|
||||||
|
/* set-in-progress = set-complete */
|
||||||
|
memset(flags, 0, 5);
|
||||||
|
ipmi_chassis_set_bootparam(intf,
|
||||||
|
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
|
||||||
|
flags, 1);
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,9 +578,29 @@ ipmi_chassis_set_bootdev(struct ipmi_intf * intf, char * arg, int clearcmos)
|
|||||||
|
|
||||||
/* set flag valid bit */
|
/* set flag valid bit */
|
||||||
flags[0] = 0x80;
|
flags[0] = 0x80;
|
||||||
rc = ipmi_chassis_set_bootparam(intf, 5, flags, 5);
|
rc = ipmi_chassis_set_bootparam(intf, IPMI_CHASSIS_BOOTPARAM_BOOT_FLAGS,
|
||||||
if (rc == 0)
|
flags, 5);
|
||||||
|
if (rc == 0) {
|
||||||
|
if (use_progress) {
|
||||||
|
/* set-in-progress = commit-write */
|
||||||
|
memset(flags, 0, 5);
|
||||||
|
flags[0] = 0x02;
|
||||||
|
ipmi_chassis_set_bootparam(intf,
|
||||||
|
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
|
||||||
|
flags, 1);
|
||||||
|
}
|
||||||
|
|
||||||
printf("Set Boot Device to %s\n", arg);
|
printf("Set Boot Device to %s\n", arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (use_progress) {
|
||||||
|
/* set-in-progress = set-complete */
|
||||||
|
memset(flags, 0, 5);
|
||||||
|
ipmi_chassis_set_bootparam(intf,
|
||||||
|
IPMI_CHASSIS_BOOTPARAM_SET_IN_PROGRESS,
|
||||||
|
flags, 1);
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user