Commit Graph

22 Commits

Author SHA1 Message Date
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
Emmanuel Vadot
c5cf2b33fe efinet: Do not return only if ReceiveFilter fails
If the network interface or the uefi implementation do not support the
ReceiveFilter interface do not return only and just print a message.
U-Boot doesn't support is and likely never will. Also even if this fails
it doesn't mean that network in EFI isn't supported.
2018-03-30 16:37:08 +00:00
Kyle Evans
bc40337bb0 loader consoles: Implement SGR 24, 25
Mostly for completeness sake- implement 24 (no underline) and 25 (no blink)

MFC after:	3 days
2018-03-24 02:01:25 +00:00
Kyle Evans
88ccfa7497 Loader consoles: Implement SGR 22, reset intensity
MFC after:	3 days
2018-03-23 03:48:45 +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
Warner Losh
f7b26b765b Use the one-line-per-file pattern here, and sort the file names.
Sponsored by: Netflix
2018-03-12 21:40:09 +00:00
Warner Losh
2472d92505 GC unused routines.
Sponsored by: Netflix
2018-03-12 21:40:05 +00:00
Warner Losh
ad00892f4c Remove d_type from devdesc. It's not needed as we can fetch it from
d_dev->dv_type when we need it.
2018-03-12 21:39:59 +00:00
Warner Losh
de04d704a9 Use the actual struct devdesc at the start of all *_devdesc structs
The current system is fragile and requires very careful layout of all
*_devdesc structures. It also makes it hard to change the base
devdesc. Take a page from CAM and put the 'header' in all the derived
classes and adjust the code to match.

For OFW, move the iHandle h_handle out of a slot conflicting with
d_opendata. Due to quirks in the alignment rules, this worked.
However changing the code to use d_opendata storage now that it's a
pointer is hard, so just have a separate field for it.

All other cleanups were to make the *_devdesc structures match where
they'd taken some liberties that were none-the-less compatible enough
to work.
2018-03-12 21:39:49 +00:00
Warner Losh
49898aa2ff We can't use d_opendata for blkio storage.
open_disk uses d_opendata for it's own purpse. We can't store blkio
there. Fortunately, blkio is stored elsewhere and we never actually
retrieve blkio from d_opendata. Eliminate it as a source of confusion.
Eliminate all stores of d_opendata in efi since this layer doesn't own
that field.
2018-03-12 21:39:38 +00:00
Warner Losh
4784aef9f5 Consolidate three copies of ZFS commands into a central location.
There's no reason to have multiple copies of lszfs and
reloadbe. Consolidate them into one location. Also ldi_get_size is the
same everywhere (except sparc64). Make it the same everywhere as the
common definition is more general and will work on spar64.
2018-02-21 15:57:36 +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
Warner Losh
b28421d5f1 These 4th words were an attempt to allow integration into the boot
loader scripts. However, that path won't be taken after all it
seems. Remove this code before it decays into uselessness. Also remove
build dependencies on forth no longer needed.
2018-02-02 15:01:44 +00:00
Warner Losh
8299b37f85 Centralize several variables.
MK_CTF, MK_SSP, MK_PROFILE, NO_PIC, and INTERNALLIB are always the
same, so set them in defs.mk. MAN= is common, so set it here too.
This removes a lot of boring repetition from the Makefiles that added
almost no value.
2018-02-02 06:32:26 +00:00
Toomas Soome
981887b970 utf8_to_ucs2() should check for malloc failure
utf8_to_ucs2() is calling malloc() without checking the result.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D13933
2018-01-16 20:35:54 +00:00
Warner Losh
27d95c1a03 When returning an error and freeing allocated memory from ucs2_to_utf8
and utf8_to_ucs2, be sure to NULL out the return pointer too, rather
than return a pointer to free memory.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13917
2018-01-15 22:17:15 +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
Toomas Soome
61da91207d loader.efi: add note about iPXE into the efipart.c
Commant update.
2017-12-04 08:50:00 +00:00
Toomas Soome
e4f6a1bfa3 loader.efi: efipart should exclude iPXE stub block protocol
iPXE does insert stub  BLOCK IO protocol handle to rework other issues,
this handle is not usable as it does not provide actual implementation.

We can detect this situation by checking and validating the BlockSize
property, so this update does make sure we have BlockSize at least 512B
and its value is power of 2.

PR:		223969
Reported by:	Jeff Pieper
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D13297
2017-12-01 06:37:12 +00:00
Toomas Soome
cdadbf0971 loader.efi: efipart does not recognize partitionless disks
Rework the block device handle check to allow more robust device
classification. This is mostly usability issue - it can be quite confusing
for user when no disks are listed with lsdev.

Add more comments about what and why is done.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D13026
2017-11-22 08:48:00 +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