]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Library / PiDxeS3BootScriptLib / BootScriptExecute.c
index f7fb787cd51fef97d54255ae2d8ff58c6357f634..279daefac16c5b670809bb251e9e59a060d0411a 100644 (file)
 **/\r
 EFI_STATUS\r
 InternalSmbusExecute (\r
-  IN     UINTN                    SmbusAddress,\r
-  IN     EFI_SMBUS_OPERATION      Operation,\r
-  IN OUT UINTN                    *Length,\r
-  IN OUT VOID                     *Buffer\r
+  IN     UINTN                SmbusAddress,\r
+  IN     EFI_SMBUS_OPERATION  Operation,\r
+  IN OUT UINTN                *Length,\r
+  IN OUT VOID                 *Buffer\r
   )\r
 {\r
-  EFI_STATUS                      Status;\r
-  UINT8                           WorkBuffer[MAX_SMBUS_BLOCK_LEN];\r
+  EFI_STATUS  Status;\r
+  UINT8       WorkBuffer[MAX_SMBUS_BLOCK_LEN];\r
 \r
   switch (Operation) {\r
     case EfiSmbusQuickRead:\r
@@ -74,28 +74,28 @@ InternalSmbusExecute (
       SmBusReceiveByte (SmbusAddress, &Status);\r
       break;\r
     case EfiSmbusSendByte:\r
-      DEBUG ((DEBUG_INFO, "EfiSmbusSendByte - 0x%08x (0x%02x)\n", SmbusAddress, (UINTN)*(UINT8 *) Buffer));\r
-      SmBusSendByte (SmbusAddress, *(UINT8 *) Buffer, &Status);\r
+      DEBUG ((DEBUG_INFO, "EfiSmbusSendByte - 0x%08x (0x%02x)\n", SmbusAddress, (UINTN)*(UINT8 *)Buffer));\r
+      SmBusSendByte (SmbusAddress, *(UINT8 *)Buffer, &Status);\r
       break;\r
     case EfiSmbusReadByte:\r
       DEBUG ((DEBUG_INFO, "EfiSmbusReadByte - 0x%08x\n", SmbusAddress));\r
       SmBusReadDataByte (SmbusAddress, &Status);\r
       break;\r
     case EfiSmbusWriteByte:\r
-      DEBUG ((DEBUG_INFO, "EfiSmbusWriteByte - 0x%08x (0x%02x)\n", SmbusAddress, (UINTN)*(UINT8 *) Buffer));\r
-      SmBusWriteDataByte (SmbusAddress, *(UINT8 *) Buffer, &Status);\r
+      DEBUG ((DEBUG_INFO, "EfiSmbusWriteByte - 0x%08x (0x%02x)\n", SmbusAddress, (UINTN)*(UINT8 *)Buffer));\r
+      SmBusWriteDataByte (SmbusAddress, *(UINT8 *)Buffer, &Status);\r
       break;\r
     case EfiSmbusReadWord:\r
       DEBUG ((DEBUG_INFO, "EfiSmbusReadWord - 0x%08x\n", SmbusAddress));\r
       SmBusReadDataWord (SmbusAddress, &Status);\r
       break;\r
     case EfiSmbusWriteWord:\r
-      DEBUG ((DEBUG_INFO, "EfiSmbusWriteWord - 0x%08x (0x%04x)\n", SmbusAddress, (UINTN)*(UINT16 *) Buffer));\r
-      SmBusWriteDataWord (SmbusAddress, *(UINT16 *) Buffer, &Status);\r
+      DEBUG ((DEBUG_INFO, "EfiSmbusWriteWord - 0x%08x (0x%04x)\n", SmbusAddress, (UINTN)*(UINT16 *)Buffer));\r
+      SmBusWriteDataWord (SmbusAddress, *(UINT16 *)Buffer, &Status);\r
       break;\r
     case EfiSmbusProcessCall:\r
-      DEBUG ((DEBUG_INFO, "EfiSmbusProcessCall - 0x%08x (0x%04x)\n", SmbusAddress, (UINTN)*(UINT16 *) Buffer));\r
-      SmBusProcessCall (SmbusAddress, *(UINT16 *) Buffer, &Status);\r
+      DEBUG ((DEBUG_INFO, "EfiSmbusProcessCall - 0x%08x (0x%04x)\n", SmbusAddress, (UINTN)*(UINT16 *)Buffer));\r
+      SmBusProcessCall (SmbusAddress, *(UINT16 *)Buffer, &Status);\r
       break;\r
     case EfiSmbusReadBlock:\r
       DEBUG ((DEBUG_INFO, "EfiSmbusReadBlock - 0x%08x\n", SmbusAddress));\r
@@ -130,31 +130,31 @@ InternalSmbusExecute (
 **/\r
 EFI_STATUS\r
 BuildLoopData (\r
-  IN  S3_BOOT_SCRIPT_LIB_WIDTH      Width,\r
+  IN  S3_BOOT_SCRIPT_LIB_WIDTH  Width,\r
   IN  UINT64                    Address,\r
   OUT UINTN                     *AddressStride,\r
   OUT UINTN                     *BufferStride\r
   )\r
 {\r
-  UINTN AlignMask;\r
+  UINTN  AlignMask;\r
 \r
   if (Width >= S3BootScriptWidthMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  *AddressStride  = (UINT32)(1 << (Width & 0x03));\r
-  *BufferStride   = *AddressStride;\r
+  *AddressStride = (UINT32)(1 << (Width & 0x03));\r
+  *BufferStride  = *AddressStride;\r
 \r
-  AlignMask       = *AddressStride - 1;\r
+  AlignMask = *AddressStride - 1;\r
   if ((Address & AlignMask) != 0) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (Width >= S3BootScriptWidthFifoUint8 && Width <= S3BootScriptWidthFifoUint64) {\r
+  if ((Width >= S3BootScriptWidthFifoUint8) && (Width <= S3BootScriptWidthFifoUint64)) {\r
     *AddressStride = 0;\r
   }\r
 \r
-  if (Width >= S3BootScriptWidthFillUint8 && Width <= S3BootScriptWidthFillUint64) {\r
+  if ((Width >= S3BootScriptWidthFillUint8) && (Width <= S3BootScriptWidthFillUint64)) {\r
     *BufferStride = 0;\r
   }\r
 \r
@@ -178,10 +178,10 @@ BuildLoopData (
 **/\r
 EFI_STATUS\r
 ScriptIoRead (\r
-  IN      S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
-  IN      UINT64                   Address,\r
-  IN      UINTN                    Count,\r
-  OUT     VOID                     *Buffer\r
+  IN      S3_BOOT_SCRIPT_LIB_WIDTH  Width,\r
+  IN      UINT64                    Address,\r
+  IN      UINTN                     Count,\r
+  OUT     VOID                      *Buffer\r
   )\r
 {\r
   EFI_STATUS  Status;\r
@@ -189,7 +189,7 @@ ScriptIoRead (
   UINTN       BufferStride;\r
   PTR         Out;\r
 \r
-  Out.Buf = (UINT8 *) Buffer;\r
+  Out.Buf = (UINT8 *)Buffer;\r
 \r
   if (Address > MAX_IO_ADDRESS) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -199,66 +199,66 @@ ScriptIoRead (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
   //\r
   // Loop for each iteration and move the data\r
   //\r
-  for (; Count > 0; Count--, Address += AddressStride, Out.Buf += BufferStride) {\r
+  for ( ; Count > 0; Count--, Address += AddressStride, Out.Buf += BufferStride) {\r
     switch (Width) {\r
+      case S3BootScriptWidthUint8:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint8 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint8 = IoRead8 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFifoUint8:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint8 = IoRead8 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFillUint8:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint8 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint8 = IoRead8 ((UINTN)Address);\r
+        break;\r
 \r
-    case S3BootScriptWidthUint8:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint8 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint8 = IoRead8 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFifoUint8:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint8 = IoRead8 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFillUint8:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint8 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint8 = IoRead8 ((UINTN) Address);\r
-      break;\r
-\r
-    case S3BootScriptWidthUint16:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint16 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint16 = IoRead16 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFifoUint16:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint16 = IoRead16 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFillUint16:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint16 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint16 = IoRead16 ((UINTN) Address);\r
-      break;\r
+      case S3BootScriptWidthUint16:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint16 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint16 = IoRead16 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFifoUint16:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint16 = IoRead16 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFillUint16:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint16 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint16 = IoRead16 ((UINTN)Address);\r
+        break;\r
 \r
-    case S3BootScriptWidthUint32:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint32 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint32 = IoRead32 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFifoUint32:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint32 = IoRead32 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFillUint32:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint32 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint32 = IoRead32 ((UINTN) Address);\r
-      break;\r
+      case S3BootScriptWidthUint32:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint32 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint32 = IoRead32 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFifoUint32:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint32 = IoRead32 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFillUint32:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint32 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint32 = IoRead32 ((UINTN)Address);\r
+        break;\r
 \r
-    case S3BootScriptWidthUint64:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint64 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint64 = IoRead64 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFifoUint64:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint64 = IoRead64 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFillUint64:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint64 - 0x%08x\n", (UINTN) Address));\r
-      *Out.Uint64 = IoRead64 ((UINTN) Address);\r
-      break;\r
+      case S3BootScriptWidthUint64:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint64 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint64 = IoRead64 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFifoUint64:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint64 = IoRead64 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFillUint64:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint64 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint64 = IoRead64 ((UINTN)Address);\r
+        break;\r
 \r
-    default:\r
-      return EFI_INVALID_PARAMETER;\r
+      default:\r
+        return EFI_INVALID_PARAMETER;\r
     }\r
   }\r
 \r
@@ -283,9 +283,9 @@ ScriptIoRead (
 EFI_STATUS\r
 ScriptIoWrite (\r
   IN      S3_BOOT_SCRIPT_LIB_WIDTH  Width,\r
-  IN      UINT64                 Address,\r
-  IN      UINTN                  Count,\r
-  IN      VOID                   *Buffer\r
+  IN      UINT64                    Address,\r
+  IN      UINTN                     Count,\r
+  IN      VOID                      *Buffer\r
   )\r
 {\r
   EFI_STATUS  Status;\r
@@ -295,7 +295,7 @@ ScriptIoWrite (
   PTR         In;\r
   PTR         OriginalIn;\r
 \r
-  In.Buf = (UINT8 *) Buffer;\r
+  In.Buf = (UINT8 *)Buffer;\r
 \r
   if (Address > MAX_IO_ADDRESS) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -305,69 +305,70 @@ ScriptIoWrite (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
   //\r
   // Loop for each iteration and move the data\r
   //\r
   OriginalAddress = Address;\r
-  OriginalIn.Buf = In.Buf;\r
-  for (; Count > 0; Count--, Address += AddressStride, In.Buf += BufferStride) {\r
+  OriginalIn.Buf  = In.Buf;\r
+  for ( ; Count > 0; Count--, Address += AddressStride, In.Buf += BufferStride) {\r
     switch (Width) {\r
       case S3BootScriptWidthUint8:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*In.Uint8));\r
-        IoWrite8 ((UINTN) Address, *In.Uint8);\r
+        IoWrite8 ((UINTN)Address, *In.Uint8);\r
         break;\r
       case S3BootScriptWidthFifoUint8:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint8));\r
-        IoWrite8 ((UINTN) OriginalAddress, *In.Uint8);\r
+        IoWrite8 ((UINTN)OriginalAddress, *In.Uint8);\r
         break;\r
       case S3BootScriptWidthFillUint8:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint8));\r
-        IoWrite8 ((UINTN) Address, *OriginalIn.Uint8);\r
+        IoWrite8 ((UINTN)Address, *OriginalIn.Uint8);\r
         break;\r
       case S3BootScriptWidthUint16:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*In.Uint16));\r
-        IoWrite16 ((UINTN) Address, *In.Uint16);\r
+        IoWrite16 ((UINTN)Address, *In.Uint16);\r
         break;\r
       case S3BootScriptWidthFifoUint16:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint16));\r
-        IoWrite16 ((UINTN) OriginalAddress, *In.Uint16);\r
+        IoWrite16 ((UINTN)OriginalAddress, *In.Uint16);\r
         break;\r
       case S3BootScriptWidthFillUint16:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint16));\r
-        IoWrite16 ((UINTN) Address, *OriginalIn.Uint16);\r
+        IoWrite16 ((UINTN)Address, *OriginalIn.Uint16);\r
         break;\r
       case S3BootScriptWidthUint32:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*In.Uint32));\r
-        IoWrite32 ((UINTN) Address, *In.Uint32);\r
+        IoWrite32 ((UINTN)Address, *In.Uint32);\r
         break;\r
       case S3BootScriptWidthFifoUint32:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint32));\r
-        IoWrite32 ((UINTN) OriginalAddress, *In.Uint32);\r
+        IoWrite32 ((UINTN)OriginalAddress, *In.Uint32);\r
         break;\r
       case S3BootScriptWidthFillUint32:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint32));\r
-        IoWrite32 ((UINTN) Address, *OriginalIn.Uint32);\r
+        IoWrite32 ((UINTN)Address, *OriginalIn.Uint32);\r
         break;\r
       case S3BootScriptWidthUint64:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *In.Uint64));\r
-        IoWrite64 ((UINTN) Address, *In.Uint64);\r
+        IoWrite64 ((UINTN)Address, *In.Uint64);\r
         break;\r
       case S3BootScriptWidthFifoUint64:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN)OriginalAddress, *In.Uint64));\r
-        IoWrite64 ((UINTN) OriginalAddress, *In.Uint64);\r
+        IoWrite64 ((UINTN)OriginalAddress, *In.Uint64);\r
         break;\r
       case S3BootScriptWidthFillUint64:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *OriginalIn.Uint64));\r
-        IoWrite64 ((UINTN) Address, *OriginalIn.Uint64);\r
+        IoWrite64 ((UINTN)Address, *OriginalIn.Uint64);\r
         break;\r
       default:\r
         return EFI_INVALID_PARAMETER;\r
     }\r
   }\r
 \r
-\r
   return EFI_SUCCESS;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_IO_WRITE OP code.\r
 \r
@@ -382,24 +383,25 @@ ScriptIoWrite (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteIoWrite (\r
-  IN UINT8                    *Script\r
+  IN UINT8  *Script\r
   )\r
 {\r
-  S3_BOOT_SCRIPT_LIB_WIDTH   Width;\r
-  UINT64                     Address;\r
-  UINTN                      Count;\r
+  S3_BOOT_SCRIPT_LIB_WIDTH  Width;\r
+  UINT64                    Address;\r
+  UINTN                     Count;\r
   VOID                      *Buffer;\r
-  EFI_BOOT_SCRIPT_IO_WRITE   IoWrite;\r
+  EFI_BOOT_SCRIPT_IO_WRITE  IoWrite;\r
 \r
-  CopyMem ((VOID*)&IoWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_WRITE));\r
-  Width = (S3_BOOT_SCRIPT_LIB_WIDTH) IoWrite.Width;\r
+  CopyMem ((VOID *)&IoWrite, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_IO_WRITE));\r
+  Width   = (S3_BOOT_SCRIPT_LIB_WIDTH)IoWrite.Width;\r
   Address = IoWrite.Address;\r
-  Count = IoWrite.Count;\r
-  Buffer = Script + sizeof (EFI_BOOT_SCRIPT_IO_WRITE);\r
+  Count   = IoWrite.Count;\r
+  Buffer  = Script + sizeof (EFI_BOOT_SCRIPT_IO_WRITE);\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteIoWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN)Address, Count, (UINTN)Width));\r
-  return ScriptIoWrite(Width, Address, Count, Buffer);\r
+  return ScriptIoWrite (Width, Address, Count, Buffer);\r
 }\r
+\r
 /**\r
   Perform memory read operation\r
 \r
@@ -418,10 +420,10 @@ BootScriptExecuteIoWrite (
 **/\r
 EFI_STATUS\r
 ScriptMemoryRead (\r
-  IN       S3_BOOT_SCRIPT_LIB_WIDTH    Width,\r
-  IN       UINT64                   Address,\r
-  IN       UINTN                    Count,\r
-  IN OUT   VOID                     *Buffer\r
+  IN       S3_BOOT_SCRIPT_LIB_WIDTH  Width,\r
+  IN       UINT64                    Address,\r
+  IN       UINTN                     Count,\r
+  IN OUT   VOID                      *Buffer\r
   )\r
 {\r
   EFI_STATUS  Status;\r
@@ -431,74 +433,76 @@ ScriptMemoryRead (
 \r
   Out.Buf = Buffer;\r
 \r
-  Status  = BuildLoopData (Width, Address, &AddressStride, &BufferStride);\r
+  Status = BuildLoopData (Width, Address, &AddressStride, &BufferStride);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
   //\r
   // Loop for each iteration and move the data\r
   //\r
-  for (; Count > 0; Count--, Address += AddressStride, Out.Buf += BufferStride) {\r
+  for ( ; Count > 0; Count--, Address += AddressStride, Out.Buf += BufferStride) {\r
     switch (Width) {\r
-    case S3BootScriptWidthUint8:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint8 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint8 = MmioRead8 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFifoUint8:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint8 = MmioRead8 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFillUint8:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint8 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint8 = MmioRead8 ((UINTN) Address);\r
-      break;\r
+      case S3BootScriptWidthUint8:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint8 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint8 = MmioRead8 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFifoUint8:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint8 = MmioRead8 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFillUint8:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint8 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint8 = MmioRead8 ((UINTN)Address);\r
+        break;\r
 \r
-    case S3BootScriptWidthUint16:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint16 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint16 = MmioRead16 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFifoUint16:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint16 = MmioRead16 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFillUint16:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint16 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint16 = MmioRead16 ((UINTN) Address);\r
-      break;\r
+      case S3BootScriptWidthUint16:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint16 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint16 = MmioRead16 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFifoUint16:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint16 = MmioRead16 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFillUint16:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint16 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint16 = MmioRead16 ((UINTN)Address);\r
+        break;\r
 \r
-    case S3BootScriptWidthUint32:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint32 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint32 = MmioRead32 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFifoUint32:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint32 = MmioRead32 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFillUint32:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint32 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint32 = MmioRead32 ((UINTN) Address);\r
-      break;\r
+      case S3BootScriptWidthUint32:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint32 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint32 = MmioRead32 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFifoUint32:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint32 = MmioRead32 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFillUint32:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint32 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint32 = MmioRead32 ((UINTN)Address);\r
+        break;\r
 \r
-    case S3BootScriptWidthUint64:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint64 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint64 = MmioRead64 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFifoUint64:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint64 = MmioRead64 ((UINTN) Address);\r
-      break;\r
-    case S3BootScriptWidthFillUint64:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint64 - 0x%08x\n", (UINTN)Address));\r
-      *Out.Uint64 = MmioRead64 ((UINTN) Address);\r
-      break;\r
+      case S3BootScriptWidthUint64:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint64 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint64 = MmioRead64 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFifoUint64:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint64 = MmioRead64 ((UINTN)Address);\r
+        break;\r
+      case S3BootScriptWidthFillUint64:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint64 - 0x%08x\n", (UINTN)Address));\r
+        *Out.Uint64 = MmioRead64 ((UINTN)Address);\r
+        break;\r
 \r
-    default:\r
-      return EFI_UNSUPPORTED;\r
+      default:\r
+        return EFI_UNSUPPORTED;\r
     }\r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
+\r
 /**\r
   Perform memory write operation\r
 \r
@@ -517,10 +521,10 @@ ScriptMemoryRead (
 **/\r
 EFI_STATUS\r
 ScriptMemoryWrite (\r
-  IN      S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
-  IN      UINT64                Address,\r
-  IN      UINTN                 Count,\r
-  IN OUT  VOID                 *Buffer\r
+  IN      S3_BOOT_SCRIPT_LIB_WIDTH  Width,\r
+  IN      UINT64                    Address,\r
+  IN      UINTN                     Count,\r
+  IN OUT  VOID                      *Buffer\r
   )\r
 {\r
   EFI_STATUS  Status;\r
@@ -530,73 +534,76 @@ ScriptMemoryWrite (
   PTR         In;\r
   PTR         OriginalIn;\r
 \r
-  In.Buf  = Buffer;\r
+  In.Buf = Buffer;\r
 \r
-  Status  = BuildLoopData (Width, Address, &AddressStride, &BufferStride);\r
+  Status = BuildLoopData (Width, Address, &AddressStride, &BufferStride);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
   //\r
   // Loop for each iteration and move the data\r
   //\r
   OriginalAddress = Address;\r
-  OriginalIn.Buf = In.Buf;\r
-  for (; Count > 0; Count--, Address += AddressStride, In.Buf += BufferStride) {\r
+  OriginalIn.Buf  = In.Buf;\r
+  for ( ; Count > 0; Count--, Address += AddressStride, In.Buf += BufferStride) {\r
     switch (Width) {\r
       case S3BootScriptWidthUint8:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*In.Uint8));\r
-        MmioWrite8 ((UINTN) Address, *In.Uint8);\r
+        MmioWrite8 ((UINTN)Address, *In.Uint8);\r
         break;\r
       case S3BootScriptWidthFifoUint8:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint8));\r
-        MmioWrite8 ((UINTN) OriginalAddress, *In.Uint8);\r
+        MmioWrite8 ((UINTN)OriginalAddress, *In.Uint8);\r
         break;\r
       case S3BootScriptWidthFillUint8:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint8));\r
-        MmioWrite8 ((UINTN) Address, *OriginalIn.Uint8);\r
+        MmioWrite8 ((UINTN)Address, *OriginalIn.Uint8);\r
         break;\r
       case S3BootScriptWidthUint16:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*In.Uint16));\r
-        MmioWrite16 ((UINTN) Address, *In.Uint16);\r
+        MmioWrite16 ((UINTN)Address, *In.Uint16);\r
         break;\r
       case S3BootScriptWidthFifoUint16:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint16));\r
-        MmioWrite16 ((UINTN) OriginalAddress, *In.Uint16);\r
+        MmioWrite16 ((UINTN)OriginalAddress, *In.Uint16);\r
         break;\r
       case S3BootScriptWidthFillUint16:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint16));\r
-        MmioWrite16 ((UINTN) Address, *OriginalIn.Uint16);\r
+        MmioWrite16 ((UINTN)Address, *OriginalIn.Uint16);\r
         break;\r
       case S3BootScriptWidthUint32:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*In.Uint32));\r
-        MmioWrite32 ((UINTN) Address, *In.Uint32);\r
+        MmioWrite32 ((UINTN)Address, *In.Uint32);\r
         break;\r
       case S3BootScriptWidthFifoUint32:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint32));\r
-        MmioWrite32 ((UINTN) OriginalAddress, *In.Uint32);\r
+        MmioWrite32 ((UINTN)OriginalAddress, *In.Uint32);\r
         break;\r
       case S3BootScriptWidthFillUint32:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint32));\r
-        MmioWrite32 ((UINTN) Address, *OriginalIn.Uint32);\r
+        MmioWrite32 ((UINTN)Address, *OriginalIn.Uint32);\r
         break;\r
       case S3BootScriptWidthUint64:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *In.Uint64));\r
-        MmioWrite64 ((UINTN) Address, *In.Uint64);\r
+        MmioWrite64 ((UINTN)Address, *In.Uint64);\r
         break;\r
       case S3BootScriptWidthFifoUint64:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN)OriginalAddress, *In.Uint64));\r
-        MmioWrite64 ((UINTN) OriginalAddress, *In.Uint64);\r
+        MmioWrite64 ((UINTN)OriginalAddress, *In.Uint64);\r
         break;\r
       case S3BootScriptWidthFillUint64:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *OriginalIn.Uint64));\r
-        MmioWrite64 ((UINTN) Address, *OriginalIn.Uint64);\r
+        MmioWrite64 ((UINTN)Address, *OriginalIn.Uint64);\r
         break;\r
       default:\r
         return EFI_UNSUPPORTED;\r
     }\r
   }\r
+\r
   return EFI_SUCCESS;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_MEM_WRITE OP code.\r
 \r
@@ -612,25 +619,25 @@ ScriptMemoryWrite (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteMemoryWrite (\r
-  IN UINT8             *Script\r
+  IN UINT8  *Script\r
   )\r
 {\r
-  VOID            *Buffer;\r
-  S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
-  UINT64           Address;\r
-  UINTN            Count;\r
+  VOID                       *Buffer;\r
+  S3_BOOT_SCRIPT_LIB_WIDTH   Width;\r
+  UINT64                     Address;\r
+  UINTN                      Count;\r
   EFI_BOOT_SCRIPT_MEM_WRITE  MemWrite;\r
 \r
-  CopyMem((VOID*)&MemWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_WRITE));\r
+  CopyMem ((VOID *)&MemWrite, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_MEM_WRITE));\r
   Width   = (S3_BOOT_SCRIPT_LIB_WIDTH)MemWrite.Width;\r
   Address = MemWrite.Address;\r
   Count   = MemWrite.Count;\r
-  Buffer  = Script + sizeof(EFI_BOOT_SCRIPT_MEM_WRITE);\r
+  Buffer  = Script + sizeof (EFI_BOOT_SCRIPT_MEM_WRITE);\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteMemoryWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN)Address, Count, (UINTN)Width));\r
-  return ScriptMemoryWrite (Width,Address, Count,  Buffer);\r
-\r
+  return ScriptMemoryWrite (Width, Address, Count, Buffer);\r
 }\r
+\r
 /**\r
   Performance PCI configuration 2 read operation\r
 \r
@@ -647,11 +654,11 @@ BootScriptExecuteMemoryWrite (
 **/\r
 EFI_STATUS\r
 ScriptPciCfg2Read (\r
-  IN  S3_BOOT_SCRIPT_LIB_WIDTH    Width,\r
-  IN  UINT16                       Segment,\r
-  IN  UINT64                       Address,\r
-  IN  UINTN                        Count,\r
-  OUT VOID                        *Buffer\r
+  IN  S3_BOOT_SCRIPT_LIB_WIDTH  Width,\r
+  IN  UINT16                    Segment,\r
+  IN  UINT64                    Address,\r
+  IN  UINTN                     Count,\r
+  OUT VOID                      *Buffer\r
   )\r
 {\r
   EFI_STATUS  Status;\r
@@ -660,7 +667,7 @@ ScriptPciCfg2Read (
   PTR         Out;\r
   UINT64      PciAddress;\r
 \r
-  Out.Buf = (UINT8 *) Buffer;\r
+  Out.Buf = (UINT8 *)Buffer;\r
 \r
   PciAddress = PCI_ADDRESS_ENCODE (Segment, Address);\r
 \r
@@ -668,54 +675,56 @@ ScriptPciCfg2Read (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
   //\r
   // Loop for each iteration and move the data\r
   //\r
-  for (; Count > 0; Count--, PciAddress += AddressStride, Out.Buf += BufferStride) {\r
+  for ( ; Count > 0; Count--, PciAddress += AddressStride, Out.Buf += BufferStride) {\r
     switch (Width) {\r
-    case S3BootScriptWidthUint8:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint8 - 0x%016lx\n", PciAddress));\r
-      *Out.Uint8 = PciSegmentRead8 (PciAddress);\r
-      break;\r
-    case S3BootScriptWidthFifoUint8:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint8 - 0x%016lx\n", PciAddress));\r
-      *Out.Uint8 = PciSegmentRead8 (PciAddress);\r
-      break;\r
-    case S3BootScriptWidthFillUint8:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint8 - 0x%016lx\n", PciAddress));\r
-      *Out.Uint8 = PciSegmentRead8 (PciAddress);\r
-      break;\r
+      case S3BootScriptWidthUint8:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint8 - 0x%016lx\n", PciAddress));\r
+        *Out.Uint8 = PciSegmentRead8 (PciAddress);\r
+        break;\r
+      case S3BootScriptWidthFifoUint8:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint8 - 0x%016lx\n", PciAddress));\r
+        *Out.Uint8 = PciSegmentRead8 (PciAddress);\r
+        break;\r
+      case S3BootScriptWidthFillUint8:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint8 - 0x%016lx\n", PciAddress));\r
+        *Out.Uint8 = PciSegmentRead8 (PciAddress);\r
+        break;\r
 \r
-    case S3BootScriptWidthUint16:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint16 - 0x%016lx\n", PciAddress));\r
-      *Out.Uint16 = PciSegmentRead16 (PciAddress);\r
-      break;\r
-    case S3BootScriptWidthFifoUint16:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint16 - 0x%016lx\n", PciAddress));\r
-      *Out.Uint16 = PciSegmentRead16 (PciAddress);\r
-      break;\r
-    case S3BootScriptWidthFillUint16:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint16 - 0x%016lx\n", PciAddress));\r
-      *Out.Uint16 = PciSegmentRead16 (PciAddress);\r
-      break;\r
+      case S3BootScriptWidthUint16:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint16 - 0x%016lx\n", PciAddress));\r
+        *Out.Uint16 = PciSegmentRead16 (PciAddress);\r
+        break;\r
+      case S3BootScriptWidthFifoUint16:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint16 - 0x%016lx\n", PciAddress));\r
+        *Out.Uint16 = PciSegmentRead16 (PciAddress);\r
+        break;\r
+      case S3BootScriptWidthFillUint16:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint16 - 0x%016lx\n", PciAddress));\r
+        *Out.Uint16 = PciSegmentRead16 (PciAddress);\r
+        break;\r
 \r
-    case S3BootScriptWidthUint32:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint32 - 0x%016lx\n", PciAddress));\r
-      *Out.Uint32 = PciSegmentRead32 (PciAddress);\r
-      break;\r
-    case S3BootScriptWidthFifoUint32:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint32 - 0x%016lx\n", PciAddress));\r
-      *Out.Uint32 = PciSegmentRead32 (PciAddress);\r
-      break;\r
-    case S3BootScriptWidthFillUint32:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint32 - 0x%016lx\n", PciAddress));\r
-      *Out.Uint32 = PciSegmentRead32 (PciAddress);\r
-      break;\r
+      case S3BootScriptWidthUint32:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint32 - 0x%016lx\n", PciAddress));\r
+        *Out.Uint32 = PciSegmentRead32 (PciAddress);\r
+        break;\r
+      case S3BootScriptWidthFifoUint32:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFifoUint32 - 0x%016lx\n", PciAddress));\r
+        *Out.Uint32 = PciSegmentRead32 (PciAddress);\r
+        break;\r
+      case S3BootScriptWidthFillUint32:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptWidthFillUint32 - 0x%016lx\n", PciAddress));\r
+        *Out.Uint32 = PciSegmentRead32 (PciAddress);\r
+        break;\r
 \r
-    default:\r
-      return EFI_INVALID_PARAMETER;\r
+      default:\r
+        return EFI_INVALID_PARAMETER;\r
     }\r
   }\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -735,11 +744,11 @@ ScriptPciCfg2Read (
 **/\r
 EFI_STATUS\r
 ScriptPciCfg2Write (\r
-  IN  S3_BOOT_SCRIPT_LIB_WIDTH     Width,\r
-  IN  UINT16                       Segment,\r
-  IN  UINT64                       Address,\r
-  IN  UINTN                        Count,\r
-  IN  VOID                         *Buffer\r
+  IN  S3_BOOT_SCRIPT_LIB_WIDTH  Width,\r
+  IN  UINT16                    Segment,\r
+  IN  UINT64                    Address,\r
+  IN  UINTN                     Count,\r
+  IN  VOID                      *Buffer\r
   )\r
 {\r
   EFI_STATUS  Status;\r
@@ -750,7 +759,7 @@ ScriptPciCfg2Write (
   PTR         OriginalIn;\r
   UINT64      PciAddress;\r
 \r
-  In.Buf = (UINT8 *) Buffer;\r
+  In.Buf = (UINT8 *)Buffer;\r
 \r
   PciAddress = PCI_ADDRESS_ENCODE (Segment, Address);\r
 \r
@@ -758,12 +767,13 @@ ScriptPciCfg2Write (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
   //\r
   // Loop for each iteration and move the data\r
   //\r
   OriginalPciAddress = PciAddress;\r
-  OriginalIn.Buf = In.Buf;\r
-  for (; Count > 0; Count--, PciAddress += AddressStride, In.Buf += BufferStride) {\r
+  OriginalIn.Buf     = In.Buf;\r
+  for ( ; Count > 0; Count--, PciAddress += AddressStride, In.Buf += BufferStride) {\r
     switch (Width) {\r
       case S3BootScriptWidthUint8:\r
         DEBUG ((DEBUG_INFO, "S3BootScriptWidthUint8 - 0x%016lx (0x%02x)\n", PciAddress, (UINTN)*In.Uint8));\r
@@ -805,8 +815,10 @@ ScriptPciCfg2Write (
         return EFI_INVALID_PARAMETER;\r
     }\r
   }\r
+\r
   return EFI_SUCCESS;\r
 }\r
+\r
 /**\r
   Performance PCI configuration read operation\r
 \r
@@ -824,14 +836,15 @@ ScriptPciCfg2Write (
 **/\r
 EFI_STATUS\r
 ScriptPciCfgRead (\r
-  IN  S3_BOOT_SCRIPT_LIB_WIDTH    Width,\r
-  IN  UINT64                   Address,\r
-  IN  UINTN                    Count,\r
-  OUT VOID                     *Buffer\r
+  IN  S3_BOOT_SCRIPT_LIB_WIDTH  Width,\r
+  IN  UINT64                    Address,\r
+  IN  UINTN                     Count,\r
+  OUT VOID                      *Buffer\r
   )\r
 {\r
   return ScriptPciCfg2Read (Width, 0, Address, Count, Buffer);\r
 }\r
+\r
 /**\r
   Performance PCI configuration write operation\r
 \r
@@ -850,14 +863,15 @@ ScriptPciCfgRead (
 EFI_STATUS\r
 EFIAPI\r
 ScriptPciCfgWrite (\r
-  IN  S3_BOOT_SCRIPT_LIB_WIDTH    Width,\r
-  IN  UINT64                   Address,\r
-  IN  UINTN                    Count,\r
-  IN  VOID                     *Buffer\r
+  IN  S3_BOOT_SCRIPT_LIB_WIDTH  Width,\r
+  IN  UINT64                    Address,\r
+  IN  UINTN                     Count,\r
+  IN  VOID                      *Buffer\r
   )\r
 {\r
   return ScriptPciCfg2Write (Width, 0, Address, Count, Buffer);\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE OP code.\r
 \r
@@ -867,7 +881,7 @@ ScriptPciCfgWrite (
 **/\r
 EFI_STATUS\r
 BootScriptExecutePciCfgWrite (\r
-  IN UINT8                    *Script\r
+  IN UINT8  *Script\r
   )\r
 {\r
   VOID                              *Buffer;\r
@@ -876,16 +890,17 @@ BootScriptExecutePciCfgWrite (
   UINTN                             Count;\r
   EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE  PciCfgWrite;\r
 \r
-  CopyMem ((VOID*)&PciCfgWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE));\r
+  CopyMem ((VOID *)&PciCfgWrite, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE));\r
 \r
   Width   = (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfgWrite.Width;\r
   Address = PciCfgWrite.Address;\r
   Count   = PciCfgWrite.Count;\r
-  Buffer  = Script + sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE);\r
+  Buffer  = Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE);\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecutePciCfgWrite - 0x%016lx, 0x%08x, 0x%08x\n", PCI_ADDRESS_ENCODE (0, Address), Count, (UINTN)Width));\r
   return ScriptPciCfgWrite (Width, Address, Count, Buffer);\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_IO_READ_WRITE OP code.\r
 \r
@@ -897,39 +912,41 @@ BootScriptExecutePciCfgWrite (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteIoReadWrite (\r
-  IN  UINT8                        *Script,\r
-  IN  UINT64                       AndMask,\r
-  IN  UINT64                        OrMask\r
+  IN  UINT8   *Script,\r
+  IN  UINT64  AndMask,\r
+  IN  UINT64  OrMask\r
   )\r
 \r
 {\r
-  EFI_STATUS  Status;\r
-  UINT64      Data;\r
-  EFI_BOOT_SCRIPT_IO_READ_WRITE IoReadWrite;\r
+  EFI_STATUS                     Status;\r
+  UINT64                         Data;\r
+  EFI_BOOT_SCRIPT_IO_READ_WRITE  IoReadWrite;\r
 \r
   Data = 0;\r
 \r
-  CopyMem((VOID*)&IoReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_READ_WRITE));\r
+  CopyMem ((VOID *)&IoReadWrite, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteIoReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoReadWrite.Address, AndMask, OrMask));\r
 \r
   Status = ScriptIoRead (\r
-             (S3_BOOT_SCRIPT_LIB_WIDTH) IoReadWrite.Width,\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)IoReadWrite.Width,\r
              IoReadWrite.Address,\r
              1,\r
              &Data\r
              );\r
   if (!EFI_ERROR (Status)) {\r
-    Data = (Data & AndMask) | OrMask;\r
+    Data   = (Data & AndMask) | OrMask;\r
     Status = ScriptIoWrite (\r
-               (S3_BOOT_SCRIPT_LIB_WIDTH) IoReadWrite.Width,\r
+               (S3_BOOT_SCRIPT_LIB_WIDTH)IoReadWrite.Width,\r
                IoReadWrite.Address,\r
                1,\r
                &Data\r
                );\r
   }\r
+\r
   return Status;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_MEM_READ_WRITE OP code.\r
 \r
@@ -941,39 +958,41 @@ BootScriptExecuteIoReadWrite (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteMemoryReadWrite (\r
-  IN UINT8                        *Script,\r
-  IN UINT64                        AndMask,\r
-  IN UINT64                        OrMask\r
+  IN UINT8   *Script,\r
+  IN UINT64  AndMask,\r
+  IN UINT64  OrMask\r
   )\r
 \r
 {\r
-  EFI_STATUS  Status;\r
-  UINT64      Data;\r
+  EFI_STATUS                      Status;\r
+  UINT64                          Data;\r
   EFI_BOOT_SCRIPT_MEM_READ_WRITE  MemReadWrite;\r
 \r
   Data = 0;\r
 \r
-  CopyMem((VOID*)&MemReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_READ_WRITE));\r
+  CopyMem ((VOID *)&MemReadWrite, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteMemoryReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemReadWrite.Address, AndMask, OrMask));\r
 \r
   Status = ScriptMemoryRead (\r
-             (S3_BOOT_SCRIPT_LIB_WIDTH) MemReadWrite.Width,\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)MemReadWrite.Width,\r
              MemReadWrite.Address,\r
              1,\r
              &Data\r
              );\r
   if (!EFI_ERROR (Status)) {\r
-    Data = (Data & AndMask) | OrMask;\r
+    Data   = (Data & AndMask) | OrMask;\r
     Status = ScriptMemoryWrite (\r
-               (S3_BOOT_SCRIPT_LIB_WIDTH) MemReadWrite.Width,\r
+               (S3_BOOT_SCRIPT_LIB_WIDTH)MemReadWrite.Width,\r
                MemReadWrite.Address,\r
                1,\r
                &Data\r
                );\r
   }\r
+\r
   return Status;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CFG_READ_WRITE OP code.\r
 \r
@@ -985,24 +1004,24 @@ BootScriptExecuteMemoryReadWrite (
 **/\r
 EFI_STATUS\r
 BootScriptExecutePciCfgReadWrite (\r
-  IN UINT8                     *Script,\r
-  IN UINT64                    AndMask,\r
-  IN UINT64                    OrMask\r
+  IN UINT8   *Script,\r
+  IN UINT64  AndMask,\r
+  IN UINT64  OrMask\r
   )\r
 \r
 {\r
-  EFI_STATUS  Status;\r
-  UINT64      Data;\r
+  EFI_STATUS                             Status;\r
+  UINT64                                 Data;\r
   EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE  PciCfgReadWrite;\r
 \r
   Data = 0;\r
 \r
-  CopyMem((VOID*)&PciCfgReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE));\r
+  CopyMem ((VOID *)&PciCfgReadWrite, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecutePciCfgReadWrite - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (0, PciCfgReadWrite.Address), AndMask, OrMask));\r
 \r
   Status = ScriptPciCfgRead (\r
-             (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgReadWrite.Width,\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfgReadWrite.Width,\r
              PciCfgReadWrite.Address,\r
              1,\r
              &Data\r
@@ -1014,7 +1033,7 @@ BootScriptExecutePciCfgReadWrite (
   Data = (Data & AndMask) | OrMask;\r
 \r
   Status = ScriptPciCfgWrite (\r
-             (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgReadWrite.Width,\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfgReadWrite.Width,\r
              PciCfgReadWrite.Address,\r
              1,\r
              &Data\r
@@ -1022,6 +1041,7 @@ BootScriptExecutePciCfgReadWrite (
 \r
   return Status;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_SMBUS_EXECUTE OP code.\r
 \r
@@ -1033,26 +1053,27 @@ BootScriptExecutePciCfgReadWrite (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteSmbusExecute (\r
-  IN UINT8                     *Script\r
+  IN UINT8  *Script\r
   )\r
 {\r
-  UINTN                    SmBusAddress;\r
-  UINTN                    DataSize;\r
-  EFI_BOOT_SCRIPT_SMBUS_EXECUTE SmbusExecuteEntry;\r
+  UINTN                          SmBusAddress;\r
+  UINTN                          DataSize;\r
+  EFI_BOOT_SCRIPT_SMBUS_EXECUTE  SmbusExecuteEntry;\r
 \r
-  CopyMem ((VOID*)&SmbusExecuteEntry, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_SMBUS_EXECUTE ));\r
+  CopyMem ((VOID *)&SmbusExecuteEntry, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_SMBUS_EXECUTE));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteSmbusExecute - 0x%08x, 0x%08x\n", (UINTN)SmbusExecuteEntry.SmBusAddress, (UINTN)SmbusExecuteEntry.Operation));\r
 \r
   SmBusAddress = (UINTN)SmbusExecuteEntry.SmBusAddress;\r
-  DataSize = (UINTN) SmbusExecuteEntry.DataSize;\r
+  DataSize     = (UINTN)SmbusExecuteEntry.DataSize;\r
   return InternalSmbusExecute (\r
            SmBusAddress,\r
-           (EFI_SMBUS_OPERATION) SmbusExecuteEntry.Operation,\r
+           (EFI_SMBUS_OPERATION)SmbusExecuteEntry.Operation,\r
            &DataSize,\r
            Script + sizeof (EFI_BOOT_SCRIPT_SMBUS_EXECUTE)\r
            );\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_STALL OP code.\r
 \r
@@ -1062,18 +1083,19 @@ BootScriptExecuteSmbusExecute (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteStall (\r
-  IN UINT8                 *Script\r
+  IN UINT8  *Script\r
   )\r
 {\r
-  EFI_BOOT_SCRIPT_STALL    Stall;\r
+  EFI_BOOT_SCRIPT_STALL  Stall;\r
 \r
-  CopyMem ((VOID*)&Stall, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_STALL));\r
+  CopyMem ((VOID *)&Stall, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_STALL));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteStall - 0x%08x\n", (UINTN)Stall.Duration));\r
 \r
-  MicroSecondDelay ((UINTN) Stall.Duration);\r
+  MicroSecondDelay ((UINTN)Stall.Duration);\r
   return EFI_SUCCESS;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_DISPATCH OP code.\r
 \r
@@ -1082,22 +1104,23 @@ BootScriptExecuteStall (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteDispatch (\r
-  IN UINT8                  *Script\r
+  IN UINT8  *Script\r
   )\r
 {\r
   EFI_STATUS                Status;\r
   DISPATCH_ENTRYPOINT_FUNC  EntryFunc;\r
   EFI_BOOT_SCRIPT_DISPATCH  ScriptDispatch;\r
 \r
-  CopyMem ((VOID*)&ScriptDispatch, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_DISPATCH));\r
-  EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (ScriptDispatch.EntryPoint);\r
+  CopyMem ((VOID *)&ScriptDispatch, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_DISPATCH));\r
+  EntryFunc = (DISPATCH_ENTRYPOINT_FUNC)(UINTN)(ScriptDispatch.EntryPoint);\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteDispatch - 0x%08x\n", (UINTN)ScriptDispatch.EntryPoint));\r
 \r
-  Status    = EntryFunc (NULL, NULL);\r
+  Status = EntryFunc (NULL, NULL);\r
 \r
   return Status;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_DISPATCH_2 OP code.\r
 \r
@@ -1106,23 +1129,24 @@ BootScriptExecuteDispatch (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteDispatch2 (\r
-  IN UINT8                  *Script\r
+  IN UINT8  *Script\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
-  DISPATCH_ENTRYPOINT_FUNC  EntryFunc;\r
+  EFI_STATUS                  Status;\r
+  DISPATCH_ENTRYPOINT_FUNC    EntryFunc;\r
   EFI_BOOT_SCRIPT_DISPATCH_2  ScriptDispatch2;\r
 \r
-  CopyMem ((VOID*)&ScriptDispatch2, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_DISPATCH_2));\r
+  CopyMem ((VOID *)&ScriptDispatch2, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_DISPATCH_2));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteDispatch2 - 0x%08x(0x%08x)\n", (UINTN)ScriptDispatch2.EntryPoint, (UINTN)ScriptDispatch2.Context));\r
 \r
-  EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (ScriptDispatch2.EntryPoint);\r
+  EntryFunc = (DISPATCH_ENTRYPOINT_FUNC)(UINTN)(ScriptDispatch2.EntryPoint);\r
 \r
-  Status    = EntryFunc (NULL, (VOID *) (UINTN) ScriptDispatch2.Context);\r
+  Status = EntryFunc (NULL, (VOID *)(UINTN)ScriptDispatch2.Context);\r
 \r
   return Status;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_MEM_POLL OP code.\r
 \r
@@ -1136,45 +1160,44 @@ BootScriptExecuteDispatch2 (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteMemPoll (\r
-  IN UINT8                        *Script,\r
-  IN UINT64                        AndMask,\r
-  IN UINT64                        OrMask\r
+  IN UINT8   *Script,\r
+  IN UINT64  AndMask,\r
+  IN UINT64  OrMask\r
   )\r
 {\r
+  UINT64                    Data;\r
+  UINT64                    LoopTimes;\r
+  EFI_STATUS                Status;\r
+  EFI_BOOT_SCRIPT_MEM_POLL  MemPoll;\r
 \r
-  UINT64        Data;\r
-  UINT64        LoopTimes;\r
-  EFI_STATUS    Status;\r
-  EFI_BOOT_SCRIPT_MEM_POLL       MemPoll;\r
-\r
-  CopyMem ((VOID*)&MemPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_POLL));\r
+  CopyMem ((VOID *)&MemPoll, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_MEM_POLL));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteMemPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemPoll.Address, AndMask, OrMask));\r
 \r
-  Data = 0;\r
+  Data   = 0;\r
   Status = ScriptMemoryRead (\r
-               (S3_BOOT_SCRIPT_LIB_WIDTH) MemPoll.Width,\r
-               MemPoll.Address,\r
-               1,\r
-               &Data\r
-               );\r
-  if ((!EFI_ERROR (Status)) && (Data & AndMask) == OrMask) {\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)MemPoll.Width,\r
+             MemPoll.Address,\r
+             1,\r
+             &Data\r
+             );\r
+  if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {\r
     return EFI_SUCCESS;\r
   }\r
 \r
   for (LoopTimes = 0; LoopTimes < MemPoll.LoopTimes; LoopTimes++) {\r
     MicroSecondDelay ((UINTN)MemPoll.Duration);\r
 \r
-    Data = 0;\r
+    Data   = 0;\r
     Status = ScriptMemoryRead (\r
-               (S3_BOOT_SCRIPT_LIB_WIDTH) MemPoll.Width,\r
+               (S3_BOOT_SCRIPT_LIB_WIDTH)MemPoll.Width,\r
                MemPoll.Address,\r
                1,\r
                &Data\r
                );\r
-   if ((!EFI_ERROR (Status)) && (Data & AndMask) == OrMask) {\r
-    return EFI_SUCCESS;\r
-   }\r
+    if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {\r
+      return EFI_SUCCESS;\r
+    }\r
   }\r
 \r
   if (LoopTimes < MemPoll.LoopTimes) {\r
@@ -1183,6 +1206,7 @@ BootScriptExecuteMemPoll (
     return EFI_DEVICE_ERROR;\r
   }\r
 }\r
+\r
 /**\r
   Execute the boot script to interpret the Store arbitrary information.\r
   This opcode is a no-op on dispatch and is only used for debugging script issues.\r
@@ -1192,23 +1216,24 @@ BootScriptExecuteMemPoll (
 **/\r
 VOID\r
 BootScriptExecuteInformation (\r
-  IN UINT8       *Script\r
+  IN UINT8  *Script\r
   )\r
 \r
 {\r
-  UINT32                        Index;\r
-  EFI_BOOT_SCRIPT_INFORMATION   Information;\r
-  UINT8                         *InformationData;\r
+  UINT32                       Index;\r
+  EFI_BOOT_SCRIPT_INFORMATION  Information;\r
+  UINT8                        *InformationData;\r
 \r
-  CopyMem ((VOID*)&Information, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_INFORMATION));\r
+  CopyMem ((VOID *)&Information, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_INFORMATION));\r
 \r
   InformationData = Script + sizeof (EFI_BOOT_SCRIPT_INFORMATION);\r
-  DEBUG ((DEBUG_INFO, "BootScriptExecuteInformation - 0x%08x\n", (UINTN) InformationData));\r
+  DEBUG ((DEBUG_INFO, "BootScriptExecuteInformation - 0x%08x\n", (UINTN)InformationData));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptInformation: "));\r
   for (Index = 0; Index < Information.InformationLength; Index++) {\r
     DEBUG ((DEBUG_INFO, "%02x ", InformationData[Index]));\r
   }\r
+\r
   DEBUG ((DEBUG_INFO, "\n"));\r
 }\r
 \r
@@ -1220,23 +1245,24 @@ BootScriptExecuteInformation (
 **/\r
 VOID\r
 BootScriptExecuteLabel (\r
-  IN UINT8       *Script\r
+  IN UINT8  *Script\r
   )\r
 \r
 {\r
-  UINT32                        Index;\r
-  EFI_BOOT_SCRIPT_INFORMATION   Information;\r
-  UINT8                         *InformationData;\r
+  UINT32                       Index;\r
+  EFI_BOOT_SCRIPT_INFORMATION  Information;\r
+  UINT8                        *InformationData;\r
 \r
-  CopyMem ((VOID*)&Information, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_INFORMATION));\r
+  CopyMem ((VOID *)&Information, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_INFORMATION));\r
 \r
   InformationData = Script + sizeof (EFI_BOOT_SCRIPT_INFORMATION);\r
-  DEBUG ((DEBUG_INFO, "BootScriptExecuteLabel - 0x%08x\n", (UINTN) InformationData));\r
+  DEBUG ((DEBUG_INFO, "BootScriptExecuteLabel - 0x%08x\n", (UINTN)InformationData));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptLabel: "));\r
   for (Index = 0; Index < Information.InformationLength; Index++) {\r
     DEBUG ((DEBUG_INFO, "%02x ", InformationData[Index]));\r
   }\r
+\r
   DEBUG ((DEBUG_INFO, "\n"));\r
 }\r
 \r
@@ -1251,79 +1277,80 @@ BootScriptExecuteLabel (
 VOID\r
 CheckAndOrMask (\r
   IN   EFI_BOOT_SCRIPT_COMMON_HEADER  *ScriptHeader,\r
-  OUT UINT64                      *AndMask,\r
-  OUT UINT64                      *OrMask,\r
-  IN  UINT8                       *Script\r
+  OUT UINT64                          *AndMask,\r
+  OUT UINT64                          *OrMask,\r
+  IN  UINT8                           *Script\r
   )\r
 {\r
-  UINT8 *DataPtr;\r
-  UINTN Size;\r
+  UINT8  *DataPtr;\r
+  UINTN  Size;\r
 \r
   switch (ScriptHeader->OpCode) {\r
-  case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:\r
-    Size = sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE);\r
-    break;\r
-\r
-  case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
-    Size = sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE);\r
-    break;\r
-\r
-  case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:\r
-    Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE);\r
-    break;\r
-  case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:\r
-    Size = sizeof (EFI_BOOT_SCRIPT_MEM_POLL);\r
-    break;\r
-\r
-  case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
-    Size = sizeof (EFI_BOOT_SCRIPT_IO_POLL);\r
-    break;\r
-\r
-  case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:\r
-    Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE);\r
-    break;\r
-\r
-  case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
-    Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL);\r
-    break;\r
-\r
-  case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
-    Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL);\r
-    break;\r
-\r
-  default:\r
-    return;\r
+    case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:\r
+      Size = sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE);\r
+      break;\r
+\r
+    case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
+      Size = sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE);\r
+      break;\r
+\r
+    case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:\r
+      Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE);\r
+      break;\r
+    case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:\r
+      Size = sizeof (EFI_BOOT_SCRIPT_MEM_POLL);\r
+      break;\r
+\r
+    case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
+      Size = sizeof (EFI_BOOT_SCRIPT_IO_POLL);\r
+      break;\r
+\r
+    case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:\r
+      Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE);\r
+      break;\r
+\r
+    case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
+      Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL);\r
+      break;\r
+\r
+    case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
+      Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL);\r
+      break;\r
+\r
+    default:\r
+      return;\r
   }\r
 \r
   DataPtr = Script + Size;\r
 \r
   switch (ScriptHeader->Width) {\r
-  case S3BootScriptWidthUint8:\r
-    *AndMask  = (UINT64) (*(UINT8*) (DataPtr + 1));\r
-    *OrMask   = (UINT64) (*DataPtr);\r
-    break;\r
-\r
-  case S3BootScriptWidthUint16:\r
-    *AndMask  = (UINT64) (*(UINT16 *) (DataPtr + 2));\r
-    *OrMask   = (UINT64) (*(UINT16 *) DataPtr);\r
-    break;\r
-\r
-  case S3BootScriptWidthUint32:\r
-    *AndMask  = (UINT64) (*(UINT32 *) (DataPtr + 4));\r
-    *OrMask   = (UINT64) (*(UINT32 *) DataPtr);\r
-    break;\r
-\r
-  case S3BootScriptWidthUint64:\r
-    *AndMask  = (UINT64) (*(UINT64 *) (DataPtr + 8));\r
-    *OrMask   = (UINT64) (*(UINT64 *) DataPtr);\r
-    break;\r
-\r
-  default:\r
-    break;\r
+    case S3BootScriptWidthUint8:\r
+      *AndMask = (UINT64)(*(UINT8 *)(DataPtr + 1));\r
+      *OrMask  = (UINT64)(*DataPtr);\r
+      break;\r
+\r
+    case S3BootScriptWidthUint16:\r
+      *AndMask = (UINT64)(*(UINT16 *)(DataPtr + 2));\r
+      *OrMask  = (UINT64)(*(UINT16 *)DataPtr);\r
+      break;\r
+\r
+    case S3BootScriptWidthUint32:\r
+      *AndMask = (UINT64)(*(UINT32 *)(DataPtr + 4));\r
+      *OrMask  = (UINT64)(*(UINT32 *)DataPtr);\r
+      break;\r
+\r
+    case S3BootScriptWidthUint64:\r
+      *AndMask = (UINT64)(*(UINT64 *)(DataPtr + 8));\r
+      *OrMask  = (UINT64)(*(UINT64 *)DataPtr);\r
+      break;\r
+\r
+    default:\r
+      break;\r
   }\r
 \r
   return;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_IO_POLL OP code.\r
 \r
@@ -1337,40 +1364,41 @@ CheckAndOrMask (
 **/\r
 EFI_STATUS\r
 BootScriptExecuteIoPoll (\r
-  IN UINT8       *Script,\r
-  IN UINT64      AndMask,\r
-  IN UINT64      OrMask\r
+  IN UINT8   *Script,\r
+  IN UINT64  AndMask,\r
+  IN UINT64  OrMask\r
   )\r
 {\r
-  EFI_STATUS    Status;\r
-  UINT64        Data;\r
-  UINT64        LoopTimes;\r
-  EFI_BOOT_SCRIPT_IO_POLL       IoPoll;\r
+  EFI_STATUS               Status;\r
+  UINT64                   Data;\r
+  UINT64                   LoopTimes;\r
+  EFI_BOOT_SCRIPT_IO_POLL  IoPoll;\r
 \r
-  CopyMem ((VOID*)&IoPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_POLL));\r
+  CopyMem ((VOID *)&IoPoll, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_IO_POLL));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecuteIoPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoPoll.Address, AndMask, OrMask));\r
 \r
-  Data = 0;\r
+  Data   = 0;\r
   Status = ScriptIoRead (\r
-             (S3_BOOT_SCRIPT_LIB_WIDTH) IoPoll.Width,\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)IoPoll.Width,\r
              IoPoll.Address,\r
              1,\r
              &Data\r
              );\r
-  if ((!EFI_ERROR (Status)) && (Data & AndMask) == OrMask) {\r
+  if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {\r
     return EFI_SUCCESS;\r
   }\r
+\r
   for (LoopTimes = 0; LoopTimes < IoPoll.Delay; LoopTimes++) {\r
     NanoSecondDelay (100);\r
-    Data = 0;\r
+    Data   = 0;\r
     Status = ScriptIoRead (\r
-               (S3_BOOT_SCRIPT_LIB_WIDTH) IoPoll.Width,\r
+               (S3_BOOT_SCRIPT_LIB_WIDTH)IoPoll.Width,\r
                IoPoll.Address,\r
                1,\r
                &Data\r
                );\r
-    if ((!EFI_ERROR (Status)) &&(Data & AndMask) == OrMask) {\r
+    if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {\r
       return EFI_SUCCESS;\r
     }\r
   }\r
@@ -1381,6 +1409,7 @@ BootScriptExecuteIoPoll (
     return EFI_DEVICE_ERROR;\r
   }\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE OP code.\r
 \r
@@ -1391,29 +1420,28 @@ BootScriptExecuteIoPoll (
 **/\r
 EFI_STATUS\r
 BootScriptExecutePciCfg2Write (\r
-  IN UINT8             *Script\r
+  IN UINT8  *Script\r
   )\r
 {\r
-  VOID                              *Buffer;\r
-  S3_BOOT_SCRIPT_LIB_WIDTH          Width;\r
-  UINT16                            Segment;\r
-  UINT64                            Address;\r
-  UINTN                             Count;\r
-  EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE PciCfg2Write;\r
+  VOID                               *Buffer;\r
+  S3_BOOT_SCRIPT_LIB_WIDTH           Width;\r
+  UINT16                             Segment;\r
+  UINT64                             Address;\r
+  UINTN                              Count;\r
+  EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE  PciCfg2Write;\r
 \r
-  CopyMem ((VOID*)&PciCfg2Write, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE));\r
+  CopyMem ((VOID *)&PciCfg2Write, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE));\r
 \r
   Width   = (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfg2Write.Width;\r
   Segment = PciCfg2Write.Segment;\r
   Address = PciCfg2Write.Address;\r
   Count   = PciCfg2Write.Count;\r
-  Buffer  = Script + sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE);\r
+  Buffer  = Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE);\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecutePciCfg2Write - 0x%016lx, 0x%08x, 0x%08x\n", PCI_ADDRESS_ENCODE (Segment, Address), Count, (UINTN)Width));\r
   return ScriptPciCfg2Write (Width, Segment, Address, Count, Buffer);\r
 }\r
 \r
-\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE OP code.\r
 \r
@@ -1426,23 +1454,23 @@ BootScriptExecutePciCfg2Write (
 **/\r
 EFI_STATUS\r
 BootScriptExecutePciCfg2ReadWrite (\r
-  IN UINT8                        *Script,\r
-  IN UINT64                        AndMask,\r
-  IN UINT64                        OrMask\r
+  IN UINT8   *Script,\r
+  IN UINT64  AndMask,\r
+  IN UINT64  OrMask\r
   )\r
 {\r
-  UINT64      Data;\r
-  EFI_STATUS  Status;\r
-  EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE PciCfg2ReadWrite;\r
+  UINT64                                  Data;\r
+  EFI_STATUS                              Status;\r
+  EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE  PciCfg2ReadWrite;\r
 \r
   Data = 0;\r
 \r
-  CopyMem ((VOID*)&PciCfg2ReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE));\r
+  CopyMem ((VOID *)&PciCfg2ReadWrite, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptExecutePciCfg2ReadWrite - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfg2ReadWrite.Segment, PciCfg2ReadWrite.Address), AndMask, OrMask));\r
 \r
   Status = ScriptPciCfg2Read (\r
-             (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2ReadWrite.Width,\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfg2ReadWrite.Width,\r
              PciCfg2ReadWrite.Segment,\r
              PciCfg2ReadWrite.Address,\r
              1,\r
@@ -1452,9 +1480,9 @@ BootScriptExecutePciCfg2ReadWrite (
     return Status;\r
   }\r
 \r
-  Data = (Data & AndMask) | OrMask;\r
+  Data   = (Data & AndMask) | OrMask;\r
   Status = ScriptPciCfg2Write (\r
-             (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2ReadWrite.Width,\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfg2ReadWrite.Width,\r
              PciCfg2ReadWrite.Segment,\r
              PciCfg2ReadWrite.Address,\r
              1,\r
@@ -1462,6 +1490,7 @@ BootScriptExecutePciCfg2ReadWrite (
              );\r
   return Status;\r
 }\r
+\r
 /**\r
   Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_POLL OP code.\r
 \r
@@ -1475,41 +1504,43 @@ BootScriptExecutePciCfg2ReadWrite (
 **/\r
 EFI_STATUS\r
 BootScriptPciCfgPoll (\r
-  IN UINT8                         *Script,\r
-  IN UINT64                        AndMask,\r
-  IN UINT64                        OrMask\r
+  IN UINT8   *Script,\r
+  IN UINT64  AndMask,\r
+  IN UINT64  OrMask\r
   )\r
 {\r
-  UINT64        Data;\r
-  UINT64        LoopTimes;\r
-  EFI_STATUS    Status;\r
-  EFI_BOOT_SCRIPT_PCI_CONFIG_POLL PciCfgPoll;\r
-  CopyMem ((VOID*)&PciCfgPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_POLL));\r
+  UINT64                           Data;\r
+  UINT64                           LoopTimes;\r
+  EFI_STATUS                       Status;\r
+  EFI_BOOT_SCRIPT_PCI_CONFIG_POLL  PciCfgPoll;\r
+\r
+  CopyMem ((VOID *)&PciCfgPoll, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptPciCfgPoll - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (0, PciCfgPoll.Address), AndMask, OrMask));\r
 \r
-  Data = 0;\r
+  Data   = 0;\r
   Status = ScriptPciCfgRead (\r
-             (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgPoll.Width,\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfgPoll.Width,\r
              PciCfgPoll.Address,\r
              1,\r
              &Data\r
              );\r
-  if ((!EFI_ERROR (Status)) &&(Data & AndMask) == OrMask) {\r
+  if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {\r
     return EFI_SUCCESS;\r
   }\r
 \r
   for (LoopTimes = 0; LoopTimes < PciCfgPoll.Delay; LoopTimes++) {\r
     NanoSecondDelay (100);\r
-    Data = 0;\r
+    Data   = 0;\r
     Status = ScriptPciCfgRead (\r
-               (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgPoll.Width,\r
+               (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfgPoll.Width,\r
                PciCfgPoll.Address,\r
                1,\r
                &Data\r
                );\r
     if ((!EFI_ERROR (Status)) &&\r
-       (Data & AndMask) == OrMask) {\r
+        ((Data & AndMask) == OrMask))\r
+    {\r
       return EFI_SUCCESS;\r
     }\r
   }\r
@@ -1535,44 +1566,44 @@ BootScriptPciCfgPoll (
 **/\r
 EFI_STATUS\r
 BootScriptPciCfg2Poll (\r
-  IN UINT8                        *Script,\r
-  IN UINT64                        AndMask,\r
-  IN UINT64                        OrMask\r
+  IN UINT8   *Script,\r
+  IN UINT64  AndMask,\r
+  IN UINT64  OrMask\r
   )\r
 {\r
-  EFI_STATUS    Status;\r
-  UINT64        Data;\r
-  UINT64        LoopTimes;\r
-  EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL PciCfg2Poll;\r
+  EFI_STATUS                        Status;\r
+  UINT64                            Data;\r
+  UINT64                            LoopTimes;\r
+  EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL  PciCfg2Poll;\r
 \r
   Data = 0;\r
-  CopyMem ((VOID*)&PciCfg2Poll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL));\r
+  CopyMem ((VOID *)&PciCfg2Poll, (VOID *)Script, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL));\r
 \r
   DEBUG ((DEBUG_INFO, "BootScriptPciCfg2Poll - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfg2Poll.Segment, PciCfg2Poll.Address), AndMask, OrMask));\r
 \r
   Status = ScriptPciCfg2Read (\r
-             (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width,\r
+             (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfg2Poll.Width,\r
              PciCfg2Poll.Segment,\r
              PciCfg2Poll.Address,\r
              1,\r
              &Data\r
              );\r
-  if ((!EFI_ERROR (Status)) && (Data & AndMask) == OrMask) {\r
+  if ((!EFI_ERROR (Status)) && ((Data & AndMask) == OrMask)) {\r
     return EFI_SUCCESS;\r
   }\r
 \r
   for (LoopTimes = 0; LoopTimes < PciCfg2Poll.Delay; LoopTimes++) {\r
     NanoSecondDelay (100);\r
 \r
-    Data = 0;\r
+    Data   = 0;\r
     Status = ScriptPciCfg2Read (\r
-               (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width,\r
+               (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfg2Poll.Width,\r
                PciCfg2Poll.Segment,\r
                PciCfg2Poll.Address,\r
                1,\r
                &Data\r
                );\r
-    if ((!EFI_ERROR (Status)) &&  (Data & AndMask) == OrMask) {\r
+    if ((!EFI_ERROR (Status)) &&  ((Data & AndMask) == OrMask)) {\r
       return EFI_SUCCESS;\r
     }\r
   }\r
@@ -1582,7 +1613,6 @@ BootScriptPciCfg2Poll (
   } else {\r
     return EFI_DEVICE_ERROR;\r
   }\r
-\r
 }\r
 \r
 /**\r
@@ -1598,17 +1628,18 @@ S3BootScriptExecute (
   VOID\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
-  UINT8*                Script;\r
-  UINTN                 StartAddress;\r
-  UINT32                TableLength;\r
-  UINT64                AndMask;\r
-  UINT64                OrMask;\r
+  EFI_STATUS                     Status;\r
+  UINT8                          *Script;\r
+  UINTN                          StartAddress;\r
+  UINT32                         TableLength;\r
+  UINT64                         AndMask;\r
+  UINT64                         OrMask;\r
   EFI_BOOT_SCRIPT_COMMON_HEADER  ScriptHeader;\r
   EFI_BOOT_SCRIPT_TABLE_HEADER   TableHeader;\r
+\r
   Script = mS3BootScriptTablePtr->TableBase;\r
   if (Script != 0) {\r
-    CopyMem ((VOID*)&TableHeader, Script, sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER));\r
+    CopyMem ((VOID *)&TableHeader, Script, sizeof (EFI_BOOT_SCRIPT_TABLE_HEADER));\r
   } else {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -1620,145 +1651,144 @@ S3BootScriptExecute (
 \r
   DEBUG ((DEBUG_INFO, "TableHeader - 0x%08x\n", Script));\r
 \r
-  StartAddress  = (UINTN) Script;\r
-  TableLength   = TableHeader.TableLength;\r
-  Script    =    Script + TableHeader.Length;\r
-  Status        = EFI_SUCCESS;\r
-  AndMask       = 0;\r
-  OrMask        = 0;\r
+  StartAddress = (UINTN)Script;\r
+  TableLength  = TableHeader.TableLength;\r
+  Script       =    Script + TableHeader.Length;\r
+  Status       = EFI_SUCCESS;\r
+  AndMask      = 0;\r
+  OrMask       = 0;\r
 \r
   DEBUG ((DEBUG_INFO, "TableHeader.Version - 0x%04x\n", (UINTN)TableHeader.Version));\r
   DEBUG ((DEBUG_INFO, "TableHeader.TableLength - 0x%08x\n", (UINTN)TableLength));\r
 \r
-  while ((UINTN) Script < (UINTN) (StartAddress + TableLength)) {\r
+  while ((UINTN)Script < (UINTN)(StartAddress + TableLength)) {\r
     DEBUG ((DEBUG_INFO, "ExecuteBootScript - %08x\n", (UINTN)Script));\r
 \r
-    CopyMem ((VOID*)&ScriptHeader, Script, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER));\r
+    CopyMem ((VOID *)&ScriptHeader, Script, sizeof (EFI_BOOT_SCRIPT_COMMON_HEADER));\r
     switch (ScriptHeader.OpCode) {\r
+      case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE\n"));\r
+        Status = BootScriptExecuteMemoryWrite (Script);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE\n"));\r
-      Status = BootScriptExecuteMemoryWrite (Script);\r
-      break;\r
-\r
-    case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE\n"));\r
-      CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
-      Status = BootScriptExecuteMemoryReadWrite (\r
-                 Script,\r
-                 AndMask,\r
-                 OrMask\r
-                 );\r
-      break;\r
+      case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE\n"));\r
+        CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
+        Status = BootScriptExecuteMemoryReadWrite (\r
+                   Script,\r
+                   AndMask,\r
+                   OrMask\r
+                   );\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_IO_WRITE_OPCODE\n"));\r
-      Status = BootScriptExecuteIoWrite (Script);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_IO_WRITE_OPCODE\n"));\r
+        Status = BootScriptExecuteIoWrite (Script);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE\n"));\r
-      Status = BootScriptExecutePciCfgWrite (Script);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE\n"));\r
+        Status = BootScriptExecutePciCfgWrite (Script);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE\n"));\r
-      CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
-      Status = BootScriptExecutePciCfgReadWrite (\r
-                 Script,\r
-                 AndMask,\r
-                 OrMask\r
-                 );\r
-      break;\r
-    case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE\n"));\r
-      Status = BootScriptExecutePciCfg2Write (Script);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE\n"));\r
+        CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
+        Status = BootScriptExecutePciCfgReadWrite (\r
+                   Script,\r
+                   AndMask,\r
+                   OrMask\r
+                   );\r
+        break;\r
+      case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE\n"));\r
+        Status = BootScriptExecutePciCfg2Write (Script);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE\n"));\r
-      CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
-      Status = BootScriptExecutePciCfg2ReadWrite (\r
-                 Script,\r
-                 AndMask,\r
-                 OrMask\r
-                 );\r
-      break;\r
-    case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_DISPATCH_OPCODE\n"));\r
-      Status = BootScriptExecuteDispatch (Script);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE\n"));\r
+        CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
+        Status = BootScriptExecutePciCfg2ReadWrite (\r
+                   Script,\r
+                   AndMask,\r
+                   OrMask\r
+                   );\r
+        break;\r
+      case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_DISPATCH_OPCODE\n"));\r
+        Status = BootScriptExecuteDispatch (Script);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE\n"));\r
-      Status = BootScriptExecuteDispatch2 (Script);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE\n"));\r
+        Status = BootScriptExecuteDispatch2 (Script);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_INFORMATION_OPCODE\n"));\r
-      BootScriptExecuteInformation (Script);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_INFORMATION_OPCODE\n"));\r
+        BootScriptExecuteInformation (Script);\r
+        break;\r
 \r
-    case S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE\n"));\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptDone - %r\n", EFI_SUCCESS));\r
-      return EFI_SUCCESS;\r
+      case S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE\n"));\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptDone - %r\n", EFI_SUCCESS));\r
+        return EFI_SUCCESS;\r
+\r
+      case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE\n"));\r
+        CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
+        Status = BootScriptExecuteIoReadWrite (\r
+                   Script,\r
+                   AndMask,\r
+                   OrMask\r
+                   );\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE\n"));\r
-      CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
-      Status = BootScriptExecuteIoReadWrite (\r
-                Script,\r
-                AndMask,\r
-                OrMask\r
-                );\r
-      break;\r
+      case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE\n"));\r
+        Status = BootScriptExecuteSmbusExecute (Script);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE\n"));\r
-      Status = BootScriptExecuteSmbusExecute (Script);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_STALL_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_STALL_OPCODE\n"));\r
+        Status = BootScriptExecuteStall (Script);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_STALL_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_STALL_OPCODE\n"));\r
-      Status = BootScriptExecuteStall (Script);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_MEM_POLL_OPCODE\n"));\r
+        CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
+        Status = BootScriptExecuteMemPoll (Script, AndMask, OrMask);\r
 \r
-    case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_MEM_POLL_OPCODE\n"));\r
-      CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
-      Status = BootScriptExecuteMemPoll (Script, AndMask, OrMask);\r
+        break;\r
 \r
-      break;\r
+      case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_IO_POLL_OPCODE\n"));\r
+        CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
+        Status = BootScriptExecuteIoPoll (Script, AndMask, OrMask);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_IO_POLL_OPCODE\n"));\r
-      CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
-      Status = BootScriptExecuteIoPoll (Script, AndMask, OrMask);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE\n"));\r
+        CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
+        Status = BootScriptPciCfgPoll (Script, AndMask, OrMask);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
-      DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE\n"));\r
-      CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
-      Status = BootScriptPciCfgPoll (Script, AndMask, OrMask);\r
-      break;\r
+      case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
+        DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE\n"));\r
+        CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
+        Status = BootScriptPciCfg2Poll (Script, AndMask, OrMask);\r
+        break;\r
 \r
-    case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
-     DEBUG ((DEBUG_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE\n"));\r
-     CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
-     Status = BootScriptPciCfg2Poll (Script, AndMask, OrMask);\r
-     break;\r
-\r
-    case S3_BOOT_SCRIPT_LIB_LABEL_OPCODE:\r
-      //\r
-      // For label\r
-      //\r
-      DEBUG ((DEBUG_INFO, "S3_BOOT_SCRIPT_LIB_LABEL_OPCODE\n"));\r
-      BootScriptExecuteLabel (Script);\r
-      break;\r
-    default:\r
-      DEBUG ((DEBUG_INFO, "S3BootScriptDone - %r\n", EFI_UNSUPPORTED));\r
-      return EFI_UNSUPPORTED;\r
+      case S3_BOOT_SCRIPT_LIB_LABEL_OPCODE:\r
+        //\r
+        // For label\r
+        //\r
+        DEBUG ((DEBUG_INFO, "S3_BOOT_SCRIPT_LIB_LABEL_OPCODE\n"));\r
+        BootScriptExecuteLabel (Script);\r
+        break;\r
+      default:\r
+        DEBUG ((DEBUG_INFO, "S3BootScriptDone - %r\n", EFI_UNSUPPORTED));\r
+        return EFI_UNSUPPORTED;\r
     }\r
 \r
     if (EFI_ERROR (Status)) {\r
@@ -1766,7 +1796,7 @@ S3BootScriptExecute (
       return Status;\r
     }\r
 \r
-    Script  = Script + ScriptHeader.Length;\r
+    Script = Script + ScriptHeader.Length;\r
   }\r
 \r
   DEBUG ((DEBUG_INFO, "S3BootScriptDone - %r\n", Status));\r