diff options
-rw-r--r-- | core/ipmi.c | 17 | ||||
-rw-r--r-- | include/ipmi.h | 34 | ||||
-rw-r--r-- | platforms/bmc/palmetto.c | 4 |
3 files changed, 42 insertions, 13 deletions
diff --git a/core/ipmi.c b/core/ipmi.c index 6cf435d..6cfded6 100644 --- a/core/ipmi.c +++ b/core/ipmi.c @@ -37,21 +37,28 @@ out: free(msg); } -int64_t ipmi_opal_chassis_request(uint64_t request) +static uint8_t chassis_control; +int64_t ipmi_opal_chassis_control(uint64_t request) { struct ipmi_msg *msg = zalloc(sizeof(struct ipmi_msg)); if (!msg) return OPAL_HARDWARE; - msg->cmd = request; + if (request > IPMI_CHASSIS_SOFT_SHUTDOWN) + return OPAL_PARAMETER; + + chassis_control = request; + + msg->cmd = IPMI_CHASSIS_CONTROL_CMD; msg->netfn = IPMI_NETFN_CHASSIS_REQUEST; - msg->req_data = NULL; - msg->req_data_len = 0; + msg->req_data = (uint8_t *)&chassis_control; + msg->req_data_len = sizeof(chassis_control); msg->resp_data = NULL; msg->resp_data_len = 0; - prlog(PR_INFO, "IPMI: sending chassis request %llu\n", request); + prlog(PR_INFO, "IPMI: sending chassis control request %llu\n", + request); return bt_add_ipmi_msg_wait(msg); } diff --git a/include/ipmi.h b/include/ipmi.h index 8cc7e5a..96387b9 100644 --- a/include/ipmi.h +++ b/include/ipmi.h @@ -37,11 +37,33 @@ #define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 #define IPMI_GET_CHANNEL_INFO_CMD 0x42 -#define IPMI_NETFN_CHASSIS_REQUEST 0x00 -#define IPMI_NETFN_CHASSIS_RESPONSE 0x01 -#define IPMI_SET_CHASSIS_PWR_DOWN_CMD 0x00 -#define IPMI_SET_CHASSIS_PWR_UP_CMD 0x01 -#define IPMI_SET_CHASSIS_PWR_CYCLE_CMD 0x02 +/* + * 28. Chassis Commands + */ +#define IPMI_CHASSIS_GET_CAP_CMD 0x00 +#define IPMI_CHASSIS_GET_STATUS_CMD 0x01 +#define IPMI_CHASSIS_CONTROL_CMD 0x02 +#define IPMI_CHASSIS_RESET_CMD 0x03 +#define IPMI_CHASSIS_IDENTIFY_CMD 0x04 +#define IPMI_CHASSIS_SET_PANEL_BUTTON_EN_CMD 0x05 +#define IPMI_CHASSIS_SET_CAP_CMD 0x06 +#define IPMI_CHASSIS_SET_PWR_RESTORE_CMD 0x07 +#define IPMI_CHASSIS_SET_PWR_CYCLE_CMD 0x08 +#define IPMI_CHASSIS_GET_SYS_RESTART_CAUSE_CMD 0x09 +#define IPMI_CHASSIS_SET_SYS_BOOT_OPT_CMD 0x0a +#define IPMI_CHASSIS_GET_SYS_BOOT_OPT_CMD 0x0b +#define IPMI_CHASSIS_GET_POH_COUNTER_CMD 0x0f + +#define IPMI_NETFN_CHASSIS_REQUEST 0x00 +#define IPMI_NETFN_CHASSIS_RESPONSE 0x01 + +/* 28.3. Chassis Control Command */ +#define IPMI_CHASSIS_PWR_DOWN 0x00 +#define IPMI_CHASSIS_PWR_UP 0x01 +#define IPMI_CHASSIS_PWR_CYCLE 0x02 +#define IPMI_CHASSIS_HARD_RESET 0x03 +#define IPMI_CHASSIS_PULSE_DIAG 0x04 +#define IPMI_CHASSIS_SOFT_SHUTDOWN 0x05 #define IPMI_NETFN_STORAGE_REQUEST 0x0a #define IPMI_NETFN_STORAGE_RESPONSE 0x0b @@ -79,6 +101,6 @@ struct ipmi_msg { void ipmi_init(void); /* Change the power state of the P8 */ -int64_t ipmi_opal_chassis_request(uint64_t request); +int64_t ipmi_opal_chassis_control(uint64_t request); #endif diff --git a/platforms/bmc/palmetto.c b/platforms/bmc/palmetto.c index f0a0c86..c8ea281 100644 --- a/platforms/bmc/palmetto.c +++ b/platforms/bmc/palmetto.c @@ -218,12 +218,12 @@ static int64_t palmetto_ipmi_power_down(uint64_t request __unused) * However, I believe at that point we are ready to shut down, * so unconditionally tell the BMC to immediately power us down. */ - return ipmi_opal_chassis_request(IPMI_SET_CHASSIS_PWR_DOWN_CMD); + return ipmi_opal_chassis_control(IPMI_CHASSIS_PWR_DOWN); } static int64_t palmetto_ipmi_reboot(void) { - return ipmi_opal_chassis_request(IPMI_SET_CHASSIS_PWR_CYCLE_CMD); + return ipmi_opal_chassis_control(IPMI_CHASSIS_PWR_CYCLE); } DECLARE_PLATFORM(palmetto) = { |