@startuml
skinparam ParticipantPadding 10
skinparam BoxPadding 10
box RSE
participant RSE_BL1_1
participant RSE_BL1_2
participant RSE_BL2
participant RSE_S
endbox
box SCP
participant SCP_BL1
endbox
box AP
participant AP_BL1
participant AP_BL2
participant AP_BL31
endbox

== RSE Boot phase ==
-> RSE_BL1_1: Reset
Rnote over RSE_BL1_1: ROM code, XIP
Rnote over RSE_BL1_2: OTP code, XIP
Rnote over RSE_BL2, AP_BL31: Stored in flash, loaded and executed in RAM
activate RSE_BL1_1 #Green
RSE_BL1_1 -->> RSE_BL1_2: Validate, measure
Rnote over RSE_BL1_1: BL1_2 measurement\n\ saved to a shared buffer
RSE_BL1_1 -> RSE_BL1_2: Pass execution
deactivate RSE_BL1_1
activate RSE_BL1_2 #Green
RSE_BL1_2 -->> RSE_BL2: Validate, measure, load
Rnote over RSE_BL1_2: RSE_BL2 measurement\n\ saved to a shared buffer
RSE_BL1_2 -> RSE_BL2: Pass execution
deactivate RSE_BL1_2
activate RSE_BL2 #Green
RSE_BL2 -->> RSE_S: Validate, measure, load
RSE_BL2 -->> SCP_BL1: Validate, measure, load
Rnote over RSE_BL2: RSE_S and SCP_BL1\n\ measurements saved\n\ to a shared buffer
RSE_BL2 -> SCP_BL1: Release from reset
activate SCP_BL1 #Green
Rnote over RSE_BL2, SCP_BL1: MHU init between RSE and SCP
Rnote over SCP_BL1: Configure memory
Rnote over RSE_BL2: Waits for SCP
SCP_BL1 --> RSE_BL2: Done
RSE_BL2 -->> AP_BL1: Validate, measure, load
Rnote over RSE_BL2: AP_BL1 measurement\n\ saved to a shared buffer
RSE_BL2 -> AP_BL1: Release from reset
activate AP_BL1 #Green
RSE_BL2 -> RSE_S: Pass execution
deactivate RSE_BL2
activate RSE_S #Green
Rnote over RSE_S: Measurements read from\n\ shared buffer and saved by\n\
Measured Boot service to\n\ measurement slots.

== RSE Runtime / AP Boot phase ==
Rnote over RSE_S, AP_BL1: MHU init between RSE and AP
Rnote over AP_BL1: Measure and load:\n\ FW_CONFIG\n\ TB_FW_CONFIG
AP_BL1 -> RSE_S: Extend measurement
Rnote over RSE_S: Measured Boot:\n\ store measurement
AP_BL1 -->> AP_BL2: Validate, measure,load
AP_BL1 -> RSE_S: Extend measurement
Rnote over RSE_S: Measured Boot:\n\ store measurement
AP_BL1 -> AP_BL2: Pass execution
deactivate AP_BL1
activate AP_BL2 #Green
Rnote over AP_BL2: Measure and load:\n\ HW_CONFIG
AP_BL2 -> RSE_S: Extend measurement
Rnote over RSE_S: Measured Boot:\n\ store measurement
AP_BL2 -->> AP_BL31: Validate, measure,load
Rnote over AP_BL2: Measure and load:\n\ BL31
AP_BL2 -> RSE_S: Extend measurement
Rnote over RSE_S: Measured Boot:\n\ store measurement
Rnote over AP_BL2: Measure and load:\n\ RMM
AP_BL2 -> RSE_S: Extend measurement
Rnote over RSE_S: Measured Boot:\n\ store measurement
AP_BL2 -> AP_BL31: Pass execution
deactivate AP_BL2
activate AP_BL31 #Green
== RSE / AP Runtime ==
@enduml
