Skip to contentSkip to conversation

Implement all missing SMBIOS types required by distro tooling

PATCH Superseded Raymond Mao 3 participants 19 messages Nov 28, 2025 – Feb 13

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover Implement all missing SMBIOS types required by distro tooling

This series finish the last missing puzzle of required SMBIOS types by:
1) Fixing duplicated handles when multiple instances exist in one type;
2) Implementing the rest of required types 9/16/17/19;
3) Adding version control when printing properties for all types.

Type 9/16/17/19 are generally DT-based, the idea is to write these tables using a hybrid approach:
Explicit DT definitions under existing '/smbios/smbios' take precedence, with fallback to scan and interpret values from the entire DT.

Moreover, all below APIs:
smbios_get_val_si()
smbios_get_u64_si()
smbios_add_prop_si()
are on top of sysinfo, thus allow vendors to get values from other subsystems by implementing their own sysinfo driver if needed.

Raymond Mao (6):
smbios: Fix duplicated smbios handles
smbios: add support for dynamic generation of Type 9 system slot
tables
smbios: add support for dynamic generation of Type 16 table
smbios: add support for dynamic generation of Type 17 table
smbios: add support for dynamic generation of Type 19 table
smbios: print the properties only when they exist in a specified
version of spec

 arch/arm/dts/smbios_generic.dtsi |   12 +
 cmd/smbios.c                     |  365 +++++++++-
 drivers/sysinfo/smbios.c         |    5 +
 include/smbios.h                 |  151 ++++
 include/smbios_def.h             |  250 +++++++
 include/sysinfo.h                |    4 +
 lib/smbios.c                     | 1152 +++++++++++++++++++++++++++++-
 7 files changed, 1906 insertions(+), 33 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v5 1/6 smbios: Fix duplicated smbios handles

Some smbios types can have multiple instances (e.g. Type 7, 9, 16, 17, 19), thus the 'handle' argument should be a pointer so that the value can be accumulated when writing all the instances.
This also fix the observed duplicated Type 7 handles.

Fixes bcf456dd369e ("smbios: add detailed smbios information")

---
Changes in v3:
- Initial patch.
Changes in v4:
- None.
Changes in v5:
- None.

 lib/smbios.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)
lib/smbios.c +23 -19
index b8c2846277a..85508c06547 100644
@@ -103,7 +103,7 @@ struct smbios_ctx {
  * @ctx:	context for writing the tables
  * Return:	size of the structure
  */
-typedef int (*smbios_write_type)(ulong *addr, int handle,
+typedef int (*smbios_write_type)(ulong *addr, int *handle,
 				 struct smbios_ctx *ctx);
 
 /**
@@ -364,7 +364,7 @@ static int smbios_string_table_len(const struct smbios_ctx *ctx)
 	return (ctx->next_ptr + 1) - ctx->eos;
 }
 
-static int smbios_write_type0(ulong *current, int handle,
+static int smbios_write_type0(ulong *current, int *handle,
 			      struct smbios_ctx *ctx)
 {
 	struct smbios_type0 *t;
@@ -372,7 +372,7 @@ static int smbios_write_type0(ulong *current, int handle,
 
 	t = map_sysmem(*current, len);
 	memset(t, 0, len);
-	fill_smbios_header(t, SMBIOS_BIOS_INFORMATION, len, handle);
+	fill_smbios_header(t, SMBIOS_BIOS_INFORMATION, len, *handle);
 	smbios_set_eos(ctx, t->eos);
 	t->vendor = smbios_add_prop_si(ctx, NULL, SYSID_SM_BIOS_VENDOR,
 				       "U-Boot");
@@ -423,7 +423,7 @@ static int smbios_write_type0(ulong *current, int handle,
 	return len;
 }
 
-static int smbios_write_type1(ulong *current, int handle,
+static int smbios_write_type1(ulong *current, int *handle,
 			      struct smbios_ctx *ctx)
 {
 	struct smbios_type1 *t;
@@ -434,7 +434,7 @@ static int smbios_write_type1(ulong *current, int handle,
 
 	t = map_sysmem(*current, len);
 	memset(t, 0, len);
-	fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
+	fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, *handle);
 	smbios_set_eos(ctx, t->eos);
 
 	t->manufacturer = smbios_add_prop_si(ctx, "manufacturer",
@@ -471,7 +471,7 @@ static int smbios_write_type1(ulong *current, int handle,
 	return len;
 }
 
-static int smbios_write_type2(ulong *current, int handle,
+static int smbios_write_type2(ulong *current, int *handle,
 			      struct smbios_ctx *ctx)
 {
 	struct smbios_type2 *t;
@@ -485,7 +485,7 @@ static int smbios_write_type2(ulong *current, int handle,
 	 */
 	t = map_sysmem(*current, len);
 	memset(t, 0, len);
-	fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
+	fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, *handle);
 
 	/* eos is at the end of the structure */
 	eos_addr = (u8 *)t + len - sizeof(t->eos);
@@ -519,7 +519,7 @@ static int smbios_write_type2(ulong *current, int handle,
 	 * t->number_contained_objects = <obj_handle_num>;
 	 */
 
-	t->chassis_handle = handle + 1;
+	t->chassis_handle = *handle + 1;
 
 	len = t->hdr.length + smbios_string_table_len(ctx);
 	*current += len;
@@ -528,7 +528,7 @@ static int smbios_write_type2(ulong *current, int handle,
 	return len;
 }
 
-static int smbios_write_type3(ulong *current, int handle,
+static int smbios_write_type3(ulong *current, int *handle,
 			      struct smbios_ctx *ctx)
 {
 	struct smbios_type3 *t;
@@ -548,7 +548,7 @@ static int smbios_write_type3(ulong *current, int handle,
 
 	t = map_sysmem(*current, len);
 	memset(t, 0, len);
-	fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle);
+	fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, *handle);
 #if IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLE_VERBOSE)
 	elem_addr = (u8 *)t + offsetof(struct smbios_type3, sku_number);
 	sku_num_addr = elem_addr + elem_size;
@@ -669,7 +669,7 @@ static void smbios_write_type4_dm(struct smbios_type4 *t,
 #endif
 }
 
-static int smbios_write_type4(ulong *current, int handle,
+static int smbios_write_type4(ulong *current, int *handle,
 			      struct smbios_ctx *ctx)
 {
 	struct smbios_type4 *t;
@@ -679,7 +679,7 @@ static int smbios_write_type4(ulong *current, int handle,
 
 	t = map_sysmem(*current, len);
 	memset(t, 0, len);
-	fill_smbios_header(t, SMBIOS_PROCESSOR_INFORMATION, len, handle);
+	fill_smbios_header(t, SMBIOS_PROCESSOR_INFORMATION, len, *handle);
 	smbios_set_eos(ctx, t->eos);
 	t->socket_design = smbios_add_prop_si(ctx, "socket-design",
 					      SYSID_SM_PROCESSOR_SOCKET, NULL);
@@ -828,13 +828,14 @@ static int smbios_write_type7_1level(ulong *current, int handle,
 	return len;
 }
 
-static int smbios_write_type7(ulong *current, int handle,
+static int smbios_write_type7(ulong *current, int *handle,
 			      struct smbios_ctx *ctx)
 {
 	int len = 0;
 	int i, level;
 	ofnode parent = ctx->node;
 	struct smbios_ctx ctx_bak;
+	int hdl_base = *handle;
 
 	memcpy(&ctx_bak, ctx, sizeof(ctx_bak));
 
@@ -850,15 +851,17 @@ static int smbios_write_type7(ulong *current, int handle,
 			return 0;
 		ctx->subnode_name = buf;
 		ctx->node = ofnode_find_subnode(parent, ctx->subnode_name);
-		len += smbios_write_type7_1level(current, handle++, ctx, i);
+		*handle = hdl_base + i;
+		len += smbios_write_type7_1level(current, *handle, ctx, i);
 		memcpy(ctx, &ctx_bak, sizeof(*ctx));
 	}
+
 	return len;
 }
 
 #endif /* #if IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLE_VERBOSE) */
 
-static int smbios_write_type32(ulong *current, int handle,
+static int smbios_write_type32(ulong *current, int *handle,
 			       struct smbios_ctx *ctx)
 {
 	struct smbios_type32 *t;
@@ -866,7 +869,7 @@ static int smbios_write_type32(ulong *current, int handle,
 
 	t = map_sysmem(*current, len);
 	memset(t, 0, len);
-	fill_smbios_header(t, SMBIOS_SYSTEM_BOOT_INFORMATION, len, handle);
+	fill_smbios_header(t, SMBIOS_SYSTEM_BOOT_INFORMATION, len, *handle);
 	smbios_set_eos(ctx, t->eos);
 
 	*current += len;
@@ -875,7 +878,7 @@ static int smbios_write_type32(ulong *current, int handle,
 	return len;
 }
 
-static int smbios_write_type127(ulong *current, int handle,
+static int smbios_write_type127(ulong *current, int *handle,
 				struct smbios_ctx *ctx)
 {
 	struct smbios_type127 *t;
@@ -883,7 +886,7 @@ static int smbios_write_type127(ulong *current, int handle,
 
 	t = map_sysmem(*current, len);
 	memset(t, 0, len);
-	fill_smbios_header(t, SMBIOS_END_OF_TABLE, len, handle);
+	fill_smbios_header(t, SMBIOS_END_OF_TABLE, len, *handle);
 
 	*current += len;
 	unmap_sysmem(t);
@@ -954,7 +957,8 @@ ulong write_smbios_table(ulong addr)
 				ctx.node = ofnode_find_subnode(parent_node,
 							       method->subnode_name);
 		}
-		len += method->write((ulong *)&addr, handle++, &ctx);
+		len += method->write((ulong *)&addr, &handle, &ctx);
+		handle++;
 	}
 
 	/*
Signature · 1 line
2.25.1
#2 lore raw

PATCH v5 2/6 smbios: add support for dynamic generation of Type 9 system slot tables

In reply to Raymond Mao

This commit introduces support for generating SMBIOS Type 9 (System Slot) tables using a hybrid approach:

1. Explicit Device Tree definitions:
Child node under '/smbios/smbios/system-slot' will be interpreted as individual slot definitions.
- Each child represents a slot (e.g., isa, pcmcia, etc.).
- Properties follow the SMBIOS specification using lowercase hyphen-separated names such as 'slot-type', 'slot-id', 'segment-group-number', 'bus-number', 'slot-information', etc.
- This approach allows full customization of each system slot and is especially suitable for platforms with well-defined slot topology.

2. Automatic detection fallback:
If child node under '/smbios/smbios/system-slot' does not exist, the implementation will scan the entire device tree for nodes whose 'device_type' matches known slot-related types ("pci", "isa", "pcmcia", etc.).
- When a match is found, default values or heuristics are applied to populate to the System Slot table.
- This mode is useful for platforms that lack explicit SMBIOS nodes but still expose slot topology via standard DT conventions.

Together, two approaches ensure that SMBIOS Type 9 entries are available whether explicitly described or automatically derived.

---
Changes in v2:
- Reuse sysinfo_to_dt and convert_sysinfo_to_dt() for mapping SMBIOS properties to DT. Changes in v3:
- Update subject and commit message.
- Abstract helper functions and add callback for writing subnodes. Changes in v4:
- Refine the commit message.
Changes in v5:
- None.

 arch/arm/dts/smbios_generic.dtsi |   3 +
 cmd/smbios.c                     | 114 ++++++++++++
 include/smbios.h                 |  45 +++++
 include/smbios_def.h             |  89 +++++++++
 lib/smbios.c                     | 301 ++++++++++++++++++++++++++++++-
 5 files changed, 549 insertions(+), 3 deletions(-)
arch/arm/dts/smbios_generic.dtsi +3 -0
index fc168317c9e..4463dade217 100644
@@ -77,6 +77,9 @@
 						   SMBIOS_CACHE_OP_WB)>;
 				};
 			};
+
+			system-slot {
+			};
 		};
 	};
 };
cmd/smbios.c +114 -0

132 lines not on this page · raw message

include/smbios.h +45 -0

51 lines not on this page · raw message

include/smbios_def.h +89 -0

93 lines not on this page · raw message

lib/smbios.c +298 -3

339 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw

PATCH v5 3/6 smbios: add support for dynamic generation of Type 16 table

In reply to Raymond Mao

This commit implements SMBIOS Type 16 (Physical Memory Array) generation with a hybrid approach supporting both:

1. Explicit definition via Device Tree 'smbios' node:
Child node under '/smbios/smbios/memory-array' will be used to populate as individual Type 16 structure directly.
- Properties follow SMBIOS field names with lowercase letters and hyphen-separated words (e.g., 'memory-error-correction', 'maximum-capacity', 'extended-maximum-capacity', etc.).
- This method supports precise platform-defined overrides and system descriptions.

2. Fallback to automatic DT-based discovery:
If child node under '/smbios/smbios/memory-array' does not exist, the implementation will:
- Scan all top-level 'memory@' nodes to populate Type 16 structure with inferred size and location data.
- Scan nodes named or marked as 'memory-controller' and parse associated 'dimm@' subnodes (if present) to extract DIMM sizes and map them accordingly.

This dual-mode support enables flexible firmware SMBIOS reporting while aligning with spec-compliant naming and runtime-detected memory topology.

Type 16 support is under GENERATE_SMBIOS_TABLE_VERBOSE to avoid increasing rom size for those platforms which only require basic SMBIOS support.

---
Changes in v4:
- Initial patch.
Changes in v5:
- None.

 arch/arm/dts/smbios_generic.dtsi |   3 +
 cmd/smbios.c                     |  46 +++++
 drivers/sysinfo/smbios.c         |   5 +
 include/smbios.h                 |  18 ++
 include/smbios_def.h             |  29 ++++
 include/sysinfo.h                |   4 +
 lib/smbios.c                     | 282 +++++++++++++++++++++++++++++++
 7 files changed, 387 insertions(+)
arch/arm/dts/smbios_generic.dtsi +3 -0
index 4463dade217..1a9adfaa409 100644
@@ -80,6 +80,9 @@
 
 			system-slot {
 			};
+
+			memory-array {
+			};
 		};
 	};
 };
cmd/smbios.c +46 -0

64 lines not on this page · raw message

drivers/sysinfo/smbios.c +5 -0
index 99104274f72..ff5873c940e 100644
@@ -24,6 +24,7 @@ struct sysinfo_plat_priv {
 	struct smbios_type7 t7[SYSINFO_CACHE_LVL_MAX];
 	u16 cache_handles[SYSINFO_CACHE_LVL_MAX];
 	u8 cache_level;
+	u16 marray_handles[SYSINFO_MEM_HANDLE_MAX];
 };
 
 static void smbios_cache_info_dump(struct smbios_type7 *cache_info)
@@ -165,6 +166,10 @@ static int sysinfo_plat_get_data(struct udevice *dev, int id, void **buf,
 		*buf = &priv->cache_handles[0];
 		*size = sizeof(priv->cache_handles);
 		break;
+	case SYSID_SM_MEMARRAY_HANDLE:
+		*buf = &priv->marray_handles[0];
+		*size = sizeof(priv->marray_handles);
+		break;
 	default:
 		return -EOPNOTSUPP;
 	}
include/smbios.h +18 -0
index d885285ea41..16438c059c7 100644
@@ -309,6 +309,24 @@ struct __packed smbios_type9 {
 	char eos[SMBIOS_STRUCT_EOS_BYTES];
 };
 
+enum {
+	SMBIOS_MEM_NONE = 0,
+	SMBIOS_MEM_CUSTOM = 1,
+	SMBIOS_MEM_FDT_MEM_NODE = 2,
+	SMBIOS_MEM_FDT_MEMCON_NODE = 3
+};
+
+struct __packed smbios_type16 {
+	struct smbios_header hdr;
+	u8 location;
+	u8 use;
+	u8 mem_err_corr;
+	u32 max_cap;
+	u16 mem_err_info_hdl;
+	u16 num_of_mem_dev;
+	u64 ext_max_cap;
+	char eos[SMBIOS_STRUCT_EOS_BYTES];
+};
 struct __packed smbios_type32 {
 	u8 type;
 	u8 length;
include/smbios_def.h +29 -0
index ef9cb02ed25..c6850a5d6f5 100644
@@ -280,4 +280,33 @@
 /* Slot segment group number */
 #define SMBIOS_SYSSLOT_SGGNUM_UND	0
 
+/* Physical Memory Array */
+
+/* Location */
+#define SMBIOS_MA_LOCATION_OTHER	1
+#define SMBIOS_MA_LOCATION_UNKNOWN	2
+#define SMBIOS_MA_LOCATION_MOTHERBOARD	3
+
+/* Use */
+#define SMBIOS_MA_USE_OTHER		1
+#define SMBIOS_MA_USE_UNKNOWN		2
+#define SMBIOS_MA_USE_SYSTEM		3
+#define SMBIOS_MA_USE_VIDEO		4
+#define SMBIOS_MA_USE_FLASH		5
+#define SMBIOS_MA_USE_NVRAM		6
+#define SMBIOS_MA_USE_CACHE		7
+
+/* Error Correction Type */
+#define SMBIOS_MA_ERRCORR_OTHER		1
+#define SMBIOS_MA_ERRCORR_UNKNOWN	2
+#define SMBIOS_MA_ERRCORR_NONE		3
+#define SMBIOS_MA_ERRCORR_PARITY	4
+#define SMBIOS_MA_ERRCORR_SBITECC	5
+#define SMBIOS_MA_ERRCORR_MBITECC	6
+#define SMBIOS_MA_ERRCORR_CRC		7
+
+/* Error Information Handle */
+#define SMBIOS_MA_ERRINFO_NONE		0xFFFE
+#define SMBIOS_MA_ERRINFO_NOERR		0xFFFF
+
 #endif /* _SMBIOS_DEF_H_ */
include/sysinfo.h +4 -0
index e87cf969fcd..54eb64a204a 100644
@@ -12,6 +12,7 @@
 struct udevice;
 
 #define SYSINFO_CACHE_LVL_MAX 3
+#define SYSINFO_MEM_HANDLE_MAX 8
 
 /*
  * This uclass encapsulates hardware methods to gather information about a
@@ -149,6 +150,9 @@ enum sysinfo_id {
 	SYSID_SM_CACHE_INFO_END =
 		SYSID_SM_CACHE_INST_SIZE2 + SYSINFO_CACHE_LVL_MAX - 1,
 
+	/* Memory Array (Type 16) */
+	SYSID_SM_MEMARRAY_HANDLE,
+
 	/* For show_board_info() */
 	SYSID_BOARD_MODEL,
 	SYSID_BOARD_MANUFACTURER,
lib/smbios.c +282 -0

300 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw

PATCH v5 4/6 smbios: add support for dynamic generation of Type 17 table

In reply to Raymond Mao

This commit implements SMBIOS Type 17 (Memory Device) generation with a hybrid approach supporting both:

1. Explicit definition via Device Tree 'smbios' node:
Child node under '/smbios/smbios/memory-device' will be used to populate as individual Type 17 structure directly.
- Properties follow SMBIOS field names with lowercase letters and hyphen-separated words (e.g., 'physical-memory-array-handle', ' memory-error-information-handle', 'configured-memory-speed', etc.).
- This method supports precise platform-defined overrides and system descriptions.

2. Fallback to automatic DT-based discovery:
If child node under '/smbios/smbios/memory-device' does not exist, the implementation will:
- Scan all top-level 'memory@' nodes to populate Type 17 structure with inferred size and location data.
- Scan nodes named or marked as 'memory-controller' and parse associated 'dimm@' subnodes (if present) to extract DIMM sizes and map them accordingly.

This dual-mode support enables flexible firmware SMBIOS reporting while aligning with spec-compliant naming and runtime-detected memory topology.

Type 17 support is under GENERATE_SMBIOS_TABLE_VERBOSE to avoid increasing rom size for those platforms which only require basic SMBIOS support.

---
Changes in v4:
- Initial patch.
Changes in v5:
- None.

 arch/arm/dts/smbios_generic.dtsi |   3 +
 cmd/smbios.c                     | 126 +++++++++++
 include/smbios.h                 |  45 ++++
 include/smbios_def.h             | 127 +++++++++++
 lib/smbios.c                     | 377 +++++++++++++++++++++++++++++++
 5 files changed, 678 insertions(+)
arch/arm/dts/smbios_generic.dtsi +3 -0
index 1a9adfaa409..fd2df8d02e0 100644
@@ -83,6 +83,9 @@
 
 			memory-array {
 			};
+
+			memory-device {
+			};
 		};
 	};
 };
cmd/smbios.c +126 -0

144 lines not on this page · raw message

include/smbios.h +45 -0

51 lines not on this page · raw message

include/smbios_def.h +127 -0

131 lines not on this page · raw message

lib/smbios.c +377 -0

395 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

PATCH v5 5/6 smbios: add support for dynamic generation of Type 19 table

In reply to Raymond Mao

This commit implements SMBIOS Type 19 (Memory Array Mapped Address) generation with a hybrid approach supporting both:

1. Explicit definition via Device Tree 'smbios' node:
Child node under '/smbios/smbios/memory-array-mapped-address' will be used to populate as individual Type 19 structure directly.
- Properties follow SMBIOS field names with lowercase letters and hyphen-separated words (e.g., 'starting-address', 'ending-address', 'partition-width', etc.).
- This method supports precise platform-defined overrides and system descriptions.

2. Fallback to automatic DT-based discovery:
If child node under '/smbios/smbios/memory-array-mapped-address' does not exist, the implementation will:
- Scan all top-level 'memory@' nodes to populate Type 19 structure with inferred size and location data.
- Scan nodes named or marked as 'memory-controller' and parse associated 'dimm@' subnodes (if present) to extract DIMM sizes and map them accordingly.

This dual-mode support enables flexible firmware SMBIOS reporting while aligning with spec-compliant naming and runtime-detected memory topology.

Type 19 support is under GENERATE_SMBIOS_TABLE_VERBOSE to avoid increasing rom size for those platforms which only require basic SMBIOS support.

---
Changes in v4:
- Initial patch.
Changes in v5:
- None.

 arch/arm/dts/smbios_generic.dtsi |   3 +
 cmd/smbios.c                     |  14 +++
 include/smbios.h                 |  11 +++
 include/smbios_def.h             |   5 ++
 lib/smbios.c                     | 150 +++++++++++++++++++++++++++++++
 5 files changed, 183 insertions(+)
arch/arm/dts/smbios_generic.dtsi +3 -0
index fd2df8d02e0..fe16037fc20 100644
@@ -86,6 +86,9 @@
 
 			memory-device {
 			};
+
+			memory-array-mapped-address {
+			};
 		};
 	};
 };
cmd/smbios.c +14 -0
index 39c9c44a28e..671c14e05b5 100644
@@ -680,6 +680,17 @@ static void smbios_print_type17(struct smbios_type17 *table)
 	printf("\tRCD Revision Number: 0x%04x\n", table->rcd_rev_num);
 }
 
+static void smbios_print_type19(struct smbios_type19 *table)
+{
+	printf("Memory Array Mapped Address:\n");
+	printf("\tStarting Address: 0x%08x\n", table->start_addr);
+	printf("\tEnding Address: 0x%08x\n", table->end_addr);
+	printf("\tMemory Array Handle: 0x%04x\n", table->mem_array_hdl);
+	printf("\tPartition Width: 0x%04x\n", table->partition_wid);
+	printf("\tExtended Starting Address: 0x%016llx\n", table->ext_start_addr);
+	printf("\tExtended Ending Address: 0x%016llx\n", table->ext_end_addr);
+}
+
 static void smbios_print_type127(struct smbios_type127 *table)
 {
 	printf("End Of Table\n");
@@ -768,6 +779,9 @@ static int do_smbios(struct cmd_tbl *cmdtp, int flag, int argc,
 		case SMBIOS_MEMORY_DEVICE:
 			smbios_print_type17((struct smbios_type17 *)pos);
 			break;
+		case SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS:
+			smbios_print_type19((struct smbios_type19 *)pos);
+			break;
 		case SMBIOS_END_OF_TABLE:
 			smbios_print_type127((struct smbios_type127 *)pos);
 			break;
include/smbios.h +11 -0
index 45131416253..a0e47d51852 100644
@@ -372,6 +372,17 @@ struct __packed smbios_type17 {
 	char eos[SMBIOS_STRUCT_EOS_BYTES];
 };
 
+struct __packed smbios_type19 {
+	struct smbios_header hdr;
+	u32 start_addr;
+	u32 end_addr;
+	u16 mem_array_hdl;
+	u8 partition_wid;
+	u64 ext_start_addr;
+	u64 ext_end_addr;
+	char eos[SMBIOS_STRUCT_EOS_BYTES];
+};
+
 struct __packed smbios_type32 {
 	u8 type;
 	u8 length;
include/smbios_def.h +5 -0
index ce913f2f32a..ae50e1a808e 100644
@@ -436,4 +436,9 @@
 #define SMBIOS_MD_ERRINFO_NONE		0xFFFE
 #define SMBIOS_MD_ERRINFO_NOERR		0xFFFF
 
+/* Memory Array Mapped Address */
+
+/* Partition Width */
+#define SMBIOS_MAMA_PW_DEF	1 /* not partitioned */
+
 #endif /* _SMBIOS_DEF_H_ */
lib/smbios.c +150 -0

162 lines not on this page · raw message

Signature · 1 line
2.25.1
#6 lore raw

PATCH v5 6/6 smbios: print the properties only when they exist in a specified version of spec

In reply to Raymond Mao

By checking the payload length, we can know the version of the spec and skip the ones which are not expected to exist.

---
Changes in v5:
- Initial patch.

 cmd/smbios.c     | 65 ++++++++++++++++++++++++++++++++++++++++--------
 include/smbios.h | 32 ++++++++++++++++++++++++
 2 files changed, 86 insertions(+), 11 deletions(-)
cmd/smbios.c +54 -11
index 671c14e05b5..3fafa46d0a5 100644
@@ -348,6 +348,8 @@ static void smbios_print_type0(struct smbios_type0 *table)
 	printf("\tBIOS ROM Size: 0x%02x\n", table->bios_rom_size);
 	printf("\tBIOS Characteristics: 0x%016llx\n",
 	       table->bios_characteristics);
+	if (table->hdr.length < SMBIOS_TYPE0_LENGTH_V24)
+		return;
 	printf("\tBIOS Characteristics Extension Byte 1: 0x%02x\n",
 	       table->bios_characteristics_ext1);
 	printf("\tBIOS Characteristics Extension Byte 2: 0x%02x\n",
@@ -360,6 +362,8 @@ static void smbios_print_type0(struct smbios_type0 *table)
 	       table->ec_major_release);
 	printf("\tEmbedded Controller Firmware Minor Release: 0x%02x\n",
 	       table->ec_minor_release);
+	if (table->hdr.length < SMBIOS_TYPE0_LENGTH_V31)
+		return;
 	printf("\tExtended BIOS ROM Size: 0x%04x\n",
 	       table->extended_bios_rom_size);
 }
@@ -371,17 +375,16 @@ static void smbios_print_type1(struct smbios_type1 *table)
 	smbios_print_str("Product Name", table, table->product_name);
 	smbios_print_str("Version", table, table->version);
 	smbios_print_str("Serial Number", table, table->serial_number);
-	if (table->hdr.length >= SMBIOS_TYPE1_LENGTH_V21) {
-		printf("\tUUID: %pUl\n", table->uuid);
-		smbios_print_lookup_str(wakeup_type_strings,
-					table->wakeup_type,
-					ARRAY_SIZE(wakeup_type_strings),
-					"Wake-up Type");
-	}
-	if (table->hdr.length >= SMBIOS_TYPE1_LENGTH_V24) {
-		smbios_print_str("SKU Number", table, table->sku_number);
-		smbios_print_str("Family", table, table->family);
-	}
+	if (table->hdr.length < SMBIOS_TYPE1_LENGTH_V21)
+		return;
+	printf("\tUUID: %pUl\n", table->uuid);
+	smbios_print_lookup_str(wakeup_type_strings, table->wakeup_type,
+				ARRAY_SIZE(wakeup_type_strings),
+				"Wake-up Type");
+	if (table->hdr.length < SMBIOS_TYPE1_LENGTH_V24)
+		return;
+	smbios_print_str("SKU Number", table, table->sku_number);
+	smbios_print_str("Family", table, table->family);
 }
 
 static void smbios_print_type2(struct smbios_type2 *table)
@@ -501,21 +504,31 @@ static void smbios_print_type4(struct smbios_type4 *table)
 	printf("\tL1 Cache Handle: 0x%04x\n", table->l1_cache_handle);
 	printf("\tL2 Cache Handle: 0x%04x\n", table->l2_cache_handle);
 	printf("\tL3 Cache Handle: 0x%04x\n", table->l3_cache_handle);
+	if (table->hdr.length < SMBIOS_TYPE4_LENGTH_V23)
+		return;
 	smbios_print_str("Serial Number", table, table->serial_number);
 	smbios_print_str("Asset Tag", table, table->asset_tag);
 	smbios_print_str("Part Number", table, table->part_number);
+	if (table->hdr.length < SMBIOS_TYPE4_LENGTH_V25)
+		return;
 	printf("\tCore Count: 0x%02x\n", table->core_count);
 	printf("\tCore Enabled: 0x%02x\n", table->core_enabled);
 	printf("\tThread Count: 0x%02x\n", table->thread_count);
 	printf("\tProcessor Characteristics: 0x%04x\n",
 	       table->processor_characteristics);
+	if (table->hdr.length < SMBIOS_TYPE4_LENGTH_V26)
+		return;
 	smbios_print_lookup_str(processor_family_strings,
 				table->processor_family2,
 				ARRAY_SIZE(processor_family_strings),
 				"Processor Family 2");
+	if (table->hdr.length < SMBIOS_TYPE4_LENGTH_V30)
+		return;
 	printf("\tCore Count 2: 0x%04x\n", table->core_count2);
 	printf("\tCore Enabled 2: 0x%04x\n", table->core_enabled2);
 	printf("\tThread Count 2: 0x%04x\n", table->thread_count2);
+	if (table->hdr.length < SMBIOS_TYPE4_LENGTH_V36)
+		return;
 	printf("\tThread Enabled: 0x%04x\n", table->thread_enabled);
 }
 
@@ -529,6 +542,8 @@ static void smbios_print_type7(struct smbios_type7 *table)
 	printf("\tInstalled Size: 0x%04x\n", table->inst_size.data);
 	printf("\tSupported SRAM Type: 0x%04x\n", table->supp_sram_type.data);
 	printf("\tCurrent SRAM Type: 0x%04x\n", table->curr_sram_type.data);
+	if (table->hdr.length < SMBIOS_TYPE7_LENGTH_V21)
+		return;
 	printf("\tCache Speed: 0x%02x\n", table->speed);
 	smbios_print_lookup_str(err_corr_type_strings,
 				table->err_corr_type,
@@ -542,6 +557,8 @@ static void smbios_print_type7(struct smbios_type7 *table)
 				table->associativity,
 				ARRAY_SIZE(associativity_strings),
 				"Associativity");
+	if (table->hdr.length < SMBIOS_TYPE7_LENGTH_V31)
+		return;
 	printf("\tMaximum Cache Size 2: 0x%08x\n", table->max_size2.data);
 	printf("\tInstalled Cache Size 2: 0x%08x\n", table->inst_size2.data);
 }
@@ -574,8 +591,12 @@ static void smbios_print_type9(struct smbios_type9 *table)
 	printf("\tSlot ID: 0x%04x\n", table->slot_id);
 	printf("\tSlot Characteristics 1: 0x%04x\n",
 	       table->slot_characteristics_1);
+	if (table->hdr.length < SMBIOS_TYPE9_LENGTH_V21)
+		return;
 	printf("\tSlot Characteristics 2: 0x%04x\n",
 	       table->slot_characteristics_2);
+	if (table->hdr.length < SMBIOS_TYPE9_LENGTH_V26)
+		return;
 	printf("\tSegment Group Number (Base): 0x%04x\n",
 	       table->segment_group_number);
 	printf("\tBus Number (Base): 0x%04x\n", table->bus_number);
@@ -611,6 +632,8 @@ static void smbios_print_type9(struct smbios_type9 *table)
 static void smbios_print_type16(struct smbios_type16 *table)
 {
 	printf("Physical Memory Array:\n");
+	if (table->hdr.length < SMBIOS_TYPE16_LENGTH_V21)
+		return;
 	smbios_print_lookup_str(ma_location_strings, table->location,
 				ARRAY_SIZE(ma_location_strings), "Location");
 	smbios_print_lookup_str(ma_use_strings, table->use,
@@ -622,12 +645,16 @@ static void smbios_print_type16(struct smbios_type16 *table)
 	printf("\tMemory Error Information Handle: 0x%04x\n",
 	       table->mem_err_info_hdl);
 	printf("\tNumber of Memory Devices: 0x%04x\n", table->num_of_mem_dev);
+	if (table->hdr.length < SMBIOS_TYPE16_LENGTH_V27)
+		return;
 	printf("\tExtended Maximum Capacity: 0x%016llx\n", table->ext_max_cap);
 }
 
 static void smbios_print_type17(struct smbios_type17 *table)
 {
 	printf("Memory Device:\n");
+	if (table->hdr.length < SMBIOS_TYPE17_LENGTH_V21)
+		return;
 	printf("\tPhysical Memory Array Handle: 0x%04x\n",
 	       table->phy_mem_array_hdl);
 	printf("\tMemory Error Information Handle: 0x%04x\n",
@@ -644,17 +671,27 @@ static void smbios_print_type17(struct smbios_type17 *table)
 	smbios_print_lookup_str(md_type_strings, table->mem_type,
 				ARRAY_SIZE(md_type_strings), "Memory Type");
 	printf("\tType Detail: 0x%04x\n", table->type_detail);
+	if (table->hdr.length < SMBIOS_TYPE17_LENGTH_V23)
+		return;
 	printf("\tSpeed: 0x%04x\n", table->speed);
 	smbios_print_str("Manufacturer", table, table->manufacturer);
 	smbios_print_str("Serial Number", table, table->serial_number);
 	smbios_print_str("Asset Tag", table, table->asset_tag);
 	smbios_print_str("Part Number", table, table->part_number);
+	if (table->hdr.length < SMBIOS_TYPE17_LENGTH_V26)
+		return;
 	printf("\tAttributes: 0x%04x\n", table->attributes);
+	if (table->hdr.length < SMBIOS_TYPE17_LENGTH_V27)
+		return;
 	printf("\tExtended Size: 0x%08x\n", table->ext_size);
 	printf("\tConfigured Memory Speed: 0x%04x\n", table->config_mem_speed);
+	if (table->hdr.length < SMBIOS_TYPE17_LENGTH_V28)
+		return;
 	printf("\tMinimum voltage: 0x%04x\n", table->min_voltage);
 	printf("\tMaximum voltage: 0x%04x\n", table->max_voltage);
 	printf("\tConfigured voltage: 0x%04x\n", table->config_voltage);
+	if (table->hdr.length < SMBIOS_TYPE17_LENGTH_V32)
+		return;
 	smbios_print_lookup_str(md_tech_strings, table->mem_tech,
 				ARRAY_SIZE(md_tech_strings),
 				"Memory Technology");
@@ -671,6 +708,8 @@ static void smbios_print_type17(struct smbios_type17 *table)
 	printf("\tVolatile Size: 0x%016llx\n", table->volatile_size);
 	printf("\tCache Size: 0x%016llx\n", table->cache_size);
 	printf("\tLogical Size: 0x%016llx\n", table->logical_size);
+	if (table->hdr.length < SMBIOS_TYPE17_LENGTH_V33)
+		return;
 	printf("\tExtended Speed: 0x%04x\n", table->ext_speed);
 	printf("\tExtended Configured Memory Speed: 0x%04x\n",
 	       table->ext_config_mem_speed);
@@ -683,10 +722,14 @@ static void smbios_print_type17(struct smbios_type17 *table)
 static void smbios_print_type19(struct smbios_type19 *table)
 {
 	printf("Memory Array Mapped Address:\n");
+	if (table->hdr.length < SMBIOS_TYPE19_LENGTH_V21)
+		return;
 	printf("\tStarting Address: 0x%08x\n", table->start_addr);
 	printf("\tEnding Address: 0x%08x\n", table->end_addr);
 	printf("\tMemory Array Handle: 0x%04x\n", table->mem_array_hdl);
 	printf("\tPartition Width: 0x%04x\n", table->partition_wid);
+	if (table->hdr.length < SMBIOS_TYPE19_LENGTH_V27)
+		return;
 	printf("\tExtended Starting Address: 0x%016llx\n", table->ext_start_addr);
 	printf("\tExtended Ending Address: 0x%016llx\n", table->ext_end_addr);
 }
include/smbios.h +32 -0
index a0e47d51852..14a7d8e6c30 100644
@@ -110,10 +110,42 @@ struct __packed smbios_type0 {
 	char eos[SMBIOS_STRUCT_EOS_BYTES];
 };
 
+#define SMBIOS_TYPE0_LENGTH_V24		0x18
+#define SMBIOS_TYPE0_LENGTH_V31		0x1a
+
 #define SMBIOS_TYPE1_LENGTH_V20		0x08
 #define SMBIOS_TYPE1_LENGTH_V21		0x19
 #define SMBIOS_TYPE1_LENGTH_V24		0x1b
 
+#define SMBIOS_TYPE4_LENGTH_V20		0x1a
+#define SMBIOS_TYPE4_LENGTH_V23		0x23
+#define SMBIOS_TYPE4_LENGTH_V25		0x28
+#define SMBIOS_TYPE4_LENGTH_V26		0x2a
+#define SMBIOS_TYPE4_LENGTH_V30		0x30
+#define SMBIOS_TYPE4_LENGTH_V36		0x32
+
+#define SMBIOS_TYPE7_LENGTH_V20		0x0f
+#define SMBIOS_TYPE7_LENGTH_V21		0x13
+#define SMBIOS_TYPE7_LENGTH_V31		0x1b
+
+#define SMBIOS_TYPE9_LENGTH_V20		0x0c
+#define SMBIOS_TYPE9_LENGTH_V21		0x0d
+#define SMBIOS_TYPE9_LENGTH_V26		0x11
+
+#define SMBIOS_TYPE16_LENGTH_V21	0x0f
+#define SMBIOS_TYPE16_LENGTH_V27	0x17
+
+#define SMBIOS_TYPE17_LENGTH_V21	0x15
+#define SMBIOS_TYPE17_LENGTH_V23	0x1b
+#define SMBIOS_TYPE17_LENGTH_V26	0x1c
+#define SMBIOS_TYPE17_LENGTH_V27	0x22
+#define SMBIOS_TYPE17_LENGTH_V28	0x28
+#define SMBIOS_TYPE17_LENGTH_V32	0x54
+#define SMBIOS_TYPE17_LENGTH_V33	0x5c
+
+#define SMBIOS_TYPE19_LENGTH_V21	0x0f
+#define SMBIOS_TYPE19_LENGTH_V27	0x1f
+
 struct __packed smbios_type1 {
 	struct smbios_header hdr;
 	u8 manufacturer;
Signature · 1 line
2.25.1
#7 lore raw
In reply to Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

Regards,
Raymond

Quoted 40 lines · Raymond Mao

This series finish the last missing puzzle of required SMBIOS types by:
1) Fixing duplicated handles when multiple instances exist in one type;
2) Implementing the rest of required types 9/16/17/19;
3) Adding version control when printing properties for all types.

Type 9/16/17/19 are generally DT-based, the idea is to write these tables using a hybrid approach:
Explicit DT definitions under existing '/smbios/smbios' take precedence, with fallback to scan and interpret values from the entire DT.

Moreover, all below APIs:
smbios_get_val_si()
smbios_get_u64_si()
smbios_add_prop_si()
are on top of sysinfo, thus allow vendors to get values from other subsystems by implementing their own sysinfo driver if needed.

Raymond Mao (6):
smbios: Fix duplicated smbios handles
smbios: add support for dynamic generation of Type 9 system slot
tables
smbios: add support for dynamic generation of Type 16 table
smbios: add support for dynamic generation of Type 17 table
smbios: add support for dynamic generation of Type 19 table
smbios: print the properties only when they exist in a specified
version of spec

 arch/arm/dts/smbios_generic.dtsi |   12 +
 cmd/smbios.c                     |  365 +++++++++-
 drivers/sysinfo/smbios.c         |    5 +
 include/smbios.h                 |  151 ++++
 include/smbios_def.h             |  250 +++++++
 include/sysinfo.h                |    4 +
 lib/smbios.c                     | 1152 +++++++++++++++++++++++++++++-
 7 files changed, 1906 insertions(+), 33 deletions(-)

--
2.25.1

#8 lore raw
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

Signature · 1 line
Tom
#9 lore raw

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom

#10 lore raw

Hi Ilias,

Quoted 43 lines · Ilias Apalodimas

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Quoted 3 lines

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

I just retested it by below qemu cmd after I rebased it to the current master:
qemu-system-aarch64 -bios u-boot.bin -machine virt -cpu cortex-a57 -m 2G -nographic

Below is the type17 I got:

```
Handle 0x0008, DMI type 17, 104 bytes at 0xbe678141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```

If you didn't use smbios_generic.dtsi to insert new nodes, or add new 'memory@' / 'memory-controller@' nodes into your DT, you should get the same result as mine by default.
If you still can not get it, can you give me your build instruction and qemu cmd for reproducing?

Regards,
Raymond

Quoted 16 lines

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom

#11 lore raw
Quoted 101 lines · Raymond Mao

Hi Ilias,

Quoted 43 lines · Ilias Apalodimas

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Quoted 3 lines

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

I just retested it by below qemu cmd after I rebased it to the current master:
qemu-system-aarch64 -bios u-boot.bin -machine virt -cpu cortex-a57 -m 2G -nographic

Below is the type17 I got:

```
Handle 0x0008, DMI type 17, 104 bytes at 0xbe678141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```
Quoted 5 lines

If you didn't use smbios_generic.dtsi to insert new nodes, or add new 'memory@' / 'memory-controller@' nodes into your DT, you should get the same result as mine by default.
If you still can not get it, can you give me your build instruction and qemu cmd for reproducing?

I used qemu_arm64_lwip_defconfig

qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm -device
tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive
id=os,if=none,file=../debian.qcow2 -device virtio-blk-device,drive=os
is the command line

Cheers
/Ilias

Quoted 21 lines

Regards,
Raymond

Quoted 16 lines

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom

#12 lore raw

Hi Ilias

Quoted 111 lines · Ilias Apalodimas
Quoted 101 lines · Raymond Mao

Hi Ilias,

Quoted 43 lines · Ilias Apalodimas

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Quoted 3 lines

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

I just retested it by below qemu cmd after I rebased it to the current master:
qemu-system-aarch64 -bios u-boot.bin -machine virt -cpu cortex-a57 -m 2G -nographic

Below is the type17 I got:

```
Handle 0x0008, DMI type 17, 104 bytes at 0xbe678141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```
Quoted 5 lines

If you didn't use smbios_generic.dtsi to insert new nodes, or add new 'memory@' / 'memory-controller@' nodes into your DT, you should get the same result as mine by default.
If you still can not get it, can you give me your build instruction and qemu cmd for reproducing?

I used qemu_arm64_lwip_defconfig

Quoted 9 lines

qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm -device
tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive
id=os,if=none,file=../debian.qcow2 -device virtio-blk-device,drive=os
is the command line

I did these steps with a clean build (exactly the same as your ones):

$ make O=out_lwip qemu_arm64_lwip_defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make O=out_lwip -j4 all
$ cd out_lwip
$ killall swtpm
$ rm -rf /tmp/mytpm1
$ mkdir -p /tmp/mytpm1
$ swtpm_setup --tpmstate /tmp/mytpm1 --tpm2 --pcr-banks sha256
$ swtpm socket --tpmstate dir=/tmp/mytpm1 --ctrl
type=unixio,path=/tmp/mytpm1/swtpm-sock --log level=40 --tpm2 -t -d
$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive id=os,if=none,file=../debian.qcow2
-device virtio-blk-device,drive=os

SMBIOS type17 shows no difference:

```
Handle 0x0008, DMI type 17, 104 bytes at 0x7e64b141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```

By the way, I don't think it has any relationship with swtpm and the linux distro, so I also simply tried:

$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin

All works with the same type17 output.

Regards,
Raymond

Quoted 25 lines

Cheers
/Ilias

Quoted 21 lines

Regards,
Raymond

Quoted 16 lines

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom

#13 lore raw

That's weird.

I tried again on -next and got this
Handle 0x0006, DMI type 9, 24 bytes
System Slot Information
Designation: Not Specified
Type: Unknown
Data Bus Width: Unknown
Current Usage: Unknown
Length: Unknown
Characteristics: Unknown
Bus Address: 0000:00:00.0
Data Bus Width (Base): 0
Peer Devices: 0
Height: Not applicable

Handle 0x0007, DMI type 16, 23 bytes
Physical Memory Array
Location: Unknown
Use: Unknown
Error Correction Type: Unknown
Maximum Capacity: 0 kB
Error Information Handle: Not Provided
Number Of Devices: 1

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided
Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column Pseudo-static RAMBus Synchronous

Handle 0x0009, DMI type 19, 31 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x000000003FF
Range Size: 1 kB
Physical Array Handle: 0x0000
Partition Width: 1

Handle 0x000A, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected

I am using a debian unstable with a 6.18 kernel

Cheers
/Ilias

Quoted 223 lines · Raymond Mao

Hi Ilias

Quoted 111 lines · Ilias Apalodimas
Quoted 101 lines · Raymond Mao

Hi Ilias,

Quoted 43 lines · Ilias Apalodimas

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Quoted 3 lines

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

I just retested it by below qemu cmd after I rebased it to the current master:
qemu-system-aarch64 -bios u-boot.bin -machine virt -cpu cortex-a57 -m 2G -nographic

Below is the type17 I got:

```
Handle 0x0008, DMI type 17, 104 bytes at 0xbe678141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```
Quoted 5 lines

If you didn't use smbios_generic.dtsi to insert new nodes, or add new 'memory@' / 'memory-controller@' nodes into your DT, you should get the same result as mine by default.
If you still can not get it, can you give me your build instruction and qemu cmd for reproducing?

I used qemu_arm64_lwip_defconfig

Quoted 9 lines

qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm -device
tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive
id=os,if=none,file=../debian.qcow2 -device virtio-blk-device,drive=os
is the command line

I did these steps with a clean build (exactly the same as your ones):

$ make O=out_lwip qemu_arm64_lwip_defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make O=out_lwip -j4 all
$ cd out_lwip
$ killall swtpm
$ rm -rf /tmp/mytpm1
$ mkdir -p /tmp/mytpm1
$ swtpm_setup --tpmstate /tmp/mytpm1 --tpm2 --pcr-banks sha256
$ swtpm socket --tpmstate dir=/tmp/mytpm1 --ctrl
type=unixio,path=/tmp/mytpm1/swtpm-sock --log level=40 --tpm2 -t -d
$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
(quoted diff) +0 -3
-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive id=os,if=none,file=../debian.qcow2
-device virtio-blk-device,drive=os

SMBIOS type17 shows no difference:

```
Handle 0x0008, DMI type 17, 104 bytes at 0x7e64b141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```

By the way, I don't think it has any relationship with swtpm and the linux distro, so I also simply tried:

$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin

All works with the same type17 output.

Regards,
Raymond

Quoted 25 lines

Cheers
/Ilias

Quoted 21 lines

Regards,
Raymond

Quoted 16 lines

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom

#14 lore raw

Hi Ilias,

Quoted 49 lines · Ilias Apalodimas

That's weird.

I tried again on -next and got this
Handle 0x0006, DMI type 9, 24 bytes
System Slot Information
Designation: Not Specified
Type: Unknown
Data Bus Width: Unknown
Current Usage: Unknown
Length: Unknown
Characteristics: Unknown
Bus Address: 0000:00:00.0
Data Bus Width (Base): 0
Peer Devices: 0
Height: Not applicable

Handle 0x0007, DMI type 16, 23 bytes
Physical Memory Array
Location: Unknown
Use: Unknown
Error Correction Type: Unknown
Maximum Capacity: 0 kB
Error Information Handle: Not Provided
Number Of Devices: 1

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided
Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column Pseudo-static RAMBus Synchronous

Handle 0x0009, DMI type 19, 31 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x000000003FF
Range Size: 1 kB
Physical Array Handle: 0x0000
Partition Width: 1

Quoted 6 lines

Handle 0x000A, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected

I am using a debian unstable with a 6.18 kernel

It looks that your log is not in a correct format, each header should start with:
'Handle <handle_id>, DMI type <type_num>, <size> bytes at <address>' But your one is missing 'at <address>'.

How did you test it and get it printed? Are you using 'smbios' cmd in the u-boot console?
Do you mind sharing your remote working branch, so that I can have a cross-check?

Regards,
Raymond

Quoted 227 lines

Cheers
/Ilias

Quoted 223 lines · Raymond Mao

Hi Ilias

Quoted 111 lines · Ilias Apalodimas
Quoted 101 lines · Raymond Mao

Hi Ilias,

Quoted 43 lines · Ilias Apalodimas

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Quoted 3 lines

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

I just retested it by below qemu cmd after I rebased it to the current master:
qemu-system-aarch64 -bios u-boot.bin -machine virt -cpu cortex-a57 -m 2G -nographic

Below is the type17 I got:

```
Handle 0x0008, DMI type 17, 104 bytes at 0xbe678141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```
Quoted 5 lines

If you didn't use smbios_generic.dtsi to insert new nodes, or add new 'memory@' / 'memory-controller@' nodes into your DT, you should get the same result as mine by default.
If you still can not get it, can you give me your build instruction and qemu cmd for reproducing?

I used qemu_arm64_lwip_defconfig

Quoted 9 lines

qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm -device
tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive
id=os,if=none,file=../debian.qcow2 -device virtio-blk-device,drive=os
is the command line

I did these steps with a clean build (exactly the same as your ones):

$ make O=out_lwip qemu_arm64_lwip_defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make O=out_lwip -j4 all
$ cd out_lwip
$ killall swtpm
$ rm -rf /tmp/mytpm1
$ mkdir -p /tmp/mytpm1
$ swtpm_setup --tpmstate /tmp/mytpm1 --tpm2 --pcr-banks sha256
$ swtpm socket --tpmstate dir=/tmp/mytpm1 --ctrl
type=unixio,path=/tmp/mytpm1/swtpm-sock --log level=40 --tpm2 -t -d
$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
(quoted diff) +0 -3
-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive id=os,if=none,file=../debian.qcow2
-device virtio-blk-device,drive=os

SMBIOS type17 shows no difference:

```
Handle 0x0008, DMI type 17, 104 bytes at 0x7e64b141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```

By the way, I don't think it has any relationship with swtpm and the linux distro, so I also simply tried:

$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin

All works with the same type17 output.

Regards,
Raymond

Quoted 25 lines

Cheers
/Ilias

Quoted 21 lines

Regards,
Raymond

Quoted 16 lines

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom

#15 lore raw
Quoted 61 lines · Raymond Mao

Hi Ilias,

Quoted 49 lines · Ilias Apalodimas

That's weird.

I tried again on -next and got this
Handle 0x0006, DMI type 9, 24 bytes
System Slot Information
Designation: Not Specified
Type: Unknown
Data Bus Width: Unknown
Current Usage: Unknown
Length: Unknown
Characteristics: Unknown
Bus Address: 0000:00:00.0
Data Bus Width (Base): 0
Peer Devices: 0
Height: Not applicable

Handle 0x0007, DMI type 16, 23 bytes
Physical Memory Array
Location: Unknown
Use: Unknown
Error Correction Type: Unknown
Maximum Capacity: 0 kB
Error Information Handle: Not Provided
Number Of Devices: 1

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided
Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column Pseudo-static RAMBus Synchronous

Handle 0x0009, DMI type 19, 31 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x000000003FF
Range Size: 1 kB
Physical Array Handle: 0x0000
Partition Width: 1

Quoted 6 lines

Handle 0x000A, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected

I am using a debian unstable with a 6.18 kernel

Quoted 7 lines

It looks that your log is not in a correct format, each header should start with:
'Handle <handle_id>, DMI type <type_num>, <size> bytes at <address>' But your one is missing 'at <address>'.

How did you test it and get it printed? Are you using 'smbios' cmd in the u-boot console?

No, that's probably the difference. I am booting to linux and test with 'dmidecode'

Quoted 2 lines

Do you mind sharing your remote working branch, so that I can have a cross-check?

I don't but it's really just the -next branch with your patches. I think the difference is u-boots tool vs linux

Regards
/Ilias

Quoted 232 lines

Regards,
Raymond

Quoted 227 lines

Cheers
/Ilias

Quoted 223 lines · Raymond Mao

Hi Ilias

Quoted 111 lines · Ilias Apalodimas
Quoted 101 lines · Raymond Mao

Hi Ilias,

Quoted 43 lines · Ilias Apalodimas

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Quoted 3 lines

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

I just retested it by below qemu cmd after I rebased it to the current master:
qemu-system-aarch64 -bios u-boot.bin -machine virt -cpu cortex-a57 -m 2G -nographic

Below is the type17 I got:

```
Handle 0x0008, DMI type 17, 104 bytes at 0xbe678141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```
Quoted 5 lines

If you didn't use smbios_generic.dtsi to insert new nodes, or add new 'memory@' / 'memory-controller@' nodes into your DT, you should get the same result as mine by default.
If you still can not get it, can you give me your build instruction and qemu cmd for reproducing?

I used qemu_arm64_lwip_defconfig

Quoted 9 lines

qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm -device
tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive
id=os,if=none,file=../debian.qcow2 -device virtio-blk-device,drive=os
is the command line

I did these steps with a clean build (exactly the same as your ones):

$ make O=out_lwip qemu_arm64_lwip_defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make O=out_lwip -j4 all
$ cd out_lwip
$ killall swtpm
$ rm -rf /tmp/mytpm1
$ mkdir -p /tmp/mytpm1
$ swtpm_setup --tpmstate /tmp/mytpm1 --tpm2 --pcr-banks sha256
$ swtpm socket --tpmstate dir=/tmp/mytpm1 --ctrl
type=unixio,path=/tmp/mytpm1/swtpm-sock --log level=40 --tpm2 -t -d
$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
(quoted diff) +0 -3
-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive id=os,if=none,file=../debian.qcow2
-device virtio-blk-device,drive=os

SMBIOS type17 shows no difference:

```
Handle 0x0008, DMI type 17, 104 bytes at 0x7e64b141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```

By the way, I don't think it has any relationship with swtpm and the linux distro, so I also simply tried:

$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin

All works with the same type17 output.

Regards,
Raymond

Quoted 25 lines

Cheers
/Ilias

Quoted 21 lines

Regards,
Raymond

Quoted 16 lines

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom

#16 lore raw

Hi Ilias,

Quoted 68 lines · Ilias Apalodimas
Quoted 66 lines · Raymond Mao

Hi Ilias,

Quoted 49 lines · Ilias Apalodimas

That's weird.

I tried again on -next and got this
Handle 0x0006, DMI type 9, 24 bytes
System Slot Information
Designation: Not Specified
Type: Unknown
Data Bus Width: Unknown
Current Usage: Unknown
Length: Unknown
Characteristics: Unknown
Bus Address: 0000:00:00.0
Data Bus Width (Base): 0
Peer Devices: 0
Height: Not applicable

Handle 0x0007, DMI type 16, 23 bytes
Physical Memory Array
Location: Unknown
Use: Unknown
Error Correction Type: Unknown
Maximum Capacity: 0 kB
Error Information Handle: Not Provided
Number Of Devices: 1

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided
Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column Pseudo-static RAMBus Synchronous

Handle 0x0009, DMI type 19, 31 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x000000003FF
Range Size: 1 kB
Physical Array Handle: 0x0000
Partition Width: 1

Quoted 6 lines

Handle 0x000A, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected

I am using a debian unstable with a 6.18 kernel

It looks that your log is not in a correct format, each header should start with:
'Handle <handle_id>, DMI type <type_num>, <size> bytes at <address>' But your one is missing 'at <address>'.

Quoted 6 lines
Quoted 2 lines

How did you test it and get it printed? Are you using 'smbios' cmd in the u-boot console?

No, that's probably the difference. I am booting to linux and test with 'dmidecode'

I think I know the cause now, your dmidecode tool does not fully follow the spec DSP0134, or it might be an old version. Take "Form Factor: <OUT OF SPEC>" for example:
By default, this should be "unknown", and according to the spec (3.9.0) - "unknown" equals to 2.
In the u-boot console, this is decoded properly with my patch series:
"Form Factor: Unknown", which matches the definition in the code "#define SMBIOS_MD_FF_UNKNOWN 2".
But dmidecode shows "OUT OF SPEC", which means it does not support "2", or by an incorrect decoding.

What is your dmidecode version?

Regards,
Raymond

Quoted 240 lines
Quoted 2 lines

Do you mind sharing your remote working branch, so that I can have a cross-check?

I don't but it's really just the -next branch with your patches. I think the difference is u-boots tool vs linux

Regards
/Ilias

Quoted 232 lines

Regards,
Raymond

Quoted 227 lines

Cheers
/Ilias

Quoted 223 lines · Raymond Mao

Hi Ilias

Quoted 111 lines · Ilias Apalodimas
Quoted 101 lines · Raymond Mao

Hi Ilias,

Quoted 43 lines · Ilias Apalodimas

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Quoted 3 lines

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

I just retested it by below qemu cmd after I rebased it to the current master:
qemu-system-aarch64 -bios u-boot.bin -machine virt -cpu cortex-a57 -m 2G -nographic

Below is the type17 I got:

```
Handle 0x0008, DMI type 17, 104 bytes at 0xbe678141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```
Quoted 5 lines

If you didn't use smbios_generic.dtsi to insert new nodes, or add new 'memory@' / 'memory-controller@' nodes into your DT, you should get the same result as mine by default.
If you still can not get it, can you give me your build instruction and qemu cmd for reproducing?

I used qemu_arm64_lwip_defconfig

Quoted 9 lines

qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm -device
tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive
id=os,if=none,file=../debian.qcow2 -device virtio-blk-device,drive=os
is the command line

I did these steps with a clean build (exactly the same as your ones):

$ make O=out_lwip qemu_arm64_lwip_defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make O=out_lwip -j4 all
$ cd out_lwip
$ killall swtpm
$ rm -rf /tmp/mytpm1
$ mkdir -p /tmp/mytpm1
$ swtpm_setup --tpmstate /tmp/mytpm1 --tpm2 --pcr-banks sha256
$ swtpm socket --tpmstate dir=/tmp/mytpm1 --ctrl
type=unixio,path=/tmp/mytpm1/swtpm-sock --log level=40 --tpm2 -t -d
$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
(quoted diff) +0 -3
-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive id=os,if=none,file=../debian.qcow2
-device virtio-blk-device,drive=os

SMBIOS type17 shows no difference:

```
Handle 0x0008, DMI type 17, 104 bytes at 0x7e64b141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```

By the way, I don't think it has any relationship with swtpm and the linux distro, so I also simply tried:

$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin

All works with the same type17 output.

Regards,
Raymond

Quoted 25 lines

Cheers
/Ilias

Quoted 21 lines

Regards,
Raymond

Quoted 16 lines

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom

#17 lore raw

[...]

Quoted 27 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

I am using a debian unstable with a 6.18 kernel

It looks that your log is not in a correct format, each header should start with:
'Handle <handle_id>, DMI type <type_num>, <size> bytes at <address>' But your one is missing 'at <address>'.

Quoted 6 lines
Quoted 2 lines

How did you test it and get it printed? Are you using 'smbios' cmd in the u-boot console?

No, that's probably the difference. I am booting to linux and test with 'dmidecode'

I think I know the cause now, your dmidecode tool does not fully follow the spec DSP0134, or it might be an old version. Take "Form Factor: <OUT OF SPEC>" for example:
By default, this should be "unknown", and according to the spec (3.9.0) - "unknown" equals to 2.
In the u-boot console, this is decoded properly with my patch series:
"Form Factor: Unknown", which matches the definition in the code "#define SMBIOS_MD_FF_UNKNOWN 2".
But dmidecode shows "OUT OF SPEC", which means it does not support "2", or by an incorrect decoding.

Quoted 1 line

What is your dmidecode version?

$ dmidecode --version
3.6

it's the default debian unstable version

Cheers
/Ilias

Quoted 245 lines

Regards,
Raymond

Quoted 240 lines
Quoted 2 lines

Do you mind sharing your remote working branch, so that I can have a cross-check?

I don't but it's really just the -next branch with your patches. I think the difference is u-boots tool vs linux

Regards
/Ilias

Quoted 232 lines

Regards,
Raymond

Quoted 227 lines

Cheers
/Ilias

Quoted 223 lines · Raymond Mao

Hi Ilias

Quoted 111 lines · Ilias Apalodimas
Quoted 101 lines · Raymond Mao

Hi Ilias,

Quoted 43 lines · Ilias Apalodimas

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Quoted 3 lines

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

I just retested it by below qemu cmd after I rebased it to the current master:
qemu-system-aarch64 -bios u-boot.bin -machine virt -cpu cortex-a57 -m 2G -nographic

Below is the type17 I got:

```
Handle 0x0008, DMI type 17, 104 bytes at 0xbe678141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```
Quoted 5 lines

If you didn't use smbios_generic.dtsi to insert new nodes, or add new 'memory@' / 'memory-controller@' nodes into your DT, you should get the same result as mine by default.
If you still can not get it, can you give me your build instruction and qemu cmd for reproducing?

I used qemu_arm64_lwip_defconfig

Quoted 9 lines

qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm -device
tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive
id=os,if=none,file=../debian.qcow2 -device virtio-blk-device,drive=os
is the command line

I did these steps with a clean build (exactly the same as your ones):

$ make O=out_lwip qemu_arm64_lwip_defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make O=out_lwip -j4 all
$ cd out_lwip
$ killall swtpm
$ rm -rf /tmp/mytpm1
$ mkdir -p /tmp/mytpm1
$ swtpm_setup --tpmstate /tmp/mytpm1 --tpm2 --pcr-banks sha256
$ swtpm socket --tpmstate dir=/tmp/mytpm1 --ctrl
type=unixio,path=/tmp/mytpm1/swtpm-sock --log level=40 --tpm2 -t -d
$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
(quoted diff) +0 -3
-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive id=os,if=none,file=../debian.qcow2
-device virtio-blk-device,drive=os

SMBIOS type17 shows no difference:

```
Handle 0x0008, DMI type 17, 104 bytes at 0x7e64b141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```

By the way, I don't think it has any relationship with swtpm and the linux distro, so I also simply tried:

$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin

All works with the same type17 output.

Regards,
Raymond

Quoted 25 lines

Cheers
/Ilias

Quoted 21 lines

Regards,
Raymond

Quoted 16 lines

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom

#18 lore raw

Hi Ilias,

Quoted 30 lines · Ilias Apalodimas

[...]

Quoted 27 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

I am using a debian unstable with a 6.18 kernel

It looks that your log is not in a correct format, each header should start with:
'Handle <handle_id>, DMI type <type_num>, <size> bytes at <address>' But your one is missing 'at <address>'.

Quoted 6 lines
Quoted 2 lines

How did you test it and get it printed? Are you using 'smbios' cmd in the u-boot console?

No, that's probably the difference. I am booting to linux and test with 'dmidecode'

I think I know the cause now, your dmidecode tool does not fully follow the spec DSP0134, or it might be an old version. Take "Form Factor: <OUT OF SPEC>" for example:
By default, this should be "unknown", and according to the spec (3.9.0) - "unknown" equals to 2.
In the u-boot console, this is decoded properly with my patch series:
"Form Factor: Unknown", which matches the definition in the code "#define SMBIOS_MD_FF_UNKNOWN 2".
But dmidecode shows "OUT OF SPEC", which means it does not support "2", or by an incorrect decoding.

Quoted 7 lines
Quoted 1 line

What is your dmidecode version?

$ dmidecode --version
3.6

it's the default debian unstable version

Thanks a lot for the testing and patience through this long debug section. I am able to reproduce the issue using dmidecode v3.6, and found type17 structure is mis-aligned.
U-boot console is using its native structure, thus it cannot reproduce the same problem.
I fixed it and posted v6 at:
https://lore.kernel.org/u-boot/[email protected]/T/#t
Tested with dmidecode v3.6 under debian and type17 looks fine now.

Thanks and regards,
Raymond

Quoted 247 lines

Cheers
/Ilias

Quoted 245 lines

Regards,
Raymond

Quoted 240 lines
Quoted 2 lines

Do you mind sharing your remote working branch, so that I can have a cross-check?

I don't but it's really just the -next branch with your patches. I think the difference is u-boots tool vs linux

Regards
/Ilias

Quoted 232 lines

Regards,
Raymond

Quoted 227 lines

Cheers
/Ilias

Quoted 223 lines · Raymond Mao

Hi Ilias

Quoted 111 lines · Ilias Apalodimas
Quoted 101 lines · Raymond Mao

Hi Ilias,

Quoted 43 lines · Ilias Apalodimas

Hi all,

Apologies for the late reply.

I did test the patches but I see something weird on smbios type 17.

Handle 0x0008, DMI type 17, 104 bytes
Memory Device
Array Handle: 0x0000
Error Information Handle: Not Provided Total Width: Unknown
Data Width: Unknown
Size: No Module Installed
Form Factor: <OUT OF SPEC>
Set: None
Locator: <BAD INDEX>
Bank Locator: <BAD INDEX>
Type: Unknown
Type Detail: Other Unknown Fast-paged Static Column
Pseudo-static RAMBus Synchronous
Speed: 512 MT/s
Manufacturer: <BAD INDEX>
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Technology: <OUT OF SPEC>
Memory Operating Mode Capability: None Firmware Version: Not Specified
Module Manufacturer ID: Bank 3, Hex 0x04 Module Product ID: Unknown
Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: 16383 PB
Volatile Size: Unknown
Cache Size: Unknown
Logical Size: Unknown

Quoted 3 lines

Any idea what <BAD INDEX> and <OUT OF SPEC> represent? I tested this in QEMU

I just retested it by below qemu cmd after I rebased it to the current master:
qemu-system-aarch64 -bios u-boot.bin -machine virt -cpu cortex-a57 -m 2G -nographic

Below is the type17 I got:

```
Handle 0x0008, DMI type 17, 104 bytes at 0xbe678141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```
Quoted 5 lines

If you didn't use smbios_generic.dtsi to insert new nodes, or add new 'memory@' / 'memory-controller@' nodes into your DT, you should get the same result as mine by default.
If you still can not get it, can you give me your build instruction and qemu cmd for reproducing?

I used qemu_arm64_lwip_defconfig

Quoted 9 lines

qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm -device
tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive
id=os,if=none,file=../debian.qcow2 -device virtio-blk-device,drive=os
is the command line

I did these steps with a clean build (exactly the same as your ones):

$ make O=out_lwip qemu_arm64_lwip_defconfig
$ CROSS_COMPILE=aarch64-none-linux-gnu- make O=out_lwip -j4 all
$ cd out_lwip
$ killall swtpm
$ rm -rf /tmp/mytpm1
$ mkdir -p /tmp/mytpm1
$ swtpm_setup --tpmstate /tmp/mytpm1 --tpm2 --pcr-banks sha256
$ swtpm socket --tpmstate dir=/tmp/mytpm1 --ctrl
type=unixio,path=/tmp/mytpm1/swtpm-sock --log level=40 --tpm2 -t -d
$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin -chardev
socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
(quoted diff) +0 -3
-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0 \
-device virtio-rng-pci -drive id=os,if=none,file=../debian.qcow2
-device virtio-blk-device,drive=os

SMBIOS type17 shows no difference:

```
Handle 0x0008, DMI type 17, 104 bytes at 0x7e64b141
Memory Device:
Physical Memory Array Handle: 0x0000
Memory Error Information Handle: 0xfffe
Total Width: 0x0000
Data Width: 0x0000
Size: 0xffff
Form Factor: Unknown
Device Set: 0x00ff
Device Locator:
Bank Locator:
Memory Type: Unknown
Type Detail: 0x0004
Speed: 0x0000
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Attributes: 0x0000
Extended Size: 0x00000000
Configured Memory Speed: 0x0000
Minimum voltage: 0x0000
Maximum voltage: 0x0000
Configured voltage: 0x0000
Memory Technology: Unknown
Memory Operating Mode Capability: 0x0004
Firmware Version:
Module Manufacturer ID: 0x0000
Module Product ID: 0x0000
Memory Subsystem Controller Manufacturer ID: 0x0000
Memory Subsystem Controller Product ID: 0x0000
Non-volatile Size: 0xffffffffffffffff
Volatile Size: 0xffffffffffffffff
Cache Size: 0xffffffffffffffff
Logical Size: 0xffffffffffffffff
Extended Speed: 0x0000
Extended Configured Memory Speed: 0x0000
PMIC0 Manufacturer ID: 0x0000
PMIC0 Revision Number: 0x0000
RCD Manufacturer ID: 0x0000
RCD Revision Number: 0x0000
```

By the way, I don't think it has any relationship with swtpm and the linux distro, so I also simply tried:

$ qemu-system-aarch64 -m 1024 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off -bios u-boot.bin

All works with the same type17 output.

Regards,
Raymond

Quoted 25 lines

Cheers
/Ilias

Quoted 21 lines

Regards,
Raymond

Quoted 16 lines

Regards
/Ilias

Quoted 12 lines · Tom Rini
Quoted 4 lines · Raymond Mao

Hi,

Anyone have a chance to review this patch set? It is the last piece of work to support all required SMBIOS types in U-Boot.

I've been waiting for Ilias or Heinrich to have time to look at this.

--
Tom