Add support for Read Base Board Product ID

OEM command read base board product id handler is
added

Tested:
1. Verified the same by issueing ipmitool raw 0x30 0x93
and confirmed that response matches the desired platform id.

Change-Id: Ie0126e683fe5c53e20d95187bc2291c9b4c2c892
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index b57829c..7cd7895 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -1796,6 +1796,28 @@
     return ipmi::responseSuccess();
 }
 
+ipmi::RspType<uint8_t> ipmiOEMReadBoardProductId()
+{
+    uint8_t prodId = 0;
+    try
+    {
+        const DbusObjectInfo& object = getDbusObject(
+            dbus, "xyz.openbmc_project.Inventory.Item.Board",
+            "/xyz/openbmc_project/inventory/system/board/", "Baseboard");
+        const Value& propValue = getDbusProperty(
+            dbus, object.second, object.first,
+            "xyz.openbmc_project.Inventory.Item.Board", "ProductId");
+        prodId = static_cast<uint8_t>(std::get<uint64_t>(propValue));
+    }
+    catch (std::exception& e)
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "ipmiOEMReadBoardProductId: Product ID read failed!",
+            phosphor::logging::entry("ERR=%s", e.what()));
+    }
+    return ipmi::responseSuccess(prodId);
+}
+
 static void registerOEMFunctions(void)
 {
     phosphor::logging::log<phosphor::logging::level::INFO>(
@@ -1911,6 +1933,12 @@
         static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdGetFscParameter),
         ipmi::Privilege::User, ipmiOEMGetFscParameter);
 
+    ipmi::registerHandler(
+        ipmi::prioOpenBmcBase, netfnIntcOEMGeneral,
+        static_cast<ipmi::Cmd>(
+            IPMINetfnIntelOEMGeneralCmd::cmdReadBaseBoardProductId),
+        ipmi::Privilege::Admin, ipmiOEMReadBoardProductId);
+
     ipmiPrintAndRegister(
         netfnIntcOEMGeneral,
         static_cast<ipmi_cmd_t>(IPMINetfnIntelOEMGeneralCmd::cmdGetLEDStatus),