Merge remote-tracking branch 'origin/main' into vmm

This commit is contained in:
Mykola Grymalyuk
2021-10-15 09:40:48 -06:00
9 changed files with 699 additions and 70 deletions

View File

@@ -26,7 +26,7 @@
- Add Legacy GMUX patchsets
- Applicable for dual GPU MacBookPro5,x and demuxed MacBookPro8,x
- Increment Binaries:
- PatcherSupportPkg 0.1.6 release
- PatcherSupportPkg 0.1.7 release
- RestrictEvents 1.0.5 rolling (2430ed0)
- Limit MacBookPro6,2 G State
- Works around crashing when switching GPUs
@@ -45,6 +45,10 @@
- Implement software demux patch set for 2011 15/17" MacBook Pros
- Alternative to hardware demux
- Adds [AMDGPUWakeHandler](https://github.com/blackgate/AMDGPUWakeHandler)
- Add Legacy GCN support for iMac11,x and iMac12,x with upgraded GPUs
- Note: iMac12,x with legacy GCN will fail to wake
- Fix Beta 10 Bluetooth
- Works around new Broadcom/CSR vendor checks in `bluetoothd`
## 0.2.5

View File

@@ -3,6 +3,18 @@ class nvidia_ids:
# Courteous of envytools as well as Macrumors:
# https://envytools.readthedocs.io/en/latest/hw/pciid.html
# https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/
curie_ids = [
0x0040,
0x00f0,
0x0220,
0x0140,
0x0160,
0x0090,
0x01d0,
0x0390,
0x0290,
]
tesla_ids = [
# G80
0x0190, # G80 [GeForce 8800 GTS / 8800 GTX]
@@ -513,61 +525,79 @@ class nvidia_ids:
class amd_ids:
legacy_gcn_ids = [
# AMDRadeonX4000
# AMDBonaireGraphicsAccelerator
0x6640,
0x6641,
0x6646,
0x6647,
0x6650,
0x6651,
0x665C,
0x665D,
# AMDFijiGraphicsAccelerator
0x7300,
0x730F,
# AMDHawaiiGraphicsAccelerator
0x67B0,
# AMDPitcairnGraphicsAccelerator
0x6800,
0x6801,
0x6806,
0x6808,
0x6810,
0x6818,
0x6819,
# AMDTahitiGraphicsAccelerator
0x6790,
0x6798,
0x679A,
0x679E,
0x6780,
# AMDTongaGraphicsAccelerator
0x6920,
0x6921,
0x6930,
0x6938,
0x6939,
# AMDVerdeGraphicsAccelerator
0x6820,
0x6821,
0x6823,
0x6825,
0x6827,
0x682B,
0x682D,
0x682F,
0x6835,
0x6839,
0x683B,
0x683D,
0x683F,
gcn_7000_ids = [
# GCN v1
# AMDPitcairnGraphicsAccelerator - AMD7000Controller
0x6800, # HD 7970M
0x6801, # HD 8970M
0x6806, # Unknown
0x6808, # W7000
0x6810, # R7 370 / R9 270X/370X
0x6818, # HD 7870
0x6819, # HD 7850 / R7 265 / R9 270 1024SP
# AMDPitcairnGraphicsAccelerator - AMD7000Controller
0x6800, # HD 7970M
0x6801, # HD 8970M
0x6806, # Unknown
0x6808, # W7000
0x6810, # R7 370 / R9 270X/370X
0x6818, # HD 7870
0x6819, # HD 7850 / R7 265 / R9 270 1024SP
# AMDTahitiGraphicsAccelerator - AMD7000Controller
0x6790, # Unknown
0x6798, # HD 7970/8970 OEM / R9 280X / D700
0x679A, # HD 7950/8950 OEM / R9 280
0x679E, # HD 7870 XT
0x6780, # W9000
# AMDVerdeGraphicsAccelerator - AMD7000Controller
0x6820, # HD 8890M / R9 M275X/M375X / M5100
0x6821, # HD 8870M / R9 M270X/M370X
0x6823, # HD 8850M / R9 M265X
0x6825, # HD 7870M
0x6827, # HD 7850M/8850M
0x682B, # HD 8830M / R7 250 / R7 M465X
0x682D, # M4000
0x682F, # HD 7730M
0x6835, # R9 255
0x6839, # Unknown
0x683B, # Unknown
0x683D, # HD 7770/8760 / R7 250X
0x683F, # HD 7750/8740 / R7 250E
]
gcn_8000_ids = [
# GCN v2
# AMDBonaireGraphicsAccelerator - AMD8000Controller
0x6640, # M6100
0x6641, # HD 8930M
0x6646, # R9 M280X / W6170M
0x6647, # R9 M270X/M280X
0x6650, # Unknown
0x6651, # Unknown
0x665C, # HD 7790/8770 / R7 360 / R9 260/360
0x665D, # R7 200
# AMDHawaiiGraphicsAccelerator - AMD8000Controller
0x67B0, # R9 290X/390X
]
gcn_9000_ids = [
# GCN v3
# AMDFijiGraphicsAccelerator - AMD9000Controller
0x7300, # R9 FURY / NANO
0x730F, # Unknown
# AMDTongaGraphicsAccelerator - AMD9000Controller
0x6920, # R9 M395/ M395X
0x6921, # R9 M295X / M390X
0x6930, # Unknown
0x6938, # R9 380X / R9 M295X
0x6939, # R9 285/380
]
polaris_ids = [
# GCN v4
# AMDRadeonX4000
# AMDBaffinGraphicsAccelerator
# AMDBaffinGraphicsAccelerator - AMD9500Controller
0x67E0,
0x67E3,
0x67E8,
@@ -577,7 +607,7 @@ class amd_ids:
0x67E1,
0x67E7,
0x67E9,
# AMDEllesmereGraphicsAccelerator
# AMDEllesmereGraphicsAccelerator - AMD9500Controller
0x67C0,
0x67C1,
0x67C2,
@@ -593,8 +623,9 @@ class amd_ids:
]
vega_ids = [
# GCN v5
# AMDRadeonX5000
# AMDVega10GraphicsAccelerator
# AMDVega10GraphicsAccelerator - AMD10000Controller
0x6860,
0x6861,
0x6862,
@@ -610,13 +641,13 @@ class amd_ids:
0x686E,
0x686F,
0x687F,
# AMDVega12GraphicsAccelerator
# AMDVega12GraphicsAccelerator - AMD10000Controller
0x69A0,
0x69A1,
0x69A2,
0x69A3,
0x69AF,
# AMDVega20GraphicsAccelerator
# AMDVega20GraphicsAccelerator - AMD10000Controller
0x66A0,
0x66A1,
0x66A2,
@@ -636,7 +667,7 @@ class amd_ids:
0x731B,
0x731F,
# AMDNavi12GraphicsAccelerator
0x7360,
0x7360, # 5600M
# AMDNavi14GraphicsAccelerator
0x7340,
0x7341,
@@ -648,6 +679,14 @@ class amd_ids:
0x73AB,
0x73BF,
]
r500_ids = [
0x7187, # X1300/X1550
0x7146, # X1300/X1550
0x71c5, # Mobile X1600
0x7249, # X1900 XT
]
terascale_1_ids = [
0x9400,
0x9401,
@@ -719,6 +758,17 @@ class amd_ids:
class intel_ids:
gma_950_ids = [
0x2582,
0x2592,
0x2772,
0x27A2,
]
gma_x3100_ids = [
0x2a02,
]
iron_ids = [
# AppleIntelHDGraphics IDs
0x0044,
@@ -805,6 +855,12 @@ class intel_ids:
0x3E98,
]
comet_lake_ids = [
0x9BC8,
0x9BC5,
0x9BC4,
]
ice_lake_ids = [
# AppleIntelICLLPGraphicsFramebuffer IDs
0xFF05,

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
diff --git a/BrcmPatchRAM/BlueToolFixup.cpp b/BrcmPatchRAM/BlueToolFixup.cpp
index 0fa891a..b64b780 100644
index 0fa891a..4cebff4 100644
--- a/BrcmPatchRAM/BlueToolFixup.cpp
+++ b/BrcmPatchRAM/BlueToolFixup.cpp
@@ -37,8 +37,10 @@ bool BlueToolFixup::start(IOService *provider) {
@@ -13,3 +13,45 @@ index 0fa891a..b64b780 100644
registerService();
return true;
@@ -50,7 +52,22 @@ bool BlueToolFixup::start(IOService *provider) {
static const uint8_t kSkipUpdateFilePathOriginal[] = "/etc/bluetool/SkipBluetoothAutomaticFirmwareUpdate";
static const uint8_t kSkipUpdateFilePathPatched[] = "/System/Library/CoreServices/boot.efi";
+static const uint8_t kVendorCheckOriginal[] =
+ {
+ 0x74, 0x08, // jz short 08
+ 0x81, 0xFA, // cmp edx
+ 0x12, 0x0A, 0x00, 0x00 // Vendor CSR
+ };
+
+ static const uint8_t kVendorCheckPatched[] =
+ {
+ 0xEB, 0x08, // jmp short 08
+ 0x81, 0xFA, // cmp edx
+ 0x12, 0x0A, 0x00, 0x00 // Vendor CSR
+ };
+
static const char *blueToolPath = "/usr/sbin/BlueTool";
+static const char *bluetoothdPath = "/usr/sbin/bluetoothd";
static mach_vm_address_t orig_cs_validate {};
@@ -70,10 +87,14 @@ static inline void searchAndPatch(const void *haystack, size_t haystackSize, con
static void patched_cs_validate_page(vnode_t vp, memory_object_t pager, memory_object_offset_t page_offset, const void *data, int *validated_p, int *tainted_p, int *nx_p) {
char path[PATH_MAX];
int pathlen = PATH_MAX;
- FunctionCast(patched_cs_validate_page, orig_cs_validate)(vp, pager, page_offset, data, validated_p, tainted_p, nx_p);
- if (vn_getpath(vp, path, &pathlen) == 0 && UNLIKELY(strcmp(path, blueToolPath) == 0)) {
- searchAndPatch(data, PAGE_SIZE, path, kSkipUpdateFilePathOriginal, kSkipUpdateFilePathPatched);
- }
+ if (vn_getpath(vp, path, &pathlen) == 0) {
+ if (UNLIKELY(strcmp(path, blueToolPath) == 0)) {
+ searchAndPatch(data, PAGE_SIZE, path, kSkipUpdateFilePathOriginal, kSkipUpdateFilePathPatched);
+ }
+ if (UNLIKELY(strcmp(path, bluetoothdPath) == 0)) {
+ searchAndPatch(data, PAGE_SIZE, path, kVendorCheckOriginal, kVendorCheckPatched);
+ }
+ }
}

View File

@@ -558,6 +558,16 @@ class BuildOpenCore:
elif self.model == "iMac10,1":
if self.get_kext_by_bundle_path("AAAMouSSE.kext")["Enabled"] is False:
self.enable_kext("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path)
if self.computer and self.computer.dgpu:
if self.computer.dgpu.arch == device_probe.AMD.Archs.Legacy_GCN_7000:
# Add Power Gate Patches
self.config["DeviceProperties"]["Add"][backlight_path] += {
"rebuild-device-tree": 1,
"CAIL,CAIL_DisableDrmdmaPowerGating": 1,
"CAIL,CAIL_DisableGfxCGPowerGating": 1,
"CAIL,CAIL_DisableUVDPowerGating": 1,
"CAIL,CAIL_DisableVCEPowerGating": 1,
}
# Check GPU Vendor
if self.constants.metal_build is True:
@@ -572,7 +582,9 @@ class BuildOpenCore:
elif not self.constants.custom_model and self.model in model_array.LegacyGPU and self.computer.dgpu:
print(f"- Detected dGPU: {utilities.friendly_hex(self.computer.dgpu.vendor_id)}:{utilities.friendly_hex(self.computer.dgpu.device_id)}")
if self.computer.dgpu.arch in [
device_probe.AMD.Archs.Legacy_GCN,
device_probe.AMD.Archs.Legacy_GCN_7000,
device_probe.AMD.Archs.Legacy_GCN_8000,
device_probe.AMD.Archs.Legacy_GCN_9000,
device_probe.AMD.Archs.Polaris,
device_probe.AMD.Archs.Vega,
device_probe.AMD.Archs.Navi,

View File

@@ -385,10 +385,13 @@ Q. Return to previous menu
elif change_menu == "2":
custom_smbios = input("Set new SMBIOS mode: ")
try:
test = self.constants.board_id[custom_smbios]
self.constants.override_smbios = custom_smbios
if smbios_data.smbios_dictionary[custom_smbios]["Board ID"] != None:
self.constants.override_smbios = custom_smbios
else:
print("Non-Intel SMBIOS, reverting to Default setting")
self.constants.override_smbios = "Default"
except KeyError:
print("Unsupported SMBIOS, defaulting to Default setting")
print("Unsupported SMBIOS, reverting to Default setting")
self.constants.override_smbios = "Default"
elif change_menu == "3":
print("Disabling SMBIOS spoof")

View File

@@ -14,7 +14,7 @@ class Constants:
def __init__(self):
# Patcher Versioning
self.patcher_version = "0.3.0" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.1.6" # PatcherSupportPkg
self.patcher_support_pkg_version = "0.1.7" # PatcherSupportPkg
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/"

View File

@@ -160,6 +160,7 @@ class NVIDIA(GPU):
class Archs(enum.Enum):
# pylint: disable=invalid-name
Curie = "Curie"
Fermi = "Fermi"
Tesla = "Tesla"
Kepler = "Kepler"
@@ -169,7 +170,9 @@ class NVIDIA(GPU):
def detect_arch(self):
# G80/G80GL
if self.device_id in pci_data.nvidia_ids.tesla_ids:
if self.device_id in pci_data.nvidia_ids.curie_ids:
self.arch = NVIDIA.Archs.Curie
elif self.device_id in pci_data.nvidia_ids.tesla_ids:
self.arch = NVIDIA.Archs.Tesla
elif self.device_id in pci_data.nvidia_ids.fermi_ids:
self.arch = NVIDIA.Archs.Fermi
@@ -185,9 +188,12 @@ class AMD(GPU):
class Archs(enum.Enum):
# pylint: disable=invalid-name
Legacy_GCN = "Legacy GCN"
R500 = "R500"
TeraScale_1 = "TeraScale 1"
TeraScale_2 = "TeraScale 2"
Legacy_GCN_7000 = "Legacy GCN v1"
Legacy_GCN_8000 = "Legacy GCN v2"
Legacy_GCN_9000 = "Legacy GCN v3"
Polaris = "Polaris"
Vega = "Vega"
Navi = "Navi"
@@ -196,8 +202,14 @@ class AMD(GPU):
arch: Archs = field(init=False)
def detect_arch(self):
if self.device_id in pci_data.amd_ids.legacy_gcn_ids:
self.arch = AMD.Archs.Legacy_GCN
if self.device_id in pci_data.amd_ids.r500_ids:
self.arch = AMD.Archs.R500
elif self.device_id in pci_data.amd_ids.gcn_7000_ids:
self.arch = AMD.Archs.Legacy_GCN_7000
elif self.device_id in pci_data.amd_ids.gcn_8000_ids:
self.arch = AMD.Archs.Legacy_GCN_8000
elif self.device_id in pci_data.amd_ids.gcn_9000_ids:
self.arch = AMD.Archs.Legacy_GCN_9000
elif self.device_id in pci_data.amd_ids.terascale_1_ids:
self.arch = AMD.Archs.TeraScale_1
elif self.device_id in pci_data.amd_ids.terascale_2_ids:
@@ -218,6 +230,8 @@ class Intel(GPU):
class Archs(enum.Enum):
# pylint: disable=invalid-name
GMA_950 = "GMA 950"
GMA_X3100 = "GMA X3100"
Iron_Lake = "Iron Lake"
Sandy_Bridge = "Sandy Bridge"
Ivy_Bridge = "Ivy Bridge"
@@ -226,13 +240,18 @@ class Intel(GPU):
Skylake = "Skylake"
Kaby_Lake = "Kaby Lake"
Coffee_Lake = "Coffee Lake"
Comet_Lake = "Comet Lake"
Ice_Lake = "Ice Lake"
Unknown = "Unknown"
arch: Archs = field(init=False)
def detect_arch(self):
if self.device_id in pci_data.intel_ids.iron_ids:
if self.device_id in pci_data.intel_ids.gma_950_ids:
self.arch = Intel.Archs.GMA_950
elif self.device_id in pci_data.intel_ids.gma_x3100_ids:
self.arch = Intel.Archs.GMA_X3100
elif self.device_id in pci_data.intel_ids.iron_ids:
self.arch = Intel.Archs.Iron_Lake
elif self.device_id in pci_data.intel_ids.sandy_ids:
self.arch = Intel.Archs.Sandy_Bridge
@@ -248,6 +267,8 @@ class Intel(GPU):
self.arch = Intel.Archs.Kaby_Lake
elif self.device_id in pci_data.intel_ids.coffee_lake_ids:
self.arch = Intel.Archs.Coffee_Lake
elif self.device_id in pci_data.intel_ids.comet_lake_ids:
self.arch = Intel.Archs.Comet_Lake
elif self.device_id in pci_data.intel_ids.ice_lake_ids:
self.arch = Intel.Archs.Ice_Lake
else: