Contribute
Register

[Guide] Using Clover to "hotpatch" ACPI

Joined
Dec 10, 2013
Messages
152
Motherboard
Huawei Matebook D 2017
CPU
i5-7200U
Graphics
HD 620
The problem is your config.plist has no effective rename for _Q01/_Q02.
It is quite evident in your patchmatic -extract output (DSDT.aml).
Yes thank you !
 
Joined
Mar 22, 2016
Messages
30
CPU
Sandy Brigde
Graphics
HD 3000, NVIDIA NVS 4200 Optimus
Mac
MacBook Pro
Mobile Phone
Android
Hi Rehabman, my battery status not showing, in my DSDT have 2 device BAT is BAT1 and BAT2 : so i want to disable BAT2 to enable Battery status, how ? . Because in DSDT patch im using Disable BAT1, BAT2 patchs . I don't know convert this to hotpatch in clover :(
 
Joined
Mar 20, 2017
Messages
10
Motherboard
HP Zhan66 Pro G2-Clover
CPU
i5-8265U
Graphics
UHD 620(3EA0),1920*1080
Hi Rehabman,
I have done some work with your post. On my laptop, it seems that most of the functions are working. But I have observed that every time the phone is turned on, some ACPI errors are output on the screen. Can you help me fix these mistakes?
Sorry for my poor English.
Thank you for your great work.
 

Attachments

Last edited:
Joined
May 6, 2014
Messages
205
Motherboard
Lenovo Ideapad 320-14ikb
CPU
i5-7200U
Graphics
HD 620 (1920x1080)
Mac
MacBook Pro
Mobile Phone
Other
can someone make hot patch for battery
I couldn't make hot patch for battery this is very static patch
I attached required file
 

Attachments

Joined
Sep 22, 2011
Messages
280
Motherboard
Thinkpad T61-Clover
CPU
T9300/ICH8M
Graphics
Quadro NVS 140m, 1280x800
Mac
MacBook Pro
I'm experimenting with CLOVER hotpatches for the first time after manually applying DSDT patches to my first 3 hackintoshes. I found a case where the "standard" CLOVER Darwin OS identification hotpatch is incomplete. In the Dell Latitude E6410 DSDT, there are two places where variable assignments are based on OS identification: Method (OSID) and Method (IINI). The "standard" CLOVER OS identification hotpatch works only for Method (IINI), so a different patch is required for Method (OSID).

Also, there is a bug / coding mistake in the Dell E6410 DSDT (BIOS A17) that renders the hotpatch of Method (IINI) ineffective. I started a thread about this here: https://www.tonymacx86.com/threads/dsdt-aml-question-for-dell-latitude-e6410.279338/

EDIT: I just discovered the XOSI / _OSI override method and suspect that this might be the best way (better than CLOVER hotpatch) to handle _OSI calls in the Dell Latitude E6410 DSDT. Still learning about XOSI and haven't drawn a conclusion.
 
Last edited:
Joined
Oct 1, 2013
Messages
367
CPU
i5
Graphics
GT 820M
Mac
iMac
Mobile Phone
Android
Hello, I tried to hot patch ACPI for working battery status. I followed up the guide and it seemed to work, but unfortunately my battery indicator stays fixed on 100%. I double checked scopes and offset values, but nothing to do. Here are my PR files attached, in case anyone could help me. Thank you all in advance.

PS: I suspect it has something to do with more than one Field() definition on the same Operation Region (ERAM, or, in my SSDT, ERM2), but not sure about how to fix it.

Code:
MBP-di-Ruptpipt-3:~ ruptpipt$ kextstat|grep -y acpiplat
   15    2 0xffffff7f83636000 0x9c000    0x9c000    com.apple.driver.AppleACPIPlatform (6.1) F5A615E4-D5B8-3E06-A29F-F79EA07A15EF <14 13 12 8 7 6 5 3 1>
MBP-di-Ruptpipt-3:~ ruptpipt$ kextstat|grep -y appleintelcpu
MBP-di-Ruptpipt-3:~ ruptpipt$ kextstat|grep -y applelpc
  123    0 0xffffff7f8469f000 0x3000     0x3000     com.apple.driver.AppleLPC (3.1) 6DD4B940-38F9-3E34-8641-19F57B5FA0A8 <119 13 6 5 3>
MBP-di-Ruptpipt-3:~ ruptpipt$ sudo touch /System/Library/Extensions && sudo kextcache -u /
Warning: /AppleInternal/Library/Extensions: No such file or directory
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb12a5e0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/BrcmPatchRAM2.kext/", ID = "com.no-one.BrcmPatchRAM2" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba78bdb0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/BrcmFirmwareRepo.kext/", ID = "com.no-one.BrcmFirmwareStore" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba78e360 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/FakeSMC.kext/", ID = "org.netkas.driver.FakeSMC" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb014330 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Mouse.kext/", ID = "org.rehabman.voodoo.driver.PS2Mouse" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb008910 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/VoodooPS2Controller.kext/", ID = "org.rehabman.voodoo.driver.PS2Controller" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb00da30 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Keyboard.kext/", ID = "org.rehabman.voodoo.driver.PS2Keyboard" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb009fb0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Trackpad.kext/", ID = "org.rehabman.voodoo.driver.PS2Trackpad" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba763840 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/AppleBacklightFixup.kext/", ID = "com.hieplpvip.AppleBacklightFixup" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb8507f30 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/Lilu.kext/", ID = "as.vit9696.Lilu" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba67efd0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/USBInjectAll.kext/", ID = "com.rehabman.driver.USBInjectAll" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfbb007170 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/RealtekRTL8111.kext/", ID = "com.insanelymac.RealtekRTL8111" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb84082a0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/WhateverGreen.kext/", ID = "as.vit9696.WhateverGreen" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb840ab60 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/AppleALC.kext/", ID = "as.vit9696.AppleALC" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb85f8250 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/AirportBrcmFixup.kext/", ID = "as.lvs1974.AirportBrcmFixup" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfb85f6aa0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/BT4LEContinuityFixup.kext/", ID = "as.lvs1974.BT4LEContinuityFixup" }
Kext with invalid signatured (-67062) allowed: <OSKext 0x7fcfba6601d0 [0x7fffabfaf8e0]> { URL = "file:///Library/Extensions/ACPIBatteryManager.kext/", ID = "org.rehabman.driver.AppleSmartBatteryManager" }
KernelCache ID: A03E29BA58F541EF81ADDC21B5D31EFC
MBP-di-Ruptpipt-3:~ ruptpipt$
EDIT: I was wrong. I used wrong offsets in ERM2 OpRegion (I was counting field sizes as bytes instead of bits). Fixed them and all works fine. Thanks (and sorry) everyone for time wasting. If you need stupid mistakes please contact me. :D

Keep in mind that Offset arguments are expressed in bytes, while field sizes are in bits, so:
Code:
Offset(0x04), 
STEF,  8,
AAST,  8,
is
Code:
Offset(0x05),
AAST,  8,
and not
Code:
Offset(0x0c),
AAST, 8,
and you won't waste a day like I did. ;)
 

Attachments

Last edited:
Joined
Mar 28, 2019
Messages
36
Motherboard
ASUS ROG Strix G G531GD
CPU
i5-9300H/HM370
Graphics
UHD 630 + GTX 1050
Mobile Phone
Android
Help, I have tried to disable my discrete card by follow this because my laptop is consume much power and almost 1~1.5% drop per min when idling.
I follow the guide:
I have a _OFF method ***same as the post #3

Code:
Method (_OFF, 0, Serialized)  // _OFF: Power Off
        {
            If (LEqual (CTXT, Zero))
            {
                If (LNotEqual (GPRF, One))
                {
                    Store (VGAR, VGAB)
                }

                Store (One, CTXT)
            }

            PGOF (Zero)
        }
As same as #3, mine also don't have a _INI method, so i patch this:
Code:
DefinitionBlock ("", "SSDT", 2, "hack", "DGPU", 0x00000000)
{
    External (_SB_.PCI0.PEG0.PEGP._PS3, MethodObj)    // 0 Arguments (from opcode)

    Method (_SB.PCI0.PEG0.PEGP._INI, 0, NotSerialized)  // _INI: Initialize
    {
        _PS3 ()
    }
}
BUT the PGOF is not as same as the #3, mine is:
Code:
Method (PGOF, 1, Serialized)
        {
            Store (Arg0, PIOF)
            If (LEqual (PIOF, Zero))
            {
                If (LEqual (SGGP, Zero))
                {
                    Return (Zero)
                }
            }
            ElseIf (LEqual (PIOF, One))
            {
                If (LEqual (P1GP, Zero))
                {
                    Return (Zero)
                }
            }
            ElseIf (LEqual (PIOF, 0x02))
            {
                If (LEqual (P2GP, Zero))
                {
                    Return (Zero)
                }
            }

            Store (\XBAS, PEBA)
            Store (GDEV (PIOF), PDEV)
            Store (GFUN (PIOF), PFUN)
            If (LEqual (CCHK (PIOF, Zero), Zero))
            {
                Return (Zero)
            }

            Acquire (\_SB.PCI0.LPCB.EC0.CMUT, 0xFFFF)
            Store (0xC9, \_SB.PCI0.LPCB.EC0.BRAH)
            If (LNotEqual (And (\_SB.PCI0.LPCB.EC0.CNTD, 0x07), Zero))
            {
                Notify (\_SB.PCI0.PEG0.PEGP, 0xD1)
            }

            Release (\_SB.PCI0.LPCB.EC0.CMUT)
            Store (\_SB.PCI0.PEG0.LREN, \_SB.PCI0.PEG0.PEGP.LTRE)
            If (LEqual (Arg0, Zero))
            {
                Store (LCT0, ELC0)
                Store (S0VI, H0VI)
                Store (S0DI, H0DI)
                Store (LCP0, ECP0)
            }
            ElseIf (LEqual (Arg0, One))
            {
                Store (LCT1, ELC1)
                Store (S1VI, H1VI)
                Store (S1DI, H1DI)
                Store (LCP1, ECP1)
            }
            ElseIf (LEqual (Arg0, 0x02))
            {
                Store (LCT2, ELC2)
                Store (S2VI, H2VI)
                Store (S2DI, H2DI)
                Store (LCP2, ECP2)
            }

            RTDS (PIOF)
            If (LNotEqual (PBGE, Zero))
            {
                If (SBDL (PIOF))
                {
                    Store (GMXB (PIOF), MBDL)
                    PDUB (PIOF, MBDL)
                }
            }

            If (CondRefOf (SCLK))
            {
                SPCO (SCLK, Zero)
            }

            If (LEqual (Arg0, Zero))
            {
                Divide (\_SB.PCI0.PEG0.LNRD, 0x03E8, Local0, Local1)
                Sleep (Local1)
            }
            ElseIf (LEqual (Arg0, One))
            {
                Divide (\_SB.PCI0.PEG1.LNRD, 0x03E8, Local0, Local1)
                Sleep (Local1)
            }
            ElseIf (LEqual (Arg0, 0x02))
            {
                Divide (\_SB.PCI0.PEG2.LNRD, 0x03E8, Local0, Local1)
                Sleep (Local1)
            }

            GPPR (PIOF, Zero)
            DIWK (PIOF)
            Return (Zero)
        }
Apparently, there is EC code in my PGOF. I tried to patch myself with this code:
Code:
DefinitionBlock ("", "SSDT", 2, "hack", "DGPU", 0x00000000)
{
    External (_SB_.PCI0, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.LPCB.EC0_, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.LPCB.EC0_.CMUT, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.LPCB.EC0_.CNTD, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.LPCB.EC0_.XREG, MethodObj)    // 2 Arguments (from opcode)
    External (_SB_.PCI0.PEG0.LNRD, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PEG0.LREN, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PEG0.PEGP, UnknownObj)    // Warning: Unknown object
    External (_SB_.PCI0.PEG0.PEGP.LTRE, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PEG1.LNRD, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PEG2.LNRD, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.CCHK, MethodObj)    // 2 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.DIWK, MethodObj)    // 1 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.ECP0, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.ECP1, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.ECP2, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.ELC0, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.ELC1, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.ELC2, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.GDEV, MethodObj)    // 1 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.GFUN, MethodObj)    // 1 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.GMXB, MethodObj)    // 1 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.GPPR, MethodObj)    // 2 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.H0DI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.H0VI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.H1DI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.H1VI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.H2DI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.H2VI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.LCP0, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.LCP1, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.LCP2, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.LCT0, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.LCT1, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.LCT2, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.MBDL, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.P1GP, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.P2GP, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.PBGE, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.PDEV, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.PDUB, MethodObj)    // 2 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.PEBA, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.PFUN, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.PIOF, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.RTDS, MethodObj)    // 1 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.S0DI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.S0VI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.S1DI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.S1VI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.S2DI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.S2VI, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.SBDL, MethodObj)    // 1 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.SCLK, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.SGGP, MethodObj)    // 0 Arguments (from opcode)
    External (_SB_.PCI0.PGOF.SPCO, MethodObj)    // 2 Arguments (from opcode)
    External (XBAS, MethodObj)    // 0 Arguments (from opcode)

    Scope (_SB.PCI0)
    {
        Method (PGOF, 1, Serialized)
        {
            Store (Arg0, PIOF ())
            If (LEqual (PIOF (), Zero))
            {
                If (LEqual (SGGP (), Zero))
                {
                    Return (Zero)
                }
            }
            ElseIf (LEqual (PIOF (), One))
            {
                If (LEqual (P1GP (), Zero))
                {
                    Return (Zero)
                }
            }
            ElseIf (LEqual (PIOF (), 0x02))
            {
                If (LEqual (P2GP (), Zero))
                {
                    Return (Zero)
                }
            }

            Store (\XBAS (), PEBA ())
            Store (GDEV (PIOF ()), PDEV ())
            Store (GFUN (PIOF ()), PFUN ())
            If (LEqual (CCHK (PIOF (), Zero), Zero))
            {
                Return (Zero)
            }

            Store (\_SB.PCI0.PEG0.LREN (), \_SB.PCI0.PEG0.PEGP.LTRE ())
            If (LEqual (Arg0, Zero))
            {
                Store (LCT0 (), ELC0 ())
                Store (S0VI (), H0VI ())
                Store (S0DI (), H0DI ())
                Store (LCP0 (), ECP0 ())
            }
            ElseIf (LEqual (Arg0, One))
            {
                Store (LCT1 (), ELC1 ())
                Store (S1VI (), H1VI ())
                Store (S1DI (), H1DI ())
                Store (LCP1 (), ECP1 ())
            }
            ElseIf (LEqual (Arg0, 0x02))
            {
                Store (LCT2 (), ELC2 ())
                Store (S2VI (), H2VI ())
                Store (S2DI (), H2DI ())
                Store (LCP2 (), ECP2 ())
            }

            RTDS (PIOF ())
            If (LNotEqual (PBGE (), Zero))
            {
                If (SBDL (PIOF ()))
                {
                    Store (GMXB (PIOF ()), MBDL ())
                    PDUB (PIOF (), MBDL ())
                }
            }

            If (CondRefOf (SCLK))
            {
                SPCO (SCLK (), Zero)
            }

            If (LEqual (Arg0, Zero))
            {
                Divide (\_SB.PCI0.PEG0.LNRD (), 0x03E8, Local0, Local1)
                Sleep (Local1)
            }
            ElseIf (LEqual (Arg0, One))
            {
                Divide (\_SB.PCI0.PEG1.LNRD (), 0x03E8, Local0, Local1)
                Sleep (Local1)
            }
            ElseIf (LEqual (Arg0, 0x02))
            {
                Divide (\_SB.PCI0.PEG2.LNRD (), 0x03E8, Local0, Local1)
                Sleep (Local1)
            }

            GPPR (PIOF (), Zero)
            DIWK (PIOF ())
            Return (Zero)
        }
    }

    Scope (_SB.PCI0.LPCB.EC0)
    {
        OperationRegion (RME3, EmbeddedControl, Zero, 0xFF)
        Method (_REG, 2, NotSerialized)  // _REG: Region Availability
        {
            XREG (Arg0, Arg1)
            If (LAnd (LEqual (0x03, Arg0), LEqual (One, Arg1)))
            {
                Acquire (\_SB.PCI0.LPCB.EC0.CMUT (), 0xFFFF)
                If (LNotEqual (And (\_SB.PCI0.LPCB.EC0.CNTD (), 0x07), Zero))
                {
                    Notify (\_SB.PCI0.PEG0.PEGP, 0xD1)
                }

                Release (\_SB.PCI0.LPCB.EC0.CMUT ())
            }
        }
    }
}
I save as SSDT.aml and put in EFI.
*But there is a compile error and i just "//" it below Acquire (\_SB.PCI0.LPCB.EC0.CMUT (), 0xFFFF) line.
Result: The discrete card doesn't turn off and the fan still running.
I am almost desperate because of worse battery life, Any fix or mistake?
 
Top