mirror of
https://github.com/outbackdingo/OpCore-Simplify.git
synced 2026-08-25 14:53:06 +00:00
Add patch for APIC table on HEDT systems
This commit is contained in:
Executable → Regular
@@ -76,6 +76,7 @@ class ACPIGuru:
|
|||||||
self.illegal_names = ("XHC1", "EHC1", "EHC2", "PXSX")
|
self.illegal_names = ("XHC1", "EHC1", "EHC2", "PXSX")
|
||||||
self.result = {
|
self.result = {
|
||||||
"Add": [],
|
"Add": [],
|
||||||
|
"Delete": [],
|
||||||
"Patch": []
|
"Patch": []
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2890,6 +2891,53 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "GPUSPOOF", 0x00001000)
|
|||||||
"Path": ssdt_name + ".aml"
|
"Path": ssdt_name + ".aml"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def dropping_the_table(self, signature=None, oemtableid=None):
|
||||||
|
table_data = self.acpi.get_table_with_signature(signature) or self.acpi.get_table_with_id(oemtableid)
|
||||||
|
|
||||||
|
if not table_data:
|
||||||
|
return
|
||||||
|
|
||||||
|
print(list(table_data.items())[-4:])
|
||||||
|
|
||||||
|
self.result["Delete"].append({
|
||||||
|
"All": True,
|
||||||
|
"Comment": "Delete {}".format(signature or oemtableid),
|
||||||
|
"Enabled": True,
|
||||||
|
"OemTableId": self.utils.hex_to_bytes(self.utils.string_to_hex(table_data.get("id"))),
|
||||||
|
"TableLength": 0,
|
||||||
|
"TableSignature": self.utils.hex_to_bytes(self.utils.string_to_hex(table_data.get("signature")))
|
||||||
|
})
|
||||||
|
|
||||||
|
def fix_apic_processor_id(self, cpu_codename):
|
||||||
|
self.apic = self.acpi.get_table_with_signature("APIC")
|
||||||
|
processors = [line for line in self.dsdt.get("lines") if line.strip().startswith("Processor")]
|
||||||
|
|
||||||
|
if not self.is_intel_hedt_cpu(cpu_codename) or not self.apic or not processors:
|
||||||
|
return
|
||||||
|
|
||||||
|
processor_index = -1
|
||||||
|
for index, line in enumerate(self.apic.get("lines")):
|
||||||
|
if "Subtable Type" in line and "[Processor Local APIC]" in line:
|
||||||
|
processor_index += 1
|
||||||
|
apic_processor_id = self.apic["lines"][index + 2][-2:]
|
||||||
|
try:
|
||||||
|
dsdt_processor_id = processors[processor_index].split("0x")[1].split(",")[0]
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
if processor_index == 0 and apic_processor_id == dsdt_processor_id:
|
||||||
|
break
|
||||||
|
self.apic["lines"][index + 2] = self.apic["lines"][index + 2][:-2] + dsdt_processor_id
|
||||||
|
|
||||||
|
if processor_index != -1:
|
||||||
|
if self.write_ssdt("APIC", "\n".join(self.apic.get("lines"))):
|
||||||
|
self.result["Add"].append({
|
||||||
|
"Comment": "Avoid kernel panic by pointing the first CPU entry to an active CPU on HEDT systems",
|
||||||
|
"Enabled": True,
|
||||||
|
"Path": "APIC.aml"
|
||||||
|
})
|
||||||
|
self.dropping_the_table("APIC")
|
||||||
|
self.utils.request_input()
|
||||||
|
|
||||||
def initialize_patches(self, motherboard_name, motherboard_chipset, platform, cpu_manufacturer, cpu_codename, integrated_gpu, discrete_gpu, ethernet_pci, touchpad_communication, smbios, intel_mei, unsupported_devices, macos_version, acpi_directory):
|
def initialize_patches(self, motherboard_name, motherboard_chipset, platform, cpu_manufacturer, cpu_codename, integrated_gpu, discrete_gpu, ethernet_pci, touchpad_communication, smbios, intel_mei, unsupported_devices, macos_version, acpi_directory):
|
||||||
self.acpi_directory = self.check_acpi_directory(acpi_directory)
|
self.acpi_directory = self.check_acpi_directory(acpi_directory)
|
||||||
|
|
||||||
@@ -2910,6 +2958,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "GPUSPOOF", 0x00001000)
|
|||||||
self.enable_gpio_device(platform, cpu_manufacturer, touchpad_communication)
|
self.enable_gpio_device(platform, cpu_manufacturer, touchpad_communication)
|
||||||
self.enable_nvram_support(motherboard_chipset)
|
self.enable_nvram_support(motherboard_chipset)
|
||||||
self.fake_embedded_controller(platform)
|
self.fake_embedded_controller(platform)
|
||||||
|
self.fix_apic_processor_id(cpu_codename)
|
||||||
self.fix_hp_005_post_error(motherboard_name)
|
self.fix_hp_005_post_error(motherboard_name)
|
||||||
self.fix_irq_conflicts(platform, cpu_codename)
|
self.fix_irq_conflicts(platform, cpu_codename)
|
||||||
self.fix_system_clock_awac(motherboard_chipset)
|
self.fix_system_clock_awac(motherboard_chipset)
|
||||||
|
|||||||
@@ -244,14 +244,7 @@ class ConfigProdigy:
|
|||||||
del config["#WARNING - 3"]
|
del config["#WARNING - 3"]
|
||||||
del config["#WARNING - 4"]
|
del config["#WARNING - 4"]
|
||||||
config["ACPI"]["Add"] = efi_option.get("ACPI").get("Add")
|
config["ACPI"]["Add"] = efi_option.get("ACPI").get("Add")
|
||||||
if not self.is_intel_hedt_cpu(hardware.get("CPU Codename")) and not self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware.get("CPU Codename"), end=2) is None:
|
config["ACPI"]["Delete"] = efi_option.get("ACPI").get("Delete")
|
||||||
for item in config["ACPI"]["Delete"]:
|
|
||||||
item.update({
|
|
||||||
"All": True,
|
|
||||||
"Enabled": True
|
|
||||||
})
|
|
||||||
else:
|
|
||||||
config["ACPI"]["Delete"] = []
|
|
||||||
config["ACPI"]["Patch"] = efi_option.get("ACPI").get("Patch")
|
config["ACPI"]["Patch"] = efi_option.get("ACPI").get("Patch")
|
||||||
|
|
||||||
config["Booter"]["MmioWhitelist"] = self.mmio_whitelist(hardware.get("CPU Codename"))
|
config["Booter"]["MmioWhitelist"] = self.mmio_whitelist(hardware.get("CPU Codename"))
|
||||||
|
|||||||
Executable → Regular
+8
-10
@@ -110,23 +110,21 @@ class Utils:
|
|||||||
return string
|
return string
|
||||||
|
|
||||||
def int_to_hex(self, number):
|
def int_to_hex(self, number):
|
||||||
try:
|
return format(number, '02X')
|
||||||
return format(number, '02X')
|
|
||||||
except:
|
|
||||||
return number
|
|
||||||
|
|
||||||
def hex_to_int(self, hex_string):
|
def hex_to_int(self, hex_string):
|
||||||
return int(hex_string, 16)
|
return int(hex_string, 16)
|
||||||
|
|
||||||
def to_little_endian_hex(self, hex_str):
|
def to_little_endian_hex(self, hex_string):
|
||||||
hex_str = hex_str.lower().lstrip("0x")
|
hex_string = hex_string.lower().lstrip("0x").zfill(8)
|
||||||
|
|
||||||
hex_str = hex_str.zfill(8)
|
|
||||||
|
|
||||||
little_endian_hex = ''.join(reversed([hex_str[i:i+2] for i in range(0, len(hex_str), 2)]))
|
little_endian_hex = ''.join(reversed([hex_string[i:i+2] for i in range(0, len(hex_string), 2)]))
|
||||||
|
|
||||||
return little_endian_hex.upper()
|
return little_endian_hex.upper()
|
||||||
|
|
||||||
|
def string_to_hex(self, string):
|
||||||
|
return ''.join(format(ord(char), '02X') for char in string)
|
||||||
|
|
||||||
def extract_zip_file(self, zip_path, extraction_directory=None):
|
def extract_zip_file(self, zip_path, extraction_directory=None):
|
||||||
if extraction_directory is None:
|
if extraction_directory is None:
|
||||||
extraction_directory = os.path.splitext(zip_path)[0]
|
extraction_directory = os.path.splitext(zip_path)[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user