Skip to contentSkip to conversation

x86: Various minor enhancements for coreboot

PATCH Superseded Simon Glass 5 participants 41 messages Feb 20, 2023 – May 9, 2023

Subsystems (6)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover x86: Various minor enhancements for coreboot

This series includes some patches generated while getting U-Boot to boot more nicely on Brya, an Adler Lake Chromebook.

This includes:
- show the ACPI tables with 'acpi list'
- get the UART to work even if coreboot doesn't enable it
- show unimplemented sysinfo tags
- fix for keyboard not working
- fix for trying to set up PCI regions when the info is not available
- fix for looking at inaccessible memory to find the sysinfo table

Simon Glass (13):
mtrr: Don't show an invalid CPU number
x86: Adjust search range for sysinfo table
input: Only reset the keyboard when running bare metal
x86: coreboot: Allow ACPI tables to be recorded
x86: coreboot: Collect the address of the ACPI tables
x86: Allow locating UARTs by device ID
pci: coreboot: Don't read regions when booting
usb: Quieten a debug message
x86: coreboot: Use a memory-mapped UART
x86: coreboot: Document how to enable the debug UART
x86: coreboot: Scan PCI after relocation
x86: coreboot: Log function names and line numbers
x86: coreboot: Show unimplemented sysinfo tags

 arch/x86/cpu/cpu.c                     |  2 +-
 arch/x86/dts/coreboot.dts              |  4 ++
 arch/x86/include/asm/cb_sysinfo.h      |  8 +++
 arch/x86/include/asm/coreboot_tables.h |  2 +
 arch/x86/lib/coreboot/cb_sysinfo.c     | 13 +++++
 cmd/Kconfig                            |  3 +-
 cmd/acpi.c                             |  4 ++
 cmd/x86/cbsysinfo.c                    |  9 ++++
 cmd/x86/mtrr.c                         |  3 +-
 configs/coreboot_defconfig             |  5 ++
 doc/board/coreboot/coreboot.rst        | 29 +++++++++++
 drivers/input/i8042.c                  | 13 +++--
 drivers/pci/pci-uclass.c               |  4 ++
 drivers/serial/serial_coreboot.c       | 69 +++++++++++++++++++++++---
 drivers/usb/host/xhci.c                |  4 +-
 include/asm-generic/global_data.h      |  4 +-
 include/configs/coreboot.h             |  2 +
 include/pci_ids.h                      |  3 ++
 18 files changed, 161 insertions(+), 20 deletions(-)
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#1 lore raw

PATCH 1/13 mtrr: Don't show an invalid CPU number

When U-Boot did not do the MP init, we don't get an actual CPU number here. Skip printing it in that case.

---

 cmd/x86/mtrr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cmd/x86/mtrr.c +2 -1
index b213a942fde..95916933e9a 100644
@@ -145,7 +145,8 @@ static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc,
 		for (; i >= 0; i = mp_next_cpu(cpu_select, i)) {
 			if (!first)
 				printf("\n");
-			printf("CPU %d:\n", i);
+			if (i < MP_SELECT_ALL)
+				printf("CPU %d:\n", i);
 			ret = do_mtrr_list(reg_count, i);
 			if (ret) {
 				printf("Failed to read CPU %d (err=%d)\n", i,
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#2 lore raw

Re: [PATCH 01/13] mtrr: Don't show an invalid CPU number

Hi Simon,

Quoted 15 lines · Simon Glass

When U-Boot did not do the MP init, we don't get an actual CPU number here. Skip printing it in that case.

---

 cmd/x86/mtrr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cmd/x86/mtrr.c +0 -0
index b213a942fde..95916933e9a 100644

cmd/x86/mtrr.c static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc, · line 152

Quoted 9 lines
cmd/x86/mtrr.c +2 -1
@@ -145,7 +145,8 @@ static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc,
                for (; i >= 0; i = mp_next_cpu(cpu_select, i)) {
                        if (!first)
                                printf("\n");
-                       printf("CPU %d:\n", i);
+                       if (i < MP_SELECT_ALL)
+                               printf("CPU %d:\n", i);
                        ret = do_mtrr_list(reg_count, i);
                        if (ret) {
                                printf("Failed to read CPU %d (err=%d)\n", i,

The CPU number <i> should not be printed here if (i >= MP_SELECT_ALL)

Regards,
Bin

#3 lore raw

PATCH 2/13 x86: Adjust search range for sysinfo table

In reply to Simon Glass

Avoid searching starting at 0 since this memory may not be available and the table cannot be there anyway. Start at 0x400 instead.

---

 arch/x86/cpu/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/cpu.c +1 -1
index 6fe6eaf6c84..3394e5b523c 100644
@@ -352,7 +352,7 @@ long locate_coreboot_table(void)
 	long addr;
 
 	/* We look for LBIO in the first 4K of RAM and again at 960KB */
-	addr = detect_coreboot_table_at(0x0, 0x1000);
+	addr = detect_coreboot_table_at(0x400, 0xc00);
 	if (addr < 0)
 		addr = detect_coreboot_table_at(0xf0000, 0x1000);
 
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#4 lore raw

Re: [PATCH 02/13] x86: Adjust search range for sysinfo table

Hi Simon,

Quoted 2 lines · Simon Glass

Avoid searching starting at 0 since this memory may not be available

Please describe in more detail why memory address 0 is not available?

Quoted 13 lines

and the table cannot be there anyway. Start at 0x400 instead.

---

 arch/x86/cpu/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/cpu.c +0 -0
index 6fe6eaf6c84..3394e5b523c 100644

arch/x86/cpu/cpu.c long locate_coreboot_table(void) · line 354

Quoted 3 lines
arch/x86/cpu/cpu.c +0 -0
@@ -352,7 +352,7 @@ long locate_coreboot_table(void)
        long addr;
 
        /* We look for LBIO in the first 4K of RAM and again at 960KB */

And update the comment here for the memory address 0 too.

arch/x86/cpu/cpu.c long locate_coreboot_table(void)

Quoted 6 lines
arch/x86/cpu/cpu.c +1 -2
-       addr = detect_coreboot_table_at(0x0, 0x1000);
+       addr = detect_coreboot_table_at(0x400, 0xc00);
        if (addr < 0)
                addr = detect_coreboot_table_at(0xf0000, 0x1000);
 
--

Regards,
Bin

#5 lore raw

PATCH 3/13 input: Only reset the keyboard when running bare metal

In reply to Simon Glass

If U-Boot is not the first-stage bootloader we should not init the keyboard, since it has already been done. Check for this.

---

 drivers/input/i8042.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/input/i8042.c +9 -4
index 3563dc98838..e2189726674 100644
@@ -6,11 +6,14 @@
 
 /* i8042.c - Intel 8042 keyboard driver routines */
 
+#define LOG_CATEGORY UCLASS_KEYBOARD
+
 #include <common.h>
 #include <dm.h>
 #include <env.h>
 #include <errno.h>
 #include <i8042.h>
+#include <init.h>
 #include <input.h>
 #include <keyboard.h>
 #include <log.h>
@@ -132,10 +135,12 @@ static int kbd_reset(int quirk)
 		goto err;
 
 	/* keyboard reset */
-	if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) ||
-	    kbd_read(I8042_DATA_REG) != KBD_ACK ||
-	    kbd_read(I8042_DATA_REG) != KBD_POR)
-		goto err;
+	if (ll_boot_init()) {
+		if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) ||
+		    kbd_read(I8042_DATA_REG) != KBD_ACK ||
+		    kbd_read(I8042_DATA_REG) != KBD_POR)
+			goto err;
+	}
 
 	if (kbd_write(I8042_DATA_REG, CMD_DRAIN_OUTPUT) ||
 	    kbd_read(I8042_DATA_REG) != KBD_ACK)
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#6 lore raw

Re: [PATCH 03/13] input: Only reset the keyboard when running bare metal

Hi Simon,

Quoted 3 lines · Simon Glass

If U-Boot is not the first-stage bootloader we should not init the keyboard, since it has already been done. Check for this.

But re-init does no harm, right?

Quoted 7 lines

---

 drivers/input/i8042.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Regards,
Bin

#7 lore raw

Re: [PATCH 03/13] input: Only reset the keyboard when running bare metal

Hi Bin,

Quoted 9 lines · Bin Meng

Hi Simon,

Quoted 3 lines · Simon Glass

If U-Boot is not the first-stage bootloader we should not init the keyboard, since it has already been done. Check for this.

But re-init does no harm, right?

Actually it causes the keyboard to fail on Brya (Felwinter), a Chromebook. It could be due to it having a numeric keypad.

Quoted 8 lines
Quoted 8 lines

---

 drivers/input/i8042.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Regards,
Simon

#8 lore raw

Re: [PATCH 03/13] input: Only reset the keyboard when running bare metal

Hi Simon,

Quoted 9 lines · Simon Glass

Hi Bin,

Quoted 5 lines · Bin Meng

Hi Simon,

Quoted 1 line · Simon Glass
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

If U-Boot is not the first-stage bootloader we should not init the keyboard, since it has already been done. Check for this.

But re-init does no harm, right?

Actually it causes the keyboard to fail on Brya (Felwinter), a Chromebook. It could be due to it having a numeric keypad.

I assume Linux kernel will do the keyboard re-init no matter what bootloader does. So does Linux kernel fail to re-init the keyboard? If no, I guess we could improve the U-Boot keyboard driver somehow?

#9 lore raw

Re: [PATCH 03/13] input: Only reset the keyboard when running bare metal

Hi Bin,

Quoted 16 lines · Bin Meng

Hi Simon,

Quoted 12 lines · Simon Glass

Hi Bin,

Quoted 8 lines · Bin Meng

Hi Simon,

Quoted 3 lines · Simon Glass

If U-Boot is not the first-stage bootloader we should not init the keyboard, since it has already been done. Check for this.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

But re-init does no harm, right?

Actually it causes the keyboard to fail on Brya (Felwinter), a Chromebook. It could be due to it having a numeric keypad.

I assume Linux kernel will do the keyboard re-init no matter what bootloader does. So does Linux kernel fail to re-init the keyboard? If no, I guess we could improve the U-Boot keyboard driver somehow?

I found another way, to flush the buffer first.

Regards,
Simon

#10 lore raw

Re: [PATCH 03/13] input: Only reset the keyboard when running bare metal

Hi Bin,

Quoted 22 lines · Simon Glass

Hi Bin,

Quoted 18 lines · Bin Meng

Hi Simon,

Quoted 14 lines · Simon Glass

Hi Bin,

Quoted 9 lines · Bin Meng

Hi Simon,

Quoted 3 lines · Simon Glass

If U-Boot is not the first-stage bootloader we should not init the keyboard, since it has already been done. Check for this.

But re-init does no harm, right?

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Actually it causes the keyboard to fail on Brya (Felwinter), a Chromebook. It could be due to it having a numeric keypad.

I assume Linux kernel will do the keyboard re-init no matter what bootloader does. So does Linux kernel fail to re-init the keyboard? If no, I guess we could improve the U-Boot keyboard driver somehow?

I found another way, to flush the buffer first.

Hmm no that does not always work, depending on what has happened before in coreboot.

Also it doesn't look like Linux always resets. Please see here:

https://github.com/torvalds/linux/blob/master/drivers/input/serio/i8042.c#L58

Regards,
Simon

#11 lore raw

PATCH 4/13 x86: coreboot: Allow ACPI tables to be recorded

In reply to Simon Glass

At present any ACPI tables created by prior-stage firmware are ignored. It is useful to be able to view these in U-Boot.

Add the acpi command for coreboot and use that to allow recording the ACPI-table start.

---

 cmd/Kconfig                       | 3 +--
 cmd/acpi.c                        | 4 ++++
 include/asm-generic/global_data.h | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)
cmd/Kconfig +1 -2
index b2d75987170..97c8610e461 100644
@@ -109,8 +109,7 @@ menu "Info commands"
 
 config CMD_ACPI
 	bool "acpi"
-	depends on ACPIGEN
-	default y
+	default y if TARGET_COREBOOT || ACPIGEN
 	help
 	  List and dump ACPI tables. ACPI (Advanced Configuration and Power
 	  Interface) is used mostly on x86 for providing information to the
cmd/acpi.c +4 -0
index d0fc062ef8c..991b5235e28 100644
@@ -162,6 +162,10 @@ static int do_acpi_items(struct cmd_tbl *cmdtp, int flag, int argc,
 	bool dump_contents;
 
 	dump_contents = argc >= 2 && !strcmp("-d", argv[1]);
+	if (!IS_ENABLED(CONFIG_ACPIGEN)) {
+		printf("Not supported (enable ACPIGEN)\n");
+		return CMD_RET_FAILURE;
+	}
 	acpi_dump_items(dump_contents ? ACPI_DUMP_CONTENTS : ACPI_DUMP_LIST);
 
 	return 0;
include/asm-generic/global_data.h +2 -2
index da17ac8cbc8..2e3feb5a8c0 100644
@@ -457,7 +457,7 @@ struct global_data {
 	 */
 	fdt_addr_t translation_offset;
 #endif
-#ifdef CONFIG_GENERATE_ACPI_TABLE
+#if defined(CONFIG_GENERATE_ACPI_TABLE) || defined(CONFIG_CMD_ACPI)
 	/**
 	 * @acpi_ctx: ACPI context pointer
 	 */
@@ -536,7 +536,7 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
 #define gd_dm_priv_base()		NULL
 #endif
 
-#ifdef CONFIG_GENERATE_ACPI_TABLE
+#if defined(CONFIG_GENERATE_ACPI_TABLE) || defined(CONFIG_CMD_ACPI)
 #define gd_acpi_ctx()		gd->acpi_ctx
 #define gd_acpi_start()		gd->acpi_start
 #define gd_set_acpi_start(addr)	gd->acpi_start = addr
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#12 lore raw

PATCH 5/13 x86: coreboot: Collect the address of the ACPI tables

In reply to Simon Glass

Pick this up from the sysinfo tables and display it with the cbsysinfo command. This allows the 'acpi list' command to work when booting from coreboot.

---

 arch/x86/include/asm/cb_sysinfo.h      |  2 ++
 arch/x86/include/asm/coreboot_tables.h |  2 ++
 arch/x86/lib/coreboot/cb_sysinfo.c     | 11 +++++++++++
 cmd/x86/cbsysinfo.c                    |  1 +
 4 files changed, 16 insertions(+)
arch/x86/include/asm/cb_sysinfo.h +2 -0
index 0201ac6b03a..6b266149cf6 100644
@@ -133,6 +133,7 @@
  * @mtc_size: Size of MTC region
  * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning
  *	not used
+ * @rsdp: Pointer to ACPI RSDP table
  */
 struct sysinfo_t {
 	unsigned int cpu_khz;
@@ -211,6 +212,7 @@ struct sysinfo_t {
 	u64 mtc_start;
 	u32 mtc_size;
 	void	*chromeos_vpd;
+	void *rsdp;
 };
 
 extern struct sysinfo_t lib_sysinfo;
arch/x86/include/asm/coreboot_tables.h +2 -0
index f131de56a40..2d6f3db3a5f 100644
@@ -422,6 +422,8 @@ struct cb_tsc_info {
 #define CB_TAG_SERIALNO			0x002a
 #define CB_MAX_SERIALNO_LENGTH		32
 
+#define CB_TAG_ACPI_RSDP                0x0043
+
 #define CB_TAG_CMOS_OPTION_TABLE	0x00c8
 
 struct cb_cmos_option_table {
arch/x86/lib/coreboot/cb_sysinfo.c +11 -0
index 748fa4ee53b..a11a2587f66 100644
@@ -264,6 +264,13 @@ static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info)
 	info->mrc_cache = map_sysmem(cbmem->cbmem_tab, 0);
 }
 
+static void cb_parse_acpi_rsdp(void *ptr, struct sysinfo_t *info)
+{
+	struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr;
+
+	info->rsdp = map_sysmem(cbmem->cbmem_tab, 0);
+}
+
 __weak void cb_parse_unhandled(u32 tag, unsigned char *ptr)
 {
 }
@@ -428,6 +435,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 		case CB_TAG_MRC_CACHE:
 			cb_parse_mrc_cache(rec, info);
 			break;
+		case CB_TAG_ACPI_RSDP:
+			cb_parse_acpi_rsdp(rec, info);
+			break;
 		default:
 			cb_parse_unhandled(rec->tag, ptr);
 			break;
@@ -454,6 +464,7 @@ int get_coreboot_info(struct sysinfo_t *info)
 	if (!ret)
 		return -ENOENT;
 	gd->arch.coreboot_table = addr;
+	gd_set_acpi_start(map_to_sysmem(info->rsdp));
 	gd->flags |= GD_FLG_SKIP_LL_INIT;
 
 	return 0;
cmd/x86/cbsysinfo.c +1 -0
index 34fdaf5b1b1..07570b00c9a 100644
@@ -363,6 +363,7 @@ static void show_table(struct sysinfo_t *info, bool verbose)
 	print_hex("MTC size", info->mtc_size);
 
 	print_ptr("Chrome OS VPD", info->chromeos_vpd);
+	print_ptr("RSDP", info->rsdp);
 }
 
 static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc,
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#13 lore raw

Re: [PATCH 05/13] x86: coreboot: Collect the address of the ACPI tables

Hi Simon,

Quoted 39 lines · Simon Glass

Pick this up from the sysinfo tables and display it with the cbsysinfo command. This allows the 'acpi list' command to work when booting from coreboot.

---

 arch/x86/include/asm/cb_sysinfo.h      |  2 ++
 arch/x86/include/asm/coreboot_tables.h |  2 ++
 arch/x86/lib/coreboot/cb_sysinfo.c     | 11 +++++++++++
 cmd/x86/cbsysinfo.c                    |  1 +
 4 files changed, 16 insertions(+)
arch/x86/include/asm/cb_sysinfo.h +2 -0
index 0201ac6b03a..6b266149cf6 100644
@@ -133,6 +133,7 @@
  * @mtc_size: Size of MTC region
  * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning
  *     not used
+ * @rsdp: Pointer to ACPI RSDP table
  */
 struct sysinfo_t {
        unsigned int cpu_khz;
@@ -211,6 +212,7 @@ struct sysinfo_t {
        u64 mtc_start;
        u32 mtc_size;
        void    *chromeos_vpd;
+       void *rsdp;
 };
 
 extern struct sysinfo_t lib_sysinfo;
arch/x86/include/asm/coreboot_tables.h +0 -0
index f131de56a40..2d6f3db3a5f 100644

arch/x86/include/asm/coreboot_tables.h struct cb_tsc_info { · line 425

Quoted 4 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
@@ -422,6 +422,8 @@ struct cb_tsc_info {
 #define CB_TAG_SERIALNO                        0x002a
 #define CB_MAX_SERIALNO_LENGTH         32
 
+#define CB_TAG_ACPI_RSDP                0x0043

This is using space but should be tab.

Quoted 45 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
+
 #define CB_TAG_CMOS_OPTION_TABLE       0x00c8
 
 struct cb_cmos_option_table {
arch/x86/lib/coreboot/cb_sysinfo.c +11 -0
index 748fa4ee53b..a11a2587f66 100644
@@ -264,6 +264,13 @@ static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info)
        info->mrc_cache = map_sysmem(cbmem->cbmem_tab, 0);
 }
 
+static void cb_parse_acpi_rsdp(void *ptr, struct sysinfo_t *info)
+{
+       struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr;
+
+       info->rsdp = map_sysmem(cbmem->cbmem_tab, 0);
+}
+
 __weak void cb_parse_unhandled(u32 tag, unsigned char *ptr)
 {
 }
@@ -428,6 +435,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
                case CB_TAG_MRC_CACHE:
                        cb_parse_mrc_cache(rec, info);
                        break;
+               case CB_TAG_ACPI_RSDP:
+                       cb_parse_acpi_rsdp(rec, info);
+                       break;
                default:
                        cb_parse_unhandled(rec->tag, ptr);
                        break;
@@ -454,6 +464,7 @@ int get_coreboot_info(struct sysinfo_t *info)
        if (!ret)
                return -ENOENT;
        gd->arch.coreboot_table = addr;
+       gd_set_acpi_start(map_to_sysmem(info->rsdp));
        gd->flags |= GD_FLG_SKIP_LL_INIT;
 
        return 0;
cmd/x86/cbsysinfo.c +0 -0
index 34fdaf5b1b1..07570b00c9a 100644

cmd/x86/cbsysinfo.c static void show_table(struct sysinfo_t *info, bool verbose) · line 369

Quoted 7 lines
cmd/x86/cbsysinfo.c +1 -0
@@ -363,6 +363,7 @@ static void show_table(struct sysinfo_t *info, bool verbose)
        print_hex("MTC size", info->mtc_size);
 
        print_ptr("Chrome OS VPD", info->chromeos_vpd);
+       print_ptr("RSDP", info->rsdp);
 }
 
 static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc,

I tested this patch on top of coreboot with U-Boot as a payload running on QEMU i440fx, but U-Boot does not list acpi tables.

=> acpi list
No ACPI tables present

Regards,
Bin

#14 lore raw

Re: [PATCH 05/13] x86: coreboot: Collect the address of the ACPI tables

Hi Bin,

Quoted 105 lines · Bin Meng

Hi Simon,

Quoted 39 lines · Simon Glass

Pick this up from the sysinfo tables and display it with the cbsysinfo command. This allows the 'acpi list' command to work when booting from coreboot.

---

 arch/x86/include/asm/cb_sysinfo.h      |  2 ++
 arch/x86/include/asm/coreboot_tables.h |  2 ++
 arch/x86/lib/coreboot/cb_sysinfo.c     | 11 +++++++++++
 cmd/x86/cbsysinfo.c                    |  1 +
 4 files changed, 16 insertions(+)
arch/x86/include/asm/cb_sysinfo.h +2 -0
index 0201ac6b03a..6b266149cf6 100644
@@ -133,6 +133,7 @@
  * @mtc_size: Size of MTC region
  * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning
  *     not used
+ * @rsdp: Pointer to ACPI RSDP table
  */
 struct sysinfo_t {
        unsigned int cpu_khz;
@@ -211,6 +212,7 @@ struct sysinfo_t {
        u64 mtc_start;
        u32 mtc_size;
        void    *chromeos_vpd;
+       void *rsdp;
 };
 
 extern struct sysinfo_t lib_sysinfo;
arch/x86/include/asm/coreboot_tables.h +0 -0
index f131de56a40..2d6f3db3a5f 100644

arch/x86/include/asm/coreboot_tables.h struct cb_tsc_info { · line 425

Quoted 4 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
@@ -422,6 +422,8 @@ struct cb_tsc_info {
 #define CB_TAG_SERIALNO                        0x002a
 #define CB_MAX_SERIALNO_LENGTH         32
 
+#define CB_TAG_ACPI_RSDP                0x0043

This is using space but should be tab.

Quoted 33 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
+
 #define CB_TAG_CMOS_OPTION_TABLE       0x00c8
 
 struct cb_cmos_option_table {
arch/x86/lib/coreboot/cb_sysinfo.c +10 -0
index 748fa4ee53b..a11a2587f66 100644
@@ -264,6 +264,13 @@ static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info)
        info->mrc_cache = map_sysmem(cbmem->cbmem_tab, 0);
 }
 
+static void cb_parse_acpi_rsdp(void *ptr, struct sysinfo_t *info)
+{
+       struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr;
+
+       info->rsdp = map_sysmem(cbmem->cbmem_tab, 0);
+}
+
 __weak void cb_parse_unhandled(u32 tag, unsigned char *ptr)
 {
 }
@@ -428,6 +435,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
                case CB_TAG_MRC_CACHE:
                        cb_parse_mrc_cache(rec, info);
                        break;
+               case CB_TAG_ACPI_RSDP:
+                       cb_parse_acpi_rsdp(rec, info);
+                       break;
                default:
                        cb_parse_unhandled(rec->tag, ptr);
                        break;

arch/x86/lib/coreboot/cb_sysinfo.c int get_coreboot_info(struct sysinfo_t *info) · line 470

Quoted 7 lines
arch/x86/lib/coreboot/cb_sysinfo.c +1 -0
@@ -454,6 +464,7 @@ int get_coreboot_info(struct sysinfo_t *info)
        if (!ret)
                return -ENOENT;
        gd->arch.coreboot_table = addr;
+       gd_set_acpi_start(map_to_sysmem(info->rsdp));
        gd->flags |= GD_FLG_SKIP_LL_INIT;
 
        return 0;

Regards,
Bin

Quoted 11 lines
cmd/x86/cbsysinfo.c +1 -0
index 34fdaf5b1b1..07570b00c9a 100644
@@ -363,6 +363,7 @@ static void show_table(struct sysinfo_t *info, bool verbose)
        print_hex("MTC size", info->mtc_size);
 
        print_ptr("Chrome OS VPD", info->chromeos_vpd);
+       print_ptr("RSDP", info->rsdp);
 }
 
Quoted 7 lines

cmd/x86/cbsysinfo.c static void show_table(struct sysinfo_t *info, bool verbose) · line 369

Quoted 1 line
cmd/x86/cbsysinfo.c +0 -0
 static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc,

I tested this patch on top of coreboot with U-Boot as a payload running on QEMU i440fx, but U-Boot does not list acpi tables.

=> acpi list
No ACPI tables present

Can you try 'cbsysinfo' to see what it is passing in as the RSDP?

Regards,
Simon

#15 lore raw

Re: [PATCH 05/13] x86: coreboot: Collect the address of the ACPI tables

Hi Simon,

Quoted 114 lines · Simon Glass

Hi Bin,

Quoted 110 lines · Bin Meng

Hi Simon,

Quoted 39 lines · Simon Glass

Pick this up from the sysinfo tables and display it with the cbsysinfo command. This allows the 'acpi list' command to work when booting from coreboot.

---

 arch/x86/include/asm/cb_sysinfo.h      |  2 ++
 arch/x86/include/asm/coreboot_tables.h |  2 ++
 arch/x86/lib/coreboot/cb_sysinfo.c     | 11 +++++++++++
 cmd/x86/cbsysinfo.c                    |  1 +
 4 files changed, 16 insertions(+)
arch/x86/include/asm/cb_sysinfo.h +2 -0
index 0201ac6b03a..6b266149cf6 100644
@@ -133,6 +133,7 @@
  * @mtc_size: Size of MTC region
  * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning
  *     not used
+ * @rsdp: Pointer to ACPI RSDP table
  */
 struct sysinfo_t {
        unsigned int cpu_khz;
@@ -211,6 +212,7 @@ struct sysinfo_t {
        u64 mtc_start;
        u32 mtc_size;
        void    *chromeos_vpd;
+       void *rsdp;
 };
 
 extern struct sysinfo_t lib_sysinfo;
arch/x86/include/asm/coreboot_tables.h +0 -0
index f131de56a40..2d6f3db3a5f 100644

arch/x86/include/asm/coreboot_tables.h struct cb_tsc_info { · line 425

Quoted 4 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
@@ -422,6 +422,8 @@ struct cb_tsc_info {
 #define CB_TAG_SERIALNO                        0x002a
 #define CB_MAX_SERIALNO_LENGTH         32
 
+#define CB_TAG_ACPI_RSDP                0x0043

This is using space but should be tab.

Quoted 33 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
+
 #define CB_TAG_CMOS_OPTION_TABLE       0x00c8
 
 struct cb_cmos_option_table {
arch/x86/lib/coreboot/cb_sysinfo.c +10 -0
index 748fa4ee53b..a11a2587f66 100644
@@ -264,6 +264,13 @@ static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info)
        info->mrc_cache = map_sysmem(cbmem->cbmem_tab, 0);
 }
 
+static void cb_parse_acpi_rsdp(void *ptr, struct sysinfo_t *info)
+{
+       struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr;
+
+       info->rsdp = map_sysmem(cbmem->cbmem_tab, 0);
+}
+
 __weak void cb_parse_unhandled(u32 tag, unsigned char *ptr)
 {
 }
@@ -428,6 +435,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
                case CB_TAG_MRC_CACHE:
                        cb_parse_mrc_cache(rec, info);
                        break;
+               case CB_TAG_ACPI_RSDP:
+                       cb_parse_acpi_rsdp(rec, info);
+                       break;
                default:
                        cb_parse_unhandled(rec->tag, ptr);
                        break;

arch/x86/lib/coreboot/cb_sysinfo.c int get_coreboot_info(struct sysinfo_t *info) · line 470

Quoted 7 lines
arch/x86/lib/coreboot/cb_sysinfo.c +1 -0
@@ -454,6 +464,7 @@ int get_coreboot_info(struct sysinfo_t *info)
        if (!ret)
                return -ENOENT;
        gd->arch.coreboot_table = addr;
+       gd_set_acpi_start(map_to_sysmem(info->rsdp));
        gd->flags |= GD_FLG_SKIP_LL_INIT;
 
        return 0;

Regards,
Bin

cmd/x86/cbsysinfo.c static void show_table(struct sysinfo_t *info, bool verbose) · line 369

Quoted 12 lines
cmd/x86/cbsysinfo.c +1 -0
index 34fdaf5b1b1..07570b00c9a 100644
@@ -363,6 +363,7 @@ static void show_table(struct sysinfo_t *info, bool verbose)
        print_hex("MTC size", info->mtc_size);
 
        print_ptr("Chrome OS VPD", info->chromeos_vpd);
+       print_ptr("RSDP", info->rsdp);
 }
 
 static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc,

I tested this patch on top of coreboot with U-Boot as a payload running on QEMU i440fx, but U-Boot does not list acpi tables.

Quoted 5 lines
Quoted 2 lines

=> acpi list
No ACPI tables present

Can you try 'cbsysinfo' to see what it is passing in as the RSDP?

'cbsysinfo' shows RSDP is 0.

=> cbsysinfo
Coreboot table at 500, decoded to 06f558a0, forwarded to 07f99000
...
RSDP : 00000000
Unimpl. : 10 37 40
=> acpi list
No ACPI tables present

coreboot boot log says:

[DEBUG] Writing coreboot table at 0x07f99000

[DEBUG]   0. 0000000000000000-0000000000000fff: CONFIGURATION TABLES
[DEBUG]   1. 0000000000001000-000000000009ffff: RAM
[DEBUG]   2. 00000000000a0000-00000000000fffff: RESERVED
[DEBUG]   3. 0000000000100000-0000000007f6bfff: RAM
[DEBUG]   4. 0000000007f6c000-0000000007fa1fff: CONFIGURATION TABLES
[DEBUG]   5. 0000000007fa2000-0000000007fcffff: RAMSTAGE
[DEBUG]   6. 0000000007fd0000-0000000007ffffff: CONFIGURATION TABLES
[DEBUG]   7. 00000000fec00000-00000000fec00fff: RESERVED
[DEBUG]   8. 00000000ff800000-00000000ffffffff: RESERVED
[DEBUG]  FMAP: area COREBOOT found @ 200 (4193792 bytes)
[DEBUG]  Wrote coreboot table at: 0x07f99000, 0x2e8 bytes, checksum cb3f
[DEBUG]  coreboot table: 768 bytes.
[DEBUG]  IMD ROOT    0. 0x07fff000 0x00001000
[DEBUG]  IMD SMALL   1. 0x07ffe000 0x00001000
[DEBUG]  CONSOLE     2. 0x07fde000 0x00020000
[DEBUG]  TIME STAMP  3. 0x07fdd000 0x00000910
[DEBUG]  AFTER CAR   4. 0x07fd0000 0x0000d000
[DEBUG]  RAMSTAGE    5. 0x07fa1000 0x0002f000
[DEBUG]  COREBOOT    6. 0x07f99000 0x00008000
[DEBUG]  IRQ TABLE   7. 0x07f98000 0x00001000
[DEBUG]  ACPI        8. 0x07f74000 0x00024000
[DEBUG]  SMBIOS      9. 0x07f6c000 0x00008000

Regards,
Bin

#16 lore raw

Re: [PATCH 05/13] x86: coreboot: Collect the address of the ACPI tables

Hi Bin,

Quoted 151 lines · Bin Meng

Hi Simon,

Quoted 114 lines · Simon Glass

Hi Bin,

Quoted 110 lines · Bin Meng

Hi Simon,

Quoted 39 lines · Simon Glass

Pick this up from the sysinfo tables and display it with the cbsysinfo command. This allows the 'acpi list' command to work when booting from coreboot.

---

 arch/x86/include/asm/cb_sysinfo.h      |  2 ++
 arch/x86/include/asm/coreboot_tables.h |  2 ++
 arch/x86/lib/coreboot/cb_sysinfo.c     | 11 +++++++++++
 cmd/x86/cbsysinfo.c                    |  1 +
 4 files changed, 16 insertions(+)
arch/x86/include/asm/cb_sysinfo.h +2 -0
index 0201ac6b03a..6b266149cf6 100644
@@ -133,6 +133,7 @@
  * @mtc_size: Size of MTC region
  * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning
  *     not used
+ * @rsdp: Pointer to ACPI RSDP table
  */
 struct sysinfo_t {
        unsigned int cpu_khz;
@@ -211,6 +212,7 @@ struct sysinfo_t {
        u64 mtc_start;
        u32 mtc_size;
        void    *chromeos_vpd;
+       void *rsdp;
 };
 
 extern struct sysinfo_t lib_sysinfo;
arch/x86/include/asm/coreboot_tables.h +0 -0
index f131de56a40..2d6f3db3a5f 100644

arch/x86/include/asm/coreboot_tables.h struct cb_tsc_info { · line 425

Quoted 4 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
@@ -422,6 +422,8 @@ struct cb_tsc_info {
 #define CB_TAG_SERIALNO                        0x002a
 #define CB_MAX_SERIALNO_LENGTH         32
 
+#define CB_TAG_ACPI_RSDP                0x0043

This is using space but should be tab.

Quoted 33 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
+
 #define CB_TAG_CMOS_OPTION_TABLE       0x00c8
 
 struct cb_cmos_option_table {
arch/x86/lib/coreboot/cb_sysinfo.c +10 -0
index 748fa4ee53b..a11a2587f66 100644
@@ -264,6 +264,13 @@ static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info)
        info->mrc_cache = map_sysmem(cbmem->cbmem_tab, 0);
 }
 
+static void cb_parse_acpi_rsdp(void *ptr, struct sysinfo_t *info)
+{
+       struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr;
+
+       info->rsdp = map_sysmem(cbmem->cbmem_tab, 0);
+}
+
 __weak void cb_parse_unhandled(u32 tag, unsigned char *ptr)
 {
 }
@@ -428,6 +435,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
                case CB_TAG_MRC_CACHE:
                        cb_parse_mrc_cache(rec, info);
                        break;
+               case CB_TAG_ACPI_RSDP:
+                       cb_parse_acpi_rsdp(rec, info);
+                       break;
                default:
                        cb_parse_unhandled(rec->tag, ptr);
                        break;

arch/x86/lib/coreboot/cb_sysinfo.c int get_coreboot_info(struct sysinfo_t *info) · line 470

Quoted 7 lines
arch/x86/lib/coreboot/cb_sysinfo.c +1 -0
@@ -454,6 +464,7 @@ int get_coreboot_info(struct sysinfo_t *info)
        if (!ret)
                return -ENOENT;
        gd->arch.coreboot_table = addr;
+       gd_set_acpi_start(map_to_sysmem(info->rsdp));
        gd->flags |= GD_FLG_SKIP_LL_INIT;
 
        return 0;

Regards,
Bin

cmd/x86/cbsysinfo.c static void show_table(struct sysinfo_t *info, bool verbose) · line 369

Quoted 12 lines
cmd/x86/cbsysinfo.c +1 -0
index 34fdaf5b1b1..07570b00c9a 100644
@@ -363,6 +363,7 @@ static void show_table(struct sysinfo_t *info, bool verbose)
        print_hex("MTC size", info->mtc_size);
 
        print_ptr("Chrome OS VPD", info->chromeos_vpd);
+       print_ptr("RSDP", info->rsdp);
 }
 
 static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc,

I tested this patch on top of coreboot with U-Boot as a payload running on QEMU i440fx, but U-Boot does not list acpi tables.

Quoted 5 lines
Quoted 2 lines

=> acpi list
No ACPI tables present

Can you try 'cbsysinfo' to see what it is passing in as the RSDP?

'cbsysinfo' shows RSDP is 0.

=> cbsysinfo
Coreboot table at 500, decoded to 06f558a0, forwarded to 07f99000
...
RSDP : 00000000
Unimpl. : 10 37 40
=> acpi list
No ACPI tables present

coreboot boot log says:

[DEBUG] Writing coreboot table at 0x07f99000

[DEBUG]   0. 0000000000000000-0000000000000fff: CONFIGURATION TABLES
[DEBUG]   1. 0000000000001000-000000000009ffff: RAM
[DEBUG]   2. 00000000000a0000-00000000000fffff: RESERVED
[DEBUG]   3. 0000000000100000-0000000007f6bfff: RAM
[DEBUG]   4. 0000000007f6c000-0000000007fa1fff: CONFIGURATION TABLES
[DEBUG]   5. 0000000007fa2000-0000000007fcffff: RAMSTAGE
[DEBUG]   6. 0000000007fd0000-0000000007ffffff: CONFIGURATION TABLES
[DEBUG]   7. 00000000fec00000-00000000fec00fff: RESERVED
[DEBUG]   8. 00000000ff800000-00000000ffffffff: RESERVED
[DEBUG]  FMAP: area COREBOOT found @ 200 (4193792 bytes)
[DEBUG]  Wrote coreboot table at: 0x07f99000, 0x2e8 bytes, checksum cb3f
[DEBUG]  coreboot table: 768 bytes.
[DEBUG]  IMD ROOT    0. 0x07fff000 0x00001000
[DEBUG]  IMD SMALL   1. 0x07ffe000 0x00001000
Quoted 8 lines
[DEBUG]  CONSOLE     2. 0x07fde000 0x00020000
[DEBUG]  TIME STAMP  3. 0x07fdd000 0x00000910
[DEBUG]  AFTER CAR   4. 0x07fd0000 0x0000d000
[DEBUG]  RAMSTAGE    5. 0x07fa1000 0x0002f000
[DEBUG]  COREBOOT    6. 0x07f99000 0x00008000
[DEBUG]  IRQ TABLE   7. 0x07f98000 0x00001000
[DEBUG]  ACPI        8. 0x07f74000 0x00024000
[DEBUG]  SMBIOS      9. 0x07f6c000 0x00008000

Can you check why coreboot is not passing it through? It should provide the RSDP in LB_TAG_ACPI_RSDP

Regards,
Simon

#17 lore raw

Re: [PATCH 05/13] x86: coreboot: Collect the address of the ACPI tables

Hi Simon,

Quoted 164 lines · Simon Glass

Hi Bin,

Quoted 151 lines · Bin Meng

Hi Simon,

Quoted 114 lines · Simon Glass

Hi Bin,

Quoted 110 lines · Bin Meng

Hi Simon,

Quoted 39 lines · Simon Glass

Pick this up from the sysinfo tables and display it with the cbsysinfo command. This allows the 'acpi list' command to work when booting from coreboot.

---

 arch/x86/include/asm/cb_sysinfo.h      |  2 ++
 arch/x86/include/asm/coreboot_tables.h |  2 ++
 arch/x86/lib/coreboot/cb_sysinfo.c     | 11 +++++++++++
 cmd/x86/cbsysinfo.c                    |  1 +
 4 files changed, 16 insertions(+)
arch/x86/include/asm/cb_sysinfo.h +2 -0
index 0201ac6b03a..6b266149cf6 100644
@@ -133,6 +133,7 @@
  * @mtc_size: Size of MTC region
  * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning
  *     not used
+ * @rsdp: Pointer to ACPI RSDP table
  */
 struct sysinfo_t {
        unsigned int cpu_khz;
@@ -211,6 +212,7 @@ struct sysinfo_t {
        u64 mtc_start;
        u32 mtc_size;
        void    *chromeos_vpd;
+       void *rsdp;
 };
 
 extern struct sysinfo_t lib_sysinfo;
arch/x86/include/asm/coreboot_tables.h +0 -0
index f131de56a40..2d6f3db3a5f 100644

arch/x86/include/asm/coreboot_tables.h struct cb_tsc_info { · line 425

Quoted 4 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
@@ -422,6 +422,8 @@ struct cb_tsc_info {
 #define CB_TAG_SERIALNO                        0x002a
 #define CB_MAX_SERIALNO_LENGTH         32
 
+#define CB_TAG_ACPI_RSDP                0x0043

This is using space but should be tab.

Quoted 33 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
+
 #define CB_TAG_CMOS_OPTION_TABLE       0x00c8
 
 struct cb_cmos_option_table {
arch/x86/lib/coreboot/cb_sysinfo.c +10 -0
index 748fa4ee53b..a11a2587f66 100644
@@ -264,6 +264,13 @@ static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info)
        info->mrc_cache = map_sysmem(cbmem->cbmem_tab, 0);
 }
 
+static void cb_parse_acpi_rsdp(void *ptr, struct sysinfo_t *info)
+{
+       struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr;
+
+       info->rsdp = map_sysmem(cbmem->cbmem_tab, 0);
+}
+
 __weak void cb_parse_unhandled(u32 tag, unsigned char *ptr)
 {
 }
@@ -428,6 +435,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
                case CB_TAG_MRC_CACHE:
                        cb_parse_mrc_cache(rec, info);
                        break;
+               case CB_TAG_ACPI_RSDP:
+                       cb_parse_acpi_rsdp(rec, info);
+                       break;
                default:
                        cb_parse_unhandled(rec->tag, ptr);
                        break;

arch/x86/lib/coreboot/cb_sysinfo.c int get_coreboot_info(struct sysinfo_t *info) · line 470

Quoted 7 lines
arch/x86/lib/coreboot/cb_sysinfo.c +1 -0
@@ -454,6 +464,7 @@ int get_coreboot_info(struct sysinfo_t *info)
        if (!ret)
                return -ENOENT;
        gd->arch.coreboot_table = addr;
+       gd_set_acpi_start(map_to_sysmem(info->rsdp));
        gd->flags |= GD_FLG_SKIP_LL_INIT;
 
        return 0;

Regards,
Bin

cmd/x86/cbsysinfo.c static void show_table(struct sysinfo_t *info, bool verbose) · line 369

Quoted 12 lines
cmd/x86/cbsysinfo.c +1 -0
index 34fdaf5b1b1..07570b00c9a 100644
@@ -363,6 +363,7 @@ static void show_table(struct sysinfo_t *info, bool verbose)
        print_hex("MTC size", info->mtc_size);
 
        print_ptr("Chrome OS VPD", info->chromeos_vpd);
+       print_ptr("RSDP", info->rsdp);
 }
 
 static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc,

I tested this patch on top of coreboot with U-Boot as a payload running on QEMU i440fx, but U-Boot does not list acpi tables.

Quoted 5 lines
Quoted 2 lines

=> acpi list
No ACPI tables present

Can you try 'cbsysinfo' to see what it is passing in as the RSDP?

'cbsysinfo' shows RSDP is 0.

=> cbsysinfo
Coreboot table at 500, decoded to 06f558a0, forwarded to 07f99000
...
RSDP : 00000000
Unimpl. : 10 37 40
=> acpi list
No ACPI tables present

coreboot boot log says:

[DEBUG] Writing coreboot table at 0x07f99000

[DEBUG]   0. 0000000000000000-0000000000000fff: CONFIGURATION TABLES
[DEBUG]   1. 0000000000001000-000000000009ffff: RAM
[DEBUG]   2. 00000000000a0000-00000000000fffff: RESERVED
[DEBUG]   3. 0000000000100000-0000000007f6bfff: RAM
[DEBUG]   4. 0000000007f6c000-0000000007fa1fff: CONFIGURATION TABLES
[DEBUG]   5. 0000000007fa2000-0000000007fcffff: RAMSTAGE
[DEBUG]   6. 0000000007fd0000-0000000007ffffff: CONFIGURATION TABLES
[DEBUG]   7. 00000000fec00000-00000000fec00fff: RESERVED
[DEBUG]   8. 00000000ff800000-00000000ffffffff: RESERVED
[DEBUG]  FMAP: area COREBOOT found @ 200 (4193792 bytes)
[DEBUG]  Wrote coreboot table at: 0x07f99000, 0x2e8 bytes, checksum cb3f
[DEBUG]  coreboot table: 768 bytes.
[DEBUG]  IMD ROOT    0. 0x07fff000 0x00001000
[DEBUG]  IMD SMALL   1. 0x07ffe000 0x00001000
Quoted 8 lines
[DEBUG]  CONSOLE     2. 0x07fde000 0x00020000
[DEBUG]  TIME STAMP  3. 0x07fdd000 0x00000910
[DEBUG]  AFTER CAR   4. 0x07fd0000 0x0000d000
[DEBUG]  RAMSTAGE    5. 0x07fa1000 0x0002f000
[DEBUG]  COREBOOT    6. 0x07f99000 0x00008000
[DEBUG]  IRQ TABLE   7. 0x07f98000 0x00001000
[DEBUG]  ACPI        8. 0x07f74000 0x00024000
[DEBUG]  SMBIOS      9. 0x07f6c000 0x00008000
Quoted 2 lines

Can you check why coreboot is not passing it through? It should provide the RSDP in LB_TAG_ACPI_RSDP

Yes, I identified a bug in coreboot's write_acpi_tables() for QEMU. Will send a patch to coreboot community then.

Regards,
Bin

#18 lore raw

Re: [PATCH 05/13] x86: coreboot: Collect the address of the ACPI tables

Hi Bin,

Quoted 168 lines · Bin Meng

Hi Simon,

Quoted 164 lines · Simon Glass

Hi Bin,

Quoted 159 lines · Bin Meng

Hi Simon,

Quoted 114 lines · Simon Glass

Hi Bin,

Quoted 110 lines · Bin Meng

Hi Simon,

Quoted 39 lines · Simon Glass

Pick this up from the sysinfo tables and display it with the cbsysinfo command. This allows the 'acpi list' command to work when booting from coreboot.

---

 arch/x86/include/asm/cb_sysinfo.h      |  2 ++
 arch/x86/include/asm/coreboot_tables.h |  2 ++
 arch/x86/lib/coreboot/cb_sysinfo.c     | 11 +++++++++++
 cmd/x86/cbsysinfo.c                    |  1 +
 4 files changed, 16 insertions(+)
arch/x86/include/asm/cb_sysinfo.h +2 -0
index 0201ac6b03a..6b266149cf6 100644
@@ -133,6 +133,7 @@
  * @mtc_size: Size of MTC region
  * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning
  *     not used
+ * @rsdp: Pointer to ACPI RSDP table
  */
 struct sysinfo_t {
        unsigned int cpu_khz;
@@ -211,6 +212,7 @@ struct sysinfo_t {
        u64 mtc_start;
        u32 mtc_size;
        void    *chromeos_vpd;
+       void *rsdp;
 };
 
 extern struct sysinfo_t lib_sysinfo;
arch/x86/include/asm/coreboot_tables.h +0 -0
index f131de56a40..2d6f3db3a5f 100644

arch/x86/include/asm/coreboot_tables.h struct cb_tsc_info { · line 425

Quoted 4 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
@@ -422,6 +422,8 @@ struct cb_tsc_info {
 #define CB_TAG_SERIALNO                        0x002a
 #define CB_MAX_SERIALNO_LENGTH         32
 
+#define CB_TAG_ACPI_RSDP                0x0043

This is using space but should be tab.

Quoted 33 lines
arch/x86/include/asm/coreboot_tables.h +1 -0
+
 #define CB_TAG_CMOS_OPTION_TABLE       0x00c8
 
 struct cb_cmos_option_table {
arch/x86/lib/coreboot/cb_sysinfo.c +10 -0
index 748fa4ee53b..a11a2587f66 100644
@@ -264,6 +264,13 @@ static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info)
        info->mrc_cache = map_sysmem(cbmem->cbmem_tab, 0);
 }
 
+static void cb_parse_acpi_rsdp(void *ptr, struct sysinfo_t *info)
+{
+       struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr;
+
+       info->rsdp = map_sysmem(cbmem->cbmem_tab, 0);
+}
+
 __weak void cb_parse_unhandled(u32 tag, unsigned char *ptr)
 {
 }
@@ -428,6 +435,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
                case CB_TAG_MRC_CACHE:
                        cb_parse_mrc_cache(rec, info);
                        break;
+               case CB_TAG_ACPI_RSDP:
+                       cb_parse_acpi_rsdp(rec, info);
+                       break;
                default:
                        cb_parse_unhandled(rec->tag, ptr);
                        break;

arch/x86/lib/coreboot/cb_sysinfo.c int get_coreboot_info(struct sysinfo_t *info) · line 470

Quoted 7 lines
arch/x86/lib/coreboot/cb_sysinfo.c +1 -0
@@ -454,6 +464,7 @@ int get_coreboot_info(struct sysinfo_t *info)
        if (!ret)
                return -ENOENT;
        gd->arch.coreboot_table = addr;
+       gd_set_acpi_start(map_to_sysmem(info->rsdp));
        gd->flags |= GD_FLG_SKIP_LL_INIT;
 
        return 0;

Regards,
Bin

cmd/x86/cbsysinfo.c static void show_table(struct sysinfo_t *info, bool verbose) · line 369

Quoted 12 lines
cmd/x86/cbsysinfo.c +1 -0
index 34fdaf5b1b1..07570b00c9a 100644
@@ -363,6 +363,7 @@ static void show_table(struct sysinfo_t *info, bool verbose)
        print_hex("MTC size", info->mtc_size);
 
        print_ptr("Chrome OS VPD", info->chromeos_vpd);
+       print_ptr("RSDP", info->rsdp);
 }
 
 static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc,

I tested this patch on top of coreboot with U-Boot as a payload running on QEMU i440fx, but U-Boot does not list acpi tables.

Quoted 5 lines
Quoted 2 lines

=> acpi list
No ACPI tables present

Can you try 'cbsysinfo' to see what it is passing in as the RSDP?

'cbsysinfo' shows RSDP is 0.

=> cbsysinfo
Coreboot table at 500, decoded to 06f558a0, forwarded to 07f99000
...
RSDP : 00000000
Unimpl. : 10 37 40
=> acpi list
No ACPI tables present

coreboot boot log says:

[DEBUG] Writing coreboot table at 0x07f99000

[DEBUG]   0. 0000000000000000-0000000000000fff: CONFIGURATION TABLES
[DEBUG]   1. 0000000000001000-000000000009ffff: RAM
[DEBUG]   2. 00000000000a0000-00000000000fffff: RESERVED
[DEBUG]   3. 0000000000100000-0000000007f6bfff: RAM
[DEBUG]   4. 0000000007f6c000-0000000007fa1fff: CONFIGURATION TABLES
[DEBUG]   5. 0000000007fa2000-0000000007fcffff: RAMSTAGE
[DEBUG]   6. 0000000007fd0000-0000000007ffffff: CONFIGURATION TABLES
[DEBUG]   7. 00000000fec00000-00000000fec00fff: RESERVED
[DEBUG]   8. 00000000ff800000-00000000ffffffff: RESERVED
[DEBUG]  FMAP: area COREBOOT found @ 200 (4193792 bytes)
[DEBUG]  Wrote coreboot table at: 0x07f99000, 0x2e8 bytes, checksum cb3f
[DEBUG]  coreboot table: 768 bytes.
[DEBUG]  IMD ROOT    0. 0x07fff000 0x00001000
[DEBUG]  IMD SMALL   1. 0x07ffe000 0x00001000
[DEBUG]  CONSOLE     2. 0x07fde000 0x00020000
[DEBUG]  TIME STAMP  3. 0x07fdd000 0x00000910
[DEBUG]  AFTER CAR   4. 0x07fd0000 0x0000d000
[DEBUG]  RAMSTAGE    5. 0x07fa1000 0x0002f000
[DEBUG]  COREBOOT    6. 0x07f99000 0x00008000
[DEBUG]  IRQ TABLE   7. 0x07f98000 0x00001000
[DEBUG]  ACPI        8. 0x07f74000 0x00024000
[DEBUG]  SMBIOS      9. 0x07f6c000 0x00008000
Quoted 5 lines
Quoted 2 lines

Can you check why coreboot is not passing it through? It should provide the RSDP in LB_TAG_ACPI_RSDP

Yes, I identified a bug in coreboot's write_acpi_tables() for QEMU. Will send a patch to coreboot community then.

OK, great, thanks. QEMU is quite different from real boards in how it handles the tables.

Regards,
SImon

#19 lore raw

PATCH 6/13 x86: Allow locating UARTs by device ID

In reply to Simon Glass

When coreboot does not pass a UART in its sysinfo struct, there is no easy way to find it out. Add a way to specify known UARTs so we can find them without needing help from coreboot.

Since coreboot does not actually init the serial device when serial is disabled, it is not possible to make it add this information to the sysinfo table.

Also, we cannot use the class information, since we don't know which UART is being used. For example, with Alder Lake there are two:

00.16.00   0x8086     0x51e0     Simple comm. controller 0x80
00.1e.00   0x8086     0x51a8     Simple comm. controller 0x80

In our case the second one is the right one, but thre is no way to distinguish it from the first one without using the device ID.

If we have Adler Lake hardware which uses a different UART, we could perhaps look at the ACPI tables, or the machine information passed in the SMBIOS tables.

This was discussed previously before: [1]

[1] https://patchwork.ozlabs.org/project/uboot/patch/
20210407163159.3.I967ea8c85e009f870c7aa944372d32c990f1b14a@changeid/

---

 arch/x86/dts/coreboot.dts        |  4 ++
 drivers/serial/serial_coreboot.c | 69 ++++++++++++++++++++++++++++----
 include/pci_ids.h                |  3 ++
 3 files changed, 68 insertions(+), 8 deletions(-)
arch/x86/dts/coreboot.dts +4 -0
index d21978d6e09..3cd23b797ab 100644
@@ -14,6 +14,8 @@
 /include/ "rtc.dtsi"
 
 #include "tsc_timer.dtsi"
+#include <dt-bindings/pci/pci.h>
+#include <pci_ids.h>
 
 / {
 	model = "coreboot x86 payload";
@@ -34,6 +36,8 @@
 	pci {
 		compatible = "pci-x86";
 		u-boot,dm-pre-reloc;
+		u-boot,pci-pre-reloc = <
+			PCI_VENDEV(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ADP_P_UART0) >;
 	};
 
 	serial: serial {
drivers/serial/serial_coreboot.c +61 -8

80 lines not on this page · raw message

include/pci_ids.h +3 -0
index 88b0a640458..5ae1b9b7fb6 100644
@@ -2992,6 +2992,9 @@
 #define PCI_DEVICE_ID_INTEL_UNC_R3QPI1	0x3c45
 #define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX	0x3ce0
 #define PCI_DEVICE_ID_INTEL_IOAT_SNB	0x402f
+#define PCI_DEVICE_ID_INTEL_ADP_P_UART0	0x51a8
+#define PCI_DEVICE_ID_INTEL_ADP_P_UART1	0x51a9
+#define PCI_DEVICE_ID_INTEL_APL_UART2	0x5ac0
 #define PCI_DEVICE_ID_INTEL_5100_16	0x65f0
 #define PCI_DEVICE_ID_INTEL_5100_19	0x65f3
 #define PCI_DEVICE_ID_INTEL_5100_21	0x65f5
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#20 lore raw

Re: [PATCH 06/13] x86: Allow locating UARTs by device ID

+Andy

Hi Simon,

Quoted 27 lines · Simon Glass

When coreboot does not pass a UART in its sysinfo struct, there is no easy way to find it out. Add a way to specify known UARTs so we can find them without needing help from coreboot.

Since coreboot does not actually init the serial device when serial is disabled, it is not possible to make it add this information to the sysinfo table.

Also, we cannot use the class information, since we don't know which UART is being used. For example, with Alder Lake there are two:

00.16.00   0x8086     0x51e0     Simple comm. controller 0x80
00.1e.00   0x8086     0x51a8     Simple comm. controller 0x80

In our case the second one is the right one, but thre is no way to distinguish it from the first one without using the device ID.

If we have Adler Lake hardware which uses a different UART, we could perhaps look at the ACPI tables, or the machine information passed in the SMBIOS tables.

This was discussed previously before: [1]

[1] https://patchwork.ozlabs.org/project/uboot/patch/
20210407163159.3.I967ea8c85e009f870c7aa944372d32c990f1b14a@changeid/

Quoted 8 lines

---

 arch/x86/dts/coreboot.dts        |  4 ++
 drivers/serial/serial_coreboot.c | 69 ++++++++++++++++++++++++++++----
 include/pci_ids.h                |  3 ++
 3 files changed, 68 insertions(+), 8 deletions(-)

Last time we discussed this, both Andy and I thought this was a hack. I cited Andy's point below:

"What coreboot should do is either provide serial information or SPCR ACPI table. Otherwise if it does not provide it, I think it's on purpose, and we have to respect this."

So maybe somehow we should parse the SPCR ACPI table instead?

Regards,
Bin

#21 lore raw

Re: [PATCH 06/13] x86: Allow locating UARTs by device ID

Hi Bin,

Quoted 42 lines · Bin Meng

+Andy

Hi Simon,

Quoted 27 lines · Simon Glass

When coreboot does not pass a UART in its sysinfo struct, there is no easy way to find it out. Add a way to specify known UARTs so we can find them without needing help from coreboot.

Since coreboot does not actually init the serial device when serial is disabled, it is not possible to make it add this information to the sysinfo table.

Also, we cannot use the class information, since we don't know which UART is being used. For example, with Alder Lake there are two:

00.16.00   0x8086     0x51e0     Simple comm. controller 0x80
00.1e.00   0x8086     0x51a8     Simple comm. controller 0x80

In our case the second one is the right one, but thre is no way to distinguish it from the first one without using the device ID.

If we have Adler Lake hardware which uses a different UART, we could perhaps look at the ACPI tables, or the machine information passed in the SMBIOS tables.

This was discussed previously before: [1]

[1] https://patchwork.ozlabs.org/project/uboot/patch/
20210407163159.3.I967ea8c85e009f870c7aa944372d32c990f1b14a@changeid/

Quoted 8 lines

---

 arch/x86/dts/coreboot.dts        |  4 ++
 drivers/serial/serial_coreboot.c | 69 ++++++++++++++++++++++++++++----
 include/pci_ids.h                |  3 ++
 3 files changed, 68 insertions(+), 8 deletions(-)
Quoted 6 lines

Last time we discussed this, both Andy and I thought this was a hack. I cited Andy's point below:

"What coreboot should do is either provide serial information or SPCR ACPI table. Otherwise if it does not provide it, I think it's on purpose, and we have to respect this."

We cannot change what coreboot does. I have written up a design for it but it seems unlikely that anything will happen there in the short term, perhaps ever. I will keep pushing.

In the meantime U-Boot cannot be used as a coreboot payload in this (common) situation. So we do need a solution.

Quoted 2 lines

So maybe somehow we should parse the SPCR ACPI table instead?

I don't see that table present, but there is DBG2 so I will take a look.

Regards,
Simon

#22 lore raw

PATCH 7/13 pci: coreboot: Don't read regions when booting

In reply to Simon Glass

When U-Boot is the second-stage bootloader, PCI is already set up. We cannot read the regions from the device tree. There is no point anyway, since PCI devices have already been allocated according to the regions and it is not safe for U-Boot to make any changes.

---

 drivers/pci/pci-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/pci/pci-uclass.c +4 -0
index 9343cfc62a9..8d27e40338c 100644
@@ -973,6 +973,10 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 	int len;
 	int i;
 
+	/* handle booting from coreboot, etc. */
+	if (!ll_boot_init())
+		return 0;
+
 	prop = ofnode_get_property(node, "ranges", &len);
 	if (!prop) {
 		debug("%s: Cannot decode regions\n", __func__);
Signature · 1 line
2.39.2.637.g21b0678d19-goog
Reviewed-by on v1 7/13
#23 lore raw

Re: [PATCH 07/13] pci: coreboot: Don't read regions when booting

Quoted 6 lines · Simon Glass

When U-Boot is the second-stage bootloader, PCI is already set up. We cannot read the regions from the device tree. There is no point anyway, since PCI devices have already been allocated according to the regions and it is not safe for U-Boot to make any changes.

Quoted 6 lines

---

 drivers/pci/pci-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)
#24 lore raw

Re: [PATCH 07/13] pci: coreboot: Don't read regions when booting

Quoted 5 lines
Quoted 5 lines

When U-Boot is the second-stage bootloader, PCI is already set up. We cannot read the regions from the device tree. There is no point anyway, since PCI devices have already been allocated according to the regions and it is not safe for U-Boot to make any changes.

Quoted 7 lines
Quoted 6 lines

---

 drivers/pci/pci-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)
Signature · 5 lines
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy
#25 lore raw

PATCH 8/13 usb: Quieten a debug message

In reply to Simon Glass

This comes up repeatedly on Intel ADL. Use a debug message instead.

---

 drivers/usb/host/xhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +2 -2
index dbeb88afe37..bd7e88b1769 100644
@@ -885,8 +885,8 @@ static int xhci_submit_root(struct usb_device *udev, unsigned long pipe,
 
 	if ((req->requesttype & USB_RT_PORT) &&
 	    le16_to_cpu(req->index) > max_ports) {
-		printf("The request port(%d) exceeds maximum port number\n",
-		       le16_to_cpu(req->index) - 1);
+		log_debug("The request port(%d) exceeds maximum port number\n",
+			  le16_to_cpu(req->index) - 1);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#26 lore raw

Re: [PATCH 08/13] usb: Quieten a debug message

Quoted 4 lines

From: Simon Glass <[email protected]>
Date: Mon, 20 Feb 2023 12:49:22 -0700

This comes up repeatedly on Intel ADL. Use a debug message instead.

commit e330c8b83e87 fixed the (likely) root cause for this error message. Are you still seeing this message with that commit present?

Quoted 25 lines

---

 drivers/usb/host/xhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +2 -2
index dbeb88afe37..bd7e88b1769 100644
@@ -885,8 +885,8 @@ static int xhci_submit_root(struct usb_device *udev, unsigned long pipe,
 
 	if ((req->requesttype & USB_RT_PORT) &&
 	    le16_to_cpu(req->index) > max_ports) {
-		printf("The request port(%d) exceeds maximum port number\n",
-		       le16_to_cpu(req->index) - 1);
+		log_debug("The request port(%d) exceeds maximum port number\n",
+			  le16_to_cpu(req->index) - 1);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#27 lore raw

Re: [PATCH 08/13] usb: Quieten a debug message

Hi Mark,

Quoted 9 lines · Mark Kettenis
Quoted 5 lines

From: Simon Glass <[email protected]>
Date: Mon, 20 Feb 2023 12:49:22 -0700

This comes up repeatedly on Intel ADL. Use a debug message instead.

commit e330c8b83e87 fixed the (likely) root cause for this error message. Are you still seeing this message with that commit present?

Yes it does, thank you! Will drop this patch.

Regards,
Simon

Quoted 25 lines
Quoted 25 lines

---

 drivers/usb/host/xhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +2 -3
index dbeb88afe37..bd7e88b1769 100644
@@ -885,8 +885,8 @@ static int xhci_submit_root(struct usb_device *udev, unsigned long pipe,
 
      if ((req->requesttype & USB_RT_PORT) &&
          le16_to_cpu(req->index) > max_ports) {
-             printf("The request port(%d) exceeds maximum port number\n",
-                    le16_to_cpu(req->index) - 1);
+             log_debug("The request port(%d) exceeds maximum port number\n",
+                       le16_to_cpu(req->index) - 1);
              return -EINVAL;
      }
 
--

2.39.2.637.g21b0678d19-goog

#28 lore raw

PATCH 9/13 x86: coreboot: Use a memory-mapped UART

In reply to Simon Glass

This is much more common on modern hardware, so default to using it.

---

 include/configs/coreboot.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/coreboot.h +2 -0
index f73004386fd..2775f8d76ce 100644
@@ -19,6 +19,8 @@
 					"stdout=serial,vidconsole\0" \
 					"stderr=serial,vidconsole\0"
 
+#undef CONFIG_SYS_NS16550_PORT_MAPPED
+
 /* ATA/IDE support */
 
 #endif	/* __CONFIG_H */
Signature · 1 line
2.39.2.637.g21b0678d19-goog
#29 lore raw

Re: [PATCH 09/13] x86: coreboot: Use a memory-mapped UART

Hi Simon,

Quoted 14 lines · Simon Glass

This is much more common on modern hardware, so default to using it.

---

 include/configs/coreboot.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/coreboot.h +0 -0
index f73004386fd..2775f8d76ce 100644

include/configs/coreboot.h line 22

Quoted 4 lines
include/configs/coreboot.h +1 -0
@@ -19,6 +19,8 @@
                                        "stdout=serial,vidconsole\0" \
                                        "stderr=serial,vidconsole\0"
 
+#undef CONFIG_SYS_NS16550_PORT_MAPPED

This macro is only meaningful for non-DM boards which is not the case for x86.

include/configs/coreboot.h line 26

Quoted 5 lines
include/configs/coreboot.h +1 -0
+
 /* ATA/IDE support */
 
 #endif /* __CONFIG_H */

Regards,
Bin

#30 lore raw

Re: [PATCH 09/13] x86: coreboot: Use a memory-mapped UART

Quoted 21 lines · Bin Meng

Hi Simon,

Quoted 17 lines · Simon Glass

This is much more common on modern hardware, so default to using it.

---

 include/configs/coreboot.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/coreboot.h +0 -0
index f73004386fd..2775f8d76ce 100644
@@ -19,6 +19,8 @@
                                        "stdout=serial,vidconsole\0" \
                                        "stderr=serial,vidconsole\0"
 
Quoted 4 lines

include/configs/coreboot.h line 22

Quoted 1 line
include/configs/coreboot.h +1 -0
+#undef CONFIG_SYS_NS16550_PORT_MAPPED

This macro is only meaningful for non-DM boards which is not the case for x86.

for non-DM boards, or for boards that don't enable CONFIG_NS16550_DYNAMIC

Regards,
Bin

#31 lore raw

PATCH 10/13 x86: coreboot: Document how to enable the debug UART

In reply to Simon Glass

This is not obvious so add a little note about how it works.

---

 doc/board/coreboot/coreboot.rst | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
doc/board/coreboot/coreboot.rst +29 -0
index 4a5f101cad2..0fe95af56d2 100644
@@ -71,3 +71,32 @@ Memory map
               (typically redirects to 7ab10030 or similar)
          500  Location of coreboot sysinfo table, used during startup
   ==========  ==================================================================
+
+
+Debug UART
+----------
+
+It is possible to enable the debug UART with coreboot. To do this, use the
+info from the cbsysinfo command to locate the UART base. For example::
+
+   => cbsysinfo
+   ...
+   Serial I/O port: 00000000
+      base        : 00000000
+      pointer     : 767b51bc
+      type        : 2
+      base        : fe03e000
+      baud        : 0d115200
+      regwidth    : 4
+      input_hz    : 0d1843200
+      PCI addr    : 00000010
+   ...
+
+Here you can see that the UART base is fe03e000, regwidth is 4 (1 << 2) and the
+input clock is 1843200. So you can add the following CONFIG options::
+
+   CONFIG_DEBUG_UART=y
+   CONFIG_DEBUG_UART_BASE=fe03e000
+   CONFIG_DEBUG_UART_CLOCK=1843200
+   CONFIG_DEBUG_UART_SHIFT=2
+   CONFIG_DEBUG_UART_ANNOUNCE=y
Signature · 1 line
2.39.2.637.g21b0678d19-goog
Reviewed-by on v1 10/13
#32 lore raw

Re: [PATCH 10/13] x86: coreboot: Document how to enable the debug UART

Quoted 9 lines · Simon Glass

This is not obvious so add a little note about how it works.

---

 doc/board/coreboot/coreboot.rst | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
#33 lore raw

PATCH 11/13 x86: coreboot: Scan PCI after relocation

In reply to Simon Glass

Enable this so that PCI devices can be used correctly without needing to do a manual scan.

---

 configs/coreboot_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/coreboot_defconfig +1 -0
index d8c5be66ad7..1c5e7fc717d 100644
@@ -18,6 +18,7 @@ CONFIG_PRE_CONSOLE_BUFFER=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_LAST_STAGE_INIT=y
+CONFIG_PCI_INIT_R=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_IDE=y
Signature · 1 line
2.39.2.637.g21b0678d19-goog
Reviewed-by on v1 11/13
#34 lore raw

Re: [PATCH 11/13] x86: coreboot: Scan PCI after relocation

Quoted 10 lines · Simon Glass

Enable this so that PCI devices can be used correctly without needing to do a manual scan.

---

 configs/coreboot_defconfig | 1 +
 1 file changed, 1 insertion(+)
#35 lore raw

PATCH 12/13 x86: coreboot: Log function names and line numbers

In reply to Simon Glass

Turn these options on to make it easier to debug things.

Also enable dhrystone so we can get some measure of performance.

---

 configs/coreboot_defconfig | 4 ++++
 1 file changed, 4 insertions(+)
configs/coreboot_defconfig +4 -0
index 1c5e7fc717d..e6def760ada 100644
@@ -16,6 +16,9 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_PRE_CONSOLE_BUFFER=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_LOG=y
+CONFIG_LOGF_LINE=y
+CONFIG_LOGF_FUNC=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_LAST_STAGE_INIT=y
 CONFIG_PCI_INIT_R=y
@@ -59,5 +62,6 @@ CONFIG_SYS_64BIT_LBA=y
 CONFIG_SOUND=y
 CONFIG_SOUND_I8254=y
 CONFIG_CONSOLE_SCROLL_LINES=5
+CONFIG_CMD_DHRYSTONE=y
 # CONFIG_GZIP is not set
 CONFIG_SMBIOS_PARSER=y
Signature · 1 line
2.39.2.637.g21b0678d19-goog
Reviewed-by on v1 12/13
#36 lore raw

Re: [PATCH 12/13] x86: coreboot: Log function names and line numbers

Quoted 11 lines · Simon Glass

Turn these options on to make it easier to debug things.

Also enable dhrystone so we can get some measure of performance.

---

 configs/coreboot_defconfig | 4 ++++
 1 file changed, 4 insertions(+)
#37 lore raw

PATCH 13/13 x86: coreboot: Show unimplemented sysinfo tags

In reply to Simon Glass

Sometimes coreboot adds new tags that U-Boot does not know about. These are silently ignored, but it is useful to at least know what we are missing.

Add a way to collect this information. For Brya it shows:

Unimpl. 38 41 37 34 42 40

These are:

LB_TAG_PLATFORM_BLOB_VERSION
LB_TAG_ACPI_CNVS
LB_TAG_FMAP
LB_TAG_VBOOT_WORKBUF
LB_TAG_TYPE_C_INFO
LB_TAG_BOARD_CONFIG

---

 arch/x86/include/asm/cb_sysinfo.h  | 6 ++++++
 arch/x86/lib/coreboot/cb_sysinfo.c | 2 ++
 cmd/x86/cbsysinfo.c                | 8 ++++++++
 3 files changed, 16 insertions(+)
arch/x86/include/asm/cb_sysinfo.h +6 -0
index 6b266149cf6..2c78b22d0d2 100644
@@ -16,6 +16,8 @@
 #define SYSINFO_MAX_GPIOS	8
 /* Up to 10 MAC addresses */
 #define SYSINFO_MAX_MACS 10
+/* Track the first 32 unimplemented tags */
+#define SYSINFO_MAX_UNIMPL	32
 
 /**
  * struct sysinfo_t - Information passed to U-Boot from coreboot
@@ -134,6 +136,8 @@
  * @chromeos_vpd: Chromium OS Vital Product Data region, typically NULL, meaning
  *	not used
  * @rsdp: Pointer to ACPI RSDP table
+ * @unimpl_count: Number of entries in unimpl_map[]
+ * @unimpl: List of unimplemented IDs (bottom 8 bits only)
  */
 struct sysinfo_t {
 	unsigned int cpu_khz;
@@ -213,6 +217,8 @@ struct sysinfo_t {
 	u32 mtc_size;
 	void	*chromeos_vpd;
 	void *rsdp;
+	u32 unimpl_count;
+	u8 unimpl[SYSINFO_MAX_UNIMPL];
 };
 
 extern struct sysinfo_t lib_sysinfo;
arch/x86/lib/coreboot/cb_sysinfo.c +2 -0
index a11a2587f66..42cc3a128d9 100644
@@ -439,6 +439,8 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
 			cb_parse_acpi_rsdp(rec, info);
 			break;
 		default:
+			if (info->unimpl_count < SYSINFO_MAX_UNIMPL)
+				info->unimpl[info->unimpl_count++] = rec->tag;
 			cb_parse_unhandled(rec->tag, ptr);
 			break;
 		}
cmd/x86/cbsysinfo.c +8 -0
index 07570b00c9a..2b8d3b0a435 100644
@@ -364,6 +364,14 @@ static void show_table(struct sysinfo_t *info, bool verbose)
 
 	print_ptr("Chrome OS VPD", info->chromeos_vpd);
 	print_ptr("RSDP", info->rsdp);
+	printf("%-12s: ", "Unimpl.");
+	if (info->unimpl_count) {
+		for (i = 0; i < info->unimpl_count; i++)
+			printf("%02x ", info->unimpl[i]);
+		printf("\n");
+	} else {
+		printf("(none)\n");
+	}
 }
 
 static int do_cbsysinfo(struct cmd_tbl *cmdtp, int flag, int argc,
Signature · 1 line
2.39.2.637.g21b0678d19-goog
Reviewed-by on v1 13/13
#38 lore raw

Re: [PATCH 13/13] x86: coreboot: Show unimplemented sysinfo tags

Quoted 18 lines · Simon Glass

Sometimes coreboot adds new tags that U-Boot does not know about. These are silently ignored, but it is useful to at least know what we are missing.

Add a way to collect this information. For Brya it shows:

   Unimpl. 38 41 37 34 42 40

These are:

LB_TAG_PLATFORM_BLOB_VERSION
LB_TAG_ACPI_CNVS
LB_TAG_FMAP
LB_TAG_VBOOT_WORKBUF
LB_TAG_TYPE_C_INFO
LB_TAG_BOARD_CONFIG

Quoted 8 lines

---

 arch/x86/include/asm/cb_sysinfo.h  | 6 ++++++
 arch/x86/lib/coreboot/cb_sysinfo.c | 2 ++
 cmd/x86/cbsysinfo.c                | 8 ++++++++
 3 files changed, 16 insertions(+)
Reviewed-by on the v1 series
#39 lore raw
In reply to Simon Glass
Quoted 10 lines

-----Original Message-----
From: Simon Glass <[email protected]>
Sent: 2023年2月21日 3:49
To: U-Boot Mailing List <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; AKASHI Takahiro <[email protected]>; Andrew Scull <[email protected]>; Heinrich Schuchardt <[email protected]>; Ilias Apalodimas <[email protected]>; Jason Liu

<[email protected]>;

Quoted 8 lines

John Keeping <[email protected]>; Marek Vasut <[email protected]>; Masahisa Kojima <[email protected]>; Michal Suchanek <[email protected]>; Pali Rohár <[email protected]>; Pierre-Clément Tosi <[email protected]>; Rasmus Villemoes <[email protected]>; Stefan Roese <[email protected]>
Subject: [PATCH 00/13] x86: Various minor enhancements for coreboot

This series includes some patches generated while getting U-Boot to boot

more

Quoted 11 lines

nicely on Brya, an Adler Lake Chromebook.

This includes:
- show the ACPI tables with 'acpi list'
- get the UART to work even if coreboot doesn't enable it
- show unimplemented sysinfo tags
- fix for keyboard not working
- fix for trying to set up PCI regions when the info is not available
- fix for looking at inaccessible memory to find the sysinfo table

Quoted 14 lines

Simon Glass (13):
mtrr: Don't show an invalid CPU number
x86: Adjust search range for sysinfo table
input: Only reset the keyboard when running bare metal
x86: coreboot: Allow ACPI tables to be recorded
x86: coreboot: Collect the address of the ACPI tables
x86: Allow locating UARTs by device ID
pci: coreboot: Don't read regions when booting
usb: Quieten a debug message
x86: coreboot: Use a memory-mapped UART
x86: coreboot: Document how to enable the debug UART
x86: coreboot: Scan PCI after relocation
x86: coreboot: Log function names and line numbers
x86: coreboot: Show unimplemented sysinfo tags

This patch-set looks fine to me, thus,

Quoted 23 lines
 arch/x86/cpu/cpu.c                     |  2 +-
 arch/x86/dts/coreboot.dts              |  4 ++
 arch/x86/include/asm/cb_sysinfo.h      |  8 +++
 arch/x86/include/asm/coreboot_tables.h |  2 +
 arch/x86/lib/coreboot/cb_sysinfo.c     | 13 +++++
 cmd/Kconfig                            |  3 +-
 cmd/acpi.c                             |  4 ++
 cmd/x86/cbsysinfo.c                    |  9 ++++
 cmd/x86/mtrr.c                         |  3 +-
 configs/coreboot_defconfig             |  5 ++
 doc/board/coreboot/coreboot.rst        | 29 +++++++++++
 drivers/input/i8042.c                  | 13 +++--
 drivers/pci/pci-uclass.c               |  4 ++
 drivers/serial/serial_coreboot.c       | 69 +++++++++++++++++++++++---
 drivers/usb/host/xhci.c                |  4 +-
 include/asm-generic/global_data.h      |  4 +-
 include/configs/coreboot.h             |  2 +
 include/pci_ids.h                      |  3 ++
 18 files changed, 161 insertions(+), 20 deletions(-)

--
2.39.2.637.g21b0678d19-goog

#40 lore raw

Hi Bin,

Quoted 47 lines · Jason Liu
Quoted 11 lines

-----Original Message-----
From: Simon Glass <[email protected]>
Sent: 2023年2月21日 3:49
To: U-Boot Mailing List <[email protected]>
Cc: Bin Meng <[email protected]>; Simon Glass <[email protected]>; AKASHI Takahiro <[email protected]>; Andrew Scull <[email protected]>; Heinrich Schuchardt <[email protected]>; Ilias Apalodimas <[email protected]>; Jason Liu

<[email protected]>;

Quoted 8 lines

John Keeping <[email protected]>; Marek Vasut <[email protected]>; Masahisa Kojima <[email protected]>; Michal Suchanek <[email protected]>; Pali Rohár <[email protected]>; Pierre-Clément Tosi <[email protected]>; Rasmus Villemoes <[email protected]>; Stefan Roese <[email protected]>
Subject: [PATCH 00/13] x86: Various minor enhancements for coreboot

This series includes some patches generated while getting U-Boot to boot

more

Quoted 11 lines

nicely on Brya, an Adler Lake Chromebook.

This includes:
- show the ACPI tables with 'acpi list'
- get the UART to work even if coreboot doesn't enable it
- show unimplemented sysinfo tags
- fix for keyboard not working
- fix for trying to set up PCI regions when the info is not available
- fix for looking at inaccessible memory to find the sysinfo table

Quoted 14 lines

Simon Glass (13):
mtrr: Don't show an invalid CPU number
x86: Adjust search range for sysinfo table
input: Only reset the keyboard when running bare metal
x86: coreboot: Allow ACPI tables to be recorded
x86: coreboot: Collect the address of the ACPI tables
x86: Allow locating UARTs by device ID
pci: coreboot: Don't read regions when booting
usb: Quieten a debug message
x86: coreboot: Use a memory-mapped UART
x86: coreboot: Document how to enable the debug UART
x86: coreboot: Scan PCI after relocation
x86: coreboot: Log function names and line numbers
x86: coreboot: Show unimplemented sysinfo tags

Quoted 4 lines

This patch-set looks fine to me, thus,

Any thoughts on this series please?

We need to drop the usb one as the bug has been fixed.

Regards,
Simon