1 /* 2 * Copyright (c) 2021 Synopsys 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <devicetree.h> 8 #include <soc.h> 9 #include <arch/arc/v2/mpu/arc_mpu.h> 10 #include <linker/linker-defs.h> 11 12 /* 13 * for secure firmware, MPU entries are only set up for secure world. 14 * All regions not listed here are shared by secure world and normal world. 15 */ 16 static struct arc_mpu_region mpu_regions[] = { 17 18 #if defined(CONFIG_COVERAGE_GCOV) && defined(CONFIG_USERSPACE) 19 /* Region Coverage */ 20 MPU_REGION_ENTRY("COVERAGE", 21 (uint32_t)&(__gcov_bss_start), 22 (uint32_t)&__gcov_bss_size, 23 REGION_IO_ATTR), 24 #endif /* CONFIG_COVERAGE_GCOV && CONFIG_USERSPACE */ 25 26 #if DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) > 0 27 /* Region RAM */ 28 MPU_REGION_ENTRY("RAM", 29 DT_REG_ADDR(DT_CHOSEN(zephyr_sram)), 30 DT_REG_SIZE(DT_CHOSEN(zephyr_sram)), 31 REGION_KERNEL_RAM_ATTR | REGION_DYNAMIC), 32 #endif 33 34 #if DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) > 0 35 /* Region DCCM */ 36 MPU_REGION_ENTRY("FLASH", 37 DT_REG_ADDR(DT_CHOSEN(zephyr_flash)), 38 DT_REG_SIZE(DT_CHOSEN(zephyr_flash)), 39 REGION_ROM_ATTR), 40 #endif 41 42 /* 43 * Region peripheral is shared by secure world and normal world by default, 44 * no need a static mpu entry. If some peripherals belong to secure world, 45 * add it here. 46 */ 47 #ifndef CONFIG_ARC_SECURE_FIRMWARE 48 /* Region Peripheral */ 49 MPU_REGION_ENTRY("PERIPHERAL", 50 0xF0000000, 51 64 * 1024, 52 REGION_KERNEL_RAM_ATTR), 53 #endif 54 }; 55 56 struct arc_mpu_config mpu_config = { 57 .num_regions = ARRAY_SIZE(mpu_regions), 58 .mpu_regions = mpu_regions, 59 }; 60