2008年11月13日 星期四

修改 DSDT (完全不知道在做什麼)

我不知道我在改什麼,我只想讓錯誤和警告消失而已
I'm not sure what I'm doing, I just try to let Error and Warning disappear
參考 http://fred-zone.blogspot.com/2008/10/bios-acpi-description-table.html
http://forums.opensuse.org/how-faq-read-only/unreviewed-how-faq/386054-how-fix-your-buggy-dsdt.html
其實上次 s2ram 成功後,大概要用的功能都有了
可以休眠、可以調螢幕亮暗、可關閉螢幕
雖然音量無法用 Fn 調,我也不覺得怎樣重要
倒是數字鍵雖然可用,但是 NumLock 沒有亮
(剛才打字時赫然發現,這台機器本來就沒有 NumLock 燈
我一直想讓他亮的那個是 CapsLock <-- 正常) 反正就是因為上面那個不存在的理由 我開始修正 DSDT (Differentiated System Description Table)...
# cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
# iasl -d dsdt.aml

Intel ACPI Component Architecture
AML Disassembler version 20080213 [Jun 6 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

Loading Acpi table from file dsdt.aml
Acpi table [DSDT] successfully installed and loaded
Pass 1 parse of [DSDT]
Pass 2 parse of [DSDT]
Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Parsing completed
Disassembly completed, written to "dsdt.dsl"

iasl 這個指令包含在 pmtools 套件中
這個指令會將 dsdt.aml 反組譯寫入一個 dsdt.dsl 讓我們看得懂
您在將它重新組譯看會有何錯誤或警告
# iasl -tc dsdt.dsl

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20080213 [Jun 6 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

dsdt.dsl 5599: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5613: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5628: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5643: Acquire (MUTE, 0x0FFF)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5657: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5672: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5687: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 8071: And (CTRL, 0x1E)
Warning 1104 - ^ Result is not used, operator has no effect

dsdt.dsl 12674: Method (_DSM, 4, NotSerialized)
Warning 1086 - ^ Not all control paths return a value (_DSM)

dsdt.dsl 12674: Method (_DSM, 4, NotSerialized)
Warning 1079 - ^ Reserved method must return a value (_DSM)

dsdt.dsl 12680: Name (_T_0, Zero)
Error 4081 - Use of reserved word ^ (_T_0)

dsdt.dsl 12716: Name (_T_1, Zero)
Error 4081 - Use of reserved word ^ (_T_1)

ASL Input: dsdt.dsl - 12870 lines, 366022 bytes, 6047 keywords
Compilation complete. 2 Errors, 10 Warnings, 0 Remarks, 35 Optimizations

出現兩個錯誤,10個警告
把那些錯誤訊息貼到 google 上找出修正的辦法
警告:本人完全看不懂那些程式,事實上使用修正完後的 DSDT 感覺並沒有任何改進
該可以用的還是可以用,不能用的照樣不能用(做虛功)
因為看不懂,所以只能讓這些有問題處順利編譯
但不見得有正常功能
dsdt.dsl 12680:                         Name (_T_0, Zero)
Error 4081 - Use of reserved word ^ (_T_0)

他說您用了保留字,所以將所有的_T_0改成T_0,_T_1改成T_1
參考 http://www.mail-archive.com/acpi-bugzilla@lists.sourceforge.net/msg11485.html
# iasl -tc dsdt.dsl

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20080213 [Jun 6 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

dsdt.dsl 5599: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5613: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5628: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5643: Acquire (MUTE, 0x0FFF)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5657: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5672: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5687: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 8071: And (CTRL, 0x1E)
Warning 1104 - ^ Result is not used, operator has no effect

dsdt.dsl 12674: Method (_DSM, 4, NotSerialized)
Warning 1086 - ^ Not all control paths return a value (_DSM)

dsdt.dsl 12674: Method (_DSM, 4, NotSerialized)
Warning 1079 - ^ Reserved method must return a value (_DSM)

ASL Input: dsdt.dsl - 12870 lines, 366011 bytes, 6047 keywords
AML Output: dsdt.aml - 45421 bytes 1399 named objects 4648 executable opcodes

Compilation complete. 0 Errors, 10 Warnings, 0 Remarks, 35 Optimizations

很好,解決一個
dsdt.dsl 12674:             Method (_DSM, 4, NotSerialized)
Warning 1086 - ^ Not all control paths return a value (_DSM)

dsdt.dsl 12674: Method (_DSM, 4, NotSerialized)
Warning 1079 - ^ Reserved method must return a value (_DSM)

他說"並非所有路線都會 return 一個值,而這個方法規定要 return 一個值"
在 12674 行您會看到
...
Method (_DSM, 4, NotSerialized)
{
If (LEqual (Arg0, UMOR))
{
If (LEqual (Arg1, One))
{
Name (T_0, Zero)
Store (Arg2, T_0)
If (LEqual (T_0, One))
{
Store (DerefOf (Index (Arg3, Zero)), Local0)
If (Local0) {}
Else
{
}

Return (Zero)
}
Else
{
Return (One)
}
}

Return (One)
}
...

看起來最後少 return 一個值
參考 http://www.unixy.pl/forum/viewtopic.php?t=1320
http://www.linuxforums.org/forum/peripherals-hardware/96259-toshiba-p100-series-sound-fix-ubuntu.html
加上
                Else
{
Return(Package(0x02){0x00, 0x00})
}

變成
            Method (_DSM, 4, NotSerialized)
{
If (LEqual (Arg0, UMOR))
{
If (LEqual (Arg1, One))
{
Name (T_0, Zero)
Store (Arg2, T_0)
If (LEqual (T_0, One))
{
Store (DerefOf (Index (Arg3, Zero)), Local0)
If (Local0) {}
Else
{
}

Return (Zero)
}
Else
{
Return (One)
}
}

Return (One)
}
Else
{
Return(Package(0x02){0x00, 0x00})
}

事實上我試過
                Else
{
Return(Zero)
}

                Else
{
Return(One)
}

似乎看不出有何差別...囧
# iasl -tc dsdt.dsl

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20080213 [Jun 6 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

dsdt.dsl 5599: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5613: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5628: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5643: Acquire (MUTE, 0x0FFF)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5657: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5672: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 5687: Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

dsdt.dsl 8071: And (CTRL, 0x1E)
Warning 1104 - ^ Result is not used, operator has no effect

ASL Input: dsdt.dsl - 12874 lines, 366045 bytes, 6049 keywords
AML Output: dsdt.aml - 45425 bytes 1399 named objects 4650 executable opcodes

Compilation complete. 0 Errors, 8 Warnings, 0 Remarks, 35 Optimizations

就這樣呼隆過去好了
dsdt.dsl  5599:             Acquire (MUTE, 0x03E8)
Warning 1103 - ^ Possible operator timeout is ignored

剛好您會估到著名的 foxconn 事件
http://izanbardprince.wordpress.com/2008/07/25/foxconn-bios-sabotaging-linux-change-of-plans/
根據建議將0x03E8和0x0FFF全改為0xFFFF
# iasl -tc dsdt.dsl

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20080213 [Jun 6 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

dsdt.dsl 8071: And (CTRL, 0x1E)
Warning 1104 - ^ Result is not used, operator has no effect

ASL Input: dsdt.dsl - 12874 lines, 366045 bytes, 6049 keywords
AML Output: dsdt.aml - 45425 bytes 1399 named objects 4650 executable opcodes

Compilation complete. 0 Errors, 1 Warnings, 0 Remarks, 35 Optimizations

剩下最後一個
將 8071 行的 And (CTRL, 0x1E) 改成
And (CTRL, 0x1E, CTRL)

# iasl -tc dsdt.dsl

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20080213 [Jun 6 2008]
Copyright (C) 2000 - 2008 Intel Corporation
Supports ACPI Specification Revision 3.0a

ASL Input: dsdt.dsl - 12874 lines, 366053 bytes, 6049 keywords
AML Output: dsdt.aml - 45428 bytes 1399 named objects 4650 executable opcodes

Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 35 Optimizations

要使用自訂的 DSDT
openSUSE 提供了一個方便的工具 initramfs-add-dsdt.sh
您要安裝 kernel-source 套件
參考 http://forums.opensuse.org/how-faq-read-only/unreviewed-how-faq/386054-how-fix-your-buggy-dsdt.html
將編譯出來的 dsdt.aml 更名為 DSDT.aml
例如放在 /etc/dsdt/DSDT.aml
# cd /usr/src/linux/Documentation/acpi/
# sh initramfs-add-dsdt.sh /boot/initrd-`uname -r` /etc/dsdt/DSDT.aml

如此便大功告成了(根本沒完成任何事...)重開機
在套用新的 DSDT 之前,dmesg 會有下面訊息
...
ACPI: Checking initramfs for custom DSDT
Parsing all Control Methods:
Table [DSDT](id 0001) - 1644 Objects with 78 Devices 521 Methods 73 Regions
Parsing all Control Methods:
Table [SSDT](id 0002) - 14 Objects with 0 Devices 4 Methods 0 Regions
tbxface-0598 [00] tb_load_namespace : ACPI Tables successfully acquired
evxfevnt-0091 [00] enable : Transition to ACPI mode successful
Using local APIC timer interrupts.
...

重開機後
...
ACPI: Checking initramfs for custom DSDT
ACPI: Found DSDT in DSDT.aml.
ACPI: Override [DSDT-F6S00000], this is unsafe: tainting kernel
ACPI: Table DSDT replaced by host OS
ACPI: DSDT 00000000, B174 (r1 F6S00 F6S00000 0 INTL 20080213)
ACPI: DSDT override uses original SSDTs unless "acpi_no_auto_ssdt"Parsing all Control Methods:
Table [DSDT](id 0001) - 1644 Objects with 78 Devices 521 Methods 73 Regions
Parsing all Control Methods:
Table [SSDT](id 0002) - 14 Objects with 0 Devices 4 Methods 0 Regions
tbxface-0598 [00] tb_load_namespace : ACPI Tables successfully acquired
evxfevnt-0091 [00] enable : Transition to ACPI mode successful
Using local APIC timer interrupts.
...

表示已套用了新的 DSDT

沒有留言: