Date: Wed, 26 Jun 2019 03:06:57 +0000 (UTC) From: Rebecca Cran <bcran@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349404 - in head/stand/efi: libefi loader Message-ID: <201906260306.x5Q36v3t027997@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bcran Date: Wed Jun 26 03:06:57 2019 New Revision: 349404 URL: https://svnweb.freebsd.org/changeset/base/349404 Log: 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. Modified: head/stand/efi/libefi/efihttp.c head/stand/efi/loader/conf.c Modified: head/stand/efi/libefi/efihttp.c ============================================================================== --- head/stand/efi/libefi/efihttp.c Wed Jun 26 02:09:22 2019 (r349403) +++ head/stand/efi/libefi/efihttp.c Wed Jun 26 03:06:57 2019 (r349404) @@ -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. Modified: head/stand/efi/loader/conf.c ============================================================================== --- head/stand/efi/loader/conf.c Wed Jun 26 02:09:22 2019 (r349403) +++ head/stand/efi/loader/conf.c Wed Jun 26 03:06:57 2019 (r349404) @@ -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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906260306.x5Q36v3t027997>