]> git.ipfire.org Git - thirdparty/u-boot.git/blame - arch/x86/cpu/qemu/e820.c
SPDX: Convert all of our single license tags to Linux Kernel style
[thirdparty/u-boot.git] / arch / x86 / cpu / qemu / e820.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
dd6f3abb
TR
2/*
3 * (C) Copyright 2015 Miao Yan <yanmiaobest@gmail.com>
dd6f3abb
TR
4 */
5
6#include <common.h>
dd6f3abb 7#include <asm/e820.h>
dd6f3abb 8
45ffa122
BM
9DECLARE_GLOBAL_DATA_PTR;
10
87af71c2 11unsigned int install_e820_map(unsigned int max_entries,
45519924 12 struct e820_entry *entries)
dd6f3abb
TR
13{
14 entries[0].addr = 0;
15 entries[0].size = ISA_START_ADDRESS;
16 entries[0].type = E820_RAM;
17
18 entries[1].addr = ISA_START_ADDRESS;
19 entries[1].size = ISA_END_ADDRESS - ISA_START_ADDRESS;
20 entries[1].type = E820_RESERVED;
21
22 /*
23 * since we use memalign(malloc) to allocate high memory for
24 * storing ACPI tables, we need to reserve them in e820 tables,
25 * otherwise kernel will reclaim them and data will be corrupted
26 */
27 entries[2].addr = ISA_END_ADDRESS;
28 entries[2].size = gd->relocaddr - TOTAL_MALLOC_LEN - ISA_END_ADDRESS;
29 entries[2].type = E820_RAM;
30
31 /* for simplicity, reserve entire malloc space */
32 entries[3].addr = gd->relocaddr - TOTAL_MALLOC_LEN;
33 entries[3].size = TOTAL_MALLOC_LEN;
34 entries[3].type = E820_RESERVED;
35
36 entries[4].addr = gd->relocaddr;
37 entries[4].size = gd->ram_size - gd->relocaddr;
38 entries[4].type = E820_RESERVED;
39
40 entries[5].addr = CONFIG_PCIE_ECAM_BASE;
41 entries[5].size = CONFIG_PCIE_ECAM_SIZE;
42 entries[5].type = E820_RESERVED;
43
44 return 6;
45}