summaryrefslogtreecommitdiff
path: root/services/smbios-mdrv2/src/cpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/smbios-mdrv2/src/cpu.cpp')
-rw-r--r--services/smbios-mdrv2/src/cpu.cpp44
1 files changed, 40 insertions, 4 deletions
diff --git a/services/smbios-mdrv2/src/cpu.cpp b/services/smbios-mdrv2/src/cpu.cpp
index cda96da..f7681c9 100644
--- a/services/smbios-mdrv2/src/cpu.cpp
+++ b/services/smbios-mdrv2/src/cpu.cpp
@@ -16,6 +16,7 @@
#include "cpu.hpp"
+#include <iostream>
#include <map>
namespace phosphor
@@ -82,13 +83,13 @@ void Cpu::cpuManufacturer(const uint8_t positionNum, const uint8_t structLen,
{
std::string result = positionToString(positionNum, structLen, dataIn);
- processorManufacturer(result);
+ manufacturer(result);
}
-std::string Cpu::processorManufacturer(std::string value)
+std::string Cpu::manufacturer(std::string value)
{
- return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Cpu::
- processorManufacturer(value);
+ return sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::
+ Asset::manufacturer(value);
}
uint32_t Cpu::processorId(uint32_t value)
@@ -152,6 +153,39 @@ uint16_t Cpu::processorThreadCount(uint16_t value)
processorThreadCount(value);
}
+static constexpr const uint8_t populateMask = 1 << 6;
+static constexpr const uint8_t statusMask = 0x07;
+void Cpu::cpuStatus(uint8_t value)
+{
+ if (!(value & populateMask))
+ {
+ present(false);
+ functional(false);
+ return;
+ }
+ present(true);
+ if ((value & statusMask) == 1)
+ {
+ functional(true);
+ }
+ else
+ {
+ functional(false);
+ }
+}
+
+bool Cpu::present(bool value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::server::Item::present(
+ value);
+}
+
+bool Cpu::functional(bool value)
+{
+ return sdbusplus::xyz::openbmc_project::State::Decorator::server::
+ OperationalStatus::functional(value);
+}
+
static constexpr uint8_t maxOldVersionCount = 0xff;
void Cpu::processorInfoUpdate(void)
{
@@ -207,6 +241,8 @@ void Cpu::processorInfoUpdate(void)
}
cpuCharacteristics(cpuInfo->characteristics); // offset 26h
+
+ cpuStatus(cpuInfo->status);
}
} // namespace smbios