Home | History | Annotate | only in /src/sys/stand
History log of /src/sys/stand
RevisionDateAuthorComments
 1.11 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.10 11-Dec-2005  christos branches: 1.10.74; 1.10.84; 1.10.90;
merge ktrace-lwp.
 1.9 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 01-Dec-2001  perry branches: 1.8.16;
bring back. we need to fix these, not remove them.
 1.7 28-Nov-2001  soren Nuke. These are very unlikely to start witht the current libsa, and can
always be brought back if necessary.
 1.6 13-Sep-1998  christos branches: 1.6.24; 1.6.26;
Fix rcsid's
 1.5 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.4 27-Jun-1994  cgd clean up SCCS/RCS ID's, add NetBSD to rcsid's.
 1.3 26-Jan-1994  cgd kill files that don't belong here, update rest from CMU stand lib
 1.2 20-May-1993  cgd add rcs ids, and clean up headers where necessary
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.24.1 08-Jan-2002  nathanw Catch up to -current.
 1.8.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.16.1 03-Aug-2004  skrll Sync with HEAD
 1.10.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.10.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.10.74.1 04-May-2009  yamt sync with head.
 1.14 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.13 11-Dec-2005  christos branches: 1.13.74; 1.13.84; 1.13.90;
merge ktrace-lwp.
 1.12 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 01-Dec-2001  perry branches: 1.11.16;
bring back. we need to fix these, not remove them.
 1.10 28-Nov-2001  soren Nuke. These are very unlikely to start witht the current libsa, and can
always be brought back if necessary.
 1.9 20-Oct-1998  matt branches: 1.9.24; 1.9.26;
vax -> __vax__ (and mips to __mips__ in ultrix_misc.c)
 1.8 13-Sep-1998  christos Fix rcsid's
 1.7 12-Oct-1996  christos backout previous kprintf change
 1.6 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.5 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.4 27-Jun-1994  cgd clean up SCCS/RCS ID's, add NetBSD to rcsid's.
 1.3 26-Jan-1994  cgd kill files that don't belong here, update rest from CMU stand lib
 1.2 20-May-1993  cgd add rcs ids, and clean up headers where necessary
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.9.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.24.1 08-Jan-2002  nathanw Catch up to -current.
 1.11.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.16.1 03-Aug-2004  skrll Sync with HEAD
 1.13.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.13.74.1 04-May-2009  yamt sync with head.
 1.3 26-Jan-1994  mycroft Clean up deleted files.
 1.2 20-May-1993  cgd add rcs ids, and clean up headers where necessary
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.17 27-Sep-2011  christos use NAME_MAX instead of MAXNAMLEN
 1.16 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.15 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.14 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.13 11-Dec-2005  christos branches: 1.13.74; 1.13.84; 1.13.90;
merge ktrace-lwp.
 1.12 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 22-Dec-2001  wiz branches: 1.11.16;
Fix two typos reported by Chris Lloyd in kern/15028.
 1.10 01-Dec-2001  perry bring back. we need to fix these, not remove them.
 1.9 28-Nov-2001  soren Nuke. These are very unlikely to start witht the current libsa, and can
always be brought back if necessary.
 1.8 13-Sep-1998  christos branches: 1.8.24; 1.8.26;
Fix rcsid's
 1.7 12-Oct-1996  christos Make this compile again.
 1.6 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.5 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.4 27-Jun-1994  cgd clean up SCCS/RCS ID's, add NetBSD to rcsid's.
 1.3 26-Jan-1994  cgd kill files that don't belong here, update rest from CMU stand lib
 1.2 20-May-1993  cgd add rcs ids, and clean up headers where necessary
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.24.1 08-Jan-2002  nathanw Catch up to -current.
 1.11.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.16.1 03-Aug-2004  skrll Sync with HEAD
 1.13.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.13.74.1 04-May-2009  yamt sync with head.
 1.3 26-Jan-1994  mycroft Clean up deleted files.
 1.2 20-May-1993  cgd add rcs ids, and clean up headers where necessary
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.3 26-Jan-1994  mycroft Clean up deleted files.
 1.2 20-May-1993  cgd add rcs ids, and clean up headers where necessary
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.3 26-Jan-1994  mycroft Clean up deleted files.
 1.2 20-May-1993  cgd add rcs ids, and clean up headers where necessary
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.3 26-Jan-1994  mycroft Clean up deleted files.
 1.2 20-May-1993  cgd add rcs ids, and clean up headers where necessary
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.31 02-Dec-2024  rin stand/efiboot: Enable to override `DEFAULT_TIMEOUT`

by `EFIBOOT_TIMEOUT` make(1) variable.
 1.30 20-Jan-2024  kre branches: 1.30.2;
Compensate for src/common/lib/libc/atomic/atomic_init_cas.c losing
the extern declaration of __libc_atomic_init() and instead using a
new one added to src/lib/libc/include/extern.h

That file is outside src/common and src/sys so is unavailable to
kernel builds, so instead make a new include file in src/common
which the kernel can read which contains the needed extern decl
for __libc_atomic_init()

This seems to fix the evbarm builds (maybe others) - but it is
all MUCH TOO UGLY to keep. Someone please make a better fix,
even if that just means reverting rev 1.5 of
src/common/lib/libc/atomic/atomic_init_cas.c
and all of the changes here (the addition to libc/include/extern.h
should be harmless to keep).
 1.29 15-Jun-2023  rin Add missing include paths for libz. Not used at the moment although.
 1.28 03-Jun-2023  lukem adapt to ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

Simplify CWARNFLAGS to use ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
which works for both clang and gcc, and remove compiler-specific
equivalents.
 1.27 03-Jun-2023  lukem bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER

Provide a single variable
CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
CLANG_NO_ADDR_OF_PACKED_MEMBER
CC_NO_ADDR_OF_PACKED_MEMBER
GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.26 25-Mar-2022  jmcneill branches: 1.26.4;
efiboot: Add support for 'userconf' command.

Add support for the 'userconf' command at the boot prompt and in boot.cfg,
and for FDT based booting, pass the commands as a string list property
named "netbsd,userconf" on the /chosen node.
 1.25 17-Oct-2021  jmcneill Honour the timeout= entry in boot.cfg
 1.24 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.23 28-Sep-2021  jmcneill efiboot: Add support for changing the video mode.

Add a new "gop" command that can query the list of available video modes.
With a mode number as argument (eg. "gop 16"), the new display mode will
be selected.

The "version" command prints the current display mode.
 1.22 20-Jun-2021  jmcneill Add support for the boot services watchdog and pet it on every block I/O
access. For slow media (like ISO image redirection on Lenovo HR330A BMC)
this is needed because otherwise the default watchdog timeout fires before
we can finish loading the kernel from install media.
 1.21 27-May-2021  mrg add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.20 04-May-2021  jmcneill branches: 1.20.2;
Set VERSIONMACHINE to ${MACHINE} instead of evbarm (oops)
 1.19 11-Oct-2020  jmcneill branches: 1.19.6;
Add ISO9660 support.
 1.18 06-Sep-2020  mrg add support for new GCC 9 warnings that may be too much to fix
right now. new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree. mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it. (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.) clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
 1.17 28-Jun-2020  jmcneill Remove support for storing settings in EFI environment variables now that
we have boot.cfg support.
 1.16 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.15 21-Jun-2020  jmcneill Add boot.cfg support.
 1.14 21-Jun-2020  jmcneill Add module support.
 1.13 14-May-2020  riastradh Draft logic to get at EFI RNG.
 1.12 26-Apr-2020  rin Adjust for binutils 2.34 in the same manner as efiboot/x86:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/i386/stand/efiboot/Makefile.efiboot#rev1.17
 1.11 01-Apr-2020  tnn efiboot: add clang fix from i386/stand/efiboot/bootx64/Makefile here too
 1.10 25-Jan-2020  jmcneill Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.9 30-Nov-2019  jmcneill branches: 1.9.2;
Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.8 21-Jul-2019  rin branches: 1.8.2;
Enable us to load kernel image of different byte order. Now, earmv7hf-eb
kernel can successfully boot from EFI bootloader.

XXX
We need to recognize disklabel and filesystem written in opposite byte oder.
 1.7 21-Apr-2019  thorpej branches: 1.7.2;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.6 12-Oct-2018  jmcneill Add ACPI support (enable with -DEFIBOOT_ACPI, currently disabled).

When UEFI reports that ACPI tables are available, generate a DTB with
compatible string "netbsd,generic-acpi" and pass this to the booted
kernel.

The DTB contains a /chosen property "netbsd,acpi-root-table" that contains
the physical address of the ACPI RSDP, along with a special /acpi node
with compatible string "netbsd,acpi" for the kernel to attach an acpi(4)
device driver.
 1.5 15-Sep-2018  jmcneill Suppress printing size info when calling loadfile with COUNT_KERNEL
 1.4 09-Sep-2018  jmcneill Add support for setting environment variables. Currently the following env
vars are supported: "fdtfile", "initrd", and "rootdev".
 1.3 03-Sep-2018  jmcneill branches: 1.3.2;
Add PXE support.
 1.2 26-Aug-2018  jmcneill Add support for booting kernels from FFS partitions.
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.3.2.4 20-Oct-2018  pgoyette Sync with head
 1.3.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.3.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.2.1 03-Sep-2018  pgoyette file Makefile.efiboot was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.7.2.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.2.2 10-Jun-2019  christos Sync with HEAD
 1.7.2.1 21-Apr-2019  christos file Makefile.efiboot was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.8.2.2 26-Jan-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #653):

sys/stand/efiboot/prompt.c: revision 1.6
sys/stand/efiboot/boot.c: revision 1.20
sys/stand/efiboot/bootarm/Makefile: revision 1.4
sys/stand/efiboot/efiacpi.c: revision 1.6
sys/stand/efiboot/exec.c: revision 1.13
sys/stand/efiboot/Makefile.efiboot: revision 1.10
sys/stand/efiboot/bootaa64/Makefile: revision 1.7

Fix for disappearing counters on graphics consoles

Hide the twiddle while loading efiboot plist

Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.8.2.1 08-Dec-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #503):

sys/stand/efiboot/Makefile.efiboot: revision 1.9
sys/stand/efiboot/efiacpi.c: revision 1.5
sys/stand/efiboot/version: revision 1.13
sys/stand/efiboot/smbios.h: revision 1.1
sys/stand/efiboot/smbios.c: revision 1.1

Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.9.2.1 25-Jan-2020  ad Sync with head.
 1.19.6.3 01-Aug-2021  thorpej Sync with HEAD.
 1.19.6.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.19.6.1 13-May-2021  thorpej Sync with HEAD.
 1.20.2.1 31-May-2021  cjep sync with head
 1.26.4.1 03-Nov-2023  martin Pull up following revision(s) (requested by rin in ticket #451):

sys/stand/efiboot/efiblock.c: revision 1.20
sys/stand/efiboot/exec.c: revision 1.24
sys/stand/efiboot/Makefile.efiboot: revision 1.29
sys/stand/efiboot/boot.c: revision 1.45

Add missing member for terminating sentinel.

Avoid void * pointer arithmetic; cast to UINT8 * explicitly.
No binary changes for aarch64 at least.

Use %zd instead of %ld for ssize_t.

Add missing include paths for libz. Not used at the moment although.
 1.30.2.1 02-Aug-2025  perseant Sync with HEAD
 1.45 14-Jun-2023  rin Add missing member for terminating sentinel.
 1.44 14-Aug-2022  jmcneill branches: 1.44.4;
Align output of "version" command.
 1.43 25-Mar-2022  jmcneill efiboot: Add support for 'userconf' command.

Add support for the 'userconf' command at the boot prompt and in boot.cfg,
and for FDT based booting, pass the commands as a string list property
named "netbsd,userconf" on the /chosen node.
 1.42 04-Nov-2021  skrll Fix non-ACPI builds.
 1.41 03-Nov-2021  skrll Provide the ablity to ignore ACPI with an 'acpi' command:

acpi [{on|off}]
 1.40 17-Oct-2021  jmcneill Honour the timeout= entry in boot.cfg
 1.39 09-Oct-2021  jmcneill efiboot: add "setup" command

The "setup" command sets the 64-bit "OsIndications" variable to the value of
EFI_OS_INDICATIONS_BOOT_TO_FW_UI and requests a reboot. On firmware that
supports this, after reboot the user will be presented with the firmware
setup menu.
 1.38 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.37 28-Sep-2021  jmcneill efiboot: Add support for changing the video mode.

Add a new "gop" command that can query the list of available video modes.
With a mode number as argument (eg. "gop 16"), the new display mode will
be selected.

The "version" command prints the current display mode.
 1.36 07-Sep-2021  nia Remove banner printing code from bootloaders, add it to libsa.

This harmonizes efiboot and the various x86 bootloaders to use shared
code for printing the banner. By friendly coincidence, it also adds
support for specifying 'banner=' in arm efiboot's boot.cfg, as on x86.
 1.35 24-Jul-2021  jmcneill efiboot: Allow "fs" as alias for "initrd", for compat with x86
 1.34 23-Jun-2021  jmcneill When printing memory size, don't promote to next unit size unless it is at
two digits.
 1.33 23-Jun-2021  jmcneill print_banner: Print memory size like x86 does
 1.32 21-Jun-2021  jmcneill efiboot: Add readahead support.

Reading data through libsa file-systems ends up breaking block I/O
accesses into very small (512-byte or 2048-byte) accesses. This can be
very inefficient, and causes Ampere eMAG w/ BMC image direction to take
_minutes_ to load the install image and kernel. So slow in fact that
the default watchdog timeout will fire before it finishes.

So, when loading big files, optimistically read ahead up to 64KB of data.
Brings the time to boot the install ISO down to around 40 seconds -- still
not ideal but way better than before.
 1.31 21-Jun-2021  nia efiboot: Add ASCII art.
 1.30 31-May-2021  rin Generalize boot.cfg workaround for ISO9660; fallback to default_device
whenever efi_file_path() fails (due to broken firmware), in addition to
the case of ISO9660 (for which efi_file_path() succeeds but does not
work correctly).
 1.29 28-Nov-2020  jmcneill branches: 1.29.4; 1.29.6;
Add a hook for MD specific info to print in the "ver" command. Use this
to print the value of the current execution level in bootaa64.
 1.28 11-Oct-2020  jmcneill branches: 1.28.2;
Add ISO9660 support.
 1.27 28-Jun-2020  jmcneill Remove support for storing settings in EFI environment variables now that
we have boot.cfg support.
 1.26 27-Jun-2020  jmcneill command_version: print config file path
 1.25 27-Jun-2020  jmcneill Load boot.cfg from the EFI system partition instead of the first FFS
partition on that device.
 1.24 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.23 21-Jun-2020  jmcneill Add boot.cfg support.
 1.22 21-Jun-2020  jmcneill Add module support.
 1.21 14-May-2020  riastradh Draft logic to get at EFI RNG.
 1.20 25-Jan-2020  jmcneill Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.19 18-Dec-2019  riastradh branches: 1.19.2;
Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.

Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.18 21-Apr-2019  thorpej branches: 1.18.2; 1.18.4;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.17 20-Apr-2019  jmcneill ST FirmwareRevision field is in a vendor defined format, so just print the raw value
 1.16 10-Apr-2019  skrll Print bootargs from the environment

Pass the enironment boot args if none are provided by the boot command
 1.15 18-Jan-2019  skrll Add support for "bootargs" environment variable from jmcneill@

Doesn't work with some (all?) u-boots.
 1.14 15-Nov-2018  jmcneill Add support for loading kernels over NFS.
 1.13 02-Nov-2018  jmcneill Add a "mem" command to print the EFI memory map.
 1.12 29-Oct-2018  mrg avoid sign/unsigned issue and for NUMNAMES to an integer when it is
compared against a value that may be -1.

fixes autoboot when boot-file is set. (serves me right for removing
code that looked odd when it was tested :-)
 1.11 26-Oct-2018  mrg add "boot-file" support. now one can automatically boot a
non-default kernel with "setenv boot-file host/netbsd".

this is particularly useful with the current net / tftp
kernel boot, so the tftproot does not need a "/netbsd"
visible to all hosts, but some host-specific path.

some minor clean up.

version 1.4.

ok jmcneill@.
 1.10 12-Oct-2018  jmcneill Add ACPI support (enable with -DEFIBOOT_ACPI, currently disabled).

When UEFI reports that ACPI tables are available, generate a DTB with
compatible string "netbsd,generic-acpi" and pass this to the booted
kernel.

The DTB contains a /chosen property "netbsd,acpi-root-table" that contains
the physical address of the ACPI RSDP, along with a special /acpi node
with compatible string "netbsd,acpi" for the kernel to attach an acpi(4)
device driver.
 1.9 09-Sep-2018  jmcneill Add a reboot command to the bootloader
 1.8 09-Sep-2018  jmcneill Add support for setting environment variables. Currently the following env
vars are supported: "fdtfile", "initrd", and "rootdev".
 1.7 09-Sep-2018  jmcneill Add "dtb" command for loading a custom .dtb file.
 1.6 07-Sep-2018  jmcneill Add initrd support.
 1.5 03-Sep-2018  jmcneill branches: 1.5.2;
Print FDT model and compatible strings with "version" command
 1.4 03-Sep-2018  jmcneill Add PXE support.
 1.3 26-Aug-2018  jmcneill Add support for booting kernels from FFS partitions.
 1.2 24-Aug-2018  jmcneill Use absolute paths for default kernel filenames
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.5.2.6 26-Jan-2019  pgoyette Sync with HEAD
 1.5.2.5 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.5.2.4 20-Oct-2018  pgoyette Sync with head
 1.5.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.5.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.5.2.1 03-Sep-2018  pgoyette file boot.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.18.4.2 12-Feb-2020  martin Pull up following revision(s) (requested by riastradh in ticket #705):

sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.35
sys/stand/efiboot/efifdt.c: revision 1.20
sys/stand/efiboot/efifdt.h: revision 1.7
sys/arch/aarch64/include/machdep.h: revision 1.9
sys/stand/efiboot/efiboot.h: revision 1.11
sys/arch/arm/arm32/arm32_machdep.c: revision 1.129
sys/arch/arm/include/arm32/machdep.h: revision 1.30
sys/stand/efiboot/exec.c: revision 1.12
sys/arch/evbarm/fdt/fdt_machdep.c: revision 1.65
sys/stand/efiboot/version: revision 1.14
sys/stand/efiboot/boot.c: revision 1.19

New function cpu_startup_hook on arm.

Called at end of cpu_startup. Can be defined in, e.g., evbarm to do
additional stuff after cpu_startup. Defined as a weak alias to a
function that does nothing, so optional.
ok jmcneill

Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.
Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.18.4.1 26-Jan-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #653):

sys/stand/efiboot/prompt.c: revision 1.6
sys/stand/efiboot/boot.c: revision 1.20
sys/stand/efiboot/bootarm/Makefile: revision 1.4
sys/stand/efiboot/efiacpi.c: revision 1.6
sys/stand/efiboot/exec.c: revision 1.13
sys/stand/efiboot/Makefile.efiboot: revision 1.10
sys/stand/efiboot/bootaa64/Makefile: revision 1.7

Fix for disappearing counters on graphics consoles

Hide the twiddle while loading efiboot plist

Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.18.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.18.2.2 10-Jun-2019  christos Sync with HEAD
 1.18.2.1 21-Apr-2019  christos file boot.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.19.2.1 25-Jan-2020  ad Sync with head.
 1.28.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.29.6.1 31-May-2021  cjep sync with head
 1.29.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.29.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.44.4.1 03-Nov-2023  martin Pull up following revision(s) (requested by rin in ticket #451):

sys/stand/efiboot/efiblock.c: revision 1.20
sys/stand/efiboot/exec.c: revision 1.24
sys/stand/efiboot/Makefile.efiboot: revision 1.29
sys/stand/efiboot/boot.c: revision 1.45

Add missing member for terminating sentinel.

Avoid void * pointer arithmetic; cast to UINT8 * explicitly.
No binary changes for aarch64 at least.

Use %zd instead of %ld for ssize_t.

Add missing include paths for libz. Not used at the moment although.
 1.5 08-Jun-2022  wiz Remove now unused bootdefault() function.

Part of PR 56862.
 1.4 25-Mar-2022  jmcneill efiboot: Add support for 'userconf' command.

Add support for the 'userconf' command at the boot prompt and in boot.cfg,
and for FDT based booting, pass the commands as a string list property
named "netbsd,userconf" on the /chosen node.
 1.3 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.2 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.1 21-Jun-2020  jmcneill Add boot.cfg support.
 1.2 08-Jun-2022  wiz Remove now unused bootdefault() function.

Part of PR 56862.
 1.1 21-Jun-2020  jmcneill Add boot.cfg support.
 1.6 24-Apr-2022  mlelstv Use physical sector size as unit for disk addresses.
Provide new ioctl to libsa to query for sector size.
 1.5 11-Oct-2020  jmcneill Add ISO9660 support.
 1.4 15-Nov-2018  jmcneill branches: 1.4.4;
Add support for loading kernels over NFS.
 1.3 03-Sep-2018  jmcneill branches: 1.3.2;
Add PXE support.
 1.2 26-Aug-2018  jmcneill Add support for booting kernels from FFS partitions.
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.3.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.3.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.2.1 03-Sep-2018  pgoyette file conf.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 15-Nov-2018  christos file conf.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.2 15-Sep-2018  jmcneill branches: 1.2.4;
Some U-Boot implementations (notably U-Boot) do not implement WaitForKey. Do the same as FreeBSD EFI loader here (I wrote the original patch there as well).
 1.1 24-Aug-2018  jmcneill branches: 1.1.2;
Add MI EFI bootloader and AArch64 glue.
 1.1.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 24-Aug-2018  pgoyette file console.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 15-Sep-2018  christos file console.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.3 15-Aug-2024  skrll Trailing whitespace.
 1.2 15-Nov-2018  jmcneill branches: 1.2.4; 1.2.38;
Add support for loading kernels over NFS.
 1.1 03-Sep-2018  jmcneill branches: 1.1.2;
Add PXE support.
 1.1.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 03-Sep-2018  pgoyette file dev_net.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.2.38.1 02-Aug-2025  perseant Sync with HEAD
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 15-Nov-2018  christos file dev_net.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.4 15-Nov-2018  jmcneill branches: 1.4.4;
Add support for loading kernels over NFS.
 1.3 03-Sep-2018  jmcneill branches: 1.3.2;
Add PXE support.
 1.2 26-Aug-2018  jmcneill Add support for booting kernels from FFS partitions.
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.3.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.3.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.2.1 03-Sep-2018  pgoyette file devopen.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 15-Nov-2018  christos file devopen.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.1 24-Aug-2018  jmcneill branches: 1.1.2; 1.1.6;
Add MI EFI bootloader and AArch64 glue.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 24-Aug-2018  christos file devopen.h was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 24-Aug-2018  pgoyette file devopen.h was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.13 14-Aug-2022  jmcneill Align output of "version" command.
 1.12 03-Nov-2021  skrll Provide the ablity to ignore ACPI with an 'acpi' command:

acpi [{on|off}]
 1.11 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.10 23-Jul-2021  jmcneill efiboot: Add support for SMBIOS 2.x tables.
 1.9 21-May-2021  jmcneill Disable ACPI support when booting big endian kernels.
 1.8 10-Oct-2020  jmcneill branches: 1.8.6; 1.8.8;
Support EFI runtime and GOP FB for devicetree (non-ACPI) setups.
 1.7 14-May-2020  riastradh Draft logic to get at EFI RNG.
 1.6 25-Jan-2020  jmcneill Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.5 30-Nov-2019  jmcneill branches: 1.5.2;
Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.4 01-Aug-2019  jmcneill Add full UEFI memory map to the /chosen node.
 1.3 28-Oct-2018  jmcneill branches: 1.3.4; 1.3.6;
Make EFI runtime services available to the kernel. Bump version to 1.5.
 1.2 23-Oct-2018  jmcneill If an SMBIOS3 table is found, pass the address to the kernel via /chosen
"netbsd,smbios-table" property.
 1.1 12-Oct-2018  jmcneill branches: 1.1.2;
Add ACPI support (enable with -DEFIBOOT_ACPI, currently disabled).

When UEFI reports that ACPI tables are available, generate a DTB with
compatible string "netbsd,generic-acpi" and pass this to the booted
kernel.

The DTB contains a /chosen property "netbsd,acpi-root-table" that contains
the physical address of the ACPI RSDP, along with a special /acpi node
with compatible string "netbsd,acpi" for the kernel to attach an acpi(4)
device driver.
 1.1.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.1.2.2 20-Oct-2018  pgoyette Sync with head
 1.1.2.1 12-Oct-2018  pgoyette file efiacpi.c was added on branch pgoyette-compat on 2018-10-20 06:58:46 +0000
 1.3.6.3 26-Jan-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #653):

sys/stand/efiboot/prompt.c: revision 1.6
sys/stand/efiboot/boot.c: revision 1.20
sys/stand/efiboot/bootarm/Makefile: revision 1.4
sys/stand/efiboot/efiacpi.c: revision 1.6
sys/stand/efiboot/exec.c: revision 1.13
sys/stand/efiboot/Makefile.efiboot: revision 1.10
sys/stand/efiboot/bootaa64/Makefile: revision 1.7

Fix for disappearing counters on graphics consoles

Hide the twiddle while loading efiboot plist

Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.3.6.2 08-Dec-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #503):

sys/stand/efiboot/Makefile.efiboot: revision 1.9
sys/stand/efiboot/efiacpi.c: revision 1.5
sys/stand/efiboot/version: revision 1.13
sys/stand/efiboot/smbios.h: revision 1.1
sys/stand/efiboot/smbios.c: revision 1.1

Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.3.6.1 04-Aug-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #3):

sys/stand/efiboot/efiacpi.c: revision 1.4
sys/stand/efiboot/efifdt.c: revision 1.18
sys/stand/efiboot/version: revision 1.12
sys/arch/arm/acpi/acpi_machdep.c: revision 1.7
sys/arch/arm/acpi/acpi_machdep.c: revision 1.8

Add full UEFI memory map to the /chosen node.

-

acpi_md_OsMapMemory can be used for both normal and device memory. Use the
UEFI memory map to determine how to map a given region.

Always map ACPI table memory as normal memory. Always map device memory as device memory.
 1.3.4.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 28-Oct-2018  christos file efiacpi.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.5.2.1 25-Jan-2020  ad Sync with head.
 1.8.8.1 31-May-2021  cjep sync with head
 1.8.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.8.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.3 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.2 21-May-2021  jmcneill Disable ACPI support when booting big endian kernels.
 1.1 12-Oct-2018  jmcneill branches: 1.1.2; 1.1.6; 1.1.20; 1.1.22;
Add ACPI support (enable with -DEFIBOOT_ACPI, currently disabled).

When UEFI reports that ACPI tables are available, generate a DTB with
compatible string "netbsd,generic-acpi" and pass this to the booted
kernel.

The DTB contains a /chosen property "netbsd,acpi-root-table" that contains
the physical address of the ACPI RSDP, along with a special /acpi node
with compatible string "netbsd,acpi" for the kernel to attach an acpi(4)
device driver.
 1.1.22.1 31-May-2021  cjep sync with head
 1.1.20.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 12-Oct-2018  christos file efiacpi.h was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.1.2.2 20-Oct-2018  pgoyette Sync with head
 1.1.2.1 12-Oct-2018  pgoyette file efiacpi.h was added on branch pgoyette-compat on 2018-10-20 06:58:46 +0000
 1.20 14-Jun-2023  rin Avoid void * pointer arithmetic; cast to UINT8 * explicitly.
No binary changes for aarch64 at least.
 1.19 24-Apr-2022  mlelstv branches: 1.19.4;
Use physical sector size as unit for disk addresses.
Provide new ioctl to libsa to query for sector size.
 1.18 30-Oct-2021  jmcneill If a path is not specified, assume /. This makes "ls" and "ls hd0b:" work
as expected.
 1.17 23-Jun-2021  jmcneill fix typo
 1.16 23-Jun-2021  jmcneill Fix buffer size for alignment adjusted block I/O reads.
 1.15 22-Jun-2021  jmcneill efiboot: Use EFI_BLOCK_IO_PROTOCOL if EFI_DISK_IO_PROTOCOL is missing

UEFI spec says that firmware should automatically add EFI_DISK_IO_PROTOCOL
for all produced EFI_BLOCK_IO_PROTOCOL interfaces. Unfortunately U-Boot
doesn't do this, so fallback to block I/O if disk I/O is not there.
 1.14 21-Jun-2021  jmcneill efiboot: Add readahead support.

Reading data through libsa file-systems ends up breaking block I/O
accesses into very small (512-byte or 2048-byte) accesses. This can be
very inefficient, and causes Ampere eMAG w/ BMC image direction to take
_minutes_ to load the install image and kernel. So slow in fact that
the default watchdog timeout will fire before it finishes.

So, when loading big files, optimistically read ahead up to 64KB of data.
Brings the time to boot the install ISO down to around 40 seconds -- still
not ideal but way better than before.
 1.13 21-Jun-2021  jmcneill efiboot: Use disk I/O protocol for block device access.

EFI_DISK_IO_PROTOCOL is a simplified interface to block devices. Use this
instead of EFI_BLOCK_IO_PROTOCOL for accessing block devices to simplify
the code -- we no longer need to worry about the underlying media's block
I/O size and alignment requirements.
 1.12 20-Jun-2021  jmcneill Add support for the boot services watchdog and pet it on every block I/O
access. For slow media (like ISO image redirection on Lenovo HR330A BMC)
this is needed because otherwise the default watchdog timeout fires before
we can finish loading the kernel from install media.
 1.11 26-May-2021  mrg add basic raidframe support to efiboot.

if raid disklabel or gpt is found, add this partition with
the offset/size adjusted by RF_PROTECTED_SECTORS. note

don't le32toh() the disklabel. if it was wrong-endian, then
getdisklabel() will have swapped it.

ok jmcneill thorpej.
 1.10 28-Nov-2020  jmcneill branches: 1.10.4; 1.10.6;
Deal with devices that report either 512 or 2048 as logical block size
for CD9660 file-systems.
 1.9 18-Oct-2020  tnn branches: 1.9.2;
efiboot: recognize the EFI system partition as fstype MSDOS
 1.8 11-Oct-2020  jmcneill Add ISO9660 support.
 1.7 27-Sep-2019  jakllsch Use roundup2() instead of open coding something almost the same that
truncates 64-bit quantities.

Fixes disk access and booting in bootaa64.efi on SoftIron OverDrive 1000
(which does not have any memory below 4GiB).
 1.6 21-Sep-2019  jmcneill Honour block device's IO alignment requirements.

Patch from Simon South <simon@simonsouth.net> in PR# 54554
 1.5 09-Mar-2019  jmcneill branches: 1.5.4; 1.5.6;
Workaround a bug with ROCKPro64's U-Boot EFI implementation. The booted
device path when booting from SD card sometimes does not include a
MEDIA_DEVICE_PATH component, so in this case fallback to doing an exact
match on the booted device path with the block device path to detect the
default boot device.
 1.4 01-Nov-2018  jmcneill Add GPT support.
 1.3 14-Sep-2018  jakllsch MI efiboot: avoid LBA overflow in efi_block_find_partitions_disklabel()
 1.2 27-Aug-2018  jmcneill branches: 1.2.2;
Pass a hash of the MBR and the booted partition to the kernel.
 1.1 26-Aug-2018  jmcneill Add support for booting kernels from FFS partitions.
 1.2.2.4 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.2.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.2.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2.2.1 27-Aug-2018  pgoyette file efiblock.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.5.6.2 28-Sep-2019  martin Pull up following revision(s) (requested by jakllsch in ticket #257):

sys/stand/efiboot/efiblock.c: revision 1.7

Use roundup2() instead of open coding something almost the same that
truncates 64-bit quantities.

Fixes disk access and booting in bootaa64.efi on SoftIron OverDrive 1000
(which does not have any memory below 4GiB).
 1.5.6.1 22-Sep-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #225):

sys/stand/efiboot/efiblock.c: revision 1.6

Honour block device's IO alignment requirements.
Patch from Simon South <simon%simonsouth.net@localhost> in PR# 54554
 1.5.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.4.2 10-Jun-2019  christos Sync with HEAD
 1.5.4.1 09-Mar-2019  christos file efiblock.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.9.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.10.6.1 31-May-2021  cjep sync with head
 1.10.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.10.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.19.4.1 03-Nov-2023  martin Pull up following revision(s) (requested by rin in ticket #451):

sys/stand/efiboot/efiblock.c: revision 1.20
sys/stand/efiboot/exec.c: revision 1.24
sys/stand/efiboot/Makefile.efiboot: revision 1.29
sys/stand/efiboot/boot.c: revision 1.45

Add missing member for terminating sentinel.

Avoid void * pointer arithmetic; cast to UINT8 * explicitly.
No binary changes for aarch64 at least.

Use %zd instead of %ld for ssize_t.

Add missing include paths for libz. Not used at the moment although.
 1.7 24-Apr-2022  mlelstv Use physical sector size as unit for disk addresses.
Provide new ioctl to libsa to query for sector size.
 1.6 21-Jun-2021  jmcneill efiboot: Add readahead support.

Reading data through libsa file-systems ends up breaking block I/O
accesses into very small (512-byte or 2048-byte) accesses. This can be
very inefficient, and causes Ampere eMAG w/ BMC image direction to take
_minutes_ to load the install image and kernel. So slow in fact that
the default watchdog timeout will fire before it finishes.

So, when loading big files, optimistically read ahead up to 64KB of data.
Brings the time to boot the install ISO down to around 40 seconds -- still
not ideal but way better than before.
 1.5 21-Jun-2021  jmcneill efiboot: Use disk I/O protocol for block device access.

EFI_DISK_IO_PROTOCOL is a simplified interface to block devices. Use this
instead of EFI_BLOCK_IO_PROTOCOL for accessing block devices to simplify
the code -- we no longer need to worry about the underlying media's block
I/O size and alignment requirements.
 1.4 11-Oct-2020  jmcneill branches: 1.4.6;
Add ISO9660 support.
 1.3 01-Nov-2018  jmcneill branches: 1.3.4;
Add GPT support.
 1.2 27-Aug-2018  jmcneill branches: 1.2.2;
Pass a hash of the MBR and the booted partition to the kernel.
 1.1 26-Aug-2018  jmcneill Add support for booting kernels from FFS partitions.
 1.2.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.2.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2.2.1 27-Aug-2018  pgoyette file efiblock.h was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 01-Nov-2018  christos file efiblock.h was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.4.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.24 15-Aug-2024  skrll Rename some symbols for consistency with the style used elsewhere
in efiboot.

NFCI.
 1.23 28-Mar-2024  riastradh branches: 1.23.2;
efiboot: Duplicate efi_bootdp before we clobber it in efi_net_probe.

Patch from jakllsch@. Makes Socionext Synquacer boot considerably
more reliably.

PR kern/58075
 1.22 06-Oct-2021  jmcneill branches: 1.22.4;
efiboot: Make FDT support optional on a per-arch basis.
 1.21 28-Sep-2021  jmcneill efiboot: Add support for changing the video mode.

Add a new "gop" command that can query the list of available video modes.
With a mode number as argument (eg. "gop 16"), the new display mode will
be selected.

The "version" command prints the current display mode.
 1.20 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.19 21-Jun-2020  jmcneill Add boot.cfg support.
 1.18 14-May-2020  riastradh Pass EFI RNG output via /chosen/netbsd,efirng-{start,end}.

This is separate from /chosen/netbsd,rndseed-{start,end}, which
specifies NetBSD's persistent on-disk seed; efirng is the firmware's
RNG device.
 1.17 26-Sep-2019  jmcneill Do a full reset of the console at startup
 1.16 21-Apr-2019  thorpej branches: 1.16.2; 1.16.4;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.15 20-Apr-2019  jmcneill Skip clearing the screen when efiboot starts, it may end up hiding useful information
 1.14 10-Apr-2019  skrll Fixup EFIBOT_DEBUG output for non-_LP64 case
 1.13 30-Mar-2019  jmcneill Build fixes for 32-bit targets.
 1.12 01-Nov-2018  jmcneill Add GPT support.
 1.11 31-Oct-2018  jmcneill Assign VAs for EFI runtime mmio ranges
 1.10 28-Oct-2018  jmcneill Make EFI runtime services available to the kernel. Bump version to 1.5.
 1.9 12-Oct-2018  jmcneill Add ACPI support (enable with -DEFIBOOT_ACPI, currently disabled).

When UEFI reports that ACPI tables are available, generate a DTB with
compatible string "netbsd,generic-acpi" and pass this to the booted
kernel.

The DTB contains a /chosen property "netbsd,acpi-root-table" that contains
the physical address of the ACPI RSDP, along with a special /acpi node
with compatible string "netbsd,acpi" for the kernel to attach an acpi(4)
device driver.
 1.8 15-Sep-2018  jmcneill Suppress printing size info when calling loadfile with COUNT_KERNEL
 1.7 15-Sep-2018  jmcneill Claer the screen at startup
 1.6 09-Sep-2018  jmcneill Add a reboot command to the bootloader
 1.5 03-Sep-2018  jmcneill branches: 1.5.2;
Add PXE support.
 1.4 26-Aug-2018  jmcneill Add support for booting kernels from FFS partitions.
 1.3 24-Aug-2018  jmcneill If we could not query the DevicePathProtocol handle, just select no default boot device instead of exiting.
 1.2 24-Aug-2018  jmcneill EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset() may not be supported. Failing to reset is not a fatal error, so ignore the status.
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.5.2.5 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.5.2.4 20-Oct-2018  pgoyette Sync with head
 1.5.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.5.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.5.2.1 03-Sep-2018  pgoyette file efiboot.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.16.4.2 18-Apr-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1828):

sys/stand/efiboot/efiboot.c: revision 1.23

efiboot: Duplicate efi_bootdp before we clobber it in efi_net_probe.

Patch from jakllsch@. Makes Socionext Synquacer boot considerably
more reliably.

PR kern/58075
 1.16.4.1 26-Sep-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #249):

sys/stand/efiboot/efiboot.c: revision 1.17

Do a full reset of the console at startup
 1.16.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.16.2.2 10-Jun-2019  christos Sync with HEAD
 1.16.2.1 21-Apr-2019  christos file efiboot.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.22.4.1 18-Apr-2024  martin Pull up following revision(s) (requested by riastradh in ticket #656):

sys/stand/efiboot/efiboot.c: revision 1.23

efiboot: Duplicate efi_bootdp before we clobber it in efi_net_probe.

Patch from jakllsch@. Makes Socionext Synquacer boot considerably
more reliably.

PR kern/58075
 1.23.2.1 02-Aug-2025  perseant Sync with HEAD
 1.22 15-Aug-2024  skrll Move function declarations into correct header.

NFCI.
 1.21 15-Aug-2024  skrll Rename some symbols for consistency with the style used elsewhere
in efiboot.

NFCI.
 1.20 14-Aug-2022  jmcneill branches: 1.20.10;
Align output of "version" command.
 1.19 25-Mar-2022  jmcneill efiboot: Add support for 'userconf' command.

Add support for the 'userconf' command at the boot prompt and in boot.cfg,
and for FDT based booting, pass the commands as a string list property
named "netbsd,userconf" on the /chosen node.
 1.18 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.17 28-Sep-2021  jmcneill efiboot: Add support for changing the video mode.

Add a new "gop" command that can query the list of available video modes.
With a mode number as argument (eg. "gop 16"), the new display mode will
be selected.

The "version" command prints the current display mode.
 1.16 07-Sep-2021  nia Remove banner printing code from bootloaders, add it to libsa.

This harmonizes efiboot and the various x86 bootloaders to use shared
code for printing the banner. By friendly coincidence, it also adds
support for specifying 'banner=' in arm efiboot's boot.cfg, as on x86.
 1.15 20-Jun-2021  jmcneill Add support for the boot services watchdog and pet it on every block I/O
access. For slow media (like ISO image redirection on Lenovo HR330A BMC)
this is needed because otherwise the default watchdog timeout fires before
we can finish loading the kernel from install media.
 1.14 11-Oct-2020  jmcneill branches: 1.14.6;
Add ISO9660 support.
 1.13 15-Jul-2020  jmcneill Fixup OpenSimpleReadFile usage:
- The "EFI_DEVICE_PATH **FilePath" parameter can change, so do not free
the output. This was causing crashes on U-Boot when attempting to load
boot.cfg, even if it didn't exist.
- Allocate the SIMPLE_READ_FILE in advance and store a pointer to it in
struct open_file.
 1.12 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.11 18-Dec-2019  riastradh Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.

Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.10 21-Apr-2019  thorpej branches: 1.10.2; 1.10.4;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.9 15-Nov-2018  jmcneill Add support for loading kernels over NFS.
 1.8 26-Oct-2018  mrg add "boot-file" support. now one can automatically boot a
non-default kernel with "setenv boot-file host/netbsd".

this is particularly useful with the current net / tftp
kernel boot, so the tftproot does not need a "/netbsd"
visible to all hosts, but some host-specific path.

some minor clean up.

version 1.4.

ok jmcneill@.
 1.7 15-Sep-2018  jmcneill Suppress printing size info when calling loadfile with COUNT_KERNEL
 1.6 09-Sep-2018  jmcneill Add a reboot command to the bootloader
 1.5 09-Sep-2018  jmcneill Add "dtb" command for loading a custom .dtb file.
 1.4 07-Sep-2018  jmcneill Add initrd support.
 1.3 03-Sep-2018  jmcneill branches: 1.3.2;
Add PXE support.
 1.2 26-Aug-2018  jmcneill Add support for booting kernels from FFS partitions.
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.3.2.4 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.3.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.3.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.2.1 03-Sep-2018  pgoyette file efiboot.h was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.10.4.1 12-Feb-2020  martin Pull up following revision(s) (requested by riastradh in ticket #705):

sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.35
sys/stand/efiboot/efifdt.c: revision 1.20
sys/stand/efiboot/efifdt.h: revision 1.7
sys/arch/aarch64/include/machdep.h: revision 1.9
sys/stand/efiboot/efiboot.h: revision 1.11
sys/arch/arm/arm32/arm32_machdep.c: revision 1.129
sys/arch/arm/include/arm32/machdep.h: revision 1.30
sys/stand/efiboot/exec.c: revision 1.12
sys/arch/evbarm/fdt/fdt_machdep.c: revision 1.65
sys/stand/efiboot/version: revision 1.14
sys/stand/efiboot/boot.c: revision 1.19

New function cpu_startup_hook on arm.

Called at end of cpu_startup. Can be defined in, e.g., evbarm to do
additional stuff after cpu_startup. Defined as a weak alias to a
function that does nothing, so optional.
ok jmcneill

Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.
Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.10.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.2.2 10-Jun-2019  christos Sync with HEAD
 1.10.2.1 21-Apr-2019  christos file efiboot.h was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.14.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.20.10.1 02-Aug-2025  perseant Sync with HEAD
 1.5 15-Aug-2024  skrll Allow an MD check in prepare_boot and use it on arm64 (aarch64) to check
that, if a big endian kernel is seen, the CPU is capable of supporting BE
data accesses at EL0 via ID_AA64MMFR0_EL1.BigEnd.
 1.4 01-Aug-2023  mrg branches: 1.4.6;
fix simple mis-matched function prototype and definitions.

most of these are like, eg

void foo(int[2]);

with either of these

void foo(int*) { ... }
void foo(int[]) { ... }

in some cases (such as stat or utimes* calls found in our header files),
we now match standard definition from opengroup.

found by GCC 12.
 1.3 28-Nov-2020  jmcneill Add a hook for MD specific info to print in the "ver" command. Use this
to print the value of the current execution level in bootaa64.
 1.2 07-Sep-2018  jmcneill branches: 1.2.4; 1.2.14;
Disable MMU and dcache before jumping to the kernel.
 1.1 24-Aug-2018  jmcneill branches: 1.1.2;
Add MI EFI bootloader and AArch64 glue.
 1.1.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 24-Aug-2018  pgoyette file efiboot_machdep.h was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.2.14.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 07-Sep-2018  christos file efiboot_machdep.h was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.4.6.1 02-Aug-2025  perseant Sync with HEAD
 1.1 24-Aug-2018  jmcneill branches: 1.1.2; 1.1.6;
Add MI EFI bootloader and AArch64 glue.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 24-Aug-2018  christos file efichar.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 24-Aug-2018  pgoyette file efichar.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.2 15-Jul-2020  jmcneill Fixup OpenSimpleReadFile usage:
- The "EFI_DEVICE_PATH **FilePath" parameter can change, so do not free
the output. This was causing crashes on U-Boot when attempting to load
boot.cfg, even if it didn't exist.
- Allocate the SIMPLE_READ_FILE in advance and store a pointer to it in
struct open_file.
 1.1 26-Aug-2018  jmcneill branches: 1.1.2; 1.1.6;
Add support for booting kernels from FFS partitions.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 26-Aug-2018  christos file efidev.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 26-Aug-2018  pgoyette file efidev.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.7 28-Jun-2020  jmcneill Remove support for storing settings in EFI environment variables now that
we have boot.cfg support.
 1.6 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.5 14-May-2020  msaitoh Remove extra semicolon.
 1.4 21-Apr-2019  thorpej branches: 1.4.2;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.3 30-Mar-2019  jmcneill Build fixes for 32-bit targets.
 1.2 18-Sep-2018  jmcneill branches: 1.2.2;
utf8_to_ucs2 second param (nmp) needs to be initialized before calling this function
 1.1 09-Sep-2018  jmcneill Add support for setting environment variables. Currently the following env
vars are supported: "fdtfile", "initrd", and "rootdev".
 1.2.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.2.2.1 18-Sep-2018  pgoyette file efienv.c was added on branch pgoyette-compat on 2018-09-30 01:45:57 +0000
 1.4.2.2 10-Jun-2019  christos Sync with HEAD
 1.4.2.1 21-Apr-2019  christos file efienv.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.4 28-Jun-2020  jmcneill Remove support for storing settings in EFI environment variables now that
we have boot.cfg support.
 1.3 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.2 21-Apr-2019  thorpej branches: 1.2.2;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.1 09-Sep-2018  jmcneill branches: 1.1.2;
Add support for setting environment variables. Currently the following env
vars are supported: "fdtfile", "initrd", and "rootdev".
 1.1.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.1.2.1 09-Sep-2018  pgoyette file efienv.h was added on branch pgoyette-compat on 2018-09-30 01:45:58 +0000
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 21-Apr-2019  christos file efienv.h was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.38 07-Dec-2024  jmcneill efiboot: Use 1:1 PA to VA mappings for RT services.

UEFI firmware on Snapdragon X Elite devices crashes when
SetVirtualAddressMap is called with runtime mappings that are not 1:1.
Always do this on arm64 as it won't interfere with KVA and will help us
avoid avoid a very common class of firmware bugs.
 1.37 15-Aug-2024  skrll Allow an MD check in prepare_boot and use it on arm64 (aarch64) to check
that, if a big endian kernel is seen, the CPU is capable of supporting BE
data accesses at EL0 via ID_AA64MMFR0_EL1.BigEnd.
 1.36 15-Aug-2024  skrll Rename some symbols for consistency with the style used elsewhere
in efiboot.

NFCI.
 1.35 14-Aug-2022  jmcneill branches: 1.35.10;
Align output of "version" command.
 1.34 25-Mar-2022  jmcneill efiboot: Add support for 'userconf' command.

Add support for the 'userconf' command at the boot prompt and in boot.cfg,
and for FDT based booting, pass the commands as a string list property
named "netbsd,userconf" on the /chosen node.
 1.33 06-Nov-2021  jmcneill Revert part of previous commit that broke DT booting.
 1.32 03-Nov-2021  skrll Provide the ablity to ignore ACPI with an 'acpi' command:

acpi [{on|off}]
 1.31 06-Oct-2021  jmcneill Fix bootarm build.
 1.30 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.29 21-May-2021  jmcneill Disable ACPI support when booting big endian kernels.
 1.28 19-Dec-2020  skrll branches: 1.28.4; 1.28.6;
Various clean ups
- cache node where possible
- remove a compiler warning
- improve a comment (the round_page might not be needed)
 1.27 22-Oct-2020  jmcneill branches: 1.27.2;
Fix previous.
 1.26 22-Oct-2020  jmcneill If the framebuffer node already exists, we don't need to create one
 1.25 10-Oct-2020  jmcneill Support EFI runtime and GOP FB for devicetree (non-ACPI) setups.
 1.24 21-Jun-2020  jmcneill Add module support.
 1.23 14-May-2020  riastradh Deduplicate lazy /chosen node creation logic.
 1.22 14-May-2020  riastradh Pass EFI RNG output via /chosen/netbsd,efirng-{start,end}.

This is separate from /chosen/netbsd,rndseed-{start,end}, which
specifies NetBSD's persistent on-disk seed; efirng is the firmware's
RNG device.
 1.21 03-Jan-2020  skrll Fix EFIBOOT_DEBUG build on arm
 1.20 18-Dec-2019  riastradh Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.

Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.19 30-Aug-2019  jmcneill Only set #address-cells and #size-cells properties on /chosen if we are
fabricating a devicetree (ACPI mode). Fixes PR# 54494
 1.18 01-Aug-2019  jmcneill Add full UEFI memory map to the /chosen node.
 1.17 25-Jul-2019  skrll branches: 1.17.2;
Fix arm build
 1.16 24-Jul-2019  jmcneill Add support for simple framebuffers when booting in ACPI mode.
 1.15 21-Apr-2019  thorpej branches: 1.15.2;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.14 15-Nov-2018  jmcneill Add support for loading kernels over NFS.
 1.13 02-Nov-2018  jmcneill Add a "mem" command to print the EFI memory map.
 1.12 01-Nov-2018  jmcneill Add GPT support.
 1.11 31-Oct-2018  jmcneill When building /memory, skip EFI runtime memory ranges
 1.10 31-Oct-2018  jmcneill No longer need to delete reserved memory ranges.
 1.9 09-Sep-2018  jmcneill Add "dtb" command for loading a custom .dtb file.
 1.8 07-Sep-2018  jmcneill Add initrd support.
 1.7 03-Sep-2018  jmcneill branches: 1.7.2;
Print FDT model and compatible strings with "version" command
 1.6 02-Sep-2018  jmcneill Dump memory map if EFI_MEMORY_DEBUG is defined
 1.5 28-Aug-2018  jmcneill Remove call to fdt_pack, it is causing problems with memory detection
 1.4 27-Aug-2018  alnsn Fix typo in a panic string.
 1.3 27-Aug-2018  jmcneill Pass a hash of the MBR and the booted partition to the kernel.
 1.2 24-Aug-2018  jmcneill Sanitize the memory map passed to the kernel.
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.7.2.4 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.7.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.7.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.7.2.1 03-Sep-2018  pgoyette file efifdt.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.15.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.15.2.2 10-Jun-2019  christos Sync with HEAD
 1.15.2.1 21-Apr-2019  christos file efifdt.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.17.2.3 12-Feb-2020  martin Pull up following revision(s) (requested by riastradh in ticket #705):

sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.35
sys/stand/efiboot/efifdt.c: revision 1.20
sys/stand/efiboot/efifdt.h: revision 1.7
sys/arch/aarch64/include/machdep.h: revision 1.9
sys/stand/efiboot/efiboot.h: revision 1.11
sys/arch/arm/arm32/arm32_machdep.c: revision 1.129
sys/arch/arm/include/arm32/machdep.h: revision 1.30
sys/stand/efiboot/exec.c: revision 1.12
sys/arch/evbarm/fdt/fdt_machdep.c: revision 1.65
sys/stand/efiboot/version: revision 1.14
sys/stand/efiboot/boot.c: revision 1.19

New function cpu_startup_hook on arm.

Called at end of cpu_startup. Can be defined in, e.g., evbarm to do
additional stuff after cpu_startup. Defined as a weak alias to a
function that does nothing, so optional.
ok jmcneill

Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.
Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.17.2.2 01-Sep-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #142):

sys/stand/efiboot/efifdt.c: revision 1.19

Only set #address-cells and #size-cells properties on /chosen if we are
fabricating a devicetree (ACPI mode). Fixes PR# 54494
 1.17.2.1 04-Aug-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #3):

sys/stand/efiboot/efiacpi.c: revision 1.4
sys/stand/efiboot/efifdt.c: revision 1.18
sys/stand/efiboot/version: revision 1.12
sys/arch/arm/acpi/acpi_machdep.c: revision 1.7
sys/arch/arm/acpi/acpi_machdep.c: revision 1.8

Add full UEFI memory map to the /chosen node.

-

acpi_md_OsMapMemory can be used for both normal and device memory. Use the
UEFI memory map to determine how to map a given region.

Always map ACPI table memory as normal memory. Always map device memory as device memory.
 1.27.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.28.6.1 31-May-2021  cjep sync with head
 1.28.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.35.10.1 02-Aug-2025  perseant Sync with HEAD
 1.14 15-Aug-2024  riastradh efifdt.h: Break overlong line.
 1.13 15-Aug-2024  skrll Move function declarations into correct header.

NFCI.
 1.12 25-Mar-2022  jmcneill branches: 1.12.10;
efiboot: Add support for 'userconf' command.

Add support for the 'userconf' command at the boot prompt and in boot.cfg,
and for FDT based booting, pass the commands as a string list property
named "netbsd,userconf" on the /chosen node.
 1.11 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.10 10-Oct-2020  jmcneill Support EFI runtime and GOP FB for devicetree (non-ACPI) setups.
 1.9 21-Jun-2020  jmcneill Add module support.
 1.8 14-May-2020  riastradh Pass EFI RNG output via /chosen/netbsd,efirng-{start,end}.

This is separate from /chosen/netbsd,rndseed-{start,end}, which
specifies NetBSD's persistent on-disk seed; efirng is the firmware's
RNG device.
 1.7 18-Dec-2019  riastradh Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.

Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.6 24-Jul-2019  jmcneill branches: 1.6.2;
Add support for simple framebuffers when booting in ACPI mode.
 1.5 21-Apr-2019  thorpej branches: 1.5.2;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.4 09-Sep-2018  jmcneill Add "dtb" command for loading a custom .dtb file.
 1.3 07-Sep-2018  jmcneill Add initrd support.
 1.2 03-Sep-2018  jmcneill branches: 1.2.2;
Print FDT model and compatible strings with "version" command
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.2.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.2.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2.2.1 03-Sep-2018  pgoyette file efifdt.h was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.5.2.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.2.2 10-Jun-2019  christos Sync with HEAD
 1.5.2.1 21-Apr-2019  christos file efifdt.h was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.6.2.1 12-Feb-2020  martin Pull up following revision(s) (requested by riastradh in ticket #705):

sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.35
sys/stand/efiboot/efifdt.c: revision 1.20
sys/stand/efiboot/efifdt.h: revision 1.7
sys/arch/aarch64/include/machdep.h: revision 1.9
sys/stand/efiboot/efiboot.h: revision 1.11
sys/arch/arm/arm32/arm32_machdep.c: revision 1.129
sys/arch/arm/include/arm32/machdep.h: revision 1.30
sys/stand/efiboot/exec.c: revision 1.12
sys/arch/evbarm/fdt/fdt_machdep.c: revision 1.65
sys/stand/efiboot/version: revision 1.14
sys/stand/efiboot/boot.c: revision 1.19

New function cpu_startup_hook on arm.

Called at end of cpu_startup. Can be defined in, e.g., evbarm to do
additional stuff after cpu_startup. Defined as a weak alias to a
function that does nothing, so optional.
ok jmcneill

Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.
Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.12.10.1 02-Aug-2025  perseant Sync with HEAD
 1.5 15-Jul-2020  jmcneill Fixup OpenSimpleReadFile usage:
- The "EFI_DEVICE_PATH **FilePath" parameter can change, so do not free
the output. This was causing crashes on U-Boot when attempting to load
boot.cfg, even if it didn't exist.
- Allocate the SIMPLE_READ_FILE in advance and store a pointer to it in
struct open_file.
 1.4 27-Jun-2020  jmcneill Load boot.cfg from the EFI system partition instead of the first FFS
partition on that device.
 1.3 26-Aug-2018  jmcneill branches: 1.3.2; 1.3.6;
Add support for booting kernels from FFS partitions.
 1.2 24-Aug-2018  jmcneill If the boot device could not be determined, use the first one found as
the default. While here, remove unnecessary calls to LibFileSystemInfo().
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.3.6.2 10-Jun-2019  christos Sync with HEAD
 1.3.6.1 26-Aug-2018  christos file efifile.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.3.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.2.1 26-Aug-2018  pgoyette file efifile.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.2 27-Jun-2020  jmcneill Load boot.cfg from the EFI system partition instead of the first FFS
partition on that device.
 1.1 24-Aug-2018  jmcneill branches: 1.1.2; 1.1.6;
Add MI EFI bootloader and AArch64 glue.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 24-Aug-2018  christos file efifile.h was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 24-Aug-2018  pgoyette file efifile.h was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.5 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.4 30-Mar-2019  jmcneill branches: 1.4.4;
Build fixes for 32-bit targets.
 1.3 03-Sep-2018  jmcneill branches: 1.3.2;
Add PXE support.
 1.2 24-Aug-2018  jmcneill Remove unused file.
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.3.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.2.1 03-Sep-2018  pgoyette file efigetsecs.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 30-Mar-2019  christos file efigetsecs.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.3 14-Aug-2022  jmcneill Align output of "version" command.
 1.2 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.1 28-Sep-2021  jmcneill efiboot: Add efigop.c
 1.9 01-Jan-2024  rin MI efiboot: Revert "Stop using efi_bootdp after exclusive open for PXE"

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/stand/efiboot/efinet.c#rev1.7

Some UEFI implementations pass multiple boot options as boot device path,
and NULL-clearing it results in boot failures.

Thanks skrll@ for pointing it out.
 1.8 27-Dec-2023  rin MI efiboot: efi_net_probe: Examine Messaging Device Path also

Network devices can be found as Hardware or Messaging Device Paths,
see Sec 10.4.4 of UEFI Spec 2.10.

In addition to Hardware Device Path, try Messaging Device Path also.
This fixes PXE boot on implementations with the latter choice, e.g.,
Raspberry Pi 4 UEFI firmware.
 1.7 27-Dec-2023  rin MI efiboot: Stop using efi_bootdp after exclusive open for PXE

Once boot device is exclusively opened for Simple Network Protocol,
further access via device path (efi_bootdp) is illegal.

For some implementations, boot device path gets corrupted by
exclusive open, and subsequent access by efi_device_path_depth(),
e.g., causes infinite recursion.

Fix PXE boot for QEMU/aarch64 with EDK2 on some Linux distributions.

Thanks yamaguchi@ for comments and tests.
 1.6 31-Mar-2019  jmcneill branches: 1.6.4; 1.6.32;
Add support for netbooting with non-PCI network devices.
 1.5 05-Mar-2019  msaitoh Centralize ETHER_ALIGN into net/if_ether.h. Note that this commit also changes
if_upgt.c's ETHER_ALIGN from 0 to 2.
 1.4 15-Nov-2018  jmcneill Add support for loading kernels over NFS.
 1.3 04-Sep-2018  jmcneill branches: 1.3.2;
If the loader is loaded from the network, try to load the kernel from the
same network device.
 1.2 04-Sep-2018  riastradh Fix some min/max -> uimin/uimax stragglers.

Confirmed by the 2018-09-04T04:40Z autobuild.
 1.1 03-Sep-2018  jmcneill Add PXE support.
 1.3.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.3.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.2.1 04-Sep-2018  pgoyette file efinet.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.6.32.2 01-Jan-2024  martin Additionally pull up following revision(s) (requested by rin in ticket #524):

sys/stand/efiboot/efinet.c: revision 1.9

MI efiboot: Revert "Stop using efi_bootdp after exclusive open for PXE"
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/stand/efiboot/efinet.c#rev1.7

Some UEFI implementations pass multiple boot options as boot device path,
and NULL-clearing it results in boot failures.

Thanks skrll@ for pointing it out.
 1.6.32.1 30-Dec-2023  martin Pull up following revision(s) (requested by rin in ticket #524):

sys/stand/efiboot/efinet.c: revision 1.7
sys/stand/efiboot/efinet.c: revision 1.8

MI efiboot: Stop using efi_bootdp after exclusive open for PXE

Once boot device is exclusively opened for Simple Network Protocol,
further access via device path (efi_bootdp) is illegal.

For some implementations, boot device path gets corrupted by
exclusive open, and subsequent access by efi_device_path_depth(),
e.g., causes infinite recursion.

Fix PXE boot for QEMU/aarch64 with EDK2 on some Linux distributions.
Thanks yamaguchi@ for comments and tests.

MI efiboot: efi_net_probe: Examine Messaging Device Path also
Network devices can be found as Hardware or Messaging Device Paths,
see Sec 10.4.4 of UEFI Spec 2.10.

In addition to Hardware Device Path, try Messaging Device Path also.

This fixes PXE boot on implementations with the latter choice, e.g.,
Raspberry Pi 4 UEFI firmware.
 1.6.4.2 10-Jun-2019  christos Sync with HEAD
 1.6.4.1 31-Mar-2019  christos file efinet.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.1 03-Sep-2018  jmcneill branches: 1.1.2; 1.1.6;
Add PXE support.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 03-Sep-2018  christos file efinet.h was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 03-Sep-2018  pgoyette file efinet.h was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.3 24-Jul-2023  rin MI and x86 efiboot: Fix device path type for PXE boot device.

It should be Messaging, not Media Device Path. Taken from OpenBSD, for
which this code was originally written:

https://cvsweb.openbsd.org/src/sys/arch/amd64/stand/efiboot/efipxe.c#rev1.6

> Network-based device paths use Messaging and not Media types. Thus
> in reality the depth was always -1 which made the compare function
> a No-Op. Properly check the device path depth value and look for
> the Messaging type instead to find the correct NIC. This check
> never worked before and was uncovered by the last change.
>
> Regression noticed by bluhm@
 1.2 15-Nov-2018  jmcneill branches: 1.2.4; 1.2.32;
Add support for loading kernels over NFS.
 1.1 03-Sep-2018  jmcneill branches: 1.1.2;
Add PXE support.
 1.1.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 03-Sep-2018  pgoyette file efipxe.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.2.32.1 11-Sep-2023  martin Pull up following revision(s) (requested by rin in ticket #362):

sys/arch/i386/stand/efiboot/efipxe.c: revision 1.2
sys/stand/efiboot/efipxe.c: revision 1.3

MI and x86 efiboot: Fix device path type for PXE boot device.
It should be Messaging, not Media Device Path. Taken from OpenBSD, for
which this code was originally written:
https://cvsweb.openbsd.org/src/sys/arch/amd64/stand/efiboot/efipxe.c#rev1.6

Network-based device paths use Messaging and not Media types. Thus
in reality the depth was always -1 which made the compare function
a No-Op. Properly check the device path depth value and look for
the Messaging type instead to find the correct NIC. This check
never worked before and was uncovered by the last change.

Regression noticed by bluhm@
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 15-Nov-2018  christos file efipxe.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.4 14-Aug-2022  jmcneill Align output of "version" command.
 1.3 22-Jun-2021  jmcneill efirng: fix va_num arg to uefi_call_wrapper for GetRNG calls

As far as I can tell this param isn't actually used, but it is supposed to
be the number of arguments passed to the called method.
 1.2 14-May-2020  jmcneill branches: 1.2.6;
Make efi_rng_show return early if RNG protocol is not available. While
here, use efi_rng_available() consistently, prefix all show messages with
"RNG: ", and use sizeof(foo) instead of sizeof foo.
 1.1 14-May-2020  riastradh Draft logic to get at EFI RNG.
 1.2.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.1 14-May-2020  riastradh Draft logic to get at EFI RNG.
 1.1 20-Jun-2021  jmcneill branches: 1.1.4;
Add support for the boot services watchdog and pet it on every block I/O
access. For slow media (like ISO image redirection on Lenovo HR330A BMC)
this is needed because otherwise the default watchdog timeout fires before
we can finish loading the kernel from install media.
 1.1.4.2 01-Aug-2021  thorpej Sync with HEAD.
 1.1.4.1 20-Jun-2021  thorpej file efiwatchdog.c was added on branch thorpej-i2c-spi-conf on 2021-08-01 22:42:44 +0000
 1.26 19-Sep-2024  mlelstv when freeing pages, pass page count instead of byte count.
 1.25 15-Aug-2024  skrll Rename some symbols for consistency with the style used elsewhere
in efiboot.

NFCI.
 1.24 14-Jun-2023  rin branches: 1.24.6;
Use %zd instead of %ld for ssize_t.
 1.23 06-Oct-2021  jmcneill branches: 1.23.4;
efiboot: Make FDT support optional on a per-arch basis.
 1.22 20-Jun-2021  jmcneill Enable the twiddle spinner when loading the kernel, ramdisk images, and
modules.
 1.21 21-May-2021  jmcneill Disable ACPI support when booting big endian kernels.
 1.20 11-May-2021  skrll Consistently have ALIGN sizes as the power of two size, i.e. change
FDT_ALIGN, and use the same math(s) to round.

In the process fix the load_offset for the kernel to use the EFIBOOT_ALIGN
aligned address if that's what we get from AllocatePages.
 1.19 10-Oct-2020  jmcneill branches: 1.19.6; 1.19.8;
Support EFI runtime and GOP FB for devicetree (non-ACPI) setups.
 1.18 28-Jun-2020  jmcneill Remove support for storing settings in EFI environment variables now that
we have boot.cfg support.
 1.17 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.16 21-Jun-2020  jmcneill Add module support.
 1.15 23-May-2020  thorpej If a device tree overlay does not have a "compatible" match, don't
load it. (Oops, missing return statement.)
 1.14 14-May-2020  riastradh Pass EFI RNG output via /chosen/netbsd,efirng-{start,end}.

This is separate from /chosen/netbsd,rndseed-{start,end}, which
specifies NetBSD's persistent on-disk seed; efirng is the firmware's
RNG device.
 1.13 25-Jan-2020  jmcneill Hide the twiddle while loading efiboot plist
 1.12 18-Dec-2019  riastradh branches: 1.12.2;
Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.

Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.11 24-Jul-2019  jmcneill branches: 1.11.2;
Add support for simple framebuffers when booting in ACPI mode.
 1.10 21-Apr-2019  thorpej branches: 1.10.2;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.9 30-Mar-2019  jmcneill Build fixes for 32-bit targets.
 1.8 28-Oct-2018  jmcneill Make EFI runtime services available to the kernel. Bump version to 1.5.
 1.7 12-Oct-2018  jmcneill Add ACPI support (enable with -DEFIBOOT_ACPI, currently disabled).

When UEFI reports that ACPI tables are available, generate a DTB with
compatible string "netbsd,generic-acpi" and pass this to the booted
kernel.

The DTB contains a /chosen property "netbsd,acpi-root-table" that contains
the physical address of the ACPI RSDP, along with a special /acpi node
with compatible string "netbsd,acpi" for the kernel to attach an acpi(4)
device driver.
 1.6 15-Sep-2018  jmcneill Suppress printing size info when calling loadfile with COUNT_KERNEL
 1.5 09-Sep-2018  jmcneill Add "dtb" command for loading a custom .dtb file.
 1.4 07-Sep-2018  jmcneill Add initrd support.
 1.3 02-Sep-2018  jmcneill branches: 1.3.2;
Support loading kernels at PAs above 0x3fffffffff on arm64
 1.2 27-Aug-2018  jmcneill Pass a hash of the MBR and the booted partition to the kernel.
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.3.2.5 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.3.2.4 20-Oct-2018  pgoyette Sync with head
 1.3.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.3.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3.2.1 02-Sep-2018  pgoyette file exec.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.10.2.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.10.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.2.2 10-Jun-2019  christos Sync with HEAD
 1.10.2.1 21-Apr-2019  christos file exec.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.11.2.2 12-Feb-2020  martin Pull up following revision(s) (requested by riastradh in ticket #705):

sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.35
sys/stand/efiboot/efifdt.c: revision 1.20
sys/stand/efiboot/efifdt.h: revision 1.7
sys/arch/aarch64/include/machdep.h: revision 1.9
sys/stand/efiboot/efiboot.h: revision 1.11
sys/arch/arm/arm32/arm32_machdep.c: revision 1.129
sys/arch/arm/include/arm32/machdep.h: revision 1.30
sys/stand/efiboot/exec.c: revision 1.12
sys/arch/evbarm/fdt/fdt_machdep.c: revision 1.65
sys/stand/efiboot/version: revision 1.14
sys/stand/efiboot/boot.c: revision 1.19

New function cpu_startup_hook on arm.

Called at end of cpu_startup. Can be defined in, e.g., evbarm to do
additional stuff after cpu_startup. Defined as a weak alias to a
function that does nothing, so optional.
ok jmcneill

Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.
Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.11.2.1 26-Jan-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #653):

sys/stand/efiboot/prompt.c: revision 1.6
sys/stand/efiboot/boot.c: revision 1.20
sys/stand/efiboot/bootarm/Makefile: revision 1.4
sys/stand/efiboot/efiacpi.c: revision 1.6
sys/stand/efiboot/exec.c: revision 1.13
sys/stand/efiboot/Makefile.efiboot: revision 1.10
sys/stand/efiboot/bootaa64/Makefile: revision 1.7

Fix for disappearing counters on graphics consoles

Hide the twiddle while loading efiboot plist

Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.12.2.1 25-Jan-2020  ad Sync with head.
 1.19.8.1 31-May-2021  cjep sync with head
 1.19.6.3 01-Aug-2021  thorpej Sync with HEAD.
 1.19.6.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.19.6.1 13-May-2021  thorpej Sync with HEAD.
 1.23.4.2 21-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #898):

sys/stand/efiboot/exec.c: revision 1.26

When freeing pages, pass page count instead of byte count.
 1.23.4.1 03-Nov-2023  martin Pull up following revision(s) (requested by rin in ticket #451):

sys/stand/efiboot/efiblock.c: revision 1.20
sys/stand/efiboot/exec.c: revision 1.24
sys/stand/efiboot/Makefile.efiboot: revision 1.29
sys/stand/efiboot/boot.c: revision 1.45

Add missing member for terminating sentinel.

Avoid void * pointer arithmetic; cast to UINT8 * explicitly.
No binary changes for aarch64 at least.

Use %zd instead of %ld for ssize_t.

Add missing include paths for libz. Not used at the moment although.
 1.24.6.1 02-Aug-2025  perseant Sync with HEAD
 1.2 21-Sep-2022  riastradh efiboot: Handle 9.99.100 by taking four, not two, digits.

We haven't used the revision part of __NetBSD_Version__ = MMmmrrpp00
in almos two decades so we're apparently reclaiming it as MMmmpppp00.
 1.1 21-Jun-2020  jmcneill Add module support.
 1.1 21-Jun-2020  jmcneill Add module support.
 1.1 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.1 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.1 24-Aug-2018  jmcneill branches: 1.1.2; 1.1.6;
Add MI EFI bootloader and AArch64 glue.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 24-Aug-2018  christos file panic.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 24-Aug-2018  pgoyette file panic.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.6 25-Jan-2020  jmcneill Fix for disappearing counters on graphics consoles
 1.5 29-Sep-2019  jakllsch branches: 1.5.2;
Increase MI efiboot bootprompt() input buffer from 80 bytes to LINE_MAX.

This allows you to load a kernel from a build directory deep in some file
system after you accidentally boot an old kernel with a new userland and
are otherwise unable to get yourself back to a matching kernel.
 1.4 31-Oct-2018  jmcneill branches: 1.4.4; 1.4.6;
No need to re-print the countdown timer if the number of seconds hasn't changed.
 1.3 15-Sep-2018  jmcneill Only need to ischar() once when polling for input
 1.2 24-Aug-2018  jmcneill branches: 1.2.2;
Start counting down at 5 instead of 4
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.2.2.4 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.2.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.2.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2.2.1 24-Aug-2018  pgoyette file prompt.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.4.6.1 26-Jan-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #653):

sys/stand/efiboot/prompt.c: revision 1.6
sys/stand/efiboot/boot.c: revision 1.20
sys/stand/efiboot/bootarm/Makefile: revision 1.4
sys/stand/efiboot/efiacpi.c: revision 1.6
sys/stand/efiboot/exec.c: revision 1.13
sys/stand/efiboot/Makefile.efiboot: revision 1.10
sys/stand/efiboot/bootaa64/Makefile: revision 1.7

Fix for disappearing counters on graphics consoles

Hide the twiddle while loading efiboot plist

Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.4.4.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 31-Oct-2018  christos file prompt.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.5.2.1 25-Jan-2020  ad Sync with head.
 1.4 16-Sep-2021  andvar fix typos in word "successful".
 1.3 23-Jul-2021  jmcneill efiboot: Add support for SMBIOS 2.x tables.
 1.2 27-Dec-2019  msaitoh branches: 1.2.6; 1.2.14;
s/sucess/success/ in comment.
 1.1 30-Nov-2019  jmcneill branches: 1.1.2;
Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.1.2.2 08-Dec-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #503):

sys/stand/efiboot/Makefile.efiboot: revision 1.9
sys/stand/efiboot/efiacpi.c: revision 1.5
sys/stand/efiboot/version: revision 1.13
sys/stand/efiboot/smbios.h: revision 1.1
sys/stand/efiboot/smbios.c: revision 1.1

Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.1.2.1 30-Nov-2019  martin file smbios.c was added on branch netbsd-9 on 2019-12-08 13:13:06 +0000
 1.2.14.1 01-Aug-2021  thorpej Sync with HEAD.
 1.2.6.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.6.1 27-Dec-2019  martin file smbios.c was added on branch phil-wifi on 2020-04-08 14:09:02 +0000
 1.1 30-Nov-2019  jmcneill branches: 1.1.2; 1.1.8;
Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.1.8.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.8.1 30-Nov-2019  martin file smbios.h was added on branch phil-wifi on 2020-04-08 14:09:02 +0000
 1.1.2.2 08-Dec-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #503):

sys/stand/efiboot/Makefile.efiboot: revision 1.9
sys/stand/efiboot/efiacpi.c: revision 1.5
sys/stand/efiboot/version: revision 1.13
sys/stand/efiboot/smbios.h: revision 1.1
sys/stand/efiboot/smbios.c: revision 1.1

Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.1.2.1 30-Nov-2019  martin file smbios.h was added on branch netbsd-9 on 2019-12-08 13:13:06 +0000
 1.1 25-Mar-2022  jmcneill efiboot: Add support for 'userconf' command.

Add support for the 'userconf' command at the boot prompt and in boot.cfg,
and for FDT based booting, pass the commands as a string list property
named "netbsd,userconf" on the /chosen node.
 1.33 07-Dec-2024  jmcneill efiboot: Use 1:1 PA to VA mappings for RT services.

UEFI firmware on Snapdragon X Elite devices crashes when
SetVirtualAddressMap is called with runtime mappings that are not 1:1.
Always do this on arm64 as it won't interfere with KVA and will help us
avoid avoid a very common class of firmware bugs.
 1.32 15-Aug-2024  skrll Allow an MD check in prepare_boot and use it on arm64 (aarch64) to check
that, if a big endian kernel is seen, the CPU is capable of supporting BE
data accesses at EL0 via ID_AA64MMFR0_EL1.BigEnd.
 1.31 02-Apr-2022  skrll branches: 1.31.10;
Update to support EFI runtime outside the kernel virtual address space
by creating an EFI RT pmap that can be activated / deactivated when
required.

Adds support for EFI RT to ARM_MMU_EXTENDED (ASID) 32-bit Arm machines.

On Arm64 the usage of pmapboot_enter is reduced and the mappings are
created much later in the boot process -- now in cpu_startup_hook.
Backward compatiblity for KVA mapped RT from old bootaa64.efi is
maintained.

Adding support to other platforms should be easier as a result.
 1.30 25-Mar-2022  jmcneill efiboot: Add support for 'userconf' command.

Add support for the 'userconf' command at the boot prompt and in boot.cfg,
and for FDT based booting, pass the commands as a string list property
named "netbsd,userconf" on the /chosen node.
 1.29 28-Sep-2021  jmcneill efiboot: Add support for changing the video mode.

Add a new "gop" command that can query the list of available video modes.
With a mode number as argument (eg. "gop 16"), the new display mode will
be selected.

The "version" command prints the current display mode.
 1.28 08-Aug-2021  andvar s/partion/partition/ s/arrray/array/ in comments.
 1.27 21-Jun-2021  jmcneill efiboot: Use disk I/O protocol for block device access.

EFI_DISK_IO_PROTOCOL is a simplified interface to block devices. Use this
instead of EFI_BLOCK_IO_PROTOCOL for accessing block devices to simplify
the code -- we no longer need to worry about the underlying media's block
I/O size and alignment requirements.
 1.26 20-Jun-2021  jmcneill Add support for the boot services watchdog and pet it on every block I/O
access. For slow media (like ISO image redirection on Lenovo HR330A BMC)
this is needed because otherwise the default watchdog timeout fires before
we can finish loading the kernel from install media.
 1.25 27-May-2021  mrg add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.24 26-May-2021  mrg add basic raidframe support to efiboot.

if raid disklabel or gpt is found, add this partition with
the offset/size adjusted by RF_PROTECTED_SECTORS. note

don't le32toh() the disklabel. if it was wrong-endian, then
getdisklabel() will have swapped it.

ok jmcneill thorpej.
 1.23 21-May-2021  jmcneill Disable ACPI support when booting big endian kernels.
 1.22 18-Oct-2020  tnn branches: 1.22.6; 1.22.8;
efiboot: bump version
 1.21 11-Oct-2020  jmcneill Add ISO9660 support.
 1.20 10-Oct-2020  jmcneill Support EFI runtime and GOP FB for devicetree (non-ACPI) setups.
 1.19 28-Jun-2020  jmcneill Remove support for storing settings in EFI environment variables now that
we have boot.cfg support.
 1.18 26-Jun-2020  thorpej Add dtoverlay command to specify device tree overlays from the boot
loader command line. Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.
 1.17 21-Jun-2020  jmcneill Add boot.cfg support.
 1.16 21-Jun-2020  jmcneill Add module support.
 1.15 14-May-2020  riastradh Bump efiboot version to note EFI RNG support.
 1.14 18-Dec-2019  riastradh Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.

Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.13 30-Nov-2019  jmcneill Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.12 01-Aug-2019  jmcneill Add full UEFI memory map to the /chosen node.
 1.11 24-Jul-2019  jmcneill branches: 1.11.2;
Add support for simple framebuffers when booting in ACPI mode.
 1.10 21-Apr-2019  thorpej branches: 1.10.2;
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)
 1.9 18-Jan-2019  skrll Add support for "bootargs" environment variable from jmcneill@

Doesn't work with some (all?) u-boots.
 1.8 15-Nov-2018  jmcneill Add support for loading kernels over NFS.
 1.7 01-Nov-2018  jmcneill Add GPT support.
 1.6 28-Oct-2018  jmcneill Make EFI runtime services available to the kernel. Bump version to 1.5.
 1.5 26-Oct-2018  mrg add "boot-file" support. now one can automatically boot a
non-default kernel with "setenv boot-file host/netbsd".

this is particularly useful with the current net / tftp
kernel boot, so the tftproot does not need a "/netbsd"
visible to all hosts, but some host-specific path.

some minor clean up.

version 1.4.

ok jmcneill@.
 1.4 21-Oct-2018  jmcneill Enable ACPI support.
 1.3 09-Sep-2018  jmcneill Add support for setting environment variables. Currently the following env
vars are supported: "fdtfile", "initrd", and "rootdev".
 1.2 03-Sep-2018  jmcneill branches: 1.2.2;
Add PXE support.
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.2.2.5 26-Jan-2019  pgoyette Sync with HEAD
 1.2.2.4 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.2.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.2.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2.2.1 03-Sep-2018  pgoyette file version was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.10.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.10.2.2 10-Jun-2019  christos Sync with HEAD
 1.10.2.1 21-Apr-2019  christos file version was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.11.2.3 12-Feb-2020  martin Pull up following revision(s) (requested by riastradh in ticket #705):

sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.35
sys/stand/efiboot/efifdt.c: revision 1.20
sys/stand/efiboot/efifdt.h: revision 1.7
sys/arch/aarch64/include/machdep.h: revision 1.9
sys/stand/efiboot/efiboot.h: revision 1.11
sys/arch/arm/arm32/arm32_machdep.c: revision 1.129
sys/arch/arm/include/arm32/machdep.h: revision 1.30
sys/stand/efiboot/exec.c: revision 1.12
sys/arch/evbarm/fdt/fdt_machdep.c: revision 1.65
sys/stand/efiboot/version: revision 1.14
sys/stand/efiboot/boot.c: revision 1.19

New function cpu_startup_hook on arm.

Called at end of cpu_startup. Can be defined in, e.g., evbarm to do
additional stuff after cpu_startup. Defined as a weak alias to a
function that does nothing, so optional.
ok jmcneill

Implement rndseed support in efiboot and fdt arm.

The EFI environment variable `rndseed' specifies the path to the
random seed. It is loaded only for fdt platforms at the moment.
Since the rndseed (an rndsave_t object as defined in <sys/rndio.h>)
is 536 bytes long (for hysterical raisins), and to avoid having to
erase parts of the fdt tree, we load it into a physical page whose
address is passed in the fdt tree, rather than passing the content of
the file as an fdt node directly; the kernel then reserves the page
from uvm, and maps it into kva to call rnd_seed.

For now, the only kernel that does use efiboot with fdt is evbarm,
which knows to handle the rndseed. Any new kernels that use efiboot
with fdt must do the same; otherwise uvm may hand out the page with
the secret key on it for a normal page allocation in the kernel --
which should be OK if there are no kernel memory disclosure bugs, but
would lead to worse consequences than simply loading the seed late in
userland with /etc/rc.d/random_seed otherwise.

ok jmcneill
 1.11.2.2 08-Dec-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #503):

sys/stand/efiboot/Makefile.efiboot: revision 1.9
sys/stand/efiboot/efiacpi.c: revision 1.5
sys/stand/efiboot/version: revision 1.13
sys/stand/efiboot/smbios.h: revision 1.1
sys/stand/efiboot/smbios.c: revision 1.1

Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.
 1.11.2.1 04-Aug-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #3):

sys/stand/efiboot/efiacpi.c: revision 1.4
sys/stand/efiboot/efifdt.c: revision 1.18
sys/stand/efiboot/version: revision 1.12
sys/arch/arm/acpi/acpi_machdep.c: revision 1.7
sys/arch/arm/acpi/acpi_machdep.c: revision 1.8

Add full UEFI memory map to the /chosen node.

-

acpi_md_OsMapMemory can be used for both normal and device memory. Use the
UEFI memory map to determine how to map a given region.

Always map ACPI table memory as normal memory. Always map device memory as device memory.
 1.22.8.1 31-May-2021  cjep sync with head
 1.22.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.22.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.31.10.1 02-Aug-2025  perseant Sync with HEAD
 1.13 07-Dec-2024  jmcneill efiboot: Use 1:1 PA to VA mappings for RT services.

UEFI firmware on Snapdragon X Elite devices crashes when
SetVirtualAddressMap is called with runtime mappings that are not 1:1.
Always do this on arm64 as it won't interfere with KVA and will help us
avoid avoid a very common class of firmware bugs.
 1.12 02-Apr-2022  skrll branches: 1.12.10;
Update to support EFI runtime outside the kernel virtual address space
by creating an EFI RT pmap that can be activated / deactivated when
required.

Adds support for EFI RT to ARM_MMU_EXTENDED (ASID) 32-bit Arm machines.

On Arm64 the usage of pmapboot_enter is reduced and the mappings are
created much later in the boot process -- now in cpu_startup_hook.
Backward compatiblity for KVA mapped RT from old bootaa64.efi is
maintained.

Adding support to other platforms should be easier as a result.
 1.11 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.10 10-Sep-2020  jakllsch bootaa64: explicitly set GNUEFIARCH and LIBGNUEFI_ARCH to aarch64
 1.9 08-Sep-2020  jmcneill Be explicit about building for little endian. This allows efiboot to be
built with the aarch64eb toolchain.
 1.8 21-Jun-2020  jmcneill Add module support.
 1.7 25-Jan-2020  jmcneill Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.6 23-Sep-2019  christos branches: 1.6.2;
Consistently use ${RELEASEDIR}/${RELEASEMACHINE} instead of
${RELEASEDIR}/${MACHINE} (Paul Ripke)
 1.5 28-Oct-2018  jmcneill branches: 1.5.4; 1.5.6;
Make EFI runtime services available to the kernel. Bump version to 1.5.
 1.4 21-Oct-2018  jmcneill Enable ACPI support.
 1.3 12-Oct-2018  jmcneill Add ACPI support (enable with -DEFIBOOT_ACPI, currently disabled).

When UEFI reports that ACPI tables are available, generate a DTB with
compatible string "netbsd,generic-acpi" and pass this to the booted
kernel.

The DTB contains a /chosen property "netbsd,acpi-root-table" that contains
the physical address of the ACPI RSDP, along with a special /acpi node
with compatible string "netbsd,acpi" for the kernel to attach an acpi(4)
device driver.
 1.2 27-Aug-2018  jmcneill branches: 1.2.2;
Add release target
 1.1 24-Aug-2018  jmcneill Add MI EFI bootloader and AArch64 glue.
 1.2.2.4 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.2.2.3 20-Oct-2018  pgoyette Sync with head
 1.2.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2.2.1 27-Aug-2018  pgoyette file Makefile was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.5.6.1 26-Jan-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #653):

sys/stand/efiboot/prompt.c: revision 1.6
sys/stand/efiboot/boot.c: revision 1.20
sys/stand/efiboot/bootarm/Makefile: revision 1.4
sys/stand/efiboot/efiacpi.c: revision 1.6
sys/stand/efiboot/exec.c: revision 1.13
sys/stand/efiboot/Makefile.efiboot: revision 1.10
sys/stand/efiboot/bootaa64/Makefile: revision 1.7

Fix for disappearing counters on graphics consoles

Hide the twiddle while loading efiboot plist

Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.5.4.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.4.2 10-Jun-2019  christos Sync with HEAD
 1.5.4.1 28-Oct-2018  christos file Makefile was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.6.2.1 25-Jan-2020  ad Sync with head.
 1.12.10.1 02-Aug-2025  perseant Sync with HEAD
 1.2 07-Sep-2018  jmcneill branches: 1.2.4;
Disable MMU and dcache before jumping to the kernel.
 1.1 24-Aug-2018  jmcneill branches: 1.1.2;
Add MI EFI bootloader and AArch64 glue.
 1.1.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 24-Aug-2018  pgoyette file cache.S was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 07-Sep-2018  christos file cache.S was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.7 15-Aug-2024  skrll Allow an MD check in prepare_boot and use it on arm64 (aarch64) to check
that, if a big endian kernel is seen, the CPU is capable of supporting BE
data accesses at EL0 via ID_AA64MMFR0_EL1.BigEnd.
 1.6 14-Aug-2022  jmcneill branches: 1.6.10;
Align output of "version" command.
 1.5 09-Jan-2021  jmcneill Flush from kernel start, not the entry point.
 1.4 09-Jan-2021  jmcneill Style fixes, NFCI.
 1.3 28-Nov-2020  jmcneill Add a hook for MD specific info to print in the "ver" command. Use this
to print the value of the current execution level in bootaa64.
 1.2 07-Sep-2018  jmcneill branches: 1.2.4; 1.2.14;
Disable MMU and dcache before jumping to the kernel.
 1.1 24-Aug-2018  jmcneill branches: 1.1.2;
Add MI EFI bootloader and AArch64 glue.
 1.1.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 24-Aug-2018  pgoyette file efibootaa64.c was added on branch pgoyette-compat on 2018-09-06 06:56:47 +0000
 1.2.14.2 03-Apr-2021  thorpej Sync with HEAD.
 1.2.14.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 07-Sep-2018  christos file efibootaa64.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.6.10.1 02-Aug-2025  perseant Sync with HEAD
 1.9 02-Apr-2022  skrll Update to support EFI runtime outside the kernel virtual address space
by creating an EFI RT pmap that can be activated / deactivated when
required.

Adds support for EFI RT to ARM_MMU_EXTENDED (ASID) 32-bit Arm machines.

On Arm64 the usage of pmapboot_enter is reduced and the mappings are
created much later in the boot process -- now in cpu_startup_hook.
Backward compatiblity for KVA mapped RT from old bootaa64.efi is
maintained.

Adding support to other platforms should be easier as a result.
 1.8 06-Oct-2021  jmcneill Fix bootarm build.
 1.7 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.6 08-Sep-2020  jmcneill Be explicit about building for little endian. This allows efiboot to be
built with the armv7be toolchain.
 1.5 21-Jun-2020  jmcneill Add module support.
 1.4 25-Jan-2020  jmcneill Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.3 03-Jan-2020  skrll branches: 1.3.2;
Add -mfloat-abi=soft so that gcc 8 doesn't emit FP instructions. This
fixes bootarm.efi compiled by gcc 8.
 1.2 23-Sep-2019  christos Consistently use ${RELEASEDIR}/${RELEASEMACHINE} instead of
${RELEASEDIR}/${MACHINE} (Paul Ripke)
 1.1 30-Mar-2019  jmcneill branches: 1.1.4; 1.1.6;
Add efiboot support for 32-bit ARM targets.
 1.1.6.1 26-Jan-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #653):

sys/stand/efiboot/prompt.c: revision 1.6
sys/stand/efiboot/boot.c: revision 1.20
sys/stand/efiboot/bootarm/Makefile: revision 1.4
sys/stand/efiboot/efiacpi.c: revision 1.6
sys/stand/efiboot/exec.c: revision 1.13
sys/stand/efiboot/Makefile.efiboot: revision 1.10
sys/stand/efiboot/bootaa64/Makefile: revision 1.7

Fix for disappearing counters on graphics consoles

Hide the twiddle while loading efiboot plist

Clean up the banner so it fits in 80 columns and add some extra details
to the "version" command output.
 1.1.4.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.4.2 10-Jun-2019  christos Sync with HEAD
 1.1.4.1 30-Mar-2019  christos file Makefile was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.3.2.1 25-Jan-2020  ad Sync with head.
 1.2 18-Sep-2024  skrll Clean and invalidate the full data cache as the armv6_start.S code assumes
that the caches are disabled on entry which armv7_exec_kernel ensures.
When caches are disabled armv6_start.S will invalidate (not clean) the
cache and this can lose u-boot data for the u-boots that now don't
perform their own cache maintenance.

An example of such a u-boot is the banana pro that chuq@ has tried which
has

commit 8b5dea33584261cc5d600614970d1cbed6d99f91
Author: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Wed Mar 3 14:05:05 2021 +0100

efi_loader: disable GRUB_ARM32_WORKAROUND on ARCH_SUNXI

applied.

Improving things so that the architected caches could remain on would be
better, but that's a much bigger change / set of changes.
 1.1 30-Mar-2019  jmcneill branches: 1.1.4; 1.1.38;
Add efiboot support for 32-bit ARM targets.
 1.1.38.1 02-Aug-2025  perseant Sync with HEAD
 1.1.4.2 10-Jun-2019  christos Sync with HEAD
 1.1.4.1 30-Mar-2019  christos file cache.S was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.5 18-Sep-2024  skrll Clean and invalidate the full data cache as the armv6_start.S code assumes
that the caches are disabled on entry which armv7_exec_kernel ensures.
When caches are disabled armv6_start.S will invalidate (not clean) the
cache and this can lose u-boot data for the u-boots that now don't
perform their own cache maintenance.

An example of such a u-boot is the banana pro that chuq@ has tried which
has

commit 8b5dea33584261cc5d600614970d1cbed6d99f91
Author: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Wed Mar 3 14:05:05 2021 +0100

efi_loader: disable GRUB_ARM32_WORKAROUND on ARCH_SUNXI

applied.

Improving things so that the architected caches could remain on would be
better, but that's a much bigger change / set of changes.
 1.4 15-Aug-2024  skrll Allow an MD check in prepare_boot and use it on arm64 (aarch64) to check
that, if a big endian kernel is seen, the CPU is capable of supporting BE
data accesses at EL0 via ID_AA64MMFR0_EL1.BigEnd.
 1.3 28-Nov-2020  jmcneill branches: 1.3.24;
Add a hook for MD specific info to print in the "ver" command. Use this
to print the value of the current execution level in bootaa64.
 1.2 30-Mar-2019  jmcneill branches: 1.2.4; 1.2.14;
Jump to MARK_ENTRY instead of MARK_START
 1.1 30-Mar-2019  jmcneill Add efiboot support for 32-bit ARM targets.
 1.2.14.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 30-Mar-2019  christos file efibootarm.c was added on branch phil-wifi on 2019-06-10 22:09:56 +0000
 1.3.24.1 02-Aug-2025  perseant Sync with HEAD
 1.3 06-Oct-2021  jmcneill EFIBOOT_FDT=yes for riscv64 too
 1.2 06-Oct-2021  jmcneill efiboot: Make FDT support optional on a per-arch basis.
 1.1 02-May-2021  jmcneill branches: 1.1.4;
Add RISC-V 64-bit support.
 1.1.4.2 13-May-2021  thorpej Sync with HEAD.
 1.1.4.1 02-May-2021  thorpej file Makefile was added on branch thorpej-i2c-spi-conf on 2021-05-13 00:47:33 +0000
 1.2 15-Aug-2024  skrll Allow an MD check in prepare_boot and use it on arm64 (aarch64) to check
that, if a big endian kernel is seen, the CPU is capable of supporting BE
data accesses at EL0 via ID_AA64MMFR0_EL1.BigEnd.
 1.1 02-May-2021  jmcneill branches: 1.1.4; 1.1.22;
Add RISC-V 64-bit support.
 1.1.22.1 02-Aug-2025  perseant Sync with HEAD
 1.1.4.2 13-May-2021  thorpej Sync with HEAD.
 1.1.4.1 02-May-2021  thorpej file efibootriscv64.c was added on branch thorpej-i2c-spi-conf on 2021-05-13 00:47:33 +0000

RSS XML Feed