diff options
author | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2013-11-28 14:55:58 +0000 |
---|---|---|
committer | Dan Handley <dan.handley@arm.com> | 2013-12-12 16:06:48 +0000 |
commit | ee12f6f7497882fdcc8acc7774c516739296799e (patch) | |
tree | 249e6ef6b93045864d616ee8db1294563ebf783c /bl2/bl2_main.c | |
parent | dc98e5370ac81965ebcc322a279b8aad51258d9a (diff) |
Remove useless copies of meminfo structures
Platform setup code has to reserve some memory for storing the
memory layout information. It is populated in early platform setup
code.
blx_get_sec_mem_layout() functions used to return a copy of this
structure. This patch modifies blx_get_sec_mem_layout() functions
so that they now directly return a pointer to their memory layout
structure. It ensures that the memory layout returned by
blx_get_sec_mem_layout() is always up-to-date and also avoids a
useless copy of the meminfo structure.
Also rename blx_get_sec_mem_layout() to blx_plat_sec_mem_layout()
to make it clear those functions are platform specific.
Change-Id: Ic7a6f9d6b6236b14865ab48a9f5eff545ce56551
Diffstat (limited to 'bl2/bl2_main.c')
-rw-r--r-- | bl2/bl2_main.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bl2/bl2_main.c b/bl2/bl2_main.c index c738677c..2d976fc7 100644 --- a/bl2/bl2_main.c +++ b/bl2/bl2_main.c @@ -46,7 +46,8 @@ ******************************************************************************/ void bl2_main(void) { - meminfo bl2_tzram_layout, *bl31_tzram_layout; + meminfo *bl2_tzram_layout; + meminfo *bl31_tzram_layout; el_change_info *ns_image_info; unsigned long bl31_base, el_status; unsigned int bl2_load, bl31_load, mode; @@ -62,7 +63,7 @@ void bl2_main(void) #endif /* Find out how much free trusted ram remains after BL2 load */ - bl2_tzram_layout = bl2_get_sec_mem_layout(); + bl2_tzram_layout = bl2_plat_sec_mem_layout(); /* * Load BL31. BL1 tells BL2 whether it has been TOP or BOTTOM loaded. @@ -70,10 +71,10 @@ void bl2_main(void) * loaded opposite to BL2. This allows BL31 to reclaim BL2 memory * while maintaining its free space in one contiguous chunk. */ - bl2_load = bl2_tzram_layout.attr & LOAD_MASK; + bl2_load = bl2_tzram_layout->attr & LOAD_MASK; assert((bl2_load == TOP_LOAD) || (bl2_load == BOT_LOAD)); bl31_load = (bl2_load == TOP_LOAD) ? BOT_LOAD : TOP_LOAD; - bl31_base = load_image(&bl2_tzram_layout, BL31_IMAGE_NAME, + bl31_base = load_image(bl2_tzram_layout, BL31_IMAGE_NAME, bl31_load, BL31_BASE); /* Assert if it has not been possible to load BL31 */ @@ -84,7 +85,7 @@ void bl2_main(void) * will gobble up all the BL2 memory. */ bl31_tzram_layout = (meminfo *) get_el_change_mem_ptr(); - init_bl31_mem_layout(&bl2_tzram_layout, bl31_tzram_layout, bl31_load); + init_bl31_mem_layout(bl2_tzram_layout, bl31_tzram_layout, bl31_load); /* * BL2 also needs to tell BL31 where the non-trusted software image |