Fix get fan config command

It was returning an extra byte. Update it to new
api as well.

Tested:

root@intel-obmc:~#  ipmitool raw 0x30 0x8a 0x0
 00 00 04 00 00 00 00

Now returns 7 bytes

Change-Id: I90df4938eda70d7c62c1130b01c1482e32a29ad2
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/oemcommands.hpp b/include/oemcommands.hpp
index b0aea02..b30d5c9 100644
--- a/include/oemcommands.hpp
+++ b/include/oemcommands.hpp
@@ -301,16 +301,6 @@
     uint8_t flags;
     // other parameters from previous generation are not supported
 };
-
-struct GetFanConfigResp
-{
-    uint8_t supportMask;
-    uint8_t profileSupport;
-    uint8_t fanControlProfileEnable;
-    uint8_t flags;
-    uint8_t dimmPresenceMap[4];
-};
-
 struct CfgHostSerialReq
 {
     uint8_t command;
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 6118b36..8a7b443 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -1223,24 +1223,13 @@
     return IPMI_CC_OK;
 }
 
-ipmi_ret_t ipmiOEMGetFanConfig(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                               ipmi_request_t request, ipmi_response_t response,
-                               ipmi_data_len_t dataLen, ipmi_context_t context)
+ipmi::RspType<uint8_t, // profile support map
+              uint8_t, // fan control profile enable
+              uint8_t, // flags
+              uint32_t // dimm presence bit map
+              >
+    ipmiOEMGetFanConfig(uint8_t dimmGroupId)
 {
-
-    if (*dataLen > 1)
-    {
-        phosphor::logging::log<phosphor::logging::level::ERR>(
-            "ipmiOEMGetFanConfig: invalid input len!");
-        *dataLen = 0;
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
-    }
-
-    // todo: talk to bios about needing less information
-
-    GetFanConfigResp* resp = reinterpret_cast<GetFanConfigResp*>(response);
-    *dataLen = sizeof(GetFanConfigResp);
-
     boost::container::flat_map<
         std::string, std::variant<std::vector<std::string>, std::string>>
         profileData;
@@ -1248,7 +1237,7 @@
     std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
     if (!getFanProfileInterface(*dbus, profileData))
     {
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseResponseError();
     }
 
     std::string* current = std::get_if<std::string>(&profileData["Current"]);
@@ -1257,18 +1246,18 @@
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
             "ipmiOEMGetFanConfig: can't get current mode!");
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseResponseError();
     }
     bool performance = (*current == "Performance");
 
+    uint8_t flags = 0;
     if (performance)
     {
-        resp->flags |= 1 << 2;
+        flags |= 1 << 2;
     }
 
-    return IPMI_CC_OK;
+    return ipmi::responseSuccess(0, 0, flags, 0);
 }
-
 constexpr const char* cfmLimitSettingPath =
     "/xyz/openbmc_project/control/cfm_limit";
 constexpr const char* cfmLimitIface = "xyz.openbmc_project.Control.CFMLimit";
@@ -2170,10 +2159,10 @@
         static_cast<ipmi_cmd_t>(IPMINetfnIntelOEMGeneralCmd::cmdSetFanConfig),
         NULL, ipmiOEMSetFanConfig, PRIVILEGE_USER);
 
-    ipmiPrintAndRegister(
-        netfnIntcOEMGeneral,
-        static_cast<ipmi_cmd_t>(IPMINetfnIntelOEMGeneralCmd::cmdGetFanConfig),
-        NULL, ipmiOEMGetFanConfig, PRIVILEGE_USER);
+    ipmi::registerHandler(
+        ipmi::prioOemBase, netfnIntcOEMGeneral,
+        static_cast<ipmi::Cmd>(IPMINetfnIntelOEMGeneralCmd::cmdGetFanConfig),
+        ipmi::Privilege::User, ipmiOEMGetFanConfig);
 
     ipmi::registerHandler(
         ipmi::prioOemBase, netfnIntcOEMGeneral,