Blame SOURCES/0014-dmidecode-Add-helper-function-pr_attr.patch

fc71ac
From 07968a8a578d34137eb6db0c26b860c567f60903 Mon Sep 17 00:00:00 2001
fc71ac
From: Jean Delvare <jdelvare@suse.de>
fc71ac
Date: Wed, 1 Apr 2020 09:52:04 +0200
fc71ac
Subject: [PATCH 14/23] dmidecode: Add helper function pr_attr
fc71ac
fc71ac
Print all first-level attributes through a helper function pr_attr.
fc71ac
fc71ac
Signed-off-by: Jean Delvare <jdelvare@suse.de>
fc71ac
---
fc71ac
 dmidecode.c | 1357 ++++++++++++++++++++++++---------------------------
fc71ac
 dmioem.c    |   66 +--
fc71ac
 dmioutput.c |   12 +
fc71ac
 dmioutput.h |    1 +
fc71ac
 4 files changed, 691 insertions(+), 745 deletions(-)
fc71ac
fc71ac
diff --git a/dmidecode.c b/dmidecode.c
fc71ac
index c226bad06638..7ab058b61ef0 100644
fc71ac
--- a/dmidecode.c
fc71ac
+++ b/dmidecode.c
fc71ac
@@ -261,7 +261,7 @@ static void dmi_dump(const struct dmi_header *h, const char *prefix)
fc71ac
 }
fc71ac
 
fc71ac
 /* shift is 0 if the value is in bytes, 1 if it is in kilobytes */
fc71ac
-static void dmi_print_memory_size(u64 code, int shift)
fc71ac
+static void dmi_print_memory_size(const char *attr, u64 code, int shift)
fc71ac
 {
fc71ac
 	unsigned long capacity;
fc71ac
 	u16 split[7];
fc71ac
@@ -301,7 +301,7 @@ static void dmi_print_memory_size(u64 code, int shift)
fc71ac
 	else
fc71ac
 		capacity = split[i];
fc71ac
 
fc71ac
-	printf(" %lu %s", capacity, unit[i + shift]);
fc71ac
+	pr_attr(attr, "%lu %s", capacity, unit[i + shift]);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -310,10 +310,19 @@ static void dmi_print_memory_size(u64 code, int shift)
fc71ac
 
fc71ac
 static void dmi_bios_runtime_size(u32 code)
fc71ac
 {
fc71ac
+	const char *format;
fc71ac
+
fc71ac
 	if (code & 0x000003FF)
fc71ac
-		printf(" %u bytes", code);
fc71ac
+	{
fc71ac
+		format = "%u bytes";
fc71ac
+	}
fc71ac
 	else
fc71ac
-		printf(" %u kB", code >> 10);
fc71ac
+	{
fc71ac
+		format = "%u kB";
fc71ac
+		code >>= 10;
fc71ac
+	}
fc71ac
+
fc71ac
+	pr_attr("Runtime Size", format, code);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_bios_rom_size(u8 code1, u16 code2)
fc71ac
@@ -325,10 +334,10 @@ static void dmi_bios_rom_size(u8 code1, u16 code2)
fc71ac
 	if (code1 != 0xFF)
fc71ac
 	{
fc71ac
 		u64 s = { .l = (code1 + 1) << 6 };
fc71ac
-		dmi_print_memory_size(s, 1);
fc71ac
+		dmi_print_memory_size("ROM Size", s, 1);
fc71ac
 	}
fc71ac
 	else
fc71ac
-		printf(" %u %s", code2 & 0x3FFF, unit[code2 >> 14]);
fc71ac
+		pr_attr("ROM Size", "%u %s", code2 & 0x3FFF, unit[code2 >> 14]);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_bios_characteristics(u64 code, const char *prefix)
fc71ac
@@ -426,7 +435,7 @@ static void dmi_bios_characteristics_x2(u8 code, const char *prefix)
fc71ac
  * 7.2 System Information (Type 1)
fc71ac
  */
fc71ac
 
fc71ac
-static void dmi_system_uuid(const u8 *p, u16 ver)
fc71ac
+static void dmi_system_uuid(const char *attr, const u8 *p, u16 ver)
fc71ac
 {
fc71ac
 	int only0xFF = 1, only0x00 = 1;
fc71ac
 	int i;
fc71ac
@@ -439,12 +448,18 @@ static void dmi_system_uuid(const u8 *p, u16 ver)
fc71ac
 
fc71ac
 	if (only0xFF)
fc71ac
 	{
fc71ac
-		printf("Not Present");
fc71ac
+		if (attr)
fc71ac
+			pr_attr(attr, "Not Present");
fc71ac
+		else
fc71ac
+			printf("Not Present\n");
fc71ac
 		return;
fc71ac
 	}
fc71ac
 	if (only0x00)
fc71ac
 	{
fc71ac
-		printf("Not Settable");
fc71ac
+		if (attr)
fc71ac
+			pr_attr(attr, "Not Settable");
fc71ac
+		else
fc71ac
+			printf("Not Settable\n");
fc71ac
 		return;
fc71ac
 	}
fc71ac
 
fc71ac
@@ -457,13 +472,29 @@ static void dmi_system_uuid(const u8 *p, u16 ver)
fc71ac
 	 * for older versions.
fc71ac
 	 */
fc71ac
 	if (ver >= 0x0206)
fc71ac
-		printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
fc71ac
-			p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6],
fc71ac
-			p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
fc71ac
+	{
fc71ac
+		if (attr)
fc71ac
+			pr_attr(attr,
fc71ac
+				"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
fc71ac
+				p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6],
fc71ac
+				p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
fc71ac
+		else
fc71ac
+			printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
fc71ac
+				p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6],
fc71ac
+				p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
fc71ac
+	}
fc71ac
 	else
fc71ac
-		printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
fc71ac
-			p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
fc71ac
-			p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
fc71ac
+	{
fc71ac
+		if (attr)
fc71ac
+			pr_attr(attr,
fc71ac
+				"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
fc71ac
+				p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
fc71ac
+				p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
fc71ac
+		else
fc71ac
+			printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
fc71ac
+				p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
fc71ac
+				p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
fc71ac
+	}
fc71ac
 }
fc71ac
 
fc71ac
 static const char *dmi_system_wake_up_type(u8 code)
fc71ac
@@ -649,17 +680,17 @@ static const char *dmi_chassis_security_status(u8 code)
fc71ac
 static void dmi_chassis_height(u8 code)
fc71ac
 {
fc71ac
 	if (code == 0x00)
fc71ac
-		printf(" Unspecified");
fc71ac
+		pr_attr("Height", "Unspecified");
fc71ac
 	else
fc71ac
-		printf(" %u U", code);
fc71ac
+		pr_attr("Height", "%u U", code);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_chassis_power_cords(u8 code)
fc71ac
 {
fc71ac
 	if (code == 0x00)
fc71ac
-		printf(" Unspecified");
fc71ac
+		pr_attr("Number Of Power Cords", "Unspecified");
fc71ac
 	else
fc71ac
-		printf(" %u", code);
fc71ac
+		pr_attr("Number Of Power Cords", "%u", code);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_chassis_elements(u8 count, u8 len, const u8 *p, const char *prefix)
fc71ac
@@ -1052,8 +1083,8 @@ static void dmi_processor_id(const struct dmi_header *h, const char *prefix)
fc71ac
 	 * This might help learn about new processors supporting the
fc71ac
 	 * CPUID instruction or another form of identification.
fc71ac
 	 */
fc71ac
-	printf("%sID: %02X %02X %02X %02X %02X %02X %02X %02X\n",
fc71ac
-		prefix, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
fc71ac
+	pr_attr("ID", "%02X %02X %02X %02X %02X %02X %02X %02X",
fc71ac
+		p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
fc71ac
 
fc71ac
 	if (type == 0x05) /* 80386 */
fc71ac
 	{
fc71ac
@@ -1061,8 +1092,9 @@ static void dmi_processor_id(const struct dmi_header *h, const char *prefix)
fc71ac
 		/*
fc71ac
 		 * 80386 have a different signature.
fc71ac
 		 */
fc71ac
-		printf("%sSignature: Type %u, Family %u, Major Stepping %u, Minor Stepping %u\n",
fc71ac
-			prefix, dx >> 12, (dx >> 8) & 0xF,
fc71ac
+		pr_attr("Signature",
fc71ac
+			"Type %u, Family %u, Major Stepping %u, Minor Stepping %u",
fc71ac
+			dx >> 12, (dx >> 8) & 0xF,
fc71ac
 			(dx >> 4) & 0xF, dx & 0xF);
fc71ac
 		return;
fc71ac
 	}
fc71ac
@@ -1080,8 +1112,9 @@ static void dmi_processor_id(const struct dmi_header *h, const char *prefix)
fc71ac
 			sig = 1;
fc71ac
 		else
fc71ac
 		{
fc71ac
-			printf("%sSignature: Type %u, Family %u, Model %u, Stepping %u\n",
fc71ac
-				prefix, (dx >> 12) & 0x3, (dx >> 8) & 0xF,
fc71ac
+			pr_attr("Signature",
fc71ac
+				"Type %u, Family %u, Model %u, Stepping %u",
fc71ac
+				(dx >> 12) & 0x3, (dx >> 8) & 0xF,
fc71ac
 				(dx >> 4) & 0xF, dx & 0xF);
fc71ac
 			return;
fc71ac
 		}
fc71ac
@@ -1097,8 +1130,9 @@ static void dmi_processor_id(const struct dmi_header *h, const char *prefix)
fc71ac
 		 */
fc71ac
 		if (midr == 0)
fc71ac
 			return;
fc71ac
-		printf("%sSignature: Implementor 0x%02x, Variant 0x%x, Architecture %u, Part 0x%03x, Revision %u\n",
fc71ac
-			prefix, midr >> 24, (midr >> 20) & 0xF,
fc71ac
+		pr_attr("Signature",
fc71ac
+			"Implementor 0x%02x, Variant 0x%x, Architecture %u, Part 0x%03x, Revision %u",
fc71ac
+			midr >> 24, (midr >> 20) & 0xF,
fc71ac
 			(midr >> 16) & 0xF, (midr >> 4) & 0xFFF, midr & 0xF);
fc71ac
 		return;
fc71ac
 	}
fc71ac
@@ -1153,15 +1187,15 @@ static void dmi_processor_id(const struct dmi_header *h, const char *prefix)
fc71ac
 	switch (sig)
fc71ac
 	{
fc71ac
 		case 1: /* Intel */
fc71ac
-			printf("%sSignature: Type %u, Family %u, Model %u, Stepping %u\n",
fc71ac
-				prefix, (eax >> 12) & 0x3,
fc71ac
+			pr_attr("Signature",
fc71ac
+				"Type %u, Family %u, Model %u, Stepping %u",
fc71ac
+				(eax >> 12) & 0x3,
fc71ac
 				((eax >> 20) & 0xFF) + ((eax >> 8) & 0x0F),
fc71ac
 				((eax >> 12) & 0xF0) + ((eax >> 4) & 0x0F),
fc71ac
 				eax & 0xF);
fc71ac
 			break;
fc71ac
 		case 2: /* AMD, publication #25481 revision 2.28 */
fc71ac
-			printf("%sSignature: Family %u, Model %u, Stepping %u\n",
fc71ac
-				prefix,
fc71ac
+			pr_attr("Signature", "Family %u, Model %u, Stepping %u",
fc71ac
 				((eax >> 8) & 0xF) + (((eax >> 8) & 0xF) == 0xF ? (eax >> 20) & 0xFF : 0),
fc71ac
 				((eax >> 4) & 0xF) | (((eax >> 8) & 0xF) == 0xF ? (eax >> 12) & 0xF0 : 0),
fc71ac
 				eax & 0xF);
fc71ac
@@ -1183,7 +1217,7 @@ static void dmi_processor_id(const struct dmi_header *h, const char *prefix)
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_processor_voltage(u8 code)
fc71ac
+static void dmi_processor_voltage(const char *attr, u8 code)
fc71ac
 {
fc71ac
 	/* 7.5.4 */
fc71ac
 	static const char *voltage[] = {
fc71ac
@@ -1194,25 +1228,47 @@ static void dmi_processor_voltage(u8 code)
fc71ac
 	int i;
fc71ac
 
fc71ac
 	if (code & 0x80)
fc71ac
-		printf(" %.1f V", (float)(code & 0x7f) / 10);
fc71ac
+		pr_attr(attr, "%.1f V", (float)(code & 0x7f) / 10);
fc71ac
 	else if ((code & 0x07) == 0x00)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
 	{
fc71ac
+		char voltage_str[18];
fc71ac
+		int off = 0;
fc71ac
+
fc71ac
 		for (i = 0; i <= 2; i++)
fc71ac
+		{
fc71ac
 			if (code & (1 << i))
fc71ac
-				printf(" %s", voltage[i]);
fc71ac
+			{
fc71ac
+				/* Insert space if not the first value */
fc71ac
+				off += sprintf(voltage_str + off,
fc71ac
+					       off ? " %s" :"%s",
fc71ac
+					       voltage[i]);
fc71ac
+			}
fc71ac
+		}
fc71ac
+		if (off)
fc71ac
+			pr_attr(attr, voltage_str);
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_processor_frequency(const u8 *p)
fc71ac
+static void dmi_processor_frequency(const char *attr, const u8 *p)
fc71ac
 {
fc71ac
 	u16 code = WORD(p);
fc71ac
 
fc71ac
 	if (code)
fc71ac
-		printf("%u MHz", code);
fc71ac
+	{
fc71ac
+		if (attr)
fc71ac
+			pr_attr(attr, "%u MHz", code);
fc71ac
+		else
fc71ac
+			printf("%u MHz\n", code);
fc71ac
+	}
fc71ac
 	else
fc71ac
-		printf("Unknown");
fc71ac
+	{
fc71ac
+		if (attr)
fc71ac
+			pr_attr(attr, "Unknown");
fc71ac
+		else
fc71ac
+			printf("Unknown\n");
fc71ac
+	}
fc71ac
 }
fc71ac
 
fc71ac
 /* code is assumed to be a 3-bit value */
fc71ac
@@ -1303,17 +1359,18 @@ static const char *dmi_processor_upgrade(u8 code)
fc71ac
 	return out_of_spec;
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_processor_cache(u16 code, const char *level, u16 ver)
fc71ac
+static void dmi_processor_cache(const char *attr, u16 code, const char *level,
fc71ac
+				u16 ver)
fc71ac
 {
fc71ac
 	if (code == 0xFFFF)
fc71ac
 	{
fc71ac
 		if (ver >= 0x0203)
fc71ac
-			printf(" Not Provided");
fc71ac
+			pr_attr(attr, "Not Provided");
fc71ac
 		else
fc71ac
-			printf(" No %s Cache", level);
fc71ac
+			pr_attr(attr, "No %s Cache", level);
fc71ac
 	}
fc71ac
 	else
fc71ac
-		printf(" 0x%04X", code);
fc71ac
+		pr_attr(attr, "0x%04X", code);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_processor_characteristics(u16 code, const char *prefix)
fc71ac
@@ -1478,46 +1535,48 @@ static void dmi_memory_module_types(u16 code, const char *sep)
fc71ac
 static void dmi_memory_module_connections(u8 code)
fc71ac
 {
fc71ac
 	if (code == 0xFF)
fc71ac
-		printf(" None");
fc71ac
+		pr_attr("Bank Connections", "None");
fc71ac
+	else if ((code & 0xF0) == 0xF0)
fc71ac
+		pr_attr("Bank Connections", "%u", code & 0x0F);
fc71ac
+	else if ((code & 0x0F) == 0x0F)
fc71ac
+		pr_attr("Bank Connections", "%u", code >> 4);
fc71ac
 	else
fc71ac
-	{
fc71ac
-		if ((code & 0xF0) != 0xF0)
fc71ac
-			printf(" %u", code >> 4);
fc71ac
-		if ((code & 0x0F) != 0x0F)
fc71ac
-			printf(" %u", code & 0x0F);
fc71ac
-	}
fc71ac
+		pr_attr("Bank Connections", "%u %u", code >> 4, code & 0x0F);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_memory_module_speed(u8 code)
fc71ac
+static void dmi_memory_module_speed(const char *attr, u8 code)
fc71ac
 {
fc71ac
 	if (code == 0)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u ns", code);
fc71ac
+		pr_attr(attr, "%u ns", code);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_memory_module_size(u8 code)
fc71ac
+static void dmi_memory_module_size(const char *attr, u8 code)
fc71ac
 {
fc71ac
+	const char *connection;
fc71ac
+
fc71ac
 	/* 7.7.2 */
fc71ac
+	if (code & 0x80)
fc71ac
+		connection = " (Double-bank Connection)";
fc71ac
+	else
fc71ac
+		connection = " (Single-bank Connection)";
fc71ac
+
fc71ac
 	switch (code & 0x7F)
fc71ac
 	{
fc71ac
 		case 0x7D:
fc71ac
-			printf(" Not Determinable");
fc71ac
+			pr_attr(attr, "Not Determinable%s", connection);
fc71ac
 			break;
fc71ac
 		case 0x7E:
fc71ac
-			printf(" Disabled");
fc71ac
+			pr_attr(attr, "Disabled%s", connection);
fc71ac
 			break;
fc71ac
 		case 0x7F:
fc71ac
-			printf(" Not Installed");
fc71ac
+			pr_attr(attr, "Not Installed");
fc71ac
 			return;
fc71ac
 		default:
fc71ac
-			printf(" %u MB", 1 << (code & 0x7F));
fc71ac
+			pr_attr(attr, "%u MB%s", 1 << (code & 0x7F),
fc71ac
+				connection);
fc71ac
 	}
fc71ac
-
fc71ac
-	if (code & 0x80)
fc71ac
-		printf(" (Double-bank Connection)");
fc71ac
-	else
fc71ac
-		printf(" (Single-bank Connection)");
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_memory_module_error(u8 code)
fc71ac
@@ -1530,9 +1589,9 @@ static void dmi_memory_module_error(u8 code)
fc71ac
 	};
fc71ac
 
fc71ac
 	if (code & (1 << 2))
fc71ac
-		printf(" See Event Log\n");
fc71ac
+		pr_attr("Error Status", "See Event Log");
fc71ac
 	else
fc71ac
-		printf(" %s\n", status[code & 0x03]);
fc71ac
+		pr_attr("Error Status", "%s", status[code & 0x03]);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -1564,7 +1623,7 @@ static const char *dmi_cache_location(u8 code)
fc71ac
 	return location[code];
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_cache_size_2(u32 code)
fc71ac
+static void dmi_cache_size_2(const char *attr, u32 code)
fc71ac
 {
fc71ac
 	u64 size;
fc71ac
 
fc71ac
@@ -1581,12 +1640,13 @@ static void dmi_cache_size_2(u32 code)
fc71ac
 	}
fc71ac
 
fc71ac
 	/* Use a more convenient unit for large cache size */
fc71ac
-	dmi_print_memory_size(size, 1);
fc71ac
+	dmi_print_memory_size(attr, size, 1);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_cache_size(u16 code)
fc71ac
+static void dmi_cache_size(const char *attr, u16 code)
fc71ac
 {
fc71ac
-	dmi_cache_size_2((((u32)code & 0x8000LU) << 16) | (code & 0x7FFFLU));
fc71ac
+	dmi_cache_size_2(attr,
fc71ac
+			 (((u32)code & 0x8000LU) << 16) | (code & 0x7FFFLU));
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_cache_types(u16 code, const char *sep)
fc71ac
@@ -1938,16 +1998,16 @@ static const char *dmi_slot_length(u8 code)
fc71ac
 	return out_of_spec;
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_slot_id(u8 code1, u8 code2, u8 type, const char *prefix)
fc71ac
+static void dmi_slot_id(u8 code1, u8 code2, u8 type)
fc71ac
 {
fc71ac
 	/* 7.10.5 */
fc71ac
 	switch (type)
fc71ac
 	{
fc71ac
 		case 0x04: /* MCA */
fc71ac
-			printf("%sID: %u\n", prefix, code1);
fc71ac
+			pr_attr("ID", "%u", code1);
fc71ac
 			break;
fc71ac
 		case 0x05: /* EISA */
fc71ac
-			printf("%sID: %u\n", prefix, code1);
fc71ac
+			pr_attr("ID", "%u", code1);
fc71ac
 			break;
fc71ac
 		case 0x06: /* PCI */
fc71ac
 		case 0x0E: /* PCI */
fc71ac
@@ -1985,10 +2045,10 @@ static void dmi_slot_id(u8 code1, u8 code2, u8 type, const char *prefix)
fc71ac
 		case 0xBB: /* PCI Express 4 */
fc71ac
 		case 0xBC: /* PCI Express 4 */
fc71ac
 		case 0xBD: /* PCI Express 4 */
fc71ac
-			printf("%sID: %u\n", prefix, code1);
fc71ac
+			pr_attr("ID", "%u", code1);
fc71ac
 			break;
fc71ac
 		case 0x07: /* PCMCIA */
fc71ac
-			printf("%sID: Adapter %u, Socket %u\n", prefix, code1, code2);
fc71ac
+			pr_attr("ID", "Adapter %u, Socket %u", code1, code2);
fc71ac
 			break;
fc71ac
 	}
fc71ac
 }
fc71ac
@@ -2031,22 +2091,26 @@ static void dmi_slot_characteristics(u8 code1, u8 code2, const char *prefix)
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_slot_segment_bus_func(u16 code1, u8 code2, u8 code3, const char *prefix)
fc71ac
+static void dmi_slot_segment_bus_func(u16 code1, u8 code2, u8 code3)
fc71ac
 {
fc71ac
 	/* 7.10.8 */
fc71ac
 	if (!(code1 == 0xFFFF && code2 == 0xFF && code3 == 0xFF))
fc71ac
-		printf("%sBus Address: %04x:%02x:%02x.%x\n",
fc71ac
-		       prefix, code1, code2, code3 >> 3, code3 & 0x7);
fc71ac
+		pr_attr("Bus Address", "%04x:%02x:%02x.%x",
fc71ac
+			code1, code2, code3 >> 3, code3 & 0x7);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_slot_peers(u8 n, const u8 *data, const char *prefix)
fc71ac
+static void dmi_slot_peers(u8 n, const u8 *data)
fc71ac
 {
fc71ac
+	char attr[16];
fc71ac
 	int i;
fc71ac
 
fc71ac
 	for (i = 1; i <= n; i++, data += 5)
fc71ac
-		printf("%sPeer Device %d: %04x:%02x:%02x.%x (Width %u)\n",
fc71ac
-		       prefix, i, WORD(data), data[2], data[3] >> 3,
fc71ac
-		       data[3] & 0x07, data[4]);
fc71ac
+	{
fc71ac
+		sprintf(attr, "Peer Device %hu", i);
fc71ac
+		pr_attr(attr, "%04x:%02x:%02x.%x (Width %u)",
fc71ac
+			WORD(data), data[2], data[3] >> 3, data[3] & 0x07,
fc71ac
+			data[4]);
fc71ac
+	}
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -2074,7 +2138,7 @@ static const char *dmi_on_board_devices_type(u8 code)
fc71ac
 	return out_of_spec;
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_on_board_devices(const struct dmi_header *h, const char *prefix)
fc71ac
+static void dmi_on_board_devices(const struct dmi_header *h)
fc71ac
 {
fc71ac
 	u8 *p = h->data + 4;
fc71ac
 	u8 count = (h->length - 0x04) / 2;
fc71ac
@@ -2087,12 +2151,11 @@ static void dmi_on_board_devices(const struct dmi_header *h, const char *prefix)
fc71ac
 		else
fc71ac
 			pr_handle_name("On Board Device %d Information",
fc71ac
 				       i + 1);
fc71ac
-		printf("%s\tType: %s\n",
fc71ac
-			prefix, dmi_on_board_devices_type(p[2 * i] & 0x7F));
fc71ac
-		printf("%s\tStatus: %s\n",
fc71ac
-			prefix, p[2 * i] & 0x80 ? "Enabled" : "Disabled");
fc71ac
-		printf("%s\tDescription: %s\n",
fc71ac
-			prefix, dmi_string(h, p[2 * i + 1]));
fc71ac
+		pr_attr("Type", "%s",
fc71ac
+			dmi_on_board_devices_type(p[2 * i] & 0x7F));
fc71ac
+		pr_attr("Status", "%s",
fc71ac
+			p[2 * i] & 0x80 ? "Enabled" : "Disabled");
fc71ac
+		pr_attr("Description", "%s", dmi_string(h, p[2 * i + 1]));
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
@@ -2100,30 +2163,36 @@ static void dmi_on_board_devices(const struct dmi_header *h, const char *prefix)
fc71ac
  * 7.12 OEM Strings (Type 11)
fc71ac
  */
fc71ac
 
fc71ac
-static void dmi_oem_strings(const struct dmi_header *h, const char *prefix)
fc71ac
+static void dmi_oem_strings(const struct dmi_header *h)
fc71ac
 {
fc71ac
+	char attr[11];
fc71ac
 	u8 *p = h->data + 4;
fc71ac
 	u8 count = p[0x00];
fc71ac
 	int i;
fc71ac
 
fc71ac
 	for (i = 1; i <= count; i++)
fc71ac
-		printf("%sString %d: %s\n",
fc71ac
-			prefix, i, dmi_string(h, i));
fc71ac
+	{
fc71ac
+		sprintf(attr, "String %hu", i);
fc71ac
+		pr_attr(attr, "%s",dmi_string(h, i));
fc71ac
+	}
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
  * 7.13 System Configuration Options (Type 12)
fc71ac
  */
fc71ac
 
fc71ac
-static void dmi_system_configuration_options(const struct dmi_header *h, const char *prefix)
fc71ac
+static void dmi_system_configuration_options(const struct dmi_header *h)
fc71ac
 {
fc71ac
+	char attr[11];
fc71ac
 	u8 *p = h->data + 4;
fc71ac
 	u8 count = p[0x00];
fc71ac
 	int i;
fc71ac
 
fc71ac
 	for (i = 1; i <= count; i++)
fc71ac
-		printf("%sOption %d: %s\n",
fc71ac
-			prefix, i, dmi_string(h, i));
fc71ac
+	{
fc71ac
+		sprintf(attr, "Option %hu", i);
fc71ac
+		pr_attr(attr, "%s",dmi_string(h, i));
fc71ac
+	}
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -2197,7 +2266,7 @@ static void dmi_event_log_status(u8 code)
fc71ac
 		"Full" /* 1 */
fc71ac
 	};
fc71ac
 
fc71ac
-	printf(" %s, %s",
fc71ac
+	pr_attr("Status", "%s, %s",
fc71ac
 		valid[(code >> 0) & 1], full[(code >> 1) & 1]);
fc71ac
 }
fc71ac
 
fc71ac
@@ -2209,16 +2278,17 @@ static void dmi_event_log_address(u8 method, const u8 *p)
fc71ac
 		case 0x00:
fc71ac
 		case 0x01:
fc71ac
 		case 0x02:
fc71ac
-			printf(" Index 0x%04X, Data 0x%04X", WORD(p), WORD(p + 2));
fc71ac
+			pr_attr("Access Address", "Index 0x%04X, Data 0x%04X",
fc71ac
+				WORD(p), WORD(p + 2));
fc71ac
 			break;
fc71ac
 		case 0x03:
fc71ac
-			printf(" 0x%08X", DWORD(p));
fc71ac
+			pr_attr("Access Address", "0x%08X", DWORD(p));
fc71ac
 			break;
fc71ac
 		case 0x04:
fc71ac
-			printf(" 0x%04X", WORD(p));
fc71ac
+			pr_attr("Access Address", "0x%04X", WORD(p));
fc71ac
 			break;
fc71ac
 		default:
fc71ac
-			printf(" Unknown");
fc71ac
+			pr_attr("Access Address", "Unknown");
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
@@ -2295,19 +2365,22 @@ static const char *dmi_event_log_descriptor_format(u8 code)
fc71ac
 	return out_of_spec;
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_event_log_descriptors(u8 count, u8 len, const u8 *p, const char *prefix)
fc71ac
+static void dmi_event_log_descriptors(u8 count, u8 len, const u8 *p)
fc71ac
 {
fc71ac
 	/* 7.16.1 */
fc71ac
+	char attr[16];
fc71ac
 	int i;
fc71ac
 
fc71ac
 	for (i = 0; i < count; i++)
fc71ac
 	{
fc71ac
 		if (len >= 0x02)
fc71ac
 		{
fc71ac
-			printf("%sDescriptor %u: %s\n",
fc71ac
-				prefix, i + 1, dmi_event_log_descriptor_type(p[i * len]));
fc71ac
-			printf("%sData Format %u: %s\n",
fc71ac
-				prefix, i + 1, dmi_event_log_descriptor_format(p[i * len + 1]));
fc71ac
+			sprintf(attr, "Descriptor %hu", i + 1);
fc71ac
+			pr_attr(attr, "%s",
fc71ac
+				dmi_event_log_descriptor_type(p[i * len]));
fc71ac
+			sprintf(attr, "Data Format %hu", i + 1);
fc71ac
+			pr_attr(attr, "%s",
fc71ac
+				dmi_event_log_descriptor_format(p[i * len + 1]));
fc71ac
 		}
fc71ac
 	}
fc71ac
 }
fc71ac
@@ -2385,40 +2458,40 @@ static const char *dmi_memory_array_ec_type(u8 code)
fc71ac
 static void dmi_memory_array_error_handle(u16 code)
fc71ac
 {
fc71ac
 	if (code == 0xFFFE)
fc71ac
-		printf(" Not Provided");
fc71ac
+		pr_attr("Error Information Handle", "Not Provided");
fc71ac
 	else if (code == 0xFFFF)
fc71ac
-		printf(" No Error");
fc71ac
+		pr_attr("Error Information Handle", "No Error");
fc71ac
 	else
fc71ac
-		printf(" 0x%04X", code);
fc71ac
+		pr_attr("Error Information Handle", "0x%04X", code);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
  * 7.18 Memory Device (Type 17)
fc71ac
  */
fc71ac
 
fc71ac
-static void dmi_memory_device_width(u16 code)
fc71ac
+static void dmi_memory_device_width(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	/*
fc71ac
 	 * If no memory module is present, width may be 0
fc71ac
 	 */
fc71ac
 	if (code == 0xFFFF || code == 0)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u bits", code);
fc71ac
+		pr_attr(attr, "%u bits", code);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_memory_device_size(u16 code)
fc71ac
 {
fc71ac
 	if (code == 0)
fc71ac
-		printf(" No Module Installed");
fc71ac
+		pr_attr("Size", "No Module Installed");
fc71ac
 	else if (code == 0xFFFF)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Size", "Unknown");
fc71ac
 	else
fc71ac
 	{
fc71ac
 		u64 s = { .l = code & 0x7FFF };
fc71ac
 		if (!(code & 0x8000))
fc71ac
 			s.l <<= 10;
fc71ac
-		dmi_print_memory_size(s, 1);
fc71ac
+		dmi_print_memory_size("Size", s, 1);
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
@@ -2431,19 +2504,20 @@ static void dmi_memory_device_extended_size(u32 code)
fc71ac
 	 * as an integer without rounding
fc71ac
 	 */
fc71ac
 	if (code & 0x3FFUL)
fc71ac
-		printf(" %lu MB", (unsigned long)code);
fc71ac
+		pr_attr("Size", "%lu MB", (unsigned long)code);
fc71ac
 	else if (code & 0xFFC00UL)
fc71ac
-		printf(" %lu GB", (unsigned long)code >> 10);
fc71ac
+		pr_attr("Size", "%lu GB", (unsigned long)code >> 10);
fc71ac
 	else
fc71ac
-		printf(" %lu TB", (unsigned long)code >> 20);
fc71ac
+		pr_attr("Size", "%lu TB", (unsigned long)code >> 20);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_memory_voltage_value(u16 code)
fc71ac
+static void dmi_memory_voltage_value(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	if (code == 0)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(code % 100 ? " %g V" : " %.1f V", (float)code / 1000);
fc71ac
+		pr_attr(attr, code % 100 ? "%g V" : "%.1f V",
fc71ac
+			(float)code / 1000);
fc71ac
 }
fc71ac
 
fc71ac
 static const char *dmi_memory_device_form_factor(u8 code)
fc71ac
@@ -2476,11 +2550,11 @@ static const char *dmi_memory_device_form_factor(u8 code)
fc71ac
 static void dmi_memory_device_set(u8 code)
fc71ac
 {
fc71ac
 	if (code == 0)
fc71ac
-		printf(" None");
fc71ac
+		pr_attr("Set", "None");
fc71ac
 	else if (code == 0xFF)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Set", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u", code);
fc71ac
+		pr_attr("Set", "%u", code);
fc71ac
 }
fc71ac
 
fc71ac
 static const char *dmi_memory_device_type(u8 code)
fc71ac
@@ -2547,25 +2621,29 @@ static void dmi_memory_device_type_detail(u16 code)
fc71ac
 		"Unbuffered (Unregistered)",
fc71ac
 		"LRDIMM"  /* 15 */
fc71ac
 	};
fc71ac
+	char list[172];		/* Update length if you touch the array above */
fc71ac
 
fc71ac
 	if ((code & 0xFFFE) == 0)
fc71ac
-		printf(" None");
fc71ac
+		pr_attr("Type Detail", "None");
fc71ac
 	else
fc71ac
 	{
fc71ac
-		int i;
fc71ac
+		int i, off = 0;
fc71ac
 
fc71ac
+		list[0] = '\0';
fc71ac
 		for (i = 1; i <= 15; i++)
fc71ac
 			if (code & (1 << i))
fc71ac
-				printf(" %s", detail[i - 1]);
fc71ac
+				off += sprintf(list + off, off ? " %s" : "%s",
fc71ac
+					       detail[i - 1]);
fc71ac
+		pr_attr("Type Detail", list);
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_memory_device_speed(u16 code)
fc71ac
+static void dmi_memory_device_speed(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	if (code == 0)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u MT/s", code);
fc71ac
+		pr_attr(attr, "%u MT/s", code);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_memory_technology(u8 code)
fc71ac
@@ -2581,9 +2659,9 @@ static void dmi_memory_technology(u8 code)
fc71ac
 		"Intel Optane DC persistent memory" /* 0x07 */
fc71ac
 	};
fc71ac
 	if (code >= 0x01 && code <= 0x07)
fc71ac
-		printf(" %s", technology[code - 0x01]);
fc71ac
+		pr_attr("Memory Technology", "%s", technology[code - 0x01]);
fc71ac
 	else
fc71ac
-		printf(" %s", out_of_spec);
fc71ac
+		pr_attr("Memory Technology", "%s", out_of_spec);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_memory_operating_mode_capability(u16 code)
fc71ac
@@ -2596,49 +2674,54 @@ static void dmi_memory_operating_mode_capability(u16 code)
fc71ac
 		"Byte-accessible persistent memory",
fc71ac
 		"Block-accessible persistent memory" /* 5 */
fc71ac
 	};
fc71ac
+	char list[99];		/* Update length if you touch the array above */
fc71ac
 
fc71ac
 	if ((code & 0xFFFE) == 0)
fc71ac
-		printf(" None");
fc71ac
+		pr_attr("Memory Operating Mode Capability", "None");
fc71ac
 	else {
fc71ac
-		int i;
fc71ac
+		int i, off = 0;
fc71ac
 
fc71ac
+		list[0] = '\0';
fc71ac
 		for (i = 1; i <= 5; i++)
fc71ac
 			if (code & (1 << i))
fc71ac
-				printf(" %s", mode[i - 1]);
fc71ac
+				off += sprintf(list + off, off ? " %s" : "%s",
fc71ac
+					       mode[i - 1]);
fc71ac
+		pr_attr("Memory Operating Mode Capability", list);
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_memory_manufacturer_id(u16 code)
fc71ac
+static void dmi_memory_manufacturer_id(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	/* 7.18.8 */
fc71ac
 	/* 7.18.10 */
fc71ac
 	/* LSB is 7-bit Odd Parity number of continuation codes */
fc71ac
 	if (code == 0)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" Bank %d, Hex 0x%02X", (code & 0x7F) + 1, code >> 8);
fc71ac
+		pr_attr(attr, "Bank %d, Hex 0x%02X",
fc71ac
+			(code & 0x7F) + 1, code >> 8);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_memory_product_id(u16 code)
fc71ac
+static void dmi_memory_product_id(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	/* 7.18.9 */
fc71ac
 	/* 7.18.11 */
fc71ac
 	if (code == 0)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" 0x%04X", code);
fc71ac
+		pr_attr(attr, "0x%04X", code);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_memory_size(u64 code)
fc71ac
+static void dmi_memory_size(const char *attr, u64 code)
fc71ac
 {
fc71ac
 	/* 7.18.12 */
fc71ac
 	/* 7.18.13 */
fc71ac
 	if (code.h == 0xFFFFFFFF && code.l == 0xFFFFFFFF)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else if (code.h == 0x0 && code.l == 0x0)
fc71ac
-		printf(" None");
fc71ac
+		pr_attr(attr, "None");
fc71ac
 	else
fc71ac
-		dmi_print_memory_size(code, 0);
fc71ac
+		dmi_print_memory_size(attr, code, 0);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -2704,17 +2787,17 @@ static const char *dmi_memory_error_operation(u8 code)
fc71ac
 static void dmi_memory_error_syndrome(u32 code)
fc71ac
 {
fc71ac
 	if (code == 0x00000000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Vendor Syndrome", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" 0x%08X", code);
fc71ac
+		pr_attr("Vendor Syndrome", "0x%08X", code);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_32bit_memory_error_address(u32 code)
fc71ac
+static void dmi_32bit_memory_error_address(const char *attr, u32 code)
fc71ac
 {
fc71ac
 	if (code == 0x80000000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" 0x%08X", code);
fc71ac
+		pr_attr(attr, "0x%08X", code);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -2724,23 +2807,23 @@ static void dmi_32bit_memory_error_address(u32 code)
fc71ac
 static void dmi_mapped_address_size(u32 code)
fc71ac
 {
fc71ac
 	if (code == 0)
fc71ac
-		printf(" Invalid");
fc71ac
+		pr_attr("Range Size", "Invalid");
fc71ac
 	else
fc71ac
 	{
fc71ac
 		u64 size;
fc71ac
 
fc71ac
 		size.h = 0;
fc71ac
 		size.l = code;
fc71ac
-		dmi_print_memory_size(size, 1);
fc71ac
+		dmi_print_memory_size("Range Size", size, 1);
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_mapped_address_extended_size(u64 start, u64 end)
fc71ac
 {
fc71ac
 	if (start.h == end.h && start.l == end.l)
fc71ac
-		printf(" Invalid");
fc71ac
+		pr_attr("Range Size", "Invalid");
fc71ac
 	else
fc71ac
-		dmi_print_memory_size(u64_range(start, end), 0);
fc71ac
+		dmi_print_memory_size("Range Size", u64_range(start, end), 0);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -2750,36 +2833,32 @@ static void dmi_mapped_address_extended_size(u64 start, u64 end)
fc71ac
 static void dmi_mapped_address_row_position(u8 code)
fc71ac
 {
fc71ac
 	if (code == 0)
fc71ac
-		printf(" %s", out_of_spec);
fc71ac
+		pr_attr("Partition Row Position", "%s", out_of_spec);
fc71ac
 	else if (code == 0xFF)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Partition Row Position", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u", code);
fc71ac
+		pr_attr("Partition Row Position", "%u", code);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_mapped_address_interleave_position(u8 code, const char *prefix)
fc71ac
+static void dmi_mapped_address_interleave_position(u8 code)
fc71ac
 {
fc71ac
 	if (code != 0)
fc71ac
 	{
fc71ac
-		printf("%sInterleave Position:", prefix);
fc71ac
 		if (code == 0xFF)
fc71ac
-			printf(" Unknown");
fc71ac
+			pr_attr("Interleave Position", "Unknown");
fc71ac
 		else
fc71ac
-			printf(" %u", code);
fc71ac
-		printf("\n");
fc71ac
+			pr_attr("Interleave Position", "%u", code);
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_mapped_address_interleaved_data_depth(u8 code, const char *prefix)
fc71ac
+static void dmi_mapped_address_interleaved_data_depth(u8 code)
fc71ac
 {
fc71ac
 	if (code != 0)
fc71ac
 	{
fc71ac
-		printf("%sInterleaved Data Depth:", prefix);
fc71ac
 		if (code == 0xFF)
fc71ac
-			printf(" Unknown");
fc71ac
+			pr_attr("Interleaved Data Depth", "Unknown");
fc71ac
 		else
fc71ac
-			printf(" %u", code);
fc71ac
-		printf("\n");
fc71ac
+			pr_attr("Interleaved Data Depth", "%u", code);
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
@@ -2859,25 +2938,25 @@ static const char *dmi_battery_chemistry(u8 code)
fc71ac
 static void dmi_battery_capacity(u16 code, u8 multiplier)
fc71ac
 {
fc71ac
 	if (code == 0)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Design Capacity", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u mWh", code * multiplier);
fc71ac
+		pr_attr("Design Capacity", "%u mWh", code * multiplier);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_battery_voltage(u16 code)
fc71ac
 {
fc71ac
 	if (code == 0)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Design Voltage", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u mV", code);
fc71ac
+		pr_attr("Design Voltage", "%u mV", code);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_battery_maximum_error(u8 code)
fc71ac
 {
fc71ac
 	if (code == 0xFF)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Maximum Error", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u%%", code);
fc71ac
+		pr_attr("Maximum Error", "%u%%", code);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -2897,20 +2976,20 @@ static const char *dmi_system_reset_boot_option(u8 code)
fc71ac
 	return option[code];
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_system_reset_count(u16 code)
fc71ac
+static void dmi_system_reset_count(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	if (code == 0xFFFF)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u", code);
fc71ac
+		pr_attr(attr, "%u", code);
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_system_reset_timer(u16 code)
fc71ac
+static void dmi_system_reset_timer(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	if (code == 0xFFFF)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u min", code);
fc71ac
+		pr_attr(attr, "%u min", code);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -2935,27 +3014,32 @@ static const char *dmi_hardware_security_status(u8 code)
fc71ac
 
fc71ac
 static void dmi_power_controls_power_on(const u8 *p)
fc71ac
 {
fc71ac
+	char time[15];
fc71ac
+	int off = 0;
fc71ac
+
fc71ac
 	/* 7.26.1 */
fc71ac
 	if (dmi_bcd_range(p[0], 0x01, 0x12))
fc71ac
-		printf(" %02X", p[0]);
fc71ac
+		off += sprintf(time + off, "%02X", p[0]);
fc71ac
 	else
fc71ac
-		printf(" *");
fc71ac
+		off += sprintf(time + off, "*");
fc71ac
 	if (dmi_bcd_range(p[1], 0x01, 0x31))
fc71ac
-		printf("-%02X", p[1]);
fc71ac
+		off += sprintf(time + off, "-%02X", p[1]);
fc71ac
 	else
fc71ac
-		printf("-*");
fc71ac
+		off += sprintf(time + off, "-*");
fc71ac
 	if (dmi_bcd_range(p[2], 0x00, 0x23))
fc71ac
-		printf(" %02X", p[2]);
fc71ac
+		off += sprintf(time + off, " %02X", p[2]);
fc71ac
 	else
fc71ac
-		printf(" *");
fc71ac
+		off += sprintf(time + off, " *");
fc71ac
 	if (dmi_bcd_range(p[3], 0x00, 0x59))
fc71ac
-		printf(":%02X", p[3]);
fc71ac
+		off += sprintf(time + off, ":%02X", p[3]);
fc71ac
 	else
fc71ac
-		printf(":*");
fc71ac
+		off += sprintf(time + off, ":*");
fc71ac
 	if (dmi_bcd_range(p[4], 0x00, 0x59))
fc71ac
-		printf(":%02X", p[4]);
fc71ac
+		off += sprintf(time + off, ":%02X", p[4]);
fc71ac
 	else
fc71ac
-		printf(":*");
fc71ac
+		off += sprintf(time + off, ":*");
fc71ac
+
fc71ac
+	pr_attr("Next Scheduled Power-on", time);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -3001,28 +3085,28 @@ static const char *dmi_probe_status(u8 code)
fc71ac
 	return out_of_spec;
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_voltage_probe_value(u16 code)
fc71ac
+static void dmi_voltage_probe_value(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	if (code == 0x8000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %.3f V", (float)(i16)code / 1000);
fc71ac
+		pr_attr(attr, "%.3f V", (float)(i16)code / 1000);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_voltage_probe_resolution(u16 code)
fc71ac
 {
fc71ac
 	if (code == 0x8000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Resolution", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %.1f mV", (float)code / 10);
fc71ac
+		pr_attr("Resolution", "%.1f mV", (float)code / 10);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_probe_accuracy(u16 code)
fc71ac
 {
fc71ac
 	if (code == 0x8000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Accuracy", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %.2f%%", (float)code / 100);
fc71ac
+		pr_attr("Accuracy", "%.2f%%", (float)code / 100);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -3058,9 +3142,9 @@ static const char *dmi_cooling_device_type(u8 code)
fc71ac
 static void dmi_cooling_device_speed(u16 code)
fc71ac
 {
fc71ac
 	if (code == 0x8000)
fc71ac
-		printf(" Unknown Or Non-rotating");
fc71ac
+		pr_attr("Nominal Speed", "Unknown Or Non-rotating");
fc71ac
 	else
fc71ac
-		printf(" %u rpm", code);
fc71ac
+		pr_attr("Nominal Speed", "%u rpm", code);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -3093,40 +3177,40 @@ static const char *dmi_temperature_probe_location(u8 code)
fc71ac
 	return out_of_spec;
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_temperature_probe_value(u16 code)
fc71ac
+static void dmi_temperature_probe_value(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	if (code == 0x8000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %.1f deg C", (float)(i16)code / 10);
fc71ac
+		pr_attr(attr, "%.1f deg C", (float)(i16)code / 10);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_temperature_probe_resolution(u16 code)
fc71ac
 {
fc71ac
 	if (code == 0x8000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Resolution", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %.3f deg C", (float)code / 1000);
fc71ac
+		pr_attr("Resolution", "%.3f deg C", (float)code / 1000);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
  * 7.30 Electrical Current Probe (Type 29)
fc71ac
  */
fc71ac
 
fc71ac
-static void dmi_current_probe_value(u16 code)
fc71ac
+static void dmi_current_probe_value(const char *attr, u16 code)
fc71ac
 {
fc71ac
 	if (code == 0x8000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %.3f A", (float)(i16)code / 1000);
fc71ac
+		pr_attr(attr, "%.3f A", (float)(i16)code / 1000);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_current_probe_resolution(u16 code)
fc71ac
 {
fc71ac
 	if (code == 0x8000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Resolution", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %.1f mA", (float)code / 10);
fc71ac
+		pr_attr("Resolution", "%.1f mA", (float)code / 10);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -3160,12 +3244,12 @@ static const char *dmi_system_boot_status(u8 code)
fc71ac
  * 7.34 64-bit Memory Error Information (Type 33)
fc71ac
  */
fc71ac
 
fc71ac
-static void dmi_64bit_memory_error_address(u64 code)
fc71ac
+static void dmi_64bit_memory_error_address(const char *attr, u64 code)
fc71ac
 {
fc71ac
 	if (code.h == 0x80000000 && code.l == 0x00000000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr(attr, "Unknown");
fc71ac
 	else
fc71ac
-		printf(" 0x%08X%08X", code.h, code.l);
fc71ac
+		pr_attr(attr, "0x%08X%08X", code.h, code.l);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -3253,17 +3337,20 @@ static const char *dmi_memory_channel_type(u8 code)
fc71ac
 	return out_of_spec;
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_memory_channel_devices(u8 count, const u8 *p, const char *prefix)
fc71ac
+static void dmi_memory_channel_devices(u8 count, const u8 *p)
fc71ac
 {
fc71ac
+	char attr[18];
fc71ac
 	int i;
fc71ac
 
fc71ac
 	for (i = 1; i <= count; i++)
fc71ac
 	{
fc71ac
-		printf("%sDevice %u Load: %u\n",
fc71ac
-			prefix, i, p[3 * i]);
fc71ac
+		sprintf(attr, "Device %hu Load", i);
fc71ac
+		pr_attr(attr, "%u", p[3 * i]);
fc71ac
 		if (!(opt.flags & FLAG_QUIET))
fc71ac
-			printf("%sDevice %u Handle: 0x%04X\n",
fc71ac
-				prefix, i, WORD(p + 3 * i + 1));
fc71ac
+		{
fc71ac
+			sprintf(attr, "Device %hu Handle", i);
fc71ac
+			pr_attr(attr, "0x%04X", WORD(p + 3 * i + 1));
fc71ac
+		}
fc71ac
 	}
fc71ac
 }
fc71ac
 
fc71ac
@@ -3291,12 +3378,13 @@ static void dmi_ipmi_base_address(u8 type, const u8 *p, u8 lsb)
fc71ac
 {
fc71ac
 	if (type == 0x04) /* SSIF */
fc71ac
 	{
fc71ac
-		printf("0x%02X (SMBus)", (*p) >> 1);
fc71ac
+		pr_attr("Base Address", "0x%02X (SMBus)", (*p) >> 1);
fc71ac
 	}
fc71ac
 	else
fc71ac
 	{
fc71ac
 		u64 address = QWORD(p);
fc71ac
-		printf("0x%08X%08X (%s)", address.h, (address.l & ~1) | lsb,
fc71ac
+		pr_attr("Base Address", "0x%08X%08X (%s)",
fc71ac
+			address.h, (address.l & ~1) | lsb,
fc71ac
 			address.l & 1 ? "I/O" : "Memory-mapped");
fc71ac
 	}
fc71ac
 }
fc71ac
@@ -3322,9 +3410,9 @@ static const char *dmi_ipmi_register_spacing(u8 code)
fc71ac
 static void dmi_power_supply_power(u16 code)
fc71ac
 {
fc71ac
 	if (code == 0x8000)
fc71ac
-		printf(" Unknown");
fc71ac
+		pr_attr("Max Power Capacity", "Unknown");
fc71ac
 	else
fc71ac
-		printf(" %u W", (unsigned int)code);
fc71ac
+		pr_attr("Max Power Capacity", "%u W", (unsigned int)code);
fc71ac
 }
fc71ac
 
fc71ac
 static const char *dmi_power_supply_type(u8 code)
fc71ac
@@ -3387,7 +3475,7 @@ static const char *dmi_power_supply_range_switching(u8 code)
fc71ac
  * whether it's worth the effort.
fc71ac
  */
fc71ac
 
fc71ac
-static void dmi_additional_info(const struct dmi_header *h, const char *prefix)
fc71ac
+static void dmi_additional_info(const struct dmi_header *h)
fc71ac
 {
fc71ac
 	u8 *p = h->data + 4;
fc71ac
 	u8 count = *p++;
fc71ac
@@ -3403,30 +3491,28 @@ static void dmi_additional_info(const struct dmi_header *h, const char *prefix)
fc71ac
 		length = p[0x00];
fc71ac
 		if (length < 0x05 || h->length < offset + length) break;
fc71ac
 
fc71ac
-		printf("%s\tReferenced Handle: 0x%04x\n",
fc71ac
-			prefix, WORD(p + 0x01));
fc71ac
-		printf("%s\tReferenced Offset: 0x%02x\n",
fc71ac
-			prefix, p[0x03]);
fc71ac
-		printf("%s\tString: %s\n",
fc71ac
-			prefix, dmi_string(h, p[0x04]));
fc71ac
+		pr_attr("Referenced Handle", "0x%04x",
fc71ac
+			WORD(p + 0x01));
fc71ac
+		pr_attr("Referenced Offset", "0x%02x",
fc71ac
+			p[0x03]);
fc71ac
+		pr_attr("String", "%s",
fc71ac
+			dmi_string(h, p[0x04]));
fc71ac
 
fc71ac
-		printf("%s\tValue: ", prefix);
fc71ac
 		switch (length - 0x05)
fc71ac
 		{
fc71ac
 			case 1:
fc71ac
-				printf("0x%02x", p[0x05]);
fc71ac
+				pr_attr("Value", "0x%02x", p[0x05]);
fc71ac
 				break;
fc71ac
 			case 2:
fc71ac
-				printf("0x%04x", WORD(p + 0x05));
fc71ac
+				pr_attr("Value", "0x%04x", WORD(p + 0x05));
fc71ac
 				break;
fc71ac
 			case 4:
fc71ac
-				printf("0x%08x", DWORD(p + 0x05));
fc71ac
+				pr_attr("Value", "0x%08x", DWORD(p + 0x05));
fc71ac
 				break;
fc71ac
 			default:
fc71ac
-				printf("Unexpected size");
fc71ac
+				pr_attr("Value", "Unexpected size");
fc71ac
 				break;
fc71ac
 		}
fc71ac
-		printf("\n");
fc71ac
 
fc71ac
 		p += length;
fc71ac
 		offset += length;
fc71ac
@@ -3580,8 +3666,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
fc71ac
 	 * we can just pick a sufficiently recent version here.
fc71ac
 	 */
fc71ac
 	printf("%s\tService UUID: ", prefix);
fc71ac
-	dmi_system_uuid(&rdata[0], 0x311);
fc71ac
-	printf("\n");
fc71ac
+	dmi_system_uuid(NULL, &rdata[0], 0x311);	/* FIXME */
fc71ac
 
fc71ac
 	/*
fc71ac
 	 * DSP0270: 8.6: Redfish Over IP Host IP Assignment Type
fc71ac
@@ -3710,7 +3795,7 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
fc71ac
 		return;
fc71ac
 
fc71ac
 	type = data[0x4];
fc71ac
-	printf("%sHost Interface Type: %s\n", prefix,
fc71ac
+	pr_attr("Host Interface Type", "%s",
fc71ac
 		dmi_management_controller_host_type(type));
fc71ac
 
fc71ac
 	/*
fc71ac
@@ -3725,17 +3810,17 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
fc71ac
 		/* DSP0270: 8.3 Table 2: Device Type */
fc71ac
 		type = data[0x6];
fc71ac
 
fc71ac
-		printf("%sDevice Type: %s\n", prefix,
fc71ac
+		pr_attr("Device Type", "%s",
fc71ac
 			dmi_parse_device_type(type));
fc71ac
 		if (type == 0x2 && len >= 5)
fc71ac
 		{
fc71ac
 			/* USB Device Type - need at least 6 bytes */
fc71ac
 			u8 *usbdata = &data[0x7];
fc71ac
 			/* USB Device Descriptor: idVendor */
fc71ac
-			printf("%sidVendor: 0x%04x\n", prefix,
fc71ac
+			pr_attr("idVendor", "0x%04x",
fc71ac
 				WORD(&usbdata[0x0]));
fc71ac
 			/* USB Device Descriptor: idProduct */
fc71ac
-			printf("%sidProduct: 0x%04x\n", prefix,
fc71ac
+			pr_attr("idProduct", "0x%04x",
fc71ac
 				WORD(&usbdata[0x2]));
fc71ac
 			/*
fc71ac
 			 * USB Serial number is here, but its useless, don't
fc71ac
@@ -3747,16 +3832,16 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
fc71ac
 			/* PCI Device Type - Need at least 8 bytes */
fc71ac
 			u8 *pcidata = &data[0x7];
fc71ac
 			/* PCI Device Descriptor: VendorID */
fc71ac
-			printf("%sVendorID: 0x%04x\n", prefix,
fc71ac
+			pr_attr("VendorID", "0x%04x",
fc71ac
 				WORD(&pcidata[0x0]));
fc71ac
 			/* PCI Device Descriptor: DeviceID */
fc71ac
-			printf("%sDeviceID: 0x%04x\n", prefix,
fc71ac
+			pr_attr("DeviceID", "0x%04x",
fc71ac
 				WORD(&pcidata[0x2]));
fc71ac
 			/* PCI Device Descriptor: PCI SubvendorID */
fc71ac
-			printf("%sSubVendorID: 0x%04x\n", prefix,
fc71ac
+			pr_attr("SubVendorID", "0x%04x",
fc71ac
 				WORD(&pcidata[0x4]));
fc71ac
 			/* PCI Device Descriptor: PCI SubdeviceID */
fc71ac
-			printf("%sSubDeviceID: 0x%04x\n", prefix,
fc71ac
+			pr_attr("SubDeviceID", "0x%04x",
fc71ac
 				WORD(&pcidata[0x6]));
fc71ac
 		}
fc71ac
 		else if (type == 0x4 && len >= 5)
fc71ac
@@ -3764,8 +3849,8 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
fc71ac
 			/* OEM Device Type - Need at least 4 bytes */
fc71ac
 			u8 *oemdata = &data[0x7];
fc71ac
 			/* OEM Device Descriptor: IANA */
fc71ac
-			printf("%sVendor ID: 0x%02x:0x%02x:0x%02x:0x%02x\n",
fc71ac
-				prefix, oemdata[0x0], oemdata[0x1],
fc71ac
+			pr_attr("Vendor ID", "0x%02x:0x%02x:0x%02x:0x%02x",
fc71ac
+				oemdata[0x0], oemdata[0x1],
fc71ac
 				oemdata[0x2], oemdata[0x3]);
fc71ac
 		}
fc71ac
 		/* Don't mess with unknown types for now */
fc71ac
@@ -3848,7 +3933,7 @@ static void dmi_tpm_vendor_id(const u8 *p)
fc71ac
 	/* Terminate the string */
fc71ac
 	vendor_id[i] = '\0';
fc71ac
 
fc71ac
-	printf(" %s", vendor_id);
fc71ac
+	pr_attr("Vendor ID", "%s", vendor_id);
fc71ac
 }
fc71ac
 
fc71ac
 static void dmi_tpm_characteristics(u64 code, const char *prefix)
fc71ac
@@ -3894,11 +3979,11 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 		case 0: /* 7.1 BIOS Information */
fc71ac
 			pr_handle_name("BIOS Information");
fc71ac
 			if (h->length < 0x12) break;
fc71ac
-			printf("\tVendor: %s\n",
fc71ac
+			pr_attr("Vendor", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tVersion: %s\n",
fc71ac
+			pr_attr("Version", "%s",
fc71ac
 				dmi_string(h, data[0x05]));
fc71ac
-			printf("\tRelease Date: %s\n",
fc71ac
+			pr_attr("Release Date", "%s",
fc71ac
 				dmi_string(h, data[0x08]));
fc71ac
 			/*
fc71ac
 			 * On IA-64, the BIOS base address will read 0 because
fc71ac
@@ -3907,15 +3992,11 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			 */
fc71ac
 			if (WORD(data + 0x06) != 0)
fc71ac
 			{
fc71ac
-				printf("\tAddress: 0x%04X0\n",
fc71ac
+				pr_attr("Address", "0x%04X0",
fc71ac
 					WORD(data + 0x06));
fc71ac
-				printf("\tRuntime Size:");
fc71ac
 				dmi_bios_runtime_size((0x10000 - WORD(data + 0x06)) << 4);
fc71ac
-				printf("\n");
fc71ac
 			}
fc71ac
-			printf("\tROM Size:");
fc71ac
 			dmi_bios_rom_size(data[0x09], h->length < 0x1A ? 16 : WORD(data + 0x18));
fc71ac
-			printf("\n");
fc71ac
 			printf("\tCharacteristics:\n");
fc71ac
 			dmi_bios_characteristics(QWORD(data + 0x0A), "\t\t");
fc71ac
 			if (h->length < 0x13) break;
fc71ac
@@ -3924,61 +4005,59 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			dmi_bios_characteristics_x2(data[0x13], "\t\t");
fc71ac
 			if (h->length < 0x18) break;
fc71ac
 			if (data[0x14] != 0xFF && data[0x15] != 0xFF)
fc71ac
-				printf("\tBIOS Revision: %u.%u\n",
fc71ac
+				pr_attr("BIOS Revision", "%u.%u",
fc71ac
 					data[0x14], data[0x15]);
fc71ac
 			if (data[0x16] != 0xFF && data[0x17] != 0xFF)
fc71ac
-				printf("\tFirmware Revision: %u.%u\n",
fc71ac
+				pr_attr("Firmware Revision", "%u.%u",
fc71ac
 					data[0x16], data[0x17]);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 1: /* 7.2 System Information */
fc71ac
 			pr_handle_name("System Information");
fc71ac
 			if (h->length < 0x08) break;
fc71ac
-			printf("\tManufacturer: %s\n",
fc71ac
+			pr_attr("Manufacturer", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tProduct Name: %s\n",
fc71ac
+			pr_attr("Product Name", "%s",
fc71ac
 				dmi_string(h, data[0x05]));
fc71ac
-			printf("\tVersion: %s\n",
fc71ac
+			pr_attr("Version", "%s",
fc71ac
 				dmi_string(h, data[0x06]));
fc71ac
-			printf("\tSerial Number: %s\n",
fc71ac
+			pr_attr("Serial Number", "%s",
fc71ac
 				dmi_string(h, data[0x07]));
fc71ac
 			if (h->length < 0x19) break;
fc71ac
-			printf("\tUUID: ");
fc71ac
-			dmi_system_uuid(data + 0x08, ver);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tWake-up Type: %s\n",
fc71ac
+			dmi_system_uuid("UUID", data + 0x08, ver);
fc71ac
+			pr_attr("Wake-up Type", "%s",
fc71ac
 				dmi_system_wake_up_type(data[0x18]));
fc71ac
 			if (h->length < 0x1B) break;
fc71ac
-			printf("\tSKU Number: %s\n",
fc71ac
+			pr_attr("SKU Number", "%s",
fc71ac
 				dmi_string(h, data[0x19]));
fc71ac
-			printf("\tFamily: %s\n",
fc71ac
+			pr_attr("Family", "%s",
fc71ac
 				dmi_string(h, data[0x1A]));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 2: /* 7.3 Base Board Information */
fc71ac
 			pr_handle_name("Base Board Information");
fc71ac
 			if (h->length < 0x08) break;
fc71ac
-			printf("\tManufacturer: %s\n",
fc71ac
+			pr_attr("Manufacturer", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tProduct Name: %s\n",
fc71ac
+			pr_attr("Product Name", "%s",
fc71ac
 				dmi_string(h, data[0x05]));
fc71ac
-			printf("\tVersion: %s\n",
fc71ac
+			pr_attr("Version", "%s",
fc71ac
 				dmi_string(h, data[0x06]));
fc71ac
-			printf("\tSerial Number: %s\n",
fc71ac
+			pr_attr("Serial Number", "%s",
fc71ac
 				dmi_string(h, data[0x07]));
fc71ac
 			if (h->length < 0x09) break;
fc71ac
-			printf("\tAsset Tag: %s\n",
fc71ac
+			pr_attr("Asset Tag", "%s",
fc71ac
 				dmi_string(h, data[0x08]));
fc71ac
 			if (h->length < 0x0A) break;
fc71ac
 			printf("\tFeatures:");
fc71ac
 			dmi_base_board_features(data[0x09], "\t\t");
fc71ac
 			if (h->length < 0x0E) break;
fc71ac
-			printf("\tLocation In Chassis: %s\n",
fc71ac
+			pr_attr("Location In Chassis", "%s",
fc71ac
 				dmi_string(h, data[0x0A]));
fc71ac
 			if (!(opt.flags & FLAG_QUIET))
fc71ac
-				printf("\tChassis Handle: 0x%04X\n",
fc71ac
+				pr_attr("Chassis Handle", "0x%04X",
fc71ac
 					WORD(data + 0x0B));
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_base_board_type(data[0x0D]));
fc71ac
 			if (h->length < 0x0F) break;
fc71ac
 			if (h->length < 0x0F + data[0x0E] * sizeof(u16)) break;
fc71ac
@@ -3989,109 +4068,94 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 		case 3: /* 7.4 Chassis Information */
fc71ac
 			pr_handle_name("Chassis Information");
fc71ac
 			if (h->length < 0x09) break;
fc71ac
-			printf("\tManufacturer: %s\n",
fc71ac
+			pr_attr("Manufacturer", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_chassis_type(data[0x05]));
fc71ac
-			printf("\tLock: %s\n",
fc71ac
+			pr_attr("Lock", "%s",
fc71ac
 				dmi_chassis_lock(data[0x05] >> 7));
fc71ac
-			printf("\tVersion: %s\n",
fc71ac
+			pr_attr("Version", "%s",
fc71ac
 				dmi_string(h, data[0x06]));
fc71ac
-			printf("\tSerial Number: %s\n",
fc71ac
+			pr_attr("Serial Number", "%s",
fc71ac
 				dmi_string(h, data[0x07]));
fc71ac
-			printf("\tAsset Tag: %s\n",
fc71ac
+			pr_attr("Asset Tag", "%s",
fc71ac
 				dmi_string(h, data[0x08]));
fc71ac
 			if (h->length < 0x0D) break;
fc71ac
-			printf("\tBoot-up State: %s\n",
fc71ac
+			pr_attr("Boot-up State", "%s",
fc71ac
 				dmi_chassis_state(data[0x09]));
fc71ac
-			printf("\tPower Supply State: %s\n",
fc71ac
+			pr_attr("Power Supply State", "%s",
fc71ac
 				dmi_chassis_state(data[0x0A]));
fc71ac
-			printf("\tThermal State: %s\n",
fc71ac
+			pr_attr("Thermal State", "%s",
fc71ac
 				dmi_chassis_state(data[0x0B]));
fc71ac
-			printf("\tSecurity Status: %s\n",
fc71ac
+			pr_attr("Security Status", "%s",
fc71ac
 				dmi_chassis_security_status(data[0x0C]));
fc71ac
 			if (h->length < 0x11) break;
fc71ac
-			printf("\tOEM Information: 0x%08X\n",
fc71ac
+			pr_attr("OEM Information", "0x%08X",
fc71ac
 				DWORD(data + 0x0D));
fc71ac
 			if (h->length < 0x13) break;
fc71ac
-			printf("\tHeight:");
fc71ac
 			dmi_chassis_height(data[0x11]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tNumber Of Power Cords:");
fc71ac
 			dmi_chassis_power_cords(data[0x12]);
fc71ac
-			printf("\n");
fc71ac
 			if (h->length < 0x15) break;
fc71ac
 			if (h->length < 0x15 + data[0x13] * data[0x14]) break;
fc71ac
 			dmi_chassis_elements(data[0x13], data[0x14], data + 0x15, "\t");
fc71ac
 			if (h->length < 0x16 + data[0x13] * data[0x14]) break;
fc71ac
-			printf("\tSKU Number: %s\n",
fc71ac
+			pr_attr("SKU Number", "%s",
fc71ac
 				dmi_string(h, data[0x15 + data[0x13] * data[0x14]]));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 4: /* 7.5 Processor Information */
fc71ac
 			pr_handle_name("Processor Information");
fc71ac
 			if (h->length < 0x1A) break;
fc71ac
-			printf("\tSocket Designation: %s\n",
fc71ac
+			pr_attr("Socket Designation", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_processor_type(data[0x05]));
fc71ac
-			printf("\tFamily: %s\n",
fc71ac
+			pr_attr("Family", "%s",
fc71ac
 				dmi_processor_family(h, ver));
fc71ac
-			printf("\tManufacturer: %s\n",
fc71ac
+			pr_attr("Manufacturer", "%s",
fc71ac
 				dmi_string(h, data[0x07]));
fc71ac
 			dmi_processor_id(h, "\t");
fc71ac
-			printf("\tVersion: %s\n",
fc71ac
+			pr_attr("Version", "%s",
fc71ac
 				dmi_string(h, data[0x10]));
fc71ac
-			printf("\tVoltage:");
fc71ac
-			dmi_processor_voltage(data[0x11]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tExternal Clock: ");
fc71ac
-			dmi_processor_frequency(data + 0x12);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMax Speed: ");
fc71ac
-			dmi_processor_frequency(data + 0x14);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tCurrent Speed: ");
fc71ac
-			dmi_processor_frequency(data + 0x16);
fc71ac
-			printf("\n");
fc71ac
+			dmi_processor_voltage("Voltage", data[0x11]);
fc71ac
+			dmi_processor_frequency("External Clock", data + 0x12);
fc71ac
+			dmi_processor_frequency("Max Speed", data + 0x14);
fc71ac
+			dmi_processor_frequency("Current Speed", data + 0x16);
fc71ac
 			if (data[0x18] & (1 << 6))
fc71ac
-				printf("\tStatus: Populated, %s\n",
fc71ac
+				pr_attr("Status", "Populated, %s",
fc71ac
 					dmi_processor_status(data[0x18] & 0x07));
fc71ac
 			else
fc71ac
-				printf("\tStatus: Unpopulated\n");
fc71ac
-			printf("\tUpgrade: %s\n",
fc71ac
+				pr_attr("Status", "Unpopulated");
fc71ac
+			pr_attr("Upgrade", "%s",
fc71ac
 				dmi_processor_upgrade(data[0x19]));
fc71ac
 			if (h->length < 0x20) break;
fc71ac
 			if (!(opt.flags & FLAG_QUIET))
fc71ac
 			{
fc71ac
-				printf("\tL1 Cache Handle:");
fc71ac
-				dmi_processor_cache(WORD(data + 0x1A), "L1", ver);
fc71ac
-				printf("\n");
fc71ac
-				printf("\tL2 Cache Handle:");
fc71ac
-				dmi_processor_cache(WORD(data + 0x1C), "L2", ver);
fc71ac
-				printf("\n");
fc71ac
-				printf("\tL3 Cache Handle:");
fc71ac
-				dmi_processor_cache(WORD(data + 0x1E), "L3", ver);
fc71ac
-				printf("\n");
fc71ac
+				dmi_processor_cache("L1 Cache Handle",
fc71ac
+						    WORD(data + 0x1A), "L1", ver);
fc71ac
+				dmi_processor_cache("L2 Cache Handle",
fc71ac
+						    WORD(data + 0x1C), "L2", ver);
fc71ac
+				dmi_processor_cache("L3 Cache Handle",
fc71ac
+						    WORD(data + 0x1E), "L3", ver);
fc71ac
 			}
fc71ac
 			if (h->length < 0x23) break;
fc71ac
-			printf("\tSerial Number: %s\n",
fc71ac
+			pr_attr("Serial Number", "%s",
fc71ac
 				dmi_string(h, data[0x20]));
fc71ac
-			printf("\tAsset Tag: %s\n",
fc71ac
+			pr_attr("Asset Tag", "%s",
fc71ac
 				dmi_string(h, data[0x21]));
fc71ac
-			printf("\tPart Number: %s\n",
fc71ac
+			pr_attr("Part Number", "%s",
fc71ac
 				dmi_string(h, data[0x22]));
fc71ac
 			if (h->length < 0x28) break;
fc71ac
 			if (data[0x23] != 0)
fc71ac
-				printf("\tCore Count: %u\n",
fc71ac
+				pr_attr("Core Count", "%u",
fc71ac
 					h->length >= 0x2C && data[0x23] == 0xFF ?
fc71ac
 					WORD(data + 0x2A) : data[0x23]);
fc71ac
 			if (data[0x24] != 0)
fc71ac
-				printf("\tCore Enabled: %u\n",
fc71ac
+				pr_attr("Core Enabled", "%u",
fc71ac
 					h->length >= 0x2E && data[0x24] == 0xFF ?
fc71ac
 					WORD(data + 0x2C) : data[0x24]);
fc71ac
 			if (data[0x25] != 0)
fc71ac
-				printf("\tThread Count: %u\n",
fc71ac
+				pr_attr("Thread Count", "%u",
fc71ac
 					h->length >= 0x30 && data[0x25] == 0xFF ?
fc71ac
 					WORD(data + 0x2E) : data[0x25]);
fc71ac
 			printf("\tCharacteristics:");
fc71ac
@@ -4101,26 +4165,24 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 		case 5: /* 7.6 Memory Controller Information */
fc71ac
 			pr_handle_name("Memory Controller Information");
fc71ac
 			if (h->length < 0x0F) break;
fc71ac
-			printf("\tError Detecting Method: %s\n",
fc71ac
+			pr_attr("Error Detecting Method", "%s",
fc71ac
 				dmi_memory_controller_ed_method(data[0x04]));
fc71ac
 			printf("\tError Correcting Capabilities:");
fc71ac
 			dmi_memory_controller_ec_capabilities(data[0x05], "\t\t");
fc71ac
-			printf("\tSupported Interleave: %s\n",
fc71ac
+			pr_attr("Supported Interleave", "%s",
fc71ac
 				dmi_memory_controller_interleave(data[0x06]));
fc71ac
-			printf("\tCurrent Interleave: %s\n",
fc71ac
+			pr_attr("Current Interleave", "%s",
fc71ac
 				dmi_memory_controller_interleave(data[0x07]));
fc71ac
-			printf("\tMaximum Memory Module Size: %u MB\n",
fc71ac
+			pr_attr("Maximum Memory Module Size", "%u MB",
fc71ac
 				1 << data[0x08]);
fc71ac
-			printf("\tMaximum Total Memory Size: %u MB\n",
fc71ac
+			pr_attr("Maximum Total Memory Size", "%u MB",
fc71ac
 				data[0x0E] * (1 << data[0x08]));
fc71ac
 			printf("\tSupported Speeds:");
fc71ac
 			dmi_memory_controller_speeds(WORD(data + 0x09), "\t\t");
fc71ac
 			printf("\tSupported Memory Types:");
fc71ac
 			dmi_memory_module_types(WORD(data + 0x0B), "\n\t\t");
fc71ac
 			printf("\n");
fc71ac
-			printf("\tMemory Module Voltage:");
fc71ac
-			dmi_processor_voltage(data[0x0D]);
fc71ac
-			printf("\n");
fc71ac
+			dmi_processor_voltage("Memory Module Voltage", data[0x0D]);
fc71ac
 			if (h->length < 0x0F + data[0x0E] * sizeof(u16)) break;
fc71ac
 			dmi_memory_controller_slots(data[0x0E], data + 0x0F, "\t");
fc71ac
 			if (h->length < 0x10 + data[0x0E] * sizeof(u16)) break;
fc71ac
@@ -4131,52 +4193,39 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 		case 6: /* 7.7 Memory Module Information */
fc71ac
 			pr_handle_name("Memory Module Information");
fc71ac
 			if (h->length < 0x0C) break;
fc71ac
-			printf("\tSocket Designation: %s\n",
fc71ac
+			pr_attr("Socket Designation", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tBank Connections:");
fc71ac
 			dmi_memory_module_connections(data[0x05]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tCurrent Speed:");
fc71ac
-			dmi_memory_module_speed(data[0x06]);
fc71ac
-			printf("\n");
fc71ac
+			dmi_memory_module_speed("Current Speed", data[0x06]);
fc71ac
 			printf("\tType:");
fc71ac
 			dmi_memory_module_types(WORD(data + 0x07), " ");
fc71ac
 			printf("\n");
fc71ac
-			printf("\tInstalled Size:");
fc71ac
-			dmi_memory_module_size(data[0x09]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tEnabled Size:");
fc71ac
-			dmi_memory_module_size(data[0x0A]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tError Status:");
fc71ac
+			dmi_memory_module_size("Installed Size", data[0x09]);
fc71ac
+			dmi_memory_module_size("Enabled Size", data[0x0A]);
fc71ac
 			dmi_memory_module_error(data[0x0B]);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 7: /* 7.8 Cache Information */
fc71ac
 			pr_handle_name("Cache Information");
fc71ac
 			if (h->length < 0x0F) break;
fc71ac
-			printf("\tSocket Designation: %s\n",
fc71ac
+			pr_attr("Socket Designation", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tConfiguration: %s, %s, Level %u\n",
fc71ac
+			pr_attr("Configuration", "%s, %s, Level %u",
fc71ac
 				WORD(data + 0x05) & 0x0080 ? "Enabled" : "Disabled",
fc71ac
 				WORD(data + 0x05) & 0x0008 ? "Socketed" : "Not Socketed",
fc71ac
 				(WORD(data + 0x05) & 0x0007) + 1);
fc71ac
-			printf("\tOperational Mode: %s\n",
fc71ac
+			pr_attr("Operational Mode", "%s",
fc71ac
 				dmi_cache_mode((WORD(data + 0x05) >> 8) & 0x0003));
fc71ac
-			printf("\tLocation: %s\n",
fc71ac
+			pr_attr("Location", "%s",
fc71ac
 				dmi_cache_location((WORD(data + 0x05) >> 5) & 0x0003));
fc71ac
-			printf("\tInstalled Size:");
fc71ac
 			if (h->length >= 0x1B)
fc71ac
-				dmi_cache_size_2(DWORD(data + 0x17));
fc71ac
+				dmi_cache_size_2("Installed Size", DWORD(data + 0x17));
fc71ac
 			else
fc71ac
-				dmi_cache_size(WORD(data + 0x09));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMaximum Size:");
fc71ac
+				dmi_cache_size("Installed Size", WORD(data + 0x09));
fc71ac
 			if (h->length >= 0x17)
fc71ac
-				dmi_cache_size_2(DWORD(data + 0x13));
fc71ac
+				dmi_cache_size_2("Maximum Size", DWORD(data + 0x13));
fc71ac
 			else
fc71ac
-				dmi_cache_size(WORD(data + 0x07));
fc71ac
-			printf("\n");
fc71ac
+				dmi_cache_size("Maximum Size", WORD(data + 0x07));
fc71ac
 			printf("\tSupported SRAM Types:");
fc71ac
 			dmi_cache_types(WORD(data + 0x0B), "\n\t\t");
fc71ac
 			printf("\n");
fc71ac
@@ -4184,73 +4233,71 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			dmi_cache_types(WORD(data + 0x0D), " ");
fc71ac
 			printf("\n");
fc71ac
 			if (h->length < 0x13) break;
fc71ac
-			printf("\tSpeed:");
fc71ac
-			dmi_memory_module_speed(data[0x0F]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tError Correction Type: %s\n",
fc71ac
+			dmi_memory_module_speed("Speed", data[0x0F]);
fc71ac
+			pr_attr("Error Correction Type", "%s",
fc71ac
 				dmi_cache_ec_type(data[0x10]));
fc71ac
-			printf("\tSystem Type: %s\n",
fc71ac
+			pr_attr("System Type", "%s",
fc71ac
 				dmi_cache_type(data[0x11]));
fc71ac
-			printf("\tAssociativity: %s\n",
fc71ac
+			pr_attr("Associativity", "%s",
fc71ac
 				dmi_cache_associativity(data[0x12]));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 8: /* 7.9 Port Connector Information */
fc71ac
 			pr_handle_name("Port Connector Information");
fc71ac
 			if (h->length < 0x09) break;
fc71ac
-			printf("\tInternal Reference Designator: %s\n",
fc71ac
+			pr_attr("Internal Reference Designator", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tInternal Connector Type: %s\n",
fc71ac
+			pr_attr("Internal Connector Type", "%s",
fc71ac
 				dmi_port_connector_type(data[0x05]));
fc71ac
-			printf("\tExternal Reference Designator: %s\n",
fc71ac
+			pr_attr("External Reference Designator", "%s",
fc71ac
 				dmi_string(h, data[0x06]));
fc71ac
-			printf("\tExternal Connector Type: %s\n",
fc71ac
+			pr_attr("External Connector Type", "%s",
fc71ac
 				dmi_port_connector_type(data[0x07]));
fc71ac
-			printf("\tPort Type: %s\n",
fc71ac
+			pr_attr("Port Type", "%s",
fc71ac
 				dmi_port_type(data[0x08]));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 9: /* 7.10 System Slots */
fc71ac
 			pr_handle_name("System Slot Information");
fc71ac
 			if (h->length < 0x0C) break;
fc71ac
-			printf("\tDesignation: %s\n",
fc71ac
+			pr_attr("Designation", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tType: %s%s\n",
fc71ac
+			pr_attr("Type", "%s%s",
fc71ac
 				dmi_slot_bus_width(data[0x06]),
fc71ac
 				dmi_slot_type(data[0x05]));
fc71ac
-			printf("\tCurrent Usage: %s\n",
fc71ac
+			pr_attr("Current Usage", "%s",
fc71ac
 				dmi_slot_current_usage(data[0x07]));
fc71ac
-			printf("\tLength: %s\n",
fc71ac
+			pr_attr("Length", "%s",
fc71ac
 				dmi_slot_length(data[0x08]));
fc71ac
-			dmi_slot_id(data[0x09], data[0x0A], data[0x05], "\t");
fc71ac
+			dmi_slot_id(data[0x09], data[0x0A], data[0x05]);
fc71ac
 			printf("\tCharacteristics:");
fc71ac
 			if (h->length < 0x0D)
fc71ac
 				dmi_slot_characteristics(data[0x0B], 0x00, "\t\t");
fc71ac
 			else
fc71ac
 				dmi_slot_characteristics(data[0x0B], data[0x0C], "\t\t");
fc71ac
 			if (h->length < 0x11) break;
fc71ac
-			dmi_slot_segment_bus_func(WORD(data + 0x0D), data[0x0F], data[0x10], "\t");
fc71ac
+			dmi_slot_segment_bus_func(WORD(data + 0x0D), data[0x0F], data[0x10]);
fc71ac
 			if (h->length < 0x13) break;
fc71ac
-			printf("\tData Bus Width: %u\n", data[0x11]);
fc71ac
-			printf("\tPeer Devices: %u\n", data[0x12]);
fc71ac
+			pr_attr("Data Bus Width", "%u", data[0x11]);
fc71ac
+			pr_attr("Peer Devices", "%u", data[0x12]);
fc71ac
 			if (h->length - 0x13 >= data[0x12] * 5)
fc71ac
-				dmi_slot_peers(data[0x12], data + 0x13, "\t");
fc71ac
+				dmi_slot_peers(data[0x12], data + 0x13);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 10: /* 7.11 On Board Devices Information */
fc71ac
-			dmi_on_board_devices(h, "");
fc71ac
+			dmi_on_board_devices(h);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 11: /* 7.12 OEM Strings */
fc71ac
 			pr_handle_name("OEM Strings");
fc71ac
 			if (h->length < 0x05) break;
fc71ac
-			dmi_oem_strings(h, "\t");
fc71ac
+			dmi_oem_strings(h);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 12: /* 7.13 System Configuration Options */
fc71ac
 			pr_handle_name("System Configuration Options");
fc71ac
 			if (h->length < 0x05) break;
fc71ac
-			dmi_system_configuration_options(h, "\t");
fc71ac
+			dmi_system_configuration_options(h);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 13: /* 7.14 BIOS Language Information */
fc71ac
@@ -4258,19 +4305,19 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			if (h->length < 0x16) break;
fc71ac
 			if (ver >= 0x0201)
fc71ac
 			{
fc71ac
-				printf("\tLanguage Description Format: %s\n",
fc71ac
+				pr_attr("Language Description Format", "%s",
fc71ac
 					dmi_bios_language_format(data[0x05]));
fc71ac
 			}
fc71ac
 			printf("\tInstallable Languages: %u\n", data[0x04]);
fc71ac
 			dmi_bios_languages(h, "\t\t");
fc71ac
-			printf("\tCurrently Installed Language: %s\n",
fc71ac
+			pr_attr("Currently Installed Language", "%s",
fc71ac
 				dmi_string(h, data[0x15]));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 14: /* 7.15 Group Associations */
fc71ac
 			pr_handle_name("Group Associations");
fc71ac
 			if (h->length < 0x05) break;
fc71ac
-			printf("\tName: %s\n",
fc71ac
+			pr_attr("Name", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
 			printf("\tItems: %u\n",
fc71ac
 				(h->length - 0x05) / 3);
fc71ac
@@ -4280,51 +4327,47 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 		case 15: /* 7.16 System Event Log */
fc71ac
 			pr_handle_name("System Event Log");
fc71ac
 			if (h->length < 0x14) break;
fc71ac
-			printf("\tArea Length: %u bytes\n",
fc71ac
+			pr_attr("Area Length", "%u bytes",
fc71ac
 				WORD(data + 0x04));
fc71ac
-			printf("\tHeader Start Offset: 0x%04X\n",
fc71ac
+			pr_attr("Header Start Offset", "0x%04X",
fc71ac
 				WORD(data + 0x06));
fc71ac
 			if (WORD(data + 0x08) - WORD(data + 0x06))
fc71ac
-				printf("\tHeader Length: %u byte%s\n",
fc71ac
+				pr_attr("Header Length", "%u byte%s",
fc71ac
 					WORD(data + 0x08) - WORD(data + 0x06),
fc71ac
 					WORD(data + 0x08) - WORD(data + 0x06) > 1 ? "s" : "");
fc71ac
-			printf("\tData Start Offset: 0x%04X\n",
fc71ac
+			pr_attr("Data Start Offset", "0x%04X",
fc71ac
 				WORD(data + 0x08));
fc71ac
-			printf("\tAccess Method: %s\n",
fc71ac
+			pr_attr("Access Method", "%s",
fc71ac
 				dmi_event_log_method(data[0x0A]));
fc71ac
-			printf("\tAccess Address:");
fc71ac
 			dmi_event_log_address(data[0x0A], data + 0x10);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tStatus:");
fc71ac
 			dmi_event_log_status(data[0x0B]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tChange Token: 0x%08X\n",
fc71ac
+			pr_attr("Change Token", "0x%08X",
fc71ac
 				DWORD(data + 0x0C));
fc71ac
 			if (h->length < 0x17) break;
fc71ac
-			printf("\tHeader Format: %s\n",
fc71ac
+			pr_attr("Header Format", "%s",
fc71ac
 				dmi_event_log_header_type(data[0x14]));
fc71ac
-			printf("\tSupported Log Type Descriptors: %u\n",
fc71ac
+			pr_attr("Supported Log Type Descriptors", "%u",
fc71ac
 				data[0x15]);
fc71ac
 			if (h->length < 0x17 + data[0x15] * data[0x16]) break;
fc71ac
-			dmi_event_log_descriptors(data[0x15], data[0x16], data + 0x17, "\t");
fc71ac
+			dmi_event_log_descriptors(data[0x15], data[0x16], data + 0x17);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 16: /* 7.17 Physical Memory Array */
fc71ac
 			pr_handle_name("Physical Memory Array");
fc71ac
 			if (h->length < 0x0F) break;
fc71ac
-			printf("\tLocation: %s\n",
fc71ac
+			pr_attr("Location", "%s",
fc71ac
 				dmi_memory_array_location(data[0x04]));
fc71ac
-			printf("\tUse: %s\n",
fc71ac
+			pr_attr("Use", "%s",
fc71ac
 				dmi_memory_array_use(data[0x05]));
fc71ac
-			printf("\tError Correction Type: %s\n",
fc71ac
+			pr_attr("Error Correction Type", "%s",
fc71ac
 				dmi_memory_array_ec_type(data[0x06]));
fc71ac
-			printf("\tMaximum Capacity:");
fc71ac
 			if (DWORD(data + 0x07) == 0x80000000)
fc71ac
 			{
fc71ac
 				if (h->length < 0x17)
fc71ac
-					printf(" Unknown");
fc71ac
+					pr_attr("Maximum Capacity", "Unknown");
fc71ac
 				else
fc71ac
-					dmi_print_memory_size(QWORD(data + 0x0F), 0);
fc71ac
+					dmi_print_memory_size("Maximum Capacity",
fc71ac
+							      QWORD(data + 0x0F), 0);
fc71ac
 			}
fc71ac
 			else
fc71ac
 			{
fc71ac
@@ -4332,16 +4375,12 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 
fc71ac
 				capacity.h = 0;
fc71ac
 				capacity.l = DWORD(data + 0x07);
fc71ac
-				dmi_print_memory_size(capacity, 1);
fc71ac
+				dmi_print_memory_size("Maximum Capacity",
fc71ac
+						      capacity, 1);
fc71ac
 			}
fc71ac
-			printf("\n");
fc71ac
 			if (!(opt.flags & FLAG_QUIET))
fc71ac
-			{
fc71ac
-				printf("\tError Information Handle:");
fc71ac
 				dmi_memory_array_error_handle(WORD(data + 0x0B));
fc71ac
-				printf("\n");
fc71ac
-			}
fc71ac
-			printf("\tNumber Of Devices: %u\n",
fc71ac
+			pr_attr("Number Of Devices", "%u",
fc71ac
 				WORD(data + 0x0D));
fc71ac
 			break;
fc71ac
 
fc71ac
@@ -4350,132 +4389,91 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			if (h->length < 0x15) break;
fc71ac
 			if (!(opt.flags & FLAG_QUIET))
fc71ac
 			{
fc71ac
-				printf("\tArray Handle: 0x%04X\n",
fc71ac
+				pr_attr("Array Handle", "0x%04X",
fc71ac
 					WORD(data + 0x04));
fc71ac
-				printf("\tError Information Handle:");
fc71ac
 				dmi_memory_array_error_handle(WORD(data + 0x06));
fc71ac
-				printf("\n");
fc71ac
 			}
fc71ac
-			printf("\tTotal Width:");
fc71ac
-			dmi_memory_device_width(WORD(data + 0x08));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tData Width:");
fc71ac
-			dmi_memory_device_width(WORD(data + 0x0A));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tSize:");
fc71ac
+			dmi_memory_device_width("Total Width", WORD(data + 0x08));
fc71ac
+			dmi_memory_device_width("Data Width", WORD(data + 0x0A));
fc71ac
 			if (h->length >= 0x20 && WORD(data + 0x0C) == 0x7FFF)
fc71ac
 				dmi_memory_device_extended_size(DWORD(data + 0x1C));
fc71ac
 			else
fc71ac
 				dmi_memory_device_size(WORD(data + 0x0C));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tForm Factor: %s\n",
fc71ac
+			pr_attr("Form Factor", "%s",
fc71ac
 				dmi_memory_device_form_factor(data[0x0E]));
fc71ac
-			printf("\tSet:");
fc71ac
 			dmi_memory_device_set(data[0x0F]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tLocator: %s\n",
fc71ac
+			pr_attr("Locator", "%s",
fc71ac
 				dmi_string(h, data[0x10]));
fc71ac
-			printf("\tBank Locator: %s\n",
fc71ac
+			pr_attr("Bank Locator", "%s",
fc71ac
 				dmi_string(h, data[0x11]));
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_memory_device_type(data[0x12]));
fc71ac
-			printf("\tType Detail:");
fc71ac
 			dmi_memory_device_type_detail(WORD(data + 0x13));
fc71ac
-			printf("\n");
fc71ac
 			if (h->length < 0x17) break;
fc71ac
-			printf("\tSpeed:");
fc71ac
-			dmi_memory_device_speed(WORD(data + 0x15));
fc71ac
-			printf("\n");
fc71ac
+			dmi_memory_device_speed("Speed", WORD(data + 0x15));
fc71ac
 			if (h->length < 0x1B) break;
fc71ac
-			printf("\tManufacturer: %s\n",
fc71ac
+			pr_attr("Manufacturer", "%s",
fc71ac
 				dmi_string(h, data[0x17]));
fc71ac
-			printf("\tSerial Number: %s\n",
fc71ac
+			pr_attr("Serial Number", "%s",
fc71ac
 				dmi_string(h, data[0x18]));
fc71ac
-			printf("\tAsset Tag: %s\n",
fc71ac
+			pr_attr("Asset Tag", "%s",
fc71ac
 				dmi_string(h, data[0x19]));
fc71ac
-			printf("\tPart Number: %s\n",
fc71ac
+			pr_attr("Part Number", "%s",
fc71ac
 				dmi_string(h, data[0x1A]));
fc71ac
 			if (h->length < 0x1C) break;
fc71ac
-			printf("\tRank: ");
fc71ac
 			if ((data[0x1B] & 0x0F) == 0)
fc71ac
-				printf("Unknown");
fc71ac
+				pr_attr("Rank", "Unknown");
fc71ac
 			else
fc71ac
-				printf("%u", data[0x1B] & 0x0F);
fc71ac
-			printf("\n");
fc71ac
+				pr_attr("Rank", "%u", data[0x1B] & 0x0F);
fc71ac
 			if (h->length < 0x22) break;
fc71ac
-			printf("\tConfigured Memory Speed:");
fc71ac
-			dmi_memory_device_speed(WORD(data + 0x20));
fc71ac
-			printf("\n");
fc71ac
+			dmi_memory_device_speed("Configured Memory Speed",
fc71ac
+						WORD(data + 0x20));
fc71ac
 			if (h->length < 0x28) break;
fc71ac
-			printf("\tMinimum Voltage:");
fc71ac
-			dmi_memory_voltage_value(WORD(data + 0x22));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMaximum Voltage:");
fc71ac
-			dmi_memory_voltage_value(WORD(data + 0x24));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tConfigured Voltage:");
fc71ac
-			dmi_memory_voltage_value(WORD(data + 0x26));
fc71ac
-			printf("\n");
fc71ac
+			dmi_memory_voltage_value("Minimum Voltage",
fc71ac
+						 WORD(data + 0x22));
fc71ac
+			dmi_memory_voltage_value("Maximum Voltage",
fc71ac
+						 WORD(data + 0x24));
fc71ac
+			dmi_memory_voltage_value("Configured Voltage",
fc71ac
+						 WORD(data + 0x26));
fc71ac
 			if (h->length < 0x34) break;
fc71ac
-			printf("\tMemory Technology:");
fc71ac
 			dmi_memory_technology(data[0x28]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMemory Operating Mode Capability:");
fc71ac
 			dmi_memory_operating_mode_capability(WORD(data + 0x29));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tFirmware Version: %s\n",
fc71ac
+			pr_attr("Firmware Version", "%s",
fc71ac
 				dmi_string(h, data[0x2B]));
fc71ac
-			printf("\tModule Manufacturer ID:");
fc71ac
-			dmi_memory_manufacturer_id(WORD(data + 0x2C));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tModule Product ID:");
fc71ac
-			dmi_memory_product_id(WORD(data + 0x2E));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMemory Subsystem Controller Manufacturer ID:");
fc71ac
-			dmi_memory_manufacturer_id(WORD(data + 0x30));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMemory Subsystem Controller Product ID:");
fc71ac
-			dmi_memory_product_id(WORD(data + 0x32));
fc71ac
-			printf("\n");
fc71ac
+			dmi_memory_manufacturer_id("Module Manufacturer ID",
fc71ac
+						   WORD(data + 0x2C));
fc71ac
+			dmi_memory_product_id("Module Product ID",
fc71ac
+					      WORD(data + 0x2E));
fc71ac
+			dmi_memory_manufacturer_id("Memory Subsystem Controller Manufacturer ID",
fc71ac
+						   WORD(data + 0x30));
fc71ac
+			dmi_memory_product_id("Memory Subsystem Controller Product ID",
fc71ac
+					      WORD(data + 0x32));
fc71ac
 			if (h->length < 0x3C) break;
fc71ac
-			printf("\tNon-Volatile Size:");
fc71ac
-			dmi_memory_size(QWORD(data + 0x34));
fc71ac
-			printf("\n");
fc71ac
+			dmi_memory_size("Non-Volatile Size", QWORD(data + 0x34));
fc71ac
 			if (h->length < 0x44) break;
fc71ac
-			printf("\tVolatile Size:");
fc71ac
-			dmi_memory_size(QWORD(data + 0x3C));
fc71ac
-			printf("\n");
fc71ac
+			dmi_memory_size("Volatile Size", QWORD(data + 0x3C));
fc71ac
 			if (h->length < 0x4C) break;
fc71ac
-			printf("\tCache Size:");
fc71ac
-			dmi_memory_size(QWORD(data + 0x44));
fc71ac
-			printf("\n");
fc71ac
+			dmi_memory_size("Cache Size", QWORD(data + 0x44));
fc71ac
 			if (h->length < 0x54) break;
fc71ac
-			printf("\tLogical Size:");
fc71ac
-			dmi_memory_size(QWORD(data + 0x4C));
fc71ac
-			printf("\n");
fc71ac
+			dmi_memory_size("Logical Size", QWORD(data + 0x4C));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 18: /* 7.19 32-bit Memory Error Information */
fc71ac
 			pr_handle_name("32-bit Memory Error Information");
fc71ac
 			if (h->length < 0x17) break;
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_memory_error_type(data[0x04]));
fc71ac
-			printf("\tGranularity: %s\n",
fc71ac
+			pr_attr("Granularity", "%s",
fc71ac
 				dmi_memory_error_granularity(data[0x05]));
fc71ac
-			printf("\tOperation: %s\n",
fc71ac
+			pr_attr("Operation", "%s",
fc71ac
 				dmi_memory_error_operation(data[0x06]));
fc71ac
-			printf("\tVendor Syndrome:");
fc71ac
 			dmi_memory_error_syndrome(DWORD(data + 0x07));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMemory Array Address:");
fc71ac
-			dmi_32bit_memory_error_address(DWORD(data + 0x0B));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tDevice Address:");
fc71ac
-			dmi_32bit_memory_error_address(DWORD(data + 0x0F));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tResolution:");
fc71ac
-			dmi_32bit_memory_error_address(DWORD(data + 0x13));
fc71ac
-			printf("\n");
fc71ac
+			dmi_32bit_memory_error_address("Memory Array Address",
fc71ac
+						       DWORD(data + 0x0B));
fc71ac
+			dmi_32bit_memory_error_address("Device Address",
fc71ac
+						       DWORD(data + 0x0F));
fc71ac
+			dmi_32bit_memory_error_address("Resolution",
fc71ac
+						       DWORD(data + 0x13));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 19: /* 7.20 Memory Array Mapped Address */
fc71ac
@@ -4488,29 +4486,26 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 				start = QWORD(data + 0x0F);
fc71ac
 				end = QWORD(data + 0x17);
fc71ac
 
fc71ac
-				printf("\tStarting Address: 0x%08X%08Xk\n",
fc71ac
+				pr_attr("Starting Address", "0x%08X%08Xk",
fc71ac
 					start.h, start.l);
fc71ac
-				printf("\tEnding Address: 0x%08X%08Xk\n",
fc71ac
+				pr_attr("Ending Address", "0x%08X%08Xk",
fc71ac
 					end.h, end.l);
fc71ac
-				printf("\tRange Size:");
fc71ac
 				dmi_mapped_address_extended_size(start, end);
fc71ac
 			}
fc71ac
 			else
fc71ac
 			{
fc71ac
-				printf("\tStarting Address: 0x%08X%03X\n",
fc71ac
+				pr_attr("Starting Address", "0x%08X%03X",
fc71ac
 					DWORD(data + 0x04) >> 2,
fc71ac
 					(DWORD(data + 0x04) & 0x3) << 10);
fc71ac
-				printf("\tEnding Address: 0x%08X%03X\n",
fc71ac
+				pr_attr("Ending Address", "0x%08X%03X",
fc71ac
 					DWORD(data + 0x08) >> 2,
fc71ac
 					((DWORD(data + 0x08) & 0x3) << 10) + 0x3FF);
fc71ac
-				printf("\tRange Size:");
fc71ac
 				dmi_mapped_address_size(DWORD(data + 0x08) - DWORD(data + 0x04) + 1);
fc71ac
 			}
fc71ac
-			printf("\n");
fc71ac
 			if (!(opt.flags & FLAG_QUIET))
fc71ac
-				printf("\tPhysical Array Handle: 0x%04X\n",
fc71ac
+				pr_attr("Physical Array Handle", "0x%04X",
fc71ac
 					WORD(data + 0x0C));
fc71ac
-			printf("\tPartition Width: %u\n",
fc71ac
+			pr_attr("Partition Width", "%u",
fc71ac
 				data[0x0E]);
fc71ac
 			break;
fc71ac
 
fc71ac
@@ -4524,344 +4519,288 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 				start = QWORD(data + 0x13);
fc71ac
 				end = QWORD(data + 0x1B);
fc71ac
 
fc71ac
-				printf("\tStarting Address: 0x%08X%08Xk\n",
fc71ac
+				pr_attr("Starting Address", "0x%08X%08Xk",
fc71ac
 					start.h, start.l);
fc71ac
-				printf("\tEnding Address: 0x%08X%08Xk\n",
fc71ac
+				pr_attr("Ending Address", "0x%08X%08Xk",
fc71ac
 					end.h, end.l);
fc71ac
-				printf("\tRange Size:");
fc71ac
 				dmi_mapped_address_extended_size(start, end);
fc71ac
 			}
fc71ac
 			else
fc71ac
 			{
fc71ac
-				printf("\tStarting Address: 0x%08X%03X\n",
fc71ac
+				pr_attr("Starting Address", "0x%08X%03X",
fc71ac
 					DWORD(data + 0x04) >> 2,
fc71ac
 					(DWORD(data + 0x04) & 0x3) << 10);
fc71ac
-				printf("\tEnding Address: 0x%08X%03X\n",
fc71ac
+				pr_attr("Ending Address", "0x%08X%03X",
fc71ac
 					DWORD(data + 0x08) >> 2,
fc71ac
 					((DWORD(data + 0x08) & 0x3) << 10) + 0x3FF);
fc71ac
-				printf("\tRange Size:");
fc71ac
 				dmi_mapped_address_size(DWORD(data + 0x08) - DWORD(data + 0x04) + 1);
fc71ac
 			}
fc71ac
-			printf("\n");
fc71ac
 			if (!(opt.flags & FLAG_QUIET))
fc71ac
 			{
fc71ac
-				printf("\tPhysical Device Handle: 0x%04X\n",
fc71ac
+				pr_attr("Physical Device Handle", "0x%04X",
fc71ac
 					WORD(data + 0x0C));
fc71ac
-				printf("\tMemory Array Mapped Address Handle: 0x%04X\n",
fc71ac
+				pr_attr("Memory Array Mapped Address Handle", "0x%04X",
fc71ac
 					WORD(data + 0x0E));
fc71ac
 			}
fc71ac
-			printf("\tPartition Row Position:");
fc71ac
 			dmi_mapped_address_row_position(data[0x10]);
fc71ac
-			printf("\n");
fc71ac
-			dmi_mapped_address_interleave_position(data[0x11], "\t");
fc71ac
-			dmi_mapped_address_interleaved_data_depth(data[0x12], "\t");
fc71ac
+			dmi_mapped_address_interleave_position(data[0x11]);
fc71ac
+			dmi_mapped_address_interleaved_data_depth(data[0x12]);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 21: /* 7.22 Built-in Pointing Device */
fc71ac
 			pr_handle_name("Built-in Pointing Device");
fc71ac
 			if (h->length < 0x07) break;
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_pointing_device_type(data[0x04]));
fc71ac
-			printf("\tInterface: %s\n",
fc71ac
+			pr_attr("Interface", "%s",
fc71ac
 				dmi_pointing_device_interface(data[0x05]));
fc71ac
-			printf("\tButtons: %u\n",
fc71ac
+			pr_attr("Buttons", "%u",
fc71ac
 				data[0x06]);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 22: /* 7.23 Portable Battery */
fc71ac
 			pr_handle_name("Portable Battery");
fc71ac
 			if (h->length < 0x10) break;
fc71ac
-			printf("\tLocation: %s\n",
fc71ac
+			pr_attr("Location", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tManufacturer: %s\n",
fc71ac
+			pr_attr("Manufacturer", "%s",
fc71ac
 				dmi_string(h, data[0x05]));
fc71ac
 			if (data[0x06] || h->length < 0x1A)
fc71ac
-				printf("\tManufacture Date: %s\n",
fc71ac
+				pr_attr("Manufacture Date", "%s",
fc71ac
 					dmi_string(h, data[0x06]));
fc71ac
 			if (data[0x07] || h->length < 0x1A)
fc71ac
-				printf("\tSerial Number: %s\n",
fc71ac
+				pr_attr("Serial Number", "%s",
fc71ac
 					dmi_string(h, data[0x07]));
fc71ac
-			printf("\tName: %s\n",
fc71ac
+			pr_attr("Name", "%s",
fc71ac
 				dmi_string(h, data[0x08]));
fc71ac
 			if (data[0x09] != 0x02 || h->length < 0x1A)
fc71ac
-				printf("\tChemistry: %s\n",
fc71ac
+				pr_attr("Chemistry", "%s",
fc71ac
 					dmi_battery_chemistry(data[0x09]));
fc71ac
-			printf("\tDesign Capacity:");
fc71ac
 			if (h->length < 0x16)
fc71ac
 				dmi_battery_capacity(WORD(data + 0x0A), 1);
fc71ac
 			else
fc71ac
 				dmi_battery_capacity(WORD(data + 0x0A), data[0x15]);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tDesign Voltage:");
fc71ac
 			dmi_battery_voltage(WORD(data + 0x0C));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tSBDS Version: %s\n",
fc71ac
+			pr_attr("SBDS Version", "%s",
fc71ac
 				dmi_string(h, data[0x0E]));
fc71ac
-			printf("\tMaximum Error:");
fc71ac
 			dmi_battery_maximum_error(data[0x0F]);
fc71ac
-			printf("\n");
fc71ac
 			if (h->length < 0x1A) break;
fc71ac
 			if (data[0x07] == 0)
fc71ac
-				printf("\tSBDS Serial Number: %04X\n",
fc71ac
+				pr_attr("SBDS Serial Number", "%04X",
fc71ac
 					WORD(data + 0x10));
fc71ac
 			if (data[0x06] == 0)
fc71ac
-				printf("\tSBDS Manufacture Date: %u-%02u-%02u\n",
fc71ac
+				pr_attr("SBDS Manufacture Date", "%u-%02u-%02u",
fc71ac
 					1980 + (WORD(data + 0x12) >> 9),
fc71ac
 					(WORD(data + 0x12) >> 5) & 0x0F,
fc71ac
 					WORD(data + 0x12) & 0x1F);
fc71ac
 			if (data[0x09] == 0x02)
fc71ac
-				printf("\tSBDS Chemistry: %s\n",
fc71ac
+				pr_attr("SBDS Chemistry", "%s",
fc71ac
 					dmi_string(h, data[0x14]));
fc71ac
-			printf("\tOEM-specific Information: 0x%08X\n",
fc71ac
+			pr_attr("OEM-specific Information", "0x%08X",
fc71ac
 				DWORD(data + 0x16));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 23: /* 7.24 System Reset */
fc71ac
 			pr_handle_name("System Reset");
fc71ac
 			if (h->length < 0x0D) break;
fc71ac
-			printf("\tStatus: %s\n",
fc71ac
+			pr_attr("Status", "%s",
fc71ac
 				data[0x04] & (1 << 0) ? "Enabled" : "Disabled");
fc71ac
-			printf("\tWatchdog Timer: %s\n",
fc71ac
+			pr_attr("Watchdog Timer", "%s",
fc71ac
 				data[0x04] & (1 << 5) ? "Present" : "Not Present");
fc71ac
 			if (!(data[0x04] & (1 << 5)))
fc71ac
 				break;
fc71ac
-			printf("\tBoot Option: %s\n",
fc71ac
+			pr_attr("Boot Option", "%s",
fc71ac
 				dmi_system_reset_boot_option((data[0x04] >> 1) & 0x3));
fc71ac
-			printf("\tBoot Option On Limit: %s\n",
fc71ac
+			pr_attr("Boot Option On Limit", "%s",
fc71ac
 				dmi_system_reset_boot_option((data[0x04] >> 3) & 0x3));
fc71ac
-			printf("\tReset Count:");
fc71ac
-			dmi_system_reset_count(WORD(data + 0x05));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tReset Limit:");
fc71ac
-			dmi_system_reset_count(WORD(data + 0x07));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tTimer Interval:");
fc71ac
-			dmi_system_reset_timer(WORD(data + 0x09));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tTimeout:");
fc71ac
-			dmi_system_reset_timer(WORD(data + 0x0B));
fc71ac
-			printf("\n");
fc71ac
+			dmi_system_reset_count("Reset Count", WORD(data + 0x05));
fc71ac
+			dmi_system_reset_count("Reset Limit", WORD(data + 0x07));
fc71ac
+			dmi_system_reset_timer("Timer Interval", WORD(data + 0x09));
fc71ac
+			dmi_system_reset_timer("Timeout", WORD(data + 0x0B));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 24: /* 7.25 Hardware Security */
fc71ac
 			pr_handle_name("Hardware Security");
fc71ac
 			if (h->length < 0x05) break;
fc71ac
-			printf("\tPower-On Password Status: %s\n",
fc71ac
+			pr_attr("Power-On Password Status", "%s",
fc71ac
 				dmi_hardware_security_status(data[0x04] >> 6));
fc71ac
-			printf("\tKeyboard Password Status: %s\n",
fc71ac
+			pr_attr("Keyboard Password Status", "%s",
fc71ac
 				dmi_hardware_security_status((data[0x04] >> 4) & 0x3));
fc71ac
-			printf("\tAdministrator Password Status: %s\n",
fc71ac
+			pr_attr("Administrator Password Status", "%s",
fc71ac
 				dmi_hardware_security_status((data[0x04] >> 2) & 0x3));
fc71ac
-			printf("\tFront Panel Reset Status: %s\n",
fc71ac
+			pr_attr("Front Panel Reset Status", "%s",
fc71ac
 				dmi_hardware_security_status(data[0x04] & 0x3));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 25: /* 7.26 System Power Controls */
fc71ac
 			pr_handle_name("System Power Controls");
fc71ac
 			if (h->length < 0x09) break;
fc71ac
-			printf("\tNext Scheduled Power-on:");
fc71ac
 			dmi_power_controls_power_on(data + 0x04);
fc71ac
-			printf("\n");
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 26: /* 7.27 Voltage Probe */
fc71ac
 			pr_handle_name("Voltage Probe");
fc71ac
 			if (h->length < 0x14) break;
fc71ac
-			printf("\tDescription: %s\n",
fc71ac
+			pr_attr("Description", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tLocation: %s\n",
fc71ac
+			pr_attr("Location", "%s",
fc71ac
 				dmi_voltage_probe_location(data[0x05] & 0x1f));
fc71ac
-			printf("\tStatus: %s\n",
fc71ac
+			pr_attr("Status", "%s",
fc71ac
 				dmi_probe_status(data[0x05] >> 5));
fc71ac
-			printf("\tMaximum Value:");
fc71ac
-			dmi_voltage_probe_value(WORD(data + 0x06));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMinimum Value:");
fc71ac
-			dmi_voltage_probe_value(WORD(data + 0x08));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tResolution:");
fc71ac
+			dmi_voltage_probe_value("Maximum Value", WORD(data + 0x06));
fc71ac
+			dmi_voltage_probe_value("Minimum Value", WORD(data + 0x08));
fc71ac
 			dmi_voltage_probe_resolution(WORD(data + 0x0A));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tTolerance:");
fc71ac
-			dmi_voltage_probe_value(WORD(data + 0x0C));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tAccuracy:");
fc71ac
+			dmi_voltage_probe_value("Tolerance", WORD(data + 0x0C));
fc71ac
 			dmi_probe_accuracy(WORD(data + 0x0E));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tOEM-specific Information: 0x%08X\n",
fc71ac
+			pr_attr("OEM-specific Information", "0x%08X",
fc71ac
 				DWORD(data + 0x10));
fc71ac
 			if (h->length < 0x16) break;
fc71ac
-			printf("\tNominal Value:");
fc71ac
-			dmi_voltage_probe_value(WORD(data + 0x14));
fc71ac
-			printf("\n");
fc71ac
+			dmi_voltage_probe_value("Nominal Value", WORD(data + 0x14));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 27: /* 7.28 Cooling Device */
fc71ac
 			pr_handle_name("Cooling Device");
fc71ac
 			if (h->length < 0x0C) break;
fc71ac
 			if (!(opt.flags & FLAG_QUIET) && WORD(data + 0x04) != 0xFFFF)
fc71ac
-				printf("\tTemperature Probe Handle: 0x%04X\n",
fc71ac
+				pr_attr("Temperature Probe Handle", "0x%04X",
fc71ac
 					WORD(data + 0x04));
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_cooling_device_type(data[0x06] & 0x1f));
fc71ac
-			printf("\tStatus: %s\n",
fc71ac
+			pr_attr("Status", "%s",
fc71ac
 				dmi_probe_status(data[0x06] >> 5));
fc71ac
 			if (data[0x07] != 0x00)
fc71ac
-				printf("\tCooling Unit Group: %u\n",
fc71ac
+				pr_attr("Cooling Unit Group", "%u",
fc71ac
 					data[0x07]);
fc71ac
-			printf("\tOEM-specific Information: 0x%08X\n",
fc71ac
+			pr_attr("OEM-specific Information", "0x%08X",
fc71ac
 				DWORD(data + 0x08));
fc71ac
 			if (h->length < 0x0E) break;
fc71ac
-			printf("\tNominal Speed:");
fc71ac
 			dmi_cooling_device_speed(WORD(data + 0x0C));
fc71ac
-			printf("\n");
fc71ac
 			if (h->length < 0x0F) break;
fc71ac
-			printf("\tDescription: %s\n", dmi_string(h, data[0x0E]));
fc71ac
+			pr_attr("Description", "%s", dmi_string(h, data[0x0E]));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 28: /* 7.29 Temperature Probe */
fc71ac
 			pr_handle_name("Temperature Probe");
fc71ac
 			if (h->length < 0x14) break;
fc71ac
-			printf("\tDescription: %s\n",
fc71ac
+			pr_attr("Description", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tLocation: %s\n",
fc71ac
+			pr_attr("Location", "%s",
fc71ac
 				dmi_temperature_probe_location(data[0x05] & 0x1F));
fc71ac
-			printf("\tStatus: %s\n",
fc71ac
+			pr_attr("Status", "%s",
fc71ac
 				dmi_probe_status(data[0x05] >> 5));
fc71ac
-			printf("\tMaximum Value:");
fc71ac
-			dmi_temperature_probe_value(WORD(data + 0x06));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMinimum Value:");
fc71ac
-			dmi_temperature_probe_value(WORD(data + 0x08));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tResolution:");
fc71ac
+			dmi_temperature_probe_value("Maximum Value",
fc71ac
+						    WORD(data + 0x06));
fc71ac
+			dmi_temperature_probe_value("Minimum Value",
fc71ac
+						    WORD(data + 0x08));
fc71ac
 			dmi_temperature_probe_resolution(WORD(data + 0x0A));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tTolerance:");
fc71ac
-			dmi_temperature_probe_value(WORD(data + 0x0C));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tAccuracy:");
fc71ac
+			dmi_temperature_probe_value("Tolerance",
fc71ac
+						    WORD(data + 0x0C));
fc71ac
 			dmi_probe_accuracy(WORD(data + 0x0E));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tOEM-specific Information: 0x%08X\n",
fc71ac
+			pr_attr("OEM-specific Information", "0x%08X",
fc71ac
 				DWORD(data + 0x10));
fc71ac
 			if (h->length < 0x16) break;
fc71ac
-			printf("\tNominal Value:");
fc71ac
-			dmi_temperature_probe_value(WORD(data + 0x14));
fc71ac
-			printf("\n");
fc71ac
+			dmi_temperature_probe_value("Nominal Value",
fc71ac
+						    WORD(data + 0x14));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 29: /* 7.30 Electrical Current Probe */
fc71ac
 			pr_handle_name("Electrical Current Probe");
fc71ac
 			if (h->length < 0x14) break;
fc71ac
-			printf("\tDescription: %s\n",
fc71ac
+			pr_attr("Description", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tLocation: %s\n",
fc71ac
+			pr_attr("Location", "%s",
fc71ac
 				dmi_voltage_probe_location(data[5] & 0x1F));
fc71ac
-			printf("\tStatus: %s\n",
fc71ac
+			pr_attr("Status", "%s",
fc71ac
 				dmi_probe_status(data[0x05] >> 5));
fc71ac
-			printf("\tMaximum Value:");
fc71ac
-			dmi_current_probe_value(WORD(data + 0x06));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMinimum Value:");
fc71ac
-			dmi_current_probe_value(WORD(data + 0x08));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tResolution:");
fc71ac
+			dmi_current_probe_value("Maximum Value",
fc71ac
+						WORD(data + 0x06));
fc71ac
+			dmi_current_probe_value("Minimum Value",
fc71ac
+						WORD(data + 0x08));
fc71ac
 			dmi_current_probe_resolution(WORD(data + 0x0A));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tTolerance:");
fc71ac
-			dmi_current_probe_value(WORD(data + 0x0C));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tAccuracy:");
fc71ac
+			dmi_current_probe_value("Tolerance",
fc71ac
+						WORD(data + 0x0C));
fc71ac
 			dmi_probe_accuracy(WORD(data + 0x0E));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tOEM-specific Information: 0x%08X\n",
fc71ac
+			pr_attr("OEM-specific Information", "0x%08X",
fc71ac
 				DWORD(data + 0x10));
fc71ac
 			if (h->length < 0x16) break;
fc71ac
-			printf("\tNominal Value:");
fc71ac
-			dmi_current_probe_value(WORD(data + 0x14));
fc71ac
-			printf("\n");
fc71ac
+			dmi_current_probe_value("Nominal Value",
fc71ac
+						WORD(data + 0x14));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 30: /* 7.31 Out-of-band Remote Access */
fc71ac
 			pr_handle_name("Out-of-band Remote Access");
fc71ac
 			if (h->length < 0x06) break;
fc71ac
-			printf("\tManufacturer Name: %s\n",
fc71ac
+			pr_attr("Manufacturer Name", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tInbound Connection: %s\n",
fc71ac
+			pr_attr("Inbound Connection", "%s",
fc71ac
 				data[0x05] & (1 << 0) ? "Enabled" : "Disabled");
fc71ac
-			printf("\tOutbound Connection: %s\n",
fc71ac
+			pr_attr("Outbound Connection", "%s",
fc71ac
 				data[0x05] & (1 << 1) ? "Enabled" : "Disabled");
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 31: /* 7.32 Boot Integrity Services Entry Point */
fc71ac
 			pr_handle_name("Boot Integrity Services Entry Point");
fc71ac
 			if (h->length < 0x1C) break;
fc71ac
-			printf("\tChecksum: %s\n",
fc71ac
+			pr_attr("Checksum", "%s",
fc71ac
 				checksum(data, h->length) ? "OK" : "Invalid");
fc71ac
-			printf("\t16-bit Entry Point Address: %04X:%04X\n",
fc71ac
+			pr_attr("16-bit Entry Point Address", "%04X:%04X",
fc71ac
 				DWORD(data + 0x08) >> 16,
fc71ac
 				DWORD(data + 0x08) & 0xFFFF);
fc71ac
-			printf("\t32-bit Entry Point Address: 0x%08X\n",
fc71ac
+			pr_attr("32-bit Entry Point Address", "0x%08X",
fc71ac
 				DWORD(data + 0x0C));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 32: /* 7.33 System Boot Information */
fc71ac
 			pr_handle_name("System Boot Information");
fc71ac
 			if (h->length < 0x0B) break;
fc71ac
-			printf("\tStatus: %s\n",
fc71ac
+			pr_attr("Status", "%s",
fc71ac
 				dmi_system_boot_status(data[0x0A]));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 33: /* 7.34 64-bit Memory Error Information */
fc71ac
 			pr_handle_name("64-bit Memory Error Information");
fc71ac
 			if (h->length < 0x1F) break;
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_memory_error_type(data[0x04]));
fc71ac
-			printf("\tGranularity: %s\n",
fc71ac
+			pr_attr("Granularity", "%s",
fc71ac
 				dmi_memory_error_granularity(data[0x05]));
fc71ac
-			printf("\tOperation: %s\n",
fc71ac
+			pr_attr("Operation", "%s",
fc71ac
 				dmi_memory_error_operation(data[0x06]));
fc71ac
-			printf("\tVendor Syndrome:");
fc71ac
 			dmi_memory_error_syndrome(DWORD(data + 0x07));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tMemory Array Address:");
fc71ac
-			dmi_64bit_memory_error_address(QWORD(data + 0x0B));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tDevice Address:");
fc71ac
-			dmi_64bit_memory_error_address(QWORD(data + 0x13));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tResolution:");
fc71ac
-			dmi_32bit_memory_error_address(DWORD(data + 0x1B));
fc71ac
-			printf("\n");
fc71ac
+			dmi_64bit_memory_error_address("Memory Array Address",
fc71ac
+						       QWORD(data + 0x0B));
fc71ac
+			dmi_64bit_memory_error_address("Device Address",
fc71ac
+						       QWORD(data + 0x13));
fc71ac
+			dmi_32bit_memory_error_address("Resolution",
fc71ac
+						       DWORD(data + 0x1B));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 34: /* 7.35 Management Device */
fc71ac
 			pr_handle_name("Management Device");
fc71ac
 			if (h->length < 0x0B) break;
fc71ac
-			printf("\tDescription: %s\n",
fc71ac
+			pr_attr("Description", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_management_device_type(data[0x05]));
fc71ac
-			printf("\tAddress: 0x%08X\n",
fc71ac
+			pr_attr("Address", "0x%08X",
fc71ac
 				DWORD(data + 0x06));
fc71ac
-			printf("\tAddress Type: %s\n",
fc71ac
+			pr_attr("Address Type", "%s",
fc71ac
 				dmi_management_device_address_type(data[0x0A]));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 35: /* 7.36 Management Device Component */
fc71ac
 			pr_handle_name("Management Device Component");
fc71ac
 			if (h->length < 0x0B) break;
fc71ac
-			printf("\tDescription: %s\n",
fc71ac
+			pr_attr("Description", "%s",
fc71ac
 				dmi_string(h, data[0x04]));
fc71ac
 			if (!(opt.flags & FLAG_QUIET))
fc71ac
 			{
fc71ac
-				printf("\tManagement Device Handle: 0x%04X\n",
fc71ac
+				pr_attr("Management Device Handle", "0x%04X",
fc71ac
 					WORD(data + 0x05));
fc71ac
-				printf("\tComponent Handle: 0x%04X\n",
fc71ac
+				pr_attr("Component Handle", "0x%04X",
fc71ac
 					WORD(data + 0x07));
fc71ac
 				if (WORD(data + 0x09) != 0xFFFF)
fc71ac
-					printf("\tThreshold Handle: 0x%04X\n",
fc71ac
+					pr_attr("Threshold Handle", "0x%04X",
fc71ac
 						WORD(data + 0x09));
fc71ac
 			}
fc71ac
 			break;
fc71ac
@@ -4870,36 +4809,36 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			pr_handle_name("Management Device Threshold Data");
fc71ac
 			if (h->length < 0x10) break;
fc71ac
 			if (WORD(data + 0x04) != 0x8000)
fc71ac
-				printf("\tLower Non-critical Threshold: %d\n",
fc71ac
+				pr_attr("Lower Non-critical Threshold", "%d",
fc71ac
 					(i16)WORD(data + 0x04));
fc71ac
 			if (WORD(data + 0x06) != 0x8000)
fc71ac
-				printf("\tUpper Non-critical Threshold: %d\n",
fc71ac
+				pr_attr("Upper Non-critical Threshold", "%d",
fc71ac
 					(i16)WORD(data + 0x06));
fc71ac
 			if (WORD(data + 0x08) != 0x8000)
fc71ac
-				printf("\tLower Critical Threshold: %d\n",
fc71ac
+				pr_attr("Lower Critical Threshold", "%d",
fc71ac
 					(i16)WORD(data + 0x08));
fc71ac
 			if (WORD(data + 0x0A) != 0x8000)
fc71ac
-				printf("\tUpper Critical Threshold: %d\n",
fc71ac
+				pr_attr("Upper Critical Threshold", "%d",
fc71ac
 					(i16)WORD(data + 0x0A));
fc71ac
 			if (WORD(data + 0x0C) != 0x8000)
fc71ac
-				printf("\tLower Non-recoverable Threshold: %d\n",
fc71ac
+				pr_attr("Lower Non-recoverable Threshold", "%d",
fc71ac
 					(i16)WORD(data + 0x0C));
fc71ac
 			if (WORD(data + 0x0E) != 0x8000)
fc71ac
-				printf("\tUpper Non-recoverable Threshold: %d\n",
fc71ac
+				pr_attr("Upper Non-recoverable Threshold", "%d",
fc71ac
 					(i16)WORD(data + 0x0E));
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 37: /* 7.38 Memory Channel */
fc71ac
 			pr_handle_name("Memory Channel");
fc71ac
 			if (h->length < 0x07) break;
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_memory_channel_type(data[0x04]));
fc71ac
-			printf("\tMaximal Load: %u\n",
fc71ac
+			pr_attr("Maximal Load", "%u",
fc71ac
 				data[0x05]);
fc71ac
-			printf("\tDevices: %u\n",
fc71ac
+			pr_attr("Devices", "%u",
fc71ac
 				data[0x06]);
fc71ac
 			if (h->length < 0x07 + 3 * data[0x06]) break;
fc71ac
-			dmi_memory_channel_devices(data[0x06], data + 0x07, "\t");
fc71ac
+			dmi_memory_channel_devices(data[0x06], data + 0x07);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 38: /* 7.39 IPMI Device Information */
fc71ac
@@ -4909,37 +4848,35 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			 */
fc71ac
 			pr_handle_name("IPMI Device Information");
fc71ac
 			if (h->length < 0x10) break;
fc71ac
-			printf("\tInterface Type: %s\n",
fc71ac
+			pr_attr("Interface Type", "%s",
fc71ac
 				dmi_ipmi_interface_type(data[0x04]));
fc71ac
-			printf("\tSpecification Version: %u.%u\n",
fc71ac
+			pr_attr("Specification Version", "%u.%u",
fc71ac
 				data[0x05] >> 4, data[0x05] & 0x0F);
fc71ac
-			printf("\tI2C Slave Address: 0x%02x\n",
fc71ac
+			pr_attr("I2C Slave Address", "0x%02x",
fc71ac
 				data[0x06] >> 1);
fc71ac
 			if (data[0x07] != 0xFF)
fc71ac
-				printf("\tNV Storage Device Address: %u\n",
fc71ac
+				pr_attr("NV Storage Device Address", "%u",
fc71ac
 					data[0x07]);
fc71ac
 			else
fc71ac
-				printf("\tNV Storage Device: Not Present\n");
fc71ac
-			printf("\tBase Address: ");
fc71ac
+				pr_attr("NV Storage Device", "Not Present");
fc71ac
 			dmi_ipmi_base_address(data[0x04], data + 0x08,
fc71ac
 				h->length < 0x11 ? 0 : (data[0x10] >> 4) & 1);
fc71ac
-			printf("\n");
fc71ac
 			if (h->length < 0x12) break;
fc71ac
 			if (data[0x04] != 0x04)
fc71ac
 			{
fc71ac
-				printf("\tRegister Spacing: %s\n",
fc71ac
+				pr_attr("Register Spacing", "%s",
fc71ac
 					dmi_ipmi_register_spacing(data[0x10] >> 6));
fc71ac
 				if (data[0x10] & (1 << 3))
fc71ac
 				{
fc71ac
-					printf("\tInterrupt Polarity: %s\n",
fc71ac
+					pr_attr("Interrupt Polarity", "%s",
fc71ac
 						data[0x10] & (1 << 1) ? "Active High" : "Active Low");
fc71ac
-					printf("\tInterrupt Trigger Mode: %s\n",
fc71ac
+					pr_attr("Interrupt Trigger Mode", "%s",
fc71ac
 						data[0x10] & (1 << 0) ? "Level" : "Edge");
fc71ac
 				}
fc71ac
 			}
fc71ac
 			if (data[0x11] != 0x00)
fc71ac
 			{
fc71ac
-				printf("\tInterrupt Number: %u\n",
fc71ac
+				pr_attr("Interrupt Number", "%u",
fc71ac
 					data[0x11]);
fc71ac
 			}
fc71ac
 			break;
fc71ac
@@ -4948,51 +4885,47 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			pr_handle_name("System Power Supply");
fc71ac
 			if (h->length < 0x10) break;
fc71ac
 			if (data[0x04] != 0x00)
fc71ac
-				printf("\tPower Unit Group: %u\n",
fc71ac
+				pr_attr("Power Unit Group", "%u",
fc71ac
 					data[0x04]);
fc71ac
-			printf("\tLocation: %s\n",
fc71ac
+			pr_attr("Location", "%s",
fc71ac
 				dmi_string(h, data[0x05]));
fc71ac
-			printf("\tName: %s\n",
fc71ac
+			pr_attr("Name", "%s",
fc71ac
 				dmi_string(h, data[0x06]));
fc71ac
-			printf("\tManufacturer: %s\n",
fc71ac
+			pr_attr("Manufacturer", "%s",
fc71ac
 				dmi_string(h, data[0x07]));
fc71ac
-			printf("\tSerial Number: %s\n",
fc71ac
+			pr_attr("Serial Number", "%s",
fc71ac
 				dmi_string(h, data[0x08]));
fc71ac
-			printf("\tAsset Tag: %s\n",
fc71ac
+			pr_attr("Asset Tag", "%s",
fc71ac
 				dmi_string(h, data[0x09]));
fc71ac
-			printf("\tModel Part Number: %s\n",
fc71ac
+			pr_attr("Model Part Number", "%s",
fc71ac
 				dmi_string(h, data[0x0A]));
fc71ac
-			printf("\tRevision: %s\n",
fc71ac
+			pr_attr("Revision", "%s",
fc71ac
 				dmi_string(h, data[0x0B]));
fc71ac
-			printf("\tMax Power Capacity:");
fc71ac
 			dmi_power_supply_power(WORD(data + 0x0C));
fc71ac
-			printf("\n");
fc71ac
-			printf("\tStatus:");
fc71ac
 			if (WORD(data + 0x0E) & (1 << 1))
fc71ac
-				printf(" Present, %s",
fc71ac
+				pr_attr("Status", "Present, %s",
fc71ac
 					dmi_power_supply_status((WORD(data + 0x0E) >> 7) & 0x07));
fc71ac
 			else
fc71ac
-				printf(" Not Present");
fc71ac
-			printf("\n");
fc71ac
-			printf("\tType: %s\n",
fc71ac
+				pr_attr("Status", "Not Present");
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_power_supply_type((WORD(data + 0x0E) >> 10) & 0x0F));
fc71ac
-			printf("\tInput Voltage Range Switching: %s\n",
fc71ac
+			pr_attr("Input Voltage Range Switching", "%s",
fc71ac
 				dmi_power_supply_range_switching((WORD(data + 0x0E) >> 3) & 0x0F));
fc71ac
-			printf("\tPlugged: %s\n",
fc71ac
+			pr_attr("Plugged", "%s",
fc71ac
 				WORD(data + 0x0E) & (1 << 2) ? "No" : "Yes");
fc71ac
-			printf("\tHot Replaceable: %s\n",
fc71ac
+			pr_attr("Hot Replaceable", "%s",
fc71ac
 				WORD(data + 0x0E) & (1 << 0) ? "Yes" : "No");
fc71ac
 			if (h->length < 0x16) break;
fc71ac
 			if (!(opt.flags & FLAG_QUIET))
fc71ac
 			{
fc71ac
 				if (WORD(data + 0x10) != 0xFFFF)
fc71ac
-					printf("\tInput Voltage Probe Handle: 0x%04X\n",
fc71ac
+					pr_attr("Input Voltage Probe Handle", "0x%04X",
fc71ac
 						WORD(data + 0x10));
fc71ac
 				if (WORD(data + 0x12) != 0xFFFF)
fc71ac
-					printf("\tCooling Device Handle: 0x%04X\n",
fc71ac
+					pr_attr("Cooling Device Handle", "0x%04X",
fc71ac
 						WORD(data + 0x12));
fc71ac
 				if (WORD(data + 0x14) != 0xFFFF)
fc71ac
-					printf("\tInput Current Probe Handle: 0x%04X\n",
fc71ac
+					pr_attr("Input Current Probe Handle", "0x%04X",
fc71ac
 						WORD(data + 0x14));
fc71ac
 			}
fc71ac
 			break;
fc71ac
@@ -5001,19 +4934,19 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			if (h->length < 0x0B) break;
fc71ac
 			if (opt.flags & FLAG_QUIET)
fc71ac
 				return;
fc71ac
-			dmi_additional_info(h, "");
fc71ac
+			dmi_additional_info(h);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 41: /* 7.42 Onboard Device Extended Information */
fc71ac
 			pr_handle_name("Onboard Device");
fc71ac
 			if (h->length < 0x0B) break;
fc71ac
-			printf("\tReference Designation: %s\n", dmi_string(h, data[0x04]));
fc71ac
-			printf("\tType: %s\n",
fc71ac
+			pr_attr("Reference Designation", "%s", dmi_string(h, data[0x04]));
fc71ac
+			pr_attr("Type", "%s",
fc71ac
 				dmi_on_board_devices_type(data[0x05] & 0x7F));
fc71ac
-			printf("\tStatus: %s\n",
fc71ac
+			pr_attr("Status", "%s",
fc71ac
 				data[0x05] & 0x80 ? "Enabled" : "Disabled");
fc71ac
-			printf("\tType Instance: %u\n", data[0x06]);
fc71ac
-			dmi_slot_segment_bus_func(WORD(data + 0x07), data[0x09], data[0x0A], "\t");
fc71ac
+			pr_attr("Type Instance", "%u", data[0x06]);
fc71ac
+			dmi_slot_segment_bus_func(WORD(data + 0x07), data[0x09], data[0x0A]);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 42: /* 7.43 Management Controller Host Interface */
fc71ac
@@ -5021,7 +4954,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			if (ver < 0x0302)
fc71ac
 			{
fc71ac
 				if (h->length < 0x05) break;
fc71ac
-				printf("\tInterface Type: %s\n",
fc71ac
+				pr_attr("Interface Type", "%s",
fc71ac
 					dmi_management_controller_host_type(data[0x04]));
fc71ac
 				/*
fc71ac
 				 * There you have a type-dependent, variable-length
fc71ac
@@ -5032,7 +4965,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 				if (h->length < 0x09) break;
fc71ac
 				if (data[0x04] == 0xF0)		/* OEM */
fc71ac
 				{
fc71ac
-					printf("\tVendor ID: 0x%02X%02X%02X%02X\n",
fc71ac
+					pr_attr("Vendor ID", "0x%02X%02X%02X%02X",
fc71ac
 						data[0x05], data[0x06], data[0x07],
fc71ac
 						data[0x08]);
fc71ac
 				}
fc71ac
@@ -5044,10 +4977,8 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 		case 43: /* 7.44 TPM Device */
fc71ac
 			pr_handle_name("TPM Device");
fc71ac
 			if (h->length < 0x1B) break;
fc71ac
-			printf("\tVendor ID:");
fc71ac
 			dmi_tpm_vendor_id(data + 0x04);
fc71ac
-			printf("\n");
fc71ac
-			printf("\tSpecification Version: %d.%d\n", data[0x08], data[0x09]);
fc71ac
+			pr_attr("Specification Version", "%d.%d", data[0x08], data[0x09]);
fc71ac
 			switch (data[0x08])
fc71ac
 			{
fc71ac
 				case 0x01:
fc71ac
@@ -5056,11 +4987,11 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 					 * redundant with the above, and uncoded
fc71ac
 					 * in a silly way.
fc71ac
 					 */
fc71ac
-					printf("\tFirmware Revision: %u.%u\n",
fc71ac
+					pr_attr("Firmware Revision", "%u.%u",
fc71ac
 						data[0x0C], data[0x0D]);
fc71ac
 					break;
fc71ac
 				case 0x02:
fc71ac
-					printf("\tFirmware Revision: %u.%u\n",
fc71ac
+					pr_attr("Firmware Revision", "%u.%u",
fc71ac
 						DWORD(data + 0x0A) >> 16,
fc71ac
 						DWORD(data + 0x0A) & 0xFFFF);
fc71ac
 					/*
fc71ac
@@ -5070,11 +5001,11 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 					 */
fc71ac
 					break;
fc71ac
 			}
fc71ac
-			printf("\tDescription: %s\n", dmi_string(h, data[0x12]));
fc71ac
+			pr_attr("Description", "%s", dmi_string(h, data[0x12]));
fc71ac
 			printf("\tCharacteristics:\n");
fc71ac
 			dmi_tpm_characteristics(QWORD(data + 0x13), "\t\t");
fc71ac
 			if (h->length < 0x1F) break;
fc71ac
-			printf("\tOEM-specific Information: 0x%08X\n",
fc71ac
+			pr_attr("OEM-specific Information", "0x%08X",
fc71ac
 				DWORD(data + 0x1B));
fc71ac
 			break;
fc71ac
 
fc71ac
@@ -5141,8 +5072,7 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
fc71ac
 				printf("%u.%u\n", data[key - 1], data[key]);
fc71ac
 			break;
fc71ac
 		case 0x108:
fc71ac
-			dmi_system_uuid(data + offset, ver);
fc71ac
-			printf("\n");
fc71ac
+			dmi_system_uuid(NULL, data + offset, ver);
fc71ac
 			break;
fc71ac
 		case 0x305:
fc71ac
 			printf("%s\n", dmi_chassis_type(data[offset]));
fc71ac
@@ -5151,8 +5081,7 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
fc71ac
 			printf("%s\n", dmi_processor_family(h, ver));
fc71ac
 			break;
fc71ac
 		case 0x416:
fc71ac
-			dmi_processor_frequency(data + offset);
fc71ac
-			printf("\n");
fc71ac
+			dmi_processor_frequency(NULL, data + offset);
fc71ac
 			break;
fc71ac
 		default:
fc71ac
 			printf("%s\n", dmi_string(h, data[offset]));
fc71ac
diff --git a/dmioem.c b/dmioem.c
fc71ac
index c999c08c4475..873ec1068c16 100644
fc71ac
--- a/dmioem.c
fc71ac
+++ b/dmioem.c
fc71ac
@@ -96,16 +96,16 @@ static int dmi_decode_acer(const struct dmi_header *h)
fc71ac
 			pr_handle_name("Acer Hotkey Function");
fc71ac
 			if (h->length < 0x0F) break;
fc71ac
 			cap = WORD(data + 0x04);
fc71ac
-			printf("\tFunction bitmap for Communication Button: 0x%04hx\n", cap);
fc71ac
+			pr_attr("Function bitmap for Communication Button", "0x%04hx", cap);
fc71ac
 			printf("\t\tWiFi: %s\n", cap & 0x0001 ? "Yes" : "No");
fc71ac
 			printf("\t\t3G: %s\n", cap & 0x0040 ? "Yes" : "No");
fc71ac
 			printf("\t\tWiMAX: %s\n", cap & 0x0080 ? "Yes" : "No");
fc71ac
 			printf("\t\tBluetooth: %s\n", cap & 0x0800 ? "Yes" : "No");
fc71ac
-			printf("\tFunction bitmap for Application Button: 0x%04hx\n", WORD(data + 0x06));
fc71ac
-			printf("\tFunction bitmap for Media Button: 0x%04hx\n", WORD(data + 0x08));
fc71ac
-			printf("\tFunction bitmap for Display Button: 0x%04hx\n", WORD(data + 0x0A));
fc71ac
-			printf("\tFunction bitmap for Others Button: 0x%04hx\n", WORD(data + 0x0C));
fc71ac
-			printf("\tCommunication Function Key Number: %d\n", data[0x0E]);
fc71ac
+			pr_attr("Function bitmap for Application Button", "0x%04hx", WORD(data + 0x06));
fc71ac
+			pr_attr("Function bitmap for Media Button", "0x%04hx", WORD(data + 0x08));
fc71ac
+			pr_attr("Function bitmap for Display Button", "0x%04hx", WORD(data + 0x0A));
fc71ac
+			pr_attr("Function bitmap for Others Button", "0x%04hx", WORD(data + 0x0C));
fc71ac
+			pr_attr("Communication Function Key Number", "%d", data[0x0E]);
fc71ac
 			break;
fc71ac
 
fc71ac
 		default:
fc71ac
@@ -128,19 +128,21 @@ static void dmi_print_hp_net_iface_rec(u8 id, u8 bus, u8 dev, const u8 *mac)
fc71ac
 	 * 640K ought to be enough for anybody(said no one, ever).
fc71ac
 	 * */
fc71ac
 	static u8 nic_ctr;
fc71ac
+	char attr[8];
fc71ac
 
fc71ac
 	if (id == 0xFF)
fc71ac
 		id = ++nic_ctr;
fc71ac
 
fc71ac
+	sprintf(attr, "NIC %hu", id);
fc71ac
 	if (dev == 0x00 && bus == 0x00)
fc71ac
-		printf("\tNIC %d: Disabled\n", id);
fc71ac
+		pr_attr(attr, "Disabled");
fc71ac
 	else if (dev == 0xFF && bus == 0xFF)
fc71ac
-		printf("\tNIC %d: Not Installed\n", id);
fc71ac
+		pr_attr(attr, "Not Installed");
fc71ac
 	else
fc71ac
 	{
fc71ac
-		printf("\tNIC %d: PCI device %02x:%02x.%x, "
fc71ac
-			"MAC address %02X:%02X:%02X:%02X:%02X:%02X\n",
fc71ac
-			id, bus, dev >> 3, dev & 7,
fc71ac
+		pr_attr(attr, "PCI device %02x:%02x.%x, "
fc71ac
+			"MAC address %02X:%02X:%02X:%02X:%02X:%02X",
fc71ac
+			bus, dev >> 3, dev & 7,
fc71ac
 			mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
fc71ac
 	}
fc71ac
 }
fc71ac
@@ -160,13 +162,13 @@ static int dmi_decode_hp(const struct dmi_header *h)
fc71ac
 			 */
fc71ac
 			pr_handle_name("%s ProLiant System/Rack Locator", company);
fc71ac
 			if (h->length < 0x0B) break;
fc71ac
-			printf("\tRack Name: %s\n", dmi_string(h, data[0x04]));
fc71ac
-			printf("\tEnclosure Name: %s\n", dmi_string(h, data[0x05]));
fc71ac
-			printf("\tEnclosure Model: %s\n", dmi_string(h, data[0x06]));
fc71ac
-			printf("\tEnclosure Serial: %s\n", dmi_string(h, data[0x0A]));
fc71ac
-			printf("\tEnclosure Bays: %d\n", data[0x08]);
fc71ac
-			printf("\tServer Bay: %s\n", dmi_string(h, data[0x07]));
fc71ac
-			printf("\tBays Filled: %d\n", data[0x09]);
fc71ac
+			pr_attr("Rack Name", "%s", dmi_string(h, data[0x04]));
fc71ac
+			pr_attr("Enclosure Name", "%s", dmi_string(h, data[0x05]));
fc71ac
+			pr_attr("Enclosure Model", "%s", dmi_string(h, data[0x06]));
fc71ac
+			pr_attr("Enclosure Serial", "%s", dmi_string(h, data[0x0A]));
fc71ac
+			pr_attr("Enclosure Bays", "%d", data[0x08]);
fc71ac
+			pr_attr("Server Bay", "%s", dmi_string(h, data[0x07]));
fc71ac
+			pr_attr("Bays Filled", "%d", data[0x09]);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 209:
fc71ac
@@ -243,20 +245,22 @@ static int dmi_decode_hp(const struct dmi_header *h)
fc71ac
 			 */
fc71ac
 			pr_handle_name("%s 64-bit CRU Information", company);
fc71ac
 			if (h->length < 0x18) break;
fc71ac
-			printf("\tSignature: 0x%08x", DWORD(data + 0x04));
fc71ac
 			if (is_printable(data + 0x04, 4))
fc71ac
-				printf(" (%c%c%c%c)", data[0x04], data[0x05],
fc71ac
+				pr_attr("Signature", "0x%08x (%c%c%c%c)",
fc71ac
+					DWORD(data + 0x04),
fc71ac
+					data[0x04], data[0x05],
fc71ac
 					data[0x06], data[0x07]);
fc71ac
-			printf("\n");
fc71ac
+			else
fc71ac
+				pr_attr("Signature", "0x%08x", DWORD(data + 0x04));
fc71ac
 			if (DWORD(data + 0x04) == 0x55524324)
fc71ac
 			{
fc71ac
 				u64 paddr = QWORD(data + 0x08);
fc71ac
 				paddr.l += DWORD(data + 0x14);
fc71ac
 				if (paddr.l < DWORD(data + 0x14))
fc71ac
 					paddr.h++;
fc71ac
-				printf("\tPhysical Address: 0x%08x%08x\n",
fc71ac
+				pr_attr("Physical Address", "0x%08x%08x",
fc71ac
 					paddr.h, paddr.l);
fc71ac
-				printf("\tLength: 0x%08x\n", DWORD(data + 0x10));
fc71ac
+				pr_attr("Length", "0x%08x", DWORD(data + 0x10));
fc71ac
 			}
fc71ac
 			break;
fc71ac
 
fc71ac
@@ -268,12 +272,12 @@ static int dmi_decode_hp(const struct dmi_header *h)
fc71ac
 			 */
fc71ac
 			pr_handle_name("%s ProLiant Information", company);
fc71ac
 			if (h->length < 0x08) break;
fc71ac
-			printf("\tPower Features: 0x%08x\n", DWORD(data + 0x04));
fc71ac
+			pr_attr("Power Features", "0x%08x", DWORD(data + 0x04));
fc71ac
 			if (h->length < 0x0C) break;
fc71ac
-			printf("\tOmega Features: 0x%08x\n", DWORD(data + 0x08));
fc71ac
+			pr_attr("Omega Features", "0x%08x", DWORD(data + 0x08));
fc71ac
 			if (h->length < 0x14) break;
fc71ac
 			feat = DWORD(data + 0x10);
fc71ac
-			printf("\tMisc. Features: 0x%08x\n", feat);
fc71ac
+			pr_attr("Misc. Features", "0x%08x", feat);
fc71ac
 			printf("\t\tiCRU: %s\n", feat & 0x0001 ? "Yes" : "No");
fc71ac
 			printf("\t\tUEFI: %s\n", feat & 0x1400 ? "Yes" : "No");
fc71ac
 			break;
fc71ac
@@ -320,8 +324,8 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
fc71ac
 				return 0;
fc71ac
 
fc71ac
 			pr_handle_name("ThinkVantage Technologies");
fc71ac
-			printf("\tVersion: %u\n", data[0x04]);
fc71ac
-			printf("\tDiagnostics: %s\n",
fc71ac
+			pr_attr("Version", "%u", data[0x04]);
fc71ac
+			pr_attr("Diagnostics", "%s",
fc71ac
 				data[0x14] & 0x80 ? "Available" : "No");
fc71ac
 			break;
fc71ac
 
fc71ac
@@ -359,7 +363,7 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
fc71ac
 				return 0;
fc71ac
 
fc71ac
 			pr_handle_name("ThinkPad Device Presence Detection");
fc71ac
-			printf("\tFingerprint Reader: %s\n",
fc71ac
+			pr_attr("Fingerprint Reader", "%s",
fc71ac
 				data[0x09] & 0x01 ? "Present" : "No");
fc71ac
 			break;
fc71ac
 
fc71ac
@@ -392,8 +396,8 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
fc71ac
 				return 0;
fc71ac
 
fc71ac
 			pr_handle_name("ThinkPad Embedded Controller Program");
fc71ac
-			printf("\tVersion ID: %s\n", dmi_string(h, 1));
fc71ac
-			printf("\tRelease Date: %s\n", dmi_string(h, 2));
fc71ac
+			pr_attr("Version ID", "%s", dmi_string(h, 1));
fc71ac
+			pr_attr("Release Date", "%s", dmi_string(h, 2));
fc71ac
 			break;
fc71ac
 
fc71ac
 		default:
fc71ac
diff --git a/dmioutput.c b/dmioutput.c
fc71ac
index ca7edab5cc69..2330b65755c9 100644
fc71ac
--- a/dmioutput.c
fc71ac
+++ b/dmioutput.c
fc71ac
@@ -59,3 +59,15 @@ void pr_handle_name(const char *format, ...)
fc71ac
 	va_end(args);
fc71ac
 	printf("\n");
fc71ac
 }
fc71ac
+
fc71ac
+void pr_attr(const char *name, const char *format, ...)
fc71ac
+{
fc71ac
+	va_list args;
fc71ac
+
fc71ac
+	printf("\t%s: ", name);
fc71ac
+
fc71ac
+	va_start(args, format);
fc71ac
+	vprintf(format, args);
fc71ac
+	va_end(args);
fc71ac
+	printf("\n");
fc71ac
+}
fc71ac
diff --git a/dmioutput.h b/dmioutput.h
fc71ac
index 0acdce7658c9..981dcb45f26a 100644
fc71ac
--- a/dmioutput.h
fc71ac
+++ b/dmioutput.h
fc71ac
@@ -25,3 +25,4 @@ void pr_comment(const char *format, ...);
fc71ac
 void pr_info(const char *format, ...);
fc71ac
 void pr_handle(const struct dmi_header *h);
fc71ac
 void pr_handle_name(const char *format, ...);
fc71ac
+void pr_attr(const char *name, const char *format, ...);
fc71ac
-- 
fc71ac
2.17.1
fc71ac