Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/drivers/acpica/uttrack.c need to be fixed.

0001 /******************************************************************************
0002  *
0003  * Module Name: uttrack - Memory allocation tracking routines (debug only)
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights.  You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code.  No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision.  In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change.  Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee.  Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution.  In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government.  In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************/
0115 
0116 /*
0117  * These procedures are used for tracking memory leaks in the subsystem, and
0118  * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
0119  *
0120  * Each memory allocation is tracked via a doubly linked list.  Each
0121  * element contains the caller's component, module name, function name, and
0122  * line number.  AcpiUtAllocate and AcpiUtAllocateZeroed call
0123  * AcpiUtTrackAllocation to add an element to the list; deletion
0124  * occurs in the body of AcpiUtFree.
0125  */
0126 
0127 #define __UTTRACK_C__
0128 
0129 #include "acpi.h"
0130 #include "accommon.h"
0131 
0132 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
0133 
0134 #define _COMPONENT          ACPI_UTILITIES
0135         ACPI_MODULE_NAME    ("uttrack")
0136 
0137 /* Local prototypes */
0138 
0139 static ACPI_DEBUG_MEM_BLOCK *
0140 AcpiUtFindAllocation (
0141     void                    *Allocation);
0142 
0143 static ACPI_STATUS
0144 AcpiUtTrackAllocation (
0145     ACPI_DEBUG_MEM_BLOCK    *Address,
0146     ACPI_SIZE               Size,
0147     UINT8                   AllocType,
0148     UINT32                  Component,
0149     const char              *Module,
0150     UINT32                  Line);
0151 
0152 static ACPI_STATUS
0153 AcpiUtRemoveAllocation (
0154     ACPI_DEBUG_MEM_BLOCK    *Address,
0155     UINT32                  Component,
0156     const char              *Module,
0157     UINT32                  Line);
0158 
0159 
0160 /*******************************************************************************
0161  *
0162  * FUNCTION:    AcpiUtCreateList
0163  *
0164  * PARAMETERS:  CacheName       - Ascii name for the cache
0165  *              ObjectSize      - Size of each cached object
0166  *              ReturnCache     - Where the new cache object is returned
0167  *
0168  * RETURN:      Status
0169  *
0170  * DESCRIPTION: Create a local memory list for tracking purposed
0171  *
0172  ******************************************************************************/
0173 
0174 ACPI_STATUS
0175 AcpiUtCreateList (
0176     char                    *ListName,
0177     UINT16                  ObjectSize,
0178     ACPI_MEMORY_LIST        **ReturnCache)
0179 {
0180     ACPI_MEMORY_LIST        *Cache;
0181 
0182 
0183     Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST));
0184     if (!Cache)
0185     {
0186         return (AE_NO_MEMORY);
0187     }
0188 
0189     ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
0190 
0191     Cache->ListName   = ListName;
0192     Cache->ObjectSize = ObjectSize;
0193 
0194     *ReturnCache = Cache;
0195     return (AE_OK);
0196 }
0197 
0198 
0199 /*******************************************************************************
0200  *
0201  * FUNCTION:    AcpiUtAllocateAndTrack
0202  *
0203  * PARAMETERS:  Size                - Size of the allocation
0204  *              Component           - Component type of caller
0205  *              Module              - Source file name of caller
0206  *              Line                - Line number of caller
0207  *
0208  * RETURN:      Address of the allocated memory on success, NULL on failure.
0209  *
0210  * DESCRIPTION: The subsystem's equivalent of malloc.
0211  *
0212  ******************************************************************************/
0213 
0214 void *
0215 AcpiUtAllocateAndTrack (
0216     ACPI_SIZE               Size,
0217     UINT32                  Component,
0218     const char              *Module,
0219     UINT32                  Line)
0220 {
0221     ACPI_DEBUG_MEM_BLOCK    *Allocation;
0222     ACPI_STATUS             Status;
0223 
0224 
0225     Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
0226                     Component, Module, Line);
0227     if (!Allocation)
0228     {
0229         return (NULL);
0230     }
0231 
0232     Status = AcpiUtTrackAllocation (Allocation, Size,
0233                     ACPI_MEM_MALLOC, Component, Module, Line);
0234     if (ACPI_FAILURE (Status))
0235     {
0236         AcpiOsFree (Allocation);
0237         return (NULL);
0238     }
0239 
0240     AcpiGbl_GlobalList->TotalAllocated++;
0241     AcpiGbl_GlobalList->TotalSize += (UINT32) Size;
0242     AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size;
0243     if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied)
0244     {
0245         AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize;
0246     }
0247 
0248     return ((void *) &Allocation->UserSpace);
0249 }
0250 
0251 
0252 /*******************************************************************************
0253  *
0254  * FUNCTION:    AcpiUtAllocateZeroedAndTrack
0255  *
0256  * PARAMETERS:  Size                - Size of the allocation
0257  *              Component           - Component type of caller
0258  *              Module              - Source file name of caller
0259  *              Line                - Line number of caller
0260  *
0261  * RETURN:      Address of the allocated memory on success, NULL on failure.
0262  *
0263  * DESCRIPTION: Subsystem equivalent of calloc.
0264  *
0265  ******************************************************************************/
0266 
0267 void *
0268 AcpiUtAllocateZeroedAndTrack (
0269     ACPI_SIZE               Size,
0270     UINT32                  Component,
0271     const char              *Module,
0272     UINT32                  Line)
0273 {
0274     ACPI_DEBUG_MEM_BLOCK    *Allocation;
0275     ACPI_STATUS             Status;
0276 
0277 
0278     Allocation = AcpiUtAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
0279                     Component, Module, Line);
0280     if (!Allocation)
0281     {
0282         /* Report allocation error */
0283 
0284         ACPI_ERROR ((Module, Line,
0285             "Could not allocate size %X", (UINT32) Size));
0286         return (NULL);
0287     }
0288 
0289     Status = AcpiUtTrackAllocation (Allocation, Size,
0290                 ACPI_MEM_CALLOC, Component, Module, Line);
0291     if (ACPI_FAILURE (Status))
0292     {
0293         AcpiOsFree (Allocation);
0294         return (NULL);
0295     }
0296 
0297     AcpiGbl_GlobalList->TotalAllocated++;
0298     AcpiGbl_GlobalList->TotalSize += (UINT32) Size;
0299     AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size;
0300     if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied)
0301     {
0302         AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize;
0303     }
0304 
0305     return ((void *) &Allocation->UserSpace);
0306 }
0307 
0308 
0309 /*******************************************************************************
0310  *
0311  * FUNCTION:    AcpiUtFreeAndTrack
0312  *
0313  * PARAMETERS:  Allocation          - Address of the memory to deallocate
0314  *              Component           - Component type of caller
0315  *              Module              - Source file name of caller
0316  *              Line                - Line number of caller
0317  *
0318  * RETURN:      None
0319  *
0320  * DESCRIPTION: Frees the memory at Allocation
0321  *
0322  ******************************************************************************/
0323 
0324 void
0325 AcpiUtFreeAndTrack (
0326     void                    *Allocation,
0327     UINT32                  Component,
0328     const char              *Module,
0329     UINT32                  Line)
0330 {
0331     ACPI_DEBUG_MEM_BLOCK    *DebugBlock;
0332     ACPI_STATUS             Status;
0333 
0334 
0335     ACPI_FUNCTION_TRACE_PTR (UtFree, Allocation);
0336 
0337 
0338     if (NULL == Allocation)
0339     {
0340         ACPI_ERROR ((Module, Line,
0341             "Attempt to delete a NULL address"));
0342 
0343         return_VOID;
0344     }
0345 
0346     DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK,
0347                     (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER)));
0348 
0349     AcpiGbl_GlobalList->TotalFreed++;
0350     AcpiGbl_GlobalList->CurrentTotalSize -= DebugBlock->Size;
0351 
0352     Status = AcpiUtRemoveAllocation (DebugBlock,
0353                     Component, Module, Line);
0354     if (ACPI_FAILURE (Status))
0355     {
0356         ACPI_EXCEPTION ((AE_INFO, Status, "Could not free memory"));
0357     }
0358 
0359     AcpiOsFree (DebugBlock);
0360     ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation));
0361     return_VOID;
0362 }
0363 
0364 
0365 /*******************************************************************************
0366  *
0367  * FUNCTION:    AcpiUtFindAllocation
0368  *
0369  * PARAMETERS:  Allocation              - Address of allocated memory
0370  *
0371  * RETURN:      A list element if found; NULL otherwise.
0372  *
0373  * DESCRIPTION: Searches for an element in the global allocation tracking list.
0374  *
0375  ******************************************************************************/
0376 
0377 static ACPI_DEBUG_MEM_BLOCK *
0378 AcpiUtFindAllocation (
0379     void                    *Allocation)
0380 {
0381     ACPI_DEBUG_MEM_BLOCK    *Element;
0382 
0383 
0384     ACPI_FUNCTION_ENTRY ();
0385 
0386 
0387     Element = AcpiGbl_GlobalList->ListHead;
0388 
0389     /* Search for the address. */
0390 
0391     while (Element)
0392     {
0393         if (Element == Allocation)
0394         {
0395             return (Element);
0396         }
0397 
0398         Element = Element->Next;
0399     }
0400 
0401     return (NULL);
0402 }
0403 
0404 
0405 /*******************************************************************************
0406  *
0407  * FUNCTION:    AcpiUtTrackAllocation
0408  *
0409  * PARAMETERS:  Allocation          - Address of allocated memory
0410  *              Size                - Size of the allocation
0411  *              AllocType           - MEM_MALLOC or MEM_CALLOC
0412  *              Component           - Component type of caller
0413  *              Module              - Source file name of caller
0414  *              Line                - Line number of caller
0415  *
0416  * RETURN:      None.
0417  *
0418  * DESCRIPTION: Inserts an element into the global allocation tracking list.
0419  *
0420  ******************************************************************************/
0421 
0422 static ACPI_STATUS
0423 AcpiUtTrackAllocation (
0424     ACPI_DEBUG_MEM_BLOCK    *Allocation,
0425     ACPI_SIZE               Size,
0426     UINT8                   AllocType,
0427     UINT32                  Component,
0428     const char              *Module,
0429     UINT32                  Line)
0430 {
0431     ACPI_MEMORY_LIST        *MemList;
0432     ACPI_DEBUG_MEM_BLOCK    *Element;
0433     ACPI_STATUS             Status = AE_OK;
0434 
0435 
0436     ACPI_FUNCTION_TRACE_PTR (UtTrackAllocation, Allocation);
0437 
0438 
0439     MemList = AcpiGbl_GlobalList;
0440     Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
0441     if (ACPI_FAILURE (Status))
0442     {
0443         return_ACPI_STATUS (Status);
0444     }
0445 
0446     /*
0447      * Search list for this address to make sure it is not already on the list.
0448      * This will catch several kinds of problems.
0449      */
0450     Element = AcpiUtFindAllocation (Allocation);
0451     if (Element)
0452     {
0453         ACPI_ERROR ((AE_INFO,
0454             "UtTrackAllocation: Allocation already present in list! (%p)",
0455             Allocation));
0456 
0457         ACPI_ERROR ((AE_INFO, "Element %p Address %p",
0458             Element, Allocation));
0459 
0460         goto UnlockAndExit;
0461     }
0462 
0463     /* Fill in the instance data. */
0464 
0465     Allocation->Size      = (UINT32) Size;
0466     Allocation->AllocType = AllocType;
0467     Allocation->Component = Component;
0468     Allocation->Line      = Line;
0469 
0470     ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);
0471     Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0;
0472 
0473     /* Insert at list head */
0474 
0475     if (MemList->ListHead)
0476     {
0477         ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation;
0478     }
0479 
0480     Allocation->Next = MemList->ListHead;
0481     Allocation->Previous = NULL;
0482 
0483     MemList->ListHead = Allocation;
0484 
0485 
0486 UnlockAndExit:
0487     Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
0488     return_ACPI_STATUS (Status);
0489 }
0490 
0491 
0492 /*******************************************************************************
0493  *
0494  * FUNCTION:    AcpiUtRemoveAllocation
0495  *
0496  * PARAMETERS:  Allocation          - Address of allocated memory
0497  *              Component           - Component type of caller
0498  *              Module              - Source file name of caller
0499  *              Line                - Line number of caller
0500  *
0501  * RETURN:
0502  *
0503  * DESCRIPTION: Deletes an element from the global allocation tracking list.
0504  *
0505  ******************************************************************************/
0506 
0507 static ACPI_STATUS
0508 AcpiUtRemoveAllocation (
0509     ACPI_DEBUG_MEM_BLOCK    *Allocation,
0510     UINT32                  Component,
0511     const char              *Module,
0512     UINT32                  Line)
0513 {
0514     ACPI_MEMORY_LIST        *MemList;
0515     ACPI_STATUS             Status;
0516 
0517 
0518     ACPI_FUNCTION_TRACE (UtRemoveAllocation);
0519 
0520 
0521     MemList = AcpiGbl_GlobalList;
0522     if (NULL == MemList->ListHead)
0523     {
0524         /* No allocations! */
0525 
0526         ACPI_ERROR ((Module, Line,
0527             "Empty allocation list, nothing to free!"));
0528 
0529         return_ACPI_STATUS (AE_OK);
0530     }
0531 
0532     Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
0533     if (ACPI_FAILURE (Status))
0534     {
0535         return_ACPI_STATUS (Status);
0536     }
0537 
0538     /* Unlink */
0539 
0540     if (Allocation->Previous)
0541     {
0542         (Allocation->Previous)->Next = Allocation->Next;
0543     }
0544     else
0545     {
0546         MemList->ListHead = Allocation->Next;
0547     }
0548 
0549     if (Allocation->Next)
0550     {
0551         (Allocation->Next)->Previous = Allocation->Previous;
0552     }
0553 
0554     /* Mark the segment as deleted */
0555 
0556     ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size);
0557 
0558     ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
0559         Allocation->Size));
0560 
0561     Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
0562     return_ACPI_STATUS (Status);
0563 }
0564 
0565 
0566 /*******************************************************************************
0567  *
0568  * FUNCTION:    AcpiUtDumpAllocationInfo
0569  *
0570  * PARAMETERS:
0571  *
0572  * RETURN:      None
0573  *
0574  * DESCRIPTION: Print some info about the outstanding allocations.
0575  *
0576  ******************************************************************************/
0577 
0578 void
0579 AcpiUtDumpAllocationInfo (
0580     void)
0581 {
0582 /*
0583     ACPI_MEMORY_LIST        *MemList;
0584 */
0585 
0586     ACPI_FUNCTION_TRACE (UtDumpAllocationInfo);
0587 
0588 /*
0589     ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
0590                     ("%30s: %4d (%3d Kb)\n", "Current allocations",
0591                     MemList->CurrentCount,
0592                     ROUND_UP_TO_1K (MemList->CurrentSize)));
0593 
0594     ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
0595                     ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
0596                     MemList->MaxConcurrentCount,
0597                     ROUND_UP_TO_1K (MemList->MaxConcurrentSize)));
0598 
0599 
0600     ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
0601                     ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
0602                     RunningObjectCount,
0603                     ROUND_UP_TO_1K (RunningObjectSize)));
0604 
0605     ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
0606                     ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
0607                     RunningAllocCount,
0608                     ROUND_UP_TO_1K (RunningAllocSize)));
0609 
0610 
0611     ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
0612                     ("%30s: %4d (%3d Kb)\n", "Current Nodes",
0613                     AcpiGbl_CurrentNodeCount,
0614                     ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize)));
0615 
0616     ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
0617                     ("%30s: %4d (%3d Kb)\n", "Max Nodes",
0618                     AcpiGbl_MaxConcurrentNodeCount,
0619                     ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount *
0620                         sizeof (ACPI_NAMESPACE_NODE)))));
0621 */
0622     return_VOID;
0623 }
0624 
0625 
0626 /*******************************************************************************
0627  *
0628  * FUNCTION:    AcpiUtDumpAllocations
0629  *
0630  * PARAMETERS:  Component           - Component(s) to dump info for.
0631  *              Module              - Module to dump info for.  NULL means all.
0632  *
0633  * RETURN:      None
0634  *
0635  * DESCRIPTION: Print a list of all outstanding allocations.
0636  *
0637  ******************************************************************************/
0638 
0639 void
0640 AcpiUtDumpAllocations (
0641     UINT32                  Component,
0642     const char              *Module)
0643 {
0644     ACPI_DEBUG_MEM_BLOCK    *Element;
0645     ACPI_DESCRIPTOR         *Descriptor;
0646     UINT32                  NumOutstanding = 0;
0647 
0648 
0649     ACPI_FUNCTION_TRACE (UtDumpAllocations);
0650 
0651 
0652     /*
0653      * Walk the allocation list.
0654      */
0655     if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY)))
0656     {
0657         return;
0658     }
0659 
0660     Element = AcpiGbl_GlobalList->ListHead;
0661     while (Element)
0662     {
0663         if ((Element->Component & Component) &&
0664             ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module))))
0665         {
0666             /* Ignore allocated objects that are in a cache */
0667 
0668             Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace);
0669             if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != ACPI_DESC_TYPE_CACHED)
0670             {
0671                 AcpiOsPrintf ("%p Len %04X %9.9s-%d [%s] ",
0672                     Descriptor, Element->Size, Element->Module,
0673                     Element->Line, AcpiUtGetDescriptorName (Descriptor));
0674 
0675                 /* Most of the elements will be Operand objects. */
0676 
0677                 switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
0678                 {
0679                 case ACPI_DESC_TYPE_OPERAND:
0680                     AcpiOsPrintf ("%12.12s R%hd",
0681                         AcpiUtGetTypeName (Descriptor->Object.Common.Type),
0682                         Descriptor->Object.Common.ReferenceCount);
0683                     break;
0684 
0685                 case ACPI_DESC_TYPE_PARSER:
0686                     AcpiOsPrintf ("AmlOpcode %04hX",
0687                         Descriptor->Op.Asl.AmlOpcode);
0688                     break;
0689 
0690                 case ACPI_DESC_TYPE_NAMED:
0691                     AcpiOsPrintf ("%4.4s",
0692                         AcpiUtGetNodeName (&Descriptor->Node));
0693                     break;
0694 
0695                 default:
0696                     break;
0697                 }
0698 
0699                 AcpiOsPrintf ( "\n");
0700                 NumOutstanding++;
0701             }
0702         }
0703         Element = Element->Next;
0704     }
0705 
0706     (void) AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
0707 
0708     /* Print summary */
0709 
0710     if (!NumOutstanding)
0711     {
0712         ACPI_INFO ((AE_INFO,
0713             "No outstanding allocations"));
0714     }
0715     else
0716     {
0717         ACPI_ERROR ((AE_INFO,
0718             "%d(%X) Outstanding allocations",
0719             NumOutstanding, NumOutstanding));
0720     }
0721 
0722     return_VOID;
0723 }
0724 
0725 #endif  /* ACPI_DBG_TRACK_ALLOCATIONS */
0726