1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Re-enable loader efi http boot and fix dv_open bug if dv_init failed

The code in efihttp.c was assuming that dv_open wouldn't be called if
dv_init failed. But the dv_init return value is currently ignored.

Add a new variable, `efihttp_init_done` and only proceed in dv_open if
it's true. This fixes the loader on systems without efi http support.
This commit is contained in:
Rebecca Cran 2019-06-26 03:06:57 +00:00
parent 088c26aee8
commit 1ee03da25e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349404
2 changed files with 12 additions and 0 deletions

View File

@ -52,6 +52,8 @@ static EFI_GUID http_guid = EFI_HTTP_PROTOCOL_GUID;
static EFI_GUID httpsb_guid = EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID;
static EFI_GUID ip4config2_guid = EFI_IP4_CONFIG2_PROTOCOL_GUID;
static bool efihttp_init_done = false;
static int efihttp_dev_init(void);
static int efihttp_dev_strategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize);
@ -208,6 +210,9 @@ efihttp_dev_init(void)
return (efi_status_to_errno(status));
err = efi_register_handles(&efihttp_dev, &handle, NULL, 1);
if (!err)
efihttp_init_done = true;
return (err);
}
@ -236,6 +241,9 @@ efihttp_dev_open(struct open_file *f, ...)
EFI_STATUS status;
int err, len;
if (!efihttp_init_done)
return (ENXIO);
imgpath = efi_lookup_image_devpath(IH);
if (imgpath == NULL)
return (ENXIO);
@ -555,6 +563,8 @@ efihttp_fs_open(const char *path, struct open_file *f)
char *path_slash;
int err;
if (!efihttp_init_done)
return (ENXIO);
/*
* If any path fails to open, try with a trailing slash in
* case it's a directory.

View File

@ -39,6 +39,7 @@ struct devsw *devsw[] = {
&efipart_fddev,
&efipart_cddev,
&efipart_hddev,
&efihttp_dev, /* ordering with efinet_dev matters */
&efinet_dev,
&vdisk_dev,
#ifdef EFI_ZFS_BOOT
@ -54,6 +55,7 @@ struct fs_ops *file_system[] = {
&dosfs_fsops,
&ufs_fsops,
&cd9660_fsops,
&efihttp_fsops,
&tftp_fsops,
&nfs_fsops,
&gzipfs_fsops,