From 2a64b8ae9b952b18b4aef38cb7c41ce6dba16c50 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Mon, 24 May 2021 12:54:37 -0700 Subject: Update to internal 0.52 Signed-off-by: Jason M. Bills --- ...001-Improve-initialization-of-I2C-sensors.patch | 26 ++- ...ty-manager-Add-support-to-update-assetTag.patch | 226 +++------------------ .../0003-Add-logs-to-fwVersionIsSame.patch | 56 +++++ .../configuration/entity-manager_%.bbappend | 3 +- 4 files changed, 98 insertions(+), 213 deletions(-) create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0003-Add-logs-to-fwVersionIsSame.patch (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/configuration') diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0001-Improve-initialization-of-I2C-sensors.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0001-Improve-initialization-of-I2C-sensors.patch index fdd2ba6e3..e47111c56 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0001-Improve-initialization-of-I2C-sensors.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0001-Improve-initialization-of-I2C-sensors.patch @@ -1,4 +1,4 @@ -From 85e7b2d9ede4bb33e02f48ea1d4691d2154fc4a5 Mon Sep 17 00:00:00 2001 +From a85d4c9cf702965593ec771e57a975e30d1d5853 Mon Sep 17 00:00:00 2001 From: Johnathan Mantey Date: Tue, 13 Oct 2020 15:00:51 -0700 Subject: [PATCH] Improve initialization of I2C sensors @@ -32,15 +32,15 @@ missing after AC cycles. Change-Id: I118df674162677d66e7d211b089430fce384086b Signed-off-by: Johnathan Mantey --- - include/devices.hpp | 165 ++++++++++++++++++++----------------- + include/devices.hpp | 167 +++++++++++++++++++++----------------- src/Overlay.cpp | 192 ++++++++++++++++++++++++++++++++++---------- - 2 files changed, 239 insertions(+), 118 deletions(-) + 2 files changed, 243 insertions(+), 116 deletions(-) diff --git a/include/devices.hpp b/include/devices.hpp -index c375b1c..b7dc7d0 100644 +index 50fbe63..2e299a0 100644 --- a/include/devices.hpp +++ b/include/devices.hpp -@@ -31,105 +31,122 @@ struct CmpStr +@@ -31,107 +31,130 @@ struct CmpStr struct ExportTemplate { @@ -61,14 +61,20 @@ index c375b1c..b7dc7d0 100644 const boost::container::flat_map exportTemplates{ -- {{"24C02", ExportTemplate("24c02 $Address", -- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, -- {"24C64", ExportTemplate("24c64 $Address", -- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, + {{"EEPROM_24C02", + ExportTemplate("24c02 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, ++ "/sys/bus/i2c/devices/i2c-$Bus/new_device", ++ "new_device", "delete_device", false)}, + {"EEPROM_24C64", + ExportTemplate("24c64 $Address", +- "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, - {"ADM1266", - ExportTemplate("adm1266 $Address", - "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, -+ {{"24C02", ++ "/sys/bus/i2c/devices/i2c-$Bus/new_device", ++ "new_device", "delete_device", false)}, ++ {"24C02", + ExportTemplate("24c02 $Address", "/sys/bus/i2c/devices/i2c-$Bus", + "new_device", "delete_device", false)}, + {"24C64", diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch index 88e86f68c..8682e2cad 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch @@ -1,6 +1,6 @@ -From 1e8b3e0fe4ce9aa87a35f6c3ba6e506873d5455c Mon Sep 17 00:00:00 2001 +From ff5dbca96d12b1c2aaaec0bb891125990af3f218 Mon Sep 17 00:00:00 2001 From: mansijos -Date: Fri, 12 Feb 2021 11:26:57 +0530 +Date: Tue, 6 Apr 2021 02:12:56 +0530 Subject: [PATCH] Entity-manager: Add support to update assetTag Asset tag is an updateable property from User level interface like @@ -12,58 +12,17 @@ Successfully updated in assetTag interface as well as in fru interface while using set-property and using redfish as well. The new value is preserved after BMC resets. -Change-Id: Iab8b24344d1a27486ceafe21aa2b4496706a2944 +Change-Id: If7fbfd8325488280f500ab0e2c8b38475813cc3f Signed-off-by: mansijos --- - include/EntityManager.hpp | 15 ++-- - src/EntityManager.cpp | 148 ++++++++++++++++++++++++++++++++------ - 2 files changed, 135 insertions(+), 28 deletions(-) + src/EntityManager.cpp | 92 +++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 88 insertions(+), 4 deletions(-) -diff --git a/include/EntityManager.hpp b/include/EntityManager.hpp -index 5867556..a4e9922 100644 ---- a/include/EntityManager.hpp -+++ b/include/EntityManager.hpp -@@ -29,13 +29,16 @@ - #include - #include - --using DBusProbeObjectT = boost::container::flat_map< -- std::string, -- std::vector>>; -- - using FoundDeviceT = - std::vector>; - -+using FoundDeviceInfoT = std::vector< -+ std::tuple, -+ std::string, std::string, std::string>>; -+ -+using DBusProbeObjectT = -+ boost::container::flat_map; -+ - struct PerformScan : std::enable_shared_from_this - { - -@@ -62,12 +65,12 @@ struct PerformProbe : std::enable_shared_from_this - { - PerformProbe(const std::vector& probeCommand, - std::shared_ptr& scanPtr, -- std::function&& callback); -+ std::function&& callback); - virtual ~PerformProbe(); - - std::vector _probeCommand; - std::shared_ptr scan; -- std::function _callback; -+ std::function _callback; - }; - - inline void logDeviceAdded(const nlohmann::json& record) diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp -index aa1df20..cd73675 100644 +index 932b6f9..67b8f95 100644 --- a/src/EntityManager.cpp +++ b/src/EntityManager.cpp -@@ -47,9 +47,14 @@ constexpr const char* lastConfiguration = "/tmp/configuration/last.json"; +@@ -47,9 +47,17 @@ constexpr const char* lastConfiguration = "/tmp/configuration/last.json"; constexpr const char* currentConfiguration = "/var/configuration/system.json"; constexpr const char* globalSchema = "global.json"; constexpr const int32_t MAX_MAPPER_DEPTH = 0; @@ -74,99 +33,14 @@ index aa1df20..cd73675 100644 +using foundProbeData = std::map; +static foundProbeData foundData; +static std::map mapFoundData; ++ ++constexpr const char* fruConn = "xyz.openbmc_project.FruDevice"; ++constexpr const char* fruIntf = "xyz.openbmc_project.FruDevice"; + struct cmp_str { bool operator()(const char* a, const char* b) const -@@ -169,7 +174,10 @@ void getInterfaces( - return; - } - -- scan->dbusProbeObjects[std::get<2>(call)].emplace_back(resp); -+ // Save the dbus info along with device info -+ scan->dbusProbeObjects[std::get<2>(call)].emplace_back( -+ std::make_tuple(resp, std::get<0>(call), std::get<1>(call), -+ std::get<2>(call))); - }, - std::get<0>(call), std::get<1>(call), "org.freedesktop.DBus.Properties", - "GetAll", std::get<2>(call)); -@@ -274,11 +282,10 @@ void findDbusObjects(std::vector>&& probeVector, - // probes dbus interface dictionary for a key with a value that matches a regex - bool probeDbus(const std::string& interface, - const std::map& matches, -- FoundDeviceT& devices, std::shared_ptr scan, -+ FoundDeviceInfoT& devices, std::shared_ptr scan, - bool& foundProbe) - { -- std::vector>& -- dbusObject = scan->dbusProbeObjects[interface]; -+ FoundDeviceInfoT& dbusObject = scan->dbusProbeObjects[interface]; - if (dbusObject.empty()) - { - foundProbe = false; -@@ -287,8 +294,9 @@ bool probeDbus(const std::string& interface, - foundProbe = true; - - bool foundMatch = false; -- for (auto& device : dbusObject) -+ for (auto& deviceInfo : dbusObject) - { -+ auto& device = std::get<0>(deviceInfo); - bool deviceMatches = true; - for (auto& match : matches) - { -@@ -305,7 +313,7 @@ bool probeDbus(const std::string& interface, - } - if (deviceMatches) - { -- devices.emplace_back(device); -+ devices.emplace_back(deviceInfo); - foundMatch = true; - deviceMatches = false; // for next iteration - } -@@ -315,11 +323,8 @@ bool probeDbus(const std::string& interface, - - // default probe entry point, iterates a list looking for specific types to - // call specific probe functions --bool probe( -- const std::vector& probeCommand, -- std::shared_ptr scan, -- std::vector>& -- foundDevs) -+bool probe(const std::vector& probeCommand, -+ std::shared_ptr scan, FoundDeviceInfoT& foundDevs) - { - const static std::regex command(R"(\((.*)\))"); - std::smatch match; -@@ -449,8 +454,9 @@ bool probe( - // probe passed, but empty device - if (ret && foundDevs.size() == 0) - { -- foundDevs.emplace_back( -- boost::container::flat_map{}); -+ foundDevs.emplace_back(std::make_tuple( -+ boost::container::flat_map{}, -+ std::string{}, std::string{}, std::string{})); - } - if (matchOne && ret) - { -@@ -465,13 +471,13 @@ bool probe( - - PerformProbe::PerformProbe(const std::vector& probeCommand, - std::shared_ptr& scanPtr, -- std::function&& callback) : -+ std::function&& callback) : - _probeCommand(probeCommand), - scan(scanPtr), _callback(std::move(callback)) - {} - PerformProbe::~PerformProbe() - { -- FoundDeviceT foundDevs; -+ FoundDeviceInfoT foundDevs; - if (probe(_probeCommand, scan, foundDevs)) - { - _callback(foundDevs); -@@ -556,6 +562,47 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, +@@ -575,6 +583,43 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, } } @@ -186,11 +60,8 @@ index aa1df20..cd73675 100644 + } + + foundProbeData& tmpMap = it->second; -+ auto foundConn = tmpMap.find("foundConn"); + auto foundPath = tmpMap.find("foundPath"); -+ auto foundIntf = tmpMap.find("foundIntf"); -+ if (foundConn == tmpMap.end() || foundPath == tmpMap.end() || -+ foundIntf == tmpMap.end()) ++ if (foundPath == tmpMap.end()) + { + std::cerr << "No prob object data is avaliable in foundProbeData" + << "\n"; @@ -205,20 +76,16 @@ index aa1df20..cd73675 100644 + << "\n"; + } + }, -+ foundConn->second, foundPath->second, "org.freedesktop.DBus.Properties", -+ "Set", foundIntf->second, "PRODUCT_ASSET_TAG", -+ std::variant(newVal)); ++ fruConn, foundPath->second, "org.freedesktop.DBus.Properties", "Set", ++ fruIntf, "PRODUCT_ASSET_TAG", std::variant(newVal)); + return true; +} + template void addProperty(const std::string& propertyName, const PropertyType& value, sdbusplus::asio::dbus_interface* iface, -@@ -568,11 +615,21 @@ void addProperty(const std::string& propertyName, const PropertyType& value, - iface->register_property(propertyName, value); - return; +@@ -589,9 +634,18 @@ void addProperty(const std::string& propertyName, const PropertyType& value, } -+ iface->register_property( propertyName, value, - [&systemConfiguration, @@ -237,19 +104,17 @@ index aa1df20..cd73675 100644 val = newVal; if (!setJsonFromPointer(jsonPointerString, val, systemConfiguration)) -@@ -970,6 +1027,11 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -989,6 +1043,9 @@ void postToDbus(const nlohmann::json& newConfiguration, populateInterfaceFromJson(systemConfiguration, jsonPointerPath, boardIface, boardValues, objServer); jsonPointerPath += "/"; + -+ std::string foundConn; + std::string foundPath; -+ std::string foundIntf; + // iterate through board properties for (auto& boardField : boardValues.items()) { -@@ -979,9 +1041,32 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -998,9 +1055,28 @@ void postToDbus(const nlohmann::json& newConfiguration, createInterface(objServer, boardName, boardField.key(), boardKeyOrig); @@ -258,16 +123,12 @@ index aa1df20..cd73675 100644 - iface, boardField.value(), objServer); + if (boardField.key() == "FoundProbe") + { -+ foundConn = boardField.value()["Connection"]; + foundPath = boardField.value()["Path"]; -+ foundIntf = boardField.value()["Interface"]; + } + if (boardField.key() == + "xyz.openbmc_project.Inventory.Decorator.AssetTag") + { -+ foundData["foundConn"] = foundConn; + foundData["foundPath"] = foundPath; -+ foundData["foundIntf"] = foundIntf; + mapFoundData[jsonPointerPath + boardField.key()] = + foundData; + @@ -285,63 +146,24 @@ index aa1df20..cd73675 100644 } } -@@ -1278,7 +1363,7 @@ void PerformScan::run() - auto thisRef = shared_from_this(); - auto probePointer = std::make_shared( - probeCommand, thisRef, -- [&, recordPtr, probeName](FoundDeviceT& foundDevices) { -+ [&, recordPtr, probeName](FoundDeviceInfoT& foundDevices) { - _passed = true; - - std::set usedNames; -@@ -1294,7 +1379,8 @@ void PerformScan::run() - for (auto itr = foundDevices.begin(); - itr != foundDevices.end();) - { -- std::string recordName = getRecordName(*itr, probeName); -+ std::string recordName = -+ getRecordName(std::get<0>(*itr), probeName); - - auto fromLastJson = lastJson.find(recordName); - if (fromLastJson != lastJson.end()) -@@ -1328,6 +1414,15 @@ void PerformScan::run() +@@ -1349,6 +1425,10 @@ void PerformScan::run() continue; } + nlohmann::json recordVal = *recordPtr; -+ // Save the dbus connection, path and interface info -+ // of the device -+ recordVal[foundObject]["Connection"] = -+ std::get<1>(*itr); -+ recordVal[foundObject]["Path"] = std::get<2>(*itr); -+ recordVal[foundObject]["Interface"] = -+ std::get<3>(*itr); ++ // Save the dbus path info of the device ++ recordVal[foundObject]["Path"] = std::get<1>(*itr); + int index = std::stoi( nameIt->get().substr(indexIdx), nullptr, 0); -@@ -1349,8 +1444,9 @@ void PerformScan::run() - - std::optional replaceStr; - -- for (auto& foundDevice : foundDevices) -+ for (auto& foundDeviceInfo : foundDevices) - { -+ auto& foundDevice = std::get<0>(foundDeviceInfo); - nlohmann::json record = *recordPtr; - std::string recordName = - getRecordName(foundDevice, probeName); -@@ -1382,6 +1478,14 @@ void PerformScan::run() +@@ -1421,6 +1501,10 @@ void PerformScan::run() } } -+ // Save the dbus connection, path and interface info -+ // of the device -+ record[foundObject]["Connection"] = -+ std::get<1>(foundDeviceInfo); -+ record[foundObject]["Path"] = std::get<2>(foundDeviceInfo); -+ record[foundObject]["Interface"] = -+ std::get<3>(foundDeviceInfo); ++ // Save the dbus path info of the device ++ record[foundObject]["Path"] = ++ std::get<1>(foundDeviceAndPath); + if (replaceStr) { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0003-Add-logs-to-fwVersionIsSame.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0003-Add-logs-to-fwVersionIsSame.patch new file mode 100644 index 000000000..94af67967 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0003-Add-logs-to-fwVersionIsSame.patch @@ -0,0 +1,56 @@ +From 28525b56161e1b659e85e85c33fc00dc397758aa Mon Sep 17 00:00:00 2001 +From: Helen Huang +Date: Mon, 19 Apr 2021 16:06:15 +0800 +Subject: [PATCH] Add logs to fwVersionIsSame() + +Add logs to fwVersionIsSame() to indicate whether the firmware +version is changed or not. + +Tested: +Logs are printed as expected when firmware updating and BMC rebooting. + +Log of rebooting: +The firmware version is similiar as the last boot, +Hash value of versionFile is:3336889560 + +Log of Firmware update: +The firmware version is changed since the last boot, +hash value of current versionFile is:3336889560, +hash value of versionFile of last boot is:834871226 + +Change-Id: I5306917329d2e2e015af58cad1e9c59881f0b217 +Signed-off-by: Helen Huang +--- + include/Utils.hpp | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/include/Utils.hpp b/include/Utils.hpp +index 657af92..8238807 100644 +--- a/include/Utils.hpp ++++ b/include/Utils.hpp +@@ -116,13 +116,22 @@ inline bool fwVersionIsSame(void) + + if (expectedHash == hashString) + { ++ std::cout << "The firmware version is similiar as the last boot, " ++ "hash value of versionFile is:" ++ << hashString.c_str() << "\n"; + return true; + } ++ std::cout << "The firmware version is changed since the last boot, hash " ++ "value of current versionFile is:" ++ << expectedHash.c_str() ++ << ", hash value of versionFile of last boot is:" ++ << hashString.c_str() << "\n"; + hashFile.close(); + } + + std::ofstream output(versionHashFile); + output << expectedHash; ++ + return false; + } + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend index 94bddf2be..9d891c620 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend @@ -1,10 +1,11 @@ # this is here just to bump faster than upstream # SRC_URI = "git://github.com/openbmc/entity-manager.git" -SRCREV = "296667f0076888f3cdf898a3f2cdf66da260853e" +SRCREV = "1694ef625a1075599e40faa695a40d61ccd91095" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += " file://0001-Improve-initialization-of-I2C-sensors.patch \ file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ + file://0003-Add-logs-to-fwVersionIsSame.patch \ " -- cgit v1.2.3