summaryrefslogtreecommitdiff
path: root/src/cpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu.cpp')
-rw-r--r--src/cpu.cpp80
1 files changed, 26 insertions, 54 deletions
diff --git a/src/cpu.cpp b/src/cpu.cpp
index b6ebb3a..552a781 100644
--- a/src/cpu.cpp
+++ b/src/cpu.cpp
@@ -19,6 +19,7 @@
#include <map>
#include <cstdint>
#include <bitset>
+#include <iostream>
namespace phosphor
{
@@ -31,7 +32,9 @@ void Cpu::cpuSocket(uint8_t positionNum, uint8_t structLen, uint8_t *dataIn)
result = positionToString(positionNum, structLen, dataIn);
- processorSocket(result);
+ processor::socket(result);
+
+ location::locationCode(result);
}
std::string Cpu::processorSocket(std::string value)
@@ -39,43 +42,19 @@ std::string Cpu::processorSocket(std::string value)
return processor::socket(value);
}
-void Cpu::cpuType(uint8_t value)
-{
- std::map<uint8_t, std::string>::const_iterator it =
- cpuTypeTable.find(value);
- if (it == cpuTypeTable.end())
- {
- processorType("Unknown Processor Type");
- }
- else
- {
- processorType(it->second);
- }
-}
-
-std::string Cpu::processorType(std::string value)
-{
- return "";//processor::processorType(value);
-}
-
void Cpu::cpuFamily(uint8_t value)
{
std::map<uint8_t, std::string>::const_iterator it = familyTable.find(value);
if (it == familyTable.end())
{
- processorFamily("Unknown Processor Family");
+ processor::family("Unknown Processor Family");
}
else
{
- processorFamily(it->second);
+ processor::family(it->second);
}
}
-std::string Cpu::processorFamily(std::string value)
-{
- return processor::family(value);
-}
-
void Cpu::cpuManufacturer(uint8_t positionNum, uint8_t structLen,
uint8_t *dataIn)
{
@@ -83,12 +62,7 @@ void Cpu::cpuManufacturer(uint8_t positionNum, uint8_t structLen,
result = positionToString(positionNum, structLen, dataIn);
- processorManufacturer(result);
-}
-
-std::string Cpu::processorManufacturer(std::string value)
-{
- return asset::manufacturer(value);
+ asset::manufacturer(result);
}
uint32_t Cpu::processorId(uint32_t value)
@@ -102,12 +76,8 @@ void Cpu::cpuVersion(uint8_t positionNum, uint8_t structLen, uint8_t *dataIn)
result = positionToString(positionNum, structLen, dataIn);
- processorVersion(result);
-}
-
-std::string Cpu::processorVersion(std::string value)
-{
- return rev::version(value);
+ processor::version(result);
+ rev::version(result);
}
uint16_t Cpu::processorMaxSpeed(uint16_t value)
@@ -135,11 +105,6 @@ void Cpu::cpuCharacteristics(uint16_t value)
processor::characteristics(result);
}
-std::string Cpu::processorCharacteristics(std::string value)
-{
- return "";//processor::characteristics(value);
-}
-
uint16_t Cpu::processorCoreCount(uint16_t value)
{
return processor::coreCount(value);
@@ -177,16 +142,23 @@ void Cpu::processorInfoUpdate(void)
auto cpuInfo = reinterpret_cast<struct ProcessorInfo *>(dataIn);
- cpuSocket(cpuInfo->socketDesignation, cpuInfo->length,
- dataIn); // offset 4h
- cpuType(cpuInfo->processorType); // offset 5h
- cpuFamily(cpuInfo->family); // offset 6h
- cpuManufacturer(cpuInfo->manufacturer, cpuInfo->length,
- dataIn); // offset 7h
- processorId(cpuInfo->id); // offset 8h
- cpuVersion(cpuInfo->version, cpuInfo->length, dataIn); // offset 10h
- processorMaxSpeed(cpuInfo->maxSpeed); // offset 14h
- if (cpuInfo->coreCount < maxOldVersionCount) // offset 23h or 2Ah
+ constexpr uint32_t socketPopulatedMask = 1 << 6;
+ if ((cpuInfo->status & socketPopulatedMask) == 0)
+ {
+ // Don't attempt to fill in any other details if the CPU is not present.
+ present(false);
+ return;
+ }
+ present(true);
+
+ cpuSocket(cpuInfo->socketDesignation, cpuInfo->length, dataIn); // offset 4h
+ cpuFamily(cpuInfo->family); // offset 6h
+ cpuManufacturer(cpuInfo->manufacturer, cpuInfo->length, dataIn);// offset 7h
+ processorId(cpuInfo->id); // offset 8h
+ cpuVersion(cpuInfo->version, cpuInfo->length, dataIn); // offset 10h
+ processorMaxSpeed(cpuInfo->maxSpeed); // offset 14h
+
+ if (cpuInfo->coreCount < maxOldVersionCount) // offset 23h or 2Ah
{
processorCoreCount((uint16_t)cpuInfo->coreCount);
}