From nobody Tue Nov 16 09:12:25 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3A7BC18918BC; Tue, 16 Nov 2021 09:12:26 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HtgLf19V4z3ND9; Tue, 16 Nov 2021 09:12:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0963127E3; Tue, 16 Nov 2021 09:12:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AG9CP6k043970; Tue, 16 Nov 2021 09:12:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AG9CPSQ043969; Tue, 16 Nov 2021 09:12:25 GMT (envelope-from git) Date: Tue, 16 Nov 2021 09:12:25 GMT Message-Id: <202111160912.1AG9CPSQ043969@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 2e0d67c3ed7e - main - loader: lsefi: Print more information List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2e0d67c3ed7ec760b2d54f8258304b2e6359418b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=2e0d67c3ed7ec760b2d54f8258304b2e6359418b commit 2e0d67c3ed7ec760b2d54f8258304b2e6359418b Author: Emmanuel Vadot AuthorDate: 2021-11-15 11:12:50 +0000 Commit: Emmanuel Vadot CommitDate: 2021-11-16 09:11:53 +0000 loader: lsefi: Print more information Printing the EFI_HANDLE pointer isn't very useful. If the handle have a IMAGE_DEVICE_PATH or a DEVICE_PATH protocol print it. This makes it easier to see which devices are present and what protocol they expose. Reviewed by: imp, tsoome Differential Revision: https://reviews.freebsd.org/D32991 Sponsored by: Beckhoff Automation GmbH & Co. KG --- stand/efi/loader/main.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index d8b3b1d19b15..73936d870771 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -1402,6 +1402,30 @@ command_mode(int argc, char *argv[]) COMMAND_SET(lsefi, "lsefi", "list EFI handles", command_lsefi); +static void +lsefi_print_handle_info(EFI_HANDLE handle) +{ + EFI_DEVICE_PATH *devpath; + EFI_DEVICE_PATH *imagepath; + CHAR16 *dp_name; + + imagepath = efi_lookup_image_devpath(handle); + if (imagepath != NULL) { + dp_name = efi_devpath_name(imagepath); + printf("Handle for image %S", dp_name); + efi_free_devpath_name(dp_name); + return; + } + devpath = efi_lookup_devpath(handle); + if (devpath != NULL) { + dp_name = efi_devpath_name(devpath); + printf("Handle for device %S", dp_name); + efi_free_devpath_name(dp_name); + return; + } + printf("Handle %p", handle); +} + static int command_lsefi(int argc __unused, char *argv[] __unused) { @@ -1437,7 +1461,7 @@ command_lsefi(int argc __unused, char *argv[] __unused) EFI_GUID **protocols = NULL; handle = buffer[i]; - printf("Handle %p", handle); + lsefi_print_handle_info(handle); if (pager_output("\n")) break; /* device path */