summaryrefslogtreecommitdiff
path: root/arch/arm/include
diff options
context:
space:
mode:
authorAnshul Dalal <[email protected]>2025-10-17 18:45:27 +0530
committerTom Rini <[email protected]>2025-10-22 12:05:52 -0600
commitfe2647f2a0d4e4df5d47fdf068aeb2a1edd3d533 (patch)
treeb4295c11924d5987ae1ba835fe8f31b7b789c6e4 /arch/arm/include
parent9ebdbbc43e5fb5841d85ec7ebcb1dbf07f4c87b0 (diff)
arm: armv8: mmu: add mem_map_from_dram_banks
For armv8, U-Boot uses a static map defined as 'mem_map' for configuring the MMU as part of mmu_setup. But since the exact configuration of memory banks might not be known at build time, many platforms such as imx9, versal2 etc. utilize gd->bd->bi_dram to configure the static map at runtime. Therefore this patch adds a new API mem_map_from_dram_banks that modifies the static map in a similar way. Allowing the caller to map all dram banks by just passing the index to last entry in their mem_map and it's length. Reviewed-by: Dhruva Gole <[email protected]> Signed-off-by: Anshul Dalal <[email protected]> Tested-by: Wadim Egorov <[email protected]>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/armv8/mmu.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
index 3807c702fb6..6e7a3366844 100644
--- a/arch/arm/include/asm/armv8/mmu.h
+++ b/arch/arm/include/asm/armv8/mmu.h
@@ -194,8 +194,19 @@ struct mm_region {
u64 attrs;
};
+/* Used as the memory map for MMU configuration by mmu_setup */
extern struct mm_region *mem_map;
void setup_pgtables(void);
+
+/**
+ * mem_map_from_dram_banks() - Populate mem_map with entries corresponding to
+ * dram banks as per the gd. This should be called prior to mmu_setup.
+ *
+ * @index: The entry in mem_map to start the over-write
+ * @len: The size of mem_map
+ */
+int mem_map_from_dram_banks(unsigned int index, unsigned int len, u64 attrs);
+
u64 get_tcr(u64 *pips, u64 *pva_bits);
/**