Changeset 82322 in vbox for trunk/src/VBox/Devices/EFI
- Timestamp:
- Dec 2, 2019 2:24:28 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 135146
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware/BaseTools/Source/C/DevicePath/DevicePathFromText.c
r80721 r82322 3338 3338 {L"UartFlowCtrl", DevPathFromTextUartFlowCtrl }, 3339 3339 {L"SAS", DevPathFromTextSAS }, 3340 #ifndef VBOX 3340 3341 {L"SasEx", DevPathFromTextSasEx }, 3342 #else 3343 {L"NVMe", DevPathFromTextNVMe }, 3344 #endif 3341 3345 {L"NVMe", DevPathFromTextNVMe }, 3342 3346 {L"UFS", DevPathFromTextUfs }, -
trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Core/Dxe/Hand/Locate.c
r80721 r82322 398 398 return Handle; 399 399 } 400 401 402 #ifdef VBOX 403 /** 404 * This works around several issues with device paths created by macOS AppleACPIPlatform.kext. 405 * 406 * See @bugref{6930} comment 84 and following for an in depth explanation. 407 */ 408 BOOLEAN 409 EFIAPI 410 vboxDevicePathCompareMacOsHacks(IN EFI_DEVICE_PATH_PROTOCOL *LocateDevicePath, 411 IN EFI_DEVICE_PATH_PROTOCOL *HandleDevicePath, 412 UINTN Size) 413 { 414 EFI_DEVICE_PATH_PROTOCOL *AlteredDevicePath = NULL; 415 EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath = LocateDevicePath; 416 417 /* First check whether the device path to be located contains a NVMe or SATA node where we have to employ the hacks. */ 418 while (!IsDevicePathEnd(TmpDevicePath)) { 419 if (IsDevicePathEndInstance(TmpDevicePath)) { 420 // 421 // If DevicePath is a multi-instance device path, 422 // the function will operate on the first instance 423 // 424 break; 425 } 426 427 if ( DevicePathType(TmpDevicePath) == MESSAGING_DEVICE_PATH 428 && DevicePathSubType(TmpDevicePath) == MSG_SASEX_DP) 429 { 430 /* 431 * macOS uses the SasEx path sub type for NVMe entries (the node is actually an 432 * NVMe one). So we alter the device path to contain a proper NVMe sub type for 433 * matching against the devices device path. 434 */ 435 AlteredDevicePath = DuplicateDevicePath(LocateDevicePath); 436 if (AlteredDevicePath != NULL) 437 { 438 UINTN offNode = (UINTN)TmpDevicePath - (UINTN)LocateDevicePath; 439 EFI_DEVICE_PATH_PROTOCOL *NvmeNode = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)AlteredDevicePath + offNode); 440 441 NvmeNode->SubType = MSG_NVME_NAMESPACE_DP; 442 } 443 break; 444 } 445 else if ( DevicePathType(TmpDevicePath) == MESSAGING_DEVICE_PATH 446 && DevicePathSubType(TmpDevicePath) == MSG_SATA_DP) 447 { 448 /* 449 * macOS uses a 0 port multiplier number for devices directly attached 450 * to the HBA while it should be 0xffff according to the UEFI spec. 451 * We alter this here and try to match against the devices device path. 452 */ 453 AlteredDevicePath = DuplicateDevicePath(LocateDevicePath); 454 if (AlteredDevicePath != NULL) 455 { 456 UINTN offNode = (UINTN)TmpDevicePath - (UINTN)LocateDevicePath; 457 SATA_DEVICE_PATH *SataNode = (SATA_DEVICE_PATH *)((UINTN)AlteredDevicePath + offNode); 458 459 SataNode->PortMultiplierPortNumber = 0xffff; 460 } 461 break; 462 } 463 464 TmpDevicePath = NextDevicePathNode(TmpDevicePath); 465 } 466 467 if (AlteredDevicePath != NULL) 468 { 469 BOOLEAN fMatch = CompareMem(AlteredDevicePath, HandleDevicePath, Size) == 0; 470 FreePool(AlteredDevicePath); 471 return fMatch; 472 } 473 474 return FALSE; 475 } 476 #endif 400 477 401 478 … … 485 562 Size = GetDevicePathSize (TmpDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); 486 563 ASSERT (Size >= 0); 564 #ifndef VBOX 487 565 if ((Size <= SourceSize) && CompareMem (SourcePath, TmpDevicePath, (UINTN) Size) == 0) { 566 #else 567 if ( (Size <= SourceSize) 568 && ( CompareMem (SourcePath, TmpDevicePath, (UINTN) Size) == 0 569 || vboxDevicePathCompareMacOsHacks(SourcePath, TmpDevicePath, (UINTN)Size))) { 570 #endif 488 571 // 489 572 // If the size is equal to the best match, then we -
trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
r80721 r82322 3493 3493 {L"UartFlowCtrl", DevPathFromTextUartFlowCtrl }, 3494 3494 {L"SAS", DevPathFromTextSAS }, 3495 #ifndef VBOX 3495 3496 {L"SasEx", DevPathFromTextSasEx }, 3497 #else 3498 {L"NVMe", DevPathFromTextNVMe }, 3499 #endif 3496 3500 {L"NVMe", DevPathFromTextNVMe }, 3497 3501 {L"UFS", DevPathFromTextUfs }, -
trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
r80721 r82322 2277 2277 {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre }, 2278 2278 {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx }, 2279 #ifndef VBOX 2279 2280 {MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx }, 2281 #else 2282 {MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextNVMe }, 2283 #endif 2280 2284 {MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe }, 2281 2285 {MESSAGING_DEVICE_PATH, MSG_UFS_DP, DevPathToTextUfs },
Note:
See TracChangeset
for help on using the changeset viewer.