We plan to increase the default serial rate to 115200 (see review
D36295) but early boot components that use BIOS interfaces do not
support higher rates. Add a note to that effect.
Reported by: imp
Sponsored by: The FreeBSD Foundation
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).
The removal of the sparc64 support in February 2020 obsoleted the
VTOC8 partitioning scheme as no other FreeBSD platform makes use
of it. Moreover, the code is bitrotting as nothing defines e. g.
LOADER_VTOC8_SUPPORT any more and, thus, should go now, too. With
this change, the following commits are reverted as far as VTOC8
is concerned and parts haven't already previously been deleted
along with prior sparc64 removals:
094fcb157da7d366e958ba8d50d08b
The alignment example d9711c28ef
added to the VTOC8 section of gpart.8 is folded into the MBR one.
This should finally conclude the deorbit of sparc64-specific bits.
We had joy, we had fun
we ran Unix on a Sun.
But that source and the song
of FreeBSD have all gone.
Credits to Michael Bueker for the original "Unix on a Sun" and Rod
McKuen for the "Seasons in the Sun" lyrics.
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
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
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
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
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
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
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
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
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
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
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
Commit e32fecd0c2 intended to skip installing all but one copy of
each loader variant's help file, but accidentally skipped all copies for
the userboot help file. (Other loaders install help files via the _simp
variant, but there is is no userboot_simp.)
PR: 271178
Fixes: e32fecd0c2 ("loader: install help files only once")
Sponsored by: The FreeBSD Foundation
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
Remove the i386 ifdefs and files. It never worked.
Sponsored by: Netflix
Reviewed by: manu, tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D40012
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
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
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
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
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
If a file is specified in loader_conf_files that ends in '.lua', lualoader
will now load and execute that file. These may be used in place of a
traditional loader.conf to use more complicated logic, where some values
may be set based on others or based on the environment that the C bits has
left us with.
Lua scripts are run in a limited environment. In particular, it does not get
access to any modules or, in-fact, anything except environment variable.
A config.buildenv hook has been added so that a local module can add
whatever it may need to to the environment.
When a global var is set in the lua script, it does not immediately alter
the loader environment. Instead, the script's environment is initially
empty and processed only if the whole script executes successfully.
Effectively, a lua configuration file either takes effect or it does not,
an error will not leave it in a half-baked state.
Reviewed by: bcr (manpages), imp
Differential Revision: https://reviews.freebsd.org/D28450
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
com.klarasystems:vdev_zaps_v2 is a new feature that the last OpenZFS
import brought in. It needs to be on the list of supported features, but
that update didn't happen so I woke up to a mailbox with multiple
complaints.
CirrusCI test to boot twice with a zpool update inbetween coming later
today.
Sponsored by: Netflix
Add some more sanity checks to make sure we don't march off the end of
the table. Typically, smbios structures are well formed, or Windows
wouldn't boot. Sometimes they aren't, and this at least fails safe.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39794
This code was written on x86 where unaligned accesses were
easy. LinuxBoot running on aarch64 uses mmap of /dev/mem to read the
smbios table. Linux's mapping of this memory doesn't allow the normal
unaligned fixup, so we get a bus error instead. We can't use the more
natural le16dec and friends because they optimize into a single,
unaligned memory load. We don't see this issue on aarch64 UEFI because
memory is mapped such that unaligned accesses are fixed up.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39793
Add support for getting smbios from /sys/firmware/efi/systab, if
any. Add ptov mapping that uses mmap on /dev/mem to do the mapping with
64k pages (usually we only need 1 or two mappings).
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39792
Fix an off-by-one error that would mean we'd get stuck on the newline if
ACPI= wasn't first.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39817
Add one ifdef to upstrem code and get rid of compiling the horrible
checked-in aarch64 assembler for the boot loader that the loader will
never use. I'll attempt to upstream this and adjust as needed.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39897
There's plenty of stack in kboot, so use it here rather than the
malloc/free dance.
Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39416
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
We have way more than 8k of stack for the current value of the zfs
bootonce attribute. Allocate buf on the stack rather than the
complicated malloc / free dance.
Sponsored by: Netflix
Reviewed by: tsoome, kevans, jhb
Differential Revision: https://reviews.freebsd.org/D39414
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
Lookup the spa and pass it into zfs_get_bootonce_spa to process the boot
once protocol.
Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39411
Refactor zfs_set_bootenv to split out the lookup of spa from the
rest. zfs_set_bootenv_spa flushes the benv to the vdevs and updates the
cached benv.
Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39410
Create a new interface to zfs_get_bootenv called zfs_get_bootenv_spa
which takes a spa instead of a void * (effectively a devdesc *). Use
that in zfs_get_bootenv.
Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39409