1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2021 - 2022, Xilinx, Inc.
4 * Copyright (C) 2022, Advanced Micro Devices, Inc.
10 #include <asm/armv8/mmu.h>
11 #include <asm/cache.h>
12 #include <asm/global_data.h>
14 #include <asm/arch/hardware.h>
15 #include <asm/arch/sys_proto.h>
16 #include <asm/cache.h>
17 #include <dm/platdata.h>
19 DECLARE_GLOBAL_DATA_PTR;
21 #define VERSAL_NET_MEM_MAP_USED 5
23 #define DRAM_BANKS CONFIG_NR_DRAM_BANKS
25 /* +1 is end of list which needs to be empty */
26 #define VERSAL_NET_MEM_MAP_MAX (VERSAL_NET_MEM_MAP_USED + DRAM_BANKS + 1)
28 static struct mm_region versal_mem_map[VERSAL_NET_MEM_MAP_MAX] = {
33 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
35 PTE_BLOCK_PXN | PTE_BLOCK_UXN
40 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
42 PTE_BLOCK_PXN | PTE_BLOCK_UXN
44 .virt = 0x400000000UL,
45 .phys = 0x400000000UL,
46 .size = 0x200000000UL,
47 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
49 PTE_BLOCK_PXN | PTE_BLOCK_UXN
51 .virt = 0x600000000UL,
52 .phys = 0x600000000UL,
53 .size = 0x800000000UL,
54 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
57 .virt = 0xe00000000UL,
58 .phys = 0xe00000000UL,
59 .size = 0xf200000000UL,
60 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
62 PTE_BLOCK_PXN | PTE_BLOCK_UXN
66 void mem_map_fill(void)
68 int banks = VERSAL_NET_MEM_MAP_USED;
70 for (int i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
71 /* Zero size means no more DDR that's this is end */
72 if (!gd->bd->bi_dram[i].size)
75 versal_mem_map[banks].virt = gd->bd->bi_dram[i].start;
76 versal_mem_map[banks].phys = gd->bd->bi_dram[i].start;
77 versal_mem_map[banks].size = gd->bd->bi_dram[i].size;
78 versal_mem_map[banks].attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
79 PTE_BLOCK_INNER_SHARE;
84 struct mm_region *mem_map = versal_mem_map;
86 u64 get_page_table_size(void)
91 U_BOOT_DRVINFO(soc_xilinx_versal_net) = {
92 .name = "soc_xilinx_versal_net",