SPRUJ17H March 2022 – October 2024 AM2631 , AM2631-Q1 , AM2632 , AM2632-Q1 , AM2634 , AM2634-Q1
R5F boot rom and HSM boot rom communicate via IPC (Inter processor communication) using shared mailbox RAM. The Mailbox architecture is a distributed architecture with the Mailbox memory present in the Receiving processors Subsystem.
Following is the processor numbering:
Processor | Number |
R5FSS0 Core0 | 0 |
HSM M4 | 6 |
Following is the Tx and Rx mailbox addressing:
Mailbox | Address |
R5 Tx Mailbox | 0x44000000 |
R5 Rx Mailbox | 0x72000000 |
Following are the mailbox interrupts:
Interrupt Type | Interrupt Line |
R5 Mailbox Read Request |
136 |
R5 Mailbox Read Done Acknowledge |
137 |
HSM Mailbox Read Request | 0 |
HSM Mailbox Read Done Acknowledge | 40 |
Mailbox message scheme:
PROC_WRITE writes the message in the PROC_READ mailbox
PROC_WRITE triggers an interrupt to PROC_READ by writing 1 to <PROC_WRITE_SS>_CTRL: <PROC_WRITE>_MBOX_WRITE_DONE [PROC_READ]. Note. It is writing to its own CTRL space.
PROC_READ gets a single interrupt for all inter processor communication which is an aggregated interrupt. PROC_READ Reads the register <PROC_READ_SS>_CTRL::<PROC_READ>_MBOX_READ_REQ and sees bit [PROC_WRITE] is 0x1
PROC_READ Writes to 0x1 to <PROC_READ_SS>>_CTRL:: <PROC_READ>_MBOX_READ_REQ [PROC_WRITE] to clear the interrupt.
PROC_READ Reads the Message
PROC_READ Writes to 0x1 to <PROC_READ_SS>>_CTRL:: <PROC_READ>_MBOX_READ_DONE_ACK[PROC_WRITE] to generate an acknowledgement interrupt to PROC_WRITE.
PROC_WRITE gets a single interrupt for all inter processor communication which is an aggregated ACK interrupt. PROC_WRITE reads the register <PROC_WRITE_SS>_CTRL: <PROC_WRITE>_MBOX_READ_DONE and sees bit [PROC_READ] is 0x1
PROC_WRITE writes 0x1 to <PROC_WRITE_SS>_CTRL: <PROC_WRITE>_MBOX_READ_DONE [PROC_READ] to clear the interrupt.
The supported messages are as follows:
IPC_MsgType_HELLO : It’s a hello message from R5 to HSM.
IPC_MsgType_CERT : It’s a message type of certificate from R5 to HSM.
IPC_MsgType_IMAGE : It’s a message type of image from R5 to HSM.
IPC_MsgType_GET_SOC_ID : SOCID message from R5 to HSM for asking SOCID.
IPC_MsgType_RESULT_ACK : Result acknowledge message from R5 to HSM.
IPC_MsgType_CANCEL : It’s a cancel message from R5 to HSM.
IPC_MsgType_SOC_ID : SOCID message from HSM to R5 for providing SOCID.
IPC_MsgType_RESULT : It’s a result message from HSM to R5.
IPC_MsgType_CANCEL_ACK : It’s a cancel acknowledge message from HSM to R5.
The message flow between HSM and R5 as follows:
HSM State machine:
Wait for Hello…: After unhalting R5 core, HSM ROM waits for ‘Hello…’ message from R5 core. R5 ROM starts execution and initializes core PLL and other necessary modules, configures clocks i.e., R5 Core@400MHz and HSM Core@200MHz and then sends the message IPC_MsgType_HELLO.
Wait for Certificate: R5 core downloads certificate from the identified boot interface and sends message to HSM i.e., IPC_MsgType_CERT. HSM validates the certificate based on the device type.
All the certificate extensions are validated against the above table.
HSM performs the following two operations on the image:
SHA512 of the image
Image hash is calculated on the chunks received, and after receiving entire image the computed HASH is compared with hash present in the certificate
Image Decryption
Decryption of the image is optional. If certificate is enabled with decryption, decryption will start only after certificate verification and image integrity checks are passed.
R5 wait Sleep :
HSM checks for the valid certificate and the image
On successful validation of the certificate and the image, HSM ROM will eclipse R5 ROM and issues R5 core reset, then SBL starts execution from 0x0
In case of any failures observed with the certificate or image validation , HSM retries the boot, state machine jumps to Wait for certificate state.
Note : Refer to section R5 SBL Handoff for more details