Contribute
Register

[Guide] Native Power Management for Laptops

You must include all the SSDTs you expect to load in SortedOrder.
Clover will load only those SSDTs listed, in the order listed.
I added SSDT-PluginType1.aml to SortedOrder as a last item (it's not important to add it first or last, right?), kext loaded, it's working now. However, I got 1.30 GHz and 500 MHz base frequencies respectively for CPU and GPU again. When the kext not loaded, CPU was going below 1.30 but GPU was stuck 300 MHz even with Geekbench GPU test. So, this means I still need to use Pike's freqVectorsEdit.sh script to edit plists, right? Grrr, I thought it's the method causing this issue but turns out it's the plist in the kext itself for broadwell.
 
I added SSDT-PluginType1.aml to SortedOrder as a last item (it's not important to add it first or last, right?), kext loaded, it's working now. However, I got 1.30 GHz and 500 MHz base frequencies respectively for CPU and GPU again. When the kext not loaded, CPU was going below 1.30 but GPU was stuck 300 MHz even with Geekbench GPU test. So, this means I still need to use Pike's freqVectorsEdit.sh script to edit plists, right? Grrr, I thought it's the method causing this issue but turns out it's the plist in the kext itself for broadwell.

Read about Pike's freqVectorEdit.sh script.
 
I have a strange issue. After I fixed Broadwell Low Frequency issue with Piker Alpha's freqVectorsEdit.sh, CPU freq dropped to 800 Mhz but IGPU freq started acting weird. When I use the system with any app, it's dynamically changes 500 Mhz to 850 MHz. That's ok but when I close all apps and let Intel Power Gadget to run only, CPU freq stays at 800 Mhz however IGPU freq stays 850 MHz.

I tried several times. Opened a 4K 60 fps video on YouTube and checked it, it was 500 MHz, 550 Mhz during the video. Whenever I close the browser and wait a few secs IGPU freq throttles up to 850 MHz and stays there.

Have anyone seen something like that before?

Besides, before the freqVectorsEdit.sh fix, graph on Intel Power Gadget for both CPU and GPU were calm and has almost no stress but after the fix they both going up and down. I tried Geekbench CPU test, CPU freq is like going to 2.50 GHz (not 2.70 GHz for some reason) and 800 MHz all the time. It wasn't like stayed 2+ GHz during the test, Also, GPU was hanging out between 500 - 600 MHz during the GPU test, I never seen it throttled up to 900 MHz nor 850 MHz.

Can you check my Power Management broken or not due to the freqVectorsEdit.sh fix?

Thanks.
 

Attachments

  • AE's MBP PR IGPU Issue.zip
    5.3 MB · Views: 81
I have a strange issue. After I fixed Broadwell Low Frequency issue with Piker Alpha's freqVectorsEdit.sh, CPU freq dropped to 800 Mhz but IGPU freq started acting weird. When I use the system with any app, it's dynamically changes 500 Mhz to 850 MHz. That's ok but when I close all apps and let Intel Power Gadget to run only, CPU freq stays at 800 Mhz however IGPU freq stays 850 MHz.

I tried several times. Opened a 4K 60 fps video on YouTube and checked it, it was 500 MHz, 550 Mhz during the video. Whenever I close the browser and wait a few secs IGPU freq throttles up to 850 MHz and stays there.

Have anyone seen something like that before?

Besides, before the freqVectorsEdit.sh fix, graph on Intel Power Gadget for both CPU and GPU were calm and has almost no stress but after the fix they both going up and down. I tried Geekbench CPU test, CPU freq is like going to 2.50 GHz (not 2.70 GHz for some reason) and 800 MHz all the time. It wasn't like stayed 2+ GHz during the test, Also, GPU was hanging out between 500 - 600 MHz during the GPU test, I never seen it throttled up to 900 MHz nor 850 MHz.

Can you check my Power Management broken or not due to the freqVectorsEdit.sh fix?

Thanks.

Test without freqVectorsEdit.sh changes (eg. restore native IOPlatformPlugin.kext).
 
Test without freqVectorsEdit.sh changes (eg. restore native IOPlatformPlugin.kext).
I have no backup. Does freqVectorsEdit.sh back up the kext before patching it? Where can I find the original IOPlatformPlugin.kext?

Btw, let's say I wanna edit a plist file in a kext. Which one is the best approach? Backing up the whole kext then do the changes or backing up only the plist file in the kext then do the changes?

Thanks
 
I have no backup. Does freqVectorsEdit.sh back up the kext before patching it? Where can I find the original IOPlatformPlugin.kext?

You can run the macOS/OS X installer to restore it (just don't erase the target partititon, and it is a "refresh install").

Btw, let's say I wanna edit a plist file in a kext. Which one is the best approach? Backing up the whole kext then do the changes or backing up only the plist file in the kext then do the changes?

Your choice.
 
You can run the macOS/OS X installer to restore it (just don't erase the target partititon, and it is a "refresh install").
Is it a reinstall the whole OS or at what stage I cancel the setup?

Thanks
 
Is it a reinstall the whole OS or at what stage I cancel the setup?

Thanks

No cancelling. Run from start to finish.
(next time, you will remember to save a backup of any kext you're thinking about patching).
 
hell
Overview

Power Management should be one of the first things implemented when trying to install OS X on a laptop. Because of heat/noise and battery life issues, using NullCPUPowerManagement is not a realistic option on a laptop.

Fortunately, with Clover, you NullCPUPowerManagement is never needed.

This guide will assume you started by following my Clover guide for laptops:

http://www.tonymacx86.com/el-capita...de-booting-os-x-installer-laptops-clover.html


Custom SSDT.aml using ssdtPRGen.sh

Use the ssdtPRGen.sh script by Pike R. Alpha: https://github.com/Piker-Alpha/ssdtPRGen.sh

Instructions for using it are provided in the README.

The generated SSDT.aml should be placed on the EFI partition at /EFI/Clover/ACPI/patched/SSDT.aml.

Based on the current instructions at the README, what follows is a synopsis...

To prepare, you only need to do the first two commands:
Code:
cd ~
curl -o ./ssdtPRGen.sh https://raw.githubusercontent.com/Piker-Alpha/ssdtPRGen.sh/master/ssdtPRGen.sh
chmod +x ./ssdtPRGen.sh

With newer computers (Broadwell, Skylake, and future), make sure you use the beta branch:
Code:
cd ~
curl -o ./ssdtPRGen.sh https://raw.githubusercontent.com/Piker-Alpha/ssdtPRGen.sh/Beta/ssdtPRGen.sh
chmod +x ./ssdtPRGen.sh

Then you can run the script:
Code:
./ssdtPRGen.sh

Note: If you have a CPU currently unsupported by the script (the Beta branch has more comprehensive data, so this is less likely with the Beta), you may have to provide the data for it.

For example, i7-4720HQ:
Code:
./ssdtPRGen.sh -p 'i7-4710HQ' -f 2600 -turbo 3600

By providing the name 'i7-4710HQ' (similar enough to i7-4720HQ), and overrides for the non-turbo and turbo frequencies, the script is successful. Eventually, it would not be necessary, provided the script is updated with the new CPUs.

When it asks if you want to copy to /Extra just respond 'n'. Same for opening ssdt.dsl... respond 'n'.

The results are at ~/Library/ssdtPRGen/SSDT.aml.

Assuming your EFI partition is mounted at /Volumes/EFI, copy that file to EFI partition, /EFI/Clover/ACPI/patched/SSDT.aml

Code:
cd ~
cp ~/Library/ssdtPRGen/ssdt.aml /Volumes/EFI/EFI/Clover/ACPI/patched/SSDT.aml

Also, be aware that hibernation (suspend to disk or S4 sleep) is not supported on hackintosh.

You should disable it:
Code:
sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage
sudo mkdir /var/vm/sleepimage

Always check your hibernatemode after updates and disable it. System updates tend to re-enable it, although the trick above (making sleepimage a directory) tends to help.

And it may be a good idea to disable the other hibernation related options:
Code:
sudo pmset -a standby 0
sudo pmset -a autopoweroff 0


Testing PM

After installing the custom SSDT, you should reboot and test it. You can test using DPCIManager (1.5) by using the PStates monitor. AppleIntelCPUPowerManagementInfo.kext (now renamed AppleIntelInfo.kext) will generally provide more accurate results.

Note: DPCIManager currently does not work on 10.11. Use AppleIntelInfo.kext instead.

In addition, for Ivy Bridge and later (eg. Ivy, Haswell, Broadwell, Skylake, KabyLake, etc), you should run IORegistryExplorer and verify that X86PlatformPlugin is loading under the CPU0 node.

More information on Native PM is available here: http://www.tonymacx86.com/mountain-...tive-ivy-bridge-cpu-gpu-power-management.html

For Mavericks specific information, read here: http://www.tonymacx86.com/mavericks...vericks-native-cpu-igpu-power-management.html


Checklist

Here is a quick Ivy/Sandy/Haswell+ Power Management checklist.

- SSDT.aml at EFI/Clover/ACPI/patched
- config.plist/KernelAndKextPatches/AsusAICPUPM=true (pre-Haswell)
- config.plist/KernelAndKextPatches/KernelPm=true (Haswell+)
- config.plist/KernelAndKextPatches/KernelLapic=true (for those with Local APIC panic)
- appropriate System Definition (SMBIOS) for your CPU (config.plist/SMBIOS)
- no rollbacks of AppleACPIPlatform.kext
- no NullCPUPowerManagement.kext (usually implies patched AppleIntelCPUPowerManagement)
- Processor objects declared in Scope (_SB) or Scope (_PR) in DSDT (pretty rare not to have them in OEM DSDT)
- Verify that the generated SSDT injects into the same scope as Processor declarations in DSDT (usually _PR)


AppleACPIPlatform and EmbeddedControl

Note: For Sandy Bridge PM, it is possible to run a rollback of AppleACPIPlatform.kext but it is discouraged. Watch out for battery manager packages that include a rolled back AppleACPIPlatform.kext.

Note: Running stock AppleACPIPlatform.kext means any DSDT methods that manipulate EC (EmbeddedControl) registers larger than 8-bits will not work and will cause the method to fail. These methods must be patched. Access to such registers is common in DSDT battery methods. Some patches are provided at my laptop DSDT patch repository at: https://github.com/RehabMan/Laptop-DSDT-Patch


Note on laptops with AMD Radeon

It is sometimes necessary to drop the MCFG table (use config.plist/ACPI/DropTables).


Note on older CPUs

For CPUs older than Sandy Bridge, use config.plist/Generate=true instead of custom SSDT.aml. Since that option causes Clover to generate replacement CPU SSDTs, you will also need to drop the OEM CPU related SSDTs. Usually that means setting config.plist/ACPI/SSDT/DropOem=true, although you may be able to drop the individual tables with DropTables.


Notes on DropOem=true

With older hardware you may need to drop OEM CPU related SSDTs (as mentioned above). Although you can drop individual tables with config.plist/ACPI/DropTables, it is easiest to drop all with config.plist/ACPI/SSDT/DropOem=true.

With modern hardware (Haswell and later), the system almost always works better if you retain all the SSDTs. The newer systems may even have trouble booting if you eliminate them.

As a result, don't use DropOem=true unless you have to. It is needed on certain computers Sandy Bridge and older.

More information regarding DropOem is available in the ACPI patching guide:

http://www.tonymacx86.com/el-capitan-laptop-support/152573-guide-patching-laptop-dsdt-ssdts.html

--

For additional information for earlier versions of OS X and Chameleon/Chimera, see original post here: http://www.tonymacx86.com/yosemite-laptop-support/146870-guide-native-power-management-laptops.html


Experimental technique: XCPM only

If you have a computer with Haswell or later (eg. Haswell, Broadwell, Skylake, KabyLake, etc), you can use a simpler method that does not involve ssdtPRgen.sh. Since power management is in the kernel (XCPM), it appears the custom tables generated by ssdtPRgen.sh are not needed. But we still need X86PlatformPlugin to load.

In order to do that we only need an SSDT that will inject the "plugin-type" property ("plugin-type"=1). The SSDT is available in my hotpatch repo here: https://github.com/RehabMan/OS-X-Clover-Laptop-Config (hotpatch/SSDT-PluginType1.dsl).

Direct link: https://raw.githubusercontent.com/R...p-Config/master/hotpatch/SSDT-PluginType1.dsl

The contents of it are simple:
Code:
// Inject plugin-type=1 on _PR.CPU0
// This is experimental to see how only injecting plugin-type with native CPU PM SSDTs
// works on various platforms.
//
// Results: OK on Haswell+, not so good on Ivy
DefinitionBlock("", "SSDT", 2, "hack", "PluginType", 0)
{
    External(\_PR.CPU0, DeviceObj)
    Method (\_PR.CPU0._DSM, 4)
    {
        If (!Arg2) { Return (Buffer() { 0x03 } ) }
        Return (Package()
        {
            "plugin-type", 1
        })
    }
}
//EOF

To use it, compile it as AML in MaciASL, then copy to your EFI/Clover/ACPI/patched.

For example, in Terminal (assuming you have iasl installed):
Code:
# download SSDT-PluginType1.dsl and compile it as SSDT-PluginType1.aml
curl -o ./SSDT-PluginType1.dsl https://raw.githubusercontent.com/RehabMan/OS-X-Clover-Laptop-Config/master/hotpatch/SSDT-PluginType1.dsl
iasl SSDT-PluginType1.dsl
# not valid to use both SSDT.aml and SSDT-PluginType1.aml, so remove it
rm /Volumes/EFI/EFI/Clover/ACPI/patched/SSDT.aml
cp SSDT-PluginType1.aml /Volumes/EFI/EFI/Clover/ACPI/patched/SSDT-PluginType1.aml

Testing and verification is the same was when using SSDT.aml generated from ssdtPRgen.sh.


Experimental option for Skylake/Kaby Lake (and later): HWP

In Skylake CPUs, Intel introduced a new power management technology: SpeedShift (aka. SST, aka. HWP).

With HWP enabled, the CPU handles pstate management by itself instead of requiring the OS to do it. The CPU itself will automatically shift to higher and lower pstates depending on CPU demand.

In order to use HWP, use an SMBIOS that is enabled for HWP... currently MacBook9,1, MacBookPro13,x. Also, since HWP tends to cause the xcpm_idle to be invoked, make sure the xcpm_idle patch (courtesy of PikeRAlpha) is enabled. It is default in all current plists provided by my Clover laptop guide. If you're using older than current plists, you may have to copy the patch into your config.plist/KernelAndKextPatches/KernelToPatch section.

You can also enable HWP for other SMBIOS by creating a patched resources injector for X86PlatformPlugin.kext (or by patching the kext itself). But that is a subject for another day.

Note: You still need SSDT.aml from ssdtPRgen.sh or SSDT-PluginType1.aml as discussed earlier.


Problem Reporting

Be precise about the nature of the problem.

Attach ioreg as ZIP: http://www.tonymacx86.com/audio/58368-guide-how-make-copy-ioreg.html. Please, use the IORegistryExplorer v2.1 attached to the post! DO NOT reply with an ioreg from any other version of IORegistryExplorer.app.

Provide output (in Terminal):
Code:
kextstat|grep -y acpiplat
kextstat|grep -y appleintelcpu
kextstat|grep -y applelpc
kextstat|grep -y applehda

Attach EFI/Clover folder as ZIP (press F4 at main Clover screen before collecting). Please eliminate 'themes' directory. Provide only EFI/Clover, not the entire EFI folder.

Attach output of (in Terminal):
Code:
sudo touch /System/Library/Extensions && sudo kextcache -u /

Compress all files as ZIP. Do not use external links. Attach all files using site attachments only.

hello rehabman thanks for making cools guide, i had a problem, appleintelpowermanagement.kext not loaded, i dont know why, i was follow your guide correctly, i think because of appleintelcpu not loaded my system not wake correctly, if i wake from sleep and open apps like chrome or movist it hang or freeze and shown rainbow circle, i need to restart my system using terminal because if i restart using restart menu it doesnt do anything, hope you can help me , thankyou rehabman,
 

Attachments

  • Archive.zip
    4.6 MB · Views: 59
hell


hello rehabman thanks for making cools guide, i had a problem, appleintelpowermanagement.kext not loaded, i dont know why, i was follow your guide correctly, i think because of appleintelcpu not loaded my system not wake correctly, if i wake from sleep and open apps like chrome or movist it hang or freeze and shown rainbow circle, i need to restart my system using terminal because if i restart using restart menu it doesnt do anything, hope you can help me , thankyou rehabman,

AppleIntelCPUPowerManagement.kext is not used for the hardware in your profile, therefore not expected.
AppleIntelCPUPowerManagement.kext last enabled for Ivy Bridge. Haswell and later use X86PlatformPlugin and XCPM.

For your sleep issue, open a separate thread.
(although I can see your ACPI setup is wrong. _OSI->XOSI patch is not valid without SSDT-XOSI.aml).
 
Back
Top