smbios-mdr: get SystemBootInfo
Adding this property for smbios to propagate the infomation
Tested: b/409172603#comment26
Fusion-Link:
platform5: fusion2/05f2b090-6924-3ecb-b1de-70a40409b6e9
platform11: fusion2/6c74f17d-1f18-3226-a4d6-aac21609d23f (failed with known issue b/436156535)
platform15: fusion2/9d687565-3525-37f8-9552-43edb4576eda
platform17: fusion2/7c1adeb9-e2ac-3550-a929-186b42b5da82
Google-Bug-Id: 409172603
Change-Id: If95e0561407c16c69b1a69686752e606a0d0c65c
Signed-off-by: Alex Lai <alexlai@google.com>
diff --git a/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Add-Host-interface-BootCount-and-StatusCode.patch b/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Add-Host-interface-BootCount-and-StatusCode.patch
new file mode 100644
index 0000000..9a06b69
--- /dev/null
+++ b/recipes-phosphor/dbus/phosphor-dbus-interfaces/0001-Add-Host-interface-BootCount-and-StatusCode.patch
@@ -0,0 +1,44 @@
+From 4e18552ae837304aa7ae510dfb3ffa4eca0f4f3b Mon Sep 17 00:00:00 2001
+From: Alex Lai <alexlai@google.com>
+Date: Wed, 30 Jul 2025 03:13:52 +0000
+Subject: [PATCH] Add Host interface - BootCount and StatusCode
+
+Reference:
+https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.2.0.pdf?page=121
+N/A DMTF defined oem specific command
+
+Patch Tracking Bug: n/a
+Upstream-Status: Inappropriate [oem specific command]
+Justification: b/409172603
+
+Signed-off-by: Alex Lai <alexlai@google.com>
+---
+ yaml/xyz/openbmc_project/State/Host.interface.yaml | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/yaml/xyz/openbmc_project/State/Host.interface.yaml b/yaml/xyz/openbmc_project/State/Host.interface.yaml
+index 95f3b19..d845184 100644
+--- a/yaml/xyz/openbmc_project/State/Host.interface.yaml
++++ b/yaml/xyz/openbmc_project/State/Host.interface.yaml
+@@ -36,6 +36,18 @@ properties:
+ description: >
+ A property to define restart cause of a host.
+
++ - name: StatusCode
++ type: uint16
++ description: >
++ Status and Additional Data fields that identify the boot status.
++
++ - name: BootCount
++ type: uint32
++ description: >
++ The bootcount of the host. This is vendor/oem-specific implementation according to the spec,
++ Google-Only attribute.
++ default: 0
++
+ enumerations:
+ - name: Transition
+ description: >
+--
+2.50.1.552.g942d659e1b-goog
+
diff --git a/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend
index 92375b8..04d676f 100644
--- a/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend
+++ b/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend
@@ -11,6 +11,7 @@
file://0001-Inventory-add-NetworkAdapter-and-Port-Inventory-Item.patch \
file://0001-State-add-new-RebootCause-value-for-supporting-Softw.patch \
file://0001-Add-Processor-Information-Core-Enabled.patch \
+ file://0001-Add-Host-interface-BootCount-and-StatusCode.patch \
"
EXTRA_OEMESON += " \
diff --git a/recipes-phosphor/smbios/smbios-mdr/0001-smbios-mdr-Add-support-to-get-SystemBootInfo.patch b/recipes-phosphor/smbios/smbios-mdr/0001-smbios-mdr-Add-support-to-get-SystemBootInfo.patch
new file mode 100644
index 0000000..b8c1a31
--- /dev/null
+++ b/recipes-phosphor/smbios/smbios-mdr/0001-smbios-mdr-Add-support-to-get-SystemBootInfo.patch
@@ -0,0 +1,112 @@
+From c55b869780118f1fa1f53ab7ec6932902f47cd0d Mon Sep 17 00:00:00 2001
+From: Alex Lai <alexlai@google.com>
+Date: Wed, 30 Jul 2025 07:19:55 +0000
+Subject: [PATCH] smbios-mdr: Add support to get SystemBootInfo
+
+ref: https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.2.0.pdf?page=121
+Signed-off-by: Alex Lai <alexlai@google.com>
+---
+ include/smbios_mdrv2.hpp | 1 +
+ include/system.hpp | 21 ++++++++++++++++++++-
+ src/system.cpp | 13 +++++++++++++
+ 3 files changed, 34 insertions(+), 1 deletion(-)
+
+diff --git a/include/smbios_mdrv2.hpp b/include/smbios_mdrv2.hpp
+index b7906bc..ae11daa 100644
+--- a/include/smbios_mdrv2.hpp
++++ b/include/smbios_mdrv2.hpp
+@@ -206,6 +206,7 @@ typedef enum
+ systemEventLogType = 15,
+ physicalMemoryArrayType = 16,
+ memoryDeviceType = 17,
++ systemBootInformationType = 32,
+ #ifdef GOOGLE_CPU_LINK
+ googleCpuLinkType = 162,
+ #endif
+diff --git a/include/system.hpp b/include/system.hpp
+index ac75a0c..2c71e00 100644
+--- a/include/system.hpp
++++ b/include/system.hpp
+@@ -20,6 +20,7 @@
+ #include <sdbusplus/asio/connection.hpp>
+ #include <xyz/openbmc_project/Common/UUID/server.hpp>
+ #include <xyz/openbmc_project/Inventory/Decorator/Revision/server.hpp>
++#include <xyz/openbmc_project/State/Host/server.hpp>
+
+ namespace phosphor
+ {
+@@ -31,7 +32,9 @@ class System :
+ sdbusplus::server::object_t<
+ sdbusplus::server::xyz::openbmc_project::common::UUID>,
+ sdbusplus::server::object_t<
+- sdbusplus::server::xyz::openbmc_project::inventory::decorator::Revision>
++ sdbusplus::server::xyz::openbmc_project::inventory::decorator::Revision>,
++ sdbusplus::server::object_t<
++ sdbusplus::server::xyz::openbmc_project::state::Host>
+ {
+ public:
+ System() = delete;
+@@ -50,14 +53,20 @@ class System :
+ sdbusplus::server::object_t<sdbusplus::server::xyz::openbmc_project::
+ inventory::decorator::Revision>(
+ *bus, objPath.c_str()),
++ sdbusplus::server::object_t<sdbusplus::server::xyz::openbmc_project::
++ state::Host>(
++ *bus, objPath.c_str()),
+ bus(std::move(bus)), path(std::move(objPath)),
+ storage(smbiosTableStorage), smbiosFilePath(std::move(filePath))
+ {
+ std::string input = "0";
+ uuid(input);
+ version("0.00");
++ updateSystemBootInfo();
+ }
+
++ void updateSystemBootInfo();
++
+ std::string uuid(std::string value) override;
+
+ std::string version(std::string value) override;
+@@ -113,6 +122,16 @@ class System :
+ uint8_t family;
+ } __attribute__((packed));
+
++ struct SystemBootInfo
++ {
++ uint8_t type;
++ uint8_t length;
++ uint16_t handle;
++ uint8_t reserved[6];
++ uint8_t statusCode;
++ uint32_t bootCount;
++ } __attribute__((packed));
++
+ std::string smbiosFilePath;
+ };
+
+diff --git a/src/system.cpp b/src/system.cpp
+index a838577..60d9f22 100644
+--- a/src/system.cpp
++++ b/src/system.cpp
+@@ -158,5 +158,18 @@ std::string System::version(std::string /* value */)
+ Revision::version(result);
+ }
+
++void System::updateSystemBootInfo()
++{
++ uint8_t* dataIn = getSMBIOSTypePtr(storage, systemBootInformationType);
++ if (dataIn != nullptr)
++ {
++ auto systemBootInfo = reinterpret_cast<struct SystemBootInfo*>(dataIn);
++
++ statusCode(systemBootInfo->statusCode);
++ bootCount(systemBootInfo->bootCount);
++ lg2::info("system boot info added");
++ }
++}
++
+ } // namespace smbios
+ } // namespace phosphor
+--
+2.50.1.565.gc32cd1483b-goog
+
diff --git a/recipes-phosphor/smbios/smbios-mdr_%.bbappend b/recipes-phosphor/smbios/smbios-mdr_%.bbappend
index 6f152bd..35337f9 100644
--- a/recipes-phosphor/smbios/smbios-mdr_%.bbappend
+++ b/recipes-phosphor/smbios/smbios-mdr_%.bbappend
@@ -5,6 +5,7 @@
file://0001-Use-Device-Locator-as-DIMM-Object-Path-if-Enabled.patch \
file://0001-Support-CoreEnable-attribute.patch \
file://0001-Process-smbios-grpc-blob-tranasfer.patch \
+ file://0001-smbios-mdr-Add-support-to-get-SystemBootInfo.patch \
"
EXTRA_OEMESON:append:gbmc = " -Ddimm-only-locator=enabled"