Deepak Pandey | 9cbacf6 | 2018-08-08 10:32:51 +0530 | [diff] [blame] | 1 | /* |
Tamas Ban | 307b3d8 | 2023-05-08 13:51:27 +0200 | [diff] [blame] | 2 | * Copyright (c) 2018-2024, Arm Limited. All rights reserved. |
Deepak Pandey | 9cbacf6 | 2018-08-08 10:32:51 +0530 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
sah01 | 6ec01e8 | 2021-06-06 14:38:01 +0530 | [diff] [blame] | 7 | #include <assert.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | |
Tamas Ban | 307b3d8 | 2023-05-08 13:51:27 +0200 | [diff] [blame] | 9 | #include <drivers/arm/css/sds.h> |
Aditya Angadi | 20b4841 | 2019-04-16 11:29:14 +0530 | [diff] [blame] | 10 | #include <drivers/arm/sbsa.h> |
Tamas Ban | 307b3d8 | 2023-05-08 13:51:27 +0200 | [diff] [blame] | 11 | #include <lib/utils_def.h> |
sah01 | 6ec01e8 | 2021-06-06 14:38:01 +0530 | [diff] [blame] | 12 | #include <plat/arm/common/plat_arm.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 13 | |
Manoj Kumar | 69bebd8 | 2019-06-21 17:07:13 +0100 | [diff] [blame] | 14 | #include "n1sdp_def.h" |
| 15 | |
Deepak Pandey | 9cbacf6 | 2018-08-08 10:32:51 +0530 | [diff] [blame] | 16 | /* |
| 17 | * Table of regions to map using the MMU. |
| 18 | * Replace or extend the below regions as required |
| 19 | */ |
| 20 | |
sah01 | 6ec01e8 | 2021-06-06 14:38:01 +0530 | [diff] [blame] | 21 | #if IMAGE_BL1 |
| 22 | const mmap_region_t plat_arm_mmap[] = { |
| 23 | ARM_MAP_SHARED_RAM, |
| 24 | N1SDP_MAP_DEVICE, |
| 25 | N1SDP_MAP_NS_SRAM, |
| 26 | ARM_MAP_DRAM1, |
| 27 | {0} |
| 28 | }; |
| 29 | #endif |
| 30 | |
| 31 | #if IMAGE_BL2 |
Deepak Pandey | 9cbacf6 | 2018-08-08 10:32:51 +0530 | [diff] [blame] | 32 | const mmap_region_t plat_arm_mmap[] = { |
| 33 | ARM_MAP_SHARED_RAM, |
| 34 | N1SDP_MAP_DEVICE, |
Manoj Kumar | 69bebd8 | 2019-06-21 17:07:13 +0100 | [diff] [blame] | 35 | N1SDP_MAP_NS_SRAM, |
| 36 | ARM_MAP_DRAM1, |
| 37 | ARM_MAP_DRAM2, |
Arvind Ram Prakash | 11b9b49 | 2022-11-22 14:41:00 -0600 | [diff] [blame] | 38 | #if TRUSTED_BOARD_BOOT && !RESET_TO_BL2 |
sah01 | 6ec01e8 | 2021-06-06 14:38:01 +0530 | [diff] [blame] | 39 | ARM_MAP_BL1_RW, |
| 40 | #endif |
| 41 | {0} |
| 42 | }; |
| 43 | #endif |
| 44 | |
| 45 | #if IMAGE_BL31 |
| 46 | const mmap_region_t plat_arm_mmap[] = { |
| 47 | ARM_MAP_SHARED_RAM, |
| 48 | N1SDP_MAP_DEVICE, |
| 49 | N1SDP_MAP_NS_SRAM, |
Manish Pandey | b68e286 | 2019-09-11 17:07:40 +0100 | [diff] [blame] | 50 | N1SDP_MAP_REMOTE_DEVICE, |
| 51 | N1SDP_MAP_REMOTE_DRAM1, |
| 52 | N1SDP_MAP_REMOTE_DRAM2, |
Deepak Pandey | 9cbacf6 | 2018-08-08 10:32:51 +0530 | [diff] [blame] | 53 | {0} |
| 54 | }; |
sah01 | 6ec01e8 | 2021-06-06 14:38:01 +0530 | [diff] [blame] | 55 | #endif |
| 56 | |
| 57 | #if TRUSTED_BOARD_BOOT |
| 58 | int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size) |
| 59 | { |
| 60 | assert(heap_addr != NULL); |
| 61 | assert(heap_size != NULL); |
| 62 | |
| 63 | return arm_get_mbedtls_heap(heap_addr, heap_size); |
| 64 | } |
| 65 | #endif |
Deepak Pandey | 9cbacf6 | 2018-08-08 10:32:51 +0530 | [diff] [blame] | 66 | |
Aditya Angadi | 20b4841 | 2019-04-16 11:29:14 +0530 | [diff] [blame] | 67 | void plat_arm_secure_wdt_start(void) |
| 68 | { |
| 69 | sbsa_wdog_start(SBSA_SECURE_WDOG_BASE, SBSA_SECURE_WDOG_TIMEOUT); |
| 70 | } |
| 71 | |
| 72 | void plat_arm_secure_wdt_stop(void) |
| 73 | { |
| 74 | sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE); |
| 75 | } |
Tamas Ban | 307b3d8 | 2023-05-08 13:51:27 +0200 | [diff] [blame] | 76 | |
| 77 | #if CSS_USE_SCMI_SDS_DRIVER |
| 78 | static sds_region_desc_t n1sdp_sds_regions[] = { |
| 79 | { .base = PLAT_ARM_SDS_MEM_BASE }, |
| 80 | }; |
| 81 | |
| 82 | sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count) |
| 83 | { |
| 84 | *region_count = ARRAY_SIZE(n1sdp_sds_regions); |
| 85 | |
| 86 | return n1sdp_sds_regions; |
| 87 | } |
| 88 | #endif /* CSS_USE_SCMI_SDS_DRIVER */ |