mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-29 16:10:24 +09:00
Merge git://git.denx.de/u-boot-x86
This commit is contained in:
commit
90efca2539
@ -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.
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <common.h>
|
||||
#include <efi.h>
|
||||
#include <errno.h>
|
||||
#include <usb.h>
|
||||
#include <asm/post.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
@ -108,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;
|
||||
@ -160,3 +160,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;
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
#
|
||||
# Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
|
||||
|
||||
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
|
||||
|
49
arch/x86/cpu/x86_64/setjmp.S
Normal file
49
arch/x86/cpu/x86_64/setjmp.S
Normal file
@ -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 <linux/linkage.h>
|
||||
|
||||
.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)
|
@ -1,19 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (c) 2016 Google, Inc
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/setjmp.h>
|
||||
|
||||
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");
|
||||
}
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
EFI-X86 BOARD
|
||||
EFI-X86_APP BOARD
|
||||
M: Simon Glass <sjg@chromium.org>
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -2,4 +2,4 @@
|
||||
#
|
||||
# Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
|
||||
|
||||
obj-y += start.o
|
||||
obj-y += start.o payload.o
|
||||
|
18
board/efi/efi-x86_payload/payload.c
Normal file
18
board/efi/efi-x86_payload/payload.c
Normal file
@ -0,0 +1,18 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <usb.h>
|
||||
|
||||
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;
|
||||
}
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -19,12 +19,19 @@
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#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))
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user