quarta-feira, 4 de março de 2015

[Guide] Native Power Management for Laptops

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. This guide will start assuming you are running Multibeast for the first time and wish to implement power management on a laptop with a Sandy Bridge, Ivy Bridge CPU, or Haswell CPU.

Make sure you download and use the latest version of Multibeast. Most laptops have locked CPU MSRs so you need a patched AppleIntelCPUPowerManagement.kext to avoid a KP upon boot. In fact, you just watch for updates to the system that might replace this kext and be sure to replace it with a patched version before rebooting following the update. Some laptops can flash a patched BIOS to avoid this problem, but I do not recommend it. Why risk bricking your laptop with a patched BIOS when a simple software change can accomplish the same thing?

You should be aware of what kind of CPU you have. A Sandy Bridge CPU will be Core iX-2xxx[U|M|QM]. An Ivy Bridge CPU will be a Core iX-3xxx[U|M|QM], and Haswell Core iX-4xxx[U|M|QM]. Know what the exact CPU is in your laptop and provide it in your profile. Just saying "I have a laptop with an i5" is not helpful.

Most of this guide's specifics are concerning Chameleon/Chimera bootloader configuration. If you're using Clover, the same concepts apply, but the details are different. Clover differences are covered at the end of the post.

First run of Multibeast (make sure you are using the latest version) select the following options:

- UserDSDT or DSDT-Free Installation
- Sandy/Ivy only: Drivers & Bootloaders -> Drivers -> System -> Patched AppleIntelCPUPowerManagement. With Haswell patched AICPUPM is not necessary, since PM is handled in the kernel instead. And, of course, you already had to patch mach_kernel to even make it this far.
(be sure to select the version appropriate for the version of OS X you have installed)

Note: If you have a laptop subject to "Local APIC panic" (HP consumer laptops, for example), you should install the KernelPatcher module from Chameleon to /Extra/modules. The KernelPatcher module is available from Chameleon Wizard and the Chameleon package installer.

Choosing an SMBIOS

If you have a laptop with Sandy Bridge CPU use Multibeast's Customization -> System Definitions -> MacBookPro8,1.

If you have an Ivy Bridge CPU, you should obtain/create an appropriate System Definition (/Extra/smbios.plist) for your laptop. If your CPU ends in 'U', you should probably use MacBookAir5,2. If your CPU ends in 'M' use the ProBook Installer to create a custom MacBookPro9,1 or MacBookPro9,2. To create a MacBookAir5,2 smbios.plist, use Chameleon Wizard.

If you have Haswell, you should use a Haswell era smbios. iMac14,2 is available in Multibeast, but one of the Haswell laptop smbios might be more appropriate. Chameleon Wizard has support for MacBookAir6,2, but MacBookPro11,2 must be created manually (use Clover Configurator for clues).

That should give you basic power management (without TurboBoost), plus a bootloader and a starter /Extra folder. You can reboot and test booting directly from your HDD at this point.

Custom SSDT for CPU

Next step is to install a custom SSDT using the ProBook Installer. Download the latest ProBook Installer and select only the SSDT option. Click continue to install it. It is important to have your final smbios in place before generating a custom SSDT, so make sure you reboot with the smbios in /Extra before continuing to generate an SSDT.

Note: Much of the content in the ProBook Installer is specific to the ProBook. But not the SSDT generator. It can be used on any computer with a Sandy/Ivy/Haswell CPU, even desktops.

Note: For Yosemite, it is recommended you use the latest version of ssdtPRgen.sh script here:https://github.com/Piker-Alpha/ssdtPRGen.sh. The script contained in the ProBook Installer is an older version and may not work on Yosemite.

Now that you have a custom SSDT, you should make a few changes to /Extra/org.chameleon.Boot.plist:

- set GenerateCStates=No
- set GeneratePStates=No
- add DropSSDT=Yes

You can use Chameleon Wizard to edit these options if you're not familiar with XML plists.

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 will generally provide more accurate results. 

In addition, for Ivy Bridge or Haswell CPUs, you should run IORegistryExplorer and verify that X86PlatformPlugin is loading under the CPU0 node.

More information on Ivy Bridge PM is available here: ML: Native Ivy Bridge CPU and GPU Power Management

For Mavericks specific information, read here: Mavericks: Native CPU/IGPU Power Management

Checklist

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

- patched AppleIntelCPUPowerManagement installed (except on Haswell)
- SSDT installed to /Extra/ssdt.aml for your CPU (easiest to use ProBook Installer)
- appropriate System Definition (smbios.plist) for your CPU
- DropSSDT=Yes, GeneratePStates=No, GenerateCStates=No
- 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 older CPUs

For CPUs older than Sandy Bridge, use GeneratePStates=Y GenerateCStates=Y DropSSDT=Y. No need for custom SSDT (there are no tools to generate one).

Notes on Clover

With Clover there are slight differences, although the same concepts apply.

Here is a quick Ivy/Sandy/Haswell Power Management checklist as it relates to Clover:
- obviously, with Clover, you're using the Clover Installer to get a bootloader on your HDD. So there is no need to use Multibeast.
- patched AppleIntelCPUPowerManagement can be patched on the fly with config.plist/KernelAndKextPatches/AsusAICPUPM=true
- the kernel can be patched for XCPM (Haswell) with config.plist/KernelAndKextPatches/KernelPm=true
- the kernel can be patched for "Local APIC" panic with config.plist/KernelAndKextPatches/KernelLapic=true
- generated SSDT should be placed at /EFI/CLOVER/ACPI/patched/SSDT.aml
- appropriate System Definition (SMBIOS) for your CPU in config.plist/SMBIOS. Use the Clover Configurator to generate one
- to drop all OEM SSDTs, use config.plist/ACPI/SSDT/DropOem=true
- no rollbacks of AppleACPIPlatform.kext
- no NullCPUPowerManagement.kext (NullCPU is not even required during installation because AsusAICPUPM=true)
- Processor objects declared in Scope (_SB) or Scope (_PR) in DSDT (pretty rare not to have them in OEM DSDT)

Nenhum comentário:

Postar um comentário