VirtualBox

Changeset 77749 in vbox


Ignore:
Timestamp:
Mar 18, 2019 11:45:00 AM (6 years ago)
Author:
vboxsync
Message:

EFI: Have to cache MCFG base in BasePciExpressLib because reading a dynamic PCD at runtime does not work due TPL clash. See bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePciExpressLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf

    r58466 r77749  
    2525  VERSION_STRING                 = 1.0
    2626  LIBRARY_CLASS                  = PciExpressLib
     27  CONSTRUCTOR                    = PciExpressLibConstructor
    2728
    2829#
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePciExpressLib/PciExpressLib.c

    r58466 r77749  
    3636#define ASSERT_INVALID_PCI_ADDRESS(A) \
    3737  ASSERT (((A) & ~0xfffffff) == 0)
     38
     39#ifdef VBOX
     40
     41STATIC UINT64 mPciExpressBaseAddress;
     42
     43RETURN_STATUS
     44EFIAPI
     45PciExpressLibConstructor (
     46  VOID
     47  )
     48{
     49  //
     50  // Accessing PciExpressBaseAddress as a dynamic PCD does not work
     51  // because LibPcdGet64() worker tries to raise the TPL to 16 when
     52  // it was already set to 31 by caller further up the chain. We need
     53  // to read the value (which won't change) and cache it here.
     54  //
     55  mPciExpressBaseAddress = PcdGet64 (PcdPciExpressBaseAddress);
     56  if (!mPciExpressBaseAddress)
     57    return RETURN_LOAD_ERROR;
     58
     59  return RETURN_SUCCESS;
     60}
     61#endif
     62
    3863
    3964/**
     
    83108  )
    84109{
     110#ifdef VBOX
     111  return (VOID*)(UINTN) mPciExpressBaseAddress;
     112#else
    85113  return (VOID*)(UINTN) PcdGet64 (PcdPciExpressBaseAddress);
     114#endif
    86115}
    87116
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