[x86] Add EFI boot stub support (Closes: #669033)
svn path=/dists/sid/linux-2.6/; revision=18952
This commit is contained in:
parent
5fc7f738f4
commit
9ec2630fc6
|
@ -15,6 +15,7 @@ linux-2.6 (3.2.16-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
[ Ben Hutchings ]
|
[ Ben Hutchings ]
|
||||||
* rt2x00: Identify rt2800usb chipsets. (Closes: #658067)
|
* rt2x00: Identify rt2800usb chipsets. (Closes: #658067)
|
||||||
|
* [x86] Add EFI boot stub support (Closes: #669033)
|
||||||
|
|
||||||
-- Ben Hutchings <ben@decadent.org.uk> Mon, 16 Apr 2012 02:27:29 +0100
|
-- Ben Hutchings <ben@decadent.org.uk> Mon, 16 Apr 2012 02:27:29 +0100
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0
|
||||||
CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1
|
CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1
|
||||||
CONFIG_X86_PAT=y
|
CONFIG_X86_PAT=y
|
||||||
CONFIG_EFI=y
|
CONFIG_EFI=y
|
||||||
|
CONFIG_EFI_STUB=y
|
||||||
CONFIG_SECCOMP=y
|
CONFIG_SECCOMP=y
|
||||||
CONFIG_CC_STACKPROTECTOR=y
|
CONFIG_CC_STACKPROTECTOR=y
|
||||||
CONFIG_KEXEC=y
|
CONFIG_KEXEC=y
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
From: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Date: Sat, 27 Aug 2011 09:35:45 +0100
|
||||||
|
Subject: [PATCH 01/11] x86: Add missing bzImage fields to struct setup_header
|
||||||
|
|
||||||
|
commit 8af21e7e71d1ac56d9b66fb787a14fd66af7f5f7 upstream.
|
||||||
|
|
||||||
|
commit 37ba7ab5e33c ("x86, boot: make kernel_alignment adjustable; new
|
||||||
|
bzImage fields") introduced some new fields into the bzImage header
|
||||||
|
but struct setup_header was not updated accordingly. Add the missing
|
||||||
|
'pref_address' and 'init_size' fields.
|
||||||
|
|
||||||
|
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
arch/x86/include/asm/bootparam.h | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
|
||||||
|
index e020d88..2f90c51 100644
|
||||||
|
--- a/arch/x86/include/asm/bootparam.h
|
||||||
|
+++ b/arch/x86/include/asm/bootparam.h
|
||||||
|
@@ -64,6 +64,8 @@ struct setup_header {
|
||||||
|
__u32 payload_offset;
|
||||||
|
__u32 payload_length;
|
||||||
|
__u64 setup_data;
|
||||||
|
+ __u64 pref_address;
|
||||||
|
+ __u32 init_size;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
struct sys_desc_table {
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
From: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Date: Tue, 15 Nov 2011 12:56:14 +0000
|
||||||
|
Subject: [PATCH 02/11] x86: Don't use magic strings for EFI loader signature
|
||||||
|
|
||||||
|
commit f7d7d01be53cb47e0ae212c4e968aa28b82d2138 upstream.
|
||||||
|
|
||||||
|
Introduce a symbol, EFI_LOADER_SIGNATURE instead of using the magic
|
||||||
|
strings, which also helps to reduce the amount of ifdeffery.
|
||||||
|
|
||||||
|
Cc: Matthew Garrett <mjg@redhat.com>
|
||||||
|
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
arch/x86/include/asm/efi.h | 4 ++++
|
||||||
|
arch/x86/kernel/setup.c | 7 +------
|
||||||
|
2 files changed, 5 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
|
||||||
|
index b8d8bfc..26d8c18 100644
|
||||||
|
--- a/arch/x86/include/asm/efi.h
|
||||||
|
+++ b/arch/x86/include/asm/efi.h
|
||||||
|
@@ -3,6 +3,8 @@
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
|
|
||||||
|
+#define EFI_LOADER_SIGNATURE "EL32"
|
||||||
|
+
|
||||||
|
extern unsigned long asmlinkage efi_call_phys(void *, ...);
|
||||||
|
|
||||||
|
#define efi_call_phys0(f) efi_call_phys(f)
|
||||||
|
@@ -35,6 +37,8 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
|
||||||
|
|
||||||
|
#else /* !CONFIG_X86_32 */
|
||||||
|
|
||||||
|
+#define EFI_LOADER_SIGNATURE "EL64"
|
||||||
|
+
|
||||||
|
extern u64 efi_call0(void *fp);
|
||||||
|
extern u64 efi_call1(void *fp, u64 arg1);
|
||||||
|
extern u64 efi_call2(void *fp, u64 arg1, u64 arg2);
|
||||||
|
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
|
||||||
|
index 9a9e40f..4d5243c 100644
|
||||||
|
--- a/arch/x86/kernel/setup.c
|
||||||
|
+++ b/arch/x86/kernel/setup.c
|
||||||
|
@@ -752,12 +752,7 @@ void __init setup_arch(char **cmdline_p)
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_EFI
|
||||||
|
if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
|
||||||
|
-#ifdef CONFIG_X86_32
|
||||||
|
- "EL32",
|
||||||
|
-#else
|
||||||
|
- "EL64",
|
||||||
|
-#endif
|
||||||
|
- 4)) {
|
||||||
|
+ EFI_LOADER_SIGNATURE, 4)) {
|
||||||
|
efi_enabled = 1;
|
||||||
|
efi_memblock_x86_reserve_range();
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
From: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Date: Tue, 15 Nov 2011 12:56:32 +0000
|
||||||
|
Subject: [PATCH 03/11] efi.h: Add struct definition for boot time services
|
||||||
|
|
||||||
|
commit f30ca6ba0bb2b7d050f24682bb8639c939c79859 upstream.
|
||||||
|
|
||||||
|
With the forthcoming efi stub code we're gonna need to access boot
|
||||||
|
time services so let's define a struct so we can access the functions.
|
||||||
|
|
||||||
|
Cc: Matthew Garrett <mjg@redhat.com>
|
||||||
|
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
include/linux/efi.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||||
|
1 file changed, 52 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||||
|
index 2362a0b..9547597 100644
|
||||||
|
--- a/include/linux/efi.h
|
||||||
|
+++ b/include/linux/efi.h
|
||||||
|
@@ -139,6 +139,57 @@ typedef struct {
|
||||||
|
} efi_time_cap_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
+ * EFI Boot Services table
|
||||||
|
+ */
|
||||||
|
+typedef struct {
|
||||||
|
+ efi_table_hdr_t hdr;
|
||||||
|
+ void *raise_tpl;
|
||||||
|
+ void *restore_tpl;
|
||||||
|
+ void *allocate_pages;
|
||||||
|
+ void *free_pages;
|
||||||
|
+ void *get_memory_map;
|
||||||
|
+ void *allocate_pool;
|
||||||
|
+ void *free_pool;
|
||||||
|
+ void *create_event;
|
||||||
|
+ void *set_timer;
|
||||||
|
+ void *wait_for_event;
|
||||||
|
+ void *signal_event;
|
||||||
|
+ void *close_event;
|
||||||
|
+ void *check_event;
|
||||||
|
+ void *install_protocol_interface;
|
||||||
|
+ void *reinstall_protocol_interface;
|
||||||
|
+ void *uninstall_protocol_interface;
|
||||||
|
+ void *handle_protocol;
|
||||||
|
+ void *__reserved;
|
||||||
|
+ void *register_protocol_notify;
|
||||||
|
+ void *locate_handle;
|
||||||
|
+ void *locate_device_path;
|
||||||
|
+ void *install_configuration_table;
|
||||||
|
+ void *load_image;
|
||||||
|
+ void *start_image;
|
||||||
|
+ void *exit;
|
||||||
|
+ void *unload_image;
|
||||||
|
+ void *exit_boot_services;
|
||||||
|
+ void *get_next_monotonic_count;
|
||||||
|
+ void *stall;
|
||||||
|
+ void *set_watchdog_timer;
|
||||||
|
+ void *connect_controller;
|
||||||
|
+ void *disconnect_controller;
|
||||||
|
+ void *open_protocol;
|
||||||
|
+ void *close_protocol;
|
||||||
|
+ void *open_protocol_information;
|
||||||
|
+ void *protocols_per_handle;
|
||||||
|
+ void *locate_handle_buffer;
|
||||||
|
+ void *locate_protocol;
|
||||||
|
+ void *install_multiple_protocol_interfaces;
|
||||||
|
+ void *uninstall_multiple_protocol_interfaces;
|
||||||
|
+ void *calculate_crc32;
|
||||||
|
+ void *copy_mem;
|
||||||
|
+ void *set_mem;
|
||||||
|
+ void *create_event_ex;
|
||||||
|
+} efi_boot_services_t;
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
* Types and defines for EFI ResetSystem
|
||||||
|
*/
|
||||||
|
#define EFI_RESET_COLD 0
|
||||||
|
@@ -261,7 +312,7 @@ typedef struct {
|
||||||
|
unsigned long stderr_handle;
|
||||||
|
unsigned long stderr;
|
||||||
|
efi_runtime_services_t *runtime;
|
||||||
|
- unsigned long boottime;
|
||||||
|
+ efi_boot_services_t *boottime;
|
||||||
|
unsigned long nr_tables;
|
||||||
|
unsigned long tables;
|
||||||
|
} efi_system_table_t;
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
59
debian/patches/features/x86/efi-stub/0004-efi.h-Add-efi_image_loaded_t.patch
vendored
Normal file
59
debian/patches/features/x86/efi-stub/0004-efi.h-Add-efi_image_loaded_t.patch
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
From: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Date: Tue, 15 Nov 2011 12:56:50 +0000
|
||||||
|
Subject: [PATCH 04/11] efi.h: Add efi_image_loaded_t
|
||||||
|
|
||||||
|
commit 8e84f345e2f2189a37492c77c566c7494b7b6b23 upstream.
|
||||||
|
|
||||||
|
Add the EFI loaded image structure and protocol guid which are
|
||||||
|
required by the x86 EFI boot stub. The EFI boot stub uses the
|
||||||
|
structure to figure out where it was loaded in memory and to pass
|
||||||
|
command line arguments to the kernel.
|
||||||
|
|
||||||
|
Cc: Matthew Garrett <mjg@redhat.com>
|
||||||
|
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
include/linux/efi.h | 19 +++++++++++++++++++
|
||||||
|
1 file changed, 19 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||||
|
index 9547597..e35005f 100644
|
||||||
|
--- a/include/linux/efi.h
|
||||||
|
+++ b/include/linux/efi.h
|
||||||
|
@@ -287,6 +287,9 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
|
||||||
|
#define LINUX_EFI_CRASH_GUID \
|
||||||
|
EFI_GUID( 0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 )
|
||||||
|
|
||||||
|
+#define LOADED_IMAGE_PROTOCOL_GUID \
|
||||||
|
+ EFI_GUID( 0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
|
||||||
|
+
|
||||||
|
typedef struct {
|
||||||
|
efi_guid_t guid;
|
||||||
|
unsigned long table;
|
||||||
|
@@ -326,6 +329,22 @@ struct efi_memory_map {
|
||||||
|
unsigned long desc_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
+typedef struct {
|
||||||
|
+ u32 revision;
|
||||||
|
+ void *parent_handle;
|
||||||
|
+ efi_system_table_t *system_table;
|
||||||
|
+ void *device_handle;
|
||||||
|
+ void *file_path;
|
||||||
|
+ void *reserved;
|
||||||
|
+ u32 load_options_size;
|
||||||
|
+ void *load_options;
|
||||||
|
+ void *image_base;
|
||||||
|
+ __aligned_u64 image_size;
|
||||||
|
+ unsigned int image_code_type;
|
||||||
|
+ unsigned int image_data_type;
|
||||||
|
+ unsigned long unload;
|
||||||
|
+} efi_loaded_image_t;
|
||||||
|
+
|
||||||
|
#define EFI_INVALID_TABLE_ADDR (~0UL)
|
||||||
|
|
||||||
|
/*
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
From: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Date: Tue, 15 Nov 2011 12:57:03 +0000
|
||||||
|
Subject: [PATCH 05/11] efi.h: Add allocation types for
|
||||||
|
boottime->allocate_pages()
|
||||||
|
|
||||||
|
commit bb05e4ba452ada7966fbced4e829aa029f546445 upstream.
|
||||||
|
|
||||||
|
Add the allocation types detailed in section 6.2 - "AllocatePages()"
|
||||||
|
of the UEFI 2.3 specification. These definitions will be used by the
|
||||||
|
x86 EFI boot stub which needs to allocate memory during boot.
|
||||||
|
|
||||||
|
Cc: Matthew Garrett <mjg@redhat.com>
|
||||||
|
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
include/linux/efi.h | 8 ++++++++
|
||||||
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||||
|
index e35005f..378f2cd 100644
|
||||||
|
--- a/include/linux/efi.h
|
||||||
|
+++ b/include/linux/efi.h
|
||||||
|
@@ -109,6 +109,14 @@ typedef struct {
|
||||||
|
u32 imagesize;
|
||||||
|
} efi_capsule_header_t;
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Allocation types for calls to boottime->allocate_pages.
|
||||||
|
+ */
|
||||||
|
+#define EFI_ALLOCATE_ANY_PAGES 0
|
||||||
|
+#define EFI_ALLOCATE_MAX_ADDRESS 1
|
||||||
|
+#define EFI_ALLOCATE_ADDRESS 2
|
||||||
|
+#define EFI_MAX_ALLOCATE_TYPE 3
|
||||||
|
+
|
||||||
|
typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
|
||||||
|
|
||||||
|
/*
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
41
debian/patches/features/x86/efi-stub/0006-efi.h-Add-graphics-protocol-guids.patch
vendored
Normal file
41
debian/patches/features/x86/efi-stub/0006-efi.h-Add-graphics-protocol-guids.patch
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
From: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Date: Tue, 15 Nov 2011 12:57:16 +0000
|
||||||
|
Subject: [PATCH 06/11] efi.h: Add graphics protocol guids
|
||||||
|
|
||||||
|
commit 0f7c5d477f2ce552997831d80e2c872cca1b9054 upstream.
|
||||||
|
|
||||||
|
The x86 EFI boot stub uses the Graphics Output Protocol and Universal
|
||||||
|
Graphics Adapter (UGA) protocol guids when initialising graphics
|
||||||
|
during boot.
|
||||||
|
|
||||||
|
Cc: Matthew Garrett <mjg@redhat.com>
|
||||||
|
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
include/linux/efi.h | 9 +++++++++
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||||
|
index 378f2cd..e46d771 100644
|
||||||
|
--- a/include/linux/efi.h
|
||||||
|
+++ b/include/linux/efi.h
|
||||||
|
@@ -298,6 +298,15 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
|
||||||
|
#define LOADED_IMAGE_PROTOCOL_GUID \
|
||||||
|
EFI_GUID( 0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
|
||||||
|
|
||||||
|
+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
|
||||||
|
+ EFI_GUID( 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a )
|
||||||
|
+
|
||||||
|
+#define EFI_UGA_PROTOCOL_GUID \
|
||||||
|
+ EFI_GUID( 0x982c298b, 0xf4fa, 0x41cb, 0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 )
|
||||||
|
+
|
||||||
|
+#define EFI_PCI_IO_PROTOCOL_GUID \
|
||||||
|
+ EFI_GUID( 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a )
|
||||||
|
+
|
||||||
|
typedef struct {
|
||||||
|
efi_guid_t guid;
|
||||||
|
unsigned long table;
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
37
debian/patches/features/x86/efi-stub/0007-efi.h-Add-boottime-locate_handle-search-types.patch
vendored
Normal file
37
debian/patches/features/x86/efi-stub/0007-efi.h-Add-boottime-locate_handle-search-types.patch
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
From: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Date: Tue, 15 Nov 2011 12:57:26 +0000
|
||||||
|
Subject: [PATCH 07/11] efi.h: Add boottime->locate_handle search types
|
||||||
|
|
||||||
|
commit e2527a7cbec073b69a251193f200a88efbced7ad upstream.
|
||||||
|
|
||||||
|
The x86 EFI boot stub needs to locate handles for various protocols.
|
||||||
|
|
||||||
|
Cc: Matthew Garrett <mjg@redhat.com>
|
||||||
|
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
include/linux/efi.h | 7 +++++++
|
||||||
|
1 file changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||||
|
index e46d771..d407c88 100644
|
||||||
|
--- a/include/linux/efi.h
|
||||||
|
+++ b/include/linux/efi.h
|
||||||
|
@@ -472,6 +472,13 @@ extern int __init efi_setup_pcdp_console(char *);
|
||||||
|
#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
|
||||||
|
|
||||||
|
/*
|
||||||
|
+ * The type of search to perform when calling boottime->locate_handle
|
||||||
|
+ */
|
||||||
|
+#define EFI_LOCATE_ALL_HANDLES 0
|
||||||
|
+#define EFI_LOCATE_BY_REGISTER_NOTIFY 1
|
||||||
|
+#define EFI_LOCATE_BY_PROTOCOL 2
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
* EFI Device Path information
|
||||||
|
*/
|
||||||
|
#define EFI_DEV_HW 0x01
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
78
debian/patches/features/x86/efi-stub/0008-efi-Add-EFI-file-I-O-data-types.patch
vendored
Normal file
78
debian/patches/features/x86/efi-stub/0008-efi-Add-EFI-file-I-O-data-types.patch
vendored
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
From: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Date: Thu, 11 Aug 2011 10:28:06 +0100
|
||||||
|
Subject: [PATCH 08/11] efi: Add EFI file I/O data types
|
||||||
|
|
||||||
|
commit 55839d515495e766605d7aaabd9c2758370a8d27 upstream.
|
||||||
|
|
||||||
|
The x86 EFI stub needs to access files, for example when loading
|
||||||
|
initrd's. Add the required data types.
|
||||||
|
|
||||||
|
Cc: Matthew Garrett <mjg@redhat.com>
|
||||||
|
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Link: http://lkml.kernel.org/r/1318848017-12301-1-git-send-email-matt@console-pimps.org
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
include/linux/efi.h | 40 ++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 40 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||||
|
index d407c88..37c3007 100644
|
||||||
|
--- a/include/linux/efi.h
|
||||||
|
+++ b/include/linux/efi.h
|
||||||
|
@@ -307,6 +307,12 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
|
||||||
|
#define EFI_PCI_IO_PROTOCOL_GUID \
|
||||||
|
EFI_GUID( 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a )
|
||||||
|
|
||||||
|
+#define EFI_FILE_INFO_ID \
|
||||||
|
+ EFI_GUID( 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
|
||||||
|
+
|
||||||
|
+#define EFI_FILE_SYSTEM_GUID \
|
||||||
|
+ EFI_GUID( 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
|
||||||
|
+
|
||||||
|
typedef struct {
|
||||||
|
efi_guid_t guid;
|
||||||
|
unsigned long table;
|
||||||
|
@@ -362,6 +368,40 @@ typedef struct {
|
||||||
|
unsigned long unload;
|
||||||
|
} efi_loaded_image_t;
|
||||||
|
|
||||||
|
+typedef struct {
|
||||||
|
+ u64 revision;
|
||||||
|
+ void *open_volume;
|
||||||
|
+} efi_file_io_interface_t;
|
||||||
|
+
|
||||||
|
+typedef struct {
|
||||||
|
+ u64 size;
|
||||||
|
+ u64 file_size;
|
||||||
|
+ u64 phys_size;
|
||||||
|
+ efi_time_t create_time;
|
||||||
|
+ efi_time_t last_access_time;
|
||||||
|
+ efi_time_t modification_time;
|
||||||
|
+ __aligned_u64 attribute;
|
||||||
|
+ efi_char16_t filename[1];
|
||||||
|
+} efi_file_info_t;
|
||||||
|
+
|
||||||
|
+typedef struct {
|
||||||
|
+ u64 revision;
|
||||||
|
+ void *open;
|
||||||
|
+ void *close;
|
||||||
|
+ void *delete;
|
||||||
|
+ void *read;
|
||||||
|
+ void *write;
|
||||||
|
+ void *get_position;
|
||||||
|
+ void *set_position;
|
||||||
|
+ void *get_info;
|
||||||
|
+ void *set_info;
|
||||||
|
+ void *flush;
|
||||||
|
+} efi_file_handle_t;
|
||||||
|
+
|
||||||
|
+#define EFI_FILE_MODE_READ 0x0000000000000001
|
||||||
|
+#define EFI_FILE_MODE_WRITE 0x0000000000000002
|
||||||
|
+#define EFI_FILE_MODE_CREATE 0x8000000000000000
|
||||||
|
+
|
||||||
|
#define EFI_INVALID_TABLE_ADDR (~0UL)
|
||||||
|
|
||||||
|
/*
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
1720
debian/patches/features/x86/efi-stub/0009-x86-efi-EFI-boot-stub-support.patch
vendored
Normal file
1720
debian/patches/features/x86/efi-stub/0009-x86-efi-EFI-boot-stub-support.patch
vendored
Normal file
File diff suppressed because it is too large
Load Diff
72
debian/patches/features/x86/efi-stub/0010-x86-efi-Break-up-large-initrd-reads.patch
vendored
Normal file
72
debian/patches/features/x86/efi-stub/0010-x86-efi-Break-up-large-initrd-reads.patch
vendored
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
From: Maarten Lankhorst <m.b.lankhorst@gmail.com>
|
||||||
|
Date: Fri, 16 Dec 2011 13:30:58 +0100
|
||||||
|
Subject: [PATCH 10/11] x86, efi: Break up large initrd reads
|
||||||
|
|
||||||
|
commit 2d2da60fb40a80cc59383121ccf763e0e0e8a42a upstream.
|
||||||
|
|
||||||
|
The efi boot stub tries to read the entire initrd in 1 go, however
|
||||||
|
some efi implementations hang if too much if asked to read too much
|
||||||
|
data at the same time. After some experimentation I found out that my
|
||||||
|
asrock p67 board will hang if asked to read chunks of 4MiB, so use a
|
||||||
|
safe value.
|
||||||
|
|
||||||
|
elilo reads in chunks of 16KiB, but since that requires many read
|
||||||
|
calls I use a value of 1 MiB. hpa suggested adding individual
|
||||||
|
blacklists for when systems are found where this value causes a crash.
|
||||||
|
|
||||||
|
Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
|
||||||
|
Link: http://lkml.kernel.org/r/4EEB3A02.3090201@gmail.com
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
arch/x86/boot/compressed/eboot.c | 20 ++++++++++++++------
|
||||||
|
arch/x86/boot/compressed/eboot.h | 1 +
|
||||||
|
2 files changed, 15 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
|
||||||
|
index 4055e63..fec216f 100644
|
||||||
|
--- a/arch/x86/boot/compressed/eboot.c
|
||||||
|
+++ b/arch/x86/boot/compressed/eboot.c
|
||||||
|
@@ -643,14 +643,22 @@ grow:
|
||||||
|
u64 size;
|
||||||
|
|
||||||
|
size = initrds[j].size;
|
||||||
|
- status = efi_call_phys3(fh->read, initrds[j].handle,
|
||||||
|
- &size, addr);
|
||||||
|
- if (status != EFI_SUCCESS)
|
||||||
|
- goto free_initrd_total;
|
||||||
|
+ while (size) {
|
||||||
|
+ u64 chunksize;
|
||||||
|
+ if (size > EFI_READ_CHUNK_SIZE)
|
||||||
|
+ chunksize = EFI_READ_CHUNK_SIZE;
|
||||||
|
+ else
|
||||||
|
+ chunksize = size;
|
||||||
|
+ status = efi_call_phys3(fh->read,
|
||||||
|
+ initrds[j].handle,
|
||||||
|
+ &chunksize, addr);
|
||||||
|
+ if (status != EFI_SUCCESS)
|
||||||
|
+ goto free_initrd_total;
|
||||||
|
+ addr += chunksize;
|
||||||
|
+ size -= chunksize;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
efi_call_phys1(fh->close, initrds[j].handle);
|
||||||
|
-
|
||||||
|
- addr += size;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
|
||||||
|
index f66d023..3925166 100644
|
||||||
|
--- a/arch/x86/boot/compressed/eboot.h
|
||||||
|
+++ b/arch/x86/boot/compressed/eboot.h
|
||||||
|
@@ -12,6 +12,7 @@
|
||||||
|
#define DESC_TYPE_CODE_DATA (1 << 0)
|
||||||
|
|
||||||
|
#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)
|
||||||
|
+#define EFI_READ_CHUNK_SIZE (1024 * 1024)
|
||||||
|
|
||||||
|
#define PIXEL_RGB_RESERVED_8BIT_PER_COLOR 0
|
||||||
|
#define PIXEL_BGR_RESERVED_8BIT_PER_COLOR 1
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
From: Dan Carpenter <dan.carpenter@oracle.com>
|
||||||
|
Date: Mon, 5 Mar 2012 21:06:14 +0300
|
||||||
|
Subject: [PATCH 11/11] x86, efi: Fix pointer math issue in handle_ramdisks()
|
||||||
|
|
||||||
|
commit c7b738351ba92f48b943ac59aff6b5b0f17f37c9 upstream.
|
||||||
|
|
||||||
|
"filename" is a efi_char16_t string so this check for reaching the end
|
||||||
|
of the array doesn't work. We need to cast the pointer to (u8 *) before
|
||||||
|
doing the math.
|
||||||
|
|
||||||
|
This patch changes the "filename" to "filename_16" to avoid confusion in
|
||||||
|
the future.
|
||||||
|
|
||||||
|
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
|
||||||
|
Link: http://lkml.kernel.org/r/20120305180614.GA26880@elgon.mountain
|
||||||
|
Acked-by: Matt Fleming <matt.fleming@intel.com>
|
||||||
|
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||||
|
---
|
||||||
|
arch/x86/boot/compressed/eboot.c | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
|
||||||
|
index fec216f..0cdfc0d 100644
|
||||||
|
--- a/arch/x86/boot/compressed/eboot.c
|
||||||
|
+++ b/arch/x86/boot/compressed/eboot.c
|
||||||
|
@@ -539,7 +539,7 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
|
||||||
|
struct initrd *initrd;
|
||||||
|
efi_file_handle_t *h;
|
||||||
|
efi_file_info_t *info;
|
||||||
|
- efi_char16_t filename[256];
|
||||||
|
+ efi_char16_t filename_16[256];
|
||||||
|
unsigned long info_sz;
|
||||||
|
efi_guid_t info_guid = EFI_FILE_INFO_ID;
|
||||||
|
efi_char16_t *p;
|
||||||
|
@@ -552,14 +552,14 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
|
||||||
|
str += 7;
|
||||||
|
|
||||||
|
initrd = &initrds[i];
|
||||||
|
- p = filename;
|
||||||
|
+ p = filename_16;
|
||||||
|
|
||||||
|
/* Skip any leading slashes */
|
||||||
|
while (*str == '/' || *str == '\\')
|
||||||
|
str++;
|
||||||
|
|
||||||
|
while (*str && *str != ' ' && *str != '\n') {
|
||||||
|
- if (p >= filename + sizeof(filename))
|
||||||
|
+ if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16))
|
||||||
|
break;
|
||||||
|
|
||||||
|
*p++ = *str++;
|
||||||
|
@@ -583,7 +583,7 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
|
||||||
|
goto free_initrds;
|
||||||
|
}
|
||||||
|
|
||||||
|
- status = efi_call_phys5(fh->open, fh, &h, filename,
|
||||||
|
+ status = efi_call_phys5(fh->open, fh, &h, filename_16,
|
||||||
|
EFI_FILE_MODE_READ, (u64)0);
|
||||||
|
if (status != EFI_SUCCESS)
|
||||||
|
goto close_handles;
|
||||||
|
--
|
||||||
|
1.7.10
|
||||||
|
|
|
@ -171,3 +171,15 @@
|
||||||
+ debian/nls-Avoid-ABI-change-from-improvement-to-utf8s_to_ut.patch
|
+ debian/nls-Avoid-ABI-change-from-improvement-to-utf8s_to_ut.patch
|
||||||
|
|
||||||
+ features/all/rt2x00-Identify-rt2800usb-chipsets.patch
|
+ features/all/rt2x00-Identify-rt2800usb-chipsets.patch
|
||||||
|
|
||||||
|
+ features/x86/efi-stub/0001-x86-Add-missing-bzImage-fields-to-struct-setup_heade.patch
|
||||||
|
+ features/x86/efi-stub/0002-x86-Don-t-use-magic-strings-for-EFI-loader-signature.patch
|
||||||
|
+ features/x86/efi-stub/0003-efi.h-Add-struct-definition-for-boot-time-services.patch
|
||||||
|
+ features/x86/efi-stub/0004-efi.h-Add-efi_image_loaded_t.patch
|
||||||
|
+ features/x86/efi-stub/0005-efi.h-Add-allocation-types-for-boottime-allocate_pag.patch
|
||||||
|
+ features/x86/efi-stub/0006-efi.h-Add-graphics-protocol-guids.patch
|
||||||
|
+ features/x86/efi-stub/0007-efi.h-Add-boottime-locate_handle-search-types.patch
|
||||||
|
+ features/x86/efi-stub/0008-efi-Add-EFI-file-I-O-data-types.patch
|
||||||
|
+ features/x86/efi-stub/0009-x86-efi-EFI-boot-stub-support.patch
|
||||||
|
+ features/x86/efi-stub/0010-x86-efi-Break-up-large-initrd-reads.patch
|
||||||
|
+ features/x86/efi-stub/0011-x86-efi-Fix-pointer-math-issue-in-handle_ramdisks.patch
|
||||||
|
|
Loading…
Reference in New Issue