[U-Boot] [PATCH 0/20] Final patch set for basic coreboot x86 implementation

This series contains patches to:
- enable video and keyboard - fix up some x86 relocation bugs - Implement show_boot_progress() - Provide access to new Intel core architecture timers - Enable device tree control and add a basic fdt include file
With the above changes (on top of previously-submitted series), we have a basically functioning U-Boot on x86, running from coreboot.
Further work is required to tidy up MTRR support (based on Graeme's comments), add a SPI driver, rename the config file, move coreboot support into a lib directory (or similar), clean up the config to enable various other devices and a few other minor issues.
This work will be the subject of a later series.
Duncan Laurie (3): x86: Fix MTRR clear to detect which MTRR to use x86: Issue SMI to finalize Coreboot in final stage video: Check for valid FB pointer before clearing
Gabe Black (8): x86: Initialise SPI if enabled x86: Reorder x86's post relocation memory layout x86: Make the upper bound on relocated symbols closed instead of open x86: Make calculate_relocation_address an overridable function x86: Override calculate_relocation_address to use the e820 map x86: Add back cold- and warm-boot flags x86: Add support for CONFIG_OF_CONTROL x86: coreboot: Set CONFIG_ARCH_DEVICE_TREE correctly
Simon Glass (3): x86: fdt: Create basic .dtsi file for coreboot x86: Remove video_init() prototype from u-boot-x86.h x86: coreboot: Enable video display
Stefan Reinauer (4): x86: Add CONFIG_DELAY_ENVIRONMENT to delay environment loading x86: Emit port 80 post codes in show_boot_progress() x86: Remove coreboot_ from file name x86: drop unused code in coreboot.c
Vadim Bendebury (2): x86: Provide tick counter and frequency reference for Intel core architecture x86: Provide a way to throttle port80 accesses
arch/x86/cpu/coreboot/Makefile | 3 +- arch/x86/cpu/coreboot/{coreboot_car.S => car.S} | 0 arch/x86/cpu/coreboot/config.mk | 23 ++++++++++ arch/x86/cpu/coreboot/coreboot.c | 53 ++++++++++++++++++----- arch/x86/cpu/coreboot/sdram.c | 53 +++++++++++++++++++++-- arch/x86/cpu/interrupts.c | 31 +++++++++++++ arch/x86/cpu/start.S | 10 ++++- arch/x86/cpu/start16.S | 3 + arch/x86/dts/coreboot.dtsi | 16 +++++++ arch/x86/dts/skeleton.dtsi | 13 ++++++ arch/x86/include/asm/global_data.h | 6 +++ arch/x86/include/asm/init_helpers.h | 1 + arch/x86/include/asm/u-boot-x86.h | 1 - arch/x86/lib/board.c | 10 ++++ arch/x86/lib/init_helpers.c | 50 +++++++++++++++++++--- arch/x86/lib/init_wrappers.c | 28 ++++++++++++- arch/x86/lib/relocate.c | 2 +- drivers/video/cfb_console.c | 5 +- include/configs/coreboot.h | 10 +++- 19 files changed, 287 insertions(+), 31 deletions(-) rename arch/x86/cpu/coreboot/{coreboot_car.S => car.S} (100%) create mode 100644 arch/x86/cpu/coreboot/config.mk create mode 100644 arch/x86/dts/coreboot.dtsi create mode 100644 arch/x86/dts/skeleton.dtsi

From: Gabe Black gabeblack@chromium.org
If we have SPI support, make sure that we init it.
Signed-off-by: Gabe Black gabeblack@google.com Signed-off-by: Simon Glass sjg@chromium.org Signed-off-by: Vic Yang victoryang@chromium.org --- arch/x86/include/asm/init_helpers.h | 1 + arch/x86/lib/board.c | 3 +++ arch/x86/lib/init_helpers.c | 9 +++++++++ 3 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/init_helpers.h b/arch/x86/include/asm/init_helpers.h index 8afb443..4ea6536 100644 --- a/arch/x86/include/asm/init_helpers.h +++ b/arch/x86/include/asm/init_helpers.h @@ -38,5 +38,6 @@ int init_bd_struct_r(void); int flash_init_r(void); int status_led_set_r(void); int set_load_addr_r(void); +int init_func_spi(void);
#endif /* !_INIT_HELPERS_H_ */ diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index e5caf13..e0c5419 100644 --- a/arch/x86/lib/board.c +++ b/arch/x86/lib/board.c @@ -154,6 +154,9 @@ init_fnc_t *init_sequence_r[] = { #ifndef CONFIG_SYS_NO_FLASH flash_init_r, #endif +#ifdef CONFIG_SPI + init_func_spi; +#endif env_relocate_r, #ifdef CONFIG_PCI pci_init_r, diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 1863209..4a6d9f3 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -28,6 +28,7 @@ #include <net.h> #include <ide.h> #include <serial.h> +#include <spi.h> #include <status_led.h> #include <asm/processor.h> #include <asm/u-boot-x86.h> @@ -196,3 +197,11 @@ int set_load_addr_r(void)
return 0; } + +int init_func_spi(void) +{ + puts("SPI: "); + spi_init(); + puts("ready\n"); + return 0; +}

From: Gabe Black gabeblack@chromium.org
This changes the layout in decreasing addresses from:
1. Stack 2. Sections in the image 3. Heap
to
1. Sections in the image 2. Heap 3. Stack
This allows the stack to grow significantly more since it isn't constrained by the other u-boot areas. More importantly, the generic memory wipe code assumes that the stack is the lowest addressed area used by the main part of u-boot. In the original layout, that means that u-boot tramples all over itself. In the new layout, it works.
Signed-off-by: Gabe Black gabeblack@google.com Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/lib/init_helpers.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 4a6d9f3..6032ee5 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -96,16 +96,15 @@ int calculate_relocation_address(void) dest_addr &= ~15; gd->gdt_addr = dest_addr;
- /* Stack is below GDT */ - gd->start_addr_sp = dest_addr; - - /* U-Boot is below the stack */ - dest_addr -= CONFIG_SYS_STACK_SIZE; + /* U-Boot is below Global Data */ dest_addr -= (bss_end - text_start); dest_addr &= ~15; gd->relocaddr = dest_addr; gd->reloc_off = (dest_addr - text_start);
+ /* Stack is at the bottom, so it can grow down */ + gd->start_addr_sp = dest_addr - CONFIG_SYS_MALLOC_LEN; + return 0; }

From: Gabe Black gabeblack@chromium.org
This seems to be a bug.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/lib/relocate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c index c0b9b29..23edca9 100644 --- a/arch/x86/lib/relocate.c +++ b/arch/x86/lib/relocate.c @@ -80,7 +80,7 @@ int do_elf_reloc_fixups(void)
/* Check that the target points into .text */ if (*offset_ptr_ram >= CONFIG_SYS_TEXT_BASE && - *offset_ptr_ram < + *offset_ptr_ram <= (CONFIG_SYS_TEXT_BASE + size)) { *offset_ptr_ram += gd->reloc_off; }

From: Gabe Black gabeblack@chromium.org
Different systems may have different mechanisms for picking a suitable place to relocate U-Boot to.
Signed-off-by: Gabe Black gabeblack@chromium.org
Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/lib/init_helpers.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index 6032ee5..fc28af7 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -32,6 +32,7 @@ #include <status_led.h> #include <asm/processor.h> #include <asm/u-boot-x86.h> +#include <linux/compiler.h>
#include <asm/init_helpers.h>
@@ -72,7 +73,7 @@ int init_baudrate_f(void) return 0; }
-int calculate_relocation_address(void) +__weak int calculate_relocation_address(void) { ulong text_start = (ulong)&__text_start; /* keep .bss variables aligned */

From: Gabe Black gabeblack@chromium.org
Because calculate_relocation_address now uses the e820 map, it will be able to avoid addresses over 32 bits and regions that are at high addresses but not big enough for U-Boot. It also means we can remove the hack which limitted U-Boot's idea of the size of memory to less than 4GB.
Also take into account the space needed for the heap and stack, so we avoid picking a very small region those areas might overlap with something it shouldn't.
Signed-off-by: Gabe Black gabeblack@google.com Signed-off-by: Gabe Black gabeblack@google.com Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/coreboot/sdram.c | 53 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c index 5d3da99..611f554 100644 --- a/arch/x86/cpu/coreboot/sdram.c +++ b/arch/x86/cpu/coreboot/sdram.c @@ -51,6 +51,55 @@ unsigned install_e820_map(unsigned max_entries, struct e820entry *entries) return num_entries; }
+/* + * This function looks for the highest region of memory lower than 4GB which + * has enough space for U-Boot where U-Boot is aligned on a page boundary. It + * overrides the default implementation found elsewhere which simply picks the + * end of ram, wherever that may be. The location of the stack, the relocation + * address, and how far U-Boot is moved by relocation are set in the global + * data structure. + */ +int calculate_relocation_address(void) +{ + const uint64_t uboot_size = &__bss_end - &__text_start; + const uint64_t total_size = uboot_size + CONFIG_SYS_MALLOC_LEN + + CONFIG_SYS_STACK_SIZE; + uintptr_t dest_addr = 0; + int i; + + for (i = 0; i < lib_sysinfo.n_memranges; i++) { + struct memrange *memrange = &lib_sysinfo.memrange[i]; + /* Force U-Boot to relocate to a page aligned address. */ + uint64_t start = roundup(memrange->base, 1 << 12); + uint64_t end = memrange->base + memrange->size; + + /* Ignore non-memory regions. */ + if (memrange->type != CB_MEM_RAM) + continue; + + /* Filter memory over 4GB. */ + if (end > 0xffffffffULL) + end = 0x100000000ULL; + /* Skip this region if it's too small. */ + if (end - start < total_size) + continue; + + /* Use this address if it's the largest so far. */ + if (end - uboot_size > dest_addr) + dest_addr = (end - uboot_size) & ~((1 << 12) - 1); + } + + /* If no suitable area was found, return an error. */ + if (!dest_addr) + return 1; + + gd->start_addr_sp = dest_addr - CONFIG_SYS_MALLOC_LEN; + gd->relocaddr = dest_addr; + gd->reloc_off = dest_addr - (uintptr_t)&__text_start; + + return 0; +} + int dram_init_f(void) { int i; @@ -60,10 +109,6 @@ int dram_init_f(void) struct memrange *memrange = &lib_sysinfo.memrange[i]; unsigned long long end = memrange->base + memrange->size;
- /* Ignore memory over 4GB, we can't use it. */ - if (memrange->base > 0xffffffff) - continue; - if (memrange->type == CB_MEM_RAM && end > ram_size) ram_size = end; }

From: Gabe Black gabeblack@chromium.org
Because calculate_relocation_address now uses the e820 map, it will be able to avoid addresses over 32 bits and regions that are at high addresses but not big enough for U-Boot. It also means we can remove the hack which limitted U-Boot's idea of the size of memory to less than 4GB.
Also take into account the space needed for the heap and stack, so we avoid picking a very small region those areas might overlap with something it shouldn't.
Signed-off-by: Gabe Black gabeblack@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v2: - Update relocation for new link symbols, headers - Update relocation for new global data positioning - Update coreboot text base to fit with relocation scheme
arch/x86/cpu/coreboot/sdram.c | 61 +++++++++++++++++++++++++++++++++++++---- boards.cfg | 2 +- 2 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c index 5d3da99..76274cb 100644 --- a/arch/x86/cpu/coreboot/sdram.c +++ b/arch/x86/cpu/coreboot/sdram.c @@ -27,8 +27,9 @@ #include <asm/e820.h> #include <asm/u-boot-x86.h> #include <asm/global_data.h> -#include <asm/arch-coreboot/sysinfo.h> -#include <asm/arch-coreboot/tables.h> +#include <asm/processor.h> +#include <asm/arch/sysinfo.h> +#include <asm/arch/tables.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -51,6 +52,58 @@ unsigned install_e820_map(unsigned max_entries, struct e820entry *entries) return num_entries; }
+/* + * This function looks for the highest region of memory lower than 4GB which + * has enough space for U-Boot where U-Boot is aligned on a page boundary. It + * overrides the default implementation found elsewhere which simply picks the + * end of ram, wherever that may be. The location of the stack, the relocation + * address, and how far U-Boot is moved by relocation are set in the global + * data structure. + */ +int calculate_relocation_address(void) +{ + const uint64_t uboot_size = (uintptr_t)&__bss_end - + (uintptr_t)&__text_start; + const uint64_t total_size = uboot_size + CONFIG_SYS_MALLOC_LEN + + CONFIG_SYS_STACK_SIZE; + uintptr_t dest_addr = 0; + int i; + + for (i = 0; i < lib_sysinfo.n_memranges; i++) { + struct memrange *memrange = &lib_sysinfo.memrange[i]; + /* Force U-Boot to relocate to a page aligned address. */ + uint64_t start = roundup(memrange->base, 1 << 12); + uint64_t end = memrange->base + memrange->size; + + /* Ignore non-memory regions. */ + if (memrange->type != CB_MEM_RAM) + continue; + + /* Filter memory over 4GB. */ + if (end > 0xffffffffULL) + end = 0x100000000ULL; + /* Skip this region if it's too small. */ + if (end - start < total_size) + continue; + + /* Use this address if it's the largest so far. */ + if (end - uboot_size > dest_addr) + dest_addr = end; + } + + /* If no suitable area was found, return an error. */ + if (!dest_addr) + return 1; + + dest_addr -= uboot_size; + dest_addr &= ~((1 << 12) - 1); + gd->relocaddr = dest_addr; + gd->reloc_off = dest_addr - (uintptr_t)&__text_start; + gd->start_addr_sp = dest_addr - CONFIG_SYS_MALLOC_LEN; + + return 0; +} + int dram_init_f(void) { int i; @@ -60,10 +113,6 @@ int dram_init_f(void) struct memrange *memrange = &lib_sysinfo.memrange[i]; unsigned long long end = memrange->base + memrange->size;
- /* Ignore memory over 4GB, we can't use it. */ - if (memrange->base > 0xffffffff) - continue; - if (memrange->type == CB_MEM_RAM && end > ram_size) ram_size = end; } diff --git a/boards.cfg b/boards.cfg index ca9b12b..9093ecb 100644 --- a/boards.cfg +++ b/boards.cfg @@ -1099,7 +1099,7 @@ gr_cpci_ax2000 sparc leon3 - gaisler gr_ep2s60 sparc leon3 - gaisler grsim sparc leon3 - gaisler gr_xc3s_1500 sparc leon3 - gaisler -coreboot-x86 x86 x86 coreboot chromebook-x86 coreboot coreboot:SYS_TEXT_BASE=0xFC0000 +coreboot-x86 x86 x86 coreboot chromebook-x86 coreboot coreboot:SYS_TEXT_BASE=0x01110000 eNET x86 x86 eNET - sc520 eNET:SYS_TEXT_BASE=0x38040000 eNET_SRAM x86 x86 eNET - sc520 eNET:SYS_TEXT_BASE=0x19000000 # Target ARCH CPU Board name Vendor SoC Options

From: Gabe Black gabeblack@chromium.org
These were removed, but actually are useful.
Cold means that we started from a reset/power on. Warm means that we started from another U-Boot.
We determine whether u-boot on x86 was warm or cold booted (really if it started at the beginning of the text segment or at the ELF entry point). We plumb the result through to the global data structure.
Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/start.S | 10 +++++++++- arch/x86/cpu/start16.S | 3 +++ arch/x86/include/asm/global_data.h | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S index ee0dabe..acdd054 100644 --- a/arch/x86/cpu/start.S +++ b/arch/x86/cpu/start.S @@ -55,8 +55,16 @@ _x86boot_start: movl %eax, %cr0 wbinvd
+ /* Tell 32-bit code it is being entered from an in-RAM copy */ + movw $GD_FLG_WARM_BOOT, %bx + jmp 1f _start: - /* This is the 32-bit cold-reset entry point */ + /* + * This is the 32-bit cold-reset entry point. Initialize %bx to 0 + * in case we're preceeded by some sort of boot stub. + */ + movw $GD_FLG_COLD_BOOT, %bx +1:
/* Load the segement registes to match the gdt loaded in start16.S */ movl $(X86_GDT_ENTRY_32BIT_DS * X86_GDT_ENTRY_SIZE), %eax diff --git a/arch/x86/cpu/start16.S b/arch/x86/cpu/start16.S index cc393ff..603bf1d 100644 --- a/arch/x86/cpu/start16.S +++ b/arch/x86/cpu/start16.S @@ -37,6 +37,9 @@ .code16 .globl start16 start16: + /* Set the Cold Boot / Hard Reset flag */ + movl $GD_FLG_COLD_BOOT, %ebx + /* * First we let the BSP do some early initialization * this code have to map the flash to its final position diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index d3b6031..b3a6b50 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -77,6 +77,12 @@ static inline gd_t *get_fs_gd_ptr(void)
#include <asm-generic/global_data_flags.h>
+/* + * Our private Global Data Flags + */ +#define GD_FLG_COLD_BOOT 0x00100 /* Cold Boot */ +#define GD_FLG_WARM_BOOT 0x00200 /* Warm Boot */ + #define DECLARE_GLOBAL_DATA_PTR
#endif /* __ASM_GBL_DATA_H */

From: Stefan Reinauer reinauer@chromium.org
This option delays loading of the environment until later, so that only the default environment will be available to U-Boot.
This can address the security risk of untrusted data being used during boot.
When CONFIG_DELAY_ENVIRONMENT is defined, it is convenient to have a run-time way of enabling loadinlg of the environment. Add this to the fdt as /config/delay-environment.
Note: This patch depends on http://patchwork.ozlabs.org/patch/194342/
Signed-off-by: Simon Glass sjg@chromium.org Signed-off-by: Stefan Reinauer reinauer@chromium.org --- arch/x86/lib/init_wrappers.c | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/arch/x86/lib/init_wrappers.c b/arch/x86/lib/init_wrappers.c index 71449fe..cca018f 100644 --- a/arch/x86/lib/init_wrappers.c +++ b/arch/x86/lib/init_wrappers.c @@ -21,6 +21,7 @@ * MA 02111-1307 USA */ #include <common.h> +#include <environment.h> #include <serial.h> #include <kgdb.h> #include <scsi.h> @@ -36,10 +37,35 @@ int serial_initialize_r(void) return 0; }
+/* + * Tell if it's OK to load the environment early in boot. + * + * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see + * if this is OK (defaulting to saying it's not OK). + * + * NOTE: Loading the environment early can be a bad idea if security is + * important, since no verification is done on the environment. + * + * @return 0 if environment should not be loaded, !=0 if it is ok to load + */ +static int should_load_env(void) +{ +#ifdef CONFIG_OF_CONTROL + return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 0); +#elif defined CONFIG_DELAY_ENVIRONMENT + return 0; +#else + return 1; +#endif +} + int env_relocate_r(void) { /* initialize environment */ - env_relocate(); + if (should_load_env()) + env_relocate(); + else + set_default_env(NULL);
return 0; }

From: Gabe Black gabeblack@chromium.org
Allow a device tree to be provided through the standard mechanisms.
Signed-off-by: Gabe Black gabeblack@google.com Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/lib/board.c | 7 +++++++ arch/x86/lib/init_helpers.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index e0c5419..3093ea5 100644 --- a/arch/x86/lib/board.c +++ b/arch/x86/lib/board.c @@ -98,10 +98,17 @@ typedef int (init_fnc_t) (void); init_fnc_t *init_sequence_f[] = { cpu_init_f, board_early_init_f, +#ifdef CONFIG_OF_CONTROL + find_fdt, + fdtdec_check_fdt, +#endif env_init, init_baudrate_f, serial_init, console_init_f, +#ifdef CONFIG_OF_CONTROL + prepare_fdt, +#endif dram_init_f, calculate_relocation_address,
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c index fc28af7..4a94d96 100644 --- a/arch/x86/lib/init_helpers.c +++ b/arch/x86/lib/init_helpers.c @@ -205,3 +205,32 @@ int init_func_spi(void) puts("ready\n"); return 0; } + +#ifdef CONFIG_OF_CONTROL +int find_fdt(void) +{ +#ifdef CONFIG_OF_EMBED + /* Get a pointer to the FDT */ + gd->fdt_blob = _binary_dt_dtb_start; +#elif defined CONFIG_OF_SEPARATE + /* FDT is at end of image */ + gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE); +#endif + /* Allow the early environment to override the fdt address */ + gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16, + (uintptr_t)gd->fdt_blob); + + return 0; +} + +int prepare_fdt(void) +{ + /* For now, put this check after the console is ready */ + if (fdtdec_prepare_fdt()) { + panic("** CONFIG_OF_CONTROL defined but no FDT - please see " + "doc/README.fdt-control"); + } + + return 0; +} +#endif

From: Gabe Black gabeblack@chromium.org
We will use coreboot.dtsi as our fdt include file.
Signed-off-by: Gabe Black gabeblack@chromium.org
Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/coreboot/config.mk | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) create mode 100644 arch/x86/cpu/coreboot/config.mk
diff --git a/arch/x86/cpu/coreboot/config.mk b/arch/x86/cpu/coreboot/config.mk new file mode 100644 index 0000000..4858fc3 --- /dev/null +++ b/arch/x86/cpu/coreboot/config.mk @@ -0,0 +1,23 @@ +# +# Copyright (c) 2012 The Chromium OS Authors. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +CONFIG_ARCH_DEVICE_TREE := coreboot

This contains just the minimum information for a coreboot-based board.
Signed-off-by: Stefan Reinauer reinauer@chromium.org Signed-off-by: Gabe Black gabeblack@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/dts/coreboot.dtsi | 16 ++++++++++++++++ arch/x86/dts/skeleton.dtsi | 13 +++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) create mode 100644 arch/x86/dts/coreboot.dtsi create mode 100644 arch/x86/dts/skeleton.dtsi
diff --git a/arch/x86/dts/coreboot.dtsi b/arch/x86/dts/coreboot.dtsi new file mode 100644 index 0000000..4862a59 --- /dev/null +++ b/arch/x86/dts/coreboot.dtsi @@ -0,0 +1,16 @@ +/include/ "skeleton.dtsi" + +/ { + aliases { + console = "/serial"; + }; + + serial { + compatible = "ns16550"; + reg-shift = <1>; + io-mapped = <1>; + multiplier = <1>; + baudrate = <115200>; + status = "disabled"; + }; +}; diff --git a/arch/x86/dts/skeleton.dtsi b/arch/x86/dts/skeleton.dtsi new file mode 100644 index 0000000..b41d241 --- /dev/null +++ b/arch/x86/dts/skeleton.dtsi @@ -0,0 +1,13 @@ +/* + * Skeleton device tree; the bare minimum needed to boot; just include and + * add a compatible value. The bootloader will typically populate the memory + * node. + */ + +/ { + #address-cells = <1>; + #size-cells = <1>; + chosen { }; + aliases { }; + memory { device_type = "memory"; reg = <0 0>; }; +};

This contains just the minimum information for a coreboot-based board.
Signed-off-by: Stefan Reinauer reinauer@chromium.org Signed-off-by: Gabe Black gabeblack@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v2: - Update alex to use this include file - Add an empty link .dts which also uses this include file
arch/x86/dts/coreboot.dtsi | 16 +++++++++++++ arch/x86/dts/skeleton.dtsi | 13 ++++++++++ .../chromebook-x86/dts/{x86-alex.dts => alex.dts} | 18 +++++---------- board/chromebook-x86/dts/link.dts | 24 ++++++++++++++++++++ 4 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 arch/x86/dts/coreboot.dtsi create mode 100644 arch/x86/dts/skeleton.dtsi rename board/chromebook-x86/dts/{x86-alex.dts => alex.dts} (53%) create mode 100644 board/chromebook-x86/dts/link.dts
diff --git a/arch/x86/dts/coreboot.dtsi b/arch/x86/dts/coreboot.dtsi new file mode 100644 index 0000000..4862a59 --- /dev/null +++ b/arch/x86/dts/coreboot.dtsi @@ -0,0 +1,16 @@ +/include/ "skeleton.dtsi" + +/ { + aliases { + console = "/serial"; + }; + + serial { + compatible = "ns16550"; + reg-shift = <1>; + io-mapped = <1>; + multiplier = <1>; + baudrate = <115200>; + status = "disabled"; + }; +}; diff --git a/arch/x86/dts/skeleton.dtsi b/arch/x86/dts/skeleton.dtsi new file mode 100644 index 0000000..b41d241 --- /dev/null +++ b/arch/x86/dts/skeleton.dtsi @@ -0,0 +1,13 @@ +/* + * Skeleton device tree; the bare minimum needed to boot; just include and + * add a compatible value. The bootloader will typically populate the memory + * node. + */ + +/ { + #address-cells = <1>; + #size-cells = <1>; + chosen { }; + aliases { }; + memory { device_type = "memory"; reg = <0 0>; }; +}; diff --git a/board/chromebook-x86/dts/x86-alex.dts b/board/chromebook-x86/dts/alex.dts similarity index 53% rename from board/chromebook-x86/dts/x86-alex.dts rename to board/chromebook-x86/dts/alex.dts index bd90d18..cb6a9e4 100644 --- a/board/chromebook-x86/dts/x86-alex.dts +++ b/board/chromebook-x86/dts/alex.dts @@ -1,5 +1,7 @@ /dts-v1/;
+/include/ "coreboot.dtsi" + / { #address-cells = <1>; #size-cells = <1>; @@ -10,19 +12,11 @@ silent_console = <0>; };
- aliases { - console = "/serial@e0401000"; - }; + gpio: gpio {};
- serial@e0401000 { - compatible = "ns16550"; - reg = <0xe0401000 0x40>; - id = <1>; - reg-shift = <1>; - baudrate = <115200>; - clock-frequency = <4000000>; - multiplier = <1>; - status = "ok"; + serial { + reg = <0x3f8 8>; + clock-frequency = <115200>; };
chosen { }; diff --git a/board/chromebook-x86/dts/link.dts b/board/chromebook-x86/dts/link.dts new file mode 100644 index 0000000..af60f59 --- /dev/null +++ b/board/chromebook-x86/dts/link.dts @@ -0,0 +1,24 @@ +/dts-v1/; + +/include/ "coreboot.dtsi" + +/ { + #address-cells = <1>; + #size-cells = <1>; + model = "Google Link"; + compatible = "google,link", "intel,celeron-ivybridge"; + + config { + silent_console = <0>; + }; + + gpio: gpio {}; + + serial { + reg = <0x3f8 8>; + clock-frequency = <115200>; + }; + + chosen { }; + memory { device_type = "memory"; reg = <0 0>; }; +};

From: Stefan Reinauer reinauer@chromium.org
This helps us monitor boot progress and determine where U-Boot dies if there are any problems.
Signed-off-by: Stefan Reinauer reinauer@google.com
Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/coreboot/coreboot.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index d1be8ff..2912443 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -28,6 +28,7 @@ #include <netdev.h> #include <asm/msr.h> #include <asm/cache.h> +#include <asm/io.h> #include <asm/arch-coreboot/tables.h> #include <asm/arch-coreboot/sysinfo.h> #include <asm/arch/timestamp.h> @@ -68,6 +69,7 @@ int board_early_init_r(void)
void show_boot_progress(int val) { + outb(val, 0x80); }

From: Stefan Reinauer reinauer@chromium.org
This helps us monitor boot progress and determine where U-Boot dies if there are any problems.
Signed-off-by: Stefan Reinauer reinauer@google.com
Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v2: - Enable boot progress in coreboot config file
arch/x86/cpu/coreboot/coreboot.c | 2 ++ include/configs/coreboot.h | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index f262800..5a4c3e5 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -28,6 +28,7 @@ #include <netdev.h> #include <asm/msr.h> #include <asm/cache.h> +#include <asm/io.h> #include <asm/arch-coreboot/tables.h> #include <asm/arch-coreboot/sysinfo.h> #include <asm/arch/timestamp.h> @@ -68,6 +69,7 @@ int board_early_init_r(void)
void show_boot_progress(int val) { + outb(val, 0x80); }
diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index e45ecad..94b6917 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -35,7 +35,7 @@ * (easy to change) */ #define CONFIG_SYS_COREBOOT -#undef CONFIG_SHOW_BOOT_PROGRESS +#define CONFIG_SHOW_BOOT_PROGRESS #define CONFIG_LAST_STAGE_INIT #define CONFIG_X86_NO_RESET_VECTOR #define CONFIG_SYS_VSNPRINTF

From: Duncan Laurie dlaurie@chromium.org
Coreboot was always using MTRR 7 for the write-protect cache entry that covers the ROM and U-boot was removing it. However with 4GB configs we need more MTRRs for the BIOS and so the WP MTRR needs to move. Instead coreboot will always use the last available MTRR that is normally set aside for OS use and U-boot can clear it before the OS.
Signed-off-by: Duncan Laurie dlaurie@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/coreboot/coreboot.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index 2912443..ff42661 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -94,6 +94,8 @@ void setup_pcat_compatibility() { }
+#define MTRR_TYPE_WP 5 +#define MTRRcap_MSR 0xfe #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg)) #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
@@ -101,11 +103,20 @@ int board_final_cleanup(void) { /* Un-cache the ROM so the kernel has one * more MTRR available. + * + * Coreboot should have assigned this to the + * top available variable MTRR. */ - disable_cache(); - wrmsr(MTRRphysBase_MSR(7), 0); - wrmsr(MTRRphysMask_MSR(7), 0); - enable_cache(); + u8 top_mtrr = (rdmsr(MTRRcap_MSR) & 0xff) - 1; + u8 top_type = rdmsr(MTRRphysBase_MSR(top_mtrr)) & 0xff; + + /* Make sure this MTRR is the correct Write-Protected type */ + if (top_type == MTRR_TYPE_WP) { + disable_cache(); + wrmsr(MTRRphysBase_MSR(top_mtrr), 0); + wrmsr(MTRRphysMask_MSR(top_mtrr), 0); + enable_cache(); + }
return 0; }

From: Duncan Laurie dlaurie@chromium.org
Coreboot was always using MTRR 7 for the write-protect cache entry that covers the ROM and U-boot was removing it. However with 4GB configs we need more MTRRs for the BIOS and so the WP MTRR needs to move. Instead coreboot will always use the last available MTRR that is normally set aside for OS use and U-boot can clear it before the OS.
Signed-off-by: Duncan Laurie dlaurie@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v2: - Rebase to deal with cache code changes - Use functions from Graeme's msr patch
arch/x86/cpu/coreboot/coreboot.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index 5a4c3e5..f73977f 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -94,6 +94,8 @@ void setup_pcat_compatibility() { }
+#define MTRR_TYPE_WP 5 +#define MTRRcap_MSR 0xfe #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg)) #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
@@ -101,11 +103,20 @@ int board_final_cleanup(void) { /* Un-cache the ROM so the kernel has one * more MTRR available. + * + * Coreboot should have assigned this to the + * top available variable MTRR. */ - disable_caches(); - wrmsrl(MTRRphysBase_MSR(7), 0); - wrmsrl(MTRRphysMask_MSR(7), 0); - enable_caches(); + u8 top_mtrr = (native_read_msr(MTRRcap_MSR) & 0xff) - 1; + u8 top_type = native_read_msr(MTRRphysBase_MSR(top_mtrr)) & 0xff; + + /* Make sure this MTRR is the correct Write-Protected type */ + if (top_type == MTRR_TYPE_WP) { + disable_caches(); + wrmsrl(MTRRphysBase_MSR(top_mtrr), 0); + wrmsrl(MTRRphysMask_MSR(top_mtrr), 0); + enable_caches(); + }
return 0; }

From: Duncan Laurie dlaurie@chromium.org
This will write magic value to APMC command port which will trigger an SMI and cause coreboot to lock down the ME, chipset, and CPU.
Signed-off-by: Duncan Laurie dlaurie@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/coreboot/coreboot.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index ff42661..59d730e 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -118,5 +118,9 @@ int board_final_cleanup(void) enable_cache(); }
+ /* Issue SMI to Coreboot to lock down ME and registers */ + printf("Finalizing Coreboot\n"); + outb(0xcb, 0xb2); + return 0; }

From: Vadim Bendebury vbendeb@chromium.org
Some u-boot modules rely on availability of get_ticks() and get_tbclk() functions, reporting a free running clock and its frequency respectively. Traditionally these functions return number and frequency of timer interrupts.
Intel's core architecture processors however are known to run the rdtsc instruction at a constant rate of the so called 'Max Non Turbo ratio' times the external clock frequency which is 100MHz. This is just as good for the timer tick functions in question.
Signed-off-by: Vadim Bendebury vbendeb@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/interrupts.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c index 710b653..f841834 100644 --- a/arch/x86/cpu/interrupts.c +++ b/arch/x86/cpu/interrupts.c @@ -33,6 +33,8 @@ #include <asm/io.h> #include <asm/processor-flags.h> #include <linux/compiler.h> +#include <asm/msr.h> +#include <asm/u-boot-x86.h>
#define DECLARE_INTERRUPT(x) \ ".globl irq_"#x"\n" \ @@ -673,3 +675,32 @@ asm(".globl irq_common_entry\n" \ DECLARE_INTERRUPT(253) \ DECLARE_INTERRUPT(254) \ DECLARE_INTERRUPT(255)); + +#if defined(CONFIG_INTEL_CORE_ARCH) +/* + * Get the number of CPU time counter ticks since it was read first time after + * restart. This yields a free running counter guaranteed to take almost 6 + * years to wrap around even at 100GHz clock rate. + */ +u64 get_ticks(void) +{ + static u64 tick_base; + u64 now_tick = rdtsc(); + + if (!tick_base) + tick_base = now_tick; + + return now_tick - tick_base; +} + +#define PLATFORM_INFO_MSR 0xce + +unsigned long get_tbclk(void) +{ + u32 ratio; + u64 platform_info = rdmsr(PLATFORM_INFO_MSR); + + ratio = (platform_info >> 8) & 0xff; + return 100 * 1000 * 1000 * ratio; /* 100MHz times Max Non Turbo ratio */ +} +#endif

From: Vadim Bendebury vbendeb@chromium.org
Some u-boot modules rely on availability of get_ticks() and get_tbclk() functions, reporting a free running clock and its frequency respectively. Traditionally these functions return number and frequency of timer interrupts.
Intel's core architecture processors however are known to run the rdtsc instruction at a constant rate of the so called 'Max Non Turbo ratio' times the external clock frequency which is 100MHz. This is just as good for the timer tick functions in question.
Signed-off-by: Vadim Bendebury vbendeb@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v2: - Use functions from Graeme's msr patch
arch/x86/cpu/interrupts.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c index e788715..dd30a05 100644 --- a/arch/x86/cpu/interrupts.c +++ b/arch/x86/cpu/interrupts.c @@ -34,6 +34,8 @@ #include <asm/io.h> #include <asm/processor-flags.h> #include <linux/compiler.h> +#include <asm/msr.h> +#include <asm/u-boot-x86.h>
#define DECLARE_INTERRUPT(x) \ ".globl irq_"#x"\n" \ @@ -615,3 +617,32 @@ asm(".globl irq_common_entry\n" \ DECLARE_INTERRUPT(253) \ DECLARE_INTERRUPT(254) \ DECLARE_INTERRUPT(255)); + +#if defined(CONFIG_INTEL_CORE_ARCH) +/* + * Get the number of CPU time counter ticks since it was read first time after + * restart. This yields a free running counter guaranteed to take almost 6 + * years to wrap around even at 100GHz clock rate. + */ +u64 get_ticks(void) +{ + static u64 tick_base; + u64 now_tick = rdtsc(); + + if (!tick_base) + tick_base = now_tick; + + return now_tick - tick_base; +} + +#define PLATFORM_INFO_MSR 0xce + +unsigned long get_tbclk(void) +{ + u32 ratio; + u64 platform_info = native_read_msr(PLATFORM_INFO_MSR); + + ratio = (platform_info >> 8) & 0xff; + return 100 * 1000 * 1000 * ratio; /* 100MHz times Max Non Turbo ratio */ +} +#endif

From: Vadim Bendebury vbendeb@chromium.org
Some systems (like Google Link device) provide the ability to keep a history of the target CPU port80 accesses, which is extremely handy for debugging. The problem is that the EC handling port 80 access is orders of magnitude slower than the AP. This causes random loss of trace data.
This change allows to throttle port 80 accesses such that in case the AP is trying to post faster than the EC can handle, a delay is introduced to make sure that the post rate is throttled. Experiments have shown that on Link the delay should be at least 350,000 of tsc clocks.
Throttling is not being enabled by default: to enable it one would have to set MIN_PORT80_KCLOCKS_DELAY to something like 400 and rebuild the u-boot image. With upcoming EC code optimizations this number could be decreased (new new value should be established experimentally).
Signed-off-by: Vadim Bendebury vbendeb@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/coreboot/coreboot.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index 59d730e..da722e9 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -69,6 +69,27 @@ int board_early_init_r(void)
void show_boot_progress(int val) { +#if MIN_PORT80_KCLOCKS_DELAY + static uint32_t prev_stamp; + static uint32_t base; + + /* + * Scale the time counter reading to avoid using 64 bit arithmetics. + * Can't use get_timer() here becuase it could be not yet + * initialized or even implemented. + */ + if (!prev_stamp) { + base = rdtsc() / 1000; + prev_stamp = 0; + } else { + uint32_t now; + + do { + now = rdtsc() / 1000 - base; + } while (now < (prev_stamp + MIN_PORT80_KCLOCKS_DELAY)); + prev_stamp = now; + } +#endif outb(val, 0x80); }

From: Stefan Reinauer reinauer@chromium.org
... because that information is already "encoded" in the directory name.
Signed-off-by: Stefan Reinauer reinauer@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/coreboot/Makefile | 3 +-- arch/x86/cpu/coreboot/{coreboot_car.S => car.S} | 0 2 files changed, 1 insertions(+), 2 deletions(-) rename arch/x86/cpu/coreboot/{coreboot_car.S => car.S} (100%)
diff --git a/arch/x86/cpu/coreboot/Makefile b/arch/x86/cpu/coreboot/Makefile index 4612a3e..b1d3e95 100644 --- a/arch/x86/cpu/coreboot/Makefile +++ b/arch/x86/cpu/coreboot/Makefile @@ -33,6 +33,7 @@ include $(TOPDIR)/config.mk
LIB := $(obj)lib$(SOC).o
+SOBJS-$(CONFIG_SYS_COREBOOT) += car.o COBJS-$(CONFIG_SYS_COREBOOT) += coreboot.o COBJS-$(CONFIG_SYS_COREBOOT) += tables.o COBJS-$(CONFIG_SYS_COREBOOT) += ipchecksum.o @@ -40,8 +41,6 @@ COBJS-$(CONFIG_SYS_COREBOOT) += sdram.o COBJS-$(CONFIG_SYS_COREBOOT) += timestamp.o COBJS-$(CONFIG_PCI) += pci.o
-SOBJS-$(CONFIG_SYS_COREBOOT) += coreboot_car.o - SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
diff --git a/arch/x86/cpu/coreboot/coreboot_car.S b/arch/x86/cpu/coreboot/car.S similarity index 100% rename from arch/x86/cpu/coreboot/coreboot_car.S rename to arch/x86/cpu/coreboot/car.S

From: Stefan Reinauer reinauer@chromium.org
The function setup_pcat_compatibility() is weak and implemented as empty function in board.c hence we don't have to override that with another empty function.
monitor_flash_len is unused, drop it.
Signed-off-by: Stefan Reinauer reinauer@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/cpu/coreboot/coreboot.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index da722e9..a3a1a4e 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -35,8 +35,6 @@
DECLARE_GLOBAL_DATA_PTR;
-unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN; - /* * Miscellaneous platform dependent initializations */ @@ -93,7 +91,6 @@ void show_boot_progress(int val) outb(val, 0x80); }
- int last_stage_init(void) { return 0; @@ -111,10 +108,6 @@ int board_eth_init(bd_t *bis) return pci_eth_init(bis); }
-void setup_pcat_compatibility() -{ -} - #define MTRR_TYPE_WP 5 #define MTRRcap_MSR 0xfe #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))

From: Duncan Laurie dlaurie@chromium.org
This command will start erasing at memory address zero if there is not a valid framebuffer address that was found during video_init().
This is a common case with Chrome OS devices in normal mode when we do not execute the video option rom in coreboot.
Signed-off-by: Duncan Laurie dlaurie@chromium.org Signed-off-by: Simon Glass sjg@chromium.org --- drivers/video/cfb_console.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index c8d3e42..2b1f604 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -1976,6 +1976,7 @@ int video_get_screen_columns(void)
void video_clear(void) { - memsetl(video_fb_address, - (VIDEO_VISIBLE_ROWS * VIDEO_LINE_LEN) / sizeof(int), 0); + if (video_fb_address) + memsetl(video_fb_address, + (VIDEO_VISIBLE_ROWS * VIDEO_LINE_LEN) / sizeof(int), 0); }

This function is not intended to be exported from the video drivers, so remove the prototype. This fixes an error:
cfb_console.c:1793:12: error: static declaration of 'video_init' follows non-static declaration
Signed-off-by: Simon Glass sjg@chromium.org --- arch/x86/include/asm/u-boot-x86.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h index 11be5c3..99062e5 100644 --- a/arch/x86/include/asm/u-boot-x86.h +++ b/arch/x86/include/asm/u-boot-x86.h @@ -63,7 +63,6 @@ u32 isa_map_rom(u32 bus_addr, int size);
/* arch/x86/lib/... */ int video_bios_init(void); -int video_init(void);
void board_init_f_r_trampoline(ulong) __attribute__ ((noreturn)); void board_init_f_r(void) __attribute__ ((noreturn));

Enable the display on coreboot, using CFB.
Signed-off-by: Simon Glass sjg@chromium.org --- include/configs/coreboot.h | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index 7c9c7e4..e62d7aa 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -59,6 +59,7 @@ */ #define CONFIG_RTC_MC146818 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS 0 +#define CONFIG_SYS_ISA_IO CONFIG_SYS_ISA_IO_BASE_ADDRESS
/*----------------------------------------------------------------------- * Serial Configuration @@ -108,8 +109,13 @@ /*----------------------------------------------------------------------- * Video Configuration */ -#undef CONFIG_VIDEO -#undef CONFIG_CFB_CONSOLE +#define CONFIG_VIDEO +#define CONFIG_VIDEO_COREBOOT +#define CONFIG_VIDEO_SW_CURSOR +#define VIDEO_FB_16BPP_WORD_SWAP +#define CONFIG_I8042_KBD +#define CONFIG_CFB_CONSOLE +#define CONFIG_SYS_CONSOLE_INFO_QUIET
/*----------------------------------------------------------------------- * Command line configuration.

When running from coreboot we don't want this code, so make it optional.
Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v2: - Add new patch to remove video code, to avoid compile error
README | 7 +++++++ arch/x86/lib/Makefile | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/README b/README index c7aab18..0f5dfad 100644 --- a/README +++ b/README @@ -1409,6 +1409,13 @@ CBFS (Coreboot Filesystem) support boot. See the documentation file README.video for a description of this variable.
+ CONFIG_VIDEO_VGA + + Enable the VGA video / BIOS for x86. The alternative if you + are using coreboot is to use the coreboot frame buffer + driver. + + - Keyboard Support: CONFIG_KEYBOARD
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 2a3e8f0..0a52cc8 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -32,7 +32,7 @@ COBJS-y += realmode.o SOBJS-y += realmode_switch.o
COBJS-$(CONFIG_SYS_PC_BIOS) += bios_setup.o -COBJS-$(CONFIG_VIDEO) += video_bios.o +COBJS-$(CONFIG_VIDEO_VGA) += video_bios.o endif
COBJS-y += board.o @@ -50,7 +50,7 @@ COBJS-y += relocate.o COBJS-y += physmem.o COBJS-y += string.o COBJS-$(CONFIG_SYS_X86_ISR_TIMER) += timer.o -COBJS-$(CONFIG_VIDEO) += video.o +COBJS-$(CONFIG_VIDEO_VGA) += video.o COBJS-$(CONFIG_CMD_ZBOOT) += zimage.o
SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
participants (1)
-
Simon Glass