1 // SPDX-License-Identifier: GPL-2.0+
3 * QEMU x86 specific E820 table generation
5 * (C) Copyright 2015 Miao Yan <yanmiaobest@gmail.com>
6 * (C) Copyright 2019 Bin Meng <bmeng.cn@gmail.com>
10 #include <env_internal.h>
12 #include <asm/arch/qemu.h>
14 DECLARE_GLOBAL_DATA_PTR;
16 unsigned int install_e820_map(unsigned int max_entries,
17 struct e820_entry *entries)
23 entries[n].size = ISA_START_ADDRESS;
24 entries[n].type = E820_RAM;
27 entries[n].addr = ISA_START_ADDRESS;
28 entries[n].size = ISA_END_ADDRESS - ISA_START_ADDRESS;
29 entries[n].type = E820_RESERVED;
33 * since we use memalign(malloc) to allocate high memory for
34 * storing ACPI tables, we need to reserve them in e820 tables,
35 * otherwise kernel will reclaim them and data will be corrupted
37 entries[n].addr = ISA_END_ADDRESS;
38 entries[n].size = gd->relocaddr - TOTAL_MALLOC_LEN - ISA_END_ADDRESS;
39 entries[n].type = E820_RAM;
42 /* for simplicity, reserve entire malloc space */
43 entries[n].addr = gd->relocaddr - TOTAL_MALLOC_LEN;
44 entries[n].size = TOTAL_MALLOC_LEN;
45 entries[n].type = E820_RESERVED;
48 entries[n].addr = gd->relocaddr;
49 entries[n].size = qemu_get_low_memory_size() - gd->relocaddr;
50 entries[n].type = E820_RESERVED;
53 entries[n].addr = CONFIG_PCIE_ECAM_BASE;
54 entries[n].size = CONFIG_PCIE_ECAM_SIZE;
55 entries[n].type = E820_RESERVED;
58 high_mem_size = qemu_get_high_memory_size();
60 entries[n].addr = SZ_4G;
61 entries[n].size = high_mem_size;
62 entries[n].type = E820_RAM;