Skip to contentSkip to conversation

x86_64 EFI support -v3: EFI base support

PATCH In review Huang, Ying 2 participants 3 messages Jul 31, 2007 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 x86_64 EFI support -v3: EFI base support

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<x> (<x> is the number of parameters) are implemented. EFI function calls are wrapped before calling the firmware service.

---

 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(+)
include/asm-x86_64/eficallwrap.h new file +27 -0
Index: linux-2.6.23-rc1/include/asm-x86_64/eficallwrap.h
===================================================================
@@ -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);
arch/x86_64/kernel/efi.c new file +507 -0

507 lines not on this page · raw message

arch/x86_64/kernel/efi_callwrap.S new file +69 -0

69 lines not on this page · raw message

include/linux/efi.h +1 -0
Index: linux-2.6.23-rc1/include/linux/efi.h
===================================================================
@@ -301,6 +301,7 @@
 					struct resource *data_resource);
 extern unsigned long efi_get_time(void);
 extern int efi_set_rtc_mmss(unsigned long nowtime);
+extern void efi_emergency_restart(void);
 extern int is_available_memory(efi_memory_desc_t * md);
 extern struct efi_memory_map memmap;
 
arch/x86_64/Kconfig +13 -0
Index: linux-2.6.23-rc1/arch/x86_64/Kconfig
===================================================================
@@ -266,6 +266,19 @@
 	depends on SMP && !MK8
 	default y
 
+config EFI
+	bool "Boot from EFI support (EXPERIMENTAL)"
+	---help---
+	  This enables the the kernel to boot on EFI platforms using
+	  system configuration information passed to it from the firmware.
+	  This also enables the kernel to use any EFI runtime services that are
+	  available (such as the EFI variable services).
+	  This option is only useful on systems that have EFI firmware
+	  and will result in a kernel image that is ~8k larger. However,
+	  even with this option, the resultant kernel should continue to
+	  boot on existing non-EFI platforms. For more information on
+	  how to set up [U]EFI64 system, see Documentation/x86_64/uefi.txt.
+
 config MATH_EMULATION
 	bool
 
arch/x86_64/kernel/Makefile +1 -0
Index: linux-2.6.23-rc1/arch/x86_64/kernel/Makefile
===================================================================
@@ -38,6 +38,7 @@
 obj-$(CONFIG_X86_VSMP)		+= vsmp.o
 obj-$(CONFIG_K8_NB)		+= k8.o
 obj-$(CONFIG_AUDIT)		+= audit.o
+obj-$(CONFIG_EFI)		+= efi.o efi_callwrap.o
 
 obj-$(CONFIG_MODULES)		+= module.o
 obj-$(CONFIG_PCI)		+= early-quirks.o
#1 lore raw
Quoted 6 lines · Ying

Changelog between v2 and v3:

1. The EFI callwrapper is re-implemented in assembler.

---

Quoted 8 lines

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<x> (<x> is the number of parameters) are implemented. EFI function calls are wrapped before calling the firmware service.

Since the code to generate the e820 map from the efi memory map has been added to elilo (odd but ok) why does this patch continue to have code for playing with the efi memory map?

Eric

#2 lore raw
Quoted 18 lines · Eric W. Biederman
Quoted 6 lines · Ying

Changelog between v2 and v3:

1. The EFI callwrapper is re-implemented in assembler.

---

Quoted 8 lines

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<x> (<x> is the number of parameters) are implemented. EFI function calls are wrapped before calling the firmware service.

Quoted 3 lines

Since the code to generate the e820 map from the efi memory map has been added to elilo (odd but ok) why does this patch continue to have code for playing with the efi memory map?

EFI memory map is used as the parameter to EFI runtime service call:
set_virtual_address_map. It conveys some information not suitable to be described in E820 map, such as, memory region that is memory mapped IO and is used by EFI runtime service.

Best Regards,
Huang Ying