]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.c
MdeModulePkg/UdfDxe: suppress incorrect compiler warning in ReadFile()
[mirror_edk2.git] / MdeModulePkg / Universal / FaultTolerantWriteDxe / FaultTolerantWriteSmmDxe.c
index 89c7d337bf578e0cd85ea5aba2efe90c645fce90..772d10dcd46cb18e6965c1743bf39156a62f72ca 100644 (file)
@@ -3,7 +3,7 @@
   Implement the Fault Tolerant Write (FTW) protocol based on SMM FTW \r
   module.\r
 \r
-Copyright (c) 2011, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved. <BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -74,13 +74,13 @@ InitCommunicateBuffer (
 /**\r
   Send the data in communicate buffer to SMI handler and get response.\r
 \r
-  @param[out]      SmmCommunicateHeader    The communicate buffer.\r
+  @param[in, out]  SmmCommunicateHeader    The communicate buffer.\r
   @param[in]       DataSize                The payload size.\r
                       \r
 **/\r
 EFI_STATUS\r
 SendCommunicateBuffer (\r
-  IN      EFI_SMM_COMMUNICATE_HEADER        *SmmCommunicateHeader,\r
+  IN OUT  EFI_SMM_COMMUNICATE_HEADER        *SmmCommunicateHeader,\r
   IN      UINTN                             DataSize\r
   )\r
 {\r
@@ -100,9 +100,9 @@ SendCommunicateBuffer (
 /**\r
   Get the FvbBaseAddress and FvbAttributes from the FVB handle FvbHandle.\r
 \r
-  @param[in]   FvBlockHandle     The handle of FVB protocol that provides services.\r
-  @param[in]   FvbBaseAddress    The base address of the FVB attached with FvBlockHandle.\r
-  @param[out]  FvbAttributes     The attributes of the FVB attached with FvBlockHandle.\r
+  @param[in]   FvbHandle         The handle of FVB protocol that provides services.\r
+  @param[out]  FvbBaseAddress    The base address of the FVB attached with FvbHandle.\r
+  @param[out]  FvbAttributes     The attributes of the FVB attached with FvbHandle.\r
     \r
   @retval EFI_SUCCESS            The function completed successfully.\r
   @retval Others                 The function could not complete successfully.\r
@@ -463,13 +463,17 @@ FtwGetLastWrite (
   // Get data from SMM\r
   //\r
   *PrivateDataSize = SmmFtwGetLastWriteHeader->PrivateDataSize;\r
-  if (!EFI_ERROR (Status)) {\r
+  if (Status == EFI_SUCCESS || Status == EFI_BUFFER_TOO_SMALL) {\r
     *Lba      = SmmFtwGetLastWriteHeader->Lba;\r
     *Offset   = SmmFtwGetLastWriteHeader->Offset; \r
     *Length   = SmmFtwGetLastWriteHeader->Length;\r
     *Complete = SmmFtwGetLastWriteHeader->Complete;\r
     CopyGuid (CallerId, &SmmFtwGetLastWriteHeader->CallerId);\r
-    CopyMem (PrivateData, SmmFtwGetLastWriteHeader->Data, *PrivateDataSize);\r
+    if (Status == EFI_SUCCESS) {\r
+      CopyMem (PrivateData, SmmFtwGetLastWriteHeader->Data, *PrivateDataSize);\r
+    }\r
+  } else if (Status == EFI_NOT_FOUND) {\r
+    *Complete = SmmFtwGetLastWriteHeader->Complete;\r
   }\r
 \r
   FreePool (SmmCommunicateHeader);  \r