Files
OpenBMC/meta-luxshare/meta-bhs/recipes-phosphor/flash/phosphor-software-manager/0001-Add-fan-board-cpld-for-software-manager.patch
T

158 lines
5.4 KiB
Diff
Raw Normal View History

2026-04-23 17:07:55 +08:00
From 9f12832b7a6d2056b3db4e044f88c3e5b65dee97 Mon Sep 17 00:00:00 2001
From: roly <Rolyli.Li@luxshare-ict.com>
Date: Wed, 13 Nov 2024 11:04:54 +0800
Subject: [PATCH] Add fan board cpld for software manager
---
item_updater.cpp | 37 +++++++++++++++++++++++++++++++++++++
item_updater.hpp | 20 ++++++++++++++++++++
meson.build | 5 +++++
meson_options.txt | 8 ++++++++
4 files changed, 70 insertions(+)
diff --git a/item_updater.cpp b/item_updater.cpp
index 76f72d4..d8348e3 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -74,6 +74,9 @@ void ItemUpdater::createActivation(sdbusplus::message_t& msg)
#endif
#ifdef CPLD_UPGRADE
value == VersionPurpose::CPLD ||
+#endif
+#ifdef FB_CPLD_UPGRADE
+ value == VersionPurpose::FBCPLD ||
#endif
value == VersionPurpose::System)
{
@@ -916,6 +919,40 @@ void ItemUpdater::createCPLDObject()
}
#endif
+#ifdef FB_CPLD_UPGRADE
+void ItemUpdater::createFBCPLDObject()
+{
+ std::string path = FB_CPLD_OBJPATH;
+ // Get version id from last item in the path
+ auto pos = path.rfind("/");
+ if (pos == std::string::npos)
+ {
+ error("No version id found in object path {PATH}", "PATH", path);
+ return;
+ }
+
+ createActiveAssociation(path);
+ createFunctionalAssociation(path);
+
+ auto versionId = path.substr(pos + 1);
+ auto version = "null";
+ AssociationList assocs = {};
+ FBcpldActivation = std::make_unique<Activation>(
+ bus, path, *this, versionId, server::Activation::Activations::Active,
+ assocs);
+ auto dummyErase = [](std::string /*entryId*/) {
+ // Do nothing;
+ };
+ FBcpldVersion = std::make_unique<VersionClass>(
+ bus, path, version, VersionPurpose::FBCPLD, "", "",
+ std::vector<std::string>(),
+ std::bind(dummyErase, std::placeholders::_1), "");
+ cpldVersion->deleteObject =
+ std::make_unique<phosphor::software::manager::Delete>(bus, path,
+ *cpldVersion);
+}
+#endif
+
void ItemUpdater::getRunningSlot()
{
// Check /run/media/slot to get the slot number
diff --git a/item_updater.hpp b/item_updater.hpp
index 26b657d..fc8d6c3 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -70,6 +70,9 @@ class ItemUpdater : public ItemUpdaterInherit
#endif
#ifdef CPLD_UPGRADE
createCPLDObject();
+#endif
+#ifdef FB_CPLD_UPGRADE
+ createFBCPLDObject();
#endif
emit_object_added();
};
@@ -299,6 +302,23 @@ class ItemUpdater : public ItemUpdaterInherit
/** @brief Persistent Version D-Bus object for CPLD */
std::unique_ptr<VersionClass> cpldVersion;
#endif
+
+#ifdef FB_CPLD_UPGRADE
+ /** @brief Create the CPLD object without knowing the version.
+ *
+ * The object is created only to provide the DBus access so that an
+ * external service could set the correct CPLD version.
+ * On CPLD code update, the version is updated accordingly.
+ */
+ void createFBCPLDObject();
+
+ /** @brief Persistent Activation D-Bus object for CPLD */
+ std::unique_ptr<Activation> FBcpldActivation;
+
+ public:
+ /** @brief Persistent Version D-Bus object for CPLD */
+ std::unique_ptr<VersionClass> FBcpldVersion;
+#endif
/** @brief Get the slot number of running image */
void getRunningSlot();
};
diff --git a/meson.build b/meson.build
index 509d9f7..009dcef 100644
--- a/meson.build
+++ b/meson.build
@@ -68,6 +68,7 @@ conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc'))
# Configurable features
conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled())
conf.set('CPLD_UPGRADE', get_option('cpld-upgrade').enabled())
+conf.set('FB_CPLD_UPGRADE', get_option('fb-cpld-upgrade').enabled())
conf.set('WANT_SIGNATURE_VERIFY', \
get_option('verify-signature').enabled() or \
get_option('verify-full-signature').enabled())
@@ -101,6 +102,10 @@ if get_option('cpld-upgrade').enabled()
conf.set_quoted('CPLD_OBJPATH', get_option('cpld-object-path'))
endif
+if get_option('fb-cpld-upgrade').enabled()
+ conf.set_quoted('FB_CPLD_OBJPATH', get_option('fb-cpld-object-path'))
+endif
+
if get_option('bmc-static-dual-image').enabled()
conf.set('BMC_STATIC_DUAL_IMAGE', get_option('bmc-static-dual-image').enabled())
conf.set_quoted('ALT_ROFS_DIR', get_option('alt-rofs-dir'))
diff --git a/meson_options.txt b/meson_options.txt
index d638c93..2109025 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -13,6 +13,8 @@ option('host-bios-upgrade', type: 'feature', value: 'enabled',
description: 'Enable host bios upgrade support.')
option('cpld-upgrade', type: 'feature', value: 'enabled',
description: 'Enable cpld upgrade support.')
+option('fb-cpld-upgrade', type: 'feature', value: 'enabled',
+ description: 'Enable fan board cpld upgrade support.')
option('sync-bmc-files', type: 'feature', value: 'enabled',
description: 'Enable sync of filesystem files.')
@@ -129,6 +131,12 @@ option(
description: 'The CPLD DBus object path.',
)
+option(
+ 'fb-cpld-object-path', type: 'string',
+ value: '/xyz/openbmc_project/software/fb_cpld_active',
+ description: 'The Fan Board CPLD DBus object path.',
+)
+
option('bmc-static-dual-image', type: 'feature', value: 'enabled',
description: 'Enable the dual image support for static layout.')
--
2.25.1