Browse Source

IpmiFeaturePkg: fix IpmiSendCommand response size in GetDeviceId function

It is required to reinitialize DataSize variable before subsequent
IpmiSendCommand calls. It is especially required after processing
IpmiSendCommand with IPMI_GET_BMC_EXECUTION_CONTEXT because it returns
only 2 bytes as a response. So to the next call of IpmiSendCommand with
IPMI_APP_GET_DEVICE_ID DataSize=2 will be passed. Probably this call will
fail because the expected size of returned data either 12 or 16 bytes
depending on IPMI version supported.

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>
Mike Maslenkin 1 year ago
parent
commit
4811c37ae3

+ 2 - 0
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c

@@ -305,6 +305,7 @@ Returns:
     mIpmiInstance->BmcStatus = BMC_OK;
     return EFI_SUCCESS;
   } else {
+    DataSize = sizeof (TempData);
     Status = IpmiSendCommand (
                &IpmiInstance->IpmiTransport,
                IPMI_NETFN_FIRMWARE, 0,
@@ -326,6 +327,7 @@ Returns:
       while (Retries-- != 0) {
         MicroSecondDelay(1*1000*1000); //delay 1 seconds
         DEBUG ((EFI_D_ERROR, "[IPMI] UpdateMode Retries: %d \n",Retries));
+        DataSize = sizeof (TempData);
         Status = IpmiSendCommand (
                    &IpmiInstance->IpmiTransport,
                    IPMI_NETFN_APP, 0,