Skip to contentSkip to conversation

x86: Add support for running on bare hardware

PATCH New Simon Glass 4 participants 62 messages Nov 13, 2014 – Nov 24, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 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 v3:
- Add a CONFIG_X86_RAMTEST option to enable the SDRAM test
- Add an option to control the inclusion of the Intel ME
- Add help for CONFIG_ENABLE_VMX
- Add new patch to allow ifdtool to create an empty ROM
- Adjust PCI setup code to fit with new generic cpu PCI code
- Assign hose->last_busno when calling pci_hose_scan()
- Callpci_setup_type1() in early PCI setup
- Change asm label to 1 (from 2)
- Enable Intel ME for chromebook_link
- Move pci_setup_type1() call to common pci file
- Rebase against x86/master
- Remove extra coreboot print_cpuinfo() implementation
- Split out CONFIG_INTEL_CORE_ARCH removal patch
- Try another approach for fixing the timer
- Use cpu_get_name() in report_paltform.c
- Use the CONFIG_HAVE_INTEL_ME option in the Makefile

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 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
- 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 (26):
x86: Allow timer calibration to work on ivybridge
x86: Drop old CONFIG_INTEL_CORE_ARCH code
x96: ifdtool: Allow creation of an empty ROM
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                                           |  36 +-
 arch/x86/Kconfig                                   |  74 +-
 arch/x86/cpu/Makefile                              |   1 +
 arch/x86/cpu/coreboot/coreboot.c                   |  28 +-
 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                                 |  24 +
 arch/x86/cpu/interrupts.c                          |  28 -
 arch/x86/cpu/ivybridge/Kconfig                     | 172 +++++
 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                       |  60 ++
 arch/x86/cpu/ivybridge/report_platform.c           |  89 +++
 arch/x86/cpu/ivybridge/sdram.c                     | 571 ++++++++++++++++
 arch/x86/cpu/pci.c                                 |  98 +++
 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/global_data.h                 |  23 +
 arch/x86/include/asm/gpio.h                        | 142 +++-
 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                   |   2 +
 arch/x86/include/asm/u-boot-x86.h                  |   2 +
 arch/x86/lib/Makefile                              |   1 +
 arch/x86/lib/ramtest.c                             |  79 +++
 arch/x86/lib/tsc_timer.c                           |  32 +-
 .../{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 +
 configs/chromebook_link_defconfig                  |  10 +
 doc/device-tree-bindings/misc/intel-lpc.txt        |  23 +
 drivers/gpio/intel_ich6_gpio.c                     |  79 ++-
 include/configs/chromebook_link.h                  |  74 ++
 include/configs/x86-common.h                       |   2 +-
 include/fdtdec.h                                   |   2 +
 lib/fdtdec.c                                       |   2 +
 tools/ifdtool.c                                    |   2 +-
 70 files changed, 6079 insertions(+), 109 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
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#1 lore raw

PATCH v3 1/26 x86: Allow timer calibration to work on ivybridge

Unfortunately MSR_FSB_FREQ is not available on this CPU, and the PIT method seems to take up to 50ms which is much too long.

For this CPU we know the frequency, so add another special case for now.

---

Changes in v3:
- Try another approach for fixing the timer

Changes in v2:
- Add new patch to tidy up timer code for Intel core architecture

 arch/x86/lib/tsc_timer.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)
arch/x86/lib/tsc_timer.c +21 -11
index f091c91..fb9afed 100644
@@ -36,7 +36,8 @@ DECLARE_GLOBAL_DATA_PTR;
 struct freq_desc {
 	u8 x86_family;	/* CPU family */
 	u8 x86_model;	/* model */
-	u8 msr_plat;	/* 1: use MSR_PLATFORM_INFO, 0: MSR_IA32_PERF_STATUS */
+	/* 2: use 100MHz, 1: use MSR_PLATFORM_INFO, 0: MSR_IA32_PERF_STATUS */
+	u8 msr_plat;
 	u32 freqs[MAX_NUM_FREQS];
 };
 
@@ -49,6 +50,8 @@ static struct freq_desc freq_desc_tables[] = {
 	{ 6, 0x4a, 1, { 0, FREQ_100, FREQ_133, 0, 0, 0, 0, 0 } },
 	/* VLV2 */
 	{ 6, 0x37, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_166, 0, 0, 0, 0 } },
+	/* Ivybridge */
+	{ 6, 0x3a, 2, { 0, 0, 0, 0, 0, 0, 0, 0 } },
 	/* ANN */
 	{ 6, 0x5a, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_100, 0, 0, 0, 0 } },
 };
@@ -97,11 +100,18 @@ static unsigned long try_msr_calibrate_tsc(void)
 	if (!ratio)
 		goto fail;
 
-	/* Get FSB FREQ ID */
-	rdmsr(MSR_FSB_FREQ, lo, hi);
-	freq_id = lo & 0x7;
-	freq = id_to_freq(cpu_index, freq_id);
-	debug("Resolved frequency ID: %u, frequency: %u KHz\n", freq_id, freq);
+	if (freq_desc_tables[cpu_index].msr_plat == 2) {
+		/* TODO: Figure out how best to deal with this */
+		freq = FREQ_100;
+		debug("Using frequency: %u KHz\n", freq);
+	} else {
+		/* Get FSB FREQ ID */
+		rdmsr(MSR_FSB_FREQ, lo, hi);
+		freq_id = lo & 0x7;
+		freq = id_to_freq(cpu_index, freq_id);
+		debug("Resolved frequency ID: %u, frequency: %u KHz\n",
+		      freq_id, freq);
+	}
 	if (!freq)
 		goto fail;
 
@@ -297,12 +307,12 @@ unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void)
 		return gd->arch.tsc_mhz;
 
 	fast_calibrate = try_msr_calibrate_tsc();
-	if (fast_calibrate)
-		return fast_calibrate;
+	if (!fast_calibrate) {
 
-	fast_calibrate = quick_pit_calibrate();
-	if (!fast_calibrate)
-		panic("TSC frequency is ZERO");
+		fast_calibrate = quick_pit_calibrate();
+		if (!fast_calibrate)
+			panic("TSC frequency is ZERO");
+	}
 
 	gd->arch.tsc_mhz = fast_calibrate;
 	return fast_calibrate;
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#2 lore raw

PATCH v3 1/26 x86: Allow timer calibration to work on ivybridge

Quoted 73 lines · Simon Glass

Unfortunately MSR_FSB_FREQ is not available on this CPU, and the PIT method seems to take up to 50ms which is much too long.

For this CPU we know the frequency, so add another special case for now.

---

Changes in v3:
- Try another approach for fixing the timer

Changes in v2:
- Add new patch to tidy up timer code for Intel core architecture

 arch/x86/lib/tsc_timer.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)
arch/x86/lib/tsc_timer.c +17 -9
index f091c91..fb9afed 100644
@@ -36,7 +36,8 @@ DECLARE_GLOBAL_DATA_PTR;
 struct freq_desc {
        u8 x86_family;  /* CPU family */
        u8 x86_model;   /* model */
-       u8 msr_plat;    /* 1: use MSR_PLATFORM_INFO, 0: MSR_IA32_PERF_STATUS */
+       /* 2: use 100MHz, 1: use MSR_PLATFORM_INFO, 0: MSR_IA32_PERF_STATUS */
+       u8 msr_plat;
        u32 freqs[MAX_NUM_FREQS];
 };
 
@@ -49,6 +50,8 @@ static struct freq_desc freq_desc_tables[] = {
        { 6, 0x4a, 1, { 0, FREQ_100, FREQ_133, 0, 0, 0, 0, 0 } },
        /* VLV2 */
        { 6, 0x37, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_166, 0, 0, 0, 0 } },
+       /* Ivybridge */
+       { 6, 0x3a, 2, { 0, 0, 0, 0, 0, 0, 0, 0 } },
        /* ANN */
        { 6, 0x5a, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_100, 0, 0, 0, 0 } },
 };
@@ -97,11 +100,18 @@ static unsigned long try_msr_calibrate_tsc(void)
        if (!ratio)
                goto fail;
 
-       /* Get FSB FREQ ID */
-       rdmsr(MSR_FSB_FREQ, lo, hi);
-       freq_id = lo & 0x7;
-       freq = id_to_freq(cpu_index, freq_id);
-       debug("Resolved frequency ID: %u, frequency: %u KHz\n", freq_id, freq);
+       if (freq_desc_tables[cpu_index].msr_plat == 2) {
+               /* TODO: Figure out how best to deal with this */
+               freq = FREQ_100;
+               debug("Using frequency: %u KHz\n", freq);
+       } else {
+               /* Get FSB FREQ ID */
+               rdmsr(MSR_FSB_FREQ, lo, hi);
+               freq_id = lo & 0x7;
+               freq = id_to_freq(cpu_index, freq_id);
+               debug("Resolved frequency ID: %u, frequency: %u KHz\n",
+                     freq_id, freq);
+       }
        if (!freq)
                goto fail;
 
@@ -297,12 +307,12 @@ unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void)
                return gd->arch.tsc_mhz;
 
        fast_calibrate = try_msr_calibrate_tsc();
-       if (fast_calibrate)
-               return fast_calibrate;
+       if (!fast_calibrate) {
 
-       fast_calibrate = quick_pit_calibrate();

arch/x86/lib/tsc_timer.c unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void)

Quoted 10 lines
arch/x86/lib/tsc_timer.c +4 -3
-       if (!fast_calibrate)
-               panic("TSC frequency is ZERO");
+               fast_calibrate = quick_pit_calibrate();
+               if (!fast_calibrate)
+                       panic("TSC frequency is ZERO");
+       }
 
        gd->arch.tsc_mhz = fast_calibrate;
        return fast_calibrate;
--
#3 lore raw

PATCH v3 1/26 x86: Allow timer calibration to work on ivybridge

Quoted 81 lines · Bin Meng
Quoted 80 lines · Simon Glass

Unfortunately MSR_FSB_FREQ is not available on this CPU, and the PIT method seems to take up to 50ms which is much too long.

For this CPU we know the frequency, so add another special case for now.

---

Changes in v3:
- Try another approach for fixing the timer

Changes in v2:
- Add new patch to tidy up timer code for Intel core architecture

 arch/x86/lib/tsc_timer.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)
arch/x86/lib/tsc_timer.c +21 -11
index f091c91..fb9afed 100644
@@ -36,7 +36,8 @@ DECLARE_GLOBAL_DATA_PTR;
 struct freq_desc {
        u8 x86_family;  /* CPU family */
        u8 x86_model;   /* model */
-       u8 msr_plat;    /* 1: use MSR_PLATFORM_INFO, 0: MSR_IA32_PERF_STATUS */
+       /* 2: use 100MHz, 1: use MSR_PLATFORM_INFO, 0: MSR_IA32_PERF_STATUS */
+       u8 msr_plat;
        u32 freqs[MAX_NUM_FREQS];
 };
 
@@ -49,6 +50,8 @@ static struct freq_desc freq_desc_tables[] = {
        { 6, 0x4a, 1, { 0, FREQ_100, FREQ_133, 0, 0, 0, 0, 0 } },
        /* VLV2 */
        { 6, 0x37, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_166, 0, 0, 0, 0 } },
+       /* Ivybridge */
+       { 6, 0x3a, 2, { 0, 0, 0, 0, 0, 0, 0, 0 } },
        /* ANN */
        { 6, 0x5a, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_100, 0, 0, 0, 0 } },
 };
@@ -97,11 +100,18 @@ static unsigned long try_msr_calibrate_tsc(void)
        if (!ratio)
                goto fail;
 
-       /* Get FSB FREQ ID */
-       rdmsr(MSR_FSB_FREQ, lo, hi);
-       freq_id = lo & 0x7;
-       freq = id_to_freq(cpu_index, freq_id);
-       debug("Resolved frequency ID: %u, frequency: %u KHz\n", freq_id, freq);
+       if (freq_desc_tables[cpu_index].msr_plat == 2) {
+               /* TODO: Figure out how best to deal with this */
+               freq = FREQ_100;
+               debug("Using frequency: %u KHz\n", freq);
+       } else {
+               /* Get FSB FREQ ID */
+               rdmsr(MSR_FSB_FREQ, lo, hi);
+               freq_id = lo & 0x7;
+               freq = id_to_freq(cpu_index, freq_id);
+               debug("Resolved frequency ID: %u, frequency: %u KHz\n",
+                     freq_id, freq);
+       }
        if (!freq)
                goto fail;
 
@@ -297,12 +307,12 @@ unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void)
                return gd->arch.tsc_mhz;
 
        fast_calibrate = try_msr_calibrate_tsc();
-       if (fast_calibrate)
-               return fast_calibrate;
+       if (!fast_calibrate) {
 
-       fast_calibrate = quick_pit_calibrate();
-       if (!fast_calibrate)
-               panic("TSC frequency is ZERO");
+               fast_calibrate = quick_pit_calibrate();
+               if (!fast_calibrate)
+                       panic("TSC frequency is ZERO");
+       }
 
Quoted 5 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 -1
        gd->arch.tsc_mhz = fast_calibrate;
        return fast_calibrate;
--

Applied to u-boot-x86.

#4 lore raw

PATCH v3 2/26 x86: Drop old CONFIG_INTEL_CORE_ARCH code

In reply to Simon Glass

This is no-longer used, so drop it.

---

Changes in v3:
- Split out CONFIG_INTEL_CORE_ARCH removal patch

Changes in v2: None

 arch/x86/cpu/interrupts.c | 28 ----------------------------
 1 file changed, 28 deletions(-)
arch/x86/cpu/interrupts.c +0 -28
index 51e2c59..4822c11 100644
@@ -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
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#5 lore raw

PATCH v3 2/26 x86: Drop old CONFIG_INTEL_CORE_ARCH code

Quoted 40 lines · Simon Glass

This is no-longer used, so drop it.

---

Changes in v3:
- Split out CONFIG_INTEL_CORE_ARCH removal patch

Changes in v2: None

 arch/x86/cpu/interrupts.c | 28 ----------------------------
 1 file changed, 28 deletions(-)
arch/x86/cpu/interrupts.c +0 -19
index 51e2c59..4822c11 100644
@@ -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
-

arch/x86/cpu/interrupts.c asm(".globl irq_common_entry\n" \

Quoted 10 lines
arch/x86/cpu/interrupts.c +0 -10
-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
--
#6 lore raw

PATCH v3 2/26 x86: Drop old CONFIG_INTEL_CORE_ARCH code

Quoted 45 lines · Bin Meng
Quoted 44 lines · Simon Glass

This is no-longer used, so drop it.

---

Changes in v3:
- Split out CONFIG_INTEL_CORE_ARCH removal patch

Changes in v2: None

 arch/x86/cpu/interrupts.c | 28 ----------------------------
 1 file changed, 28 deletions(-)
arch/x86/cpu/interrupts.c +0 -23
index 51e2c59..4822c11 100644
@@ -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);
Quoted 8 lines

arch/x86/cpu/interrupts.c asm(".globl irq_common_entry\n" \

Quoted 6 lines
arch/x86/cpu/interrupts.c +0 -6
-
-       ratio = (platform_info >> 8) & 0xff;
-       return 100 * 1000 * 1000 * ratio; /* 100MHz times Max Non Turbo ratio */
-}
-#endif
--

Applied to u-boot-x86.

#7 lore raw

PATCH v3 3/26 x96: ifdtool: Allow creation of an empty ROM

In reply to Simon Glass

Allow an empty ROM to be created, without needing to provide a descriptor. The descriptor is not needed on some x86 boards.

---

Changes in v3:
- Add new patch to allow ifdtool to create an empty ROM

Changes in v2: None

 tools/ifdtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/ifdtool.c +1 -1
index 2c9bbda..a4b481f 100644
@@ -924,7 +924,7 @@ int main(int argc, char *argv[])
 
 	if ((mode_dump + mode_extract + mode_inject + mode_spifreq +
 	     mode_em100 + mode_locked + mode_unlocked + mode_write +
-	     mode_write_descriptor) == 0) {
+	     mode_write_descriptor) == 0 && !create) {
 		fprintf(stderr, "You need to specify a mode.\n\n");
 		print_usage(argv[0]);
 		exit(EXIT_FAILURE);
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#8 lore raw

PATCH v3 3/26 x96: ifdtool: Allow creation of an empty ROM

This typo caught my attention by chance.

Quoted 1 line

x96: ifdtool: Allow creation of an empty ROM

x96 -> x86

Masahiro Yamada

#9 lore raw

PATCH v3 3/26 x96: ifdtool: Allow creation of an empty ROM

Hi,

Quoted 7 lines · Masahiro Yamada

This typo caught my attention by chance.

Quoted 1 line

x96: ifdtool: Allow creation of an empty ROM

x96 -> x86

Yes will fix. Probably wishful thinking, but perhaps I should be grateful it is not '76.

Regards,
Simon

#10 lore raw

PATCH v3 3/26 x96: ifdtool: Allow creation of an empty ROM

Quoted 9 lines · Simon Glass

Hi,

Quoted 6 lines · Masahiro Yamada

This typo caught my attention by chance.

Quoted 1 line

x96: ifdtool: Allow creation of an empty ROM

Quoted 7 lines
Quoted 1 line

x96 -> x86

Yes will fix. Probably wishful thinking, but perhaps I should be grateful it is not '76.

Regards,
Simon

It didn't seem worth resending just for that nit, so I fixed it locally.

Applied to u-boot-x86.

#11 lore raw

PATCH v3 4/26 x86: Add chromebook_link board

In reply to Simon Glass

This 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 v3:
- Add help for CONFIG_ENABLE_VMX
- Enable Intel ME for chromebook_link
- Remove extra coreboot print_cpuinfo() implementation

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           |   1 +
 arch/x86/cpu/ivybridge/Kconfig             | 171 +++++++++++++++++++++++++++++
 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, 438 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
index 0dba8ac..a5f24d0 100644
@@ -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 +1 -0
index c9f83b0..8501716 100644
@@ -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>
arch/x86/cpu/ivybridge/Kconfig new file +171 -0

171 lines not on this page · raw message

arch/x86/cpu/ivybridge/Makefile new file +9 -0
new file mode 100644
index 0000000..dbcd4bd
@@ -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
new file mode 100644
index 0000000..0480813
@@ -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
new file mode 100644
index 0000000..5f9ae5e
@@ -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
index 48265ef..bb3b116 100644
@@ -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
new file mode 120000
index 0000000..6f8c5cd
@@ -0,0 +1 @@
+link.dts
\ No newline at end of file
arch/x86/include/asm/arch-ivybridge/gpio.h new file +10 -0
new file mode 100644
index 0000000..4951a8c
@@ -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
new file mode 100644
index 0000000..975d557
@@ -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
new file mode 100644
index 0000000..bc253a2
@@ -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
new file mode 100644
index 0000000..a133c2e
@@ -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
new file mode 100644
index 0000000..ffa9d60
@@ -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
new file mode 100644
index 0000000..b38bc14
@@ -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
new file mode 100644
index 0000000..cf70ae4
@@ -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
new file mode 100644
index 0000000..b83803e
@@ -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
#12 lore raw

PATCH v3 4/26 x86: Add chromebook_link board

Quoted 47 lines · Simon Glass

This 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 v3:
- Add help for CONFIG_ENABLE_VMX
- Enable Intel ME for chromebook_link
- Remove extra coreboot print_cpuinfo() implementation

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           |   1 +
 arch/x86/cpu/ivybridge/Kconfig             | 171 +++++++++++++++++++++++++++++
 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, 438 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
Quoted 9 lines
 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

Applied to u-boot-x86.

#13 lore raw

PATCH v3 5/26 x86: Build a .rom file which can be flashed to an x86 machine

In reply to Simon Glass

On 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 v3:
- Add an option to control the inclusion of the Intel ME

Changes in v2: None

 Makefile                          | 36 +++++++++++++++++++++++++++++++++++-
 arch/x86/Kconfig                  | 13 +++++++++++++
 include/configs/chromebook_link.h |  2 ++
 3 files changed, 50 insertions(+), 1 deletion(-)
Makefile +35 -1
index ddea534..23590d9 100644
@@ -749,6 +749,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)
@@ -817,7 +820,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}') ; \
@@ -956,6 +960,36 @@ 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 descriptor 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)/mrc.bin
+	$(objtree)/tools/ifdtool -c -r $(CONFIG_ROM_SIZE) u-boot.tmp
+	if [ -n "$(CONFIG_HAVE_INTEL_ME)" ]; then \
+		$(objtree)/tools/ifdtool -D \
+			$(srctree)/board/$(BOARDDIR)/descriptor.bin u-boot.tmp; \
+		$(objtree)/tools/ifdtool \
+			-i ME:$(srctree)/board/$(BOARDDIR)/me.bin u-boot.tmp; \
+	fi
+	$(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 $@
+
+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 +13 -0
index a5f24d0..aa7cf77 100644
@@ -34,6 +34,19 @@ config TARGET_CHROMEBOOK_LINK
 
 endchoice
 
+config ROM_SIZE
+	hex
+	default 0x800000
+
+config HAVE_INTEL_ME
+	bool "Platform requires Intel Management Engine"
+	help
+	  Newer higher-end devices have an Intel Management Engine (ME)
+	  which is a very large binary blob (typically 1.5MB) which is
+	  required for the platform to work. This enforces a particular
+	  SPI flash format. You will need to supply the me.bin file in
+	  your board directory.
+
 source "arch/x86/cpu/ivybridge/Kconfig"
 
 source "board/chromebook-x86/coreboot/Kconfig"
include/configs/chromebook_link.h +2 -0
index 394e27b..3137ef0 100644
@@ -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
#14 lore raw

PATCH v3 5/26 x86: Build a .rom file which can be flashed to an x86 machine

Quoted 14 lines · Simon Glass

On 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 v3:
- Add an option to control the inclusion of the Intel ME

Quoted 6 lines

Changes in v2: None

 Makefile                          | 36 +++++++++++++++++++++++++++++++++++-
 arch/x86/Kconfig                  | 13 +++++++++++++
 include/configs/chromebook_link.h |  2 ++
 3 files changed, 50 insertions(+), 1 deletion(-)

Applied to u-boot-x86.

#15 lore raw

PATCH v3 6/26 x86: Emit post codes in startup code for Chromebooks

In reply to 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.

---

Changes in v3:
- Change asm label to 1 (from 2)

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
index 8501716..0760a61 100644
@@ -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 print_cpuinfo(void)
arch/x86/cpu/start.S +4 -0
index b18f320..1b738f9 100644
@@ -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
new file mode 100644
index 0000000..3371185
@@ -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
index 975d557..9c715ba 100644
@@ -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
index cf70ae4..7017185 100644
@@ -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     1f
+
+	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)
+1:
+#endif
 	jmp	early_board_init_ret
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#16 lore raw

PATCH v3 6/26 x86: Emit post codes in startup code for Chromebooks

Quoted 157 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.

---

Changes in v3:
- Change asm label to 1 (from 2)

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
index 8501716..0760a61 100644
@@ -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 print_cpuinfo(void)
arch/x86/cpu/start.S +4 -0
index b18f320..1b738f9 100644
@@ -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
new file mode 100644
index 0000000..3371185
@@ -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
index 975d557..9c715ba 100644
@@ -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 +12 -1
index cf70ae4..7017185 100644
@@ -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     1f
+
+       mov    $0x8000f8f0, %eax
+       mov    $0xcf8, %dx
+       out    %eax, (%dx)
+       mov    $0xfed1c001, %eax

board/google/common/early_init.S

Quoted 10 lines
board/google/common/early_init.S +8 -1
+       mov    $0xcfc, %dx
+       out    %eax, (%dx)
+       mov    $0xfed1f410, %esp
+       mov    (%esp), %eax
+       and    $0xfffffffb, %eax
+       mov    %eax, (%esp)
+1:
+#endif
        jmp     early_board_init_ret
--
#17 lore raw

PATCH v3 6/26 x86: Emit post codes in startup code for Chromebooks

Quoted 162 lines · Bin Meng
Quoted 161 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.

---

Changes in v3:
- Change asm label to 1 (from 2)

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
index 8501716..0760a61 100644
@@ -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 print_cpuinfo(void)
arch/x86/cpu/start.S +4 -0
index b18f320..1b738f9 100644
@@ -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
new file mode 100644
index 0000000..3371185
@@ -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
index 975d557..9c715ba 100644
@@ -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 +16 -1
index cf70ae4..7017185 100644
@@ -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     1f
+
+       mov    $0x8000f8f0, %eax
+       mov    $0xcf8, %dx
+       out    %eax, (%dx)
+       mov    $0xfed1c001, %eax
+       mov    $0xcfc, %dx
+       out    %eax, (%dx)
+       mov    $0xfed1f410, %esp
+       mov    (%esp), %eax
Quoted 8 lines

board/google/common/early_init.S

Quoted 6 lines
board/google/common/early_init.S +4 -1
+       and    $0xfffffffb, %eax
+       mov    %eax, (%esp)
+1:
+#endif
        jmp     early_board_init_ret
--

Applied to u-boot-x86.

#18 lore raw

PATCH v3 7/26 x86: chromebook_link: Implement CAR support (cache as RAM)

In reply to Simon Glass

Add 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 v3: None
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
index aa7cf77..f27d731 100644
@@ -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
index 1cbdaaf..5863811 100644
@@ -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
index 3371185..b203dc9 100644
@@ -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
index 9c715ba..3a4f557 100644
@@ -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
#19 lore raw

PATCH v3 7/26 x86: chromebook_link: Implement CAR support (cache as RAM)

Quoted 13 lines · Simon Glass

Add 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 v3: None
Changes in v2:
- Expand the comment about preserving ebp
- Move SIPI code to after CAR init
- Use capitals for all #define declarations

Quoted 8 lines
 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

Applied to u-boot-x86.

#20 lore raw

PATCH v3 8/26 x86: Refactor PCI to permit alternate init

In reply to 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.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 v3:
- Assign hose->last_busno when calling pci_hose_scan()
- Move pci_setup_type1() call to common pci file

Changes in v2: None

 arch/x86/cpu/Makefile       |  1 +
 arch/x86/cpu/coreboot/pci.c | 22 +++++++---------------
 arch/x86/cpu/pci.c          | 27 +++++++++++++++++++++++++++
 arch/x86/include/asm/pci.h  | 11 +++++++++++
 4 files changed, 46 insertions(+), 15 deletions(-)
 create mode 100644 arch/x86/cpu/pci.c
arch/x86/cpu/Makefile +1 -0
index 9d38ef7..97f36d5 100644
@@ -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 +7 -15
index 33f16a3..4778f71 100644
@@ -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,13 @@ 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);
-
-	pci_register_hose(&coreboot_hose);
+	hose->config_table = pci_coreboot_config_table;
+	hose->first_busno = 0;
+	hose->last_busno = 0;
 
-	pci_hose_scan(&coreboot_hose);
+	pci_set_region(hose->regions + 0, 0x0, 0x0, 0xffffffff,
+		       PCI_REGION_MEM);
+	hose->region_count = 1;
 }
arch/x86/cpu/pci.c new file +27 -0
new file mode 100644
index 0000000..0741dc2
@@ -0,0 +1,27 @@
+/*
+ * 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_setup_type1(hose);
+	pci_register_hose(hose);
+
+	hose->last_busno = pci_hose_scan(hose);
+}
arch/x86/include/asm/pci.h +11 -0
index 6b16188..c160707 100644
@@ -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
#21 lore raw

PATCH v3 8/26 x86: Refactor PCI to permit alternate init

Quoted 118 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.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 v3:
- Assign hose->last_busno when calling pci_hose_scan()
- Move pci_setup_type1() call to common pci file

Changes in v2: None

 arch/x86/cpu/Makefile       |  1 +
 arch/x86/cpu/coreboot/pci.c | 22 +++++++---------------
 arch/x86/cpu/pci.c          | 27 +++++++++++++++++++++++++++
 arch/x86/include/asm/pci.h  | 11 +++++++++++
 4 files changed, 46 insertions(+), 15 deletions(-)
 create mode 100644 arch/x86/cpu/pci.c
arch/x86/cpu/Makefile +1 -0
index 9d38ef7..97f36d5 100644
@@ -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 +7 -15
index 33f16a3..4778f71 100644
@@ -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,13 @@ 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);
-
-       pci_register_hose(&coreboot_hose);
+       hose->config_table = pci_coreboot_config_table;
+       hose->first_busno = 0;
+       hose->last_busno = 0;
 
-       pci_hose_scan(&coreboot_hose);
+       pci_set_region(hose->regions + 0, 0x0, 0x0, 0xffffffff,
+                      PCI_REGION_MEM);
+       hose->region_count = 1;
 }
arch/x86/cpu/pci.c new file +27 -0
new file mode 100644
index 0000000..0741dc2
@@ -0,0 +1,27 @@
+/*
+ * 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_setup_type1(hose);
+       pci_register_hose(hose);
+
+       hose->last_busno = pci_hose_scan(hose);
+}
arch/x86/include/asm/pci.h +3 -0
index 6b16188..c160707 100644
@@ -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
--
#22 lore raw

PATCH v3 8/26 x86: Refactor PCI to permit alternate init

Quoted 115 lines · Bin Meng
Quoted 114 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.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 v3:
- Assign hose->last_busno when calling pci_hose_scan()
- Move pci_setup_type1() call to common pci file

Changes in v2: None

 arch/x86/cpu/Makefile       |  1 +
 arch/x86/cpu/coreboot/pci.c | 22 +++++++---------------
 arch/x86/cpu/pci.c          | 27 +++++++++++++++++++++++++++
 arch/x86/include/asm/pci.h  | 11 +++++++++++
 4 files changed, 46 insertions(+), 15 deletions(-)
 create mode 100644 arch/x86/cpu/pci.c
arch/x86/cpu/Makefile +1 -0
index 9d38ef7..97f36d5 100644
@@ -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 +7 -15
index 33f16a3..4778f71 100644
@@ -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,13 @@ 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);
-
-       pci_register_hose(&coreboot_hose);
+       hose->config_table = pci_coreboot_config_table;
+       hose->first_busno = 0;
+       hose->last_busno = 0;
 
-       pci_hose_scan(&coreboot_hose);
+       pci_set_region(hose->regions + 0, 0x0, 0x0, 0xffffffff,
+                      PCI_REGION_MEM);
+       hose->region_count = 1;
 }
arch/x86/cpu/pci.c new file +27 -0
new file mode 100644
index 0000000..0741dc2
@@ -0,0 +1,27 @@
+/*
+ * 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_setup_type1(hose);
+       pci_register_hose(hose);
+
+       hose->last_busno = pci_hose_scan(hose);
+}
arch/x86/include/asm/pci.h +0 -0
index 6b16188..c160707 100644
@@ -12,5 +12,16 @@
 #define DEFINE_PCI_DEVICE_TABLE(_table) \
        const struct pci_device_id _table[]
 
Quoted 16 lines
Quoted 4 lines
arch/x86/include/asm/pci.h +3 -0
+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
--

Applied to u-boot-x86.

#23 lore raw

PATCH v3 9/26 x86: Support use of PCI before relocation

In reply to Simon Glass

Add support for using PCI before SDRAM is available, using early malloc() and global_data.

---

Changes in v3:
- Callpci_setup_type1() in early PCI setup

Changes in v2:
- Split out new patch to support use fo PCI before relocation

 arch/x86/cpu/pci.c                 | 21 +++++++++++++++++++++
 arch/x86/include/asm/global_data.h |  1 +
 arch/x86/include/asm/pci.h         |  9 +++++++++
 3 files changed, 31 insertions(+)
arch/x86/cpu/pci.c +21 -0
index 0741dc2..2d8f16c 100644
@@ -10,15 +10,36 @@
  */
 
 #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);
+	pci_setup_type1(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_setup_type1(hose);
 	pci_register_hose(hose);
arch/x86/include/asm/global_data.h +1 -0
index 186b97e..d32987b 100644
@@ -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
index c160707..6e70a99 100644
@@ -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
#24 lore raw

PATCH v3 9/26 x86: Support use of PCI before relocation

Quoted 79 lines · Simon Glass

Add support for using PCI before SDRAM is available, using early malloc() and global_data.

---

Changes in v3:
- Callpci_setup_type1() in early PCI setup

Changes in v2:
- Split out new patch to support use fo PCI before relocation

 arch/x86/cpu/pci.c                 | 21 +++++++++++++++++++++
 arch/x86/include/asm/global_data.h |  1 +
 arch/x86/include/asm/pci.h         |  9 +++++++++
 3 files changed, 31 insertions(+)
arch/x86/cpu/pci.c +21 -0
index 0741dc2..2d8f16c 100644
@@ -10,15 +10,36 @@
  */
 
 #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);
+       pci_setup_type1(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_setup_type1(hose);
        pci_register_hose(hose);
arch/x86/include/asm/global_data.h +1 -0
index 186b97e..d32987b 100644
@@ -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 +1 -0
index c160707..6e70a99 100644
@@ -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);
+

arch/x86/include/asm/pci.h void pci_setup_type1(struct pci_controller *hose);

Quoted 10 lines
arch/x86/include/asm/pci.h +8 -1
+/**
+ * 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
--
#25 lore raw

PATCH v3 9/26 x86: Support use of PCI before relocation

Quoted 84 lines · Bin Meng
Quoted 83 lines · Simon Glass

Add support for using PCI before SDRAM is available, using early malloc() and global_data.

---

Changes in v3:
- Callpci_setup_type1() in early PCI setup

Changes in v2:
- Split out new patch to support use fo PCI before relocation

 arch/x86/cpu/pci.c                 | 21 +++++++++++++++++++++
 arch/x86/include/asm/global_data.h |  1 +
 arch/x86/include/asm/pci.h         |  9 +++++++++
 3 files changed, 31 insertions(+)
arch/x86/cpu/pci.c +21 -0
index 0741dc2..2d8f16c 100644
@@ -10,15 +10,36 @@
  */
 
 #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);
+       pci_setup_type1(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_setup_type1(hose);
        pci_register_hose(hose);
arch/x86/include/asm/global_data.h +1 -0
index 186b97e..d32987b 100644
@@ -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 +5 -0
index c160707..6e70a99 100644
@@ -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
Quoted 8 lines

arch/x86/include/asm/pci.h void pci_setup_type1(struct pci_controller *hose);

Quoted 6 lines
arch/x86/include/asm/pci.h +4 -1
+ * 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
--

Applied to u-boot-x86.

#26 lore raw

PATCH v3 10/26 x86: ivybridge: Enable PCI in early init

In reply to Simon Glass

Enable PCI so we can access devices that need to be set up before relocation.

---

Changes in v3:
- Adjust PCI setup code to fit with new generic cpu PCI code

Changes in v2: None

 arch/x86/cpu/ivybridge/Makefile   |  1 +
 arch/x86/cpu/ivybridge/cpu.c      |  6 ++++
 arch/x86/cpu/ivybridge/pci.c      | 60 +++++++++++++++++++++++++++++++++++++++
 include/configs/chromebook_link.h | 14 +++++++--
 4 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/cpu/ivybridge/pci.c
arch/x86/cpu/ivybridge/Makefile +1 -0
index dbcd4bd..6d0a78d 100644
@@ -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
index 5863811..ff6b7b3 100644
@@ -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 +60 -0

60 lines not on this page · raw message

include/configs/chromebook_link.h +12 -2
index 3137ef0..0b8c067 100644
@@ -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
#27 lore raw

PATCH v3 10/26 x86: ivybridge: Enable PCI in early init

Quoted 8 lines · Simon Glass

Enable PCI so we can access devices that need to be set up before relocation.

---

Changes in v3:
- Adjust PCI setup code to fit with new generic cpu PCI code

Quoted 8 lines

Changes in v2: None

 arch/x86/cpu/ivybridge/Makefile   |  1 +
 arch/x86/cpu/ivybridge/cpu.c      |  6 ++++
 arch/x86/cpu/ivybridge/pci.c      | 60 +++++++++++++++++++++++++++++++++++++++
 include/configs/chromebook_link.h | 14 +++++++--
 4 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/cpu/ivybridge/pci.c

Applied to u-boot-x86.

#28 lore raw

PATCH v3 10/26 x86: ivybridge: Enable PCI in early init

Hello Simon,

Is there a specific case to use PCI before relocation?
Or it only applies for x86?
If so, we could figure out how to use this new feature. Thanks for the info.

Regards,
James

Quoted 29 lines

Date: Fri, 21 Nov 2014 07:51:08 +0100
From: sjg at chromium.org
To: u-boot at lists.denx.de
CC: graeme.russ at gmail.com
Subject: Re: [U-Boot] [PATCH v3 10/26] x86: ivybridge: Enable PCI in early init

Quoted 8 lines · Simon Glass

Enable PCI so we can access devices that need to be set up before relocation.

---

Changes in v3:
- Adjust PCI setup code to fit with new generic cpu PCI code

Quoted 8 lines

Changes in v2: None

 arch/x86/cpu/ivybridge/Makefile   |  1 +
 arch/x86/cpu/ivybridge/cpu.c      |  6 ++++
 arch/x86/cpu/ivybridge/pci.c      | 60 +++++++++++++++++++++++++++++++++++++++
 include/configs/chromebook_link.h | 14 +++++++--
 4 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/cpu/ivybridge/pci.c

Applied to u-boot-x86.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#29 lore raw

PATCH v3 10/26 x86: ivybridge: Enable PCI in early init

HI James,

Quoted 5 lines · James Zhou

Hello Simon,

Is there a specific case to use PCI before relocation?
Or it only applies for x86?
If so, we could figure out how to use this new feature. Thanks for the info.

It's not x86-specific - you can use this for any arch. The main enabler was pre-relocation malloc() which is now supported in U-Boot.

Regards,
Simon

Quoted 37 lines

Regards,
James

Quoted 33 lines

Date: Fri, 21 Nov 2014 07:51:08 +0100
From: sjg at chromium.org
To: u-boot at lists.denx.de
CC: graeme.russ at gmail.com
Subject: Re: [U-Boot] [PATCH v3 10/26] x86: ivybridge: Enable PCI in early init

Quoted 11 lines · Simon Glass

Enable PCI so we can access devices that need to be set up before relocation.

---

Changes in v3:
- Adjust PCI setup code to fit with new generic cpu PCI code

Changes in v2: None

Quoted 7 lines

arch/x86/cpu/ivybridge/Makefile | 1 + arch/x86/cpu/ivybridge/cpu.c | 6 ++++ arch/x86/cpu/ivybridge/pci.c | 60
+++++++++++++++++++++++++++++++++++++++
include/configs/chromebook_link.h | 14 +++++++--

4 files changed, 79 insertions(+), 2 deletions(-)

create mode 100644 arch/x86/cpu/ivybridge/pci.c

Applied to u-boot-x86.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#30 lore raw

PATCH v3 11/26 x86: pci: Allow configuration before relocation

In reply to Simon Glass

Add 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 v3: None
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
index 2d8f16c..e399388 100644
@@ -46,3 +46,53 @@ void pci_init_board(void)
 
 	hose->last_busno = 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
index 6e70a99..98817aa 100644
@@ -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
#31 lore raw

PATCH v3 11/26 x86: pci: Allow configuration before relocation

Quoted 7 lines · Simon Glass

Add 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.

Quoted 8 lines

---

Changes in v3: None
Changes in v2: None

 arch/x86/cpu/pci.c         | 50 ++++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/pci.h | 13 ++++++++++++
 2 files changed, 63 insertions(+)

Applied to u-boot-x86.

#32 lore raw

PATCH v3 12/26 x86: ivybridge: Add early LPC init so that serial works

In reply to Simon Glass

The 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 v3: None
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
index 6d0a78d..4b77c9c 100644
@@ -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
index ff6b7b3..5d7640b 100644
@@ -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
index f2fcb39..63933aa 100644
@@ -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
new file mode 100644
index 0000000..7e1b389
@@ -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
#33 lore raw

PATCH v3 12/26 x86: ivybridge: Add early LPC init so that serial works

Quoted 11 lines · Simon Glass

The 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 v3: None
Changes in v2:
- Fix mangled cros_ec reg property

Quoted 10 lines
 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

Applied to u-boot-x86.

#34 lore raw

PATCH v3 13/26 x86: Tidy up coreboot header usage

In reply to Simon Glass

There 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 v3: None
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
index 0760a61..3356121 100644
@@ -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
index 57733d8..5f6c009 100644
@@ -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
index 0d91adc..92b7528 100644
@@ -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
#35 lore raw

PATCH v3 13/26 x86: Tidy up coreboot header usage

Quoted 7 lines · Simon Glass

There 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.

---

Quoted 7 lines

Changes in v3: None
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(-)

Applied to u-boot-x86.

#36 lore raw

PATCH v3 14/26 x86: Add clr/setbits functions

In reply to Simon Glass

These are available on other architectures. Make them available on x86 also.

---

Changes in v3: None
Changes in v2: None

 arch/x86/include/asm/io.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
arch/x86/include/asm/io.h +49 -0
index 86bac90..fcd9aa9 100644
@@ -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
#37 lore raw

PATCH v3 14/26 x86: Add clr/setbits functions

Quoted 10 lines · Simon Glass

These are available on other architectures. Make them available on x86 also.

---

Changes in v3: None
Changes in v2: None

 arch/x86/include/asm/io.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

Applied to u-boot-x86.

#38 lore raw

PATCH v3 15/26 x86: Add msr read/write functions that use a structure

In reply to Simon Glass

It 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 v3: None
Changes in v2: None

 arch/x86/include/asm/msr.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/x86/include/asm/msr.h +19 -0
index 3b5915d..df43983 100644
@@ -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
#39 lore raw

PATCH v3 15/26 x86: Add msr read/write functions that use a structure

Quoted 4 lines · Simon Glass

It 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.

Quoted 8 lines

---

Changes in v3: None
Changes in v2: None

 arch/x86/include/asm/msr.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Applied to u-boot-x86.

#40 lore raw

PATCH v3 16/26 x86: ivybridge: Perform initial CPU setup

In reply to Simon Glass

Set up the flex ratio (controls speed versus heat output) and a few other very early things.

---

Changes in v3: None
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
index 5d7640b..ab708dd 100644
@@ -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, &reg8);
+	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
index b2854a9..b9317cb 100644
@@ -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
#41 lore raw

PATCH v3 16/26 x86: ivybridge: Perform initial CPU setup

Quoted 6 lines · Simon Glass

Set up the flex ratio (controls speed versus heat output) and a few other very early things.

---

Quoted 8 lines

Changes in v3: None
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(+)

Applied to u-boot-x86.

#42 lore raw

PATCH v3 17/26 x86: ivybridge: Check BIST value on boot

In reply to Simon Glass

The built-in self test value should be checked before we continue booting. Refuse to continue if there is something wrong.

---

Changes in v3: None
Changes in v2: None

 arch/x86/cpu/ivybridge/cpu.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/x86/cpu/ivybridge/cpu.c +16 -0
index ab708dd..6a242d7 100644
@@ -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
#43 lore raw

PATCH v3 17/26 x86: ivybridge: Check BIST value on boot

Quoted 11 lines · Simon Glass

The built-in self test value should be checked before we continue booting. Refuse to continue if there is something wrong.

---

Changes in v3: None
Changes in v2: None

 arch/x86/cpu/ivybridge/cpu.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Applied to u-boot-x86.

#44 lore raw

PATCH v3 18/26 x86: ivybridge: Perform Intel microcode update on boot

In reply to Simon Glass

Microcode updates are stored in the device tree. Work through these and apply any that are needed.

---

Changes in v3: None
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
index 4b77c9c..74f01e8 100644
@@ -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
index 6a242d7..0aca2f0 100644
@@ -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
new file mode 100644
index 0000000..bc9b87c
@@ -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
index 6b40006..3bd60b7 100644
@@ -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
index 4aa227a..9a68f9c 100644
@@ -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
#45 lore raw

PATCH v3 18/26 x86: ivybridge: Perform Intel microcode update on boot

Quoted 9 lines · Simon Glass

Microcode updates are stored in the device tree. Work through these and apply any that are needed.

---

Changes in v3: None
Changes in v2: None

Quoted 9 lines
 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

Applied to u-boot-x86.

#46 lore raw

PATCH v3 19/26 x86: dts: Add microcode updates for ivybridge CPU

In reply to Simon Glass

Add 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 v3: None
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
index 63933aa..f1b7bf0 100644
@@ -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
#47 lore raw

PATCH v3 19/26 x86: dts: Add microcode updates for ivybridge CPU

Quoted 13 lines · Simon Glass

Add 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 v3: None
Changes in v2:
- Change commit message to indicate that SPDX license request is submitted

Quoted 6 lines
 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

Applied to u-boot-x86.

#48 lore raw

PATCH v3 20/26 x86: ivybridge: Add early init for PCH devices

In reply to Simon Glass

Many PCH devices are hard-coded to a particular PCI address. Set these up early in case they are needed.

---

Changes in v3: None
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
index 74f01e8..e5c0751 100644
@@ -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
index d32987b..ff9574c 100644
@@ -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
index b203dc9..61dcda1 100644
@@ -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
#49 lore raw

PATCH v3 20/26 x86: ivybridge: Add early init for PCH devices

Quoted 9 lines · Simon Glass

Many PCH devices are hard-coded to a particular PCI address. Set these up early in case they are needed.

---

Changes in v3: None
Changes in v2: None

Quoted 10 lines
 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

Applied to u-boot-x86.

#50 lore raw

PATCH v3 21/26 x86: ivybridge: Add support for early GPIO init

In reply to Simon Glass

When 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 v3: None
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
index 3ec1816..4951a8c 100644
@@ -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
index 290a737..ae338e3 100644
@@ -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
index ff9574c..4ea46d7 100644
@@ -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
#51 lore raw

PATCH v3 21/26 x86: ivybridge: Add support for early GPIO init

Quoted 16 lines · Simon Glass

When 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 v3: None
Changes in v2: None

Quoted 6 lines
 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(-)

Applied to u-boot-x86.

#52 lore raw

PATCH v3 22/26 x86: chromebook_link: Enable GPIO support

In reply to Simon Glass

Enable GPIO support and provide the required GPIO setup information to the driver.

---

Changes in v3: None
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
index f1b7bf0..74b2198 100644
@@ -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
index 0b8c067..3063bd9 100644
@@ -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
#53 lore raw

PATCH v3 22/26 x86: chromebook_link: Enable GPIO support

Quoted 6 lines · Simon Glass

Enable GPIO support and provide the required GPIO setup information to the driver.

---

Quoted 7 lines

Changes in v3: None
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(-)

Applied to u-boot-x86.

#54 lore raw

PATCH v3 23/26 x86: Make show_boot_progress() common

In reply to Simon Glass

This function can probably be used on all x86 boards, so move it into the common file.

---

Changes in v3: None
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
index 3356121..2df7288 100644
@@ -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 print_cpuinfo(void)
 {
 	return default_print_cpuinfo();
arch/x86/cpu/cpu.c +24 -0
index 97c77ba..b391b7a 100644
@@ -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>
@@ -567,3 +568,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
#55 lore raw

PATCH v3 23/26 x86: Make show_boot_progress() common

Quoted 4 lines · Simon Glass

This function can probably be used on all x86 boards, so move it into the common file.

Quoted 8 lines

---

Changes in v3: None
Changes in v2: None

 arch/x86/cpu/coreboot/coreboot.c | 24 ------------------------
 arch/x86/cpu/cpu.c               | 24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 24 deletions(-)

Applied to u-boot-x86.

#56 lore raw

PATCH v3 24/26 x86: ivybridge: Add LAPIC support

In reply to Simon Glass

The 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 v3: None
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
index d5be2f5..60976db 100644
@@ -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
#57 lore raw

PATCH v3 24/26 x86: ivybridge: Add LAPIC support

Quoted 10 lines · Simon Glass

The 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 v3: None
Changes in v2: None

Quoted 6 lines
 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

Applied to u-boot-x86.

#58 lore raw

PATCH v3 25/26 x86: ivybridge: Implement SDRAM init

In reply to Simon Glass

Implement 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 v3:
- Add a CONFIG_X86_RAMTEST option to enable the SDRAM test
- Rebase against x86/master
- Use cpu_get_name() in report_paltform.c
- Use the CONFIG_HAVE_INTEL_ME option in the Makefile

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

 arch/x86/Kconfig                                  |  20 +
 arch/x86/cpu/ivybridge/Kconfig                    |   1 +
 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          |  89 ++++
 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, 1868 insertions(+), 6 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
arch/x86/Kconfig +20 -0
index f27d731..43c22ff 100644
@@ -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
@@ -63,6 +74,15 @@ config HAVE_INTEL_ME
 	  SPI flash format. You will need to supply the me.bin file in
 	  your board directory.
 
+config X86_RAMTEST
+	bool "Perform a simple RAM test after SDRAM initialisation"
+	help
+	  If there is something wrong with SDRAM then the platform will
+	  often crash within U-Boot or the kernel. This option enables a
+	  very simple RAM test that quickly checks whether the SDRAM seems
+	  to work correctly. It is not exhaustive but can save time by
+	  detecting obvious failures.
+
 source "arch/x86/cpu/ivybridge/Kconfig"
 
 source "board/chromebook-x86/coreboot/Kconfig"
arch/x86/cpu/ivybridge/Kconfig +1 -0
index 177247e..afca957 100644
@@ -129,6 +129,7 @@ config CPU_SPECIFIC_OPTIONS
 	select CPU_MICROCODE_IN_CBFS
 	select TSC_SYNC_MFENCE
 	select HAVE_INTEL_ME
+	select X86_RAMTEST
 
 config SMM_TSEG_SIZE
 	hex
arch/x86/cpu/ivybridge/Makefile +3 -0
index e5c0751..721b37e 100644
@@ -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 +89 -0

89 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
index 1b738f9..b0d0ac0 100644
@@ -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
index a1072f2..114ee19 100644
@@ -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
index ff15828..c97d988 100644
@@ -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
index 4ea46d7..48bbd1a 100644
@@ -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
index 61dcda1..ce68839 100644
@@ -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
index 0399417..98217dd 100644
@@ -70,4 +70,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
index 25b672a..e146e64 100644
@@ -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-$(CONFIG_X86_RAMTEST) += 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
index 3063bd9..8caeca6 100644
@@ -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
index 825e9f7..f16ae32 100644
@@ -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
index 3bd60b7..abfd678 100644
@@ -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
index 9a68f9c..aafc4f9 100644
@@ -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
#59 lore raw

PATCH v3 25/26 x86: ivybridge: Implement SDRAM init

Quoted 71 lines · Simon Glass

Implement 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 v3:
- Add a CONFIG_X86_RAMTEST option to enable the SDRAM test
- Rebase against x86/master
- Use cpu_get_name() in report_paltform.c
- Use the CONFIG_HAVE_INTEL_ME option in the Makefile

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

 arch/x86/Kconfig                                  |  20 +
 arch/x86/cpu/ivybridge/Kconfig                    |   1 +
 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          |  89 ++++
 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 +
Quoted 8 lines
 lib/fdtdec.c                                      |   1 +
 23 files changed, 1868 insertions(+), 6 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

Applied to u-boot-x86.

#60 lore raw

PATCH v3 26/26 x86: Rename chromebook-x86 to coreboot

In reply to Simon Glass

Rename 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 v3: None
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
index 43c22ff..6e29868 100644
@@ -85,7 +85,7 @@ config X86_RAMTEST
 
 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
similarity index 86%
rename from board/chromebook-x86/coreboot/Kconfig
rename to board/coreboot/coreboot/Kconfig
index 83385c7..6ca6ced 100644
@@ -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
similarity index 78%
rename from board/chromebook-x86/coreboot/MAINTAINERS
rename to board/coreboot/coreboot/MAINTAINERS
index 3b2fb52..6ce66f5 100644
@@ -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
similarity index 100%
rename from board/chromebook-x86/coreboot/Makefile
rename to board/coreboot/coreboot/Makefile
board/coreboot/coreboot/coreboot.c renamed from board/chromebook-x86/coreboot/coreboot.c +0 -0
similarity index 100%
rename from board/chromebook-x86/coreboot/coreboot.c
rename to board/coreboot/coreboot/coreboot.c
board/coreboot/coreboot/coreboot_start.S renamed from board/chromebook-x86/coreboot/coreboot_start.S +0 -0
similarity index 100%
rename from board/chromebook-x86/coreboot/coreboot_start.S
rename to board/coreboot/coreboot/coreboot_start.S
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#61 lore raw

PATCH v3 26/26 x86: Rename chromebook-x86 to coreboot

Quoted 16 lines · Simon Glass

Rename 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 v3: None
Changes in v2:
- Add new patch to rename chromebook-x86 to coreboot

Quoted 12 lines
 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%)

Applied to u-boot-x86.