diff options
author | Madhukar Pappireddy <madhukar.pappireddy@arm.com> | 2022-01-13 23:10:48 +0100 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2022-01-13 23:10:48 +0100 |
commit | 97c911478718ac6e789b3a863970ed80e18be9e5 (patch) | |
tree | 42dca2acc5f72ad92bb9ad470e6d00220ba3d71e | |
parent | 1f4adc3a34f80249d40bfc7033a65f4217d7ee04 (diff) | |
parent | d958d10eb360024e15f3c921dc3863a0cee98830 (diff) |
Merge changes from topic "st_mapping_update" into integration
* changes:
feat(stm32mp1): enable BL2_IN_XIP_MEM to remove relocation sections
refactor(stm32mp1): reduce MMU memory regions and split XLAT by context
feat(st): map 2MB for ROM code
fix(stm32mp1): restrict DEVICE2 mapping in BL2
-rw-r--r-- | plat/st/common/stm32mp_auth.c | 10 | ||||
-rw-r--r-- | plat/st/stm32mp1/include/platform_def.h | 9 | ||||
-rw-r--r-- | plat/st/stm32mp1/platform.mk | 1 | ||||
-rw-r--r-- | plat/st/stm32mp1/stm32mp1.ld.S | 6 | ||||
-rw-r--r-- | plat/st/stm32mp1/stm32mp1_def.h | 17 | ||||
-rw-r--r-- | plat/st/stm32mp1/stm32mp1_fip_def.h | 18 | ||||
-rw-r--r-- | plat/st/stm32mp1/stm32mp1_private.c | 4 |
7 files changed, 50 insertions, 15 deletions
diff --git a/plat/st/common/stm32mp_auth.c b/plat/st/common/stm32mp_auth.c index 0ef6d54548..744201cd16 100644 --- a/plat/st/common/stm32mp_auth.c +++ b/plat/st/common/stm32mp_auth.c @@ -1,13 +1,11 @@ /* - * Copyright (c) 2019, STMicroelectronics - All Rights Reserved + * Copyright (c) 2019-2022, STMicroelectronics - All Rights Reserved * * SPDX-License-Identifier: BSD-3-Clause */ #include <errno.h> -#include <platform_def.h> - #include <common/debug.h> #include <drivers/io/io_storage.h> #include <drivers/st/bsec.h> @@ -15,6 +13,8 @@ #include <lib/xlat_tables/xlat_tables_v2.h> #include <plat/common/platform.h> +#include <platform_def.h> + static const struct stm32mp_auth_ops *auth_ops; void stm32mp_init_auth(struct stm32mp_auth_ops *init_ptr) @@ -47,7 +47,7 @@ int stm32mp_auth_image(boot_api_image_header_t *header, uintptr_t buffer) } ret = mmap_add_dynamic_region(STM32MP_ROM_BASE, STM32MP_ROM_BASE, - STM32MP_ROM_SIZE, MT_CODE | MT_SECURE); + STM32MP_ROM_SIZE_2MB_ALIGNED, MT_CODE | MT_SECURE); if (ret != 0) { return ret; } @@ -85,6 +85,6 @@ int stm32mp_auth_image(boot_api_image_header_t *header, uintptr_t buffer) } err: - mmap_remove_dynamic_region(STM32MP_ROM_BASE, STM32MP_ROM_SIZE); + mmap_remove_dynamic_region(STM32MP_ROM_BASE, STM32MP_ROM_SIZE_2MB_ALIGNED); return ret; } diff --git a/plat/st/stm32mp1/include/platform_def.h b/plat/st/stm32mp1/include/platform_def.h index 1e9443ece5..511a0e25c3 100644 --- a/plat/st/stm32mp1/include/platform_def.h +++ b/plat/st/stm32mp1/include/platform_def.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -68,6 +68,13 @@ #define BL2_LIMIT (STM32MP_BL2_BASE + \ STM32MP_BL2_SIZE) +#define BL2_RO_BASE STM32MP_BL2_RO_BASE +#define BL2_RO_LIMIT (STM32MP_BL2_RO_BASE + \ + STM32MP_BL2_RO_SIZE) + +#define BL2_RW_BASE STM32MP_BL2_RW_BASE +#define BL2_RW_LIMIT (STM32MP_BL2_RW_BASE + \ + STM32MP_BL2_RW_SIZE) /******************************************************************************* * BL32 specific defines. ******************************************************************************/ diff --git a/plat/st/stm32mp1/platform.mk b/plat/st/stm32mp1/platform.mk index a24a5b06c8..13dea2a740 100644 --- a/plat/st/stm32mp1/platform.mk +++ b/plat/st/stm32mp1/platform.mk @@ -16,6 +16,7 @@ STM32MP_USE_STM32IMAGE ?= 0 ifneq ($(STM32MP_USE_STM32IMAGE),1) ENABLE_PIE := 1 +BL2_IN_XIP_MEM := 1 endif STM32_TF_VERSION ?= 0 diff --git a/plat/st/stm32mp1/stm32mp1.ld.S b/plat/st/stm32mp1/stm32mp1.ld.S index 945de99e59..23716acc63 100644 --- a/plat/st/stm32mp1/stm32mp1.ld.S +++ b/plat/st/stm32mp1/stm32mp1.ld.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -57,7 +57,11 @@ SECTIONS * The strongest and only alignment contraint is MMU 4K page. * Indeed as images below will be removed, 4K pages will be re-used. */ +#if SEPARATE_CODE_AND_RODATA + . = ( STM32MP_BL2_RO_BASE - STM32MP_BINARY_BASE ); +#else . = ( STM32MP_BL2_BASE - STM32MP_BINARY_BASE ); +#endif __BL2_IMAGE_START__ = .; *(.bl2_image*) __BL2_IMAGE_END__ = .; diff --git a/plat/st/stm32mp1/stm32mp1_def.h b/plat/st/stm32mp1/stm32mp1_def.h index 95274696b2..291342e13d 100644 --- a/plat/st/stm32mp1/stm32mp1_def.h +++ b/plat/st/stm32mp1/stm32mp1_def.h @@ -68,6 +68,7 @@ ******************************************************************************/ #define STM32MP_ROM_BASE U(0x00000000) #define STM32MP_ROM_SIZE U(0x00020000) +#define STM32MP_ROM_SIZE_2MB_ALIGNED U(0x00200000) #define STM32MP_SYSRAM_BASE U(0x2FFC0000) #define STM32MP_SYSRAM_SIZE U(0x00040000) @@ -110,15 +111,25 @@ enum ddr_type { (STM32MP_PARAM_LOAD_SIZE + \ STM32MP_HEADER_SIZE)) -/* BL2 and BL32/sp_min require 4 tables */ -#define MAX_XLAT_TABLES U(4) /* 16 KB for mapping */ +/* BL2 and BL32/sp_min require finer granularity tables */ +#if defined(IMAGE_BL2) +#define MAX_XLAT_TABLES U(2) /* 8 KB for mapping */ +#endif + +#if defined(IMAGE_BL32) +#define MAX_XLAT_TABLES U(4) /* 16 KB for mapping */ +#endif /* * MAX_MMAP_REGIONS is usually: * BL stm32mp1_mmap size + mmap regions in *_plat_arch_setup */ #if defined(IMAGE_BL2) - #define MAX_MMAP_REGIONS 11 + #if STM32MP_USB_PROGRAMMER + #define MAX_MMAP_REGIONS 8 + #else + #define MAX_MMAP_REGIONS 7 + #endif #endif #define STM32MP_BL33_BASE (STM32MP_DDR_BASE + U(0x100000)) diff --git a/plat/st/stm32mp1/stm32mp1_fip_def.h b/plat/st/stm32mp1/stm32mp1_fip_def.h index d8561dcc03..41972e4f83 100644 --- a/plat/st/stm32mp1/stm32mp1_fip_def.h +++ b/plat/st/stm32mp1/stm32mp1_fip_def.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021, STMicroelectronics - All Rights Reserved + * Copyright (C) 2021-2022, STMicroelectronics - All Rights Reserved * * SPDX-License-Identifier: BSD-3-Clause */ @@ -10,9 +10,10 @@ #define STM32MP_DDR_S_SIZE U(0x01E00000) /* 30 MB */ #define STM32MP_DDR_SHMEM_SIZE U(0x00200000) /* 2 MB */ -#define STM32MP_BL2_SIZE U(0x0001B000) /* 108 KB for BL2 */ -#define STM32MP_BL2_DTB_SIZE U(0x00006000) /* 24 KB for DTB */ -#define STM32MP_BL32_SIZE U(0x00019000) /* 100 KB for BL32 */ +#define STM32MP_BL2_RO_SIZE U(0x00011000) /* 68 KB */ +#define STM32MP_BL2_SIZE U(0x00016000) /* 88 KB for BL2 */ +#define STM32MP_BL2_DTB_SIZE U(0x00007000) /* 28 KB for DTB */ +#define STM32MP_BL32_SIZE U(0x0001B000) /* 108 KB for BL32 */ #define STM32MP_BL32_DTB_SIZE U(0x00005000) /* 20 KB for DTB */ #define STM32MP_FW_CONFIG_MAX_SIZE PAGE_SIZE /* 4 KB for FCONF DTB */ #define STM32MP_HW_CONFIG_MAX_SIZE U(0x40000) /* 256 KB for HW config DTB */ @@ -21,6 +22,15 @@ STM32MP_SEC_SYSRAM_SIZE - \ STM32MP_BL2_SIZE) +#define STM32MP_BL2_RO_BASE STM32MP_BL2_BASE + +#define STM32MP_BL2_RW_BASE (STM32MP_BL2_RO_BASE + \ + STM32MP_BL2_RO_SIZE) + +#define STM32MP_BL2_RW_SIZE (STM32MP_SEC_SYSRAM_BASE + \ + STM32MP_SEC_SYSRAM_SIZE - \ + STM32MP_BL2_RW_BASE) + #define STM32MP_BL2_DTB_BASE (STM32MP_BL2_BASE - \ STM32MP_BL2_DTB_SIZE) diff --git a/plat/st/stm32mp1/stm32mp1_private.c b/plat/st/stm32mp1/stm32mp1_private.c index e58528e910..0bed12a27d 100644 --- a/plat/st/stm32mp1/stm32mp1_private.c +++ b/plat/st/stm32mp1/stm32mp1_private.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -82,7 +82,9 @@ static const mmap_region_t stm32mp1_mmap[] = { MAP_SEC_SYSRAM, MAP_DEVICE1, +#if STM32MP_RAW_NAND MAP_DEVICE2, +#endif {0} }; #endif |