aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-10-22 13:56:10 -0400
committerTom Rini <trini@konsulko.com>2018-10-22 13:56:10 -0400
commitc95c666d0128e5ec0c161b531c568233a8d3979d (patch)
tree77b5e5f3575b67216190d9f14411f8c692f808f1
parent88d60db01168c743b4ae4152150a43a3df43c1c0 (diff)
parent3fdfca7a782e7d84bc14cd5d316b4894ec20dcec (diff)
downloadu-boot-c95c666d0128e5ec0c161b531c568233a8d3979d.zip
u-boot-c95c666d0128e5ec0c161b531c568233a8d3979d.tar.gz
u-boot-c95c666d0128e5ec0c161b531c568233a8d3979d.tar.bz2
Merge git://git.denx.de/u-boot-x86
-rw-r--r--.travis.yml13
-rw-r--r--arch/x86/config.mk3
-rw-r--r--arch/x86/cpu/quark/Kconfig4
-rw-r--r--arch/x86/cpu/start64.S1
-rw-r--r--arch/x86/cpu/x86_64/cpu.c28
-rw-r--r--arch/x86/lib/bootm.c4
-rw-r--r--arch/x86/lib/relocate.c18
-rw-r--r--configs/chromebook_samus_defconfig2
-rw-r--r--configs/qemu-x86_64_defconfig1
-rw-r--r--doc/README.x8636
-rw-r--r--drivers/timer/Kconfig13
-rw-r--r--drivers/timer/tsc_timer.c6
-rw-r--r--tools/binman/etype/intel_refcode.py27
13 files changed, 111 insertions, 45 deletions
diff --git a/.travis.yml b/.travis.yml
index 6697664..03ab70f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,7 @@ addons:
- libpython-dev
- iasl
- grub-efi-ia32-bin
+ - grub-efi-amd64-bin
- rpm2cpio
- wget
- device-tree-compiler
@@ -49,6 +50,7 @@ install:
- pip install pytest
- pip install python-subunit
- grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
+ - grub-mkimage -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
- mkdir ~/grub2-arm
- ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di )
- mkdir ~/grub2-arm64
@@ -95,7 +97,7 @@ before_script:
git clone git://git.qemu.org/qemu.git /tmp/qemu;
pushd /tmp/qemu;
git submodule update --init dtc &&
- git checkout v2.8.0-rc3 &&
+ git checkout v3.0.0 &&
./configure --prefix=/tmp/qemu-install --target-list=${QEMU_TARGET} &&
make -j4 all install;
popd;
@@ -128,6 +130,7 @@ script:
# value.
- export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD};
cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/;
+ cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/;
cp ~/grub2-arm/usr/lib/grub2/arm-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi;
cp ~/grub2-arm64/usr/lib/grub2/arm64-efi/grub.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi;
if [[ "${TEST_PY_BD}" != "" ]]; then
@@ -421,6 +424,14 @@ matrix:
BUILDMAN="^qemu-x86$"
TOOLCHAIN="i386"
BUILD_ROM="yes"
+ - name: "test/py qemu-x86_64"
+ env:
+ - TEST_PY_BD="qemu-x86_64"
+ TEST_PY_TEST_SPEC="not sleep"
+ QEMU_TARGET="x86_64-softmmu"
+ BUILDMAN="^qemu-x86_64$"
+ TOOLCHAIN="i386"
+ BUILD_ROM="yes"
- name: "test/py zynq_zc702"
env:
- TEST_PY_BD="zynq_zc702"
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index cc94071..8151e47 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -23,7 +23,8 @@ endif
ifeq ($(IS_32BIT),y)
PLATFORM_CPPFLAGS += -march=i386 -m32
else
-PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -m64
+PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -march=core2 -m64
+PLATFORM_CPPFLAGS += -mno-mmx -mno-sse
endif
PLATFORM_RELFLAGS += -fdata-sections -ffunction-sections -fvisibility=hidden
diff --git a/arch/x86/cpu/quark/Kconfig b/arch/x86/cpu/quark/Kconfig
index 76f1592..3a18cb0 100644
--- a/arch/x86/cpu/quark/Kconfig
+++ b/arch/x86/cpu/quark/Kconfig
@@ -130,4 +130,8 @@ config SYS_CAR_SIZE
Space in bytes in eSRAM used as Cache-As-ARM (CAR).
Note this size must not exceed eSRAM's total size.
+config X86_TSC_TIMER_EARLY_FREQ
+ int
+ default 400
+
endif
diff --git a/arch/x86/cpu/start64.S b/arch/x86/cpu/start64.S
index a473fd1..a78a331 100644
--- a/arch/x86/cpu/start64.S
+++ b/arch/x86/cpu/start64.S
@@ -20,6 +20,7 @@ _start:
call board_init_f_init_reserve
+ xor %rdi, %rdi
call board_init_f
call board_init_f_r
diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
index 18b3e94..6c063e8 100644
--- a/arch/x86/cpu/x86_64/cpu.c
+++ b/arch/x86/cpu/x86_64/cpu.c
@@ -7,30 +7,18 @@
#include <common.h>
#include <debug_uart.h>
-/* Global declaration of gd */
-struct global_data *global_data_ptr;
+/*
+ * Global declaration of gd.
+ *
+ * As we write to it before relocation we have to make sure it is not put into
+ * a .bss section which may overlap a .rela section. Initialization forces it
+ * into a .data section which cannot overlap any .rela section.
+ */
+struct global_data *global_data_ptr = (struct global_data *)~0;
void arch_setup_gd(gd_t *new_gd)
{
global_data_ptr = new_gd;
-
- /*
- * TODO(sjg@chromium.org): For some reason U-Boot does not boot
- * without this line. It fails to start up U-Boot proper and instead
- * restarts SPL. Need to figure out why:
- *
- * U-Boot SPL 2017.01
- *
- * U-Boot SPL 2017.01
- * CPU: Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz
- * Trying to boot from SPIJumping to 64-bit U-Boot: Note many
- * features are missing
- *
- * U-Boot SPL 2017.01
- */
-#ifdef CONFIG_DEBUG_UART
- printch(' ');
-#endif
}
int cpu_has_64bit(void)
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 54c22fe..832b1f9 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -116,6 +116,10 @@ static int boot_prep_linux(bootm_headers_t *images)
char *base_ptr;
base_ptr = (char *)load_zimage(data, len, &load_address);
+ if (!base_ptr) {
+ puts("## Kernel loading failed ...\n");
+ goto error;
+ }
images->os.load = load_address;
cmd_line_dest = base_ptr + COMMAND_LINE_OFFSET;
images->ep = (ulong)base_ptr;
diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c
index ed10755..4d09e4d 100644
--- a/arch/x86/lib/relocate.c
+++ b/arch/x86/lib/relocate.c
@@ -53,6 +53,15 @@ static void do_elf_reloc_fixups64(unsigned int text_base, uintptr_t size,
Elf64_Addr *offset_ptr_ram;
do {
+ unsigned long long type = ELF64_R_TYPE(re_src->r_info);
+
+ if (type != R_X86_64_RELATIVE) {
+ printf("%s: unsupported relocation type 0x%llx "
+ "at %p, ", __func__, type, re_src);
+ printf("offset = 0x%llx\n", re_src->r_offset);
+ continue;
+ }
+
/* Get the location from the relocation entry */
offset_ptr_rom = (Elf64_Addr *)(uintptr_t)re_src->r_offset;
@@ -91,6 +100,15 @@ static void do_elf_reloc_fixups32(unsigned int text_base, uintptr_t size,
Elf32_Addr *offset_ptr_ram;
do {
+ unsigned int type = ELF32_R_TYPE(re_src->r_info);
+
+ if (type != R_386_RELATIVE) {
+ printf("%s: unsupported relocation type 0x%x "
+ "at %p, ", __func__, type, re_src);
+ printf("offset = 0x%x\n", re_src->r_offset);
+ continue;
+ }
+
/* Get the location from the relocation entry */
offset_ptr_rom = (Elf32_Addr *)(uintptr_t)re_src->r_offset;
diff --git a/configs/chromebook_samus_defconfig b/configs/chromebook_samus_defconfig
index 8f2336c..e5483c5 100644
--- a/configs/chromebook_samus_defconfig
+++ b/configs/chromebook_samus_defconfig
@@ -1,6 +1,6 @@
CONFIG_X86=y
CONFIG_SYS_TEXT_BASE=0xFFE00000
-CONFIG_SYS_MALLOC_F_LEN=0x1800
+CONFIG_SYS_MALLOC_F_LEN=0x1a00
CONFIG_DEBUG_UART_BOARD_INIT=y
CONFIG_DEBUG_UART_BASE=0x3f8
CONFIG_DEBUG_UART_CLOCK=1843200
diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
index cf1ba8e..32922b8 100644
--- a/configs/qemu-x86_64_defconfig
+++ b/configs/qemu-x86_64_defconfig
@@ -63,6 +63,7 @@ CONFIG_SPL_REGMAP=y
CONFIG_SYSCON=y
CONFIG_SPL_SYSCON=y
CONFIG_CPU=y
+CONFIG_SPL_DM_RTC=y
CONFIG_SPI=y
CONFIG_SPL_TIMER=y
CONFIG_USB_STORAGE=y
diff --git a/doc/README.x86 b/doc/README.x86
index 8cc4672..fa49cb8 100644
--- a/doc/README.x86
+++ b/doc/README.x86
@@ -32,7 +32,7 @@ are supported:
- Link (Chromebook Pixel)
- Minnowboard MAX
- Samus (Chromebook Pixel 2015)
- - QEMU x86
+ - QEMU x86 (32-bit & 64-bit)
As for loading an OS, U-Boot supports directly booting a 32-bit or 64-bit
Linux kernel as part of a FIT image. It also supports a compressed zImage.
@@ -376,7 +376,9 @@ QEMU x86 target instructions for bare mode:
To build u-boot.rom for QEMU x86 targets, just simply run
-$ make qemu-x86_defconfig
+$ make qemu-x86_defconfig (for 32-bit)
+or
+$ make qemu-x86_64_defconfig (for 64-bit)
$ make all
Note this default configuration will build a U-Boot for the QEMU x86 i440FX
@@ -479,6 +481,19 @@ Here the kernel (bzImage) is loaded to 01000000 and initrd is to 04000000. Then,
=> zboot 01000000 - 04000000 1b1ab50
+To run 64-bit U-Boot, qemu-system-x86_64 should be used instead, e.g.:
+$ qemu-system-x86_64 -nographic -bios path/to/u-boot.rom
+
+A specific CPU can be specified via the '-cpu' parameter but please make
+sure the specified CPU supports 64-bit like '-cpu core2duo'. Conversely
+'-cpu pentium' won't work for obvious reasons that the processor only
+supports 32-bit.
+
+Note 64-bit support is very preliminary at this point. Lots of features
+are missing in the 64-bit world. One notable feature is the VGA console
+support which is currently missing, so that you must specify '-nographic'
+to get 64-bit U-Boot up and running.
+
Updating U-Boot on Edison
-------------------------
By default Intel Edison boards are shipped with preinstalled heavily
@@ -1145,27 +1160,10 @@ to load a 'u-boot-payload.efi', see below test logs on QEMU.
See README.u-boot_on_efi and README.uefi for details of EFI support in U-Boot.
-64-bit Support
---------------
-U-Boot supports booting a 64-bit kernel directly and is able to change to
-64-bit mode to do so. However, U-Boot itself is currently always built
-in 32-bit mode. Some access to the full memory range is provided with
-arch_phys_memset().
-
-The development work to make U-Boot itself run in 64-bit mode has not yet
-been attempted. The best approach would likely be to build a 32-bit SPL
-image for U-Boot, with CONFIG_SPL_BUILD. This could then handle the early CPU
-init in 16-bit and 32-bit mode, running the FSP and any other binaries that
-are needed. Then it could change to 64-bit model and jump to U-Boot proper.
-
-Given U-Boot's extensive 64-bit support this has not been a high priority,
-but it would be a nice addition.
-
TODO List
---------
- Audio
- Chrome OS verified boot
-- Building U-Boot to run in 64-bit mode
References
----------
diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
index a7d600b..d012cf7 100644
--- a/drivers/timer/Kconfig
+++ b/drivers/timer/Kconfig
@@ -30,6 +30,9 @@ config TPL_TIMER
config TIMER_EARLY
bool "Allow timer to be used early in U-Boot"
depends on TIMER
+ # initr_bootstage() requires a timer and is called before initr_dm()
+ # so only the early timer is available
+ default y if X86 && BOOTSTAGE
help
In some cases the timer must be accessible before driver model is
active. Examples include when using CONFIG_TRACE to trace U-Boot's
@@ -79,6 +82,16 @@ config X86_TSC_TIMER
help
Select this to enable Time-Stamp Counter (TSC) timer for x86.
+config X86_TSC_TIMER_EARLY_FREQ
+ int "x86 TSC timer frequency in MHz when used as the early timer"
+ depends on X86_TSC_TIMER
+ default 1000
+ help
+ Sets the estimated CPU frequency in MHz when TSC is used as the
+ early timer and the frequency can neither be calibrated via some
+ hardware ways, nor got from device tree at the time when device
+ tree is not available yet.
+
config OMAP_TIMER
bool "Omap timer support"
depends on TIMER
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index 6473de2..da7c812 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -341,7 +341,7 @@ static int tsc_timer_get_count(struct udevice *dev, u64 *count)
return 0;
}
-static void tsc_timer_ensure_setup(bool stop)
+static void tsc_timer_ensure_setup(bool early)
{
if (gd->arch.tsc_base)
return;
@@ -362,8 +362,8 @@ static void tsc_timer_ensure_setup(bool stop)
if (fast_calibrate)
goto done;
- if (stop)
- panic("TSC frequency is ZERO");
+ if (early)
+ fast_calibrate = CONFIG_X86_TSC_TIMER_EARLY_FREQ;
else
return;
diff --git a/tools/binman/etype/intel_refcode.py b/tools/binman/etype/intel_refcode.py
new file mode 100644
index 0000000..045db58
--- /dev/null
+++ b/tools/binman/etype/intel_refcode.py
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for Intel Memory Reference Code binary blob
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_intel_refcode(Entry_blob):
+ """Entry containing an Intel Reference Code file
+
+ Properties / Entry arguments:
+ - filename: Filename of file to read into entry
+
+ This file contains code for setting up the platform on some Intel systems.
+ This is executed by U-Boot when needed early during startup. A typical
+ filename is 'refcode.bin'.
+
+ See README.x86 for information about x86 binary blobs.
+ """
+ def __init__(self, section, etype, node):
+ Entry_blob.__init__(self, section, etype, node)
+
+ def GetDefaultFilename(self):
+ return 'refcode.bin'