Contribute
Register

[Guide] Native Power Management for Laptops

I pulled SSDT-0 to -11 files from Clover/acpi/origin directory and went through one by one. I moved off Scope_PR.CPUx and fixed/compiled the rest, and placed them in the Clover/acpi/patch directory. Here is what I did in more detail:
SSDT Changes:

DONE - Moved Scope_PR.CPUx related to the directory “Filtered-Scope_PR.CPUx”
SSDT 3, 4, 5, 6, 7, 10

DONE SSDT-9. This one may affect Sleep/Wake. But changing/patching/compling this will require reseatation of other PR.CPUx
Has SB.PCCD. CPPC - A new technology based on the ACPI 5.0 specification that dynamically modulates performance vs. active application power. It reduces active power to deliver better battery life and allows deeper lower power states to be reached (compared to prior generations of Intel Core processor products).
Moved Scope_PR.CPUx related to the directory “Filtered-Scope_PR.CPUx”

DONE - SSDT-0
Has method KOU1 - not sure what to do. Deploy it to Clover.

DONE - SSDT-2
Has SB.PCI0.SAT1 - Compiled okay. SAT1 methods referenced from DSDT. Deploy to Clover..

DONE - SSD-11
Has SB.IFFS - SDD and NFSS configured with IFFS hibernation partition. Probably need for Sleep/Wake. Deploy to Clover.

DONE - SSDT-8
Has SB.PCI0.B0D3, SB.PCI0.VID. Changed VID to IGPU. AINT, GLIS, GSCI, GSSE method referenced from DSDT.
Changed PCI0.VID to PCI0.IGPU

DONE - SSDT-1
Has KOU2, SB.PCI0.VID.LCD0, SB.PCI0.VID.LCD0
Graphic LCD related. Changed PCI0.VID to PCI0.IGPU.


But, I am still cannot wake from sleep. I re-extracted the output of patchmatic, ioreg, and SSDT files i worked on. The patchmatic output shows the SSDT files I have added.

Any suggestion?
 

Attachments

  • RehaMan-X1C-2.zip
    401.4 KB · Views: 75
  • SSDT Dev.zip
    66.9 KB · Views: 73
I pulled SSDT-0 to -11 files from Clover/acpi/origin directory and went through one by one. I moved off Scope_PR.CPUx and fixed/compiled the rest, and placed them in the Clover/acpi/patch directory. Here is what I did in more detail:
SSDT Changes:

DONE - Moved Scope_PR.CPUx related to the directory “Filtered-Scope_PR.CPUx”
SSDT 3, 4, 5, 6, 7, 10

DONE SSDT-9. This one may affect Sleep/Wake. But changing/patching/compling this will require reseatation of other PR.CPUx
Has SB.PCCD. CPPC - A new technology based on the ACPI 5.0 specification that dynamically modulates performance vs. active application power. It reduces active power to deliver better battery life and allows deeper lower power states to be reached (compared to prior generations of Intel Core processor products).
Moved Scope_PR.CPUx related to the directory “Filtered-Scope_PR.CPUx”

DONE - SSDT-0
Has method KOU1 - not sure what to do. Deploy it to Clover.

DONE - SSDT-2
Has SB.PCI0.SAT1 - Compiled okay. SAT1 methods referenced from DSDT. Deploy to Clover..

DONE - SSD-11
Has SB.IFFS - SDD and NFSS configured with IFFS hibernation partition. Probably need for Sleep/Wake. Deploy to Clover.

DONE - SSDT-8
Has SB.PCI0.B0D3, SB.PCI0.VID. Changed VID to IGPU. AINT, GLIS, GSCI, GSSE method referenced from DSDT.
Changed PCI0.VID to PCI0.IGPU

DONE - SSDT-1
Has KOU2, SB.PCI0.VID.LCD0, SB.PCI0.VID.LCD0
Graphic LCD related. Changed PCI0.VID to PCI0.IGPU.


But, I am still cannot wake from sleep. I re-extracted the output of patchmatic, ioreg, and SSDT files i worked on. The patchmatic output shows the SSDT files I have added.

Any suggestion?

Your DSDT still has unprotected references to IAOE, which could be an issue. All unresolved externals should be protected with CondRefOf checks, to avoid access to undefined symbols. Requires careful analysis of the code.

See what I did in the u430 patch repo (patches/iaoe.txt): https://github.com/RehabMan/Lenovo-U430-Touch-DSDT-Patch

Also, you should make sure to disable any weird options your BIOS has (TPM, etc).
 
trying the following modified dsdt patch

# _WAK fixes
into method label _WAK code_regex If\s+\(And\s+\(\\_SB\.PCI0\.IGPU\.TCHE,\s+0x0100\)\) replace_matched
begin
If (LAnd(CondRefOf(\\_SB.IAOE), And(\\_SB.PCI0.IGPU.TCHE, 0x0100)))
end;

into method label _WAK code_regex If\s+\(And\s+\(\\_SB\.IAOE\.GAOS,\s+One\)\) replace_matched
begin
If (LAnd(CondRefOf(\\_SB.IAOE), And(\\_SB.IAOE.GAOS, One)))
end;

into method label _WAK code_regex If\s+\(And\s+\(\\_SB\.IAOE\.GSWR,\s+0x02\)\) replace_matched
begin
If (LAnd(CondRefOf(\\_SB.IAOE), And(\\_SB.IAOE.GSWR, Ox02)))
end;
 
Beautiful guide RehabMan. You are a life saver. Got it all working and tested on my Lenovo L430. DCPIManager 1.5 is a neat tool. my version didn't have the check pstates option.

Thank you

DPCIManager v1.5 definitely has the "PStates" button.
 
In the case of the u430, I simply fixed the errors and included them as-is. Any dynamic SSDTs (/sys/firmware/acpi/tables/dynamic or suffixed with 'x' via Clover F4) should be excluded as they will load dynamically via code in DSDT or SSDTs via ACPI 'Load'.

At that point, you can exclude the "Fix PNOT/PPNT" patch as that DSDT patch is only required due to the OEM SSDTs being eliminated in the first place. And no need to generate _PSS/_CST via Clover, since these objects are now provided by the OEM SSDTs. You still need a generated SSDT.aml via ssdtPRgen.sh to add what appear to be Apple/legacy objects such as APSS/ACST/APLF/APSN, and of course "plugin-type"=1 injection.

Thanks a lot for this. I used the helper functions in your makefile to identify the correct PM ssdts, removed PNOT patch and turned off clover p/c states generation. Seems to be working just fine!

Interestingly enough I had the same bogus 'Package (0x06) {0x80000000, ..., 0x80000000}' definitions (repeated 16 times) in the same ssdt. Used your patch to clean it up and all is good.
 
Thanks a lot for this. I used the helper functions in your makefile to identify the correct PM ssdts, removed PNOT patch and turned off clover p/c states generation. Seems to be working just fine!

Interestingly enough I had the same bogus 'Package (0x06) {0x80000000, ..., 0x80000000}' definitions (repeated 16 times) in the same ssdt. Used your patch to clean it up and all is good.

Nice... thanks for the feedback...

I'll soon try the same thing with my ProBook 4540s (Ivy), just to see if the it is dependent on XCPM or if it works also with AppleIntelCPUPowerManagement.kext.
 
Does this look right?

If (VIGD)
{
If (And (\_SB.PCI0.IGPU.TCHE, 0x0100))
{
If (And (\_SB.IAOE.GAOS, One))
{
If (And (\_SB.IAOE.GSWR, 0x02))
{
Store (Or (And (\_SB.PCI0.IGPU.STAT, 0xFFFFFFFC), One), \_SB.PCI0.IGPU.STAT)
Store (One, \_SB.PCI0.LPC.EC.SKEM)
}
}
}
}


changed to


If (\VIGD)
{
If (LAnd(CondRefOf(\_SB.IAOE), And(\_SB.PCI0.IGPU.TCHE, 0x0100)))
{
If (LAnd(CondRefOf(\_SB.IAOE), And(\_SB.IAOE.GAOS, 0x01)))
{
If (LAnd(CondRefOf(\_SB.IAOE), And(\_SB.IAOE.GSWR, 0x02)))
{
Store (Or (And (\_SB.PCI0.IGPU.STAT, Not (0x03)), 0x01), \_SB.PCI0.IGPU.STAT)
Store (0x01, \_SB.PCI0.LPC.EC.SKEM)
}
}
}
}
 
Does this look right?

Code:
                If (VIGD)
                {
                    If (And (\_SB.PCI0.IGPU.TCHE, 0x0100))
                    {
                        If (And (\_SB.IAOE.GAOS, One))
                        {
                            If (And (\_SB.IAOE.GSWR, 0x02))
                            {
                                Store (Or (And (\_SB.PCI0.IGPU.STAT, 0xFFFFFFFC), One), \_SB.PCI0.IGPU.STAT)
                                Store (One, \_SB.PCI0.LPC.EC.SKEM)
                            }
                        }
                    }
                }


changed to

Code:
                If (\VIGD)
                {
                    If (LAnd(CondRefOf(\_SB.IAOE), And(\_SB.PCI0.IGPU.TCHE, 0x0100)))
                    {
                        If (LAnd(CondRefOf(\_SB.IAOE), And(\_SB.IAOE.GAOS, 0x01)))
                        {
                            If (LAnd(CondRefOf(\_SB.IAOE), And(\_SB.IAOE.GSWR, 0x02)))
                            {
                                Store (Or (And (\_SB.PCI0.IGPU.STAT, Not (0x03)), 0x01), \_SB.PCI0.IGPU.STAT)
                                Store (0x01, \_SB.PCI0.LPC.EC.SKEM)
                            }
                        }
                    }
                }

Yes and No.

It will probably work because the first CondRefOf(\_SB.IAOE) will fail. But you did more changes than necessary. There is no reason to check CondRefOf(\_SB.IAOE) after it has already returned true.

Here's something to keep in mind for other code...

You cannot use change 'some_expression_involving_x' to 'LAnd(CondRefOf(x), some_expression_involving_x)'...

Both arguments to LAnd are evaluated before the result of LAnd is computed. Thus the some_expression_involving_x will still be evaluated even if CondRefOf(x) is false.

This is unlike C/C++ where boolean expressions are short-circuited...

eg.

Code:
if (x() && y()) {
}

In C/C++, the above x() function will be called always, and if it returns 0, y() will NOT be called. Thus the call to y() is short-circuited because of a zero return from x().
 
I have a Nahelem i5 520m Dell Latitude E6410 laptop and i did Generate p and c states drop ssdt pm works well including speedstep but sleep not works at all the laptop can't go to sleep properly the screen turns off i can't wake it but the cpu fan not stops and the power led also not blinks (i waited more than ten minutes). What can i do with this?
 
Back
Top