zephyr/boards/arc/nsim/arc_mpu_regions.c
Kumar Gala e7332f924b soc: arc: Use new dts macros in linker scripts and arc_mpu_regions
Convert linker scripts and arc_mpu_regions.c setup to use new
devicetree.h macros to extract the base address and size of the various
memory regions (DDR, SRAM, FLASH, DCCM, ICCM).  We also remove the
scaling up and down since DT_REG_SIZE() returns the value in bytes.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 13:29:48 -05:00

50 lines
1.2 KiB
C

/*
* Copyright (c) 2017 Synopsys
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <devicetree.h>
#include <soc.h>
#include <arch/arc/v2/mpu/arc_mpu.h>
#include <linker/linker-defs.h>
/*
* for secure firmware, MPU entries are only set up for secure world.
* All regions not listed here are shared by secure world and normal world.
*/
static struct arc_mpu_region mpu_regions[] = {
#if DT_REG_SIZE(DT_INST(0, arc_iccm)) > 0
/* Region ICCM */
MPU_REGION_ENTRY("ICCM",
DT_REG_ADDR(DT_INST(0, arc_iccm)),
DT_REG_SIZE(DT_INST(0, arc_iccm)),
REGION_ROM_ATTR),
#endif
#if DT_REG_SIZE(DT_INST(0, arc_dccm)) > 0
/* Region DCCM */
MPU_REGION_ENTRY("DCCM",
DT_REG_ADDR(DT_INST(0, arc_dccm)),
DT_REG_SIZE(DT_INST(0, arc_dccm)),
REGION_KERNEL_RAM_ATTR | REGION_DYNAMIC),
#endif
/*
* Region peripheral is shared by secure world and normal world by default,
* no need a static mpu entry. If some peripherals belong to secure world,
* add it here.
*/
#ifndef CONFIG_ARC_SECURE_FIRMWARE
/* Region Peripheral */
MPU_REGION_ENTRY("PERIPHERAL",
0xF0000000,
64 * 1024,
REGION_KERNEL_RAM_ATTR),
#endif
};
struct arc_mpu_config mpu_config = {
.num_regions = ARRAY_SIZE(mpu_regions),
.mpu_regions = mpu_regions,
};