]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / S3SaveStateDxe / S3SaveState.c
index d73005156cc6e172a1e6ff35c892d4218bb1759f..274f3be12c753f59481980bc76def082990b8e9d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for S3 Boot Script Saver state driver.\r
 \r
-  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
@@ -46,7 +46,7 @@ BootScriptWriteIoWrite (
   Address     = VA_ARG (Marker, UINT64);\r
   Count       = VA_ARG (Marker, UINTN);\r
   Buffer      = VA_ARG (Marker, UINT8 *);\r
-  \r
+\r
   return S3BootScriptSaveIoWrite (Width, Address, Count, Buffer);\r
 }\r
 /**\r
@@ -68,12 +68,12 @@ BootScriptWriteIoReadWrite (
   UINT64                Address;\r
   UINT8                 *Data;\r
   UINT8                 *DataMask;\r
\r
+\r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
   Address     = VA_ARG (Marker, UINT64);\r
   Data        = VA_ARG (Marker, UINT8 *);\r
   DataMask    = VA_ARG (Marker, UINT8 *);\r
-  \r
+\r
   return S3BootScriptSaveIoReadWrite (Width, Address, Data, DataMask);\r
 }\r
 \r
@@ -96,7 +96,7 @@ BootScriptWriteMemWrite (
   UINT64                Address;\r
   UINTN                 Count;\r
   UINT8                 *Buffer;\r
\r
+\r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
   Address     = VA_ARG (Marker, UINT64);\r
   Count       = VA_ARG (Marker, UINTN);\r
@@ -124,7 +124,7 @@ BootScriptWriteMemReadWrite (
   UINT64                Address;\r
   UINT8                 *Data;\r
   UINT8                 *DataMask;\r
-  \r
+\r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
   Address     = VA_ARG (Marker, UINT64);\r
   Data        = VA_ARG (Marker, UINT8 *);\r
@@ -238,13 +238,13 @@ BootScriptWritePciCfg2ReadWrite (
   UINT64                Address;\r
   UINT8                 *Data;\r
   UINT8                 *DataMask;\r
\r
+\r
   Width       = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
   Segment     = VA_ARG (Marker, UINT16);\r
   Address     = VA_ARG (Marker, UINT64);\r
   Data        = VA_ARG (Marker, UINT8 *);\r
   DataMask    = VA_ARG (Marker, UINT8 *);\r
\r
+\r
   return S3BootScriptSavePciCfg2ReadWrite (Width, Segment, Address, Data, DataMask);\r
 }\r
 /**\r
@@ -269,15 +269,15 @@ BootScriptWriteSmbusExecute (
   VOID                     *Buffer;\r
   UINTN                    *DataSize;\r
   UINTN                     SmBusAddress;\r
-  \r
+\r
   SlaveAddress.SmbusDeviceAddress = VA_ARG (Marker, UINTN);\r
   Command                         = VA_ARG (Marker, EFI_SMBUS_DEVICE_COMMAND);\r
   Operation                       = VA_ARG (Marker, EFI_SMBUS_OPERATION);\r
   PecCheck                        = VA_ARG (Marker, BOOLEAN);\r
   SmBusAddress                    = SMBUS_LIB_ADDRESS (SlaveAddress.SmbusDeviceAddress,Command,0,PecCheck);\r
-  DataSize                        = VA_ARG (Marker, UINTN *);    \r
+  DataSize                        = VA_ARG (Marker, UINTN *);\r
   Buffer                          = VA_ARG (Marker, VOID *);\r
\r
+\r
   return S3BootScriptSaveSmbusExecute (SmBusAddress, Operation, DataSize, Buffer);\r
 }\r
 /**\r
@@ -303,7 +303,7 @@ BootScriptWriteStall (
 }\r
 \r
 /**\r
-  Internal function to add Save jmp address according to DISPATCH_OPCODE. \r
+  Internal function to add Save jmp address according to DISPATCH_OPCODE.\r
   We ignore "Context" parameter\r
 \r
   @param  Marker                The variable argument list to get the opcode\r
@@ -325,8 +325,8 @@ BootScriptWriteDispatch (
 }\r
 \r
 /**\r
-  Internal function to add memory pool operation to the table. \r
\r
+  Internal function to add memory pool operation to the table.\r
+\r
   @param  Marker                The variable argument list to get the opcode\r
                                 and associated attributes.\r
 \r
@@ -339,18 +339,18 @@ BootScriptWriteMemPoll (
   IN VA_LIST                       Marker\r
   )\r
 {\r
-  S3_BOOT_SCRIPT_LIB_WIDTH   Width;                                    \r
-  UINT64                     Address;                                    \r
-  VOID                      *Data;                                    \r
-  VOID                      *DataMask;                                  \r
+  S3_BOOT_SCRIPT_LIB_WIDTH   Width;\r
+  UINT64                     Address;\r
+  VOID                      *Data;\r
+  VOID                      *DataMask;\r
   UINT64                    Delay;\r
   UINT64                    LoopTimes;\r
   UINT32                    Remainder;\r
 \r
-  Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);                  \r
-  Address  = VA_ARG (Marker, UINT64);                                    \r
-  Data     = VA_ARG (Marker, VOID *);                                    \r
-  DataMask = VA_ARG (Marker, VOID *);                                    \r
+  Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+  Address  = VA_ARG (Marker, UINT64);\r
+  Data     = VA_ARG (Marker, VOID *);\r
+  DataMask = VA_ARG (Marker, VOID *);\r
   Delay    = VA_ARG (Marker, UINT64);\r
   //\r
   // According to the spec, the interval between 2 polls is 100ns,\r
@@ -375,7 +375,7 @@ BootScriptWriteMemPoll (
 }\r
 \r
 /**\r
-  Internal function to add Save jmp address according to DISPATCH_OPCODE2. \r
+  Internal function to add Save jmp address according to DISPATCH_OPCODE2.\r
   The "Context" parameter is not ignored.\r
 \r
   @param  Marker                The variable argument list to get the opcode\r
@@ -391,7 +391,7 @@ BootScriptWriteDispatch2 (
   )\r
 {\r
   VOID                  *EntryPoint;\r
-  VOID                  *Context;  \r
+  VOID                  *Context;\r
 \r
   EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
   Context    = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
@@ -414,7 +414,7 @@ BootScriptWriteInformation (
   )\r
 {\r
   UINT32                InformationLength;\r
-  EFI_PHYSICAL_ADDRESS  Information;  \r
+  EFI_PHYSICAL_ADDRESS  Information;\r
 \r
   InformationLength = VA_ARG (Marker, UINT32);\r
   Information = VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);\r
@@ -435,17 +435,17 @@ BootScriptWriteIoPoll (
   )\r
 {\r
    S3_BOOT_SCRIPT_LIB_WIDTH     Width;\r
-   UINT64                     Address;    \r
-   VOID                      *Data;    \r
-   VOID                      *DataMask;   \r
-   UINT64                     Delay;   \r
-   \r
-   Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);  \r
-   Address  = VA_ARG (Marker, UINT64);                    \r
-   Data     = VA_ARG (Marker, VOID *);                   \r
-   DataMask = VA_ARG (Marker, VOID *);                   \r
-   Delay    = (UINT64)VA_ARG (Marker, UINT64);             \r
-   \r
+   UINT64                     Address;\r
+   VOID                      *Data;\r
+   VOID                      *DataMask;\r
+   UINT64                     Delay;\r
+\r
+   Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+   Address  = VA_ARG (Marker, UINT64);\r
+   Data     = VA_ARG (Marker, VOID *);\r
+   DataMask = VA_ARG (Marker, VOID *);\r
+   Delay    = (UINT64)VA_ARG (Marker, UINT64);\r
+\r
    return S3BootScriptSaveIoPoll (Width, Address, Data, DataMask, Delay);\r
 }\r
 /**\r
@@ -469,13 +469,13 @@ BootScriptWritePciConfigPoll (
    VOID                      *DataMask;\r
    UINT64                     Delay;\r
 \r
-   \r
-   Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);  \r
-   Address  = VA_ARG (Marker, UINT64);                    \r
-   Data     = VA_ARG (Marker, VOID *);                   \r
-   DataMask = VA_ARG (Marker, VOID *);                   \r
-   Delay    = (UINT64)VA_ARG (Marker, UINT64);             \r
-   \r
+\r
+   Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+   Address  = VA_ARG (Marker, UINT64);\r
+   Data     = VA_ARG (Marker, VOID *);\r
+   DataMask = VA_ARG (Marker, VOID *);\r
+   Delay    = (UINT64)VA_ARG (Marker, UINT64);\r
+\r
    return S3BootScriptSavePciPoll (Width, Address, Data, DataMask, Delay);\r
 }\r
 /**\r
@@ -499,14 +499,14 @@ BootScriptWritePciConfig2Poll (
    VOID                         *Data;\r
    VOID                         *DataMask;\r
    UINT64                        Delay;\r
-  \r
-   Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);  \r
-   Segment  = VA_ARG (Marker, UINT16);      \r
-   Address  = VA_ARG (Marker, UINT64);                    \r
-   Data     = VA_ARG (Marker, VOID *);                   \r
-   DataMask = VA_ARG (Marker, VOID *);                   \r
-   Delay    = (UINT64)VA_ARG (Marker, UINT64);             \r
-   \r
+\r
+   Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);\r
+   Segment  = VA_ARG (Marker, UINT16);\r
+   Address  = VA_ARG (Marker, UINT64);\r
+   Data     = VA_ARG (Marker, VOID *);\r
+   DataMask = VA_ARG (Marker, VOID *);\r
+   Delay    = (UINT64)VA_ARG (Marker, UINT64);\r
+\r
    return S3BootScriptSavePci2Poll (Width, Segment, Address, Data, DataMask, Delay);\r
 }\r
 \r
@@ -515,25 +515,25 @@ BootScriptWritePciConfig2Poll (
   Adds a record into S3 boot script table.\r
 \r
   This function is used to store a boot script record into a given boot\r
-  script table. If the table specified by TableName is nonexistent in the \r
-  system, a new table will automatically be created and then the script record \r
-  will be added into the new table. This function is responsible for allocating \r
+  script table. If the table specified by TableName is nonexistent in the\r
+  system, a new table will automatically be created and then the script record\r
+  will be added into the new table. This function is responsible for allocating\r
   necessary memory for the script.\r
 \r
-  This function has a variable parameter list. The exact parameter list depends on \r
-  the OpCode that is passed into the function. If an unsupported OpCode or illegal \r
+  This function has a variable parameter list. The exact parameter list depends on\r
+  the OpCode that is passed into the function. If an unsupported OpCode or illegal\r
   parameter list is passed in, this function returns EFI_INVALID_PARAMETER.\r
   If there are not enough resources available for storing more scripts, this function returns\r
   EFI_OUT_OF_RESOURCES.\r
 \r
   @param  This                  A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
   @param  OpCode                The operation code (opcode) number.\r
-  @param  ...                   Argument list that is specific to each opcode. \r
-                                \r
+  @param  ...                   Argument list that is specific to each opcode.\r
+\r
   @retval EFI_SUCCESS           The operation succeeded. A record was added into the\r
                                 specified script table.\r
   @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
-                                If the opcode is unknow or not supported because of the PCD \r
+                                If the opcode is unknow or not supported because of the PCD\r
                                 Feature Flags.\r
   @retval EFI_OUT_OF_RESOURCES  There is insufficient memory to store the boot script.\r
 \r
@@ -547,7 +547,7 @@ BootScriptWrite (
   )\r
 {\r
   EFI_STATUS                Status;\r
-  VA_LIST                   Marker;  \r
+  VA_LIST                   Marker;\r
   //\r
   // Build script according to opcode\r
   //\r
@@ -568,7 +568,7 @@ BootScriptWrite (
   case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:\r
     VA_START (Marker, OpCode);\r
     Status = BootScriptWriteMemWrite (Marker);\r
-    VA_END (Marker); \r
+    VA_END (Marker);\r
     break;\r
 \r
   case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
@@ -599,7 +599,7 @@ BootScriptWrite (
     VA_START (Marker, OpCode);\r
     Status = BootScriptWriteStall (Marker);\r
     VA_END (Marker);\r
-  \r
+\r
     break;\r
 \r
   case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:\r
@@ -638,23 +638,23 @@ BootScriptWrite (
     VA_END (Marker);\r
     break;\r
 \r
-  case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:  \r
+  case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
     VA_START (Marker, OpCode);\r
     Status = BootScriptWriteIoPoll (Marker);\r
     VA_END (Marker);\r
-    break;    \r
-  \r
-  case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE: \r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
     VA_START (Marker, OpCode);\r
     Status = BootScriptWritePciConfigPoll (Marker);\r
     VA_END (Marker);\r
-    break;    \r
-  \r
+    break;\r
+\r
   case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
     VA_START (Marker, OpCode);\r
     Status = BootScriptWritePciConfig2Poll (Marker);\r
     VA_END (Marker);\r
-    break;    \r
+    break;\r
 \r
   default:\r
     Status = EFI_INVALID_PARAMETER;\r
@@ -683,7 +683,7 @@ BootScriptWrite (
                                 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r
                                 the position of the inserted opcode in the boot script table.\r
   @param  OpCode                The operation code (opcode) number.\r
-  @param  ...                   Argument list that is specific to each opcode. \r
+  @param  ...                   Argument list that is specific to each opcode.\r
 \r
   @retval EFI_SUCCESS           The operation succeeded. A record was added into the\r
                                 specified script table.\r
@@ -702,7 +702,7 @@ BootScriptInsert (
   )\r
 {\r
   EFI_STATUS                Status;\r
-  VA_LIST                   Marker;  \r
+  VA_LIST                   Marker;\r
   //\r
   // Build script according to opcode\r
   //\r
@@ -723,7 +723,7 @@ BootScriptInsert (
   case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:\r
     VA_START (Marker, OpCode);\r
     Status = BootScriptWriteMemWrite (Marker);\r
-    VA_END (Marker); \r
+    VA_END (Marker);\r
     break;\r
 \r
   case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
@@ -754,7 +754,7 @@ BootScriptInsert (
     VA_START (Marker, OpCode);\r
     Status = BootScriptWriteStall (Marker);\r
     VA_END (Marker);\r
-  \r
+\r
     break;\r
 \r
   case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:\r
@@ -792,30 +792,30 @@ BootScriptInsert (
     Status = BootScriptWritePciCfg2ReadWrite (Marker);\r
     VA_END (Marker);\r
     break;\r
-    \r
-  case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:  \r
+\r
+  case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
     VA_START (Marker, OpCode);\r
     Status = BootScriptWriteIoPoll (Marker);\r
     VA_END (Marker);\r
-    break;    \r
-  \r
-  case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE: \r
+    break;\r
+\r
+  case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
     VA_START (Marker, OpCode);\r
     Status = BootScriptWritePciConfigPoll (Marker);\r
     VA_END (Marker);\r
-    break;    \r
-  \r
+    break;\r
+\r
   case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
     VA_START (Marker, OpCode);\r
     Status = BootScriptWritePciConfig2Poll (Marker);\r
     VA_END (Marker);\r
-    break;    \r
+    break;\r
 \r
   default:\r
     Status = EFI_INVALID_PARAMETER;\r
     break;\r
   }\r
-  \r
+\r
   if (!EFI_ERROR (Status)) {\r
    Status = S3BootScriptMoveLastOpcode (BeforeOrAfter, Position);\r
   }\r
@@ -846,7 +846,7 @@ BootScriptInsert (
   @retval EFI_SUCCESS           The label already exists or was inserted.\r
   @retval EFI_INVALID_PARAMETER The Label is NULL or points to an empty string.\r
   @retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -858,27 +858,27 @@ BootScriptLabel (
   IN CONST CHAR8                                *Label\r
   )\r
 {\r
-       return S3BootScriptLabel (BeforeOrAfter, CreateIfNotFound, Position, Label);\r
+  return S3BootScriptLabel (BeforeOrAfter, CreateIfNotFound, Position, Label);\r
 }\r
 /**\r
   Compare two positions in the boot script table and return their relative position.\r
-  \r
+\r
   This function compares two positions in the boot script table and returns their relative positions. If\r
   Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r
   then 0 is returned. If Position1 is after Position2, then 1 is returned.\r
-  \r
+\r
   @param  This                  A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
   @param  Position1             The positions in the boot script table to compare\r
   @param  Position2             The positions in the boot script table to compare\r
   @param  RelativePosition      On return, points to the result of the comparison\r
 \r
-  @retval EFI_SUCCESS           The operation succeeded. \r
+  @retval EFI_SUCCESS           The operation succeeded.\r
   @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.\r
   @retval EFI_INVALID_PARAMETER The RelativePosition is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
 BootScriptCompare (\r
   IN CONST EFI_S3_SAVE_STATE_PROTOCOL      *This,\r
   IN       EFI_S3_BOOT_SCRIPT_POSITION      Position1,\r
@@ -886,7 +886,7 @@ BootScriptCompare (
   OUT      UINTN                           *RelativePosition\r
   )\r
 {\r
-       return S3BootScriptCompare (Position1, Position2, RelativePosition);\r
+  return S3BootScriptCompare (Position1, Position2, RelativePosition);\r
 }\r
 /**\r
   This routine is entry point of ScriptSave driver.\r