Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
   1 /*******************************************************************************
   2  *
   3  * Module Name: dmnames - AML disassembler, names, namestrings, pathnames
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.
  29  *
  30  * NO WARRANTY
  31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41  * POSSIBILITY OF SUCH DAMAGES.
  42  */
  43 
  44 
  45 #include "acpi.h"
  46 #include "accommon.h"
  47 #include "acparser.h"
  48 #include "amlcode.h"
  49 #include "acnamesp.h"
  50 #include "acdisasm.h"
  51 
  52 
  53 #ifdef ACPI_DISASSEMBLER
  54 
  55 #define _COMPONENT          ACPI_CA_DEBUGGER
  56         ACPI_MODULE_NAME    ("dmnames")
  57 
  58 /* Local prototypes */
  59 
  60 #ifdef ACPI_OBSOLETE_FUNCTIONS
  61 void
  62 AcpiDmDisplayPath (
  63     ACPI_PARSE_OBJECT       *Op);
  64 #endif
  65 
  66 
  67 /*******************************************************************************


 209  * RETURN:      None
 210  *
 211  * DESCRIPTION: Decode and dump an ACPI namestring. Handles prefix characters
 212  *
 213  ******************************************************************************/
 214 
 215 void
 216 AcpiDmNamestring (
 217     char                    *Name)
 218 {
 219     UINT32                  SegCount;
 220 
 221 
 222     if (!Name)
 223     {
 224         return;
 225     }
 226 
 227     /* Handle all Scope Prefix operators */
 228 
 229     while (AcpiPsIsPrefixChar (ACPI_GET8 (Name)))

 230     {
 231         /* Append prefix character */
 232 
 233         AcpiOsPrintf ("%1c", ACPI_GET8 (Name));
 234         Name++;
 235     }
 236 
 237     switch (ACPI_GET8 (Name))
 238     {
 239     case 0:

 240         SegCount = 0;
 241         break;
 242 
 243     case AML_DUAL_NAME_PREFIX:

 244         SegCount = 2;
 245         Name++;
 246         break;
 247 
 248     case AML_MULTI_NAME_PREFIX_OP:

 249         SegCount = (UINT32) ACPI_GET8 (Name + 1);
 250         Name += 2;
 251         break;
 252 
 253     default:

 254         SegCount = 1;
 255         break;
 256     }
 257 
 258     while (SegCount)
 259     {
 260         /* Append Name segment */
 261 
 262         AcpiDmDumpName (*ACPI_CAST_PTR (UINT32, Name));
 263 
 264         SegCount--;
 265         if (SegCount)
 266         {
 267             /* Not last name, append dot separator */
 268 
 269             AcpiOsPrintf (".");
 270         }
 271         Name += ACPI_NAME_SIZE;
 272     }
 273 }


 306     if (!(OpInfo->Flags & AML_NSNODE))
 307     {
 308         return;
 309     }
 310 
 311     if (OpInfo->Flags & AML_CREATE)
 312     {
 313         /* Field creation - check for a fully qualified namepath */
 314 
 315         if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
 316         {
 317             NamePath = AcpiPsGetArg (Op, 3);
 318         }
 319         else
 320         {
 321             NamePath = AcpiPsGetArg (Op, 2);
 322         }
 323 
 324         if ((NamePath) &&
 325             (NamePath->Common.Value.String) &&
 326             (NamePath->Common.Value.String[0] == '\\'))
 327         {
 328             AcpiDmNamestring (NamePath->Common.Value.String);
 329             return;
 330         }
 331     }
 332 
 333     Prev = NULL;            /* Start with Root Node */
 334 
 335     while (Prev != Op)
 336     {
 337         /* Search upwards in the tree to find scope with "prev" as its parent */
 338 
 339         Search = Op;
 340         for (; ;)
 341         {
 342             if (Search->Common.Parent == Prev)
 343             {
 344                 break;
 345             }
 346 


 432     {
 433         return;
 434     }
 435 
 436     TargetOp = AcpiPsFind (Op, Name, 0, 0);
 437     if (!TargetOp)
 438     {
 439         /*
 440          * Didn't find the name in the parse tree.  This may be
 441          * a problem, or it may simply be one of the predefined names
 442          * (such as _OS_).  Rather than worry about looking up all
 443          * the predefined names, just display the name as given
 444          */
 445         AcpiOsPrintf (
 446             " /**** Name not found or not accessible from this scope ****/ ");
 447     }
 448 }
 449 #endif
 450 
 451 #endif
 452 
 453 
   1 /*******************************************************************************
   2  *
   3  * Module Name: dmnames - AML disassembler, names, namestrings, pathnames
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.
  29  *
  30  * NO WARRANTY
  31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41  * POSSIBILITY OF SUCH DAMAGES.
  42  */
  43 
  44 
  45 #include "acpi.h"
  46 #include "accommon.h"

  47 #include "amlcode.h"
  48 #include "acnamesp.h"
  49 #include "acdisasm.h"
  50 
  51 
  52 #ifdef ACPI_DISASSEMBLER
  53 
  54 #define _COMPONENT          ACPI_CA_DEBUGGER
  55         ACPI_MODULE_NAME    ("dmnames")
  56 
  57 /* Local prototypes */
  58 
  59 #ifdef ACPI_OBSOLETE_FUNCTIONS
  60 void
  61 AcpiDmDisplayPath (
  62     ACPI_PARSE_OBJECT       *Op);
  63 #endif
  64 
  65 
  66 /*******************************************************************************


 208  * RETURN:      None
 209  *
 210  * DESCRIPTION: Decode and dump an ACPI namestring. Handles prefix characters
 211  *
 212  ******************************************************************************/
 213 
 214 void
 215 AcpiDmNamestring (
 216     char                    *Name)
 217 {
 218     UINT32                  SegCount;
 219 
 220 
 221     if (!Name)
 222     {
 223         return;
 224     }
 225 
 226     /* Handle all Scope Prefix operators */
 227 
 228     while (ACPI_IS_ROOT_PREFIX (ACPI_GET8 (Name)) ||
 229            ACPI_IS_PARENT_PREFIX (ACPI_GET8 (Name)))
 230     {
 231         /* Append prefix character */
 232 
 233         AcpiOsPrintf ("%1c", ACPI_GET8 (Name));
 234         Name++;
 235     }
 236 
 237     switch (ACPI_GET8 (Name))
 238     {
 239     case 0:
 240 
 241         SegCount = 0;
 242         break;
 243 
 244     case AML_DUAL_NAME_PREFIX:
 245 
 246         SegCount = 2;
 247         Name++;
 248         break;
 249 
 250     case AML_MULTI_NAME_PREFIX_OP:
 251 
 252         SegCount = (UINT32) ACPI_GET8 (Name + 1);
 253         Name += 2;
 254         break;
 255 
 256     default:
 257 
 258         SegCount = 1;
 259         break;
 260     }
 261 
 262     while (SegCount)
 263     {
 264         /* Append Name segment */
 265 
 266         AcpiDmDumpName (*ACPI_CAST_PTR (UINT32, Name));
 267 
 268         SegCount--;
 269         if (SegCount)
 270         {
 271             /* Not last name, append dot separator */
 272 
 273             AcpiOsPrintf (".");
 274         }
 275         Name += ACPI_NAME_SIZE;
 276     }
 277 }


 310     if (!(OpInfo->Flags & AML_NSNODE))
 311     {
 312         return;
 313     }
 314 
 315     if (OpInfo->Flags & AML_CREATE)
 316     {
 317         /* Field creation - check for a fully qualified namepath */
 318 
 319         if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
 320         {
 321             NamePath = AcpiPsGetArg (Op, 3);
 322         }
 323         else
 324         {
 325             NamePath = AcpiPsGetArg (Op, 2);
 326         }
 327 
 328         if ((NamePath) &&
 329             (NamePath->Common.Value.String) &&
 330             (ACPI_IS_ROOT_PREFIX (NamePath->Common.Value.String[0])))
 331         {
 332             AcpiDmNamestring (NamePath->Common.Value.String);
 333             return;
 334         }
 335     }
 336 
 337     Prev = NULL;            /* Start with Root Node */
 338 
 339     while (Prev != Op)
 340     {
 341         /* Search upwards in the tree to find scope with "prev" as its parent */
 342 
 343         Search = Op;
 344         for (; ;)
 345         {
 346             if (Search->Common.Parent == Prev)
 347             {
 348                 break;
 349             }
 350 


 436     {
 437         return;
 438     }
 439 
 440     TargetOp = AcpiPsFind (Op, Name, 0, 0);
 441     if (!TargetOp)
 442     {
 443         /*
 444          * Didn't find the name in the parse tree. This may be
 445          * a problem, or it may simply be one of the predefined names
 446          * (such as _OS_). Rather than worry about looking up all
 447          * the predefined names, just display the name as given
 448          */
 449         AcpiOsPrintf (
 450             " /**** Name not found or not accessible from this scope ****/ ");
 451     }
 452 }
 453 #endif
 454 
 455 #endif