]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
19 months agostand: Nuke double-semicolons
Elliott Mitchell [Mon, 16 Aug 2021 22:51:38 +0000 (15:51 -0700)]
stand: Nuke double-semicolons

A distinct number of double-semicolons have ended up in FreeBSD.  Take a
pass at getting rid of many of these harmless typos.

Reviewed by: emaste, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D31717

(cherry picked from commit 798ea06f07778f69297bcb9c88738d115bf0369e)

19 months agokboot: Add hostfs
Warner Losh [Thu, 27 Oct 2022 17:37:54 +0000 (11:37 -0600)]
kboot: Add hostfs

Add hostfs for the Linux environment. We can't use the userboot one
that's kinda similar because the Linux system calls we have in kboot are
not quite POSIX compliant (Linux takes care of providing the POSIX
interface in libc), so we have to cope with a number of quirks in that
area.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36607

(cherry picked from commit 02dba4f75f86f3d5ae5a6a438b5bcfdc667929bb)

19 months agostand/kboot: Make FDT fixup per-arch
Warner Losh [Thu, 27 Oct 2022 17:36:51 +0000 (11:36 -0600)]
stand/kboot: Make FDT fixup per-arch

The fixups needed vary somewhat by architecture, so move the FDT fixup
to be per-arch. Rename the fdt_linux_fixup() routine to be
fdt_arch_fixup() and expect all architecutres to fix things up as
needed.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36604

(cherry picked from commit cc9f1b4c35974972c36553d4ca07ac91dc4262a2)

19 months agostand/efi: Simpler construct
Warner Losh [Mon, 24 Oct 2022 18:11:50 +0000 (12:11 -0600)]
stand/efi: Simpler construct

Use 'sizeof(long) == 8' for a compile time constant that can be used as
an initializer rather than #ifdefs.

Sponsored by: Netflix

(cherry picked from commit eca818c872f7ad094f8dac143123e7e8d65f3bcc)

19 months agostand/kboot: hostdisk isn't a DEVT_DISK, use a different value.
Warner Losh [Sat, 22 Oct 2022 15:09:23 +0000 (09:09 -0600)]
stand/kboot: hostdisk isn't a DEVT_DISK, use a different value.

We assume in all the code that a DEVT_DISK uses common/disk.c and/or
common/part.c and we can access a struct disk_devdesc. hostdisk.c
opens raw devices directly, so has no such structures. Define a
kboot-specific DEVT_HOSTDISK and use that instead.

In addition, disk_fmtdev assumes it is working with a struct
disk_devdesc, so write hostdisk_fmtdev as well.

Sponsored by: Netflix

(cherry picked from commit 2cb90a7b2efc41e791c589e17127f63ccf24167c)

19 months agogeli: Move check for DEVT_DISK into geli_probe_and_attach
Warner Losh [Sat, 22 Oct 2022 00:16:56 +0000 (18:16 -0600)]
geli: Move check for DEVT_DISK into geli_probe_and_attach

We only work on DEVT_DISK disks, so move that into the probe to drive
the point home better.

Sponsored by: Netflix

(cherry picked from commit bb3230e40bea68c1a0fc9ba1bee204bc05d7ea78)

19 months agostabd/geli: Bail out if you can't get the disks size
Warner Losh [Fri, 21 Oct 2022 23:39:34 +0000 (17:39 -0600)]
stabd/geli: Bail out if you can't get the disks size

If the DIOCGMEDIASIZE ioctl fails, assume the disk doesn't have geli
encryption. While all disks should implement this, fail safe for disks /
partitions that do not.

Sponsored by: Netflix

(cherry picked from commit 787df454c8175e58131f582c05c169070fb6ca7c)

19 months agokboot: hostdisk add to lsdev output
Warner Losh [Sat, 8 Oct 2022 05:46:20 +0000 (23:46 -0600)]
kboot: hostdisk add to lsdev output

Not entirely sure what to do here, so just list that we're here.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36606

(cherry picked from commit 6700f34d126eb4892e24f4c7758e9f570de2fb4e)

19 months agokboot: Move load address stuff to MD code
Warner Losh [Sat, 8 Oct 2022 05:40:56 +0000 (23:40 -0600)]
kboot: Move load address stuff to MD code

The load address computations are highly architecture specific. There
are generic ways that are augmented by specific constraints of specific
way things work on each architecture. Move the current load segment
computations into a MD routine load_addr.

As part of the move, I'm marking kboot_get_kernel_machine_bits as
unused. This arrived in a prior commit, but never seems to have been
connected, suggesting an incomplete merge at the time, or a path not yet
taken.

Create a stub for amd64 that will be filled in with a later commit.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36603

(cherry picked from commit beba54e4b8349c5482f92d1abf366cfdc12b2416)

19 months agolibsa/netif.c: Replace #if with #ifdef
Michał Grzelak [Wed, 28 Sep 2022 10:31:25 +0000 (12:31 +0200)]
libsa/netif.c: Replace #if with #ifdef

Follow the convention with *_DEBUG macros in stand/libsa/* and replace
"#if" with "#ifdef".

Reviewed by: kd
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36740

(cherry picked from commit 7b54d275ef6f74fe6030c85445bd3770d537d408)

19 months agolibsa/arp.c: Change printf format string
Michał Grzelak [Thu, 29 Sep 2022 05:22:47 +0000 (07:22 +0200)]
libsa/arp.c: Change printf format string

Change printf format string to avoid compilation failure when
ARP_DEBUG macro is defined.

Reviewed by: imp
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36735

(cherry picked from commit c66c6da4f08187deab6a30d4aeb4d6e82088a046)

19 months agolibsa/rarp.c: Change casted type and printf format
Michał Grzelak [Wed, 28 Sep 2022 10:36:53 +0000 (12:36 +0200)]
libsa/rarp.c: Change casted type and printf format

Change the casted type and printf format string to avoid compilation
failure when RARP_DEBUG macro is defined.

Reviewed by: imp
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36738

(cherry picked from commit ee0d06faa0a5b0e551cac4cfcad68062cb3257c7)

19 months agolibsa/rarp.c: Change printf format string
Michał Grzelak [Wed, 28 Sep 2022 10:34:55 +0000 (12:34 +0200)]
libsa/rarp.c: Change printf format string

Change printf format string to avoid compilation failure when
RARP_DEBUG macro is defined.

Reviewed by: imp
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36739

(cherry picked from commit 1ed7916188b5a9684414387ff88829b304a858ae)

19 months agostand/elf: Only support swapping headers on powerpc.
Warner Losh [Fri, 16 Sep 2022 15:10:14 +0000 (09:10 -0600)]
stand/elf: Only support swapping headers on powerpc.

Powerpc is currently the only architecture that we support more than one
endian. It's the only one that benefits from this swapping, so restrict
the code to there. This saves about 1k in the i386 BIOS loader.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36577

(cherry picked from commit c0ecae78abbe5c925cd05d5e218aa6f038cd03c7)

19 months agostand: Allocate bootinfo rather than have it be static
Warner Losh [Fri, 16 Sep 2022 15:09:41 +0000 (09:09 -0600)]
stand: Allocate bootinfo rather than have it be static

This saves 80 bytes (the new bootinfo structure was 84 bytes, and a
pointer is 4 bytes). The bi_load32 code is the same size.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D36575

(cherry picked from commit 9758dd3de1cddc8271be8dd6fee69286c5c86535)

stand: Pass in the proper size for bootinfo

Missed one sizeof(bi) -> sizeof(*bi) in 9758dd3de1cdd conversion to
allocating bootinfo.

Noticed by: tijl@
Fixes: 9758dd3de1cdd
Sponsored by: Netflix

(cherry picked from commit 4a676571e382d0188b98134732f421df57a47a87)

19 months agostand: Stop support booting 4.x and earlier kernels
Warner Losh [Fri, 16 Sep 2022 15:09:07 +0000 (09:09 -0600)]
stand: Stop support booting 4.x and earlier kernels

FreeBSD 4.x and earlier used the bi_bios_geom to get the geometry of the
device. Starting in 5.x, with the wdc -> ata rewrite, it was used only
in pc98 kernels to report geometry of the drives. It can be safely
removed as booting kernels this old is no longer supported. This saves
176 bytes in the BIOS loader.

Sponsored by: Netflix
Reviewed by: adrian, emaste
Differential Revision: https://reviews.freebsd.org/D36543

(cherry picked from commit d43bcf62a2182d3f00c11e5145c8912f4468871a)

19 months agostand: Remove dead store to bi_kernelname
Warner Losh [Fri, 16 Sep 2022 15:09:02 +0000 (09:09 -0600)]
stand: Remove dead store to bi_kernelname

We set this value twice: once to 0 and once to the VA that has the name
of the kernel. The first store is redundant. In addition, these two
stores of 0 are also redundant. Since we never set them, they will
always be zero, even if we're called multiple times. This saves 21
bytes on BIOS loader.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36541

(cherry picked from commit e895ab3fbdc10fbf944289165c25357cb3f279fe)

19 months agostand: collapse all copies of *copyenv into md_copyenv
Warner Losh [Fri, 16 Sep 2022 15:08:57 +0000 (09:08 -0600)]
stand: collapse all copies of *copyenv into md_copyenv

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

(cherry picked from commit fc352701ff3aeb0af22c0da17c4194cf1f8ad5d0)

19 months agostand: Move MOD_xxx macros from modinfo.h to .c
Warner Losh [Fri, 16 Sep 2022 15:08:52 +0000 (09:08 -0600)]
stand: Move MOD_xxx macros from modinfo.h to .c

Now that MOD_xxx macros are modinfo.c, they don't need to be in
modinfo.h.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36573

(cherry picked from commit 2e6ed47a4609ff03a9308a173c64900485172c22)

19 months agostand: Move md_copymodules into modinfo.c and reduce copies
Warner Losh [Fri, 16 Sep 2022 15:08:47 +0000 (09:08 -0600)]
stand: Move md_copymodules into modinfo.c and reduce copies

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

(cherry picked from commit 5d1531d9d4e7d1b1b706ab23ac3f864416e87522)

stand: fix mismerge

Remove stray line from mismerge of 5d1531d9d4e7. This is no longer
needed.

Fixes: 5d1531d9d4e7
Sponsored by: Netflix

(cherry picked from commit dd2b9c2967767b19bcbc33de0e487405c612f59f)

stand/efi: Call md_copymodules based on __LP64__ to fix 32-bit arm

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

(cherry picked from commit e0c3f66b4d5f0282e9c7c4803c4cd26b5a388a38)

19 months agostand: Create common/modinfo.h
Warner Losh [Fri, 16 Sep 2022 15:08:42 +0000 (09:08 -0600)]
stand: Create common/modinfo.h

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

(cherry picked from commit bca9c87b6104219af35ae5ea4a6af098a1631bca)

19 months agostand: Create MOD_ALIGN macro and use it everywhere
Warner Losh [Fri, 16 Sep 2022 15:08:37 +0000 (09:08 -0600)]
stand: Create MOD_ALIGN macro and use it everywhere

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

(cherry picked from commit 8b19d28d68a396b0263e3c13a559a31f70eb3b1d)

19 months agostand: use archsw.arch_copyin instead of direct call
Warner Losh [Fri, 16 Sep 2022 15:08:32 +0000 (09:08 -0600)]
stand: use archsw.arch_copyin instead of direct call

This replaces the CALLBACK(copyin, ...) with a call to
archsw.arch_copyin which points to a function that does the
callback. More diff reduction for the multiple copies of these routines
in the tree.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36569

(cherry picked from commit 4c670b53a0007739a0fc84ea4bc24a5895953aae)

19 months agostand: use archsw.arch_copyin instead of i386_copyin
Warner Losh [Fri, 16 Sep 2022 15:08:23 +0000 (09:08 -0600)]
stand: use archsw.arch_copyin instead of i386_copyin

Since archsw.arch_copyin is always i386_copyin, this will be a nop in
terms of functionality. This is a diff reduction against other copies of
the code that differ only by what copyin routine they call.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D36568

(cherry picked from commit a705c72f214293a7aae5f83235a82f126f73e109)

19 months agostand/efi: Clean the proper files
Guido van Rooij [Thu, 15 Sep 2022 15:10:20 +0000 (09:10 -0600)]
stand/efi: Clean the proper files

Need to clean the specific loader we build, not the generic loader.efi

Reviewed by: imp

(cherry picked from commit 0f97a0d425cf0c7fa3966e64b4f88e67a2ee2982)

19 months agostand: Add driver interface docs
Warner Losh [Fri, 9 Sep 2022 23:22:09 +0000 (17:22 -0600)]
stand: Add driver interface docs

Add some rather bare-bones driver interface docs.

Sponsored by: Netflix
Suggestions by: rpokala
Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D35912

(cherry picked from commit 45ad955714f8442a4485510de819755370a76af3)

19 months agoloader.efi(8): document slop control, amd64 nocopy, and amd64 fault commands
Konstantin Belousov [Sun, 4 Sep 2022 07:36:35 +0000 (10:36 +0300)]
loader.efi(8): document slop control, amd64 nocopy, and amd64 fault commands

Reviewed by: imp
Discussed with: gbe (man pages)
English wording help by: rpokala
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D36435

(cherry picked from commit 85c8c0b77d164f00e7e6e1e94544c82041d43223)

19 months agoRevert "stand: Grammar fix for a source code comment"
Gordon Bergling [Mon, 5 Sep 2022 13:40:55 +0000 (15:40 +0200)]
Revert "stand: Grammar fix for a source code comment"

This reverts commit 7d91d6b83e74edf278dde375e6049aca833cbebd.

The orginal comment is more natural.

Reported by:jrtc27

(cherry picked from commit 3c6db09bf45fd48e5e3c207f138ae1914dbeed0c)

19 months agostand/kboot: Add note about why we use MACHINE_ARCH here
Warner Losh [Sun, 4 Sep 2022 15:31:51 +0000 (09:31 -0600)]
stand/kboot: Add note about why we use MACHINE_ARCH here

Normally in the boot loader, we key off of MACHINE since that specifies
the kernel and the loader is very tuned to each type of MACHINE in
general. In this case, however, we're producing a Linux binary, with
Linux system calls encoded in it. These align better along the
MACHINE_ARCH axis of FreeBSD. For PowerPC the system calls are radically
different for each of our MACHINE_ARCHes, with only powerpc64 and
powerpc64le sharing the same numbers and memory layout. The same was
true about mips when it was in the tree. 32-bit arm uses the same
layout, however, for both armv6 and armv7 ports: that can be easily
shared in the unlikely event we support that in the future.

Sponsored by: Netflix

(cherry picked from commit cc7b630cec8320ad979af6b29cb67027f6a95456)

19 months agostand: Grammar fix for a source code comment
Gordon Bergling [Sun, 4 Sep 2022 15:26:48 +0000 (17:26 +0200)]
stand: Grammar fix for a source code comment

- s/that that/that this/

MFC after: 3 days

(cherry picked from commit 7d91d6b83e74edf278dde375e6049aca833cbebd)

19 months agolualoader: Add loader_menu_multi_user_prompt config variable
Jessica Clarke [Fri, 2 Sep 2022 19:30:40 +0000 (20:30 +0100)]
lualoader: Add loader_menu_multi_user_prompt config variable

This allows the "Multi user" in "[B]oot Multi user" to be substituted
with another string, for example with "Installer" in installer media.
Note that this is lua-only at the moment, since loader.4th's menu.rc
defines the alternate name as Boot [M]ulti User, unlike lualoader which
leaves it as [B]oot Multi user. Ideally loader.4th would adopt the newer
and simpler lualoader behaviour and then it could gain support for this
option, but loader.4th is on the way out and isn't used by any official
installer media so this is not a significant concern.

Reviewed by: kevans, rpokala
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36418

(cherry picked from commit 9b17aa27406f3716383e71c6687d53599a8f8d8a)

19 months agostand: Parse BIOS revision from SMBIOS
Kornel Dulęba [Fri, 2 Sep 2022 11:08:32 +0000 (13:08 +0200)]
stand: Parse BIOS revision from SMBIOS

Add a smbios.bios.revision kenv, which contains the system BIOS revision
as defined in SMBIOS specification, section 3.3.1.
Since the revision is stored in two separate byte fields,
the smbios_setenv helper can't be used.
Read and construct the kenv manually instead.

Approved by: mw(mentor)
Sponsored by: Stormshield
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36413

(cherry picked from commit 66c73af7ea59382ce5ca7cfb2eedb0491790276c)

19 months agokboot: List sources one per line to make merges easier
Warner Losh [Thu, 1 Sep 2022 17:07:34 +0000 (11:07 -0600)]
kboot: List sources one per line to make merges easier

Make SRC an alphabetical list of files, one per line.

Sponsored by: Netflix

(cherry picked from commit 69818bcf38e0bb1716a8d29f61ed392d447cea83)

19 months agokboot: add minmalist init functionality
Warner Losh [Thu, 1 Sep 2022 17:06:43 +0000 (11:06 -0600)]
kboot: add minmalist init functionality

It is desirable to run kboot as the first program in some LinuxBoot
environments. This is the traditional "pid 1" or "init" program. When
running as pid 1. rovide a minimal environment based on what sysvinit,
u-root, initramfs-tools and other like projects do. We mount /dev, /sys,
/proc, make symlinks from /dev/fd to /dev/proc, and create /tmp, /run,
and /var. We also setup stdin/out/err to the console, set the tty
characteristics of same and block the appropriate signals.

This is indended as an environment that never does a fork/exec. If
that's required, the process groups, session leaders and all things
POSIX terminal handlers will need to be added.

Unlike the general purpose linux projects in this area, no attempt is
made to support very old kernels.

When not pid 1, we skip all of the above.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36368

(cherry picked from commit 57f90cf81338ca9d1e403fdfeac16f21def72763)

19 months agostand: Add lua binding loader.has_command
Warner Losh [Thu, 1 Sep 2022 17:06:19 +0000 (11:06 -0600)]
stand: Add lua binding loader.has_command

Give scripts the ability to determine if the currently running loader
has provided a command.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36365

(cherry picked from commit 29fc4075e69fd27de0cded313ac6000165d99f8b)

19 months agostand: Add interp_has_builtin_cmd to see if we have a command
Warner Losh [Thu, 1 Sep 2022 17:06:01 +0000 (11:06 -0600)]
stand: Add interp_has_builtin_cmd to see if we have a command

interp_has_builtin_cmd() will try to lookup the passed in command and
returns true if it was found, false otherwise.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36364

(cherry picked from commit a5948d40ad060140bf5b995f5409458a18ced0ce)

19 months agostand: separate the command lookup from the command execution
Warner Losh [Thu, 1 Sep 2022 17:05:42 +0000 (11:05 -0600)]
stand: separate the command lookup from the command execution

Factor out interp_lookup_cmd to search for a command from
interp_builtin_cmd. This simplifies the latter and can be used to expand
lua to ask if a command exists.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36363

(cherry picked from commit 113dfadd5c8c2b8a566bf4d0e969e1dff62c9e2f)

19 months agostand: Document EFI consoles
Warner Losh [Thu, 1 Sep 2022 16:34:30 +0000 (10:34 -0600)]
stand: Document EFI consoles

Document how EFI consoles work, at least on x86. There's a number of
weird quirks and limitations that are generally known, but not
documented until now. Include information on how EFI decides what the
defualt console is, how to set it and how to cope with common
situations. Note limitations and mismatch between ACPI (which uses UID
to identify a device) and our console code (which uses a raw address)
and explain why we can't translate between them in the loader.

Sponsored by: Netflix
Reviewed by: manu, kevans, rpokala, pauamma
Differential Revision: https://reviews.freebsd.org/D36286

(cherry picked from commit 75a91c70f8d12825ded5a6d14841bf3065ba6595)

19 months agostand: Stop setting hints for bios loader too
Warner Losh [Thu, 1 Sep 2022 16:33:09 +0000 (10:33 -0600)]
stand: Stop setting hints for bios loader too

Catch up to 2753bbe71b5a and remove the old hints.

Sponsored by: Netflix

(cherry picked from commit b1819983e70f5b8890404b7e07d17888d0cccfb6)

19 months agostand: Document that boot0 uses BIOS
Warner Losh [Fri, 26 Aug 2022 21:47:21 +0000 (15:47 -0600)]
stand: Document that boot0 uses BIOS

And thus has a limited range of supported baud rates. Also add that
setting BOOT_BOOT0_COMCONSOLE_SPEED=0 will leave it unchanged which
sometimes can give you 115200 if the BIOS initialized things outside of
the normal BIOS baud rates (which many x86 enbedded-targetted boards
do).

Sponsored by: Netflix
Reviewed by: emaste, manu (earlier versions)
Suggestions by: jhb
Differential Revision: https://reviews.freebsd.org/D36300

(cherry picked from commit 7ed3228323ef4f9e3130603ea68c3be9c2ed50ce)

19 months agostand: More sensible defaults when ConOut is missing
Warner Losh [Fri, 26 Aug 2022 21:46:33 +0000 (15:46 -0600)]
stand: More sensible defaults when ConOut is missing

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

(cherry picked from commit df065f699f1ff819bb9607c44a6754275ab335ed)

19 months agostand: Use bool for stage_offset_set
Warner Losh [Sun, 21 Aug 2022 15:45:44 +0000 (09:45 -0600)]
stand: Use bool for stage_offset_set

stage_offset_set is a boolean, convert it to a bool.

Sponsored by: Netflix

(cherry picked from commit 9d70108a74efe327ed9d1f68bc1e9e271810d94c)

19 months agoloader: zfs reader should only store devdesc in f_devdata
Toomas Soome [Sun, 14 Aug 2022 21:49:50 +0000 (00:49 +0300)]
loader: zfs reader should only store devdesc in f_devdata

Use d_opendata for device specific data.

PR: 265825
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36202

(cherry picked from commit d98de7440507aea1648c8f4bc302bf88c0eb9458)

19 months agostand: Raise limit to 550,000 bytes for loader
Warner Losh [Fri, 12 Aug 2022 04:59:51 +0000 (22:59 -0600)]
stand: Raise limit to 550,000 bytes for loader

Raise the limit for /boot/loader to be 550k. The IBM PC imposes a limit
of 640k of RAM below 1MB, which is needed for real mode calls. BTX takes
40k of that. The BIOS takes some amount (25k seems a good "99% take less
than or equal to this" estimate for that, though some systems consume
more). Most typical setups need 25k of stack.  This leaves 550k for
code. We set the limit to 550,000 which gives about an extra 13,000
bytes of buffer for machines that whose setups use a little more stack
or whose BIOS reserves a bit more...

Add this derivation in the Makefile. Also recommend setting LOADERSIZE
lower in /etc/src.conf when the loader has to run on a system whose BIOS
takes up more space, or for a complex setup. Add a recipe for how to
find how much RAM your BIOS uses as well (thanks to jhb@ for the
trick). Network cards that boot via PXE and HBAs with their BIOS enabled
are known to be large consumers of lomem space.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D36152

(cherry picked from commit f8a199f28f9de46fe7360c3a4a0e19e71be72721)

stand: Fix a couple of comment typos in f8a199f28f9d

The commit message documented it as /etc/src.conf but the comment in the
source mentioned the non-existent /etc/loader.conf.

Fixes: f8a199f28f9d ("stand: Raise limit to 550,000 bytes for loader")
(cherry picked from commit 3179bb2737493bc4191c3239226bda50f0b64b8f)

19 months agostand: Go back to a.out format for /boot/loader
Warner Losh [Thu, 11 Aug 2022 23:29:10 +0000 (17:29 -0600)]
stand: Go back to a.out format for /boot/loader

Turns out there's two hidden a.out dependencies. pxeldr.S assumes it has
access to the a.out header from /boot/loader and cdboot.S assumes that
/boot/loader is also a.out and doesn't use boot2.

So, go back to making a.out files for these and adjust the size checks
to use ls, but we only need to check loader.bin. Trim the size we check
against by 2,000. The difference in size between loader and loader.bin
is about 3000 bytes, but clang15 produces binaries that are a smidge
bigger so we need to relax the check just a little and accept some
additional risk for the moment.

Add some comments to loader's Makefile about this.

Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D36142

(cherry picked from commit 4c8ea3efe73c12d595472a7fc37177432a77858e)

19 months agostand: Make BIOS loader size limits settable
Warner Losh [Thu, 11 Aug 2022 16:24:58 +0000 (10:24 -0600)]
stand: Make BIOS loader size limits settable

It's sometimes desirable to override the size limit: It's a soft limit
and there are times we exceed the limit by just a little bit and don't
want the build to fail (or we are hitting runtime failures below the
510,000 byte limit).

Sponsored by: Netflix

(cherry picked from commit 7d72ff905770a64a22125c890438189db71104ae)

19 months agostand: i386_fmtdev can be reduced to devformat
Warner Losh [Thu, 11 Aug 2022 15:09:03 +0000 (09:09 -0600)]
stand: i386_fmtdev can be reduced to devformat

devformat produces the same output as i386_fmtdev, so just use it to
reduce on the dependencies.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35927

(cherry picked from commit 362322294045943703e03dee263bbc237002525c)

19 months agostand: uboot_fmtdev can be reduced to devformat
Warner Losh [Thu, 11 Aug 2022 15:08:52 +0000 (09:08 -0600)]
stand: uboot_fmtdev can be reduced to devformat

devformat produces the same output as uboot_fmtdev, so just use it to
reduce on the dependencies.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35926

(cherry picked from commit add8154e451f441778fb9c2fb7d10d281dea9611)

19 months agostand: userboot_fmtdev can be reduced to devformat
Warner Losh [Thu, 11 Aug 2022 15:08:26 +0000 (09:08 -0600)]
stand: userboot_fmtdev can be reduced to devformat

devformat produces the same output as userboot_fmtdev, so just use it to
reduce on the dependencies. In addition, we don't need to use the
incomplete struct userboot_devdesc type, we can use struct devdesc
instead (in fact, there's no userboot_devdesc defined anywhere).

Sponsored by: Netflix
Reviewed by: jhb (prior version)
Differential Revision: https://reviews.freebsd.org/D35925

(cherry picked from commit 1e9b23448a3010e8403eae08ad890fe1eb75da8b)

19 months agostand: efi_fmtdev can be reduced to devformat
Warner Losh [Thu, 11 Aug 2022 15:08:08 +0000 (09:08 -0600)]
stand: efi_fmtdev can be reduced to devformat

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

(cherry picked from commit 1e7a2eb93a527a2f4b22be66788caf50e4ba1f89)

19 months agostand: Replace zfs_fmtdev with generic devformat()
Warner Losh [Thu, 11 Aug 2022 15:07:44 +0000 (09:07 -0600)]
stand: Replace zfs_fmtdev with generic devformat()

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35973

(cherry picked from commit edb26097cb6416adb89b54c830d36c0ead3ca64c)

19 months agostand: For zfs, set dv_fmtdev to zfs_fmtdev
Warner Losh [Thu, 11 Aug 2022 15:07:26 +0000 (09:07 -0600)]
stand: For zfs, set dv_fmtdev to zfs_fmtdev

Add a generic way to get the string representation of a zfs device / mount.

Sponsored by: Netflix
Reviewed by: tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35923

[ Dropped changes to stand/libsa/zfs/Makefile.inc file, depends
  on newer OpenZFS ]

(cherry picked from commit 654b7837a6a08ec5b51635badd14794754fab7c5)

19 months agostand: Use devformat instead of disk_devfmt
Warner Losh [Thu, 11 Aug 2022 15:07:13 +0000 (09:07 -0600)]
stand: Use devformat instead of disk_devfmt

Use devformat instead of disk_devfmt. This allows us to avoid knowing
the details of the device that's underneath us. Remove disk.h include
and the -I${LDRSRC} from the build of ufs.c since they are no longer
needed.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35922

[ minor tweaks due to earlier UFS MFC ]

(cherry picked from commit 0b3a4a588fb6b30d923686828dab4685b94ec1ea)

19 months agostand: Use devformat rather than disk_devfmt
Warner Losh [Thu, 11 Aug 2022 15:06:53 +0000 (09:06 -0600)]
stand: Use devformat rather than disk_devfmt

Fix layering violation and use devformat to get the string
representation of the device to see if we're mounted yet or not. Remove
added include to pickup disk.h.

Sponsored by: Netflix
Reviewed by: tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35919

[ minor changes because UFS changes interferred and were already merged ]

(cherry picked from commit ec9f3e776f39286ccec9915f38cca9729e6f9241)

19 months agostand: Add disk_fmtdev for dv_fmtdev for all the disk devices
Warner Losh [Thu, 11 Aug 2022 15:06:28 +0000 (09:06 -0600)]
stand: Add disk_fmtdev for dv_fmtdev for all the disk devices

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

(cherry picked from commit ad759c73522efb606135e2891ac03864926b80a3)

19 months agostand: Add devformat to return formatted string for a device
Warner Losh [Thu, 11 Aug 2022 15:06:09 +0000 (09:06 -0600)]
stand: Add devformat to return formatted string for a device

Use dv_fmtdev to return a formatted string for a device. If this is a
null pointer, return the device name and unit followed by a colon (eg
disk3:).

Sponsored by: Netflix
Reviewed by: tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35916

(cherry picked from commit dc472f67021320309ced970d3d26d30a04da0ef2)

19 months agostand: Add dv_devfmt to return a string represenation of the device
Warner Losh [Thu, 11 Aug 2022 15:05:34 +0000 (09:05 -0600)]
stand: Add dv_devfmt to return a string represenation of the device

Add a new pointer, dv_devfmt, to allow devices to format themselves. We
will use this to simplify many of the fmtdev functions in the tree as
they are all almost the same, or all are isomorphic to each other.

Sponsored by: Netflix
Reviewed by: tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35915

(cherry picked from commit 4d4b1a298c84f2357c304583dfe78d0e4b8fa2f1)

19 months agostand: Change zfs_fmtdev to take a struct devdesc *
Warner Losh [Thu, 11 Aug 2022 15:05:15 +0000 (09:05 -0600)]
stand: Change zfs_fmtdev to take a struct devdesc *

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35974

(cherry picked from commit d2d4e1271b33b233f57fd18a61a1b5c1b0aeb355)

19 months agostand: Change disk_fmtdev to take a struct devdesc *
Warner Losh [Thu, 11 Aug 2022 15:04:50 +0000 (09:04 -0600)]
stand: Change disk_fmtdev to take a struct devdesc *

We do a number of games with ploymorphism for different types struct
*devdesc. Adjust one place that this affects to take the address of the
base class (most others have void * at the moment). This is more type
safe than a bare void *.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35914

(cherry picked from commit c32dde3166922f55927764464d13f1bc9640f5f6)

19 months agostand: Move i386_devdesc to a union
Warner Losh [Thu, 11 Aug 2022 15:04:08 +0000 (09:04 -0600)]
stand: Move i386_devdesc to a union

Rather than have the magic, hand-crafted fields that have to align with
fields in other structures at the end of i386_devdesc, make it into
anonymous union and adjust the code accordingly. This is safer and
similar to what CAM does.

Sponsored by: Netflix
Reviewed by: kevans, tsoome (prior version)
Differential Revision: https://reviews.freebsd.org/D35965

(cherry picked from commit f197c0bf3e075286ccea32cd12023f3317474c5a)

19 months agostand: Remove unnecessary include
Warner Losh [Thu, 11 Aug 2022 14:59:48 +0000 (08:59 -0600)]
stand: Remove unnecessary include

stdbool.h is implied by stand.h, so remove it.

Sponsored by: Netflix

(cherry picked from commit bec11d96318bc8647f28b580829eeb7ba9d05768)

19 months agostand: impose 510,000 byte limit for /boot/loader and /boot/pxeldr
Warner Losh [Thu, 11 Aug 2022 03:19:01 +0000 (21:19 -0600)]
stand: impose 510,000 byte limit for /boot/loader and /boot/pxeldr

The BIOS method of booting imposes an absolute limit of 640k for the
size of the program being run due to btx. In practice, this means that
programs larger than about 500kiB will fail in odd ways as the stack /
heap will overflow.

Pick 510,000 as the cutoff line semi-arbitrarily. loader_lua is now
almost too big and we want to break the build when it crosses this
threshold. In my experience, below 500,000 always works, above 520,000
always seems to fail with things getting bad somewhere between 512,000
to 515,000. 510,000 is as close to the line as I think we can go, though
experience may dictate we need to lower this in the future.

This is at-best a stop-breakage until we have a better way to subset the
boot loader for BIOS booting to allow better, more fined-tuned
/boot/loaders for the many different environments they have to run
in. This likely means we'll have a graphical loader than understands a
few filesystmes for installation, and a non-graphical loader that
understands the most filesystems possible for everything else in the
future. Our build infrastructure needs some work before we can do that,
however.

At this late date, it likely isn't worth the efforts to move parts of
the loader into high memory. There's a number of assumptions about where
the stack is, where buffers reside, etc that are fulfilled when it lives
in the first 640k that would need bounce buffers and/or other counter
measures if we were to split it up. All BIOS calls are done in 16-bit
mode with SEG:OFF addresses, requiring them to be in the first 640k of
RAM. And nearly all machines in the last decade can boot with UEFI
(though there's some exceptions, so it isn't worth killing outright
yet).

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D36129

(cherry picked from commit 39fdad34e220c52a433e78f20c8c39412429014e)

19 months agostand: i386/amd64: Always use elf format for /boot/loader and pxeldr
Warner Losh [Thu, 11 Aug 2022 03:18:32 +0000 (21:18 -0600)]
stand: i386/amd64: Always use elf format for /boot/loader and pxeldr

The first level boot blocks have understood how to load ELF code since
1999. Switch /boot/loader and /boot/pxeldr over to being ELF format so
that in-tree tools can examine them more closely. In addition, one
could, in theory, now have a 'lo-mem' and a 'hi-mem' segment (though a
lot of work would need to be done with bounce buffers, btx, code segment
marking, etc for an arrangement like that to work).

As far as I can tell, this is the last a.out binary in the tree. There
are several raw binaries left, but everything else is ELF.

Reviewed by: emaste, kevans
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36130

(cherry picked from commit e2295b9117233d8248fe919c6b28ef1d44a8950d)

19 months agostand: Reduce number of files that need -I${LDRSRC}
Warner Losh [Wed, 3 Aug 2022 17:16:17 +0000 (11:16 -0600)]
stand: Reduce number of files that need -I${LDRSRC}

geliboot.c and geliboot_crypto.c don't need anything from stand/common,
so remove them from the list of things to add it.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35921

(cherry picked from commit f863970a82f430a2b10b9799585008fe89eab00a)

19 months agostand: Remove unneeded include from geli
Warner Losh [Wed, 3 Aug 2022 17:13:34 +0000 (11:13 -0600)]
stand: Remove unneeded include from geli

bootstrap.h isn't needed at all by geil, so remove it.

Sponsored by: Netflix
Reviewed by: tsoome (earlier version)
Differential Revision: https://reviews.freebsd.org/D35920

(cherry picked from commit 4333168b1dc0f9285e90ccba26e21348e51fe889)

19 months agostand: use snprintf here
Warner Losh [Wed, 3 Aug 2022 16:50:14 +0000 (10:50 -0600)]
stand: use snprintf here

This code was written prior to snprintf being in the then libstand (now
libsa). Since we have it, use it for extra safety. The code already
tries to be safe, but since we have snprintf as well, the added layer of
protection will suffice. The current code reserves 16 bytes (plus a NUL)
at the end for worst case of inet_ntoa, which is still a little
pessimal, but safe from overflow.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35102

(cherry picked from commit a23c26b2fe38f7ad63e71e1f32795b4800213585)

19 months agostand: Add a helper 'universe' target
Warner Losh [Sat, 30 Jul 2022 11:01:47 +0000 (05:01 -0600)]
stand: Add a helper 'universe' target

Add a shortcut for invokging ${SRCTOP}/tools/boot/universe.sh by
creating a 'universe' target in src/stand. This will make it easier to
test out all the different combinations of boot loaders that we build.

Sponsored by: Netflix

(cherry picked from commit 206203f5301b1bda1ceabcb7ecb7c0eee3e6b07a)

19 months agostand: Move quit command to common commands
Warner Losh [Sat, 30 Jul 2022 10:43:21 +0000 (04:43 -0600)]
stand: Move quit command to common commands

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

[[ tweaked because mips is still in stable/13 leading to conflict ]]

(cherry picked from commit 2101541ff1222788901d9503001add9f288a4c40)

19 months agokboot: Make console raw when we start
Warner Losh [Tue, 26 Jul 2022 23:39:45 +0000 (17:39 -0600)]
kboot: Make console raw when we start

Put the console into raw mode on startup. This allows the menus to work
as expected. Boot is now interruptable.

Note: Likely should restore the terminal settings on most exists.  It's
not clear the best way to do this, and most shells have an auto stty
sane anyway, so note it for future improvement.

Sponsored by: Netflix

(cherry picked from commit 9579540144880e0a612ec2fdfc66de46c08d28d6)

19 months agokboot: implement stripped down termios
Warner Losh [Tue, 26 Jul 2022 23:31:23 +0000 (17:31 -0600)]
kboot: implement stripped down termios

Implement a stripped down termios, obtained from various files in musl
and HOST_ or host_ prepended to most things and a few unavoidable style
tweaks. Only implements the bits of termios we need for the boot loader:
put the terminal into raw mode, restore terminal settings and speed
stuff.

Sponsored by: Netflix

(cherry picked from commit 963037786f76a414e91e45d4fbef5e35fc1abc84)

19 months agokboot: Implement host_ioctl
Warner Losh [Tue, 26 Jul 2022 23:30:30 +0000 (17:30 -0600)]
kboot: Implement host_ioctl

Sponsored by: Netflix

(cherry picked from commit 54e6e0deb4853dae7e97e7d5659c05e95bebac32)

19 months agokboot: Add host_exit and use it to implement exit()
Warner Losh [Thu, 28 Jul 2022 21:18:08 +0000 (15:18 -0600)]
kboot: Add host_exit and use it to implement exit()

Clients of libsa are expected to implement exit(). The current exit just
loops forever. It is better to really exit: when running as init that
will reboot the system. When not running as init, other programs can
recover (not that we support running as init, but when we do in the
future, this is still the rigtht thing).

Sponsored by: Netflix

(cherry picked from commit f56d7a73be6688299c7ec97fac6d505c657aa55c)

19 months agokboot: aarch64 support
Warner Losh [Mon, 11 Jul 2022 23:49:11 +0000 (17:49 -0600)]
kboot: aarch64 support

Add support for aarch64. exec.c and ldscript are copied from the EFI
version with #ifdefs for the differences. Once complete, I'll refactor
them. host_syscall.S implements a generic system call. tramp.S is a
first attempt to create a tramoline that we can use to jump to the
aarch64 kernel. Add aarch64-specific startup and stat files as well.
exec.c tweaked slightly to avoid bringing in bi_load(), which will come
in later. Includes tweaks to stat due to name differences between names
on different Linux architectures.

Sponsored by: Netflix

(cherry picked from commit 75cbdbc9832e72a59bdcb1c307a7a4ea77e29fce)

19 months agokboot: Move conf.c up to top level
Warner Losh [Thu, 28 Jul 2022 20:53:25 +0000 (14:53 -0600)]
kboot: Move conf.c up to top level

conf.c is the same now between powerpc64 and amd64, so move it up to
kboot. Move powerpc file formats defines to ppc64_elf_freebsd.c

Sponsored by: Netflix

(cherry picked from commit a0c075229f19ce1a10836042907e2bd89907aa0b)

19 months agokboot: Remove RELOC defines, it's unused
Warner Losh [Thu, 28 Jul 2022 05:11:12 +0000 (23:11 -0600)]
kboot: Remove RELOC defines, it's unused

This was copied from powerpc/ofw and has never been used. We also don't
care about -DAIM. It's only relevant for in-kernel structures, which we
don't use in this userland program.

Sponsored by: Netflix

(cherry picked from commit 309a263fe6484658827ca28a922fad70a2b42499)

19 months agokboot: Convert from getdents to getdents64
Warner Losh [Thu, 28 Jul 2022 04:24:50 +0000 (22:24 -0600)]
kboot: Convert from getdents to getdents64

Linux 2.4 introduced getdents64. Switch to using it because aarch64
doesn't have getdents as that syscall was obsoleted before that port was
created.

Sponsored by: Netflix

(cherry picked from commit 3a1b966ae0c1b9f334e1e3a7ad8b4bf8e845f3c5)

19 months agokboot: Do a style(9) pass on kbootfdt.c
Warner Losh [Thu, 28 Jul 2022 04:07:52 +0000 (22:07 -0600)]
kboot: Do a style(9) pass on kbootfdt.c

Mostly just properly indent.

Sponsored by: Netflix

(cherry picked from commit 065cbc77076ec8d38385406deefa8331bc2432f5)

19 months agostand: tftp.c doesn't need bootinfo.h
Warner Losh [Tue, 26 Jul 2022 03:45:35 +0000 (21:45 -0600)]
stand: tftp.c doesn't need bootinfo.h

tftp.c includes bootinfo.h, but doesn't need it. Remove it, and remove
the -Istand/common from CFALGS since that's the only reason we had it.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35928

(cherry picked from commit 60cb4f9a8e258e917634d23fb1d589eef38e579c)

19 months agostand: Make sure nobody has a NULL pointer for dv_cleanup
Warner Losh [Wed, 27 Jul 2022 14:46:21 +0000 (08:46 -0600)]
stand: Make sure nobody has a NULL pointer for dv_cleanup

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

(cherry picked from commit e98f952c82907ec39cebb4e66efd92691c835e05)

19 months agostand: Small comment correction
Warner Losh [Wed, 27 Jul 2022 14:46:12 +0000 (08:46 -0600)]
stand: Small comment correction

While in theory, once upon a time, dv_type was arch specific, that's
never been the case in FreeBSD (and certaintly isn't in the surviving
drivers). Remove that notation.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35911

(cherry picked from commit 079f02e8c035f12779a57f10b274253a701267e5)

19 months agostand: Create DEV_NAMLEN for the length of a device name
Warner Losh [Wed, 27 Jul 2022 14:45:59 +0000 (08:45 -0600)]
stand: Create DEV_NAMLEN for the length of a device name

Rather than hard coding 8 for the device name length, create a #define for it.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D35910

(cherry picked from commit 4932a6e41d1fc3fe474358501d5933e783066bdc)

19 months agostand: Spell License correctly
Warner Losh [Tue, 26 Jul 2022 22:29:56 +0000 (16:29 -0600)]
stand: Spell License correctly

An e got dropped and then cut and pasted into far too many places.

Sponsored by: Netflix
Noticed by: freqlabs on irc

(cherry picked from commit d2c0ec8d19da6531676af82461e7a8247228f8f4)

19 months agostand: Fix set but unused warning
Warner Losh [Tue, 26 Jul 2022 04:48:31 +0000 (22:48 -0600)]
stand: Fix set but unused warning

Make interp_identifier global to avoid a set but not used warning. For a
global, llvm can't optimize it out (yet?)

Sponsored by: Netflix

(cherry picked from commit f4d71d0c1a9976c047758e065adb2c1498cd9765)

19 months agostand/disk: Trivial formatting nit
Warner Losh [Mon, 25 Jul 2022 13:32:15 +0000 (07:32 -0600)]
stand/disk: Trivial formatting nit

style(9) wants a space here.

Sponsored by: Netflix

(cherry picked from commit 865a58d2fc89616a0ab2f88016da43e980dcac1d)

19 months agostand: Use c99 structure initialization for userboot's host_fsops
Warner Losh [Sun, 24 Jul 2022 21:51:50 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for userboot's host_fsops

Sponsored by: Netflix

(cherry picked from commit b3f43ee0317ad241fd35cd8a0e087fd2b158ca1f)

19 months agostand: Use c99 structure initialization for gzipfs_fsops
Warner Losh [Sun, 24 Jul 2022 21:51:47 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for gzipfs_fsops

Sponsored by: Netflix

(cherry picked from commit b7625c2c2cf7e559acc08f7cbbb53f5cb3b8ab94)

19 months agostand: Use c99 structure initialization for splitfs_fsops
Warner Losh [Sun, 24 Jul 2022 21:51:44 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for splitfs_fsops

Sponsored by: Netflix

(cherry picked from commit 9450d9c4e5f94421237a5f58f47afee8c065e60f)

19 months agostand: Use c99 structure initialization for pkgfs_fsops
Warner Losh [Sun, 24 Jul 2022 21:51:42 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for pkgfs_fsops

Sponsored by: Netflix

(cherry picked from commit e7d045aa2b270d2026ad6c15639673ea6d01c7b4)

19 months agostand: Use c99 structure initialization for nfs_fsops
Warner Losh [Sun, 24 Jul 2022 21:51:39 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for nfs_fsops

Sponsored by: Netflix

(cherry picked from commit 90a7e556a42263ea10ca931621f168bc3f07a5ff)

19 months agostand: Use c99 structure initialization for bzipfs_fsops
Warner Losh [Sun, 24 Jul 2022 21:51:36 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for bzipfs_fsops

Sponsored by: Netflix

(cherry picked from commit 0ad8a113b7066494c509f5c89267c2a4116788c5)

19 months agostand: Use c99 structure initialization for ext2fs_fsops
Warner Losh [Sun, 24 Jul 2022 21:51:34 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for ext2fs_fsops

Sponsored by: Netflix

(cherry picked from commit 12a41918a276c042886cd2741b1f79fc402cd752)

19 months agostand: Use c99 structure initialization for network device
Warner Losh [Sun, 24 Jul 2022 21:51:32 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for network device

Use c99 structure init for devsw.

Sponsored by: Netflix

(cherry picked from commit c4f4a6c983fdadfc343344152cfc571a00a1e07a)

19 months agostand: Use c99 structure initialization for fwohci device
Warner Losh [Sun, 24 Jul 2022 21:51:29 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for fwohci device

Use c99 structure init for devsw.

Sponsored by: Netflix

(cherry picked from commit bf855d1bf252bdf31a405cef65021d63846765ab)

19 months agostand: Use c99 structure initialization for userboot block device
Warner Losh [Sun, 24 Jul 2022 21:51:27 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for userboot block device

Use c99 structure init for devsw.

Sponsored by: Netflix

(cherry picked from commit 4c460aaf8342ec80216dd0e7f876903d75790c2f)

19 months agostand: Use c99 structure initialization for uboot block device
Warner Losh [Sun, 24 Jul 2022 21:51:24 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for uboot block device

Use c99 structure init for devsw.

Sponsored by: Netflix

(cherry picked from commit 1e3d1c86bc86197c1ac7f82b28e13985df58fcf4)

19 months agostand: Use c99 structure initialization for ofw's block device
Warner Losh [Sun, 24 Jul 2022 21:51:21 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for ofw's block device

Use c99 structure init for devsw.

Sponsored by: Netflix

(cherry picked from commit e72a01f1325f50326f02209d75203b97d6bfca88)

19 months agostand: Use c99 structure initialization for kboot's hostdisk device
Warner Losh [Sun, 24 Jul 2022 21:51:19 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for kboot's hostdisk device

Use c99 structure init for devsw.

Sponsored by: Netflix

(cherry picked from commit fc5d0d51aafc1a954a5e9cfa69cd8cdf91824e21)

19 months agostand: Use c99 structure initialization for md device
Warner Losh [Sun, 24 Jul 2022 21:51:15 +0000 (15:51 -0600)]
stand: Use c99 structure initialization for md device

Use c99 structure init for devsw.

Sponsored by: Netflix

(cherry picked from commit 143452f7609fc232ba9ae625a1f87d12449ff55b)

19 months agokboot: Pull in constants from Linux's mmap.h api
Warner Losh [Tue, 28 Jun 2022 16:43:42 +0000 (10:43 -0600)]
kboot: Pull in constants from Linux's mmap.h api

Define the usual #defines for mmap(2) (with HOST_ prepended) and use
them instead of hard coding constants.

Sponsored by: Netflix

(cherry picked from commit 01c58e7e4fd830b736c2fdcee4965e135f6e6685)

19 months agokboot: Properly cap number of segments loaded for kexec
Warner Losh [Wed, 29 Jun 2022 22:31:23 +0000 (16:31 -0600)]
kboot: Properly cap number of segments loaded for kexec

Linux has an arbitrary limit of 16 segments. Make sure we don't load too
many.

Sponsored by: Netflix

(cherry picked from commit 2870493f1f55d5c00e5593f336dc05805863db7f)