4cf1cc57355d83fc1f95d80f2ad1077da3346e08
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
7 #include <arch_helpers.h>
12 #if TRUSTED_BOARD_BOOT
13 #include <mbedtls_config.h>
16 #include <xlat_tables_compat.h>
19 * The following platform functions are weakly defined. The Platforms
20 * may redefine with strong definition.
22 #pragma weak bl2_el3_plat_prepare_exit
23 #pragma weak plat_error_handler
24 #pragma weak bl2_plat_preload_setup
25 #pragma weak bl2_plat_handle_pre_image_load
26 #pragma weak bl2_plat_handle_post_image_load
27 #pragma weak plat_try_next_boot_source
28 #pragma weak plat_get_mbedtls_heap
30 void bl2_el3_plat_prepare_exit(void)
34 void __dead2
plat_error_handler(int err
)
40 void bl2_plat_preload_setup(void)
44 int bl2_plat_handle_pre_image_load(unsigned int image_id
)
49 int bl2_plat_handle_post_image_load(unsigned int image_id
)
54 int plat_try_next_boot_source(void)
59 #if TRUSTED_BOARD_BOOT
61 * The following default implementation of the function simply returns the
62 * by-default allocated heap.
64 int plat_get_mbedtls_heap(void **heap_addr
, size_t *heap_size
)
66 static unsigned char heap
[TF_MBEDTLS_HEAP_SIZE
];
68 assert(heap_addr
!= NULL
);
69 assert(heap_size
!= NULL
);
72 *heap_size
= sizeof(heap
);
75 #endif /* TRUSTED_BOARD_BOOT */
78 * Set up the page tables for the generic and platform-specific memory regions.
79 * The size of the Trusted SRAM seen by the BL image must be specified as well
80 * as an array specifying the generic memory regions which can be;
82 * - Read-only data section;
83 * - Init code section, if applicable
84 * - Coherent memory region, if applicable.
87 void __init
setup_page_tables(const mmap_region_t
*bl_regions
,
88 const mmap_region_t
*plat_regions
)
90 #if LOG_LEVEL >= LOG_LEVEL_VERBOSE
91 const mmap_region_t
*regions
= bl_regions
;
93 while (regions
->size
!= 0U) {
94 VERBOSE("Region: 0x%lx - 0x%lx has attributes 0x%x\n",
96 regions
->base_va
+ regions
->size
,
102 * Map the Trusted SRAM with appropriate memory attributes.
103 * Subsequent mappings will adjust the attributes for specific regions.
105 mmap_add(bl_regions
);
107 /* Now (re-)map the platform-specific memory regions */
108 mmap_add(plat_regions
);
110 /* Create the page tables to reflect the above mappings */