From patchwork Tue Jan 15 02:55:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 155612 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4389891jaa; Mon, 14 Jan 2019 19:03:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN6J3Z6ui/hDMiFoUvd9hOX8cD2RffUGjcO/x8ZN2oyQ/RXwBqst2sxJiI9lelXplkTBXEdj X-Received: by 2002:a17:906:2496:: with SMTP id e22-v6mr1478663ejb.84.1547521417891; Mon, 14 Jan 2019 19:03:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547521417; cv=none; d=google.com; s=arc-20160816; b=vo8TMnGaa/3dKSIAJj8HOHYOZLxL19rT6ZVl+rEdL/e8DptwalZlP6taSAD0nFia4G 2BNyPaLrNCQ3QOdnLIcpH2e/5wNMZ1H4p8TiH54Df1Fs1EnZc6IPGHK1HE4rPub19N1K fuXDYepBas8ZQjQCmjCKan1dP/4PgV1xFutWMwx5BR4Qf9iqv1K2ZjZxurWYNXjKxbJH C4iA1NkK7sfmBNjd06rFw425+gi3E/3j8paZ+Sl9wQb+x5VIoc9thz/ml6lvUhUonBb0 HwsPLkO4HRpbxlDf50LrzLqvw4pIhl30CD37QhpXQ/qfspd8PNOITW/SrWpMtbof6SXc aM1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature; bh=FCMCzAiE/FPmJolytYslF88wlt9Nn7E3C7CEVrvNGqQ=; b=vY06VqtwRFv8JcErck5wLbgbWhF7J+vs8IcE/OkhRtJEUGBDo1uy+C0cJCwbvFPY72 W06U9YvDEZjR4XAYEf6JQlN34LjyZSASLT4ukfKX4x+mSCWdDNOrMytAjoU4XWZbjPm5 hekpwLEyGHtfjClA1X3+KzSLReZzyy5QwvqwJyG/k3QFqcCAHIl9ieZ2w4iJ7QQOOWRQ YIucURXlbgKXC38/MISWR7tDTPLhCUTcgOZGfMg8ZhKPY7bxfVMNixpD/vjzEdNb6Vqj sDVjkLhD07pex/irLuqnFTuwA6wKyZ0h3qfd6QO5qOCjp/zeIVKP1LkfJ5f+uS1n0YAp BcxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cLM5VQ9N; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id j6si3494195edc.361.2019.01.14.19.03.37; Mon, 14 Jan 2019 19:03:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cLM5VQ9N; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 694F6C21FA0; Tue, 15 Jan 2019 02:59:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3D1BAC2204C; Tue, 15 Jan 2019 02:59:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 845EEC21FFB; Tue, 15 Jan 2019 02:55:51 +0000 (UTC) Received: from mail-yb1-f194.google.com (mail-yb1-f194.google.com [209.85.219.194]) by lists.denx.de (Postfix) with ESMTPS id E4CCBC21FAB for ; Tue, 15 Jan 2019 02:55:47 +0000 (UTC) Received: by mail-yb1-f194.google.com with SMTP id a190so505062ybg.3 for ; Mon, 14 Jan 2019 18:55:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AkbJ7l/IyXRxN1cyxLJFrXymTDngN3+cO9Tifsb09s8=; b=cLM5VQ9NnsMPg1VdQxshrZKuHC6CVLHK/hLshbe519tFCyVHHTsgw0PVBNsFZg6Ay5 fMFtj5tIoPz0PQus1nDEfHyTDTwU8Y1SCPJ4AFqUKdKuMMyOfq6BAjikybXg5btqtUVr auTut2hEzYhvvDM8e/GpL8dLBn+9cO1Nm7+fQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AkbJ7l/IyXRxN1cyxLJFrXymTDngN3+cO9Tifsb09s8=; b=Y/8tcFTcKoHN6frjST8GmujwyXEQ7o5Wj88nmuLsI7wKai0A8lKStK72Z+A2sNk0+p ThCl1fO0Op0y7CId3pF8UFp3JOLc2oIfuSFGW/SoUxRMhUtcDoUnTN13mlrXh23DfGiG KseA3sjyWdolw10fUdJ02dg0T2Ub1CkK4t4W0SW9OovFeZz7seiI4BuorT4HLuYfncIH lIG1L0fwhSR4zq74GANkp5qj46sG2IMdu5+Wym3wmTAjv5EFXXkN/g6yl/q7+KvwiM1U eneazhj6DxoZ2BTu6/+9DsCx8tcLcZ8Y4eYzeJ75W171sWQDPWjeuWfnUFOWaiorVlUZ 9MPg== X-Gm-Message-State: AJcUukdUqEqJuid+Y5ViyNaqLnRi6JWzBhQ1y1gd1HedCXQnu/NEedR4 jM5bfXO18pvhJNA1Ce91zsX/Mw== X-Received: by 2002:a25:5e03:: with SMTP id s3mr1253397ybb.8.1547520946867; Mon, 14 Jan 2019 18:55:46 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id z186sm1384540ywd.107.2019.01.14.18.55.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 18:55:46 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de, xypron.glpk@gmx.de Date: Tue, 15 Jan 2019 11:55:18 +0900 Message-Id: <20190115025522.12060-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190115025522.12060-1-takahiro.akashi@linaro.org> References: <20190115025522.12060-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v4 5/9] cmd: efitool: add dh command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" "dh" command prints all the uefi handles used in the system. => efi dh 7ef3bfa0: Device Path, Device Path To Text, Device Path Utilities, Unicode Collation 2 7ef31d30: Driver Binding 7ef31da0: Simple Text Output 7ef31e10: Simple Text Input, Simple Text Input Ex 7ef3cca0: Block IO, Device Path 7ef3d070: Block IO, Device Path 7ef3d1b0: Block IO, Device Path, Simple File System 7ef3d3e0: Block IO, Device Path, Simple File System Signed-off-by: AKASHI Takahiro --- cmd/efitool.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/cmd/efitool.c b/cmd/efitool.c index 4d46721fbf91..4bd6367b4bd9 100644 --- a/cmd/efitool.c +++ b/cmd/efitool.c @@ -436,6 +436,103 @@ static int do_efi_show_drivers(int argc, char * const argv[]) return CMD_RET_SUCCESS; } +static struct { + u16 *name; + efi_guid_t guid; +} guid_list[] = { + { + L"Device Path", + DEVICE_PATH_GUID, + }, + { + L"Device Path To Text", + EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID, + }, + { + L"Device Path Utilities", + EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID, + }, + { + L"Unicode Collation 2", + EFI_UNICODE_COLLATION_PROTOCOL2_GUID, + }, + { + L"Driver Binding", + EFI_DRIVER_BINDING_PROTOCOL_GUID, + }, + { + L"Simple Text Input", + EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID, + }, + { + L"Simple Text Input Ex", + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID, + }, + { + L"Simple Text Output", + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID, + }, + { + L"Block IO", + BLOCK_IO_GUID, + }, + { + L"Simple File System", + EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID, + }, + { + NULL, + {{0,},}, + }, +}; + +static int do_efi_show_handles(int argc, char * const argv[]) +{ + efi_handle_t *handles; + efi_guid_t **guid; + efi_uintn_t count; + int num, i, j, k; + efi_status_t ret; + + handles = NULL; + num = 0; + if (efi_get_handles_by_proto(NULL, &handles, &num)) + return CMD_RET_FAILURE; + + if (!num) + return CMD_RET_SUCCESS; + + for (i = 0; i < num; i++) { + printf("%16p:", handles[i]); + ret = BS->protocols_per_handle(handles[i], &guid, &count); + if (ret || !count) { + putc('\n'); + continue; + } + + for (j = 0; j < count; j++) { + for (k = 0; guid_list[k].name; k++) + if (!guidcmp(&guid_list[k].guid, guid[j])) + break; + + if (j) + printf(", "); + else + putc(' '); + + if (guid[j]) + printf("%ls", guid_list[k].name); + else + printf("%pUl", guid[j]); + } + putc('\n'); + } + + free(handles); + + return CMD_RET_SUCCESS; +} + static int do_efi_boot_add(int argc, char * const argv[]) { int id; @@ -847,6 +944,8 @@ static int do_efitool(cmd_tbl_t *cmdtp, int flag, return do_efi_show_devices(argc, argv); else if (!strcmp(command, "drivers")) return do_efi_show_drivers(argc, argv); + else if (!strcmp(command, "dh")) + return do_efi_show_handles(argc, argv); else return CMD_RET_USAGE; } @@ -875,7 +974,9 @@ static char efitool_help_text[] = "efitool devices\n" " - show uefi devices\n" "efitool drivers\n" - " - show uefi drivers\n"; + " - show uefi drivers\n" + "efitool dh\n" + " - show uefi handles\n"; #endif U_BOOT_CMD(