Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Hardware - Troubleshooting and Discussion > Mac Notebooks > Kernel extension to stop whine in macbooks

Kernel extension to stop whine in macbooks
Thread Tools
Tijer
Fresh-Faced Recruit
Join Date: May 2004
Status: Offline
Reply With Quote
Jul 3, 2006, 06:54 PM
 
I am only the messenger, so I cannot take credit for any of the below.

A clever developer has made a kernel-extension with the use of Intels own manual for the Core Duo processor. The code looks like the following (grabbed from apple discussions)

#include <IOKit/IOLib.h>

int stop;
UInt8 data_org;

// Intel Manual on 945 Chipset, page 81, states that
// the offset for MMR space is at offset 44h of PCI Device 0 (Host Bridge)
// Here we read 0xfed14001
// It further states, page 186, that in MMR at offset 0xf10
// we can find a 32 bit value of which bits 1 and 0 control the Enhanced Power Management Mode of the Core Duo Processor:
// 00: All functions allowed
// 01: Disable C3 and C4
// 10: Disable C4
// The default value is 00
// This whole code is about setting this to 10
// Because after wake up from sleep it is set back to 00 we
// have a kernel thread which set to 10 every second

IOPhysicalAddress address = 0xfed14f10;

void qmb_control(){

UInt8 data;

data_org = IOMappedRead8(address);
data = data_org | 0x2;
stop = 0;
while (stop == 0)
{
IOMappedWrite8(address,data);
delay(1000000);
}


}


kern_return_t qmb_start (kmod_info_t * ki, void * d) {

IOCreateThread(qmb_control,NULL);

printf("KEXT has loaded!\n");

return KERN_SUCCESS;
}


kern_return_t qmb_stop (kmod_info_t * ki, void * d) {
// Before we can unload this Kernel Extension we have to signal qmb_control to exit.
// If we unload while qmb_control is still running the wake up timer of the loop
// will cause a kernel panic
stop = 1;
delay(2000000);
IOMappedWrite8(address,data_org);
printf("KEXT has unloaded!\n");
return KERN_SUCCESS;
}
What it does in practice is to turn off the Core Duo idle-mode every second (requires no or extremely little processor power) by moving a little bit in the setting. Unfortunately it has to do this every second because the system will wake (after system-sleep) with the bit set to idle-mode on.

Disabling the idle-mode will require the processor to use a little more power and thus remove the whine (in exactly the same way as using a bluetooth-mouse will remove the whine).

The down-side of this solution is added power-use (though the fall in battery-levels has been reported pretty low), also a higher processer-temp. is expected, nothing critical has been reported though.

Feel free to use this thread as a general feedback threat, so we will be able to learn more about the (easy) solution of just disabling the damn idle-mode all togetner.

A binary of the code can be downloaded here - the code used to compile (and as stated above) is still a bit rough, and could have been made better - please refer to the apple discussions page above in order to see the details (scroll down to the bottom).

Note that nullriver software has compiled and is hosting the binary, the code was initially written by cbhense

It must be noted, that this of course is provided with no guaranties or responsibility from the auther etc. etc. (people can think by themselves, right?) - currently only tested on MacBook Pro - should work on MacBook (non-Pro) too - and should only be used with the current machines (future machines might use a different bit in setting the idle-mode and things could get messy - yadayadayada..)
There's more to this signature than you
think.
     
stuffedmonkey
Dedicated MacNNer
Join Date: Oct 2001
Location: Washington DC
Status: Offline
Reply With Quote
Jul 12, 2006, 10:19 PM
 
Interesting.... I haven't tried it yet - but I am wondering if there is anyhting that will set that bit on a one time basis that I can launch manually - or at least that will only run while connected to AC power. That would be perfect - since the side effects are increased power use and lower battery life.

It's pretty sweet that people are working on the problem!
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:40 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,