修复DSDT时常用错误的处理办法


前言

​ 对于Hackinto电脑来说,正确的clover、config.plist和kext只能确保大部分电脑可以正常安装MacOS,但并不一定能保证能正常使用。在启动时,电脑会去读取ACPI的配置,不当的DSDT和SSDT有可能会导致出现系统启动失败、无法休眠、电池电量无法显示等很多奇奇怪怪的问题。很多人都知道使用DSDT补丁可以开双核,但DSDT的功能不仅仅如此,还可以修复显卡、声卡、网卡、电池、休眠等问题。


DSDT只是描述你硬件的文件,并不是驱动文件,它只是告诉你的MacOS系统,你的主板上都有些什么硬件,如果你的MacOS并不支持这种硬件,那么DSDT也无法驱动你的这个硬件!!!


这里是你在MacOS中修复DSDT时需要用到的软件:MaciASL (RehabMan 2018-0507版)

以下例子是我在修复DSDT中常见的问题,如果以后有新的问题会继续更新。

修复例子

  1. switch变量未设置为Integer整数时的错误提示:
1
Switch expression is not a static Integer/Buffer/String data type, default to integer

例子:

1
2
3
4
5
6
Method (WMBC, 3, Serialized)
{
Store (0x01, Local0)
Switch (Arg1)
{
Case (0x43455053)

修复方法:

1
2
3
4
5
6
Method (WMBC, 3, Serialized)
{
Store (0x01, Local0)
Switch (ToInteger (Arg1))
{
Case (0x43455053)




2. 定义了一个局部变量,但是Method方法没有用到这个变量时的错误提示:(注:如果这个是Warnings警告的话,可以不管它,但如果是Errors错误的话,必须修复。)

1
Method Local is set, but never used (Local 0)

例子:

1
2
3
4
Store (0x03, OSVR)
If (CondRefOf (\_OSI, Local0))
{
If (_OSI ("Windows 2001"))

或者

1
2
3
Store (RGE3, PMFG)
Store (RGE3, Local0)
And (RGE0, 0x9F, RGE0)

修复方法 ( And(Local0, Ones, Local0) ==> Local 0 set to 0x11111111 ):

1
2
3
4
5
Store (0x03, OSVR)
If (CondRefOf (\_OSI, Local0))
{
And(Local0, Ones, Local0)
If (_OSI ("Windows 2001"))

或者

1
2
3
4
Store (RGE3, PMFG)
Store (RGE3, Local0)
And(Local0, Ones, Local0)
And (RGE0, 0x9F, RGE0)




3. 当含有不正确或未使用的方法名时的错误提示:

1
2
Invalid object type for reserved name (_OSC: found Integer, Buffer Required)

例子:

1
2
Method (_OSC, 4, Serialized)  // _OSC: Operating System Capabilities
{

修复方法 ( 删除下划线,或者将其重命名,本例子中将重名为 “XOSC” ):

1
2
Method (XOSC, 4, Serialized)  // _OSC: Operating System Capabilities
{




4. 方法/函数具有IF语句,如果为false时,则不会返回任何内容:

1
2
Not all control paths return a value (_OSC/O1EX/TINI/TWAK...etc)
Reserved Method must return a value (Buffer required for _OSC)

例子:

1
2
3
4
5
6
7
Method (_TINI, 0, NotSerialized)
{
If (LEqual (Arg0, ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */))
{
(bunch of code here that'll get executed if the above IF statement returns true)
}
}

修复方法 ( 在方法关闭之前添加 Return (Zero) ):

1
2
3
4
5
6
7
8
Method (TINI, 4, Serialized)
{
If (LEqual (Arg0, ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */))
{
(bunch of code here that'll get executed if the above IF statement returns true)
}
Return (Zero)
}


文章作者: VinceNT.范
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 VinceNT.范 !
  目录