VirtualBox

Ignore:
Timestamp:
Mar 31, 2025 11:31:09 AM (2 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168237
Message:

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, 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/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c

    r99404 r108794  
    77  and MM driver) and/or specific dedicated hardware.
    88
    9   Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
     9  Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
    1010  Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.<BR>
    1111
     
    1414**/
    1515
    16 #include <PiMm.h>
    17 
    18 #include <Library/BaseLib.h>
    19 #include <Library/BaseMemoryLib.h>
    20 #include <Library/DebugLib.h>
    21 
    22 EFI_MMRAM_DESCRIPTOR  *mMmMemLibInternalMmramRanges;
    23 UINTN                 mMmMemLibInternalMmramCount;
     16#include "StandaloneMmMemLibInternal.h"
    2417
    2518//
     
    2922
    3023/**
    31   Calculate and save the maximum support address.
    32 
    33 **/
    34 VOID
    35 MmMemLibInternalCalculateMaximumSupportAddress (
    36   VOID
    37   );
    38 
    39 /**
    40   Initialize cached Mmram Ranges from HOB.
    41 
    42   @retval EFI_UNSUPPORTED   The routine is unable to extract MMRAM information.
    43   @retval EFI_SUCCESS       MmRanges are populated successfully.
    44 
    45 **/
    46 EFI_STATUS
    47 MmMemLibInternalPopulateMmramRanges (
    48   VOID
    49   );
    50 
    51 /**
    52   Deinitialize cached Mmram Ranges.
    53 
    54 **/
    55 VOID
    56 MmMemLibInternalFreeMmramRanges (
    57   VOID
    58   );
    59 
    60 /**
    6124  This function check if the buffer is valid per processor architecture and not overlap with MMRAM.
    6225
     
    7437  )
    7538{
    76   UINTN  Index;
    77 
    7839  //
    7940  // Check override.
     
    9758  }
    9859
    99   for (Index = 0; Index < mMmMemLibInternalMmramCount; Index++) {
    100     if (((Buffer >= mMmMemLibInternalMmramRanges[Index].CpuStart) &&
    101          (Buffer < mMmMemLibInternalMmramRanges[Index].CpuStart + mMmMemLibInternalMmramRanges[Index].PhysicalSize)) ||
    102         ((mMmMemLibInternalMmramRanges[Index].CpuStart >= Buffer) &&
    103          (mMmMemLibInternalMmramRanges[Index].CpuStart < Buffer + Length)))
    104     {
    105       DEBUG ((
    106         DEBUG_ERROR,
    107         "MmIsBufferOutsideMmValid: Overlap: Buffer (0x%lx) - Length (0x%lx), ",
    108         Buffer,
    109         Length
    110         ));
    111       DEBUG ((
    112         DEBUG_ERROR,
    113         "CpuStart (0x%lx) - PhysicalSize (0x%lx)\n",
    114         mMmMemLibInternalMmramRanges[Index].CpuStart,
    115         mMmMemLibInternalMmramRanges[Index].PhysicalSize
    116         ));
    117       return FALSE;
    118     }
    119   }
    120 
    121   return TRUE;
     60  return MmMemLibIsValidNonMmramRange (Buffer, Length);
    12261}
    12362
     
    289228  )
    290229{
    291   EFI_STATUS  Status;
    292 
    293230  //
    294231  // Calculate and save maximum support address
    295232  //
    296   MmMemLibInternalCalculateMaximumSupportAddress ();
    297 
    298   //
    299   // Initialize cached Mmram Ranges from HOB.
    300   //
    301   Status = MmMemLibInternalPopulateMmramRanges ();
    302 
    303   return Status;
     233  MmMemLibCalculateMaximumSupportAddress ();
     234
     235  //
     236  // Initialize valid non-Mmram Ranges from Resource HOB.
     237  //
     238  MmMemLibInitializeValidNonMmramRanges ();
     239
     240  return EFI_SUCCESS;
    304241}
    305242
     
    321258{
    322259  //
    323   // Deinitialize cached Mmram Ranges.
    324   //
    325   MmMemLibInternalFreeMmramRanges ();
    326 
    327   return EFI_SUCCESS;
    328 }
     260  // Deinitialize cached non-Mmram Ranges.
     261  //
     262  MmMemLibFreeValidNonMmramRanges ();
     263  return EFI_SUCCESS;
     264}
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