diff options
author | Richard Gong <richard.gong@intel.com> | 2020-11-17 09:00:45 -0600 |
---|---|---|
committer | Gan, Yau Wai <yau.wai.gan@intel.com> | 2020-11-20 20:51:55 -0800 |
commit | 186b49ccfbc370bf9b40e985bf41aa60fdc786e9 (patch) | |
tree | 8894cd1e565d6048cb77de8e92683ecd395999e3 | |
parent | fa53128b37fb7651ef7875eb7e53ba25ac972346 (diff) | |
download | u-boot-socfpga-186b49ccfbc370bf9b40e985bf41aa60fdc786e9.tar.gz |
HSD #1508450224: rsu: block access to CPB while SPTs were corrupted
Accessing CPB depends on the valid SPT. When both SPTs were corrupted, the
user need run RSU restore_spt command to restore the valid SPTs and then
user can access CPB.
Signed-off-by: Richard Gong <richard.gong@intel.com>
-rw-r--r-- | arch/arm/mach-socfpga/rsu_ll_qspi.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm/mach-socfpga/rsu_ll_qspi.c b/arch/arm/mach-socfpga/rsu_ll_qspi.c index 79888a836c..e1855a9222 100644 --- a/arch/arm/mach-socfpga/rsu_ll_qspi.c +++ b/arch/arm/mach-socfpga/rsu_ll_qspi.c @@ -1091,6 +1091,12 @@ static int empty_cpb(void) u32 image_ptr_slots; } *c_header; + if (spt_corrupted) { + rsu_log(RSU_ERR, "corrupted SPT ---"); + rsu_log(RSU_ERR, "run rsu restore_spt <address> first\n"); + return -EINVAL; + } + c_header = (struct cpb_header *)malloc(sizeof(struct cpb_header)); if (!c_header) { rsu_log(RSU_ERR, "failed to allocate cpb_header\n"); @@ -1135,6 +1141,12 @@ static int restore_cpb_from_address(u64 address) u32 magic_number; char *cpb_data = (char *)address; + if (spt_corrupted) { + rsu_log(RSU_ERR, "corrupted SPT --"); + rsu_log(RSU_ERR, "run rsu restore_spt <address> first\n"); + return -EINVAL; + } + if (!cpb_data) { rsu_log(RSU_ERR, "failed due to invalid address\n"); return -EINVAL; |