x86: add kconfig CONFIG_X86_PC_COMPATIBLE

This is an hidden option to indicate we are building for
PC-compatible devices (where there are BIOS, ACPI, etc.
which are standard on such devices).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-02-09 13:26:40 -08:00 committed by Anas Nashif
commit c027494dba
2 changed files with 20 additions and 7 deletions

View file

@ -215,6 +215,7 @@ endchoice
config ACPI
bool "ACPI (Advanced Configuration and Power Interface) support"
depends on X86_PC_COMPATIBLE
select ARCH_MAPS_ALL_RAM
help
Allow retrieval of platform configuration at runtime.
@ -230,6 +231,14 @@ config PCIE_MMIO_CFG
config KERNEL_VM_SIZE
default 0xC0000000 if ACPI
config X86_PC_COMPATIBLE
bool
default y
select ARCH_HAS_RESERVED_PAGE_FRAMES
help
Hidden option to signal building for PC-compatible platforms
with BIOS, ACPI, etc.
config X86_MEMMAP_ENTRIES
int "Number of memory map entries"
range 1 256
@ -240,6 +249,7 @@ config X86_MEMMAP_ENTRIES
config MULTIBOOT
bool "Generate multiboot header"
depends on X86_PC_COMPATIBLE
default y
help
Embed a multiboot header in the output executable. This is used

View file

@ -1723,16 +1723,19 @@ static void mark_addr_page_reserved(uintptr_t addr, size_t len)
}
}
/* Selected on PC-like targets at the SOC level.
*
* Best is to do some E820 or similar enumeration to specifically identify
* all page frames which are reserved by the hardware or firmware.
*
* For now, just reserve everything in the first megabyte of physical memory.
*/
void arch_reserved_pages_update(void)
{
#ifdef CONFIG_X86_PC_COMPATIBLE
/*
* Best is to do some E820 or similar enumeration to specifically
* identify all page frames which are reserved by the hardware or
* firmware. Or use x86_memmap[] with Multiboot if available.
*
* But still, reserve everything in the first megabyte of physical
* memory on PC-compatible platforms.
*/
mark_addr_page_reserved(0, MB(1));
#endif /* CONFIG_X86_PC_COMPATIBLE */
for (int i = 0; i < CONFIG_X86_MEMMAP_ENTRIES; i++) {
struct x86_memmap_entry *entry = &x86_memmap[i];