All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] x86: Updates to some commands
@ 2020-09-22 20:54 Simon Glass
  2020-09-22 20:54 ` [PATCH v2 1/5] x86: hob: Add way to show a single hob entry Simon Glass
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Simon Glass @ 2020-09-22 20:54 UTC (permalink / raw)
  To: u-boot

This series adds a few more features to some x86-specific commands.

Changes in v2:
- Fix '93' typo
- Capitalise 'System'

Simon Glass (5):
  x86: hob: Add way to show a single hob entry
  x86: hob: Try to show a name instead of a GUID
  x86: Allow showing details about a HOB entry
  x86: Add support for more than 8 MTRRs
  x86: video: Show information about each video device

 arch/x86/cpu/mtrr.c                |  12 ++--
 arch/x86/include/asm/fsp/fsp_hob.h |  25 ++++++++
 arch/x86/include/asm/mtrr.h        |  15 ++++-
 cmd/bdinfo.c                       |  26 +++++++-
 cmd/x86/hob.c                      | 100 +++++++++++++++++++++++++++--
 cmd/x86/mtrr.c                     |   9 +--
 6 files changed, 167 insertions(+), 20 deletions(-)

-- 
2.28.0.681.g6f77f65b4e-goog

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/5] x86: hob: Add way to show a single hob entry
  2020-09-22 20:54 [PATCH v2 0/5] x86: Updates to some commands Simon Glass
@ 2020-09-22 20:54 ` Simon Glass
  2020-09-22 20:54 ` [PATCH v2 2/5] x86: hob: Try to show a name instead of a GUID Simon Glass
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2020-09-22 20:54 UTC (permalink / raw)
  To: u-boot

The 'hob' command currently lists all HOB entries. Add way to list a
single entry, by index.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---

(no changes since v1)

 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)",
 	   ""
 );
-- 
2.28.0.681.g6f77f65b4e-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/5] x86: hob: Try to show a name instead of a GUID
  2020-09-22 20:54 [PATCH v2 0/5] x86: Updates to some commands Simon Glass
  2020-09-22 20:54 ` [PATCH v2 1/5] x86: hob: Add way to show a single hob entry Simon Glass
@ 2020-09-22 20:54 ` Simon Glass
  2020-09-22 20:54 ` [PATCH v2 3/5] x86: Allow showing details about a HOB entry Simon Glass
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2020-09-22 20:54 UTC (permalink / raw)
  To: u-boot

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 <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---

Changes in v2:
- Fix '93' typo

 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..98a67600086 100644
--- a/cmd/x86/hob.c
+++ b/cmd/x86/hob.c
@@ -8,6 +8,7 @@
 #include <efi.h>
 #include <uuid.h>
 #include <asm/hob.h>
+#include <asm/fsp/fsp_hob.h>
 
 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 9b" },
+	{ 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");
 		}
-- 
2.28.0.681.g6f77f65b4e-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/5] x86: Allow showing details about a HOB entry
  2020-09-22 20:54 [PATCH v2 0/5] x86: Updates to some commands Simon Glass
  2020-09-22 20:54 ` [PATCH v2 1/5] x86: hob: Add way to show a single hob entry Simon Glass
  2020-09-22 20:54 ` [PATCH v2 2/5] x86: hob: Try to show a name instead of a GUID Simon Glass
@ 2020-09-22 20:54 ` Simon Glass
  2020-09-22 20:54 ` [PATCH v2 4/5] x86: Add support for more than 8 MTRRs Simon Glass
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2020-09-22 20:54 UTC (permalink / raw)
  To: u-boot

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 <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---

Changes in v2:
- Capitalise 'System'

 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 98a67600086..9e555c778c2 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)",
 	   ""
 );
-- 
2.28.0.681.g6f77f65b4e-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/5] x86: Add support for more than 8 MTRRs
  2020-09-22 20:54 [PATCH v2 0/5] x86: Updates to some commands Simon Glass
                   ` (2 preceding siblings ...)
  2020-09-22 20:54 ` [PATCH v2 3/5] x86: Allow showing details about a HOB entry Simon Glass
@ 2020-09-22 20:54 ` Simon Glass
  2020-09-22 20:54 ` [PATCH v2 5/5] x86: video: Show information about each video device Simon Glass
  2020-09-23  5:17 ` [PATCH v2 0/5] x86: Updates to some commands Bin Meng
  5 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2020-09-22 20:54 UTC (permalink / raw)
  To: u-boot

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 <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---

(no changes since v1)

 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);
-- 
2.28.0.681.g6f77f65b4e-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 5/5] x86: video: Show information about each video device
  2020-09-22 20:54 [PATCH v2 0/5] x86: Updates to some commands Simon Glass
                   ` (3 preceding siblings ...)
  2020-09-22 20:54 ` [PATCH v2 4/5] x86: Add support for more than 8 MTRRs Simon Glass
@ 2020-09-22 20:54 ` Simon Glass
  2020-09-23  3:18   ` Simon Glass
  2020-09-23  5:17 ` [PATCH v2 0/5] x86: Updates to some commands Bin Meng
  5 siblings, 1 reply; 8+ messages in thread
From: Simon Glass @ 2020-09-22 20:54 UTC (permalink / raw)
  To: u-boot

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 <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---

(no changes since v1)

 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 <common.h>
 #include <command.h>
+#include <dm.h>
 #include <env.h>
 #include <lmb.h>
 #include <net.h>
+#include <video.h>
 #include <vsprintf.h>
 #include <asm/cache.h>
 
@@ -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)
-- 
2.28.0.681.g6f77f65b4e-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 5/5] x86: video: Show information about each video device
  2020-09-22 20:54 ` [PATCH v2 5/5] x86: video: Show information about each video device Simon Glass
@ 2020-09-23  3:18   ` Simon Glass
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2020-09-23  3:18 UTC (permalink / raw)
  To: u-boot

Hi Bin,

On Tue, 22 Sep 2020 at 14:55, Simon Glass <sjg@chromium.org> wrote:
>
> 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 <sjg@chromium.org>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> (no changes since v1)
>
>  cmd/bdinfo.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
>

This one breaks with other archs so I sent v3.

Regards,
Simon

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 0/5] x86: Updates to some commands
  2020-09-22 20:54 [PATCH v2 0/5] x86: Updates to some commands Simon Glass
                   ` (4 preceding siblings ...)
  2020-09-22 20:54 ` [PATCH v2 5/5] x86: video: Show information about each video device Simon Glass
@ 2020-09-23  5:17 ` Bin Meng
  5 siblings, 0 replies; 8+ messages in thread
From: Bin Meng @ 2020-09-23  5:17 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 23, 2020 at 4:54 AM Simon Glass <sjg@chromium.org> wrote:
>
> This series adds a few more features to some x86-specific commands.
>
> Changes in v2:
> - Fix '93' typo
> - Capitalise 'System'
>
> Simon Glass (5):
>   x86: hob: Add way to show a single hob entry
>   x86: hob: Try to show a name instead of a GUID
>   x86: Allow showing details about a HOB entry
>   x86: Add support for more than 8 MTRRs
>   x86: video: Show information about each video device
>
>  arch/x86/cpu/mtrr.c                |  12 ++--
>  arch/x86/include/asm/fsp/fsp_hob.h |  25 ++++++++
>  arch/x86/include/asm/mtrr.h        |  15 ++++-
>  cmd/bdinfo.c                       |  26 +++++++-
>  cmd/x86/hob.c                      | 100 +++++++++++++++++++++++++++--
>  cmd/x86/mtrr.c                     |   9 +--
>  6 files changed, 167 insertions(+), 20 deletions(-)
>
> --

applied to u-boot-x86/next, thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-23  5:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 20:54 [PATCH v2 0/5] x86: Updates to some commands Simon Glass
2020-09-22 20:54 ` [PATCH v2 1/5] x86: hob: Add way to show a single hob entry Simon Glass
2020-09-22 20:54 ` [PATCH v2 2/5] x86: hob: Try to show a name instead of a GUID Simon Glass
2020-09-22 20:54 ` [PATCH v2 3/5] x86: Allow showing details about a HOB entry Simon Glass
2020-09-22 20:54 ` [PATCH v2 4/5] x86: Add support for more than 8 MTRRs Simon Glass
2020-09-22 20:54 ` [PATCH v2 5/5] x86: video: Show information about each video device Simon Glass
2020-09-23  3:18   ` Simon Glass
2020-09-23  5:17 ` [PATCH v2 0/5] x86: Updates to some commands Bin Meng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.