Changeset 80721 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal
- Timestamp:
- Sep 11, 2019 8:46:37 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 133262
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 4 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-129237 /vendor/edk2/current 103735-103757,103769-103776,129194-133213
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/Ia32/AsmFuncs.nasm
r77662 r80721 1 1 ;------------------------------------------------------------------------------ ; 2 2 ; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 3 ; This program and the accompanying materials 4 ; are licensed and made available under the terms and conditions of the BSD License 5 ; which accompanies this distribution. The full text of the license may be found at 6 ; http://opensource.org/licenses/bsd-license.php. 7 ; 8 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 9 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 3 ; SPDX-License-Identifier: BSD-2-Clause-Patent 10 4 ; 11 5 ; Module Name: -
trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
r77662 r80721 5 5 control is passed to OS waking up handler. 6 6 7 Copyright (c) 2006 - 201 8, Intel Corporation. All rights reserved.<BR>7 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> 8 8 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR> 9 9 10 This program and the accompanying materials 11 are licensed and made available under the terms and conditions 12 of the BSD License which accompanies this distribution. The 13 full text of the license may be found at 14 http://opensource.org/licenses/bsd-license.php 15 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 10 SPDX-License-Identifier: BSD-2-Clause-Patent 18 11 19 12 **/ … … 26 19 #include <Guid/EndOfS3Resume.h> 27 20 #include <Guid/S3SmmInitDone.h> 28 #include <Ppi/ReadOnlyVariable2.h>29 21 #include <Ppi/S3Resume2.h> 30 22 #include <Ppi/SmmAccess.h> … … 35 27 #include <Library/DebugLib.h> 36 28 #include <Library/BaseLib.h> 37 #include <Library/TimerLib.h>38 29 #include <Library/PeimEntryPoint.h> 39 30 #include <Library/PeiServicesLib.h> … … 48 39 #include <Library/LocalApicLib.h> 49 40 #include <Library/ReportStatusCodeLib.h> 50 #include <Library/PrintLib.h> 41 51 42 #include <Library/HobLib.h> 52 43 #include <Library/LockBoxLib.h> … … 319 310 if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) && 320 311 ((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0) && 321 ((Facs-> Flags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0)) {312 ((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0)) { 322 313 // Both BIOS and OS wants 64bit vector 323 314 if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { … … 431 422 // 432 423 433 PERF_ END (NULL, "ScriptExec", NULL, 0);424 PERF_INMODULE_END ("ScriptExec"); 434 425 435 426 // 436 427 // Install BootScriptDonePpi 437 428 // 438 PERF_ START_EX (NULL, "BootScriptDonePpi", NULL, 0, PERF_INMODULE_START_ID);429 PERF_INMODULE_BEGIN ("BootScriptDonePpi"); 439 430 440 431 Status = PeiServicesInstallPpi (&mPpiListPostScriptTable); 441 432 ASSERT_EFI_ERROR (Status); 442 433 443 PERF_ END_EX (NULL, "BootScriptDonePpi", NULL, 0, PERF_INMODULE_END_ID);434 PERF_INMODULE_END ("BootScriptDonePpi"); 444 435 445 436 // … … 465 456 // Install EndOfPeiPpi 466 457 // 467 PERF_ START_EX (NULL, "EndOfPeiPpi", NULL, 0, PERF_INMODULE_START_ID);458 PERF_INMODULE_BEGIN("EndOfPeiPpi"); 468 459 469 460 Status = PeiServicesInstallPpi (&mPpiListEndOfPeiTable); 470 461 ASSERT_EFI_ERROR (Status); 471 462 472 PERF_ END_EX (NULL, "EndOfPeiPpi", NULL, 0, PERF_INMODULE_END_ID);473 474 PERF_ START_EX (NULL, "EndOfS3Resume", NULL, 0, PERF_INMODULE_START_ID);463 PERF_INMODULE_END("EndOfPeiPpi"); 464 465 PERF_INMODULE_BEGIN("EndOfS3Resume"); 475 466 476 467 DEBUG ((DEBUG_INFO, "Signal EndOfS3Resume\n")); … … 480 471 SignalToSmmByCommunication (&gEdkiiEndOfS3ResumeGuid); 481 472 482 PERF_ END_EX (NULL, "EndOfS3Resume", NULL, 0, PERF_INMODULE_END_ID);473 PERF_INMODULE_END ("EndOfS3Resume"); 483 474 484 475 // … … 502 493 if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) && 503 494 ((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0) && 504 ((Facs-> Flags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0)) {495 ((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0)) { 505 496 // 506 497 // X64 long mode waking vector … … 726 717 return ; 727 718 } else { 728 729 730 719 // 720 // If DXE is running 32-bit mode, no need to establish page table. 721 // 731 722 return ; 732 723 } … … 753 744 UINTN Index; 754 745 VOID *GuidHob; 755 IA32_DESCRIPTOR *IdtDescriptor;756 VOID *IdtBuffer;757 746 PEI_S3_RESUME_STATE *PeiS3ResumeState; 758 747 BOOLEAN InterruptStatus; … … 814 803 } 815 804 816 if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) {817 //818 // On some platform, such as ECP, a dispatch node in boot script table may execute a 32-bit PEIM which may need PeiServices819 // pointer. So PeiServices need preserve in (IDTBase- sizeof (UINTN)).820 //821 IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);822 //823 // Make sure the newly allocated IDT align with 16-bytes824 //825 IdtBuffer = AllocatePages (EFI_SIZE_TO_PAGES((IdtDescriptor->Limit + 1) + 16));826 if (IdtBuffer == NULL) {827 REPORT_STATUS_CODE (828 EFI_ERROR_CODE | EFI_ERROR_MAJOR,829 (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_FAILED)830 );831 ASSERT (FALSE);832 }833 //834 // Additional 16 bytes allocated to save IA32 IDT descriptor and Pei Service Table Pointer835 // IA32 IDT descriptor will be used to setup IA32 IDT table for 32-bit Framework Boot Script code836 //837 ZeroMem (IdtBuffer, 16);838 AsmReadIdtr ((IA32_DESCRIPTOR *)IdtBuffer);839 CopyMem ((VOID*)((UINT8*)IdtBuffer + 16),(VOID*)(IdtDescriptor->Base), (IdtDescriptor->Limit + 1));840 IdtDescriptor->Base = (UINTN)((UINT8*)IdtBuffer + 16);841 *(UINTN*)(IdtDescriptor->Base - sizeof(UINTN)) = (UINTN)GetPeiServicesTablePointer ();842 }843 844 805 InterruptStatus = SaveAndDisableInterrupts (); 845 806 // … … 881 842 REPORT_STATUS_CODE (EFI_PROGRESS_CODE, EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_S3_BOOT_SCRIPT); 882 843 883 PERF_ START (NULL, "ScriptExec", NULL, 0);844 PERF_INMODULE_BEGIN ("ScriptExec"); 884 845 885 846 if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { … … 967 928 BOOLEAN Build4GPageTableOnly; 968 929 BOOLEAN InterruptStatus; 930 IA32_CR0 Cr0; 969 931 970 932 TempAcpiS3Context = 0; … … 1048 1010 GuidHob = GetFirstGuidHob (&gEfiAcpiVariableGuid); 1049 1011 if (GuidHob != NULL) { 1012 // 1013 // Below SwitchStack/AsmEnablePaging64 function has 1014 // assumption that it's in 32 bits mode now. 1015 // Add ASSERT code to indicate this assumption. 1016 // 1017 ASSERT(sizeof (UINTN) == sizeof (UINT32)); 1018 1050 1019 Status = PeiServicesLocatePpi ( 1051 1020 &gPeiSmmAccessPpiGuid, … … 1108 1077 SetInterruptState (InterruptStatus); 1109 1078 1079 Cr0.UintN = AsmReadCr0 (); 1080 if (Cr0.Bits.PG != 0) { 1081 // 1082 // We're in 32-bit mode, with paging enabled. We can't set CR3 to 1083 // the 64-bit page tables without first disabling paging. 1084 // 1085 Cr0.Bits.PG = 0; 1086 AsmWriteCr0 (Cr0.UintN); 1087 } 1110 1088 AsmWriteCr3 ((UINTN)SmmS3ResumeState->SmmS3Cr3); 1111 1089 -
trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
r77662 r80721 6 6 # control is passed to OS waking up handler. 7 7 # 8 # Copyright (c) 2010 - 201 8, Intel Corporation. All rights reserved.<BR>8 # Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR> 9 9 # Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR> 10 10 # 11 # This program and the accompanying materials are 12 # licensed and made available under the terms and conditions of the BSD License 13 # which accompanies this distribution. The full text of the license may be found at 14 # http://opensource.org/licenses/bsd-license.php 15 # 16 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 # SPDX-License-Identifier: BSD-2-Clause-Patent 18 12 # 19 13 ## … … 34 28 # 35 29 30 # 31 # This module is not always workable in IA32 and X64 mode. It has below result: 32 # when it works with SMM mode: 33 # =============================== 34 # SMM:used SMM:unused 35 # PEI:IA32 works works 36 # PEI:X64 fails works 37 # =============================== 38 # 39 36 40 [Sources] 37 41 S3Resume.c 38 42 39 43 [Sources.IA32] 40 Ia32/AsmFuncs.asm41 44 Ia32/AsmFuncs.nasm 42 Ia32/AsmFuncs.S43 45 44 46 [Sources.X64] 45 X64/AsmFuncs.asm46 47 X64/AsmFuncs.nasm 47 X64/AsmFuncs.S48 48 49 49 [Packages] … … 58 58 PeiServicesLib 59 59 PeimEntryPoint 60 TimerLib61 60 BaseLib 62 61 DebugLib … … 69 68 ReportStatusCodeLib 70 69 LockBoxLib 71 PrintLib72 70 73 71 [Guids] … … 84 82 85 83 [Ppis] 86 gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES87 84 gEfiPeiS3Resume2PpiGuid ## PRODUCES 88 85 gPeiSmmAccessPpiGuid ## SOMETIMES_CONSUMES … … 93 90 [FeaturePcd] 94 91 gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES 95 gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport ## CONSUMES96 92 97 93 [Pcd] -
trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.uni
r77662 r80721 6 6 // control is passed to OS waking up handler. 7 7 // 8 // Copyright (c) 2010 - 201 4, Intel Corporation. All rights reserved.<BR>8 // Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> 9 9 // 10 // This program and the accompanying materials are 11 // licensed and made available under the terms and conditions of the BSD License 12 // which accompanies this distribution. The full text of the license may be found at 13 // http://opensource.org/licenses/bsd-license.php 14 // 15 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 10 // SPDX-License-Identifier: BSD-2-Clause-Patent 17 11 // 18 12 // **/ -
trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2PeiExtra.uni
r77662 r80721 2 2 // S3Resume2Pei Localized Strings and Content 3 3 // 4 // Copyright (c) 2013 - 201 4, Intel Corporation. All rights reserved.<BR>4 // Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR> 5 5 // 6 // This program and the accompanying materials are 7 // licensed and made available under the terms and conditions of the BSD License 8 // which accompanies this distribution. The full text of the license may be found at 9 // http://opensource.org/licenses/bsd-license.php 10 // 11 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 6 // SPDX-License-Identifier: BSD-2-Clause-Patent 13 7 // 14 8 // **/ 15 9 16 #string STR_PROPERTIES_MODULE_NAME 17 #language en-US 10 #string STR_PROPERTIES_MODULE_NAME 11 #language en-US 18 12 "S3 Resume v2 PEI Module" 19 13 -
trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/X64/AsmFuncs.nasm
r77662 r80721 1 1 ;------------------------------------------------------------------------------ ; 2 2 ; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 3 ; This program and the accompanying materials 4 ; are licensed and made available under the terms and conditions of the BSD License 5 ; which accompanies this distribution. The full text of the license may be found at 6 ; http://opensource.org/licenses/bsd-license.php. 7 ; 8 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 9 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 3 ; SPDX-License-Identifier: BSD-2-Clause-Patent 10 4 ; 11 5 ; Module Name:
Note:
See TracChangeset
for help on using the changeset viewer.