diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch | 288 |
1 files changed, 0 insertions, 288 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch deleted file mode 100644 index edf4d219e..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch +++ /dev/null @@ -1,288 +0,0 @@ -From f4f15a52610d1a199ddac948c8f849df05d86151 Mon Sep 17 00:00:00 2001 -From: Ali Ahmed <ama213000@gmail.com> -Date: Fri, 3 Sep 2021 02:33:43 -0500 -Subject: [PATCH] Add Model & CoreCount to ProcessorSummary - -In Redfish ComputerSystem schema, the ProcessorSummary parameter -lists summary information of the Processors on the system. This commit -adds the 'Model' and 'CoreCount' properties to ProcessorSummary. - -If the CPU Models are different, then the 'Model' field takes the first -entry in alphabetical order. - -Testing: -1. Redfish Validator Testing successfully passed. -2. Curl testing: - -curl -k -H "X-Auth-Token: $tok" https://$bmc/redfish/v1/Systems/system - -... - "ProcessorSummary": { - "CoreCount": 24, - "Count": 2, - "Model": "test_name", - "Status": { - "Health": "OK", - "HealthRollup": "OK", - "State": "Disabled" - } - }, -... - -Change-Id: I39cbf6ed35c35ce3a3551c9689237d5023775326 -Signed-off-by: Ali Ahmed <ama213000@gmail.com> -Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> ---- - redfish-core/lib/systems.hpp | 229 ++++++++++++++++++++++------------- - 1 file changed, 147 insertions(+), 82 deletions(-) - -diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp -index 680a0ee..3b5f9e4 100644 ---- a/redfish-core/lib/systems.hpp -+++ b/redfish-core/lib/systems.hpp -@@ -139,6 +139,152 @@ inline void - } - } - -+inline void getProcessorProperties( -+ const std::shared_ptr<bmcweb::AsyncResp>& aResp, const std::string& service, -+ const std::string& path, -+ const std::vector<std::pair< -+ std::string, std::variant<std::string, uint64_t, uint32_t, uint16_t>>>& -+ properties) -+{ -+ -+ BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties."; -+ -+ auto getCpuPresenceState = -+ [aResp](const boost::system::error_code ec3, -+ const std::variant<bool>& cpuPresenceCheck) { -+ if (ec3) -+ { -+ BMCWEB_LOG_ERROR << "DBUS response error " << ec3; -+ return; -+ } -+ modifyCpuPresenceState(aResp, cpuPresenceCheck); -+ }; -+ -+ auto getCpuFunctionalState = -+ [aResp](const boost::system::error_code ec3, -+ const std::variant<bool>& cpuFunctionalCheck) { -+ if (ec3) -+ { -+ BMCWEB_LOG_ERROR << "DBUS response error " << ec3; -+ return; -+ } -+ modifyCpuFunctionalState(aResp, cpuFunctionalCheck); -+ }; -+ -+ // Get the Presence of CPU -+ crow::connections::systemBus->async_method_call( -+ std::move(getCpuPresenceState), service, path, -+ "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.Inventory.Item", "Present"); -+ -+ // Get the Functional State -+ crow::connections::systemBus->async_method_call( -+ std::move(getCpuFunctionalState), service, path, -+ "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional"); -+ -+ for (const auto& property : properties) -+ { -+ if (property.first == "Family") -+ { -+ // Get the CPU Model -+ const std::string* modelStr = -+ std::get_if<std::string>(&property.second); -+ if (!modelStr) -+ { -+ BMCWEB_LOG_DEBUG << "Failed to get CPU Family"; -+ // Skip it and continue with other properties -+ continue; -+ } -+ if ((*modelStr).size() < 1) -+ { -+ BMCWEB_LOG_DEBUG << "Empty CPU Family info, skipping..."; -+ continue; -+ } -+ nlohmann::json& prevModel = -+ aResp->res.jsonValue["ProcessorSummary"]["Model"]; -+ std::string* prevModelPtr = prevModel.get_ptr<std::string*>(); -+ -+ // If CPU Models are different, use the first entry in -+ // alphabetical order -+ -+ // If Model has never been set -+ // before, set it to *modelStr -+ if (prevModelPtr == nullptr) -+ { -+ prevModel = *modelStr; -+ } -+ // If Model has been set before, only change if new Model is -+ // higher in alphabetical order -+ else -+ { -+ if (*modelStr < *prevModelPtr) -+ { -+ prevModel = *modelStr; -+ } -+ } -+ } -+ else if (property.first == "CoreCount") -+ { -+ // Get CPU CoreCount and add it to the total -+ const uint16_t* coreCountVal = -+ std::get_if<uint16_t>(&property.second); -+ -+ if (!coreCountVal) -+ { -+ BMCWEB_LOG_DEBUG << "Failed to get CPU Core count"; -+ // Skip it and continue with other properties -+ continue; -+ } -+ -+ nlohmann::json& coreCount = -+ aResp->res.jsonValue["ProcessorSummary"]["CoreCount"]; -+ uint64_t* coreCountPtr = coreCount.get_ptr<uint64_t*>(); -+ -+ if (coreCountPtr == nullptr) -+ { -+ coreCount = *coreCountVal; -+ } -+ else -+ { -+ *coreCountPtr += *coreCountVal; -+ } -+ } -+ } -+} -+ -+/* -+ * @brief Get ProcessorSummary fields -+ * -+ * @param[in] aResp Shared pointer for completing asynchronous calls -+ * @param[in] service dbus service for Cpu Information -+ * @param[in] path dbus path for Cpu -+ * -+ * @return None. -+ */ -+inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, -+ const std::string& service, -+ const std::string& path) -+{ -+ -+ crow::connections::systemBus->async_method_call( -+ [aResp, service, -+ path](const boost::system::error_code ec2, -+ const std::vector<std::pair< -+ std::string, std::variant<std::string, uint64_t, uint32_t, -+ uint16_t>>>& properties) { -+ if (ec2) -+ { -+ BMCWEB_LOG_ERROR << "DBUS response error " << ec2; -+ messages::internalError(aResp->res); -+ return; -+ } -+ getProcessorProperties(aResp, service, path, properties); -+ }, -+ service, path, "org.freedesktop.DBus.Properties", "GetAll", -+ "xyz.openbmc_project.Inventory.Item.Cpu"); -+} -+ - /* - * @brief Retrieves computer system properties over dbus - * -@@ -309,88 +455,7 @@ inline void - BMCWEB_LOG_DEBUG - << "Found Cpu, now get its properties."; - -- crow::connections::systemBus->async_method_call( -- [aResp, service{connection.first}, -- path](const boost::system::error_code ec2, -- const std::vector< -- std::pair<std::string, VariantType>>& -- properties) { -- if (ec2) -- { -- BMCWEB_LOG_ERROR -- << "DBUS response error " << ec2; -- messages::internalError(aResp->res); -- return; -- } -- BMCWEB_LOG_DEBUG << "Got " -- << properties.size() -- << " Cpu properties."; -- -- auto getCpuPresenceState = -- [aResp]( -- const boost::system::error_code ec3, -- const std::variant<bool>& -- cpuPresenceCheck) { -- if (ec3) -- { -- BMCWEB_LOG_ERROR -- << "DBUS response error " -- << ec3; -- return; -- } -- modifyCpuPresenceState( -- aResp, cpuPresenceCheck); -- }; -- -- auto getCpuFunctionalState = -- [aResp]( -- const boost::system::error_code ec3, -- const std::variant<bool>& -- cpuFunctionalCheck) { -- if (ec3) -- { -- BMCWEB_LOG_ERROR -- << "DBUS response error " -- << ec3; -- return; -- } -- modifyCpuFunctionalState( -- aResp, cpuFunctionalCheck); -- }; -- -- // Get the Presence of CPU -- crow::connections::systemBus -- ->async_method_call( -- std::move(getCpuPresenceState), -- service, path, -- "org.freedesktop.DBus." -- "Properties", -- "Get", -- "xyz.openbmc_project.Inventory." -- "Item", -- "Present"); -- -- // Get the Functional State -- crow::connections::systemBus -- ->async_method_call( -- std::move(getCpuFunctionalState), -- service, path, -- "org.freedesktop.DBus." -- "Properties", -- "Get", -- "xyz.openbmc_project.State." -- "Decorator." -- "OperationalStatus", -- "Functional"); -- -- // Get the MODEL from -- // xyz.openbmc_project.Inventory.Decorator.Asset -- // support it later as Model is Empty -- // currently. -- }, -- connection.first, path, -- "org.freedesktop.DBus.Properties", "GetAll", -- "xyz.openbmc_project.Inventory.Item.Cpu"); -+ getProcessorSummary(aResp, connection.first, path); - - cpuHealth->inventory.emplace_back(path); - } --- -2.17.1 - |