From patchwork Sun Sep 20 15:49:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1367912 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=oAFjh2BU; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BvX801ryvz9sTH for ; Mon, 21 Sep 2020 01:49:51 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C4354824D3; Sun, 20 Sep 2020 17:49:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="oAFjh2BU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5445D824AA; Sun, 20 Sep 2020 17:49:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B4EE18248E for ; Sun, 20 Sep 2020 17:49:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x244.google.com with SMTP id z26so13936024oih.12 for ; Sun, 20 Sep 2020 08:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4h8emVghl6vDoksEQdXuanfCQ6aEf1SdEIgDCUZBqCs=; b=oAFjh2BUi0RvbcXnL4g8Rh/xwvNmtlAmT+MfN8FK20JTw1PgbbavacPxc9KAs0iRHx MwOWcECWXe4339kKGyiGuIVnioASD/2DsVFvNYFMyHHEUaToK3OdUcCq/jpkuNqJeHeB s/yPAkRRbUnrshvG0exwSwxRkD9+mO8VdkG1Q= 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=4h8emVghl6vDoksEQdXuanfCQ6aEf1SdEIgDCUZBqCs=; b=CcV469tyRcaYLogz4JXHufdeDpnPfOt7U2QkABAdEDZOn70yXfEPEz1WeJOhos4vxe MJ3+0Y6xoSf5/zkl8DzcJx9M61nk4Atgq7zzF68K+IpHSGcc5SyYB/NBSxdVhrH+hzaj ptqvFPe42qPKfdXtOz/aY3MZHhRB7gyT/B9BS5+13psdDiH/Mpt259JKG2uW25yiD7ZE 35QjOfxUsYn6LTNdEplUocp8RanV4O32TaZOBs9bDuzucvRoj0+DSoGPzykAVQFY9SSL kN8xUGDfmamlMB4kDiGLocVeBqxeWqn5PY/jy64lb9qCN93//p90klzgAV2LwiH2ineP m7IQ== X-Gm-Message-State: AOAM5313MThX5HUvelGYfBbdKusMyEMI3X+nAfeFBYIheEAw/ZswtEfz mNfgaG3nWwVUCWlx6CGBJ5zLeeICk6Dl23Qz X-Google-Smtp-Source: ABdhPJwn/laUkxVM4c5wXThT3dChWqn+y9DEpLVd1Lq7hDEkLeMIb9Efvvpzn/dPArdd1cw3rIB0lA== X-Received: by 2002:a54:4619:: with SMTP id p25mr14526887oip.18.1600616964350; Sun, 20 Sep 2020 08:49:24 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id d1sm5500682otb.80.2020.09.20.08.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 08:49:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Bernhard Messerklinger , Wolfgang Wallner , Walter Lozano , Simon Glass , Bin Meng Subject: [PATCH 1/5] x86: hob: Add way to show a single hob entry Date: Sun, 20 Sep 2020 09:49:15 -0600 Message-Id: <20200920094914.1.Ib7d728dbb54312205dd9895f619db71d7af61fd2@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog In-Reply-To: <20200920154919.2275229-1-sjg@chromium.org> References: <20200920154919.2275229-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The 'hob' command currently lists all HOB entries. Add way to list a single entry, by index. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/x86/hob.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c index 6b1f7bda5b8..e3f512beee8 100644 --- a/cmd/x86/hob.c +++ b/cmd/x86/hob.c @@ -34,7 +34,12 @@ static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) int i = 0; efi_guid_t *guid; char uuid[UUID_STR_LEN + 1]; + int seq = -1; /* Show all by default */ + argc--; + argv++; + if (argc) + seq = simple_strtol(*argv, NULL, 16); hdr = gd->arch.hob_list; printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr); @@ -43,7 +48,9 @@ static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) printf("%36s\n", "GUID"); printf("---|----------|-----------|------|-"); printf("------------------------------------\n"); - while (!end_of_hob(hdr)) { + for (i = 0; !end_of_hob(hdr); i++, hdr = get_next_hob(hdr)) { + if (seq != -1 && seq != i) + continue; printf("%02x | %08x | ", i, (unsigned int)hdr); type = hdr->type; if (type == HOB_TYPE_UNUSED) @@ -65,14 +72,13 @@ static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) printf("%36s", "Not Available"); } printf("\n"); - hdr = get_next_hob(hdr); - i++; } return 0; } -U_BOOT_CMD(hob, 1, 1, do_hob, - "Print Hand-Off Block (HOB) information", +U_BOOT_CMD(hob, 2, 1, do_hob, + "[seq] Print Hand-Off Block (HOB) information" + " seq - Record # to show (all by default)", "" ); From patchwork Sun Sep 20 15:49:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1367911 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=lRZgenjL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BvX800xQkz9sSW for ; Mon, 21 Sep 2020 01:49:51 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3475D8248F; Sun, 20 Sep 2020 17:49:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="lRZgenjL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 49A218248F; Sun, 20 Sep 2020 17:49:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D802B824A5 for ; Sun, 20 Sep 2020 17:49:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x343.google.com with SMTP id h17so10169064otr.1 for ; Sun, 20 Sep 2020 08:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xSpsUQu/yOZsRpA7h/BV317yeE0KC2S3IMtHSJdF45M=; b=lRZgenjLa+U6oUfWBSJ4BRbL/61S3IsjibdvdfDKkrFTFN94ydc0FQF/mdJLe5qllF lZ7/qlrzBkpZWjeqm0oYXpKk/fB5jM2IE99xDOOYkkuNXl5067F3c4tG6pqkHEzZSe9w jo9xeSOUpEEzkWHQSiBMAt5/ABOl0PIvyk+nU= 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=xSpsUQu/yOZsRpA7h/BV317yeE0KC2S3IMtHSJdF45M=; b=Xz9BCuOm9ISYi7oo35ogQi/+KUy1ko4SWesRTIYIN0WxyVWR0KIaa79TNJoHPUJd40 yXEHoto6Ch7Sg50h9NhNhTlPkWy+sjqCCQ2wFhCEhEGqNqOQEsqdjeJQ+KaIPm+6fiYS i+yw4rOX5Rgyloklf0OD53+m7kpDTHbqeBnzKOW5ouJBfY6Os6qWYqEVdDXL9i8zSzPI N0QCoU4IqKtPxrPoTrlQfIVNWWbjYwXgH2hnVuiCrp1hbA4kSe2bim5hm3+2WAESEcsm IG5pK0HztChS8bJZjoOuz/I60rueIBYNkkMNROhvZ/fdM2wLa7vUmjG7S6t65UJtpBWP foaA== X-Gm-Message-State: AOAM530KqY41DnmbBlYO6JAHWsmqs1Lk+ESvW/b20Sv1FENJg78rO1pV bezapab7xTTMU7OPyPEQKpJaUnAho+UQ/B5J X-Google-Smtp-Source: ABdhPJyNy1fD6d0T+5VsjBCJ2W+E6pk3djSDcXVLnVvcEJgskg5ExqRgWwSR5unHPwidBA7K2MiLaA== X-Received: by 2002:a05:6830:13d7:: with SMTP id e23mr29243331otq.98.1600616965364; Sun, 20 Sep 2020 08:49:25 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id d1sm5500682otb.80.2020.09.20.08.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 08:49:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Bernhard Messerklinger , Wolfgang Wallner , Walter Lozano , Simon Glass , Bin Meng Subject: [PATCH 2/5] x86: hob: Try to show a name instead of a GUID Date: Sun, 20 Sep 2020 09:49:16 -0600 Message-Id: <20200920094914.2.I9640ffcd641dd823d4796557c1323c59f27525d1@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog In-Reply-To: <20200920154919.2275229-1-sjg@chromium.org> References: <20200920154919.2275229-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean GUIDs are one of the seven evils of the computer world. They obfuscate the meaning and require people to look up long hex strings to decode it. Luckily only a miniscule fraction of the 10^38 possible GUIDs are in use. Add a way to decode the GUIDs known to U-Boot. Add a few more to the list for good measure. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/include/asm/fsp/fsp_hob.h | 25 +++++++++++++++++ cmd/x86/hob.c | 43 ++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/fsp/fsp_hob.h b/arch/x86/include/asm/fsp/fsp_hob.h index d248520e972..ea3983e04ff 100644 --- a/arch/x86/include/asm/fsp/fsp_hob.h +++ b/arch/x86/include/asm/fsp/fsp_hob.h @@ -99,4 +99,29 @@ struct __packed hob_graphics_info { EFI_GUID(0x39f62cce, 0x6825, 0x4669, \ 0xbb, 0x56, 0x54, 0x1a, 0xba, 0x75, 0x3a, 0x07) +/* The following GUIDs are observed with FSP 2.1 / Apollo Lake */ +#define FSP_HOB_RESOURCE_OWNER_SMM_PEI_SMRAM_GUID \ + EFI_GUID(0x6dadf1d1, 0xd4cc, 0x4910, \ + 0xbb, 0x6e, 0x82, 0xb1, 0xfd, 0x80, 0xff, 0x3d) + +#define FSP_HOB_RESOURCE_OWNER_PCD_DATABASE_GUID1 \ + EFI_GUID(0xea296d92, 0x0b69, 0x423c, \ + 0x8c, 0x28, 0x33, 0xb4, 0xe0, 0xa9, 0x12, 0x68) + +#define FSP_HOB_RESOURCE_OWNER_PCD_DATABASE_GUID2 \ + EFI_GUID(0x9b3ada4f, 0xae56, 0x4c24, \ + 0x8d, 0xea, 0xf0, 0x3b, 0x75, 0x58, 0xae, 0x50) + +#define FSP_HOB_RESOURCE_OWNER_PEIM_DXE_GUID \ + EFI_GUID(0x86d70125, 0xbaa3, 0x4296, \ + 0xa6, 0x2f, 0x60, 0x2b, 0xeb, 0xbb, 0x90, 0x81) + +#define FSP_HOB_RESOURCE_OWNER_ALLOC_STACK_GUID \ + EFI_GUID(0x4ed4bf27, 0x4092, 0x42e9, \ + 0x80, 0x7d, 0x52, 0x7b, 0x1d, 0x00, 0xc9, 0xbd) + +#define FSP_HOB_RESOURCE_OWNER_SMBIOS_MEMORY_GUID \ + EFI_GUID(0x01a1108c, 0x9dee, 0x4984, \ + 0x88, 0xc3, 0xee, 0xe8, 0xc4, 0x9e, 0xfb, 0x89) + #endif diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c index e3f512beee8..bbe38bbf20e 100644 --- a/cmd/x86/hob.c +++ b/cmd/x86/hob.c @@ -8,6 +8,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -26,6 +27,37 @@ static char *hob_type[] = { "Capsule", }; +static struct guid_name { + efi_guid_t guid; + const char *name; +} guid_name[] = { + { FSP_HOB_RESOURCE_OWNER_TSEG_GUID, "TSEG" }, + { FSP_HOB_RESOURCE_OWNER_FSP_GUID, "FSP" }, + { FSP_HOB_RESOURCE_OWNER_SMM_PEI_SMRAM_GUID, "SMM PEI SMRAM" }, + { FSP_NON_VOLATILE_STORAGE_HOB_GUID, "NVS" }, + { FSP_VARIABLE_NV_DATA_HOB_GUID, "Variable NVS" }, + { FSP_GRAPHICS_INFO_HOB_GUID, "Graphics info" }, + { FSP_HOB_RESOURCE_OWNER_PCD_DATABASE_GUID1, "PCD database ea" }, + { FSP_HOB_RESOURCE_OWNER_PCD_DATABASE_GUID2, "PCD database 93" }, + { FSP_HOB_RESOURCE_OWNER_PEIM_DXE_GUID, "PEIM Init DXE" }, + { FSP_HOB_RESOURCE_OWNER_ALLOC_STACK_GUID, "Alloc stack" }, + { FSP_HOB_RESOURCE_OWNER_SMBIOS_MEMORY_GUID, "SMBIOS memory" }, + { {}, "zero-guid" }, + {} +}; + +static const char *guid_to_name(const efi_guid_t *guid) +{ + struct guid_name *entry; + + for (entry = guid_name; entry->name; entry++) { + if (!guidcmp(guid, &entry->guid)) + return entry->name; + } + + return NULL; +} + static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { const struct hob_header *hdr; @@ -65,9 +97,16 @@ static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (type == HOB_TYPE_MEM_ALLOC || type == HOB_TYPE_RES_DESC || type == HOB_TYPE_GUID_EXT) { + const char *name; + guid = (efi_guid_t *)(hdr + 1); - uuid_bin_to_str(guid->b, uuid, UUID_STR_FORMAT_GUID); - printf("%s", uuid); + name = guid_to_name(guid); + if (!name) { + uuid_bin_to_str(guid->b, uuid, + UUID_STR_FORMAT_GUID); + name = uuid; + } + printf("%36s", name); } else { printf("%36s", "Not Available"); } From patchwork Sun Sep 20 15:49:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1367913 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ffA5qLmq; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BvX8B65XRz9sSW for ; Mon, 21 Sep 2020 01:50:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 25CD1823FC; Sun, 20 Sep 2020 17:49:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ffA5qLmq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C37E7824A5; Sun, 20 Sep 2020 17:49:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AE46982482 for ; Sun, 20 Sep 2020 17:49:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x241.google.com with SMTP id x14so13957726oic.9 for ; Sun, 20 Sep 2020 08:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NwauYeu0Yhi/VHzwNu9u4DJ5EL1cbknfgWLfsVVzByw=; b=ffA5qLmqRqUyIo55KUbPChjqTOuB+3rEsq0SC5dP2ZBTW5MVoKcc52ZMea8sIMeeM+ ci8jHjsq+eLt1oa6v6fuKb26OXakaS1fqMj+xTDQeI+Iy63GzxYM7hwDtAabHvH5hfKK X48/QpJDW6YclhOiHkBCxeFjSCmUTLl3BR3Dc= 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=NwauYeu0Yhi/VHzwNu9u4DJ5EL1cbknfgWLfsVVzByw=; b=PJPLlTZZR4/NPU/j8Rhxyl20HvidtB5F9YZ01ZfMYIdOTiw69cltbe9rVnBoZGUi92 oQXCCvQBwtWd8J6mpEBSlzJS+sG1X5kmH/KIFyohYP7VuO3iodkytmcKbGcI3/Lxy2rL xcl/K4kl6VP+qV/C/nLnbVQhUxi2w7B8G66iTxz93LeVmP8GUDZ8+THum6VXmLXtA1wP ddyc1rMGvz6w9nNNg66pUEFJGn+kp798u7byWcaZ2uppqhTTkqZBCfeOpYNYdyirFbtg l6rm4+1+4GaindpptEoxt8/UZIfCWyzIoYKeVEqBWULvcwLtxN26oz0ei14LhBuhhJNb yn0A== X-Gm-Message-State: AOAM5315trqQzf/+hYdM13sOeMNy9y1NeIQRBluv8rImHgvTTYnhCSZa lpxrngT/5DfNota4ho/U4ibvqyfwcFbzN14k X-Google-Smtp-Source: ABdhPJwlnpSq/Eggbybu4zIz+pSP+GB3IkA9ZiGt8vtUyopbUQw7jnY8K3xuxEf2a/9IUVYrnZW0Tw== X-Received: by 2002:a05:6808:5ca:: with SMTP id d10mr15317355oij.27.1600616966370; Sun, 20 Sep 2020 08:49:26 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id d1sm5500682otb.80.2020.09.20.08.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 08:49:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Bernhard Messerklinger , Wolfgang Wallner , Walter Lozano , Simon Glass , Bin Meng Subject: [PATCH 3/5] x86: Allow showing details about a HOB entry Date: Sun, 20 Sep 2020 09:49:17 -0600 Message-Id: <20200920094914.3.Ia5660394c5732506673bfe5de470c85746ea9cce@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog In-Reply-To: <20200920154919.2275229-1-sjg@chromium.org> References: <20200920154919.2275229-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Some HOBs include information that can be decoded. Add a -v option to the hob command, to allow this to be displayed. Add the ability to decode a resource descriptor. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/x86/hob.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c index bbe38bbf20e..2933bc08c76 100644 --- a/cmd/x86/hob.c +++ b/cmd/x86/hob.c @@ -27,6 +27,16 @@ static char *hob_type[] = { "Capsule", }; +static char *res_type[] = { + "system", + "Memory-mapped I/O", + "I/O", + "Firmware device", + "Memory-mapped I/O port", + "Reserved", + "I/O reserved", +}; + static struct guid_name { efi_guid_t guid; const char *name; @@ -58,6 +68,26 @@ static const char *guid_to_name(const efi_guid_t *guid) return NULL; } +static void show_hob_details(const struct hob_header *hdr) +{ + const void *ptr = hdr; + + switch (hdr->type) { + case HOB_TYPE_RES_DESC: { + const struct hob_res_desc *res = ptr; + const char *typename; + + typename = res->type > 0 && res->type <= RES_MAX_MEM_TYPE ? + res_type[res->type] : "unknown"; + + printf(" base = %08llx, len = %08llx, end = %08llx, type = %d (%s)\n\n", + res->phys_start, res->len, res->phys_start + res->len, + res->type, typename); + break; + } + } +} + static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { const struct hob_header *hdr; @@ -66,12 +96,20 @@ static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) int i = 0; efi_guid_t *guid; char uuid[UUID_STR_LEN + 1]; + bool verbose = false; int seq = -1; /* Show all by default */ argc--; argv++; - if (argc) - seq = simple_strtol(*argv, NULL, 16); + if (argc) { + if (!strcmp("-v", *argv)) { + verbose = true; + argc--; + argv++; + } + if (argc) + seq = simple_strtol(*argv, NULL, 16); + } hdr = gd->arch.hob_list; printf("HOB list address: 0x%08x\n\n", (unsigned int)hdr); @@ -111,13 +149,16 @@ static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) printf("%36s", "Not Available"); } printf("\n"); + if (verbose) + show_hob_details(hdr); } return 0; } -U_BOOT_CMD(hob, 2, 1, do_hob, - "[seq] Print Hand-Off Block (HOB) information" +U_BOOT_CMD(hob, 3, 1, do_hob, + "[-v] [seq] Print Hand-Off Block (HOB) information" + " -v - Show detailed HOB information where available" " seq - Record # to show (all by default)", "" ); From patchwork Sun Sep 20 15:49:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1367914 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=mq/S6HQI; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BvX8R11X4z9sTH for ; Mon, 21 Sep 2020 01:50:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1780F824E5; Sun, 20 Sep 2020 17:49:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="mq/S6HQI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AEA21824F8; Sun, 20 Sep 2020 17:49:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C1A008248E for ; Sun, 20 Sep 2020 17:49:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x341.google.com with SMTP id o6so10160167ota.2 for ; Sun, 20 Sep 2020 08:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4CHYzXJLvYFOP0KkiP+yhu9cXia1NwAbPu/ZWp6SqFw=; b=mq/S6HQIAzDAs+iwNI1cXw8FK3rMid6UU0VNQJpX+83Os4JpZKRoaDHq7zB7iFnA91 vaP38zxSefm0vtJc9lO8fT0dQPtiYF/P57h7W2AtSXiNA4VTbgPWkdddq3cmBEJpSGkU EKb72ttLT8o/mn9DfKCwS8MQ93V8RG/YIBWKI= 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=4CHYzXJLvYFOP0KkiP+yhu9cXia1NwAbPu/ZWp6SqFw=; b=PkadzpC9x+00pw9Eok1U8INuO/V3IOyE/fje//1Kf99+qPFS5oJHfm4CFPvlcPbON/ THjWOQnW4u/m+UvLOQhlH2D2YFiV8+Gn5IZ9kooMCj5ZiRe7pHb+xTp4nvDtoFoz++Vk g6an55bE/ZuaEDOWlFX+71ew8OHYhjnP+QK5ibFZvjuCqLayVmDk5PNTu3Yqlo39zFjJ pfRz4ypq0JaBNStrzZwAmumVWTnXXAnweWfRfV32RYjhrEfzJe2jlq3e93eXvrNgytMk FxuO1gsLf91fsGdhESfKuGkelIhQSZ2tu+4PEjV4TsfP4XWbCQDfrn48/xFdkc0qB4Ky 9H3Q== X-Gm-Message-State: AOAM532pH1DZX9Wk7OjefvaqHSv/JQ8l/DoWASXj+eyAL7VOEtdv0/O8 NQqPspDxUzu+xSlswp8gTUAWzaf+s7ukpKqK X-Google-Smtp-Source: ABdhPJwlwBkj08zBrmOUHQS7o1r8gzAcLvGMseB7P7eRB+jy5YkXbEG42LgYhi3dnEjrXmgh2dH6Tg== X-Received: by 2002:a9d:3bca:: with SMTP id k68mr26892322otc.150.1600616967398; Sun, 20 Sep 2020 08:49:27 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id d1sm5500682otb.80.2020.09.20.08.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 08:49:26 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Bernhard Messerklinger , Wolfgang Wallner , Walter Lozano , Simon Glass , Bin Meng Subject: [PATCH 4/5] x86: Add support for more than 8 MTRRs Date: Sun, 20 Sep 2020 09:49:18 -0600 Message-Id: <20200920094914.4.I99d6a7a832d5ea62412107a626f7e12a3c91af96@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog In-Reply-To: <20200920154919.2275229-1-sjg@chromium.org> References: <20200920154919.2275229-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean At present the mtrr command only support 8 MTRRs. Some SoCs have more than that. Update the implementation to support up to 10. Read the number of MTRRs dynamically instead. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/mtrr.c | 12 +++++++----- arch/x86/include/asm/mtrr.h | 15 ++++++++++++--- cmd/x86/mtrr.c | 9 +++++---- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c index 2468d88a80a..aed4c411367 100644 --- a/arch/x86/cpu/mtrr.c +++ b/arch/x86/cpu/mtrr.c @@ -66,9 +66,10 @@ static void set_var_mtrr(uint reg, uint type, uint64_t start, uint64_t size) void mtrr_read_all(struct mtrr_info *info) { + int reg_count = mtrr_get_var_count(); int i; - for (i = 0; i < MTRR_COUNT; i++) { + for (i = 0; i < reg_count; i++) { info->mtrr[i].base = native_read_msr(MTRR_PHYS_BASE_MSR(i)); info->mtrr[i].mask = native_read_msr(MTRR_PHYS_MASK_MSR(i)); } @@ -76,10 +77,11 @@ void mtrr_read_all(struct mtrr_info *info) void mtrr_write_all(struct mtrr_info *info) { + int reg_count = mtrr_get_var_count(); struct mtrr_state state; int i; - for (i = 0; i < MTRR_COUNT; i++) { + for (i = 0; i < reg_count; i++) { mtrr_open(&state, true); wrmsrl(MTRR_PHYS_BASE_MSR(i), info->mtrr[i].base); wrmsrl(MTRR_PHYS_MASK_MSR(i), info->mtrr[i].mask); @@ -144,7 +146,7 @@ int mtrr_commit(bool do_caches) /* Clear the ones that are unused */ debug("clear\n"); - for (; i < MTRR_COUNT; i++) + for (; i < MTRR_MAX_COUNT; i++) wrmsrl(MTRR_PHYS_MASK_MSR(i), 0); debug("close\n"); mtrr_close(&state, do_caches); @@ -184,7 +186,7 @@ int mtrr_add_request(int type, uint64_t start, uint64_t size) return 0; } -static int get_var_mtrr_count(void) +int mtrr_get_var_count(void) { return msr_read(MSR_MTRR_CAP_MSR).lo & MSR_MTRR_CAP_VCNT; } @@ -195,7 +197,7 @@ static int get_free_var_mtrr(void) int vcnt; int i; - vcnt = get_var_mtrr_count(); + vcnt = mtrr_get_var_count(); /* Identify the first var mtrr which is not valid */ for (i = 0; i < vcnt; i++) { diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h index 48db1dd82f7..3a98aacdef5 100644 --- a/arch/x86/include/asm/mtrr.h +++ b/arch/x86/include/asm/mtrr.h @@ -36,8 +36,8 @@ #define MTRR_BASE_TYPE_MASK 0x7 -/* Number of MTRRs supported */ -#define MTRR_COUNT 8 +/* Maximum number of MTRRs supported - see also mtrr_get_var_count() */ +#define MTRR_MAX_COUNT 10 #define NUM_FIXED_MTRRS 11 #define RANGES_PER_FIXED_MTRR 8 @@ -87,7 +87,7 @@ struct mtrr { * @mtrr: Information about each mtrr */ struct mtrr_info { - struct mtrr mtrr[MTRR_COUNT]; + struct mtrr mtrr[MTRR_MAX_COUNT]; }; /** @@ -180,6 +180,15 @@ int mtrr_set_valid(int cpu_select, int reg, bool valid); */ int mtrr_set(int cpu_select, int reg, u64 base, u64 mask); +/** + * mtrr_get_var_count() - Get the number of variable MTRRs + * + * Some CPUs have more than 8 MTRRs. This function returns the actual number + * + * @return number of variable MTRRs + */ +int mtrr_get_var_count(void); + #endif #if ((CONFIG_XIP_ROM_SIZE & (CONFIG_XIP_ROM_SIZE - 1)) != 0) diff --git a/cmd/x86/mtrr.c b/cmd/x86/mtrr.c index 99efecb9d8e..fc61a549b02 100644 --- a/cmd/x86/mtrr.c +++ b/cmd/x86/mtrr.c @@ -27,7 +27,7 @@ static void read_mtrrs(void *arg) mtrr_read_all(info); } -static int do_mtrr_list(int cpu_select) +static int do_mtrr_list(int reg_count, int cpu_select) { struct mtrr_info info; int ret; @@ -39,7 +39,7 @@ static int do_mtrr_list(int cpu_select) ret = mp_run_on_cpus(cpu_select, read_mtrrs, &info); if (ret) return log_msg_ret("run", ret); - for (i = 0; i < MTRR_COUNT; i++) { + for (i = 0; i < reg_count; i++) { const char *type = "Invalid"; uint64_t base, mask, size; bool valid; @@ -98,6 +98,7 @@ static int do_mtrr_set(int cpu_select, uint reg, int argc, char *const argv[]) static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + int reg_count = mtrr_get_var_count(); int cmd; int cpu_select; uint reg; @@ -126,7 +127,7 @@ static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 2) return CMD_RET_USAGE; reg = simple_strtoul(argv[1], NULL, 16); - if (reg >= MTRR_COUNT) { + if (reg >= reg_count) { printf("Invalid register number\n"); return CMD_RET_USAGE; } @@ -145,7 +146,7 @@ static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc, if (!first) printf("\n"); printf("CPU %d:\n", i); - ret = do_mtrr_list(i); + ret = do_mtrr_list(reg_count, i); if (ret) { printf("Failed to read CPU %d (err=%d)\n", i, ret); From patchwork Sun Sep 20 15:49:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1367915 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=WFUcZ17c; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BvX8f1Zyfz9sSW for ; Mon, 21 Sep 2020 01:50:25 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 275C682502; Sun, 20 Sep 2020 17:49:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="WFUcZ17c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D469C824FF; Sun, 20 Sep 2020 17:49:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D8DD9824CB for ; Sun, 20 Sep 2020 17:49:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x241.google.com with SMTP id 185so13932913oie.11 for ; Sun, 20 Sep 2020 08:49:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hHg3KAeWfQJh98h9A3BXqvCxE233w6qe83W2A5hJySk=; b=WFUcZ17cSnZIFgL9bdz/w0hh4wQ+4rW7PnLwSPTEYMfTMOWV66sOgMuSoiGIrGYHG5 geCn25/BDJOKMNGBLiLviN5blpUNZ5EH0b1nQoFgdNnMhMNAxkbpCSYTshl+CVDewlbf vfYe0iI4+WFzSAx1GsHMwshok0wMYYDMcKEoQ= 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=hHg3KAeWfQJh98h9A3BXqvCxE233w6qe83W2A5hJySk=; b=UDxuvrdAxVmExav+uqAw+nbFUKC8qwoac+87tFFmYljzqPTKxAohmLwTyxLRKzu78f gAwsBCGrrJjYcIHjbLEt7LKNi9/8EbqyKGAHuURlJia5UiRqIozilwXOR0Ozyxjd0T9+ dwhb7CXNQgtV/VM/1kDrn1Y8gKiMFFV+xdJM9DBJ5q5+ybGMVJhZc8em2GLDNj9rQfuU pP5d/Em8YR42oDXzuFOqY78xFCaN7x+k82HTULMXKXMbKGCzJ8AGesBNvN9WxSCY7srM AYgg4EGaWqQswb+oOELv+yPIcnwghmOr2R6oBWBjg1Inewjqb/rzQRcCqEw0fOUUwEck fsqA== X-Gm-Message-State: AOAM532OapFCDHIYC0fps5V30KQEyRA/Ex6KFoQzhHsTiNVZJ2/gJYkd 68psJ2kAHf1QHBrdmkJXtp6odN0Q216AWpta X-Google-Smtp-Source: ABdhPJw8swKDB5HuuXsrYBRah3tkPZK5aLZvqEiBnvYRZFl5900J8TS9fDC3au9pgUFSv5YrDVbj+g== X-Received: by 2002:a05:6808:3bb:: with SMTP id n27mr14635586oie.130.1600616968506; Sun, 20 Sep 2020 08:49:28 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id d1sm5500682otb.80.2020.09.20.08.49.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2020 08:49:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Bernhard Messerklinger , Wolfgang Wallner , Walter Lozano , Simon Glass , Anatolij Gustschin , Bin Meng , Stefan Roese Subject: [PATCH 5/5] x86: video: Show information about each video device Date: Sun, 20 Sep 2020 09:49:19 -0600 Message-Id: <20200920094914.5.I27387a60499ae66446ae94ada3060dce1bc21817@changeid> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog In-Reply-To: <20200920154919.2275229-1-sjg@chromium.org> References: <20200920154919.2275229-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean At present the 'bdinfo' command shows the framebuffer address, but not the address of the copy framebuffer, if present. Add support for this. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- cmd/bdinfo.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 9593b345a3d..2d88eb18ba7 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -8,9 +8,11 @@ #include #include +#include #include #include #include +#include #include #include @@ -66,6 +68,26 @@ __weak void arch_print_bdinfo(void) { } +static void show_video_info(void) +{ + const struct udevice *dev; + struct uclass *uc; + + uclass_id_foreach_dev(UCLASS_VIDEO, dev, uc) { + printf("%-12s= %s %sactive\n", "Video", dev->name, + device_active(dev) ? "" : "in"); + if (device_active(dev)) { + struct video_priv *upriv = dev_get_uclass_priv(dev); + + print_phys_addr("FB base", (ulong)upriv->fb); + if (upriv->copy_fb) + print_phys_addr("FB copy", (ulong)upriv->copy_fb); + printf("%-12s= %dx%dx%d\n", "FB size", upriv->xsize, + upriv->ysize, 1 << upriv->bpix); + } + } +} + int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct bd_info *bd = gd->bd; @@ -96,7 +118,9 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) bdinfo_print_num("fdt_blob", (ulong)gd->fdt_blob); bdinfo_print_num("new_fdt", (ulong)gd->new_fdt); bdinfo_print_num("fdt_size", (ulong)gd->fdt_size); -#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO) + if (IS_ENABLED(CONFIG_DM_VIDEO)) + show_video_info(); +#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) bdinfo_print_num("FB base ", gd->fb_base); #endif #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)