VirtualBox

Ignore:
Timestamp:
Aug 14, 2024 1:16:30 PM (6 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164367
Message:

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

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

Legend:

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

  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseRngLib/AArch64/Rndr.c

    r99404 r105670  
    33  to provide pseudorandom numbers.
    44
     5  Copyright (c) 2023, Arm Limited. All rights reserved.<BR>
    56  Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
    67  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
     
    1213#include <Uefi.h>
    1314#include <Library/BaseLib.h>
     15#include <Library/BaseMemoryLib.h>
    1416#include <Library/DebugLib.h>
    1517#include <Library/RngLib.h>
     
    4951  //
    5052  Isar0 = ArmReadIdIsar0 ();
    51   ASSERT ((Isar0 & RNDR_MASK) != 0);
    5253
    5354  mRndrSupported = ((Isar0 & RNDR_MASK) != 0);
     
    139140  return mRndrSupported;
    140141}
     142
     143/**
     144  Get a GUID identifying the RNG algorithm implementation.
     145
     146  @param [out] RngGuid  If success, contains the GUID identifying
     147                        the RNG algorithm implementation.
     148
     149  @retval EFI_SUCCESS             Success.
     150  @retval EFI_UNSUPPORTED         Not supported.
     151  @retval EFI_INVALID_PARAMETER   Invalid parameter.
     152**/
     153EFI_STATUS
     154EFIAPI
     155GetRngGuid (
     156  GUID  *RngGuid
     157  )
     158{
     159  GUID  *RngLibGuid;
     160
     161  if (RngGuid == NULL) {
     162    return EFI_INVALID_PARAMETER;
     163  }
     164
     165  if (!mRndrSupported) {
     166    return EFI_UNSUPPORTED;
     167  }
     168
     169  //
     170  // If the platform advertises the algorithm behind RNDR instruction,
     171  // use it. Otherwise use gEfiRngAlgorithmArmRndr.
     172  //
     173  RngLibGuid = PcdGetPtr (PcdCpuRngSupportedAlgorithm);
     174  if (!IsZeroGuid (RngLibGuid)) {
     175    CopyMem (RngGuid, RngLibGuid, sizeof (*RngGuid));
     176  } else {
     177    CopyMem (RngGuid, &gEfiRngAlgorithmArmRndr, sizeof (*RngGuid));
     178  }
     179
     180  return EFI_SUCCESS;
     181}
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseRngLib/BaseRngLib.inf

    r89983 r105670  
    55#  provide random numbers.
    66#
     7#  Copyright (c) 2023, Arm Limited. All rights reserved.<BR>
    78#  Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
    89#  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
     
    4445  AArch64/ArmRng.asm         | MSFT
    4546
     47[Guids.AARCH64]
     48  gEfiRngAlgorithmArmRndr
     49
     50[Guids.Ia32, Guids.X64]
     51  gEfiRngAlgorithmSp80090Ctr256Guid
     52
    4653[Packages]
    4754  MdePkg/MdePkg.dec
     55
     56[Pcd.AARCH64]
     57  gEfiMdePkgTokenSpaceGuid.PcdCpuRngSupportedAlgorithm
    4858
    4959[LibraryClasses]
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseRngLib/BaseRngLibInternals.h

    r99404 r105670  
    1010
    1111#ifndef BASE_RNGLIB_INTERNALS_H_
     12#define BASE_RNGLIB_INTERNALS_H_
    1213
    1314/**
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseRngLib/Rand/RdRand.c

    r99404 r105670  
    33  to provide high-quality random numbers.
    44
     5Copyright (c) 2023, Arm Limited. All rights reserved.<BR>
    56Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
    67Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
     
    1213#include <Uefi.h>
    1314#include <Library/BaseLib.h>
     15#include <Library/BaseMemoryLib.h>
    1416#include <Library/DebugLib.h>
    1517
     
    129131  return TRUE;
    130132}
     133
     134/**
     135  Get a GUID identifying the RNG algorithm implementation.
     136
     137  @param [out] RngGuid  If success, contains the GUID identifying
     138                        the RNG algorithm implementation.
     139
     140  @retval EFI_SUCCESS             Success.
     141  @retval EFI_UNSUPPORTED         Not supported.
     142  @retval EFI_INVALID_PARAMETER   Invalid parameter.
     143**/
     144EFI_STATUS
     145EFIAPI
     146GetRngGuid (
     147  GUID  *RngGuid
     148  )
     149{
     150  if (RngGuid == NULL) {
     151    return EFI_INVALID_PARAMETER;
     152  }
     153
     154  CopyMem (RngGuid, &gEfiRngAlgorithmSp80090Ctr256Guid, sizeof (*RngGuid));
     155  return EFI_SUCCESS;
     156}
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