From 7ec2c21d8760fc26d93f0535588c515623d46627 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Mon, 18 Jun 2018 18:43:17 -0700 Subject: [PATCH 01/13] x86: efi-x86_app: Update MAINTAINERS Previous rename of efi-x86 target missed the MAINTAINERS update, which caused the buildman warnings: WARNING: no status info for 'efi-x86_app' WARNING: no maintainers for 'efi-x86_app' This updates the board MAINTAINERS to reflect the up-to-date info. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- board/efi/efi-x86_app/MAINTAINERS | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/board/efi/efi-x86_app/MAINTAINERS b/board/efi/efi-x86_app/MAINTAINERS index a44c7c64be..fb8a6b1c2f 100644 --- a/board/efi/efi-x86_app/MAINTAINERS +++ b/board/efi/efi-x86_app/MAINTAINERS @@ -1,6 +1,6 @@ -EFI-X86 BOARD +EFI-X86_APP BOARD M: Simon Glass S: Maintained -F: board/efi/efi-x86/ -F: include/configs/efi-x86.h -F: configs/efi-x86_defconfig +F: board/efi/efi-x86_app/ +F: include/configs/efi-x86_app.h +F: configs/efi-x86_app_defconfig From cbd29ef9f1bbd837f363eb3f80a2f6ed9400a87c Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 19 Jun 2018 19:12:15 +0200 Subject: [PATCH 02/13] x86: qemu: do not build car.o with start64.o car.o can only be used with start.o, not with start64.o. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/qemu/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/cpu/qemu/Makefile b/arch/x86/cpu/qemu/Makefile index 1761244178..b7dd5bd46c 100644 --- a/arch/x86/cpu/qemu/Makefile +++ b/arch/x86/cpu/qemu/Makefile @@ -2,6 +2,9 @@ # # Copyright (C) 2015, Bin Meng -obj-y += car.o dram.o +ifndef CONFIG_$(SPL_)X86_64 +obj-y += car.o +endif +obj-y += dram.o obj-y += qemu.o obj-$(CONFIG_QFW) += cpu.o e820.o From 964927323ff0b0cb7b00320d08589db7b429e442 Mon Sep 17 00:00:00 2001 From: Ivan Gorinov Date: Tue, 19 Jun 2018 11:40:42 -0700 Subject: [PATCH 03/13] x86: Add 64-bit setjmp/longjmp implementation Add setjmp/longjmp functions for x86_64. Signed-off-by: Ivan Gorinov Reviewed-by: Bin Meng --- arch/x86/cpu/x86_64/setjmp.S | 49 +++++++++++++++++++++++++++++++++++ arch/x86/cpu/x86_64/setjmp.c | 19 -------------- arch/x86/include/asm/setjmp.h | 17 ++++++++++++ 3 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 arch/x86/cpu/x86_64/setjmp.S delete mode 100644 arch/x86/cpu/x86_64/setjmp.c diff --git a/arch/x86/cpu/x86_64/setjmp.S b/arch/x86/cpu/x86_64/setjmp.S new file mode 100644 index 0000000000..97b812854c --- /dev/null +++ b/arch/x86/cpu/x86_64/setjmp.S @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2018 Intel Corporation + * + * See arch/x86/include/asm/setjmp.h for jmp_buf format + */ + +#include + +.text +.align 8 + +ENTRY(setjmp) + + pop %rcx + movq %rcx, (%rdi) /* Return address */ + movq %rsp, 8(%rdi) + movq %rbp, 16(%rdi) + movq %rbx, 24(%rdi) + movq %r12, 32(%rdi) + movq %r13, 40(%rdi) + movq %r14, 48(%rdi) + movq %r15, 56(%rdi) + xorq %rax, %rax /* Direct invocation returns 0 */ + jmpq *%rcx + +ENDPROC(setjmp) + +.align 8 + +ENTRY(longjmp) + + movq (%rdi), %rcx /* Return address */ + movq 8(%rdi), %rsp + movq 16(%rdi), %rbp + movq 24(%rdi), %rbx + movq 32(%rdi), %r12 + movq 40(%rdi), %r13 + movq 48(%rdi), %r14 + movq 56(%rdi), %r15 + + movq %rsi, %rax /* Value to be returned by setjmp() */ + testq %rax, %rax /* cannot be 0 in this case */ + jnz 1f + incq %rax /* Return 1 instead */ +1: + jmpq *%rcx + +ENDPROC(longjmp) diff --git a/arch/x86/cpu/x86_64/setjmp.c b/arch/x86/cpu/x86_64/setjmp.c deleted file mode 100644 index 5d4a74a571..0000000000 --- a/arch/x86/cpu/x86_64/setjmp.c +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (c) 2016 Google, Inc - */ - -#include -#include - -int setjmp(struct jmp_buf_data *jmp_buf) -{ - printf("WARNING: setjmp() is not supported\n"); - - return 0; -} - -void longjmp(struct jmp_buf_data *jmp_buf, int val) -{ - printf("WARNING: longjmp() is not supported\n"); -} diff --git a/arch/x86/include/asm/setjmp.h b/arch/x86/include/asm/setjmp.h index f25975fe1d..49c36c1cc8 100644 --- a/arch/x86/include/asm/setjmp.h +++ b/arch/x86/include/asm/setjmp.h @@ -8,6 +8,21 @@ #ifndef __setjmp_h #define __setjmp_h +#ifdef CONFIG_X86_64 + +struct jmp_buf_data { + unsigned long __rip; + unsigned long __rsp; + unsigned long __rbp; + unsigned long __rbx; + unsigned long __r12; + unsigned long __r13; + unsigned long __r14; + unsigned long __r15; +}; + +#else + struct jmp_buf_data { unsigned int __ebx; unsigned int __esp; @@ -17,6 +32,8 @@ struct jmp_buf_data { unsigned int __eip; }; +#endif + int setjmp(struct jmp_buf_data *jmp_buf); void longjmp(struct jmp_buf_data *jmp_buf, int val); From d6fea4e283a3e8d4268a39d3b37e73139876d4b2 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Sun, 17 Jun 2018 05:57:49 -0700 Subject: [PATCH 04/13] x86: qemu: Change default vesa mode to 1024x768x32 The default vesa mode was changed since commit 55b4e1b7d999 ("x86: Change default FRAMEBUFFER_VESA_MODE of some boards") for better VxWorks compatibility but with the changes QEMU video console no longer works. This is because QEMU's vgabios implements the VESA mode 8:8:8 as 24bpp without an alpha channel, which U-Boot's video console driver currently does not support yet. We need change to real 32bpp in order to make it work again. QEMU vgabios implements the custom 32bpp VESA mode starting from 0x140 (320x200x32) to 0x147 (1600x1200x32). Set it to 0x144 (1024x768x32). Fixes: 55b4e1b7d999 ("x86: Change default FRAMEBUFFER_VESA_MODE of some boards") Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- configs/qemu-x86_64_defconfig | 3 ++- configs/qemu-x86_defconfig | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig index d2eb53f091..51227f11ed 100644 --- a/configs/qemu-x86_64_defconfig +++ b/configs/qemu-x86_64_defconfig @@ -67,5 +67,6 @@ CONFIG_SPL_TIMER=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y -CONFIG_FRAMEBUFFER_VESA_MODE_112=y +CONFIG_FRAMEBUFFER_VESA_MODE_USER=y +CONFIG_FRAMEBUFFER_VESA_MODE=0x144 CONFIG_CONSOLE_SCROLL_LINES=5 diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig index f489d52b6b..7144e9cfde 100644 --- a/configs/qemu-x86_defconfig +++ b/configs/qemu-x86_defconfig @@ -47,5 +47,6 @@ CONFIG_SPI=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y -CONFIG_FRAMEBUFFER_VESA_MODE_112=y +CONFIG_FRAMEBUFFER_VESA_MODE_USER=y +CONFIG_FRAMEBUFFER_VESA_MODE=0x144 CONFIG_CONSOLE_SCROLL_LINES=5 From ec15d5f6e5e4bb718d58ec2a3753ae95abc18279 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Sun, 17 Jun 2018 05:57:50 -0700 Subject: [PATCH 05/13] board_r: Do not initialize IDE when DM BLK is on With driver model philosophy, we should avoid explicitly calling driver initialization routine during boot. This updates the ram init sequence table to exclude the IDE initialization for DM BLK. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- common/board_r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 6b297068bd..6949d4af0e 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -596,7 +596,7 @@ static int initr_pcmcia(void) } #endif -#if defined(CONFIG_IDE) +#if defined(CONFIG_IDE) && !defined(CONFIG_BLK) static int initr_ide(void) { puts("IDE: "); @@ -826,7 +826,7 @@ static init_fnc_t init_sequence_r[] = { #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_IDE) initr_pcmcia, #endif -#if defined(CONFIG_IDE) +#if defined(CONFIG_IDE) && !defined(CONFIG_BLK) initr_ide, #endif #ifdef CONFIG_LAST_STAGE_INIT From 6d02cf0562ead596b20ce23f102be5c3020c04f9 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Sun, 17 Jun 2018 05:57:52 -0700 Subject: [PATCH 06/13] x86: efi-x86_payload: Enumerate PCI bus during early boot The generic efi payload currently does not enumerate the PCI bus, which means peripherals on the PCI bus are not discovered by their drivers. This uses board_early_init_r() to do the PCI enumeration. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- board/efi/efi-x86_payload/Kconfig | 1 + board/efi/efi-x86_payload/Makefile | 2 +- board/efi/efi-x86_payload/payload.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 board/efi/efi-x86_payload/payload.c diff --git a/board/efi/efi-x86_payload/Kconfig b/board/efi/efi-x86_payload/Kconfig index b6e57b9ea7..08dd0c2edd 100644 --- a/board/efi/efi-x86_payload/Kconfig +++ b/board/efi/efi-x86_payload/Kconfig @@ -17,6 +17,7 @@ config SYS_TEXT_BASE config BOARD_SPECIFIC_OPTIONS # dummy def_bool y + select BOARD_EARLY_INIT_R imply SYS_NS16550 imply SCSI imply SCSI_AHCI diff --git a/board/efi/efi-x86_payload/Makefile b/board/efi/efi-x86_payload/Makefile index 6982340f17..00ef69534d 100644 --- a/board/efi/efi-x86_payload/Makefile +++ b/board/efi/efi-x86_payload/Makefile @@ -2,4 +2,4 @@ # # Copyright (C) 2018, Bin Meng -obj-y += start.o +obj-y += start.o payload.o diff --git a/board/efi/efi-x86_payload/payload.c b/board/efi/efi-x86_payload/payload.c new file mode 100644 index 0000000000..4eeb49a27a --- /dev/null +++ b/board/efi/efi-x86_payload/payload.c @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018, Bin Meng + */ + +#include +#include + +int board_early_init_r(void) +{ + /* + * Make sure PCI bus is enumerated so that peripherals on the PCI bus + * can be discovered by their drivers + */ + pci_init(); + + return 0; +} From 1ab2c010879baff93c690be8d98d294e9ccfab94 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Sun, 17 Jun 2018 05:57:53 -0700 Subject: [PATCH 07/13] x86: efi-x86_payload: Enable usb keyboard during boot For boards that don't route serial port pins out, it's quite common to attach a USB keyboard as the input device, along with a monitor. However USB is not automatically started in the generic efi payload codes. This uses a payload specific last_stage_init() to start the USB bus, so that a USB keyboard can be used on the U-Boot shell. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- arch/x86/cpu/cpu.c | 2 +- arch/x86/cpu/efi/payload.c | 9 +++++++++ include/configs/efi-x86_payload.h | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index db36553d05..6aefa12a7c 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -193,7 +193,7 @@ void show_boot_progress(int val) outb(val, POST_PORT); } -#ifndef CONFIG_SYS_COREBOOT +#if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB) /* * Implement a weak default function for boards that optionally * need to clean up the system before jumping to the kernel. diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index 9fd9f57776..e3f0f825f3 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -7,6 +7,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -160,3 +161,11 @@ int reserve_arch(void) return 0; } + +int last_stage_init(void) +{ + /* start usb so that usb keyboard can be used as input device */ + usb_init(); + + return 0; +} diff --git a/include/configs/efi-x86_payload.h b/include/configs/efi-x86_payload.h index 9c62fd24b8..1cf5c037e8 100644 --- a/include/configs/efi-x86_payload.h +++ b/include/configs/efi-x86_payload.h @@ -14,7 +14,7 @@ #define CONFIG_SYS_MONITOR_LEN (1 << 20) -#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd\0" \ +#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd,usbkbd\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0" From 018664464628686d41f3d36e5428bb50d9094977 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 22 Jun 2018 01:38:26 -0700 Subject: [PATCH 08/13] efi.h: Do not use config options Currently efi.h determines a few bits of its environment according to config options. This falls apart with the efi stub support which may result in efi.h getting pulled into the stub as well as real U-Boot code. In that case, one may be 32bit while the other one is 64bit. This patch changes the conditionals to use compiler provided defines instead. That way we always adhere to the build environment we're in and the definitions adjust automatically. Signed-off-by: Alexander Graf Reviewed-by: Bin Meng Tested-by: Bin Meng [bmeng: added some comments to describe the __x86_64__ check] Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- include/efi.h | 24 +++++++++++------------- lib/efi/Makefile | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/include/efi.h b/include/efi.h index 2448dde3fe..0fe15e65c0 100644 --- a/include/efi.h +++ b/include/efi.h @@ -19,12 +19,19 @@ #include #include -#if CONFIG_EFI_STUB_64BIT || (!defined(CONFIG_EFI_STUB) && defined(__x86_64__)) -/* EFI uses the Microsoft ABI which is not the default for GCC */ +/* + * EFI on x86_64 uses the Microsoft ABI which is not the default for GCC. + * + * There are two scenarios for EFI on x86_64: building a 64-bit EFI stub + * codes (CONFIG_EFI_STUB_64BIT) and building a 64-bit U-Boot (CONFIG_X86_64). + * Either needs to be properly built with the '-m64' compiler flag, and hence + * it is enough to only check the compiler provided define __x86_64__ here. + */ +#ifdef __x86_64__ #define EFIAPI __attribute__((ms_abi)) #else #define EFIAPI asmlinkage -#endif +#endif /* __x86_64__ */ struct efi_device_path; @@ -32,16 +39,7 @@ typedef struct { u8 b[16]; } efi_guid_t; -#define EFI_BITS_PER_LONG BITS_PER_LONG - -/* - * With 64-bit EFI stub, EFI_BITS_PER_LONG has to be 64. EFI_STUB is set - * in lib/efi/Makefile, when building the stub. - */ -#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB) -#undef EFI_BITS_PER_LONG -#define EFI_BITS_PER_LONG 64 -#endif +#define EFI_BITS_PER_LONG (sizeof(long) * 8) /* Bit mask for EFI status code with error */ #define EFI_ERROR_MASK (1UL << (EFI_BITS_PER_LONG - 1)) diff --git a/lib/efi/Makefile b/lib/efi/Makefile index f1a3929e32..a790d2d554 100644 --- a/lib/efi/Makefile +++ b/lib/efi/Makefile @@ -7,11 +7,11 @@ obj-$(CONFIG_EFI_STUB) += efi_info.o CFLAGS_REMOVE_efi_stub.o := -mregparm=3 \ $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32) -CFLAGS_efi_stub.o := -fpic -fshort-wchar -DEFI_STUB \ +CFLAGS_efi_stub.o := -fpic -fshort-wchar \ $(if $(CONFIG_EFI_STUB_64BIT),-m64) CFLAGS_REMOVE_efi.o := -mregparm=3 \ $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32) -CFLAGS_efi.o := -fpic -fshort-wchar -DEFI_STUB \ +CFLAGS_efi.o := -fpic -fshort-wchar \ $(if $(CONFIG_EFI_STUB_64BIT),-m64) extra-$(CONFIG_EFI_STUB) += efi_stub.o efi.o From 5460fd076263a461442e4beb3215466536166026 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 22 Jun 2018 01:38:27 -0700 Subject: [PATCH 09/13] x86: Change __kernel_size_t conditionals to use compiler provided defines Since commit bb0bb91cf0aa ("efi_stub: Use efi_uintn_t"), EFI x86 64-bit payload does not work anymore. The call to GetMemoryMap() in efi_stub.c fails with return code EFI_INVALID_PARAMETER. Since the payload itself is still 32-bit U-Boot, efi_uintn_t gets wrongly interpreted as int, but it should actually be long in a 64-bit EFI environment. This changes the x86 __kernel_size_t conditionals to use compiler provided defines instead. That way we always adhere to the build environment we're in and the definitions adjust automatically. Fixes: bb0bb91cf0aa ("efi_stub: Use efi_uintn_t") Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- arch/x86/include/asm/posix_types.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h index 717f6cb8e0..dbcea7f47f 100644 --- a/arch/x86/include/asm/posix_types.h +++ b/arch/x86/include/asm/posix_types.h @@ -16,7 +16,8 @@ typedef int __kernel_pid_t; typedef unsigned short __kernel_ipc_pid_t; typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; -#if CONFIG_IS_ENABLED(X86_64) +/* checking against __x86_64__ covers both 64-bit EFI stub and 64-bit U-Boot */ +#if defined(__x86_64__) typedef unsigned long __kernel_size_t; typedef long __kernel_ssize_t; #else From 7c98ca10eae855571b16cddb19d461a981052730 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 22 Jun 2018 01:38:28 -0700 Subject: [PATCH 10/13] efi: stub: Move the use_uart assignment immediately after exit_boot_services() call The use_uart assignment should follow immediately after the call to exit_boot_services(), in case we want some debug output after that. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- lib/efi/efi_stub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index 262fc56562..1b495ec81b 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -361,14 +361,14 @@ efi_status_t EFIAPI efi_main(efi_handle_t image, } } + /* The EFI UART won't work now, switch to a debug one */ + use_uart = true; + map.version = version; map.desc_size = desc_size; add_entry_addr(priv, EFIET_MEMORY_MAP, &map, sizeof(map), desc, size); add_entry_addr(priv, EFIET_END, NULL, 0, 0, 0); - /* The EFI UART won't work now, switch to a debug one */ - use_uart = true; - memcpy((void *)CONFIG_SYS_TEXT_BASE, _binary_u_boot_bin_start, (ulong)_binary_u_boot_bin_end - (ulong)_binary_u_boot_bin_start); From 1ffa447b8c8fd84937f41f5084ac802136773357 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 22 Jun 2018 01:38:29 -0700 Subject: [PATCH 11/13] x86: efi-x86_payload: Enable PRE_CONSOLE_BUFFER Enable PRE_CONSOLE_BUFFER so that the full boot output can be viewed on the video console for the EFI payload. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- configs/efi-x86_payload32_defconfig | 2 ++ configs/efi-x86_payload64_defconfig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configs/efi-x86_payload32_defconfig b/configs/efi-x86_payload32_defconfig index 7f0cab0ab1..5b6f125549 100644 --- a/configs/efi-x86_payload32_defconfig +++ b/configs/efi-x86_payload32_defconfig @@ -6,6 +6,8 @@ CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" +CONFIG_PRE_CONSOLE_BUFFER=y +CONFIG_PRE_CON_BUF_ADDR=0x100000 CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y diff --git a/configs/efi-x86_payload64_defconfig b/configs/efi-x86_payload64_defconfig index 8d7f3f056e..71fdb5c841 100644 --- a/configs/efi-x86_payload64_defconfig +++ b/configs/efi-x86_payload64_defconfig @@ -6,6 +6,8 @@ CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" +CONFIG_PRE_CONSOLE_BUFFER=y +CONFIG_PRE_CON_BUF_ADDR=0x100000 CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_LAST_STAGE_INIT=y From 598374729e6b3f3070e06bdf2990dd8d10cddbda Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 22 Jun 2018 01:38:30 -0700 Subject: [PATCH 12/13] x86: efi: payload: Count in conventional memory above 4GB in DRAM bank At present in dram_init_banksize() it ignores conventional memory above 4GB. This leads to wrong DRAM size is printed during boot. Remove such limitation. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- arch/x86/cpu/efi/payload.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index e3f0f825f3..4649bfe86e 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -109,11 +109,10 @@ int dram_init_banksize(void) desc < end && num_banks < CONFIG_NR_DRAM_BANKS; desc = efi_get_next_mem_desc(map, desc)) { /* - * We only use conventional memory below 4GB, and ignore + * We only use conventional memory and ignore * anything less than 1MB. */ if (desc->type != EFI_CONVENTIONAL_MEMORY || - desc->physical_start >= 1ULL << 32 || (desc->num_pages << EFI_PAGE_SHIFT) < 1 << 20) continue; gd->bd->bi_dram[num_banks].start = desc->physical_start; From dd099ec44b5d0a5d2dff537fc5b3b3441a49eec6 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 22 Jun 2018 01:38:31 -0700 Subject: [PATCH 13/13] cmd: efi: Fix wrong memory descriptor end address Each entry of the EFI memory descriptors occupies map->desc_size, not sizeof(struct efi_mem_desc). Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- cmd/efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/efi.c b/cmd/efi.c index 2511c6cb78..6c1eb88424 100644 --- a/cmd/efi.c +++ b/cmd/efi.c @@ -83,7 +83,7 @@ void *efi_build_mem_table(struct efi_entry_memmap *map, int size, bool skip_bs) prev = NULL; addr = 0; dest = base; - end = base + count; + end = (struct efi_mem_desc *)((ulong)base + count * map->desc_size); for (desc = base; desc < end; desc = efi_get_next_mem_desc(map, desc)) { bool merge = true; int type = desc->type;