]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / FaultTolerantWriteDxe / FaultTolerantWriteSmm.c
index 1e75328f9b9057dbb4896bd13a26a849fafe180d..632313f07640f95b2df0b295fc86ad991b6aee89 100644 (file)
@@ -2,18 +2,18 @@
 \r
   This is a simple fault tolerant write driver that is intended to use in the SMM environment.\r
 \r
-  This boot service protocol only provides fault tolerant write capability for \r
-  block devices.  The protocol has internal non-volatile intermediate storage \r
-  of the data and private information. It should be able to recover \r
-  automatically from a critical fault, such as power failure. \r
+  This boot service protocol only provides fault tolerant write capability for\r
+  block devices.  The protocol has internal non-volatile intermediate storage\r
+  of the data and private information. It should be able to recover\r
+  automatically from a critical fault, such as power failure.\r
 \r
-  The implementation uses an FTW (Fault Tolerant Write) Work Space. \r
+  The implementation uses an FTW (Fault Tolerant Write) Work Space.\r
   This work space is a memory copy of the work space on the Working Block,\r
   the size of the work space is the FTW_WORK_SPACE_SIZE bytes.\r
-  \r
+\r
   The work space stores each write record as EFI_FTW_RECORD structure.\r
   The spare block stores the write buffer before write to the target block.\r
-  \r
+\r
   The write record has three states to specify the different phase of write operation.\r
   1) WRITE_ALLOCATED is that the record is allocated in write space.\r
      The information of write operation is stored in write record structure.\r
   Final copy the data from the spare block to the target block.\r
 \r
   To make this drive work well, the following conditions must be satisfied:\r
-  1. The write NumBytes data must be fit within Spare area. \r
+  1. The write NumBytes data must be fit within Spare area.\r
      Offset + NumBytes <= SpareAreaLength\r
   2. The whole flash range has the same block size.\r
   3. Working block is an area which contains working space in its last block and has the same size as spare block.\r
-  4. Working Block area must be in the single one Firmware Volume Block range which FVB protocol is produced on.  \r
+  4. Working Block area must be in the single one Firmware Volume Block range which FVB protocol is produced on.\r
   5. Spare area must be in the single one Firmware Volume Block range which FVB protocol is produced on.\r
-  6. Any write data area (SpareAreaLength Area) which the data will be written into must be \r
+  6. Any write data area (SpareAreaLength Area) which the data will be written into must be\r
      in the single one Firmware Volume Block range which FVB protocol is produced on.\r
   7. If write data area (such as Variable range) is enlarged, the spare area range must be enlarged.\r
      The spare area must be enough large to store the write data before write them into the target range.\r
   Usually, Spare area only takes one block. That's SpareAreaLength = BlockSize, NumberOfSpareBlock = 1.\r
 \r
   Caution: This module requires additional review when modified.\r
-  This driver need to make sure the CommBuffer is not in the SMRAM range. \r
+  This driver need to make sure the CommBuffer is not in the SMRAM range.\r
+\r
+Copyright (c) 2010 - 2018, 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
+http://opensource.org/licenses/bsd-license.php\r
 \r
-Copyright (c) 2010 - 2015, 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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.  \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -119,8 +119,8 @@ FtwGetSarProtocol (
   // Locate Smm Swap Address Range protocol\r
   //\r
   Status = gSmst->SmmLocateProtocol (\r
-                    &gEfiSmmSwapAddressRangeProtocolGuid, \r
-                    NULL, \r
+                    &gEfiSmmSwapAddressRangeProtocolGuid,\r
+                    NULL,\r
                     SarProtocol\r
                     );\r
   return Status;\r
@@ -128,7 +128,7 @@ FtwGetSarProtocol (
 \r
 /**\r
   Function returns an array of handles that support the SMM FVB protocol\r
-  in a buffer allocated from pool. \r
+  in a buffer allocated from pool.\r
 \r
   @param[out]  NumberHandles    The number of handles returned in Buffer.\r
   @param[out]  Buffer           A pointer to the buffer to return the requested\r
@@ -227,7 +227,7 @@ GetFvbByAddressAndAttribute (
   if (EFI_ERROR (Status)) {\r
     return EFI_ABORTED;\r
   }\r
-  \r
+\r
   //\r
   // Find the proper SMM Fvb handle by the address and attributes.\r
   //\r
@@ -276,8 +276,8 @@ GetFvbByAddressAndAttribute (
   This SMI handler provides services for the fault tolerant write wrapper driver.\r
 \r
   Caution: This function requires additional review when modified.\r
-  This driver need to make sure the CommBuffer is not in the SMRAM range. \r
-  Also in FTW_FUNCTION_GET_LAST_WRITE case, check SmmFtwGetLastWriteHeader->Data + \r
+  This driver need to make sure the CommBuffer is not in the SMRAM range.\r
+  Also in FTW_FUNCTION_GET_LAST_WRITE case, check SmmFtwGetLastWriteHeader->Data +\r
   SmmFtwGetLastWriteHeader->PrivateDataSize within communication buffer.\r
 \r
   @param[in]     DispatchHandle  The unique handle assigned to this handler by SmiHandlerRegister().\r
@@ -287,14 +287,14 @@ GetFvbByAddressAndAttribute (
                                  from a non-SMM environment into an SMM environment.\r
   @param[in, out] CommBufferSize The size of the CommBuffer.\r
 \r
-  @retval EFI_SUCCESS                         The interrupt was handled and quiesced. No other handlers \r
+  @retval EFI_SUCCESS                         The interrupt was handled and quiesced. No other handlers\r
                                               should still be called.\r
-  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED  The interrupt has been quiesced but other handlers should \r
+  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED  The interrupt has been quiesced but other handlers should\r
                                               still be called.\r
-  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING   The interrupt is still pending and other handlers should still \r
+  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING   The interrupt is still pending and other handlers should still\r
                                               be called.\r
   @retval EFI_INTERRUPT_PENDING               The interrupt could not be quiesced.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -364,7 +364,7 @@ SmmFaultTolerantWriteHandler (
                  &SmmGetMaxBlockSizeHeader->BlockSize\r
                  );\r
       break;\r
-      \r
+\r
     case FTW_FUNCTION_ALLOCATE:\r
       if (CommBufferPayloadSize < sizeof (SMM_FTW_ALLOCATE_HEADER)) {\r
         DEBUG ((EFI_D_ERROR, "Allocate: SMM communication buffer size invalid!\n"));\r
@@ -378,7 +378,7 @@ SmmFaultTolerantWriteHandler (
                  SmmFtwAllocateHeader->NumberOfWrites\r
                  );\r
       break;\r
-      \r
+\r
     case FTW_FUNCTION_WRITE:\r
       if (CommBufferPayloadSize < OFFSET_OF (SMM_FTW_WRITE_HEADER, Data)) {\r
         DEBUG ((EFI_D_ERROR, "Write: SMM communication buffer size invalid!\n"));\r
@@ -412,7 +412,7 @@ SmmFaultTolerantWriteHandler (
         PrivateData = (VOID *)&SmmFtwWriteHeader->Data[Length];\r
       }\r
       Status = GetFvbByAddressAndAttribute (\r
-                 SmmFtwWriteHeader->FvbBaseAddress, \r
+                 SmmFtwWriteHeader->FvbBaseAddress,\r
                  SmmFtwWriteHeader->FvbAttributes,\r
                  &SmmFvbHandle\r
                  );\r
@@ -428,7 +428,7 @@ SmmFaultTolerantWriteHandler (
                    );\r
       }\r
       break;\r
-      \r
+\r
     case FTW_FUNCTION_RESTART:\r
       if (CommBufferPayloadSize < sizeof (SMM_FTW_RESTART_HEADER)) {\r
         DEBUG ((EFI_D_ERROR, "Restart: SMM communication buffer size invalid!\n"));\r
@@ -436,10 +436,10 @@ SmmFaultTolerantWriteHandler (
       }\r
       SmmFtwRestartHeader = (SMM_FTW_RESTART_HEADER *) SmmFtwFunctionHeader->Data;\r
       Status = GetFvbByAddressAndAttribute (\r
-                 SmmFtwRestartHeader->FvbBaseAddress, \r
+                 SmmFtwRestartHeader->FvbBaseAddress,\r
                  SmmFtwRestartHeader->FvbAttributes,\r
                  &SmmFvbHandle\r
-                 );      \r
+                 );\r
       if (!EFI_ERROR (Status)) {\r
         Status = FtwRestart (&mFtwDevice->FtwInstance, SmmFvbHandle);\r
       }\r
@@ -448,7 +448,7 @@ SmmFaultTolerantWriteHandler (
     case FTW_FUNCTION_ABORT:\r
       Status = FtwAbort (&mFtwDevice->FtwInstance);\r
       break;\r
-      \r
+\r
     case FTW_FUNCTION_GET_LAST_WRITE:\r
       if (CommBufferPayloadSize < OFFSET_OF (SMM_FTW_GET_LAST_WRITE_HEADER, Data)) {\r
         DEBUG ((EFI_D_ERROR, "GetLastWrite: SMM communication buffer size invalid!\n"));\r
@@ -499,13 +499,13 @@ SmmFaultTolerantWriteHandler (
 \r
 /**\r
   SMM Firmware Volume Block Protocol notification event handler.\r
-  \r
+\r
   @param[in]  Protocol      Points to the protocol's unique identifier\r
   @param[in]  Interface     Points to the interface instance\r
   @param[in]  Handle        The handle on which the interface was installed\r
 \r
   @retval EFI_SUCCESS       SmmEventCallback runs successfully\r
-  \r
+\r
  **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -519,14 +519,14 @@ FvbNotificationEvent (
   EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL   *FtwProtocol;\r
   EFI_HANDLE                              SmmFtwHandle;\r
   EFI_HANDLE                              FtwHandle;\r
-  \r
+\r
   //\r
   // Just return to avoid install SMM FaultTolerantWriteProtocol again\r
   // if SMM Fault Tolerant Write protocol had been installed.\r
-  //  \r
+  //\r
   Status = gSmst->SmmLocateProtocol (\r
-                    &gEfiSmmFaultTolerantWriteProtocolGuid, \r
-                    NULL, \r
+                    &gEfiSmmFaultTolerantWriteProtocolGuid,\r
+                    NULL,\r
                     (VOID **) &FtwProtocol\r
                     );\r
   if (!EFI_ERROR (Status)) {\r
@@ -550,7 +550,7 @@ FvbNotificationEvent (
                     EFI_NATIVE_INTERFACE,\r
                     &mFtwDevice->FtwInstance\r
                     );\r
-  ASSERT_EFI_ERROR (Status); \r
+  ASSERT_EFI_ERROR (Status);\r
 \r
   ///\r
   /// Register SMM FTW SMI handler\r
@@ -569,13 +569,13 @@ FvbNotificationEvent (
                   NULL\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
   SMM END_OF_DXE protocol notification event handler.\r
\r
+\r
   @param  Protocol   Points to the protocol's unique identifier\r
   @param  Interface  Points to the interface instance\r
   @param  Handle     The handle on which the interface was installed\r
@@ -636,7 +636,7 @@ SmmFaultTolerantWriteInitialize (
 \r
   //\r
   // Register FvbNotificationEvent () notify function.\r
-  // \r
+  //\r
   Status = gSmst->SmmRegisterProtocolNotify (\r
                     &gEfiSmmFirmwareVolumeBlockProtocolGuid,\r
                     FvbNotificationEvent,\r
@@ -645,6 +645,6 @@ SmmFaultTolerantWriteInitialize (
   ASSERT_EFI_ERROR (Status);\r
 \r
   FvbNotificationEvent (NULL, NULL, NULL);\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r