Add API to return memory map on ARM platforms
Functions to configure the MMU in S-EL1 and EL3 on ARM platforms expect each platform to export its memory map in the `plat_arm_mmap` data structure. This approach does not scale well in case the memory map cannot be determined until runtime. To cater for this possibility, this patch introduces the plat_arm_get_mmap() API. It returns a reference to the `plat_arm_mmap` by default but can be overridden by a platform if required. Change-Id: Idae6ad8fdf40cdddcd8b992abc188455fa047c74
This commit is contained in:
parent
421295a017
commit
65cb1c4c28
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -37,11 +37,6 @@
|
|||
#include <stdint.h>
|
||||
#include <xlat_tables.h>
|
||||
|
||||
/*
|
||||
* Extern declarations common to ARM standard platforms
|
||||
*/
|
||||
extern const mmap_region_t plat_arm_mmap[];
|
||||
|
||||
#define ARM_CASSERT_MMAP \
|
||||
CASSERT((ARRAY_SIZE(plat_arm_mmap) + ARM_BL_REGIONS) \
|
||||
<= MAX_MMAP_REGIONS, \
|
||||
|
@ -204,6 +199,6 @@ int plat_arm_get_alt_image_source(
|
|||
uintptr_t *dev_handle,
|
||||
uintptr_t *image_spec);
|
||||
unsigned int plat_arm_calc_core_pos(u_register_t mpidr);
|
||||
|
||||
const mmap_region_t *plat_arm_get_mmap(void);
|
||||
|
||||
#endif /* __PLAT_ARM_H__ */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -35,6 +35,7 @@
|
|||
#include <platform_def.h>
|
||||
#include <xlat_tables.h>
|
||||
|
||||
extern const mmap_region_t plat_arm_mmap[];
|
||||
|
||||
static const int cci_map[] = {
|
||||
PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX,
|
||||
|
@ -43,6 +44,7 @@ static const int cci_map[] = {
|
|||
|
||||
/* Weak definitions may be overridden in specific ARM standard platform */
|
||||
#pragma weak plat_get_ns_image_entrypoint
|
||||
#pragma weak plat_arm_get_mmap
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -67,7 +69,7 @@ static const int cci_map[] = {
|
|||
mmap_add_region(coh_start, coh_start, \
|
||||
coh_limit - coh_start, \
|
||||
MT_DEVICE | MT_RW | MT_SECURE); \
|
||||
mmap_add(plat_arm_mmap); \
|
||||
mmap_add(plat_arm_get_mmap()); \
|
||||
init_xlat_tables(); \
|
||||
\
|
||||
enable_mmu_el##_el(0); \
|
||||
|
@ -85,7 +87,7 @@ static const int cci_map[] = {
|
|||
mmap_add_region(ro_start, ro_start, \
|
||||
ro_limit - ro_start, \
|
||||
MT_MEMORY | MT_RO | MT_SECURE); \
|
||||
mmap_add(plat_arm_mmap); \
|
||||
mmap_add(plat_arm_get_mmap()); \
|
||||
init_xlat_tables(); \
|
||||
\
|
||||
enable_mmu_el##_el(0); \
|
||||
|
@ -161,3 +163,11 @@ void arm_configure_sys_timer(void)
|
|||
reg_val = (1 << CNTNSAR_NS_SHIFT(PLAT_ARM_NSTIMER_FRAME_ID));
|
||||
mmio_write_32(ARM_SYS_TIMCTL_BASE + CNTNSAR, reg_val);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Returns ARM platform specific memory map regions.
|
||||
******************************************************************************/
|
||||
const mmap_region_t *plat_arm_get_mmap(void)
|
||||
{
|
||||
return plat_arm_mmap;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue