aboutsummaryrefslogtreecommitdiff
path: root/stand/efi
Commit message (Collapse)AuthorAgeFilesLines
* amd64 loader: Use efiserialio for Hyper-V booted systemsWei Hu10 days4-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)
* Support SMBIOS v3 for 64-bit entry systemsJohn-Mark Gurney2023-02-221-1/+2
| | | | | | | | | | | | Summary: Under QEMU on arm64 systems, the smbios table is above 4GB requiring a 64-bit address to access. Reviewers: manu Subscribers: imp, bcran, dab Differential Revision: https://reviews.freebsd.org/D38721
* Skip EFI framebuffer information if there is noneSimon J. Gerraty2023-02-061-9/+12
| | | | | | | Avoid several lines of useless info if there is no EFI framebuffer Reviewed by: stevek, imp Differential Revision: https://reviews.freebsd.org/D38393
* loader.efi: include help.fdt for FDT-enabled loaderMitchell Horne2023-02-031-0/+1
|
* loader: always install help filesMitchell Horne2023-02-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address two issues with current help file logic: The existing condition prevents the common help file from being installed when there are no additional help files defined. This results in no loader.help on EFI platforms, for example. Second, due to the fact that we build and install multiple loader types, each successive install will clobber the previous loader.help. The result is that we could lose type-specific commands, or possibly list them in loaders that do not have such commands. Instead, give each loader type a uniquely named help file. The EFI loader will look for /boot/loader.help.efi, userboot will look for /boot/loader.help.userboot, etc. The interpreter variant has no effect on which help file is loaded. This leaves the old /boot/loader.help unused. Some credit for the final approach goes to Mathieu <sigsys@gmail.com> for their version of the fix in https://reviews.freebsd.org/D22951. PR: 267134 Reported by: Daniel O'Connor <darius@dons.net.au> Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28591
* stand: share bootinfo.c between EFI and KBOOTWarner Losh2023-02-031-2/+4
| | | | | | | | | | | | | | | Connect efi's bootinfo.c to the kboot build, and adjust to use the kboot specific routines. The getrootmount() call is independent of EFI. Remove ifdefs so it's called for kboot too. The differences between the kboot and efi bootinfo.c files are now tiny. This could use some more refactoring, but this is a working checkpoint. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D38350
* efiserialio: use port settings (sio->Mode) for initial setupToomas Soome2023-02-031-16/+22
| | | | | | | | | | Use serial port setup done by system firmware. ARM64 Hyper-V does hung if we attempt to override the defaults, therefore we should default to use settings from firmware. Tested by: schakrabarti@microsoft.com PR: 266248 MFC after: 1 week
* stand: create common set_currdevWarner Losh2023-01-111-14/+0
| | | | | | | | | | | | Pull together the nearly identical copies of set_currdev in i386, userboot and efi. Other boot loaders have variances that might be fine to use the common routine, or not. Since they are harder to test for me, and ofw and uboot do handle these setting differently, leave them be for now. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38005
* stand: Create common gen_setcurrdev and replace codeWarner Losh2023-01-113-21/+2
| | | | | | | | | | Replace 4 identical copies of *_setcurrdev with gen_setcurrdev to avoid having to create a 5th copy. uboot_setcurrdev is actually different and needs to remain separate (even though it's quite similar). Sponsored by: Netflix Reviewed by: fuz@fuz.su, kevans Differential Revision: https://reviews.freebsd.org/D38003
* stand/efi: Better variable nameWarner Losh2023-01-091-4/+4
| | | | | | | | sanity_check_currdev returns true if it found a kernel or a sane loader config file. A better name for this would be 'bootable' rather than 'rv' which connotes in other places an errno value or similar. Sponsored by: Netflix
* stand/zfs: Add a third argument to zfs_probe_dev: part_tooWarner Losh2023-01-081-1/+1
| | | | | | | | | Pass in 'true' if you'd like to search this device's partitions or 'false' if you should just search the device. EFI and (in the future) kboot have discrete partitions that aren't accessed via the full disk device. Weird things happen if you try to search in these cases. Sponsored by: Netflix
* loader.efi: make sure kernel image is executableRobert Clausecker2023-01-051-4/+4
| | | | | | | | | | | | | | The Windows Dev Kit 2023 (Volterra) has an UEFI implementation that maps EfiLoaderData pages as non-executable. Map the kernel as EfiLoaderCode to ensure that it can be executed. With this change and another in review, FreeBSD boots to the mountroot prompt if hw.pac.enable = 0 is set in loader.conf(5). Reviewed by: andrew, imp, tsoome Sponsored by: Berliner Linux User Group e.V. Sponsored by: spline / FU-Berlin Differential Revision: https://reviews.freebsd.org/D37931
* stand/efi: remove unused local varaiblesWarner Losh2022-12-071-2/+1
| | | | | | Remove some unused local variables. No functional change. Sponsored by: Netflix
* kboot: Mark the EFI specific parts of bootinfo.cWarner Losh2022-12-071-0/+16
| | | | | | | | | bootinfo.c is about to be shared with kboot since they create substantially similar environments / metadata tagging / etc. Tag this with #ifdef EFI for the moment until the proper abstracting out can happen. Sponsored by: Netflix
* stand: update prototypes for md_load and md_load64Warner Losh2022-12-051-1/+0
| | | | | | | | | | | These are declared as extern in a number of files (some with the wrong return type). Centralize this in modinfo.h and remove a few extra stray declarations as well that are no longer used. No functional change. Note: I've not tried to cope with the bi_load() functions which are the same logical thing. These will be handled separately. Sponsored by: Netflix
* stand/efi: Break stlye rules a little for easier sharingWarner Losh2022-12-041-2/+3
| | | | | | | Break the style rules a little to allow easier sharing between efi and kboot. This will allow the ifdefs to be fewer in number. Sponsored by: Netflix
* stand/efi: Better include order for sharingWarner Losh2022-12-041-1/+1
| | | | | | | | Have a better include order so this can more easily be shared between EFI and kboot. Fewer ifdefs and the same (enough) include order as before. Sponsored by: Netflix
* stand/efi: Remove redundant parenthesisWarner Losh2022-12-041-1/+1
| | | | | | Style: Remove redundant parens. Sponsored by: Netflix
* stand/efi: Document the copy size trickWarner Losh2022-12-041-1/+1
| | | | | | | We call bi_copymodules twice: once with 0 and once with the size of the arena. We do this to find the size, it turns out. Document this. Sponsored by: Netflix
* stand: create devinitWarner Losh2022-11-301-3/+1
| | | | | | | | devinit() marches through all the devices, calling the inint routines if any exist. Replace all the identical copies of this code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37349
* stand/efi: Move to using common devparse()Warner Losh2022-11-301-102/+3
| | | | | | | | We no longer need to have to hand-code this for each boot loader since devparse() handles them all with dv_parsedev(). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37340
* stand: For all disk drivers, connect dv_parsedev to disk_parsedevWarner Losh2022-11-301-0/+1
| | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37339
* stand: Change zfs_parsedev() APIWarner Losh2022-11-301-5/+1
| | | | | | | | | | | Change the first argument to zfs_parsedev() to be a pointer to a struct devdesc *. This now gets filled in with a malloc'd structure that's returned to the caller that the caller is repsonsible for freeing. Most nplaces in the tree passed in a malloc'd pointer anyway, and this moves knowledge of zfs_devdesc more firmly into the zfs.c code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37336
* stand: Change disk_parsedev() APIWarner Losh2022-11-301-5/+1
| | | | | | | | | | | Change the first argument to disk_parsedev() to be a pointer to a struct devdesc *. This now gets filled in with a malloc'd structure that's returned to the caller that the caller is repsonsible for freeing. Most places in the tree passed in a malloc'd pointer anyway, and this moves knowledge of disk_devdesc more firmly into the disk.[ch] code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37335
* stand/efi: Simpler constructWarner Losh2022-10-241-7/+1
| | | | | | | Use 'sizeof(long) == 8' for a compile time constant that can be used as an initializer rather than #ifdefs. Sponsored by: Netflix
* stand/efi: Call md_copymodules based on __LP64__ to fix 32-bit armWarner Losh2022-10-231-2/+8
| | | | | | | | | | | | | When I refactored everything, I neglected to pass in the proper is64 value on 32-bit platforms. This corrects that. This prevented armv7 and armv6 platforms from booting due to misaligned data in the kernel. The only platform we support 32-bit booting in armv[67], which I apparently neglected to test before commiting my refactoring. Tested by: skibo Fixes: 5d1531d9d4e7d Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37095
* stand: collapse all copies of *copyenv into md_copyenvWarner Losh2022-09-161-40/+1
| | | | | | | | Use the efi's bi_copyenv to md_copyenv and place it in modinfo.c. Remove all other nearly identical and efi's has the best error handling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36574
* stand: Move md_copymodules into modinfo.c and reduce copiesWarner Losh2022-09-161-37/+2
| | | | | | | | | | md_copymodules, bi_copymdoules, bi_copymodules32 (x2) and bi_copymodules64 (x2) are all the same routine... Replace them all with md_copymodules. This saves about 800 bytes on i386 BIOS loader, which is a nice bonus. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36572
* stand: Create common/modinfo.hWarner Losh2022-09-161-60/+6
| | | | | | | | | | Move all the MOD_xxx macros to this header. Each user of this interface is currently required to define MOD_ALIGNMENT(l). modinfo was selected because it sits inbetween modules and metadata and will make it easier to migrate to new, shared intefaces. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36571
* stand: Create MOD_ALIGN macro and use it everywhereWarner Losh2022-09-161-4/+5
| | | | | | | | To further reduce the differences between the different MOD_xxx macros, use MOD_ALIGN to do the proper alignment for the given use. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36570
* stand/efi: Clean the proper filesGuido van Rooij2022-09-151-1/+1
| | | | | | Need to clean the specific loader we build, not the generic loader.efi Reviewed by: imp
* stand: Parse all arguments passed by UEFIMichael Gmelin2022-09-061-1/+1
| | | | | | Approved by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D36457
* stand: Remove a double word in a source code commentGordon Bergling2022-09-041-1/+1
| | | | | | - s/the the/the/ MFC after: 3 days
* stand: More sensible defaults when ConOut is missingWarner Losh2022-08-274-2/+37
| | | | | | | | | | | | | | | | | When ConOut is missing, we used to default to serial. Except we did it in the worst way possible by just setting the howto bits and not updating the console setting, which lead to weird behavior where we'd get some things on the video port, others on serial. Instead, set console to "efi,comconsole" for this case. Also set RB_MULTIPLE always (so we get dual consoles from the kernel) and or in RB_SERIAL when we can't find GOPs that suggest the precense of a video console. This will put output in the most places and have a sensible default for 'primary' console. Sponsored by: Netflix Reviewed by: emaste, manu Differential Revision: https://reviews.freebsd.org/D36299
* stand: Use bool for stage_offset_setWarner Losh2022-08-211-4/+4
| | | | | | stage_offset_set is a boolean, convert it to a bool. Sponsored by: Netflix
* stand: efi_fmtdev can be reduced to devformatWarner Losh2022-08-114-30/+3
| | | | | | | | devformat produces the same output as efi_fmtdev, so just use it to reduce on the dependencies. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D35924
* stand: Add disk_fmtdev for dv_fmtdev for all the disk devicesWarner Losh2022-08-111-0/+1
| | | | | | | | | | All of the archsw fmtdev functions treat DEVT_DISK as a call to disk_fmtdev. Set all disks' dv_fmtdev to disk_fmtdev so devformat will return the same thing. Sponsored by: Netflix Reviewed by: tsoome (prior version) Differential Revision: https://reviews.freebsd.org/D35917
* stand: Move quit command to common commandsWarner Losh2022-07-301-9/+0
| | | | | | | | | | | | | Since both EFI and the future kboot will benefit from a 'quit' command, move it from efi/loader/main.c to common/commands.c. In EFI this command exits back to the boot loader (which will cause the next BootXXXX in the BootOrder list to be attempted). In kboot, this will exit back to whatever called loader.kboot. In uboot this will cause a reset (which will restart uboot, not quite a simple exit, but will look similar) and in OFW it will execute OF_exit which should return to the openfirmware prompt. Sponsored by: Netflix
* stand: Make sure nobody has a NULL pointer for dv_cleanupWarner Losh2022-07-273-5/+5
| | | | | | | | | | dv_cleanup is specified almost everywhere. Use nullsys instead of NULL to indicate 'do nothing'. Also, be consistent in trailing commas that were missing before. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D35913
* loader.efi: faults could try to print out call traceToomas Soome2022-07-142-0/+40
| | | | | | | | | | | | with grab_faults, we can try to print out the trace of function calls. Without symbol table, we can not translate addresses to function names, but even addresses can help to track the bugs. For loader functions, print out absolute address, so it could be searched from objdump -d output. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D35433
* amd64/efi: Remove setting hints for rsdpWarner Losh2022-07-021-12/+0
| | | | | | | | | | | Given that hints set this way don't work when a static kenv is compiled into the kernel. acpi.rsdp has been set for this for the past 6 years, and all kernels in that time have used it in preference to the hints. As such, we no longer hints.*, so remove them. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D35634
* loader: Set preferred kenv for acpi.rsdp on arm64Warner Losh2022-07-021-0/+15
| | | | | | | | | | | | Several years ago, x86 moved from using hints to communicate this information to using the simpler acpi.rsdp variables. If one compiles static hints into the kernel, then these hints are ignored. We can remove this when we branch FreeBSD 15. Thought about BURN_BRIDGES here, but it's too messy. Sponsored by: Netflix Reviewed by: andrew, jhb Differential Revision: https://reviews.freebsd.org/D35632
* Remove "All Rights Reserved" from Foundation copyrightsEd Maste2022-06-308-8/+0
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* loader.efi: fix panic() after BS offToomas Soome2022-06-194-4/+15
| | | | | | | | | | panic() is using multiple services - attempting to read keyboard, accessing time functions and finally, exiting the loader. Protect all the accessed listed above. Note, when BS are off, we really can not just exit the loader, we only can reboot. MFC after: 1 week
* Set mm before passing it to the UEFI firmwareAndrew Turner2022-05-211-0/+1
| | | | | | | | | | | | | | | | When reading the UEFI memory map we pass in a pointer to the memory to hold the map. Unfortunately it wasn't initialised before the first use so clang decided it was undefined behaviour so the entire loop was removed. This leads to everything in bi_load after this to also be removed as dead code. The next function after bi_load in the binary is efi_copy_init. The above caused us to enter efi_copy_init with a return address of the start of the function. Because of this it would enter an infinite loop of calling the function, allocating memory, then returning to the start of the function. PR: 264021
* stand: s/libstand/libsa/g to catch up with renameWarner Losh2022-04-302-2/+2
| | | | | | | We renamed libstand to libsa years ago with the move from sys/boot to stand. Catch up in the comments. Sponsored by: Netflix
* stand: libefi: swap /Pci() printing aroundKyle Evans2022-04-131-2/+2
| | | | | | | | | | | Printing device followed by interface matches, e.g., edk2. Note that this is only a fallback, many firmware implementations will provide the protocol that we'll use to format device paths. Reviewed by: imp, tsoome Sponsored by: Ampere Computing Submitted by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D34539
* stand: Fix a common typo in source code commentsGordon Bergling2022-03-281-1/+1
| | | | | | - s/existance/existence/ MFC after: 3 days
* teken: color #3 is yellow not brown - use TC_YELLOW as the nameEd Maste2022-03-121-1/+1
| | | | | | | | | | | The console escape code standard (ECMA-48) specifies color #3 (escape code 33) as yellow. A brown console color is an artifact of the VGA palette, which replaces dim (but not bright) yellow with brown. Reviewed by: adrian, imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34531
* loader: accept "yellow" as a named colorEd Maste2022-03-111-1/+1
| | | | | | | | | | | | | | | | For historical reasons console color number 3 may be either yellow (most consoles) or brown (VGA palette). The console escape code standard uses "yellow", but teken color name constants appear to be based on the VGA scheme and use TC_BROWN for color 3. Even so, the palette table used 50,50,0 as the RGB percentage tuple, resulting in a dim yellow for framebuffer consoles at the time teken was introduced. Amusingly, in 19e2ce2d8367 the comment on the palette entry was changed from "brown" to "dark yellow" but the colour itself was changed from a pure yellow to being somewhat brown. MFC after: 1 week Sponsored by: The FreeBSD Foundation