summaryrefslogtreecommitdiff
path: root/arch/x86/lib
AgeCommit message (Collapse)Author
2025-06-13spl: Rename jump_to_image_no_args()Simon Glass
This function is currently a misnomer at times as we have cases where it passes arguments to the image. In preparation for making that be a more common case rename this function to jump_to_image(...). In order to do this, rename jump_to_image in board_init_r(...) to jumper so that we do not have a conflict. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Reword the commit message, adding missing cases of jump_to_image_no_args()] Signed-off-by: Tom Rini <trini@konsulko.com>
2025-06-02Merge patch series "Audit include list for include/[a-m]*.h"Tom Rini
Tom Rini <trini@konsulko.com> says: Hey all, Related to my other series I've posted recently on cleaning up some headers, this series here is the result of at least lightly auditing the #includes used in include/[a-m]*.h. This ignores subdirectories, as at least in part I think the top-level includes we've constructed are the most likely places to have some extra transitive include paths. I'm sure there's exceptions and I'll likely audit deeper once this first pass is done. This only gets as far as "include/m*.h" because I didn't want this to get too big. This also sets aside <miiphy.h> and <phy.h>. While miiphy.h does not directly need <phy.h> there are *so* many users and I think I had half of the tree just about not building when I first tried. It might be worth further investigation, but it might just be OK as-is. Link: https://lore.kernel.org/r/20250521230119.2084088-1-trini@konsulko.com
2025-06-02include/bios_emul.h: Audit include listTom Rini
This file does not need <pc.h> but does directly need <linux/types.h>. Furthermore, arch/x86/lib/bios.c was getting <pci.h> via <bios_emul.h> so add it there. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-05-27binman: x86: Write skip-at-start when end-at-4gb is usedSimon Glass
The end-at-4gb property implies a value for skip-at-start so add it into the output FDT so that U-Boot can read it. Now that skip-at-start is implemented, we can drop the workarounds used in the x86 code to obtain the correct image-pos value. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-25x86: efi_loader: Ensure the SMBIOS tables are sent via EFISimon Glass
The EFI-loader code has not been fully converted to use bloblist, so relies on the SMBIOS-table address being set in global_data. Set this up in write_tables() so that the SMBIOS tables are actually available. Enable the command for x86 QEMU so that the SMBIOS tests actually run. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 83ce35d6ebb ("emulation: Use bloblist to hold tables") Reported-by: Niklas Sombert <niklas.sombert@uni-duesseldorf.de> Tested-by: Niklas Sombert <niklas.sombert@uni-duesseldorf.de> Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-05-09x86: Correct usage of IS_ENABLED() macro in arch/x86/lib/spl.cTom Rini
This file was using IS_ENABLED() to test for CONFIG flags but omitted the CONFIG_ prefix and so did not work as expected. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-11Merge patch series "Switch to using $(PHASE_) in Makefiles"Tom Rini
Tom Rini <trini@konsulko.com> says: This series switches to always using $(PHASE_) in Makefiles when building rather than $(PHASE_) or $(XPL_). It also starts on documenting this part of the build, but as a follow-up we need to rename doc/develop/spl.rst and expand on explaining things a bit. Link: https://lore.kernel.org/r/20250401225851.1125678-1-trini@konsulko.com
2025-04-11Kbuild: Always use $(PHASE_)Tom Rini
It is confusing to have both "$(PHASE_)" and "$(XPL_)" be used in our Makefiles as part of the macros to determine when to do something in our Makefiles based on what phase of the build we are in. For consistency, bring this down to a single macro and use "$(PHASE_)" only. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-08Merge patch series "acpi: simplify updating ACPI table header checksum"Tom Rini
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says: Introduce a new function to update ACPI table headers. This allows to simplify the existing code. Link: https://lore.kernel.org/r/20250321232121.251800-1-heinrich.schuchardt@canonical.com
2025-04-08x86/acpi: simplify updating header checksumHeinrich Schuchardt
Use acpi_update_checksum() for updating ACPI table header checksum. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Matthias Brugger <mbrugger@suse.com>
2025-04-07Revert "Merge patch series "pxe: Precursor series for supporting read_all() ↵Tom Rini
in extlinux / PXE"" This reverts commit 8bc3542384e3a1219e5ffb62b79d16dddc1b1fb9, reversing changes made to 698edd63eca090a2e299cd3facf90a0b97bed677. There are still problems with this series to work out. Link: https://lore.kernel.org/u-boot/CAFLszTjw_MJbK9tpzVYi3XKGazcv55auBAdgVzcAVUta7dRqcg@mail.gmail.com/ Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-04arch/x86/lib: Fix CONFIG_X86_64 usage in zimage.cJeremy Compostella
Correct the preprocessor directive used to check for 64-bit kernel support in the `zboot_go` function. The code previously checked for `CONFIG_X86_RUN_64BIT`, which is not the correct configuration option for determining if the kernel should run in 64-bit mode. The correct option is `CONFIG_X86_64`. Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2025-04-03x86: Support a 64-bit ramdisk addressSimon Glass
Add some missing pieces to bootparams so that a 64-bit ramdisk address can be used. Tidy up the logging while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03x86: emulation: Support BLOBLIST_TABLES properlySimon Glass
The existing QEMU implementation mostly ignored BLOBLIST_TABLES and allocates the bulk of the tables with malloc(). Update it to place all tables in the bloblist. Since QEMU declares a size of 128KB regardless of the size of its tables, this requires a larger bloblist. Fix up the e820 table to handle this, keeping the old code as an option for now, to assist with any future bug-fixing. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03x86: Add a new API for e820Simon Glass
The existing mechanism is pretty painful as it requires manual calculations for anything but a trivial setup. Add a new API for adding e820 entries. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03x86: e820: Add a function to dump the e820 tableSimon Glass
There is already code for this in zimage. Move it to the e820 file so it can be used elsewhere. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03x86: Drop the message about features missing in 64-bitSimon Glass
This functions normally and has done for a while, so drop this scary message. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03x86: spl: Drop duplicate CPU initSimon Glass
x86_cpu_init_f() is called by arch_cpu_init() a few lines below this code. Drop the duplicate call. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03x86: Avoid clearing the VESA displaySimon Glass
U-Boot clears the display when it starts up, so there is no need to ask the VESA driver to do this. Fix this and add a comment explaining the flags. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03x86: Drop use of CONFIG_REALMODE_DEBUGSimon Glass
This option is not actually defined in Kconfig anymore. Use a normal debug print instead, which has a similar effect. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2025-04-03x86: Add some log categoriesSimon Glass
Add categories for i8259 and bios files, so that log statements have the right category. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03x86: Drop mpspec from the SPL buildSimon Glass
This is not needed in SPL, so drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-18Merge patch series "pxe: Precursor series for supporting read_all() in ↵Tom Rini
extlinux / PXE" Simon Glass <sjg@chromium.org> says: This series includes some patches related to allowing read_all() to be used with the extlinux / PXE bootmeths. These patches were split out from the stb4 series, since it will need to have additional patches for LWIP, to avoid breaking PXE booting when LWIP is used. Link: https://lore.kernel.org/r/20250306002533.2380866-1-sjg@chromium.org
2025-03-18boot: pxe: Refactor label_run_boot() to avoid cmdlineSimon Glass
Adjust the remaining call in this function to use the bootm API. This will allow PXE to work without the command line. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-18x86: Drop the unnecessary base_ptr argument to zboot_dump()Simon Glass
This value is include the bootm_info, so drop the unnecessary parameter. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-18bootstd: Correct display of kernel versionSimon Glass
The address of the bzImage is not recorded in the bootflow, so we cannot actually locate the version at present. Handle this case, to avoid showing invalid data. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-18x86: Move the bootm state for zimage into cmd/Simon Glass
Rather than holding the state in the implementation code, move it to the command code. The state is now passed to the implementation functions and can there (with future work) be pass in from bootstd, without going through the commands. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-18x86: Rename state to bmiSimon Glass
Use the common name for the struct, in preparation for passing it around between functions. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-18x86: Move x86 zboot state into struct bootm_infoSimon Glass
This structure is supposed to handle any type of booting programmatically, i.e. without needing a command to be executed. Move the x86-specific members into it and use it instead of struct zboot_state. Provide a macro so access is possible without adding lots of #ifdefs to the code. This will allow the struct to be used for all four types of booting (bootm, bootz, booti and zboot). Call bootm_init() to init the state, to match other boot methods. Note that some rationalisation could be performed on this. But this is tricky since addresses are stored as strings in several places. Also some strings combine multiple arguments into one. So to keep this task somewhat manageable, we content ourselves with just getting everything into the same struct Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-18x86: Rename zboot_run() to zboot_run_args()Simon Glass
Rename this function so we can (later) create a zboot_run() function which looks the same as bootm_run() Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04x86: Stop working around skip-at-startSimon Glass
With a recent Binman change, the skip-at-start property is now honoured, meaning that all image-pos values in the affected section start from the skip-at-start value. The x86 code works around the old behaviour at present, so update it. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22x86: Align the SMBIOS table to a 4K boundarySimon Glass
This isn't strictly needed, but with UPL we use the reserved-memory nodes to indicate where the SMBIOS table is. Tianocore requires 4KB alignment on these regions, so it is easier to adjust the alignment to match. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22x86: Move tables to use SZ macrosSimon Glass
Update the tables to use linux/sizes rather than open-coped values. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-01-22x86: Enable UPL handoff for SPLSimon Glass
Add the GD_FLG_UPL so that a UPL-handoff is created. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22x86: Support jumping to a UPL imageSimon Glass
Add a function to allow x86 boards to jump to a UPL images. Currently only 32-bit entry is supported. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22x86: Show an error if video failsSimon Glass
If video is enabled we expect it to work. Avoid silent failure by adding a panic if things go wrong. Expand the SPL malloc-area for qemu-x86_64 to avoid a panic. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22emulation: Use bloblist to hold tablesSimon Glass
QEMU can have its own internal ACPI and SMBIOS tables. At present U-Boot copies out the SMBIOS tables but points directly to the ACPI ones. The ACPI tables are not aligned on a 4KB boundary, which means that UPL cannot use them directly, since it uses a reserved-memory node for the tables and that it assumed (by EDK2) to be 4KB-aligned. On x86, QEMU provides the tables in a mapped memory region and U-Boot makes use of these directly, thus making it difficult to use any common code. Adjust the logic to fit within the existing table-generation code. Use a bloblist always and ensure that the ACPI tables is placed in an aligned region. Set a size of 8K for QEMU. This does not actually put all the tables in one place, for QEMU, since it currently adds a pointer to the tables in QFW. On ARM, enable bloblist so that SMBIOS tables can be added to the bloblist. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22boot: Use fit_image_get_data() to get dataSimon Glass
Use this function instead of fit_image_get_emb_data() data, since it works will FITs that use external data. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22boot: Rename fit_image_get_data()Simon Glass
This function can only be used with FITs that use embedded data. Rename it so this is clear. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-01-22x86: Show the timestamp counter with bdinfoSimon Glass
Add a line to the 'bdinfo' command which shows the current value of the TSC. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22cpu: Provide a way to get the physical-address sizeSimon Glass
This concept exists on x86. Declare it as a generic function so that the value can be accessed by UPL. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-12-18arch: x86: lib: Add support of legacy 64-bit entry point at 0x200Paul HENRYS
Support of legacy 64-bit entry point was already present when booting a bzimage with 'zboot' but not supported with 'bootm' when the x86_64 Linux kernel is embedded in a FIT image. Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-12-02Revert "global_data: Drop spl_handoff"Simon Glass
This breaks chromebook_coral which says: Video: No video mode configured in FSP! This reverts commit 2e9313179a846b581c0fc3f6a49e19f3d343efa8. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-24dm: Add dm_remove_devices_active() for ordered device removalJanne Grunau
This replaces dm_remove_devices_flags() calls in all boot implementations to ensure non vital devices are consistently removed first. All boot implementation except arch/arm/lib/bootm.c currently just call dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL). This can result in crashes when dependencies between devices exists. The driver model's design document describes DM_FLAG_VITAL as "indicates that the device is 'vital' to the operation of other devices". Device removal at boot should follow this. Instead of adding dm_remove_devices_flags() with (DM_REMOVE_ACTIVE_ALL | DM_REMOVE_NON_VITAL) everywhere add dm_remove_devices_active() which does this. Fixes a NULL pointer deref in the apple dart IOMMU driver during EFI boot. The xhci-pci (driver which depends on the IOMMU to work) removes its mapping on removal. This explodes when the IOMMU device was removed first. dm_remove_devices_flags() is kept since it is used for testing of device_remove() calls in dm. Signed-off-by: Janne Grunau <j@jannau.net>
2024-10-27x86: Missed removal of CMD_BOOTEFI_HELLO_COMPILEAndrew Goodbody
The config setting CMD_BOOTEFI_HELLO_COMPILE was removed in favour of BOOTEFI_HELLO_COMPILE but the usage in this Makefile was not updated. Fix it. Fixes: 6fe80876dcc7 ("efi_loader: Rename and move CMD_BOOTEFI_HELLO_COMPILE") Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2024-10-27Merge patch series "Implement ACPI on aarch64"Tom Rini
Patrick Rudolph <patrick.rudolph@9elements.com> says: Based on the existing work done by Simon Glass this series adds support for booting aarch64 devices using ACPI only. As first target QEMU SBSA support is added, which relies on ACPI only to boot an OS. As secondary target the Raspberry Pi4 was used, which is broadly available and allows easy testing of the proposed solution. The series is split into ACPI cleanups and code movements, adding Arm specific ACPI tables and finally SoC and mainboard related changes to boot a Linux on the QEMU SBSA and RPi4. Currently only the mandatory ACPI tables are supported, allowing to boot into Linux without errors. The QEMU SBSA support is feature complete and provides the same functionality as the EDK2 implementation. The changes were tested on real hardware as well on QEMU v9.0: qemu-system-aarch64 -machine sbsa-ref -nographic -cpu cortex-a57 \ -pflash secure-world.rom \ -pflash unsecure-world.rom qemu-system-aarch64 -machine raspi4b -kernel u-boot.bin -cpu cortex-a72 \ -smp 4 -m 2G -drive file=raspbian.img,format=raw,index=0 \ -dtb bcm2711-rpi-4-b.dtb -nographic Tested against FWTS V24.03.00. Known issues: - The QEMU rpi4 support is currently limited as it doesn't emulate PCI, USB or ethernet devices! - The SMP bringup doesn't work on RPi4, but works in QEMU (Possibly cache related). - PCI on RPI4 isn't working on real hardware since the pcie_brcmstb Linux kernel module doesn't support ACPI yet. Link: https://lore.kernel.org/r/20241023132116.970117-1-patrick.rudolph@9elements.com
2024-10-27acpi: x86: Move MADT to common codePatrick Rudolph
Write MADT in common code and let the SoC fill out the body by calling acpi_fill_madt() which must be implemented at SoC level. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com>
2024-10-27acpi: x86: Write FADT in common codeMaximilian Brune
Write the FADT in common code since it's used on all architectures. Since the FADT is mandatory all SoCs or mainboards must implement the introduced function acpi_fill_fadt() and properly update the FADT. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com>
2024-10-27acpi: x86: Move SPCR and DBG2 into common codeMaximilian Brune
This moves the SPCR and DBG2 table generation into common code, so that they can be used by architectures other than x86. Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com>
2024-10-18x86: cpu: Use default print_cpuinfo() for allAndy Shevchenko
Most of the copies of the print_cpuinfo() call the default method. Remove all of those in order to have only the default one when no `cpu` command is compiled. This also helps avoiding compiler warning, e.g.: arch/x86/cpu/tangier/tangier.c:23:5: warning: no previous prototype for ‘print_cpuinfo’ [-Wmissing-prototypes] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>