public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2 v2] efilinux: set ext_ramdisk_* for huge initrd
@ 2014-06-25 21:24 Yinghai Lu
       [not found] ` <1403731467-1527-1-git-send-email-yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Yinghai Lu @ 2014-06-25 21:24 UTC (permalink / raw)
  To: Matt Fleming, H. Peter Anvin
  Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Yinghai Lu

We could load it high if it is more than 2G when kernel support
LOAD_ABOVE_4G.

-v2: Use macro instead of (1<<1) directly for LOAD_ABOVE_4G.

Signed-off-by: Yinghai Lu <yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

---
 loaders/bzimage/bzimage.c |    9 ++++++++-
 loaders/bzimage/bzimage.h |   15 +++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)

Index: efilinux/loaders/bzimage/bzimage.c
===================================================================
--- efilinux.orig/loaders/bzimage/bzimage.c
+++ efilinux/loaders/bzimage/bzimage.c
@@ -130,7 +130,9 @@ static void parse_initrd(EFI_LOADED_IMAG
 	if (err != EFI_SUCCESS)
 		goto close_handles;
 
-	if ((UINTN)addr > boot_params->hdr.ramdisk_max) {
+	if ((boot_params->hdr.version < 0x20c ||
+	     !(boot_params->hdr.xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G)) &&
+	    (UINTN)addr > boot_params->hdr.ramdisk_max) {
 		Print(L"ramdisk address is too high!\n");
 		efree(addr, size);
 		goto close_handles;
@@ -138,6 +140,11 @@ static void parse_initrd(EFI_LOADED_IMAG
 
 	boot_params->hdr.ramdisk_start = (UINT32)(UINTN)addr;
 	boot_params->hdr.ramdisk_len = (UINT32)size;
+	if (boot_params->hdr.version >= 0x20c &&
+	    (boot_params->hdr.xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G)) {
+		boot_params->ext_ramdisk_image = (UINT64)(UINTN)addr >> 32;
+		boot_params->ext_ramdisk_size = size >> 32;
+	}
 
 	for (j = 0; j < nr_initrds; j++) {
 		struct initrd *rd = &initrds[j];
Index: efilinux/loaders/bzimage/bzimage.h
===================================================================
--- efilinux.orig/loaders/bzimage/bzimage.h
+++ efilinux/loaders/bzimage/bzimage.h
@@ -40,6 +40,13 @@
 #define E820_NVS		4
 #define E820_UNUSABLE		5
 
+/* xloadflags */
+#define XLF_KERNEL_64                   (1<<0)
+#define XLF_CAN_BE_LOADED_ABOVE_4G      (1<<1)
+#define XLF_EFI_HANDOVER_32             (1<<2)
+#define XLF_EFI_HANDOVER_64             (1<<3)
+#define XLF_EFI_KEXEC                   (1<<4)
+
 struct setup_header {
 	UINT8 setup_secs;	/* Sectors for setup code */
 	UINT16 root_flags;
@@ -69,7 +76,8 @@ struct setup_header {
 	UINT32 ramdisk_max;    /* Highest legal initrd address */
 	UINT32 kernel_alignment; /* Physical addr alignment required for kernel */
 	UINT8 relocatable_kernel; /* Whether kernel is relocatable or not */
-	UINT8 _pad2[3];
+	UINT8 min_alignment;
+	UINT16 xloadflags;
 	UINT32 cmdline_size;
 	UINT32 hardware_subarch;
 	UINT64 hardware_subarch_data;
@@ -148,7 +156,10 @@ struct boot_params {
 	UINT8 hd1_info[16];
 	UINT8 sys_desc_table[0x10];
 	UINT8 olpc_ofw_header[0x10];
-	UINT8 _pad4[128];
+	UINT32 ext_ramdisk_image;
+	UINT32 ext_ramdisk_size;
+	UINT32 ext_cmd_line_ptr;
+	UINT8 _pad4[116];
 	UINT8 edid_info[0x80];
 	struct efi_info efi_info;
 	UINT32 alt_mem_k;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2 v2] efilinux: set ext_ramdisk_* for huge initrd
       [not found] ` <1403731467-1527-1-git-send-email-yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2014-06-27  6:24   ` Matt Fleming
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Fleming @ 2014-06-27  6:24 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Matt Fleming, H. Peter Anvin, linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, 25 Jun, at 02:24:27PM, Yinghai Lu wrote:
> We could load it high if it is more than 2G when kernel support
> LOAD_ABOVE_4G.
> 
> -v2: Use macro instead of (1<<1) directly for LOAD_ABOVE_4G.
> 
> Signed-off-by: Yinghai Lu <yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> 
> ---
>  loaders/bzimage/bzimage.c |    9 ++++++++-
>  loaders/bzimage/bzimage.h |   15 +++++++++++++--
>  2 files changed, 21 insertions(+), 3 deletions(-)

Applied, thanks!

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-27  6:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25 21:24 [PATCH 2/2 v2] efilinux: set ext_ramdisk_* for huge initrd Yinghai Lu
     [not found] ` <1403731467-1527-1-git-send-email-yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-06-27  6:24   ` Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox