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