From patchwork Tue Dec 18 05:05:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 154060 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3281208ljp; Mon, 17 Dec 2018 21:06:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/VY+mXEAa2P7zecs3cJPzb8Kz4TK9aB350S5VT7cW3YOKOJWIQNO9+okzVbN50CB4tyVt// X-Received: by 2002:a17:906:914:: with SMTP id i20-v6mr12078906ejd.225.1545109572216; Mon, 17 Dec 2018 21:06:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545109572; cv=none; d=google.com; s=arc-20160816; b=V0ACGNSwyAPFRvNqMDjoyajgAybkr2tYdZgb+/tzz2y0W2lffukzofcpiVZNYP6ltz nt51cPtgv6Xq/NRgg+d0NXKqPwzEEWrn0jY3ACs67hg3JZ1SKSqlGkKUzHmpJ/JdF937 9lcPnCYfbGcHO0R4AEg9p40WeDlEVHSwYdWvjSlDckBhRrW/rC6DE5yRdCqhzMOIOnhv 8YNXqAlz1D9WKdlzIZ8eWlyhmD5l6so6q9N0BQFjVxzM4uNQHWGuzOZ/RRgPCxNpg156 0QpG6GMxlCHnM97ZDot40uSLO9C7O1T/Y4MpQrfJecRS0uTOVeqmNnOvk02fTFyWHDXj 4y2Q== 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=tVTsfjgdpDLFLJi7IQ7ZLdrPbymEGUTj9b1TJgT4lzE=; b=hObLOF3keZH5QtrKFZIRgyNczwI2gbTuK+9VHeNCoa/5WF89IfndM66t+SPB/CbCz2 AaLUrxcpq0kah0q1Gqi7VNjlEF30SGfqpepqRt17fm8/4M41rMRa5OAUMjpui5lh7jiE XLpOWT6yPbt1VSdhuvX18iWNcx/zP6PaoOUP9Z9nZSlqsTVCZpQSvJMrolMhiPDRoRLj 7v8yqF+pWqmr9GKAp32LZvCNkQwPhljvZ9IZez9BgSliRBcQkixx5Zv87CzsCsFIeA8q Hy0NYX2xZsncWRonUCoFaJM6avQ4jqlmx5y3h4ss92E8/BqZtJ9Dk5bpxF+rrwZ4rZmV wQWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QfV2xhzP; 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 ka19-v6si1809410ejb.98.2018.12.17.21.06.11; Mon, 17 Dec 2018 21:06:12 -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=QfV2xhzP; 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 A96B4C21F79; Tue, 18 Dec 2018 05:03:16 +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, 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 16FB2C2206B; Tue, 18 Dec 2018 05:03:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C6685C21FBA; Tue, 18 Dec 2018 05:02:05 +0000 (UTC) Received: from mail-yb1-f195.google.com (mail-yb1-f195.google.com [209.85.219.195]) by lists.denx.de (Postfix) with ESMTPS id 11068C21FC0 for ; Tue, 18 Dec 2018 05:02:05 +0000 (UTC) Received: by mail-yb1-f195.google.com with SMTP id d136so5997314ybh.10 for ; Mon, 17 Dec 2018 21:02:05 -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=SGFLaY1hecvNqSZUHx5jgk03n+6RC/Tuf+Uu7ARQWuo=; b=QfV2xhzPWDu0JKzMIQJwFzW+MaTV3b4IgVfIIR3xUUIH9KuwIE4ZJdO+7H5y48oebv UXggU6G70M8rT8clOWREieTKLJ/fRgUxaQD5HP0noZUexYygEvF6HsQ3K8IJVijOQ7/2 35lQzVcZSekhoK93W9S0KdWdlO4YEyQa3K8Ag= 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=SGFLaY1hecvNqSZUHx5jgk03n+6RC/Tuf+Uu7ARQWuo=; b=Gp9aQkWWeqzmFsisbskuIFePO/i+vitl5BG062zo6S8nfFqenfhCbUt0vzug/44Xxi ofc0nKGzNbxODW4EcrDazbWPqITN8RGJkzIq7FOz3sq5REUtfssq/rrIHA1q4ZVjOgHc L43RWkSMtE6CnsQbo4ldkxGeEk9vs+jT9U0TOYzqIGoGi3OU1ifZgFIETqep4FP7dfQ7 sZmqI3totBS2hdYc0TT+sjA3Eq/X6GHmDOMvAjnr+Bkxsl5MDN/2C7gQ7JMQLvp0l1/r tJf4SJbKZ5lPwhOp3C9r9kuVsHjZFZrfdo+w1x0lSs8Zx5MNhmbC3BwOUjqTmJYxABDw /g8g== X-Gm-Message-State: AA+aEWYJYTDGMe1xFyOE09mJCRiueXE2+h9685SA8nIKAzgQMX2lv1Bc p/i6pJHTm+LTvCsG+5ncMJ+/Dw== X-Received: by 2002:a25:12d4:: with SMTP id 203mr16531985ybs.394.1545109324045; Mon, 17 Dec 2018 21:02:04 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id n16sm5084208ywn.31.2018.12.17.21.02.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Dec 2018 21:02:03 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de, xypron.glpk@gmx.de Date: Tue, 18 Dec 2018 14:05:08 +0900 Message-Id: <20181218050510.20308-7-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181218050510.20308-1-takahiro.akashi@linaro.org> References: <20181218050510.20308-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v3 6/8] 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 5a81a627d616..47ad77606062 100644 --- a/cmd/efishell.c +++ b/cmd/efishell.c @@ -511,6 +511,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(