aboutsummaryrefslogtreecommitdiff
path: root/stand/efi
Commit message (Collapse)AuthorAgeFilesLines
* loader: Only warn when we have neither FDT nor ACPIWarner Losh2026-01-081-1/+2
| | | | | | Sponsored by: Netflix Reviewed by: adrian, andrew Differential Revision: https://reviews.freebsd.org/D54510
* loader.efi: Only use SPCR if enabled.Jarmo Jaakkola2026-01-081-5/+9
| | | | | | | | | | | | | | | | | | SerialPort in the SPCR is zeroed when serial redirection is disabled, rather than the SPCR being omitted from the ACPI tables ony many systems. Check to see that SerialPort.Address is non-zero before using. FreeBSD would fail to boot on systems that could have a serial port redireciton, but don't have it enabled because the loader would create a bogus hw.uart.console. While one could unset this value to boot, you couldn't do that automatically very easily. Instead, don't even look at the SPCR table if the SerialPort is zero'd. PR: 292206 MFC After: 3 days Sponsored by: Netflix Co-authored-by: Warner Losh <imp@FreeBSD.org> Closes: https://github.com/freebsd/freebsd-src/pull/1948
* loader.efi: add stride & offset for MacBookPro3,1Frank Hilgendorf2026-01-061-0/+17
| | | | | | | | Note that there are three variants of this MacBook. We only have the stride and offset values for the 17" 1680x1050 model. Reviewed by: vexeduxr Pull Request: https://github.com/freebsd/freebsd-src/pull/1584
* loader.efi: probe for UGA if GOP isn't foundAhmad Khalifa2026-01-041-36/+38
| | | | | | | | | Probe for UGA instead of returning early if we can't find GOP. Reviewed by: tsoome PR: 291935 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54431
* loader: Use C99 initializations for file_formatWarner Losh2025-12-284-8/+14
| | | | | | For greppability, use C99 initializers for the struct file_format. Sponsored by: Netflix
* stand: Rename ZFSSRC to SAZFSSRC to avoid confusionWarner Losh2025-11-253-3/+3
| | | | | | | | | ZFSSRC is abiguous on its surface and too clos to ZFSTOP, so rename it to SAZFSSRC. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D53901
* stand: Update riscv efi booting to edk2 includesWarner Losh2025-11-171-1/+5
| | | | | | | | | | | | Update to include the right includes for the riscv protocol to get the hypervisor details. Note: I expanded the GUID inline rather than using a #define because there was none. This is only listed in UefiCpuPkg/UefiCpuPkg.dec, so include it here inline until we can automate using those files. Fixes: 43b8edb32051 Sponsored by: Netflix
* edk2: Fix fdt buildWarner Losh2025-11-162-0/+3
| | | | | | | | | x86 doesn't use FDT things by default, but aarch64 does. I thought I'd built the loader on aarch64 to test the EDK2 all the things series, but apparently not. This fixes the aarch64 build. Fixes: 43b8edb32051 Sponsored by: Netflix
* stand: Cut over to using the EDK2 filesWarner Losh2025-11-1650-7426/+282
| | | | | | | | | | | | | | | | | | | | | | Remove the old EFI SDK files that we've been nursing along for too many years. Replace them with files from EDK2 edk2-stable202502 and tweak the interfaces we need to tweak. Mostly include different things or change the names of the protocols that no longer have old-school compat names. I gave up in the middle of env.c, too damn tedious to find all those new GUIDs. Also, many of the guids were mystery meat, most likely from the EDK2 sources, but just not the Include subdirectory. Need to investigate those. And the memory info? Is it just an oboslete thing, or embedded knowledge of EDK2. Delete the now-redundant copies of things in Guid and Protocol. I debated keeping ZeroGuid.h, but EDK2 has moved on from when I snagged it years ago (or maybe I just invented it out of whole cloth: edk2 does radically different things today and I didn't do the git deep-dive to find out). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D53655
* stand: switch the loader over to using efi-edk2.hWarner Losh2025-11-166-804/+9
| | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D53652
* stand: Rename EFI_ERROR_CODE to DECODE_ERROR to avoid Edk2 ClashWarner Losh2025-11-1618-40/+40
| | | | | | | | This follows what Illumos has done. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D53656
* loader: Move ACPI RSDP detectionkpowkitty2025-09-144-40/+116
| | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1843
* loader.efi: Properly scope variableWarner Losh2025-09-131-1/+1
| | | | | | | guid here is only used for EFI_ZFS_BOOT, so move the ifdef. Noticed by: wosch and clang 20 Sponsored by: Netflix
* loader.efi: improve StartImage error messageToomas Soome2025-09-111-2/+11
| | | | | | | | | | StartImage() may return additional data from failure. This data has text message followed by optional binary blob. Print out the text message (if present) and free the data. See 7.4.2 EFI_BOOT_SERVICES.StartImage() page 199 UEFI_Spec_Final_2.11.pdf. Reviewed by: imp
* loader/efi: fix non-x86 buildAhmad Khalifa2025-09-102-1/+3
| | | | | Pointy hat to: vexeduxr Reported by: Bakul Shah
* efi: translate errno to EFI status on exitAhmad Khalifa2025-09-092-3/+3
| | | | | Translate the given errno to an efi status instead of always exiting with EFI_LOAD_ERROR.
* loader/efi: remove is_last parameter from find_currdevAhmad Khalifa2025-09-091-6/+3
| | | | | | | It is unused. Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D52434
* loader/efi: plug memory leakAhmad Khalifa2025-09-091-0/+2
| | | | | Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D52433
* loader/efi: return error from efi_find_framebufferAhmad Khalifa2025-09-091-2/+5
| | | | | | | | Also return actual errno values in other code paths. (suggested by tsoome) Reviewed by: tsoome, imp Differential Revision: https://reviews.freebsd.org/D52432
* stand: remove unused variablesAhmad Khalifa2025-09-095-11/+4
|
* loader/efi: build with -WallAhmad Khalifa2025-09-091-0/+1
| | | | | Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D52431
* stand: use a common function in gfx_fb for setting up teken colorsKyle Evans2025-08-221-22/+1
| | | | | | | | | | These are basically identical, with exception to the hook installed which is specific to the loader we're building by necessity. Pull these out into common/gfx_fb.c and just parameterize the hooks to make it easier to change the logic. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D50886
* stand/efi: Fix a typo in a source code commentGordon Bergling2025-08-172-2/+2
| | | | | | - s/externel/external/ MFC after: 3 days
* stand: Add print_delay environment variable in loaderAymeric Wibo2025-07-211-0/+3
| | | | | | | | | | | This adds support for a new `print_delay` environment variable, which inserts a delay in microseconds when `putchar` encounters a newline character. This can be useful when debugging. Reviewed by: markj, imp, ziaee, mckusick (mentor) Approved by: markj, imp, ziaee, mckusick (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50832
* Allow net_cleanup for loader.efiSimon J. Gerraty2025-07-106-17/+33
| | | | | | | | | | | | | | | While netbooting with loader.efi on at least one arm64 platform which uses u-boot emulating UEFI, the kernel gets corrupted, we suspected the u-boot ethernet driver was still running. Use netdev.dv_cleanup for efinet_dev to address this. This in turn requires calling dev_cleanup() before bi_load() to avoid a loader crash since bi_load() calls ExitBootServices. Reviewed by: imp Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D51186
* loader: Add halt as an alias to poweroff machineTom Jones2025-07-041-0/+1
| | | | | | | | | Add halt as an alias to also poweroff a machine from the loader prompt, this is consistent with ddb. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51132
* machine/stdarg.h -> sys/stdarg.hBrooks Davis2025-06-113-3/+9
| | | | | | | | | | | | | Switch to using sys/stdarg.h for va_list type and va_* builtins. Make an attempt to insert the include in a sensible place. Where style(9) was followed this is easy, where it was ignored, aim for the first block of sys/*.h headers and don't get too fussy or try to fix other style bugs. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
* stand: Introduce md_alignWarner Losh2025-05-301-6/+6
| | | | | | | | | | | | | | When we're loading metadata, we need to align it in a certain way. Right now that way is hard-coded to be PAGE_SIZE. Rather than do the actual physical thing in all these places, move this into a wrapper routine. We may want to load a 16k kernel and align all these on 16k or a 4k kernel and align on 4k on aarch64 (today you have to compile the loader with the right page size). This will also reduce the number of places we might have to touch to do that. Sponsored by: Netflix Reviewed by: tsoome, jhibbits Differential Revision: https://reviews.freebsd.org/D50585
* stand/efi: Use EFI_PAGE_SIZE here, it's more appropriateWarner Losh2025-05-301-2/+2
| | | | | | | | | | | | | | | | No functional change: We're allocating a page from EFI, which is always 4k on amd64. So, this should always be 4k. PAGE_SIZE usually is this, but might not be in some cases. For the end of the stack pointer in the ist1, it should point the architecture's physical page past where we've allocated. EFI_PAGE_SIZE more faithfully reflects that here since PAGE_SIZE might not be exactly that in the future (if we had a larger logical page than physical page). Since the AllocPage interface is in EFI_PAGE_SIZE pages always, this seems safer. No functional change since they are both 2096 today. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D50584
* stand/efi: Initialize archsw at compile timeWarner Losh2025-05-261-11/+11
| | | | Sponsored by: Netflix
* stand allow for local.defs.mkSimon J. Gerraty2025-05-221-1/+1
| | | | | | | | | | | This allows us to change the VERSION_FILE used for loaders as well as set NEWVERS_DATE and BUILD_UTC to reflect the publish date of loaders for secure-boot. Sponsored by: Juniper Networks, Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D50478
* loader - guard against empty rootdevSimon J. Gerraty2025-05-201-1/+1
| | | | | | | | | | At least one instance of u-boot pretending to be EFI is passing empty rootdev to loader which does not end well. A simple precaution is harmless. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D50334
* loader/efi: strip trailing whitespaceWarner Losh2025-04-1119-259/+258
| | | | | | | | | Many of these no-doubt are in upstream, but they are interfering with the filters I use to judge commits (no traling whitespace). We don't directly get stuff from upstream. If/when we pull this from contrib we'll revisit. Sponsored by: Netflix
* loader/libefi: Fix trivial trailing whitespaceWarner Losh2025-04-115-14/+14
| | | | Sponsored by: Netflix
* loader/efi: Fix trivial whitespace errorWarner Losh2025-04-113-4/+4
| | | | Sponsored by: Netflix
* boot: Fall back to objcopy if usable for EFI componentsEd Maste2025-04-091-0/+15
| | | | | | | | | | | | | | | | In commit b885643b63e4 ("boot: Always use ELF Tool Chain elfcopy for EFI builds") I switched to using elfcopy for EFI_OBJCOPY, as llvm-objcopy lacks support for translating ELF objects to PE32+. This broke building on older releases with WITHOUT_ELFTOOLCHAIN_BOOTSTRAP set, as the host did not provide elfcopy and it was not built as a bootstrap tool. Now, if we're not bootstrapping ELF Tool Chain we check the output of `${OBJCOPY} --version`, and will use that ${OBJCOPY} as long as it is not llvm-objcopy. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49722
* boot: Always use ELF Tool Chain elfcopy for EFI buildsEd Maste2025-03-233-2/+3
| | | | | | | | | | | | | | | | We now use llvm-objcopy by default (as of commit 1cae7121c667), but it does not support efi-app-x86_64 and similar ouptut formats (for more detail see LLVM issue 108609[1]). Go back to installing ELF Tool Chain's version of objcopy as elfcopy (the standard upstream name) and use it for EFI builds. [1] https://github.com/llvm/llvm-project/issues/108609). PR: 280771 Reviewed by: andrew Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49362
* loader.efi: smbios: Favor the v3 (64-bit) entry pointOlivier Certner2025-03-111-15/+36
| | | | | | | | | | | | | | | Be consistent with what we are now doing with non-EFI boot (but with the difference that EFI runs in 64-bit mode on 64-bit platforms, so there is no restriction that the v3 entry point should be below 4GB). While here, move out the EFI smbios detection code in a separate sub-routine. Reviewed by: imp, markj MFC after: 2 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49292
* riscv/stand: pass boot hart in loader metadataMitchell Horne2025-03-031-0/+25
| | | | | | | | | | | | | | | | | Use the RISCV_EFI_BOOT_PROTOCOL to fetch the boot hart ID, and communicate this to the kernel via new metadata field (MODINFOMD_BOOT_HART). If the boot hart is not found this way, fall back to the (now deprecated) device-tree method. The assumption that a hart ID can be represented with a 32-bit unsigned integer is unchanged in the kernel, but from the loader we pass the full 64-bit value. This ensures that this API won't need to change in the future, should the wider value become necessary. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48887
* efiprot.h: add definitions for RISCV_EFI_BOOT_PROTOCOLMitchell Horne2025-03-031-0/+27
| | | | | | | | | | | | It seems like this file was vendored (sorta) originally, but we have not kept it in sync with the original source, if it still exists. Follow the precedent in commit acf82d2659879, and just add the definition to the bottom of the file, keeping its style conventions. Defined here: https://github.com/riscv-non-isa/riscv-uefi Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48885
* riscv: enable EFI framebufferMitchell Horne2025-03-031-1/+1
| | | | | | | | | | | | | Pass framebuffer information from loader(8) to the kernel via the MODINFOMD_EFI_FB metadata field. Enable the vt_efifb driver. A small tweak is required to work around the lack of VM_MEMATTR_WRITE_COMBINING on this platform; we use VM_MEMATTR_UNCACHEABLE instead. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48884
* loader.efi: add "gop blt <on|off>" commandToomas Soome2025-02-201-3/+23
| | | | | | | | | | | | | | | | | | | Some systems have very slow console output and it may be about either wrong memory attributes are set or gop->Blt() implementation is bad. We do not have good way to set memory attributes, but we can choose which Blt() to use (or we can set "gop off" to fall back on use of SimpleTextOutput protocol). This update adds argument for "gop" command to switch gop->Blt() use. Note, this update does not fix the problem, but allows us to try to understand the possible cause. PR: 254381 Reported by: Michael Galassi Reviewed by: manu, imp Differential Revision: https://reviews.freebsd.org/D49073
* stand: use globals for the kernel and module typesAhmad Khalifa2025-01-242-5/+6
| | | | | Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1394
* stand: remove unnecessary checks for "elfN kernel"Ahmad Khalifa2025-01-241-2/+0
| | | | | | | | We never set the kernel type to either "elf64 kernel" nor "elf32 kernel". Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1394
* stand/efi: Limit where we load the arm64 kernelAndrew Turner2025-01-241-2/+13
| | | | | | | | | | | | When FEAT_LPA2 is implemented the hardware supports increasing the physical address space from 48-bit to 52-bit. As older kernels only support a 48-bit physical address space limit where the kernel is loaded to this. Reviewed by: kib, markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46625
* stand/efi: Add more pl011-like uartsAndrew Turner2025-01-231-0/+2
| | | | | | | | | The Arm SBSA uarts are handled by the pl011 driver. Add them to the list of pl011 uarts. Reviewed by: manu, imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48526
* stand/efi: Use hex values to get the uart typeAndrew Turner2025-01-231-4/+4
| | | | | | | | | To keep the SPCR uart type to name map aligned always use the hex value as an index in the types array. Reviewed by: manu, imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48525
* stand/efihttp: Add device type check to efihttp_fs_open()Yongbo Yao2025-01-191-0/+2
| | | | | | | | | Ensure the open operation targets an HTTP device. Return EINVAL if not, to prevent potential system crashes when used on other devices. Differential Revision: https://reviews.freebsd.org/D48439 Reviewed by: dab, imp, vangyzen Sponsored by: Dell Technologies
* loader: remove check for 2M alignmentAhmad Khalifa2024-12-051-5/+0
| | | | | | | | Instead of listing every arch we support, always define EFI_STAGING_2M_ALIGN to 1. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
* stand/elf64_freebsd.c: use headers instead of doing things ourselvesAhmad Khalifa2024-12-051-48/+56
| | | | | | | | Try our best to use headers instead of doing things ourselves. With i386's headers, there are some holes we need to fill manually. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1446