Intel® Agilex™ Hard Processor System Remote System Update User Guide

ID 683184
Date 7/13/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

7.4.5.4. Corrupted Sub-Partition Table

This example uses U-Boot commands to demonstrate how sub-partition table corruptions can be detected and recovered.
Note: The commands listed in this example assume the initial flash image (JIC) was written to flash, with no other changes.
  1. Power up the board, boot up to the U-Boot prompt and query the RSU status:
    SOCFPGA # rsu status_log
    Current Image   : 0x01000000
    Last Fail Image : 0x00000000
    State           : 0x00000000
    Version         : 0x00000202
    Error location  : 0x00000000
    Error details   : 0x00000000
    Retry counter   : 0x00000000

    The highest priority image is running, and there are no errors.

  2. Corrupt SPT0 file by erasing the flash at its location:
    SOCFPGA # sf probe 
    SF: Detected mt25qu02g with page size 256 Bytes, erase size 4 KiB, total 256 MiB
    SOCFPGA # sf erase 0x0910000 0x1000
    SF: 4096 bytes @ 0x910000 Erased: OK
  3. Power cycle the board, stop to U-Boot prompt and query RSU status:
    SOCFPGA # rsu status_log
    SF: Detected mt25qu02g with page size 256 Bytes, erase size 4 KiB, total 256 MiB
    Bad SPT0 magic number 0xFFFFFFFF
    Restoring SPT0
    Current Image   : 0x01000000
    Last Fail Image : 0x00000000
    State           : 0x00000000
    Version         : 0x00000202
    Error location  : 0x00000000
    Error details   : 0x00000000
    Retry counter   : 0x00000000

    The decision firmware loads the higest priority image, and it does not look at the SPTs. The rsu_init function is called when the first RSU U-Boot command is executed, it detects that the SPT0 is corrupted, and it recovers it from SPT1.

  4. Save the currently used SPT to a file for backup purposes:
    SOCFPGA # rsu save_spt ${loadaddr}
    4100 bytes SPT data saved
    SOCFPGA # fatwrite mmc 0:1 ${loadaddr} spt-backup.bin ${filesize}
    4100 bytes written
  5. Corrupt both SPTs by erasing the flash at their locations:
    SOCFPGA # sf probe
    SF: Detected mt25qu02g with page size 256 Bytes, erase size 4 KiB, total 256 MiB
    SOCFPGA # sf erase 0x910000 0x1000
    SF: 4096 bytes @ 0x910000 Erased: OK
    SOCFPGA # sf erase 0x918000 0x1000
    SF: 4096 bytes @ 0x918000 Erased: OK
  6. Power cycle the board, stop to U-Boot prompt and query RSU status:
    SOCFPGA # rsu status_log
    Bad SPT1 magic number 0xFFFFFFFF
    Bad SPT0 magic number 0xFFFFFFFF
    no valid SPT0 and SPT1 found
    Current Image   : 0x01000000
    Last Fail Image : 0x00000000
    State           : 0x00000000
    Version         : 0x00000202
    Error location  : 0x00000000
    Error details   : 0x00000000
    Retry counter   : 0x00000000

    The decision firmware loads the higest priority image, and it does not look at the SPTs. The rsu_init function is called when the first RSU U-Boot command is executed and it detects that both SPTs are corrupted.

  7. Try to run an RSU command which requires a valid SPT - it fails:
    SOCFPGA # rsu slot_count
    corrupted SPT --run rsu restore_spt <address> first
  8. Restore the SPT from the backup copy that we have created:
    SOCFPGA # fatload mmc 0:1 ${loadaddr} spt-backup.bin
    4100 bytes read in 2 ms (2 MiB/s)
    SOCFPGA # rsu restore_spt ${loadaddr}
  9. Power cycle the board, the highest priority image loads, and all functionality is available. This power cycle is needed to cause the rsu_init function to be called in U-Boot, as it is only called once when the first RSU command is called.