Add CPU and memory LocationCode DBus interface

LocationCode DBus interface can describe the sockets with physical
labels printed on the board. Bmcweb looks up the LocationCode for CPU
and DIMM resources and then identify the resource location. Those
physical CPU and DIMM socket labels are hardcoded in SMBIOS table as
socket designation.

Tested:
CPU and memory DBus objects show the
xyz.openbmc_project.Inventory.Decorator.LocationCode interface and the
LocationCode property is the socket label.

Signed-off-by: Jie Yang <jjy@google.com>
Change-Id: I6131567aca1958505989773fc800a4c2d1dd7e1f
diff --git a/include/dimm.hpp b/include/dimm.hpp
index 43b5456..ec1e32c 100644
--- a/include/dimm.hpp
+++ b/include/dimm.hpp
@@ -18,6 +18,7 @@
 #include "smbios_mdrv2.hpp"
 
 #include <xyz/openbmc_project/Inventory/Decorator/Asset/server.hpp>
+#include <xyz/openbmc_project/Inventory/Decorator/LocationCode/server.hpp>
 #include <xyz/openbmc_project/Inventory/Item/Dimm/server.hpp>
 #include <xyz/openbmc_project/Inventory/Item/server.hpp>
 
@@ -36,6 +37,9 @@
     sdbusplus::server::object::object<
         sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Asset>,
     sdbusplus::server::object::object<
+        sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::
+            LocationCode>,
+    sdbusplus::server::object::object<
         sdbusplus::xyz::openbmc_project::Inventory::server::Item>
 {
   public:
@@ -56,6 +60,9 @@
             sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::
                 Asset>(bus, objPath.c_str()),
         sdbusplus::server::object::object<
+            sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::
+                LocationCode>(bus, objPath.c_str()),
+        sdbusplus::server::object::object<
             sdbusplus::xyz::openbmc_project::Inventory::server::Item>(
             bus, objPath.c_str()),
         dimmNum(dimmId), storage(smbiosTableStorage)
@@ -75,6 +82,7 @@
     bool present(bool value) override;
     std::string serialNumber(std::string value) override;
     std::string partNumber(std::string value) override;
+    std::string locationCode(std::string value) override;
     uint8_t memoryAttributes(uint8_t value) override;
     uint16_t memoryConfiguredSpeedInMhz(uint16_t value) override;