Hard Processor System Booting User Guide: Agilex™ 5 SoCs

ID 813762
Date 12/20/2024
Public
Document Table of Contents

4.11.3. Preserving Data in SDRAM Across Reset Examples

The following example demonstrates the SDRAM Data Retention mechanism during a Warm reset using the U-Boot shell. In this example, data is written to the memory address specified by the loadaddr environment variable. A Warm reset is then initiated using the reset command and setting the reset environment variable to warm. In this case, a cache flush is not needed, as it is handled by U-Boot during the execution of the socfpga_sysreset_request() function in drivers/sysreset/sysreset_socfpga_agilex5.c file. After the reboot, you can see that the reset state printed by U-Boot SPL corresponds to a Warm reset triggered by SDM (with ATF sending a request through the SDM mailbox). Once back in the U-Boot shell, the same memory locations are read to verify that the data has survived the reset.

# Write some data in a SDRAM memory location
SOCFPGA_AGILEX5 # mw ${loadaddr} 0xcafecafe 0x10
SOCFPGA_AGILEX5 # md ${loadaddr} 10
82000000: cafecafe cafecafe cafecafe cafecafe  ................
82000010: cafecafe cafecafe cafecafe cafecafe  ................
82000020: cafecafe cafecafe cafecafe cafecafe  ................
82000030: cafecafe cafecafe cafecafe cafecafe  ................
# Triger a Warm Reset
SOCFPGA_AGILEX5 # setenv reset warm
SOCFPGA_AGILEX5 # reset
resetting ...
Do warm reset now...

<reboot occurs here>

U-Boot SPL 2023.10-31805-g69d5338be0-dirty (May 22 2024 - 14:26:16 -0500)
Reset state: Warm [from SDM]
:
Hit any key to stop autoboot:  0 
# Reading back the preserved data 
SOCFPGA_AGILEX5 # md ${loadaddr} 10
82000000: cafecafe cafecafe cafecafe cafecafe  ................
82000010: cafecafe cafecafe cafecafe cafecafe  ................
82000020: cafecafe cafecafe cafecafe cafecafe  ................
82000030: cafecafe cafecafe cafecafe cafecafe  ................

The following code snippet demonstrates the same example, but this time issuing a cold reset. Here, the reset command is called without defining any value for the reset environment variable, resulting in a cold reset. In this scenario, the data written to SDRAM is automatically flushed from the cache to SDRAM as part of the handling of the PSCI_SYSTEM_RESET command by the SMC handler in the Arm Trusted Firmware. After the reboot, the reset state printed by U-Boot SPL indicates that a cold reset occurred. Once back in the U-Boot shell, the same memory locations are read to verify that the data has also survived this reset.

# Write some data in a SDRAM memory location
SOCFPGA_AGILEX5 # mw ${loadaddr} 0xcafecafe 0x10
SOCFPGA_AGILEX5 # md ${loadaddr} 0x10
82000000: cafecafe cafecafe cafecafe cafecafe  ................
82000010: cafecafe cafecafe cafecafe cafecafe  ................
82000020: cafecafe cafecafe cafecafe cafecafe  ................
82000030: cafecafe cafecafe cafecafe cafecafe  ................
# Triger a Cold reset
SOCFPGA_AGILEX5 # reset
resetting ...
Issuing cold reset REBOOT_HPS

<reboot occurs here>

U-Boot SPL 2023.10-31805-g69d5338be0-dirty (May 22 2024 - 14:26:16 -0500)
Reset state: Cold
:
Hit any key to stop autoboot:  0 
# Reading back the preserved data 
SOCFPGA_AGILEX5 # md ${loadaddr} 0x10
82000000: cafecafe cafecafe cafecafe cafecafe  ................
82000010: cafecafe cafecafe cafecafe cafecafe  ................
82000020: cafecafe cafecafe cafecafe cafecafe  ................
82000030: cafecafe cafecafe cafecafe cafecafe  ................

In the Agilex™ 5 device, the flow to process the reset command to trigger a warm or cold reset issued from U-Boot, and also the reboot command from Linux, is done requesting this reset to the SDM though the SMC handler in the Arm Trusted Firmware (ATF). The SMC handler process the reset request from U-Boot and Linux, performs some operations like flushing the cache memories (under certain conditions), and finally forwards the reset request to SDM using the REBOOT_HPS command through the SDM mailbox. This flow is shown in the following figure.

In the Agilex™ 5 device, the process for handling the reset command to trigger a warm or cold reset from U-Boot, as well as the reboot command from Linux, involves requesting the reset from the SDM through the SMC handler in the Arm Trusted Firmware (ATF). The SMC handler processes the reset request from U-Boot and Linux, performs operations such as flushing the cache memories (under certain conditions), and finally forwards the reset request to the SDM using the REBOOT_HPS command through the SDM mailbox. This flow is illustrated in the following figure.

Figure 36. Reset Command Triggers a Warm or Cold Reset Flow