diff options
Diffstat (limited to 'meta-ibs/meta-common/recipes-phosphor/interfaces/bmcweb/0003-add-new-cpu-fields.patch')
-rw-r--r-- | meta-ibs/meta-common/recipes-phosphor/interfaces/bmcweb/0003-add-new-cpu-fields.patch | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/meta-ibs/meta-common/recipes-phosphor/interfaces/bmcweb/0003-add-new-cpu-fields.patch b/meta-ibs/meta-common/recipes-phosphor/interfaces/bmcweb/0003-add-new-cpu-fields.patch new file mode 100644 index 0000000000..1e4f2efd7a --- /dev/null +++ b/meta-ibs/meta-common/recipes-phosphor/interfaces/bmcweb/0003-add-new-cpu-fields.patch @@ -0,0 +1,133 @@ +From 644dc71f3ff13fbc620d6ea8bff89736dc7cc691 Mon Sep 17 00:00:00 2001 +From: eportnov <eportnov@ibs.ru> +Date: Fri, 8 Jul 2022 10:31:14 +0300 +Subject: [PATCH] add new cpu fields + +--- + redfish-core/lib/processor.hpp | 106 +++++++++++++++++++++++++++++++++ + 1 file changed, 106 insertions(+) + +diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp +index 2a0e028..a83211a 100644 +--- a/redfish-core/lib/processor.hpp ++++ b/redfish-core/lib/processor.hpp +@@ -66,6 +66,77 @@ inline void getProcessorUUID(std::shared_ptr<bmcweb::AsyncResp> aResp, + }); + } + ++inline std::string translateInstructionSetTypeToRedfish(const std::string& instructionSetType) ++{ ++ if (instructionSetType == "xyz.openbmc_project.Inventory.Item.Cpu.Instruction.ARM_A32") ++ { ++ return "ARM-A32"; ++ } ++ if (instructionSetType == "xyz.openbmc_project.Inventory.Item.Cpu.Instruction.ARM_A64") ++ { ++ return "ARM-A64"; ++ } ++ if (instructionSetType == "xyz.openbmc_project.Inventory.Item.Cpu.Instruction.IA_64") ++ { ++ return "IA-64"; ++ } ++ if (instructionSetType == "xyz.openbmc_project.Inventory.Item.Cpu.Instruction.MIPS32") ++ { ++ return "MIPS32"; ++ } ++ if (instructionSetType == "xyz.openbmc_project.Inventory.Item.Cpu.Instruction.MIPS64") ++ { ++ return "MIPS64"; ++ } ++ if (instructionSetType == "xyz.openbmc_project.Inventory.Item.Cpu.Instruction.OEM") ++ { ++ return "OEM"; ++ } ++ if (instructionSetType == "xyz.openbmc_project.Inventory.Item.Cpu.Instruction.PowerISA") ++ { ++ return "PowerISA"; ++ } ++ if (instructionSetType == "xyz.openbmc_project.Inventory.Item.Cpu.Instruction.x86") ++ { ++ return "x86"; ++ } ++ if (instructionSetType == "xyz.openbmc_project.Inventory.Item.Cpu.Instruction.x86_64") ++ { ++ return "x86-64"; ++ } ++ return ""; ++} ++ ++inline std::string translateProcessorArchTypeToRedfish(const std::string& processorArchType) ++{ ++ if (processorArchType == "xyz.openbmc_project.Inventory.Item.Cpu.ProcessorArchitecture.ARM") ++ { ++ return "ARM"; ++ } ++ if (processorArchType == "xyz.openbmc_project.Inventory.Item.Cpu.ProcessorArchitecture.IA_64") ++ { ++ return "IA-64"; ++ } ++ if (processorArchType == "xyz.openbmc_project.Inventory.Item.Cpu.ProcessorArchitecture.MIPS") ++ { ++ return "MIPS"; ++ } ++ if (processorArchType == "xyz.openbmc_project.Inventory.Item.Cpu.ProcessorArchitecture.OEM") ++ { ++ return "OEM"; ++ } ++ if (processorArchType == "xyz.openbmc_project.Inventory.Item.Cpu.ProcessorArchitecture.Power") ++ { ++ return "Power"; ++ } ++ if (processorArchType == "xyz.openbmc_project.Inventory.Item.Cpu.ProcessorArchitecture.x86") ++ { ++ return "x86"; ++ } ++ return ""; ++} ++ ++ + inline void getCpuDataByInterface( + const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const dbus::utility::DBusInteracesMap& cpuInterfacesProperties) +@@ -144,6 +215,41 @@ inline void getCpuDataByInterface( + aResp->res.jsonValue["TotalThreads"] = *value; + } + } ++ else if (property.first == "InstructionSet") ++ { ++ const std::string* value = ++ std::get_if<std::string>(&property.second); ++ if (value != nullptr) ++ { ++ aResp->res.jsonValue["InstructionSet"] = translateInstructionSetTypeToRedfish(*value); ++ } ++ } ++ else if (property.first == "Version") ++ { ++ const std::string* value = ++ std::get_if<std::string>(&property.second); ++ if (value != nullptr) ++ { ++ aResp->res.jsonValue["Version"] = *value; ++ } ++ } ++ else if (property.first == "ProcessorArchitecture") ++ { ++ const std::string* value = ++ std::get_if<std::string>(&property.second); ++ if (value != nullptr) ++ { ++ aResp->res.jsonValue["ProcessorArchitecture"] = translateProcessorArchTypeToRedfish(*value); ++ } ++ } ++ else if (property.first == "MinSpeedMHz") ++ { ++ const uint32_t* value = std::get_if<uint32_t>(&property.second); ++ if (value != nullptr) ++ { ++ aResp->res.jsonValue["MinSpeedMHz"] = *value; ++ } ++ } + else if (property.first == "EffectiveFamily") + { + const uint16_t* value = std::get_if<uint16_t>(&property.second); |