VirtualBox

Ignore:
Timestamp:
Aug 14, 2024 1:16:30 PM (6 months ago)
Author:
vboxsync
Message:

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

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

Legend:

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

  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf

    r99404 r105670  
    6969  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision  ## CONSUMES
    7070  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions    ## CONSUMES
     71  gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory         ## CONSUMES
    7172
    7273[Protocols]
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c

    r99404 r105670  
    341341  EFI_STATUS               Status;
    342342  UINT64                   CurrentData;
     343  EFI_MEMORY_TYPE          AcpiAllocateMemoryType;
    343344
    344345  CopyMem (&TempPrivateData, AcpiTableInstance, sizeof (EFI_ACPI_TABLE_INSTANCE));
     
    360361  }
    361362
     363  if (PcdGetBool (PcdNoACPIReclaimMemory)) {
     364    AcpiAllocateMemoryType = EfiACPIMemoryNVS;
     365  } else {
     366    AcpiAllocateMemoryType = EfiACPIReclaimMemory;
     367  }
     368
    362369  if (mAcpiTableAllocType != AllocateAnyPages) {
    363370    //
     
    373380    Status      = gBS->AllocatePages (
    374381                         mAcpiTableAllocType,
    375                          EfiACPIReclaimMemory,
     382                         AcpiAllocateMemoryType,
    376383                         EFI_SIZE_TO_PAGES (TotalSize),
    377384                         &PageAddress
     
    379386  } else {
    380387    Status = gBS->AllocatePool (
    381                     EfiACPIReclaimMemory,
     388                    AcpiAllocateMemoryType,
    382389                    TotalSize,
    383390                    (VOID **)&Pointer
     
    513520  UINT64                Buffer64;
    514521  BOOLEAN               AddToRsdt;
     522  EFI_MEMORY_TYPE       AcpiAllocateMemoryType;
    515523
    516524  //
     
    550558  CurrentTableList->TableSize      = CurrentTableSize;
    551559  CurrentTableList->PoolAllocation = FALSE;
     560
     561  if (PcdGetBool (PcdNoACPIReclaimMemory)) {
     562    AcpiAllocateMemoryType = EfiACPIMemoryNVS;
     563  } else {
     564    AcpiAllocateMemoryType = EfiACPIReclaimMemory;
     565  }
    552566
    553567  //
     
    586600    //
    587601    Status = gBS->AllocatePool (
    588                     EfiACPIReclaimMemory,
     602                    AcpiAllocateMemoryType,
    589603                    CurrentTableList->TableSize,
    590604                    (VOID **)&CurrentTableList->Table
     
    597611    Status = gBS->AllocatePages (
    598612                    mAcpiTableAllocType,
    599                     EfiACPIReclaimMemory,
     613                    AcpiAllocateMemoryType,
    600614                    EFI_SIZE_TO_PAGES (CurrentTableList->TableSize),
    601615                    &AllocPhysAddress
     
    18931907        }
    18941908
    1895         if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt != 0) {
     1909        //
     1910        // First check if xDSDT is available, as that is preferred as per
     1911        // ACPI Spec 6.5+ Table 5-9 X_DSDT definition
     1912        //
     1913        if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->XDsdt != 0) {
     1914          TableToInstall = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->XDsdt;
     1915        } else if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt != 0) {
    18961916          TableToInstall = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt;
    1897           Status         = AddTableToList (AcpiTableInstance, TableToInstall, TRUE, Version, TRUE, &TableKey);
    1898           if (EFI_ERROR (Status)) {
    1899             DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI table DSDT\n"));
    1900             ASSERT_EFI_ERROR (Status);
    1901             break;
    1902           }
     1917        } else {
     1918          DEBUG ((DEBUG_ERROR, "DSDT table not found\n"));
     1919          continue;
     1920        }
     1921
     1922        Status = AddTableToList (AcpiTableInstance, TableToInstall, TRUE, Version, TRUE, &TableKey);
     1923        if (EFI_ERROR (Status)) {
     1924          DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI table DSDT\n"));
     1925          ASSERT_EFI_ERROR (Status);
     1926          break;
    19031927        }
    19041928      }
     
    19451969  UINT8                 *Pointer;
    19461970  EFI_PHYSICAL_ADDRESS  PageAddress;
     1971  EFI_MEMORY_TYPE       AcpiAllocateMemoryType;
    19471972
    19481973  //
     
    19792004  }
    19802005
     2006  if (PcdGetBool (PcdNoACPIReclaimMemory)) {
     2007    AcpiAllocateMemoryType = EfiACPIMemoryNVS;
     2008  } else {
     2009    AcpiAllocateMemoryType = EfiACPIReclaimMemory;
     2010  }
     2011
    19812012  if (mAcpiTableAllocType != AllocateAnyPages) {
    19822013    PageAddress = 0xFFFFFFFF;
    19832014    Status      = gBS->AllocatePages (
    19842015                         mAcpiTableAllocType,
    1985                          EfiACPIReclaimMemory,
     2016                         AcpiAllocateMemoryType,
    19862017                         EFI_SIZE_TO_PAGES (RsdpTableSize),
    19872018                         &PageAddress
     
    19892020  } else {
    19902021    Status = gBS->AllocatePool (
    1991                     EfiACPIReclaimMemory,
     2022                    AcpiAllocateMemoryType,
    19922023                    RsdpTableSize,
    19932024                    (VOID **)&Pointer
     
    20382069    Status      = gBS->AllocatePages (
    20392070                         mAcpiTableAllocType,
    2040                          EfiACPIReclaimMemory,
     2071                         AcpiAllocateMemoryType,
    20412072                         EFI_SIZE_TO_PAGES (TotalSize),
    20422073                         &PageAddress
     
    20442075  } else {
    20452076    Status = gBS->AllocatePool (
    2046                     EfiACPIReclaimMemory,
     2077                    AcpiAllocateMemoryType,
    20472078                    TotalSize,
    20482079                    (VOID **)&Pointer
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c

    r99404 r105670  
    113113  S3ResumeTotal = MultU64x32 (AcpiS3ResumeRecord->AverageResume, AcpiS3ResumeRecord->ResumeCount);
    114114  AcpiS3ResumeRecord->ResumeCount++;
    115   AcpiS3ResumeRecord->AverageResume = DivU64x32 (S3ResumeTotal + AcpiS3ResumeRecord->FullResume, AcpiS3ResumeRecord->ResumeCount);
    116 
    117   DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - ResumeCount   = %d\n", AcpiS3ResumeRecord->ResumeCount));
    118   DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - FullResume    = %ld\n", AcpiS3ResumeRecord->FullResume));
    119   DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - AverageResume = %ld\n", AcpiS3ResumeRecord->AverageResume));
     115  if (AcpiS3ResumeRecord->ResumeCount > 0) {
     116    AcpiS3ResumeRecord->AverageResume = DivU64x32 (S3ResumeTotal + AcpiS3ResumeRecord->FullResume, AcpiS3ResumeRecord->ResumeCount);
     117    DEBUG ((DEBUG_INFO, "\nFPDT: S3 Resume Performance - AverageResume = 0x%x\n", AcpiS3ResumeRecord->AverageResume));
     118  } else {
     119    DEBUG ((DEBUG_ERROR, "\nFPDT: S3 ResumeCount reaches the MAX_UINT32 value. S3 ResumeCount record reset to Zero."));
     120  }
     121
     122  DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - ResumeCount   = 0x%x\n", AcpiS3ResumeRecord->ResumeCount));
     123  DEBUG ((DEBUG_INFO, "FPDT: S3 Resume Performance - FullResume    = 0x%x\n", AcpiS3ResumeRecord->FullResume));
    120124
    121125  //
Note: See TracChangeset for help on using the changeset viewer.

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