Re: [PATCH 1/5] x86_64 EFI support -v3: EFI base support

2007-07-31 Thread Huang, Ying
On Mon, 2007-07-30 at 22:37 -0600, Eric W. Biederman wrote:
> "Huang, Ying" <[EMAIL PROTECTED]> writes:
> 
> > 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.
> 
> 
> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] x86_64 EFI support -v3: EFI base support

2007-07-31 Thread Huang, Ying
On Mon, 2007-07-30 at 22:37 -0600, Eric W. Biederman wrote:
 Huang, Ying [EMAIL PROTECTED] writes:
 
  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
  lin2winx (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?

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
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] x86_64 EFI support -v3: EFI base support

2007-07-30 Thread Eric W. Biederman
"Huang, Ying" <[EMAIL PROTECTED]> writes:

> 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.


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2007-07-30 Thread Huang, Ying
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,
+ 

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

2007-07-30 Thread Huang, Ying
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
lin2winx (x 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 linux/kernel.h
+#include linux/init.h
+#include linux/mm.h
+#include linux/types.h
+#include linux/time.h
+#include linux/spinlock.h
+#include linux/bootmem.h
+#include linux/ioport.h
+#include linux/module.h
+#include linux/efi.h
+#include linux/uaccess.h
+#include linux/io.h
+#include linux/reboot.h
+
+#include asm/setup.h
+#include asm/bootsetup.h
+#include asm/page.h
+#include asm/e820.h
+#include asm/pgtable.h
+#include asm/tlbflush.h
+#include asm/cacheflush.h
+#include asm/proto.h
+#include asm-x86_64/eficallwrap.h
+
+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,
+

Re: [PATCH 1/5] x86_64 EFI support -v3: EFI base support

2007-07-30 Thread Eric W. Biederman
Huang, Ying [EMAIL PROTECTED] writes:

 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
 lin2winx (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
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/