Visible to Intel only — GUID: yzu1725045675797
Ixiasoft
Visible to Intel only — GUID: yzu1725045675797
Ixiasoft
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_soc64.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). After it reaches 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_AGILEX7 # mw ${loadaddr} 0xcafecafe 0x10 SOCFPGA_AGILEX7 # md ${loadaddr} 10 02000000: cafecafe cafecafe cafecafe cafecafe ................ 02000010: cafecafe cafecafe cafecafe cafecafe ................ 02000020: cafecafe cafecafe cafecafe cafecafe ................ 02000030: cafecafe cafecafe cafecafe cafecafe ................ # Triger a Warm Reset SOCFPGA_AGILEX7 # setenv reset warm SOCFPGA_AGILEX7 # reset resetting ... Do warm reset now... <reboot occurs here> U-Boot SPL 2023.07-rc6 (Nov 20 2023 - 08:40:20 +0000) Reset state: Warm (Triggered by MPU 0) : Hit any key to stop autoboot: 0 # Reading back the preserved data SOCFPGA_AGILEX7 # md ${loadaddr} 10 02000000: cafecafe cafecafe cafecafe cafecafe ................ 02000010: cafecafe cafecafe cafecafe cafecafe ................ 02000020: cafecafe cafecafe cafecafe cafecafe ................ 02000030: 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_AGILEX7 # mw ${loadaddr} 0xcafecafe 0x10 # Flushing Cach memory SOCFPGA_AGILEX7 # dcache flush SOCFPGA_AGILEX7 # md ${loadaddr} 0x10 02000000: cafecafe cafecafe cafecafe cafecafe ................ 02000010: cafecafe cafecafe cafecafe cafecafe ................ 02000020: cafecafe cafecafe cafecafe cafecafe ................ 02000030: cafecafe cafecafe cafecafe cafecafe ................ # Trigger a Cold reset SOCFPGA_AGILEX7 # reset resetting ... Mailbox: Issuing mailbox cmd REBOOT_HPS <reboot occurs here> U-Boot SPL 2023.07-rc6 (Nov 20 2023 - 08:40:20 +0000) Reset state: Cold : Hit any key to stop autoboot: 0 # Reading back the preserved data SOCFPGA_AGILEX7 # md ${loadaddr} 0x10 02000000: cafecafe cafecafe cafecafe cafecafe ................ 02000010: cafecafe cafecafe cafecafe cafecafe ................ 02000020: cafecafe cafecafe cafecafe cafecafe ................ 02000030: cafecafe cafecafe cafecafe cafecafe ................