"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

common/memsize.c: Fix get_ram_size() original data restore

The get_ram_size() function fails to restore the original RAM data when
the data cache is enabled. This issue was observed on an AM625 R5 SPL
with 512MB of RAM and is a regression that became visible with
commit bc07851897bd ("board: ti: Pull redundant DDR functions to a common
location and Fixup DDR size when ECC is enabled").

Observed boot failure messages:
Warning: Did not detect image signing certificate. Skipping authentication to prevent boot failure. This will fail on Security Enforcing(HS-SE) devices
Authentication passed
Starting ATF on ARM64 core...

The system then hangs. This indicates that without a data cache flush,
data in the cache is not coherent with RAM, preventing the system from
booting. This was verified by printing the content of this address when
the issue occurs.

Add a data cache flush after each restore operation to resolve this
issue.

Fixes: bc07851897bd ("board: ti: Pull redundant DDR functions to a common location and Fixup DDR size when ECC is enabled")
Fixes: 1c64b98c1ec4 ("common/memsize.c: Fix get_ram_size() when cache is enabled")
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Reviewed-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Tested-by: Francesco Dolcini <francesco.dolcini@toradex.com> # Toradex Verdin AM62

authored by

Stefan Eichenberger and committed by
Tom Rini
8d24789a e6e7b242

+8
+8
common/memsize.c
··· 85 85 addr = base + cnt; 86 86 sync(); 87 87 *addr = save[--i]; 88 + if (dcache_en) 89 + dcache_flush_invalidate(addr); 88 90 } 89 91 return (0); 90 92 } ··· 93 95 addr = base + cnt; /* pointer arith! */ 94 96 val = *addr; 95 97 *addr = save[--i]; 98 + if (dcache_en) 99 + dcache_flush_invalidate(addr); 96 100 if (val != ~cnt) { 97 101 size = cnt * sizeof(long); 98 102 /* ··· 104 108 cnt <<= 1) { 105 109 addr = base + cnt; 106 110 *addr = save[--i]; 111 + if (dcache_en) 112 + dcache_flush_invalidate(addr); 107 113 } 108 114 /* warning: don't restore save_base in this case, 109 115 * it is already done in the loop because ··· 115 121 } 116 122 } 117 123 *base = save_base; 124 + if (dcache_en) 125 + dcache_flush_invalidate(base); 118 126 119 127 return (maxsize); 120 128 }