summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-08-04 19:00:15 +0300
committerToomas Soome <tsoome@me.com>2019-08-07 21:12:01 +0300
commitbf693dc92f91a3c8675bf5a04d1300c40058500c (patch)
treec6a681ecbbef6fdd8a0afe7311412a0df89ae769 /usr
parent8c732929c6c71eb2de940ee265460cfb89b887f7 (diff)
downloadillumos-joyent-bf693dc92f91a3c8675bf5a04d1300c40058500c.tar.gz
11516 loader.efi: replace HandleProtocol() with OpenProtocol()
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Reviewed by: John Levon <john.levon@joyent.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr')
-rw-r--r--usr/src/boot/Makefile.version2
-rw-r--r--usr/src/boot/sys/boot/efi/include/efilib.h1
-rw-r--r--usr/src/boot/sys/boot/efi/libefi/devpath.c7
-rw-r--r--usr/src/boot/sys/boot/efi/libefi/efinet.c2
-rw-r--r--usr/src/boot/sys/boot/efi/libefi/efipart.c16
-rw-r--r--usr/src/boot/sys/boot/efi/libefi/libefi.c7
-rw-r--r--usr/src/boot/sys/boot/efi/loader/arch/i386/efimd.c2
-rw-r--r--usr/src/boot/sys/boot/efi/loader/efi_main.c2
-rw-r--r--usr/src/boot/sys/boot/efi/loader/framebuffer.c7
-rw-r--r--usr/src/boot/sys/boot/efi/loader/main.c8
10 files changed, 32 insertions, 22 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version
index a293a6a2fa..06fa2d3ef9 100644
--- a/usr/src/boot/Makefile.version
+++ b/usr/src/boot/Makefile.version
@@ -33,4 +33,4 @@ LOADER_VERSION = 1.1
# Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
# The version is processed from left to right, the version number can only
# be increased.
-BOOT_VERSION = $(LOADER_VERSION)-2019.06.26.1
+BOOT_VERSION = $(LOADER_VERSION)-2019.08.04.1
diff --git a/usr/src/boot/sys/boot/efi/include/efilib.h b/usr/src/boot/sys/boot/efi/include/efilib.h
index db2a238515..bf975d1bbc 100644
--- a/usr/src/boot/sys/boot/efi/include/efilib.h
+++ b/usr/src/boot/sys/boot/efi/include/efilib.h
@@ -66,6 +66,7 @@ pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev);
pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h);
void *efi_get_table(EFI_GUID *tbl);
+EFI_STATUS OpenProtocolByHandle(EFI_HANDLE, EFI_GUID *, void **);
int efi_getdev(void **, const char *, const char **);
char *efi_fmtdev(void *);
diff --git a/usr/src/boot/sys/boot/efi/libefi/devpath.c b/usr/src/boot/sys/boot/efi/libefi/devpath.c
index 86172ba093..fd67bc5d77 100644
--- a/usr/src/boot/sys/boot/efi/libefi/devpath.c
+++ b/usr/src/boot/sys/boot/efi/libefi/devpath.c
@@ -41,8 +41,8 @@ efi_lookup_image_devpath(EFI_HANDLE handle)
EFI_DEVICE_PATH *devpath;
EFI_STATUS status;
- status = BS->HandleProtocol(handle, &ImageDevicePathGUID,
- (VOID **)&devpath);
+ status = OpenProtocolByHandle(handle, &ImageDevicePathGUID,
+ (void **)&devpath);
if (EFI_ERROR(status))
devpath = NULL;
return (devpath);
@@ -54,7 +54,8 @@ efi_lookup_devpath(EFI_HANDLE handle)
EFI_DEVICE_PATH *devpath;
EFI_STATUS status;
- status = BS->HandleProtocol(handle, &DevicePathGUID, (VOID **)&devpath);
+ status = OpenProtocolByHandle(handle, &DevicePathGUID,
+ (void **)&devpath);
if (EFI_ERROR(status))
devpath = NULL;
return (devpath);
diff --git a/usr/src/boot/sys/boot/efi/libefi/efinet.c b/usr/src/boot/sys/boot/efi/libefi/efinet.c
index ed71f9d428..45e7dc0601 100644
--- a/usr/src/boot/sys/boot/efi/libefi/efinet.c
+++ b/usr/src/boot/sys/boot/efi/libefi/efinet.c
@@ -212,7 +212,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint)
}
h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private;
- status = BS->HandleProtocol(h, &sn_guid, (void **)&nif->nif_devdata);
+ status = OpenProtocolByHandle(h, &sn_guid, (void **)&nif->nif_devdata);
if (status != EFI_SUCCESS) {
printf("net%d: cannot fetch interface data (status=%lu)\n",
nif->nif_unit, EFI_ERROR_CODE(status));
diff --git a/usr/src/boot/sys/boot/efi/libefi/efipart.c b/usr/src/boot/sys/boot/efi/libefi/efipart.c
index 1af5f9dcf4..f200f62314 100644
--- a/usr/src/boot/sys/boot/efi/libefi/efipart.c
+++ b/usr/src/boot/sys/boot/efi/libefi/efipart.c
@@ -286,8 +286,8 @@ efipart_hdd(EFI_DEVICE_PATH *dp)
}
/* Make sure we do have the media. */
- status = BS->HandleProtocol(efipart_handles[i],
- &blkio_guid, (void **)&blkio);
+ status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid,
+ (void **)&blkio);
if (EFI_ERROR(status))
return (false);
@@ -430,8 +430,8 @@ efipart_updatecd(void)
if (efipart_hdd(devpath))
continue;
- status = BS->HandleProtocol(efipart_handles[i],
- &blkio_guid, (void **)&blkio);
+ status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid,
+ (void **)&blkio);
if (EFI_ERROR(status))
continue;
/*
@@ -683,8 +683,8 @@ efipart_updatehd(void)
if (!efipart_hdd(devpath))
continue;
- status = BS->HandleProtocol(efipart_handles[i],
- &blkio_guid, (void **)&blkio);
+ status = OpenProtocolByHandle(efipart_handles[i], &blkio_guid,
+ (void **)&blkio);
if (EFI_ERROR(status))
continue;
@@ -771,7 +771,7 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t *pdlist, int verbose)
snprintf(line, sizeof(line),
" %s%d", dev->dv_name, pd->pd_unit);
printf("%s:", line);
- status = BS->HandleProtocol(h, &blkio_guid, (void **)&blkio);
+ status = OpenProtocolByHandle(h, &blkio_guid, (void **)&blkio);
if (!EFI_ERROR(status)) {
printf(" %llu",
blkio->Media->LastBlock == 0? 0:
@@ -854,7 +854,7 @@ efipart_open(struct open_file *f, ...)
return (EINVAL);
if (pd->pd_blkio == NULL) {
- status = BS->HandleProtocol(pd->pd_handle, &blkio_guid,
+ status = OpenProtocolByHandle(pd->pd_handle, &blkio_guid,
(void **)&pd->pd_blkio);
if (EFI_ERROR(status))
return (efi_status_to_errno(status));
diff --git a/usr/src/boot/sys/boot/efi/libefi/libefi.c b/usr/src/boot/sys/boot/efi/libefi/libefi.c
index 7d5c8760d7..b1af9c040e 100644
--- a/usr/src/boot/sys/boot/efi/libefi/libefi.c
+++ b/usr/src/boot/sys/boot/efi/libefi/libefi.c
@@ -47,3 +47,10 @@ efi_get_table(EFI_GUID *tbl)
}
return (NULL);
}
+
+EFI_STATUS
+OpenProtocolByHandle(EFI_HANDLE handle, EFI_GUID *protocol, void **interface)
+{
+ return (BS->OpenProtocol(handle, protocol, interface, IH, NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL));
+}
diff --git a/usr/src/boot/sys/boot/efi/loader/arch/i386/efimd.c b/usr/src/boot/sys/boot/efi/loader/arch/i386/efimd.c
index 01905e664f..41615be905 100644
--- a/usr/src/boot/sys/boot/efi/loader/arch/i386/efimd.c
+++ b/usr/src/boot/sys/boot/efi/loader/arch/i386/efimd.c
@@ -73,7 +73,7 @@ ldr_bootinfo(struct bootinfo *bi, uint64_t *bi_addr)
sz = sizeof(EFI_HANDLE);
status = BS->LocateHandle(ByProtocol, &fpswa_guid, 0, &sz, &handle);
if (status == 0)
- status = BS->HandleProtocol(handle, &fpswa_guid, &fpswa);
+ status = OpenProtocolByHandle(handle, &fpswa_guid, &fpswa);
bi->bi_fpswa = (status == 0) ? (uint64_t)fpswa : 0;
bisz = (sizeof(struct bootinfo) + 0x0f) & ~0x0f;
diff --git a/usr/src/boot/sys/boot/efi/loader/efi_main.c b/usr/src/boot/sys/boot/efi/loader/efi_main.c
index c65be09057..23a86a4ae6 100644
--- a/usr/src/boot/sys/boot/efi/loader/efi_main.c
+++ b/usr/src/boot/sys/boot/efi/loader/efi_main.c
@@ -92,7 +92,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)
/* Use efi_exit() from here on... */
- status = BS->HandleProtocol(IH, &image_protocol, (VOID**)&img);
+ status = OpenProtocolByHandle(IH, &image_protocol, (void **)&img);
if (status != EFI_SUCCESS)
efi_exit(status);
diff --git a/usr/src/boot/sys/boot/efi/loader/framebuffer.c b/usr/src/boot/sys/boot/efi/loader/framebuffer.c
index aff5f9133e..dc2096849b 100644
--- a/usr/src/boot/sys/boot/efi/loader/framebuffer.c
+++ b/usr/src/boot/sys/boot/efi/loader/framebuffer.c
@@ -222,7 +222,8 @@ efifb_uga_get_pciio(void)
/* Get the PCI I/O interface of the first handle that supports it. */
pciio = NULL;
for (hp = buf; hp < buf + bufsz; hp++) {
- status = BS->HandleProtocol(*hp, &pciio_guid, (void **)&pciio);
+ status = OpenProtocolByHandle(*hp, &pciio_guid,
+ (void **)&pciio);
if (status == EFI_SUCCESS) {
free(buf);
return (pciio);
@@ -458,11 +459,11 @@ efifb_gop_get_edid(EFI_HANDLE gop)
return (NULL);
guid = &active_edid_guid;
- status = BS->OpenProtocol(gop, guid, (VOID **)&edid, IH, NULL,
+ status = BS->OpenProtocol(gop, guid, (void **)&edid, IH, NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (status != EFI_SUCCESS) {
guid = &discovered_edid_guid;
- status = BS->OpenProtocol(gop, guid, (VOID **)&edid, IH, NULL,
+ status = BS->OpenProtocol(gop, guid, (void **)&edid, IH, NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
}
if (status != EFI_SUCCESS)
diff --git a/usr/src/boot/sys/boot/efi/loader/main.c b/usr/src/boot/sys/boot/efi/loader/main.c
index 0c01a85fe3..9be26a8b88 100644
--- a/usr/src/boot/sys/boot/efi/loader/main.c
+++ b/usr/src/boot/sys/boot/efi/loader/main.c
@@ -173,7 +173,7 @@ has_keyboard(void)
*/
hin_end = &hin[sz / sizeof (*hin)];
for (walker = hin; walker < hin_end; walker++) {
- status = BS->HandleProtocol(*walker, &devid, (void **)&path);
+ status = OpenProtocolByHandle(*walker, &devid, (void **)&path);
if (EFI_ERROR(status))
continue;
@@ -482,7 +482,7 @@ main(int argc, CHAR16 *argv[])
archsw.arch_zfs_probe = efi_zfs_probe;
/* Get our loaded image protocol interface structure. */
- BS->HandleProtocol(IH, &imgid, (void **)&img);
+ (void) OpenProtocolByHandle(IH, &imgid, (void **)&img);
/* Init the time source */
efi_time_init();
@@ -648,7 +648,7 @@ main(int argc, CHAR16 *argv[])
efi_free_devpath_name(text);
}
- status = BS->HandleProtocol(img->DeviceHandle, &devid,
+ status = OpenProtocolByHandle(img->DeviceHandle, &devid,
(void **)&imgpath);
if (status == EFI_SUCCESS) {
text = efi_devpath_name(imgpath);
@@ -1066,7 +1066,7 @@ command_chain(int argc, char *argv[])
command_errmsg = "LoadImage failed";
return (CMD_ERROR);
}
- status = BS->HandleProtocol(loaderhandle, &LoadedImageGUID,
+ status = OpenProtocolByHandle(loaderhandle, &LoadedImageGUID,
(void **)&loaded_image);
if (argc > 2) {