VirtualBox

Ignore:
Timestamp:
Sep 11, 2019 8:46:37 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133262
Message:

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
4 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/Ia32/AsmFuncs.nasm

    r77662 r80721  
    11;------------------------------------------------------------------------------ ;
    22; 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
    104;
    115; Module Name:
  • trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c

    r77662 r80721  
    55  control is passed to OS waking up handler.
    66
    7   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
     7  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
    88  Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
    99
    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
    1811
    1912**/
     
    2619#include <Guid/EndOfS3Resume.h>
    2720#include <Guid/S3SmmInitDone.h>
    28 #include <Ppi/ReadOnlyVariable2.h>
    2921#include <Ppi/S3Resume2.h>
    3022#include <Ppi/SmmAccess.h>
     
    3527#include <Library/DebugLib.h>
    3628#include <Library/BaseLib.h>
    37 #include <Library/TimerLib.h>
    3829#include <Library/PeimEntryPoint.h>
    3930#include <Library/PeiServicesLib.h>
     
    4839#include <Library/LocalApicLib.h>
    4940#include <Library/ReportStatusCodeLib.h>
    50 #include <Library/PrintLib.h>
     41
    5142#include <Library/HobLib.h>
    5243#include <Library/LockBoxLib.h>
     
    319310    if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
    320311        ((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)) {
    322313      // Both BIOS and OS wants 64bit vector
    323314      if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
     
    431422  //
    432423
    433   PERF_END (NULL, "ScriptExec", NULL, 0);
     424  PERF_INMODULE_END ("ScriptExec");
    434425
    435426  //
    436427  // Install BootScriptDonePpi
    437428  //
    438   PERF_START_EX (NULL, "BootScriptDonePpi", NULL, 0, PERF_INMODULE_START_ID);
     429  PERF_INMODULE_BEGIN ("BootScriptDonePpi");
    439430
    440431  Status = PeiServicesInstallPpi (&mPpiListPostScriptTable);
    441432  ASSERT_EFI_ERROR (Status);
    442433
    443   PERF_END_EX (NULL, "BootScriptDonePpi", NULL, 0, PERF_INMODULE_END_ID);
     434  PERF_INMODULE_END ("BootScriptDonePpi");
    444435
    445436  //
     
    465456  // Install EndOfPeiPpi
    466457  //
    467   PERF_START_EX (NULL, "EndOfPeiPpi", NULL, 0, PERF_INMODULE_START_ID);
     458  PERF_INMODULE_BEGIN("EndOfPeiPpi");
    468459
    469460  Status = PeiServicesInstallPpi (&mPpiListEndOfPeiTable);
    470461  ASSERT_EFI_ERROR (Status);
    471462
    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");
    475466
    476467  DEBUG ((DEBUG_INFO, "Signal EndOfS3Resume\n"));
     
    480471  SignalToSmmByCommunication (&gEdkiiEndOfS3ResumeGuid);
    481472
    482   PERF_END_EX (NULL, "EndOfS3Resume", NULL, 0, PERF_INMODULE_END_ID);
     473  PERF_INMODULE_END ("EndOfS3Resume");
    483474
    484475  //
     
    502493    if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
    503494        ((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)) {
    505496      //
    506497      // X64 long mode waking vector
     
    726717    return ;
    727718  } else {
    728         //
    729         // If DXE is running 32-bit mode, no need to establish page table.
    730         //
     719    //
     720    // If DXE is running 32-bit mode, no need to establish page table.
     721    //
    731722    return ;
    732723  }
     
    753744  UINTN                      Index;
    754745  VOID                       *GuidHob;
    755   IA32_DESCRIPTOR            *IdtDescriptor;
    756   VOID                       *IdtBuffer;
    757746  PEI_S3_RESUME_STATE        *PeiS3ResumeState;
    758747  BOOLEAN                    InterruptStatus;
     
    814803  }
    815804
    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 PeiServices
    819     // 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-bytes
    824     //
    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 Pointer
    835     // IA32 IDT descriptor will be used to setup IA32 IDT table for 32-bit Framework Boot Script code
    836     //
    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 
    844805  InterruptStatus = SaveAndDisableInterrupts ();
    845806  //
     
    881842  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_S3_BOOT_SCRIPT);
    882843
    883   PERF_START (NULL, "ScriptExec", NULL, 0);
     844  PERF_INMODULE_BEGIN ("ScriptExec");
    884845
    885846  if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
     
    967928  BOOLEAN                                       Build4GPageTableOnly;
    968929  BOOLEAN                                       InterruptStatus;
     930  IA32_CR0                                      Cr0;
    969931
    970932  TempAcpiS3Context = 0;
     
    10481010  GuidHob = GetFirstGuidHob (&gEfiAcpiVariableGuid);
    10491011  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
    10501019    Status = PeiServicesLocatePpi (
    10511020                              &gPeiSmmAccessPpiGuid,
     
    11081077      SetInterruptState (InterruptStatus);
    11091078
     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      }
    11101088      AsmWriteCr3 ((UINTN)SmmS3ResumeState->SmmS3Cr3);
    11111089
  • trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf

    r77662 r80721  
    66# control is passed to OS waking up handler.
    77#
    8 # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
     8# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
    99# Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
    1010#
    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
    1812#
    1913##
     
    3428#
    3529
     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
    3640[Sources]
    3741  S3Resume.c
    3842
    3943[Sources.IA32]
    40   Ia32/AsmFuncs.asm
    4144  Ia32/AsmFuncs.nasm
    42   Ia32/AsmFuncs.S
    4345
    4446[Sources.X64]
    45   X64/AsmFuncs.asm
    4647  X64/AsmFuncs.nasm
    47   X64/AsmFuncs.S
    4848
    4949[Packages]
     
    5858  PeiServicesLib
    5959  PeimEntryPoint
    60   TimerLib
    6160  BaseLib
    6261  DebugLib
     
    6968  ReportStatusCodeLib
    7069  LockBoxLib
    71   PrintLib
    7270
    7371[Guids]
     
    8482
    8583[Ppis]
    86   gEfiPeiReadOnlyVariable2PpiGuid               ## CONSUMES
    8784  gEfiPeiS3Resume2PpiGuid                       ## PRODUCES
    8885  gPeiSmmAccessPpiGuid                          ## SOMETIMES_CONSUMES
     
    9390[FeaturePcd]
    9491  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode         ## CONSUMES
    95   gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport  ## CONSUMES
    9692
    9793[Pcd]
  • trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.uni

    r77662 r80721  
    66// control is passed to OS waking up handler.
    77//
    8 // Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
     8// Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
    99//
    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
    1711//
    1812// **/
  • trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2PeiExtra.uni

    r77662 r80721  
    22// S3Resume2Pei Localized Strings and Content
    33//
    4 // Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
     4// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
    55//
    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
    137//
    148// **/
    159
    16 #string STR_PROPERTIES_MODULE_NAME 
    17 #language en-US 
     10#string STR_PROPERTIES_MODULE_NAME
     11#language en-US
    1812"S3 Resume v2 PEI Module"
    1913
  • trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/X64/AsmFuncs.nasm

    r77662 r80721  
    11;------------------------------------------------------------------------------ ;
    22; 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
    104;
    115; Module Name:
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette