Jump to content

ACPIThermal driver development.


ThirdSmile
 Share

27 posts in this topic

Recommended Posts

Before 10.7 I have used AppleACPIThermal.kext for thermal zones, but I in lion this driver has loosed ability to work with active cooling on my notebook(hp 6720).

 

So after lot of tries to fix this in DSDT i has decided to develop own driver and see what is going on ...

 

The problem was in _ALx methods in thermal zone - them returns NULL in lion(in snow they works as expected), but must return fan devices list.

Any ideas about this behavior?

 

So I have added methods to thermal zone in DSDT:

- EALx - to enable cooling for _ACx

- DALx - to disable cooling for _ACx

 

(Thermal Zones TZ1 and TZ2 in my DSDT came from SSDT)

 

And added use of them to my driver.

Now I have tested driver in lion and snow - works good, I have active cooling on my laptop.

 

The only things implemented in driver at this moment:

1. Check zone temperature.

2. Get _ACx values, and if need enable/disable cooling form them with EACx/DACx methods(_ALx - not used at this moment)

Also thermal zone driver, may be, need to implement some actions for passive cooling(such as cpu throttling) - but i do not know how...

 

Any suggestions and fixes are welcome =)

 

Also this driver is diqused projectosx.

ACPIThermal.zip

ACPIThermal.kext.zip

dsdt.dsl.zip

Link to comment
Share on other sites

  • 1 month later...

Hello, Third Smile!

 

First, thank you for this driver.

 

Now, I have KP with this driver (no specific info, just kernel trap blah blah). I implemented EAL/DALs as you've said, and I also examined source, but I could nto find any error which could cause KP. I'll attach my DSDT (8710p, but same BIOS and DSDT as in 65xx series). CPU is Penryn, but I think it should not be of any significant value here (as I drop SSDT's and include TZ SSDT with my DSDT).

 

Best regards, --py

DSDT.txt

Link to comment
Share on other sites

I'm using them (all vanilla, 10.7.2). In fact, I tried to resolve problem, and I currently have two problems (and will try to fix them):

* CRT and AL* functions are panicking (most probably in TZ2, which manages graphics). By extracting those values on windows I'm able to proceed (they shoudl be constants all the time).

* TMP always returns 16. I'll try to implement ThirdSmile's 16-bit fix, and post results here.

 

Crappy HP DSDT ... :@

Link to comment
Share on other sites

Hi, I also had those KPs before. I think you should try to correct the dependencies for Lion in the info.plist.

 

Dependencies in driver are correct(and incorrect dependencies can not be reason of KP - it is just requirements to load).

 

Hi juanerson!

 

Thanks, I solved KP, but driver won't load (it cannot allocate AppleACPIThermalZone class). Of course, setting IOClass to anything else (like ACPIThermal, as default) yields the same KP.

 

Of course, there are no KP - because driver is not loading(because of incorrect dependencies).

 

 

Because it is required for to works with this driver... are needed all vanilla ACPI-Family .kexts. Just for records.

 

It is not required(this driver must work with old ACPIPlatform.kext as well), but I am using all vanilla kexts when testing it(10.7.x, 10.6.7, 10.6.8).

 

About KP: probably reason can be in wrong return from ACPI methods(When debuging driver, I have KP when I have tried to use 32bit value as 16bit one)...

 

Try to use driver from attachment ACPIThermal-test1 and post your IOReg(from IORegistryExplorer) - it will output(to IORegistry) values from _ACx and _TMP methods in ThermalZone devices.

 

 

Also try too use ACPIThermal-test2 (it is the same driver as in first post, but all values from ACPI are treat as 64bit values - this can reduce number of KP).

 

 

Upd:

 

Also about debuging driver - you can add some logging to see at what place in driver KP occurs.

For example:

If you are suspecting some part of code in KP, so you can add IOLog("Begin part\n") before it and IOLog("End Part\n") after it - and if you are right and error is here you will see only phrase "Begin part" in KP log but no corresponding "End part" after it.

In this way we can finout mistakes in driver and fix them.

ACPIThermal_test2.kext.zip

ACPIThermal_test1.kext.zip

Link to comment
Share on other sites

OK, so far I just want driver to report properly TMP value in IOREG (so just added empty EAL/DALs and set _ACx to zero). After that I will plug in fan control code.

 

KPs gone. But, my TMP is always 16, because C0EE method always return 0 (even with 16-bit fix you already suggested on 6520 thread). I tried your 64-bit driver, but it still returns 0. I examined the C0EE code but have no idea why it returns 0 (maybe it cannot access operating region?!) ...

 

Best regards,

Link to comment
Share on other sites

Dependencies in driver are correct(and incorrect dependencies can not be reason of KP - it is just requirements to load).

 

Of course, there are no KP - because driver is not loading(because of incorrect dependencies).

With hight respect my friend:

 

1) No, dependencies are incorrect in the original Info.plist inside the driver extension. Therefore is causing the KP, and the reason is the mismatch with AppleACPIPlatform version running from /S/L/E and/or main prelinked kernel caché.

 

2) I think some people are mixing the terms? Because in "IOKitPersonalities" if you have a wrong "CFBundleIdentifier" entry like "AppleACPIThermalZone" or "XYZClass", the driver will not load due to mismatch with the binary itself, or I am wrong?.

 

3) Then, from I know Dependencies = OSBundleLibraries, and Nothing More.

 

It is not required(this driver must work with old ACPIPlatform.kext as well), but I am using all vanilla kexts when testing it(10.7.x, 10.6.7, 10.6.8).

 

About KP: probably reason can be in wrong return from ACPI methods(When debuging driver, I have KP when I have tried to use 32bit value as 16bit one)...

4) I see you have all vanilla like me. Good, because AppleACPIPlatform.kext depend of ACPI and PCI Family drivers, included in his dependencies you know. I mean, for me is very important this point, specially After wake up from Sleep, because ACPIThermal.kext will not load again if not satisfied the same dependencies of AppleACPIPlatform.

 

5) Please Remember, Now we have the same structural code in DSDT for ThermalZones with your adaptations, But from the beginning was not like that. So, in that moment, how is possible I didn't get it a wrong ACPI bad code return, KP, etc? If as I said, I could load your driver, Even before the last fix (16-bit), and Just only by writing the right dependencies, not a big deal.

 

Anyway, Thank You Again for your excellent driver!

Link to comment
Share on other sites

With hight respect my friend:

 

1) No, dependencies are incorrect in the original Info.plist inside the driver extension. Therefore is causing the KP, and the reason is the mismatch with AppleACPIPlatform version running from /S/L/E and/or main prelinked kernel caché.

 

2) I think some people are mixing the terms? Because in "IOKitPersonalities" if you have a wrong "CFBundleIdentifier" entry like "AppleACPIThermalZone" or "XYZClass", the driver will not load due to mismatch with the binary itself, or I am wrong?.

 

3) Then, from I know Dependencies = OSBundleLibraries, and Nothing More.

 

4) I see you have all vanilla like me. Good, because AppleACPIPlatform.kext depend of ACPI and PCI Family drivers, included in his dependencies you know. I mean, for me is very important this point, specially After wake up from Sleep, because ACPIThermal.kext will not load again if not satisfied the same dependencies of AppleACPIPlatform.

 

5) Please Remember, Now we have the same structural code in DSDT for ThermalZones with your adaptations, But from the beginning was not like that. So, in that moment, how is possible I didn't get it a wrong ACPI bad code return, KP, etc? If as I said, I could load your driver, Even before the last fix (16-bit), and Just only by writing the right dependencies, not a big deal.

 

Anyway, Thank You Again for your excellent driver!

 

I am new in osx driver development, but I think dependencies are correct - see IOKit Fundamentals at page 64.

 

About where dependencies in my driver - I taken them from ACPIBatteryMonitor (which i have used as one of samples at begining of work)

 

1) AppleACPIPlatform - What are you talking about? There are no dependency to this bundle. It is separate driver NOT plugin for AppleACPIPlatform - and it has no direct relation with AppleACPIPlatform (about legacy AppleACPIThermal - it is plugin)

 

2) Yes, Pasa Yildirim corected not only dependencies, but also bundle identifiers.

 

3) Read IOKit Fundamentals. Answer to that post is here (error was not in dependencies! the error was in driver code).

 

4) read answer to 1.

 

5) "last fix (16-bit)" does not fix any bug - it only allows driver do not panic when return from ACPI is bigger as it must be(in other words - when return wfom ACPI in invalid). The only changes is: replace unsigned16BitValue method call by unsigned64BitValue and change in type of some variables.

Link to comment
Share on other sites

1) AppleACPIPlatform - What are you talking about? There are no dependency to this bundle. It is separate driver NOT plugin for AppleACPIPlatform - and it has no direct relation with AppleACPIPlatform (about legacy AppleACPIThermal - it is plugin)
Yes, was my fault in this point... I meant "IOACPIFamily" dependency. So, the correct one to avoid the KP (capture) is:

	<key>com.apple.iokit.IOACPIFamily</key>
<string>1.0.0d1</string>

That's what I am talking about. And please... I am just trying to help in this thread :D NO more. Good Luck.

Link to comment
Share on other sites

Yes, was my fault in this point... I meant "IOACPIFamily" dependency. So, the correct one to avoid the KP (capture) is:

	<key>com.apple.iokit.IOACPIFamily</key>
<string>1.0.0d1</string>

That's what I am talking about. And please... I am just trying to help in this thread :D

 

Yes it will work with such dependencies too, but - this change only probably(because now target platform is 10.6+) will allow to use this driver on systems older than 10.4(IOACPIFamily version 1.2.0 corresponds to osx 10.4)

 

Also this can not reduce number of KP - because dependency version means minimum version of bundle required to be loaded before driver, for it correct work and can not be reason of KP(except cases when dependency version is lower as required by bundle)

 

So I did not think that there is need of such change in driver dependencies list.

 

About concret KP, the error is "page fault"(form photo) - I think it is because of: wrong try to interpret some object as another completely different object(for example if ACPI return something like package instead of something like number), such error can occur.

 

Anyway, thanks for comments - in discussing we can do more ;)

Link to comment
Share on other sites

Hi All,

 

I've got rid of kp's loading the kext. (edited dependencies- thanks to juanerson)

Here is a new DSDT with bat working and ThirdSmiles tz inserts as well as ioreg with acpithermal.kext loaded.

Fan doesn't work. Found this in console:

com.apple.kextd: Kext id com.apple.driver.AppleACPIThermal not found; removing personalities from kernel.

Also in in zip the info.plist from acpithermal.

 

nc6510b.zip

Link to comment
Share on other sites

1. You have changed not only dependencies - you have changed bundle ids. So driver is not loading because of wrong bundle ids that did not correspond to binaries.

2. ACPIThermal is not loaded at all - see your IOReg.

3. In post above I have written how you can try to determine place in which KP occurs - just try too add some logging.

 

Also I will say one more time AppleACPIThermal(by Apple) and ACPIThermal(by me) - are completely different drivers, DO NOT MIX THEM.

Link to comment
Share on other sites

IOReg with test1 - looks promising.

 

Try this - probably it will panic too, but I have added some logging - so photo of KP screen and last messages in kernel log(you can see it in Console.app) would be useful to find-out the reason of KP.

 

Also - no need to install it, you can try using kextload utility:

sudo chown -R 0:0 ACPIThermal.kext
sudo kextload ACPIThermal.kext

 

Good luck.

ACPIThermal_test3.kext.zip

Link to comment
Share on other sites

IOReg with test1 - looks promising.

 

Try this - probably it will panic too, but I have added some logging - so photo of KP screen and last messages in kernel log(you can see it in Console.app) would be useful to find-out the reason of KP.

 

It gives a kp, here is the photo:

 

post-52582-1320760845_thumb.jpg

Link to comment
Share on other sites

Ok. Now try this one - I have added check in driver to work only for TZ1(according to your ioreg only it has active cooling).

 

Probably it will panic too, but in log will be only info related too TZ1..

 

Ok, it is loadable :)

It produces a lot of output in console, but the values are still the same.

 

08.11.11 18:56:49,000 kernel: TZ1, T=2892

08.11.11 18:56:49,000 kernel: TZ1, Check Active Cooling 0

08.11.11 18:56:50,000 kernel: TZ1, _AC0=3552

08.11.11 18:56:50,000 kernel: TZ1, Check Active Cooling 1

08.11.11 18:56:50,000 kernel: TZ1, _AC1=3472

08.11.11 18:56:50,000 kernel: TZ1, Check Active Cooling 2

08.11.11 18:56:50,000 kernel: TZ1, _AC2=3392

08.11.11 18:56:50,000 kernel: TZ1, Check Active Cooling 3

08.11.11 18:56:50,000 kernel: TZ1, _AC3=3232

08.11.11 18:56:50,000 kernel: TZ1, Check Active Cooling 4

08.11.11 18:56:50,000 kernel: TZ1, _AC4=3082

08.11.11 18:56:50,000 kernel: TZ1, Check Active Cooling 5

08.11.11 18:56:50,000 kernel: TZ1, Check Active Cooling 6

08.11.11 18:56:50,000 kernel: TZ1, Check Active Cooling 7

08.11.11 18:56:50,000 kernel: TZ1, Check Active Cooling 8

08.11.11 18:56:50,000 kernel: TZ1, Check Active Cooling 9

Link to comment
Share on other sites

  • 2 weeks later...

Hi all!

could you please help me to patch my dsdt to work with this driver?

the next is correctly loaded, but I don't know if and how to integrate funtionalities with my dsdt.

Here is my actual dsdt:

dsdt.aml.zip

Link to comment
Share on other sites

 Share

×
×
  • Create New...