2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2016-05-06 14:40:22 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2015 Miao Yan <yanmiaobest@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/e820.h>
|
|
|
|
|
2017-01-18 11:32:51 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2018-04-12 05:02:10 +00:00
|
|
|
unsigned int install_e820_map(unsigned int max_entries,
|
2018-04-12 05:02:11 +00:00
|
|
|
struct e820_entry *entries)
|
2016-05-06 14:40:22 +00:00
|
|
|
{
|
|
|
|
entries[0].addr = 0;
|
|
|
|
entries[0].size = ISA_START_ADDRESS;
|
|
|
|
entries[0].type = E820_RAM;
|
|
|
|
|
|
|
|
entries[1].addr = ISA_START_ADDRESS;
|
|
|
|
entries[1].size = ISA_END_ADDRESS - ISA_START_ADDRESS;
|
|
|
|
entries[1].type = E820_RESERVED;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* since we use memalign(malloc) to allocate high memory for
|
|
|
|
* storing ACPI tables, we need to reserve them in e820 tables,
|
|
|
|
* otherwise kernel will reclaim them and data will be corrupted
|
|
|
|
*/
|
|
|
|
entries[2].addr = ISA_END_ADDRESS;
|
|
|
|
entries[2].size = gd->relocaddr - TOTAL_MALLOC_LEN - ISA_END_ADDRESS;
|
|
|
|
entries[2].type = E820_RAM;
|
|
|
|
|
|
|
|
/* for simplicity, reserve entire malloc space */
|
|
|
|
entries[3].addr = gd->relocaddr - TOTAL_MALLOC_LEN;
|
|
|
|
entries[3].size = TOTAL_MALLOC_LEN;
|
|
|
|
entries[3].type = E820_RESERVED;
|
|
|
|
|
|
|
|
entries[4].addr = gd->relocaddr;
|
|
|
|
entries[4].size = gd->ram_size - gd->relocaddr;
|
|
|
|
entries[4].type = E820_RESERVED;
|
|
|
|
|
|
|
|
entries[5].addr = CONFIG_PCIE_ECAM_BASE;
|
|
|
|
entries[5].size = CONFIG_PCIE_ECAM_SIZE;
|
|
|
|
entries[5].type = E820_RESERVED;
|
|
|
|
|
|
|
|
return 6;
|
|
|
|
}
|