前两天,一位前辈问我,怎么样让系统支持S1呢?一时无语。
平时我接触的都是笔记本,只支持S3,S4和S5,也没有仔细看是怎么支持的。
做了一个支持S1的试验,进入S1后看起来和进入S3差别是:Power灯不是闪而是一直亮的,进入和退出时间要短得多。
那么怎么样让OS知道我们支持S1呢?OS怎么样进入S1呢?
在ACPI spec中有说到,System /_Sx states
All system states supported by the system must provide a package containing the DWORD value of the following format in the static
Definition Block. The system states, known as S0–S5, are referenced in the namespace as /_S0–/_S5 and for clarity the short Sx
names are used unless specifically referring to the named /_Sx object. For each Sx state, there is a defined system behavior.
System State Package
Byte Byte Length Offset Description
1 0 Value for PM1a_CNT.SLP_TYP register to enter this system state.
1 1 Value for PM1b_CNT.SLP_TYP register to enter this system state. To enter any given state, OSPM must write the PM1a_CNT.SLP_TYP register before the PM1b_CNT.SLP_TYP register.
2 2 Reserved
例如:Name(/_S1, Package(4){0x1,0x0,0,0}),就申明了_S1这个system state,用于告诉OS,系统支持S1!
S0,S3,S4和S5都是这样的(当然,S0和S5是每个都支持的)。并且这个Package也说明了进入S1的方法:
将0x1写如到PM1a_CNT.SLP_TYP,0x0写入到PM1b_CNT.SLP_TYP,设置SLP_EN位。
其中PM1a_CNT和PM1b_CNT在Fixed ACPI Description Table (FADT)中有回报,
SLP_TYP和SLP_EN是PM1 Control Registers中的的bit12~10和bit13,在ACPI spec中都有定义。
这里也体现了ACPI架构的优点:OS只要得到ACPI Tables和AML code就几乎得到了他想得到的一切,底层的都不用去管。