Implement Inventory.Item for CPU presence

Bmcweb Redfish code now relies on the xyz.openbmc_project.Inventory.Item
interface to determine Processor presence status. And if this interface
does not exist, CPUs are shown as Present by default. Therefore, to
avoid false positive presence, this commit fills out the interface based
on Status field of the Type 4 table.

Tested:
GET /redfish/v1/Systems/system/Processor/cpu1 (unpopulated socket)
-> Before change:
{
    ...
    "Manufacturer": "CPU1",
    "MaxSpeedMHz": 4000,
    "ProcessorId": {
        "EffectiveFamily": "Unknown Processor Family"
    },
    "Socket": "CPU1",
    "Status": {
        "Health": "OK",
        "State": "Enabled"
    },
    "Version": "CPU1"
    ...
}
-> After change:
{
    ...
    "Manufacturer": "",
    "MaxSpeedMHz": 0,
    "ProcessorId": {
        "EffectiveFamily": ""
    },
    "Socket": "CPU1",
    "Status": {
        "Health": "OK",
        "State": "Absent"
    },
    "Version": ""
    ...
}

GET /redfish/v1/Systems/system/Processor/cpu0 (populated socket)
-> Before/after change:
{
    ...
    "Status": {
        "Health": "OK",
        "State": "Enabled"
    },
    ...
}

Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
Change-Id: I8868919e3f919d774b8bedb6c48cc6e4bc764c26
diff --git a/include/cpu.hpp b/include/cpu.hpp
index 5c8ca86..c2edca9 100644
--- a/include/cpu.hpp
+++ b/include/cpu.hpp
@@ -20,6 +20,7 @@
 #include <xyz/openbmc_project/Inventory/Decorator/Asset/server.hpp>
 #include <xyz/openbmc_project/Inventory/Decorator/Revision/server.hpp>
 #include <xyz/openbmc_project/Inventory/Item/Cpu/server.hpp>
+#include <xyz/openbmc_project/Inventory/Item/server.hpp>
 
 namespace phosphor
 {
@@ -32,6 +33,7 @@
 using asset =
     sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Asset;
 using processor = sdbusplus::xyz::openbmc_project::Inventory::Item::server::Cpu;
+using Item = sdbusplus::xyz::openbmc_project::Inventory::server::Item;
 
 // Definition follow smbios spec DSP0134 3.0.0
 static const std::map<uint8_t, const char*> familyTable = {
@@ -88,7 +90,7 @@
                          std::nullopt,
                          std::nullopt};
 
-class Cpu : sdbusplus::server::object_t<processor, asset, rev>
+class Cpu : sdbusplus::server::object_t<processor, asset, rev, Item>
 {
   public:
     Cpu() = delete;
@@ -100,8 +102,8 @@
 
     Cpu(sdbusplus::bus::bus& bus, const std::string& objPath,
         const uint8_t& cpuId, uint8_t* smbiosTableStorage) :
-        sdbusplus::server::object_t<processor, asset, rev>(bus,
-                                                           objPath.c_str()),
+        sdbusplus::server::object_t<processor, asset, rev, Item>(
+            bus, objPath.c_str()),
         cpuNum(cpuId), storage(smbiosTableStorage)
     {
         infoUpdate();