ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

nsdump.c
Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * Module Name: nsdump - table dumping routines for debug
00004  *
00005  *****************************************************************************/
00006 
00007 /******************************************************************************
00008  *
00009  * 1. Copyright Notice
00010  *
00011  * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
00012  * All rights reserved.
00013  *
00014  * 2. License
00015  *
00016  * 2.1. This is your license from Intel Corp. under its intellectual property
00017  * rights.  You may have additional license terms from the party that provided
00018  * you this software, covering your right to use that party's intellectual
00019  * property rights.
00020  *
00021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
00022  * copy of the source code appearing in this file ("Covered Code") an
00023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
00024  * base code distributed originally by Intel ("Original Intel Code") to copy,
00025 
00026  * make derivatives, distribute, use and display any portion of the Covered
00027  * Code in any form, with the right to sublicense such rights; and
00028  *
00029  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
00030  * license (with the right to sublicense), under only those claims of Intel
00031  * patents that are infringed by the Original Intel Code, to make, use, sell,
00032  * offer to sell, and import the Covered Code and derivative works thereof
00033  * solely to the minimum extent necessary to exercise the above copyright
00034  * license, and in no event shall the patent license extend to any additions
00035  * to or modifications of the Original Intel Code.  No other license or right
00036  * is granted directly or by implication, estoppel or otherwise;
00037  *
00038  * The above copyright and patent license is granted only if the following
00039  * conditions are met:
00040  *
00041  * 3. Conditions
00042  *
00043  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
00044  * Redistribution of source code of any substantial portion of the Covered
00045  * Code or modification with rights to further distribute source must include
00046  * the above Copyright Notice, the above License, this list of Conditions,
00047  * and the following Disclaimer and Export Compliance provision.  In addition,
00048  * Licensee must cause all Covered Code to which Licensee contributes to
00049  * contain a file documenting the changes Licensee made to create that Covered
00050  * Code and the date of any change.  Licensee must include in that file the
00051  * documentation of any changes made by any predecessor Licensee.  Licensee
00052  * must include a prominent statement that the modification is derived,
00053  * directly or indirectly, from Original Intel Code.
00054  *
00055  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
00056  * Redistribution of source code of any substantial portion of the Covered
00057  * Code or modification without rights to further distribute source must
00058  * include the following Disclaimer and Export Compliance provision in the
00059  * documentation and/or other materials provided with distribution.  In
00060  * addition, Licensee may not authorize further sublicense of source of any
00061  * portion of the Covered Code, and must include terms to the effect that the
00062  * license from Licensee to its licensee is limited to the intellectual
00063  * property embodied in the software Licensee provides to its licensee, and
00064  * not to intellectual property embodied in modifications its licensee may
00065  * make.
00066  *
00067  * 3.3. Redistribution of Executable. Redistribution in executable form of any
00068  * substantial portion of the Covered Code or modification must reproduce the
00069  * above Copyright Notice, and the following Disclaimer and Export Compliance
00070  * provision in the documentation and/or other materials provided with the
00071  * distribution.
00072  *
00073  * 3.4. Intel retains all right, title, and interest in and to the Original
00074  * Intel Code.
00075  *
00076  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
00077  * Intel shall be used in advertising or otherwise to promote the sale, use or
00078  * other dealings in products derived from or relating to the Covered Code
00079  * without prior written authorization from Intel.
00080  *
00081  * 4. Disclaimer and Export Compliance
00082  *
00083  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
00084  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
00085  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
00086  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
00087  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
00088  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
00089  * PARTICULAR PURPOSE.
00090  *
00091  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
00092  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
00093  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
00094  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
00095  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
00096  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
00097  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
00098  * LIMITED REMEDY.
00099  *
00100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
00101  * software or system incorporating such software without first obtaining any
00102  * required license or other approval from the U. S. Department of Commerce or
00103  * any other agency or department of the United States Government.  In the
00104  * event Licensee exports any such software from the United States or
00105  * re-exports any such software from a foreign destination, Licensee shall
00106  * ensure that the distribution and export/re-export of the software is in
00107  * compliance with all laws, regulations, orders, or other restrictions of the
00108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
00109  * any of its subsidiaries will export/re-export any technical data, process,
00110  * software, or service, directly or indirectly, to any country for which the
00111  * United States government or any agency thereof requires an export license,
00112  * other governmental approval, or letter of assurance, without first obtaining
00113  * such license, approval or letter.
00114  *
00115  *****************************************************************************/
00116 
00117 #define __NSDUMP_C__
00118 
00119 #include "acpi.h"
00120 #include "accommon.h"
00121 #include "acnamesp.h"
00122 
00123 
00124 #define _COMPONENT          ACPI_NAMESPACE
00125         ACPI_MODULE_NAME    ("nsdump")
00126 
00127 /* Local prototypes */
00128 
00129 #ifdef ACPI_OBSOLETE_FUNCTIONS
00130 void
00131 AcpiNsDumpRootDevices (
00132     void);
00133 
00134 static ACPI_STATUS
00135 AcpiNsDumpOneDevice (
00136     ACPI_HANDLE             ObjHandle,
00137     UINT32                  Level,
00138     void                    *Context,
00139     void                    **ReturnValue);
00140 #endif
00141 
00142 
00143 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
00144 /*******************************************************************************
00145  *
00146  * FUNCTION:    AcpiNsPrintPathname
00147  *
00148  * PARAMETERS:  NumSegments         - Number of ACPI name segments
00149  *              Pathname            - The compressed (internal) path
00150  *
00151  * RETURN:      None
00152  *
00153  * DESCRIPTION: Print an object's full namespace pathname
00154  *
00155  ******************************************************************************/
00156 
00157 void
00158 AcpiNsPrintPathname (
00159     UINT32                  NumSegments,
00160     char                    *Pathname)
00161 {
00162     UINT32                  i;
00163 
00164 
00165     ACPI_FUNCTION_NAME (NsPrintPathname);
00166 
00167 
00168     if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
00169     {
00170         return;
00171     }
00172 
00173     /* Print the entire name */
00174 
00175     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
00176 
00177     while (NumSegments)
00178     {
00179         for (i = 0; i < 4; i++)
00180         {
00181             ACPI_IS_PRINT (Pathname[i]) ?
00182                 AcpiOsPrintf ("%c", Pathname[i]) :
00183                 AcpiOsPrintf ("?");
00184         }
00185 
00186         Pathname += ACPI_NAME_SIZE;
00187         NumSegments--;
00188         if (NumSegments)
00189         {
00190             AcpiOsPrintf (".");
00191         }
00192     }
00193 
00194     AcpiOsPrintf ("]\n");
00195 }
00196 
00197 
00198 /*******************************************************************************
00199  *
00200  * FUNCTION:    AcpiNsDumpPathname
00201  *
00202  * PARAMETERS:  Handle              - Object
00203  *              Msg                 - Prefix message
00204  *              Level               - Desired debug level
00205  *              Component           - Caller's component ID
00206  *
00207  * RETURN:      None
00208  *
00209  * DESCRIPTION: Print an object's full namespace pathname
00210  *              Manages allocation/freeing of a pathname buffer
00211  *
00212  ******************************************************************************/
00213 
00214 void
00215 AcpiNsDumpPathname (
00216     ACPI_HANDLE             Handle,
00217     char                    *Msg,
00218     UINT32                  Level,
00219     UINT32                  Component)
00220 {
00221 
00222     ACPI_FUNCTION_TRACE (NsDumpPathname);
00223 
00224 
00225     /* Do this only if the requested debug level and component are enabled */
00226 
00227     if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
00228     {
00229         return_VOID;
00230     }
00231 
00232     /* Convert handle to a full pathname and print it (with supplied message) */
00233 
00234     AcpiNsPrintNodePathname (Handle, Msg);
00235     AcpiOsPrintf ("\n");
00236     return_VOID;
00237 }
00238 
00239 
00240 /*******************************************************************************
00241  *
00242  * FUNCTION:    AcpiNsDumpOneObject
00243  *
00244  * PARAMETERS:  ObjHandle           - Node to be dumped
00245  *              Level               - Nesting level of the handle
00246  *              Context             - Passed into WalkNamespace
00247  *              ReturnValue         - Not used
00248  *
00249  * RETURN:      Status
00250  *
00251  * DESCRIPTION: Dump a single Node
00252  *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
00253  *
00254  ******************************************************************************/
00255 
00256 ACPI_STATUS
00257 AcpiNsDumpOneObject (
00258     ACPI_HANDLE             ObjHandle,
00259     UINT32                  Level,
00260     void                    *Context,
00261     void                    **ReturnValue)
00262 {
00263     ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
00264     ACPI_NAMESPACE_NODE     *ThisNode;
00265     ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
00266     ACPI_OBJECT_TYPE        ObjType;
00267     ACPI_OBJECT_TYPE        Type;
00268     UINT32                  BytesToDump;
00269     UINT32                  DbgLevel;
00270     UINT32                  i;
00271 
00272 
00273     ACPI_FUNCTION_NAME (NsDumpOneObject);
00274 
00275 
00276     /* Is output enabled? */
00277 
00278     if (!(AcpiDbgLevel & Info->DebugLevel))
00279     {
00280         return (AE_OK);
00281     }
00282 
00283     if (!ObjHandle)
00284     {
00285         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
00286         return (AE_OK);
00287     }
00288 
00289     ThisNode = AcpiNsValidateHandle (ObjHandle);
00290     if (!ThisNode)
00291     {
00292         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
00293             ObjHandle));
00294         return (AE_OK);
00295     }
00296 
00297     Type = ThisNode->Type;
00298 
00299     /* Check if the owner matches */
00300 
00301     if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
00302         (Info->OwnerId != ThisNode->OwnerId))
00303     {
00304         return (AE_OK);
00305     }
00306 
00307     if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
00308     {
00309         /* Indent the object according to the level */
00310 
00311         AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
00312 
00313         /* Check the node type and name */
00314 
00315         if (Type > ACPI_TYPE_LOCAL_MAX)
00316         {
00317             ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type 0x%08X", Type));
00318         }
00319 
00320         AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
00321     }
00322 
00323     /* Now we can print out the pertinent information */
00324 
00325     AcpiOsPrintf (" %-12s %p %2.2X ",
00326             AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
00327 
00328     DbgLevel = AcpiDbgLevel;
00329     AcpiDbgLevel = 0;
00330     ObjDesc = AcpiNsGetAttachedObject (ThisNode);
00331     AcpiDbgLevel = DbgLevel;
00332 
00333     /* Temp nodes are those nodes created by a control method */
00334 
00335     if (ThisNode->Flags & ANOBJ_TEMPORARY)
00336     {
00337         AcpiOsPrintf ("(T) ");
00338     }
00339 
00340     switch (Info->DisplayType & ACPI_DISPLAY_MASK)
00341     {
00342     case ACPI_DISPLAY_SUMMARY:
00343 
00344         if (!ObjDesc)
00345         {
00346             /* No attached object, we are done */
00347 
00348             AcpiOsPrintf ("\n");
00349             return (AE_OK);
00350         }
00351 
00352         switch (Type)
00353         {
00354         case ACPI_TYPE_PROCESSOR:
00355 
00356             AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
00357                 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
00358                 ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
00359             break;
00360 
00361 
00362         case ACPI_TYPE_DEVICE:
00363 
00364             AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
00365             break;
00366 
00367 
00368         case ACPI_TYPE_METHOD:
00369 
00370             AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
00371                 (UINT32) ObjDesc->Method.ParamCount,
00372                 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
00373             break;
00374 
00375 
00376         case ACPI_TYPE_INTEGER:
00377 
00378             AcpiOsPrintf ("= %8.8X%8.8X\n",
00379                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
00380             break;
00381 
00382 
00383         case ACPI_TYPE_PACKAGE:
00384 
00385             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
00386             {
00387                 AcpiOsPrintf ("Elements %.2X\n",
00388                     ObjDesc->Package.Count);
00389             }
00390             else
00391             {
00392                 AcpiOsPrintf ("[Length not yet evaluated]\n");
00393             }
00394             break;
00395 
00396 
00397         case ACPI_TYPE_BUFFER:
00398 
00399             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
00400             {
00401                 AcpiOsPrintf ("Len %.2X",
00402                             ObjDesc->Buffer.Length);
00403 
00404                 /* Dump some of the buffer */
00405 
00406                 if (ObjDesc->Buffer.Length > 0)
00407                 {
00408                     AcpiOsPrintf (" =");
00409                     for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
00410                     {
00411                         AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
00412                     }
00413                 }
00414                 AcpiOsPrintf ("\n");
00415             }
00416             else
00417             {
00418                 AcpiOsPrintf ("[Length not yet evaluated]\n");
00419             }
00420             break;
00421 
00422 
00423         case ACPI_TYPE_STRING:
00424 
00425             AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
00426             AcpiUtPrintString (ObjDesc->String.Pointer, 32);
00427             AcpiOsPrintf ("\n");
00428             break;
00429 
00430 
00431         case ACPI_TYPE_REGION:
00432 
00433             AcpiOsPrintf ("[%s]",
00434                 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
00435             if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
00436             {
00437                 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
00438                     ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
00439                     ObjDesc->Region.Length);
00440             }
00441             else
00442             {
00443                 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
00444             }
00445             break;
00446 
00447 
00448         case ACPI_TYPE_LOCAL_REFERENCE:
00449 
00450             AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
00451             break;
00452 
00453 
00454         case ACPI_TYPE_BUFFER_FIELD:
00455 
00456             if (ObjDesc->BufferField.BufferObj &&
00457                 ObjDesc->BufferField.BufferObj->Buffer.Node)
00458             {
00459                 AcpiOsPrintf ("Buf [%4.4s]",
00460                     AcpiUtGetNodeName (
00461                         ObjDesc->BufferField.BufferObj->Buffer.Node));
00462             }
00463             break;
00464 
00465 
00466         case ACPI_TYPE_LOCAL_REGION_FIELD:
00467 
00468             AcpiOsPrintf ("Rgn [%4.4s]",
00469                 AcpiUtGetNodeName (
00470                     ObjDesc->CommonField.RegionObj->Region.Node));
00471             break;
00472 
00473 
00474         case ACPI_TYPE_LOCAL_BANK_FIELD:
00475 
00476             AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
00477                 AcpiUtGetNodeName (
00478                     ObjDesc->CommonField.RegionObj->Region.Node),
00479                 AcpiUtGetNodeName (
00480                     ObjDesc->BankField.BankObj->CommonField.Node));
00481             break;
00482 
00483 
00484         case ACPI_TYPE_LOCAL_INDEX_FIELD:
00485 
00486             AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
00487                 AcpiUtGetNodeName (
00488                     ObjDesc->IndexField.IndexObj->CommonField.Node),
00489                 AcpiUtGetNodeName (
00490                     ObjDesc->IndexField.DataObj->CommonField.Node));
00491             break;
00492 
00493 
00494         case ACPI_TYPE_LOCAL_ALIAS:
00495         case ACPI_TYPE_LOCAL_METHOD_ALIAS:
00496 
00497             AcpiOsPrintf ("Target %4.4s (%p)\n",
00498                 AcpiUtGetNodeName (ObjDesc), ObjDesc);
00499             break;
00500 
00501         default:
00502 
00503             AcpiOsPrintf ("Object %p\n", ObjDesc);
00504             break;
00505         }
00506 
00507         /* Common field handling */
00508 
00509         switch (Type)
00510         {
00511         case ACPI_TYPE_BUFFER_FIELD:
00512         case ACPI_TYPE_LOCAL_REGION_FIELD:
00513         case ACPI_TYPE_LOCAL_BANK_FIELD:
00514         case ACPI_TYPE_LOCAL_INDEX_FIELD:
00515 
00516             AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
00517                 (ObjDesc->CommonField.BaseByteOffset * 8)
00518                     + ObjDesc->CommonField.StartFieldBitOffset,
00519                 ObjDesc->CommonField.BitLength,
00520                 ObjDesc->CommonField.AccessByteWidth);
00521             break;
00522 
00523         default:
00524             break;
00525         }
00526         break;
00527 
00528 
00529     case ACPI_DISPLAY_OBJECTS:
00530 
00531         AcpiOsPrintf ("O:%p", ObjDesc);
00532         if (!ObjDesc)
00533         {
00534             /* No attached object, we are done */
00535 
00536             AcpiOsPrintf ("\n");
00537             return (AE_OK);
00538         }
00539 
00540         AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
00541 
00542         switch (Type)
00543         {
00544         case ACPI_TYPE_METHOD:
00545 
00546             /* Name is a Method and its AML offset/length are set */
00547 
00548             AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
00549                 ObjDesc->Method.AmlLength);
00550             break;
00551 
00552         case ACPI_TYPE_INTEGER:
00553 
00554             AcpiOsPrintf (" I:%8.8X8.8%X\n",
00555                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
00556             break;
00557 
00558         case ACPI_TYPE_STRING:
00559 
00560             AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
00561                 ObjDesc->String.Length);
00562             break;
00563 
00564         case ACPI_TYPE_BUFFER:
00565 
00566             AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
00567                 ObjDesc->Buffer.Length);
00568             break;
00569 
00570         default:
00571 
00572             AcpiOsPrintf ("\n");
00573             break;
00574         }
00575         break;
00576 
00577 
00578     default:
00579         AcpiOsPrintf ("\n");
00580         break;
00581     }
00582 
00583     /* If debug turned off, done */
00584 
00585     if (!(AcpiDbgLevel & ACPI_LV_VALUES))
00586     {
00587         return (AE_OK);
00588     }
00589 
00590     /* If there is an attached object, display it */
00591 
00592     DbgLevel     = AcpiDbgLevel;
00593     AcpiDbgLevel = 0;
00594     ObjDesc      = AcpiNsGetAttachedObject (ThisNode);
00595     AcpiDbgLevel = DbgLevel;
00596 
00597     /* Dump attached objects */
00598 
00599     while (ObjDesc)
00600     {
00601         ObjType = ACPI_TYPE_INVALID;
00602         AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
00603 
00604         /* Decode the type of attached object and dump the contents */
00605 
00606         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
00607         {
00608         case ACPI_DESC_TYPE_NAMED:
00609 
00610             AcpiOsPrintf ("(Ptr to Node)\n");
00611             BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
00612             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
00613             break;
00614 
00615         case ACPI_DESC_TYPE_OPERAND:
00616 
00617             ObjType = ObjDesc->Common.Type;
00618 
00619             if (ObjType > ACPI_TYPE_LOCAL_MAX)
00620             {
00621                 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
00622                     ObjType);
00623                 BytesToDump = 32;
00624             }
00625             else
00626             {
00627                 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n",
00628                     ObjType, AcpiUtGetTypeName (ObjType));
00629                 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
00630             }
00631 
00632             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
00633             break;
00634 
00635         default:
00636 
00637             break;
00638         }
00639 
00640         /* If value is NOT an internal object, we are done */
00641 
00642         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
00643         {
00644             goto Cleanup;
00645         }
00646 
00647         /* Valid object, get the pointer to next level, if any */
00648 
00649         switch (ObjType)
00650         {
00651         case ACPI_TYPE_BUFFER:
00652         case ACPI_TYPE_STRING:
00653             /*
00654              * NOTE: takes advantage of common fields between string/buffer
00655              */
00656             BytesToDump = ObjDesc->String.Length;
00657             ObjDesc = (void *) ObjDesc->String.Pointer;
00658             AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
00659                 ObjDesc, BytesToDump);
00660             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
00661             goto Cleanup;
00662 
00663         case ACPI_TYPE_BUFFER_FIELD:
00664             ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
00665             break;
00666 
00667         case ACPI_TYPE_PACKAGE:
00668             ObjDesc = (void *) ObjDesc->Package.Elements;
00669             break;
00670 
00671         case ACPI_TYPE_METHOD:
00672             ObjDesc = (void *) ObjDesc->Method.AmlStart;
00673             break;
00674 
00675         case ACPI_TYPE_LOCAL_REGION_FIELD:
00676             ObjDesc = (void *) ObjDesc->Field.RegionObj;
00677             break;
00678 
00679         case ACPI_TYPE_LOCAL_BANK_FIELD:
00680             ObjDesc = (void *) ObjDesc->BankField.RegionObj;
00681             break;
00682 
00683         case ACPI_TYPE_LOCAL_INDEX_FIELD:
00684             ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
00685             break;
00686 
00687         default:
00688             goto Cleanup;
00689         }
00690 
00691         ObjType = ACPI_TYPE_INVALID;   /* Terminate loop after next pass */
00692     }
00693 
00694 Cleanup:
00695     AcpiOsPrintf ("\n");
00696     return (AE_OK);
00697 }
00698 
00699 
00700 /*******************************************************************************
00701  *
00702  * FUNCTION:    AcpiNsDumpObjects
00703  *
00704  * PARAMETERS:  Type                - Object type to be dumped
00705  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
00706  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
00707  *                                    for an effectively unlimited depth.
00708  *              OwnerId             - Dump only objects owned by this ID. Use
00709  *                                    ACPI_UINT32_MAX to match all owners.
00710  *              StartHandle         - Where in namespace to start/end search
00711  *
00712  * RETURN:      None
00713  *
00714  * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
00715  *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
00716  *
00717  ******************************************************************************/
00718 
00719 void
00720 AcpiNsDumpObjects (
00721     ACPI_OBJECT_TYPE        Type,
00722     UINT8                   DisplayType,
00723     UINT32                  MaxDepth,
00724     ACPI_OWNER_ID           OwnerId,
00725     ACPI_HANDLE             StartHandle)
00726 {
00727     ACPI_WALK_INFO          Info;
00728     ACPI_STATUS             Status;
00729 
00730 
00731     ACPI_FUNCTION_ENTRY ();
00732 
00733 
00734     /*
00735      * Just lock the entire namespace for the duration of the dump.
00736      * We don't want any changes to the namespace during this time,
00737      * especially the temporary nodes since we are going to display
00738      * them also.
00739      */
00740     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
00741     if (ACPI_FAILURE (Status))
00742     {
00743         AcpiOsPrintf ("Could not acquire namespace mutex\n");
00744         return;
00745     }
00746 
00747     Info.DebugLevel = ACPI_LV_TABLES;
00748     Info.OwnerId = OwnerId;
00749     Info.DisplayType = DisplayType;
00750 
00751     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
00752                 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
00753                 AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
00754 
00755     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
00756 }
00757 
00758 
00759 /*******************************************************************************
00760  *
00761  * FUNCTION:    AcpiNsDumpEntry
00762  *
00763  * PARAMETERS:  Handle              - Node to be dumped
00764  *              DebugLevel          - Output level
00765  *
00766  * RETURN:      None
00767  *
00768  * DESCRIPTION: Dump a single Node
00769  *
00770  ******************************************************************************/
00771 
00772 void
00773 AcpiNsDumpEntry (
00774     ACPI_HANDLE             Handle,
00775     UINT32                  DebugLevel)
00776 {
00777     ACPI_WALK_INFO          Info;
00778 
00779 
00780     ACPI_FUNCTION_ENTRY ();
00781 
00782 
00783     Info.DebugLevel = DebugLevel;
00784     Info.OwnerId = ACPI_OWNER_ID_MAX;
00785     Info.DisplayType = ACPI_DISPLAY_SUMMARY;
00786 
00787     (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
00788 }
00789 
00790 
00791 #ifdef ACPI_ASL_COMPILER
00792 /*******************************************************************************
00793  *
00794  * FUNCTION:    AcpiNsDumpTables
00795  *
00796  * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
00797  *                                    NS_ALL to dump the entire namespace
00798  *              MaxDepth            - Maximum depth of dump.  Use INT_MAX
00799  *                                    for an effectively unlimited depth.
00800  *
00801  * RETURN:      None
00802  *
00803  * DESCRIPTION: Dump the name space, or a portion of it.
00804  *
00805  ******************************************************************************/
00806 
00807 void
00808 AcpiNsDumpTables (
00809     ACPI_HANDLE             SearchBase,
00810     UINT32                  MaxDepth)
00811 {
00812     ACPI_HANDLE             SearchHandle = SearchBase;
00813 
00814 
00815     ACPI_FUNCTION_TRACE (NsDumpTables);
00816 
00817 
00818     if (!AcpiGbl_RootNode)
00819     {
00820         /*
00821          * If the name space has not been initialized,
00822          * there is nothing to dump.
00823          */
00824         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
00825         return_VOID;
00826     }
00827 
00828     if (ACPI_NS_ALL == SearchBase)
00829     {
00830         /* Entire namespace */
00831 
00832         SearchHandle = AcpiGbl_RootNode;
00833         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
00834     }
00835 
00836     AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
00837             ACPI_OWNER_ID_MAX, SearchHandle);
00838     return_VOID;
00839 }
00840 #endif
00841 #endif
00842 

Generated on Sat May 26 2012 04:25:53 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.