2018-07-07 23:21:17 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Synopsys
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <generated_dts_board.h>
|
|
|
|
#include <soc.h>
|
|
|
|
#include <arch/arc/v2/mpu/arc_mpu.h>
|
|
|
|
#include <linker/linker-defs.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_USERSPACE
|
|
|
|
static struct arc_mpu_region mpu_regions[] = {
|
2019-02-01 07:53:24 +08:00
|
|
|
#if CONFIG_ARC_MPU_VER == 3
|
2018-07-07 23:21:17 +08:00
|
|
|
/* Region ICCM */
|
|
|
|
MPU_REGION_ENTRY("IMAGE ROM",
|
|
|
|
(u32_t) _image_rom_start,
|
|
|
|
(u32_t) _image_rom_size,
|
|
|
|
REGION_FLASH_ATTR),
|
|
|
|
MPU_REGION_ENTRY("KERNEL MEMORY",
|
|
|
|
(u32_t) __kernel_ram_start,
|
|
|
|
(u32_t) __kernel_ram_size,
|
|
|
|
AUX_MPU_RDP_KW | AUX_MPU_RDP_KR),
|
|
|
|
|
|
|
|
#else
|
2018-11-13 22:15:23 +08:00
|
|
|
#if DT_ICCM_SIZE > 0
|
2018-07-07 23:21:17 +08:00
|
|
|
/* Region ICCM */
|
|
|
|
MPU_REGION_ENTRY("ICCM",
|
2018-11-13 22:15:23 +08:00
|
|
|
DT_ICCM_BASE_ADDRESS,
|
|
|
|
DT_ICCM_SIZE * 1024,
|
2018-07-07 23:21:17 +08:00
|
|
|
REGION_FLASH_ATTR),
|
|
|
|
#endif
|
2018-11-13 22:15:23 +08:00
|
|
|
#if DT_DCCM_SIZE > 0
|
2018-07-07 23:21:17 +08:00
|
|
|
/* Region DCCM */
|
|
|
|
MPU_REGION_ENTRY("DCCM",
|
2018-11-13 22:15:23 +08:00
|
|
|
DT_DCCM_BASE_ADDRESS,
|
|
|
|
DT_DCCM_SIZE * 1024,
|
2018-07-07 23:21:17 +08:00
|
|
|
AUX_MPU_RDP_KW | AUX_MPU_RDP_KR),
|
|
|
|
#endif
|
2018-07-17 14:48:39 +08:00
|
|
|
#endif /* ARC_MPU_VER == 3 */
|
2018-07-07 23:21:17 +08:00
|
|
|
/* Region Peripheral */
|
|
|
|
MPU_REGION_ENTRY("PERIPHERAL",
|
|
|
|
0xF0000000,
|
|
|
|
64 * 1024,
|
2018-07-17 14:48:39 +08:00
|
|
|
AUX_MPU_RDP_KW | AUX_MPU_RDP_KR),
|
2018-07-07 23:21:17 +08:00
|
|
|
};
|
|
|
|
#else /* CONFIG_USERSPACE */
|
|
|
|
static struct arc_mpu_region mpu_regions[] = {
|
2018-11-13 22:15:23 +08:00
|
|
|
#if DT_ICCM_SIZE > 0
|
2018-07-07 23:21:17 +08:00
|
|
|
/* Region ICCM */
|
|
|
|
MPU_REGION_ENTRY("ICCM",
|
2018-11-13 22:15:23 +08:00
|
|
|
DT_ICCM_BASE_ADDRESS,
|
|
|
|
DT_ICCM_SIZE * 1024,
|
2018-07-07 23:21:17 +08:00
|
|
|
REGION_FLASH_ATTR),
|
|
|
|
#endif
|
2018-11-13 22:15:23 +08:00
|
|
|
#if DT_DCCM_SIZE > 0
|
2018-07-07 23:21:17 +08:00
|
|
|
/* Region DCCM */
|
|
|
|
MPU_REGION_ENTRY("DCCM",
|
2018-11-13 22:15:23 +08:00
|
|
|
DT_DCCM_BASE_ADDRESS,
|
|
|
|
DT_DCCM_SIZE * 1024,
|
2018-07-07 23:21:17 +08:00
|
|
|
REGION_RAM_ATTR),
|
|
|
|
#endif
|
|
|
|
/* Region Peripheral */
|
|
|
|
MPU_REGION_ENTRY("PERIPHERAL",
|
|
|
|
0xF0000000,
|
|
|
|
64 * 1024,
|
|
|
|
REGION_IO_ATTR),
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct arc_mpu_config mpu_config = {
|
|
|
|
.num_regions = ARRAY_SIZE(mpu_regions),
|
|
|
|
.mpu_regions = mpu_regions,
|
|
|
|
};
|