diff mbox series

[v3,08/10] armv8: Add generic smbios information into the device tree

Message ID 20241206225438.13866-9-raymond.mao@linaro.org
State Accepted
Delegated to: Tom Rini
Headers show
Series SMBIOS improvements | expand

Commit Message

Raymond Mao Dec. 6, 2024, 10:54 p.m. UTC
Add common smbios information that can be used by all armv8
platforms and set it as default for qemu-arm64.
From now smbios library can load values from here for those fields
doesn't exist in the sysinfo driver.

To run this with QEMU arm64, we need to dump the generated DTB
from QEMU first, merge it with the one we build and then re-run
QEMU with the merged DTB.
```
qemu-system-aarch64 -machine virt -machine dumpdtb=qemu.dtb
cat  <(dtc -I dtb qemu.dtb) <(dtc -I dtb ./dts/dt.dtb | \
  grep -v /dts-v1/) | dtc - -o merged.dtb
qemu-system-aarch64 -machine virt -nographic -bios u-boot.bin \
  -dtb merged.dtb
```
For details please take reference on dt_qemu.rst

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
---
Changes in v2
- Initial patch.
Changes in v3
- Remove all "Not Specified" strings.
- Update the commit message.

 arch/arm/dts/qemu-arm64.dts      |  4 ++
 arch/arm/dts/smbios_generic.dtsi | 82 ++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)
 create mode 100644 arch/arm/dts/smbios_generic.dtsi
diff mbox series

Patch

diff --git a/arch/arm/dts/qemu-arm64.dts b/arch/arm/dts/qemu-arm64.dts
index 096b3910728..95fcf53ed74 100644
--- a/arch/arm/dts/qemu-arm64.dts
+++ b/arch/arm/dts/qemu-arm64.dts
@@ -7,5 +7,9 @@ 
 
 /dts-v1/;
 
+#if defined(CONFIG_SYSINFO_SMBIOS) && !defined(QFW_SMBIOS)
+#include "smbios_generic.dtsi"
+#endif
+
 / {
 };
diff --git a/arch/arm/dts/smbios_generic.dtsi b/arch/arm/dts/smbios_generic.dtsi
new file mode 100644
index 00000000000..fc168317c9e
--- /dev/null
+++ b/arch/arm/dts/smbios_generic.dtsi
@@ -0,0 +1,82 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Default SMBIOS information for Arm64 platforms
+ *
+ * Copyright (c) 2024 Linaro Limited
+ * Author: Raymond Mao <raymond.mao@linaro.org>
+ */
+#include <config.h>
+#include <smbios_def.h>
+
+/ {
+	smbios {
+		compatible = "u-boot,sysinfo-smbios";
+
+		smbios {
+			system {
+				manufacturer = CONFIG_SYS_VENDOR;
+				product = CONFIG_SYS_BOARD;
+				version = "";
+				serial = "";
+				wakeup-type = <SMBIOS_WAKEUP_TYPE_UNKNOWN>;
+				sku = "";
+				family = "armv8";
+			};
+
+			baseboard {
+				manufacturer = CONFIG_SYS_VENDOR;
+				product = CONFIG_SYS_BOARD;
+				version = "";
+				serial = "";
+				asset-tag = "";
+				chassis-location = "";
+				feature-flags = <SMBIOS_BOARD_FEAT_HOST_BOARD>;
+				board-type = <SMBIOS_BOARD_TYPE_MOTHERBOARD>;
+			};
+
+			chassis {
+				manufacturer = CONFIG_SYS_VENDOR;
+				version = "";
+				serial = "";
+				asset-tag = "";
+				chassis-type = <SMBIOS_ENCLOSURE_DESKTOP>;
+				bootup-state = <SMBIOS_STATE_SAFE>;
+				power-supply-state = <SMBIOS_STATE_SAFE>;
+				thermal-state = <SMBIOS_STATE_SAFE>;
+				security-status = <SMBIOS_SECURITY_NONE>;
+				oem-defined = <SMBIOS_ENCLOSURE_OEM_UND>;
+				height = <SMBIOS_ENCLOSURE_HEIGHT_UND>;
+				number-of-power-cords = <SMBIOS_POWCORD_NUM_UND>;
+			};
+
+			processor {
+				version = "";
+				processor-type = <SMBIOS_PROCESSOR_TYPE_CENTRAL>;
+				processor-status = <SMBIOS_PROCESSOR_STATUS_ENABLED>;
+				upgrade = <SMBIOS_PROCESSOR_UPGRADE_NONE>;
+				family = <SMBIOS_PROCESSOR_FAMILY_EXT>;
+				family2 = <SMBIOS_PROCESSOR_FAMILY_ARMV8>;
+				socket-design = "";
+				serial = "";
+				asset-tag = "";
+				part-number = "";
+			};
+
+			cache {
+				l1-cache {
+					socket-design = "";
+					config = <(SMBIOS_CACHE_LEVEL_1 |
+						   SMBIOS_CACHE_ENABLED |
+						   SMBIOS_CACHE_OP_WB)>;
+				};
+
+				l2-cache {
+					socket-design = "";
+					config = <(SMBIOS_CACHE_LEVEL_2 |
+						   SMBIOS_CACHE_ENABLED |
+						   SMBIOS_CACHE_OP_WB)>;
+				};
+			};
+		};
+	};
+};