linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linn Crosetto <linn@hp.com>
To: matt.fleming@intel.com, hpa@zytor.com, tglx@linutronix.de,
	mingo@redhat.com, x86@kernel.org, yinghai@kernel.org,
	penberg@kernel.org, jacob.shin@amd.com,
	linux-efi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Linn Crosetto <linn@hp.com>
Subject: [RFC PATCH 3/4] efi: Add efi_memmap_needed()
Date: Mon, 19 Aug 2013 14:00:18 -0600	[thread overview]
Message-ID: <1376942419-5684-4-git-send-email-linn@hp.com> (raw)
In-Reply-To: <1376942419-5684-1-git-send-email-linn@hp.com>

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@hp.com>
---
 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

  parent reply	other threads:[~2013-08-19 20:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 20:00 [RFC PATCH 0/4] EFI boot stub memory map fix Linn Crosetto
     [not found] ` <1376942419-5684-1-git-send-email-linn-VXdhtT5mjnY@public.gmane.org>
2013-08-19 20:00   ` [RFC PATCH 1/4] efi: Decouple efi_memmap_init() and do_add_efi_memmap() Linn Crosetto
2013-08-19 20:06   ` [RFC PATCH 0/4] EFI boot stub memory map fix H. Peter Anvin
     [not found]     ` <e7fc4e2f-4cda-4eef-8d37-bb87773f58e8-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
2013-08-19 20:47       ` Yinghai Lu
2013-08-19 21:09         ` Linn Crosetto
     [not found]           ` <20130819210939.GJ14273-QpTgeCMhooRo/CpIj0byZw@public.gmane.org>
2013-08-19 21:39             ` Yinghai Lu
2013-08-19 20:00 ` [RFC PATCH 2/4] efi: Add memory_setup function efi_memory_setup() Linn Crosetto
2013-08-19 20:00 ` Linn Crosetto [this message]
2013-08-19 20:00 ` [RFC PATCH 4/4] x86: Fix EFI boot stub for large memory maps Linn Crosetto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376942419-5684-4-git-send-email-linn@hp.com \
    --to=linn@hp.com \
    --cc=hpa@zytor.com \
    --cc=jacob.shin@amd.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=mingo@redhat.com \
    --cc=penberg@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).