VirtualBox

Ignore:
Timestamp:
Jul 1, 2021 8:17:41 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145450
Message:

Devices/EFI: Merge edk-stable202105 and openssl 1.1.1j and make it build, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
7 added
1 deleted
13 edited

Legend:

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

  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHobList.c

    r80721 r89983  
    33  on ARM platforms.
    44
    5 Copyright (c) 2017 - 2018, ARM Ltd. All rights reserved.<BR>
     5Copyright (c) 2017 - 2021, Arm Ltd. All rights reserved.<BR>
    66SPDX-License-Identifier: BSD-2-Clause-Patent
    77
     
    4747  suitable for consumption by the MM Core and drivers.
    4848
    49   @param  PayloadBootInfo    Boot information passed by privileged firmware
     49  @param  [in, out] CpuDriverEntryPoint   Address of MM CPU driver entrypoint
     50  @param  [in]      PayloadBootInfo       Boot information passed by privileged
     51                                          firmware
    5052
    5153**/
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/SetPermissions.c

    r80721 r89983  
    33  Foundation Entry point on ARM platforms.
    44
    5 Copyright (c) 2017 - 2018, ARM Ltd. All rights reserved.<BR>
     5Copyright (c) 2017 - 2021, Arm Ltd. All rights reserved.<BR>
    66SPDX-License-Identifier: BSD-2-Clause-Patent
    77
     
    2626#include <IndustryStandard/ArmStdSmc.h>
    2727
     28/**
     29  Privileged firmware assigns RO & Executable attributes to all memory occupied
     30  by the Boot Firmware Volume. This function sets the correct permissions of
     31  sections in the Standalone MM Core module to be able to access RO and RW data
     32  and make further progress in the boot process.
     33
     34  @param  [in] ImageContext           Pointer to PE/COFF image context
     35  @param  [in] ImageBase              Base of image in memory
     36  @param  [in] SectionHeaderOffset    Offset of PE/COFF image section header
     37  @param  [in] NumberOfSections       Number of Sections
     38  @param  [in] TextUpdater            Function to change code permissions
     39  @param  [in] ReadOnlyUpdater        Function to change RO permissions
     40  @param  [in] ReadWriteUpdater       Function to change RW permissions
     41
     42**/
    2843EFI_STATUS
    2944EFIAPI
    3045UpdateMmFoundationPeCoffPermissions (
    3146  IN  CONST PE_COFF_LOADER_IMAGE_CONTEXT      *ImageContext,
     47  IN  EFI_PHYSICAL_ADDRESS                    ImageBase,
    3248  IN  UINT32                                  SectionHeaderOffset,
    3349  IN  CONST  UINT16                           NumberOfSections,
     
    88104    //
    89105    if ((SectionHeader.Characteristics & EFI_IMAGE_SCN_MEM_EXECUTE) == 0) {
    90       Base = ImageContext->ImageAddress + SectionHeader.VirtualAddress;
     106      Base = ImageBase + SectionHeader.VirtualAddress;
    91107
    92108      TextUpdater (Base, SectionHeader.Misc.VirtualSize);
     
    113129}
    114130
     131/**
     132  Privileged firmware assigns RO & Executable attributes to all memory occupied
     133  by the Boot Firmware Volume. This function locates the Standalone MM Core
     134  module PE/COFF image in the BFV and returns this information.
     135
     136  @param  [in]      BfvAddress         Base Address of Boot Firmware Volume
     137  @param  [in, out] TeData             Pointer to address for allocating memory
     138                                       for PE/COFF image data
     139  @param  [in, out] TeDataSize         Pointer to size of PE/COFF image data
     140
     141**/
    115142EFI_STATUS
    116143EFIAPI
     
    121148  )
    122149{
    123   EFI_FFS_FILE_HEADER             *FileHeader = NULL;
     150  EFI_FFS_FILE_HEADER             *FileHeader;
    124151  EFI_STATUS                      Status;
    125152
     153  FileHeader = NULL;
    126154  Status = FfsFindNextFile (
    127155             EFI_FV_FILETYPE_SECURITY_CORE,
     
    150178}
    151179
     180/**
     181  Returns the PC COFF section information.
     182
     183  @param  [in, out] ImageContext         Pointer to PE/COFF image context
     184  @param  [out]     ImageBase            Base of image in memory
     185  @param  [out]     SectionHeaderOffset  Offset of PE/COFF image section header
     186  @param  [out]     NumberOfSections     Number of Sections
     187
     188**/
    152189STATIC
    153190EFI_STATUS
    154191GetPeCoffSectionInformation (
    155192  IN  OUT   PE_COFF_LOADER_IMAGE_CONTEXT      *ImageContext,
     193      OUT   EFI_PHYSICAL_ADDRESS              *ImageBase,
    156194      OUT   UINT32                            *SectionHeaderOffset,
    157195      OUT   UINT16                            *NumberOfSections
     
    213251  }
    214252
     253  *ImageBase = ImageContext->ImageAddress;
    215254  if (!ImageContext->IsTeImage) {
    216255    ASSERT (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE);
     
    233272    *SectionHeaderOffset = (UINTN)(sizeof (EFI_TE_IMAGE_HEADER));
    234273    *NumberOfSections = Hdr.Te->NumberOfSections;
    235     ImageContext->ImageAddress -= (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
     274    *ImageBase -= (UINT32)Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);
    236275  }
    237276  return RETURN_SUCCESS;
    238277}
    239278
     279/**
     280  Privileged firmware assigns RO & Executable attributes to all memory occupied
     281  by the Boot Firmware Volume. This function locates the section information of
     282  the Standalone MM Core module to be able to change permissions of the
     283  individual sections later in the boot process.
     284
     285  @param  [in]      TeData                Pointer to PE/COFF image data
     286  @param  [in, out] ImageContext          Pointer to PE/COFF image context
     287  @param  [out]     ImageBase             Pointer to ImageBase variable
     288  @param  [in, out] SectionHeaderOffset   Offset of PE/COFF image section header
     289  @param  [in, out] NumberOfSections      Number of Sections
     290
     291**/
    240292EFI_STATUS
    241293EFIAPI
     
    243295  IN        VOID                            *TeData,
    244296  IN  OUT   PE_COFF_LOADER_IMAGE_CONTEXT    *ImageContext,
     297      OUT   EFI_PHYSICAL_ADDRESS            *ImageBase,
    245298  IN  OUT   UINT32                          *SectionHeaderOffset,
    246299  IN  OUT   UINT16                          *NumberOfSections
     
    256309  DEBUG ((DEBUG_INFO, "Found Standalone MM PE data - 0x%x\n", TeData));
    257310
    258   Status = GetPeCoffSectionInformation (ImageContext, SectionHeaderOffset, NumberOfSections);
     311  Status = GetPeCoffSectionInformation (ImageContext, ImageBase,
     312             SectionHeaderOffset, NumberOfSections);
    259313  if (EFI_ERROR (Status)) {
    260314    DEBUG ((DEBUG_ERROR, "Unable to locate Standalone MM Core PE-COFF Section information - %r\n", Status));
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c

    r80721 r89983  
    33  phase on ARM platforms
    44
    5 Copyright (c) 2017 - 2018, ARM Ltd. All rights reserved.<BR>
     5Copyright (c) 2017 - 2021, Arm Ltd. All rights reserved.<BR>
    66SPDX-License-Identifier: BSD-2-Clause-Patent
    77
     
    2424#include <Library/BaseMemoryLib.h>
    2525#include <Library/SerialPortLib.h>
     26#include <Library/PcdLib.h>
    2627
    2728#include <IndustryStandard/ArmStdSmc.h>
    2829#include <IndustryStandard/ArmMmSvc.h>
     30#include <IndustryStandard/ArmFfaSvc.h>
    2931
    3032#define SPM_MAJOR_VER_MASK        0xFFFF0000
    3133#define SPM_MINOR_VER_MASK        0x0000FFFF
    3234#define SPM_MAJOR_VER_SHIFT       16
    33 
    34 CONST UINT32 SPM_MAJOR_VER = 0;
    35 CONST UINT32 SPM_MINOR_VER = 1;
    36 
    37 CONST UINT8 BOOT_PAYLOAD_VERSION = 1;
     35#define FFA_NOT_SUPPORTED         -1
     36
     37STATIC CONST UINT32 mSpmMajorVer = SPM_MAJOR_VERSION;
     38STATIC CONST UINT32 mSpmMinorVer = SPM_MINOR_VERSION;
     39
     40STATIC CONST UINT32 mSpmMajorVerFfa = SPM_MAJOR_VERSION_FFA;
     41STATIC CONST UINT32 mSpmMinorVerFfa = SPM_MINOR_VERSION_FFA;
     42
     43#define BOOT_PAYLOAD_VERSION      1
    3844
    3945PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT      CpuDriverEntryPoint = NULL;
     
    4147/**
    4248  Retrieve a pointer to and print the boot information passed by privileged
    43   secure firmware
    44 
    45   @param  SharedBufAddress The pointer memory shared with privileged firmware
     49  secure firmware.
     50
     51  @param  [in] SharedBufAddress   The pointer memory shared with privileged
     52                                  firmware.
    4653
    4754**/
     
    102109}
    103110
     111/**
     112  A loop to delegated events.
     113
     114  @param  [in] EventCompleteSvcArgs   Pointer to the event completion arguments.
     115
     116**/
    104117VOID
    105118EFIAPI
     
    108121  )
    109122{
     123  BOOLEAN FfaEnabled;
    110124  EFI_STATUS Status;
    111125  UINTN SvcStatus;
     
    119133    DEBUG ((DEBUG_INFO, "X2 :  0x%x\n", (UINT32) EventCompleteSvcArgs->Arg2));
    120134    DEBUG ((DEBUG_INFO, "X3 :  0x%x\n", (UINT32) EventCompleteSvcArgs->Arg3));
    121 
    122     Status = CpuDriverEntryPoint (
    123                EventCompleteSvcArgs->Arg0,
    124                EventCompleteSvcArgs->Arg3,
    125                EventCompleteSvcArgs->Arg1
    126                );
    127 
    128     if (EFI_ERROR (Status)) {
    129       DEBUG ((DEBUG_ERROR, "Failed delegated event 0x%x, Status 0x%x\n",
    130               EventCompleteSvcArgs->Arg0, Status));
     135    DEBUG ((DEBUG_INFO, "X4 :  0x%x\n", (UINT32) EventCompleteSvcArgs->Arg4));
     136    DEBUG ((DEBUG_INFO, "X5 :  0x%x\n", (UINT32) EventCompleteSvcArgs->Arg5));
     137    DEBUG ((DEBUG_INFO, "X6 :  0x%x\n", (UINT32) EventCompleteSvcArgs->Arg6));
     138    DEBUG ((DEBUG_INFO, "X7 :  0x%x\n", (UINT32) EventCompleteSvcArgs->Arg7));
     139
     140    FfaEnabled = FeaturePcdGet (PcdFfaEnable);
     141    if (FfaEnabled) {
     142      Status = CpuDriverEntryPoint (
     143                 EventCompleteSvcArgs->Arg0,
     144                 EventCompleteSvcArgs->Arg6,
     145                 EventCompleteSvcArgs->Arg3
     146                 );
     147      if (EFI_ERROR (Status)) {
     148        DEBUG ((DEBUG_ERROR, "Failed delegated event 0x%x, Status 0x%x\n",
     149          EventCompleteSvcArgs->Arg3, Status));
     150      }
     151    } else {
     152      Status = CpuDriverEntryPoint (
     153                 EventCompleteSvcArgs->Arg0,
     154                 EventCompleteSvcArgs->Arg3,
     155                 EventCompleteSvcArgs->Arg1
     156                 );
     157      if (EFI_ERROR (Status)) {
     158        DEBUG ((DEBUG_ERROR, "Failed delegated event 0x%x, Status 0x%x\n",
     159          EventCompleteSvcArgs->Arg0, Status));
     160      }
    131161    }
    132162
     
    152182    }
    153183
    154     EventCompleteSvcArgs->Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64;
    155     EventCompleteSvcArgs->Arg1 = SvcStatus;
     184    if (FfaEnabled) {
     185      EventCompleteSvcArgs->Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64;
     186      EventCompleteSvcArgs->Arg1 = 0;
     187      EventCompleteSvcArgs->Arg2 = 0;
     188      EventCompleteSvcArgs->Arg3 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64;
     189      EventCompleteSvcArgs->Arg4 = SvcStatus;
     190    } else {
     191      EventCompleteSvcArgs->Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64;
     192      EventCompleteSvcArgs->Arg1 = SvcStatus;
     193    }
    156194  }
    157195}
    158196
     197/**
     198  Query the SPM version, check compatibility and return success if compatible.
     199
     200  @retval EFI_SUCCESS       SPM versions compatible.
     201  @retval EFI_UNSUPPORTED   SPM versions not compatible.
     202**/
    159203STATIC
    160204EFI_STATUS
     
    162206{
    163207  EFI_STATUS   Status;
    164   UINT16       SpmMajorVersion;
    165   UINT16       SpmMinorVersion;
     208  UINT16       CalleeSpmMajorVer;
     209  UINT16       CallerSpmMajorVer;
     210  UINT16       CalleeSpmMinorVer;
     211  UINT16       CallerSpmMinorVer;
    166212  UINT32       SpmVersion;
    167213  ARM_SVC_ARGS SpmVersionArgs;
    168214
    169   SpmVersionArgs.Arg0 = ARM_SVC_ID_SPM_VERSION_AARCH32;
     215  if (FeaturePcdGet (PcdFfaEnable)) {
     216    SpmVersionArgs.Arg0 = ARM_SVC_ID_FFA_VERSION_AARCH32;
     217    SpmVersionArgs.Arg1 = mSpmMajorVerFfa << SPM_MAJOR_VER_SHIFT;
     218    SpmVersionArgs.Arg1 |= mSpmMinorVerFfa;
     219    CallerSpmMajorVer = mSpmMajorVerFfa;
     220    CallerSpmMinorVer = mSpmMinorVerFfa;
     221  } else {
     222    SpmVersionArgs.Arg0 = ARM_SVC_ID_SPM_VERSION_AARCH32;
     223    CallerSpmMajorVer = mSpmMajorVer;
     224    CallerSpmMinorVer = mSpmMinorVer;
     225  }
    170226
    171227  ArmCallSvc (&SpmVersionArgs);
    172228
    173229  SpmVersion = SpmVersionArgs.Arg0;
    174 
    175   SpmMajorVersion = ((SpmVersion & SPM_MAJOR_VER_MASK) >> SPM_MAJOR_VER_SHIFT);
    176   SpmMinorVersion = ((SpmVersion & SPM_MINOR_VER_MASK) >> 0);
     230  if (SpmVersion == FFA_NOT_SUPPORTED) {
     231    return EFI_UNSUPPORTED;
     232  }
     233
     234  CalleeSpmMajorVer = ((SpmVersion & SPM_MAJOR_VER_MASK) >> SPM_MAJOR_VER_SHIFT);
     235  CalleeSpmMinorVer = ((SpmVersion & SPM_MINOR_VER_MASK) >> 0);
    177236
    178237  // Different major revision values indicate possibly incompatible functions.
     
    183242  // However, it is possible for revision B to have a higher
    184243  // function count than revision A.
    185   if ((SpmMajorVersion == SPM_MAJOR_VER) &&
    186       (SpmMinorVersion >= SPM_MINOR_VER))
     244  if ((CalleeSpmMajorVer == CallerSpmMajorVer) &&
     245      (CalleeSpmMinorVer >= CallerSpmMinorVer))
    187246  {
    188247    DEBUG ((DEBUG_INFO, "SPM Version: Major=0x%x, Minor=0x%x\n",
    189            SpmMajorVersion, SpmMinorVersion));
     248           CalleeSpmMajorVer, CalleeSpmMinorVer));
    190249    Status = EFI_SUCCESS;
    191250  }
    192251  else
    193252  {
    194     DEBUG ((DEBUG_INFO, "Incompatible SPM Versions.\n Current Version: Major=0x%x, Minor=0x%x.\n Expected: Major=0x%x, Minor>=0x%x.\n",
    195             SpmMajorVersion, SpmMinorVersion, SPM_MAJOR_VER, SPM_MINOR_VER));
     253    DEBUG ((DEBUG_INFO, "Incompatible SPM Versions.\n Callee Version: Major=0x%x, Minor=0x%x.\n Caller: Major=0x%x, Minor>=0x%x.\n",
     254            CalleeSpmMajorVer, CalleeSpmMinorVer, CallerSpmMajorVer, CallerSpmMinorVer));
    196255    Status = EFI_UNSUPPORTED;
    197256  }
     
    201260
    202261/**
     262  Initialize parameters to be sent via SVC call.
     263
     264  @param[out]     InitMmFoundationSvcArgs  Args structure
     265  @param[out]     Ret                      Return Code
     266
     267**/
     268STATIC
     269VOID
     270InitArmSvcArgs (
     271  OUT ARM_SVC_ARGS *InitMmFoundationSvcArgs,
     272  OUT INT32 *Ret
     273  )
     274{
     275  if (FeaturePcdGet (PcdFfaEnable)) {
     276    InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP_AARCH64;
     277    InitMmFoundationSvcArgs->Arg1 = 0;
     278    InitMmFoundationSvcArgs->Arg2 = 0;
     279    InitMmFoundationSvcArgs->Arg3 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64;
     280    InitMmFoundationSvcArgs->Arg4 = *Ret;
     281  } else {
     282    InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64;
     283    InitMmFoundationSvcArgs->Arg1 = *Ret;
     284  }
     285}
     286
     287/**
    203288  The entry point of Standalone MM Foundation.
    204289
    205   @param  SharedBufAddress  Pointer to the Buffer between SPM and SP.
    206   @param  cookie1.
    207   @param  cookie2.
     290  @param  [in]  SharedBufAddress  Pointer to the Buffer between SPM and SP.
     291  @param  [in]  SharedBufSize     Size of the shared buffer.
     292  @param  [in]  cookie1           Cookie 1
     293  @param  [in]  cookie2           Cookie 2
    208294
    209295**/
     
    221307  ARM_SVC_ARGS                            InitMmFoundationSvcArgs;
    222308  EFI_STATUS                              Status;
     309  INT32                                   Ret;
    223310  UINT32                                  SectionHeaderOffset;
    224311  UINT16                                  NumberOfSections;
     
    226313  VOID                                    *TeData;
    227314  UINTN                                   TeDataSize;
     315  EFI_PHYSICAL_ADDRESS                    ImageBase;
    228316
    229317  // Get Secure Partition Manager Version Information
     
    254342             TeData,
    255343             &ImageContext,
     344             &ImageBase,
    256345             &SectionHeaderOffset,
    257346             &NumberOfSections
     
    261350    goto finish;
    262351  }
     352
     353  //
     354  // ImageBase may deviate from ImageContext.ImageAddress if we are dealing
     355  // with a TE image, in which case the latter points to the actual offset
     356  // of the image, whereas ImageBase refers to the address where the image
     357  // would start if the stripped PE headers were still in place. In either
     358  // case, we need to fix up ImageBase so it refers to the actual current
     359  // load address.
     360  //
     361  ImageBase += (UINTN)TeData - ImageContext.ImageAddress;
    263362
    264363  // Update the memory access permissions of individual sections in the
     
    266365  Status = UpdateMmFoundationPeCoffPermissions (
    267366             &ImageContext,
     367             ImageBase,
    268368             SectionHeaderOffset,
    269369             NumberOfSections,
     
    277377  }
    278378
     379  if (ImageContext.ImageAddress != (UINTN)TeData) {
     380    ImageContext.ImageAddress = (UINTN)TeData;
     381    ArmSetMemoryRegionNoExec (ImageBase, SIZE_4KB);
     382    ArmClearMemoryRegionReadOnly (ImageBase, SIZE_4KB);
     383
     384    Status = PeCoffLoaderRelocateImage (&ImageContext);
     385    ASSERT_EFI_ERROR (Status);
     386  }
     387
    279388  //
    280389  // Create Hoblist based upon boot information passed by privileged software
     
    290399
    291400finish:
     401  if (Status == RETURN_UNSUPPORTED) {
     402    Ret = -1;
     403  } else if (Status == RETURN_INVALID_PARAMETER) {
     404    Ret = -2;
     405  } else if (Status == EFI_NOT_FOUND) {
     406    Ret = -7;
     407  } else {
     408    Ret = 0;
     409  }
    292410  ZeroMem (&InitMmFoundationSvcArgs, sizeof(InitMmFoundationSvcArgs));
    293   InitMmFoundationSvcArgs.Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64;
    294   InitMmFoundationSvcArgs.Arg1 = Status;
     411  InitArmSvcArgs (&InitMmFoundationSvcArgs, &Ret);
    295412  DelegatedEventLoop (&InitMmFoundationSvcArgs);
    296413}
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf

    r80721 r89983  
    22# Module entry point library for DXE core.
    33#
    4 # Copyright (c) 2017 - 2018, ARM Ltd. All rights reserved.<BR>
     4# Copyright (c) 2017 - 2021, Arm Ltd. All rights reserved.<BR>
    55#
    66#  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    2727  AArch64/CreateHobList.c
    2828
     29[Sources.X64]
     30  X64/StandaloneMmCoreEntryPoint.c
     31
    2932[Packages]
    3033  MdePkg/MdePkg.dec
     
    3437[Packages.AARCH64]
    3538  ArmPkg/ArmPkg.dec
    36   ArmPlatformPkg/ArmPlatformPkg.dec
    3739
    3840[LibraryClasses]
     
    4951  gEfiStandaloneMmNonSecureBufferGuid
    5052  gEfiArmTfCpuDriverEpDescriptorGuid
     53
     54[FeaturePcd.AARCH64]
     55  gArmTokenSpaceGuid.PcdFfaEnable
     56
     57[BuildOptions]
     58  GCC:*_*_*_CC_FLAGS = -fpie
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf

    r80721 r89983  
    2323
    2424#
    25 #  VALID_ARCHITECTURES           = AARCH64
     25#  VALID_ARCHITECTURES           = X64 AARCH64
    2626#
    27 [Sources.Common]
    28   StandaloneMmCoreHobLib.c
     27[Sources.common]
     28  Common.c
     29
     30[Sources.X64]
     31  X64/StandaloneMmCoreHobLib.c
    2932
    3033[Sources.AARCH64]
     34  AArch64/StandaloneMmCoreHobLib.c
    3135  AArch64/StandaloneMmCoreHobLibInternal.c
    3236
    3337[Packages]
    3438  MdePkg/MdePkg.dec
     39  StandaloneMmPkg/StandaloneMmPkg.dec
    3540
    3641
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c

    r80721 r89983  
    33
    44  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
    5   Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>
     5  Copyright (c) 2016 - 2021, ARM Limited. All rights reserved.<BR>
    66
    77  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    823823  memory in MMRAM and caches EFI_MM_SYSTEM_TABLE pointer.
    824824
    825   @param  ImageHandle   The firmware allocated handle for the EFI image.
    826   @param  SystemTable   A pointer to the Management mode System Table.
     825  @param  [in]  ImageHandle     The firmware allocated handle for the EFI image.
     826  @param  [in]  MmSystemTable   A pointer to the Management mode System Table.
    827827
    828828  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.
     
    842842  EFI_MMRAM_HOB_DESCRIPTOR_BLOCK  *MmramRangesHobData;
    843843  EFI_MMRAM_DESCRIPTOR            *MmramRanges;
    844   UINT32                           MmramRangeCount;
     844  UINTN                            MmramRangeCount;
    845845  EFI_HOB_GUID_TYPE               *MmramRangesHob;
    846846
     
    869869    }
    870870
    871     MmramRangeCount = MmramRangesHobData->NumberOfMmReservedRegions;
     871    MmramRangeCount = (UINTN) MmramRangesHobData->NumberOfMmReservedRegions;
    872872    if (MmramRanges == NULL) {
    873873      return EFI_UNSUPPORTED;
     
    878878    MmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address;
    879879    MmramRanges     = (EFI_MMRAM_DESCRIPTOR *)(UINTN)MmCorePrivate->MmramRanges;
    880     MmramRangeCount = MmCorePrivate->MmramRangeCount;
     880    MmramRangeCount = (UINTN) MmCorePrivate->MmramRangeCount;
    881881  }
    882882
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf

    r80721 r89983  
    22# Memory Allocation Library instance dedicated to MM Core.
    33# The implementation borrows the MM Core Memory Allocation services as the primitive
    4 # for memory allocation instead of using MM System Table servces in an indirect way.
     4# for memory allocation instead of using MM System Table services in an indirect way.
    55# It is assumed that this library instance must be linked with MM Core in this package.
    66#
    77# Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
    8 # Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>
     8# Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.<BR>
    99#
    1010#  SPDX-License-Identifier: BSD-2-Clause-Patent
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmMemLib/AArch64/StandaloneMmMemLibInternal.c

    r80721 r89983  
    4141}
    4242
     43/**
     44  Initialize cached Mmram Ranges from HOB.
    4345
     46  @retval EFI_UNSUPPORTED   The routine is unable to extract MMRAM information.
     47  @retval EFI_SUCCESS       MmRanges are populated successfully.
     48
     49**/
     50EFI_STATUS
     51MmMemLibInternalPopulateMmramRanges (
     52  VOID
     53  )
     54{
     55  // Not implemented for AARCH64.
     56  return EFI_SUCCESS;
     57}
     58
     59/**
     60  Deinitialize cached Mmram Ranges.
     61
     62**/
     63VOID
     64MmMemLibInternalFreeMmramRanges (
     65  VOID
     66  )
     67{
     68  // Not implemented for AARCH64.
     69}
     70
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c

    r80721 r89983  
    88
    99  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
    10   Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>
     10  Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.<BR>
    1111
    1212  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    3535VOID
    3636MmMemLibInternalCalculateMaximumSupportAddress (
     37  VOID
     38  );
     39
     40/**
     41  Initialize cached Mmram Ranges from HOB.
     42
     43  @retval EFI_UNSUPPORTED   The routine is unable to extract MMRAM information.
     44  @retval EFI_SUCCESS       MmRanges are populated successfully.
     45
     46**/
     47EFI_STATUS
     48MmMemLibInternalPopulateMmramRanges (
     49  VOID
     50  );
     51
     52/**
     53  Deinitialize cached Mmram Ranges.
     54
     55**/
     56VOID
     57MmMemLibInternalFreeMmramRanges (
    3758  VOID
    3859  );
     
    146167  @param  Length              The number of bytes to copy from SourceBuffer to DestinationBuffer.
    147168
    148   @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with MMRAM.
     169  @retval EFI_SECURITY_VIOLATION The DestinationBuffer is invalid per processor architecture or overlap with MMRAM.
    149170  @retval EFI_SUCCESS            Memory is copied.
    150171
     
    180201  @param  Length              The number of bytes to copy from SourceBuffer to DestinationBuffer.
    181202
    182   @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with MMRAM.
     203  @retval EFI_SECURITY_VIOLATION The DestinationBuffer is invalid per processor architecture or overlap with MMRAM.
    183204  @retval EFI_SECURITY_VIOLATION The SourceBuffer is invalid per processor architecture or overlap with MMRAM.
    184205  @retval EFI_SUCCESS            Memory is copied.
     
    241262  The constructor function initializes the Mm Mem library
    242263
    243   @param  ImageHandle   The firmware allocated handle for the EFI image.
    244   @param  SystemTable   A pointer to the EFI System Table.
     264  @param  [in]  ImageHandle     The firmware allocated handle for the EFI image.
     265  @param  [in]  MmSystemTable   A pointer to the EFI System Table.
    245266
    246267  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.
     
    254275  )
    255276{
     277  EFI_STATUS Status;
    256278
    257279  //
     
    260282  MmMemLibInternalCalculateMaximumSupportAddress ();
    261283
    262   return EFI_SUCCESS;
    263 }
     284  //
     285  // Initialize cached Mmram Ranges from HOB.
     286  //
     287  Status = MmMemLibInternalPopulateMmramRanges ();
     288
     289  return Status;
     290}
     291
     292/**
     293  Destructor for Mm Mem library.
     294
     295  @param ImageHandle    The image handle of the process.
     296  @param MmSystemTable  The EFI System Table pointer.
     297
     298  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.
     299
     300**/
     301EFI_STATUS
     302EFIAPI
     303MemLibDestructor (
     304  IN EFI_HANDLE             ImageHandle,
     305  IN EFI_MM_SYSTEM_TABLE    *MmSystemTable
     306  )
     307{
     308
     309  //
     310  // Deinitialize cached Mmram Ranges.
     311  //
     312  MmMemLibInternalFreeMmramRanges ();
     313
     314  return EFI_SUCCESS;
     315}
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf

    r80721 r89983  
    99#  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
    1010#  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>
     11#  Copyright (c) Microsoft Corporation.
    1112#
    1213#  SPDX-License-Identifier: BSD-2-Clause-Patent
     
    2324  LIBRARY_CLASS                  = MemLib|MM_STANDALONE MM_CORE_STANDALONE
    2425  CONSTRUCTOR                    = MemLibConstructor
     26  DESTRUCTOR                     = MemLibDestructor
    2527
    2628#
    2729# The following information is for reference only and not required by the build tools.
    2830#
    29 #  VALID_ARCHITECTURES           = AARCH64
     31#  VALID_ARCHITECTURES           = IA32 X64 AARCH64
    3032#
    3133
    3234[Sources.Common]
    3335  StandaloneMmMemLib.c
     36
     37[Sources.IA32, Sources.X64]
     38  X86StandaloneMmMemLibInternal.c
    3439
    3540[Sources.AARCH64]
     
    4348  BaseMemoryLib
    4449  DebugLib
     50  HobLib
     51  MemoryAllocationLib
     52
     53[Guids]
     54  gMmCoreDataHobGuid                  ## SOMETIMES_CONSUMES ## HOB
     55  gEfiMmPeiMmramMemoryReserveGuid     ## SOMETIMES_CONSUMES ## HOB
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.c

    r80721 r89983  
    11/** @file
    2   Runtime DXE part corresponding to StanaloneMM variable module.
     2  Runtime DXE part corresponding to StandaloneMM variable module.
    33
    44This module installs variable arch protocol and variable write arch protocol
    55to StandaloneMM runtime variable service.
    66
    7 Copyright (c) 2019, ARM Ltd. All rights reserved.
     7Copyright (c) 2019 - 2021, Arm Ltd. All rights reserved.
    88
    99SPDX-License-Identifier: BSD-2-Clause-Patent
  • trunk/src/VBox/Devices/EFI/FirmwareNew/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf

    r80721 r89983  
    11## @file
    2 #  Runtime DXE part corresponding to StanaloneMM variable module.
     2#  Runtime DXE part corresponding to StandaloneMM variable module.
    33#
    44#  This module installs variable arch protocol and variable write arch protocol
    55#  to StandaloneMM runtime variable service.
    66#
    7 # Copyright (c) 2019, ARM Ltd. All rights reserved.
     7# Copyright (c) 2019 - 2021, Arm Ltd. All rights reserved.
    88# SPDX-License-Identifier: BSD-2-Clause-Patent
    99#
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