aboutsummaryrefslogtreecommitdiff
path: root/target/xtensa/overlay_tool.h
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2019-12-07 22:27:23 -0800
committerMax Filippov <jcmvbkbc@gmail.com>2020-01-06 11:46:16 -0800
commita153a3f73d8e028be996f1602fa99c7f3f53348c (patch)
treed93e93cab5f623126f7c71122e356d1e541ca738 /target/xtensa/overlay_tool.h
parentca3c979d6be82e88bd19ade3f6e4c9c2bc4887ea (diff)
target/xtensa: use MPU background map from core configuration
Configuration overlay may define MPU background map. Import core-matmap.h from the overlay and use XCHAL_MPU_BACKGROUND_MAP macro if it's defined. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'target/xtensa/overlay_tool.h')
-rw-r--r--target/xtensa/overlay_tool.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/target/xtensa/overlay_tool.h b/target/xtensa/overlay_tool.h
index f0cc33adfe..cab532095c 100644
--- a/target/xtensa/overlay_tool.h
+++ b/target/xtensa/overlay_tool.h
@@ -373,15 +373,28 @@
#elif XCHAL_HAVE_MPU
#ifndef XTENSA_MPU_BG_MAP
+#ifdef XCHAL_MPU_BACKGROUND_MAP
+#define XCHAL_MPU_BGMAP(s, vaddr_start, vaddr_last, rights, memtype, x...) \
+ { .vaddr = (vaddr_start), .attr = ((rights) << 8) | ((memtype) << 12), },
+
+#define XTENSA_MPU_BG_MAP (xtensa_mpu_entry []){\
+ XCHAL_MPU_BACKGROUND_MAP(0) \
+}
+
+#define XTENSA_MPU_BG_MAP_ENTRIES XCHAL_MPU_BACKGROUND_ENTRIES
+#else
#define XTENSA_MPU_BG_MAP (xtensa_mpu_entry []){\
{ .vaddr = 0, .attr = 0x00006700, }, \
}
+
+#define XTENSA_MPU_BG_MAP_ENTRIES 1
+#endif
#endif
#define TLB_SECTION \
.mpu_align = XCHAL_MPU_ALIGN, \
.n_mpu_fg_segments = XCHAL_MPU_ENTRIES, \
- .n_mpu_bg_segments = 1, \
+ .n_mpu_bg_segments = XTENSA_MPU_BG_MAP_ENTRIES, \
.mpu_bg = XTENSA_MPU_BG_MAP
#ifndef XCHAL_SYSROM0_PADDR