Jump to content

Power management for Sandy/Ivy Bridge/Haswell CPUs

Chameleon CPU SSDT AICPUPM patch Sandy Bridge Ivy Bridge Power Management

  • Please log in to reply
93 replies to this topic

#1
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

*
POPULAR

Hello folks!

First of all it is very good that we have an updated version of Chameleon, so please take this most updated version right here in the official thread: http://www.insanelym...ameleon-22-svn/

Since 10.7.4 for CPUs and SandyBridger IvyBridger P and C States - that are responsible for the proper functioning of energy - are no longer provided by Chameleon, in others words, only activate GeneratePStates and GenerateCStates doesn't work any more.

A quick exit is to use the kext NullCPUPowermanagement, but I don't recommend continued use of this kext because it disables AppleIntelCPUPowermanagement kext which is responsible for power management

The most viable and recommended solution that will give to you a good power management is the creation of a SSDT which will contain all P-States and C-States.

Step-by-Step

Creating the SSDT

 

Create your SSDT based on the script  Pike R. Alpha
Run these commands in terminal

curl -o ssdtPRGen.sh https://raw.github.com/Piker-Alpha/RevoBoot/clang/i386/libsaio/acpi/Tools/ssdtPRGen.sh
chmod +x ssdtPRGen.sh
./ssdtPRGen.sh

After you run it you need to put the Maximum Frequency and Maximum TDP of your CPU ... see these information  about your CPU in here: http://ark.intel.com/
This is an example of one i7 2600 that has 3800MHz(3.8 Ghz) of maximum frequency and 95 of TDP

sudo ./ssdtPRGen.sh 3800 95

Place the SSDT in Extra folder and rename ssdt_pr for SSDT

 

Note: Some CPUs are auto-detected by the script, the script just now detects the maximum frequency and TDP, so if simply after running the first command you are prompted to save the SSDT in Extra folder(not asking to enter your max frequenc. and TDP as the guide teach),don't worry about it, just to confirm, because the script already detected everything and created the SSDT and the time is already asking to save the file.

Patch AppleIntelCPUPowermanagement

 

In older mobos is necessary to patch the kext AICPUPM to enable recording in Bios, otherwise you will get a kernel panic because it can't write to the Bios ...

Download the patch: AICPUPMpatch

Run in terminal

cd ~/Downloads/AICPMPatch

Just find and list ...

perl AICPMPatch.pl /System/Library/Extensions/AppleIntelCPUPowerManagement.kext/Contents/MacOS/AppleIntelCPUPowerManagement

Then give patch in wrmsr to enable recording in Bios

sudo perl AICPMPatch.pl /System/Library/Extensions/AppleIntelCPUPowerManagement.kext/Contents/MacOS/AppleIntelCPUPowerManagement --patch

After that you need to update the cache

sudo touch /System/Library/Extensions

Kernel Patch for Haswell CPU(Kernel XCPM)

 

Since version 10.8.5 a new kernel was implemented on OSX, he called XNU kernel(XNU CPU Power Management(xcpm)).

 

This kernel has the power management moved down into it, in past we used AppleIntelCPUPowermanagement kext to control power management and some Bios were lockeds, in others words, were not allowed to write information on it, so the patch was created for kext AICPUPM to solve this problem (see above how to patch the kext AICPUPM).

 

But with the power management moved down into the kernel(XNU kernel) AICPUPM the kext isn't loaded and so the same mistake that we were having in the past with AICPUPM kext(Kernel Panic)are having now with the XNU kernel in some models CPU haswell(mainly in portable models, some Desktop models doesn't need patch)

 

To solve this problem it is necessary to patch the kernel.

 

Open the terminal and type:

cd /Volumes/Name of your HDD/

Now copy this perl code if you use version 10.9 or 10.9.1

sudo perl -pi -e 's|\x74\x6c(\x48\x83\xc7\x28\x90\x8b\x05..\x5e\x00\x85\x47\xdc)\x74\x54(\x8b\x4f\xd8\x45\x85\xc0\x74\x08\x44\x39\xc1\x44\x89\xc1)\x75\x44(\x0f\x32\x89\xc0\x48\xc1\xe2\x20\x48\x09\xc2\x48\x89\x57\xf8\x48\x8b\x47\xe8\x48\x85\xc0\x74\x06\x48\xf7\xd0\x48\x21\xc2\x48\x0b\x57\xf0\x49\x89\xd1\x49\xc1\xe9\x20\x89\xd0\x8b\x4f\xd8\x4c\x89\xca)(\x0f\x30\x8b\x4f\xd8\x0f\x32\x89\xc0\x48\xc1\xe2\x20\x48\x09\xc2\x48\x89\x17\x48\x83\xc7\x30\xff\xce)\x75\x99(\x5d\xc3)\x90{7}|\x74\x73${1}\x74\x5b${2}\x75\x4b${3}\x66\x81\xf9\xe2\x00\x74\x02${4}\x75\x92${5}|g' mach_kernel

or that other perl code if you use version 10.8.5

sudo perl -pi -e 's|\x74\x69(\x48\x83\xc7\x28\x90\x8b\x05\xfe\xce\x5f\x00\x85\x47\xdc)\x74\x51(\x8b\x4f\xd8\x45\x85\xc0\x74\x05\x44\x39\xc1)\x75\x44(\x0f\x32\x89\xc0\x48\xc1\xe2\x20\x48\x09\xc2\x48\x89\x57\xf8\x48\x8b\x47\xe8\x48\x85\xc0\x74\x06\x48\xf7\xd0\x48\x21\xc2\x48\x0b\x57\xf0\x49\x89\xd1\x49\xc1\xe9\x20\x89\xd0\x8b\x4f\xd8\x4c\x89\xca)(\x0f\x30\x8b\x4f\xd8\x0f\x32\x89\xc0\x48\xc1\xe2\x20\x48\x09\xc2\x48\x89\x17\x48\x83\xc7\x30\xff\xce)\x75\x9c(\x5d\xc3)\x90{7}(\x90{3})|\x74\x70${1}\x74\x58${2}\x75\x4b${3}\x66\x81\xf9\xe2\x00\x74\x02${4}\x75\x95${5}${6}|g' mach_kernel

Finally update the cache

sudo touch /System/Library/Extensions

Ready! XCPM patched kernel and is working perfectly on your CPU haswell

Note1: XCPM only works in Ivy Bridge and Haswell CPUs, and the CPUs Ivy Bridger use by default the power management given by AICPUPM kext, to use the power management provided by the kernel XCPM you must enable this flag(Chameleon)/argument(Clover):

-xcpm

Haswell CPUs use XCPM management by default and doesn't change.The management XCPM not support CPUs Sandy Bridger, so who uses SB can stay quiet about it.

Note2: Even Patching the kernel XCPM, you will need to patch the kext AICPUPM if your BIOS is locked for writing.

Note3: If you have no problem with KP, it isn't necessary to patch the kernel, but in some cases, helped to patch the kernel to add some energy states.

 

Final adjustments

 

To make the Chameleon recognize your SSDT, enable DropSSDT in org.chameleon

<key>DropSSDT</key>
<string>Yes</string>

Don't install the NullCPUPM and don't enable P and C States in org.chameleon ...

 

Don't forget to create a DSDT in future to help the power management

 

Note: For those who are having difficulty with power management ... take a look to see if the kexts: X86PlatformPlugin, ACPI_SMC_PlatformPlugin, AppleLPC are loaded, type kextstat the terminal to see ...

Good luck to all who try this guide, I just put it all together in a single tutorial to facilitate the understanding of power management in Sandy and Ivy Bridger, but all credits go to the respective owners of the wonderful tools that enable power management in our CPUs

 

Credit: Pike R. Alpha,flaked,RevoGirl, ReHabMan and other


Edited by Gringo Vermelho, 16 February 2014 - 09:46 PM.


#2
Allaп

Allaп

    InsanelyMaestro

  • Local Moderators
  • 2,300 posts
  • Gender:Male
  • Location:Brazil

PimentelX86...Congrats man,!!

 

Very easy and simple!!  :thumbsup_anim:



#3
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

Hello

 

Thanks Allan...

I think this guide work in Haswell CPU too... i make a hack to my friend, he use haswell and i use this script to get power management and work perfect...

But i don't know yet... if it work in haswell 100%, i make only 1 test... but i think work...



#4
Revolutioner

Revolutioner

    InsanelyMac Protégé

  • Members
  • PipPip
  • 51 posts
  • Gender:Male

Really Good one ,very understandable :yes:  :)



#5
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

Hello

 

Thanks :)



#6
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

Hello

 

Guide updated to Support Haswell CPUs :D

 

I hope it's very clear and easy to understand


Remembering: All credits to developers... :)


#7
Allaп

Allaп

    InsanelyMaestro

  • Local Moderators
  • 2,300 posts
  • Gender:Male
  • Location:Brazil

very, very good!! 



#8
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

Hello

thanks Allan again... i updated portuguese guide too: http://www.insanelym...dgehaswell-cpu/

 

Good Luck!



#9
hydra1ysk

hydra1ysk

    InsanelyMac Protégé

  • Members
  • PipPip
  • 79 posts

hi everybody!

 

i try to implement this hack to improve my hackintosh but i get this kernel panic. "attempt to re register power management interface --aicpm..."

what i can do?

 

DELL N4050

Intel I3 2330-m (SandyB)

6 GB RAM DDR 1066

500 GB HDD

Intel HD3000

Atheros 9285

Attached Files



#10
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

Hello

Ok… What steps of this guide you followed???

Did you create your SSDT and patch AICPUPM? Are you using NullCPUPM?
 



#11
hydra1ysk

hydra1ysk

    InsanelyMac Protégé

  • Members
  • PipPip
  • 79 posts

Hello

Ok… What steps of this guide you followed???

Did you create your SSDT and patch AICPUPM? Are you using NullCPUPM?
 

 

STEPS

- Creating the SSDT
- Patch AppleIntelCPUPowermanagement
- Kernel Patch for Haswell CPU(Kernel XCPM)
 
i think in the last step i did wrong, because my CPU it’s a SandyBrigde. how i revert this step?


#12
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

Hello
 

The management XCPM not support CPUs Sandy Bridger

 

Yes… you did a wrong thing…

haven’t how revert it… only way was backup your mach_kernel… so, this mean you need re-install OSX and do everything again…
 



#13
hydra1ysk

hydra1ysk

    InsanelyMac Protégé

  • Members
  • PipPip
  • 79 posts

Hello
 

Yes… you did a wrong thing…

haven’t how revert it… only way was backup your mach_kernel… so, this mean you need re-install OSX and do everything again…
 

 

Thanks for your reply.

 

i'll reinstall OSX and i'll try this hack again. I'll post the results. 



#14
fabiosun

fabiosun

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 103 posts
  • Gender:Male

hydra1ysk,

maybe you can extract mach_kernel with pacifist tool and copy over the patched one without rinstall all OSX.



#15
hydra1ysk

hydra1ysk

    InsanelyMac Protégé

  • Members
  • PipPip
  • 79 posts

I re-install mavericks and i got the same kernel panic

 

"attempt to re register power management interface--AICPM present in xcpm mode?"

 

Only i do this steps

- Creating the SSDT
- Patch AppleIntelCPUPowermanagement

(now i skip the last one)

 

Did you create your SSDT and patch AICPUPM?

yes, with this hack

 

Are you using NullCPUPM?

no, i delete it.

 

maybe is a problem with my SSDT or the org.chamaleon. I attach this files. Please help :(

Attached Files



#16
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

Hello

 

Are you using tonymac tools? We don't support tonymac... 

 

This guide created work perfect with Chameleon, but... What bootloader are you using?



#17
hydra1ysk

hydra1ysk

    InsanelyMac Protégé

  • Members
  • PipPip
  • 79 posts

Hello

 

Are you using tonymac tools? We don't support tonymac... 

 

This guide created work perfect with Chameleon, but... What bootloader are you using?

 

I use chameleon wizard for install (i have the v.2371 but i tested with the v.2368). i have 2 notices

 

1.- I fix the problem. Only i replace the "AppleIntelCPUPowermanagement Patched" with the original file (from USB installation) and the system works.

 

2.- the script maybe don't work in my case. I use the kext MSRDumper.kext for test if SSDT works (from a revogirl post). When i enable this kext, in the console i only get this

22-02-14 10:41:08,000	kernel[0]	MSRDumper CoreMulti(8) 
22-02-14 10:41:08,000	kernel[0]	MSRDumper PStatesReached: 8 
22-02-14 10:41:09,000	kernel[0]	MSRDumper CoreMulti(8) 
22-02-14 10:41:09,000	kernel[0]	MSRDumper PStatesReached: 8 

i see in youtube when you apply this method, the console show the pstates of the CPU like this 16 22 29 35 38 39

 

I run also the geekbench and i get the same score (2000). 



#18
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

Hello

 

Great Job!

 

P-States stages is controled by SSDT, but they already in SSDT that you created, but they aren't working... you get only 8x(800Mhz)standard to you CPU

 

Model identifier(SMbios)is responsible of enable these P-States... I have a i7 2600 and i made my SSDT using this script, but when i look my states, i only get 2 16x - 34x(Min - Max)...

I used iMac 12,2 but i don't get more than 2... i simple change for a another SMbios, i changed to Macbook Pro 8,1 and i get 8 states(16, 20, 25, 28, 30, 32 34, 35) :D

 

In others words... you need jus t change your SMbios... try a diferente and see with this app: http://sourceforge.n...ts/dpcimanager/

If it work.... what's your hardware?



#19
hydra1ysk

hydra1ysk

    InsanelyMac Protégé

  • Members
  • PipPip
  • 79 posts

Hello

 

Great Job!

 

P-States stages is controled by SSDT, but they already in SSDT that you created, but they aren't working... you get only 8x(800Mhz)standard to you CPU

 

Model identifier(SMbios)is responsible of enable these P-States... I have a i7 2600 and i made my SSDT using this script, but when i look my states, i only get 2 16x - 34x(Min - Max)...

I used iMac 12,2 but i don't get more than 2... i simple change for a another SMbios, i changed to Macbook Pro 8,1 and i get 8 states(16, 20, 25, 28, 30, 32 34, 35) :D

 

In others words... you need jus t change your SMbios... try a diferente and see with this app: http://sourceforge.n...ts/dpcimanager/

If it work.... what's your hardware?

 

i'm using MACBOOK PRO 8.1 from chameleon wizard and i get the same result. I try with all other macbook pro (8.1, 8.2, 8,3, 9.1, 9.2) and i get the same result. I change the smbios, reboot, run script and reboot again.

 

what i can do?

 

edit: the kexts, ACPI_SMC_PlatformPlugin and AppleLPC are loaded in my system. i must delete it? both?



#20
PimentelX86

PimentelX86

    InsanelyMac Deity

  • Local Moderators
  • 2,024 posts
  • Gender:Male
  • Location:Area 51

Hello

the kexts, ACPI_SMC_PlatformPlugin and AppleLPC are loaded in my system. i must delete it? both?

 

What's your hardware? I talk about Macbook Pro 8,1, but this work for my hardware, i don't think if this will work to you...

 

Try other SMbios...







Also tagged with one or more of these keywords: Chameleon, CPU, SSDT, AICPUPM patch, Sandy Bridge, Ivy Bridge, Power Management


2 user(s) are reading this topic

1 members, 1 guests, 0 anonymous users


© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy