OcBootManagementLib: Fixed ScanPolicy NVMe handling on MacPro5,1

closes acidanthera/bugtracker#1234
This commit is contained in:
vit9696 2020-10-24 19:50:17 +03:00
parent a5267aab4a
commit a9af4abd09
4 changed files with 12 additions and 5 deletions

View File

@ -17,6 +17,7 @@ OpenCore Changelog
- Fixed intermittent 32-bit prelinking failures caused by improper Mach-O expansion
- Fixed failures in cacheless injection dependency resolution
- Fixed detection issues with older Atom CPUs
- Fixed `ScanPolicy` NVMe handling on MacPro5,1
#### v0.6.2
- Updated builtin firmware versions for SMBIOS and the rest

View File

@ -15,6 +15,14 @@
#ifndef OC_DEVICE_PATH_LIB_H
#define OC_DEVICE_PATH_LIB_H
/**
Apple MacPro5,1 includes NVMe driver, however, it contains a typo in MSG_SASEX_DP.
Instead of 0x16 aka 22 (SasEx) it uses 0x22 aka 34 (Unspecified).
Here we replace it with the "right" value.
Reference: https://forums.macrumors.com/posts/28169441.
**/
#define MSG_APPLE_NVME_NAMESPACE_DP 0x22
/**
Append file name to device path.

View File

@ -80,6 +80,7 @@ OcGetDevicePolicyType (
return OC_SCAN_ALLOW_DEVICE_SASEX;
case MSG_SCSI_DP:
return OC_SCAN_ALLOW_DEVICE_SCSI;
case MSG_APPLE_NVME_NAMESPACE_DP:
case MSG_NVME_NAMESPACE_DP:
return OC_SCAN_ALLOW_DEVICE_NVME;
case MSG_ATAPI_DP:

View File

@ -484,16 +484,13 @@ OcFixAppleBootDevicePathNode (
case MSG_NVME_NAMESPACE_DP:
//
// Apple MacPro5,1 includes NVMe driver, however, it contains a typo in MSG_SASEX_DP.
// Instead of 0x16 aka 22 (SasEx) it uses 0x22 aka 34 (Unspecified).
// Here we replace it with the "right" value.
// Reference: https://forums.macrumors.com/posts/28169441.
// Workaround for MacPro5,1 using custom NVMe type.
//
if (RestoreContext != NULL) {
RestoreContext->Types.SasExNvme.SubType = Node.DevPath->SubType;
}
Node.NvmeNamespace->Header.SubType = 0x22;
Node.NvmeNamespace->Header.SubType = MSG_APPLE_NVME_NAMESPACE_DP;
return 1;
default: