History log of /freebsd-current/stand/efi/boot1/boot1.c
Revision Date Author Comments
# 7c43148a 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

stand: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 91ac713b 01-May-2023 Warner Losh <imp@FreeBSD.org>

stand/boot1.efi: Allow modules to add env variables

Sometimes filesystem modules need to pass details of the state of the
filesystem to later stages of a boot. Provide a generic method to do
so. We'll add them after any env variables set in our config files.

Sponsored by: Netflix
Reviewed by: tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D39407


# 12c470af 30-Jun-2020 Toomas Soome <tsoome@FreeBSD.org>

boot1.efi: use malloc family from libsa

The zfs reader development did reach to the point where linking boot1,
we will get errors about duplicate symbols Malloc, Free, Calloc.

We can just use libsa version, just as loader.efi does. The only concern is,
libsa zalloc is using fixed size heap region, I did pick 64MB as other
stage instances are using, but this size is likely not optimal. In any case,
with limited memory setups, we should boot loader.efi directly.

Sponsored by: Netflix, Klara Inc.


# abc23d59 15-Oct-2019 Toomas Soome <tsoome@FreeBSD.org>

boot1.efi: provide generic exit() and stub getchar()

panic() is expecting us to have exit and getchar, lets provide those.


# cefffc0b 06-Aug-2019 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: boot1.c was left out of 350654

Followup for 350654.


# f46eb752 08-Jun-2019 Warner Losh <imp@FreeBSD.org>

Break out the disk selection protocol from the rest of boot1.

Segregate the disk probing and selection protocol from the rest of the
boot loader.

Reviewed by: tsoome, bcran
Differential Revision: https://reviews.freebsd.org/D20547


# 31927bd4 06-Jun-2019 Warner Losh <imp@FreeBSD.org>

Rework the reporting of the priority.

Simplify the code a bit and rework how we report the results
of the probing.

Reviewed by: tsoome@
Differential Revision: https://reviews.freebsd.org/D20537


# b5f3ad3a 04-Jun-2019 Warner Losh <imp@FreeBSD.org>

Use newly minted efi_devpath_same_disk() instead of
efi_devpath_match(). This fixes a regression in r347193.

Reported by: Tomoaki AOKI
Differential Revision: https://reviews.freebsd.org/D20513


# f28f385b 29-May-2019 Toomas Soome <tsoome@FreeBSD.org>

boot1.efi should also provide Calloc

boot1.efi does provide Malloc and Free, we also need Calloc.


# 141b1c32 06-May-2019 Warner Losh <imp@FreeBSD.org>

Simplify boot1 allocation of handles.

There's no need to pre-malloc the number of handles. Instead call
LocateHandles twice, once to get the size, and once to get the
data.


# f28eb485 06-May-2019 Warner Losh <imp@FreeBSD.org>

We only ever need one devinfo per handle. So allocate it outside of
looping over the filesystem modules rather than doing a malloc + free
each time through the loop. In addition, nothing changes from loop to
loop, so setup the new devinfo outside the loop as well.


# 4cf36aa1 06-May-2019 Warner Losh <imp@FreeBSD.org>

Reach over and pull in devpath.c from libefi

This allows us to remove three nearly identical functions because the
differences don't matter, and the size difference is trivial.


# 6f21634d 03-May-2019 Warner Losh <imp@FreeBSD.org>

When we can't get memory, trying again right away is going to
fail. Rather than print N failure messages, bail on the first one.


# 807dbf2b 18-Apr-2018 Kyle Evans <kevans@FreeBSD.org>

efi loader: Address two nits with recent graphics changes

- We should be setting a known graphics mode on conout, but we aren't.
- We shouldn't be setting gop mode if we didn't find a good resolution to
set, but we were. This made efi_max_resolution=1x1 effectively worthless,
since it would always set gop mode 0 if nothing else.


# 5f8cfbe1 21-Mar-2018 Kyle Evans <kevans@FreeBSD.org>

UEFI: Ditch console mode setting, choose optimal GOP mode later in boot

boot1 is too early to be deciding a good resolution. Console modes don't map
cleanly/predictably to actual screen resolutions, and GOP does not reflect
the actual screen resolution after a console mode change. Rip it out.

Add an efi-autoresizecons command to loader to choose an optimal screen
resolution based on the current environment. We'll explicitly execute this
later, preferably before we draw anything of value but after we load config
and pick up any tunables we may need to decide where we're going.

This method also allows us to actually pass the correct framebuffer
information on to the kernel.

UGA autoresizing is not implemented because it doesn't have the kind of mode
enumeration that GOP does. If an interested person with relevant hardware
could get in contact, we can take a look at implementing UGA autoresize.

This effectively "fixes" the breakage caused by r327058, but doesn't
actually set the resolution correctly until the interpreter calls
efi-autoresizcons. The lualoader version of this has been included for
reference; the forth equivalent will follow.

Reviewed by: imp (with some hestitation), manu
Differential Revision: https://reviews.freebsd.org/D14788


# 1ce0264e 16-Mar-2018 Warner Losh <imp@FreeBSD.org>

Only print boot order / boot current if we can get the variables from
the loader. Some UEFI implementations don't return all of them.

Sponsored by: Netflix


# c25acd45 12-Mar-2018 Warner Losh <imp@FreeBSD.org>

Star BootCurrent entry when booting.

Sponsored by: Netflix


# 5722dd83 12-Mar-2018 Warner Losh <imp@FreeBSD.org>

Move the env convenience routines out of boot1.c.

These routines are more generally useful. Even though boot1 is on its
way out, it's better to make these common during the transition than
copy them.


# 082f2fb1 15-Jan-2018 Warner Losh <imp@FreeBSD.org>

Need to free uv after we're done using it.

Reported by: andrew@
Sponsored by: Netflix


# 96c4f2c5 15-Jan-2018 Warner Losh <imp@FreeBSD.org>

Check the return value from utf8_to_ucs2 instead of whether or not uv
is NULL. That's more correct and doesn't depend on the error behavior
of utf8_to_ucs2. In practice, we'll never see this though since we
pass utf8_to_ucs2 a well formed string.

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


# 2c18ede6 15-Jan-2018 Andrew Turner <andrew@FreeBSD.org>

Fix booting on some arm64 systems after r327879 by fixing the call to
utf8_to_ucs2 in boot1.efi. We need to initialise the ucs2 output string
so it will allocate space, and use the return value to determine if the
call was successful.

Reviewed by: imp
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D13915


# 8d578b39 12-Jan-2018 Warner Losh <imp@FreeBSD.org>

Report the boot order and where we are in that boot order. Add
ability to create a boot1.efi that always fails for testing purposes
and failover scenarios.

Sponsored by: Netflix


# 5e6e2d38 20-Dec-2017 Michael Zhilin <mizhka@FreeBSD.org>

[boot/efi] scan all display modes rather than sequential try-fail way

This patch allows to scan all display modes in boot1 as loader does.

Before system tried to select optimal display mode by sequential scan of
modes and if error then stop scanning. This way is not good, because
if mode N is not present, mode N+1 may exist.

In loader we use conout->Mode->MaxMode to identify maximum number of modes.
This commit is to use same way in boot1 as in loader.

Reported by: Andrey Pustovetov <andrey.pustovetov@gmail.com>
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D13541


# 9f9b430b 14-Dec-2017 Toomas Soome <tsoome@FreeBSD.org>

libefi: make efichar.h more usable in stand code

Use _STANDALONE for guard expression in efichar.[ch] and add efi_char typedef.
clean up boot1.c, and replace for loop in efipart.c with ucs2len().

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D13488


# ca987d46 14-Nov-2017 Warner Losh <imp@FreeBSD.org>

Move sys/boot to stand. Fix all references to new location

Sponsored by: Netflix