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/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c

    r101291 r108794  
    11121112  VOID                                         *AllocAddress;
    11131113
     1114  MemType = EFI_MEMORY_XP;
     1115
    11141116  if (HostAddress == NULL) {
    11151117    return EFI_INVALID_PARAMETER;
     
    11531155    // type supported by the region.
    11541156    //
    1155     MemType = EFI_MEMORY_WC;
     1157    MemType |= EFI_MEMORY_WC;
    11561158  } else {
    1157     MemType = EFI_MEMORY_UC;
     1159    MemType |= EFI_MEMORY_UC;
    11581160  }
    11591161
     
    11721174  //
    11731175  InsertHeadList (&Dev->UncachedAllocationList, &Alloc->List);
     1176
     1177  //
     1178  // Ensure that EFI_MEMORY_XP is in the capability set
     1179  //
     1180  if ((GcdDescriptor.Capabilities & EFI_MEMORY_XP) != EFI_MEMORY_XP) {
     1181    Status = gDS->SetMemorySpaceCapabilities (
     1182                    (PHYSICAL_ADDRESS)(UINTN)AllocAddress,
     1183                    EFI_PAGES_TO_SIZE (Pages),
     1184                    GcdDescriptor.Capabilities | EFI_MEMORY_XP
     1185                    );
     1186
     1187    // if we were to fail setting the capability, this would indicate an internal failure of the GCD code. We should
     1188    // assert here to let a platform know something went crazy, but for a release build we can let the allocation occur
     1189    // without the EFI_MEMORY_XP bit set, as that was the existing behavior
     1190    if (EFI_ERROR (Status)) {
     1191      DEBUG ((
     1192        DEBUG_ERROR,
     1193        "%a failed to set EFI_MEMORY_XP capability on 0x%llx for length 0x%llx. Attempting to allocate without XP set.\n",
     1194        __func__,
     1195        AllocAddress,
     1196        EFI_PAGES_TO_SIZE (Pages)
     1197        ));
     1198
     1199      ASSERT_EFI_ERROR (Status);
     1200
     1201      MemType &= ~EFI_MEMORY_XP;
     1202    }
     1203  }
    11741204
    11751205  Status = gDS->SetMemorySpaceAttributes (
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