e820.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * (C) Copyright 2015 Miao Yan <yanmiaobest@gmail.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <asm/e820.h>
  8. unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
  9. {
  10. entries[0].addr = 0;
  11. entries[0].size = ISA_START_ADDRESS;
  12. entries[0].type = E820_RAM;
  13. entries[1].addr = ISA_START_ADDRESS;
  14. entries[1].size = ISA_END_ADDRESS - ISA_START_ADDRESS;
  15. entries[1].type = E820_RESERVED;
  16. /*
  17. * since we use memalign(malloc) to allocate high memory for
  18. * storing ACPI tables, we need to reserve them in e820 tables,
  19. * otherwise kernel will reclaim them and data will be corrupted
  20. */
  21. entries[2].addr = ISA_END_ADDRESS;
  22. entries[2].size = gd->relocaddr - TOTAL_MALLOC_LEN - ISA_END_ADDRESS;
  23. entries[2].type = E820_RAM;
  24. /* for simplicity, reserve entire malloc space */
  25. entries[3].addr = gd->relocaddr - TOTAL_MALLOC_LEN;
  26. entries[3].size = TOTAL_MALLOC_LEN;
  27. entries[3].type = E820_RESERVED;
  28. entries[4].addr = gd->relocaddr;
  29. entries[4].size = gd->ram_size - gd->relocaddr;
  30. entries[4].type = E820_RESERVED;
  31. entries[5].addr = CONFIG_PCIE_ECAM_BASE;
  32. entries[5].size = CONFIG_PCIE_ECAM_SIZE;
  33. entries[5].type = E820_RESERVED;
  34. return 6;
  35. }