x86: add kconfig CONFIG_X86_MEMMAP

This adds a new kconfig to enable the use of memory map.
This map can be populated automatically if
CONFIG_MULTIBOOT_MEMMAP=y or can be manually defined
via x86_memmap[].

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-02-09 13:42:46 -08:00 committed by Anas Nashif
commit 9a189da03b
3 changed files with 16 additions and 1 deletions

View file

@ -239,8 +239,19 @@ config X86_PC_COMPATIBLE
Hidden option to signal building for PC-compatible platforms
with BIOS, ACPI, etc.
config X86_MEMMAP
bool "Use memory map"
select ARCH_HAS_RESERVED_PAGE_FRAMES
help
Enable the use of memory map to identify regions of memory.
The memory map can be populated via Multiboot
(CONFIG_MULTIBOOT=y and CONFIG_MULTIBOOT_MEMMAP=y) or
can be manually defined via x86_memmap[].
config X86_MEMMAP_ENTRIES
int "Number of memory map entries"
depends on X86_MEMMAP
range 1 256
default 1 if !MULTIBOOT_MEMMAP
default 64 if MULTIBOOT_MEMMAP
@ -270,6 +281,7 @@ config MULTIBOOT_INFO
config MULTIBOOT_MEMMAP
bool "Use multiboot memory map if provided"
select MULTIBOOT_INFO
select X86_MEMMAP
help
Use the multiboot memory map if the loader provides one.

View file

@ -9,11 +9,12 @@ if (CONFIG_COVERAGE)
endif ()
zephyr_library_sources(cpuhalt.c)
zephyr_library_sources(memmap.c)
zephyr_library_sources(prep_c.c)
zephyr_library_sources(fatal.c)
zephyr_library_sources(spec_ctrl.c)
zephyr_library_sources_ifdef(CONFIG_X86_MEMMAP memmap.c)
zephyr_library_sources_ifdef(CONFIG_PCIE pcie.c)
zephyr_library_sources_ifdef(CONFIG_REBOOT_RST_CNT reboot_rst_cnt.c)
zephyr_library_sources_ifdef(CONFIG_MULTIBOOT multiboot.c)

View file

@ -1737,6 +1737,7 @@ void arch_reserved_pages_update(void)
mark_addr_page_reserved(0, MB(1));
#endif /* CONFIG_X86_PC_COMPATIBLE */
#ifdef CONFIG_X86_MEMMAP
for (int i = 0; i < CONFIG_X86_MEMMAP_ENTRIES; i++) {
struct x86_memmap_entry *entry = &x86_memmap[i];
@ -1758,6 +1759,7 @@ void arch_reserved_pages_update(void)
mark_addr_page_reserved(entry->base, entry->length);
}
#endif /* CONFIG_X86_MEMMAP */
}
#endif /* CONFIG_ARCH_HAS_RESERVED_PAGE_FRAMES */