aboutsummaryrefslogtreecommitdiff
path: root/stand/efi
Commit message (Collapse)AuthorAgeFilesLines
* stand: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2714-14/+2
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* stand/efi: Consolidate integer typesWarner Losh2023-11-227-354/+31
| | | | | | | | We have no need for 5 different copies of these. Sponsored by: Netflix Reviewed by: rcm, kevans, andrew Differential Revision: https://reviews.freebsd.org/D42699
* stand/efi: Define ACPI_USE_SYSTEM_INTTYPES to be 1 instead of blankWarner Losh2023-11-211-1/+1
| | | | | | | | | To avoid a redefinition warning... This needs to be redone correctly, but this gets amd64 building again... My amd64 environment is polluted with something that caues earlier failures which I ignored... Fixes: 488bc7e9a777 Sponsored by: Netflix
* stand/efi: Request ACPI use the system inttypesWarner Losh2023-11-211-0/+1
| | | | | | | | With the system inttypes, we build on all platforms again. Suggested by: andrew Fixes: 0b01d45783c3 Sponsored by: Netflix
* loader: fix EFI ACPI detectionR. Christian McDonald2023-11-203-97/+43
| | | | | | | | | | | | | | lua was previously unable to determine ACPI presence because this probing was postponed until the final loading and execution of the kernel. This patch resolves that by detecting ACPI early (similar to the order of operations in the legacy i386 loader). Reviewed by: kevans Approved by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42459
* stand: Rename LIBFDT to LIBSAFDTMark Johnston2023-11-071-2/+2
| | | | | | | | | | | Preemptively address a collision with LIBFDT (to be added in the future) from src.libnames.mk, which gets included via bsd.progs.mk. No functional change intended. Reviewed by: imp MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D42486
* loader: add target for dirdeps buildStephen J. Kiernan2023-11-027-5/+27
| | | | | | | | Update dependencies for the loader variations used for each architecture. Reviewed by: sjg Differential Revision: https://reviews.freebsd.org/D39741
* dirdeps: Add missing dependency filesStephen J. Kiernan2023-10-292-0/+34
| | | | | Some leaf directories were missing Makefile.depend files or needed architecture-specific Makefile.depend.* files.
* stand/loader.efi: fix regression with ignoring nvstoreGleb Smirnoff2023-09-111-1/+1
| | | | | | | | | | | | | | To read/update the boot loader nvstore, we always need to call zfs_attach_nvstore() regardless of whether we use bootonce key in nvstore or the bootfs property of the pool. The call was unintentionally left in the block of code that is processed only when bootonce key is present. In particular this fixes broken 'nextboot -k'. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D41795 Fixes: e3e2681d0ec28d6661fef6da76c9479049e2761c
* Remove $FreeBSD$: one-line bare tagWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-1618-18/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1635-70/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-1646-46/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1619-38/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* stand: Export _start on arm like other architecturesJessica Clarke2023-08-051-0/+1
| | | | | | | | | | | | | | | By not exporting _start, we get various warnings of the form: ld: warning: cannot find entry symbol _start Note that in practice these don't matter because we manually construct our PE header and use objcopy -O binary, so the entry point is set to whatever we put explicitly in the PE header, but we should still do the right thing and silence these warnings. This was found in CheriBSD, where bsd.prog.mk has similar logic to bsd.lib.mk and sets -Wl,--(no-)fatal-warnings based on LD_FATAL_WARNINGS (unlike FreeBSD which only does so in the latter).
* Stand: Silence undefined symbols check commandVexedUXR2023-07-012-2/+2
| | | | | | | No need to print this... Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/786
* efi loader: Move 'module' variable under #ifdef MODINFOMD_MODULEP.John Baldwin2023-06-271-2/+6
| | | | | | | This quiets a set but unused warning on platforms without this module info such as aarch64. Differential Revision: https://reviews.freebsd.org/D40672
* loader.efi: Remove redundant error messageVexedUXR2023-06-261-3/+1
| | | | | | | efi_copy_init already prints an error message (with more information) if it fails. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/777
* bug: efi_print_global only checks for the first 5 letters of "Driver"Alfonso Gregory2023-06-231-1/+1
| | | | | | | | As a result, it is only really checking for the word Drive, making "Drive" appended to anything else considered for efi env. Reviewed by: imp, kevans Pull Request: https://github.com/freebsd/freebsd-src/pull/738
* Add comments for memory sizeVexedUXR2023-06-121-1/+1
| | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/753
* Add boot1.efi to CLEANFILESVexedUXR2023-06-121-0/+2
| | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/775
* stand/boot1.efi: use the bootonce dataset as root datasetGleb Smirnoff2023-06-081-12/+42
| | | | | | | | | | | | | Before this change we would only pass the bootonce dataset name to the environment for the next loader, while actually reading the next stage loader from the 'bootfs' dataset, not the bootonce dataset. Another problem fixed by this change is a boot from a configuration when bootonce attribute is present, but 'bootfs' property is not set. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D40389
* stand/loader.efi: read zfs bootonce attribute before checking currdevGleb Smirnoff2023-06-081-11/+6
| | | | | | | | | | First check if bootonce is configured and if it is, then change currdev accordingly and after that do the sanity check. This fixes boot in a situation when ZFS pool doesn't have the "bootfs" property, but has bootonce attribute set. A strange, but legitimate case. Reviewed by: tsoome, imp Differential Revision: https://reviews.freebsd.org/D40388
* stand: libefi: avoid a null pointer deref in eficomKyle Evans2023-05-281-2/+2
| | | | | | | | | | | We don't keep comc_port around anymore if the console's not present, but some things might still try to set one of the environment variables we hook. In particular, one need not even set efi_com_port/efi_com_speed in loader.conf; loader may do it itself and induce the crash if ConOut depicts an available uart. Probably reported by: dch OK for now: imp
* stand/efi/eficom: Free comc_port if we can't find the serial portWarner Losh2023-05-251-0/+10
| | | | | | | | | If we can't find the serial port, free comc_port and return early. The serial port just isn't there. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D40223
* stand/efi/eficom: Make aarch64 compat code probe correctlyWarner Losh2023-05-251-2/+5
| | | | | | | | | Make the compat code more correct by probing using the eficom console structure, not the comconsole one. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D40222
* stand/efi/eficom: Don't allow this for !HYPERV machinesWarner Losh2023-05-251-0/+17
| | | | | | | | | If the machine isn't hyperv on amd64, then this driver fails the probe and will do nothing further now, even if explicitly listed in a config. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D40221
* stand/efi/eficom: better handling of absent deviceWarner Losh2023-05-251-5/+16
| | | | | | | | | | Don't even have a comc_port when the port doesn't exist: always free it if we probe that it's not there. Also, when it's not present, clear the flags indicating presence to avoid disturbing other flags. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D40220
* stand/efi/smbios: Move detection of smbios earlier.Warner Losh2023-05-251-16/+16
| | | | | | | | | | It would be nice to make decisions early in boot, about maybe consoles, based on smbios variables. Set them just after we setup the archsw so we can use them everywhere. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D40219
* libefi: add efi_devpath_next_instance()Toomas Soome2023-05-132-0/+18
| | | | | | | | | | | | | | | | | | | | | | UEFI device path may be path to one device, or concatenated list of instances to different devices (textually represented as comma separated list). Provide generic function to get next instance from device path. Returns next instance or end node. The use case is like: EFI_DEVICE_PATH *node = (EFI_DEVICE_PATH *)buf; while (!IsDevicePathEnd(node)) { process(node); node = efi_devpath_next_instance(node); } Where buf is pointing to either single device path or concatenated list of device paths (such as from ConIn or ConOut). Reviewers: imp Differential Revision: https://reviews.freebsd.org/D40081
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-122-2/+2
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* stand/efi: Retire i386 supportWarner Losh2023-05-1111-388/+12
| | | | | | | | Remove the i386 ifdefs and files. It never worked. Sponsored by: Netflix Reviewed by: manu, tsoome, kevans Differential Revision: https://reviews.freebsd.org/D40012
* stand: eficom: Only set baudrate when it changesWarner Losh2023-05-111-17/+22
| | | | | | | | | | | | Only set the baudrate when it is different than what the device has reported. In addition, pass in the args to effect no change to the other parameters to the serial port. Some EFI firmware gets cranky when you set them to the same value, so avoid doing so (we likely can remove the HyperV workaround with this fix, but I kept it in place). Add comments to the code for why we do this too. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D40010
* stand: eficom: Don't preemtively assume flow controlWarner Losh2023-05-111-9/+5
| | | | | | | | | | | | Remove rtsdtr_off. It's basically unused. Expand its meaning, but put changing flow control to under an ifdef. We shouldn't set it unless we're sure we need to do so. UEFI normally initializes the device correctly, and we should avoid needless changes that aren't user requested. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D40009
* stand: eficom : remove unused ignore_cdWarner Losh2023-05-111-2/+0
| | | | | | Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D40008
* stand: Move eficom to libefiWarner Losh2023-05-116-6/+1
| | | | | | | | | | | | Rename efiserialc to eficom.c and move it to libefi. Remove loader.efi.h, since it's not needed. It's architecture independent (though how we use it might vary). Drivers also belong in libfoo in the boot loader: all the BIOS drivers are in i386/libi386 and the console driver is in efi/libefi. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D40007
* stand: add comconsole backwards compatibility shim for aarch64Warner Losh2023-05-112-0/+32
| | | | | | | | | | | | Add a compat shim for the "comconsole" name so that people with a "console=comconsole" in their loader.conf on aarch64 will continue to work (though with a warning). This is only aarch64: it will never be there for amd64 (where comconsole always means talk to the hardware directly). To do that is too hard. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D39983
* stand: efi create eficom console device.Warner Losh2023-05-112-58/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the 'renaming kludge' that we absolutely cannot do going forward (it's cost us days of engineering time). console=comconsole talks to the hardware directly. This is available only on amd64. It is not available anywhere else (and so requires changes for people doing comconsole on aarch64) console=eficom talks to the console via EFI protocols. It's available on amd64, aarch64 and riscv64. It's the first port that we find, though it can be overriden by efi_com_port (which should be set to the UID of the serial port, not the I/O port, despite the name). devinfo -v will give the UID to uartX mapping. This is an incompatible change for HYPER-V on amd64. It only works with eficom console, so you'll need to change your configuration in loader.conf. No compatibility hack will ever be provided for this (since it requires renamig, which the loader cannot reliably do). It's also an incompatible change for aarch64. comconsole will need to change to eficom. There might be a comconsole "shim" for this. All the interlock to keep only eficom and comconsole from both attaching have been removed. RelNotes: Yes Sponsored by: Netflix Discussed with: kevans Differential Revision: https://reviews.freebsd.org/D39982
* loader: install help files only onceEd Maste2023-05-102-0/+2
| | | | | | | | | | | | | | Every file should be installed exactly once by `make installworld`. This is especially important for pkgbase. Loader help files were being installed by each loader variant (e.g., the simp, lua, and 4th EFI loaders). Add a (slightly hacky) mechanism to skip installing help files for all but one variant. PR: 271178 Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40021
* stand/efi: Simplify code hereWarner Losh2023-05-011-11/+8
| | | | | | | | | We have plenty of stack in the EFI case, so use it instead of the complicated malloc / free dance. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D39415
* stand/boot1.efi: Implement bootonce for ZFSWarner Losh2023-05-011-1/+26
| | | | | | | | | | | | | | Implement ZFS bootonce protocol. We pass zfs-bootonce=t to the next boot stage as a command line argument. Unlike zfsboot -> loader handoff in the BIOS case, we don't use the OS_BOOTONCE_USED. This would require modifications to loader.efi which would only server to make it more complicated. Instead, use the command line parsing interface for the boot1.efi -> loader.efi to pass in the zfs-bootonce kenv that will be needed by rc.d/zfsbe to activate the BE if boot progresses that far. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D39412
* stand/boot1.efi: Allow modules to add env variablesWarner Losh2023-05-012-0/+23
| | | | | | | | | | Sometimes filesystem modules need to pass details of the state of the filesystem to later stages of a boot. Provide a generic method to do so. We'll add them after any env variables set in our config files. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D39407
* Note that static hints no longer break loader hintsKyle Evans2023-04-261-5/+3
| | | | | | | | | | | This commentary was carried over from the x86 version of the same code, but has actually been inaccurate for a while now. As of FreeBSD 12.x, all environments are used unless they disable each other. See 39d44f7f15c ("kern_environment: use any provided environments [...]") for details. Reviewed by: imp Differentiala Revision: https://reviews.freebsd.org/D35695
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-192-4/+0
|
* loader.efi: Fix some arm64 PE metadataMark Johnston2023-04-182-22/+29
| | | | | | | | | | | | | | - Mark the file as an executable in the COFF header. - Provide separate .text and .data sections. - Provide sane file and section alignment values. These values are the defaults defined in the PE specification. - Set appropriate characteristics for each of .text and .data. This is required for the MS devkit to load our UEFI image. Obtained from: OpenBSD via allanjude MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D37765
* gptboot.efi.8: Fix a typoMateusz Piotrowski2023-04-131-2/+2
|
* amd64 loader: plug hard hang with serial console enabledGleb Smirnoff2023-03-311-0/+2
| | | | | | | | | | The hang basically bricks a physical box and it can be recovered only if you are able to boot from alternate media. This isn't a perfect fix, but throw it in before loader experts decide on proper one. Submitted by: whu Fixes: 927358dd98cb902160093e0dc0bac002d6b43858
* amd64 loader: Use efiserialio for Hyper-V booted systemsWei Hu2023-03-184-7/+54
| | | | | | | | | | | | | | | | | | | | | | | UEFI provides ConIn/ConOut handles for consoles that it supports, which include the text-video and serial ports. When the serial port is available, use the UEFI driver instead of direct io-port accesses to avoid conflicts between the firmware and direct hardware access, as happens on Hyper-V (Azure) setups. This change enables efiserialio to be built for efi-amd64 and has higher order priority vs comconsole, and only uses efiserialio if the hypervisor is Hyper-V. When efiserialio successfully probes, it will set efi_comconsole_avail=true which will prevent comconsole from probing in this setup. Tested on Hyper-V, ESXi and Azure VMs. PR: 264267 Reviewed by: kevans, whu Tested by: whu Obtained from: Rubicon Communications, LLC (Netgate) MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate)