From patchwork Mon Nov 5 09:06:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 150162 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2359476ljp; Mon, 5 Nov 2018 01:12:44 -0800 (PST) X-Google-Smtp-Source: AJdET5d09edogEn1rtQ5YKJPt7X7PsJCXxYpuSJJdQkRnaNAAihXlVhCxWRkCOxGbNDk1djqHKhc X-Received: by 2002:a17:906:4f98:: with SMTP id o24-v6mr13641656eju.237.1541409164249; Mon, 05 Nov 2018 01:12:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541409164; cv=none; d=google.com; s=arc-20160816; b=vC+Vnen26jFzb2g6mWclg6RCWADo4PyXp/sjCW6rjeDrcmiWxKYPLEkDz7kruJp9Gt UL/xfT3s/WXXgoEyFUbKlovIkVl24fV4+O9hIlaWApxz69WBHngK1DXabZ6qz4JkT3cx SuPPKf4PDYYjdj8mt5EEMgiE/0zGAstIAw2ywfjtJJPtUbYVTyf0es1lTbdUckGnoQGb OIYozjGJHmxBV/NjTc0zPXa7lw3xuNYRURchS0fEPMWDBcJXpU+LsCMbx8dMkOCeqDbG 8ruERHEkZiN9S3ZpUgfUcvDwlF+oDryvYZS6el/v0TAY4TayxiRJnAUBECK14FWLWjJO MOKQ== 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=UmpC6m/736Cj/ZE4/XaKVGXh3lQhcoxmVD8yI01tYVs=; b=gM7HhDnoUSyVbaGpHDwaDLa6q+yTEPggHF+GAyRFOHAHdpQtKQhN08sloPbIyqIOFX PG7es13ztzu05vuZmPTN1tDxJMQBMcm2G0efPpJ0881TncAe/DsiOcy29fIgK5x2VwZt nXi1YUI/Q3MMRRtdae2okQD1I4Vm+Z4MHii4/DAy+YiUSLFcT8CQSyWI9Enr+Wv7lf98 etJ8T9Si8e31ckRZHaai6OjIWR8bSt1N2U+jSvbPhUtSE65/88KJKRNTzKBIRqM6CIlk AlTipeVxAe8q8WerU3v5kKFmHqGnvqlGVgXxOuQGTpNeTe2n01lTffgU+cpAWOF8h/kb FjbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gsulonIb; 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 t48-v6si6344492edb.83.2018.11.05.01.12.43; Mon, 05 Nov 2018 01:12:44 -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=gsulonIb; 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 D6C24C22235; Mon, 5 Nov 2018 09:08:20 +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_MSPIKE_H2, 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 BC1E1C2222E; Mon, 5 Nov 2018 09:07:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CD87DC221F2; Mon, 5 Nov 2018 09:05:14 +0000 (UTC) Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by lists.denx.de (Postfix) with ESMTPS id 6F8F6C22201 for ; Mon, 5 Nov 2018 09:05:10 +0000 (UTC) Received: by mail-yb1-f173.google.com with SMTP id j9-v6so3472434ybj.6 for ; Mon, 05 Nov 2018 01:05:10 -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=nO3AJ1eN87t5k0Jfw5vlPH1ejIZPbgz5i8DPK6kv9O8=; b=gsulonIbZx5LakPQmtHPoyO0J9y+EhiJYSx4iGse/qpa1TR4ISHBZzXXZB65u+EwEu GW4OMAfgGQ+4G1RhyVk23ljcWn5Re+7nohcjU+0nWaf4dItCSTNmpQ7Vz1PSrSR+7ebW jofaKE8+ik5kOiwH9JG4aXqNiI9VBTX02pELg= 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=nO3AJ1eN87t5k0Jfw5vlPH1ejIZPbgz5i8DPK6kv9O8=; b=TrkqvEEZG9d+tke+rJdFzjm44jAQL9n8tef7fTVejh6vU4Mr5ikjcJq7Al7PvMbBK0 YhWsG8tbpC+1B7PthJVNc9klARB7T/gmmA7ROzK1ikc+l8VmwjJDLS+Q1zMzKG6hfBHC 6kn3UA9ofmhzwqBTLT1r0qoJDQ0rA2NasUUdYf+lIF9nahiBjs6hz/B+fQDo8OS2L6TH y0mJ4s307Iv+7qanUB7pt1DyUi7FNdRNDGWo53TgWCSDOBwWVlamIpn5qmeryJoM18MM UkAA9lseRTJ4BcZxQRnI2Bo4PbMa+HFuHkVzzjm5T+pnflKIOXICBY4ChXBWrdOH9TgI p02A== X-Gm-Message-State: AGRZ1gIQ9WgyDMgEdaouWo7jLGRGNfRAK1sXxCzUpiOkBtvVuI6tiep7 EERUAk5p8vLKLgtlstu81oFaOg== X-Received: by 2002:a25:f50d:: with SMTP id a13-v6mr14753476ybe.56.1541408709288; Mon, 05 Nov 2018 01:05:09 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id a189-v6sm10806292ywf.49.2018.11.05.01.05.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 01:05:08 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de Date: Mon, 5 Nov 2018 18:06:48 +0900 Message-Id: <20181105090653.7409-10-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181105090653.7409-1-takahiro.akashi@linaro.org> References: <20181105090653.7409-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: xypron.glpk@gmx.de, u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 09/14] cmd: efishell: 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. => efishell dh (T.B.D.) 0: (protocol info not available) 1: (protocol info not available) 2: (protocol info not available) 3: (protocol info not available) 4: (protocol info not available) 5: (protocol info not available) 6: (protocol info not available) 7: (protocol info not available) 8: (protocol info not available) 9: (protocol info not available) 10: (protocol info not available) 11: (protocol info not available) 12: (protocol info not available) 13: (protocol info not available) 14: (protocol info not available) 15: (protocol info not available) Signed-off-by: AKASHI Takahiro --- cmd/efishell.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/cmd/efishell.c b/cmd/efishell.c index 3e1118a407ff..bd2b99e74079 100644 --- a/cmd/efishell.c +++ b/cmd/efishell.c @@ -514,6 +514,33 @@ static int do_efi_show_memmap(int argc, char * const argv[]) return CMD_RET_SUCCESS; } +static char *efi_get_proto_info(efi_handle_t handle) +{ + return strdup("(protocol info not available)"); +} + +static int do_efi_show_handles(int argc, char * const argv[]) +{ + efi_handle_t *handles = NULL, *handle; + char *info; + int i; + + handles = efi_get_handles_by_proto(NULL); + if (!handles) + return CMD_RET_SUCCESS; + + for (handle = handles, i = 0; *handle; handle++, i++) { + /* TODO: depends on protocols */ + info = efi_get_proto_info(*handle); + printf("%d: %s\n", i, info ?: ""); + free(info); + } + + free(handles); + + return CMD_RET_SUCCESS; +} + static int do_efi_boot_add(int argc, char * const argv[]) { int id; @@ -900,6 +927,8 @@ static int do_efishell(cmd_tbl_t *cmdtp, int flag, return do_efi_show_images(argc, argv); else if (!strcmp(command, "memmap")) return do_efi_show_memmap(argc, argv); + else if (!strcmp(command, "dh")) + return do_efi_show_handles(argc, argv); else return CMD_RET_USAGE; } @@ -929,7 +958,9 @@ static char efishell_help_text[] = "efishell images\n" " - show loaded images\n" "efishell memmap\n" - " - show uefi memory map\n"; + " - show uefi memory map\n" + "efishell dh\n" + " - show uefi handles\n"; #endif U_BOOT_CMD(