Contribute
Register

Lid close stop working after sleep

Status
Not open for further replies.
all errors are gone now
That's fine...

@dandepeched, you'd have to add \RMDT.P2("ZWAK=",Arg0) to the DSDT original _WAK method which will be then hotpatched to ZWAK by clover during boot. We've to be sure that all wake-up methods are correctly called.
To do so, you've to patch the DSDT file and put it in clover/ACPI/patched folder. Due to a parse error present in your DSDT, I did it for you. I also add some debug statements into SSDT-BAT OWAK methods, use both attachments and replace the SSDT-BAT you have in patched folder. Reboot and collect all ACPI statements in log and check if an ACPI error occurs during all wake-up sequence.

Just for clarity, below the right wake-up sequence:
_WAK method is called from System (the one you added in PTSWAK)
_WAK method (in PTSWAK) is calling ZWAK (the original DSDT _WAK method you renamed in ZWAK with clover)
ZWAK method (in DSDT) is calling OWAK method (patched in SSDT-BAT)

You may also want to test with the original OWAK method. To do so, you've to disable the clover OWAK hotpatch renaming and temporary disable the OWAK method in SSDT-BAT file (to avoid dual OWAK methods). The original OWAK has been patched for battery compatibility but you could give it a try to verify whether with the original DSDT OWAK method the behavior is different/correct.
 

Attachments

  • DSDT.aml
    125.8 KB · Views: 55
  • SSDT-BAT.aml
    6.1 KB · Views: 58
You may also want to test with the original OWAK method. To do so, you've to disable the clover OWAK hotpatch renaming and temporary disable the OWAK method in SSDT-BAT file (to avoid dual OWAK methods). The original OWAK has been patched for battery compatibility but you could give it a try to verify whether with the original DSDT OWAK method the behavior is different/correct.

@FreeJHack, thanks for DSDT and SSDT-BAT files. It looks like ACPIBatteryManager.kext does not work correctly when SSDT-BAT is used together with DSDT. Such errors are printed on battery status check:
default 12:36:31.966930 +0300 kernel ACPI Error: default 12:36:31.966935 +0300 kernel Method parse/execution failed default 12:36:31.966943 +0300 kernel [\_SB.PCI0.LPCB.EC.GBIX] (Node ffffff8028675780) default 12:36:31.966950 +0300 kernel , AE_BAD_PARAMETER

Also on wake following errors was observed:
ACPI Error: default 12:36:37.964214 +0300 kernel Method parse/execution failed default 12:36:37.964218 +0300 kernel [\ZWAK] (Node ffffff8028676f60) default 12:36:37.964219 +0300 kernel , AE_BAD_PARAMETER default 12:36:37.964222 +0300 kernel (20160930/psparse-632) default 12:36:37.964225 +0300 kernel ACPI Error: default 12:36:37.964228 +0300 kernel Method parse/execution failed default 12:36:37.964229 +0300 kernel [\_WAK] (Node ffffff802868c0c0) default 12:36:37.964232 +0300 kernel , AE_BAD_PARAMETER default 12:36:37.964233 +0300 kernel (20160930/psparse-632) default 12:36:37.964240 +0300 kernel ACPI Exception: AE_BAD_PARAMETER, default 12:36:37.964241 +0300 kernel While executing method \_WAK default 12:36:37.964245 +0300 kernel (20160930/hwesleep-161) default 12:36:37.964249 +0300 kernel Facs->FirmwareWakingVector: 0x0 default 12:36:49.049795 +0300 kernel 0000000000000004 default 12:36:49.049799 +0300 kernel default 12:36:49.049800 +0300 kernel Arg2: default 12:36:49.049805 +0300 kernel ffffff803b82c3c0 default 12:36:49.049807 +0300 kernel <Obj> default 12:36:49.049811 +0300 kernel Integer default 12:36:49.049812 +0300 kernel 0000000000000001 default 12:36:49.049816 +0300 kernel default 12:36:49.049818 +0300 kernel Arg3: default 12:36:49.049821 +0300 kernel ffffff8027f68b90 default 12:36:49.049824 +0300 kernel <Obj> default 12:36:49.049828 +0300 kernel Package default 12:36:49.049830 +0300 kernel ffffff8027f68b90 default 12:36:49.049836 +0300 kernel

To make a clean test I removed ACPIBatteryManager.kext. For such config few errors are printed, but no ACPIDebug:
default 12:52:49.691208 +0300 kernel No Local Variables are initialized for method [ZWAK] default 12:52:49.691269 +0300 kernel [\ZWAK] (Node ffffff80389cbcc0) default 12:52:49.691273 +0300 kernel , AE_NOT_FOUND default 12:52:49.691279 +0300 kernel (20160930/psparse-632) default 12:52:49.691285 +0300 kernel ACPI Error: default 12:52:49.691291 +0300 kernel Method parse/execution failed default 12:52:49.691295 +0300 kernel [\_WAK] (Node ffffff80389e1cc0) default 12:52:49.691301 +0300 kernel , AE_NOT_FOUND default 12:52:49.691306 +0300 kernel (20160930/psparse-632) default 12:52:49.691319 +0300 kernel Facs->FirmwareWakingVector: 0x0 default 12:52:49.691320 +0300 kernel Facs->Length: 0x40 default 12:52:49.691322 +0300 kernel Facs->Version: 0x2 default 12:52:49.691324 +0300 kernel Facs->XFirmwareWakingVector: 0x0 default 12:52:49.691325 +0300 kernel Facs->OspmFlags: 0x0 default 12:52:53.732780 +0300 kernel AppleACPIPlatformPower Wake reason: power-button XHC (User)

Also I've tried the original OWAK by removing SSDT-BAT and disabling all related hotpaches. For that test no errors or ACPI messages are printed, except system one:
default 12:43:23.414650 +0300 kernel (20160930/psparse-632) default 12:43:23.414709 +0300 kernel Facs->FirmwareWakingVector: 0x0 default 12:43:23.414711 +0300 kernel Facs->Length: 0x40 default 12:43:23.414711 +0300 kernel Facs->Version: 0x2 default 12:43:23.414713 +0300 kernel Facs->XFirmwareWakingVector: 0x0 default 12:43:23.414714 +0300 kernel Facs->OspmFlags: 0x0 default 12:43:23.420328 +0300 kernel AppleACPIPlatformPower Wake reason: power-button XHC (User) default 12:43:23.420329 +0300 kernel AppleACPIPlatformPower Wake reason: power-button XHC (User)

I'm wondering why no ACPIDebug messages are printed for any of those configurations.
 
I'm wondering why no ACPIDebug messages are printed for any of those configurations.

PR files are missing and they're mandatory for a complete check...
 
PR files are missing and they're mandatory for a complete check...

Sorry for that! Debug files attached (ACPIBatteryManager.kext removed, SSDT-BAT is present)
 

Attachments

  • debug_10106.zip
    7.4 MB · Views: 76
ACPIBatteryManager.kext removed, SSDT-BAT is present
I'm pretty sure ACPIBatteryManager.kext is not an issue...
Instead, problem in hotpatching GBIX & GBST. Your clover hotpatching methods are no more valid for DSDT I provided.
Look at kernel.log
Code:
2019-10-15 12:49:27.627834+0300 0x71       Default     0x0                  0      0    kernel: (AppleACPIPlatform) ACPI Error:
2019-10-15 12:49:27.627836+0300 0x71       Default     0x0                  0      0    kernel: (AppleACPIPlatform) [GBIX]
2019-10-15 12:49:27.627843+0300 0x71       Default     0x0                  0      0    kernel: (AppleACPIPlatform) ACPI Exception: AE_ALREADY_EXISTS,
Here below the clover GBIX & GBST hotpatching valid for both versions (original & mine)
Code:
Comment: Change GBIX  Find:4742495803  Replace:5842495803
Comment: Change GBST  Find:4742535404  Replace:5842535404
Then check the error is gone and re-test sleep/wake sequence and log messages as per post #21
 
Here below the clover GBIX & GBST hotpatching valid for both versions (original & mine)

@FreeJHack, thanks! You are right, those errors are gone now.
Here is the new log from wake. Sequence seems to be correct?
default 11:13:23.523782 +0300 kernel ACPIDebug: { "ZWAK=", 0x3, } default 11:13:23.536614 +0300 kernel ACPIDebug: { "Calling OWAK", 0x3, } default 11:13:23.537360 +0300 kernel ACPIDebug: { "SSDT-OWAK", 0x3, } default 11:13:27.552843 +0300 kernel ACPIDebug: { "SSDT-GBIX", 0x0, } default 11:13:27.611808 +0300 kernel ACPIDebug: { "SSDT-GBST", 0x0, } default 11:13:27.619657 +0300 kernel ACPIBatteryManager: WARNING! fMaxCapacity > fDesignCapacity. adjusted fMaxCapacity from 4257, to 4079 default 11:13:27.626528 +0300 kernel ACPIDebug: { "Arg 3 OWAK", 0x3, } default 11:13:27.648648 +0300 kernel ACPIDebug: { "Arg 3 & 4 OWAK", 0x3, } default 11:13:27.649283 +0300 kernel ACPIDebug: { "Exiting OWAK", 0x3, } default 11:13:27.649670 +0300 kernel ACPIDebug: { "Exiting ZWAK", 0x3, } default 11:13:27.655106 +0300 kernel Facs->FirmwareWakingVector: 0x0 default 11:13:27.655107 +0300 kernel Facs->Length: 0x40 default 11:13:27.655108 +0300 kernel Facs->Version: 0x2 default 11:13:27.655109 +0300 kernel Facs->XFirmwareWakingVector: 0x0 default 11:13:27.655110 +0300 kernel Facs->OspmFlags: 0x0 default 11:13:27.661002 +0300 kernel AppleACPIPlatformPower Wake reason: power-button XHC (User)

Recent debug files are attached.
 

Attachments

  • debug_20116.zip
    7.5 MB · Views: 51
those errors are gone now
Ok

@dandepeched Wak sequence seems correct...
Instead, some basic patches are still missing from DSDT. I've added to the attached DSDT the 'OS fix'.
Replace the DSDT in patched folder, reboot and test lid.
If it's still not working, try also adding the SSDT-LPCB file in patched folder.

If still not working, as per post #21
You may also want to test with the original OWAK method.
did you gave it a try?
 

Attachments

  • DSDT.aml
    125.8 KB · Views: 55
  • SSDT-LPCB.aml
    232 bytes · Views: 69
Ok

@dandepeched Wak sequence seems correct...
Instead, some basic patches are still missing from DSDT. I've added to the attached DSDT the 'OS fix'.
Replace the DSDT in patched folder, reboot and test lid.
If it's still not working, try also adding the SSDT-LPCB file in patched folder.

If still not working, as per post #21

did you gave it a try?

@dandepeched FWIW, I had to need to drop _DSM method for the existing LPCB device for the SSDT-LPCB to work, otherwise they will conflict and the SSDT-LPCB has no effect. I've renamed all _DSM to XDSM with success on my E480 and applied the LPCB patch.

Also, I've read through your SSDT-BAT methods (GBIX, OWAK, etc) and the code is nearly (or 100% if I'm correct) identical in my ASL.

That said, the OS fix, while it definitely affects some of the functionality in the WAK and PTS functions (based on reading the code), doesn't appear to solve the issue with the lid, media keys, etc after a sleep/wake cycle. I've applied SSDT-XOSI and also have modified it to return true for "FreeBSD" (and even defer to Darwin's _OSI when the argument doesn't match Windows or FreeBSD, even though this is unnecessary), which has the same affect as returning true for "Linux" based on the DSDT code that calls _OSI.

I will apply the WAK Arg fix via SSDT (recently switched to completely hotpatched and didn't reapply it because it had no visible affect), and upload my reporting files.

EDIT: I've also tried switching to VirtualSMC for the heck of it; it worked, but it didn't solve the lid/keys after sleep/wake issue.

EDIT2: clarification
 
Last edited:
Okay! I've applied SSDT-PTSWAK (disabling fixes that didn't seem necessary) for the WAK arg fix and also left in the _SST fix for the heck of it. The problem still occurs. I have attached Problem Reporting files.

Two questions I have / am wondering if anyone here knows the answer to:
1. The DPTS fix (which enables PEG0 on _PTS and disabled on _WAK) -- what is this for? Could this potentially help?
2. More likely, I noticed while doing more digging this comment:
Correct.
It is pretty easy to customize/use SSDT-Disable_DGPU if it is just a simple call to _OFF that is required.
And actually quite simple if you need the additional code in _PTS/_WAK.
But more complicated if _OFF or anything it calls has EC references, as then you need to patch it ("Rename/Replace" pattern) and you need to patch EC._REG (again, "Rename/Replace").

It looks like this affects at least my ASL (did not check @dandepeched 's ACPI but assume it is the case there as well given how close the ACPI code appears for both of our machines):

- PEG0._OFF, found in SSDT-8-SgUlx, calls _SB.PCI0.HGOF,
- HGOF, defined in SSDT-7-SgPch, has at least one reference to the EC, storing Zero in \_SB.PCI0.LPCB.EC.GATY.

So it seems that patching _OFF so that it just sets the _STA to 0 is necessary; if so, what (if anything) needs to be patched in regards to EC._REG if my understanding is correct? It looks like patching such that the _STA is updated and the other, EC related functionality is called in EC._REG, is necessary based on a RehabMan guide. Definitely overlooked this.

EDIT: Looks like I broke sleep in my SSDT-BAT; will report back once this is resolved. Old PR files deleted. Updated Problem Reporting files with fixed SSDT-BAT: debug_29856.zip

EDIT2: Answered my own question regarding the DDGPU issue.

EDIT3: I've fixed my SSDT-DDGPU (by targeting the correct ACPI path AFAICT), hotpatching _OFF->XOFF & moving EC related functions to _REG, and now call XOFF/_ON from _PTS/_WAK based on the RM guide. Problem still persists. Latest PR files are debug_3641.zip.
 

Attachments

  • debug_29856.zip
    3.4 MB · Views: 42
  • debug_3641.zip
    3.4 MB · Views: 59
Last edited:

Attachments

  • SSDT-PTSWAK.aml
    293 bytes · Views: 64
Status
Not open for further replies.
Back
Top