[PATCH] efi_limit_regions triggers link failure when CONFIG_EFI is not defined

Andy Whitcroft
2006-11-24T17:00:16Z

The following patch is needed to get 2.6.19-rc6-mm1 to compile with
CONFIG_EFI disabled. This is the 'shortest' fix. However, it does
appear that there is some overlap with EFI implmentation partly
being in e820.c and partly in efi.c. It might make sense to move
everything efi related over to efi.c.

-apw

=== 8< ===
efi_limit_regions triggers link failure when CONFIG_EFI is not defined

The changes in the patch x86_64-mm-i386-efi-memmap extracted
the guts of limit_regions out into a new efi_limit_regions().
This exposes this code to the compiler uncondionally, previously
it was under an if (efi_enabled) which allowed it to be optimised
away without comment. This leads to link errors looking for an
undefined memmap. Make the routine body conditional on CONFIG_EFI.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
index 6f3fda4..393b87a 100644
--- a/arch/i386/kernel/e820.c
+++ b/arch/i386/kernel/e820.c
@@ -743,6 +743,7 @@ void __init print_memory_map(char *who)

static __init void efi_limit_regions(unsigned long long size)
{
+#ifdef CONFIG_EFI
unsigned long long current_addr = 0;
efi_memory_desc_t *md, *next_md;
void *p, *p1;
@@ -779,6 +780,7 @@ static __init void efi_limit_regions(uns
memmap.nr_map = j;
memmap.map_end = memmap.map +
(memmap.nr_map * memmap.desc_size);
+#endif /* CONFIG_EFI */
}

void __init limit_regions(unsigned long long size)