aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorChristophe Lombard <clombard@linux.ibm.com>2023-08-29 11:23:30 +0200
committerReza Arbab <arbab@linux.ibm.com>2023-09-12 14:22:11 -0500
commitb1e22c7c91185f230a734a74239f4d03fed500af (patch)
tree1408d80ee812c6d7cf417a2813fb7bcf66082613 /core
parentbb6b93f75169a439f5ac5d97a6a011245702b90f (diff)
downloadskiboot-b1e22c7c91185f230a734a74239f4d03fed500af.zip
skiboot-b1e22c7c91185f230a734a74239f4d03fed500af.tar.gz
skiboot-b1e22c7c91185f230a734a74239f4d03fed500af.tar.bz2
core/pldm: Send a system chassis Off-Soft Graceful request
Set the state information of the PLDM effecter identified by: the entity type (PLDM_ENTITY_SYSTEM_CHASSIS) and the state set PLDM_STATE_SET_SYSTEM_POWER_STATE with the effecter state: PLDM_STATE_SET_SYS_POWER_STATE_OFF_SOFT_GRACEFUL to request a platform off. Reviewed-by: Abhishek Singh Tomar <abhishek@linux.ibm.com> Signed-off-by: Christophe Lombard <clombard@linux.ibm.com> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/pldm/pldm-platform-requests.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/pldm/pldm-platform-requests.c b/core/pldm/pldm-platform-requests.c
index f456209..c506bd4 100644
--- a/core/pldm/pldm-platform-requests.c
+++ b/core/pldm/pldm-platform-requests.c
@@ -172,6 +172,38 @@ static int set_state_effecter_states_req(uint16_t effecter_id,
}
/*
+ * entity_type: System chassis (main enclosure)
+ * state_set: System Power State (260)
+ * states: Off-Soft Graceful(9)
+ */
+int pldm_platform_power_off(void)
+{
+ set_effecter_state_field field;
+ uint16_t effecter_id;
+ int rc;
+
+ if (!pdr_ready)
+ return OPAL_HARDWARE;
+
+ rc = find_effecter_id_by_state_set_Id(
+ PLDM_ENTITY_SYSTEM_CHASSIS,
+ PLDM_STATE_SET_SYSTEM_POWER_STATE,
+ &effecter_id, BMC_TID);
+ if (rc) {
+ prlog(PR_ERR, "%s - effecter id not found\n", __func__);
+ return rc;
+ }
+
+ field.set_request = PLDM_REQUEST_SET;
+ field.effecter_state = PLDM_STATE_SET_SYS_POWER_STATE_OFF_SOFT_GRACEFUL;
+
+ prlog(PR_INFO, "sending system chassis Off-Soft Graceful request (effecter_id: %d)\n",
+ effecter_id);
+
+ return set_state_effecter_states_req(effecter_id, &field, true);
+}
+
+/*
* entity_type: System Firmware
* state_set: Software Termination Status(129)
* states: Graceful Restart Requested(6)