blob: 967bb671822ef701e7c9a537476822f635506d5d [file] [log] [blame]
Igor Prusov0e3f7e92023-05-05 15:56:37 +03001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2023 SberDevices, Inc.
4 */
5
6#include <common.h>
7#include <asm/arch/a1.h>
8#include <asm/arch/boot.h>
9#include <asm/armv8/mmu.h>
10#include <asm/io.h>
11#include <linux/compiler.h>
12#include <linux/sizes.h>
13
14phys_size_t get_effective_memsize(void)
15{
16 return ((readl(A1_SYSCTRL_SEC_STATUS_REG4) & A1_SYSCTRL_MEM_SIZE_MASK)
17 >> A1_SYSCTRL_MEM_SIZE_SHIFT) * SZ_1M;
18}
19
20void meson_init_reserved_memory(__maybe_unused void *fdt)
21{
22}
23
24int meson_get_boot_device(void)
25{
26 return -ENOSYS;
27}
28
29static struct mm_region a1_mem_map[] = {
30 {
31 .virt = 0x00000000UL,
32 .phys = 0x00000000UL,
33 .size = 0x80000000UL,
34 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
35 PTE_BLOCK_INNER_SHARE
36 }, {
37 .virt = 0x80000000UL,
38 .phys = 0x80000000UL,
39 .size = 0x7FE00000UL,
40 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
41 PTE_BLOCK_NON_SHARE |
42 PTE_BLOCK_PXN | PTE_BLOCK_UXN
43 }, {
44 /*
45 * This mem region contains in/out shared memory with bl31,
46 * hence it's marked as NORMAL memory type
47 */
48 .virt = 0xFFE00000UL,
49 .phys = 0xFFE00000UL,
50 .size = 0x00200000UL,
51 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
52 PTE_BLOCK_INNER_SHARE
53 }, {
54 /* List terminator */
55 0,
56 }
57};
58
59struct mm_region *mem_map = a1_mem_map;