This patch split EFI tables parsing code from EFI runtime service
support code. This makes ACPI support and DMI support on EFI platform
not depend on EFI runtime service support. Both EFI32 and EFI64 tables
parsing functions are provided on i386 and x86_64. This makes it
possible to use EFI information in i386 kernel on x86_64 with EFI64
firmware or in x86_64 kernel on x86_64 with EFI32 firmware.
This patch is based on 2.6.24-rc5-mm1 and has been tested for
following combinations:
i386 kernel on EFI 32
i386 kernel on EFI 64
x86_64 kernel on EFI 32
x86_64 kernel on EFI 64
ia64 kernel on EFI 64
Signed-off-by: Huang Ying <[EMAIL PROTECTED]>
---
arch/ia64/kernel/acpi.c |6 -
arch/ia64/kernel/efi.c | 30
arch/ia64/kernel/setup.c |2
arch/ia64/sn/kernel/setup.c |4 -
arch/x86/Kconfig |4 -
arch/x86/kernel/Makefile_32 |3
arch/x86/kernel/Makefile_64 |2
arch/x86/kernel/efi.c| 111 +++--
arch/x86/kernel/efi_tables.c | 144 +++
arch/x86/kernel/setup_32.c |9 ++
arch/x86/kernel/setup_64.c |9 ++
drivers/acpi/osl.c | 11 +--
drivers/firmware/dmi_scan.c |7 +-
drivers/firmware/efivars.c | 53 ---
drivers/firmware/pcdp.c |6 -
include/asm-ia64/setup.h |5 +
include/asm-ia64/sn/sn_sal.h |2
include/asm-x86/efi.h|7 ++
include/asm-x86/setup.h |9 ++
include/linux/efi.h | 64 ---
20 files changed, 331 insertions(+), 157 deletions(-)
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -212,6 +212,16 @@ typedef struct {
unsigned long table;
} efi_config_table_t;
+struct efi_config_table64 {
+ efi_guid_t guid;
+ u64 table;
+};
+
+struct efi_config_table32 {
+ efi_guid_t guid;
+ u32 table;
+};
+
#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
typedef struct {
@@ -230,6 +240,39 @@ typedef struct {
unsigned long tables;
} efi_system_table_t;
+struct efi_system_table64 {
+ efi_table_hdr_t hdr;
+ u64 fw_vendor;
+ u32 fw_revision;
+ u32 _pad1;
+ u64 con_in_handle;
+ u64 con_in;
+ u64 con_out_handle;
+ u64 con_out;
+ u64 stderr_handle;
+ u64 stderr;
+ u64 runtime;
+ u64 boottime;
+ u64 nr_tables;
+ u64 tables;
+};
+
+struct efi_system_table32 {
+ efi_table_hdr_t hdr;
+ u32 fw_vendor;
+ u32 fw_revision;
+ u32 con_in_handle;
+ u32 con_in;
+ u32 con_out_handle;
+ u32 con_out;
+ u32 stderr_handle;
+ u32 stderr;
+ u32 runtime;
+ u32 boottime;
+ u32 nr_tables;
+ u32 tables;
+};
+
struct efi_memory_map {
void *phys_map;
void *map;
@@ -246,14 +289,6 @@ struct efi_memory_map {
*/
extern struct efi {
efi_system_table_t *systab; /* EFI system table */
- unsigned long mps; /* MPS table */
- unsigned long acpi; /* ACPI table (IA64 ext 0.71) */
- unsigned long acpi20; /* ACPI table (ACPI 2.0) */
- unsigned long smbios; /* SM BIOS table */
- unsigned long sal_systab; /* SAL system table */
- unsigned long boot_info;/* boot info table */
- unsigned long hcdp; /* HCDP table */
- unsigned long uga; /* UGA table */
efi_get_time_t *get_time;
efi_set_time_t *set_time;
efi_get_wakeup_time_t *get_wakeup_time;
@@ -266,6 +301,19 @@ extern struct efi {
efi_set_virtual_address_map_t *set_virtual_address_map;
} efi;
+struct efi_tables {
+ unsigned long mps; /* MPS table */
+ unsigned long acpi; /* ACPI table (IA64 ext 0.71) */
+ unsigned long acpi20; /* ACPI table (ACPI 2.0) */
+ unsigned long smbios; /* SM BIOS table */
+ unsigned long sal_systab; /* SAL system table */
+ unsigned long boot_info;/* boot info table */
+ unsigned long hcdp; /* HCDP table */
+ unsigned long uga; /* UGA table */
+};
+
+extern struct efi_tables efi_tables;
+
static inline int
efi_guidcmp (efi_guid_t left, efi_guid_t right)
{
--- /dev/null
+++ b/arch/x86/kernel/efi_tables.c
@@ -0,0 +1,144 @@
+/*
+ * EFI tables parsing functions
+ *
+ * Copyright (C) 2007 Intel Co.
+ * Huang Ying <[EMAIL PROTECTED]>
+ *
+ * This file is released under the GPLv2.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+struct efi_tables efi_tables;
+EXPORT_SYMBOL(efi_tables);
+
+#define EFI_TABLE_PARSE(bt)\
+static void __init efi_tables_parse ## bt(void)
\
+{ \
+ struct efi_config_table ## bt *config