xref: /rk3399_ARM-atf/plat/arm/board/corstone1000/common/corstone1000_plat.c (revision bbca58ffd3bedf8ae86856d1250e0e8b3aaa593f)
1 /*
2  * Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <assert.h>
8 
9 #include <common/bl_common.h>
10 
11 #include <drivers/generic_delay_timer.h>
12 #include <drivers/io/io_storage.h>
13 #include <plat/common/platform.h>
14 #include <plat/arm/common/arm_fconf_getter.h>
15 #include <plat/arm/common/arm_fconf_io_storage.h>
16 #include <plat/arm/common/plat_arm.h>
17 #include <platform_def.h>
18 
19 /*
20  * Table of regions to map using the MMU.
21  * Replace or extend the below regions as required
22  */
23 
24 const mmap_region_t plat_arm_mmap[] = {
25 	ARM_MAP_SHARED_RAM,
26 	ARM_MAP_NS_DRAM1,
27 	CORSTONE1000_MAP_DEVICE,
28 	CORSTONE1000_EXTERNAL_FLASH,
29 	{0}
30 };
31 
set_fip_image_source(void)32 static void set_fip_image_source(void)
33 {
34 	const struct plat_io_policy *policy;
35 	policy = FCONF_GET_PROPERTY(arm, io_policies, FIP_IMAGE_ID);
36 
37 	assert(policy != NULL);
38 	assert(policy->image_spec != 0UL);
39 
40 	/* FIP Partition contains Signature area at the beginning which TF-A doesn't expect */
41 	io_block_spec_t *spec = (io_block_spec_t *)policy->image_spec;
42 	spec->offset += FIP_SIGNATURE_AREA_SIZE;
43 	spec->length -= FIP_SIGNATURE_AREA_SIZE;
44 
45 }
46 
bl2_platform_setup(void)47 void bl2_platform_setup(void)
48 {
49 	arm_bl2_platform_setup();
50 	/*
51 	 * Identify the start address of the FIP by reading the boot
52 	 * index flag from the flash.
53 	 */
54 	set_fip_image_source();
55 }
56 
57 /* corstone1000 only has one always-on power domain and there
58  * is no power control present
59  */
plat_arm_pwrc_setup(void)60 void __init plat_arm_pwrc_setup(void)
61 {
62 }
63 
plat_get_syscnt_freq2(void)64 unsigned int plat_get_syscnt_freq2(void)
65 {
66 	/* Returning the Generic Timer Frequency */
67 	return SYS_COUNTER_FREQ_IN_TICKS;
68 }
69 
70 
71 /*
72  * Helper function to initialize ARM interconnect driver.
73  */
plat_arm_interconnect_init(void)74 void plat_arm_interconnect_init(void)
75 {
76 }
77 
78 /*
79  * Helper function to place current master into coherency
80  */
plat_arm_interconnect_enter_coherency(void)81 void plat_arm_interconnect_enter_coherency(void)
82 {
83 }
84 
85 /*
86  * Helper function to remove current master from coherency
87  */
plat_arm_interconnect_exit_coherency(void)88 void plat_arm_interconnect_exit_coherency(void)
89 {
90 }
91 
92 /*
93  * This function is invoked during Mbed TLS library initialisation to get a heap
94  * The function simply returns the default allocated heap.
95  */
96 
97 #if TRUSTED_BOARD_BOOT
plat_get_mbedtls_heap(void ** heap_addr,size_t * heap_size)98 int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size)
99 {
100 	assert(heap_addr != NULL);
101 	assert(heap_size != NULL);
102 
103 	return arm_get_mbedtls_heap(heap_addr, heap_size);
104 }
105 #endif
106