mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
common/memsize.c: prepare get_ram_size update
Save the content of the base address in a new variable in stack (save_base) to prepare restore this content. This patch don't modified code behavior and stack usage. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
79717c8047
commit
c5da05cd41
1 changed files with 4 additions and 3 deletions
|
@ -27,7 +27,8 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
long get_ram_size(long *base, long maxsize)
|
long get_ram_size(long *base, long maxsize)
|
||||||
{
|
{
|
||||||
volatile long *addr;
|
volatile long *addr;
|
||||||
long save[32];
|
long save[31];
|
||||||
|
long save_base;
|
||||||
long cnt;
|
long cnt;
|
||||||
long val;
|
long val;
|
||||||
long size;
|
long size;
|
||||||
|
@ -43,7 +44,7 @@ long get_ram_size(long *base, long maxsize)
|
||||||
|
|
||||||
addr = base;
|
addr = base;
|
||||||
sync();
|
sync();
|
||||||
save[i] = *addr;
|
save_base = *addr;
|
||||||
sync();
|
sync();
|
||||||
*addr = 0;
|
*addr = 0;
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ long get_ram_size(long *base, long maxsize)
|
||||||
if ((val = *addr) != 0) {
|
if ((val = *addr) != 0) {
|
||||||
/* Restore the original data before leaving the function. */
|
/* Restore the original data before leaving the function. */
|
||||||
sync();
|
sync();
|
||||||
*addr = save[i];
|
*base = save_base;
|
||||||
for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) {
|
for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) {
|
||||||
addr = base + cnt;
|
addr = base + cnt;
|
||||||
sync();
|
sync();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue