diff mbox

[U-Boot,v3,25/28] x86: qemu: Support operation as an EFI payload

Message ID 1438713246-1887-26-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Aug. 4, 2015, 6:34 p.m. UTC
Disable a few things which interfere with the EFI init. This allows QEMU to
to boot into EFI, load a U-Boot payload then boot to the U-Boot prompt.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---

Changes in v3: None
Changes in v2:
- Fix indenting in board/emulation/qemu-x86/Kconfig

 arch/x86/cpu/qemu/Makefile       | 5 ++++-
 arch/x86/cpu/qemu/qemu.c         | 2 ++
 board/emulation/qemu-x86/Kconfig | 5 +++--
 3 files changed, 9 insertions(+), 3 deletions(-)

Comments

Bin Meng Aug. 5, 2015, 8:19 a.m. UTC | #1
On Wed, Aug 5, 2015 at 2:34 AM, Simon Glass <sjg@chromium.org> wrote:
> Disable a few things which interfere with the EFI init. This allows QEMU to
> to boot into EFI, load a U-Boot payload then boot to the U-Boot prompt.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v3: None
> Changes in v2:
> - Fix indenting in board/emulation/qemu-x86/Kconfig
>
>  arch/x86/cpu/qemu/Makefile       | 5 ++++-
>  arch/x86/cpu/qemu/qemu.c         | 2 ++
>  board/emulation/qemu-x86/Kconfig | 5 +++--
>  3 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/cpu/qemu/Makefile b/arch/x86/cpu/qemu/Makefile
> index be79723..9a66b16 100644
> --- a/arch/x86/cpu/qemu/Makefile
> +++ b/arch/x86/cpu/qemu/Makefile
> @@ -4,5 +4,8 @@
>  # SPDX-License-Identifier:     GPL-2.0+
>  #
>
> -obj-y += car.o dram.o qemu.o
> +ifndef CONFIG_EFI_STUB
> +obj-y += car.o dram.o
> +endif
> +obj-y += qemu.o
>  obj-$(CONFIG_PCI) += pci.o
> diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c
> index 930d2b6..64634a9 100644
> --- a/arch/x86/cpu/qemu/qemu.c
> +++ b/arch/x86/cpu/qemu/qemu.c
> @@ -25,11 +25,13 @@ int arch_cpu_init(void)
>         return 0;
>  }
>
> +#ifndef CONFIG_EFI_STUB
>  int print_cpuinfo(void)
>  {
>         post_code(POST_CPU_INFO);
>         return default_print_cpuinfo();
>  }
> +#endif
>
>  void reset_cpu(ulong addr)
>  {
> diff --git a/board/emulation/qemu-x86/Kconfig b/board/emulation/qemu-x86/Kconfig
> index e777ef4..c9181fc 100644
> --- a/board/emulation/qemu-x86/Kconfig
> +++ b/board/emulation/qemu-x86/Kconfig
> @@ -13,11 +13,12 @@ config SYS_CONFIG_NAME
>         default "qemu-x86"
>
>  config SYS_TEXT_BASE
> -       default 0xfff00000
> +       default 0xfff00000 if !EFI_STUB
> +       default 0x01110000 if EFI_STUB
>
>  config BOARD_SPECIFIC_OPTIONS # dummy
>         def_bool y
> -       select X86_RESET_VECTOR
> +       select X86_RESET_VECTOR if !EFI_STUB
>         select QEMU
>         select BOARD_ROMSIZE_KB_1024
>
> --

Tested on QEMU 32-bit and 64-bit
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass Aug. 5, 2015, 6:03 p.m. UTC | #2
On 5 August 2015 at 02:19, Bin Meng <bmeng.cn@gmail.com> wrote:
> On Wed, Aug 5, 2015 at 2:34 AM, Simon Glass <sjg@chromium.org> wrote:
>> Disable a few things which interfere with the EFI init. This allows QEMU to
>> to boot into EFI, load a U-Boot payload then boot to the U-Boot prompt.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v3: None
>> Changes in v2:
>> - Fix indenting in board/emulation/qemu-x86/Kconfig
>>
>>  arch/x86/cpu/qemu/Makefile       | 5 ++++-
>>  arch/x86/cpu/qemu/qemu.c         | 2 ++
>>  board/emulation/qemu-x86/Kconfig | 5 +++--
>>  3 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/cpu/qemu/Makefile b/arch/x86/cpu/qemu/Makefile
>> index be79723..9a66b16 100644
>> --- a/arch/x86/cpu/qemu/Makefile
>> +++ b/arch/x86/cpu/qemu/Makefile
>> @@ -4,5 +4,8 @@
>>  # SPDX-License-Identifier:     GPL-2.0+
>>  #
>>
>> -obj-y += car.o dram.o qemu.o
>> +ifndef CONFIG_EFI_STUB
>> +obj-y += car.o dram.o
>> +endif
>> +obj-y += qemu.o
>>  obj-$(CONFIG_PCI) += pci.o
>> diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c
>> index 930d2b6..64634a9 100644
>> --- a/arch/x86/cpu/qemu/qemu.c
>> +++ b/arch/x86/cpu/qemu/qemu.c
>> @@ -25,11 +25,13 @@ int arch_cpu_init(void)
>>         return 0;
>>  }
>>
>> +#ifndef CONFIG_EFI_STUB
>>  int print_cpuinfo(void)
>>  {
>>         post_code(POST_CPU_INFO);
>>         return default_print_cpuinfo();
>>  }
>> +#endif
>>
>>  void reset_cpu(ulong addr)
>>  {
>> diff --git a/board/emulation/qemu-x86/Kconfig b/board/emulation/qemu-x86/Kconfig
>> index e777ef4..c9181fc 100644
>> --- a/board/emulation/qemu-x86/Kconfig
>> +++ b/board/emulation/qemu-x86/Kconfig
>> @@ -13,11 +13,12 @@ config SYS_CONFIG_NAME
>>         default "qemu-x86"
>>
>>  config SYS_TEXT_BASE
>> -       default 0xfff00000
>> +       default 0xfff00000 if !EFI_STUB
>> +       default 0x01110000 if EFI_STUB
>>
>>  config BOARD_SPECIFIC_OPTIONS # dummy
>>         def_bool y
>> -       select X86_RESET_VECTOR
>> +       select X86_RESET_VECTOR if !EFI_STUB
>>         select QEMU
>>         select BOARD_ROMSIZE_KB_1024
>>
>> --
>
> Tested on QEMU 32-bit and 64-bit
> Tested-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot-x86.
diff mbox

Patch

diff --git a/arch/x86/cpu/qemu/Makefile b/arch/x86/cpu/qemu/Makefile
index be79723..9a66b16 100644
--- a/arch/x86/cpu/qemu/Makefile
+++ b/arch/x86/cpu/qemu/Makefile
@@ -4,5 +4,8 @@ 
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-y += car.o dram.o qemu.o
+ifndef CONFIG_EFI_STUB
+obj-y += car.o dram.o
+endif
+obj-y += qemu.o
 obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c
index 930d2b6..64634a9 100644
--- a/arch/x86/cpu/qemu/qemu.c
+++ b/arch/x86/cpu/qemu/qemu.c
@@ -25,11 +25,13 @@  int arch_cpu_init(void)
 	return 0;
 }
 
+#ifndef CONFIG_EFI_STUB
 int print_cpuinfo(void)
 {
 	post_code(POST_CPU_INFO);
 	return default_print_cpuinfo();
 }
+#endif
 
 void reset_cpu(ulong addr)
 {
diff --git a/board/emulation/qemu-x86/Kconfig b/board/emulation/qemu-x86/Kconfig
index e777ef4..c9181fc 100644
--- a/board/emulation/qemu-x86/Kconfig
+++ b/board/emulation/qemu-x86/Kconfig
@@ -13,11 +13,12 @@  config SYS_CONFIG_NAME
 	default "qemu-x86"
 
 config SYS_TEXT_BASE
-	default 0xfff00000
+	default 0xfff00000 if !EFI_STUB
+	default 0x01110000 if EFI_STUB
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
-	select X86_RESET_VECTOR
+	select X86_RESET_VECTOR if !EFI_STUB
 	select QEMU
 	select BOARD_ROMSIZE_KB_1024