VirtualBox

Ignore:
Timestamp:
Aug 14, 2024 1:16:30 PM (4 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:
2 edited

Legend:

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

  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/SmmAccess/SmmAccessPei.c

    r101291 r105670  
    44
    55  - verify & configure the Q35 TSEG in the entry point,
    6   - provide SMRAM access by producing PEI_SMM_ACCESS_PPI,
    7   - set aside the SMM_S3_RESUME_STATE object at the bottom of TSEG, and expose
    8     it via the gEfiAcpiVariableGuid GUID HOB.
     6  - provide SMRAM access by producing PEI_SMM_ACCESS_PPI
    97
    108  This PEIM runs from RAM, so we can write to variables with static storage
     
    1210
    1311  Copyright (C) 2013, 2015, Red Hat, Inc.<BR>
    14   Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
     12  Copyright (c) 2010 - 2024, Intel Corporation. All rights reserved.<BR>
    1513
    1614  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    1816**/
    1917
    20 #include <Guid/AcpiS3Context.h>
    2118#include <Library/BaseLib.h>
    2219#include <Library/BaseMemoryLib.h>
    2320#include <Library/DebugLib.h>
    24 #include <Library/HobLib.h>
    2521#include <Library/IoLib.h>
    2622#include <Library/PcdLib.h>
     
    6561  )
    6662{
    67   if (DescriptorIndex >= DescIdxCount) {
     63  EFI_HOB_GUID_TYPE               *GuidHob;
     64  EFI_SMRAM_HOB_DESCRIPTOR_BLOCK  *DescriptorBlock;
     65
     66  //
     67  // Get the number of regions in the system that can be usable for SMRAM
     68  //
     69  GuidHob         = GetFirstGuidHob (&gEfiSmmSmramMemoryGuid);
     70  DescriptorBlock = GET_GUID_HOB_DATA (GuidHob);
     71  ASSERT (DescriptorBlock);
     72
     73  if (DescriptorIndex >= DescriptorBlock->NumberOfSmmReservedRegions) {
    6874    return EFI_INVALID_PARAMETER;
    6975  }
     
    103109  )
    104110{
    105   if (DescriptorIndex >= DescIdxCount) {
     111  EFI_HOB_GUID_TYPE               *GuidHob;
     112  EFI_SMRAM_HOB_DESCRIPTOR_BLOCK  *DescriptorBlock;
     113
     114  //
     115  // Get the number of regions in the system that can be usable for SMRAM
     116  //
     117  GuidHob         = GetFirstGuidHob (&gEfiSmmSmramMemoryGuid);
     118  DescriptorBlock = GET_GUID_HOB_DATA (GuidHob);
     119  ASSERT (DescriptorBlock);
     120
     121  if (DescriptorIndex >= DescriptorBlock->NumberOfSmmReservedRegions) {
    106122    return EFI_INVALID_PARAMETER;
    107123  }
     
    140156  )
    141157{
    142   if (DescriptorIndex >= DescIdxCount) {
     158  EFI_HOB_GUID_TYPE               *GuidHob;
     159  EFI_SMRAM_HOB_DESCRIPTOR_BLOCK  *DescriptorBlock;
     160
     161  //
     162  // Get the number of regions in the system that can be usable for SMRAM
     163  //
     164  GuidHob         = GetFirstGuidHob (&gEfiSmmSmramMemoryGuid);
     165  DescriptorBlock = GET_GUID_HOB_DATA (GuidHob);
     166  ASSERT (DescriptorBlock);
     167
     168  if (DescriptorIndex >= DescriptorBlock->NumberOfSmmReservedRegions) {
    143169    return EFI_INVALID_PARAMETER;
    144170  }
     
    179205{
    180206  return SmramAccessGetCapabilities (
    181            This->LockState,
    182            This->OpenState,
    183207           SmramMapSize,
    184208           SmramMap
     
    241265  )
    242266{
    243   UINT16                HostBridgeDevId;
    244   UINT8                 EsmramcVal;
    245   UINT8                 RegMask8;
    246   UINT32                TopOfLowRam, TopOfLowRamMb;
    247   EFI_STATUS            Status;
    248   UINTN                 SmramMapSize;
    249   EFI_SMRAM_DESCRIPTOR  SmramMap[DescIdxCount];
    250   VOID                  *GuidHob;
     267  UINT16  HostBridgeDevId;
     268  UINT8   EsmramcVal;
     269  UINT8   RegMask8;
     270  UINT32  TopOfLowRam, TopOfLowRamMb;
    251271
    252272  //
     
    357377    );
    358378
    359   //
    360   // Create the GUID HOB and point it to the first SMRAM range.
    361   //
    362379  GetStates (&mAccess.LockState, &mAccess.OpenState);
    363   SmramMapSize = sizeof SmramMap;
    364   Status       = SmramAccessGetCapabilities (
    365                    mAccess.LockState,
    366                    mAccess.OpenState,
    367                    &SmramMapSize,
    368                    SmramMap
    369                    );
    370   ASSERT_EFI_ERROR (Status);
    371 
    372   DEBUG_CODE_BEGIN ();
    373   {
    374     UINTN  Count;
    375     UINTN  Idx;
    376 
    377     Count = SmramMapSize / sizeof SmramMap[0];
    378     DEBUG ((
    379       DEBUG_VERBOSE,
    380       "%a: SMRAM map follows, %d entries\n",
    381       __func__,
    382       (INT32)Count
    383       ));
    384     DEBUG ((
    385       DEBUG_VERBOSE,
    386       "% 20a % 20a % 20a % 20a\n",
    387       "PhysicalStart(0x)",
    388       "PhysicalSize(0x)",
    389       "CpuStart(0x)",
    390       "RegionState(0x)"
    391       ));
    392     for (Idx = 0; Idx < Count; ++Idx) {
    393       DEBUG ((
    394         DEBUG_VERBOSE,
    395         "% 20Lx % 20Lx % 20Lx % 20Lx\n",
    396         SmramMap[Idx].PhysicalStart,
    397         SmramMap[Idx].PhysicalSize,
    398         SmramMap[Idx].CpuStart,
    399         SmramMap[Idx].RegionState
    400         ));
    401     }
    402   }
    403   DEBUG_CODE_END ();
    404 
    405   GuidHob = BuildGuidHob (
    406               &gEfiAcpiVariableGuid,
    407               sizeof SmramMap[DescIdxSmmS3ResumeState]
    408               );
    409   if (GuidHob == NULL) {
    410     return EFI_OUT_OF_RESOURCES;
    411   }
    412 
    413   CopyMem (
    414     GuidHob,
    415     &SmramMap[DescIdxSmmS3ResumeState],
    416     sizeof SmramMap[DescIdxSmmS3ResumeState]
    417     );
    418380
    419381  //
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