关于修改DSDT出现的常见问题

来源:互联网 发布:java人脸识别开源算法 编辑:程序博客网 时间:2024/06/09 23:21

在DSDT的修改中会出现各种各样的Warnings和Errors,Warnings可以忽略,除非你和我一样是一个完美主义者;Error就不能视而不见了,出现Error之后会使引导出现问题。所以相对于Warnings,Errors是一定要去除的。

推荐一种修改方式,就是改之前先编译(Compile)一下,有errors和warnings就先修改掉。完成之后,再修改一个地方编译一下,一步一步来,不然修改了很多到最后都不知道是错在哪里了。

下面就列举一些比较常见的吧,错误代码不一定完全和实际中的一样,有可能会有几个数值的差距,不过不影响。另外,下面所有内容直接用英文了,并稍微加了一点点点自己的理解。虽然自己看得懂,不过本人翻译水平有限,下面很多词语过于专业。怕翻译之后就变味了,所以干脆就不翻译了。英文不算太难,如果遇到不认识的单词搜索一下即可。(=^_^=)

  1. Access width of Field Unit extends beyond region limit

    1
    2
    3
    4
    SRST, 1,
    Error 1051 - ^ Access width of Field Unit extends beyond region limit
    ACPW, 1
    Error 1051 - ^ Access width of Field Unit extends beyond region limit

    This error consists on that the limit of data is less that the quantity of the same

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    OperationRegion (GPIO, SystemIO, 0x1180, 0x3B)   // "0x3B" contains the error, it must be increased for example to "0x3C" (hexa)
    Field (GPIO, WordAcc, Lock, Preserve)
    {
    AccessAs (DWordAcc, 0x00),
    Offset (0x0F),
    , 4,
    LV28, 1,
    Offset (0x2D),
    , 5,
    LPOL, 1,
    Offset (0x38),
    , 1,
    SRST, 1,
    Offset (0x39),
    , 2,
    ACPW, 1
    }
  2. Argument count mismatch error

    1
    2
    ./dsdt_fixed.txt     1: ACPI (Local2) 
    Error  4095 -   ^ syntax error, unexpected PARSEOP_NAMESEG,expecting PARSEOP_DEFINITIONBLOCK

    This error comes from line 1.If we look inside the DSDT.dsl, we can verify that the error is here:

    1
    2
    3
    4
    5
    ACPI Error (dmutils-0261): Argument count mismatch for method \_SB_.VWAK 3 1 [20080926] 
    ACPI Error (dmutils-0261): Argument count mismatch for method \_GPE.VBRE 2 1 [20080926] 
    /* 
     * Intel ACPI Component Architecture 
     * AML Disassembler version 20080926

    There should be no code before these lines:

    1
    2
    3
    /* 
     * Intel ACPI Component Architecture 
     * AML Disassembler version 20080926
  3. Internal compiler error ^ (null Op pointer)

    1
    2
    dsdt.dsl 4106: If (LNot (\_OSI ("Windows 2006")))
    Error 4011 - Internal compiler error ^ (null Op pointer)

    The incorrect part of the code is:

    1
    2
    3
    4
    If (LNot (\_OSI ("Windows 2006")))
    {
    PHSR (0x10, 0x00)
    }

    It can be fixed by these changes:

    1
    2
    3
    4
    5
    6
    7
    If (\_OSI ("Windows 2006"))
       {
          }
            Else
          {
          PHSR (0x10, 0x00)
       }
  4. Local variable is not initialized

    1
    2
    ./dsdt_fixed.txt 408: Store (Local0, Local0) 
    Error 4050 - ^ Method local variable is not initialized (Local0)

    If we revise the code, and look at line 408 we find the these codes.There may exists two cases

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Scope (\_SI) 
        { 
            Method (_MSG, 1, NotSerialized) 
            { 
                Store (Local0, Local0) 
            }
            Method (_SST, 1, NotSerialized) 
            { 
                Store (Local0, Local0) 
            } 
        }
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Scope (\_SI) 
        { 
            Method (_MSG, 1, NotSerialized) 
            { 
                Store ("Local0", Local0) 
            } 
            Method (_SST, 1, NotSerialized) 
            { 
                Store ("Local0", Local0) 
            } 
        }

    How do we know what in the DSDT.dsl needs fixing? If you search for “Store” in the menu, and look just below the error, you will see something like this:

    1
    2
    Store (0xFF, RSR0) 
    Store (0x80, PMC0)

    The first value of “Store” is a hexadecimal value, and the second, a variable. There is the error. In the code (Local0,Local0), it is supposed that the first value is a hexadecimal, not a variable. we could add 0×00 or also zero, in a format like this:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Scope (\_SI) 
        { 
            Method (_MSG, 1, NotSerialized) 
            { 
                Store (zero, Local0) 
            } 
            Method (_SST, 1, NotSerialized) 
            { 
                Store (zero, Local0) 
            } 
        }
  5. Maximum error count (200) exceeded

    1
    ./dsdt_fixed.txt    24:     External (^CPU0._PPC)

    The problem here is that the compiler doesn’t like the following:

    1
    External (^CPU0._PPC)

    It can be fixed by using this code:

    1
    External (\_PR.CPU0._PPC)

    Then we must find and replace every occurrence in the code that has ^CPU0 for _PR.CPU0 to skip this error:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    dsdt.dsl.patched   574:   If (LGreater (^CPU0._PPC, Zero))
    Error 4063 -Object not found or not accessible from scope ^  (^CPU0._PPC)

    dsdt.dsl.patched   576:     Subtract (^CPU0._PPC, One, ^CPU0._PPC)
    Error 4063 -Object not found or not accessible from scope ^  (^CPU0._PPC)   

    dsdt.dsl.patched   576:     Subtract (^CPU0._PPC, One, ^CPU0._PPC)
    Error 4063 -Object not found or not accessible from scope ^  (^CPU0._PPC)

    dsdt.dsl.patched   578:     Add (^CPU0._PPC, One, ^CPU0._PPC)
    Error 4063 -Object not found or not accessible from scope ^  (^CPU0._PPC)
  6. Method local variable is not initialized (Local0)

    1
    2
    DSDT.dsl 242: Store (Local0, Local0)
    Error 4050 – ^ Method local variable is not initialized (Local0)

    This error is produced because a variable tries to store it’s value in itself. Original codes:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
      Scope (\_SI)
      {
       Method (_MSG, 1, NotSerialized)
       {
        Store (Local0, Local0)
       }

       Method (_SST, 1, NotSerialized)
       {
        Store (Local0, Local0)
        If (LEqual (Arg0, 0x03)) {}
        If (LEqual (Arg0, 0x01)) {}
       }
      }

    There are two method to repair this,you need to comment this code out below or enclose on ” ” the first Local0

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
       Scope (\_SI)
       {
        Method (_MSG, 1, NotSerialized)
        {
     /* Store (Local0, Local0) */
        }

        Method (_SST, 1, NotSerialized)
        {
     /* Store (Local0, Local0) */
        If (LEqual (Arg0, 0x03)) {}
        If (LEqual (Arg0, 0x01)) {}
        }
       }
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     Scope (\_SI)
      {
       Method (_MSG, 1, NotSerialized)
       {
      /* Store ("Local0", Local0) */
       }

       Method (_SST, 1, NotSerialized)
       {
      /* Store ("Local0", Local0) */
       If (LEqual (Arg0, 0x03)) {}
       If (LEqual (Arg0, 0x01)) {}
       }
      }
  7. Method local variable is not initialized

    1
    2
    dsdt.dsl  610:  If (LNot (LEqual (ShiftRight (And (Local1, 0x10),0x03), And (Local2, 0x02))))
    Error  1013 -  Method local variable is not initialized ^  (Local1)

    In this case, you must change all “Local1″ in that line to “Local2″.(Only in this case, in others it could be another error.)

  8. Missing ResourceSource string

    1
    2
    3
    4
    5
    6
    7
    8
    dsdt.asl  1028:    0x0100, 0x00)
    Error 1094 -   ^ Missing ResourceSource string (required)

    dsdt.asl  1034:    0x00000CF8, 0x00)
    Error 1094 -  ^ Missing ResourceSource string (required)

    dsdt.asl  1041:   0x0000F300, 0x00)
    Error 1094 - ^ Missing ResourceSource string (required)

    To fix this error we must eliminate the value of 0×00 from all erroneous entries. The first one is the original,and the second one is the modified.

    1
    2
    3
    4
    5
    6
    1023  WordBusNumber (ResourceProducer, MinFixed, MaxFixed,PosDecode,
    1024      0x0000, /* Address Space Granularity */
    1025      0x0000, /* Address Range Minimum */
    1026      0x00FF, /* Address Range Maximum */
    1027      0x0000, /* Address Translation Offset */
    1028      0x0100, 0x00)
    1
    2
    3
    4
    5
    6
    1023  WordBusNumber (ResourceProducer, MinFixed, MaxFixed,PosDecode,
    1024      0x0000, /* Address Space Granularity */
    1025      0x0000, /* Address Range Minimum */
    1026      0x00FF, /* Address Range Maximum */
    1027      0x0000, /* Address Translation Offset */
    1028      0x0100)
  9. Must return a value (_WAK)

    1
    2
    dsdt.dsl   163:   Method (_WAK, 1, NotSerialized)
    Warning  2026 -    ^ Reserved method must return a value (_WAK)

    At the end of the _WAK method, this must be added:

    1
    Return(Package(0x02){Zero, Zero})

    Example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    Method (_WAK, 1, NotSerialized)
        {
            P8XH (One, 0xAB)
            If (LOr (LEqual (Arg0, 0x03), LEqual (Arg0, 0x04)))
            {
                If (And (CFGD, 0x01000000))
                {
                    If (LAnd (And (CFGD, 0xF0), LEqual (OSYS, 0x07D1)))
                    {
                        TRAP (0x3D)
                    }
                }
            }

            If (LEqual (RP2D, Zero))
            {
                Notify (\_SB.PCI0.RP02, Zero)
            }

            If (LEqual (Arg0, 0x03)) {}
            If (LEqual (Arg0, 0x04))
            {
                \_SB.PCI0.LPCB.EC.SELE ()
            }

            P8XH (Zero, 0xCD)

            Return (Package (0x02)
            {
                Zero, 
                Zero
            })
        }
  10. Not all control paths return a value

    1
    2
    dsdt.dsl  7288:    Method (EVNT, 1, NotSerialized)
    Warning  1086 -   ^ Not all control paths return a value (EVNT)

    In this other case, a value of this kind must be returned at the end of the method:

    1
    Return (Zero)

    Example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    Method (EVNT, 1, NotSerialized)
                {
                    While (VZOK)
                    {
                        If (LEqual (VZOK, 0x01))
                        {
                            Store (Arg0, VZOK)
                            Notify (\_SB.VALZ, 0x80)
                            Return (Zero)
                        }
                        Else
                        {
                            Sleep (0x05)
                        }
                    }
               }

    The fix is something like:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    Method (EVNT, 1, NotSerialized)
                {
                    While (VZOK)
                    {
                        If (LEqual (VZOK, 0x01))
                        {
                            Store (Arg0, VZOK)
                            Notify (\_SB.VALZ, 0x80)
                            Return (Zero)
                        }
                        Else
                        {
                            Sleep (0x05)
                        }
                    }
                                    Return (Zero)
               }
  11. Not all control paths return a value(2)

    1
    2
    dsdt.dsl   255:   Method (_BTP, 1, NotSerialized)
    Warning  2019 -   ^ Not all control paths return a value (_BTP)

    The original code is:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    Device (CMB0)
    {
        Name (_HID, EisaId ("PNP0C0A"))
        Name (_UID, 0x01)
        Name (BATP, Ones)
        Name (_PCL, Package (0x01)
        {
            \_SB
        })
        ...
        ...
        ...
        Method (_BTP, 1, NotSerialized)
        {
            If (LEqual (\ECFL, Zero))
            {
                Return (0x0F)
            }
            Else
            {
                Store ("_SB.CMB0._BTP", Debug)
            }
        }
        ...
        ...
        ...
    }

    In this case, the solution consists on using the returned value of \ECFL and then add it in place of “Debug”.Change this line:

    1
     Store ("_SB.CMB0._BTP", Debug)

    to this:

    1
     Store ("_SB.CMB0._BTP", 0x0F)
  12. Object does not exist ^ (\_PR.C000)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    dsdt.dsl    75:   If (LEqual (\C001, 0x00))
    Error 1061 -  Object does not exist ^  (\C001)
     
    dsdt.dsl  6589:   \_PR.C000
    Error    1061 -   Object does not exist ^  (\_PR.C000)
     
    dsdt.dsl  6645:  Notify (\_PR.C000, 0x80)
    Error    1061 -   Object does not exist ^  (\_PR.C000)
     
    dsdt.dsl  6718:    Notify (\_PR.C000, 0x80)
    Error  1061 -  Object does not exist ^  (\_PR.C000)

    In this error, there is missing code that needs to be added to the beginning.This is the code to be added:

    1
    2
    External (\C001)                 
    External (\_PR.C000)

    Just below the header of the DSDT, like this:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    /*
     * Intel ACPI Component Architecture
     * AML Disassembler version 20090625
     *
     * Disassembly of ./dsdt.dat, Tue Aug 11 23:29:06 2009
     *
     *
     * Original Table Header:
     *     Signature        "DSDT"
     *     Length           0x00005FC3 (24515)
     *     Revision         0x02
     *     Checksum         0x13
     *     OEM ID           "Sony"
     *     OEM Table ID     "VAIO"
     *     OEM Revision     0x20080725 (537397029)
     *     Compiler ID      "INTL"
     *     Compiler Version 0x20090625 (537462309)
     */

    DefinitionBlock ("./dsdt.aml", "DSDT", 2, "Sony", "VAIO",0x20080725)
    {

        External (\C001)                 
            External (\_PR.C000)

        External (L0C3)
        External (L1C3)
        External (PDC1)
        External (PDC0)
        External (CFGD)
  13. Object does not exist ^ (\LOR)

    1
    2
    ./dsdt_fixed.txt   233:   If (\LOr (_OSI ("Darwin"), _OSI ("Windows 2001"))) 
    Error 4063 - Object does not exist ^ (\LOR)

    Solution:

    1
    If (LOr (\_OSI ("Darwin"), \_OSI ("Windows 2001")))

    Or:

    1
    If (LOr (_OSI ("Darwin"), _OSI ("Windows 2001")))
  14. Operation Region requires ByteAcc

    1
    2
    3
    4
    5
    ./dsdt_fixed.txt  3964:   Field (ECRM, AnyAcc, Lock, Preserve) 
    Error   4075 -   ^ Host Operation Region requires ByteAcc access 

    ./dsdt_fixed.txt  4192:      Return (Local1) 
    Error  4050 -   Method local variable is not initialized ^  (Local1)

    What is happening here? Well This:

    1
    2
    OperationRegion (ECRM, EmbeddedControl, Zero, 0xFF) 
                        Field (ECRM, AnyAcc, Lock, Preserve)

    The compiler tells us that Anyacc isn’t correct, it must be ByteAcc, so that way we change this:

    1
    2
    OperationRegion (ECRM, EmbeddedControl, Zero, 0xFF) 
                        Field (ECRM, ByteAcc, Lock, Preserve)

    The second error:

    1
    2
    ./dsdt_fixed.txt  4192:    Return (Local1) 
    Error   4050 -   Method local variable is not initialized ^  (Local1)

    Is similar to the error above, of the uninitialized variable, does it sound familiar to you all?

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Method (PKTW, 1, NotSerialized) 
                        { 
                            Store (Arg0, EPKT) 
                            Return (Local1) 
    We fix it like this: 


    Method (PKTW, 1, NotSerialized) 
                        { 
                            Store (Arg0, EPKT) 
                            Return (Zero)
  15. Possible operator timeout is ignored

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    dsdt.dsl  4220:   Acquire (MUTE, 0x03E8)
    Warning  1103 -    ^ Possible operator timeout is ignored

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

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

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

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

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

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

    In this error, the value of MUTE must be changed from 0xXXXX to 0xFFFF

    1
    Acquire (MUTE, 0x03E8)

    Converts to the code below,and it must be replaced where ever it gives error.

    1
    Acquire (MUTE, 0xFFFF)
  16. Reserved method has too few arguments

    1
    2
    dsdt.dsl  3067:     Method (_EJ0, 0, NotSerialized)
    Warning  1076 -  ^ Reserved method has too few arguments (_EJ0 requires 1)

    This error is solved by changing:

    1
    Method (_EJ0, 0, NotSerialized)

    to:

    1
    Method (_EJ0, 1, NotSerialized)
  17. Reserved method has too many arguments

    1
    2
    dsdt.dsl  3067:     Method (_EJ0, 0, NotSerialized)
    Warning  1076 -  ^ Reserved method has too few arguments (_EJ0 requires 1)

    This error is solved by changing:

    1
    Method (_EJ0, 0, NotSerialized)

    to:

    1
    Method (_EJ0, 1, NotSerialized)
  18. Reserved method must return a value (_PSR)

    1
    2
    dsdt.dsl 3896: Method (_PSR, 0, NotSerialized)
    Warning 1079 - ^ Reserved method must return a value (_PSR)

    Here the problem is that it is not detected the change from battery/AC.Extracted from the ACPI specifications:

    1
    2
    3
    4
    5
    6
    7
    8
    11.3.1 PSR (Power Source)
    Returns the current power source devices. Used for the AC adapter and is located under the AC adapter
    object in name space. Used to determine if system is running off the AC adapter.
    Arguments:
    None
    Result Code:
    0x00000000 – Off-line
    0x00000001 – On-line

    This is the erroneous code:

    1
    2
    3
    4
    5
    6
    7
    Method (_PSR, 0, NotSerialized)
                {
                    If (\_SB.PCI0.PIB.EC.ECOK)
                    {
                        Return (\_SB.PCI0.PIB.EC.ADP)
                    }
                }

    And here the solution:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Method (_PSR, 0, NotSerialized)
    {
        If (\_SB.PCI0.PIB.EC.ECOK)
        {
            Return (0x01)
        }
        Else
        {
            Return (0x00)
        }
    }
  19. Reserved method must return a value (_STA)

    1
    2
    Method (_STA, 0, NotSerialized) 
    Warning  2026 -    ^ Reserved method must return a value (_STA)

    This is the original code:

    1
    2
    3
    4
    Method (_STA, 0, NotSerialized) 
                { 
                    STAL (0x60) 
                }

    It should be:

    1
    2
    3
    4
                Method (_STA, 0, NotSerialized) 
                { 
                    Return (STAL (0x60)) 
                }
  20. Result is not used, operator has no effect ^

    1
    2
    dsdt.dsl 10150:    ShiftRight (BUF2, 0x04)
    Warning  1105 -    Result is not used, operator has no effect ^

    The error is produced because “Shiftright” stores no value:

    1
    2
    3
    4
    5
    6
    7
    8
    .....
       Store (AAXB, MBUF)
       ShiftRight (BUF2, 0x04) < ------- Error.
       Store (BUF2, Local3)
       Store (CMER, BUF0)
       Store (0xFF, BUF1)
       Store (Zero, BUF2)
    .....

    It must be changed to this :

    1
    2
    3
    4
    5
    6
    7
    8
    Store (BUF2, Local4)
                        
        Store (AAXB, MBUF)
        Store (BUF2, Local4)   <------- Here.
        Store (BUF2, Local3)
        Store (CMER, BUF0)
        Store (0xFF, BUF1)
        Store (Zero, BUF2)

  21. Result is not used, operator has no effect ^ (2)

    1
    2
    ./dsdt.dsl  2803:    And (CTRL, 0x1E)
    Warning  1105 -    ^ Result is not used, operator has no effect

    It can be fixed changing:

    1
    And (CTRL, 0x1E)

    to:

    1
    And (CTRL, 0x1E, CTRL)
  22. String must be entirely alphanumeric

    1
    2
    dsdt.dsl    32:  Name (_HID, "*PNP0A03")
    Error    1068 -  ^ String must be entirely alphanumeric (*PNP0A03)

    Solution is to remove the “ * ”character,such as converts

    1
    (*PNP0A03)

    to:

    1
    (PNP0A03)
  23. Too many arguments

    1
    2
    dsdt.dsl  2672:  Method (_GLK, 1, NotSerialized)
    Warning  2024 -  ^ Reserved method has too many arguments ( _GLK requires 0)

    Solution: eliminate the arguments:

    1
    Method (_GLK)

    This was a simple one.(^0^)

  24. Warning 1099 -Unknown reserved name ^ (_BCG)

    On this case the compiler is complaining about the use of “-” on a specified method name.Here is a example:

    1
    2
    3
    4
    5
    6
    Method (_BCG, 0, Serialized)
                        {
                            Store (C136, Local0)
                            Return (Local0)
                        }
                    }

    Just change _BCG to BCG and the compiler will be happy again.

    1
    2
    3
    4
    5
    6
    Method (BCG, 0, Serialized)
                        {
                            Store (C136, Local0)
                            Return (Local0)
                        }
                    }
  25. Use of reserved word ^ (_T_0)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    dsdt.dsl  2928:    Name (_T_0, Zero)
    Error    4081 -     Use of reserved word ^  (_T_0)

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

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

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

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

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

    The solution consists of changing this:

    1
    Name (_T_0, Zero)

    to this:

    1
    Name (T_0, Zero)
原创粉丝点击