From owner-svn-src-head@freebsd.org Tue Aug 6 19:27:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B1B4C8EE8; Tue, 6 Aug 2019 19:27:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4634Qn2z5Dz4N28; Tue, 6 Aug 2019 19:27:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 479F0B34; Tue, 6 Aug 2019 19:27:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x76JRTZX022876; Tue, 6 Aug 2019 19:27:29 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x76JRRrn022866; Tue, 6 Aug 2019 19:27:27 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201908061927.x76JRRrn022866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 6 Aug 2019 19:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350654 - in head/stand/efi: boot1 gptboot libefi loader X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/stand/efi: boot1 gptboot libefi loader X-SVN-Commit-Revision: 350654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 19:27:29 -0000 Author: tsoome Date: Tue Aug 6 19:27:27 2019 New Revision: 350654 URL: https://svnweb.freebsd.org/changeset/base/350654 Log: loader.efi: replace HandleProtocol() with OpenProtocol() The HandleProtocol() is deprecated interface and we should use OpenProtocol() instead. Moreover, in some firmware implementation(s), the HandleProtocol() does return device path using static storage, so we can not keep the value returned there. With same firmware, the OpenProtocol() does return data we do not need to clone. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D21162 Modified: head/stand/efi/boot1/proto.c head/stand/efi/gptboot/proto.c head/stand/efi/libefi/devpath.c head/stand/efi/libefi/efinet.c head/stand/efi/libefi/efipart.c head/stand/efi/loader/efi_main.c head/stand/efi/loader/framebuffer.c head/stand/efi/loader/main.c Modified: head/stand/efi/boot1/proto.c ============================================================================== --- head/stand/efi/boot1/proto.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/boot1/proto.c Tue Aug 6 19:27:27 2019 (r350654) @@ -61,7 +61,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) int preferred; /* Figure out if we're dealing with an actual partition. */ - status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = OpenProtocolByHandle(h, &DevicePathGUID, (void **)&devpath); if (status == EFI_UNSUPPORTED) return (0); @@ -77,7 +77,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) efi_free_devpath_name(text); } #endif - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (0); Modified: head/stand/efi/gptboot/proto.c ============================================================================== --- head/stand/efi/gptboot/proto.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/gptboot/proto.c Tue Aug 6 19:27:27 2019 (r350654) @@ -146,7 +146,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) EFI_STATUS status; /* Figure out if we're dealing with an actual partition. */ - status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = OpenProtocolByHandle(h, &DevicePathGUID, (void **)&devpath); if (status != EFI_SUCCESS) return; #ifdef EFI_DEBUG @@ -169,7 +169,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) return; } } - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status != EFI_SUCCESS) { DPRINTF("Can't get the block I/O protocol block\n"); return; Modified: head/stand/efi/libefi/devpath.c ============================================================================== --- head/stand/efi/libefi/devpath.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/libefi/devpath.c Tue Aug 6 19:27:27 2019 (r350654) @@ -44,8 +44,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); @@ -57,7 +57,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); Modified: head/stand/efi/libefi/efinet.c ============================================================================== --- head/stand/efi/libefi/efinet.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/libefi/efinet.c Tue Aug 6 19:27:27 2019 (r350654) @@ -286,7 +286,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)); Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/libefi/efipart.c Tue Aug 6 19:27:27 2019 (r350654) @@ -297,8 +297,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); @@ -439,8 +439,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; /* @@ -691,8 +691,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; @@ -779,7 +779,7 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t 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: @@ -862,7 +862,7 @@ efipart_open(struct open_file *f, ...) return (EIO); 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)); Modified: head/stand/efi/loader/efi_main.c ============================================================================== --- head/stand/efi/loader/efi_main.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/loader/efi_main.c Tue Aug 6 19:27:27 2019 (r350654) @@ -103,7 +103,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *sy /* 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); Modified: head/stand/efi/loader/framebuffer.c ============================================================================== --- head/stand/efi/loader/framebuffer.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/loader/framebuffer.c Tue Aug 6 19:27:27 2019 (r350654) @@ -244,7 +244,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); Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Tue Aug 6 18:28:44 2019 (r350653) +++ head/stand/efi/loader/main.c Tue Aug 6 19:27:27 2019 (r350654) @@ -128,7 +128,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; @@ -864,7 +864,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**)&boot_img); + (void) OpenProtocolByHandle(IH, &imgid, (void **)&boot_img); /* * Chicken-and-egg problem; we want to have console output early, but @@ -1004,7 +1004,8 @@ main(int argc, CHAR16 *argv[]) efi_free_devpath_name(text); } - rv = BS->HandleProtocol(boot_img->DeviceHandle, &devid, (void **)&imgpath); + rv = OpenProtocolByHandle(boot_img->DeviceHandle, &devid, + (void **)&imgpath); if (rv == EFI_SUCCESS) { text = efi_devpath_name(imgpath); if (text != NULL) { @@ -1464,7 +1465,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) {