Contribute
Register

[Guide] How to patch DSDT for working battery status

Looks good.



Keep in mind you have two BCV4 and two SMD0 in different scopes. Rename the ones in EC so you can tell which code refers to them (you'll get errors from the compiler, which will tell you which code you need to worry about).

If you rename them, and there are no errors... then they are not referenced (I think you'll find they are not referenced, so false alarm by me...)

So if there is no SMD0 reference in EC then it can be left as it was before.

So instead of this bug with ERIB everything else should be okay.

Code:
# Battery patch for Dell Inspiron 5548 Broadwell
# created by Resset

# Split 16-bit fields into 8-bit fields
into device label EC0 code_regex BRC0,\s+16, replace_matched begin RC00,8,RC01,8, end;
into device label EC0 code_regex BSN0,\s+16, replace_matched begin SN00,8,SN01,8, end;
into device label EC0 code_regex BPV0,\s+16, replace_matched begin PV00,8,PV01,8, end;
into device label EC0 code_regex BDV0,\s+16, replace_matched begin DV00,8,DV01,8, end;
into device label EC0 code_regex BDC0,\s+16, replace_matched begin DC00,8,DC01,8, end;
into device label EC0 code_regex BFC0,\s+16, replace_matched begin FC00,8,FC01,8, end;
into device label EC0 code_regex BAC0,\s+16, replace_matched begin AC00,8,AC01,8, end;
into device label EC0 code_regex BFCB,\s+16, replace_matched begin FCB0,8,FCB1,8, end;
into device label EC0 code_regex ERIB,\s+16, replace_matched begin ERI0,8,ERI1,8, end;

# Fix BIFX-related values
into method label BIFX code_regex \(\^\^EC0\.BDV0, replaceall_matched begin (B1B2(^^EC0.DV00,^^EC0.DV01), end;
into method label BIFX code_regex \(\^\^EC0\.BDC0, replaceall_matched begin (B1B2(^^EC0.DC00,^^EC0.DC01), end;
into method label BIFX code_regex \(\^\^EC0\.BFC0, replaceall_matched begin (B1B2(^^EC0.FC00,^^EC0.FC01), end;
into method label BIFX code_regex \(\^\^EC0\.BFCB, replaceall_matched begin (B1B2(^^EC0.FCB0,^^EC0.FCB1), end;

# Fix GUBS-related values
into method label GUBS code_regex \(\^\^EC0\.BSN0, replaceall_matched begin (B1B2(^^EC0.SN00,^^EC0.SN01), end;
into method label GUBS code_regex \(\^EC0\.BSN0, replaceall_matched begin (B1B2(^EC0.SN00,^EC0.SN01), end;

# Fix _BST-related values
into method label _BST code_regex \(\^\^EC0\.BRC0, replaceall_matched begin (B1B2(^^EC0.RC00,^^EC0.RC01), end;
into method label _BST code_regex \s\^\^EC0\.BPV0\) replaceall_matched begin B1B2(^^EC0.PV00,^^EC0.PV01)) end;
into method label _BST code_regex \(\^\^EC0\.BPV0, replaceall_matched begin (B1B2(^^EC0.PV00,^^EC0.PV01), end;
into method label _BST code_regex \(\^\^EC0\.BAC0, replaceall_matched begin (B1B2(^^EC0.AC00,^^EC0.AC01), end;

# Fix FAN-related values
into method label FANG code_regex Store\s+\(Arg0,\s+ERIB\) replace_matched begin Store(Arg0, ERI0) Store(ShiftRight(Arg0, 8), ERI1) end;
into method label FANW code_regex Store\s+\(Arg0,\s+ERIB\) replace_matched begin Store(Arg0, ERI0) Store(ShiftRight(Arg0, 8), ERI1) end;

# Deal with 128-bit BATN field
into device label EC0 code_regex (BATN,)\s+(128) replace_matched begin BATX,%2,//%1%2 end;
into method label GBMN code_regex \(\^\EC0\.BATN, replaceall_matched begin (^EC0.RECB(0x90,128), end;


# Add utility methods to DSDT in order to deal with more than 8-bit fields by RehabMan

# method to read from 16-bit fields
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }\n
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;

Thank you veery much for your advices RehabMan :)
 

Attachments

  • battery-dell-inspiron-5548.zip
    79.5 KB · Views: 70
So if there is no SMD0 reference in EC then it can be left as it was before.

...

Thank you veery much for your advices RehabMan :)

Added to the repo. Thanks!
 
Hi rehabman! I have successfully made a patch for my dv2500! Its working! Maybe you want to add it to your repository?? Below i have appended a clean dsdt for you to check whether i did is correct and the actually patch itself! Thanks!
 

Attachments

  • battery_HP-DV2-2500.txt
    7.2 KB · Views: 141
  • dsdt_dv2000.aml
    39.2 KB · Views: 118
Hi rehabman! I have successfully made a patch for my dv2500! Its working! Maybe you want to add it to your repository?? Below i have appended a clean dsdt for you to check whether i did is correct and the actually patch itself! Thanks!

Your L1L4 method does not work. Integers are limited to 64-bits (it actually depends on ACPI version in the DSDT header, but most will be 64-bits, not 32-bits).

I tested:
Code:
            Store(L1L4(0x10001000, 0x20002000, 0x30003000, 0x40004000), Local0)
            \rmdt.p2("L1L4 result", Local0)

output:
Code:
Oct 29 09:38:44 localhost kernel[0]: ACPIDebug: { "L1L4 result", 0x2000200010001000, }

As expected, you're losing the high 64-bits.

Read post #1 for how to deal with buffer fields correctly.
 
Screen Shot 2015-10-29 at 2.03.56 PM.jpg
Hi, I have an HP Pavilion dv6-6033cl and I'm having trouble editing the dsdt.aml file to show the battery status. I installed the latest ACPIBatterManager.kext version 1.60.3 Attached is the dsdt.aml file.
 

Attachments

  • DSDT.aml
    51 KB · Views: 97
View attachment 159582
Hi, I have an HP Pavilion dv6-6033cl and I'm having trouble editing the dsdt.aml file to show the battery status. I installed the latest ACPIBatterManager.kext version 1.60.3 Attached is the dsdt.aml file.

I suspect the "HP DV6t-6b00" is a match.
 
Screen Shot 2015-10-29 at 4.43.36 PM.png
Thanks RehabMan for the quick response!
So I copied texts from "battery_HP-DV6t-6b00.txt" and pasted in the "patch text" field in MACiASL and get these errors when I went to compile it. Can you help me understand what is going on?
 
View attachment 159604
Thanks RehabMan for the quick response!
So I copied texts from "battery_HP-DV6t-6b00.txt" and pasted in the "patch text" field in MACiASL and get these errors when I went to compile it. Can you help me understand what is going on?

There are no errors in your image.
 
Oh they are just warnings lol
Thanks RehabMan, for pointing me in the right direction. I went ahead and save the dsdt, reboot, and got battery % !!!!!Screen Shot 2015-10-29 at 4.53.33 PM.jpg
 
Oh they are just warnings lol
Thanks RehabMan, for pointing me in the right direction. I went ahead and save the dsdt, reboot, and got battery % !!!!!View attachment 159609

Added a comment in the file regarding compatibility with your DV6t-6033cl...
 
Back
Top