Contribute
Register

[Guide] How to patch DSDT for working battery status

Hi Rehabman,, I make new patch for Acer one 14 z1402g, Intel Core i3-5005U (Broadwell Generations)

Here is the patch
Code:
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized) { Return (Or (Arg0, ShiftLeft (Arg1, 8))) }\n
end;

# 16-bit registers
into device label EC0 code_regex XIF1,\s+16, replace_matched begin IF10,8,IF11,8, end;
into device label EC0 code_regex XIF2,\s+16, replace_matched begin IF20,8,IF21,8, end;
into device label EC0 code_regex XIF3,\s+16, replace_matched begin IF30,8,IF31,8, end;
into device label EC0 code_regex XIF4,\s+16, replace_matched begin IF40,8,IF41,8, end;
into device label EC0 code_regex XIF7,\s+16, replace_matched begin IF70,8,IF71,8, end;
into device label EC0 code_regex XST0,\s+16, replace_matched begin ST00,8,ST01,8, end;
into device label EC0 code_regex XST1,\s+16, replace_matched begin ST10,8,ST11,8, end;
into device label EC0 code_regex XST2,\s+16, replace_matched begin ST20,8,ST21,8, end;
into device label EC0 code_regex XST3,\s+16, replace_matched begin ST30,8,ST31,8, end;
into device label EC0 code_regex BIF1,\s+16, replace_matched begin BIA0,8,BIA1,8, end;
into device label EC0 code_regex BIF1,\s+16, replace_matched begin BIB0,8,BIB1,8, end;
into device label EC0 code_regex BST1,\s+16, replace_matched begin BSA0,8,BSA1,8, end;

# fix 16-bit methods
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF1, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF10,^^PCI0.LPCB.EC0.IF11), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF2, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF20,^^PCI0.LPCB.EC0.IF21), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF3, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF30,^^PCI0.LPCB.EC0.IF31), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF4, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF40,^^PCI0.LPCB.EC0.IF41), end;
into method label _BIF code_regex \(\^\^PCI0\.LPCB\.EC0\.XIF7, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.IF70,^^PCI0.LPCB.EC0.IF71), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST0, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST00,^^PCI0.LPCB.EC0.ST01), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST1, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST10,^^PCI0.LPCB.EC0.ST11), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST2, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST20,^^PCI0.LPCB.EC0.ST21), end;
into method label _BST code_regex \(\^\^PCI0\.LPCB\.EC0\.XST3, replaceall_matched begin (B1B2(^^PCI0.LPCB.EC0.ST30,^^PCI0.LPCB.EC0.ST31), end;


# utility methods to read/write buffers from/to EC
into method label RE1B parent_label EC0 remove_entry;
into method label RECB parent_label EC0 remove_entry;
into device label EC0 insert
begin
Method (RE1B, 1, NotSerialized)\n
{\n
    OperationRegion(ERAM, EmbeddedControl, Arg0, 1)\n
    Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }\n
    Return(BYTE)\n
}\n
Method (RECB, 2, Serialized)\n
// Arg0 - offset in bytes from zero-based EC\n
// Arg1 - size of buffer in bits\n
{\n
    ShiftRight(Arg1, 3, Arg1)\n
    Name(TEMP, Buffer(Arg1) { })\n
    Add(Arg0, Arg1, Arg1)\n
    Store(0, Local0)\n
    While (LLess(Arg0, Arg1))\n
    {\n
        Store(RE1B(Arg0), Index(TEMP, Local0))\n
        Increment(Arg0)\n
        Increment(Local0)\n
    }\n
    Return(TEMP)\n
}\n
end;
into method label WE1B parent_label EC0 remove_entry;
into method label WECB parent_label EC0 remove_entry;
into device label EC0 insert
begin
Method (WE1B, 2, NotSerialized)\n
{\n
    OperationRegion(ERAM, EmbeddedControl, Arg0, 1)\n
    Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }\n
    Store(Arg1, BYTE)\n
}\n
Method (WECB, 3, Serialized)\n
// Arg0 - offset in bytes from zero-based EC\n
// Arg1 - size of buffer in bits\n
// Arg2 - value to write\n
{\n
    ShiftRight(Arg1, 3, Arg1)\n
    Name(TEMP, Buffer(Arg1) { })\n
    Store(Arg2, TEMP)\n
    Add(Arg0, Arg1, Arg1)\n
    Store(0, Local0)\n
    While (LLess(Arg0, Arg1))\n
    {\n
        WE1B(Arg0, DerefOf(Index(TEMP, Local0)))\n
        Increment(Arg0)\n
        Increment(Local0)\n
    }\n
}\n
end;

I hope you can check it and add to your repository
View attachment 228727 View attachment 228728

The "MECHREVO x6TI" patch already in the repo is a match.
 
You can inject "model" to fix the graphics name cosmetics.
How would I go about doing this? is it in the 'Add properties' section of clover config?
Screen Shot 2017-01-06 at 5.45.31 PM.png

Did you need to use the minStolenSize patch or is DVMT-prealloc changeable in BIOS (or large enough by default)?

I didn't find I needed to edit that, I couldn't even find it in the BIOS, so I assume it was already set
 
How would I go about doing this? is it in the 'Add properties' section of clover config?
View attachment 228732

You can do it various ways... If you're using config.plist/Graphics/Inject/Intel=true, then yes... use /Devices/AddProperties.

I didn't find I needed to edit that, I couldn't even find it in the BIOS, so I assume it was already set

It is a good trend...
 
If you're using config.plist/Graphics/Inject/Intel=true, then yes... use /Devices/AddProperties.
Hmmmm I have added /Graphics/Inject/Intel=true and added 'IntelGFX, model, Intel HD Graphics 620' to AddProperties, but still Intel Unknown in system profiler... perhaps a typo?
 
Hmmmm I have added /Graphics/Inject/Intel=true and added 'IntelGFX, model, Intel HD Graphics 620' to AddProperties, but still Intel Unknown in system profiler... perhaps a typo?

Off-topic. This thread is for battery status.
Open a separate thread, attach same "Problem Reporting" files as requested here in post #1.
 
Hey man, my battery status was working for like 6 months and then... it stopped working all of a sudden. It always shows 100%. Until I reboot, then sometimes shows proper status, sometimes doesn't. And sometimes just randomly shows 0% and that my Mac will shut down. While in reality I'm using the computer for like 10 minutes. It's all screwed up. Here's all the necessary stuff for problem reporting in the attachment. Should I repatch my computer?

Terminal output:
Code:
kextstat|grep -y acpiplat
   13    2 0xffffff7f82d77000 0x66000    0x66000    com.apple.driver.AppleACPIPlatform (4.0) A29C7512-D3A8-3AED-9721-3A5FF1A32EB2 <12 11 7 6 5 4 3 1>
patchm|⇒ kextstat|grep -y appleintelcpu
patchm|⇒ kextstat|grep -y applelpc
  116    0 0xffffff7f82759000 0x3000     0x3000     com.apple.driver.AppleLPC (3.1) 32BDCF9F-0473-32D4-9DAE-F523EFB2D244 <115 12 5 4 3>
patchm|⇒ sudo touch /System/Library/Extensions && sudo kextcache -u /
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext toledaARPT.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext SmoothMouse.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext IntelBacklight.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext HDAEnabler3.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID_Intel_HD_Graphics.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext CodecCommander.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ApplePS2Keyboard.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ApplePS2Controller.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ApplePS2SmartTouchPad.kext
kext-dev-mode allowing invalid signature -67030 0xFFFFFFFFFFFEFA2A for kext AppleHDAHardwareConfigDriver.kext
kext-dev-mode allowing invalid signature -67061 0xFFFFFFFFFFFEFA0B for kext AppleHDA.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ACPIBatteryManager.kext
 

Attachments

  • CLOVER.zip
    1.6 MB · Views: 199
  • IOReg.ioreg
    4.7 MB · Views: 213
  • patchm.zip
    50.6 KB · Views: 172
Hey man, my battery status was working for like 6 months and then... it stopped working all of a sudden. It always shows 100%. Until I reboot, then sometimes shows proper status, sometimes doesn't. And sometimes just randomly shows 0% and that my Mac will shut down. While in reality I'm using the computer for like 10 minutes. It's all screwed up. Here's all the necessary stuff for problem reporting in the attachment. Should I repatch my computer?

Terminal output:
Code:
kextstat|grep -y acpiplat
   13    2 0xffffff7f82d77000 0x66000    0x66000    com.apple.driver.AppleACPIPlatform (4.0) A29C7512-D3A8-3AED-9721-3A5FF1A32EB2 <12 11 7 6 5 4 3 1>
patchm|⇒ kextstat|grep -y appleintelcpu
patchm|⇒ kextstat|grep -y applelpc
  116    0 0xffffff7f82759000 0x3000     0x3000     com.apple.driver.AppleLPC (3.1) 32BDCF9F-0473-32D4-9DAE-F523EFB2D244 <115 12 5 4 3>
patchm|⇒ sudo touch /System/Library/Extensions && sudo kextcache -u /
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext toledaARPT.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext SmoothMouse.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext IntelBacklight.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext HDAEnabler3.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID_Intel_HD_Graphics.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext FakePCIID.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext CodecCommander.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ApplePS2Keyboard.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ApplePS2Controller.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ApplePS2SmartTouchPad.kext
kext-dev-mode allowing invalid signature -67030 0xFFFFFFFFFFFEFA2A for kext AppleHDAHardwareConfigDriver.kext
kext-dev-mode allowing invalid signature -67061 0xFFFFFFFFFFFEFA0B for kext AppleHDA.kext
kext-dev-mode allowing invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext ACPIBatteryManager.kext

Your _REG method is coded incorrectly. The EC related things from _OFF should only be done when the EC is ready.

You have:
Code:
          Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                If (LEqual (Arg0, 0x03))
                {
                    Store (Arg1, ECFL)
                }

                If (LAnd (LEqual (Arg0, 0x03), LEqual (Arg1, One)))
                {
                    SPIN (0x96, Zero)
                }

                Store (RRAM (0x0521), Local0)
                And (Local0, 0xCF, Local0)
                WRAM (0x0521, Local0)
                WRAM (0x0520, 0x95)
                WRAM (0x03A4, Zero)
                WRAM (0x03A5, Zero)
            }

Should be:
Code:
          Method (_REG, 2, NotSerialized)  // _REG: Region Availability
            {
                If (LEqual (Arg0, 0x03))
                {
                    Store (Arg1, ECFL)
                }

                If (LAnd (LEqual (Arg0, 0x03), LEqual (Arg1, One)))
                {
                    SPIN (0x96, Zero)

                    Store (RRAM (0x0521), Local0)
                    And (Local0, 0xCF, Local0)
                    WRAM (0x0521, Local0)
                    WRAM (0x0520, 0x95)
                    WRAM (0x03A4, Zero)
                    WRAM (0x03A5, Zero)
                }
            }

Since this incorrect code may have put your EC into a bad state, you will also need to do an EC reset (after correcting the code).
 
Your _REG method is coded incorrectly. The EC related things from _OFF should only be done when the EC is ready.

Sorry this may be off-topic, but I can't seem to disassemble DSDT into .dsl with iasl. I get

Code:
ACPI Exception: AE_ALREADY_EXISTS, During name lookup/catalog (20141107/psobject-305)

Doesn't work neither with patchmatic nor F4. All necessary files (if you need to debug) are in my post above. The iasl creates DSDT.dsl file but the contents are:

Code:
Could not parse ACPI tables, AE_ALREADY_EXISTS
 
Sorry this may be off-topic, but I can't seem to disassemble DSDT into .dsl with iasl. I get

Code:
ACPI Exception: AE_ALREADY_EXISTS, During name lookup/catalog (20141107/psobject-305)

Doesn't work neither with patchmatic nor F4. All necessary files (if you need to debug) are in my post above. The iasl creates DSDT.dsl file but the contents are:

Code:
Could not parse ACPI tables, AE_ALREADY_EXISTS

See guide: https://www.tonymacx86.com/threads/guide-patching-laptop-dsdt-ssdts.152573/
 
Back
Top