x86: Add support for running on bare hardware
Subsystems (5)
v2 cover x86: Add support for running on bare hardware
At present U-Boot's x86 support requires Coreboot to run first, starting up the CPU and then setting up SDRAM and video among other tasks. U-Boot then runs as a payload. Notably U-Boot does not handle the ACPI fun on x86 where the kernel can call back into the 'BIOS' to perform certain tasks.
This Coreboot + U-Boot method is used for link (Chromebook Pixel) and it works fairly well.
However this does not remove the need for all x86-specific init in U-Boot. For each generation of chipset we need to adjust U-Boot to make it work, albeit sometimes not a lot. In any case this work has not been done so the x86 port risks being stranded.
There are also a few disadvantages to using two separate boot loaders. When Coreboot decides not set to up the video card, it is not possible for U-Boot to go back and do this.
Building an image which has both boot loaders in itis a little tricky, particularly with the binary blobs that are required.
After some experimentation prompted by a discussion at ELCE, it was found that while x86 is somewhat different to most of the other architectures that U-Boot supports, it actually fits the model fairly well. There is nothing magic about getting the platform running. Also it turns out that x86 likes running before relocation with no DRAM, using global_data, relocating and then starting up the full U-Boot, all within the same image (Coreboot splits this into three programs which run one after the other). Perhaps this is because U-Boot was conceived before the more modern SoCs with SRAM, FAT file system code in the ROM, etc.
This series contains a basic port of U-Boot to a bare x86 environment. It would be targeted at some generally available board, such as the Minnowmax, except that it doesn't seem to be generally available, at least for me. So while that remains a goal, for now the port targets link. It is already supported in U-Boot and the platform is well understood.
The following are implemented in this series:
- ivybridge support with some peripherals enabled
- SDRAM init using a binary blob (Memory Reference Code)
- Use of Intel Management Engine via another binary blob
- microcode update from device tree
- ifttool for creating ROMs of the required format (u-boot.rom)
- GPIO
Notably missing are:
- PCI device support (USB, SATA)
- Video support
- MTRR setup (for performance)
- Real time clock
- Chrome OS EC
- Documentation
- Links to binary blobs
These will be addressed in a follow-up series. Things like ACPI and SMI will come later.
Unfortunately this series is quite long as it includes basic infrastructure needed on x86. But it is a solid step forward: with this series, link boots to a prompt.
This series is available at u-boot-x86/working
Changes in v2:
- Add a common early_init file
- Add mrc.bin dependency for u-boot.rom build rule
- Add new patch to rename chromebook-x86 to coreboot
- Add new patch to replace fill_processor_name() with cpu_get_name()
- Add new patch to tidy up timer code for Intel core architecture
- Adjust config to deal with changed x86-common.h
- Adjust to use asm/cpu.h header for cpuid
- Change commit message to indicate that SPDX license request is submitted
- Correct 'peripheral controller hub' to 'platform controller hub'
- Drop patch to move coreboot PCI into common cpu area
- Drop patch which removes the early_board_init() feature
- Expand the comment about preserving ebp
- Fix incorrect subl mnemonic in start.S
- Fix mangled cros_ec reg property
- Move SIPI code to after CAR init
- Move early init code into early_board_init
- Move some features out of the common file
- Remove definition of find_fdt() also
- Remove prepare_fdt() also
- Remove the cpuid functions since they were already added in another patch
- Remove use of PCI_CPU_DEVICE and use PCH_DEV instead
- Split out new patch to support use fo PCI before relocation
- Use capitals for all #define declarations
Simon Glass (33):
Move early malloc() to before arch_cpu_init()
fdt: Add a function to decode a variable-sized u32 array
dm: serial: Move current serial port pointer to global_data
dm: gpio: Add a function to read an ID from a list of GPIOs
x86: Add ifdtool for working with Intel Flash Descriptor ROM images
x86: config: Move common x86 configs to a common file
x86: Add processor functions to halt and get stack pointer
x86: Remove unnecessary find_fdt(), prepare_fdt() functions
x86: Replace fill_processor_name() with cpu_get_name()
x86: Tidy up timer code for Intel core architecture
x86: Add chromebook_link board
x86: Build a .rom file which can be flashed to an x86 machine
x86: Emit post codes in startup code for Chromebooks
x86: chromebook_link: Implement CAR support (cache as RAM)
x86: Refactor PCI to permit alternate init
x86: Support use of PCI before relocation
x86: ivybridge: Enable PCI in early init
x86: pci: Allow configuration before relocation
x86: ivybridge: Add early LPC init so that serial works
x86: Tidy up coreboot header usage
x86: Add clr/setbits functions
x86: Add msr read/write functions that use a structure
x86: ivybridge: Perform initial CPU setup
x86: ivybridge: Check BIST value on boot
x86: ivybridge: Perform Intel microcode update on boot
x86: dts: Add microcode updates for ivybridge CPU
x86: ivybridge: Add early init for PCH devices
x86: ivybridge: Add support for early GPIO init
x86: chromebook_link: Enable GPIO support
x86: Make show_boot_progress() common
x86: ivybridge: Add LAPIC support
x86: ivybridge: Implement SDRAM init
x86: Rename chromebook-x86 to coreboot
Makefile | 34 +-
arch/x86/Kconfig | 56 +-
arch/x86/cpu/Makefile | 1 +
arch/x86/cpu/coreboot/coreboot.c | 35 +-
arch/x86/cpu/coreboot/ipchecksum.c | 2 +-
arch/x86/cpu/coreboot/pci.c | 22 +-
arch/x86/cpu/coreboot/tables.c | 6 +-
arch/x86/cpu/cpu.c | 46 +-
arch/x86/cpu/interrupts.c | 28 -
arch/x86/cpu/ivybridge/Kconfig | 157 +++
arch/x86/cpu/ivybridge/Makefile | 16 +
arch/x86/cpu/ivybridge/car.S | 178 ++++
arch/x86/cpu/ivybridge/cpu.c | 357 +++++++
arch/x86/cpu/ivybridge/early_init.c | 145 +++
arch/x86/cpu/ivybridge/early_me.c | 191 ++++
arch/x86/cpu/ivybridge/lpc.c | 48 +
arch/x86/cpu/ivybridge/me_status.c | 195 ++++
arch/x86/cpu/ivybridge/microcode_intel.c | 151 +++
arch/x86/cpu/ivybridge/pci.c | 63 ++
arch/x86/cpu/ivybridge/report_platform.c | 98 ++
arch/x86/cpu/ivybridge/sdram.c | 571 +++++++++++
arch/x86/cpu/pci.c | 96 ++
arch/x86/cpu/start.S | 14 +-
arch/x86/dts/Makefile | 1 +
arch/x86/dts/chromebook_link.dts | 1 +
arch/x86/dts/link.dts | 125 +++
arch/x86/dts/m12206a7_00000028.dtsi | 622 ++++++++++++
arch/x86/dts/m12306a9_00000017.dtsi | 750 ++++++++++++++
arch/x86/include/asm/arch-coreboot/gpio.h | 5 -
arch/x86/include/asm/arch-ivybridge/gpio.h | 10 +
arch/x86/include/asm/arch-ivybridge/me.h | 356 +++++++
arch/x86/include/asm/arch-ivybridge/microcode.h | 20 +
arch/x86/include/asm/arch-ivybridge/model_206ax.h | 82 ++
arch/x86/include/asm/arch-ivybridge/pch.h | 356 +++++++
arch/x86/include/asm/arch-ivybridge/pei_data.h | 121 +++
arch/x86/include/asm/arch-ivybridge/sandybridge.h | 109 ++
arch/x86/include/asm/config.h | 1 +
arch/x86/include/asm/cpu.h | 11 +-
arch/x86/include/asm/global_data.h | 23 +
arch/x86/include/asm/gpio.h | 142 ++-
arch/x86/include/asm/init_helpers.h | 2 -
arch/x86/include/asm/io.h | 49 +
arch/x86/include/asm/lapic.h | 59 ++
arch/x86/include/asm/lapic_def.h | 101 ++
arch/x86/include/asm/msr.h | 19 +
arch/x86/include/asm/mtrr.h | 121 +++
arch/x86/include/asm/pci.h | 33 +
arch/x86/include/asm/post.h | 50 +
arch/x86/include/asm/processor.h | 21 +
arch/x86/include/asm/u-boot-x86.h | 2 +
arch/x86/lib/Makefile | 1 +
arch/x86/lib/init_helpers.c | 27 -
arch/x86/lib/ramtest.c | 79 ++
arch/x86/lib/tsc_timer.c | 16 +-
.../{chromebook-x86 => coreboot}/coreboot/Kconfig | 2 +-
.../coreboot/MAINTAINERS | 2 +-
.../{chromebook-x86 => coreboot}/coreboot/Makefile | 0
.../coreboot/coreboot.c | 0
.../coreboot/coreboot_start.S | 0
board/google/chromebook_link/Kconfig | 31 +
board/google/chromebook_link/MAINTAINERS | 6 +
board/google/chromebook_link/Makefile | 15 +
board/google/chromebook_link/link.c | 124 +++
board/google/common/Makefile | 7 +
board/google/common/early_init.S | 29 +
common/board_f.c | 7 +-
configs/chromebook_link_defconfig | 10 +
doc/device-tree-bindings/misc/intel-lpc.txt | 23 +
drivers/gpio/gpio-uclass.c | 19 +
drivers/gpio/intel_ich6_gpio.c | 79 +-
drivers/serial/serial-uclass.c | 35 +-
include/asm-generic/global_data.h | 1 +
include/asm-generic/gpio.h | 11 +-
include/configs/chromebook_link.h | 74 ++
include/configs/coreboot.h | 265 +----
include/configs/x86-common.h | 251 +++++
include/fdtdec.h | 18 +
lib/fdtdec.c | 22 +
tools/Makefile | 2 +
tools/ifdtool.c | 1039 ++++++++++++++++++++
tools/ifdtool.h | 88 ++
81 files changed, 7566 insertions(+), 419 deletions(-)
create mode 100644 arch/x86/cpu/ivybridge/Kconfig
create mode 100644 arch/x86/cpu/ivybridge/Makefile
create mode 100644 arch/x86/cpu/ivybridge/car.S
create mode 100644 arch/x86/cpu/ivybridge/cpu.c
create mode 100644 arch/x86/cpu/ivybridge/early_init.c
create mode 100644 arch/x86/cpu/ivybridge/early_me.c
create mode 100644 arch/x86/cpu/ivybridge/lpc.c
create mode 100644 arch/x86/cpu/ivybridge/me_status.c
create mode 100644 arch/x86/cpu/ivybridge/microcode_intel.c
create mode 100644 arch/x86/cpu/ivybridge/pci.c
create mode 100644 arch/x86/cpu/ivybridge/report_platform.c
create mode 100644 arch/x86/cpu/ivybridge/sdram.c
create mode 100644 arch/x86/cpu/pci.c
create mode 120000 arch/x86/dts/chromebook_link.dts
create mode 100644 arch/x86/dts/m12206a7_00000028.dtsi
create mode 100644 arch/x86/dts/m12306a9_00000017.dtsi
create mode 100644 arch/x86/include/asm/arch-ivybridge/gpio.h
create mode 100644 arch/x86/include/asm/arch-ivybridge/me.h
create mode 100644 arch/x86/include/asm/arch-ivybridge/microcode.h
create mode 100644 arch/x86/include/asm/arch-ivybridge/model_206ax.h
create mode 100644 arch/x86/include/asm/arch-ivybridge/pch.h
create mode 100644 arch/x86/include/asm/arch-ivybridge/pei_data.h
create mode 100644 arch/x86/include/asm/arch-ivybridge/sandybridge.h
create mode 100644 arch/x86/include/asm/lapic.h
create mode 100644 arch/x86/include/asm/lapic_def.h
create mode 100644 arch/x86/include/asm/mtrr.h
create mode 100644 arch/x86/include/asm/post.h
create mode 100644 arch/x86/lib/ramtest.c
rename board/{chromebook-x86 => coreboot}/coreboot/Kconfig (86%)
rename board/{chromebook-x86 => coreboot}/coreboot/MAINTAINERS (78%)
rename board/{chromebook-x86 => coreboot}/coreboot/Makefile (100%)
rename board/{chromebook-x86 => coreboot}/coreboot/coreboot.c (100%)
rename board/{chromebook-x86 => coreboot}/coreboot/coreboot_start.S (100%)
create mode 100644 board/google/chromebook_link/Kconfig
create mode 100644 board/google/chromebook_link/MAINTAINERS
create mode 100644 board/google/chromebook_link/Makefile
create mode 100644 board/google/chromebook_link/link.c
create mode 100644 board/google/common/Makefile
create mode 100644 board/google/common/early_init.S
create mode 100644 configs/chromebook_link_defconfig
create mode 100644 doc/device-tree-bindings/misc/intel-lpc.txt
create mode 100644 include/configs/chromebook_link.h
create mode 100644 include/configs/x86-common.h
create mode 100644 tools/ifdtool.c
create mode 100644 tools/ifdtool.hSignature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 1/33 Move early malloc() to before arch_cpu_init()
For some CPUs, having malloc() available very early is useful. There is no reason to delay this since early malloc is allocated before board_init_f() is called.
Move early malloc() init nearer to the start of the init sequence.
---
Changes in v2: None
common/board_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +1 -1
@@ -812,6 +812,7 @@ static init_fnc_t init_sequence_f[] = { setup_mon_len, setup_fdt, trace_early_init, + initf_malloc, #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)/* TODO: can this go into arch_cpu_init()? */ probecpu,
@@ -826,7 +827,6 @@ static init_fnc_t init_sequence_f[] = {#ifdef CONFIG_OF_CONTROL fdtdec_check_fdt, #endif - initf_malloc, initf_dm,#if defined(CONFIG_BOARD_EARLY_INIT_F ) board_early_init_f,
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 1/33 Move early malloc() to before arch_cpu_init()
Quoted 7 lines · Simon Glass
For some CPUs, having
malloc()available very early is useful. There is no reason to delay this since early malloc is allocated beforeboard_init_f()is called.Move early
malloc()init nearer to the start of the init sequence.Signed-off-by Simon Glass <[email protected]>
Applied to u-boot-x86.
PATCH v2 2/33 fdt: Add a function to decode a variable-sized u32 array
In reply to Simon GlassSometimes an array can be of variable size up to a maximum. Add a helper function to decode this.
---
Changes in v2: None
include/fdtdec.h | 16 ++++++++++++++++ lib/fdtdec.c | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+)
include/fdtdec.h +16 -0
@@ -445,6 +445,22 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name, u32 *array, int count);/** +* Look up a property in a node and return its contents in an integer +* array of given length. The property must exist but may have less data that +* expected (4*count bytes). It may have more, but this will be ignored. +* +* @param blob FDT blob +* @param node node to examine +* @param prop_name name of property to find +* @param array array to fill with data +* @param count number of array elements +* @return number of array elements if ok, or -FDT_ERR_NOTFOUND if the +* property is not found +*/ +int fdtdec_get_int_array_count (const void *blob,int node, +const char *prop_name,u32 *array,int count); + +/** * Look up a property in a node and return a pointer to its contents as a * unsigned int array of given length. The property must have at least enough * data for the array ('count' cells). It may have more, but this will be
lib/fdtdec.c +20 -0
@@ -485,6 +485,26 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,return err; } +int fdtdec_get_int_array_count (const void *blob,int node, +const char *prop_name,u32 *array,int count) +{ +const u32 *cell; +int len, elems; +int i; + +debug ("%s: %s\n" , __func__, prop_name); + cell =fdt_getprop (blob, node, prop_name, &len); +if (!cell) +return -FDT_ERR_NOTFOUND ; + elems = len /sizeof (u32); +if (count > elems) + count = elems; +for (i =0 ; i < count; i++) + array[i] =fdt32_to_cpu (cell[i]); + +return count; +} +const u32 *fdtdec_locate_array (const void *blob,int node,const char *prop_name,int count) {
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 2/33 fdt: Add a function to decode a variable-sized u32 array
Quoted 11 lines · Simon Glass
Sometimes an array can be of variable size up to a maximum. Add a helper function to decode this.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
include/fdtdec.h | 16 ++++++++++++++++ lib/fdtdec.c | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+)
Applied to u-boot-x86.
PATCH v2 3/33 dm: serial: Move current serial port pointer to global_data
In reply to Simon GlassIn general we can't store things in the data section until we have inited SDRAM. Some platforms allow this (e.g. those with SPL) but some don't. Move the pointer to global_data so that it will work on all platforms.
Without this fix the serial port will not work prior to relocation with driver model on some platforms.
---
Changes in v2: None
drivers/serial/serial-uclass.c | 35 +++++++++++++++++++---------------- include/asm-generic/global_data.h | 1 + 2 files changed, 20 insertions(+), 16 deletions(-)
drivers/serial/serial-uclass.c +19 -16
@@ -19,15 +19,14 @@DECLARE_GLOBAL_DATA_PTR ; -/* The currently-selected console serial device */ -struct udevice *cur_dev __attribute__ ((section(".data"))); -#ifndef CONFIG_SYS_MALLOC_F_LEN #error "Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to make this work"#endif static void serial_find_console_or_panic (void ) { +struct udevice *dev; +#ifdef CONFIG_OF_CONTROL int node;
@@ -35,18 +34,21 @@ static void serial_find_console_or_panic(void) node =fdtdec_get_chosen_node (gd->fdt_blob,"stdout-path" );if (node <0 ) node =fdtdec_get_alias_node (gd->fdt_blob,"console" ); -if (!uclass_get_device_by_of_offset (UCLASS_SERIAL , node, &cur_dev)) +if (!uclass_get_device_by_of_offset (UCLASS_SERIAL , node, &dev)) { + gd->cur_serial_dev = dev;return ; + }/* * If the console is not marked to be bound before relocation, bind * it anyway. */ if (node >0 && - !lists_bind_fdt (gd->dm_root, gd->fdt_blob, node, &cur_dev)) { -if (!device_probe (cur_dev)) + !lists_bind_fdt (gd->dm_root, gd->fdt_blob, node, &dev)) { +if (!device_probe (dev)) { + gd->cur_serial_dev = dev;return ; - cur_dev =NULL ; + } }#endif /*
@@ -61,11 +63,12 @@ static void serial_find_console_or_panic(void)#else #define INDEX 0#endif -if (uclass_get_device_by_seq (UCLASS_SERIAL ,INDEX , &cur_dev) && -uclass_get_device (UCLASS_SERIAL ,INDEX , &cur_dev) && - (uclass_first_device (UCLASS_SERIAL , &cur_dev) || !cur_dev)) +if (uclass_get_device_by_seq (UCLASS_SERIAL ,INDEX , &dev) && +uclass_get_device (UCLASS_SERIAL ,INDEX , &dev) && + (uclass_first_device (UCLASS_SERIAL , &dev) || !dev))panic ("No serial driver found" );#undef INDEX + gd->cur_serial_dev = dev; }/* Called prior to relocation */
@@ -127,30 +130,30 @@ static int _serial_tstc(struct udevice *dev)void serial_putc (char ch) { -_serial_putc (cur_dev, ch); +_serial_putc (gd->cur_serial_dev, ch); }void serial_puts (const char *str) { -_serial_puts (cur_dev, str); +_serial_puts (gd->cur_serial_dev, str); }int serial_getc (void ) { -return _serial_getc (cur_dev); +return _serial_getc (gd->cur_serial_dev); }int serial_tstc (void ) { -return _serial_tstc (cur_dev); +return _serial_tstc (gd->cur_serial_dev); }void serial_setbrg (void ) { -struct dm_serial_ops *ops =serial_get_ops (cur_dev); +struct dm_serial_ops *ops =serial_get_ops (gd->cur_serial_dev);if (ops->setbrg) - ops->setbrg (cur_dev, gd->baudrate); + ops->setbrg (gd->cur_serial_dev, gd->baudrate); }void serial_stdio_init (void )
include/asm-generic/global_data.h +1 -0
@@ -91,6 +91,7 @@ typedef struct global_data {unsigned long malloc_limit;/* limit address */ unsigned long malloc_ptr;/* current address */ #endif +struct udevice *cur_serial_dev;/* current serial device */ struct arch_global_data arch; /* architecture-specific data */ } gd_t;#endif
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 3/33 dm: serial: Move current serial port pointer to global_data
Quoted 7 lines · Simon Glass
In general we can't store things in the data section until we have inited SDRAM. Some platforms allow this (e.g. those with SPL) but some don't. Move the pointer to
global_dataso that it will work on all platforms.Without this fix the serial port will not work prior to relocation with driver model on some platforms.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
drivers/serial/serial-uclass.c | 35 +++++++++++++++++++---------------- include/asm-generic/global_data.h | 1 + 2 files changed, 20 insertions(+), 16 deletions(-)
Applied to u-boot-x86.
PATCH v2 4/33 dm: gpio: Add a function to read an ID from a list of GPIOs
In reply to Simon GlassFor board IDs a common approach is to set aside several GPIOs for use in determining the board ID. This can provide information about board features and the revision.
Add a function that turns a list of GPIOs into an integer by assigning each GPIO to a single bit.
---
Changes in v2: None
drivers/gpio/gpio-uclass.c | 19 +++++++++++++++++++ include/asm-generic/gpio.h | 11 ++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-)
drivers/gpio/gpio-uclass.c +19 -0
@@ -390,6 +390,25 @@ int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize)return 0 ; } +/* +* get a number comprised of multiple GPIO values. gpio_num_array points to +* the array of gpio pin numbers to scan, terminated by -1. +*/ +unsigned gpio_get_values_as_int (const int *gpio_num_array) +{ +int gpio; +unsigned bitmask =1 ; +unsigned vector =0 ; + +while (bitmask && + ((gpio = *gpio_num_array++) !=-1 )) { +if (gpio_get_value (gpio)) + vector |= bitmask; + bitmask <<=1 ; + } +return vector; +} +/* We need to renumber the GPIOs when any driver is probed/removed */ static int gpio_renumber (struct udevice *removed_dev) {
include/asm-generic/gpio.h +10 -1
@@ -257,6 +257,15 @@ const char *gpio_get_bank_info(struct udevice *dev, int *offset_count);int gpio_lookup_name (const char *name,struct udevice **devp,unsigned int *offsetp,unsigned int *gpiop); -int name_to_gpio (const char *name); +/** +* get_gpios() - Turn the values of a list of GPIOs into an integer +* +* This puts the value of the first GPIO into bit 0, the second into bit 1, +* etc. then returns the resulting integer. +* +* @gpio_list: List of GPIOs to collect +* @return resulting integer value +*/ +unsigned gpio_get_values_as_int (const int *gpio_list);#endif /* _ASM_GENERIC_GPIO_H_ */
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 4/33 dm: gpio: Add a function to read an ID from a list of GPIOs
Quoted 7 lines · Simon Glass
For board IDs a common approach is to set aside several GPIOs for use in determining the board ID. This can provide information about board features and the revision.
Add a function that turns a list of GPIOs into an integer by assigning each GPIO to a single bit.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
drivers/gpio/gpio-uclass.c | 19 +++++++++++++++++++ include/asm-generic/gpio.h | 11 ++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-)
Applied to u-boot-x86.
PATCH v2 5/33 x86: Add ifdtool for working with Intel Flash Descriptor ROM images
In reply to Simon GlassNewer Intel chips require a Management Engine which requires a particular format for the SPI flash that contains the boot loader. Add a tool that supports creating and modifying these ROM images.
This tool is from Chrome OS but has been cleaned up to use U-Boot style and to add comments. A few features have been added also.
---
Changes in v2: None
tools/Makefile | 2 + tools/ifdtool.c | 1039 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/ifdtool.h | 88 +++++ 3 files changed, 1129 insertions(+) create mode 100644 tools/ifdtool.c create mode 100644 tools/ifdtool.h
tools/Makefile +2 -0
@@ -126,6 +126,8 @@ hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl HOSTCFLAGS_mkexynosspl.o := -pedantic +hostprogs-$(CONFIG_X86) += ifdtool + hostprogs-$(CONFIG_MX23) += mxsboot hostprogs-$(CONFIG_MX28) += mxsboot HOSTCFLAGS_mxsboot.o := -pedantic
tools/ifdtool.c new file +1039 -0
1,039 lines not on this page · raw message
tools/ifdtool.h new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 5/33 x86: Add ifdtool for working with Intel Flash Descriptor ROM images
Quoted 10 lines · Simon Glass
Newer Intel chips require a Management Engine which requires a particular format for the SPI flash that contains the boot loader. Add a tool that supports creating and modifying these ROM images.
This tool is from Chrome OS but has been cleaned up to use U-Boot style and to add comments. A few features have been added also.
Signed-off-by Simon Glass <[email protected]>---
Quoted 8 lines
Changes in v2: None
tools/Makefile | 2 + tools/ifdtool.c | 1039 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/ifdtool.h | 88 +++++ 3 files changed, 1129 insertions(+) create mode 100644 tools/ifdtool.c create mode 100644 tools/ifdtool.h
Applied to u-boot-x86.
PATCH v2 6/33 x86: config: Move common x86 configs to a common file
In reply to Simon GlassMany of the x86 CONFIG options will be common across different boards. Move them to a common file.
---
Changes in v2:
- Move some features out of the common file
include/configs/coreboot.h | 265 ++----------------------------------------- include/configs/x86-common.h | 251 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 260 insertions(+), 256 deletions(-) create mode 100644 include/configs/x86-common.h
include/configs/coreboot.h +9 -256
@@ -6,7 +6,6 @@* SPDX-License-Identifier: GPL-2.0+ */ -#include <asm/ibmpc.h> /* * board/config.h - configuration options, board specific */
@@ -14,27 +13,23 @@#ifndef __CONFIG_H#define __CONFIG_H +#include <configs/x86-common.h> +/* * High Level Configuration Options * (easy to change) */ #define CONFIG_SYS_COREBOOT -#define CONFIG_SHOW_BOOT_PROGRESS #define CONFIG_LAST_STAGE_INIT -#define CONFIG_SYS_VSNPRINTF -#define CONFIG_ZBOOT_32 -#define CONFIG_PHYSMEM #define CONFIG_SYS_EARLY_PCI_INIT -#define CONFIG_DISPLAY_BOARDINFO_LATE -#define CONFIG_DISPLAY_CPUINFO -#define CONFIG_DM -#define CONFIG_CMD_DM -#define CONFIG_DM_GPIO -#define CONFIG_DM_SERIAL +#define CONFIG_SYS_CAR_ADDR 0x19200000 +#define CONFIG_SYS_CAR_SIZE (16 * 1024) +#define CONFIG_SYS_MONITOR_LEN (256 * 1024) -#define CONFIG_LMB -#define CONFIG_OF_LIBFDT +#define CONFIG_TRACE_EARLY_SIZE (8 << 20) +#define CONFIG_TRACE_EARLY +#define CONFIG_TRACE_EARLY_ADDR 0x01400000#define CONFIG_BOOTSTAGE #define CONFIG_BOOTSTAGE_REPORT
@@ -45,26 +40,6 @@#define CONFIG_BOOTSTAGE_STASH_SIZE 0x7fc#define CONFIG_BOOTSTAGE_USER_COUNT 60 -#define CONFIG_LZO -#define CONFIG_FIT -#undef CONFIG_ZLIB -#undef CONFIG_GZIP -#define CONFIG_SYS_BOOTM_LEN (16 << 20) - -/*----------------------------------------------------------------------- -* Watchdog Configuration -*/ -#undef CONFIG_WATCHDOG -#undef CONFIG_HW_WATCHDOG - -/* SATA AHCI storage */ - -#define CONFIG_SCSI_AHCI - -#ifdef CONFIG_SCSI_AHCI -#define CONFIG_LIBATA -#define CONFIG_SYS_64BIT_LBA -#define CONFIG_SATA_INTEL 1#define CONFIG_SCSI_DEV_LIST {PCI_VENDOR_ID_INTEL, \ PCI_DEVICE_ID_INTEL_NM10_AHCI}, \ {PCI_VENDOR_ID_INTEL, \
@@ -74,249 +49,27 @@ {PCI_VENDOR_ID_INTEL , \ PCI_DEVICE_ID_INTEL_PANTHERPOINT_AHCI_MOBILE} -#define CONFIG_SYS_SCSI_MAX_SCSI_ID 2 -#define CONFIG_SYS_SCSI_MAX_LUN 1 -#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ - CONFIG_SYS_SCSI_MAX_LUN) -#endif - -/* Generic TPM interfaced through LPC bus */ -#define CONFIG_TPM -#define CONFIG_TPM_TIS_LPC -#define CONFIG_TPM_TIS_BASE_ADDRESS 0xfed40000 - -/*----------------------------------------------------------------------- -* Real Time Clock Configuration -*/ -#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 -*/ #define CONFIG_COREBOOT_SERIAL -#define CONFIG_SYS_NS16550 -#define CONFIG_BAUDRATE 115200 -#define CONFIG_SYS_BAUDRATE_TABLE {300, 600, 1200, 2400, 4800, \ - 9600, 19200, 38400, 115200} -#define CONFIG_SYS_NS16550_PORT_MAPPED #define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,serial\0" \ "stdout=vga,serial,cbmem\0" \ "stderr=vga,serial,cbmem\0" -#define CONFIG_CONSOLE_MUX -#define CONFIG_SYS_CONSOLE_IS_IN_ENV -#define CONFIG_SYS_STDIO_DEREGISTER #define CONFIG_CBMEM_CONSOLE -#define CONFIG_CMDLINE_EDITING -#define CONFIG_COMMAND_HISTORY -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER - -#define CONFIG_SUPPORT_VFAT -/************************************************************ -* ATAPI support (experimental) -************************************************************/ -#define CONFIG_ATAPI - -/************************************************************ -* DISK Partition support -************************************************************/ -#define CONFIG_EFI_PARTITION -#define CONFIG_DOS_PARTITION -#define CONFIG_MAC_PARTITION -#define CONFIG_ISO_PARTITION /* Experimental */ - -#define CONFIG_CMD_PART -#define CONFIG_CMD_CBFS -#define CONFIG_CMD_EXT4 -#define CONFIG_CMD_EXT4_WRITE -#define CONFIG_PARTITION_UUIDS - -/*----------------------------------------------------------------------- -* Video Configuration -*/ -#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 -/* x86 GPIOs are accessed through a PCI device */ -#define CONFIG_INTEL_ICH6_GPIO - -/*----------------------------------------------------------------------- -* Command line configuration. -*/ -#include <config_cmd_default.h> +#define CONFIG_NR_DRAM_BANKS 4#define CONFIG_TRACE #define CONFIG_CMD_TRACE #define CONFIG_TRACE_BUFFER_SIZE (16 << 20) -#define CONFIG_TRACE_EARLY_SIZE (8 << 20) -#define CONFIG_TRACE_EARLY -#define CONFIG_TRACE_EARLY_ADDR 0x01400000 - -#define CONFIG_CMD_BDI -#define CONFIG_CMD_BOOTD -#define CONFIG_CMD_CONSOLE -#define CONFIG_CMD_DATE -#define CONFIG_CMD_ECHO -#undef CONFIG_CMD_FLASH -#define CONFIG_CMD_FPGA -#define CONFIG_CMD_FPGA_LOADMK -#define CONFIG_CMD_GPIO -#define CONFIG_CMD_IMI -#undef CONFIG_CMD_IMLS -#define CONFIG_CMD_IO -#define CONFIG_CMD_IRQ -#define CONFIG_CMD_ITEST -#define CONFIG_CMD_LOADB -#define CONFIG_CMD_LOADS -#define CONFIG_CMD_MEMORY -#define CONFIG_CMD_MISC -#define CONFIG_CMD_NET -#undef CONFIG_CMD_NFS -#define CONFIG_CMD_PCI -#define CONFIG_CMD_PING -#define CONFIG_CMD_RUN -#define CONFIG_CMD_SAVEENV -#define CONFIG_CMD_SETGETDCR -#define CONFIG_CMD_SOURCE -#define CONFIG_CMD_TIME -#define CONFIG_CMD_GETTIME -#define CONFIG_CMD_XIMG -#define CONFIG_CMD_SCSI - -#define CONFIG_CMD_FAT -#define CONFIG_CMD_EXT2 - -#define CONFIG_CMD_ZBOOT -#define CONFIG_CMD_ELF #define CONFIG_BOOTDELAY 2 -#define CONFIG_BOOTARGS \ - "root=/dev/sdb3 init=/sbin/init rootwait ro" -#define CONFIG_BOOTCOMMAND \ - "ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" - - -#if defined(CONFIG_CMD_KGDB ) -#define CONFIG_KGDB_BAUDRATE 115200 -#endif - -/* -* Miscellaneous configurable options -*/ -#define CONFIG_SYS_LONGHELP -#define CONFIG_SYS_CBSIZE 512 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ - sizeof(CONFIG_SYS_PROMPT) + \ - 16) -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE - -#define CONFIG_SYS_MEMTEST_START 0x00100000 -#define CONFIG_SYS_MEMTEST_END 0x01000000 -#define CONFIG_SYS_LOAD_ADDR 0x20000000 - -/*----------------------------------------------------------------------- -* SDRAM Configuration -*/ -#define CONFIG_NR_DRAM_BANKS 4 - -/* CONFIG_SYS_SDRAM_DRCTMCTL Overrides the following*/ -#undef CONFIG_SYS_SDRAM_PRECHARGE_DELAY -#undef CONFIG_SYS_SDRAM_RAS_CAS_DELAY -#undef CONFIG_SYS_SDRAM_CAS_LATENCY_2T -#undef CONFIG_SYS_SDRAM_CAS_LATENCY_3T - -/*----------------------------------------------------------------------- -* CPU Features -*/ - -#define CONFIG_SYS_X86_TSC_TIMER -#define CONFIG_SYS_PCAT_INTERRUPTS -#define CONFIG_SYS_PCAT_TIMER -#define CONFIG_SYS_NUM_IRQS 16 - -/*----------------------------------------------------------------------- -* Memory organization: -* 32kB Stack -* 16kB Cache-As-RAM @ 0x19200000 -* 256kB Monitor -* (128kB + Environment Sector Size) malloc pool -*/ -#define CONFIG_SYS_STACK_SIZE (32 * 1024) -#define CONFIG_SYS_CAR_ADDR 0x19200000 -#define CONFIG_SYS_CAR_SIZE (16 * 1024) -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE -#define CONFIG_SYS_MONITOR_LEN (256 * 1024) -#define CONFIG_SYS_MALLOC_LEN (0x20000 + 128 * 1024) -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) - -/* allow to overwrite serial and ethaddr */ -#define CONFIG_ENV_OVERWRITE - -/*----------------------------------------------------------------------- -* FLASH configuration -*/ -#define CONFIG_ICH_SPI -#define CONFIG_SPI_FLASH -#define CONFIG_SPI_FLASH_MACRONIX -#define CONFIG_SPI_FLASH_WINBOND -#define CONFIG_SPI_FLASH_GIGADEVICE -#define CONFIG_SYS_NO_FLASH -#define CONFIG_CMD_SF -#define CONFIG_CMD_SF_TEST -#define CONFIG_CMD_SPI -#define CONFIG_SPI - -/*----------------------------------------------------------------------- -* Environment configuration -*/ -#define CONFIG_ENV_IS_NOWHERE -#define CONFIG_ENV_SIZE 0x01000 - -/*----------------------------------------------------------------------- -* PCI configuration -*/ -#define CONFIG_PCI #define CONFIG_CROS_EC #define CONFIG_CROS_EC_LPC #define CONFIG_CMD_CROS_EC #define CONFIG_ARCH_EARLY_INIT_R -/*----------------------------------------------------------------------- -* USB configuration -*/ -#define CONFIG_USB_EHCI -#define CONFIG_USB_EHCI_PCI -#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 12 -#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 -#define CONFIG_USB_STORAGE -#define CONFIG_USB_KEYBOARD -#define CONFIG_SYS_USB_EVENT_POLL - -#define CONFIG_USB_HOST_ETHER -#define CONFIG_USB_ETHER_ASIX -#define CONFIG_USB_ETHER_SMSC95XX -#define CONFIG_TFTP_TSIZE -#define CONFIG_CMD_DHCP -#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME - -#define CONFIG_CMD_USB - -#define CONFIG_EXTRA_ENV_SETTINGS \ - CONFIG_STD_DEVICES_SETTINGS -#endif /* __CONFIG_H */
include/configs/x86-common.h new file +251 -0
251 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 6/33 x86: config: Move common x86 configs to a common file
Quoted 588 lines · Simon Glass
Many of the x86 CONFIG options will be common across different boards. Move them to a common file.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Move some features out of the common fileinclude/configs/coreboot.h | 265 ++----------------------------------------- include/configs/x86-common.h | 251 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 260 insertions(+), 256 deletions(-) create mode 100644 include/configs/x86-common.hinclude/configs/coreboot.h +9
-256@@ -6,7 +6,6 @@* SPDX-License-Identifier: GPL-2.0+ */ -#include <asm/ibmpc.h> /* * board/config.h - configuration options, board specific */ @@ -14,27 +13,23 @@#ifndef __CONFIG_H#define __CONFIG_H +#include <configs/x86-common.h> +/* * High Level Configuration Options * (easy to change) */ #define CONFIG_SYS_COREBOOT -#define CONFIG_SHOW_BOOT_PROGRESS #define CONFIG_LAST_STAGE_INIT -#define CONFIG_SYS_VSNPRINTF -#define CONFIG_ZBOOT_32 -#define CONFIG_PHYSMEM #define CONFIG_SYS_EARLY_PCI_INIT -#define CONFIG_DISPLAY_BOARDINFO_LATE -#define CONFIG_DISPLAY_CPUINFO -#define CONFIG_DM -#define CONFIG_CMD_DM -#define CONFIG_DM_GPIO -#define CONFIG_DM_SERIAL +#define CONFIG_SYS_CAR_ADDR 0x19200000 +#define CONFIG_SYS_CAR_SIZE (16 * 1024) +#define CONFIG_SYS_MONITOR_LEN (256 * 1024) -#define CONFIG_LMB -#define CONFIG_OF_LIBFDT +#define CONFIG_TRACE_EARLY_SIZE (8 << 20) +#define CONFIG_TRACE_EARLY +#define CONFIG_TRACE_EARLY_ADDR 0x01400000#define CONFIG_BOOTSTAGE #define CONFIG_BOOTSTAGE_REPORT @@ -45,26 +40,6 @@#define CONFIG_BOOTSTAGE_STASH_SIZE 0x7fc#define CONFIG_BOOTSTAGE_USER_COUNT 60 -#define CONFIG_LZO -#define CONFIG_FIT -#undef CONFIG_ZLIB -#undef CONFIG_GZIP -#define CONFIG_SYS_BOOTM_LEN (16 << 20) - -/*----------------------------------------------------------------------- -* Watchdog Configuration -*/ -#undef CONFIG_WATCHDOG -#undef CONFIG_HW_WATCHDOG - -/* SATA AHCI storage */ - -#define CONFIG_SCSI_AHCI - -#ifdef CONFIG_SCSI_AHCI -#define CONFIG_LIBATA -#define CONFIG_SYS_64BIT_LBA -#define CONFIG_SATA_INTEL 1#define CONFIG_SCSI_DEV_LIST {PCI_VENDOR_ID_INTEL, \ PCI_DEVICE_ID_INTEL_NM10_AHCI}, \ {PCI_VENDOR_ID_INTEL, \@@ -74,249 +49,27 @@ {PCI_VENDOR_ID_INTEL , \ PCI_DEVICE_ID_INTEL_PANTHERPOINT_AHCI_MOBILE} -#define CONFIG_SYS_SCSI_MAX_SCSI_ID 2 -#define CONFIG_SYS_SCSI_MAX_LUN 1 -#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ - CONFIG_SYS_SCSI_MAX_LUN) -#endif - -/* Generic TPM interfaced through LPC bus */ -#define CONFIG_TPM -#define CONFIG_TPM_TIS_LPC -#define CONFIG_TPM_TIS_BASE_ADDRESS 0xfed40000 - -/*----------------------------------------------------------------------- -* Real Time Clock Configuration -*/ -#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 -*/ #define CONFIG_COREBOOT_SERIAL -#define CONFIG_SYS_NS16550 -#define CONFIG_BAUDRATE 115200 -#define CONFIG_SYS_BAUDRATE_TABLE {300, 600, 1200, 2400, 4800, \ - 9600, 19200, 38400, 115200} -#define CONFIG_SYS_NS16550_PORT_MAPPED #define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,serial\0" \ "stdout=vga,serial,cbmem\0" \ "stderr=vga,serial,cbmem\0" -#define CONFIG_CONSOLE_MUX -#define CONFIG_SYS_CONSOLE_IS_IN_ENV -#define CONFIG_SYS_STDIO_DEREGISTER #define CONFIG_CBMEM_CONSOLE -#define CONFIG_CMDLINE_EDITING -#define CONFIG_COMMAND_HISTORY -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER - -#define CONFIG_SUPPORT_VFAT -/************************************************************ -* ATAPI support (experimental) -************************************************************/ -#define CONFIG_ATAPI - -/************************************************************ -* DISK Partition support -************************************************************/ -#define CONFIG_EFI_PARTITION -#define CONFIG_DOS_PARTITION -#define CONFIG_MAC_PARTITION -#define CONFIG_ISO_PARTITION /* Experimental */ - -#define CONFIG_CMD_PART -#define CONFIG_CMD_CBFS -#define CONFIG_CMD_EXT4 -#define CONFIG_CMD_EXT4_WRITE -#define CONFIG_PARTITION_UUIDS - -/*----------------------------------------------------------------------- -* Video Configuration -*/ -#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 -/* x86 GPIOs are accessed through a PCI device */ -#define CONFIG_INTEL_ICH6_GPIO - -/*----------------------------------------------------------------------- -* Command line configuration. -*/ -#include <config_cmd_default.h> +#define CONFIG_NR_DRAM_BANKS 4#define CONFIG_TRACE #define CONFIG_CMD_TRACE #define CONFIG_TRACE_BUFFER_SIZE (16 << 20) -#define CONFIG_TRACE_EARLY_SIZE (8 << 20) -#define CONFIG_TRACE_EARLY -#define CONFIG_TRACE_EARLY_ADDR 0x01400000 - -#define CONFIG_CMD_BDI -#define CONFIG_CMD_BOOTD -#define CONFIG_CMD_CONSOLE -#define CONFIG_CMD_DATE -#define CONFIG_CMD_ECHO -#undef CONFIG_CMD_FLASH -#define CONFIG_CMD_FPGA -#define CONFIG_CMD_FPGA_LOADMK -#define CONFIG_CMD_GPIO -#define CONFIG_CMD_IMI -#undef CONFIG_CMD_IMLS -#define CONFIG_CMD_IO -#define CONFIG_CMD_IRQ -#define CONFIG_CMD_ITEST -#define CONFIG_CMD_LOADB -#define CONFIG_CMD_LOADS -#define CONFIG_CMD_MEMORY -#define CONFIG_CMD_MISC -#define CONFIG_CMD_NET -#undef CONFIG_CMD_NFS -#define CONFIG_CMD_PCI -#define CONFIG_CMD_PING -#define CONFIG_CMD_RUN -#define CONFIG_CMD_SAVEENV -#define CONFIG_CMD_SETGETDCR -#define CONFIG_CMD_SOURCE -#define CONFIG_CMD_TIME -#define CONFIG_CMD_GETTIME -#define CONFIG_CMD_XIMG -#define CONFIG_CMD_SCSI - -#define CONFIG_CMD_FAT -#define CONFIG_CMD_EXT2 - -#define CONFIG_CMD_ZBOOT -#define CONFIG_CMD_ELF #define CONFIG_BOOTDELAY 2 -#define CONFIG_BOOTARGS \ - "root=/dev/sdb3 init=/sbin/init rootwait ro" -#define CONFIG_BOOTCOMMAND \ - "ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" - - -#if defined(CONFIG_CMD_KGDB ) -#define CONFIG_KGDB_BAUDRATE 115200 -#endif - -/* -* Miscellaneous configurable options -*/ -#define CONFIG_SYS_LONGHELP -#define CONFIG_SYS_CBSIZE 512 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ - sizeof(CONFIG_SYS_PROMPT) + \ - 16) -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE - -#define CONFIG_SYS_MEMTEST_START 0x00100000 -#define CONFIG_SYS_MEMTEST_END 0x01000000 -#define CONFIG_SYS_LOAD_ADDR 0x20000000 - -/*----------------------------------------------------------------------- -* SDRAM Configuration -*/ -#define CONFIG_NR_DRAM_BANKS 4 - -/* CONFIG_SYS_SDRAM_DRCTMCTL Overrides the following*/ -#undef CONFIG_SYS_SDRAM_PRECHARGE_DELAY -#undef CONFIG_SYS_SDRAM_RAS_CAS_DELAY -#undef CONFIG_SYS_SDRAM_CAS_LATENCY_2T -#undef CONFIG_SYS_SDRAM_CAS_LATENCY_3T - -/*----------------------------------------------------------------------- -* CPU Features -*/ - -#define CONFIG_SYS_X86_TSC_TIMER -#define CONFIG_SYS_PCAT_INTERRUPTS -#define CONFIG_SYS_PCAT_TIMER -#define CONFIG_SYS_NUM_IRQS 16 - -/*----------------------------------------------------------------------- -* Memory organization: -* 32kB Stack -* 16kB Cache-As-RAM @ 0x19200000 -* 256kB Monitor -* (128kB + Environment Sector Size) malloc pool -*/ -#define CONFIG_SYS_STACK_SIZE (32 * 1024) -#define CONFIG_SYS_CAR_ADDR 0x19200000 -#define CONFIG_SYS_CAR_SIZE (16 * 1024) -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE -#define CONFIG_SYS_MONITOR_LEN (256 * 1024) -#define CONFIG_SYS_MALLOC_LEN (0x20000 + 128 * 1024) -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) - -/* allow to overwrite serial and ethaddr */ -#define CONFIG_ENV_OVERWRITE - -/*----------------------------------------------------------------------- -* FLASH configuration -*/ -#define CONFIG_ICH_SPI -#define CONFIG_SPI_FLASH -#define CONFIG_SPI_FLASH_MACRONIX -#define CONFIG_SPI_FLASH_WINBOND -#define CONFIG_SPI_FLASH_GIGADEVICE -#define CONFIG_SYS_NO_FLASH -#define CONFIG_CMD_SF -#define CONFIG_CMD_SF_TEST -#define CONFIG_CMD_SPI -#define CONFIG_SPI - -/*----------------------------------------------------------------------- -* Environment configuration -*/ -#define CONFIG_ENV_IS_NOWHERE -#define CONFIG_ENV_SIZE 0x01000 - -/*----------------------------------------------------------------------- -* PCI configuration -*/ -#define CONFIG_PCI #define CONFIG_CROS_EC #define CONFIG_CROS_EC_LPC #define CONFIG_CMD_CROS_EC #define CONFIG_ARCH_EARLY_INIT_R -/*----------------------------------------------------------------------- -* USB configuration -*/ -#define CONFIG_USB_EHCI -#define CONFIG_USB_EHCI_PCI -#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 12 -#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 -#define CONFIG_USB_STORAGE -#define CONFIG_USB_KEYBOARD -#define CONFIG_SYS_USB_EVENT_POLL - -#define CONFIG_USB_HOST_ETHER -#define CONFIG_USB_ETHER_ASIX -#define CONFIG_USB_ETHER_SMSC95XX -#define CONFIG_TFTP_TSIZE -#define CONFIG_CMD_DHCP -#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME - -#define CONFIG_CMD_USB - -#define CONFIG_EXTRA_ENV_SETTINGS \ - CONFIG_STD_DEVICES_SETTINGS -#endif /* __CONFIG_H */ include/configs/x86-common.h new file +242
-0@@ -0,0 +1,251 @@ +/* +* Copyright (c) 2011 The Chromium OS Authors. +* (C) Copyright 2008 +* Graeme Russ, graeme.russ at gmail.com. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <asm/ibmpc.h> + +#ifndef __CONFIG_X86_COMMON_H +#define __CONFIG_X86_COMMON_H + +/* +* High Level Configuration Options +* (easy to change) +*/ +#define CONFIG_SHOW_BOOT_PROGRESS +#define CONFIG_SYS_VSNPRINTF +#define CONFIG_ZBOOT_32 +#define CONFIG_PHYSMEM +#define CONFIG_DISPLAY_BOARDINFO_LATE +#define CONFIG_DISPLAY_CPUINFO + +#define CONFIG_DM +#define CONFIG_CMD_DM +#define CONFIG_DM_GPIO +#define CONFIG_DM_SERIAL + +#define CONFIG_LMB +#define CONFIG_OF_LIBFDT + +#define CONFIG_LZO +#define CONFIG_FIT +#undef CONFIG_ZLIB +#undef CONFIG_GZIP +#define CONFIG_SYS_BOOTM_LEN (16 << 20) + +/* SATA AHCI storage */ + +#define CONFIG_SCSI_AHCI +#define CONFIG_SATA_INTEL +#ifdef CONFIG_SCSI_AHCI +#define CONFIG_LIBATA +#define CONFIG_SYS_64BIT_LBA + +#define CONFIG_SYS_SCSI_MAX_SCSI_ID 2 +#define CONFIG_SYS_SCSI_MAX_LUN 1 +#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ + CONFIG_SYS_SCSI_MAX_LUN) +#endif + +/* Generic TPM interfaced through LPC bus */ +#define CONFIG_TPM +#define CONFIG_TPM_TIS_LPC +#define CONFIG_TPM_TIS_BASE_ADDRESS 0xfed40000 + +/*----------------------------------------------------------------------- +* Real Time Clock Configuration +*/ +#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 +*/ +#define CONFIG_SYS_NS16550 +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {300, 600, 1200, 2400, 4800, \ + 9600, 19200, 38400, 115200} +#define CONFIG_SYS_NS16550_PORT_MAPPED + +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#define CONFIG_SYS_STDIO_DEREGISTER + +#define CONFIG_CMDLINE_EDITING +#define CONFIG_COMMAND_HISTORY +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_HUSH_PARSER + +#define CONFIG_SUPPORT_VFAT +/************************************************************ +* ATAPI support (experimental) +************************************************************/ +#define CONFIG_ATAPI + +/************************************************************ +* DISK Partition support +************************************************************/ +#define CONFIG_EFI_PARTITION +#define CONFIG_DOS_PARTITION +#define CONFIG_MAC_PARTITION +#define CONFIG_ISO_PARTITION /* Experimental */ + +#define CONFIG_CMD_PART +#define CONFIG_CMD_CBFS +#define CONFIG_CMD_EXT4 +#define CONFIG_CMD_EXT4_WRITE +#define CONFIG_PARTITION_UUIDS + +#define CONFIG_SYS_CONSOLE_INFO_QUIET + +/* x86 GPIOs are accessed through a PCI device */ +#define CONFIG_INTEL_ICH6_GPIO + +/*----------------------------------------------------------------------- +* Command line configuration. +*/ +#include <config_cmd_default.h> + +#define CONFIG_CMD_BDI +#define CONFIG_CMD_BOOTD +#define CONFIG_CMD_CONSOLE +#define CONFIG_CMD_DATE +#define CONFIG_CMD_ECHO +#undef CONFIG_CMD_FLASH +#define CONFIG_CMD_FPGA +#define CONFIG_CMD_FPGA_LOADMK +#define CONFIG_CMD_GPIO +#define CONFIG_CMD_IMI +#undef CONFIG_CMD_IMLS +#define CONFIG_CMD_IO +#define CONFIG_CMD_IRQ +#define CONFIG_CMD_ITEST +#define CONFIG_CMD_LOADB +#define CONFIG_CMD_LOADS +#define CONFIG_CMD_MEMORY +#define CONFIG_CMD_MISC +#define CONFIG_CMD_NET +#undef CONFIG_CMD_NFS +#define CONFIG_CMD_PCI +#define CONFIG_CMD_PING +#define CONFIG_CMD_RUN +#define CONFIG_CMD_SAVEENV +#define CONFIG_CMD_SETGETDCR +#define CONFIG_CMD_SOURCE +#define CONFIG_CMD_TIME +#define CONFIG_CMD_GETTIME +#define CONFIG_CMD_XIMG +#define CONFIG_CMD_SCSI + +#define CONFIG_CMD_FAT +#define CONFIG_CMD_EXT2 + +#define CONFIG_CMD_ZBOOT +#define CONFIG_CMD_ELF + +#define CONFIG_BOOTARGS \ + "root=/dev/sdb3 init=/sbin/init rootwait ro" +#define CONFIG_BOOTCOMMAND \ + "ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000" + +#if defined(CONFIG_CMD_KGDB ) +#define CONFIG_KGDB_BAUDRATE 115200 +#endif + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_SYS_LONGHELP +#define CONFIG_SYS_CBSIZE 512 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + \ + 16) +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_MEMTEST_START 0x00100000 +#define CONFIG_SYS_MEMTEST_END 0x01000000 +#define CONFIG_SYS_LOAD_ADDR 0x20000000 + +/*----------------------------------------------------------------------- +* Video Configuration +*/ +#define CONFIG_VIDEO +#define CONFIG_VIDEO_SW_CURSOR +#define VIDEO_FB_16BPP_WORD_SWAP +#define CONFIG_I8042_KBD +#define CONFIG_CFB_CONSOLE + +/*----------------------------------------------------------------------- +* CPU Features +*/ + +#define CONFIG_SYS_X86_TSC_TIMER +#define CONFIG_SYS_PCAT_INTERRUPTS +#define CONFIG_SYS_PCAT_TIMER +#define CONFIG_SYS_NUM_IRQS 16 + +#define CONFIG_SYS_STACK_SIZE (32 * 1024) +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE +#define CONFIG_SYS_MALLOC_LEN 0x200000 +#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE + +/*----------------------------------------------------------------------- +* FLASH configuration +*/ +#define CONFIG_ICH_SPI +#define CONFIG_SPI_FLASH +#define CONFIG_SPI_FLASH_MACRONIX +#define CONFIG_SPI_FLASH_WINBOND +#define CONFIG_SPI_FLASH_GIGADEVICE +#define CONFIG_SYS_NO_FLASH +#define CONFIG_CMD_SF +#define CONFIG_CMD_SF_TEST +#define CONFIG_CMD_SPI +#define CONFIG_SPI + +/*----------------------------------------------------------------------- +* Environment configuration +*/ +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE 0x01000 + +/*----------------------------------------------------------------------- +* PCI configuration +*/ +#define CONFIG_PCI + +/*----------------------------------------------------------------------- +* USB configuration +*/ +#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_PCI +#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 12 +#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 +#define CONFIG_USB_STORAGE +#define CONFIG_USB_KEYBOARD +#define CONFIG_SYS_USB_EVENT_POLL + +#define CONFIG_USB_HOST_ETHER +#define CONFIG_USB_ETHER_ASIX +#define CONFIG_USB_ETHER_SMSC95XX +#define CONFIG_TFTP_TSIZE +#define CONFIG_CMD_DHCP +#define CONFIG_BOOTP_BOOTFILESIZE +#define CONFIG_BOOTP_BOOTPATH
include/configs/x86-common.h
Quoted 10 lines
include/configs/x86-common.h new file +9
-1+#define CONFIG_BOOTP_GATEWAY +#define CONFIG_BOOTP_HOSTNAME + +#define CONFIG_CMD_USB + +#define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_STD_DEVICES_SETTINGS + +#endif /* __CONFIG_H */ --
Regards,
Bin
PATCH v2 6/33 x86: config: Move common x86 configs to a common file
Quoted 15 lines · Bin Meng
Quoted 14 lines · Simon Glass
Many of the x86 CONFIG options will be common across different boards. Move them to a common file.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Move some features out of the common fileinclude/configs/coreboot.h | 265 ++----------------------------------------- include/configs/x86-common.h | 251 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 260 insertions(+), 256 deletions(-) create mode 100644 include/configs/x86-common.h
[snip]
Quoted 2 lines
Reviewed-by Bin Meng <[email protected]>
Applied to u-boot-x86.
PATCH v2 7/33 x86: Add processor functions to halt and get stack pointer
In reply to Simon GlassAdd a function to get the stack pointer and another to halt the CPU.
---
Changes in v2:
- Remove the cpuid functions since they were already added in another patch
arch/x86/include/asm/processor.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/x86/include/asm/processor.h +19 -0
@@ -30,4 +30,23 @@ enum {#define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE) +#ifndef __ASSEMBLY__ + +static inline __attribute__((always_inline))void cpu_hlt (void ) +{ + asm("hlt" ); +} + +static inline ulong cpu_get_sp (void ) +{ +ulong result; + + asmvolatile ( +"mov %%esp, %%eax" + :"=a" (result)); +return result; +} + +#endif /* __ASSEMBLY__ */ +#endif
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 7/33 x86: Add processor functions to halt and get stack pointer
Quoted 46 lines · Simon Glass
Add a function to get the stack pointer and another to halt the CPU.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Remove the cpuid functions since they were already added in another patcharch/x86/include/asm/processor.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)arch/x86/include/asm/processor.h +19
-1@@ -30,4 +30,23 @@ enum {#define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE) +#ifndef __ASSEMBLY__ + +static inline __attribute__((always_inline))void cpu_hlt (void ) +{ + asm("hlt" ); +} + +static inline ulong cpu_get_sp (void ) +{ +ulong result; + + asmvolatile ( +"mov %%esp, %%eax" + :"=a" (result)); +return result; +} + +#endif /* __ASSEMBLY__ */ +#endif --2.1.0.rc2.206.gedb03e5
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v2 7/33 x86: Add processor functions to halt and get stack pointer
Quoted 2 lines · Bin Meng
Reviewed-by Bin Meng <[email protected]>
Applied to u-boot-x86.
PATCH v2 8/33 x86: Remove unnecessary find_fdt(), prepare_fdt() functions
In reply to Simon GlassThese are no-longer needed so drop them.
---
Changes in v2:
- Remove definition of find_fdt() also
- Remove prepare_fdt() also
arch/x86/include/asm/init_helpers.h | 2 -- arch/x86/lib/init_helpers.c | 27 --------------------------- common/board_f.c | 5 ----- 3 files changed, 34 deletions(-)
arch/x86/include/asm/init_helpers.h +0 -2
@@ -13,7 +13,5 @@ int calculate_relocation_address(void);int init_cache_f_r (void );int init_bd_struct_r (void );int init_func_spi (void ); -int find_fdt (void ); -int prepare_fdt (void );#endif /* !_INIT_HELPERS_H_ */
arch/x86/lib/init_helpers.c +0 -27
@@ -87,30 +87,3 @@ int init_func_spi(void)puts ("ready\n" );return 0 ; } - -int find_fdt (void ) -{ -#ifdef CONFIG_OF_EMBED -/* Get a pointer to the FDT */ - gd->fdt_blob = __dtb_dt_begin; -#elif definedCONFIG_OF_SEPARATE -/* FDT is at end of image */ - gd->fdt_blob = (ulong *)&_end; -#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 ; -}
common/board_f.c +0 -5
@@ -818,11 +818,6 @@ static init_fnc_t init_sequence_f[] = { probecpu, #endif arch_cpu_init,/* basic arch cpu dependent setup */ -#ifdef CONFIG_X86 -# ifdef CONFIG_OF_CONTROL - find_fdt, /* TODO(sjg at chromium.org): remove */ -# endif -#endif mark_bootstage, #ifdef CONFIG_OF_CONTROL fdtdec_check_fdt,
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 8/33 x86: Remove unnecessary find_fdt(), prepare_fdt() functions
Quoted 68 lines · Simon Glass
These are no-longer needed so drop them.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Remove definition offind_fdt()also
- Removeprepare_fdt()alsoarch/x86/include/asm/init_helpers.h | 2 -- arch/x86/lib/init_helpers.c | 27 --------------------------- common/board_f.c | 5 ----- 3 files changed, 34 deletions(-)arch/x86/include/asm/init_helpers.h +0
-2@@ -13,7 +13,5 @@ int calculate_relocation_address(void);int init_cache_f_r (void );int init_bd_struct_r (void );int init_func_spi (void ); -int find_fdt (void ); -int prepare_fdt (void );#endif /* !_INIT_HELPERS_H_ */ arch/x86/lib/init_helpers.c +0
-27@@ -87,30 +87,3 @@ int init_func_spi(void)puts ("ready\n" );return 0 ; } - -int find_fdt (void ) -{ -#ifdef CONFIG_OF_EMBED -/* Get a pointer to the FDT */ - gd->fdt_blob = __dtb_dt_begin; -#elif definedCONFIG_OF_SEPARATE -/* FDT is at end of image */ - gd->fdt_blob = (ulong *)&_end; -#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 ; -}common/board_f.c +0
-0@@ -818,11 +818,6 @@ static init_fnc_t init_sequence_f[] = { probecpu,#endif
common/board_f.c static init_fnc_t init_sequence_f[] = {
Quoted 10 lines
common/board_f.c +0
-6arch_cpu_init, /* basic arch cpu dependent setup */ -#ifdef CONFIG_X86 -# ifdef CONFIG_OF_CONTROL - find_fdt, /* TODO(sjg at chromium.org): remove */ -# endif -#endif mark_bootstage,#ifdef CONFIG_OF_CONTROL fdtdec_check_fdt, --
PATCH v2 8/33 x86: Remove unnecessary find_fdt(), prepare_fdt() functions
Quoted 15 lines · Bin Meng
Quoted 14 lines · Simon Glass
These are no-longer needed so drop them.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Remove definition offind_fdt()also
- Removeprepare_fdt()alsoarch/x86/include/asm/init_helpers.h | 2 -- arch/x86/lib/init_helpers.c | 27 --------------------------- common/board_f.c | 5 ----- 3 files changed, 34 deletions(-)
[snip]
Quoted 1 line
Reviewed-by Bin Meng <[email protected]>
Applied to u-boot-x86.
PATCH v2 9/33 x86: Replace fill_processor_name() with cpu_get_name()
In reply to Simon GlassThis implementation has a 'cpu' prefix and returns a pointer to the string, avoiding the need for copying.
---
Changes in v2:
- Add new patch to replace fill_processor_name() with cpu_get_name()
arch/x86/cpu/cpu.c | 22 ++++++++++------------ arch/x86/include/asm/cpu.h | 11 ++++++++--- 2 files changed, 18 insertions(+), 15 deletions(-)
arch/x86/cpu/cpu.c +10 -12
@@ -491,14 +491,14 @@ const char *cpu_vendor_name(int vendor)return name; } -void fill_processor_name (char *processor_name) +char *cpu_get_name (char *name) { +unsigned int *name_as_ints = (unsigned int *)name;struct cpuid_result regs; -char temp_processor_name[49 ]; -char *processor_name_start; -unsigned int *name_as_ints = (unsigned int *)temp_processor_name; +char *ptr;int i; +/* This bit adds up to 48 bytes */ for (i =0 ; i <3 ; i++) { regs =cpuid (0x80000002 + i); name_as_ints[i *4 +0 ] = regs.eax;
@@ -506,19 +506,17 @@ void fill_processor_name(char *processor_name) name_as_ints[i *4 +2 ] = regs.ecx; name_as_ints[i *4 +3 ] = regs.edx; } - - temp_processor_name[48 ] =0 ; + name[CPU_MAX_NAME_LEN -1 ] ='\0' ;/* Skip leading spaces. */ - processor_name_start = temp_processor_name; -while (*processor_name_start ==' ' ) - processor_name_start++; + ptr = name; +while (*ptr ==' ' ) + ptr++; -memset (processor_name,0 ,49 ); -strcpy (processor_name, processor_name_start); +return ptr; } -int print_cpuinfo (void ) +int default_print_cpuinfo (void ) { printf("CPU: %s, vendor %s, device %xh\n", cpu_has_64bit() ? "x86_64" : "x86",
arch/x86/include/asm/cpu.h +8 -3
@@ -179,12 +179,17 @@ int cpu_has_64bit(void);*/ const char *cpu_vendor_name (int vendor); +#define CPU_MAX_NAME_LEN 49 +/** -* fill_processor_name() - Get processor name +* cpu_get_name() - Get the name of the current cpu * -* @processor_name: Address to hold the processor name string +* @name: Place to put name, which must be CPU_MAX_NAME_LEN bytes including +* @return pointer to name, which will likely be a few bytes after the start +* of @name +* \0 terminator */ -void fill_processor_name (char *processor_name); +char *cpu_get_name (char *name);/** * cpu_call64() - Jump to a 64-bit Linux kernel (internal function)
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 9/33 x86: Replace fill_processor_name() with cpu_get_name()
Quoted 79 lines · Simon Glass
This implementation has a 'cpu' prefix and returns a pointer to the string, avoiding the need for copying.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Add new patch to replacefill_processor_name()withcpu_get_name()arch/x86/cpu/cpu.c | 22 ++++++++++------------ arch/x86/include/asm/cpu.h | 11 ++++++++--- 2 files changed, 18 insertions(+), 15 deletions(-)arch/x86/cpu/cpu.c +10
-12@@ -491,14 +491,14 @@ const char *cpu_vendor_name(int vendor)return name; } -void fill_processor_name (char *processor_name) +char *cpu_get_name (char *name) { +unsigned int *name_as_ints = (unsigned int *)name;struct cpuid_result regs; -char temp_processor_name[49 ]; -char *processor_name_start; -unsigned int *name_as_ints = (unsigned int *)temp_processor_name; +char *ptr;int i; +/* This bit adds up to 48 bytes */ for (i =0 ; i <3 ; i++) { regs =cpuid (0x80000002 + i); name_as_ints[i *4 +0 ] = regs.eax;@@ -506,19 +506,17 @@ void fill_processor_name(char *processor_name) name_as_ints[i *4 +2 ] = regs.ecx; name_as_ints[i *4 +3 ] = regs.edx; } - - temp_processor_name[48 ] =0 ; + name[CPU_MAX_NAME_LEN -1 ] ='\0' ;/* Skip leading spaces. */ - processor_name_start = temp_processor_name; -while (*processor_name_start ==' ' ) - processor_name_start++; + ptr = name; +while (*ptr ==' ' ) + ptr++; -memset (processor_name,0 ,49 ); -strcpy (processor_name, processor_name_start); +return ptr; } -int print_cpuinfo (void ) +int default_print_cpuinfo (void ) { printf("CPU: %s, vendor %s, device %xh\n", cpu_has_64bit() ? "x86_64" : "x86",arch/x86/include/asm/cpu.h +4
-2@@ -179,12 +179,17 @@ int cpu_has_64bit(void);*/ const char *cpu_vendor_name (int vendor); +#define CPU_MAX_NAME_LEN 49 +/** -* fill_processor_name() - Get processor name +* cpu_get_name() - Get the name of the current cpu * -* @processor_name: Address to hold the processor name string +* @name: Place to put name, which must be CPU_MAX_NAME_LEN bytes including
arch/x86/include/asm/cpu.h int cpu_has_64bit(void);
Quoted 10 lines
arch/x86/include/asm/cpu.h +4
-2+* @return pointer to name, which will likely be a few bytes after the start +* of @name +* \0 terminator */ -void fill_processor_name (char *processor_name); +char *cpu_get_name (char *name);/** * cpu_call64() - Jump to a 64-bit Linux kernel (internal function) --
PATCH v3 1/1 x86: Replace fill_processor_name() with cpu_get_name()
In reply to Simon GlassThis implementation has a 'cpu' prefix and returns a pointer to the string, avoiding the need for copying.
---
Changes in v3:
- Added missing print_cpuinfo() call in coreboot.c
arch/x86/cpu/coreboot/coreboot.c | 5 +++++ arch/x86/cpu/cpu.c | 22 ++++++++++------------ arch/x86/include/asm/cpu.h | 11 ++++++++--- arch/x86/include/asm/u-boot-x86.h | 1 + 4 files changed, 24 insertions(+), 15 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +5 -0
@@ -72,6 +72,11 @@ void show_boot_progress(int val)outb (val,0x80 ); } +int print_cpuinfo (void ) +{ +return default_print_cpuinfo (); +} +int last_stage_init (void ) {if (gd->flags &GD_FLG_COLD_BOOT )
arch/x86/cpu/cpu.c +10 -12
@@ -491,14 +491,14 @@ const char *cpu_vendor_name(int vendor)return name; } -void fill_processor_name (char *processor_name) +char *cpu_get_name (char *name) { +unsigned int *name_as_ints = (unsigned int *)name;struct cpuid_result regs; -char temp_processor_name[49 ]; -char *processor_name_start; -unsigned int *name_as_ints = (unsigned int *)temp_processor_name; +char *ptr;int i; +/* This bit adds up to 48 bytes */ for (i =0 ; i <3 ; i++) { regs =cpuid (0x80000002 + i); name_as_ints[i *4 +0 ] = regs.eax;
@@ -506,19 +506,17 @@ void fill_processor_name(char *processor_name) name_as_ints[i *4 +2 ] = regs.ecx; name_as_ints[i *4 +3 ] = regs.edx; } - - temp_processor_name[48 ] =0 ; + name[CPU_MAX_NAME_LEN -1 ] ='\0' ;/* Skip leading spaces. */ - processor_name_start = temp_processor_name; -while (*processor_name_start ==' ' ) - processor_name_start++; + ptr = name; +while (*ptr ==' ' ) + ptr++; -memset (processor_name,0 ,49 ); -strcpy (processor_name, processor_name_start); +return ptr; } -int print_cpuinfo (void ) +int default_print_cpuinfo (void ) { printf("CPU: %s, vendor %s, device %xh\n", cpu_has_64bit() ? "x86_64" : "x86",
arch/x86/include/asm/cpu.h +8 -3
@@ -179,12 +179,17 @@ int cpu_has_64bit(void);*/ const char *cpu_vendor_name (int vendor); +#define CPU_MAX_NAME_LEN 49 +/** -* fill_processor_name() - Get processor name +* cpu_get_name() - Get the name of the current cpu * -* @processor_name: Address to hold the processor name string +* @name: Place to put name, which must be CPU_MAX_NAME_LEN bytes including +* @return pointer to name, which will likely be a few bytes after the start +* of @name +* \0 terminator */ -void fill_processor_name (char *processor_name); +char *cpu_get_name (char *name);/** * cpu_call64() - Jump to a 64-bit Linux kernel (internal function)
arch/x86/include/asm/u-boot-x86.h +1 -0
@@ -45,6 +45,7 @@ int x86_init_cache(void);void reset_cpu (ulong addr);ulong board_get_usable_ram_top (ulong total_size);void dram_init_banksize (void ); +int default_print_cpuinfo (void );void setup_pcat_compatibility (void );
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v3 1/1 x86: Replace fill_processor_name() with cpu_get_name()
Hi,
Quoted 9 lines · Simon Glass
This implementation has a 'cpu' prefix and returns a pointer to the string, avoiding the need for copying.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Bin Meng <[email protected]>---
Changes in v3:
- Added missingprint_cpuinfo()call incoreboot.c
Sadly I made a mistake with my testing and had to send a v3 for this patch only. This is the one I will apply.
Quoted 7 lines
arch/x86/cpu/coreboot/coreboot.c | 5 +++++ arch/x86/cpu/cpu.c | 22 ++++++++++------------ arch/x86/include/asm/cpu.h | 11 ++++++++--- arch/x86/include/asm/u-boot-x86.h | 1 + 4 files changed, 24 insertions(+), 15 deletions(-)
Regards,
Simon
PATCH v3 1/1 x86: Replace fill_processor_name() with cpu_get_name()
Quoted 10 lines · Simon Glass
Hi,
Quoted 7 lines · Simon Glass
This implementation has a 'cpu' prefix and returns a pointer to the string, avoiding the need for copying.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Bin Meng <[email protected]>---
Quoted 12 lines
Quoted 2 lines
Changes in v3:
- Added missingprint_cpuinfo()call incoreboot.cSadly I made a mistake with my testing and had to send a v3 for this patch only. This is the one I will apply.
Quoted 6 lines
arch/x86/cpu/coreboot/coreboot.c | 5 +++++ arch/x86/cpu/cpu.c | 22 ++++++++++------------ arch/x86/include/asm/cpu.h | 11 ++++++++--- arch/x86/include/asm/u-boot-x86.h | 1 + 4 files changed, 24 insertions(+), 15 deletions(-)
Applied to u-boot-x86
PATCH v2 10/33 x86: Tidy up timer code for Intel core architecture
In reply to Simon GlassWe can use an MSR to obtain the time base. Add this back in and consolidate the code.
---
Changes in v2:
- Add new patch to tidy up timer code for Intel core architecture
arch/x86/cpu/interrupts.c | 28 ---------------------------- arch/x86/lib/tsc_timer.c | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 29 deletions(-)
arch/x86/cpu/interrupts.c +0 -28
@@ -603,31 +603,3 @@ 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 ) -{ -u64 now_tick =rdtsc (); - -if (!gd->arch.tsc_base) - gd->arch.tsc_base = now_tick; - -return now_tick - gd->arch.tsc_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
arch/x86/lib/tsc_timer.c +15 -1
@@ -180,6 +180,20 @@ static inline int pit_expect_msb(unsigned char val, u64 *tscp,return count >5 ; } +#define PLATFORM_INFO_MSR 0xce + +/* Get the speed of the TSC timer in MHz */ +unsigned __attribute__((no_instrument_function)) + long get_tbclk_mhz_from_msr(void) +{ +u32 ratio; +u64 platform_info =native_read_msr (PLATFORM_INFO_MSR ); + +/* 100MHz times Max Non Turbo ratio */ + ratio = (platform_info >>8 ) &0xff ; +return 100 * ratio; +} +/* * How many MSB values do we want to see? We aim for * a maximum error rate of 500ppm (in practice the
@@ -302,7 +316,7 @@ unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void) fast_calibrate =quick_pit_calibrate ();if (!fast_calibrate) -panic ("TSC frequency is ZERO" ); + fast_calibrate =get_tbclk_mhz_from_msr (); gd->arch.tsc_mhz = fast_calibrate;return fast_calibrate;
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 10/33 x86: Tidy up timer code for Intel core architecture
Hi Simon,
Quoted 75 lines · Simon Glass
We can use an MSR to obtain the time base. Add this back in and consolidate the code.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Add new patch to tidy up timer code for Intel core architecturearch/x86/cpu/interrupts.c | 28 ---------------------------- arch/x86/lib/tsc_timer.c | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 29 deletions(-)arch/x86/cpu/interrupts.c +0
-28@@ -603,31 +603,3 @@ 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 ) -{ -u64 now_tick =rdtsc (); - -if (!gd->arch.tsc_base) - gd->arch.tsc_base = now_tick; - -return now_tick - gd->arch.tsc_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 arch/x86/lib/tsc_timer.c +14
-0@@ -180,6 +180,20 @@ static inline int pit_expect_msb(unsigned char val, u64 *tscp,return count >5 ; } +#define PLATFORM_INFO_MSR 0xce + +/* Get the speed of the TSC timer in MHz */ +unsigned __attribute__((no_instrument_function)) + long get_tbclk_mhz_from_msr(void) +{ +u32 ratio; +u64 platform_info =native_read_msr (PLATFORM_INFO_MSR ); + +/* 100MHz times Max Non Turbo ratio */ + ratio = (platform_info >>8 ) &0xff ; +return 100 * ratio; +} +/* * How many MSB values do we want to see? We aim for * a maximum error rate of 500ppm (in practice the
arch/x86/lib/tsc_timer.c unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void)
Quoted 9 lines
arch/x86/lib/tsc_timer.c +1
-2@@ -302,7 +316,7 @@ unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void) fast_calibrate =quick_pit_calibrate ();if (!fast_calibrate) -panic ("TSC frequency is ZERO" ); + fast_calibrate =get_tbclk_mhz_from_msr (); gd->arch.tsc_mhz = fast_calibrate;return fast_calibrate; --
Adding MSR calibration back for Intel CORE this way is inconsistent with the code logic. Can you please try adding the family number and model number in the freq_desc_tables[]?
Regards,
Bin
PATCH v2 10/33 x86: Tidy up timer code for Intel core architecture
Hi Bin,
Quoted 84 lines · Bin Meng
Hi Simon,
Quoted 81 lines · Simon Glass
We can use an MSR to obtain the time base. Add this back in and consolidate the code.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Add new patch to tidy up timer code for Intel core architecturearch/x86/cpu/interrupts.c | 28 ---------------------------- arch/x86/lib/tsc_timer.c | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 29 deletions(-)arch/x86/cpu/interrupts.c +0
-28@@ -603,31 +603,3 @@ 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 ) -{ -u64 now_tick =rdtsc (); - -if (!gd->arch.tsc_base) - gd->arch.tsc_base = now_tick; - -return now_tick - gd->arch.tsc_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 arch/x86/lib/tsc_timer.c +15
-1@@ -180,6 +180,20 @@ static inline int pit_expect_msb(unsigned char val, u64 *tscp,return count >5 ; } +#define PLATFORM_INFO_MSR 0xce + +/* Get the speed of the TSC timer in MHz */ +unsigned __attribute__((no_instrument_function)) + long get_tbclk_mhz_from_msr(void) +{ +u32 ratio; +u64 platform_info =native_read_msr (PLATFORM_INFO_MSR ); + +/* 100MHz times Max Non Turbo ratio */ + ratio = (platform_info >>8 ) &0xff ; +return 100 * ratio; +} +/* * How many MSB values do we want to see? We aim for * a maximum error rate of 500ppm (in practice the @@ -302,7 +316,7 @@ unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void) fast_calibrate =quick_pit_calibrate ();if (!fast_calibrate) -panic ("TSC frequency is ZERO" ); + fast_calibrate =get_tbclk_mhz_from_msr ();
Quoted 7 lines
arch/x86/lib/tsc_timer.c unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void)
Quoted 3 lines
arch/x86/lib/tsc_timer.c +0
-1gd->arch.tsc_mhz = fast_calibrate;return fast_calibrate; --Adding MSR calibration back for Intel CORE this way is inconsistent with the code logic. Can you please try adding the family number and model number in the freq_desc_tables[]?
Yes, but I was hoping for something automatic rather than a list of exceptions. What is the guaranteed way to do this calibration?
Regards,
Simon
PATCH v2 10/33 x86: Tidy up timer code for Intel core architecture
Hi Simon,
Quoted 95 lines · Simon Glass
Hi Bin,
Quoted 84 lines · Bin Meng
Hi Simon,
Quoted 81 lines · Simon Glass
We can use an MSR to obtain the time base. Add this back in and consolidate the code.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Add new patch to tidy up timer code for Intel core architecturearch/x86/cpu/interrupts.c | 28 ---------------------------- arch/x86/lib/tsc_timer.c | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 29 deletions(-)arch/x86/cpu/interrupts.c +0
-28@@ -603,31 +603,3 @@ 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 ) -{ -u64 now_tick =rdtsc (); - -if (!gd->arch.tsc_base) - gd->arch.tsc_base = now_tick; - -return now_tick - gd->arch.tsc_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 arch/x86/lib/tsc_timer.c +15
-1@@ -180,6 +180,20 @@ static inline int pit_expect_msb(unsigned char val, u64 *tscp,return count >5 ; } +#define PLATFORM_INFO_MSR 0xce + +/* Get the speed of the TSC timer in MHz */ +unsigned __attribute__((no_instrument_function)) + long get_tbclk_mhz_from_msr(void) +{ +u32 ratio; +u64 platform_info =native_read_msr (PLATFORM_INFO_MSR ); + +/* 100MHz times Max Non Turbo ratio */ + ratio = (platform_info >>8 ) &0xff ; +return 100 * ratio; +} +/* * How many MSB values do we want to see? We aim for * a maximum error rate of 500ppm (in practice the @@ -302,7 +316,7 @@ unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void) fast_calibrate =quick_pit_calibrate ();if (!fast_calibrate) -panic ("TSC frequency is ZERO" ); + fast_calibrate =get_tbclk_mhz_from_msr ();Quoted 7 lines
arch/x86/lib/tsc_timer.c unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void)
Quoted 3 lines
arch/x86/lib/tsc_timer.c +0
-1gd->arch.tsc_mhz = fast_calibrate;return fast_calibrate; --Adding MSR calibration back for Intel CORE this way is inconsistent with the code logic. Can you please try adding the family number and model number in the freq_desc_tables[]?
Quoted 2 lines
Yes, but I was hoping for something automatic rather than a list of exceptions. What is the guaranteed way to do this calibration?
I am not considering this as an exception. The Linux codes explicitly mentions that the MSR calibration is only used on Atom processors. What I am proposing here is that since the CORE architecture also has the MSR_PLATFORM_INFO and the TSC running frequency can be easily retrieved from that, we can add such capability into the MSR calibration routine to handle the non-Atom architectures. Note on Linux, when quick_pit_calibrate() fails, Linux falls back to use a slow PIT calibration and HPET/PMTIMER as the calibration source. I originally did not pull these stuff into the U-Boot, and thought the quick_pit_calibrate() is enough on all platforms. If you think updating freq_desc_tables[] is not feasible, or we need keep U-Boot consistent with the Linux implementation, feel free to bring the slow PIT calibration and HPET/PMTIMER into U-Boot.
Regards,
Bin
PATCH v2 11/33 x86: Add chromebook_link board
In reply to Simon GlassThis board is a 'bare' version of the existing 'link 'board. It does not require coreboot to run, but is intended to start directly from the reset vector.
This initial commit has place holders for a wide range of features. These will be added in follow-on patches and series. So far it cannot be booted as there is no ROM image produced, but it does build without errors.
---
Changes in v2:
- Add a common early_init file
- Adjust config to deal with changed x86-common.h
- Correct 'peripheral controller hub' to 'platform controller hub'
arch/x86/Kconfig | 23 +++++ arch/x86/cpu/coreboot/coreboot.c | 8 ++ arch/x86/cpu/ivybridge/Kconfig | 157 +++++++++++++++++++++++++++++ arch/x86/cpu/ivybridge/Makefile | 9 ++ arch/x86/cpu/ivybridge/car.S | 20 ++++ arch/x86/cpu/ivybridge/cpu.c | 42 ++++++++ arch/x86/cpu/ivybridge/sdram.c | 20 ++++ arch/x86/dts/Makefile | 1 + arch/x86/dts/chromebook_link.dts | 1 + arch/x86/include/asm/arch-ivybridge/gpio.h | 10 ++ board/google/chromebook_link/Kconfig | 15 +++ board/google/chromebook_link/MAINTAINERS | 6 ++ board/google/chromebook_link/Makefile | 15 +++ board/google/chromebook_link/link.c | 17 ++++ board/google/common/Makefile | 7 ++ board/google/common/early_init.S | 10 ++ configs/chromebook_link_defconfig | 10 ++ include/configs/chromebook_link.h | 60 +++++++++++ 18 files changed, 431 insertions(+) create mode 100644 arch/x86/cpu/ivybridge/Kconfig create mode 100644 arch/x86/cpu/ivybridge/Makefile create mode 100644 arch/x86/cpu/ivybridge/car.S create mode 100644 arch/x86/cpu/ivybridge/cpu.c create mode 100644 arch/x86/cpu/ivybridge/sdram.c create mode 120000 arch/x86/dts/chromebook_link.dts create mode 100644 arch/x86/include/asm/arch-ivybridge/gpio.h create mode 100644 board/google/chromebook_link/Kconfig create mode 100644 board/google/chromebook_link/MAINTAINERS create mode 100644 board/google/chromebook_link/Makefile create mode 100644 board/google/chromebook_link/link.c create mode 100644 board/google/common/Makefile create mode 100644 board/google/common/early_init.S create mode 100644 configs/chromebook_link_defconfig create mode 100644 include/configs/chromebook_link.h
arch/x86/Kconfig +23 -0
@@ -12,9 +12,32 @@ choice config TARGET_COREBOOT bool "Support coreboot" + help + This target is used for running U-Boot on top of Coreboot. In + this case Coreboot does the early inititalisation, and U-Boot + takes over once the RAM, video and CPU are fully running. + U-Boot is loaded as a fallback payload from Coreboot, in + Coreboot terminology. This method was used for the Chromebook + Pixel when launched. + +config TARGET_CHROMEBOOK_LINK + bool "Support Chromebook link" + help + This is the Chromebook Pixel released in 2013. It uses an Intel + i5 Ivybridge which is a die-shrink of Sandybridge, with 4GB of + SDRAM. It has a Panther Point platform controller hub, PCIe + WiFi and Bluetooth. It also includes a 720p webcam, USB SD + reader, microphone and speakers, display port and 32GB SATA + solid state drive. There is a Chrome OS EC connected on LPC, + and it provides a 2560x1700 high resolution touch-enabled LCD + display. endchoice +source "arch/x86/cpu/ivybridge/Kconfig" + source "board/chromebook-x86/coreboot/Kconfig" +source "board/google/chromebook_link/Kconfig" + endmenu
arch/x86/cpu/coreboot/coreboot.c +8 -0
@@ -13,6 +13,7 @@#include <ns16550.h> #include <asm/msr.h> #include <asm/cache.h> +#include <asm/cpu.h> #include <asm/io.h> #include <asm/arch-coreboot/tables.h> #include <asm/arch-coreboot/sysinfo.h>
@@ -129,3 +130,10 @@ void panic_puts(const char *str)while (*str)NS16550_putc (port, *str++); } + +int print_cpuinfo (void ) +{ +printf ("CPU: %s\n" ,cpu_has_64bit () ?"x86_64" :"x86" ); + +return 0 ; +}
arch/x86/cpu/ivybridge/Kconfig new file +157 -0
157 lines not on this page · raw message
arch/x86/cpu/ivybridge/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# +# Copyright (c) 2014 Google, Inc +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += car.o +obj-y += cpu.o +obj-y += sdram.o
arch/x86/cpu/ivybridge/car.S new file +20 -0
@@ -0,0 +1,20 @@ +/* + * Copyright (c) 2014 Google, Inc + * + * From Coreboot file cpu/intel/model_206ax/cache_as_ram.inc + * + * Copyright (C) 2000,2007 Ronald G. Minnich <[email protected]> + * Copyright (C) 2005 Tyan (written by Yinghai Lu for Tyan) + * Copyright (C) 2007-2008 coresystems GmbH + * Copyright (C) 2012 Ky?sti M?lkki <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#include <common.h> + + /* Note: ebp must not be touched in this code */ +.globl car_init +car_init: + /* TODO: Add cache-as-RAM init here */ + jmp car_init_ret
arch/x86/cpu/ivybridge/cpu.c new file +42 -0
42 lines not on this page · raw message
arch/x86/cpu/ivybridge/sdram.c new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright (c) 2011 The Chromium OS Authors. +* (C) Copyright 2010,2011 +* Graeme Russ, <[email protected]> +* +* Portions from Coreboot mainboard/google/link/romstage.c +* Copyright (C) 2007-2010 coresystems GmbH +* Copyright (C) 2011 Google Inc. +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#include <common.h> + +int dram_init (void ) +{ +/* TODO: Set up DRAM */ + +return 0 ; +}
arch/x86/dts/Makefile +1 -0
@@ -1,4 +1,5 @@ dtb-y += link.dtb \ + chromebook_link.dtb \ alex.dtb targets += $(dtb-y)
arch/x86/dts/chromebook_link.dts new file +1 -0
@@ -0,0 +1 @@ +link.dts
arch/x86/include/asm/arch-ivybridge/gpio.h new file +10 -0
@@ -0,0 +1,10 @@ +/* +* Copyright (c) 2014, Google Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _X86_ARCH_GPIO_H_ +#define _X86_ARCH_GPIO_H_ + +#endif /* _X86_ARCH_GPIO_H_ */
board/google/chromebook_link/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_CHROMEBOOK_LINK + +config SYS_BOARD + default "chromebook_link" + +config SYS_VENDOR + default "google" + +config SYS_SOC + default "ivybridge" + +config SYS_CONFIG_NAME + default "chromebook_link" + +endif
board/google/chromebook_link/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +CHROMEBOOK LINK BOARD +M: Simon Glass <[email protected]> +S: Maintained +F: board/google/chromebook_link/ +F: include/configs/chromebook_link.h +F: configs/chromebook_link_defconfig
board/google/chromebook_link/Makefile new file +15 -0
@@ -0,0 +1,15 @@ +# +# Copyright (c) 2011 The Chromium OS Authors. +# (C) Copyright 2008 +# Graeme Russ, graeme.russ at gmail.com. +# +# (C) Copyright 2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# (C) Copyright 2002 +# Daniel Engstr?m, Omicron Ceti AB, daniel at omicron.se. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += link.o
board/google/chromebook_link/link.c new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Copyright (C) 2014 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> + +int arch_early_init_r (void ) +{ +return 0 ; +} + +int board_early_init_r (void ) +{ +return 0 ; +}
board/google/common/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Copyright (c) 2014 Google, Inc +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += early_init.o
board/google/common/early_init.S new file +10 -0
@@ -0,0 +1,10 @@ +/* + * Copyright (c) 2014 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +.globl early_board_init +early_board_init: + /* No 32-bit board specific initialisation */ + jmp early_board_init_ret
configs/chromebook_link_defconfig new file +10 -0
@@ -0,0 +1,10 @@ +CONFIG_SYS_EXTRA_OPTIONS="SYS_TEXT_BASE=0xfff00000" +CONFIG_X86=y +CONFIG_TARGET_CHROMEBOOK_LINK=y +CONFIG_OF_CONTROL=y +CONFIG_OF_SEPARATE=y +CONFIG_DEFAULT_DEVICE_TREE="chromebook_link" +CONFIG_HAVE_MRC=y +CONFIG_SMM_TSEG_SIZE=0x800000 +CONFIG_FRAMEBUFFER_SET_VESA_MODE=y +CONFIG_FRAMEBUFFER_VESA_MODE_11A=y
include/configs/chromebook_link.h new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 12/33 x86: Build a .rom file which can be flashed to an x86 machine
In reply to Simon GlassOn x86 machines U-Boot needs to be added to a large ROM image which is then flashed onto the target board. The ROM has a particular format so it makes sense for U-Boot to build this image automatically. Unfortunately it relies on binary blobs so we cannot require this for the default build as yet.
Create a u-boot.rom output file for this purpose.
---
Changes in v2: None
Makefile | 27 ++++++++++++++++++++++++++- arch/x86/Kconfig | 4 ++++ include/configs/chromebook_link.h | 2 ++ 3 files changed, 32 insertions(+), 1 deletion(-)
Makefile +26 -1
@@ -743,6 +743,9 @@ ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) endif ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf +# We can't do this yet due to the need for binary blobs +# ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom + # enable combined SPL/u-boot/dtb rules for tegra ifneq ($(CONFIG_TEGRA),) ifeq ($(CONFIG_SPL),y)
@@ -804,7 +807,8 @@ OBJCOPYFLAGS_u-boot.srec := -O srec u-boot.hex u-boot.srec: u-boot FORCE $(call if_changed,objcopy) -OBJCOPYFLAGS_u-boot.bin := -O binary +OBJCOPYFLAGS_u-boot.bin := -O binary \ + $(if $(CONFIG_X86_RESET_VECTOR),-R .start16 -R .resetvec) binary_size_check: u-boot.bin FORCE @file_size=$(shell wc -c u-boot.bin | awk '{print $$1}') ; \
@@ -943,6 +947,27 @@ u-boot-nand.gph: u-boot.bin FORCE $(call if_changed,mkimage) @dd if=/dev/zero bs=8 count=1 2>/dev/null >> $@ +# x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including +# reset vector) at the top, Intel ME at the bottom, and U-Boot in the middle. +ifneq ($(CONFIG_X86_RESET_VECTOR),) +rom: u-boot.rom FORCE + +u-boot.rom: u-boot-x86-16bit.bin u-boot-dtb.bin \ + $(srctree)/board/$(BOARDDIR)/descriptor.bin + $(objtree)/tools/ifdtool -c -r $(CONFIG_ROM_SIZE) \ + -D $(srctree)/board/$(BOARDDIR)/descriptor.bin u-boot.tmp + $(objtree)/tools/ifdtool -w \ + $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot-dtb.bin u-boot.tmp + $(objtree)/tools/ifdtool -w \ + $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin \ + u-boot.tmp + mv u-boot.tmp $@ + +OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec +u-boot-x86-16bit.bin: u-boot FORCE + $(call if_changed,objcopy) +endif + ifneq ($(CONFIG_SUNXI),) OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
arch/x86/Kconfig +4 -0
@@ -34,6 +34,10 @@ config TARGET_CHROMEBOOK_LINK endchoice +config ROM_SIZE + hex + default 0x800000 + source "arch/x86/cpu/ivybridge/Kconfig" source "board/chromebook-x86/coreboot/Kconfig"
include/configs/chromebook_link.h +2 -0
@@ -18,8 +18,10 @@#define CONFIG_SYS_CAR_ADDR 0xff7e0000#define CONFIG_SYS_CAR_SIZE (128 * 1024)#define CONFIG_SYS_MONITOR_LEN (1 << 20) +#define CONFIG_SYS_X86_START16 0xfffff800#define CONFIG_BOARD_EARLY_INIT_R +#define CONFIG_X86_RESET_VECTOR #define CONFIG_NR_DRAM_BANKS 8#define CONFIG_COREBOOT_SERIAL
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 13/33 x86: Emit post codes in startup code for Chromebooks
In reply to Simon GlassOn x86 it is common to use 'post codes' which are 8-bit hex values emitted from the code and visible to the user. Traditionally two 7-segment displays were made available on the motherboard to show the last post code that was emitted. This allows diagnosis of a boot problem since it is possible to see where the code got to before it died.
On modern hardware these codes are not normally visible. On Chromebooks they are displayed by the Embedded Controller (EC), so it is useful to emit them. We must enable this feature for the EC to see the codes, so add an option for this.
---
Changes in v2:
- Move early init code into early_board_init
arch/x86/cpu/coreboot/coreboot.c | 3 ++- arch/x86/cpu/start.S | 4 ++++ arch/x86/include/asm/post.h | 32 ++++++++++++++++++++++++++++++++ board/google/chromebook_link/Kconfig | 4 ++++ board/google/common/early_init.S | 21 ++++++++++++++++++++- 5 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 arch/x86/include/asm/post.h
arch/x86/cpu/coreboot/coreboot.c +2 -1
@@ -15,6 +15,7 @@#include <asm/cache.h> #include <asm/cpu.h> #include <asm/io.h> +#include <asm/post.h> #include <asm/arch-coreboot/tables.h> #include <asm/arch-coreboot/sysinfo.h> #include <asm/arch/timestamp.h>
@@ -70,7 +71,7 @@ void show_boot_progress(int val) gd->arch.tsc_prev = now; }#endif -outb (val,0x80 ); +outb (val,POST_PORT ); }int last_stage_init (void )
arch/x86/cpu/start.S +4 -0
@@ -13,6 +13,7 @@ #include <config.h> #include <version.h> #include <asm/global_data.h> +#include <asm/post.h> #include <asm/processor.h> #include <asm/processor-flags.h> #include <generated/generic-asm-offsets.h>
@@ -67,6 +68,7 @@ _start: jmp early_board_init .globl early_board_init_ret early_board_init_ret: + post_code(POST_START) /* Initialise Cache-As-RAM */ jmp car_init
@@ -96,6 +98,7 @@ car_init_ret: /* Align global data to 16-byte boundary */ andl $0xfffffff0, %esp + post_code(POST_START_STACK) /* Zero the global data since it won't happen later */ xorl %eax, %eax
@@ -131,6 +134,7 @@ car_init_ret: call setup_gdt /* Set parameter to board_init_f() to boot flags */ + post_code(POST_START_DONE) xorl %eax, %eax /* Enter, U-boot! */
arch/x86/include/asm/post.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright (c) 2014 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _post_h +#define _post_h + +/* port to use for post codes */ +#define POST_PORT 0x80 + +/* post codes which represent various stages of init */ +#define POST_START 0x1e +#define POST_CAR_START 0x1f + +#define POST_START_STACK 0x29 +#define POST_START_DONE 0x2a + +/* Output a post code using al - value must be 0 to 0xff */ +#ifdef __ASSEMBLY__ +#define post_code (value) \ + movb $value, %al; \ + outb %al, $POST_PORT +#else +static inline void post_code (int code) +{ +outb (code,POST_PORT ); +} +#endif + +#endif
board/google/chromebook_link/Kconfig +4 -0
@@ -12,4 +12,8 @@ config SYS_SOC config SYS_CONFIG_NAME default "chromebook_link" +config EARLY_POST_CROS_EC + bool "Enable early post to Chrome OS EC" + default y + endif
board/google/common/early_init.S +20 -1
@@ -6,5 +6,24 @@ .globl early_board_init early_board_init: - /* No 32-bit board specific initialisation */ + /* Enable post codes to EC */ +#ifdef CONFIG_EARLY_POST_CROS_EC + mov $0x1b, %ecx + rdmsr + and $0x100, %eax + test %eax, %eax + je 2f + + mov $0x8000f8f0, %eax + mov $0xcf8, %dx + out %eax, (%dx) + mov $0xfed1c001, %eax + mov $0xcfc, %dx + out %eax, (%dx) + mov $0xfed1f410, %esp + mov (%esp), %eax + and $0xfffffffb, %eax + mov %eax, (%esp) +2: +#endif jmp early_board_init_ret
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 13/33 x86: Emit post codes in startup code for Chromebooks
Hi Simon,
Quoted 139 lines · Simon Glass
On x86 it is common to use 'post codes' which are 8-bit hex values emitted from the code and visible to the user. Traditionally two 7-segment displays were made available on the motherboard to show the last post code that was emitted. This allows diagnosis of a boot problem since it is possible to see where the code got to before it died.
On modern hardware these codes are not normally visible. On Chromebooks they are displayed by the Embedded Controller (EC), so it is useful to emit them. We must enable this feature for the EC to see the codes, so add an option for this.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Move early init code intoearly_board_initarch/x86/cpu/coreboot/coreboot.c | 3 ++- arch/x86/cpu/start.S | 4 ++++ arch/x86/include/asm/post.h | 32 ++++++++++++++++++++++++++++++++ board/google/chromebook_link/Kconfig | 4 ++++ board/google/common/early_init.S | 21 ++++++++++++++++++++- 5 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 arch/x86/include/asm/post.harch/x86/cpu/coreboot/coreboot.c +2
-1@@ -15,6 +15,7 @@#include <asm/cache.h> #include <asm/cpu.h> #include <asm/io.h> +#include <asm/post.h> #include <asm/arch-coreboot/tables.h> #include <asm/arch-coreboot/sysinfo.h> #include <asm/arch/timestamp.h> @@ -70,7 +71,7 @@ void show_boot_progress(int val) gd->arch.tsc_prev = now; }#endif -outb (val,0x80 ); +outb (val,POST_PORT ); }int last_stage_init (void )arch/x86/cpu/start.S +4
-0@@ -13,6 +13,7 @@ #include <config.h> #include <version.h> #include <asm/global_data.h> +#include <asm/post.h> #include <asm/processor.h> #include <asm/processor-flags.h> #include <generated/generic-asm-offsets.h>@@ -67,6 +68,7 @@ _start: jmp early_board_init .globl early_board_init_ret early_board_init_ret: + post_code(POST_START) /* Initialise Cache-As-RAM */ jmp car_init@@ -96,6 +98,7 @@ car_init_ret: /* Align global data to 16-byte boundary */ andl $0xfffffff0, %esp + post_code(POST_START_STACK) /* Zero the global data since it won't happen later */ xorl %eax, %eax@@ -131,6 +134,7 @@ car_init_ret: call setup_gdt /* Set parameter to board_init_f() to boot flags */ + post_code(POST_START_DONE) xorl %eax, %eax /* Enter, U-boot! */arch/x86/include/asm/post.h new file +32
-0@@ -0,0 +1,32 @@ +/* +* Copyright (c) 2014 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _post_h +#define _post_h + +/* port to use for post codes */ +#define POST_PORT 0x80 + +/* post codes which represent various stages of init */ +#define POST_START 0x1e +#define POST_CAR_START 0x1f + +#define POST_START_STACK 0x29 +#define POST_START_DONE 0x2a + +/* Output a post code using al - value must be 0 to 0xff */ +#ifdef __ASSEMBLY__ +#define post_code (value) \ + movb $value, %al; \ + outb %al, $POST_PORT +#else +static inline void post_code (int code) +{ +outb (code,POST_PORT ); +} +#endif + +#endif board/google/chromebook_link/Kconfig +4
-0@@ -12,4 +12,8 @@ config SYS_SOC config SYS_CONFIG_NAME default "chromebook_link" +config EARLY_POST_CROS_EC + bool "Enable early post to Chrome OS EC" + default y + endifboard/google/common/early_init.S +0
-0@@ -6,5 +6,24 @@
board/google/common/early_init.S line 15
Quoted 10 lines
board/google/common/early_init.S +7
-1.globl early_board_init early_board_init: - /* No 32-bit board specific initialisation */ + /* Enable post codes to EC */ +#ifdef CONFIG_EARLY_POST_CROS_EC + mov $0x1b, %ecx + rdmsr + and $0x100, %eax + test %eax, %eax + je 2f
1f, maybe nitpicking.
board/google/common/early_init.S line 27
Quoted 11 lines
board/google/common/early_init.S +11
-0+ mov $0x8000f8f0, %eax + mov $0xcf8, %dx + out %eax, (%dx) + mov $0xfed1c001, %eax + mov $0xcfc, %dx + out %eax, (%dx) + mov $0xfed1f410, %esp + mov (%esp), %eax + and $0xfffffffb, %eax + mov %eax, (%esp) +2:
1:
board/google/common/early_init.S
Quoted 3 lines
board/google/common/early_init.S +1
-1+#endif jmp early_board_init_ret --
Regards,
Bin
PATCH v2 14/33 x86: chromebook_link: Implement CAR support (cache as RAM)
In reply to Simon GlassAdd support for CAR so that we have memory to use prior to DRAM init. On link there is a total of 128KB of CAR available, although some is used for the memory reference code.
---
Changes in v2:
- Expand the comment about preserving ebp
- Move SIPI code to after CAR init
- Use capitals for all #define declarations
arch/x86/Kconfig | 16 ++++ arch/x86/cpu/ivybridge/car.S | 162 ++++++++++++++++++++++++++++++++++- arch/x86/cpu/ivybridge/cpu.c | 2 + arch/x86/include/asm/mtrr.h | 121 ++++++++++++++++++++++++++ arch/x86/include/asm/post.h | 13 ++- board/google/chromebook_link/Kconfig | 12 +++ 6 files changed, 323 insertions(+), 3 deletions(-) create mode 100644 arch/x86/include/asm/mtrr.h
arch/x86/Kconfig +16 -0
@@ -34,6 +34,22 @@ config TARGET_CHROMEBOOK_LINK endchoice +config RAMBASE + hex + default 0x100000 + +config RAMTOP + hex + default 0x200000 + +config XIP_ROM_SIZE + hex + default 0x10000 + +config CPU_ADDR_BITS + int + default 36 + config ROM_SIZE hex default 0x800000
arch/x86/cpu/ivybridge/car.S +160 -2
169 lines not on this page · raw message
arch/x86/cpu/ivybridge/cpu.c +2 -0
@@ -12,6 +12,7 @@#include <common.h> #include <asm/cpu.h> +#include <asm/post.h> #include <asm/processor.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -20,6 +21,7 @@ int arch_cpu_init(void) {int ret; +post_code (POST_CPU_INIT );timer_set_base (rdtsc ()); ret =x86_cpu_init_f ();
arch/x86/include/asm/mtrr.h new file +121 -0
121 lines not on this page · raw message
arch/x86/include/asm/post.h +12 -1
@@ -13,9 +13,18 @@/* post codes which represent various stages of init */ #define POST_START 0x1e#define POST_CAR_START 0x1f - +#define POST_CAR_SIPI 0x20 +#define POST_CAR_MTRR 0x21 +#define POST_CAR_UNCACHEABLE 0x22 +#define POST_CAR_BASE_ADDRESS 0x23 +#define POST_CAR_MASK 0x24 +#define POST_CAR_FILL 0x25 +#define POST_CAR_ROM_CACHE 0x26 +#define POST_CAR_MRC_CACHE 0x27 +#define POST_CAR_CPU_CACHE 0x28#define POST_START_STACK 0x29#define POST_START_DONE 0x2a +#define POST_CPU_INIT 0x2b/* Output a post code using al - value must be 0 to 0xff */ #ifdef __ASSEMBLY__
@@ -23,6 +32,8 @@ movb $value, %al; \ outb %al, $POST_PORT#else +#include <asm/io.h> +static inline void post_code (int code) {outb (code,POST_PORT );
board/google/chromebook_link/Kconfig +12 -0
@@ -12,6 +12,18 @@ config SYS_SOC config SYS_CONFIG_NAME default "chromebook_link" +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + select CPU_INTEL_SOCKET_RPGA989 + select NORTHBRIDGE_INTEL_IVYBRIDGE + select SOUTHBRIDGE_INTEL_C216 + select HAVE_ACPI_RESUME + select MARK_GRAPHICS_MEM_WRCOMB + +config MMCONF_BASE_ADDRESS + hex + default 0xf0000000 + config EARLY_POST_CROS_EC bool "Enable early post to Chrome OS EC" default y
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 15/33 x86: Refactor PCI to permit alternate init
In reply to Simon GlassWe want access PCI earlier in the init sequence, so refactor the code so that it does not require use of a BSS variable to work. This will allow us to use early malloc() to store information about a PCI hose.
Common PCI code moves to arch/x86/cpu/pci.c and a new board_pci_setup_hose() function is provided by boards to set up the (single) hose used by that board.
---
Changes in v2: None
arch/x86/cpu/Makefile | 1 + arch/x86/cpu/coreboot/pci.c | 22 ++++++++-------------- arch/x86/cpu/pci.c | 26 ++++++++++++++++++++++++++ arch/x86/include/asm/pci.h | 11 +++++++++++ 4 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 arch/x86/cpu/pci.c
arch/x86/cpu/Makefile +1 -0
@@ -11,3 +11,4 @@ extra-y = start.o obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o obj-y += interrupts.o cpu.o call64.o +obj-$(CONFIG_PCI) += pci.o
arch/x86/cpu/coreboot/pci.c +8 -14
@@ -13,8 +13,6 @@#include <pci.h> #include <asm/pci.h> -static struct pci_controller coreboot_hose; -static void config_pci_bridge (struct pci_controller *hose,pci_dev_t dev,struct pci_config_table *table) {
@@ -31,19 +29,15 @@ static struct pci_config_table pci_coreboot_config_table[] = { {} }; -void pci_init_board (void ) +void board_pci_setup_hose (struct pci_controller *hose) { - coreboot_hose.config_table = pci_coreboot_config_table; - coreboot_hose.first_busno =0 ; - coreboot_hose.last_busno =0 ; - -pci_set_region (coreboot_hose.regions +0 ,0x0 ,0x0 ,0xffffffff , -PCI_REGION_MEM ); - coreboot_hose.region_count =1 ; - -pci_setup_type1 (&coreboot_hose); + hose->config_table = pci_coreboot_config_table; + hose->first_busno =0 ; + hose->last_busno =0 ; -pci_register_hose (&coreboot_hose); +pci_set_region (hose->regions +0 ,0x0 ,0x0 ,0xffffffff , +PCI_REGION_MEM ); + hose->region_count =1 ; -pci_hose_scan (&coreboot_hose); +pci_setup_type1 (hose); }
arch/x86/cpu/pci.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Copyright (c) 2011 The Chromium OS Authors. +* (C) Copyright 2008,2009 +* Graeme Russ, <[email protected]> +* +* (C) Copyright 2002 +* Daniel Engstr?m, Omicron Ceti AB, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <pci.h> +#include <asm/pci.h> + +static struct pci_controller x86_hose; + +void pci_init_board (void ) +{ +struct pci_controller *hose = &x86_hose; + +board_pci_setup_hose (hose); +pci_register_hose (hose); + +pci_hose_scan (hose); +}
arch/x86/include/asm/pci.h +11 -0
@@ -12,5 +12,16 @@#define DEFINE_PCI_DEVICE_TABLE (_table) \ const struct pci_device_id _table[] +struct pci_controller ; +void pci_setup_type1 (struct pci_controller *hose); + +/** +* board_pci_setup_hose() - Set up the PCI hose +* +* This is called by the common x86 PCI code to set up the PCI controller +* hose. It may be called when no memory/BSS is available so should just +* store things in 'hose' and not in BSS variables. +*/ +void board_pci_setup_hose (struct pci_controller *hose);#endif
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 15/33 x86: Refactor PCI to permit alternate init
Hi Simon,
Quoted 59 lines · Simon Glass
We want access PCI earlier in the init sequence, so refactor the code so that it does not require use of a BSS variable to work. This will allow us to use early
malloc()to store information about a PCI hose.Common PCI code moves to
arch/x86/cpu/pci.cand a newboard_pci_setup_hose()function is provided by boards to set up the (single) hose used by that board.Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/x86/cpu/Makefile | 1 + arch/x86/cpu/coreboot/pci.c | 22 ++++++++-------------- arch/x86/cpu/pci.c | 26 ++++++++++++++++++++++++++ arch/x86/include/asm/pci.h | 11 +++++++++++ 4 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 arch/x86/cpu/pci.carch/x86/cpu/Makefile +1
-0@@ -11,3 +11,4 @@ extra-y = start.o obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o obj-y += interrupts.o cpu.o call64.o +obj-$(CONFIG_PCI) += pci.oarch/x86/cpu/coreboot/pci.c +2
-12@@ -13,8 +13,6 @@#include <pci.h> #include <asm/pci.h> -static struct pci_controller coreboot_hose; -static void config_pci_bridge (struct pci_controller *hose,pci_dev_t dev,struct pci_config_table *table) {@@ -31,19 +29,15 @@ static struct pci_config_table pci_coreboot_config_table[] = { {} }; -void pci_init_board (void ) +void board_pci_setup_hose (struct pci_controller *hose) { - coreboot_hose.config_table = pci_coreboot_config_table; - coreboot_hose.first_busno =0 ; - coreboot_hose.last_busno =0 ; - -pci_set_region (coreboot_hose.regions +0 ,0x0 ,0x0 ,0xffffffff , -PCI_REGION_MEM ); - coreboot_hose.region_count =1 ; - -pci_setup_type1 (&coreboot_hose); + hose->config_table = pci_coreboot_config_table;
arch/x86/cpu/coreboot/pci.c static struct pci_config_table pci_coreboot_config_table[] = { · line 42
Quoted 10 lines
arch/x86/cpu/coreboot/pci.c +6
-2+ hose->first_busno =0 ; + hose->last_busno =0 ; -pci_register_hose (&coreboot_hose); +pci_set_region (hose->regions +0 ,0x0 ,0x0 ,0xffffffff , +PCI_REGION_MEM ); + hose->region_count =1 ; -pci_hose_scan (&coreboot_hose); +pci_setup_type1 (hose);
Should pci_setup_type1(hose) be moved to arch/x86/cpu/pci.c?
Quoted 22 lines
arch/x86/cpu/coreboot/pci.c +0
-0}arch/x86/cpu/pci.c new file +15
-0@@ -0,0 +1,26 @@ +/* +* Copyright (c) 2011 The Chromium OS Authors. +* (C) Copyright 2008,2009 +* Graeme Russ, <[email protected]> +* +* (C) Copyright 2002 +* Daniel Engstr?m, Omicron Ceti AB, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <pci.h> +#include <asm/pci.h> +
arch/x86/cpu/pci.c line 25
Quoted 10 lines
arch/x86/cpu/pci.c new file +10
-0+static struct pci_controller x86_hose; + +void pci_init_board (void ) +{ +struct pci_controller *hose = &x86_hose; + +board_pci_setup_hose (hose); +pci_register_hose (hose); + +pci_hose_scan (hose);
Should we save the return value of pci_hose_scan(hose) to hose->last_busno? I noticed that coreboot/pci.c is doing this in the config_device callback, but that callback causes infinite loop when I tested that logic on the Crown Bay board.
Quoted 13 lines
arch/x86/cpu/pci.c new file +1
-0+}arch/x86/include/asm/pci.h +3
-0@@ -12,5 +12,16 @@#define DEFINE_PCI_DEVICE_TABLE (_table) \ const struct pci_device_id _table[] +struct pci_controller ; +void pci_setup_type1 (struct pci_controller *hose); +
arch/x86/include/asm/pci.h
Quoted 10 lines
arch/x86/include/asm/pci.h +8
-1+/** +* board_pci_setup_hose() - Set up the PCI hose +* +* This is called by the common x86 PCI code to set up the PCI controller +* hose. It may be called when no memory/BSS is available so should just +* store things in 'hose' and not in BSS variables. +*/ +void board_pci_setup_hose (struct pci_controller *hose);#endif --
Regards,
Bin
PATCH v2 15/33 x86: Refactor PCI to permit alternate init
Hi Bin,
Quoted 70 lines · Bin Meng
Hi Simon,
Quoted 67 lines · Simon Glass
We want access PCI earlier in the init sequence, so refactor the code so that it does not require use of a BSS variable to work. This will allow us to use early
malloc()to store information about a PCI hose.Common PCI code moves to
arch/x86/cpu/pci.cand a newboard_pci_setup_hose()function is provided by boards to set up the (single) hose used by that board.Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/x86/cpu/Makefile | 1 + arch/x86/cpu/coreboot/pci.c | 22 ++++++++-------------- arch/x86/cpu/pci.c | 26 ++++++++++++++++++++++++++ arch/x86/include/asm/pci.h | 11 +++++++++++ 4 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 arch/x86/cpu/pci.carch/x86/cpu/Makefile +1
-0@@ -11,3 +11,4 @@ extra-y = start.o obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o obj-y += interrupts.o cpu.o call64.o +obj-$(CONFIG_PCI) += pci.oarch/x86/cpu/coreboot/pci.c +7
-13@@ -13,8 +13,6 @@#include <pci.h> #include <asm/pci.h> -static struct pci_controller coreboot_hose; -static void config_pci_bridge (struct pci_controller *hose,pci_dev_t dev,struct pci_config_table *table) {@@ -31,19 +29,15 @@ static struct pci_config_table pci_coreboot_config_table[] = { {} }; -void pci_init_board (void ) +void board_pci_setup_hose (struct pci_controller *hose) { - coreboot_hose.config_table = pci_coreboot_config_table; - coreboot_hose.first_busno =0 ; - coreboot_hose.last_busno =0 ; - -pci_set_region (coreboot_hose.regions +0 ,0x0 ,0x0 ,0xffffffff , -PCI_REGION_MEM ); - coreboot_hose.region_count =1 ; - -pci_setup_type1 (&coreboot_hose); + hose->config_table = pci_coreboot_config_table; + hose->first_busno =0 ; + hose->last_busno =0 ; -pci_register_hose (&coreboot_hose); +pci_set_region (hose->regions +0 ,0x0 ,0x0 ,0xffffffff , +PCI_REGION_MEM ); + hose->region_count =1 ;
Quoted 4 lines
arch/x86/cpu/coreboot/pci.c static struct pci_config_table pci_coreboot_config_table[] = { · line 42
Quoted 2 lines
arch/x86/cpu/coreboot/pci.c +1
-1-pci_hose_scan (&coreboot_hose); +pci_setup_type1 (hose);Should
pci_setup_type1(hose)be moved toarch/x86/cpu/pci.c?
It seems happy enough in lib/ - why do you think it should move?
Quoted 30 lines
Quoted 30 lines
arch/x86/cpu/coreboot/pci.c +0
-0}arch/x86/cpu/pci.c new file +22
-0@@ -0,0 +1,26 @@ +/* +* Copyright (c) 2011 The Chromium OS Authors. +* (C) Copyright 2008,2009 +* Graeme Russ, <[email protected]> +* +* (C) Copyright 2002 +* Daniel Engstr?m, Omicron Ceti AB, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <pci.h> +#include <asm/pci.h> + +static struct pci_controller x86_hose; + +void pci_init_board (void ) +{ +struct pci_controller *hose = &x86_hose; + +board_pci_setup_hose (hose);
Quoted 8 lines
arch/x86/cpu/pci.c line 25
Quoted 3 lines
arch/x86/cpu/pci.c new file +3
-0+pci_register_hose (hose); + +pci_hose_scan (hose);Should we save the return value of
pci_hose_scan(hose)tohose->last_busno? I noticed thatcoreboot/pci.cis doing this in theconfig_devicecallback, but that callback causes infinite loop when I tested that logic on the Crown Bay board.
I expect so, but perhaps that is for you to decide out when you send your patches? My objective is to get ivybridge into a reasonable state, but I and certainly expecting that you will want to change some things.
When you do that I will be able to test and may comments so we can keep both working.
Quoted 19 lines
Quoted 19 lines
arch/x86/cpu/pci.c new file +1
-0+}arch/x86/include/asm/pci.h +8
-0@@ -12,5 +12,16 @@#define DEFINE_PCI_DEVICE_TABLE (_table) \ const struct pci_device_id _table[] +struct pci_controller ; +void pci_setup_type1 (struct pci_controller *hose); + +/** +* board_pci_setup_hose() - Set up the PCI hose +* +* This is called by the common x86 PCI code to set up the PCI controller +* hose. It may be called when no memory/BSS is available so should just
Quoted 8 lines
arch/x86/include/asm/pci.h
Quoted 5 lines
arch/x86/include/asm/pci.h +3
-1+* store things in 'hose' and not in BSS variables. +*/ +void board_pci_setup_hose (struct pci_controller *hose);#endif --Regards,
Bin
Regards,
Simon
PATCH v2 15/33 x86: Refactor PCI to permit alternate init
Hi Simon,
Quoted 73 lines · Simon Glass
Hi Bin,
Quoted 70 lines · Bin Meng
Hi Simon,
Quoted 67 lines · Simon Glass
We want access PCI earlier in the init sequence, so refactor the code so that it does not require use of a BSS variable to work. This will allow us to use early
malloc()to store information about a PCI hose.Common PCI code moves to
arch/x86/cpu/pci.cand a newboard_pci_setup_hose()function is provided by boards to set up the (single) hose used by that board.Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/x86/cpu/Makefile | 1 + arch/x86/cpu/coreboot/pci.c | 22 ++++++++-------------- arch/x86/cpu/pci.c | 26 ++++++++++++++++++++++++++ arch/x86/include/asm/pci.h | 11 +++++++++++ 4 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 arch/x86/cpu/pci.carch/x86/cpu/Makefile +1
-0@@ -11,3 +11,4 @@ extra-y = start.o obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o obj-y += interrupts.o cpu.o call64.o +obj-$(CONFIG_PCI) += pci.oarch/x86/cpu/coreboot/pci.c +7
-13@@ -13,8 +13,6 @@#include <pci.h> #include <asm/pci.h> -static struct pci_controller coreboot_hose; -static void config_pci_bridge (struct pci_controller *hose,pci_dev_t dev,struct pci_config_table *table) {@@ -31,19 +29,15 @@ static struct pci_config_table pci_coreboot_config_table[] = { {} }; -void pci_init_board (void ) +void board_pci_setup_hose (struct pci_controller *hose) { - coreboot_hose.config_table = pci_coreboot_config_table; - coreboot_hose.first_busno =0 ; - coreboot_hose.last_busno =0 ; - -pci_set_region (coreboot_hose.regions +0 ,0x0 ,0x0 ,0xffffffff , -PCI_REGION_MEM ); - coreboot_hose.region_count =1 ; - -pci_setup_type1 (&coreboot_hose); + hose->config_table = pci_coreboot_config_table; + hose->first_busno =0 ; + hose->last_busno =0 ; -pci_register_hose (&coreboot_hose); +pci_set_region (hose->regions +0 ,0x0 ,0x0 ,0xffffffff , +PCI_REGION_MEM ); + hose->region_count =1 ;
Quoted 6 lines
Quoted 4 lines
arch/x86/cpu/coreboot/pci.c static struct pci_config_table pci_coreboot_config_table[] = { · line 42
Quoted 2 lines
arch/x86/cpu/coreboot/pci.c +1
-1-pci_hose_scan (&coreboot_hose); +pci_setup_type1 (hose);Should
pci_setup_type1(hose)be moved toarch/x86/cpu/pci.c?It seems happy enough in
lib/- why do you think it should move?
Sorry I should have said it more clearly. I mean the call to pci_setup_type1() should be moved to arch/x86/cpu/pci.c::pci_init_board(), right after the call to board_pci_setup_hose().
Quoted 39 lines
Quoted 30 lines
Quoted 30 lines
arch/x86/cpu/coreboot/pci.c +0
-0}arch/x86/cpu/pci.c new file +22
-0@@ -0,0 +1,26 @@ +/* +* Copyright (c) 2011 The Chromium OS Authors. +* (C) Copyright 2008,2009 +* Graeme Russ, <[email protected]> +* +* (C) Copyright 2002 +* Daniel Engstr?m, Omicron Ceti AB, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <pci.h> +#include <asm/pci.h> + +static struct pci_controller x86_hose; + +void pci_init_board (void ) +{ +struct pci_controller *hose = &x86_hose; + +board_pci_setup_hose (hose);Quoted 8 lines
arch/x86/cpu/pci.c line 25
Quoted 3 lines
arch/x86/cpu/pci.c new file +3
-0+pci_register_hose (hose); + +pci_hose_scan (hose);Should we save the return value of
pci_hose_scan(hose)tohose->last_busno? I noticed thatcoreboot/pci.cis doing this in theconfig_devicecallback, but that callback causes infinite loop when I tested that logic on the Crown Bay board.
Quoted 7 lines
I expect so, but perhaps that is for you to decide out when you send your patches? My objective is to get ivybridge into a reasonable state, but I and certainly expecting that you will want to change some things.
When you do that I will be able to test and may comments so we can keep both working.
Yep, I will send patches after your patches are in the mainline.
Regards,
Bin
PATCH v2 15/33 x86: Refactor PCI to permit alternate init
Hi Bin,
Quoted 81 lines · Bin Meng
Hi Simon,
Quoted 78 lines · Simon Glass
Hi Bin,
Quoted 74 lines · Bin Meng
Hi Simon,
Quoted 59 lines · Simon Glass
We want access PCI earlier in the init sequence, so refactor the code so that it does not require use of a BSS variable to work. This will allow us to use early
malloc()to store information about a PCI hose.Common PCI code moves to
arch/x86/cpu/pci.cand a newboard_pci_setup_hose()function is provided by boards to set up the (single) hose used by that board.Signed-off-by Simon Glass <[email protected]>---
Changes in v2: None
arch/x86/cpu/Makefile | 1 + arch/x86/cpu/coreboot/pci.c | 22 ++++++++-------------- arch/x86/cpu/pci.c | 26 ++++++++++++++++++++++++++ arch/x86/include/asm/pci.h | 11 +++++++++++ 4 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 arch/x86/cpu/pci.carch/x86/cpu/Makefile +1
-0@@ -11,3 +11,4 @@ extra-y = start.o obj-$(CONFIG_X86_RESET_VECTOR) += resetvec.o start16.o obj-y += interrupts.o cpu.o call64.o +obj-$(CONFIG_PCI) += pci.oarch/x86/cpu/coreboot/pci.c +2
-12@@ -13,8 +13,6 @@#include <pci.h> #include <asm/pci.h> -static struct pci_controller coreboot_hose; -static void config_pci_bridge (struct pci_controller *hose,pci_dev_t dev,struct pci_config_table *table) {@@ -31,19 +29,15 @@ static struct pci_config_table pci_coreboot_config_table[] = { {} }; -void pci_init_board (void ) +void board_pci_setup_hose (struct pci_controller *hose) { - coreboot_hose.config_table = pci_coreboot_config_table; - coreboot_hose.first_busno =0 ; - coreboot_hose.last_busno =0 ; - -pci_set_region (coreboot_hose.regions +0 ,0x0 ,0x0 ,0xffffffff , -PCI_REGION_MEM ); - coreboot_hose.region_count =1 ; - -pci_setup_type1 (&coreboot_hose); + hose->config_table = pci_coreboot_config_table;arch/x86/cpu/coreboot/pci.c static struct pci_config_table pci_coreboot_config_table[] = { · line 42
Quoted 10 lines
arch/x86/cpu/coreboot/pci.c +6
-2+ hose->first_busno =0 ; + hose->last_busno =0 ; -pci_register_hose (&coreboot_hose); +pci_set_region (hose->regions +0 ,0x0 ,0x0 ,0xffffffff , +PCI_REGION_MEM ); + hose->region_count =1 ; -pci_hose_scan (&coreboot_hose); +pci_setup_type1 (hose);Should
pci_setup_type1(hose)be moved toarch/x86/cpu/pci.c?
Quoted 6 lines
Quoted 1 line
It seems happy enough in
lib/- why do you think it should move?Sorry I should have said it more clearly. I mean the call to
pci_setup_type1()should be moved to arch/x86/cpu/pci.c::pci_init_board(), right after the call toboard_pci_setup_hose().
OK I see. But I think this might be board-specific code. Some boards might have different functions for access.
Quoted 45 lines
Quoted 45 lines
Quoted 31 lines
Quoted 31 lines
arch/x86/cpu/coreboot/pci.c +0
-0}arch/x86/cpu/pci.c new file +22
-0@@ -0,0 +1,26 @@ +/* +* Copyright (c) 2011 The Chromium OS Authors. +* (C) Copyright 2008,2009 +* Graeme Russ, <[email protected]> +* +* (C) Copyright 2002 +* Daniel Engstr?m, Omicron Ceti AB, <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <pci.h> +#include <asm/pci.h> + +static struct pci_controller x86_hose; + +void pci_init_board (void ) +{ +struct pci_controller *hose = &x86_hose; + +board_pci_setup_hose (hose);Quoted 8 lines
arch/x86/cpu/pci.c line 25
Quoted 3 lines
arch/x86/cpu/pci.c new file +3
-0+pci_register_hose (hose); + +pci_hose_scan (hose);Should we save the return value of
pci_hose_scan(hose)tohose->last_busno? I noticed thatcoreboot/pci.cis doing this in theconfig_devicecallback, but that callback causes infinite loop when I tested that logic on the Crown Bay board.I expect so, but perhaps that is for you to decide out when you send your patches? My objective is to get ivybridge into a reasonable state, but I and certainly expecting that you will want to change some things.
Quoted 4 lines
Quoted 2 lines
When you do that I will be able to test and may comments so we can keep both working.
Yep, I will send patches after your patches are in the mainline.
OK.
Regards,
Simon
PATCH v2 16/33 x86: Support use of PCI before relocation
In reply to Simon GlassAdd support for using PCI before SDRAM is available, using early malloc() and global_data.
---
Changes in v2:
- Split out new patch to support use fo PCI before relocation
arch/x86/cpu/pci.c | 20 ++++++++++++++++++++ arch/x86/include/asm/global_data.h | 1 + arch/x86/include/asm/pci.h | 9 +++++++++ 3 files changed, 30 insertions(+)
arch/x86/cpu/pci.c +20 -0
@@ -10,15 +10,35 @@*/ #include <common.h> +#include <errno.h> +#include <malloc.h> #include <pci.h> #include <asm/pci.h> static struct pci_controller x86_hose; +int pci_early_init_hose (struct pci_controller **hosep) +{ +struct pci_controller *hose; + + hose =calloc (1 ,sizeof (struct pci_controller )); +if (!hose) +return -ENOMEM ; + +board_pci_setup_hose (hose); + gd->arch.hose = hose; + *hosep = hose; + +return 0 ; +} +void pci_init_board (void ) {struct pci_controller *hose = &x86_hose; +/* Stop using the early hose */ + gd->arch.hose =NULL ; +board_pci_setup_hose (hose);pci_register_hose (hose);
arch/x86/include/asm/global_data.h +1 -0
@@ -24,6 +24,7 @@ struct arch_global_data {uint32_t tsc_mhz;/* TSC frequency in MHz */ void *new_fdt;/* Relocated FDT */ uint32_t bist;/* Built-in self test value */ + struct pci_controller *hose; /* PCI hose for early use */ };#endif
arch/x86/include/asm/pci.h +9 -0
@@ -24,4 +24,13 @@ void pci_setup_type1(struct pci_controller *hose);* store things in 'hose' and not in BSS variables. */ void board_pci_setup_hose (struct pci_controller *hose); + +/** +* pci_early_init_hose() - Set up PCI host before relocation +* +* This allocates memory for, sets up and returns the PCI hose. It can be +* called before relocation. The hose will be stored in gd->arch.hose for +* later use, but will become invalid one DRAM is available. +*/ +int pci_early_init_hose (struct pci_controller **hosep);#endif
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 17/33 x86: ivybridge: Enable PCI in early init
In reply to Simon GlassEnable PCI so we can access devices that need to be set up before relocation.
---
Changes in v2: None
arch/x86/cpu/ivybridge/Makefile | 1 + arch/x86/cpu/ivybridge/cpu.c | 6 ++++ arch/x86/cpu/ivybridge/pci.c | 63 +++++++++++++++++++++++++++++++++++++++ include/configs/chromebook_link.h | 14 +++++++-- 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 arch/x86/cpu/ivybridge/pci.c
arch/x86/cpu/ivybridge/Makefile +1 -0
@@ -6,4 +6,5 @@ obj-y += car.o obj-y += cpu.o +obj-y += pci.o obj-y += sdram.o
arch/x86/cpu/ivybridge/cpu.c +6 -0
@@ -12,6 +12,7 @@#include <common.h> #include <asm/cpu.h> +#include <asm/pci.h> #include <asm/post.h> #include <asm/processor.h>
@@ -19,6 +20,7 @@ DECLARE_GLOBAL_DATA_PTR;int arch_cpu_init (void ) { +struct pci_controller *hose;int ret;post_code (POST_CPU_INIT );
@@ -28,6 +30,10 @@ int arch_cpu_init(void)if (ret)return ret; + ret =pci_early_init_hose (&hose); +if (ret) +return ret; +return 0 ; }
arch/x86/cpu/ivybridge/pci.c new file +63 -0
63 lines not on this page · raw message
include/configs/chromebook_link.h +12 -2
@@ -45,8 +45,6 @@#undef CONFIG_CMD_GPIO#undef CONFIG_VIDEO#undef CONFIG_CFB_CONSOLE -#undef CONFIG_SYS_EARLY_PCI_INIT -#undef CONFIG_PCI#undef CONFIG_ICH_SPI#undef CONFIG_SPI#undef CONFIG_CMD_SPI
@@ -55,6 +53,18 @@#undef CONFIG_CMD_USB#undef CONFIG_CMD_SCSI +#define CONFIG_PCI_MEM_BUS 0xe0000000 +#define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS +#define CONFIG_PCI_MEM_SIZE 0x10000000 + +#define CONFIG_PCI_PREF_BUS 0xd0000000 +#define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS +#define CONFIG_PCI_PREF_SIZE 0x10000000 + +#define CONFIG_PCI_IO_BUS 0x1000 +#define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS +#define CONFIG_PCI_IO_SIZE 0xefff +#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,serial\0" \ "stdout=vga,serial\0" \ "stderr=vga,serial\0"
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 18/33 x86: pci: Allow configuration before relocation
In reply to Simon GlassAdd simple PCI access routines for x86 which permit use before relocation. The normal PCI stack is still used, but for pre-relocation use there can only ever be a single hose. After relocation, fall back to the normal access, although even then on x86 machines there is normally only a single PCI bus.
---
Changes in v2: None
arch/x86/cpu/pci.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++ arch/x86/include/asm/pci.h | 13 ++++++++++++ 2 files changed, 63 insertions(+)
arch/x86/cpu/pci.c +50 -0
@@ -44,3 +44,53 @@ void pci_init_board(void)pci_hose_scan (hose); } + +static struct pci_controller *get_hose (void ) +{ +if (gd->arch.hose) +return gd->arch.hose; + +return pci_bus_to_hose (0 ); +} + +unsigned int pci_read_config8 (pci_dev_t dev,unsigned where) +{ +uint8_t value; + +pci_hose_read_config_byte (get_hose (), dev, where, &value); + +return value; +} + +unsigned int pci_read_config16 (pci_dev_t dev,unsigned where) +{ +uint16_t value; + +pci_hose_read_config_word (get_hose (), dev, where, &value); + +return value; +} + +unsigned int pci_read_config32 (pci_dev_t dev,unsigned where) +{ +uint32_t value; + +pci_hose_read_config_dword (get_hose (), dev, where, &value); + +return value; +} + +void pci_write_config8 (pci_dev_t dev,unsigned where,unsigned value) +{ +pci_hose_write_config_byte (get_hose (), dev, where, value); +} + +void pci_write_config16 (pci_dev_t dev,unsigned where,unsigned value) +{ +pci_hose_write_config_word (get_hose (), dev, where, value); +} + +void pci_write_config32 (pci_dev_t dev,unsigned where,unsigned value) +{ +pci_hose_write_config_dword (get_hose (), dev, where, value); +}
arch/x86/include/asm/pci.h +13 -0
@@ -33,4 +33,17 @@ void board_pci_setup_hose(struct pci_controller *hose);* later use, but will become invalid one DRAM is available. */ int pci_early_init_hose (struct pci_controller **hosep); + +/* +* Simple PCI access routines - these work from either the early PCI hose +* or the 'real' one, created after U-Boot has memory available +*/ +unsigned int pci_read_config8 (pci_dev_t dev,unsigned where); +unsigned int pci_read_config16 (pci_dev_t dev,unsigned where); +unsigned int pci_read_config32 (pci_dev_t dev,unsigned where); + +void pci_write_config8 (pci_dev_t dev,unsigned where,unsigned value); +void pci_write_config16 (pci_dev_t dev,unsigned where,unsigned value); +void pci_write_config32 (pci_dev_t dev,unsigned where,unsigned value); +#endif
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 19/33 x86: ivybridge: Add early LPC init so that serial works
In reply to Simon GlassThe PCH (Platform Controller Hub) includes an LPC (Low Pin Count) device which provides a serial port. This is accessible on Chromebooks, so enable it early in the boot process.
---
Changes in v2:
- Fix mangled cros_ec reg property
arch/x86/cpu/ivybridge/Makefile | 1 + arch/x86/cpu/ivybridge/cpu.c | 12 ++++++++ arch/x86/cpu/ivybridge/lpc.c | 48 +++++++++++++++++++++++++++++ arch/x86/dts/link.dts | 1 + arch/x86/include/asm/arch-ivybridge/pch.h | 48 +++++++++++++++++++++++++++++ doc/device-tree-bindings/misc/intel-lpc.txt | 23 ++++++++++++++ 6 files changed, 133 insertions(+) create mode 100644 arch/x86/cpu/ivybridge/lpc.c create mode 100644 arch/x86/include/asm/arch-ivybridge/pch.h create mode 100644 doc/device-tree-bindings/misc/intel-lpc.txt
arch/x86/cpu/ivybridge/Makefile +1 -0
@@ -6,5 +6,6 @@ obj-y += car.o obj-y += cpu.o +obj-y += lpc.o obj-y += pci.o obj-y += sdram.o
arch/x86/cpu/ivybridge/cpu.c +12 -0
@@ -11,16 +11,21 @@*/ #include <common.h> +#include <errno.h> +#include <fdtdec.h> #include <asm/cpu.h> #include <asm/pci.h> #include <asm/post.h> #include <asm/processor.h> +#include <asm/arch/pch.h> DECLARE_GLOBAL_DATA_PTR ;int arch_cpu_init (void ) { +const void *blob = gd->fdt_blob;struct pci_controller *hose; +int node;int ret;post_code (POST_CPU_INIT );
@@ -34,6 +39,13 @@ int arch_cpu_init(void)if (ret)return ret; + node =fdtdec_next_compatible (blob,0 ,COMPAT_INTEL_LPC ); +if (node <0 ) +return -ENOENT ; + ret =lpc_early_init (gd->fdt_blob, node,PCH_LPC_DEV ); +if (ret) +return ret; +return 0 ; }
arch/x86/cpu/ivybridge/lpc.c new file +48 -0
48 lines not on this page · raw message
arch/x86/dts/link.dts +1 -0
@@ -53,6 +53,7 @@ compatible = "intel,lpc"; #address-cells = <1>; #size-cells = <1>; + gen-dec = <0x800 0xfc 0x900 0xfc>; cros-ec at 200 { compatible = "google,cros-ec"; reg = <0x204 1 0x200 1 0x880 0x80>;
arch/x86/include/asm/arch-ivybridge/pch.h new file +48 -0
48 lines not on this page · raw message
doc/device-tree-bindings/misc/intel-lpc.txt new file +23 -0
@@ -0,0 +1,23 @@ +Intel LPC Device Binding +======================== + +The device tree node which describes the operation of the Intel Low Pin +Count device is as follows: + +Required properties : +- compatible = "intel,lpc" +- gen-dec : Specifies the values for the gen-dec registers. Up to four cell + pairs can be provided - the first of each pair is the base address and + the second is the size. These are written into the GENx_DEC registers of + the LPC device + + +Example +------- + +lpc { + compatible = "intel,lpc"; + #address-cells = <1>; + #size-cells = <1>; + gen-dec = <0x800 0xfc 0x900 0xfc>; +};
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 20/33 x86: Tidy up coreboot header usage
In reply to Simon GlassThere is no need to explicitly write 'arch-coreboot' when including headers, as when the arch directory points to coreboot the correct files will be used.
---
Changes in v2: None
arch/x86/cpu/coreboot/coreboot.c | 4 ++-- arch/x86/cpu/coreboot/ipchecksum.c | 2 +- arch/x86/cpu/coreboot/tables.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +2 -2
@@ -16,8 +16,8 @@#include <asm/cpu.h> #include <asm/io.h> #include <asm/post.h> -#include <asm/arch-coreboot/tables.h> -#include <asm/arch-coreboot/sysinfo.h> +#include <asm/arch/tables.h> +#include <asm/arch/sysinfo.h> #include <asm/arch/timestamp.h> DECLARE_GLOBAL_DATA_PTR ;
arch/x86/cpu/coreboot/ipchecksum.c +1 -1
@@ -30,7 +30,7 @@*/ #include <compiler.h> -#include <asm/arch-coreboot/ipchecksum.h> +#include <asm/arch/ipchecksum.h> unsigned short ipchksum (const void *vptr,unsigned long nbytes) {
arch/x86/cpu/coreboot/tables.c +3 -3
@@ -8,9 +8,9 @@*/ #include <common.h> -#include <asm/arch-coreboot/ipchecksum.h> -#include <asm/arch-coreboot/sysinfo.h> -#include <asm/arch-coreboot/tables.h> +#include <asm/arch/ipchecksum.h> +#include <asm/arch/sysinfo.h> +#include <asm/arch/tables.h> /* * This needs to be in the .data section so that it's copied over during
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 21/33 x86: Add clr/setbits functions
In reply to Simon GlassThese are available on other architectures. Make them available on x86 also.
---
Changes in v2: None
arch/x86/include/asm/io.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
arch/x86/include/asm/io.h +49 -0
@@ -69,6 +69,55 @@#define memcpy_fromio (a,b,c) memcpy((a),(b),(c))#define memcpy_toio (a,b,c) memcpy((a),(b),(c)) +#define write_arch (type, endian, a, v) __raw_write##type(cpu_to_##endian(v), a) +#define read_arch (type, endian, a) endian##_to_cpu(__raw_read##type(a)) + +#define write_le64 (a, v) write_arch(q, le64, a, v) +#define write_le32 (a, v) write_arch(l, le32, a, v) +#define write_le16 (a, v) write_arch(w, le16, a, v) + +#define read_le64 (a) read_arch(q, le64, a) +#define read_le32 (a) read_arch(l, le32, a) +#define read_le16 (a) read_arch(w, le16, a) + +#define write_be32 (a, v) write_arch(l, be32, a, v) +#define write_be16 (a, v) write_arch(w, be16, a, v) + +#define read_be32 (a) read_arch(l, be32, a) +#define read_be16 (a) read_arch(w, be16, a) + +#define write_8 (a, v) __raw_writeb(v, a) +#define read_8 (a) __raw_readb(a) + +#define clrbits (type, addr, clear) \ + write_##type((addr), read_##type(addr) & ~(clear)) + +#define setbits (type, addr, set) \ + write_##type((addr), read_##type(addr) | (set)) + +#define clrsetbits (type, addr, clear, set) \ + write_##type((addr), (read_##type(addr) & ~(clear)) | (set)) + +#define clrbits_be32 (addr, clear) clrbits(be32, addr, clear) +#define setbits_be32 (addr, set) setbits(be32, addr, set) +#define clrsetbits_be32 (addr, clear, set) clrsetbits(be32, addr, clear, set) + +#define clrbits_le32 (addr, clear) clrbits(le32, addr, clear) +#define setbits_le32 (addr, set) setbits(le32, addr, set) +#define clrsetbits_le32 (addr, clear, set) clrsetbits(le32, addr, clear, set) + +#define clrbits_be16 (addr, clear) clrbits(be16, addr, clear) +#define setbits_be16 (addr, set) setbits(be16, addr, set) +#define clrsetbits_be16 (addr, clear, set) clrsetbits(be16, addr, clear, set) + +#define clrbits_le16 (addr, clear) clrbits(le16, addr, clear) +#define setbits_le16 (addr, set) setbits(le16, addr, set) +#define clrsetbits_le16 (addr, clear, set) clrsetbits(le16, addr, clear, set) + +#define clrbits_8 (addr, clear) clrbits(8, addr, clear) +#define setbits_8 (addr, set) setbits(8, addr, set) +#define clrsetbits_8 (addr, clear, set) clrsetbits(8, addr, clear, set) +/* * ISA space is 'always mapped' on a typical x86 system, no need to * explicitly ioremap() it. The fact that the ISA IO space is mapped
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 22/33 x86: Add msr read/write functions that use a structure
In reply to Simon GlassIt is convenient to be able to adjust MSRs with a structure that splits the two 32-bit halves into separate fields, as they are often dealt with separately. Add a few functions to support this.
---
Changes in v2: None
arch/x86/include/asm/msr.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/x86/include/asm/msr.h +19 -0
@@ -175,6 +175,25 @@ static inline int wrmsr_safe_regs(u32 regs[8])return native_wrmsr_safe_regs (regs); } +typedef struct msr_t { +uint32_t lo; +uint32_t hi; +}msr_t ; + +static inline struct msr_t msr_read (unsigned msr_num) +{ +struct msr_t msr; + +rdmsr (msr_num, msr.lo, msr.hi); + +return msr; +} + +static inline void msr_write (unsigned msr_num,msr_t msr) +{ +wrmsr (msr_num, msr.lo, msr.hi); +} +#define rdtscl (low) \ ((low) = (u32)__native_read_tsc())
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 23/33 x86: ivybridge: Perform initial CPU setup
In reply to Simon GlassSet up the flex ratio (controls speed versus heat output) and a few other very early things.
---
Changes in v2: None
arch/x86/cpu/ivybridge/cpu.c | 130 ++++++++++++++++++++++ arch/x86/include/asm/arch-ivybridge/model_206ax.h | 82 ++++++++++++++ arch/x86/include/asm/arch-ivybridge/pch.h | 60 ++++++++++ arch/x86/include/asm/processor.h | 2 + 4 files changed, 274 insertions(+) create mode 100644 arch/x86/include/asm/arch-ivybridge/model_206ax.h
arch/x86/cpu/ivybridge/cpu.c +130 -0
@@ -14,13 +14,123 @@#include <errno.h> #include <fdtdec.h> #include <asm/cpu.h> +#include <asm/io.h> +#include <asm/msr.h> +#include <asm/mtrr.h> #include <asm/pci.h> #include <asm/post.h> #include <asm/processor.h> +#include <asm/arch/model_206ax.h> #include <asm/arch/pch.h> DECLARE_GLOBAL_DATA_PTR ; +static void enable_port80_on_lpc (struct pci_controller *hose,pci_dev_t dev) +{ +/* Enable port 80 POST on LPC */ +pci_hose_write_config_dword (hose, dev,PCH_RCBA_BASE ,DEFAULT_RCBA |1 ); +clrbits_le32 (RCB_REG (GCS ),4 ); +} + +/* +* Enable Prefetching and Caching. +*/ +static void enable_spi_prefetch (struct pci_controller *hose,pci_dev_t dev) +{ +u8 reg8; + +pci_hose_read_config_byte (hose, dev,0xdc , ®8); + reg8 &= ~(3 <<2 ); + reg8 |= (2 <<2 );/* Prefetching and Caching Enabled */ +pci_hose_write_config_byte (hose, dev,0xdc , reg8); +} + +static void set_var_mtrr ( +unsigned reg,unsigned base,unsigned size,unsigned type) + +{ +/* Bit Bit 32-35 of MTRRphysMask should be set to 1 */ +/* FIXME: It only support 4G less range */ +wrmsr (MTRRphysBase_MSR (reg), base | type,0 ); +wrmsr (MTRRphysMask_MSR (reg), ~(size -1 ) | MTRRphysMaskValid, + (1 << (CONFIG_CPU_ADDR_BITS -32 )) -1 ); +} + +static void enable_rom_caching (void ) +{ +disable_caches (); +set_var_mtrr (1 ,0xffc00000 ,4 <<20 ,MTRR_TYPE_WRPROT ); +enable_caches (); + +/* Enable Variable MTRRs */ +wrmsr (MTRRdefType_MSR,0x800 ,0 ); +} + +static int set_flex_ratio_to_tdp_nominal (void ) +{ +msr_t flex_ratio, msr; +u8 nominal_ratio; + +/* Minimum CPU revision for configurable TDP support */ +if (cpuid_eax (1 ) <IVB_CONFIG_TDP_MIN_CPUID ) +return -EINVAL ; + +/* Check for Flex Ratio support */ + flex_ratio =msr_read (MSR_FLEX_RATIO ); +if (!(flex_ratio.lo &FLEX_RATIO_EN )) +return -EINVAL ; + +/* Check for >0 configurable TDPs */ + msr =msr_read (MSR_PLATFORM_INFO ); +if (((msr.hi >>1 ) &3 ) ==0 ) +return -EINVAL ; + +/* Use nominal TDP ratio for flex ratio */ + msr =msr_read (MSR_CONFIG_TDP_NOMINAL ); + nominal_ratio = msr.lo &0xff ; + +/* See if flex ratio is already set to nominal TDP ratio */ +if (((flex_ratio.lo >>8 ) &0xff ) == nominal_ratio) +return 0 ; + +/* Set flex ratio to nominal TDP ratio */ + flex_ratio.lo &= ~0xff00 ; + flex_ratio.lo |= nominal_ratio <<8 ; + flex_ratio.lo |=FLEX_RATIO_LOCK ; +msr_write (MSR_FLEX_RATIO , flex_ratio); + +/* Set flex ratio in soft reset data register bits 11:6 */ +clrsetbits_le32 (RCB_REG (SOFT_RESET_DATA ),0x3f <<6 , + (nominal_ratio &0x3f ) <<6 ); + +/* Set soft reset control to use register value */ +setbits_le32 (RCB_REG (SOFT_RESET_CTRL ),1 ); + +/* Issue warm reset, will be "CPU only" due to soft reset data */ +outb (0x0 ,PORT_RESET ); +outb (0x6 ,PORT_RESET ); +cpu_hlt (); + +/* Not reached */ +return -EINVAL ; +} + +static void set_spi_speed (void ) +{ +u32 fdod; + +/* Observe SPI Descriptor Component Section 0 */ +writel (0x1000 ,RCB_REG (SPI_DESC_COMP0 )); + +/* Extract the1 Write/Erase SPI Frequency from descriptor */ + fdod =readl (RCB_REG (SPI_FREQ_WR_ERA )); + fdod >>=24 ; + fdod &=7 ; + +/* Set Software Sequence frequency to match */ +clrsetbits_8 (RCB_REG (SPI_FREQ_SWSEQ ),7 , fdod); +} +int arch_cpu_init (void ) {const void *blob = gd->fdt_blob;
@@ -46,6 +156,26 @@ int arch_cpu_init(void)if (ret)return ret; +enable_spi_prefetch (hose,PCH_LPC_DEV ); + +/* This is already done in start.S, but let's do it in C */ +enable_port80_on_lpc (hose,PCH_LPC_DEV ); + +/* already done in car.S */ +if (false) +enable_rom_caching (); + +set_spi_speed (); + +/* +* We should do as little as possible before the serial console is +* up. Perhaps this should move to later. Our next lot of init +* happens in print_cpuinfo() when we have a console +*/ + ret =set_flex_ratio_to_tdp_nominal (); +if (ret) +return ret; +return 0 ; }
arch/x86/include/asm/arch-ivybridge/model_206ax.h new file +82 -0
82 lines not on this page · raw message
arch/x86/include/asm/arch-ivybridge/pch.h +60 -0
66 lines not on this page · raw message
arch/x86/include/asm/processor.h +2 -0
@@ -32,6 +32,8 @@ enum {#ifndef __ASSEMBLY__ +#define PORT_RESET 0xcf9 +static inline __attribute__((always_inline))void cpu_hlt (void ) { asm("hlt" );
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 24/33 x86: ivybridge: Check BIST value on boot
In reply to Simon GlassThe built-in self test value should be checked before we continue booting. Refuse to continue if there is something wrong.
---
Changes in v2: None
arch/x86/cpu/ivybridge/cpu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/x86/cpu/ivybridge/cpu.c +16 -0
@@ -179,10 +179,26 @@ int arch_cpu_init(void)return 0 ; } +static int report_bist_failure (void ) +{ +if (gd->arch.bist !=0 ) { +printf ("BIST failed: %08x\n" , gd->arch.bist); +return -EFAULT ; + } + +return 0 ; +} +int print_cpuinfo (void ) {char processor_name[CPU_MAX_NAME_LEN ];const char *name; +int ret; + +/* Halt if there was a built in self test failure */ + ret =report_bist_failure (); +if (ret) +return ret;/* Print processor name */ name =cpu_get_name (processor_name);
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 25/33 x86: ivybridge: Perform Intel microcode update on boot
In reply to Simon GlassMicrocode updates are stored in the device tree. Work through these and apply any that are needed.
---
Changes in v2: None
arch/x86/cpu/ivybridge/Makefile | 1 + arch/x86/cpu/ivybridge/cpu.c | 5 + arch/x86/cpu/ivybridge/microcode_intel.c | 151 ++++++++++++++++++++++++ arch/x86/include/asm/arch-ivybridge/microcode.h | 20 ++++ include/fdtdec.h | 1 + lib/fdtdec.c | 1 + 6 files changed, 179 insertions(+) create mode 100644 arch/x86/cpu/ivybridge/microcode_intel.c create mode 100644 arch/x86/include/asm/arch-ivybridge/microcode.h
arch/x86/cpu/ivybridge/Makefile +1 -0
@@ -7,5 +7,6 @@ obj-y += car.o obj-y += cpu.o obj-y += lpc.o +obj-y += microcode_intel.o obj-y += pci.o obj-y += sdram.o
arch/x86/cpu/ivybridge/cpu.c +5 -0
@@ -21,6 +21,7 @@#include <asm/post.h> #include <asm/processor.h> #include <asm/arch/model_206ax.h> +#include <asm/arch/microcode.h> #include <asm/arch/pch.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -200,6 +201,10 @@ int print_cpuinfo(void)if (ret)return ret; + ret =microcode_update_intel (); +if (ret && ret != -ENOENT && ret != -EEXIST ) +return ret; +/* Print processor name */ name =cpu_get_name (processor_name);printf ("CPU: %s\n" , name);
arch/x86/cpu/ivybridge/microcode_intel.c new file +151 -0
151 lines not on this page · raw message
arch/x86/include/asm/arch-ivybridge/microcode.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright (c) 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ASM_ARCH_MICROCODE_H +#define __ASM_ARCH_MICROCODE_H + +/** +* microcode_update_intel() - Apply microcode updates +* +* Applies any microcode updates in the device tree. +* +* @return 0 if OK, -EEXIST if the updates were already applied, -ENOENT if +* not updates were found, -EINVAL if an update was invalid +*/ +int microcode_update_intel (void ); + +#endif
include/fdtdec.h +1 -0
@@ -118,6 +118,7 @@ enum fdt_compat_id {COMPAT_SAMSUNG_EXYNOS_SYSMMU ,/* Exynos sysmmu */ COMPAT_PARADE_PS8625 ,/* Parade PS8622 EDP->LVDS bridge */ COMPAT_INTEL_LPC ,/* Intel Low Pin Count I/F */ +COMPAT_INTEL_MICROCODE ,/* Intel microcode update */ COMPAT_COUNT, };
lib/fdtdec.c +1 -0
@@ -73,6 +73,7 @@ static const char * const compat_names[COMPAT_COUNT] = {COMPAT (SAMSUNG_EXYNOS_SYSMMU ,"samsung,sysmmu-v3.3" ),COMPAT (PARADE_PS8625 ,"parade,ps8625" ),COMPAT (COMPAT_INTEL_LPC ,"intel,lpc" ), + COMPAT(INTEL_MICROCODE, "intel,microcode"), };const char *fdtdec_get_compatible (enum fdt_compat_id id)
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 26/33 x86: dts: Add microcode updates for ivybridge CPU
In reply to Simon GlassAdd two microcode updates that are provided for this CPU. The updates have been converted to a device tree form.
Note: SPDX submission has been done. If this license is approved I will convert the files to use SPDX.
---
Changes in v2:
- Change commit message to indicate that SPDX license request is submitted
arch/x86/dts/link.dts | 10 + arch/x86/dts/m12206a7_00000028.dtsi | 622 ++++++++++++++++++++++++++++++ arch/x86/dts/m12306a9_00000017.dtsi | 750 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1382 insertions(+) create mode 100644 arch/x86/dts/m12206a7_00000028.dtsi create mode 100644 arch/x86/dts/m12306a9_00000017.dtsi
arch/x86/dts/link.dts +10 -0
@@ -67,4 +67,14 @@ }; }; }; + + microcode { + update at 0 { +#include "m12206a7_00000028.dtsi" + }; + update at 1 { +#include "m12306a9_00000017.dtsi" + }; + }; + };
arch/x86/dts/m12206a7_00000028.dtsi new file +622 -0
622 lines not on this page · raw message
arch/x86/dts/m12306a9_00000017.dtsi new file +750 -0
750 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 27/33 x86: ivybridge: Add early init for PCH devices
In reply to Simon GlassMany PCH devices are hard-coded to a particular PCI address. Set these up early in case they are needed.
---
Changes in v2: None
arch/x86/cpu/ivybridge/Makefile | 1 + arch/x86/cpu/ivybridge/cpu.c | 141 +++++++++++++++++++++ arch/x86/cpu/ivybridge/early_init.c | 145 ++++++++++++++++++++++ arch/x86/include/asm/arch-ivybridge/pch.h | 121 +++++++++++++++++- arch/x86/include/asm/arch-ivybridge/sandybridge.h | 107 ++++++++++++++++ arch/x86/include/asm/global_data.h | 8 ++ arch/x86/include/asm/post.h | 2 + 7 files changed, 524 insertions(+), 1 deletion(-) create mode 100644 arch/x86/cpu/ivybridge/early_init.c create mode 100644 arch/x86/include/asm/arch-ivybridge/sandybridge.h
arch/x86/cpu/ivybridge/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-y += car.o obj-y += cpu.o +obj-y += early_init.o obj-y += lpc.o obj-y += microcode_intel.o obj-y += pci.o
arch/x86/cpu/ivybridge/cpu.c +141 -0
176 lines not on this page · raw message
arch/x86/cpu/ivybridge/early_init.c new file +145 -0
145 lines not on this page · raw message
arch/x86/include/asm/arch-ivybridge/pch.h +120 -1
144 lines not on this page · raw message
arch/x86/include/asm/arch-ivybridge/sandybridge.h new file +107 -0
107 lines not on this page · raw message
arch/x86/include/asm/global_data.h +8 -0
@@ -10,6 +10,13 @@ #ifndef __ASSEMBLY__ +enum pei_boot_mode_t { + PEI_BOOT_NONE = 0, + PEI_BOOT_SOFT_RESET, + PEI_BOOT_RESUME, + +}; + /* Architecture-specific global data */ struct arch_global_data { struct global_data *gd_addr; /* Location of Global Data */
@@ -25,6 +32,7 @@ struct arch_global_data {void *new_fdt;/* Relocated FDT */ uint32_t bist;/* Built-in self test value */ struct pci_controller *hose;/* PCI hose for early use */ + enum pei_boot_mode_t pei_boot_mode; };#endif
arch/x86/include/asm/post.h +2 -0
@@ -25,6 +25,8 @@#define POST_START_STACK 0x29#define POST_START_DONE 0x2a#define POST_CPU_INIT 0x2b +#define POST_EARLY_INIT 0x2c +#define POST_CPU_INFO 0x2d/* Output a post code using al - value must be 0 to 0xff */ #ifdef __ASSEMBLY__
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 28/33 x86: ivybridge: Add support for early GPIO init
In reply to Simon GlassWhen not relying on Coreboot for GPIO init the GPIOs must be set up correctly. This is currently done statically through a rather ugly method. As the GPIOs are figured out they can be moved to the device tree and set up as needed rather than all at the start.
In this implementation, board files should call ich_gpio_set_gpio_map() before the GPIO driver is used in order to provide the GPIO information. We use the early PCI interface so that this driver can now be used before relocation.
---
Changes in v2: None
arch/x86/include/asm/arch-coreboot/gpio.h | 5 -- arch/x86/include/asm/arch-ivybridge/pch.h | 16 ++++ arch/x86/include/asm/global_data.h | 1 + arch/x86/include/asm/gpio.h | 142 +++++++++++++++++++++++++++++- drivers/gpio/intel_ich6_gpio.c | 79 ++++++++++++++--- 5 files changed, 227 insertions(+), 16 deletions(-)
arch/x86/include/asm/arch-coreboot/gpio.h +0 -5
@@ -7,9 +7,4 @@#ifndef _X86_ARCH_GPIO_H_#define _X86_ARCH_GPIO_H_ -struct ich6_bank_platdata { -uint32_t base_addr; -const char *bank_name; -}; -#endif /* _X86_ARCH_GPIO_H_ */
arch/x86/include/asm/arch-ivybridge/pch.h +16 -0
@@ -142,6 +142,22 @@#define FD2 0x3428/* 32bit */ #define CG 0x341c/* 32bit */ +/* ICH7 GPIOBASE */ +#define GPIO_USE_SEL 0x00 +#define GP_IO_SEL 0x04 +#define GP_LVL 0x0c +#define GPO_BLINK 0x18 +#define GPI_INV 0x2c +#define GPIO_USE_SEL2 0x30 +#define GP_IO_SEL2 0x34 +#define GP_LVL2 0x38 +#define GPIO_USE_SEL3 0x40 +#define GP_IO_SEL3 0x44 +#define GP_LVL3 0x48 +#define GP_RST_SEL1 0x60 +#define GP_RST_SEL2 0x64 +#define GP_RST_SEL3 0x68 +/* ICH7 PMBASE */ #define PM1_STS 0x00#define WAK_STS (1 << 15)
arch/x86/include/asm/global_data.h +1 -0
@@ -33,6 +33,7 @@ struct arch_global_data {uint32_t bist;/* Built-in self test value */ struct pci_controller *hose;/* PCI hose for early use */ enum pei_boot_mode_t pei_boot_mode; + const struct pch_gpio_map *gpio_map; /* board GPIO map */ };#endif
arch/x86/include/asm/gpio.h +141 -1
153 lines not on this page · raw message
drivers/gpio/intel_ich6_gpio.c +69 -10
154 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 29/33 x86: chromebook_link: Enable GPIO support
In reply to Simon GlassEnable GPIO support and provide the required GPIO setup information to the driver.
---
Changes in v2: None
arch/x86/dts/link.dts | 3 + board/google/chromebook_link/link.c | 107 ++++++++++++++++++++++++++++++++++++ include/configs/chromebook_link.h | 4 +- 3 files changed, 111 insertions(+), 3 deletions(-)
arch/x86/dts/link.dts +3 -0
@@ -14,18 +14,21 @@ gpioa { compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; reg = <0 0x10>; bank-name = "A"; }; gpiob { compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; reg = <0x30 0x10>; bank-name = "B"; }; gpioc { compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; reg = <0x40 0x10>; bank-name = "C"; };
board/google/chromebook_link/link.c +107 -0
116 lines not on this page · raw message
include/configs/chromebook_link.h +1 -3
@@ -19,6 +19,7 @@#define CONFIG_SYS_CAR_SIZE (128 * 1024)#define CONFIG_SYS_MONITOR_LEN (1 << 20)#define CONFIG_SYS_X86_START16 0xfffff800 +#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_BOARD_EARLY_INIT_R #define CONFIG_X86_RESET_VECTOR
@@ -40,9 +41,6 @@* follow-on patches in this series. Add undefs here to avoid every patch * having to put things back into x86-common.h */ -#undef CONFIG_INTEL_ICH6_GPIO -#undef CONFIG_DM_GPIO -#undef CONFIG_CMD_GPIO#undef CONFIG_VIDEO#undef CONFIG_CFB_CONSOLE#undef CONFIG_ICH_SPI
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 30/33 x86: Make show_boot_progress() common
In reply to Simon GlassThis function can probably be used on all x86 boards, so move it into the common file.
---
Changes in v2: None
arch/x86/cpu/coreboot/coreboot.c | 24 ------------------------ arch/x86/cpu/cpu.c | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -24
@@ -15,7 +15,6 @@#include <asm/cache.h> #include <asm/cpu.h> #include <asm/io.h> -#include <asm/post.h> #include <asm/arch/tables.h> #include <asm/arch/sysinfo.h> #include <asm/arch/timestamp.h>
@@ -51,29 +50,6 @@ int board_early_init_r(void)return 0 ; } -void show_boot_progress (int val) -{ -#if MIN_PORT80_KCLOCKS_DELAY -/* -* 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 (!gd->arch.tsc_prev) { - gd->arch.tsc_base_kclocks =rdtsc () /1000 ; - gd->arch.tsc_prev =0 ; - }else { -uint32_t now; - -do { - now =rdtsc () /1000 - gd->arch.tsc_base_kclocks; - }while (now < (gd->arch.tsc_prev +MIN_PORT80_KCLOCKS_DELAY )); - gd->arch.tsc_prev = now; - } -#endif -outb (val,POST_PORT ); -} -int last_stage_init (void ) {if (gd->flags &GD_FLG_COLD_BOOT )
arch/x86/cpu/cpu.c +24 -0
@@ -25,6 +25,7 @@#include <malloc.h> #include <asm/control_regs.h> #include <asm/cpu.h> +#include <asm/post.h> #include <asm/processor.h> #include <asm/processor-flags.h> #include <asm/interrupt.h>
@@ -566,3 +567,26 @@ int cpu_jump_to_64bit(ulong setup_base, ulong target)return -EFAULT ; } + +void show_boot_progress (int val) +{ +#if MIN_PORT80_KCLOCKS_DELAY +/* +* 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 (!gd->arch.tsc_prev) { + gd->arch.tsc_base_kclocks =rdtsc () /1000 ; + gd->arch.tsc_prev =0 ; + }else { +uint32_t now; + +do { + now =rdtsc () /1000 - gd->arch.tsc_base_kclocks; + }while (now < (gd->arch.tsc_prev +MIN_PORT80_KCLOCKS_DELAY )); + gd->arch.tsc_prev = now; + } +#endif +outb (val,POST_PORT ); +}
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 31/33 x86: ivybridge: Add LAPIC support
In reply to Simon GlassThe local advanced programmable interrupt controller is not used much in U-Boot but we do need to set it up. Add basic support for this, which will be extended as needed.
---
Changes in v2: None
arch/x86/cpu/ivybridge/cpu.c | 3 ++ arch/x86/include/asm/lapic.h | 59 +++++++++++++++++++++++ arch/x86/include/asm/lapic_def.h | 101 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 arch/x86/include/asm/lapic.h create mode 100644 arch/x86/include/asm/lapic_def.h
arch/x86/cpu/ivybridge/cpu.c +3 -0
@@ -16,6 +16,7 @@#include <fdtdec.h> #include <asm/cpu.h> #include <asm/io.h> +#include <asm/lapic.h> #include <asm/msr.h> #include <asm/mtrr.h> #include <asm/pci.h>
@@ -283,6 +284,8 @@ int print_cpuinfo(void)if (ret)return ret; +enable_lapic (); + ret =microcode_update_intel ();if (ret && ret != -ENOENT && ret != -EEXIST )return ret;
arch/x86/include/asm/lapic.h new file +59 -0
59 lines not on this page · raw message
arch/x86/include/asm/lapic_def.h new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 32/33 x86: ivybridge: Implement SDRAM init
In reply to Simon GlassImplement SDRAM init using the Memory Reference Code (mrc.bin) provided in the board directory and the SDRAM SPD information in the device tree. This also needs the Intel Management Engine (me.bin) to work. Binary blobs
everywhere: so far we have MRC, ME and microcode.
SDRAM init works by setting up various parameters and calling the MRC. This in turn does some sort of magic to work out how much memory there is and the timing parameters to use. It also sets up the DRAM controllers. When the MRC returns, we use the information it provides to map out the available memory in U-Boot.
U-Boot normally moves itself to the top of RAM. On x86 the RAM is not generally contiguous, and anyway some RAM may be above 4GB which doesn't work in 32-bit mode. So we relocate to the top of the largest block of RAM we can find below 4GB. Memory above 4GB is accessible with special functions (see physmem).
It would be possible to build U-Boot in 64-bit mode but this wouldn't necessarily provide any more memory, since the largest block is often below 4GB. Anyway U-Boot doesn't need huge amounts of memory - even a very large ramdisk seldom exceeds 100-200MB. U-Boot has support for booting 64-bit kernels directly so this does not pose a limitation in that area. Also there are probably parts of U-Boot that will not work correctly in 64-bit mode. The MRC is one.
There is some work remaining in this area. Since memory init is very slow (over 500ms) it is possible to save the parameters in SPI flash to speed it up next time. Suspend/resume support is not fully implemented, or at least it is not efficient.
With this patch, link boots to a prompt.
---
Changes in v2:
- Add mrc.bin dependency for u-boot.rom build rule
- Adjust to use asm/cpu.h header for cpuid
- Drop patch to move coreboot PCI into common cpu area
- Drop patch which removes the early_board_init() feature
- Fix incorrect subl mnemonic in start.S
- Remove use of PCI_CPU_DEVICE and use PCH_DEV instead
Makefile | 9 +- arch/x86/Kconfig | 11 + arch/x86/cpu/ivybridge/Makefile | 3 + arch/x86/cpu/ivybridge/early_me.c | 191 ++++++++ arch/x86/cpu/ivybridge/me_status.c | 195 ++++++++ arch/x86/cpu/ivybridge/report_platform.c | 98 ++++ arch/x86/cpu/ivybridge/sdram.c | 553 +++++++++++++++++++++- arch/x86/cpu/start.S | 10 +- arch/x86/dts/link.dts | 111 +++++ arch/x86/include/asm/arch-ivybridge/me.h | 356 ++++++++++++++ arch/x86/include/asm/arch-ivybridge/pch.h | 113 +++++ arch/x86/include/asm/arch-ivybridge/pei_data.h | 121 +++++ arch/x86/include/asm/arch-ivybridge/sandybridge.h | 2 + arch/x86/include/asm/config.h | 1 + arch/x86/include/asm/global_data.h | 13 + arch/x86/include/asm/post.h | 5 + arch/x86/include/asm/u-boot-x86.h | 2 + arch/x86/lib/Makefile | 1 + arch/x86/lib/ramtest.c | 79 ++++ include/configs/chromebook_link.h | 4 + include/configs/x86-common.h | 2 +- include/fdtdec.h | 1 + lib/fdtdec.c | 1 + 23 files changed, 1875 insertions(+), 7 deletions(-) create mode 100644 arch/x86/cpu/ivybridge/early_me.c create mode 100644 arch/x86/cpu/ivybridge/me_status.c create mode 100644 arch/x86/cpu/ivybridge/report_platform.c create mode 100644 arch/x86/include/asm/arch-ivybridge/me.h create mode 100644 arch/x86/include/asm/arch-ivybridge/pei_data.h create mode 100644 arch/x86/lib/ramtest.c
Makefile +8 -1
@@ -953,12 +953,19 @@ ifneq ($(CONFIG_X86_RESET_VECTOR),) rom: u-boot.rom FORCE u-boot.rom: u-boot-x86-16bit.bin u-boot-dtb.bin \ - $(srctree)/board/$(BOARDDIR)/descriptor.bin + $(srctree)/board/$(BOARDDIR)/mrc.bin \ + $(srctree)/board/$(BOARDDIR)/descriptor.bin \ + $(srctree)/board/$(BOARDDIR)/me.bin $(objtree)/tools/ifdtool -c -r $(CONFIG_ROM_SIZE) \ -D $(srctree)/board/$(BOARDDIR)/descriptor.bin u-boot.tmp + $(objtree)/tools/ifdtool \ + -i ME:$(srctree)/board/$(BOARDDIR)/me.bin u-boot.tmp $(objtree)/tools/ifdtool -w \ $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot-dtb.bin u-boot.tmp $(objtree)/tools/ifdtool -w \ + $(CONFIG_X86_MRC_START):$(srctree)/board/$(BOARDDIR)/mrc.bin \ + u-boot.tmp + $(objtree)/tools/ifdtool -w \ $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin \ u-boot.tmp mv u-boot.tmp $@
arch/x86/Kconfig +11 -0
@@ -50,6 +50,17 @@ config CPU_ADDR_BITS int default 36 +config HPET_ADDRESS + hex + default 0xfed00000 if !HPET_ADDRESS_OVERRIDE + +config SMM_TSEG + bool + default n + +config SMM_TSEG_SIZE + hex + config ROM_SIZE hex default 0x800000
arch/x86/cpu/ivybridge/Makefile +3 -0
@@ -7,7 +7,10 @@ obj-y += car.o obj-y += cpu.o obj-y += early_init.o +obj-y += early_me.o obj-y += lpc.o +obj-y += me_status.o obj-y += microcode_intel.o obj-y += pci.o +obj-y += report_platform.o obj-y += sdram.o
arch/x86/cpu/ivybridge/early_me.c new file +191 -0
191 lines not on this page · raw message
arch/x86/cpu/ivybridge/me_status.c new file +195 -0
195 lines not on this page · raw message
arch/x86/cpu/ivybridge/report_platform.c new file +98 -0
98 lines not on this page · raw message
arch/x86/cpu/ivybridge/sdram.c +552 -1
562 lines not on this page · raw message
arch/x86/cpu/start.S +6 -4
@@ -78,20 +78,22 @@ car_init_ret: * We now have CONFIG_SYS_CAR_SIZE bytes of Cache-As-RAM (or SRAM, * or fully initialised SDRAM - we really don't care which) * starting at CONFIG_SYS_CAR_ADDR to be used as a temporary stack - * and early malloc area. + * and early malloc area. The MRC requires some space at the top. * * Stack grows down from top of CAR. We have: * * top-> CONFIG_SYS_CAR_ADDR + CONFIG_SYS_CAR_SIZE + * MRC area * global_data * x86 global descriptor table * early malloc area * stack * bottom-> CONFIG_SYS_CAR_ADDR */ - - /* Stack grows down from top of CAR */ - movl $(CONFIG_SYS_CAR_ADDR + CONFIG_SYS_CAR_SIZE), %esp + movl $(CONFIG_SYS_CAR_ADDR + CONFIG_SYS_CAR_SIZE - 4), %esp +#ifdef CONFIG_DCACHE_RAM_MRC_VAR_SIZE + subl $CONFIG_DCACHE_RAM_MRC_VAR_SIZE, %esp +#endif /* Reserve space on stack for global data */ subl $GENERATED_GBL_DATA_SIZE, %esp
arch/x86/dts/link.dts +111 -0
117 lines not on this page · raw message
arch/x86/include/asm/arch-ivybridge/me.h new file +356 -0
356 lines not on this page · raw message
arch/x86/include/asm/arch-ivybridge/pch.h +113 -0
137 lines not on this page · raw message
arch/x86/include/asm/arch-ivybridge/pei_data.h new file +121 -0
121 lines not on this page · raw message
arch/x86/include/asm/arch-ivybridge/sandybridge.h +2 -0
@@ -102,6 +102,8 @@#define SSKPD 0x5d14/* 16bit (scratchpad) */ #define BIOS_RESET_CPL 0x5da8/* 8bit */ +void report_platform_info (void ); +void sandybridge_early_init (int chipset_type);#endif
arch/x86/include/asm/config.h +1 -0
@@ -10,5 +10,6 @@#define CONFIG_SYS_GENERIC_BOARD #define CONFIG_LMB #define CONFIG_SYS_BOOT_RAMDISK_HIGH +#define asmlinkage __attribute__((regparm(0)))#endif
arch/x86/include/asm/global_data.h +13 -0
@@ -17,6 +17,18 @@ enum pei_boot_mode_t { }; +struct memory_area { +uint64_t start; +uint64_t size; +}; + +struct memory_info { +int num_areas; +uint64_t total_memory; +uint64_t total_32bit_memory; +struct memory_area area[CONFIG_NR_DRAM_BANKS ]; +}; +/* Architecture-specific global data */ struct arch_global_data {struct global_data *gd_addr;/* Location of Global Data */
@@ -34,6 +46,7 @@ struct arch_global_data {struct pci_controller *hose;/* PCI hose for early use */ enum pei_boot_mode_t pei_boot_mode;const struct pch_gpio_map *gpio_map;/* board GPIO map */ + struct memory_info meminfo; /* Memory information */ };#endif
arch/x86/include/asm/post.h +5 -0
@@ -27,6 +27,11 @@#define POST_CPU_INIT 0x2b#define POST_EARLY_INIT 0x2c#define POST_CPU_INFO 0x2d +#define POST_PRE_MRC 0x2e +#define POST_MRC 0x2f +#define POST_DRAM 0x2f + +#define POST_RAM_FAILURE 0xea/* Output a post code using al - value must be 0 to 0xff */ #ifdef __ASSEMBLY__
arch/x86/include/asm/u-boot-x86.h +2 -0
@@ -69,4 +69,6 @@ static inline __attribute__((no_instrument_function)) uint64_t rdtsc(void)void timer_set_tsc_base (uint64_t new_base);uint64_t timer_get_tsc (void ); +void quick_ram_check (void ); +#endif /* _U_BOOT_I386_H_ */
arch/x86/lib/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_SYS_PCAT_TIMER) += pcat_timer.o obj-$(CONFIG_PCI) += pci_type1.o obj-y += relocate.o obj-y += physmem.o +obj-y += ramtest.o obj-y += string.o obj-$(CONFIG_SYS_X86_TSC_TIMER) += tsc_timer.o obj-$(CONFIG_VIDEO_VGA) += video.o
arch/x86/lib/ramtest.c new file +79 -0
79 lines not on this page · raw message
include/configs/chromebook_link.h +4 -0
@@ -18,12 +18,16 @@#define CONFIG_SYS_CAR_ADDR 0xff7e0000#define CONFIG_SYS_CAR_SIZE (128 * 1024)#define CONFIG_SYS_MONITOR_LEN (1 << 20) +#define CONFIG_DCACHE_RAM_MRC_VAR_SIZE 0x4000#define CONFIG_SYS_X86_START16 0xfffff800#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_BOARD_EARLY_INIT_R +#define CONFIG_DISPLAY_CPUINFO #define CONFIG_X86_RESET_VECTOR #define CONFIG_NR_DRAM_BANKS 8 +#define CONFIG_X86_MRC_START 0xfffa0000 +#define CONFIG_CACHE_MRC_SIZE_KB 512#define CONFIG_COREBOOT_SERIAL
include/configs/x86-common.h +1 -1
@@ -192,7 +192,7 @@#define CONFIG_SYS_STACK_SIZE (32 * 1024)#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE#define CONFIG_SYS_MALLOC_LEN 0x200000 -#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) +#define CONFIG_SYS_MALLOC_F_LEN (2 << 10)/* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE
include/fdtdec.h +1 -0
@@ -119,6 +119,7 @@ enum fdt_compat_id {COMPAT_PARADE_PS8625 ,/* Parade PS8622 EDP->LVDS bridge */ COMPAT_INTEL_LPC ,/* Intel Low Pin Count I/F */ COMPAT_INTEL_MICROCODE ,/* Intel microcode update */ +COMPAT_MEMORY_SPD ,/* Memory SPD information */ COMPAT_COUNT, };
lib/fdtdec.c +1 -0
@@ -74,6 +74,7 @@ static const char * const compat_names[COMPAT_COUNT] = {COMPAT (PARADE_PS8625 ,"parade,ps8625" ),COMPAT (COMPAT_INTEL_LPC ,"intel,lpc" ),COMPAT (INTEL_MICROCODE ,"intel,microcode" ), + COMPAT(MEMORY_SPD, "memory-spd"), };const char *fdtdec_get_compatible (enum fdt_compat_id id)
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 32/33 x86: ivybridge: Implement SDRAM init
Hi Simon,
I am not sure if there is anything I missed but when I look at the u-boot-x86/working, the repo content does not match the patch v2 here. And seems you missed my previous comments @
http://u-boot.10912.n7.nabble.com/PATCH-0-39-x86-Add-support-for-running-on-bare-hardware-tp194993p195356.html
[snip]
Regards,
Bin
PATCH v2 32/33 x86: ivybridge: Implement SDRAM init
Hi Bin,
Quoted 6 lines · Bin Meng
Hi Simon,
I am not sure if there is anything I missed but when I look at the u-boot-x86/working, the repo content does not match the patch v2 here. And seems you missed my previous comments @
http://u-boot.10912.n7.nabble.com/PATCH-0-39-x86-Add-support-for-running-on-bare-hardware-tp194993p195356.html
OK, which ones have I missed?
Regards,
Simon
PATCH v2 32/33 x86: ivybridge: Implement SDRAM init
Hi Simon,
Quoted 11 lines · Simon Glass
Hi Bin,
Quoted 6 lines · Bin Meng
Hi Simon,
I am not sure if there is anything I missed but when I look at the u-boot-x86/working, the repo content does not match the patch v2 here. And seems you missed my previous comments @
http://u-boot.10912.n7.nabble.com/PATCH-0-39-x86-Add-support-for-running-on-bare-hardware-tp194993p195356.htmlOK, which ones have I missed?
Does the above link not work for you? The comments were:
Quoted 15 lines
arch/x86/cpu/ivybridge/report_platform.c new file +15
-0+static void report_cpu_info (void ) +{ +struct cpuid_result cpuidr; +u32 i, index; +char cpu_string[50 ], *cpu_name = cpu_string;/* 48 bytes are reported */ +int vt, txt, aes; +const char *mode[] = {"NOT " ,"" }; + + index =0x80000000 ; + cpuidr =cpuid (index); +if (cpuidr.eax <0x80000004 ) { +strcpy (cpu_string,"Platform info not available" ); + }else { +u32 *p = (u32 *)cpu_string; +for (i =2 ; i <=4 ; i++) {
arch/x86/cpu/ivybridge/report_platform.c line 38
Quoted 10 lines
arch/x86/cpu/ivybridge/report_platform.c new file +10
-0+ cpuidr =cpuid (index + i); + *p++ = cpuidr.eax; + *p++ = cpuidr.ebx; + *p++ = cpuidr.ecx; + *p++ = cpuidr.edx; + } + } +/* Skip leading spaces in CPU name string */ +while (cpu_name[0 ] ==' ' ) + cpu_name++;
The above codes can be just replaced by a call to cpu_get_name()
[snip]
Quoted 37 lines
arch/x86/dts/link.dts +29
-0@@ -41,6 +41,117 @@ chosen { }; memory { device_type = "memory"; reg = <0 0>; }; + spd { + compatible = "memory-spd"; + #address-cells = <1>; + #size-cells = <0>; + elpida_4Gb_1600_x16 { + reg = <0>; + data = [92 10 0b 03 04 19 02 02 + 03 52 01 08 0a 00 fe 00 + 69 78 69 3c 69 11 18 81 + 20 08 3c 3c 01 40 83 81 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 0f 11 42 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 02 fe 00 + 11 52 00 00 00 07 7f 37 + 45 42 4a 32 30 55 47 36 + 45 42 55 30 2d 47 4e 2d + 46 20 30 20 02 fe 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00
arch/x86/dts/link.dts line 82
Quoted 10 lines
arch/x86/dts/link.dts +10
-0+ 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00]; + };
Is this the limitation of the MRC that it cannot read SPD from the DIMM? Or is it because the RAM chip is soldered on board?
[snip]
arch/x86/lib/Makefile obj-$(CONFIG_SYS_PCAT_TIMER) += pcat_timer.o · line 18
Quoted 9 lines
arch/x86/lib/Makefile +1
-0@@ -15,6 +15,7 @@ obj-$(CONFIG_SYS_PCAT_TIMER) += pcat_timer.o obj-$(CONFIG_PCI) += pci_type1.o obj-y += relocate.o obj-y += physmem.o +obj-y += ramtest.o
Can we make the ramtest wrapped by CONFIG_X86_RAMTEST?
Regards,
Bin
PATCH v2 32/33 x86: ivybridge: Implement SDRAM init
Hi Bin,
Quoted 8 lines · Bin Meng
Hi Simon,
Quoted 5 lines · Simon Glass
Hi Bin,
Quoted 2 lines · Bin Meng
Hi Simon,
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
I am not sure if there is anything I missed but when I look at the u-boot-x86/working, the repo content does not match the patch v2 here. And seems you missed my previous comments @
http://u-boot.10912.n7.nabble.com/PATCH-0-39-x86-Add-support-for-running-on-bare-hardware-tp194993p195356.htmlOK, which ones have I missed?
Does the above link not work for you? The comments were:
No I couldn't find your comments when I looked.
Quoted 20 lines
Quoted 20 lines
arch/x86/cpu/ivybridge/report_platform.c new file +19
-0+static void report_cpu_info (void ) +{ +struct cpuid_result cpuidr; +u32 i, index; +char cpu_string[50 ], *cpu_name = cpu_string;/* 48 bytes are reported */ +int vt, txt, aes; +const char *mode[] = {"NOT " ,"" }; + + index =0x80000000 ; + cpuidr =cpuid (index); +if (cpuidr.eax <0x80000004 ) { +strcpy (cpu_string,"Platform info not available" ); + }else { +u32 *p = (u32 *)cpu_string; +for (i =2 ; i <=4 ; i++) { + cpuidr =cpuid (index + i); + *p++ = cpuidr.eax; + *p++ = cpuidr.ebx; + *p++ = cpuidr.ecx;
Quoted 8 lines
arch/x86/cpu/ivybridge/report_platform.c line 38
Quoted 6 lines
arch/x86/cpu/ivybridge/report_platform.c new file +6
-0+ *p++ = cpuidr.edx; + } + } +/* Skip leading spaces in CPU name string */ +while (cpu_name[0 ] ==' ' ) + cpu_name++;The above codes can be just replaced by a call to
cpu_get_name()
Er, yes :-)
Quoted 45 lines
[snip]
Quoted 42 lines
arch/x86/dts/link.dts +34
-0@@ -41,6 +41,117 @@ chosen { }; memory { device_type = "memory"; reg = <0 0>; }; + spd { + compatible = "memory-spd"; + #address-cells = <1>; + #size-cells = <0>; + elpida_4Gb_1600_x16 { + reg = <0>; + data = [92 10 0b 03 04 19 02 02 + 03 52 01 08 0a 00 fe 00 + 69 78 69 3c 69 11 18 81 + 20 08 3c 3c 01 40 83 81 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 0f 11 42 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 02 fe 00 + 11 52 00 00 00 07 7f 37 + 45 42 4a 32 30 55 47 36 + 45 42 55 30 2d 47 4e 2d + 46 20 30 20 02 fe 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00
Quoted 8 lines
arch/x86/dts/link.dts line 82
Quoted 5 lines
arch/x86/dts/link.dts +5
-0+ 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00]; + };Is this the limitation of the MRC that it cannot read SPD from the DIMM? Or is it because the RAM chip is soldered on board?
Yes, soldered on.
Quoted 14 lines
[snip]
arch/x86/lib/Makefile obj-$(CONFIG_SYS_PCAT_TIMER) += pcat_timer.o · line 18
Quoted 9 lines
arch/x86/lib/Makefile +1
-0@@ -15,6 +15,7 @@ obj-$(CONFIG_SYS_PCAT_TIMER) += pcat_timer.o obj-$(CONFIG_PCI) += pci_type1.o obj-y += relocate.o obj-y += physmem.o +obj-y += ramtest.oCan we make the ramtest wrapped by
CONFIG_X86_RAMTEST?
OK.
Regards,
Simon
PATCH v2 33/33 x86: Rename chromebook-x86 to coreboot
In reply to Simon GlassRename this vendor since it is intended to be used on any platform where coreboot runs at reset and then loads U-Boot.
So far it is only tested on link. When other boards are supported it is likely that we will need to move to multiple board names, all under the 'coreboot' vendor. So while it would be possible to remove the vendor for now, that would be short-sighted.
---
Changes in v2:
- Add new patch to rename chromebook-x86 to coreboot
arch/x86/Kconfig | 2 +-
board/{chromebook-x86 => coreboot}/coreboot/Kconfig | 2 +-
board/{chromebook-x86 => coreboot}/coreboot/MAINTAINERS | 2 +-
board/{chromebook-x86 => coreboot}/coreboot/Makefile | 0
board/{chromebook-x86 => coreboot}/coreboot/coreboot.c | 0
board/{chromebook-x86 => coreboot}/coreboot/coreboot_start.S | 0
6 files changed, 3 insertions(+), 3 deletions(-)
rename board/{chromebook-x86 => coreboot}/coreboot/Kconfig (86%)
rename board/{chromebook-x86 => coreboot}/coreboot/MAINTAINERS (78%)
rename board/{chromebook-x86 => coreboot}/coreboot/Makefile (100%)
rename board/{chromebook-x86 => coreboot}/coreboot/coreboot.c (100%)
rename board/{chromebook-x86 => coreboot}/coreboot/coreboot_start.S (100%)arch/x86/Kconfig +1 -1
@@ -67,7 +67,7 @@ config ROM_SIZE source "arch/x86/cpu/ivybridge/Kconfig" -source "board/chromebook-x86/coreboot/Kconfig" +source "board/coreboot/coreboot/Kconfig" source "board/google/chromebook_link/Kconfig"
board/coreboot/coreboot/Kconfig renamed from board/chromebook-x86/coreboot/Kconfig +1 -1
@@ -4,7 +4,7 @@ config SYS_BOARD default "coreboot" config SYS_VENDOR - default "chromebook-x86" + default "coreboot" config SYS_SOC default "coreboot"
board/coreboot/coreboot/MAINTAINERS renamed from board/chromebook-x86/coreboot/MAINTAINERS +1 -1
@@ -1,6 +1,6 @@ COREBOOT BOARD M: Simon Glass <[email protected]> S: Maintained -F: board/chromebook-x86/coreboot/ +F: board/coreboot/coreboot/ F: include/configs/coreboot.h F: configs/coreboot-x86_defconfig
board/coreboot/coreboot/Makefile renamed from board/chromebook-x86/coreboot/Makefile +0 -0
board/coreboot/coreboot/coreboot.c renamed from board/chromebook-x86/coreboot/coreboot.c +0 -0
board/coreboot/coreboot/coreboot_start.S renamed from board/chromebook-x86/coreboot/coreboot_start.S +0 -0
Signature · 1 line
2.1.0.rc2.206.gedb03e5