]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
17 months agostand/zfs: Add a third argument to zfs_probe_dev: part_too
Warner Losh [Fri, 16 Dec 2022 23:19:51 +0000 (16:19 -0700)]
stand/zfs: Add a third argument to zfs_probe_dev: part_too

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

(cherry picked from commit 71bbe6fb709dcfbe36877fa53c928e2e6d881843)

17 months agokboot: use 128MB for the heap area, ZFS needs a lot of memory
Warner Losh [Fri, 23 Dec 2022 18:26:32 +0000 (11:26 -0700)]
kboot: use 128MB for the heap area, ZFS needs a lot of memory

ZFS uses a lot of memory. The old minimal allocations won't work when
ZFS support is added. Most environments this will be used (or will
liekly be used) have >> 256MB, 128MB should be safe everywhere and allow
examination of a fair number of ZFS pools to boot from.

Sponsored by: Netflix

(cherry picked from commit 4dd3e76881ad025170b0cfb5455680b3c89fe263)

17 months agokboot: Sort kexec_load alphabetically
Warner Losh [Sat, 7 Jan 2023 20:24:45 +0000 (13:24 -0700)]
kboot: Sort kexec_load alphabetically

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

(cherry picked from commit a0e4d18091a4fab66c4eb7c5dc731f78a2f9b0a3)

17 months agostand: Add macros for file types from stat
Warner Losh [Sat, 7 Jan 2023 20:23:05 +0000 (13:23 -0700)]
stand: Add macros for file types from stat

Add the familiar macros for file types for stat's st_mode
member. Prepend HOST_ to the start of these. Make sure all the values
match the linux nolibc and uapi headers. These values are the same as
native values since they appear to be required by POSIX. Define anyway
to allow the reader of the code to know that they are in the 'host (eg
Linux)' namespace rather than the 'loader' namespace.

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

(cherry picked from commit 2f5f17b80c2d030196e05b12b15d544b363eb058)

17 months agokboot: Disks should be at least 16MB
Warner Losh [Tue, 13 Dec 2022 05:39:03 +0000 (22:39 -0700)]
kboot: Disks should be at least 16MB

Linux pre-boot environments will often have a number of psuedo disks
that are small, all smaller than a few MB. 16MB is a good cutoff since
it's big enough to filter these devices, yet small enough to allow a
super-minimal partition through (the smallest I've been able to make
that's useful lately is around 20MB).

Sponsored by: Netflix

(cherry picked from commit 0386255bee079922f00f37eeb4e9e3138b7666c1)

17 months agokboot: hostdisk.c update copyright notice
Warner Losh [Tue, 13 Dec 2022 05:37:35 +0000 (22:37 -0700)]
kboot: hostdisk.c update copyright notice

I've rewritten a substantial portion of this file, so add Netflix
copyright.

Sponsored by: Netflix

(cherry picked from commit 538b73578b9190af1b2fd57ca886c79b40aa1c17)

17 months agostand: Allow stand.h to be included in C++ programs
Warner Losh [Sat, 7 Jan 2023 01:39:09 +0000 (18:39 -0700)]
stand: Allow stand.h to be included in C++ programs

Allow stand.h to be included in C++ programs. This is little more than
using our stylized __BEGIN_DECL / __END_DECL around the entire
file. There's no run-time support for C++, so the C++ that can be used
is quite limited. It is enough for libunwind, though.

Sponsored by: Netflix
Reviewed by: jrtc27, kevans
Differential Revision: https://reviews.freebsd.org/D37946

(cherry picked from commit 5cf20707ba79b5c06b26381da0013c65004b53be)

17 months agostand: Add inttype.h
Warner Losh [Sat, 7 Jan 2023 01:37:56 +0000 (18:37 -0700)]
stand: Add inttype.h

libunwind files need inttype.h. It's safe so add it to the safe list.

Sponsored by: Netflix
Reviewed by: jrtc27, kevans
Differential Revision: https://reviews.freebsd.org/D37947

(cherry picked from commit 97e1430606f8387c03fe6e544005be8dab6a3364)

17 months agostand: Make ioctl declaration consistent
Warner Losh [Tue, 13 Dec 2022 04:46:05 +0000 (21:46 -0700)]
stand: Make ioctl declaration consistent

It typically had two args with an optional third from the userland
declaration in sys/ioccom.h. However, the funciton definition used a
non-optional char * argument. This mismatch is UB behavior (but worked
due to the calling convetions of all our machines).

Instead, add a declaration for ioctl to stand.h, make the third arg
'void *' which is a better match to the ... declaration before. This
prevents the convert int * -> char * errors as well. Make the ioctl
user-space declaration truly user-space specific (omit it in the
stand-alone build).

No functional change intended.

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

(cherry picked from commit 2e1e68cbaee3e74a89e9b63fdb180974a2bf4292)

17 months agokboot: Use (void) instead of () for functiosn with no args
Warner Losh [Fri, 9 Dec 2022 14:55:42 +0000 (07:55 -0700)]
kboot: Use (void) instead of () for functiosn with no args

`int foo();` means 'a function that takes any number of arguments.`
not `a function that takes no arguemnts`, that's spelled `int foo(void);`
Adopt the latter.

Sponsored by: Netflix

(cherry picked from commit e830a6cbbe8e7ab359e871b0ba95b9b025c0ffcc)

17 months agokboot: Allow loading fdt from different sources
Warner Losh [Fri, 9 Dec 2022 05:07:52 +0000 (22:07 -0700)]
kboot: Allow loading fdt from different sources

Linux has /sys/firmware/fdt and /proc/device-tree to publish the dtb for
the system. The former has it all in one file, while the latter breaks
it out. Prefer the former since it's the more modern interface, but
retain both since I don't have a PS3 to test to see if its kernel is new
enough for /sys/firmware or not.

In addition, do the proper fixup.

Sponsored by: Netflix

(cherry picked from commit 111610316e49dd6dc6b0b74455c1e4c81960faa8)

17 months agokboot: Need to find the ACPI tables
Warner Losh [Fri, 9 Dec 2022 04:56:06 +0000 (21:56 -0700)]
kboot: Need to find the ACPI tables

We need to pass the ACPI tables to the laucnhed kernel (at least for x86
and aarch64). Find it using the Linux standard way.

Sponsored by: Netflix

(cherry picked from commit 1066a70e149abb383c49a4587de21eebf9b7e1d5)

17 months agostand/kboot: Parse the command line args
Warner Losh [Wed, 7 Dec 2022 17:58:44 +0000 (10:58 -0700)]
stand/kboot: Parse the command line args

Do the standard command line parsing... With a small twist to deal with
the quirks of booting via linuxboot to the initrd from the command line
in shell.efi and other observed oddities.

Sponsored by: Netflix

(cherry picked from commit e1ff7945e1b3a9af34f092d9cca72ed802671c20)

17 months agostand/efi: remove unused local varaibles
Warner Losh [Wed, 7 Dec 2022 00:42:48 +0000 (17:42 -0700)]
stand/efi: remove unused local varaibles

Remove some unused local variables. No functional change.

Sponsored by: Netflix

(cherry picked from commit 667419d55313619807b07b1bff1b206fb5d9edbb)

17 months agostand/kboot: Remove unneeded include.
Warner Losh [Wed, 7 Dec 2022 17:53:40 +0000 (10:53 -0700)]
stand/kboot: Remove unneeded include.

endian.h isn't needed for this file, so remove it.

Sponsored by: Netflix

(cherry picked from commit 482380c6f8252228a172d82e74ef0964f8fc258b)

17 months agostand/kboot: Initialize all the devices
Warner Losh [Wed, 7 Dec 2022 17:50:35 +0000 (10:50 -0700)]
stand/kboot: Initialize all the devices

main() of the boot loader is expected to call devinit() early. We do
this at the same time we do it in the EFI loader (except we don't have a
buffer cache here, we don't need to initialize time and we don't have
special efi partition handles to enumerate). This is just after we probe
for the console.

Sponsored by: Netflix

(cherry picked from commit 299c64e316f026a9441775f21dfdb69e8125d58e)

17 months agokboot: copy EFI's bootinfo.c and adjust
Warner Losh [Tue, 6 Dec 2022 18:00:08 +0000 (11:00 -0700)]
kboot: copy EFI's bootinfo.c and adjust

Copy EFI's bootinfo.c and make minor adjustments for kboot's needs. Do
not connect this to the build just yet until other pieces are in place.

Sponsored by: Netflix

(cherry picked from commit 288626083b6064a777ecfe1f64af06d658ef804c)

17 months agokboot: Mark the EFI specific parts of bootinfo.c
Warner Losh [Tue, 6 Dec 2022 17:55:58 +0000 (10:55 -0700)]
kboot: Mark the EFI specific parts of bootinfo.c

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

(cherry picked from commit b11aebff4d4a301bfeac516b5be45080c8a11142)

17 months agostand/zlib: Document the upstream issue behind NO_DEPRECATED_NON_PROTOTYPE
Warner Losh [Mon, 5 Dec 2022 23:55:04 +0000 (16:55 -0700)]
stand/zlib: Document the upstream issue behind NO_DEPRECATED_NON_PROTOTYPE

The zlib project has issue https://github.com/madler/zlib/issues/633 to
document its continued use of old K&R-style function definitions.

Suggested by: delphij@
Sponsored by: Netflix

(cherry picked from commit 6b574b3ba99af4ae81d4c619057e737e67523907)

17 months agostand: update prototypes for md_load and md_load64
Warner Losh [Mon, 5 Dec 2022 17:40:15 +0000 (10:40 -0700)]
stand: update prototypes for md_load and md_load64

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

(cherry picked from commit 335615c4cad79765b46048bfa782120fd9cadb95)

17 months agokboot: Add md_addr to metadata
Warner Losh [Sun, 4 Dec 2022 20:52:22 +0000 (13:52 -0700)]
kboot: Add md_addr to metadata

Save the address of where the metadata is loaded.

Sponsored by: Netflix

(cherry picked from commit 9f7269677c5e70283a16887e1e4b4a1ed95a96fb)

17 months agokboot: Use #define for DT_DIR
Warner Losh [Sun, 4 Dec 2022 20:25:54 +0000 (13:25 -0700)]
kboot: Use #define for DT_DIR

Sponsored by: Netflix

(cherry picked from commit 0ea00e71a2734caeb166287873b697d917e5a92d)

17 months agokboot: powerpc64 has no newfstat system call
Warner Losh [Sun, 4 Dec 2022 20:20:04 +0000 (13:20 -0700)]
kboot: powerpc64 has no newfstat system call

Powerpc doesn't have a newfstat system call. It does have a fstat call,
which we define properly if SYS_newfstat isn't defined.

Sponsored by: Netflix

(cherry picked from commit 8483b3add8e706e6e54e8508e268c623f77031d1)

17 months agokboot: Add aarch64 termios
Warner Losh [Sun, 4 Dec 2022 20:16:32 +0000 (13:16 -0700)]
kboot: Add aarch64 termios

Aarch64 has the generic termios interface, so use termios_gen.h

Sponsored by: Netflix

(cherry picked from commit 58091659cf0805c8b5b977686313d06aeb400446)

17 months agokboot: Add missing license to termios
Warner Losh [Sun, 4 Dec 2022 20:12:09 +0000 (13:12 -0700)]
kboot: Add missing license to termios

I neglected to include the proper license markings on these
files. Remedy that now.

Sponsored by: Netflix

(cherry picked from commit 1fc8e9b833347e1376fa486ff1b0b756acdbfaf6)

17 months agostand: aarch64 has different nlinks than amd64
Warner Losh [Sun, 4 Dec 2022 05:46:21 +0000 (22:46 -0700)]
stand: aarch64 has different nlinks than amd64

Some typedefs are system dependent, so move them into stat_arch.h where
they are used.  On amd64, nlinks is a int64_t, while on aarch64 it's an
int (or int32_t).

Sponsored by: Netflix

(cherry picked from commit 929c6216b1668b9a8bc7d9d9edfd528ef74c69f8)

17 months agokboot: powerpc ldscript catchup
Warner Losh [Sun, 4 Dec 2022 04:41:05 +0000 (21:41 -0700)]
kboot: powerpc ldscript catchup

Catch up with the latest ldscript for powerpc. Make it match others in
the tree.

Sponsored by: Netflix

(cherry picked from commit e3b74ec119a7d98a0f340674e28923707b7166b4)

17 months agostand/efi: Break stlye rules a little for easier sharing
Warner Losh [Sun, 4 Dec 2022 00:23:25 +0000 (17:23 -0700)]
stand/efi: Break stlye rules a little for easier sharing

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

(cherry picked from commit aed1e5d332f9d26cdd8477bc336279217d53ecb8)

17 months agostand/efi: Better include order for sharing
Warner Losh [Sun, 4 Dec 2022 00:23:22 +0000 (17:23 -0700)]
stand/efi: Better include order for sharing

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

(cherry picked from commit 3f2c1eb5b84317bae98420c1346304b604436727)

17 months agostand/efi: Remove redundant parenthesis
Warner Losh [Sun, 4 Dec 2022 00:23:20 +0000 (17:23 -0700)]
stand/efi: Remove redundant parenthesis

Style: Remove redundant parens.

Sponsored by: Netflix

(cherry picked from commit 3df86732afed7cea51934d613f8aa43b87787cc1)

17 months agostand/efi: Document the copy size trick
Warner Losh [Sun, 4 Dec 2022 00:23:16 +0000 (17:23 -0700)]
stand/efi: Document the copy size trick

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

(cherry picked from commit 67e39a0d1bdb24967591721bf7c995d61e0e1c2d)

17 months agokboot: Enable fewer things by default
Warner Losh [Sat, 3 Dec 2022 19:48:23 +0000 (12:48 -0700)]
kboot: Enable fewer things by default

We don't need NFS / network support by default, nor do we need gzip
support. Remove them for now.

Sponsored by: Netflix

(cherry picked from commit cc623784c11df05b3019b282691b6abdd63d9a71)

17 months agokboot: Make dosfs support conditional
Warner Losh [Sat, 3 Dec 2022 19:48:19 +0000 (12:48 -0700)]
kboot: Make dosfs support conditional

Sponsored by: Netflix

(cherry picked from commit 4f6c506c6f44db2ac149a22c1048d526055b37e3)

17 months agokboot: Add readme
Warner Losh [Sat, 3 Dec 2022 19:48:16 +0000 (12:48 -0700)]
kboot: Add readme

Document how to test kboot and how to build a initrd.

Sponsored by: Netflix

(cherry picked from commit 59cbe840cffcd5513e1d3b8736fb6c0d10945ab2)

17 months agokboot: Move archsw init earlier
Warner Losh [Sat, 3 Dec 2022 19:48:11 +0000 (12:48 -0700)]
kboot: Move archsw init earlier

Do archsw init first thing.

Sponsored by: Netflix

(cherry picked from commit a2fbc8859361c7bac7823c0a1978c78df11bc81d)

17 months agokboot: Use unsigned long long.
Warner Losh [Fri, 2 Dec 2022 19:41:01 +0000 (12:41 -0700)]
kboot: Use unsigned long long.

For the 64-bit platforms, this is a nop. Currently kboot only supports
64-bit platforms, though. If we support 32-bit in the future, this will
become important.

Noticed by: rpokala
Sponsored by: Netflix

(cherry picked from commit da5d0a1dbc2838eae7033254705c684d7a013fce)

17 months agokboot: Enhance hostdisk
Warner Losh [Fri, 2 Dec 2022 18:28:08 +0000 (11:28 -0700)]
kboot: Enhance hostdisk

Added missing functionality to allow us to boot off of things like
/dev/nvme0n1p2 successfully. And to list all available devices and
partitions with 'lsdev'.

Sponsored by: Netflix

(cherry picked from commit 7685e8d97a22ae4b58243d6ef67569ea5bcbc988)

17 months agokboot: amd64 use /sys/firmware/memmap to find free memory
Warner Losh [Fri, 2 Dec 2022 18:10:42 +0000 (11:10 -0700)]
kboot: amd64 use /sys/firmware/memmap to find free memory

Use the system's firmware memory map to find a good place to put the
kernel that won't stomp on anything else. While this uses obstensibly MI
interfaces to get this data, arm64 doesn't have this, nor does
powerpc64, so place it here.

Sponsored by: Netflix

(cherry picked from commit c51e1d7c0a79a4fe2774d526ad0393cd2edd3f6c)

17 months agokboot: move to using devparse
Warner Losh [Fri, 2 Dec 2022 18:10:06 +0000 (11:10 -0700)]
kboot: move to using devparse

We can use devparse directly now. No need to invent a kboot_parsedev
that just does what devparse does now that we've refactored.

Sponsored by: Netflix

(cherry picked from commit 6f8e9f22739aa7f5fe997741e9f50a66385c9e0c)

17 months agokboot: Create routines to read Linux tiny files
Warner Losh [Fri, 2 Dec 2022 18:05:58 +0000 (11:05 -0700)]
kboot: Create routines to read Linux tiny files

Most of the files in /sys/ and /proc/ are small with one value. Create
two routines to help us read the file and decode that value.

Sponsored by: Netflix

(cherry picked from commit 7e1a2e46aa9a2f834c33b5c50de0437ac19d7b41)

17 months agostand/ofw: Refactor ofw parsedev
Warner Losh [Wed, 30 Nov 2022 22:10:23 +0000 (15:10 -0700)]
stand/ofw: Refactor ofw parsedev

Both ofw_disk and ofw_net use the same parsedev routine, except for the
string passed in to match the ofw device node's type. Create a routine
to do that and connect these two users up to that.

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

(cherry picked from commit f9ce8da86434867e1e7172fb56a5504f91c98ce4)

17 months agostand/ofw: Use devparse
Warner Losh [Wed, 30 Nov 2022 22:10:18 +0000 (15:10 -0700)]
stand/ofw: Use devparse

Retire the custom parsedev routine and use the standard devparse.

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

(cherry picked from commit 854001759e59172a2760d3a77f37a287f92053b3)

17 months agoofw/disk: Add parsedev support
Warner Losh [Wed, 30 Nov 2022 22:10:11 +0000 (15:10 -0700)]
ofw/disk: Add parsedev support

Add a parsedev support for OpenFirmware disks. We must look at
characteristics of the OFW node to know if we match this device (so
supply a match routine) or not. Add a parsing routine to allocate
devdesc for OpenFirmware disks as well.

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

(cherry picked from commit 88a8c68298dbc86370d9a7eff06314da398829cb)

17 months agostand/ofw: Subclass devnet to cope with ofw's unique needs
Warner Losh [Wed, 30 Nov 2022 22:10:05 +0000 (15:10 -0700)]
stand/ofw: Subclass devnet to cope with ofw's unique needs

We need to match devices in a slightly special way: We have to look up
the path and see if the device is a 'network' device in order to use it.

Sponsored by: Netflix
Tested by: grehan@ (with tweaks to my original patch)
Differential Revision: https://reviews.freebsd.org/D37557

(cherry picked from commit b8ff248f6595067ef9a31d5d4cec5fb9b9052fc3)

17 months agostand/ofw: Add ofw_path_to_handle
Warner Losh [Wed, 30 Nov 2022 22:10:00 +0000 (15:10 -0700)]
stand/ofw: Add ofw_path_to_handle

ofw_path_to_handle converts a path string to a phandle_t. It searches
down the path for the first device whose type matches the passed-in
string.

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

(cherry picked from commit ed3cc2f24829e6c5827f142cfcd9729331a1106c)

17 months agostand: Implement ofw disk print routine
Warner Losh [Wed, 30 Nov 2022 22:09:56 +0000 (15:09 -0700)]
stand: Implement ofw disk print routine

Have lsdev show openfirmware devices.

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

(cherry picked from commit 40d340acb9316db5771fe777e279776b903336d4)

17 months agostand: Add dv_match
Warner Losh [Wed, 30 Nov 2022 22:09:51 +0000 (15:09 -0700)]
stand: Add dv_match

On OpenFirmware, and possibly kboot, we use full path names for the
objects that are the 'device'. kboot uses a hack of knowing that all
disk device nodes start with '/dev', but this generalizes it for
OpenFirmware where both 'block' and 'network' devices live in the same
namespace and one must ask the OF node its type to know if this device
type matches.

For drivers that don't specify, the current convention of using
strncmp() is retained. This is done only in devparse(), but everything
uses it directly (or will soon).

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

(cherry picked from commit a07cef5a738642ae0a39fa513945d9f867a5e2f1)

17 months agostand: parsedev API change: devspec now points to start of full device name
Warner Losh [Wed, 30 Nov 2022 22:09:36 +0000 (15:09 -0700)]
stand: parsedev API change: devspec now points to start of full device name

To support more flexible device matching, we now pass in the full
devspec to the parsedev routines. For everything execpt uboot, this is
just a drop in (since everything except uboot and openfirmware always
uses disk...: and/or zfs:, but openfirmware isn't really affected).

uboot we kludge around it by subtracting 4 from where the rest of the
device name starts. This is unforunate, and can compute the address one
before the string. But we never dereference that address. uboot needs
more work, and this is an acceptable UB until that other work happens.

OFW doesn't really use the parsedev routines these days (since none of
the supported device uses this... yet). It too needs more work, but it
needs device matching support first.

Sponsored by: Netflix
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D37553

(cherry picked from commit 33bbe5ddcbbce03b6395a4948927643107b55c06)

17 months agostand: create devinit
Warner Losh [Wed, 30 Nov 2022 22:09:29 +0000 (15:09 -0700)]
stand: create devinit

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

(cherry picked from commit 66012c8fc4f92b80a61405dc7e206617e9f08920)

17 months agostand/ofw: ofw_disk isn't really a disk
Warner Losh [Wed, 30 Nov 2022 22:09:23 +0000 (15:09 -0700)]
stand/ofw: ofw_disk isn't really a disk

The rest of the code in the tree assumes that a DEVT_DISK uses a
disk_devdesc to represent the device. However ofw_disk diesn't, so we
can't use disk_fmtdev, nor disk_parsedev. ofw needs to have a
dv_match-like routine to use devpasrse, though, since we have two
drivers (net and block) that claim the same sort of devices (eg
/path/to/ofw-dev) based on the device-type property. In the interim, we
can't use devmatch and ofw_disk's and the default net driver's parsing
is offloaded ofw_parsedev.

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

(cherry picked from commit daaf594e8469b1fb4fb7861c2f7129f4d61c6d4d)

17 months agozfs: Remove devicename_stubs
Warner Losh [Wed, 30 Nov 2022 22:09:18 +0000 (15:09 -0700)]
zfs: Remove devicename_stubs

We no longer need the zfs stubs since we're no longer referencing these
functions outside of zfs.c.

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

(cherry picked from commit bb9f61da17f66352a344e14c4d32fda83126827b)

17 months agostand: make zfs_parsedev static
Warner Losh [Wed, 30 Nov 2022 22:09:14 +0000 (15:09 -0700)]
stand: make zfs_parsedev static

It's now unreferenced outside of zfs.c.

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

(cherry picked from commit 90412431fe1bf5f4a10b68c7938b0fc9f11dc4a2)

17 months agostand/ofw: Access the parsing routine more directly
Warner Losh [Wed, 30 Nov 2022 22:09:09 +0000 (15:09 -0700)]
stand/ofw: Access the parsing routine more directly

We don't need to check if something is a ZFS device. Instead, if the
found device has a parse routine, call it. Otherwise, just copy the
path.

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

(cherry picked from commit d16083815caf32dd117487c709b33669cef4af6f)

17 months agostand/userboot: Move to using common devparse()
Warner Losh [Wed, 30 Nov 2022 22:09:05 +0000 (15:09 -0700)]
stand/userboot: Move to using common devparse()

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/D37342

(cherry picked from commit 910de60a7e43c593b5126b2f1ee468c089c8116e)

17 months agostand/i386: Move to using common devparse()
Warner Losh [Wed, 30 Nov 2022 22:09:00 +0000 (15:09 -0700)]
stand/i386: Move to using common devparse()

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/D37341

(cherry picked from commit 641a0617e8d060c3c5fb997cee9e2b7fb40d9306)

17 months agostand/efi: Move to using common devparse()
Warner Losh [Wed, 30 Nov 2022 22:08:55 +0000 (15:08 -0700)]
stand/efi: Move to using common devparse()

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

(cherry picked from commit 77378d79f165b59296a0133eb910af55c8b2b600)

17 months agostand: For all disk drivers, connect dv_parsedev to disk_parsedev
Warner Losh [Wed, 30 Nov 2022 22:08:51 +0000 (15:08 -0700)]
stand: For all disk drivers, connect dv_parsedev to disk_parsedev

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

(cherry picked from commit 8337ab69ba8e065e5cfde8f09859ec1d0d47e892)

17 months agostand/zfs: Connect dv_parsedev to zfs_parsedev
Warner Losh [Wed, 30 Nov 2022 22:08:47 +0000 (15:08 -0700)]
stand/zfs: Connect dv_parsedev to zfs_parsedev

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

(cherry picked from commit ca0654bad68d521066497e708cfb56f5f3f5d1fa)

17 months agostand: Introduce devparse to parse device / path strings
Warner Losh [Wed, 30 Nov 2022 22:08:42 +0000 (15:08 -0700)]
stand: Introduce devparse to parse device / path strings

devparse is now the preferred interface to use to parse device
strings or device:/path strings. It parses the passed in string,
mallocs the device's particular devdesc string and returns the
'remainder' of the device:/path for further processing.

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

(cherry picked from commit 781ca0afcd6c64ac3fbaf2a19b1880734cdfe947)

17 months agostand: Introduce new dv_parsedev routine
Warner Losh [Wed, 30 Nov 2022 22:08:36 +0000 (15:08 -0700)]
stand: Introduce new dv_parsedev routine

Allow device classes to define a parsing routine. Most device classes
already have these routines, but there's much duplication in their
use. Define an interface for a common routine to parse an individual
device. By convetion, files have the form "[device:]/path/to/file"
where device is optional (filled in to be the value of currdev)
and it starts with the dv_name field of the device, with the rest
of the name up to the device (typically a unit number, but disks
add partition inforation, and other devices may do artibtrary
otehr things).

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

(cherry picked from commit a0aad69f9556221283b8f6ddcd332329b50463e4)

17 months agostand: Change zfs_parsedev() API
Warner Losh [Wed, 30 Nov 2022 22:08:22 +0000 (15:08 -0700)]
stand: Change zfs_parsedev() API

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

(cherry picked from commit ba11bc368e612e7c5bbc195830a280f8af73ce18)

17 months agostand: Change disk_parsedev() API
Warner Losh [Wed, 30 Nov 2022 22:08:15 +0000 (15:08 -0700)]
stand: Change disk_parsedev() API

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

(cherry picked from commit 17276525fa1a28028f7ca423f365d5081cbe9a97)

17 months agostand/zlib: Zlib still uses K&R function definitions
Warner Losh [Wed, 30 Nov 2022 18:08:24 +0000 (11:08 -0700)]
stand/zlib: Zlib still uses K&R function definitions

So add ${NO_WDEPRECATED_NON_PROTOTYPE} to the CFLAGS of those
files. This can be removed when we import a zlib that's free of this
anachronism.

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

(cherry picked from commit 983a18021decd68fbcf5d14ccd60c3d66dac1c6a)

17 months agoofw_net: Use c99 initializers
Warner Losh [Tue, 29 Nov 2022 21:47:02 +0000 (14:47 -0700)]
ofw_net: Use c99 initializers

Update to use c99 initializers, although there's no plans to change
anything that this would make easier...

Sponsored by: Netflix
Reviewed by: zlei
Differential Revision: https://reviews.freebsd.org/D37442

(cherry picked from commit 4c4563e32dfce0652953fcbd160a9dfdda050cc4)

17 months agostand/ofw: Use strpbrk instead of two strchrs
Warner Losh [Tue, 29 Nov 2022 20:02:40 +0000 (13:02 -0700)]
stand/ofw: Use strpbrk instead of two strchrs

No need to call strchr twice, when one call to strpbrk will do the
job.. Test booted with qemu-powerpc + mac99 successfully.
Minor style(9) tweaks as well.

Sponsored by: Netflix

(cherry picked from commit b60164c9f4d823b3e9fbcb733f92d181c704f415)

17 months agoofw: Remove old K&R function declaration
Warner Losh [Sun, 27 Nov 2022 20:34:33 +0000 (13:34 -0700)]
ofw: Remove old K&R function declaration

We don't need to forward declar strchr anymore.

Sponsored by: Netflix

(cherry picked from commit 9f7156560905f5da0b42dce3e5fb64f77e9f70aa)

17 months agoofw: Cast function pointer to proper type
Warner Losh [Sun, 27 Nov 2022 20:23:28 +0000 (13:23 -0700)]
ofw: Cast function pointer to proper type

clang 15 insists that we call entry() via a function prototype. Rather
than copping out and using (...), cast it to the same prototype that's
used elsewhere (with tweaks to pointers to make them fit into that
prototype). No functional change.

Sponsored by: Netflix

(cherry picked from commit fea231d21b299535302b41ac2e841f8abf1787fc)

17 months agolibsa: Add missing GNU-stack annotations to _setjmp.S.
John Baldwin [Tue, 22 Nov 2022 16:36:40 +0000 (08:36 -0800)]
libsa: Add missing GNU-stack annotations to _setjmp.S.

ld.bfd marks the stack as executable for the crt objects due to the
missing annotations which raises a fatal warning starting with version
2.39.

(cherry picked from commit 69f6399c3733d717bc3dcefda7fcc031f06cef0d)

17 months agostand: Update comment about devdesc
Warner Losh [Sat, 5 Nov 2022 01:45:27 +0000 (19:45 -0600)]
stand: Update comment about devdesc

How devdesc is used is opaque until much code is read. Give a more
useful description of the theory behind it here.

Sponsored by: Netflix

(cherry picked from commit 269865a8eed240f572472750451484feccaeeeea)

17 months agostand: Remove unused enum
Warner Losh [Fri, 4 Nov 2022 21:28:26 +0000 (15:28 -0600)]
stand: Remove unused enum

enum disk_ioctl is unused.  It's only ever defined. All of the stand
code uses DIOCGSECTORSIZE and DIOCGMEDIASIZE instead, both to query and
to implement ioctl.

Sponsored by: Netflix

(cherry picked from commit c9ee39a3f255b62cbf106f4e5a704bcefdef017b)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)

17 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)