diff options
author | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2014-10-15 16:56:03 +0100 |
---|---|---|
committer | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2014-10-21 10:16:44 +0100 |
commit | 2902b1ddf6101cd4c3cffc0443326bdea3bda0a6 (patch) | |
tree | 23b5dbde95529a519668c248198984d2d42f4308 /plat/common/aarch64/plat_common.c | |
parent | 99565ab9d814d9c5844fbe2a4daba74848a95cc3 (diff) |
Restructure framework's directory hierarchy
This is a first, rough attempt at cleaning the framework's directory
hierarchy.
Basically, almost everything is moved to individual directories
under lib/. What's left under framework/ are the core features of
the framework, i.e. things that test cases won't ever need.
This patch also introduces some cleanups.
The following functions are removed:
- tftf_platform_get_time()
We'll need such a function in the future to measure tests execution
time but there's no reason for it to be platform-specific, we can
use the Generic Timer instead when we get to it.
Tracked by GENFW-506.
- tftf_platform_reset()
We'll need a function to reset the platform in the future but at
the moment it is not used.
Tracked by GENFW-500.
- tftf_platform_core_whoami()
Not needed. A CPU can just call read_mpidr_el1() to get its MPID,
then platform_get_core_pos() to get the corresponding linear ID.
See GENFW-483.
- tftf_is_core_enabled()
Superseded by plat_get_aff_state().
- tftf_core_participates_in_testcase()
Superseded by the platform API to query the platform topology.
Move the following defintions out of framework/helpers.c:
- Move mp_printf() in lib/utils/mp_printf.c
- Move MMU functions into plat_common.c as default implementations
of these platform functions.
What's left in helpers.c then are helper functions to write test
results into NVM so rename the file into nvm_results_helpers.c.
Remove bl_common.h as it contains only Trusted Firmware specific
definitions.
Rename tests_api.h into tftf_lib.h. Also move some of its
declarations into new header files: irq.h, systimer.h, sgi.h.
Remove tftf_common.h and move its declarations to tftf_lib.h.
Rename rt_services/ into runtime_services/.
The test cases' directory hierarchy needs to be restructured as well,
this will come in a subsequent patch.
Change-Id: I143c4c888586301594f6b6339d6e48cbbd817570
Diffstat (limited to 'plat/common/aarch64/plat_common.c')
-rw-r--r-- | plat/common/aarch64/plat_common.c | 63 |
1 files changed, 54 insertions, 9 deletions
diff --git a/plat/common/aarch64/plat_common.c b/plat/common/aarch64/plat_common.c index 90574fd..eba3881 100644 --- a/plat/common/aarch64/plat_common.c +++ b/plat/common/aarch64/plat_common.c @@ -28,22 +28,67 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include <arch_helpers.h> +#include <debug.h> +#include <platform.h> #include <xlat_tables.h> +extern unsigned long __COHERENT_RAM_START__; +extern unsigned long __COHERENT_RAM_END__; + /* - * The following 2 platform setup functions are weakly defined. They - * provide typical implementations that may be re-used by multiple - * platforms but may also be overridden by a platform if required. + * The next 2 constants identify the extents of the coherent memory region. + * These addresses are used by the MMU setup code and therefore they must be + * page-aligned. It is the responsibility of the linker script to ensure that + * __COHERENT_RAM_START__ and __COHERENT_RAM_END__ linker symbols + * refer to page-aligned addresses. */ -#pragma weak bl31_plat_enable_mmu -#pragma weak bl32_plat_enable_mmu +#define COH_START (unsigned long)(&__COHERENT_RAM_START__) +#define COH_LIMIT (unsigned long)(&__COHERENT_RAM_END__) -void bl31_plat_enable_mmu(uint32_t flags) +/* + * The following platform functions are all weakly defined. They provide typical + * implementations that may be re-used by multiple platforms but may also be + * overridden by a platform if required. + */ + +__attribute__((weak)) void tftf_platform_end(void) { - enable_mmu_el3(flags); + /* Placeholder function which should be redefined by each platform */ +} + +__attribute__((weak)) void tftf_platform_watchdog_set(void) +{ + /* Placeholder function which should be redefined by each platform */ +} + +__attribute__((weak)) void tftf_platform_watchdog_reset(void) +{ + /* Placeholder function which should be redefined by each platform */ +} + +__attribute__((weak)) unsigned int tftf_platform_core_pos_to_mpid(unsigned int core_pos) +{ + /* Placeholder function which should be redefined by each platform */ + return 0; +} + +__attribute__((weak)) void tftf_plat_configure_mmu(void) +{ + mmap_add_region(COH_START, COH_START, COH_LIMIT - COH_START, + MT_DEVICE | MT_RW | MT_NS); + mmap_add(tftf_platform_get_mmap()); + init_xlat_tables(); + + tftf_plat_enable_mmu(); } -void bl32_plat_enable_mmu(uint32_t flags) +__attribute__((weak)) void tftf_plat_enable_mmu(void) { - enable_mmu_el1(flags); + if (IS_IN_EL1()) + enable_mmu_el1(0); + else if (IS_IN_EL2()) + enable_mmu_el2(0); + else + panic(); } |