Contribute
Register

[Guide] How to patch DSDT for working battery status

I've attached the diagnostics package.

FixRegions_10000000 is a mistake. Remove or set false.
"Problem Reporting" files are incomplete. You forgot to press F4 to collect ACPI/origin.
Read "Problem Reporting" again. Carefully.

Battery patching has not been done correctly. There are multibyte EC fields, unpatched, and referenced.
Read guide in post #1.
Basic DSDT patching also not done.
Main ACPI patching guide is linked from post #1.
 
FixRegions_10000000 is a mistake. Remove or set false.
Thanks, I've changed it.
"Problem Reporting" files are incomplete. You forgot to press F4 to collect ACPI/origin.
Read "Problem Reporting" again. Carefully.
Sorry, I forgot about those. I've added them now.
Battery patching has not been done correctly. There are multibyte EC fields, unpatched, and referenced.
Read guide in post #1.
The fields
Code:
S0PW
S0CT
SXPW
SXCT
M1CT
MOCT
CPWR
CVLT
CCUR
are referenced only in Method (HPMC, 1, NotSerialized) or Method (GPMC, 1, NotSerialized) under Device (WMID). As I understand, this is the Windows Management Instrumentation Device that macOS doesn't deal with.
The fields
Code:
BCW
BCL
BIF
BTY
CCBQ
are not referenced anywhere. That's why I didn't change them. I'll gladly write patches for them if that's going to fix the issue.
Basic DSDT patching also not done.
Main ACPI patching guide is linked from post #1.
Are you sure about that? I've applied quite a few patches to the DSDT that improved hardware support.
 

Attachments

  • elitebook.zip
    1.9 MB · Views: 75
Thanks, I've changed it.

Sorry, I forgot about those. I've added them now.

The fields
Code:
S0PW
S0CT
SXPW
SXCT
M1CT
MOCT
CPWR
CVLT
CCUR
are referenced only in Method (HPMC, 1, NotSerialized) or Method (GPMC, 1, NotSerialized) under Device (WMID). As I understand, this is the Windows Management Instrumentation Device that macOS doesn't deal with.

Other parts of your DSDT may call WMI methods.
I'm not willing to verify that.
You should patch all.

The fields
Code:
BCW
BCL
BIF
BTY
CCBQ
are not referenced anywhere. That's why I didn't change them. I'll gladly write patches for them if that's going to fix the issue.

No need to patch fields which aren't referenced.

Are you sure about that? I've applied quite a few patches to the DSDT that improved hardware support.

Yes.
For example, I searched for "Darwin" in an effort to see if _OSI("Darwin") is accommodated. I did not find it.
("OS Check Fix" patches).
Your ioreg shows _STA returning 0x0F for the two battery objects.
First, two battery objects is a problem when only one battery is present.
And _STA should return 0x1F when there is a battery present... (refer to ACPI spec).

You can use ACPIDebug.kext to further debug your battery methods.

Note also that your ioreg shows ACPIBatteryManager.kext did not load against your BAT0/BAT1 objects.
No idea why...
You should check the kernel log, verify you installed ACPIBatteryManager.kext correctly.
 
Other parts of your DSDT may call WMI methods.
I'm not willing to verify that.
You should patch all.
OK, I've patched them.
For example, I searched for "Darwin" in an effort to see if _OSI("Darwin") is accommodated. I did not find it.

I've applied an OS patch.

Your ioreg shows _STA returning 0x0F for the two battery objects.
First, two battery objects is a problem when only one battery is present.
And _STA should return 0x1F when there is a battery present... (refer to ACPI spec).
The ioreg now shows only BAT0 but _STA is still 0xf.
You can use ACPIDebug.kext to further debug your battery methods.

Where should I add the trace code?
Note also that your ioreg shows ACPIBatteryManager.kext did not load against your BAT0/BAT1 objects.
No idea why...
You should check the kernel log, verify you installed ACPIBatteryManager.kext correctly.
I've included the output of dmesg but I didn't see any messages mentioning battery there.
 

Attachments

  • elitebook.zip
    1.9 MB · Views: 99
Yeah... it seems many do not read this little tidbit from post #1:
I did read it, and checked exhaustively your list of patches. I found the one for the series 3, but didn't dare try it since the list of compatible models didn't include any series 9 laptops. Could you maybe add a comment to the existing patch to specify that it also works for the Series 9?
 
Read ACPIDebug.kext README and ACPI spec.
Obviously, you'll want to put some traces into BAT0._STA to see why it is returning 0xf instead of 0x1f...
I've enabled ACPIDebug and it seems that BAT0._STA returns 0xf three times at startup and then 0x1f afterwards:
Code:
(ACPIBatteryManager) ACPIBatteryManager: Version 1.70.3 starting on OS X Darwin 16.6.
(ACPIBatteryManager) ACPIBatteryManager: Using ACPI regular battery information method _BIF
(ACPIDebug) ACPIDebug: Version 0.1.4 starting on OS X Darwin 16.6.
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0xf, "XOr BT0P follows", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0xf, "XOr BT0P follows", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0xf, "XOr BT0P follows", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0x1f, "XOr BT0P follows", 0xf, }
(ACPIDebug) ACPIDebug: { "Local0", 0x1f, "Local1", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0x1f, "XOr BT0P follows", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0x1f, "XOr BT0P follows", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0x1f, }
//Last two lines repeat continuously after
I would guess there's a delay in the battery initialisation that's causing this behaviour.
The trace code I used:
Code:
Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Store (\_SB.PCI0.LPCB.EC0.BSTA (0x01), Local0)
                \RMDT.P4 ("\_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", Local0, "XOr BT0P follows", BT0P)
                If (XOr (BT0P, Local0))
                {
                    Store (Local0, BT0P)
                    Store (Local0, Local1)
                    \RMDT.P4 ("Local0", Local0, "Local1", Local1)
                    If (LNotEqual (Local1, 0x1F))
                    {
                        Store (0x00, Local1)
                    }

                    \_SB.SSMI (0xEA3A, 0x00, Local1, 0x00, 0x00)
                    \_GPE.HWWP (0x01)
                    \_SB.WMID.WGWE (0x05, 0x00)
                }
                \RMDT.P2 ("\_SB.PCI0.BAT0._STA returning", Local0)
                Return (Local0)
            }
 
I did read it, and checked exhaustively your list of patches. I found the one for the series 3, but didn't dare try it since the list of compatible models didn't include any series 9 laptops. Could you maybe add a comment to the existing patch to specify that it also works for the Series 9?

I will only add such comments when people reply here with confirmation.
 
I've enabled ACPIDebug and it seems that BAT0._STA returns 0xf three times at startup and then 0x1f afterwards:
Code:
(ACPIBatteryManager) ACPIBatteryManager: Version 1.70.3 starting on OS X Darwin 16.6.
(ACPIBatteryManager) ACPIBatteryManager: Using ACPI regular battery information method _BIF
(ACPIDebug) ACPIDebug: Version 0.1.4 starting on OS X Darwin 16.6.
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0xf, "XOr BT0P follows", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0xf, "XOr BT0P follows", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0xf, "XOr BT0P follows", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0xf, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0x1f, "XOr BT0P follows", 0xf, }
(ACPIDebug) ACPIDebug: { "Local0", 0x1f, "Local1", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0x1f, "XOr BT0P follows", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", 0x1f, "XOr BT0P follows", 0x1f, }
(ACPIDebug) ACPIDebug: { "_SB.PCI0.BAT0._STA returning", 0x1f, }
//Last two lines repeat continuously after
I would guess there's a delay in the battery initialisation that's causing this behaviour.
The trace code I used:
Code:
Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Store (\_SB.PCI0.LPCB.EC0.BSTA (0x01), Local0)
                \RMDT.P4 ("\_SB.PCI0.LPCB.EC0.BSTA (0x01) returned", Local0, "XOr BT0P follows", BT0P)
                If (XOr (BT0P, Local0))
                {
                    Store (Local0, BT0P)
                    Store (Local0, Local1)
                    \RMDT.P4 ("Local0", Local0, "Local1", Local1)
                    If (LNotEqual (Local1, 0x1F))
                    {
                        Store (0x00, Local1)
                    }

                    \_SB.SSMI (0xEA3A, 0x00, Local1, 0x00, 0x00)
                    \_GPE.HWWP (0x01)
                    \_SB.WMID.WGWE (0x05, 0x00)
                }
                \RMDT.P2 ("\_SB.PCI0.BAT0._STA returning", Local0)
                Return (Local0)
            }

No "Problem Reporting" files attached.
Read FAQ, "Problem Reporting" again. Carefully. Attach all requested files/output.
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/
 

Attachments

  • elitebook.zip
    1.9 MB · Views: 79
Back
Top