Page MenuHomeFreeBSD

D20015.id56504.diff
No OneTemporary

D20015.id56504.diff

Index: head/stand/efi/include/efi.h
===================================================================
--- head/stand/efi/include/efi.h
+++ head/stand/efi/include/efi.h
@@ -62,6 +62,11 @@
#include "efiuga.h"
/*
+ * Global variables
+ */
+extern EFI_LOADED_IMAGE *boot_img;
+
+/*
* FreeBSD UUID
*/
#define FREEBSD_BOOT_VAR_GUID \
Index: head/stand/efi/include/efizfs.h
===================================================================
--- head/stand/efi/include/efizfs.h
+++ head/stand/efi/include/efizfs.h
@@ -50,10 +50,8 @@
EFI_HANDLE efizfs_get_handle_by_guid(uint64_t);
bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *);
zfsinfo_list_t *efizfs_get_zfsinfo_list(void);
-void efizfs_set_preferred(EFI_HANDLE);
#else
-#define efizfs_set_preferred(x)
#define efi_zfs_probe NULL
#endif
Index: head/stand/efi/libefi/efizfs.c
===================================================================
--- head/stand/efi/libefi/efizfs.c
+++ head/stand/efi/libefi/efizfs.c
@@ -45,14 +45,6 @@
uint64_t pool_guid;
-static EFI_HANDLE preferred;
-
-void
-efizfs_set_preferred(EFI_HANDLE h)
-{
- preferred = h;
-}
-
zfsinfo_list_t *
efizfs_get_zfsinfo_list(void)
{
@@ -122,7 +114,7 @@
efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit);
if (zfs_probe_dev(devname, &guid) == 0) {
insert_zfs(pd->pd_handle, guid);
- if (pd->pd_handle == preferred)
+ if (pd->pd_handle == boot_img->DeviceHandle)
pool_guid = guid;
}
Index: head/stand/efi/loader/main.c
===================================================================
--- head/stand/efi/loader/main.c
+++ head/stand/efi/loader/main.c
@@ -88,6 +88,11 @@
*/
UINT16 boot_current;
+/*
+ * Image that we booted from.
+ */
+EFI_LOADED_IMAGE *boot_img;
+
static bool
has_keyboard(void)
{
@@ -300,7 +305,7 @@
enum { BOOT_INFO_OK = 0, BAD_CHOICE = 1, NOT_SPECIFIC = 2 };
static int
-match_boot_info(EFI_LOADED_IMAGE *img __unused, char *boot_info, size_t bisz)
+match_boot_info(char *boot_info, size_t bisz)
{
uint32_t attr;
uint16_t fplen;
@@ -448,7 +453,7 @@
* a drop to the OK boot loader prompt is possible.
*/
static int
-find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, bool is_last,
+find_currdev(bool do_bootmgr, bool is_last,
char *boot_info, size_t boot_info_sz)
{
pdinfo_t *dp, *pp;
@@ -481,7 +486,7 @@
* loader.conf.
*/
if (do_bootmgr) {
- rv = match_boot_info(img, boot_info, boot_info_sz);
+ rv = match_boot_info(boot_info, boot_info_sz);
switch (rv) {
case BOOT_INFO_OK: /* We found it */
return (0);
@@ -514,7 +519,7 @@
* boot protocol to do so. We fail and let UEFI go on to
* the next candidate.
*/
- dp = efiblk_get_pdinfo_by_handle(img->DeviceHandle);
+ dp = efiblk_get_pdinfo_by_handle(boot_img->DeviceHandle);
if (dp != NULL) {
text = efi_devpath_name(dp->pd_devpath);
if (text != NULL) {
@@ -553,7 +558,7 @@
* any of the nodes in that path match one of the enumerated
* handles. Currently, this handle list is only for netboot.
*/
- if (efi_handle_lookup(img->DeviceHandle, &dev, &unit, &extra) == 0) {
+ if (efi_handle_lookup(boot_img->DeviceHandle, &dev, &unit, &extra) == 0) {
set_currdev_devsw(dev, unit);
if (sanity_check_currdev())
return (0);
@@ -751,7 +756,6 @@
size_t sz, bosz = 0, bisz = 0;
UINT16 boot_order[100];
char boot_info[4096];
- EFI_LOADED_IMAGE *img;
char buf[32];
bool uefi_boot_mgr;
@@ -763,7 +767,7 @@
archsw.arch_zfs_probe = efi_zfs_probe;
/* Get our loaded image protocol interface structure. */
- BS->HandleProtocol(IH, &imgid, (VOID**)&img);
+ BS->HandleProtocol(IH, &imgid, (VOID**)&boot_img);
/*
* Chicken-and-egg problem; we want to have console output early, but
@@ -776,9 +780,6 @@
setenv("console", "efi", 1);
cons_probe();
- /* Tell ZFS probe code where we booted from, if zfs configured */
- efizfs_set_preferred(img->DeviceHandle);
-
/* Init the time source */
efi_time_init();
@@ -880,14 +881,14 @@
/* Determine the devpath of our image so we can prefer it. */
- text = efi_devpath_name(img->FilePath);
+ text = efi_devpath_name(boot_img->FilePath);
if (text != NULL) {
printf(" Load Path: %S\n", text);
efi_setenv_freebsd_wcs("LoaderPath", text);
efi_free_devpath_name(text);
}
- rv = BS->HandleProtocol(img->DeviceHandle, &devid, (void **)&imgpath);
+ rv = BS->HandleProtocol(boot_img->DeviceHandle, &devid, (void **)&imgpath);
if (rv == EFI_SUCCESS) {
text = efi_devpath_name(imgpath);
if (text != NULL) {
@@ -974,7 +975,7 @@
* the boot protocol and also allow an escape hatch for users wishing
* to try something different.
*/
- if (find_currdev(img, uefi_boot_mgr, is_last, boot_info, bisz) != 0)
+ if (find_currdev(uefi_boot_mgr, is_last, boot_info, bisz) != 0)
if (!interactive_interrupt("Failed to find bootable partition"))
return (EFI_NOT_FOUND);

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 16, 12:14 AM (8 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27656236
Default Alt Text
D20015.id56504.diff (4 KB)

Event Timeline