Commit Graph

17 Commits

Author SHA1 Message Date
Toomas Soome
6564182252 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.
2019-01-03 20:27:50 +00:00
Toomas Soome
34ada20958 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
2019-01-03 09:03:58 +00:00
Warner Losh
00a47597a3 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
2018-07-23 20:36:54 +00:00
Warner Losh
c6c2a73c0c Implement efi_devpath_length
Return the total length, in bytes, of the device path (including the
terminating node at the end).

Sponsored by: Netflix
2018-07-23 20:36:50 +00:00
Warner Losh
13850b362f 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
2018-07-23 20:36:45 +00:00
Warner Losh
ee4e1d5807 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
2018-07-23 20:36:25 +00:00
Warner Losh
f9ac902319 Define ADR subtype of ACPI type for a device path. 2018-07-13 21:03:32 +00:00
Warner Losh
c2bac3e1ba Provide a more direct interface to tell ZFS what the preferred handle
is. We tell the ZFS code now, and it checks rather than having a
callback to do the checks.

This will allow us to have a more graceful fallback code. In the
future, it's anticipated that we may fallback to a more global search
(or implement a command to do so) when reqeusted by the user, or we
detect a violation of the UEFI Boot Manager protocol severe enough to
warrant this backstop. For now, it just allows us to get rid of img as
a global.

Sponsored by: Netflix
2018-06-15 19:07:26 +00:00
Warner Losh
fa9dc8d3ed 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
2018-04-11 19:46:24 +00:00
Toomas Soome
255b83725c libefi: UEFI_BOOT_VAR_GUID duplicates EFI_GLOBAL_VARIABLE
Drop UEFI_BOOT_VAR_GUID and use EFI_GLOBAL_VARIABLE.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D14696
2018-03-15 05:58:35 +00:00
Warner Losh
5722dd8394 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.
2018-03-12 21:40:14 +00:00
Emmanuel Vadot
ff727b9a1d efi: Do not pad the efi devpath structure
This solve problem when booting with efi on armv7
Reviewed by:	imp, tsoome
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D14415
2018-02-18 11:17:39 +00:00
Emmanuel Vadot
8b75269237 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
2018-02-14 18:05:37 +00:00
Ed Maste
9b2ff7db9d loader.efi: add missing EFI GUIDs
These were found during bring-up on a new arm64 platform and in an
amd64 VM.

Submitted by:	Arshan Khanifar <arshankhanifar_gmail.com>
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D14036
2018-01-25 20:09:51 +00:00
Warner Losh
1e13416bb9 Add GUID for UEFI boot manager variables.
Sponsoered by: Netflix
2018-01-12 15:30:52 +00:00
Toomas Soome
9f9b430b19 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
2017-12-14 16:41:52 +00:00
Warner Losh
ca987d4641 Move sys/boot to stand. Fix all references to new location
Sponsored by:	Netflix
2017-11-14 23:02:19 +00:00