History log of /freebsd-current/stand/efi/include/efilib.h
Revision Date Author Comments
# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# f2b3bf5c 12-May-2023 Toomas Soome <tsoome@FreeBSD.org>

libefi: add efi_devpath_next_instance()

UEFI device path may be path to one device, or concatenated list of instances
to different devices (textually represented as comma separated list).

Provide generic function to get next instance from device path.
Returns next instance or end node.

The use case is like:

EFI_DEVICE_PATH *node = (EFI_DEVICE_PATH *)buf;
while (!IsDevicePathEnd(node)) {
process(node);
node = efi_devpath_next_instance(node);
}

Where buf is pointing to either single device path or
concatenated list of device paths (such as from ConIn or ConOut).

Reviewers: imp
Differential Revision: https://reviews.freebsd.org/D40081


# 1c1783d6 11-Jan-2023 Warner Losh <imp@FreeBSD.org>

stand: Create common gen_setcurrdev and replace code

Replace 4 identical copies of *_setcurrdev with gen_setcurrdev to avoid
having to create a 5th copy. uboot_setcurrdev is actually different and
needs to remain separate (even though it's quite similar).

Sponsored by: Netflix
Reviewed by: fuz@fuz.su, kevans
Differential Revision: https://reviews.freebsd.org/D38003


# 1e7a2eb9 11-Aug-2022 Warner Losh <imp@FreeBSD.org>

stand: efi_fmtdev can be reduced to devformat

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

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


# 77e3db07 21-Nov-2021 Warner Losh <imp@FreeBSD.org>

loader: abstract boot services exiting to libefi function

Move direct call of ExitBootServices to efi_exit_boot_services. This
function sets boot_services_active to false so callers don't have to do
it everywhere (though currently only loader/bootinfo.c is affected).

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


# 3630506b 20-Dec-2020 Toomas Soome <tsoome@FreeBSD.org>

loader: implement framebuffer console

Draw console on efi.
Add vbe framebuffer for BIOS loader (vbe off, vbe on, vbe list,
vbe set xxx).
autoload font (/boot/fonts) based on resolution and font size.
Add command loadfont (set font by file) and
variable screen.font (set font by size). Pass loaded font to kernel.

Export variables:
screen.height
screen.width
screen.depth

Add gfx primitives to draw the screen and put png image on the screen.
Rework menu draw to iterate list of consoles to enamble device specific
output.

Probably something else I forgot...

Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27420


# 28e002cd 23-Jun-2020 Kyle Evans <kevans@FreeBSD.org>

stand: remove redundant declarations

These are picked out by the amd64-gcc6 build; time() is declared in <time.h>
and delay() is declared in <bootstrap.h>. These are the correct places for
these in stand/, so remove the duplicate declarations and make sure the
delay() consumer in libefi that depended on the extra delay() declaration
includes <bootstrap.h>.

MFC after: 1 week


# 523a713f 30-Nov-2019 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: efipart needs better support detecting nested partitions

Just as disks can have nested partitions, the same happens with cd devices,
so we need to detect device paths and make sure we will not mix the handles.

To address this:

we fetch handle array and create linked list of block devices.
we walk the list and detect parent devices and set children pd_parent.
for {fd, cd, hd}, we walk device list and pick up our devices and store to
corresponding list. We make sure we store parent device first.

For sorting we use 3 steps: We check for floppy, we check for cd and then
everything else must be hd.

In general, it seems the floppy devices have no parent.
CD can have both parents and children (multiple boot entries, partitions
from the hybrid disk image).

Tested by: cross+freebsd@distal.com on Cisco UCS systems, C200 series (C220M5, C240M4).
Also on MBP with UEFI 1.10

Reported by: Chriss Ross
MFC after: 1w
Differential Revision: https://reviews.freebsd.org/D22553


# b9f745fd 02-Nov-2019 Toomas Soome <tsoome@FreeBSD.org>

loader: fall back to term_emu on efi console with serial backend

In case of efi console having serial backend (video + serial or only serial),
we need to stick with old emulator till we can draw console.

Eventually we would need to get console terminal emulator to be removed
from serial console because the serial link already has the terminal.

However, we need to implement comconsole on all efi platforms first, then
we need the ability to draw console, so we do not have to use SimpleTextOutput
protocol (which will write both on video and serial in case of multiplexed
ComOut).

Differential Revision: https://reviews.freebsd.org/D22161


# 56758831 05-Sep-2019 Toomas Soome <tsoome@FreeBSD.org>

loader: use teken teminal emulator for x86 and uefi

Replace mini cons25 emulator with teken, this does enable us proper console
terminal for loader and will make it possible to implement different
back end callbacks to draw to screen.

At this time we still only "draw" in text mode.


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

loader.efi: efilib.h and libefi.c were left out of 350654

And this is second followup for 350654


# da4961c7 24-Jun-2019 Rebecca Cran <bcran@FreeBSD.org>

loader: add HTTP support using UEFI

Add support for an HTTP "network filesystem" using the UEFI's HTTP
stack.

This also supports HTTPS, but TianoCore EDK2 implementations currently
crash while fetching loader files.
Only IPv4 is supported at the moment. IPv6 support is planned for a
follow-up changeset.

Note that we include some headers from the TianoCore EDK II project in
stand/efi/include/Protocol verbatim, including links to the license instead
of including the full text because that's their preferred way of
communicating it, despite not being normal FreeBSD project practice.

Submitted by: scottph
Reviewed by: imp, bcran
Differential Revision: https://reviews.freebsd.org/D20643


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

Introduce efi_devpath_same_disk

This is like efi_devpath_match, but allows differing device media
paths. Those just specify the partition information.

Differential Revision: https://reviews.freebsd.org/D20513


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

Abstract out efi_devpath_to_handle to search for a handle that matches
the desired devpath.


# 751241a7 25-Apr-2019 Warner Losh <imp@FreeBSD.org>

Add efi_freebsd_delenv

Add a wrapper around efi_delenv akin to efi_freebsd_getenv and
efi_getenv.


# 16b07b25 19-Apr-2019 Warner Losh <imp@FreeBSD.org>

Add wrapper functions to convert strings to EFI_DEVICE_PATH

In anticipation of new functionality, create routines to convert char *
and a CHAR16 * to a EFI_DEVICE_PATH
EFI_DEVICE_PATH *efi_name_to_devpath(const char *path);
EFI_DEVICE_PATH *efi_name_to_devpath16(CHAR16 *path);
void efi_devpath_free(EFI_DEVICE_PATH *dp);
The first two return an EFI_DEVICE_PATH for the passed in paths. The
third frees up the storage the first two return when the caller is
done with it.

Differential Revision: https://reviews.freebsd.org/D19971


# a13881af 17-Apr-2019 Warner Losh <imp@FreeBSD.org>

Add efi_delenv

Add an interface to remove / delete UEFI variables.


# 883d342d 17-Apr-2019 Warner Losh <imp@FreeBSD.org>

Add a more generic efi_setenv function.

efi_setenv allows any UEFI variable to be set.


# 65641822 03-Jan-2019 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: efi variable rework and lsefi command added

This update does add diag and debug capabilities to interpret the efi
variables, configuration and protocols (lsefi).

The side effect is that we add/update bunch of related headers.


# 34ada209 03-Jan-2019 Toomas Soome <tsoome@FreeBSD.org>

loader.efi: update memmap command to recognize new attributes

Also move memory type to string translation to libefi for later use.

MFC after: 2 weeks


# 00a47597 23-Jul-2018 Warner Losh <imp@FreeBSD.org>

Implement efiblk_get_pdinfo_by_device_path

Lookup a block device by it's device path. We use a 'loose' lookup
whereby we scan forward to the first Media Path portion of the device
path, then look at all our handles for one whose first Media Path
matches. This will also work if the device path pointed to has a
following file path (or paths) as that's ignored. It assumes that
there's only one media path node that describes the entire device,
which is true as of the latest UEFI spec (2.7 Errata A) as far as I've
been able to determine.

Sponsored by: Netflix


# c6c2a73c 23-Jul-2018 Warner Losh <imp@FreeBSD.org>

Implement efi_devpath_length

Return the total length, in bytes, of the device path (including the
terminating node at the end).

Sponsored by: Netflix


# 13850b36 23-Jul-2018 Warner Losh <imp@FreeBSD.org>

Implement efi_devpath_match_node

Returns true if the first node pointed to by devpath1 is identical to
the first node pointed to by devpath2, with care taken to not read
past the end of the valid parts of either devpath1 or
devpath2. Otherwise, returns false.

Sponsored by: Netflix


# ee4e1d58 23-Jul-2018 Warner Losh <imp@FreeBSD.org>

Implement efi_devpath_to_media_path

Takes a generic device path as its input. Scans through it to find the
first media_path node in it and returns a pointer to it. If none is
found, NULL is returned.

Sponsored by: Netflix


# fa9dc8d3 11-Apr-2018 Warner Losh <imp@FreeBSD.org>

Refactor currdev setting

Refactor the currdev setting to find the device we booted from. Limit
searching when we don't already have a reasonable currdev from that to
the same device only. Search a little harder for ZFS volumes as that's
needed for loader.efi to live on an ESP.

Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D13784


# 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.


# 8b752692 14-Feb-2018 Emmanuel Vadot <manu@FreeBSD.org>

efi: Only scan the BLKIO MEDIA once

Scan only the BLOCK IO MEDIA once instead of each time for each type of
device (fd, cd and hdd).
Leave the mechanism to free and reprobe all devices if one day we want
to implement a "dev rescan" thing.

Reviewed by: imp, tsoome
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14334


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

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

Sponsored by: Netflix