167754Smsmith/*******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: dbstats - Generation and display of ACPI table statistics
467754Smsmith *
567754Smsmith ******************************************************************************/
667754Smsmith
7217365Sjkim/*
8245582Sjkim * Copyright (C) 2000 - 2013, Intel Corp.
970243Smsmith * All rights reserved.
1067754Smsmith *
11217365Sjkim * Redistribution and use in source and binary forms, with or without
12217365Sjkim * modification, are permitted provided that the following conditions
13217365Sjkim * are met:
14217365Sjkim * 1. Redistributions of source code must retain the above copyright
15217365Sjkim *    notice, this list of conditions, and the following disclaimer,
16217365Sjkim *    without modification.
17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
19217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
20217365Sjkim *    including a substantially similar Disclaimer requirement for further
21217365Sjkim *    binary redistribution.
22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
23217365Sjkim *    of any contributors may be used to endorse or promote products derived
24217365Sjkim *    from this software without specific prior written permission.
2567754Smsmith *
26217365Sjkim * Alternatively, this software may be distributed under the terms of the
27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
28217365Sjkim * Software Foundation.
2967754Smsmith *
30217365Sjkim * NO WARRANTY
31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
42217365Sjkim */
4367754Smsmith
4467754Smsmith
45193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
46193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
47193341Sjkim#include <contrib/dev/acpica/include/acdebug.h>
48193341Sjkim#include <contrib/dev/acpica/include/acnamesp.h>
4967754Smsmith
50102550Siwasaki#ifdef ACPI_DEBUGGER
5167754Smsmith
52102550Siwasaki#define _COMPONENT          ACPI_CA_DEBUGGER
5391116Smsmith        ACPI_MODULE_NAME    ("dbstats")
5467754Smsmith
55151937Sjkim/* Local prototypes */
56151937Sjkim
57151937Sjkimstatic void
58151937SjkimAcpiDbCountNamespaceObjects (
59151937Sjkim    void);
60151937Sjkim
61151937Sjkimstatic void
62151937SjkimAcpiDbEnumerateObject (
63151937Sjkim    ACPI_OPERAND_OBJECT     *ObjDesc);
64151937Sjkim
65151937Sjkimstatic ACPI_STATUS
66151937SjkimAcpiDbClassifyOneObject (
67151937Sjkim    ACPI_HANDLE             ObjHandle,
68151937Sjkim    UINT32                  NestingLevel,
69151937Sjkim    void                    *Context,
70151937Sjkim    void                    **ReturnValue);
71151937Sjkim
72167805Sjkim#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
73151937Sjkimstatic void
74151937SjkimAcpiDbListInfo (
75151937Sjkim    ACPI_MEMORY_LIST        *List);
76167805Sjkim#endif
77151937Sjkim
78151937Sjkim
7967754Smsmith/*
8067754Smsmith * Statistics subcommands
8167754Smsmith */
82240716Sjkimstatic ACPI_DB_ARGUMENT_INFO    AcpiDbStatTypes [] =
8367754Smsmith{
8467754Smsmith    {"ALLOCATIONS"},
8567754Smsmith    {"OBJECTS"},
8667754Smsmith    {"MEMORY"},
8767754Smsmith    {"MISC"},
8867754Smsmith    {"TABLES"},
8967754Smsmith    {"SIZES"},
9083174Smsmith    {"STACK"},
9167754Smsmith    {NULL}           /* Must be null terminated */
9267754Smsmith};
9367754Smsmith
9499679Siwasaki#define CMD_STAT_ALLOCATIONS     0
9599679Siwasaki#define CMD_STAT_OBJECTS         1
9699679Siwasaki#define CMD_STAT_MEMORY          2
9799679Siwasaki#define CMD_STAT_MISC            3
9899679Siwasaki#define CMD_STAT_TABLES          4
9999679Siwasaki#define CMD_STAT_SIZES           5
10099679Siwasaki#define CMD_STAT_STACK           6
10167754Smsmith
10267754Smsmith
103167802Sjkim#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
10467754Smsmith/*******************************************************************************
10567754Smsmith *
106151937Sjkim * FUNCTION:    AcpiDbListInfo
107151937Sjkim *
108151937Sjkim * PARAMETERS:  List            - Memory list/cache to be displayed
109151937Sjkim *
110151937Sjkim * RETURN:      None
111151937Sjkim *
112151937Sjkim * DESCRIPTION: Display information about the input memory list or cache.
113151937Sjkim *
114151937Sjkim ******************************************************************************/
115151937Sjkim
116151937Sjkimstatic void
117151937SjkimAcpiDbListInfo (
118151937Sjkim    ACPI_MEMORY_LIST        *List)
119151937Sjkim{
120151937Sjkim#ifdef ACPI_DBG_TRACK_ALLOCATIONS
121151937Sjkim    UINT32                  Outstanding;
122151937Sjkim#endif
123151937Sjkim
124151937Sjkim    AcpiOsPrintf ("\n%s\n", List->ListName);
125151937Sjkim
126151937Sjkim    /* MaxDepth > 0 indicates a cache object */
127151937Sjkim
128151937Sjkim    if (List->MaxDepth > 0)
129151937Sjkim    {
130151937Sjkim        AcpiOsPrintf (
131167802Sjkim            "    Cache: [Depth    MaxD Avail  Size]                %8.2X %8.2X %8.2X %8.2X\n",
132151937Sjkim            List->CurrentDepth,
133151937Sjkim            List->MaxDepth,
134151937Sjkim            List->MaxDepth - List->CurrentDepth,
135151937Sjkim            (List->CurrentDepth * List->ObjectSize));
136151937Sjkim    }
137151937Sjkim
138151937Sjkim#ifdef ACPI_DBG_TRACK_ALLOCATIONS
139151937Sjkim    if (List->MaxDepth > 0)
140151937Sjkim    {
141151937Sjkim        AcpiOsPrintf (
142167802Sjkim            "    Cache: [Requests Hits Misses ObjSize]             %8.2X %8.2X %8.2X %8.2X\n",
143151937Sjkim            List->Requests,
144151937Sjkim            List->Hits,
145151937Sjkim            List->Requests - List->Hits,
146151937Sjkim            List->ObjectSize);
147151937Sjkim    }
148151937Sjkim
149167802Sjkim    Outstanding = AcpiDbGetCacheInfo (List);
150151937Sjkim
151151937Sjkim    if (List->ObjectSize)
152151937Sjkim    {
153167802Sjkim        AcpiOsPrintf (
154167802Sjkim            "    Mem:   [Alloc    Free Max    CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X %8.2X\n",
155167802Sjkim            List->TotalAllocated,
156167802Sjkim            List->TotalFreed,
157167802Sjkim            List->MaxOccupied,
158167802Sjkim            Outstanding * List->ObjectSize,
159167802Sjkim            Outstanding);
160151937Sjkim    }
161151937Sjkim    else
162151937Sjkim    {
163167802Sjkim        AcpiOsPrintf (
164167802Sjkim            "    Mem:   [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n",
165167802Sjkim            List->TotalAllocated,
166167802Sjkim            List->TotalFreed,
167167802Sjkim            List->MaxOccupied,
168167802Sjkim            List->CurrentTotalSize,
169167802Sjkim            Outstanding,
170167802Sjkim            List->TotalSize);
171151937Sjkim    }
172151937Sjkim#endif
173151937Sjkim}
174167802Sjkim#endif
175151937Sjkim
176151937Sjkim
177151937Sjkim/*******************************************************************************
178151937Sjkim *
17967754Smsmith * FUNCTION:    AcpiDbEnumerateObject
18067754Smsmith *
18167754Smsmith * PARAMETERS:  ObjDesc             - Object to be counted
18267754Smsmith *
18367754Smsmith * RETURN:      None
18467754Smsmith *
18567754Smsmith * DESCRIPTION: Add this object to the global counts, by object type.
18691116Smsmith *              Limited recursion handles subobjects and packages, and this
18791116Smsmith *              is probably acceptable within the AML debugger only.
18867754Smsmith *
18967754Smsmith ******************************************************************************/
19067754Smsmith
191151937Sjkimstatic void
19267754SmsmithAcpiDbEnumerateObject (
19367754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc)
19467754Smsmith{
19567754Smsmith    UINT32                  i;
19667754Smsmith
19767754Smsmith
19867754Smsmith    if (!ObjDesc)
19967754Smsmith    {
20067754Smsmith        return;
20167754Smsmith    }
20267754Smsmith
20367754Smsmith    /* Enumerate this object first */
20467754Smsmith
20583174Smsmith    AcpiGbl_NumObjects++;
20667754Smsmith
207193267Sjkim    if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
20867754Smsmith    {
20967754Smsmith        AcpiGbl_ObjTypeCountMisc++;
21067754Smsmith    }
21167754Smsmith    else
21267754Smsmith    {
213193267Sjkim        AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++;
21467754Smsmith    }
21567754Smsmith
21667754Smsmith    /* Count the sub-objects */
21767754Smsmith
218193267Sjkim    switch (ObjDesc->Common.Type)
21967754Smsmith    {
22067754Smsmith    case ACPI_TYPE_PACKAGE:
221107325Siwasaki
22291116Smsmith        for (i = 0; i < ObjDesc->Package.Count; i++)
22367754Smsmith        {
22467754Smsmith            AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]);
22567754Smsmith        }
22667754Smsmith        break;
22767754Smsmith
22867754Smsmith    case ACPI_TYPE_DEVICE:
229107325Siwasaki
230234623Sjkim        AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[0]);
231234623Sjkim        AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[1]);
232123315Snjl        AcpiDbEnumerateObject (ObjDesc->Device.Handler);
23367754Smsmith        break;
23467754Smsmith
23587031Smsmith    case ACPI_TYPE_BUFFER_FIELD:
236107325Siwasaki
23791116Smsmith        if (AcpiNsGetSecondaryObject (ObjDesc))
23887031Smsmith        {
23991116Smsmith            AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
24087031Smsmith        }
24187031Smsmith        break;
24287031Smsmith
24367754Smsmith    case ACPI_TYPE_REGION:
244107325Siwasaki
245107325Siwasaki        AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++;
246123315Snjl        AcpiDbEnumerateObject (ObjDesc->Region.Handler);
24767754Smsmith        break;
24867754Smsmith
24967754Smsmith    case ACPI_TYPE_POWER:
250107325Siwasaki
251234623Sjkim        AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[0]);
252234623Sjkim        AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[1]);
25367754Smsmith        break;
25467754Smsmith
25567754Smsmith    case ACPI_TYPE_PROCESSOR:
256107325Siwasaki
257234623Sjkim        AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[0]);
258234623Sjkim        AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[1]);
259123315Snjl        AcpiDbEnumerateObject (ObjDesc->Processor.Handler);
26067754Smsmith        break;
26167754Smsmith
26267754Smsmith    case ACPI_TYPE_THERMAL:
263107325Siwasaki
264234623Sjkim        AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[0]);
265234623Sjkim        AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[1]);
266123315Snjl        AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler);
26767754Smsmith        break;
26899679Siwasaki
26999679Siwasaki    default:
270250838Sjkim
27199679Siwasaki        break;
27267754Smsmith    }
27367754Smsmith}
27467754Smsmith
27567754Smsmith
27667754Smsmith/*******************************************************************************
27767754Smsmith *
27867754Smsmith * FUNCTION:    AcpiDbClassifyOneObject
27967754Smsmith *
28067754Smsmith * PARAMETERS:  Callback for WalkNamespace
28167754Smsmith *
28267754Smsmith * RETURN:      Status
28367754Smsmith *
28467754Smsmith * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
28567754Smsmith *              the parent namespace node.
28667754Smsmith *
28767754Smsmith ******************************************************************************/
28867754Smsmith
289151937Sjkimstatic ACPI_STATUS
29067754SmsmithAcpiDbClassifyOneObject (
29167754Smsmith    ACPI_HANDLE             ObjHandle,
29267754Smsmith    UINT32                  NestingLevel,
29367754Smsmith    void                    *Context,
29467754Smsmith    void                    **ReturnValue)
29567754Smsmith{
29667754Smsmith    ACPI_NAMESPACE_NODE     *Node;
29767754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
29867754Smsmith    UINT32                  Type;
29967754Smsmith
30067754Smsmith
30183174Smsmith    AcpiGbl_NumNodes++;
30267754Smsmith
30367754Smsmith    Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
30487031Smsmith    ObjDesc = AcpiNsGetAttachedObject (Node);
30567754Smsmith
30667754Smsmith    AcpiDbEnumerateObject (ObjDesc);
30767754Smsmith
30867754Smsmith    Type = Node->Type;
309107325Siwasaki    if (Type > ACPI_TYPE_NS_NODE_MAX)
31067754Smsmith    {
31167754Smsmith        AcpiGbl_NodeTypeCountMisc++;
31267754Smsmith    }
31367754Smsmith    else
31467754Smsmith    {
31567754Smsmith        AcpiGbl_NodeTypeCount [Type]++;
31667754Smsmith    }
31767754Smsmith
318241973Sjkim    return (AE_OK);
31967754Smsmith
32067754Smsmith
321151937Sjkim#ifdef ACPI_FUTURE_IMPLEMENTATION
322151937Sjkim
32367754Smsmith    /* TBD: These need to be counted during the initial parsing phase */
324151937Sjkim
32567754Smsmith    if (AcpiPsIsNamedOp (Op->Opcode))
32667754Smsmith    {
32767754Smsmith        NumNodes++;
32867754Smsmith    }
32967754Smsmith
33067754Smsmith    if (IsMethod)
33167754Smsmith    {
33267754Smsmith        NumMethodElements++;
33367754Smsmith    }
33467754Smsmith
33567754Smsmith    NumGrammarElements++;
33667754Smsmith    Op = AcpiPsGetDepthNext (Root, Op);
33767754Smsmith
338151937Sjkim    SizeOfParseTree   = (NumGrammarElements - NumMethodElements) *
339151937Sjkim                            (UINT32) sizeof (ACPI_PARSE_OBJECT);
340151937Sjkim    SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
341151937Sjkim    SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
342151937Sjkim    SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
343151937Sjkim#endif
34467754Smsmith}
34567754Smsmith
34667754Smsmith
34767754Smsmith/*******************************************************************************
34867754Smsmith *
34967754Smsmith * FUNCTION:    AcpiDbCountNamespaceObjects
35067754Smsmith *
35167754Smsmith * PARAMETERS:  None
35267754Smsmith *
353151937Sjkim * RETURN:      None
35467754Smsmith *
35567754Smsmith * DESCRIPTION: Count and classify the entire namespace, including all
35667754Smsmith *              namespace nodes and attached objects.
35767754Smsmith *
35867754Smsmith ******************************************************************************/
35967754Smsmith
360151937Sjkimstatic void
36167754SmsmithAcpiDbCountNamespaceObjects (
36267754Smsmith    void)
36367754Smsmith{
36467754Smsmith    UINT32                  i;
36567754Smsmith
36667754Smsmith
36783174Smsmith    AcpiGbl_NumNodes = 0;
36883174Smsmith    AcpiGbl_NumObjects = 0;
36967754Smsmith
37067754Smsmith    AcpiGbl_ObjTypeCountMisc = 0;
371107325Siwasaki    for (i = 0; i < (ACPI_TYPE_NS_NODE_MAX -1); i++)
37267754Smsmith    {
37367754Smsmith        AcpiGbl_ObjTypeCount [i] = 0;
37467754Smsmith        AcpiGbl_NodeTypeCount [i] = 0;
37567754Smsmith    }
37667754Smsmith
377151937Sjkim    (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
378199337Sjkim                ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL);
37967754Smsmith}
38067754Smsmith
38167754Smsmith
38267754Smsmith/*******************************************************************************
38367754Smsmith *
38467754Smsmith * FUNCTION:    AcpiDbDisplayStatistics
38567754Smsmith *
38667754Smsmith * PARAMETERS:  TypeArg         - Subcommand
38767754Smsmith *
38867754Smsmith * RETURN:      Status
38967754Smsmith *
39067754Smsmith * DESCRIPTION: Display various statistics
39167754Smsmith *
39267754Smsmith ******************************************************************************/
39367754Smsmith
39467754SmsmithACPI_STATUS
39567754SmsmithAcpiDbDisplayStatistics (
396114237Snjl    char                    *TypeArg)
39767754Smsmith{
39867754Smsmith    UINT32                  i;
399151937Sjkim    UINT32                  Temp;
40067754Smsmith
40167754Smsmith
402151937Sjkim    AcpiUtStrupr (TypeArg);
403151937Sjkim    Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
404151937Sjkim    if (Temp == (UINT32) -1)
40567754Smsmith    {
40667754Smsmith        AcpiOsPrintf ("Invalid or unsupported argument\n");
40767754Smsmith        return (AE_OK);
40867754Smsmith    }
40967754Smsmith
41067754Smsmith
411151937Sjkim    switch (Temp)
41267754Smsmith    {
41399679Siwasaki    case CMD_STAT_ALLOCATIONS:
414151937Sjkim
41580062Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
41677424Smsmith        AcpiUtDumpAllocationInfo ();
41780062Smsmith#endif
41867754Smsmith        break;
41967754Smsmith
42099679Siwasaki    case CMD_STAT_TABLES:
42167754Smsmith
422167802Sjkim        AcpiOsPrintf ("ACPI Table Information (not implemented):\n\n");
42367754Smsmith        break;
42467754Smsmith
42599679Siwasaki    case CMD_STAT_OBJECTS:
42667754Smsmith
42783174Smsmith        AcpiDbCountNamespaceObjects ();
42883174Smsmith
42967754Smsmith        AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
43067754Smsmith
431151937Sjkim        AcpiOsPrintf ("%16.16s %10.10s %10.10s\n",
432151937Sjkim            "ACPI_TYPE", "NODES", "OBJECTS");
43367754Smsmith
434107325Siwasaki        for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
43567754Smsmith        {
43677424Smsmith            AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
43767754Smsmith                AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
43867754Smsmith        }
43967754Smsmith        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
44067754Smsmith            AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);
44167754Smsmith
44267754Smsmith        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
44383174Smsmith            AcpiGbl_NumNodes, AcpiGbl_NumObjects);
44467754Smsmith        break;
44567754Smsmith
44699679Siwasaki    case CMD_STAT_MEMORY:
44767754Smsmith
44882367Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
449167805Sjkim        AcpiOsPrintf ("\n----Object Statistics (all in hex)---------\n");
45067754Smsmith
451151937Sjkim        AcpiDbListInfo (AcpiGbl_GlobalList);
452151937Sjkim        AcpiDbListInfo (AcpiGbl_NsNodeList);
453167805Sjkim#endif
45467754Smsmith
455151937Sjkim#ifdef ACPI_USE_LOCAL_CACHE
456193267Sjkim        AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n");
457151937Sjkim        AcpiDbListInfo (AcpiGbl_OperandCache);
458151937Sjkim        AcpiDbListInfo (AcpiGbl_PsNodeCache);
459151937Sjkim        AcpiDbListInfo (AcpiGbl_PsNodeExtCache);
460151937Sjkim        AcpiDbListInfo (AcpiGbl_StateCache);
46182367Smsmith#endif
46282367Smsmith
46367754Smsmith        break;
46467754Smsmith
46599679Siwasaki    case CMD_STAT_MISC:
46667754Smsmith
46767754Smsmith        AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
468151937Sjkim        AcpiOsPrintf ("Calls to AcpiPsFind:..  ........% 7ld\n",
469151937Sjkim            AcpiGbl_PsFindCount);
470151937Sjkim        AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n",
471151937Sjkim            AcpiGbl_NsLookupCount);
47267754Smsmith
47367754Smsmith        AcpiOsPrintf ("\n");
47467754Smsmith
47567754Smsmith        AcpiOsPrintf ("Mutex usage:\n\n");
476167802Sjkim        for (i = 0; i < ACPI_NUM_MUTEX; i++)
47767754Smsmith        {
478151937Sjkim            AcpiOsPrintf ("%-28s:       % 7ld\n",
479151937Sjkim                AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
48067754Smsmith        }
48167754Smsmith        break;
48267754Smsmith
48399679Siwasaki    case CMD_STAT_SIZES:
48467754Smsmith
48567754Smsmith        AcpiOsPrintf ("\nInternal object sizes:\n\n");
48667754Smsmith
48767754Smsmith        AcpiOsPrintf ("Common           %3d\n", sizeof (ACPI_OBJECT_COMMON));
48871867Smsmith        AcpiOsPrintf ("Number           %3d\n", sizeof (ACPI_OBJECT_INTEGER));
48967754Smsmith        AcpiOsPrintf ("String           %3d\n", sizeof (ACPI_OBJECT_STRING));
49067754Smsmith        AcpiOsPrintf ("Buffer           %3d\n", sizeof (ACPI_OBJECT_BUFFER));
49167754Smsmith        AcpiOsPrintf ("Package          %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
49277424Smsmith        AcpiOsPrintf ("BufferField      %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
49367754Smsmith        AcpiOsPrintf ("Device           %3d\n", sizeof (ACPI_OBJECT_DEVICE));
49467754Smsmith        AcpiOsPrintf ("Event            %3d\n", sizeof (ACPI_OBJECT_EVENT));
49567754Smsmith        AcpiOsPrintf ("Method           %3d\n", sizeof (ACPI_OBJECT_METHOD));
49667754Smsmith        AcpiOsPrintf ("Mutex            %3d\n", sizeof (ACPI_OBJECT_MUTEX));
49767754Smsmith        AcpiOsPrintf ("Region           %3d\n", sizeof (ACPI_OBJECT_REGION));
49867754Smsmith        AcpiOsPrintf ("PowerResource    %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
49967754Smsmith        AcpiOsPrintf ("Processor        %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
50067754Smsmith        AcpiOsPrintf ("ThermalZone      %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
50177424Smsmith        AcpiOsPrintf ("RegionField      %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
50267754Smsmith        AcpiOsPrintf ("BankField        %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
50367754Smsmith        AcpiOsPrintf ("IndexField       %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
50467754Smsmith        AcpiOsPrintf ("Reference        %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
505117521Snjl        AcpiOsPrintf ("Notify           %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
506117521Snjl        AcpiOsPrintf ("AddressSpace     %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
50767754Smsmith        AcpiOsPrintf ("Extra            %3d\n", sizeof (ACPI_OBJECT_EXTRA));
50887031Smsmith        AcpiOsPrintf ("Data             %3d\n", sizeof (ACPI_OBJECT_DATA));
50967754Smsmith
51067754Smsmith        AcpiOsPrintf ("\n");
51167754Smsmith
51299679Siwasaki        AcpiOsPrintf ("ParseObject      %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
51399679Siwasaki        AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
51499679Siwasaki        AcpiOsPrintf ("ParseObjectAsl   %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
51567754Smsmith        AcpiOsPrintf ("OperandObject    %3d\n", sizeof (ACPI_OPERAND_OBJECT));
51667754Smsmith        AcpiOsPrintf ("NamespaceNode    %3d\n", sizeof (ACPI_NAMESPACE_NODE));
517193267Sjkim        AcpiOsPrintf ("AcpiObject       %3d\n", sizeof (ACPI_OBJECT));
51867754Smsmith
519234623Sjkim        AcpiOsPrintf ("\n");
520234623Sjkim
521234623Sjkim        AcpiOsPrintf ("Generic State    %3d\n", sizeof (ACPI_GENERIC_STATE));
522234623Sjkim        AcpiOsPrintf ("Common State     %3d\n", sizeof (ACPI_COMMON_STATE));
523234623Sjkim        AcpiOsPrintf ("Control State    %3d\n", sizeof (ACPI_CONTROL_STATE));
524234623Sjkim        AcpiOsPrintf ("Update State     %3d\n", sizeof (ACPI_UPDATE_STATE));
525234623Sjkim        AcpiOsPrintf ("Scope State      %3d\n", sizeof (ACPI_SCOPE_STATE));
526234623Sjkim        AcpiOsPrintf ("Parse Scope      %3d\n", sizeof (ACPI_PSCOPE_STATE));
527234623Sjkim        AcpiOsPrintf ("Package State    %3d\n", sizeof (ACPI_PKG_STATE));
528234623Sjkim        AcpiOsPrintf ("Thread State     %3d\n", sizeof (ACPI_THREAD_STATE));
529234623Sjkim        AcpiOsPrintf ("Result Values    %3d\n", sizeof (ACPI_RESULT_VALUES));
530234623Sjkim        AcpiOsPrintf ("Notify Info      %3d\n", sizeof (ACPI_NOTIFY_INFO));
53167754Smsmith        break;
53267754Smsmith
53399679Siwasaki    case CMD_STAT_STACK:
534102550Siwasaki#if defined(ACPI_DEBUG_OUTPUT)
53583174Smsmith
536193267Sjkim        Temp = (UINT32) ACPI_PTR_DIFF (AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer);
53783174Smsmith
53883174Smsmith        AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
539193267Sjkim        AcpiOsPrintf ("Entry Stack Pointer          %p\n", AcpiGbl_EntryStackPointer);
540193267Sjkim        AcpiOsPrintf ("Lowest Stack Pointer         %p\n", AcpiGbl_LowestStackPointer);
541193267Sjkim        AcpiOsPrintf ("Stack Use                    %X (%u)\n", Temp, Temp);
542193267Sjkim        AcpiOsPrintf ("Deepest Procedure Nesting    %u\n", AcpiGbl_DeepestNesting);
54399679Siwasaki#endif
54483174Smsmith        break;
54599679Siwasaki
54699679Siwasaki    default:
547250838Sjkim
54899679Siwasaki        break;
54967754Smsmith    }
55067754Smsmith
55167754Smsmith    AcpiOsPrintf ("\n");
55267754Smsmith    return (AE_OK);
55367754Smsmith}
55467754Smsmith
555102550Siwasaki#endif /* ACPI_DEBUGGER  */
556