Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 1 | /* |
Aditya Angadi | ccae8a1 | 2021-08-09 09:38:58 +0530 | [diff] [blame] | 2 | * Copyright (c) 2020-2021, ARM Limited and Contributors. All rights reserved. |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Aditya Angadi | ccae8a1 | 2021-08-09 09:38:58 +0530 | [diff] [blame] | 7 | #include <common/debug.h> |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 8 | #include <plat/arm/common/plat_arm.h> |
| 9 | #include <platform_def.h> |
| 10 | |
Omkar Anand Kulkarni | 1f42599 | 2023-06-22 15:18:07 +0530 | [diff] [blame] | 11 | #define RDN2_TZC_CPER_REGION \ |
| 12 | {CSS_SGI_SP_CPER_BUF_BASE, (CSS_SGI_SP_CPER_BUF_BASE + \ |
| 13 | CSS_SGI_SP_CPER_BUF_SIZE) - 1, TZC_REGION_S_NONE, \ |
| 14 | PLAT_ARM_TZC_NS_DEV_ACCESS} |
| 15 | |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 16 | static const arm_tzc_regions_info_t tzc_regions[] = { |
| 17 | ARM_TZC_REGIONS_DEF, |
Manish Pandey | f90a73c | 2023-10-10 15:42:19 +0100 | [diff] [blame] | 18 | #if ENABLE_FEAT_RAS && FFH_SUPPORT |
Omkar Anand Kulkarni | 1f42599 | 2023-06-22 15:18:07 +0530 | [diff] [blame] | 19 | RDN2_TZC_CPER_REGION, |
| 20 | #endif |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 21 | {} |
| 22 | }; |
Aditya Angadi | ccae8a1 | 2021-08-09 09:38:58 +0530 | [diff] [blame] | 23 | |
| 24 | #if (CSS_SGI_PLATFORM_VARIANT == 2 && CSS_SGI_CHIP_COUNT > 1) |
| 25 | static const arm_tzc_regions_info_t tzc_regions_mc[][CSS_SGI_CHIP_COUNT - 1] = { |
| 26 | { |
| 27 | /* TZC memory regions for second chip */ |
| 28 | SGI_PLAT_TZC_NS_REMOTE_REGIONS_DEF(1), |
| 29 | {} |
| 30 | }, |
| 31 | #if CSS_SGI_CHIP_COUNT > 2 |
| 32 | { |
| 33 | /* TZC memory regions for third chip */ |
| 34 | SGI_PLAT_TZC_NS_REMOTE_REGIONS_DEF(2), |
| 35 | {} |
| 36 | }, |
| 37 | #endif |
| 38 | #if CSS_SGI_CHIP_COUNT > 3 |
| 39 | { |
| 40 | /* TZC memory regions for fourth chip */ |
| 41 | SGI_PLAT_TZC_NS_REMOTE_REGIONS_DEF(3), |
| 42 | {} |
| 43 | }, |
| 44 | #endif |
| 45 | }; |
| 46 | #endif /* CSS_SGI_PLATFORM_VARIANT && CSS_SGI_CHIP_COUNT */ |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 47 | |
| 48 | /* Initialize the secure environment */ |
| 49 | void plat_arm_security_setup(void) |
| 50 | { |
Aditya Angadi | ccae8a1 | 2021-08-09 09:38:58 +0530 | [diff] [blame] | 51 | unsigned int i; |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 52 | |
Aditya Angadi | ccae8a1 | 2021-08-09 09:38:58 +0530 | [diff] [blame] | 53 | INFO("Configuring TrustZone Controller for Chip 0\n"); |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 54 | |
Aditya Angadi | ccae8a1 | 2021-08-09 09:38:58 +0530 | [diff] [blame] | 55 | for (i = 0; i < TZC400_COUNT; i++) { |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 56 | arm_tzc400_setup(TZC400_BASE(i), tzc_regions); |
Aditya Angadi | ccae8a1 | 2021-08-09 09:38:58 +0530 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | #if (CSS_SGI_PLATFORM_VARIANT == 2 && CSS_SGI_CHIP_COUNT > 1) |
| 60 | unsigned int j; |
| 61 | |
| 62 | for (i = 1; i < CSS_SGI_CHIP_COUNT; i++) { |
| 63 | INFO("Configuring TrustZone Controller for Chip %u\n", i); |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 64 | |
Aditya Angadi | ccae8a1 | 2021-08-09 09:38:58 +0530 | [diff] [blame] | 65 | for (j = 0; j < TZC400_COUNT; j++) { |
| 66 | arm_tzc400_setup(CSS_SGI_REMOTE_CHIP_MEM_OFFSET(i) |
| 67 | + TZC400_BASE(j), tzc_regions_mc[i-1]); |
| 68 | } |
| 69 | } |
| 70 | #endif |
Aditya Angadi | d61740b | 2020-11-19 18:05:33 +0530 | [diff] [blame] | 71 | } |