aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-09-22 11:16:22 -0400
committerTom Rini <trini@konsulko.com>2023-09-22 11:16:22 -0400
commitb05a184379631d13c4a49e423aa1324dc1ae6158 (patch)
treed9937c7de598c7edc5741ebc67c98dce47ea42d5
parent5d2fae79c7d60eaf7f50322e4ec125d2f58544e9 (diff)
parent5728246dfa11400d4f7aa8262ea630d8c09a85b9 (diff)
downloadu-boot-b05a184379631d13c4a49e423aa1324dc1ae6158.zip
u-boot-b05a184379631d13c4a49e423aa1324dc1ae6158.tar.gz
u-boot-b05a184379631d13c4a49e423aa1324dc1ae6158.tar.bz2
Merge tag 'x86-pull-20230922' of https://source.denx.de/u-boot/custodians/u-boot-x86 into nextWIP/22Sep2023-next
- Add bootstd support to 64-bit efi payload - Fix a bug of missing setting size of initrd in pxeboot - Allow Python packages to be dropped - Reland "x86: Move FACP table into separate functions" - Fixes for chromebook_link64 and chromebook_samus_tpl - Fixes and improvements for coreboot - x86 documentation updates
-rw-r--r--Makefile9
-rw-r--r--arch/arm/include/asm/global_data.h3
-rw-r--r--arch/riscv/include/asm/global_data.h3
-rw-r--r--arch/sandbox/include/asm/global_data.h1
-rw-r--r--arch/x86/cpu/apollolake/acpi.c13
-rw-r--r--arch/x86/cpu/baytrail/acpi.c23
-rw-r--r--arch/x86/cpu/broadwell/cpu.c10
-rw-r--r--arch/x86/cpu/broadwell/sdram.c2
-rw-r--r--arch/x86/cpu/coreboot/Kconfig1
-rw-r--r--arch/x86/cpu/coreboot/coreboot.c16
-rw-r--r--arch/x86/cpu/i386/cpu.c2
-rw-r--r--arch/x86/cpu/intel_common/mrc.c18
-rw-r--r--arch/x86/cpu/quark/acpi.c23
-rw-r--r--arch/x86/cpu/tangier/acpi.c23
-rw-r--r--arch/x86/cpu/x86_64/cpu.c7
-rw-r--r--arch/x86/dts/chromebook_samus.dts1
-rw-r--r--arch/x86/dts/coreboot.dts1
-rw-r--r--arch/x86/include/asm/acpi_table.h2
-rw-r--r--arch/x86/include/asm/coreboot_tables.h17
-rw-r--r--arch/x86/include/asm/global_data.h1
-rw-r--r--arch/x86/lib/acpi_table.c15
-rw-r--r--arch/x86/lib/coreboot/cb_sysinfo.c1
-rw-r--r--arch/x86/lib/init_helpers.c7
-rw-r--r--arch/x86/lib/spl.c5
-rw-r--r--arch/x86/lib/tables.c3
-rw-r--r--arch/x86/lib/tpl.c2
-rw-r--r--board/Marvell/mvebu_armada-37xx/board.c3
-rw-r--r--board/coreboot/coreboot/coreboot.c14
-rw-r--r--boot/bootdev-uclass.c27
-rw-r--r--boot/pxe_utils.c2
-rw-r--r--common/spl/spl.c2
-rw-r--r--configs/chromebook_samus_tpl_defconfig4
-rw-r--r--configs/coreboot64_defconfig25
-rw-r--r--configs/coreboot_defconfig21
-rw-r--r--configs/efi-x86_payload64_defconfig6
-rw-r--r--doc/arch/index.rst2
-rw-r--r--doc/arch/x86/index.rst12
-rw-r--r--doc/arch/x86/manual_boot.rst276
-rw-r--r--doc/arch/x86/x86.rst (renamed from doc/arch/x86.rst)300
-rw-r--r--doc/board/coreboot/coreboot.rst45
-rw-r--r--doc/board/emulation/qemu-x86.rst3
-rw-r--r--doc/build/tools.rst9
-rw-r--r--drivers/misc/Kconfig8
-rw-r--r--drivers/misc/cbmem_console.c43
-rw-r--r--drivers/serial/Kconfig2
-rw-r--r--drivers/usb/host/usb-uclass.c8
-rw-r--r--drivers/video/coreboot.c12
-rw-r--r--include/acpi/acpi_table.h7
-rw-r--r--include/asm-generic/global_data.h20
-rw-r--r--include/bootdev.h9
-rw-r--r--lib/Kconfig24
-rw-r--r--lib/efi_loader/Makefile4
-rw-r--r--lib/efi_loader/efi_setup.c20
-rw-r--r--lib/efi_loader/efi_smbios.c72
-rw-r--r--scripts/dtc/Makefile2
-rw-r--r--test/py/tests/test_event_dump.py1
56 files changed, 752 insertions, 440 deletions
diff --git a/Makefile b/Makefile
index 9be24c4..efbaf43 100644
--- a/Makefile
+++ b/Makefile
@@ -485,6 +485,15 @@ export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
--exclude CVS --exclude .pc --exclude .hg --exclude .git
+export PYTHON_ENABLE
+
+# This is y if U-Boot should not build any Python tools or libraries. Typically
+# you would need to set this if those tools/libraries (typically binman and
+# pylibfdt) cannot be built by your environment and are provided separately.
+ifeq ($(NO_PYTHON),)
+PYTHON_ENABLE=y
+endif
+
# ===========================================================================
# Rules shared between *config targets and build targets
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 2a222c5..b385bae 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -102,6 +102,9 @@ struct arch_global_data {
#ifdef CONFIG_ARCH_IMX8ULP
bool m33_handshake_done;
#endif
+#ifdef CONFIG_SMBIOS
+ ulong smbios_start; /* Start address of SMBIOS table */
+#endif
};
#include <asm-generic/global_data.h>
diff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h
index 9d97517..937fa4d 100644
--- a/arch/riscv/include/asm/global_data.h
+++ b/arch/riscv/include/asm/global_data.h
@@ -32,6 +32,9 @@ struct arch_global_data {
ulong available_harts;
#endif
#endif
+#ifdef CONFIG_SMBIOS
+ ulong smbios_start; /* Start address of SMBIOS table */
+#endif
};
#include <asm-generic/global_data.h>
diff --git a/arch/sandbox/include/asm/global_data.h b/arch/sandbox/include/asm/global_data.h
index f0ab3ba..c697773 100644
--- a/arch/sandbox/include/asm/global_data.h
+++ b/arch/sandbox/include/asm/global_data.h
@@ -17,6 +17,7 @@ struct arch_global_data {
ulong table_end; /* End address of x86 tables */
ulong table_start_high; /* Start address of high x86 tables */
ulong table_end_high; /* End address of high x86 tables */
+ ulong smbios_start; /* Start address of SMBIOS table */
};
#include <asm-generic/global_data.h>
diff --git a/arch/x86/cpu/apollolake/acpi.c b/arch/x86/cpu/apollolake/acpi.c
index fd21c0b..c610a7f 100644
--- a/arch/x86/cpu/apollolake/acpi.c
+++ b/arch/x86/cpu/apollolake/acpi.c
@@ -146,16 +146,21 @@ void fill_fadt(struct acpi_fadt *fadt)
fadt->x_pm_tmr_blk.addrl = IOMAP_ACPI_BASE + PM1_TMR;
}
-void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
- void *dsdt)
+static int apl_write_fadt(struct acpi_ctx *ctx, const struct acpi_writer *entry)
{
- struct acpi_table_header *header = &fadt->header;
+ struct acpi_table_header *header;
+ struct acpi_fadt *fadt;
- acpi_fadt_common(fadt, facs, dsdt);
+ fadt = ctx->current;
+ acpi_fadt_common(fadt, ctx->facs, ctx->dsdt);
intel_acpi_fill_fadt(fadt);
fill_fadt(fadt);
+ header = &fadt->header;
header->checksum = table_compute_checksum(fadt, header->length);
+
+ return acpi_add_fadt(ctx, fadt);
}
+ACPI_WRITER(5fadt, "FADT", apl_write_fadt, 0);
int apl_acpi_fill_dmar(struct acpi_ctx *ctx)
{
diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c
index 07757b8..4378846 100644
--- a/arch/x86/cpu/baytrail/acpi.c
+++ b/arch/x86/cpu/baytrail/acpi.c
@@ -15,20 +15,24 @@
#include <asm/arch/iomap.h>
#include <dm/uclass-internal.h>
-void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
- void *dsdt)
+static int baytrail_write_fadt(struct acpi_ctx *ctx,
+ const struct acpi_writer *entry)
{
- struct acpi_table_header *header = &(fadt->header);
+ struct acpi_table_header *header;
+ struct acpi_fadt *fadt;
+
+ fadt = ctx->current;
+ header = &fadt->header;
u16 pmbase = ACPI_BASE_ADDRESS;
- memset((void *)fadt, 0, sizeof(struct acpi_fadt));
+ memset(fadt, '\0', sizeof(struct acpi_fadt));
acpi_fill_header(header, "FACP");
header->length = sizeof(struct acpi_fadt);
header->revision = 4;
- fadt->firmware_ctrl = (u32)facs;
- fadt->dsdt = (u32)dsdt;
+ fadt->firmware_ctrl = (u32)ctx->facs;
+ fadt->dsdt = (u32)ctx->dsdt;
fadt->preferred_pm_profile = ACPI_PM_MOBILE;
fadt->sci_int = 9;
fadt->smi_cmd = 0;
@@ -75,9 +79,9 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
fadt->reset_reg.addrh = 0;
fadt->reset_value = SYS_RST | RST_CPU | FULL_RST;
- fadt->x_firmware_ctl_l = (u32)facs;
+ fadt->x_firmware_ctl_l = (u32)ctx->facs;
fadt->x_firmware_ctl_h = 0;
- fadt->x_dsdt_l = (u32)dsdt;
+ fadt->x_dsdt_l = (u32)ctx->dsdt;
fadt->x_dsdt_h = 0;
fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
@@ -137,7 +141,10 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
fadt->x_gpe1_blk.addrh = 0x0;
header->checksum = table_compute_checksum(fadt, header->length);
+
+ return acpi_add_fadt(ctx, fadt);
}
+ACPI_WRITER(5fadt, "FADT", baytrail_write_fadt, 0);
int acpi_create_gnvs(struct acpi_global_nvs *gnvs)
{
diff --git a/arch/x86/cpu/broadwell/cpu.c b/arch/x86/cpu/broadwell/cpu.c
index 560b1f7..cbd4a3b 100644
--- a/arch/x86/cpu/broadwell/cpu.c
+++ b/arch/x86/cpu/broadwell/cpu.c
@@ -11,6 +11,7 @@
#include <event.h>
#include <init.h>
#include <log.h>
+#include <spl.h>
#include <asm/cpu.h>
#include <asm/cpu_x86.h>
#include <asm/cpu_common.h>
@@ -67,12 +68,11 @@ int arch_cpu_init(void)
{
post_code(POST_CPU_INIT);
-#ifdef CONFIG_TPL
/* Do a mini-init if TPL has already done the full init */
- return x86_cpu_reinit_f();
-#else
- return x86_cpu_init_f();
-#endif
+ if (IS_ENABLED(CONFIG_TPL) && spl_phase() != PHASE_TPL)
+ return x86_cpu_reinit_f();
+ else
+ return x86_cpu_init_f();
}
int checkcpu(void)
diff --git a/arch/x86/cpu/broadwell/sdram.c b/arch/x86/cpu/broadwell/sdram.c
index f477d51..d30ebee 100644
--- a/arch/x86/cpu/broadwell/sdram.c
+++ b/arch/x86/cpu/broadwell/sdram.c
@@ -5,6 +5,8 @@
* From coreboot src/soc/intel/broadwell/romstage/raminit.c
*/
+#define LOG_CATEGORY UCLASS_RAM
+
#include <common.h>
#include <dm.h>
#include <init.h>
diff --git a/arch/x86/cpu/coreboot/Kconfig b/arch/x86/cpu/coreboot/Kconfig
index b97c277..178f8ad 100644
--- a/arch/x86/cpu/coreboot/Kconfig
+++ b/arch/x86/cpu/coreboot/Kconfig
@@ -25,6 +25,7 @@ config SYS_COREBOOT
imply FS_CBFS
imply CBMEM_CONSOLE
imply X86_TSC_READ_BASE
+ imply USE_PREBOOT
select BINMAN if X86_64
endif
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index 835b2c7..82fe4c7 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -21,7 +21,14 @@
int arch_cpu_init(void)
{
- int ret = get_coreboot_info(&lib_sysinfo);
+ int ret;
+
+ ret = IS_ENABLED(CONFIG_X86_RUN_64BIT) ? x86_cpu_reinit_f() :
+ x86_cpu_init_f();
+ if (ret)
+ return ret;
+
+ ret = get_coreboot_info(&lib_sysinfo);
if (ret != 0) {
printf("Failed to parse coreboot tables.\n");
return ret;
@@ -29,8 +36,7 @@ int arch_cpu_init(void)
timestamp_init();
- return IS_ENABLED(CONFIG_X86_RUN_64BIT) ? x86_cpu_reinit_f() :
- x86_cpu_init_f();
+ return 0;
}
int checkcpu(void)
@@ -80,10 +86,6 @@ static int last_stage_init(void)
if (IS_ENABLED(CONFIG_SPL_BUILD))
return 0;
- /* start usb so that usb keyboard can be used as input device */
- if (IS_ENABLED(CONFIG_USB_KEYBOARD))
- usb_init();
-
board_final_init();
return 0;
diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
index 91cd5d7..8882532 100644
--- a/arch/x86/cpu/i386/cpu.c
+++ b/arch/x86/cpu/i386/cpu.c
@@ -415,7 +415,7 @@ int cpu_phys_address_size(void)
/* Don't allow PCI region 3 to use memory in the 2-4GB memory hole */
static void setup_pci_ram_top(void)
{
- gd->pci_ram_top = 0x80000000U;
+ gd_set_pci_ram_top(0x80000000U);
}
static void setup_mtrr(void)
diff --git a/arch/x86/cpu/intel_common/mrc.c b/arch/x86/cpu/intel_common/mrc.c
index 56cc253..ff959d1 100644
--- a/arch/x86/cpu/intel_common/mrc.c
+++ b/arch/x86/cpu/intel_common/mrc.c
@@ -9,6 +9,7 @@
#include <dm.h>
#include <init.h>
#include <log.h>
+#include <spl.h>
#include <syscon.h>
#include <asm/cpu.h>
#include <asm/global_data.h>
@@ -251,13 +252,28 @@ static int sdram_initialise(struct udevice *dev, struct udevice *me_dev,
int mrc_common_init(struct udevice *dev, void *pei_data, bool use_asm_linkage)
{
struct udevice *me_dev;
- int ret;
+ int ret, delay;
ret = syscon_get_by_driver_data(X86_SYSCON_ME, &me_dev);
if (ret)
return ret;
+ delay = dev_read_u32_default(dev, "fspm,training-delay", 0);
+ if (spl_phase() == PHASE_SPL) {
+ if (delay)
+ printf("SDRAM training (%d seconds)...", delay);
+ else
+ log_debug("SDRAM init...");
+ } else {
+ if (delay)
+ printf("(%d seconds)...", delay);
+ }
+
ret = sdram_initialise(dev, me_dev, pei_data, use_asm_linkage);
+ if (delay)
+ printf("done\n");
+ else
+ log_debug("done\n");
if (ret)
return ret;
quick_ram_check();
diff --git a/arch/x86/cpu/quark/acpi.c b/arch/x86/cpu/quark/acpi.c
index 82b776f..9a2d682 100644
--- a/arch/x86/cpu/quark/acpi.c
+++ b/arch/x86/cpu/quark/acpi.c
@@ -10,20 +10,24 @@
#include <asm/arch/global_nvs.h>
#include <asm/arch/iomap.h>
-void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
- void *dsdt)
+static int quark_write_fadt(struct acpi_ctx *ctx,
+ const struct acpi_writer *entry)
{
- struct acpi_table_header *header = &(fadt->header);
u16 pmbase = ACPI_PM1_BASE_ADDRESS;
+ struct acpi_table_header *header;
+ struct acpi_fadt *fadt;
- memset((void *)fadt, 0, sizeof(struct acpi_fadt));
+ fadt = ctx->current;
+ header = &fadt->header;
+
+ memset(fadt, '\0', sizeof(struct acpi_fadt));
acpi_fill_header(header, "FACP");
header->length = sizeof(struct acpi_fadt);
header->revision = 4;
- fadt->firmware_ctrl = (u32)facs;
- fadt->dsdt = (u32)dsdt;
+ fadt->firmware_ctrl = (u32)ctx->facs;
+ fadt->dsdt = (u32)ctx->dsdt;
fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED;
fadt->sci_int = 9;
fadt->smi_cmd = 0;
@@ -70,9 +74,9 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
fadt->reset_reg.addrh = 0;
fadt->reset_value = SYS_RST | RST_CPU | FULL_RST;
- fadt->x_firmware_ctl_l = (u32)facs;
+ fadt->x_firmware_ctl_l = (u32)ctx->facs;
fadt->x_firmware_ctl_h = 0;
- fadt->x_dsdt_l = (u32)dsdt;
+ fadt->x_dsdt_l = (u32)ctx->dsdt;
fadt->x_dsdt_h = 0;
fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
@@ -132,7 +136,10 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
fadt->x_gpe1_blk.addrh = 0x0;
header->checksum = table_compute_checksum(fadt, header->length);
+
+ return acpi_add_fadt(ctx, fadt);
}
+ACPI_WRITER(5fadt, "FADT", quark_write_fadt, 0);
int acpi_create_gnvs(struct acpi_global_nvs *gnvs)
{
diff --git a/arch/x86/cpu/tangier/acpi.c b/arch/x86/cpu/tangier/acpi.c
index 3ffba38..1c667c7 100644
--- a/arch/x86/cpu/tangier/acpi.c
+++ b/arch/x86/cpu/tangier/acpi.c
@@ -16,19 +16,23 @@
#include <asm/arch/iomap.h>
#include <dm/uclass-internal.h>
-void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
- void *dsdt)
+static int tangier_write_fadt(struct acpi_ctx *ctx,
+ const struct acpi_writer *entry)
{
- struct acpi_table_header *header = &(fadt->header);
+ struct acpi_table_header *header;
+ struct acpi_fadt *fadt;
- memset((void *)fadt, 0, sizeof(struct acpi_fadt));
+ fadt = ctx->current;
+ header = &fadt->header;
+
+ memset(fadt, '\0', sizeof(struct acpi_fadt));
acpi_fill_header(header, "FACP");
header->length = sizeof(struct acpi_fadt);
header->revision = 6;
- fadt->firmware_ctrl = (u32)facs;
- fadt->dsdt = (u32)dsdt;
+ fadt->firmware_ctrl = (u32)ctx->facs;
+ fadt->dsdt = (u32)ctx->dsdt;
fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED;
fadt->iapc_boot_arch = ACPI_FADT_VGA_NOT_PRESENT |
@@ -41,13 +45,16 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
fadt->minor_revision = 2;
- fadt->x_firmware_ctl_l = (u32)facs;
+ fadt->x_firmware_ctl_l = (u32)ctx->facs;
fadt->x_firmware_ctl_h = 0;
- fadt->x_dsdt_l = (u32)dsdt;
+ fadt->x_dsdt_l = (u32)ctx->dsdt;
fadt->x_dsdt_h = 0;
header->checksum = table_compute_checksum(fadt, header->length);
+
+ return acpi_add_fadt(ctx, fadt);
}
+ACPI_WRITER(5fadt, "FADT", tangier_write_fadt, 0);
u32 acpi_fill_madt(u32 current)
{
diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
index d1c3873..2647bff 100644
--- a/arch/x86/cpu/x86_64/cpu.c
+++ b/arch/x86/cpu/x86_64/cpu.c
@@ -8,8 +8,11 @@
#include <cpu_func.h>
#include <debug_uart.h>
#include <init.h>
+#include <asm/cpu.h>
#include <asm/global_data.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int cpu_has_64bit(void)
{
return true;
@@ -38,6 +41,10 @@ int x86_mp_init(void)
int x86_cpu_reinit_f(void)
{
+ /* set the vendor to Intel so that native_calibrate_tsc() works */
+ gd->arch.x86_vendor = X86_VENDOR_INTEL;
+ gd->arch.has_mtrr = true;
+
return 0;
}
diff --git a/arch/x86/dts/chromebook_samus.dts b/arch/x86/dts/chromebook_samus.dts
index 96705ce..ddff277 100644
--- a/arch/x86/dts/chromebook_samus.dts
+++ b/arch/x86/dts/chromebook_samus.dts
@@ -266,6 +266,7 @@
board-id-gpios = <&gpio_c 5 0>, <&gpio_c 4 0>,
<&gpio_c 3 0>, <&gpio_c 1 0>;
bootph-all;
+ fspm,training-delay = <7>;
spd {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/arch/x86/dts/coreboot.dts b/arch/x86/dts/coreboot.dts
index f9ff534..0eb31ca 100644
--- a/arch/x86/dts/coreboot.dts
+++ b/arch/x86/dts/coreboot.dts
@@ -42,6 +42,7 @@
};
coreboot-fb {
+ bootph-some-ram;
compatible = "coreboot-fb";
};
};
diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h
index 72e1873..226753b 100644
--- a/arch/x86/include/asm/acpi_table.h
+++ b/arch/x86/include/asm/acpi_table.h
@@ -24,8 +24,6 @@ struct acpi_table_header;
/* These can be used by the target port */
-void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
- void *dsdt);
int acpi_create_madt_lapics(u32 current);
int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id,
u32 addr, u32 gsi_base);
diff --git a/arch/x86/include/asm/coreboot_tables.h b/arch/x86/include/asm/coreboot_tables.h
index 4de137f..0dfb64b 100644
--- a/arch/x86/include/asm/coreboot_tables.h
+++ b/arch/x86/include/asm/coreboot_tables.h
@@ -299,11 +299,24 @@ struct cb_vdat {
#define CB_TAG_TIMESTAMPS 0x0016
#define CB_TAG_CBMEM_CONSOLE 0x0017
+#define CBMC_CURSOR_MASK ((1 << 28) - 1)
+#define CBMC_OVERFLOW BIT(31)
+
+/*
+ * struct cbmem_console - In-memory console buffer for coreboot
+ *
+ * Structure describing console buffer. It is overlaid on a flat memory area,
+ * with body covering the extent of the memory. Once the buffer is full,
+ * output will wrap back around to the start of the buffer. The high bit of the
+ * cursor field gets set to indicate that this happened. If the underlying
+ * storage allows this, the buffer will persist across multiple boots and append
+ * to the previous log.
+ */
struct cbmem_console {
u32 size;
u32 cursor;
- char body[0];
-} __packed;
+ u8 body[0];
+};
#define CB_TAG_MRC_CACHE 0x0018
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index ea58259..6f4a713 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -127,6 +127,7 @@ struct arch_global_data {
ulong table_end; /* End address of x86 tables */
ulong table_start_high; /* Start address of high x86 tables */
ulong table_end_high; /* End address of high x86 tables */
+ ulong smbios_start; /* Start address of SMBIOS table */
};
#endif
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index e3b7e9a..c5b33dc 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -458,21 +458,6 @@ int acpi_write_gnvs(struct acpi_ctx *ctx, const struct acpi_writer *entry)
}
ACPI_WRITER(4gnvs, "GNVS", acpi_write_gnvs, 0);
-static int acpi_write_fadt(struct acpi_ctx *ctx,
- const struct acpi_writer *entry)
-{
- struct acpi_fadt *fadt;
-
- fadt = ctx->current;
- acpi_create_fadt(fadt, ctx->facs, ctx->dsdt);
- acpi_add_table(ctx, fadt);
-
- acpi_inc(ctx, sizeof(struct acpi_fadt));
-
- return 0;
-}
-ACPI_WRITER(5fact, "FADT", acpi_write_fadt, 0);
-
/**
* acpi_write_hpet() - Write out a HPET table
*
diff --git a/arch/x86/lib/coreboot/cb_sysinfo.c b/arch/x86/lib/coreboot/cb_sysinfo.c
index dfbc80c..f7fd9ea 100644
--- a/arch/x86/lib/coreboot/cb_sysinfo.c
+++ b/arch/x86/lib/coreboot/cb_sysinfo.c
@@ -471,6 +471,7 @@ int get_coreboot_info(struct sysinfo_t *info)
return -ENOENT;
gd->arch.coreboot_table = addr;
gd_set_acpi_start(map_to_sysmem(info->rsdp));
+ gd_set_smbios_start(info->smbios_start);
gd->flags |= GD_FLG_SKIP_LL_INIT;
return 0;
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 60a2707..bf0c921 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -15,7 +15,8 @@ DECLARE_GLOBAL_DATA_PTR;
int init_cache_f_r(void)
{
bool do_mtrr = CONFIG_IS_ENABLED(X86_32BIT_INIT) ||
- IS_ENABLED(CONFIG_FSP_VERSION2);
+ IS_ENABLED(CONFIG_FSP_VERSION2) ||
+ (IS_ENABLED(CONFIG_TPL) && IS_ENABLED(CONFIG_HAVE_MRC));
int ret;
/*
@@ -23,11 +24,9 @@ int init_cache_f_r(void)
*
* booting from slimbootloader - MTRRs are already set up
* booting with FSPv1 - MTRRs are already set up
- * booting with FSPv2 - MTRRs must be set here
+ * booting with FSPv2 or MRC - MTRRs must be set here
* booting from coreboot - in this case there is no SPL, so we set up
* the MTRRs here
- * Note: if there is an SPL, then it has already set up MTRRs so we
- * don't need to do that here
*/
do_mtrr &= !IS_ENABLED(CONFIG_FSP_VERSION1) &&
!IS_ENABLED(CONFIG_SYS_SLIMBOOTLOADER);
diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
index 58fa572..c15f11f 100644
--- a/arch/x86/lib/spl.c
+++ b/arch/x86/lib/spl.c
@@ -230,6 +230,9 @@ void board_init_f_r(void)
mtrr_commit(false);
init_cache();
gd->flags &= ~GD_FLG_SERIAL_READY;
+
+ /* make sure driver model is not accessed from now on */
+ gd->flags |= GD_FLG_DM_DEAD;
debug("cache status %d\n", dcache_status());
board_init_r(gd, 0);
}
@@ -258,7 +261,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image,
spl_image->os = IH_OS_U_BOOT;
spl_image->name = "U-Boot";
- if (!IS_ENABLED(CONFIG_SYS_COREBOOT)) {
+ if (spl_image->load_addr != spl_get_image_pos()) {
/* Copy U-Boot from ROM */
memcpy((void *)spl_image->load_addr,
(void *)spl_get_image_pos(), spl_get_image_size());
diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c
index 67bc0a7..5b5070f 100644
--- a/arch/x86/lib/tables.c
+++ b/arch/x86/lib/tables.c
@@ -97,6 +97,9 @@ int write_tables(void)
int size = table->size ? : CONFIG_ROM_TABLE_SIZE;
u32 rom_table_end;
+ if (!strcmp("smbios", table->name))
+ gd->arch.smbios_start = rom_addr;
+
if (IS_ENABLED(CONFIG_BLOBLIST_TABLES) && table->tag) {
if (!gd->arch.table_end)
gd->arch.table_end = rom_addr;
diff --git a/arch/x86/lib/tpl.c b/arch/x86/lib/tpl.c
index 18b05b2..273e9c8 100644
--- a/arch/x86/lib/tpl.c
+++ b/arch/x86/lib/tpl.c
@@ -3,6 +3,8 @@
* Copyright (c) 2018 Google, Inc
*/
+#define LOG_CATEGORY LOGC_BOOT
+
#include <common.h>
#include <debug_uart.h>
#include <dm.h>
diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
index 3fe5319..04124d8 100644
--- a/board/Marvell/mvebu_armada-37xx/board.c
+++ b/board/Marvell/mvebu_armada-37xx/board.c
@@ -307,7 +307,8 @@ static int last_stage_init(void)
struct udevice *bus;
ofnode node;
- if (!of_machine_is_compatible("globalscale,espressobin"))
+ if (!CONFIG_IS_ENABLED(DM_MDIO) ||
+ !of_machine_is_compatible("globalscale,espressobin"))
return 0;
node = ofnode_by_compatible(ofnode_null(), "marvell,orion-mdio");
diff --git a/board/coreboot/coreboot/coreboot.c b/board/coreboot/coreboot/coreboot.c
index 3b90ae7..db855c1 100644
--- a/board/coreboot/coreboot/coreboot.c
+++ b/board/coreboot/coreboot/coreboot.c
@@ -10,6 +10,8 @@
#include <asm/cb_sysinfo.h>
#include <asm/global_data.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int board_early_init_r(void)
{
/*
@@ -54,14 +56,12 @@ int show_board_info(void)
return 0;
fallback:
-#ifdef CONFIG_OF_CONTROL
- DECLARE_GLOBAL_DATA_PTR;
-
- model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+ if (IS_ENABLED(CONFIG_OF_CONTROL)) {
+ model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
- if (model)
- printf("Model: %s\n", model);
-#endif
+ if (model)
+ printf("Model: %s\n", model);
+ }
return checkboard();
}
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index 69506e3..974ddee 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -830,6 +830,33 @@ int bootdev_hunt(const char *spec, bool show)
return result;
}
+int bootdev_unhunt(enum uclass_id id)
+{
+ struct bootdev_hunter *start;
+ int n_ent, i;
+
+ start = ll_entry_start(struct bootdev_hunter, bootdev_hunter);
+ n_ent = ll_entry_count(struct bootdev_hunter, bootdev_hunter);
+ for (i = 0; i < n_ent; i++) {
+ struct bootdev_hunter *info = start + i;
+
+ if (info->uclass == id) {
+ struct bootstd_priv *std;
+ int ret;
+
+ ret = bootstd_get_priv(&std);
+ if (ret)
+ return log_msg_ret("std", ret);
+ if (!(std->hunters_used & BIT(i)))
+ return -EALREADY;
+ std->hunters_used &= ~BIT(i);
+ return 0;
+ }
+ }
+
+ return -ENOENT;
+}
+
int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show)
{
struct bootdev_hunter *start;
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index ac1414a..a92bb89 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -554,7 +554,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
label->name);
goto cleanup;
}
-
+ strcpy(initrd_filesize, simple_xtoa(size));
initrd_addr_str = env_get("ramdisk_addr_r");
size = snprintf(initrd_str, sizeof(initrd_str), "%s:%lx",
initrd_addr_str, size);
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 0062f3f..045a5e8 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -800,7 +800,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
IS_ENABLED(CONFIG_SPL_ATF))
dram_init_banksize();
- if (CONFIG_IS_ENABLED(PCI)) {
+ if (CONFIG_IS_ENABLED(PCI) && !(gd->flags & GD_FLG_DM_DEAD)) {
ret = pci_init();
if (ret)
puts(SPL_TPL_PROMPT "Cannot initialize PCI\n");
diff --git a/configs/chromebook_samus_tpl_defconfig b/configs/chromebook_samus_tpl_defconfig
index 33ada9f..9dd2940 100644
--- a/configs/chromebook_samus_tpl_defconfig
+++ b/configs/chromebook_samus_tpl_defconfig
@@ -1,6 +1,8 @@
CONFIG_X86=y
CONFIG_TEXT_BASE=0xffed0000
CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_TPL_SYS_MALLOC_F_LEN=0x2000
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x3000
CONFIG_NR_DRAM_BANKS=8
CONFIG_ENV_SIZE=0x1000
CONFIG_ENV_OFFSET=0x3F8000
@@ -19,7 +21,7 @@ CONFIG_HAVE_MRC=y
CONFIG_HAVE_REFCODE=y
CONFIG_SMP=y
CONFIG_HAVE_VGA_BIOS=y
-CONFIG_X86_OFFSET_U_BOOT=0xffee0000
+CONFIG_X86_OFFSET_U_BOOT=0xffed0000
CONFIG_SYS_MONITOR_BASE=0xFFED0000
CONFIG_BOOTSTAGE=y
CONFIG_BOOTSTAGE_REPORT=y
diff --git a/configs/coreboot64_defconfig b/configs/coreboot64_defconfig
index 2793e2c..555d281 100644
--- a/configs/coreboot64_defconfig
+++ b/configs/coreboot64_defconfig
@@ -1,5 +1,6 @@
CONFIG_X86=y
CONFIG_TEXT_BASE=0x1120000
+CONFIG_SYS_MALLOC_LEN=0x2000000
CONFIG_NR_DRAM_BANKS=8
CONFIG_ENV_SIZE=0x1000
CONFIG_DEFAULT_DEVICE_TREE="coreboot"
@@ -10,38 +11,32 @@ CONFIG_VENDOR_COREBOOT=y
CONFIG_TARGET_COREBOOT=y
CONFIG_FIT=y
CONFIG_FIT_SIGNATURE=y
+CONFIG_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
CONFIG_SYS_MONITOR_BASE=0x01120000
CONFIG_SHOW_BOOT_PROGRESS=y
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
-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_SPL_NO_BSS_LIMIT=y
-CONFIG_HUSH_PARSER=y
CONFIG_SYS_PBSIZE=532
CONFIG_CMD_IDE=y
CONFIG_CMD_MMC=y
-CONFIG_CMD_PART=y
+CONFIG_CMD_SATA=y
CONFIG_CMD_USB=y
# CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_DHCP=y
CONFIG_BOOTP_BOOTFILESIZE=y
-CONFIG_CMD_PING=y
CONFIG_CMD_TIME=y
CONFIG_CMD_SOUND=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
CONFIG_CMD_EXT4_WRITE=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
CONFIG_MAC_PARTITION=y
# CONFIG_SPL_MAC_PARTITION is not set
# CONFIG_SPL_DOS_PARTITION is not set
-CONFIG_ISO_PARTITION=y
-CONFIG_EFI_PARTITION=y
# CONFIG_SPL_EFI_PARTITION is not set
CONFIG_ENV_OVERWRITE=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
@@ -59,8 +54,14 @@ CONFIG_SYS_ATA_ALT_OFFSET=0
CONFIG_ATAPI=y
CONFIG_LBA48=y
CONFIG_SYS_64BIT_LBA=y
+CONFIG_NVME_PCI=y
# CONFIG_PCI_PNP is not set
+CONFIG_SYS_NS16550_MEM32=y
CONFIG_SOUND=y
CONFIG_SOUND_I8254=y
+CONFIG_VIDEO_COPY=y
CONFIG_CONSOLE_SCROLL_LINES=5
+CONFIG_SPL_ACPI=y
+CONFIG_CMD_DHRYSTONE=y
# CONFIG_GZIP is not set
+CONFIG_SMBIOS_PARSER=y
diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig
index f196ed7..edc38f1 100644
--- a/configs/coreboot_defconfig
+++ b/configs/coreboot_defconfig
@@ -10,6 +10,7 @@ CONFIG_TARGET_COREBOOT=y
CONFIG_FIT=y
CONFIG_FIT_SIGNATURE=y
CONFIG_BOOTSTD_FULL=y
+CONFIG_BOOTSTD_DEFAULTS=y
CONFIG_SYS_MONITOR_BASE=0x01110000
CONFIG_SHOW_BOOT_PROGRESS=y
CONFIG_USE_BOOTARGS=y
@@ -21,23 +22,16 @@ CONFIG_LOGF_LINE=y
CONFIG_LOGF_FUNC=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_PCI_INIT_R=y
+CONFIG_CMD_IDE=y
CONFIG_CMD_MMC=y
-CONFIG_CMD_PART=y
+CONFIG_CMD_SATA=y
CONFIG_CMD_USB=y
# CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_DHCP=y
CONFIG_BOOTP_BOOTFILESIZE=y
-CONFIG_CMD_PING=y
CONFIG_CMD_TIME=y
CONFIG_CMD_SOUND=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
CONFIG_CMD_EXT4_WRITE=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
CONFIG_MAC_PARTITION=y
-CONFIG_ISO_PARTITION=y
-CONFIG_EFI_PARTITION=y
CONFIG_ENV_OVERWRITE=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_USE_BOOTFILE=y
@@ -47,10 +41,19 @@ CONFIG_USE_ROOTPATH=y
CONFIG_REGMAP=y
CONFIG_SYSCON=y
# CONFIG_ACPIGEN is not set
+CONFIG_SYS_IDE_MAXDEVICE=4
+CONFIG_SYS_ATA_DATA_OFFSET=0
+CONFIG_SYS_ATA_REG_OFFSET=0
+CONFIG_SYS_ATA_ALT_OFFSET=0
+CONFIG_ATAPI=y
+CONFIG_LBA48=y
+CONFIG_SYS_64BIT_LBA=y
CONFIG_NVME_PCI=y
# CONFIG_PCI_PNP is not set
+CONFIG_SYS_NS16550_MEM32=y
CONFIG_SOUND=y
CONFIG_SOUND_I8254=y
+CONFIG_VIDEO_COPY=y
CONFIG_CONSOLE_SCROLL_LINES=5
CONFIG_CMD_DHRYSTONE=y
# CONFIG_GZIP is not set
diff --git a/configs/efi-x86_payload64_defconfig b/configs/efi-x86_payload64_defconfig
index 80460d3..6c6f705 100644
--- a/configs/efi-x86_payload64_defconfig
+++ b/configs/efi-x86_payload64_defconfig
@@ -7,11 +7,12 @@ CONFIG_VENDOR_EFI=y
CONFIG_TARGET_EFI_PAYLOAD=y
CONFIG_FIT=y
CONFIG_FIT_SIGNATURE=y
+CONFIG_BOOTSTD_FULL=y
+CONFIG_LEGACY_IMAGE_FORMAT=y
CONFIG_SHOW_BOOT_PROGRESS=y
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
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_DISPLAY_BOARDINFO_LATE=y
@@ -35,6 +36,9 @@ CONFIG_MAC_PARTITION=y
CONFIG_ISO_PARTITION=y
CONFIG_EFI_PARTITION=y
CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_ENV_FAT_INTERFACE="scsi"
+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_USE_BOOTFILE=y
CONFIG_BOOTFILE="bzImage"
diff --git a/doc/arch/index.rst b/doc/arch/index.rst
index 2f916f4..60c93b3 100644
--- a/doc/arch/index.rst
+++ b/doc/arch/index.rst
@@ -15,5 +15,5 @@ Architecture-specific doc
riscv
sandbox/index
sh
- x86
+ x86/index
xtensa
diff --git a/doc/arch/x86/index.rst b/doc/arch/x86/index.rst
new file mode 100644
index 0000000..69db0a5
--- /dev/null
+++ b/doc/arch/x86/index.rst
@@ -0,0 +1,12 @@
+.. SPDX-License-Identifier: GPL-2.0+ */
+.. Copyright 2023 Google LLC
+.. sectionauthor:: Simon Glass <sjg@chromium.org>
+
+x86
+===
+
+.. toctree::
+ :maxdepth: 2
+
+ x86
+ manual_boot
diff --git a/doc/arch/x86/manual_boot.rst b/doc/arch/x86/manual_boot.rst
new file mode 100644
index 0000000..ec069f2
--- /dev/null
+++ b/doc/arch/x86/manual_boot.rst
@@ -0,0 +1,276 @@
+Booting Ubuntu Manually
+-----------------------
+
+This shows a manual approach to booting Ubuntu without standard boot or the EFI
+interface.
+
+As an example of how to set up your boot flow with U-Boot, here are
+instructions for starting Ubuntu from U-Boot. These instructions have been
+tested on Minnowboard MAX with a SATA drive but are equally applicable on
+other platforms and other media. There are really only four steps and it's a
+very simple script, but a more detailed explanation is provided here for
+completeness.
+
+Note: It is possible to set up U-Boot to boot automatically using syslinux.
+It could also use the grub.cfg file (/efi/ubuntu/grub.cfg) to obtain the
+GUID. If you figure these out, please post patches to this README.
+
+Firstly, you will need Ubuntu installed on an available disk. It should be
+possible to make U-Boot start a USB start-up disk but for now let's assume
+that you used another boot loader to install Ubuntu.
+
+Use the U-Boot command line to find the UUID of the partition you want to
+boot. For example our disk is SCSI device 0::
+
+ => part list scsi 0
+
+ Partition Map for SCSI device 0 -- Partition Type: EFI
+
+ Part Start LBA End LBA Name
+ Attributes
+ Type GUID
+ Partition GUID
+ 1 0x00000800 0x001007ff ""
+ attrs: 0x0000000000000000
+ type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
+ guid: 9d02e8e4-4d59-408f-a9b0-fd497bc9291c
+ 2 0x00100800 0x037d8fff ""
+ attrs: 0x0000000000000000
+ type: 0fc63daf-8483-4772-8e79-3d69d8477de4
+ guid: 965c59ee-1822-4326-90d2-b02446050059
+ 3 0x037d9000 0x03ba27ff ""
+ attrs: 0x0000000000000000
+ type: 0657fd6d-a4ab-43c4-84e5-0933c84b4f4f
+ guid: 2c4282bd-1e82-4bcf-a5ff-51dedbf39f17
+ =>
+
+This shows that your SCSI disk has three partitions. The really long hex
+strings are called Globally Unique Identifiers (GUIDs). You can look up the
+'type' ones `here`_. On this disk the first partition is for EFI and is in
+VFAT format (DOS/Windows)::
+
+ => fatls scsi 0:1
+ efi/
+
+ 0 file(s), 1 dir(s)
+
+
+Partition 2 is 'Linux filesystem data' so that will be our root disk. It is
+in ext2 format::
+
+ => ext2ls scsi 0:2
+ <DIR> 4096 .
+ <DIR> 4096 ..
+ <DIR> 16384 lost+found
+ <DIR> 4096 boot
+ <DIR> 12288 etc
+ <DIR> 4096 media
+ <DIR> 4096 bin
+ <DIR> 4096 dev
+ <DIR> 4096 home
+ <DIR> 4096 lib
+ <DIR> 4096 lib64
+ <DIR> 4096 mnt
+ <DIR> 4096 opt
+ <DIR> 4096 proc
+ <DIR> 4096 root
+ <DIR> 4096 run
+ <DIR> 12288 sbin
+ <DIR> 4096 srv
+ <DIR> 4096 sys
+ <DIR> 4096 tmp
+ <DIR> 4096 usr
+ <DIR> 4096 var
+ <SYM> 33 initrd.img
+ <SYM> 30 vmlinuz
+ <DIR> 4096 cdrom
+ <SYM> 33 initrd.img.old
+ =>
+
+and if you look in the /boot directory you will see the kernel::
+
+ => ext2ls scsi 0:2 /boot
+ <DIR> 4096 .
+ <DIR> 4096 ..
+ <DIR> 4096 efi
+ <DIR> 4096 grub
+ 3381262 System.map-3.13.0-32-generic
+ 1162712 abi-3.13.0-32-generic
+ 165611 config-3.13.0-32-generic
+ 176500 memtest86+.bin
+ 178176 memtest86+.elf
+ 178680 memtest86+_multiboot.bin
+ 5798112 vmlinuz-3.13.0-32-generic
+ 165762 config-3.13.0-58-generic
+ 1165129 abi-3.13.0-58-generic
+ 5823136 vmlinuz-3.13.0-58-generic
+ 19215259 initrd.img-3.13.0-58-generic
+ 3391763 System.map-3.13.0-58-generic
+ 5825048 vmlinuz-3.13.0-58-generic.efi.signed
+ 28304443 initrd.img-3.13.0-32-generic
+ =>
+
+The 'vmlinuz' files contain a packaged Linux kernel. The format is a kind of
+self-extracting compressed file mixed with some 'setup' configuration data.
+Despite its size (uncompressed it is >10MB) this only includes a basic set of
+device drivers, enough to boot on most hardware types.
+
+The 'initrd' files contain a RAM disk. This is something that can be loaded
+into RAM and will appear to Linux like a disk. Ubuntu uses this to hold lots
+of drivers for whatever hardware you might have. It is loaded before the
+real root disk is accessed.
+
+The numbers after the end of each file are the version. Here it is Linux
+version 3.13. You can find the source code for this in the Linux tree with
+the tag v3.13. The '.0' allows for additional Linux releases to fix problems,
+but normally this is not needed. The '-58' is used by Ubuntu. Each time they
+release a new kernel they increment this number. New Ubuntu versions might
+include kernel patches to fix reported bugs. Stable kernels can exist for
+some years so this number can get quite high.
+
+The '.efi.signed' kernel is signed for EFI's secure boot. U-Boot has its own
+secure boot mechanism - see `this`_ & `that`_. It cannot read .efi files
+at present.
+
+To boot Ubuntu from U-Boot the steps are as follows:
+
+1. Set up the boot arguments. Use the GUID for the partition you want to boot::
+
+ => setenv bootargs root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro
+
+Here root= tells Linux the location of its root disk. The disk is specified
+by its GUID, using '/dev/disk/by-partuuid/', a Linux path to a 'directory'
+containing all the GUIDs Linux has found. When it starts up, there will be a
+file in that directory with this name in it. It is also possible to use a
+device name here, see later.
+
+2. Load the kernel. Since it is an ext2/4 filesystem we can do::
+
+ => ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic
+
+The address 30000000 is arbitrary, but there seem to be problems with using
+small addresses (sometimes Linux cannot find the ramdisk). This is 48MB into
+the start of RAM (which is at 0 on x86).
+
+3. Load the ramdisk (to 64MB)::
+
+ => ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic
+
+4. Start up the kernel. We need to know the size of the ramdisk, but can use
+ a variable for that. U-Boot sets 'filesize' to the size of the last file it
+ loaded::
+
+ => zboot 03000000 0 04000000 ${filesize}
+
+Type 'help zboot' if you want to see what the arguments are. U-Boot on x86 is
+quite verbose when it boots a kernel. You should see these messages from
+U-Boot::
+
+ Valid Boot Flag
+ Setup Size = 0x00004400
+ Magic signature found
+ Using boot protocol version 2.0c
+ Linux kernel version 3.13.0-58-generic (buildd@allspice) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015
+ Building boot_params at 0x00090000
+ Loading bzImage at address 100000 (5805728 bytes)
+ Magic signature found
+ Initial RAM disk at linear address 0x04000000, size 19215259 bytes
+ Kernel command line: "root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro"
+
+ Starting kernel ...
+
+U-Boot prints out some bootstage timing. This is more useful if you put the
+above commands into a script since then it will be faster::
+
+ Timer summary in microseconds:
+ Mark Elapsed Stage
+ 0 0 reset
+ 241,535 241,535 board_init_r
+ 2,421,611 2,180,076 id=64
+ 2,421,790 179 id=65
+ 2,428,215 6,425 main_loop
+ 48,860,584 46,432,369 start_kernel
+
+ Accumulated time:
+ 240,329 ahci
+ 1,422,704 vesa display
+
+Now the kernel actually starts (if you want to examine kernel boot up message on
+the serial console, append "console=ttyS0,115200" to the kernel command line)::
+
+ [ 0.000000] Initializing cgroup subsys cpuset
+ [ 0.000000] Initializing cgroup subsys cpu
+ [ 0.000000] Initializing cgroup subsys cpuacct
+ [ 0.000000] Linux version 3.13.0-58-generic (buildd@allspice) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015 (Ubuntu 3.13.0-58.97-generic 3.13.11-ckt22)
+ [ 0.000000] Command line: root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro console=ttyS0,115200
+
+It continues for a long time. Along the way you will see it pick up your
+ramdisk::
+
+ [ 0.000000] RAMDISK: [mem 0x04000000-0x05253fff]
+ ...
+ [ 0.788540] Trying to unpack rootfs image as initramfs...
+ [ 1.540111] Freeing initrd memory: 18768K (ffff880004000000 - ffff880005254000)
+ ...
+
+Later it actually starts using it::
+
+ Begin: Running /scripts/local-premount ... done.
+
+You should also see your boot disk turn up::
+
+ [ 4.357243] scsi 1:0:0:0: Direct-Access ATA ADATA SP310 5.2 PQ: 0 ANSI: 5
+ [ 4.366860] sd 1:0:0:0: [sda] 62533296 512-byte logical blocks: (32.0 GB/29.8 GiB)
+ [ 4.375677] sd 1:0:0:0: Attached scsi generic sg0 type 0
+ [ 4.381859] sd 1:0:0:0: [sda] Write Protect is off
+ [ 4.387452] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
+ [ 4.399535] sda: sda1 sda2 sda3
+
+Linux has found the three partitions (sda1-3). Mercifully it doesn't print out
+the GUIDs. In step 1 above we could have used::
+
+ setenv bootargs root=/dev/sda2 ro
+
+instead of the GUID. However if you add another drive to your board the
+numbering may change whereas the GUIDs will not. So if your boot partition
+becomes sdb2, it will still boot. For embedded systems where you just want to
+boot the first disk, you have that option.
+
+The last thing you will see on the console is mention of plymouth (which
+displays the Ubuntu start-up screen) and a lot of 'Starting' messages::
+
+ * Starting Mount filesystems on boot [ OK ]
+
+After a pause you should see a login screen on your display and you are done.
+
+If you want to put this in a script you can use something like this::
+
+ setenv bootargs root=UUID=b2aaf743-0418-4d90-94cc-3e6108d7d968 ro
+ setenv boot zboot 03000000 0 04000000 \${filesize}
+ setenv bootcmd "ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; run boot"
+ saveenv
+
+The \ is to tell the shell not to evaluate ${filesize} as part of the setenv
+command.
+
+You can also bake this behaviour into your build by hard-coding the
+environment variables if you add this to minnowmax.h:
+
+.. code-block:: c
+
+ #undef CONFIG_BOOTCOMMAND
+ #define CONFIG_BOOTCOMMAND \
+ "ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; " \
+ "ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; " \
+ "run boot"
+
+ #undef CFG_EXTRA_ENV_SETTINGS
+ #define CFG_EXTRA_ENV_SETTINGS "boot=zboot 03000000 0 04000000 ${filesize}"
+
+and change CONFIG_BOOTARGS value in configs/minnowmax_defconfig to::
+
+ CONFIG_BOOTARGS="root=/dev/sda2 ro"
+
+.. _here: https://en.wikipedia.org/wiki/GUID_Partition_Table
+.. _this: http://events.linuxfoundation.org/sites/events/files/slides/chromeos_and_diy_vboot_0.pdf
+.. _that: http://events.linuxfoundation.org/sites/events/files/slides/elce-2014.pdf
diff --git a/doc/arch/x86.rst b/doc/arch/x86/x86.rst
index 725a1ae..f67216d 100644
--- a/doc/arch/x86.rst
+++ b/doc/arch/x86/x86.rst
@@ -11,9 +11,9 @@ including supported boards, build instructions, todo list, etc.
Status
------
U-Boot supports running as a `coreboot`_ payload on x86. So far only Link
-(Chromebook Pixel) and `QEMU`_ x86 targets have been tested, but it should
-work with minimal adjustments on other x86 boards since coreboot deals with
-most of the low-level details.
+(Chromebook Pixel), Brya (Alder Lake Chromebook) and `QEMU`_ x86 targets have
+been tested, but it should work with minimal adjustments on other x86 boards
+since coreboot deals with most of the low-level details.
U-Boot is a main bootloader on Intel Edison board.
@@ -25,18 +25,21 @@ are supported:
- Bayley Bay CRB
- Cherry Hill CRB
- Congatec QEVAL 2.0 & conga-QA3/E3845
+ - Coral (Apollo Lake - Chromebook 2017)
- Cougar Canyon 2 CRB
- Crown Bay CRB
- Galileo
- - Link (Chromebook Pixel)
+ - Link (Ivy Bridge - Chromebook Pixel)
- Minnowboard MAX
- - Samus (Chromebook Pixel 2015)
+ - Samus (Broadwell - Chromebook Pixel 2015)
+ - Coral (Apollo Lake Chromebooks circa 2017)
- QEMU x86 (32-bit & 64-bit)
As for loading an OS, U-Boot supports directly booting a 32-bit or 64-bit
Linux kernel as part of a FIT image. It also supports a compressed zImage.
U-Boot supports loading an x86 VxWorks kernel. Please check README.vxworks
-for more details.
+for more details. Finally, U-Boot can boot Linux distributions with a UEFI
+interface.
Build Instructions for U-Boot as BIOS replacement (bare mode)
-------------------------------------------------------------
@@ -95,272 +98,9 @@ mtrr
Booting Ubuntu
--------------
-As an example of how to set up your boot flow with U-Boot, here are
-instructions for starting Ubuntu from U-Boot. These instructions have been
-tested on Minnowboard MAX with a SATA drive but are equally applicable on
-other platforms and other media. There are really only four steps and it's a
-very simple script, but a more detailed explanation is provided here for
-completeness.
-
-Note: It is possible to set up U-Boot to boot automatically using syslinux.
-It could also use the grub.cfg file (/efi/ubuntu/grub.cfg) to obtain the
-GUID. If you figure these out, please post patches to this README.
-
-Firstly, you will need Ubuntu installed on an available disk. It should be
-possible to make U-Boot start a USB start-up disk but for now let's assume
-that you used another boot loader to install Ubuntu.
-
-Use the U-Boot command line to find the UUID of the partition you want to
-boot. For example our disk is SCSI device 0::
-
- => part list scsi 0
-
- Partition Map for SCSI device 0 -- Partition Type: EFI
-
- Part Start LBA End LBA Name
- Attributes
- Type GUID
- Partition GUID
- 1 0x00000800 0x001007ff ""
- attrs: 0x0000000000000000
- type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
- guid: 9d02e8e4-4d59-408f-a9b0-fd497bc9291c
- 2 0x00100800 0x037d8fff ""
- attrs: 0x0000000000000000
- type: 0fc63daf-8483-4772-8e79-3d69d8477de4
- guid: 965c59ee-1822-4326-90d2-b02446050059
- 3 0x037d9000 0x03ba27ff ""
- attrs: 0x0000000000000000
- type: 0657fd6d-a4ab-43c4-84e5-0933c84b4f4f
- guid: 2c4282bd-1e82-4bcf-a5ff-51dedbf39f17
- =>
-
-This shows that your SCSI disk has three partitions. The really long hex
-strings are called Globally Unique Identifiers (GUIDs). You can look up the
-'type' ones `here`_. On this disk the first partition is for EFI and is in
-VFAT format (DOS/Windows)::
-
- => fatls scsi 0:1
- efi/
-
- 0 file(s), 1 dir(s)
-
-
-Partition 2 is 'Linux filesystem data' so that will be our root disk. It is
-in ext2 format::
-
- => ext2ls scsi 0:2
- <DIR> 4096 .
- <DIR> 4096 ..
- <DIR> 16384 lost+found
- <DIR> 4096 boot
- <DIR> 12288 etc
- <DIR> 4096 media
- <DIR> 4096 bin
- <DIR> 4096 dev
- <DIR> 4096 home
- <DIR> 4096 lib
- <DIR> 4096 lib64
- <DIR> 4096 mnt
- <DIR> 4096 opt
- <DIR> 4096 proc
- <DIR> 4096 root
- <DIR> 4096 run
- <DIR> 12288 sbin
- <DIR> 4096 srv
- <DIR> 4096 sys
- <DIR> 4096 tmp
- <DIR> 4096 usr
- <DIR> 4096 var
- <SYM> 33 initrd.img
- <SYM> 30 vmlinuz
- <DIR> 4096 cdrom
- <SYM> 33 initrd.img.old
- =>
-
-and if you look in the /boot directory you will see the kernel::
-
- => ext2ls scsi 0:2 /boot
- <DIR> 4096 .
- <DIR> 4096 ..
- <DIR> 4096 efi
- <DIR> 4096 grub
- 3381262 System.map-3.13.0-32-generic
- 1162712 abi-3.13.0-32-generic
- 165611 config-3.13.0-32-generic
- 176500 memtest86+.bin
- 178176 memtest86+.elf
- 178680 memtest86+_multiboot.bin
- 5798112 vmlinuz-3.13.0-32-generic
- 165762 config-3.13.0-58-generic
- 1165129 abi-3.13.0-58-generic
- 5823136 vmlinuz-3.13.0-58-generic
- 19215259 initrd.img-3.13.0-58-generic
- 3391763 System.map-3.13.0-58-generic
- 5825048 vmlinuz-3.13.0-58-generic.efi.signed
- 28304443 initrd.img-3.13.0-32-generic
- =>
-
-The 'vmlinuz' files contain a packaged Linux kernel. The format is a kind of
-self-extracting compressed file mixed with some 'setup' configuration data.
-Despite its size (uncompressed it is >10MB) this only includes a basic set of
-device drivers, enough to boot on most hardware types.
-
-The 'initrd' files contain a RAM disk. This is something that can be loaded
-into RAM and will appear to Linux like a disk. Ubuntu uses this to hold lots
-of drivers for whatever hardware you might have. It is loaded before the
-real root disk is accessed.
-
-The numbers after the end of each file are the version. Here it is Linux
-version 3.13. You can find the source code for this in the Linux tree with
-the tag v3.13. The '.0' allows for additional Linux releases to fix problems,
-but normally this is not needed. The '-58' is used by Ubuntu. Each time they
-release a new kernel they increment this number. New Ubuntu versions might
-include kernel patches to fix reported bugs. Stable kernels can exist for
-some years so this number can get quite high.
-
-The '.efi.signed' kernel is signed for EFI's secure boot. U-Boot has its own
-secure boot mechanism - see `this`_ & `that`_. It cannot read .efi files
-at present.
-
-To boot Ubuntu from U-Boot the steps are as follows:
-
-1. Set up the boot arguments. Use the GUID for the partition you want to boot::
-
- => setenv bootargs root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro
-
-Here root= tells Linux the location of its root disk. The disk is specified
-by its GUID, using '/dev/disk/by-partuuid/', a Linux path to a 'directory'
-containing all the GUIDs Linux has found. When it starts up, there will be a
-file in that directory with this name in it. It is also possible to use a
-device name here, see later.
-
-2. Load the kernel. Since it is an ext2/4 filesystem we can do::
-
- => ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic
-
-The address 30000000 is arbitrary, but there seem to be problems with using
-small addresses (sometimes Linux cannot find the ramdisk). This is 48MB into
-the start of RAM (which is at 0 on x86).
-
-3. Load the ramdisk (to 64MB)::
-
- => ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic
-
-4. Start up the kernel. We need to know the size of the ramdisk, but can use
- a variable for that. U-Boot sets 'filesize' to the size of the last file it
- loaded::
-
- => zboot 03000000 0 04000000 ${filesize}
-
-Type 'help zboot' if you want to see what the arguments are. U-Boot on x86 is
-quite verbose when it boots a kernel. You should see these messages from
-U-Boot::
-
- Valid Boot Flag
- Setup Size = 0x00004400
- Magic signature found
- Using boot protocol version 2.0c
- Linux kernel version 3.13.0-58-generic (buildd@allspice) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015
- Building boot_params at 0x00090000
- Loading bzImage at address 100000 (5805728 bytes)
- Magic signature found
- Initial RAM disk at linear address 0x04000000, size 19215259 bytes
- Kernel command line: "root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro"
-
- Starting kernel ...
-
-U-Boot prints out some bootstage timing. This is more useful if you put the
-above commands into a script since then it will be faster::
-
- Timer summary in microseconds:
- Mark Elapsed Stage
- 0 0 reset
- 241,535 241,535 board_init_r
- 2,421,611 2,180,076 id=64
- 2,421,790 179 id=65
- 2,428,215 6,425 main_loop
- 48,860,584 46,432,369 start_kernel
-
- Accumulated time:
- 240,329 ahci
- 1,422,704 vesa display
-
-Now the kernel actually starts (if you want to examine kernel boot up message on
-the serial console, append "console=ttyS0,115200" to the kernel command line)::
-
- [ 0.000000] Initializing cgroup subsys cpuset
- [ 0.000000] Initializing cgroup subsys cpu
- [ 0.000000] Initializing cgroup subsys cpuacct
- [ 0.000000] Linux version 3.13.0-58-generic (buildd@allspice) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #97-Ubuntu SMP Wed Jul 8 02:56:15 UTC 2015 (Ubuntu 3.13.0-58.97-generic 3.13.11-ckt22)
- [ 0.000000] Command line: root=/dev/disk/by-partuuid/965c59ee-1822-4326-90d2-b02446050059 ro console=ttyS0,115200
-
-It continues for a long time. Along the way you will see it pick up your
-ramdisk::
-
- [ 0.000000] RAMDISK: [mem 0x04000000-0x05253fff]
- ...
- [ 0.788540] Trying to unpack rootfs image as initramfs...
- [ 1.540111] Freeing initrd memory: 18768K (ffff880004000000 - ffff880005254000)
- ...
-
-Later it actually starts using it::
-
- Begin: Running /scripts/local-premount ... done.
-
-You should also see your boot disk turn up::
-
- [ 4.357243] scsi 1:0:0:0: Direct-Access ATA ADATA SP310 5.2 PQ: 0 ANSI: 5
- [ 4.366860] sd 1:0:0:0: [sda] 62533296 512-byte logical blocks: (32.0 GB/29.8 GiB)
- [ 4.375677] sd 1:0:0:0: Attached scsi generic sg0 type 0
- [ 4.381859] sd 1:0:0:0: [sda] Write Protect is off
- [ 4.387452] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
- [ 4.399535] sda: sda1 sda2 sda3
-
-Linux has found the three partitions (sda1-3). Mercifully it doesn't print out
-the GUIDs. In step 1 above we could have used::
-
- setenv bootargs root=/dev/sda2 ro
-
-instead of the GUID. However if you add another drive to your board the
-numbering may change whereas the GUIDs will not. So if your boot partition
-becomes sdb2, it will still boot. For embedded systems where you just want to
-boot the first disk, you have that option.
-
-The last thing you will see on the console is mention of plymouth (which
-displays the Ubuntu start-up screen) and a lot of 'Starting' messages::
-
- * Starting Mount filesystems on boot [ OK ]
-
-After a pause you should see a login screen on your display and you are done.
-
-If you want to put this in a script you can use something like this::
-
- setenv bootargs root=UUID=b2aaf743-0418-4d90-94cc-3e6108d7d968 ro
- setenv boot zboot 03000000 0 04000000 \${filesize}
- setenv bootcmd "ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; run boot"
- saveenv
-
-The \ is to tell the shell not to evaluate ${filesize} as part of the setenv
-command.
-
-You can also bake this behaviour into your build by hard-coding the
-environment variables if you add this to minnowmax.h:
-
-.. code-block:: c
-
- #undef CONFIG_BOOTCOMMAND
- #define CONFIG_BOOTCOMMAND \
- "ext2load scsi 0:2 03000000 /boot/vmlinuz-3.13.0-58-generic; " \
- "ext2load scsi 0:2 04000000 /boot/initrd.img-3.13.0-58-generic; " \
- "run boot"
-
- #undef CFG_EXTRA_ENV_SETTINGS
- #define CFG_EXTRA_ENV_SETTINGS "boot=zboot 03000000 0 04000000 ${filesize}"
-
-and change CONFIG_BOOTARGS value in configs/minnowmax_defconfig to::
-
- CONFIG_BOOTARGS="root=/dev/sda2 ro"
+Typically U-Boot boots distributions automatically so long an `CONFIG_BOOTSTD`,
+`CONFIG_BOOTSTD_DEFAULTS` and `CONFIG_EFI_LOADER` are enabled. See
+:doc:`manual_boot` for how to do this manually.
Test with SeaBIOS
-----------------
@@ -695,14 +435,15 @@ to load a 'u-boot-payload.efi', see below test logs on QEMU.
No controllers found
Hit any key to stop autoboot: 0
-See :doc:`../develop/uefi/u-boot_on_efi` and :doc:`../develop/uefi/uefi` for
-details of EFI support in U-Boot.
+See :doc:`../../develop/uefi/u-boot_on_efi` and :doc:`../../develop/uefi/uefi`
+for details of EFI support in U-Boot.
Chain-loading
-------------
-U-Boot can be chain-loaded from another bootloader, such as coreboot or
-Slim Bootloader. Typically this is done by building for targets 'coreboot' or
-'slimbootloader'.
+U-Boot can be chain-loaded from another bootloader, such as
+:doc:`../../board/coreboot/index` coreboot or
+:doc:`../../board/intel/slimbootloader`. Typically this is done by building for
+targets 'coreboot' or 'slimbootloader'.
For example, at present we have a 'coreboot' target but this runs very
different code from the bare-metal targets, such as coral. There is very little
@@ -732,7 +473,7 @@ SMBIOS tables
To generate SMBIOS tables in U-Boot, for use by the OS, enable the
CONFIG_GENERATE_SMBIOS_TABLE option. The easiest way to provide the values to
use is via the device tree. For details see
-:download:`smbios.txt <../device-tree-bindings/sysinfo/smbios.txt>`.
+:download:`smbios.txt <../../device-tree-bindings/sysinfo/smbios.txt>`.
TODO List
---------
@@ -744,8 +485,5 @@ TODO List
.. _microcode: http://en.wikipedia.org/wiki/Microcode
.. _SFI: http://simplefirmware.org
.. _MP: http://www.intel.com/design/archives/processors/pro/docs/242016.htm
-.. _here: https://en.wikipedia.org/wiki/GUID_Partition_Table
-.. _this: http://events.linuxfoundation.org/sites/events/files/slides/chromeos_and_diy_vboot_0.pdf
-.. _that: http://events.linuxfoundation.org/sites/events/files/slides/elce-2014.pdf
.. _SeaBIOS: http://www.seabios.org/SeaBIOS
.. _ACPI: http://www.acpi.info
diff --git a/doc/board/coreboot/coreboot.rst b/doc/board/coreboot/coreboot.rst
index d660a22..10a251c 100644
--- a/doc/board/coreboot/coreboot.rst
+++ b/doc/board/coreboot/coreboot.rst
@@ -41,15 +41,56 @@ At present it seems that for Minnowboard Max, coreboot does not pass through
the video information correctly (it always says the resolution is 0x0). This
works correctly for link though.
+You can run via QEMU using::
+
+ qemu-system-x86_64 -bios build/coreboot.rom -serial mon:stdio
+
+The `-serial mon:stdio` part shows both output in the display and on the
+console. It is optional. You can add `nographic` as well to *only* get console
+output.
+
+To run with a SATA drive called `$DISK`::
+
+ qemu-system-x86_64 -bios build/coreboot.rom -serial mon:stdio \
+ -drive id=disk,file=$DISK,if=none \
+ -device ahci,id=ahci \
+ -device ide-hd,drive=disk,bus=ahci.0
+
+Then you can scan it with `scsi scan` and access it normally.
+
+To use 4GB of memory, typically necessary for booting Linux distros, add
+`-m 4GB`.
+
64-bit U-Boot
-------------
In addition to the 32-bit 'coreboot' build there is a 'coreboot64' build. This
produces an image which can be booted from coreboot (32-bit). Internally it
works by using a 32-bit SPL binary to switch to 64-bit for running U-Boot. It
-can be useful for running UEFI applications, for example.
+can be useful for running UEFI applications, for example with the coreboot
+build in `$CBDIR`::
+
+ DISK=ubuntu-23.04-desktop-amd64.iso
+ CBDIR=~/coreboot/build
+
+ cp $CBDIR/coreboot.rom.in coreboot.rom
+ cbfstool coreboot.rom add-flat-binary -f u-boot-x86-with-spl.bin \
+ -n fallback/payload -c lzma -l 0x1110000 -e 0x1110000
+
+ qemu-system-x86_64 -m 2G -smp 4 -bios coreboot.rom \
+ -drive id=disk,file=$DISK,if=none \
+ -device ahci,id=ahci \
+ -device ide-hd,drive=disk,bus=ahci.0 \
+
+This allows booting and installing various distros, many of which are
+64-bit-only, so cannot work with the 32-bit 'coreboot' build.
+
+USB keyboard
+------------
-This has only been lightly tested.
+The `CONFIG_USE_PREBOOT` option is enabled by default, meaning that USB starts
+up just before the command-line starts. This allows user interaction on
+non-laptop devices which use a USB keyboard.
CBFS access
-----------
diff --git a/doc/board/emulation/qemu-x86.rst b/doc/board/emulation/qemu-x86.rst
index 15f56b6..c604e42 100644
--- a/doc/board/emulation/qemu-x86.rst
+++ b/doc/board/emulation/qemu-x86.rst
@@ -193,6 +193,9 @@ Linux is selected from grub, e.g. with `debian-12.1.0-i386-netinst.iso`::
The bochs video driver also seems to cause problems before the OS is able to
show a display.
+The QEMU `-cdrom` option is intended to work with the original ISO-format
+images, not the recently invented ISOHybrid image.
+
Finally, the use of `-M accel=kvm` is intended to use the native CPU's
virtual-machine features to accelerate operation, but this causes U-Boot to hang
when jumping 64-bit mode, at least on AMD machines. This may be a bug in U-Boot
diff --git a/doc/build/tools.rst b/doc/build/tools.rst
index ec017229..5bfa05b 100644
--- a/doc/build/tools.rst
+++ b/doc/build/tools.rst
@@ -45,3 +45,12 @@ Launch the MSYS2 shell of the MSYS2 environment, and do the following::
$ make tools-only_defconfig
$ make tools-only
+
+
+Building without Python
+-----------------------
+
+The tools-only builds bytes pylibfdt by default. To disable this, use the
+NO_PYTHON variable::
+
+ NO_PYTHON=1 make tools-only_defconfig tools-only
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index a6e3f62..c930e4a 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -122,6 +122,14 @@ config VEXPRESS_CONFIG
configuration bus on the Arm Versatile Express boards via
a sysreg driver.
+config CBMEM_CONSOLE
+ bool "Write console output to coreboot cbmem"
+ depends on X86
+ help
+ Enables console output to the cbmem console, which is a memory
+ region set up by coreboot to hold a record of all console output.
+ Enable this only if booting from coreboot.
+
config CMD_CROS_EC
bool "Enable crosec command"
depends on CROS_EC
diff --git a/drivers/misc/cbmem_console.c b/drivers/misc/cbmem_console.c
index 8bbe33d..ba3a599 100644
--- a/drivers/misc/cbmem_console.c
+++ b/drivers/misc/cbmem_console.c
@@ -5,27 +5,37 @@
#include <common.h>
#include <console.h>
-#ifndef CONFIG_SYS_COREBOOT
-#error This driver requires coreboot
-#endif
-
#include <asm/cb_sysinfo.h>
-struct cbmem_console {
- u32 buffer_size;
- u32 buffer_cursor;
- u8 buffer_body[0];
-} __attribute__ ((__packed__));
-
-static struct cbmem_console *cbmem_console_p;
-
void cbmemc_putc(struct stdio_dev *dev, char data)
{
- int cursor;
+ const struct sysinfo_t *sysinfo = cb_get_sysinfo();
+ struct cbmem_console *cons;
+ uint pos, flags;
+
+ if (!sysinfo)
+ return;
+ cons = sysinfo->cbmem_cons;
+ if (!cons)
+ return;
+
+ pos = cons->cursor & CBMC_CURSOR_MASK;
+
+ /* preserve the overflow flag if present */
+ flags = cons->cursor & ~CBMC_CURSOR_MASK;
+
+ cons->body[pos++] = data;
+
+ /*
+ * Deal with overflow - the flag may be cleared by another program which
+ * reads the buffer out later, e.g. Linux
+ */
+ if (pos >= cons->size) {
+ pos = 0;
+ flags |= CBMC_OVERFLOW;
+ }
- cursor = cbmem_console_p->buffer_cursor++;
- if (cursor < cbmem_console_p->buffer_size)
- cbmem_console_p->buffer_body[cursor] = data;
+ cons->cursor = flags | pos;
}
void cbmemc_puts(struct stdio_dev *dev, const char *str)
@@ -40,7 +50,6 @@ int cbmemc_init(void)
{
int rc;
struct stdio_dev cons_dev;
- cbmem_console_p = lib_sysinfo.cbmem_cons;
memset(&cons_dev, 0, sizeof(cons_dev));
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 7ca42df..27b4b9d 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -672,7 +672,7 @@ config COREBOOT_SERIAL
config COREBOOT_SERIAL_FROM_DBG2
bool "Obtain UART from ACPI tables"
depends on COREBOOT_SERIAL
- default y if !SPL
+ default y
help
Select this to try to find a DBG2 record in the ACPI tables, in the
event that coreboot does not provide information about the UART in the
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index e5fe949..a1cd0ad 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -9,6 +9,7 @@
#define LOG_CATEGORY UCLASS_USB
#include <common.h>
+#include <bootdev.h>
#include <dm.h>
#include <errno.h>
#include <log.h>
@@ -208,6 +209,13 @@ int usb_stop(void)
#ifdef CONFIG_USB_STORAGE
usb_stor_reset();
#endif
+ if (CONFIG_IS_ENABLED(BOOTSTD)) {
+ int ret;
+
+ ret = bootdev_unhunt(UCLASS_USB);
+ if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && ret && ret != -EALREADY)
+ printf("failed to unhunt USB (err=%dE)\n", ret);
+ }
uc_priv->companion_device_count = 0;
usb_started = 0;
diff --git a/drivers/video/coreboot.c b/drivers/video/coreboot.c
index c586475..5b718ae 100644
--- a/drivers/video/coreboot.c
+++ b/drivers/video/coreboot.c
@@ -73,6 +73,17 @@ err:
return ret;
}
+static int coreboot_video_bind(struct udevice *dev)
+{
+ struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev);
+
+ /* Set the maximum supported resolution */
+ uc_plat->size = 4096 * 2160 * 4;
+ log_debug("%s: Frame buffer size %x\n", __func__, uc_plat->size);
+
+ return 0;
+}
+
static const struct udevice_id coreboot_video_ids[] = {
{ .compatible = "coreboot-fb" },
{ }
@@ -82,5 +93,6 @@ U_BOOT_DRIVER(coreboot_video) = {
.name = "coreboot_video",
.id = UCLASS_VIDEO,
.of_match = coreboot_video_ids,
+ .bind = coreboot_video_bind,
.probe = coreboot_video_probe,
};
diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h
index 7ed0443..1f85de0 100644
--- a/include/acpi/acpi_table.h
+++ b/include/acpi/acpi_table.h
@@ -883,6 +883,13 @@ void acpi_inc_align(struct acpi_ctx *ctx, uint amount);
*/
int acpi_add_table(struct acpi_ctx *ctx, void *table);
+static inline int acpi_add_fadt(struct acpi_ctx *ctx, struct acpi_fadt *fadt)
+{
+ acpi_add_table(ctx, fadt);
+ acpi_inc(ctx, sizeof(struct acpi_fadt));
+ return 0;
+}
+
/**
* acpi_write_rsdp() - Write out an RSDP indicating where the ACPI tables are
*
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 8fc205d..c6d63b3 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -552,6 +552,14 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
#define gd_set_acpi_start(addr)
#endif
+#ifdef CONFIG_SMBIOS
+#define gd_smbios_start() gd->smbios_start
+#define gd_set_smbios_start(addr) gd->arch.smbios_start = addr
+#else
+#define gd_smbios_start() 0UL
+#define gd_set_smbios_start(addr)
+#endif
+
#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
#define gd_multi_dtb_fit() gd->multi_dtb_fit
#define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb
@@ -573,6 +581,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
#define gd_malloc_start() 0
#define gd_set_malloc_start(val)
#endif
+
+#if CONFIG_IS_ENABLED(PCI)
+#define gd_set_pci_ram_top(val) gd->pci_ram_top = val
+#else
+#define gd_set_pci_ram_top(val)
+#endif
+
/**
* enum gd_flags - global data flags
*
@@ -667,6 +682,11 @@ enum gd_flags {
* @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags
*/
GD_FLG_OF_TAG_MIGRATE = 0x200000,
+ /**
+ * @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when
+ * the memory used to holds its tables has been mapped out.
+ */
+ GD_FLG_DM_DEAD = 0x400000,
};
#endif /* __ASSEMBLY__ */
diff --git a/include/bootdev.h b/include/bootdev.h
index 8482331..b079a91 100644
--- a/include/bootdev.h
+++ b/include/bootdev.h
@@ -321,6 +321,15 @@ int bootdev_hunt(const char *spec, bool show);
int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show);
/**
+ * bootdev_unhunt() - Mark a device as needing to be hunted again
+ *
+ * @id: uclass ID to update
+ * Return: 0 if done, -EALREADY if already in this state, -ENOENT if no hunter
+ * found for that uclass
+ */
+int bootdev_unhunt(enum uclass_id id);
+
+/**
* bootdev_hunt_and_find_by_label() - Hunt for bootdevs by label
*
* Runs the hunter for the label, then tries to find the bootdev, possible
diff --git a/lib/Kconfig b/lib/Kconfig
index eb2b101..79cf9ef 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -289,6 +289,14 @@ config ACPI
not necessarily include generation of tables
(see GENERATE_ACPI_TABLE), but allows for tables to be located.
+config SPL_ACPI
+ bool "Enable support for ACPI libraries in SPL"
+ depends on SPL && SUPPORT_ACPI
+ help
+ Provides library functions for dealing with ACPI tables in SPL. This
+ does not necessarily include generation of tables
+ (see GENERATE_ACPI_TABLE), but allows for tables to be located.
+
config GENERATE_ACPI_TABLE
bool "Generate an ACPI (Advanced Configuration and Power Interface) table"
depends on ACPI
@@ -967,8 +975,8 @@ config BLOBLIST_TABLES
config GENERATE_SMBIOS_TABLE
bool "Generate an SMBIOS (System Management BIOS) table"
+ depends on SMBIOS
default y
- depends on X86 || EFI_LOADER
help
The System Management BIOS (SMBIOS) specification addresses how
motherboard and system vendors present management information about
@@ -1037,6 +1045,20 @@ config SPL_OID_REGISTRY
unambiguous persistent name (https://en.wikipedia.org/wiki/Object_identifier).
Enable fast lookup object identifier registry in the SPL.
+config SMBIOS
+ bool "SMBIOS support"
+ depends on X86 || EFI_LOADER
+ default y
+ select LAST_STAGE_INIT
+ help
+ Indicates that this platform can support System Management BIOS
+ (SMBIOS) tables. These provide various pieces of information about
+ the board, such as the manufacturer and the model name.
+
+ See GENERATE_SMBIOS_TABLE which controls whether U-Boot actually
+ creates these tables, rather than them coming from a previous firmware
+ stage.
+
config SMBIOS_PARSER
bool "SMBIOS parser"
help
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 1a8c8d7..8d31fc6 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -78,8 +78,8 @@ obj-$(CONFIG_EFI_ESRT) += efi_esrt.o
obj-$(CONFIG_VIDEO) += efi_gop.o
obj-$(CONFIG_BLK) += efi_disk.o
obj-$(CONFIG_NETDEVICES) += efi_net.o
-obj-$(CONFIG_GENERATE_ACPI_TABLE) += efi_acpi.o
-obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o
+obj-$(CONFIG_ACPI) += efi_acpi.o
+obj-$(CONFIG_SMBIOS) += efi_smbios.o
obj-$(CONFIG_EFI_RNG_PROTOCOL) += efi_rng.o
obj-$(CONFIG_EFI_TCG2_PROTOCOL) += efi_tcg2.o
obj-$(CONFIG_EFI_RISCV_BOOT_PROTOCOL) += efi_riscv.o
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index 58d4e13..e6de685 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -321,16 +321,16 @@ efi_status_t efi_init_obj_list(void)
if (ret != EFI_SUCCESS)
goto out;
#endif
-#ifdef CONFIG_GENERATE_ACPI_TABLE
- ret = efi_acpi_register();
- if (ret != EFI_SUCCESS)
- goto out;
-#endif
-#ifdef CONFIG_GENERATE_SMBIOS_TABLE
- ret = efi_smbios_register();
- if (ret != EFI_SUCCESS)
- goto out;
-#endif
+ if (IS_ENABLED(CONFIG_ACPI)) {
+ ret = efi_acpi_register();
+ if (ret != EFI_SUCCESS)
+ goto out;
+ }
+ if (IS_ENABLED(CONFIG_SMBIOS)) {
+ ret = efi_smbios_register();
+ if (ret != EFI_SUCCESS)
+ goto out;
+ }
ret = efi_watchdog_register();
if (ret != EFI_SUCCESS)
goto out;
diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c
index 306c0bc..48446f6 100644
--- a/lib/efi_loader/efi_smbios.c
+++ b/lib/efi_loader/efi_smbios.c
@@ -10,8 +10,14 @@
#include <common.h>
#include <efi_loader.h>
#include <log.h>
+#include <malloc.h>
#include <mapmem.h>
#include <smbios.h>
+#include <linux/sizes.h>
+
+enum {
+ TABLE_SIZE = SZ_4K,
+};
/*
* Install the SMBIOS table as a configuration table.
@@ -20,36 +26,50 @@
*/
efi_status_t efi_smbios_register(void)
{
- /* Map within the low 32 bits, to allow for 32bit SMBIOS tables */
- u64 dmi_addr = U32_MAX;
+ ulong addr;
efi_status_t ret;
- void *dmi;
- /* Reserve 4kiB page for SMBIOS */
- ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
- EFI_RUNTIME_SERVICES_DATA, 1, &dmi_addr);
+ addr = gd->arch.smbios_start;
+ if (!addr) {
+ log_err("No SMBIOS tables to install\n");
+ return EFI_NOT_FOUND;
+ }
+
+ /* Mark space used for tables */
+ ret = efi_add_memory_map(addr, TABLE_SIZE, EFI_RUNTIME_SERVICES_DATA);
+ if (ret)
+ return ret;
+
+ log_debug("EFI using SMBIOS tables at %lx\n", addr);
+
+ /* Install SMBIOS information as configuration table */
+ return efi_install_configuration_table(&smbios_guid,
+ map_sysmem(addr, 0));
+}
+
+static int install_smbios_table(void)
+{
+ ulong addr;
+ void *buf;
- if (ret != EFI_SUCCESS) {
- /* Could not find space in lowmem, use highmem instead */
- ret = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES,
- EFI_RUNTIME_SERVICES_DATA, 1,
- &dmi_addr);
+ if (!IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLE) || IS_ENABLED(CONFIG_X86))
+ return 0;
- if (ret != EFI_SUCCESS)
- return ret;
+ /* Align the table to a 4KB boundary to keep EFI happy */
+ buf = memalign(SZ_4K, TABLE_SIZE);
+ if (!buf)
+ return log_msg_ret("mem", -ENOMEM);
+
+ addr = map_to_sysmem(buf);
+ if (!write_smbios_table(addr)) {
+ log_err("Failed to write SMBIOS table\n");
+ return log_msg_ret("smbios", -EINVAL);
}
- /*
- * Generate SMBIOS tables - we know that efi_allocate_pages() returns
- * a 4k-aligned address, so it is safe to assume that
- * write_smbios_table() will write the table at that address.
- */
- assert(!(dmi_addr & 0xf));
- dmi = (void *)(uintptr_t)dmi_addr;
- if (write_smbios_table(map_to_sysmem(dmi)))
- /* Install SMBIOS information as configuration table */
- return efi_install_configuration_table(&smbios_guid, dmi);
- efi_free_pages(dmi_addr, 1);
- log_err("Cannot create SMBIOS table\n");
- return EFI_SUCCESS;
+ /* Make a note of where we put it */
+ log_debug("SMBIOS tables written to %lx\n", addr);
+ gd->arch.smbios_start = addr;
+
+ return 0;
}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, install_smbios_table);
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 58d879d..faa72d9 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -19,4 +19,6 @@ HOSTCFLAGS_dtc-parser.tab.o := -I$(src)
$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
# Added for U-Boot
+ifeq ($(PYTHON_ENABLE),y)
subdir-$(CONFIG_PYLIBFDT) += pylibfdt
+endif
diff --git a/test/py/tests/test_event_dump.py b/test/py/tests/test_event_dump.py
index a6df9e1..e282c67 100644
--- a/test/py/tests/test_event_dump.py
+++ b/test/py/tests/test_event_dump.py
@@ -18,6 +18,7 @@ def test_event_dump(u_boot_console):
-------------------- ------------------------------ ------------------------------
EVT_FT_FIXUP bootmeth_vbe_ft_fixup .*boot/vbe_request.c:.*
EVT_FT_FIXUP bootmeth_vbe_simple_ft_fixup .*boot/vbe_simple_os.c:.*
+EVT_LAST_STAGE_INIT install_smbios_table .*lib/efi_loader/efi_smbios.c:.*
EVT_MISC_INIT_F sandbox_early_getopt_check .*arch/sandbox/cpu/start.c:.*
EVT_TEST h_adder_simple .*test/common/event.c:'''
assert re.match(expect, out, re.MULTILINE) is not None