180d37c28SDeepak Pandey /*
2*0f37ae13STamas Ban * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
380d37c28SDeepak Pandey *
480d37c28SDeepak Pandey * SPDX-License-Identifier: BSD-3-Clause
580d37c28SDeepak Pandey */
680d37c28SDeepak Pandey
7fe2b37f6Ssah01 #include <assert.h>
880d37c28SDeepak Pandey
9*0f37ae13STamas Ban #include <drivers/arm/css/sds.h>
10b0c97dafSAditya Angadi #include <drivers/arm/sbsa.h>
11*0f37ae13STamas Ban #include <lib/utils_def.h>
12fe2b37f6Ssah01 #include <plat/arm/common/plat_arm.h>
1309d40e0eSAntonio Nino Diaz
14de8bc83eSManoj Kumar #include "n1sdp_def.h"
15de8bc83eSManoj Kumar
1680d37c28SDeepak Pandey /*
1780d37c28SDeepak Pandey * Table of regions to map using the MMU.
1880d37c28SDeepak Pandey * Replace or extend the below regions as required
1980d37c28SDeepak Pandey */
2080d37c28SDeepak Pandey
21fe2b37f6Ssah01 #if IMAGE_BL1
22fe2b37f6Ssah01 const mmap_region_t plat_arm_mmap[] = {
23fe2b37f6Ssah01 ARM_MAP_SHARED_RAM,
24fe2b37f6Ssah01 N1SDP_MAP_DEVICE,
25fe2b37f6Ssah01 N1SDP_MAP_NS_SRAM,
26fe2b37f6Ssah01 ARM_MAP_DRAM1,
27fe2b37f6Ssah01 {0}
28fe2b37f6Ssah01 };
29fe2b37f6Ssah01 #endif
30fe2b37f6Ssah01
31fe2b37f6Ssah01 #if IMAGE_BL2
3280d37c28SDeepak Pandey const mmap_region_t plat_arm_mmap[] = {
3380d37c28SDeepak Pandey ARM_MAP_SHARED_RAM,
3480d37c28SDeepak Pandey N1SDP_MAP_DEVICE,
35de8bc83eSManoj Kumar N1SDP_MAP_NS_SRAM,
36de8bc83eSManoj Kumar ARM_MAP_DRAM1,
37de8bc83eSManoj Kumar ARM_MAP_DRAM2,
3842d4d3baSArvind Ram Prakash #if TRUSTED_BOARD_BOOT && !RESET_TO_BL2
39fe2b37f6Ssah01 ARM_MAP_BL1_RW,
40fe2b37f6Ssah01 #endif
41fe2b37f6Ssah01 {0}
42fe2b37f6Ssah01 };
43fe2b37f6Ssah01 #endif
44fe2b37f6Ssah01
45fe2b37f6Ssah01 #if IMAGE_BL31
46fe2b37f6Ssah01 const mmap_region_t plat_arm_mmap[] = {
47fe2b37f6Ssah01 ARM_MAP_SHARED_RAM,
48fe2b37f6Ssah01 N1SDP_MAP_DEVICE,
49fe2b37f6Ssah01 N1SDP_MAP_NS_SRAM,
50f91a8e4cSManish Pandey N1SDP_MAP_REMOTE_DEVICE,
51f91a8e4cSManish Pandey N1SDP_MAP_REMOTE_DRAM1,
52f91a8e4cSManish Pandey N1SDP_MAP_REMOTE_DRAM2,
5380d37c28SDeepak Pandey {0}
5480d37c28SDeepak Pandey };
55fe2b37f6Ssah01 #endif
56fe2b37f6Ssah01
57fe2b37f6Ssah01 #if TRUSTED_BOARD_BOOT
plat_get_mbedtls_heap(void ** heap_addr,size_t * heap_size)58fe2b37f6Ssah01 int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size)
59fe2b37f6Ssah01 {
60fe2b37f6Ssah01 assert(heap_addr != NULL);
61fe2b37f6Ssah01 assert(heap_size != NULL);
62fe2b37f6Ssah01
63fe2b37f6Ssah01 return arm_get_mbedtls_heap(heap_addr, heap_size);
64fe2b37f6Ssah01 }
65fe2b37f6Ssah01 #endif
6680d37c28SDeepak Pandey
plat_arm_secure_wdt_start(void)67b0c97dafSAditya Angadi void plat_arm_secure_wdt_start(void)
68b0c97dafSAditya Angadi {
69b0c97dafSAditya Angadi sbsa_wdog_start(SBSA_SECURE_WDOG_BASE, SBSA_SECURE_WDOG_TIMEOUT);
70b0c97dafSAditya Angadi }
71b0c97dafSAditya Angadi
plat_arm_secure_wdt_stop(void)72b0c97dafSAditya Angadi void plat_arm_secure_wdt_stop(void)
73b0c97dafSAditya Angadi {
74b0c97dafSAditya Angadi sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE);
75b0c97dafSAditya Angadi }
76*0f37ae13STamas Ban
77*0f37ae13STamas Ban #if CSS_USE_SCMI_SDS_DRIVER
78*0f37ae13STamas Ban static sds_region_desc_t n1sdp_sds_regions[] = {
79*0f37ae13STamas Ban { .base = PLAT_ARM_SDS_MEM_BASE },
80*0f37ae13STamas Ban };
81*0f37ae13STamas Ban
plat_sds_get_regions(unsigned int * region_count)82*0f37ae13STamas Ban sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count)
83*0f37ae13STamas Ban {
84*0f37ae13STamas Ban *region_count = ARRAY_SIZE(n1sdp_sds_regions);
85*0f37ae13STamas Ban
86*0f37ae13STamas Ban return n1sdp_sds_regions;
87*0f37ae13STamas Ban }
88*0f37ae13STamas Ban #endif /* CSS_USE_SCMI_SDS_DRIVER */
89