mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
arm: afs: Set the filesize env. var. on load
The `afs load` command copies data to RAM. Set the filesize environment variable to record how much data was 'loaded' Signed-off-by: Robert Catherall <robert.catherall@arm.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
parent
ece85cc020
commit
785834d62e
1 changed files with 10 additions and 2 deletions
|
@ -180,6 +180,7 @@ static int load_image(const char * const name, const ulong address)
|
||||||
{
|
{
|
||||||
struct afs_image *afi = NULL;
|
struct afs_image *afi = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
loff_t len_read = 0;
|
||||||
|
|
||||||
parse_flash();
|
parse_flash();
|
||||||
for (i = 0; i < num_afs_images; i++) {
|
for (i = 0; i < num_afs_images; i++) {
|
||||||
|
@ -197,6 +198,7 @@ static int load_image(const char * const name, const ulong address)
|
||||||
|
|
||||||
for (i = 0; i < afi->region_count; i++) {
|
for (i = 0; i < afi->region_count; i++) {
|
||||||
ulong from, to;
|
ulong from, to;
|
||||||
|
u32 size;
|
||||||
|
|
||||||
from = afi->flash_mem_start + afi->regions[i].offset;
|
from = afi->flash_mem_start + afi->regions[i].offset;
|
||||||
if (address) {
|
if (address) {
|
||||||
|
@ -208,14 +210,20 @@ static int load_image(const char * const name, const ulong address)
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy((void *)to, (void *)from, afi->regions[i].size);
|
size = afi->regions[i].size;
|
||||||
|
memcpy((void *)to, (void *)from, size);
|
||||||
|
|
||||||
printf("loaded region %d from %08lX to %08lX, %08X bytes\n",
|
printf("loaded region %d from %08lX to %08lX, %08X bytes\n",
|
||||||
i,
|
i,
|
||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
afi->regions[i].size);
|
size);
|
||||||
|
|
||||||
|
len_read += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
env_set_hex("filesize", len_read);
|
||||||
|
|
||||||
return CMD_RET_SUCCESS;
|
return CMD_RET_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue