Hello!

I spend my day analysing why the Linux could not use the C4 state(s).
Here my results...

For a start we take a look at the current available c-states:

#> cat /proc/acpi/processor/CPU?/power

active state:            C3
max_cstate:              C8
bus master activity:     00000000
maximum allowed latency: 8000 usec
states:
    C1:                  type[C1] promotion[C2] demotion[--] latency[001]
usage[00002590] duration[00000000000000000000]
    C2:                  type[C2] promotion[C3] demotion[C1] latency[001]
usage[00002086] duration[00000000000006795863]
   *C3:                  type[C3] promotion[--] demotion[C2] latency[055]
usage[00003633] duration[00000000000009200376]

(The "max_cstate" value here is the number of the maximum used states,
 if they are supported. It's not the number of states available!)


Because Linux uses ACPI to control the processors power state, I
diassembled the ACPI code (DSDT, SSDT and FACP) and found out the
following:


In the PNOT method (Processor notify), we see:

      Notify (\_PR.CPU0, 0x80)
      If (And (PDC0, 0x10))
      {
           Sleep (0x64)
           Notify (\_PR.CPU0, 0x81)
      }

This is (I think) the cause of the ACPI event (if you unplug the AC).
Here the output from the "acpid":

[Fri Apr  6 23:54:47 2007] received event "ac_adapter ADP1 00000080 00000000"
[Fri Apr  6 23:54:47 2007] completed event "ac_adapter ADP1 00000080 00000000"

[Fri Apr  6 23:54:47 2007] received event "processor CPU0 00000080 00000000"
[Fri Apr  6 23:54:47 2007] completed event "processor CPU0 00000080 00000000"
[Fri Apr  6 23:54:47 2007] received event "processor CPU0 00000081 00000000"
[Fri Apr  6 23:54:47 2007] completed event "processor CPU0 00000081 00000000"

[Fri Apr  6 23:54:47 2007] received event "processor CPU1 00000080 00000000"
[Fri Apr  6 23:54:47 2007] completed event "processor CPU1 00000080 00000000"
[Fri Apr  6 23:54:47 2007] received event "processor CPU1 00000081 00000000"
[Fri Apr  6 23:54:47 2007] completed event "processor CPU1 00000081 00000000"

[Fri Apr  6 23:54:47 2007] received event "battery BAT0 00000080 00000001"
[Fri Apr  6 23:54:47 2007] completed event "battery BAT0 00000080 00000001"


The PNOT method is called from some special methods in the SMB0 device
section (SmartBattery or SystemManagmentBus device).

So Linux (or MacOS X) will be notified about the change. Under Linux, this
will cause a call of "acpi_processor_cst_has_changed(pr);" [in
acpi_processor_notify()] which will get the (new) c-states.

On other laptops this will show a new state C4.

The problem under Linux (and Windows) on Apple laptops is, that the ACPI did
not provide any information about the advanced power-states. These states are
specifed via the _CST control method, but this is (according to the FACP)
not supported. Here the relevant part:

[05Fh 095  1]                 _CST Support : 00
[060h 096  2]                   C2 Latency : 0065
[062h 098  2]                   C3 Latency : 03E9

MacOS X must use ACPI only to some extend and will do it's own thing, when
it comes to using all c-states.


I think three possible solutions exist:

 1) Patch "acpi_processor_cst_has_changed()" function, to return
    the C4 state(s) on Apple laptops.
    (This quick hack should be easy.)

 2) Fix the ACPI table by adding the _CST method and load it via the
    the initrd (Patch from "http://gaugusch.at/kernel.shtml"; needed).
    The biggest problem here will be, that we must change the FACP
    table to enable the _CST support. But this is the "Fixed ACPI
    Description Table" - so I think we cannot change it easily...

 3) Beg Apple to fix the ACPI table.


(Does anybody have another laptop, where we can get the relevant _CST part
 from?)


Regards
 Sven

-- 
 Sven Anders <[EMAIL PROTECTED]>                 () Ascii Ribbon Campaign
                                                 /\ Support plain text e-mail
 ANDURAS service solutions AG
 Innstraße 71 - 94036 Passau - Germany
 Web: www.anduras.de - Tel: +49 (0)851-4 90 50-0 - Fax: +49 (0)851-4 90 50-55

Rechtsform: Aktiengesellschaft - Sitz: Passau - Amtsgericht Passau HRB 6032
Mitglieder des Vorstands: Sven Anders, Marcus Junker
Vorsitzender des Aufsichtsrats: Dipl. Kfm. Thomas Träger
begin:vcard
fn:Sven Anders
n:Anders;Sven
org:ANDURAS AG;Research and Development
adr;quoted-printable:;;Innstra=C3=9Fe 71;Passau;Bavaria;94036;Germany
email;internet:[EMAIL PROTECTED]
title:Dipl. Inf.
tel;work:++49 (0)851 / 490 50 -0
tel;fax:++49 (0)851 / 590 50 - 55
x-mozilla-html:FALSE
url:http://www.anduras.de
version:2.1
end:vcard

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mactel-linux-devel mailing list
Mactel-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mactel-linux-devel

Reply via email to