]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
UefiCpuPkg: Clean up source files
[mirror_edk2.git] / UefiCpuPkg / Universal / Acpi / S3Resume2Pei / S3Resume.c
index d3cb07cd2d03e95bd6c19d0deb6d9b81b1d6610b..28e53ac5d334c2b32ecdb606ec1609965c6901c1 100644 (file)
@@ -118,7 +118,7 @@ typedef union {
     UINT64  CacheDisabled:1;          // 0 = Cached, 1=Non-Cached\r
     UINT64  Accessed:1;               // 0 = Not accessed, 1 = Accessed (set by CPU)\r
     UINT64  Dirty:1;                  // 0 = Not Dirty, 1 = written by processor on access to page\r
-    UINT64  MustBe1:1;                // Must be 1 \r
+    UINT64  MustBe1:1;                // Must be 1\r
     UINT64  Global:1;                 // 0 = Not global page, 1 = global page TLB not cleared on CR3 write\r
     UINT64  Available:3;              // Available for use by system software\r
     UINT64  PAT:1;                    //\r
@@ -142,7 +142,7 @@ typedef union {
     UINT64  CacheDisabled:1;          // 0 = Cached, 1=Non-Cached\r
     UINT64  Accessed:1;               // 0 = Not accessed, 1 = Accessed (set by CPU)\r
     UINT64  Dirty:1;                  // 0 = Not Dirty, 1 = written by processor on access to page\r
-    UINT64  MustBe1:1;                // Must be 1 \r
+    UINT64  MustBe1:1;                // Must be 1\r
     UINT64  Global:1;                 // 0 = Not global page, 1 = global page TLB not cleared on CR3 write\r
     UINT64  Available:3;              // Available for use by system software\r
     UINT64  PAT:1;                    //\r
@@ -177,9 +177,9 @@ typedef struct {
 //\r
 /**\r
   a ASM function to transfer control to OS.\r
-  \r
+\r
   @param  S3WakingVector  The S3 waking up vector saved in ACPI Facs table\r
-  @param  AcpiLowMemoryBase a buffer under 1M which could be used during the transfer             \r
+  @param  AcpiLowMemoryBase a buffer under 1M which could be used during the transfer\r
 **/\r
 typedef\r
 VOID\r
@@ -425,7 +425,7 @@ S3ResumeBootOs (
   }\r
 \r
   //\r
-  // NOTE: Because Debug Timer interrupt and system interrupts will be disabled \r
+  // NOTE: Because Debug Timer interrupt and system interrupts will be disabled\r
   // in BootScriptExecuteDxe, the rest code in S3ResumeBootOs() cannot be halted\r
   // by soft debugger.\r
   //\r
@@ -563,7 +563,7 @@ S3ResumeBootOs (
 \r
 /**\r
   Restore S3 page table because we do not trust ACPINvs content.\r
-  If BootScriptExector driver will not run in 64-bit mode, this function will do nothing. \r
+  If BootScriptExector driver will not run in 64-bit mode, this function will do nothing.\r
 \r
   @param S3NvsPageTableAddress   PageTableAddress in ACPINvs\r
   @param Build4GPageTableOnly    If BIOS just build 4G page table only\r
@@ -611,7 +611,7 @@ RestoreS3PageTables (
     //\r
     PageMap = (PAGE_MAP_AND_DIRECTORY_POINTER *)S3NvsPageTableAddress;\r
     S3NvsPageTableAddress += SIZE_4KB;\r
-    \r
+\r
     Page1GSupport = FALSE;\r
     if (PcdGetBool(PcdUse1GPageTable)) {\r
       AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);\r
@@ -622,7 +622,7 @@ RestoreS3PageTables (
         }\r
       }\r
     }\r
-    \r
+\r
     //\r
     // Get physical address bits supported.\r
     //\r
@@ -638,7 +638,7 @@ RestoreS3PageTables (
         PhysicalAddressBits = 36;\r
       }\r
     }\r
-    \r
+\r
     //\r
     // IA-32e paging translates 48-bit linear addresses to 52-bit physical addresses.\r
     //\r
@@ -665,7 +665,7 @@ RestoreS3PageTables (
       NumberOfPml4EntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 39));\r
       NumberOfPdpEntriesNeeded = 512;\r
     }\r
-    \r
+\r
     PageMapLevel4Entry = PageMap;\r
     PageAddress        = 0;\r
     for (IndexOfPml4Entries = 0; IndexOfPml4Entries < NumberOfPml4EntriesNeeded; IndexOfPml4Entries++, PageMapLevel4Entry++) {\r
@@ -675,7 +675,7 @@ RestoreS3PageTables (
       //\r
       PageDirectoryPointerEntry = (PAGE_MAP_AND_DIRECTORY_POINTER *)S3NvsPageTableAddress;\r
       S3NvsPageTableAddress += SIZE_4KB;\r
-    \r
+\r
       //\r
       // Make a PML4 Entry\r
       //\r
@@ -685,7 +685,7 @@ RestoreS3PageTables (
 \r
       if (Page1GSupport) {\r
         PageDirectory1GEntry = (VOID *) PageDirectoryPointerEntry;\r
-    \r
+\r
         for (IndexOfPageDirectoryEntries = 0; IndexOfPageDirectoryEntries < 512; IndexOfPageDirectoryEntries++, PageDirectory1GEntry++, PageAddress += SIZE_1GB) {\r
           //\r
           // Fill in the Page Directory entries\r
@@ -700,17 +700,17 @@ RestoreS3PageTables (
           //\r
           // Each Directory Pointer entries points to a page of Page Directory entires.\r
           // So allocate space for them and fill them in in the IndexOfPageDirectoryEntries loop.\r
-          //       \r
+          //\r
           PageDirectoryEntry = (PAGE_TABLE_ENTRY *)S3NvsPageTableAddress;\r
           S3NvsPageTableAddress += SIZE_4KB;\r
-    \r
+\r
           //\r
           // Fill in a Page Directory Pointer Entries\r
           //\r
           PageDirectoryPointerEntry->Uint64 = (UINT64)(UINTN)PageDirectoryEntry | AddressEncMask;\r
           PageDirectoryPointerEntry->Bits.ReadWrite = 1;\r
           PageDirectoryPointerEntry->Bits.Present = 1;\r
-    \r
+\r
           for (IndexOfPageDirectoryEntries = 0; IndexOfPageDirectoryEntries < 512; IndexOfPageDirectoryEntries++, PageDirectoryEntry++, PageAddress += SIZE_2MB) {\r
             //\r
             // Fill in the Page Directory entries\r
@@ -725,9 +725,9 @@ RestoreS3PageTables (
     }\r
     return ;\r
   } else {\r
-       //\r
-       // If DXE is running 32-bit mode, no need to establish page table.\r
-       //\r
+    //\r
+    // If DXE is running 32-bit mode, no need to establish page table.\r
+    //\r
     return ;\r
   }\r
 }\r
@@ -770,7 +770,7 @@ S3ResumeExecuteBootScript (
 \r
     //\r
     // Send SMI to APs\r
-    //    \r
+    //\r
     SendSmiIpiAllExcludingSelf ();\r
     //\r
     // Send SMI to BSP\r
@@ -785,13 +785,13 @@ S3ResumeExecuteBootScript (
                               );\r
     if (!EFI_ERROR (Status)) {\r
       DEBUG ((DEBUG_INFO, "Close all SMRAM regions before executing boot script\n"));\r
-  \r
+\r
       for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {\r
         Status = SmmAccess->Close ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);\r
       }\r
 \r
       DEBUG ((DEBUG_INFO, "Lock all SMRAM regions before executing boot script\n"));\r
-  \r
+\r
       for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {\r
         Status = SmmAccess->Lock ((EFI_PEI_SERVICES **)GetPeiServicesTablePointer (), SmmAccess, Index);\r
       }\r
@@ -816,12 +816,12 @@ S3ResumeExecuteBootScript (
   if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) {\r
     //\r
     // On some platform, such as ECP, a dispatch node in boot script table may execute a 32-bit PEIM which may need PeiServices\r
-    // pointer. So PeiServices need preserve in (IDTBase- sizeof (UINTN)). \r
+    // pointer. So PeiServices need preserve in (IDTBase- sizeof (UINTN)).\r
     //\r
     IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);\r
     //\r
     // Make sure the newly allocated IDT align with 16-bytes\r
-    // \r
+    //\r
     IdtBuffer = AllocatePages (EFI_SIZE_TO_PAGES((IdtDescriptor->Limit + 1) + 16));\r
     if (IdtBuffer == NULL) {\r
       REPORT_STATUS_CODE (\r
@@ -833,7 +833,7 @@ S3ResumeExecuteBootScript (
     //\r
     // Additional 16 bytes allocated to save IA32 IDT descriptor and Pei Service Table Pointer\r
     // IA32 IDT descriptor will be used to setup IA32 IDT table for 32-bit Framework Boot Script code\r
-    // \r
+    //\r
     ZeroMem (IdtBuffer, 16);\r
     AsmReadIdtr ((IA32_DESCRIPTOR *)IdtBuffer);\r
     CopyMem ((VOID*)((UINT8*)IdtBuffer + 16),(VOID*)(IdtDescriptor->Base), (IdtDescriptor->Limit + 1));\r
@@ -874,7 +874,7 @@ S3ResumeExecuteBootScript (
   // Save IDT\r
   //\r
   AsmReadIdtr (&PeiS3ResumeState->Idtr);\r
-  \r
+\r
   //\r
   // Report Status Code to indicate S3 boot script execution\r
   //\r
@@ -1011,7 +1011,7 @@ S3RestoreConfig2 (
   DEBUG (( DEBUG_INFO, "AcpiS3Context = %x\n", AcpiS3Context));\r
   DEBUG (( DEBUG_INFO, "Waking Vector = %x\n", ((EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) ((UINTN) (AcpiS3Context->AcpiFacsTable)))->FirmwareWakingVector));\r
   DEBUG (( DEBUG_INFO, "AcpiS3Context->AcpiFacsTable = %x\n", AcpiS3Context->AcpiFacsTable));\r
-  DEBUG (( DEBUG_INFO, "AcpiS3Context->IdtrProfile = %x\n", AcpiS3Context->IdtrProfile));  \r
+  DEBUG (( DEBUG_INFO, "AcpiS3Context->IdtrProfile = %x\n", AcpiS3Context->IdtrProfile));\r
   DEBUG (( DEBUG_INFO, "AcpiS3Context->S3NvsPageTableAddress = %x\n", AcpiS3Context->S3NvsPageTableAddress));\r
   DEBUG (( DEBUG_INFO, "AcpiS3Context->S3DebugBufferAddress = %x\n", AcpiS3Context->S3DebugBufferAddress));\r
   DEBUG (( DEBUG_INFO, "AcpiS3Context->BootScriptStackBase = %x\n", AcpiS3Context->BootScriptStackBase));\r
@@ -1100,7 +1100,7 @@ S3RestoreConfig2 (
       AsmWriteGdtr (&mGdt);\r
       //\r
       // update segment selectors per the new GDT.\r
-      //      \r
+      //\r
       AsmSetDataSelectors (DATA_SEGEMENT_SELECTOR);\r
       //\r
       // Restore interrupt state.\r
@@ -1134,7 +1134,7 @@ S3RestoreConfig2 (
   Main entry for S3 Resume PEIM.\r
 \r
   This routine is to install EFI_PEI_S3_RESUME2_PPI.\r
-  \r
+\r
   @param  FileHandle              Handle of the file being invoked.\r
   @param  PeiServices             Pointer to PEI Services table.\r
 \r