diff options
author | Brandon Kim <brandonkim@google.com> | 2021-09-15 03:52:51 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2021-12-01 03:38:37 +0300 |
commit | 1930fbd482ad28be0c833db0035d1be180e25939 (patch) | |
tree | f1d010453f284b8d676f4e5a3a3ba19173cfced0 /redfish-core | |
parent | 0fd03ad472d42eb35c15147e4c678d28b7f70c4a (diff) | |
download | bmcweb-1930fbd482ad28be0c833db0035d1be180e25939.tar.xz |
redfish-core: processor: Add Model, Microcode, Step
Add implementation of ProcessorId from Processor DMTF Schema.
"EffectiveModel", "MicrocodeInfo" and "Step" are mapped to "Model",
"Microcode" and "Step" from phosphor-dbus-interfaces
Tested:
With some of the information redacted as XX, we can see:
```
{
"@odata.id": "/redfish/v1/Systems/system/Processors/cpu0",
"@odata.type": "#Processor.v1_11_0.Processor",
"Id": "cpu0",
"MaxSpeedMHz": 0,
"Name": "Processor",
"ProcessorId": {
"EffectiveFamily": "X",
"EffectiveModel": "XX",
"MicrocodeInfo": "XXX",
"Step": "X"
},
"ProcessorType": "CPU",
"Socket": "0",
"Status": {
"Health": "OK",
"State": "Enabled"
},
"TotalCores": XX,
"TotalThreads": XXX
}
```
The Redfish-Service-Validator passed for Processors:
```
*** /redfish/v1/Systems/system/Processors
Type (#ProcessorCollection.ProcessorCollection), GET SUCCESS (time: 0.286532)
...
...
*** /redfish/v1/Systems/system/Processors/cpu0
Type (#Processor.v1_11_0.Processor), GET SUCCESS (time: 0.434741)
PASS
...
...
*** /redfish/v1/JsonSchemas/Processor
Type (#JsonSchemaFile.v1_0_2.JsonSchemaFile), GET SUCCESS (time: 0.134821)
PASS
```
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: Ie770bfcdb8bf9d5efbf90cc9d9c09daaf8447a6f
Diffstat (limited to 'redfish-core')
-rw-r--r-- | redfish-core/lib/processor.hpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp index ec24735ba1..e510768442 100644 --- a/redfish-core/lib/processor.hpp +++ b/redfish-core/lib/processor.hpp @@ -160,16 +160,26 @@ inline void aResp->res.jsonValue["TotalThreads"] = *value; } } - else if (property.first == "Family") + else if (property.first == "EffectiveFamily") { - const std::string* value = - std::get_if<std::string>(&property.second); + const uint16_t* value = std::get_if<uint16_t>(&property.second); if (value != nullptr) { aResp->res.jsonValue["ProcessorId"]["EffectiveFamily"] = - *value; + "0x" + intToHexString(*value); } } + else if (property.first == "EffectiveModel") + { + const uint16_t* value = std::get_if<uint16_t>(&property.second); + if (value == nullptr) + { + messages::internalError(aResp->res); + return; + } + aResp->res.jsonValue["ProcessorId"]["EffectiveModel"] = + "0x" + intToHexString(*value); + } else if (property.first == "Id") { const uint64_t* value = std::get_if<uint64_t>(&property.second); @@ -180,6 +190,28 @@ inline void "0x" + intToHexString(*value); } } + else if (property.first == "Microcode") + { + const uint32_t* value = std::get_if<uint32_t>(&property.second); + if (value == nullptr) + { + messages::internalError(aResp->res); + return; + } + aResp->res.jsonValue["ProcessorId"]["MicrocodeInfo"] = + "0x" + intToHexString(*value); + } + else if (property.first == "Step") + { + const uint16_t* value = std::get_if<uint16_t>(&property.second); + if (value == nullptr) + { + messages::internalError(aResp->res); + return; + } + aResp->res.jsonValue["ProcessorId"]["Step"] = + "0x" + intToHexString(*value); + } } } |