Skip to contentSkip to conversation

x86: Improve U-Boot as the coreboot payload support

PATCH New Bin Meng 2 participants 37 messages Aug 13, 2015 – Aug 17, 2015

Subsystems (3)
lore
Share & tools
lore

Bin Meng

author
#0 lore raw

cover x86: Improve U-Boot as the coreboot payload support

This series adds some improvment to the existing coreboot support, like >=4GiB memory support, correct E820 table report, don't bother configure system tables in Kconfig and support booting Linux kernel with a working graphics console.

Tested on Intel Bayley Bay, U-Boot loaded by coreboot as a payload.

Bin Meng (11):
x86: doc: Update coreboot payload entry point address
x86: coreboot: Increase memrange entry number to 32
x86: coreboot: Correctly report E820 types
x86: Remove calculate_relocation_address()
x86: coreboot: Allow >=4GiB memory bank size
x86: kconfig: Hide "System tables" for EFI
x86: kconfig: Hide "System tables" for coreboot
x86: Only include cbfs command for coreboot
x86: Enable CONFIG_PCI_CONFIG_HOST_BRIDGE for all boards
video: coreboot: Save VESA mode for future use
x86: Set up video framebuffer for coreboot before loading kernel

 arch/x86/Kconfig                             |  4 +--
 arch/x86/cpu/coreboot/sdram.c                | 33 ++++++++++--------
 arch/x86/include/asm/arch-coreboot/sysinfo.h |  9 ++---
 arch/x86/include/asm/init_helpers.h          |  2 --
 arch/x86/lib/init_helpers.c                  | 51 +---------------------------
 doc/README.x86                               |  6 ++--
 drivers/pci/pci_rom.c                        |  4 +--
 drivers/video/coreboot_fb.c                  | 24 +++++++++++++
 include/configs/bayleybay.h                  |  1 -
 include/configs/crownbay.h                   |  1 -
 include/configs/minnowmax.h                  |  1 -
 include/configs/qemu-x86.h                   |  1 -
 include/configs/x86-common.h                 |  3 ++
 include/vbe.h                                |  2 ++
 14 files changed, 56 insertions(+), 86 deletions(-)
Signature · 1 line
1.8.2.1
author
#1 lore raw

PATCH 1/11 x86: doc: Update coreboot payload entry point address

With recent EFI support, the entry point address of coreboot payload was changed. Now we update the address to use _x86boot_start, which is the same one for EFI.

---

 doc/README.x86 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
doc/README.x86 +3 -3
index af2459c..3f5ed8f 100644
@@ -235,10 +235,10 @@ this capability yet. The command is as follows:
 
 # in the coreboot root directory
 $ ./build/util/cbfstool/cbfstool build/coreboot.rom add-flat-binary \
-  -f u-boot-dtb.bin -n fallback/payload -c lzma -l 0x1110000 -e 0x1110015
+  -f u-boot-dtb.bin -n fallback/payload -c lzma -l 0x1110000 -e 0x1110000
 
-Make sure 0x1110000 matches CONFIG_SYS_TEXT_BASE and 0x1110015 matches the
-symbol address of _start (in arch/x86/cpu/start.S).
+Make sure 0x1110000 matches CONFIG_SYS_TEXT_BASE, which is the symbol address
+of _x86boot_start (in arch/x86/cpu/start.S).
 
 If you want to use ELF as the coreboot payload, change U-Boot configuration to
 use CONFIG_OF_EMBED instead of CONFIG_OF_SEPARATE.
Signature · 1 line
1.8.2.1
author
#4 lore raw

PATCH 2/11 x86: coreboot: Increase memrange entry number to 32

In reply to Bin Meng

Increase lib_sysinfo memrange entry number to 32 to sync with coreboot. This allows a complete E820 table to be reported to the kernel, as on some platforms (eg: Bayley Bay) having only 16 entires does not cover all the memory ranges.

---

 arch/x86/include/asm/arch-coreboot/sysinfo.h | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/x86/include/asm/arch-coreboot/sysinfo.h +3 -6
index 832c50a..2d57245 100644
@@ -9,15 +9,12 @@
 #ifndef _COREBOOT_SYSINFO_H
 #define _COREBOOT_SYSINFO_H
 
-#include <common.h>
-#include <linux/compiler.h>
-#include <libfdt.h>
 #include <asm/arch/tables.h>
 
-/* Allow a maximum of 16 memory range definitions. */
-#define SYSINFO_MAX_MEM_RANGES 16
+/* Maximum number of memory range definitions */
+#define SYSINFO_MAX_MEM_RANGES	32
 /* Allow a maximum of 8 GPIOs */
-#define SYSINFO_MAX_GPIOS 8
+#define SYSINFO_MAX_GPIOS	8
 
 struct sysinfo_t {
 	int n_memranges;
Signature · 1 line
1.8.2.1
author
#7 lore raw

PATCH 3/11 x86: coreboot: Correctly report E820 types

In reply to Bin Meng

coreboot has some extensions (type 6 & 16) to the E820 types. When we detect this, mark it as E820_RESERVED.

---

 arch/x86/cpu/coreboot/sdram.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
arch/x86/cpu/coreboot/sdram.c +13 -2
index 9c3ab81..2722886 100644
@@ -22,9 +22,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
 unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
 {
+	unsigned num_entries;
 	int i;
 
-	unsigned num_entries = min((unsigned)lib_sysinfo.n_memranges, max_entries);
+	num_entries = min((unsigned)lib_sysinfo.n_memranges, max_entries);
 	if (num_entries < lib_sysinfo.n_memranges) {
 		printf("Warning: Limiting e820 map to %d entries.\n",
 			num_entries);
@@ -34,8 +35,18 @@ unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
 
 		entries[i].addr = memrange->base;
 		entries[i].size = memrange->size;
-		entries[i].type = memrange->type;
+
+		/*
+		 * coreboot has some extensions (type 6 & 16) to the E820 types.
+		 * When we detect this, mark it as E820_RESERVED.
+		 */
+		if (memrange->type == CB_MEM_VENDOR_RSVD ||
+		    memrange->type == CB_MEM_TABLE)
+			entries[i].type = E820_RESERVED;
+		else
+			entries[i].type = memrange->type;
 	}
+
 	return num_entries;
 }
 
Signature · 1 line
1.8.2.1
author
#11 lore raw

PATCH 4/11 x86: Remove calculate_relocation_address()

In reply to Bin Meng

Now that we have generic routine to calculate relocation address, remove the x86 specific one which is now only used by coreboot.

---

 arch/x86/cpu/coreboot/sdram.c       |  9 +------
 arch/x86/include/asm/init_helpers.h |  2 --
 arch/x86/lib/init_helpers.c         | 51 +------------------------------------
 3 files changed, 2 insertions(+), 60 deletions(-)
arch/x86/cpu/coreboot/sdram.c +1 -8
index 2722886..ae5c893 100644
@@ -7,14 +7,7 @@
  */
 
 #include <common.h>
-#include <malloc.h>
 #include <asm/e820.h>
-#include <asm/u-boot-x86.h>
-#include <asm/global_data.h>
-#include <asm/init_helpers.h>
-#include <asm/processor.h>
-#include <asm/sections.h>
-#include <asm/zimage.h>
 #include <asm/arch/sysinfo.h>
 #include <asm/arch/tables.h>
 
@@ -109,7 +102,7 @@ int dram_init(void)
 	if (ram_size == 0)
 		return -1;
 
-	return calculate_relocation_address();
+	return 0;
 }
 
 void dram_init_banksize(void)
arch/x86/include/asm/init_helpers.h +0 -2
index 8cbe08e..c689a63 100644
@@ -8,8 +8,6 @@
 #ifndef _INIT_HELPERS_H_
 #define _INIT_HELPERS_H_
 
-int calculate_relocation_address(void);
-
 int init_cache_f_r(void);
 int init_bd_struct_r(void);
 int init_func_spi(void);
arch/x86/lib/init_helpers.c +1 -50

66 lines not on this page · raw message

Signature · 1 line
1.8.2.1
author
#14 lore raw

PATCH 5/11 x86: coreboot: Allow >=4GiB memory bank size

In reply to Bin Meng

Some platforms may have >=4GiB memory, so we need make U-Boot report such configuration correctly when booting as the coreboot payload.

---

 arch/x86/cpu/coreboot/sdram.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
arch/x86/cpu/coreboot/sdram.c +4 -5
index ae5c893..32f595d 100644
@@ -94,10 +94,10 @@ int dram_init(void)
 		struct memrange *memrange = &lib_sysinfo.memrange[i];
 		unsigned long long end = memrange->base + memrange->size;
 
-		if (memrange->type == CB_MEM_RAM && end > ram_size &&
-		    memrange->base < (1ULL << 32))
-			ram_size = end;
+		if (memrange->type == CB_MEM_RAM && end > ram_size)
+			ram_size += memrange->size;
 	}
+
 	gd->ram_size = ram_size;
 	if (ram_size == 0)
 		return -1;
@@ -113,8 +113,7 @@ void dram_init_banksize(void)
 		for (i = 0, j = 0; i < lib_sysinfo.n_memranges; i++) {
 			struct memrange *memrange = &lib_sysinfo.memrange[i];
 
-			if (memrange->type == CB_MEM_RAM &&
-			    memrange->base < (1ULL << 32)) {
+			if (memrange->type == CB_MEM_RAM) {
 				gd->bd->bi_dram[j].start = memrange->base;
 				gd->bd->bi_dram[j].size = memrange->size;
 				j++;
Signature · 1 line
1.8.2.1
author
#17 lore raw

PATCH 6/11 x86: kconfig: Hide "System tables" for EFI

In reply to Bin Meng

Instead of hiding each menu entries under "System tables" for EFI, hide the main menu completely.

---

 arch/x86/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/Kconfig +1 -3
index 01ed760..b600beb 100644
@@ -307,10 +307,10 @@ config VGA_BIOS_ADDR
 	  0x90000 from the beginning of a 1MB flash device.
 
 menu "System tables"
+	depends on !EFI
 
 config GENERATE_PIRQ_TABLE
 	bool "Generate a PIRQ table"
-	depends on !EFI
 	default n
 	help
 	  Generate a PIRQ routing table for this board. The PIRQ routing table
@@ -321,7 +321,6 @@ config GENERATE_PIRQ_TABLE
 
 config GENERATE_SFI_TABLE
 	bool "Generate a SFI (Simple Firmware Interface) table"
-	depends on !EFI
 	help
 	  The Simple Firmware Interface (SFI) provides a lightweight method
 	  for platform firmware to pass information to the operating system
@@ -336,7 +335,6 @@ config GENERATE_SFI_TABLE
 
 config GENERATE_MP_TABLE
 	bool "Generate an MP (Multi-Processor) table"
-	depends on !EFI
 	default n
 	help
 	  Generate an MP (Multi-Processor) table for this board. The MP table
Signature · 1 line
1.8.2.1
author
#20 lore raw

PATCH 7/11 x86: kconfig: Hide "System tables" for coreboot

In reply to Bin Meng

When booting as a coreboot payload, we don't need write any configuration tables as coreboot does that for us.

---

 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +1 -1
index b600beb..065bbe4 100644
@@ -307,7 +307,7 @@ config VGA_BIOS_ADDR
 	  0x90000 from the beginning of a 1MB flash device.
 
 menu "System tables"
-	depends on !EFI
+	depends on !EFI && !SYS_COREBOOT
 
 config GENERATE_PIRQ_TABLE
 	bool "Generate a PIRQ table"
Signature · 1 line
1.8.2.1
author
#23 lore raw

PATCH 8/11 x86: Only include cbfs command for coreboot

In reply to Bin Meng

When running U-Boot bare-metal, the cbfs command is useless.

---

 include/configs/x86-common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/x86-common.h +2 -0
index 349b06c..3d07cc0 100644
@@ -87,7 +87,9 @@
 #define CONFIG_ISO_PARTITION		/* Experimental */
 
 #define CONFIG_CMD_PART
+#ifdef CONFIG_SYS_COREBOOT
 #define CONFIG_CMD_CBFS
+#endif
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_EXT4_WRITE
 #define CONFIG_PARTITION_UUIDS
Signature · 1 line
1.8.2.1
author
#27 lore raw

PATCH 9/11 x86: Enable CONFIG_PCI_CONFIG_HOST_BRIDGE for all boards

In reply to Bin Meng

It looks that x86 chipset always contains a host bridge at pci b.d.f 0.0.0, so enable this for all boards.

---

 include/configs/bayleybay.h  | 1 -
 include/configs/crownbay.h   | 1 -
 include/configs/minnowmax.h  | 1 -
 include/configs/qemu-x86.h   | 1 -
 include/configs/x86-common.h | 1 +
 5 files changed, 1 insertion(+), 4 deletions(-)
include/configs/bayleybay.h +0 -1
index c590f56..eae94df 100644
@@ -16,7 +16,6 @@
 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
 #define CONFIG_ARCH_MISC_INIT
 
-#define CONFIG_PCI_CONFIG_HOST_BRIDGE
 #define CONFIG_SYS_EARLY_PCI_INIT
 #define CONFIG_PCI_PNP
 #define CONFIG_E1000
include/configs/crownbay.h +0 -1
index 1ea320b..e87bd54 100644
@@ -31,7 +31,6 @@
 #define CONFIG_PCI_IO_PHYS		CONFIG_PCI_IO_BUS
 #define CONFIG_PCI_IO_SIZE		0xe000
 
-#define CONFIG_PCI_CONFIG_HOST_BRIDGE
 #define CONFIG_SYS_EARLY_PCI_INIT
 #define CONFIG_PCI_PNP
 #define CONFIG_E1000
include/configs/minnowmax.h +0 -1
index 64fa676..38879da 100644
@@ -18,7 +18,6 @@
 
 #define CONFIG_SMSC_LPC47M
 
-#define CONFIG_PCI_CONFIG_HOST_BRIDGE
 #define CONFIG_SYS_EARLY_PCI_INIT
 #define CONFIG_PCI_PNP
 #define CONFIG_RTL8169
include/configs/qemu-x86.h +0 -1
index c25e331..e589425 100644
@@ -28,7 +28,6 @@
 #define CONFIG_PCI_IO_PHYS		CONFIG_PCI_IO_BUS
 #define CONFIG_PCI_IO_SIZE		0xe000
 
-#define CONFIG_PCI_CONFIG_HOST_BRIDGE
 #define CONFIG_PCI_PNP
 #define CONFIG_E1000
 
include/configs/x86-common.h +1 -0
index 3d07cc0..217312e 100644
@@ -192,6 +192,7 @@
  * PCI configuration
  */
 #define CONFIG_PCI
+#define CONFIG_PCI_CONFIG_HOST_BRIDGE
 
 /*-----------------------------------------------------------------------
  * USB configuration
Signature · 1 line
1.8.2.1
author
#30 lore raw

PATCH 10/11 video: coreboot: Save VESA mode for future use

In reply to Bin Meng

When booting as a coreboot payload, the framebuffer details are passed from coreboot via configuration tables. We save these information into vesa_mode_info structure for future use.

---

 drivers/pci/pci_rom.c       |  2 +-
 drivers/video/coreboot_fb.c | 24 ++++++++++++++++++++++++
 include/vbe.h               |  2 ++
 3 files changed, 27 insertions(+), 1 deletion(-)
drivers/pci/pci_rom.c +1 -1
index 26db3ca..b9a3990 100644
@@ -187,7 +187,7 @@ int pci_rom_load(struct pci_rom_header *rom_header,
 	return 0;
 }
 
-static struct vbe_mode_info mode_info;
+struct vbe_mode_info mode_info;
 
 int vbe_get_video_info(struct graphic_device *gdev)
 {
drivers/video/coreboot_fb.c +24 -0
index 56c35c1..4790ef1 100644
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <asm/arch/tables.h>
 #include <asm/arch/sysinfo.h>
+#include <vbe.h>
 #include <video_fb.h>
 #include "videomodes.h"
 
@@ -17,6 +18,26 @@
  */
 GraphicDevice ctfb;
 
+static void save_vesa_mode(void)
+{
+	struct vesa_mode_info *vesa = &mode_info.vesa;
+	struct cb_framebuffer *fb = lib_sysinfo.framebuffer;
+
+	vesa->x_resolution = fb->x_resolution;
+	vesa->y_resolution = fb->y_resolution;
+	vesa->bits_per_pixel = fb->bits_per_pixel;
+	vesa->bytes_per_scanline = fb->bytes_per_line;
+	vesa->phys_base_ptr = fb->physical_address;
+	vesa->red_mask_size = fb->red_mask_size;
+	vesa->red_mask_pos = fb->red_mask_pos;
+	vesa->green_mask_size = fb->green_mask_size;
+	vesa->green_mask_pos = fb->green_mask_pos;
+	vesa->blue_mask_size = fb->blue_mask_size;
+	vesa->blue_mask_pos = fb->blue_mask_pos;
+	vesa->reserved_mask_size = fb->reserved_mask_size;
+	vesa->reserved_mask_pos = fb->reserved_mask_pos;
+}
+
 static int parse_coreboot_table_fb(GraphicDevice *gdev)
 {
 	struct cb_framebuffer *fb = lib_sysinfo.framebuffer;
@@ -81,5 +102,8 @@ void *video_hw_init(void)
 	memset((void *)gdev->pciBase, 0,
 		gdev->winSizeX * gdev->winSizeY * gdev->gdfBytesPP);
 
+	/* Initialize vesa_mode_info structure */
+	save_vesa_mode();
+
 	return (void *)gdev;
 }
include/vbe.h +2 -0
index 1a86db8..164ccae 100644
@@ -102,6 +102,8 @@ struct vbe_ddc_info {
 #define VESA_SET_MODE		0x4f02
 #define VESA_GET_CUR_MODE	0x4f03
 
+extern struct vbe_mode_info mode_info;
+
 struct graphic_device;
 int vbe_get_video_info(struct graphic_device *gdev);
 
Signature · 1 line
1.8.2.1
author
#33 lore raw

PATCH 11/11 x86: Set up video framebuffer for coreboot before loading kernel

In reply to Bin Meng

Currenlty we only set up video framebuffer when VIDEO_VESA driver is used. With coreboot, VIDEO_COREBOOT driver is used instead. Since we already saved VESA mode in the VIDEO_COREBOOT driver, now we can also set up video framebuffer for coreboot before loading Linux kernel.

---

 drivers/pci/pci_rom.c | 2 --
 1 file changed, 2 deletions(-)
drivers/pci/pci_rom.c +0 -2
index b9a3990..d244543 100644
@@ -232,7 +232,6 @@ int vbe_get_video_info(struct graphic_device *gdev)
 
 void setup_video(struct screen_info *screen_info)
 {
-#ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
 	struct vesa_mode_info *vesa = &mode_info.vesa;
 
 	/* Sanity test on VESA parameters */
@@ -258,7 +257,6 @@ void setup_video(struct screen_info *screen_info)
 	screen_info->blue_pos = vesa->blue_mask_pos;
 	screen_info->rsvd_size = vesa->reserved_mask_size;
 	screen_info->rsvd_pos = vesa->reserved_mask_pos;
-#endif
 }
 
 int pci_run_vga_bios(pci_dev_t dev, int (*int15_handler)(void), int exec_method)
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH 1/11 x86: doc: Update coreboot payload entry point address

In reply to Bin Meng
Quoted 9 lines · Bin Meng

With recent EFI support, the entry point address of coreboot payload was changed. Now we update the address to use _x86boot_start, which is the same one for EFI.

---

 doc/README.x86 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Thanks, I had the same patch locally.

#5 lore raw

PATCH 2/11 x86: coreboot: Increase memrange entry number to 32

In reply to Bin Meng
Quoted 10 lines · Bin Meng

Increase lib_sysinfo memrange entry number to 32 to sync with coreboot. This allows a complete E820 table to be reported to the kernel, as on some platforms (eg: Bayley Bay) having only 16 entires does not cover all the memory ranges.

---

 arch/x86/include/asm/arch-coreboot/sysinfo.h | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
#8 lore raw

PATCH 3/11 x86: coreboot: Correctly report E820 types

In reply to Bin Meng

Hi Bin,

Quoted 8 lines · Bin Meng

coreboot has some extensions (type 6 & 16) to the E820 types. When we detect this, mark it as E820_RESERVED.

---

 arch/x86/cpu/coreboot/sdram.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

I wonder what the kernel does when it sees the coreboot values?

Regards,
Simon

#12 lore raw

PATCH 4/11 x86: Remove calculate_relocation_address()

In reply to Bin Meng
Quoted 10 lines · Bin Meng

Now that we have generic routine to calculate relocation address, remove the x86 specific one which is now only used by coreboot.

---

 arch/x86/cpu/coreboot/sdram.c       |  9 +------
 arch/x86/include/asm/init_helpers.h |  2 --
 arch/x86/lib/init_helpers.c         | 51 +------------------------------------
 3 files changed, 2 insertions(+), 60 deletions(-)

Great!

#24 lore raw

PATCH 8/11 x86: Only include cbfs command for coreboot

In reply to Bin Meng

Hi Bin,

Quoted 23 lines · Bin Meng

When running U-Boot bare-metal, the cbfs command is useless.

---

 include/configs/x86-common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/x86-common.h +2 -1
index 349b06c..3d07cc0 100644
@@ -87,7 +87,9 @@
 #define CONFIG_ISO_PARTITION           /* Experimental */
 
 #define CONFIG_CMD_PART
+#ifdef CONFIG_SYS_COREBOOT
 #define CONFIG_CMD_CBFS
+#endif
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_EXT4_WRITE
 #define CONFIG_PARTITION_UUIDS
--
Quoted 2 lines

1.8.2.1

We should move that to Kconfig. Have you tried Masahiro's moveconfig script?

Regards,
Simon

#28 lore raw

PATCH 9/11 x86: Enable CONFIG_PCI_CONFIG_HOST_BRIDGE for all boards

In reply to Bin Meng
Quoted 4 lines · Bin Meng

It looks that x86 chipset always contains a host bridge at pci b.d.f 0.0.0, so enable this for all boards.

Quoted 8 lines

---

 include/configs/bayleybay.h  | 1 -
 include/configs/crownbay.h   | 1 -
 include/configs/minnowmax.h  | 1 -
 include/configs/qemu-x86.h   | 1 -
 include/configs/x86-common.h | 1 +
 5 files changed, 1 insertion(+), 4 deletions(-)
#31 lore raw

PATCH 10/11 video: coreboot: Save VESA mode for future use

In reply to Bin Meng
Quoted 11 lines · Bin Meng

When booting as a coreboot payload, the framebuffer details are passed from coreboot via configuration tables. We save these information into vesa_mode_info structure for future use.

---

 drivers/pci/pci_rom.c       |  2 +-
 drivers/video/coreboot_fb.c | 24 ++++++++++++++++++++++++
 include/vbe.h               |  2 ++
 3 files changed, 27 insertions(+), 1 deletion(-)
#34 lore raw

PATCH 11/11 x86: Set up video framebuffer for coreboot before loading kernel

In reply to Bin Meng
Quoted 11 lines · Bin Meng

Currenlty we only set up video framebuffer when VIDEO_VESA driver is used. With coreboot, VIDEO_COREBOOT driver is used instead. Since we already saved VESA mode in the VIDEO_COREBOOT driver, now we can also set up video framebuffer for coreboot before loading Linux kernel.

---

 drivers/pci/pci_rom.c | 2 --
 1 file changed, 2 deletions(-)

Nice.

author
#9 lore raw

PATCH 3/11 x86: coreboot: Correctly report E820 types

In reply to Simon Glass

Hi Simon,

Quoted 9 lines · Simon Glass

Hi Bin,

Quoted 6 lines · Bin Meng

coreboot has some extensions (type 6 & 16) to the E820 types. When we detect this, mark it as E820_RESERVED.

---

Quoted 7 lines
Quoted 2 lines
 arch/x86/cpu/coreboot/sdram.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

I wonder what the kernel does when it sees the coreboot values?

I noticed this by checking kernel dmesg, where the log prints the E820 ranges as well as types. For type 6 & 16, kernel does not understand that and it just prints the typer number. I believe kernel will ignore these.

Regards,
Bin

author
#25 lore raw

PATCH 8/11 x86: Only include cbfs command for coreboot

In reply to Simon Glass

Hi Simon,

Quoted 31 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng

When running U-Boot bare-metal, the cbfs command is useless.

---

 include/configs/x86-common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/x86-common.h +2 -1
index 349b06c..3d07cc0 100644
@@ -87,7 +87,9 @@
 #define CONFIG_ISO_PARTITION           /* Experimental */
 
 #define CONFIG_CMD_PART
+#ifdef CONFIG_SYS_COREBOOT
 #define CONFIG_CMD_CBFS
+#endif
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_EXT4_WRITE
 #define CONFIG_PARTITION_UUIDS
--
Quoted 2 lines

1.8.2.1

Quoted 2 lines

We should move that to Kconfig. Have you tried Masahiro's moveconfig script?

I haven't got a chance to try moveconfig scripts, but I will try some time. I believe there are lots of work to get all config.h defines converted to Kconfig options first, and some day we will achieve this :)

Regards,
Bin

#36 lore raw

cover x86: Improve U-Boot as the coreboot payload support

In reply to Bin Meng

Hi,

Quoted 21 lines · Bin Meng

This series adds some improvment to the existing coreboot support, like >=4GiB memory support, correct E820 table report, don't bother configure system tables in Kconfig and support booting Linux kernel with a working graphics console.

Tested on Intel Bayley Bay, U-Boot loaded by coreboot as a payload.

Bin Meng (11):
x86: doc: Update coreboot payload entry point address
x86: coreboot: Increase memrange entry number to 32
x86: coreboot: Correctly report E820 types
x86: Remove calculate_relocation_address()
x86: coreboot: Allow >=4GiB memory bank size
x86: kconfig: Hide "System tables" for EFI
x86: kconfig: Hide "System tables" for coreboot
x86: Only include cbfs command for coreboot
x86: Enable CONFIG_PCI_CONFIG_HOST_BRIDGE for all boards
video: coreboot: Save VESA mode for future use
x86: Set up video framebuffer for coreboot before loading kernel

Quoted 15 lines
 arch/x86/Kconfig                             |  4 +--
 arch/x86/cpu/coreboot/sdram.c                | 33 ++++++++++--------
 arch/x86/include/asm/arch-coreboot/sysinfo.h |  9 ++---
 arch/x86/include/asm/init_helpers.h          |  2 --
 arch/x86/lib/init_helpers.c                  | 51 +---------------------------
 doc/README.x86                               |  6 ++--
 drivers/pci/pci_rom.c                        |  4 +--
 drivers/video/coreboot_fb.c                  | 24 +++++++++++++
 include/configs/bayleybay.h                  |  1 -
 include/configs/crownbay.h                   |  1 -
 include/configs/minnowmax.h                  |  1 -
 include/configs/qemu-x86.h                   |  1 -
 include/configs/x86-common.h                 |  3 ++
 include/vbe.h                                |  2 ++
 14 files changed, 56 insertions(+), 86 deletions(-)

I'm going to pick this for this release as it adds fixes for booting as a coreboot payload.

Regards,
Simon

#3 lore raw

PATCH 1/11 x86: doc: Update coreboot payload entry point address

In reply to Simon Glass
Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng

With recent EFI support, the entry point address of coreboot payload was changed. Now we update the address to use _x86boot_start, which is the same one for EFI.

---

Quoted 6 lines
Quoted 2 lines
 doc/README.x86 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Thanks, I had the same patch locally.

I'm applying this for the current release as it is a fix.

Applied to u-boot-x86, thanks!

#6 lore raw

PATCH 2/11 x86: coreboot: Increase memrange entry number to 32

In reply to Simon Glass
Quoted 6 lines · Simon Glass
Quoted 5 lines · Bin Meng

Increase lib_sysinfo memrange entry number to 32 to sync with coreboot. This allows a complete E820 table to be reported to the kernel, as on some platforms (eg: Bayley Bay) having only 16 entires does not cover all the memory ranges.

Quoted 7 lines
Quoted 5 lines

---

 arch/x86/include/asm/arch-coreboot/sysinfo.h | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Applied to u-boot-x86, thanks!

#10 lore raw

PATCH 3/11 x86: coreboot: Correctly report E820 types

In reply to Bin Meng
Quoted 20 lines · Bin Meng

Hi Simon,

Quoted 9 lines · Simon Glass

Hi Bin,

Quoted 6 lines · Bin Meng

coreboot has some extensions (type 6 & 16) to the E820 types. When we detect this, mark it as E820_RESERVED.

---

Quoted 7 lines
Quoted 2 lines
 arch/x86/cpu/coreboot/sdram.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

I wonder what the kernel does when it sees the coreboot values?

Quoted 7 lines

I noticed this by checking kernel dmesg, where the log prints the E820 ranges as well as types. For type 6 & 16, kernel does not understand that and it just prints the typer number. I believe kernel will ignore these.

Regards,
Bin

Applied to u-boot-x86, thanks!

#13 lore raw

PATCH 4/11 x86: Remove calculate_relocation_address()

In reply to Simon Glass
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng

Now that we have generic routine to calculate relocation address, remove the x86 specific one which is now only used by coreboot.

---

Quoted 8 lines
Quoted 4 lines
 arch/x86/cpu/coreboot/sdram.c       |  9 +------
 arch/x86/include/asm/init_helpers.h |  2 --
 arch/x86/lib/init_helpers.c         | 51 +------------------------------------
 3 files changed, 2 insertions(+), 60 deletions(-)

Great!

Applied to u-boot-x86, thanks!

#16 lore raw

PATCH 5/11 x86: coreboot: Allow >=4GiB memory bank size

In reply to Simon Glass
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng

Some platforms may have >=4GiB memory, so we need make U-Boot report such configuration correctly when booting as the coreboot payload.

---

Quoted 6 lines
Quoted 2 lines
 arch/x86/cpu/coreboot/sdram.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

This looks safe to me.

Applied to u-boot-x86, thanks!

#26 lore raw

PATCH 8/11 x86: Only include cbfs command for coreboot

In reply to Bin Meng
Quoted 37 lines · Bin Meng

Hi Simon,

Quoted 31 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng

When running U-Boot bare-metal, the cbfs command is useless.

---

 include/configs/x86-common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/x86-common.h +2 -1
index 349b06c..3d07cc0 100644
@@ -87,7 +87,9 @@
 #define CONFIG_ISO_PARTITION           /* Experimental */
 
 #define CONFIG_CMD_PART
+#ifdef CONFIG_SYS_COREBOOT
 #define CONFIG_CMD_CBFS
+#endif
 #define CONFIG_CMD_EXT4
 #define CONFIG_CMD_EXT4_WRITE
 #define CONFIG_PARTITION_UUIDS
--
Quoted 2 lines

1.8.2.1

Quoted 2 lines

We should move that to Kconfig. Have you tried Masahiro's moveconfig script?

Quoted 7 lines

I haven't got a chance to try moveconfig scripts, but I will try some time. I believe there are lots of work to get all config.h defines converted to Kconfig options first, and some day we will achieve this :)

Regards,
Bin

Applied to u-boot-x86, thanks!

#29 lore raw

PATCH 9/11 x86: Enable CONFIG_PCI_CONFIG_HOST_BRIDGE for all boards

In reply to Simon Glass
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng

It looks that x86 chipset always contains a host bridge at pci b.d.f 0.0.0, so enable this for all boards.

---

Quoted 8 lines
Quoted 6 lines
 include/configs/bayleybay.h  | 1 -
 include/configs/crownbay.h   | 1 -
 include/configs/minnowmax.h  | 1 -
 include/configs/qemu-x86.h   | 1 -
 include/configs/x86-common.h | 1 +
 5 files changed, 1 insertion(+), 4 deletions(-)

Applied to u-boot-x86, thanks!

#32 lore raw

PATCH 10/11 video: coreboot: Save VESA mode for future use

In reply to Simon Glass
Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng

When booting as a coreboot payload, the framebuffer details are passed from coreboot via configuration tables. We save these information into vesa_mode_info structure for future use.

---

Quoted 6 lines
Quoted 4 lines
 drivers/pci/pci_rom.c       |  2 +-
 drivers/video/coreboot_fb.c | 24 ++++++++++++++++++++++++
 include/vbe.h               |  2 ++
 3 files changed, 27 insertions(+), 1 deletion(-)

Applied to u-boot-x86, thanks!

#35 lore raw

PATCH 11/11 x86: Set up video framebuffer for coreboot before loading kernel

In reply to Simon Glass
Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng

Currenlty we only set up video framebuffer when VIDEO_VESA driver is used. With coreboot, VIDEO_COREBOOT driver is used instead. Since we already saved VESA mode in the VIDEO_COREBOOT driver, now we can also set up video framebuffer for coreboot before loading Linux kernel.

Quoted 8 lines
Quoted 4 lines

---

 drivers/pci/pci_rom.c | 2 --
 1 file changed, 2 deletions(-)

Nice.

Applied to u-boot-x86, thanks!