[RFC PATCH 3/4] efi: Add efi_memmap_needed()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function efi_memmap_needed() is used to determine when to use the
EFI memory map during boot instead of a BIOS provided e820.

The intent is to determine whether we are booted on an EFI system from
the EFI boot stub (came in through efi_main(), implemented by checking
efi_is_native() and the boot loader identifier), and that there is no
e820 map already provided.

Signed-off-by: Linn Crosetto <linn@xxxxxx>
---
 arch/x86/platform/efi/efi.c | 7 +++++++
 include/linux/efi.h         | 1 +
 2 files changed, 8 insertions(+)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index c2a660c..af32a21 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -719,6 +719,13 @@ char * __init efi_memory_setup(void)
 	return who;
 }
 
+int __init efi_memmap_needed(void)
+{
+	return efi_is_native() &&
+	       boot_params.e820_entries == 0 &&
+	       boot_params.hdr.type_of_loader >> 4 == 2; /* bootsect-loader */
+}
+
 void __init efi_init(void)
 {
 	efi_char16_t *c16;
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 977bbc7..95b2251 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -567,6 +567,7 @@ efi_guid_unparse(efi_guid_t *guid, char *out)
         return out;
 }
 
+extern int efi_memmap_needed(void);
 extern char *efi_memory_setup(void);
 extern void efi_init (void);
 extern void *efi_get_pal_addr (void);
-- 
1.7.11.3

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux