diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2018-12-13 19:04:25 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2018-12-13 19:04:25 +0000 | 
| commit | d28459aaaf532373b12c80aa5b869f8b591954e7 (patch) | |
| tree | 22941844047df08d63d286d7dfbf38f3a8f79e0f /source/tools/acpihelp | |
| parent | 4d4b15a0e8524e15826ac932bd05252dbd246422 (diff) | |
Notes
Diffstat (limited to 'source/tools/acpihelp')
| -rw-r--r-- | source/tools/acpihelp/ahdecode.c | 120 | 
1 files changed, 110 insertions, 10 deletions
diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index 4c6850385cb1..416acf4d3787 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -168,6 +168,10 @@ AhDisplayPredefinedInfo (      char                    *Name);  static void +AhDoSpecialNames ( +    char                    *Name); + +static void  AhDisplayResourceName (      const ACPI_PREDEFINED_INFO  *ThisName); @@ -293,15 +297,23 @@ AhFindPredefinedNames (  {      UINT32                  Length;      BOOLEAN                 Found; -    char                    Name[9]; +    char                    Name[ACPI_NAME_SIZE + 1]; -    if (!NamePrefix || (NamePrefix[0] == '*')) +    if (!NamePrefix || (*NamePrefix == '*'))      {          Found = AhDisplayPredefinedName (NULL, 0);          return;      } +    Length = strlen (NamePrefix); +    if (Length > ACPI_NAME_SIZE) +    { +        printf ("%.8s: Predefined name must be 4 characters maximum\n", +            NamePrefix); +        return; +    } +      /* Contruct a local name or name prefix */      AcpiUtStrupr (NamePrefix); @@ -311,14 +323,13 @@ AhFindPredefinedNames (      }      Name[0] = '_'; -    AcpiUtSafeStrncpy (&Name[1], NamePrefix, 7); +    AcpiUtSafeStrncpy (&Name[1], NamePrefix, 4); -    Length = strlen (Name); -    if (Length > ACPI_NAME_SIZE) -    { -        printf ("%.8s: Predefined name must be 4 characters maximum\n", Name); -        return; -    } +    /* Check for special names such as _Exx, _ACx, etc. */ + +    AhDoSpecialNames (Name); + +    /* Lookup and display the name(s) */      Found = AhDisplayPredefinedName (Name, Length);      if (!Found) @@ -330,6 +341,95 @@ AhFindPredefinedNames (  /*******************************************************************************   * + * FUNCTION:    AhDoSpecialNames + * + * PARAMETERS:  Name          - Name or prefix to find + * + * RETURN:      None + * + * DESCRIPTION: Detect and handle the "special" names such as _Exx, _ACx, etc. + * + * Current support: + *  _EJx + *  _Exx + *  _Lxx + *  _Qxx + *  _Wxx + *  _ACx + *  _ALx + *  _T_x + * + ******************************************************************************/ + +static void +AhDoSpecialNames ( +    char                    *Name) +{ + +    /* +     * Check for the special names that have one or more numeric +     * suffixes. For example, _Lxx can have 256 different flavors, +     * from _L00 to _LFF. +     */ +    switch (Name[1]) +    { +    case 'E': +        if (Name[2] == 'J') +        { +            if (isdigit (Name[3]) || (Name[3] == 'X')) +            { +                /* _EJx */ + +                Name[3] = 'x'; +                break; +            } +        } + +        /* Fallthrough */ + +    case 'L': +    case 'Q': +    case 'W': +        if ((isxdigit (Name[2]) && isxdigit (Name[3])) +                || +            ((Name[2] == 'X') && (Name[3] == 'X'))) +        { +            /* _Exx, _Lxx, _Qxx, or _Wxx */ + +            Name[2] = 'x'; +            Name[3] = 'x'; +        } +        break; + +    case 'A': +        if ((Name[2] == 'C') || (Name[2] == 'L')) +        { +            if (isdigit (Name[3]) || (Name[3] == 'X')) +            { +                /* _ACx or _ALx */ + +                Name[3] = 'x'; +            } +        } +        break; + +    case 'T': +        if (Name[2] == '_') +        { +            /* _T_x (Reserved for iASL compiler */ + +            Name[3] = 'x'; +        } +        break; + +    default: +        break; +    } +} + + +/******************************************************************************* + *   * FUNCTION:    AhDisplayPredefinedName   *   * PARAMETERS:  Name                - Name or name prefix @@ -420,7 +520,7 @@ AhDisplayPredefinedInfo (      /* NOTE: we check both tables always because there are some dupes */ -    /* Check against the predefine methods first */ +    /* Check against the predefined methods first */      ThisName = AcpiUtMatchPredefinedMethod (Name);      if (ThisName)  | 
