Changelog between v2 and v3:
1. The EFI callwrapper is re-implemented in assembler.
---
This patch adds basic support for EFI x86_64 system. The main file of
the patch is the addition of efi.c for x86_64. This file is modeled
after the EFI IA32 avatar. EFI initialization are implemented in
efi.c. Some x86_64 specifics are worth noting here. On x86_64,
parameters passed to UEFI firmware services need to follow the UEFI
calling convention. For this purpose, a set of functions named
lin2win ( is the number of parameters) are implemented. EFI
function calls are wrapped before calling the firmware service.
Signed-off-by: Chandramouli Narayanan <[EMAIL PROTECTED]>
Signed-off-by: Huang Ying <[EMAIL PROTECTED]>
---
arch/x86_64/Kconfig | 13
arch/x86_64/kernel/Makefile |1
arch/x86_64/kernel/efi.c | 507 ++
arch/x86_64/kernel/efi_callwrap.S | 69 +
include/asm-x86_64/eficallwrap.h | 27 ++
include/linux/efi.h |1
6 files changed, 618 insertions(+)
Index: linux-2.6.23-rc1/include/asm-x86_64/eficallwrap.h
===
--- /dev/null 1970-01-01 00:00:00.0 +
+++ linux-2.6.23-rc1/include/asm-x86_64/eficallwrap.h 2007-07-30
15:35:48.0 +0800
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2007 Intel Corp
+ * Bibo Mao <[EMAIL PROTECTED]>
+ * Huang Ying <[EMAIL PROTECTED]>
+ *
+ * Function calling ABI conversion from SYSV to Windows for x86_64
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+extern efi_status_t lin2win0(void *fp);
+extern efi_status_t lin2win1(void *fp, u64 arg1);
+extern efi_status_t lin2win2(void *fp, u64 arg1, u64 arg2);
+extern efi_status_t lin2win3(void *fp, u64 arg1, u64 arg2, u64 arg3);
+extern efi_status_t lin2win4(void *fp, u64 arg1, u64 arg2, u64 arg3, u64 arg4);
+extern efi_status_t lin2win5(void *fp, u64 arg1, u64 arg2, u64 arg3,
+u64 arg4, u64 arg5);
+extern efi_status_t lin2win6(void *fp, u64 arg1, u64 arg2, u64 arg3,
+u64 arg4, u64 arg5, u64 arg6);
Index: linux-2.6.23-rc1/arch/x86_64/kernel/efi.c
===
--- /dev/null 1970-01-01 00:00:00.0 +
+++ linux-2.6.23-rc1/arch/x86_64/kernel/efi.c 2007-07-30 15:40:49.0
+0800
@@ -0,0 +1,507 @@
+/*
+ * Extensible Firmware Interface
+ *
+ * Based on Extensible Firmware Interface Specification version 1.0
+ *
+ * Copyright (C) 1999 VA Linux Systems
+ * Copyright (C) 1999 Walt Drummond <[EMAIL PROTECTED]>
+ * Copyright (C) 1999-2002 Hewlett-Packard Co.
+ * David Mosberger-Tang <[EMAIL PROTECTED]>
+ * Stephane Eranian <[EMAIL PROTECTED]>
+ * Copyright (C) 2005-2008 Intel Co.
+ * Fenghua Yu <[EMAIL PROTECTED]>
+ * Bibo Mao <[EMAIL PROTECTED]>
+ * Chandramouli Narayanan <[EMAIL PROTECTED]>
+ *
+ * Code to convert EFI to E820 map has been implemented in elilo bootloader
+ * based on a EFI patch by Edgar Hucek. Based on the E820 map, the page table
+ * is setup appropriately for EFI runtime code.
+ * - mouli 06/14/2007.
+ *
+ * All EFI Runtime Services are not implemented yet as EFI only
+ * supports physical mode addressing on SoftSDV. This is to be fixed
+ * in a future version. --drummond 1999-07-20
+ *
+ * Implemented EFI runtime services and virtual mode calls. --davidm
+ *
+ * Goutham Rao: <[EMAIL PROTECTED]>
+ * Skip non-WB memory and ignore empty memory ranges.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+struct efi efi;
+EXPORT_SYMBOL(efi);
+
+struct efi efi_phys __initdata;
+struct efi_memory_map memmap;
+static efi_system_table_t efi_systab __initdata;
+
+static unsigned long efi_rt_eflags;
+/* efi_rt_lock protects efi physical mode call */
+static spinlock_t efi_rt_lock = SPIN_LOCK_UNLOCKED;
+static pgd_t save_pgd;
+
+static efi_status_t _efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
+{
+ return lin2win2((void *)efi.systab->runtime->get_time,
+ (u64)tm, (u64)tc);
+}
+
+static efi_status_t _efi_set_time(efi_time_t *tm)
+{
+ return lin2win1((void *)efi.systab->runtime->set_time, (u64)tm);
+}
+
+static efi_status_t _efi_get_wakeup_time(efi_bool_t *enabled,
+