Contribute
Register

[Guide] Using Clover to "hotpatch" ACPI

A method with only a single line is a bit of a waste.

You’re right. But I accounted for the possibility of wanting to call DGPU.EXST() to check if PEGP exists before doing other future tasks. Maybe you’re right it’s a waste. I can add it easily later when I want.

I added ECOF() because I had separate REG and DGPU SSDTs so I wanted to have the DGPU code only in its SSDTs and only call the relevant method from REG.

And method calls should use (), eg., not:
Code:
Method(EXST) { Return(CondRefOf(\_SB.PCI0.RP05.PEGP._OFF)) } // Check if DGPU existsMethod(DGOF) { If(EXST) { \_SB.PCI0.RP05.PEGP._OFF() } } // Call DGPU _OFF (without EC code)

Instead:
Code:
Method(EXST) { Return(CondRefOf(\_SB.PCI0.RP05.PEGP._OFF)) } // Check if DGPU exists
Method(DGOF) { If(EXST()) { \_SB.PCI0.RP05.PEGP._OFF() } } // Call DGPU _OFF (without EC code)

But really, I'd write it as:
Code:
Method(DGOF) { If(CondRefOf(\_SB.PCI0.RP05.PEGP._OFF)) { \_SB.PCI0.RP05.PEGP._OFF() } } // Call DGPU _OFF (without EC code)

Same goes for ECOF (no need for a separate method for a single line of code...)

OK. I was wondering if ACPI has Swift-style computed properties that wouldn’t need () at the end...
 
Last edited:
[Deleted]
 
Last edited:
Hi @RehabMan, Good Day. I am new to hot patching and just now, I have successfully booted my hack and most functionality works. I just want to have my setup checked as I am encountering errors on verbose boot(see attached picture). Attached is my reporting files containing my reporting files. Thank you in advance


Verbose boot error:
Screenshot_20171229-014735.png



Reporting File Contents:

Normal Reporting files ++

My previous setup
----static DSDT & SSDT in CLOVER/ACPI/patched-static
----static config in CLOVER/config-static.plist
----static patches applied on static setup Static Patches.txt

Current Setup(Hot Patch Method):
----new aml files in CLOVER/ACPI/patched
----config files with DSDT fixes & patches config.plist



UPDATE:

I have fixed the verbose logs with this:

ACPI ERROR: [PSTE] Namespace lookup failure, AE_ALREADY_EXIST
--fixed by removing Disable_EH01.aml (i forgot that i already have that on my SSDT-UIAC.aml)
ACPI ERROR: [FDE1] Namespace lookup failure, AE_ALREADY_EXIST
--fixed with fix for PSTE
ACPI ERROR: [_DSM] Namespace lookup failure, AE_ALREADY_EXIST
--Fixed by disabling generate plugin type in clover. I am injecting plugin type via SSDT-PluginType1.aml
ACPI Exception: AE_ALREADY_EXIST, During name lookup/catalog
--fixed with fix for _DSM
ACPI Exception: AE_ALREADY_EXIST, (SSDT: CpuPm) while loading table
--fixed with fix for _DSM



Kindly check if my patches,fixes,SSDTS are correct for my hack. Attached is my reporting file(updated with fixes for my previous errors). Thank you very much in advance
 

Attachments

  • Gelomon - Reporting files.zip
    2.5 MB · Views: 93
Last edited:
Hi, If i Wanna Remove 'Device (LID0)' from DSDT.How to do it? I try to use 'Remove LID0 to LIDX' , but it is not working~~
 
Hi @RehabMan, Good Day. I am new to hot patching and just now, I have successfully booted my hack and most functionality works. I just want to have my setup checked as I am encountering errors on verbose boot(see attached picture). Attached is my reporting files containing my reporting files. Thank you in advance


Verbose boot error:
View attachment 302401


Reporting File Contents:

Normal Reporting files ++

My previous setup
----static DSDT & SSDT in CLOVER/ACPI/patched-static
----static config in CLOVER/config-static.plist
----static patches applied on static setup Static Patches.txt

Current Setup(Hot Patch Method):
----new aml files in CLOVER/ACPI/patched
----config files with DSDT fixes & patches config.plist



UPDATE:

I have fixed the verbose logs with this:

ACPI ERROR: [PSTE] Namespace lookup failure, AE_ALREADY_EXIST
--fixed by removing Disable_EH01.aml (i forgot that i already have that on my SSDT-UIAC.aml)
ACPI ERROR: [FDE1] Namespace lookup failure, AE_ALREADY_EXIST
--fixed with fix for PSTE
ACPI ERROR: [_DSM] Namespace lookup failure, AE_ALREADY_EXIST
--Fixed by disabling generate plugin type in clover. I am injecting plugin type via SSDT-PluginType1.aml
ACPI Exception: AE_ALREADY_EXIST, During name lookup/catalog
--fixed with fix for _DSM
ACPI Exception: AE_ALREADY_EXIST, (SSDT: CpuPm) while loading table
--fixed with fix for _DSM



Kindly check if my patches,fixes,SSDTS are correct for my hack. Attached is my reporting file(updated with fixes for my previous errors). Thank you very much in advance

"Problem Reporting" files are incomplete.
Read FAQ, "Problem Reporting" again. Carefully. Attach all requested files/output.
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/
Use the tool mentioned in the FAQ, that way it is less likely you'll omit something.
 
Hi, If i Wanna Remove 'Device (LID0)' from DSDT.How to do it? I try to use 'Remove LID0 to LIDX' , but it is not working~~

Why do you want to remove the LID device?
This thread is for hotpatch only. Static patch questions are off-topic.
 

Attachments

  • Reporting Files.zip
    2.6 MB · Views: 75
Hi Uploaded new Reporting files:

-John

Comments:
- you could probably do with less config.plist/ACPI/DSDT/Fixes
- looks like something strange is going on with your audio (but that is probably a kext/patching problem, not ACPI)
- SSDT-SATA probably not needed (your SATA seems to be already in AHCI mode)
 
Hi, I'm trying to understand hotpatching (and doing it myself). I'm trying to change the 0x6d instant wake patch into a hotpatch. I've got two problems:

- How to remove a Name (like this: `Name (_PRW, Package (0x03) { 0x6d, 0x03, \_SB.PCI0.LPCB.EC.PUBS })` )
- What does removing _all_ _DSM (as the following part addresses) affect? Should I do so or just match the specific one that needs altering? (as in the instant wake patch that follows)

Code:
# Insert Apple USB properties into USB 3.0 XHC
into method label _DSM parent_adr 0x00140000 remove_entry;
into device name_adr 0x00140000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
    If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
    Return (Package()\n
    {\n
        "subsystem-id", Buffer() { 0x70, 0x72, 0x00, 0x00 },\n
        "subsystem-vendor-id", Buffer() { 0x86, 0x80, 0x00, 0x00 },\n
        "AAPL,current-available", 2100,\n
        "AAPL,current-extra", 2200,\n
        "AAPL,current-extra-in-sleep", 1600,\n
        "AAPL,device-internal", 0x02,\n
        "AAPL,max-port-current-in-sleep", 2100,\n
    })\n
}\n
end;

Removing methods

It is very difficult to remove ACPI objects, (methods, names, devices, etc) using Clover binary patches. Commonly, we must add _DSM methods to inject properties that describe various hardware properties. But added _DSM methods can conflict with existing _DSM methods that may already be in the native ACPI files. With static patching, "Remove _DSM methods" would be used.

Since it is difficult to remove the methods, but we don't want the native methods to conflict with new _DSM methods that are added, the fix is to rename the native methods to something else.

So... again, we use a simple rename patch:

Comment: Rename _DSM to XDSM
Find: <5f44534d>
Replace: <5844534d>

Sometimes, you might rename an object to effectively disable it so it does not cause problems. For example, my Intel DH67GD DSDT defines an APSS object. If this object is left in the DSDT it interferes with power management (causes panic). I use a rename from APSS -> APXX. Because AppleIntelCPUPowerManagement is looking for APSS, it does not cause a problem once renamed to APXX.
 
<todo: post #4 reserved for future>
Can you describe how to solve a field that's defined upon SystemMemory?

Code:
OperationRegion (GNVS, SystemMemory, 0x9FF4E000, 0x072C)
    Field (GNVS, AnyAcc, Lock, Preserve)
    {
 
Back
Top