feat(app/device_assignment): add transition pdev from has_key to ready
Add support in pdev_communicate RMI handler to transition pdev state
from RMI_PDEV_STATE_HAS_KEY to RMI_PDEV_STATE_READY.
If pdev_communicate is called when the state is RMI_PDEV_STATE_HAS_KEY
then it issues SPDM_SECURE_SESSION command to establish a secure
session.
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
Change-Id: I81849fa52671016c8ec95921dbc01af99a6cd512
diff --git a/runtime/rmi/pdev.c b/runtime/rmi/pdev.c
index c5dde93..cc20131 100644
--- a/runtime/rmi/pdev.c
+++ b/runtime/rmi/pdev.c
@@ -441,6 +441,10 @@
rc = dev_assign_dev_communicate(&pd->da_app_data, enter_args,
exit_args, comm_digest_ptr, DEVICE_ASSIGN_APP_FUNC_ID_CONNECT_INIT);
break;
+ case RMI_PDEV_STATE_HAS_KEY:
+ rc = dev_assign_dev_communicate(&pd->da_app_data, enter_args,
+ exit_args, comm_digest_ptr, DEVICE_ASSIGN_APP_FUNC_ID_SECURE_SESSION);
+ break;
case RMI_PDEV_STATE_STOPPING:
rc = dev_assign_dev_communicate(&pd->da_app_data, enter_args,
exit_args, comm_digest_ptr, DEVICE_ASSIGN_APP_FUNC_ID_STOP_CONNECTION);
@@ -566,6 +570,8 @@
case DEV_COMM_IDLE:
if (pd->rmi_state == RMI_PDEV_STATE_NEW) {
pd->rmi_state = RMI_PDEV_STATE_NEEDS_KEY;
+ } else if (pd->rmi_state == RMI_PDEV_STATE_HAS_KEY) {
+ pd->rmi_state = RMI_PDEV_STATE_READY;
} else if (pd->rmi_state == RMI_PDEV_STATE_STOPPING) {
pd->rmi_state = RMI_PDEV_STATE_STOPPED;
} else {