167754Smsmith/*******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: dbstats - Generation and display of ACPI table statistics
467754Smsmith *
567754Smsmith ******************************************************************************/
667754Smsmith
7217365Sjkim/*
8306536Sjkim * Copyright (C) 2000 - 2016, 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
44193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
45193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
46193341Sjkim#include <contrib/dev/acpica/include/acdebug.h>
47193341Sjkim#include <contrib/dev/acpica/include/acnamesp.h>
4867754Smsmith
4967754Smsmith
50102550Siwasaki#define _COMPONENT          ACPI_CA_DEBUGGER
5191116Smsmith        ACPI_MODULE_NAME    ("dbstats")
5267754Smsmith
53306536Sjkim
54151937Sjkim/* Local prototypes */
55151937Sjkim
56151937Sjkimstatic void
57151937SjkimAcpiDbCountNamespaceObjects (
58151937Sjkim    void);
59151937Sjkim
60151937Sjkimstatic void
61151937SjkimAcpiDbEnumerateObject (
62151937Sjkim    ACPI_OPERAND_OBJECT     *ObjDesc);
63151937Sjkim
64151937Sjkimstatic ACPI_STATUS
65151937SjkimAcpiDbClassifyOneObject (
66151937Sjkim    ACPI_HANDLE             ObjHandle,
67151937Sjkim    UINT32                  NestingLevel,
68151937Sjkim    void                    *Context,
69151937Sjkim    void                    **ReturnValue);
70151937Sjkim
71167805Sjkim#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
72151937Sjkimstatic void
73151937SjkimAcpiDbListInfo (
74151937Sjkim    ACPI_MEMORY_LIST        *List);
75167805Sjkim#endif
76151937Sjkim
77151937Sjkim
7867754Smsmith/*
7967754Smsmith * Statistics subcommands
8067754Smsmith */
81240716Sjkimstatic ACPI_DB_ARGUMENT_INFO    AcpiDbStatTypes [] =
8267754Smsmith{
8367754Smsmith    {"ALLOCATIONS"},
8467754Smsmith    {"OBJECTS"},
8567754Smsmith    {"MEMORY"},
8667754Smsmith    {"MISC"},
8767754Smsmith    {"TABLES"},
8867754Smsmith    {"SIZES"},
8983174Smsmith    {"STACK"},
9067754Smsmith    {NULL}           /* Must be null terminated */
9167754Smsmith};
9267754Smsmith
9399679Siwasaki#define CMD_STAT_ALLOCATIONS     0
9499679Siwasaki#define CMD_STAT_OBJECTS         1
9599679Siwasaki#define CMD_STAT_MEMORY          2
9699679Siwasaki#define CMD_STAT_MISC            3
9799679Siwasaki#define CMD_STAT_TABLES          4
9899679Siwasaki#define CMD_STAT_SIZES           5
9999679Siwasaki#define CMD_STAT_STACK           6
10067754Smsmith
10167754Smsmith
102167802Sjkim#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
10367754Smsmith/*******************************************************************************
10467754Smsmith *
105151937Sjkim * FUNCTION:    AcpiDbListInfo
106151937Sjkim *
107151937Sjkim * PARAMETERS:  List            - Memory list/cache to be displayed
108151937Sjkim *
109151937Sjkim * RETURN:      None
110151937Sjkim *
111151937Sjkim * DESCRIPTION: Display information about the input memory list or cache.
112151937Sjkim *
113151937Sjkim ******************************************************************************/
114151937Sjkim
115151937Sjkimstatic void
116151937SjkimAcpiDbListInfo (
117151937Sjkim    ACPI_MEMORY_LIST        *List)
118151937Sjkim{
119151937Sjkim#ifdef ACPI_DBG_TRACK_ALLOCATIONS
120151937Sjkim    UINT32                  Outstanding;
121151937Sjkim#endif
122151937Sjkim
123151937Sjkim    AcpiOsPrintf ("\n%s\n", List->ListName);
124151937Sjkim
125151937Sjkim    /* MaxDepth > 0 indicates a cache object */
126151937Sjkim
127151937Sjkim    if (List->MaxDepth > 0)
128151937Sjkim    {
129151937Sjkim        AcpiOsPrintf (
130306536Sjkim            "    Cache: [Depth    MaxD Avail  Size]                "
131306536Sjkim            "%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 (
142306536Sjkim            "    Cache: [Requests Hits Misses ObjSize]             "
143306536Sjkim            "%8.2X %8.2X %8.2X %8.2X\n",
144151937Sjkim            List->Requests,
145151937Sjkim            List->Hits,
146151937Sjkim            List->Requests - List->Hits,
147151937Sjkim            List->ObjectSize);
148151937Sjkim    }
149151937Sjkim
150167802Sjkim    Outstanding = AcpiDbGetCacheInfo (List);
151151937Sjkim
152151937Sjkim    if (List->ObjectSize)
153151937Sjkim    {
154167802Sjkim        AcpiOsPrintf (
155306536Sjkim            "    Mem:   [Alloc    Free Max    CurSize Outstanding] "
156306536Sjkim            "%8.2X %8.2X %8.2X %8.2X %8.2X\n",
157167802Sjkim            List->TotalAllocated,
158167802Sjkim            List->TotalFreed,
159167802Sjkim            List->MaxOccupied,
160167802Sjkim            Outstanding * List->ObjectSize,
161167802Sjkim            Outstanding);
162151937Sjkim    }
163151937Sjkim    else
164151937Sjkim    {
165167802Sjkim        AcpiOsPrintf (
166306536Sjkim            "    Mem:   [Alloc Free Max CurSize Outstanding Total] "
167306536Sjkim            "%8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n",
168167802Sjkim            List->TotalAllocated,
169167802Sjkim            List->TotalFreed,
170167802Sjkim            List->MaxOccupied,
171167802Sjkim            List->CurrentTotalSize,
172167802Sjkim            Outstanding,
173167802Sjkim            List->TotalSize);
174151937Sjkim    }
175151937Sjkim#endif
176151937Sjkim}
177167802Sjkim#endif
178151937Sjkim
179151937Sjkim
180151937Sjkim/*******************************************************************************
181151937Sjkim *
18267754Smsmith * FUNCTION:    AcpiDbEnumerateObject
18367754Smsmith *
18467754Smsmith * PARAMETERS:  ObjDesc             - Object to be counted
18567754Smsmith *
18667754Smsmith * RETURN:      None
18767754Smsmith *
18867754Smsmith * DESCRIPTION: Add this object to the global counts, by object type.
18991116Smsmith *              Limited recursion handles subobjects and packages, and this
19091116Smsmith *              is probably acceptable within the AML debugger only.
19167754Smsmith *
19267754Smsmith ******************************************************************************/
19367754Smsmith
194151937Sjkimstatic void
19567754SmsmithAcpiDbEnumerateObject (
19667754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc)
19767754Smsmith{
19867754Smsmith    UINT32                  i;
19967754Smsmith
20067754Smsmith
20167754Smsmith    if (!ObjDesc)
20267754Smsmith    {
20367754Smsmith        return;
20467754Smsmith    }
20567754Smsmith
20667754Smsmith    /* Enumerate this object first */
20767754Smsmith
20883174Smsmith    AcpiGbl_NumObjects++;
20967754Smsmith
210193267Sjkim    if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
21167754Smsmith    {
21267754Smsmith        AcpiGbl_ObjTypeCountMisc++;
21367754Smsmith    }
21467754Smsmith    else
21567754Smsmith    {
216193267Sjkim        AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++;
21767754Smsmith    }
21867754Smsmith
21967754Smsmith    /* Count the sub-objects */
22067754Smsmith
221193267Sjkim    switch (ObjDesc->Common.Type)
22267754Smsmith    {
22367754Smsmith    case ACPI_TYPE_PACKAGE:
224107325Siwasaki
22591116Smsmith        for (i = 0; i < ObjDesc->Package.Count; i++)
22667754Smsmith        {
22767754Smsmith            AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]);
22867754Smsmith        }
22967754Smsmith        break;
23067754Smsmith
23167754Smsmith    case ACPI_TYPE_DEVICE:
232107325Siwasaki
233234623Sjkim        AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[0]);
234234623Sjkim        AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[1]);
235123315Snjl        AcpiDbEnumerateObject (ObjDesc->Device.Handler);
23667754Smsmith        break;
23767754Smsmith
23887031Smsmith    case ACPI_TYPE_BUFFER_FIELD:
239107325Siwasaki
24091116Smsmith        if (AcpiNsGetSecondaryObject (ObjDesc))
24187031Smsmith        {
24291116Smsmith            AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
24387031Smsmith        }
24487031Smsmith        break;
24587031Smsmith
24667754Smsmith    case ACPI_TYPE_REGION:
247107325Siwasaki
248107325Siwasaki        AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++;
249123315Snjl        AcpiDbEnumerateObject (ObjDesc->Region.Handler);
25067754Smsmith        break;
25167754Smsmith
25267754Smsmith    case ACPI_TYPE_POWER:
253107325Siwasaki
254234623Sjkim        AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[0]);
255234623Sjkim        AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[1]);
25667754Smsmith        break;
25767754Smsmith
25867754Smsmith    case ACPI_TYPE_PROCESSOR:
259107325Siwasaki
260234623Sjkim        AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[0]);
261234623Sjkim        AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[1]);
262123315Snjl        AcpiDbEnumerateObject (ObjDesc->Processor.Handler);
26367754Smsmith        break;
26467754Smsmith
26567754Smsmith    case ACPI_TYPE_THERMAL:
266107325Siwasaki
267234623Sjkim        AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[0]);
268234623Sjkim        AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[1]);
269123315Snjl        AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler);
27067754Smsmith        break;
27199679Siwasaki
27299679Siwasaki    default:
273250838Sjkim
27499679Siwasaki        break;
27567754Smsmith    }
27667754Smsmith}
27767754Smsmith
27867754Smsmith
27967754Smsmith/*******************************************************************************
28067754Smsmith *
28167754Smsmith * FUNCTION:    AcpiDbClassifyOneObject
28267754Smsmith *
28367754Smsmith * PARAMETERS:  Callback for WalkNamespace
28467754Smsmith *
28567754Smsmith * RETURN:      Status
28667754Smsmith *
28767754Smsmith * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
28867754Smsmith *              the parent namespace node.
28967754Smsmith *
29067754Smsmith ******************************************************************************/
29167754Smsmith
292151937Sjkimstatic ACPI_STATUS
29367754SmsmithAcpiDbClassifyOneObject (
29467754Smsmith    ACPI_HANDLE             ObjHandle,
29567754Smsmith    UINT32                  NestingLevel,
29667754Smsmith    void                    *Context,
29767754Smsmith    void                    **ReturnValue)
29867754Smsmith{
29967754Smsmith    ACPI_NAMESPACE_NODE     *Node;
30067754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
30167754Smsmith    UINT32                  Type;
30267754Smsmith
30367754Smsmith
30483174Smsmith    AcpiGbl_NumNodes++;
30567754Smsmith
30667754Smsmith    Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
30787031Smsmith    ObjDesc = AcpiNsGetAttachedObject (Node);
30867754Smsmith
30967754Smsmith    AcpiDbEnumerateObject (ObjDesc);
31067754Smsmith
31167754Smsmith    Type = Node->Type;
312107325Siwasaki    if (Type > ACPI_TYPE_NS_NODE_MAX)
31367754Smsmith    {
31467754Smsmith        AcpiGbl_NodeTypeCountMisc++;
31567754Smsmith    }
31667754Smsmith    else
31767754Smsmith    {
31867754Smsmith        AcpiGbl_NodeTypeCount [Type]++;
31967754Smsmith    }
32067754Smsmith
321241973Sjkim    return (AE_OK);
32267754Smsmith
32367754Smsmith
324151937Sjkim#ifdef ACPI_FUTURE_IMPLEMENTATION
325151937Sjkim
32667754Smsmith    /* TBD: These need to be counted during the initial parsing phase */
327151937Sjkim
32867754Smsmith    if (AcpiPsIsNamedOp (Op->Opcode))
32967754Smsmith    {
33067754Smsmith        NumNodes++;
33167754Smsmith    }
33267754Smsmith
33367754Smsmith    if (IsMethod)
33467754Smsmith    {
33567754Smsmith        NumMethodElements++;
33667754Smsmith    }
33767754Smsmith
33867754Smsmith    NumGrammarElements++;
33967754Smsmith    Op = AcpiPsGetDepthNext (Root, Op);
34067754Smsmith
341151937Sjkim    SizeOfParseTree   = (NumGrammarElements - NumMethodElements) *
342306536Sjkim        (UINT32) sizeof (ACPI_PARSE_OBJECT);
343151937Sjkim    SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
344151937Sjkim    SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
345151937Sjkim    SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
346151937Sjkim#endif
34767754Smsmith}
34867754Smsmith
34967754Smsmith
35067754Smsmith/*******************************************************************************
35167754Smsmith *
35267754Smsmith * FUNCTION:    AcpiDbCountNamespaceObjects
35367754Smsmith *
35467754Smsmith * PARAMETERS:  None
35567754Smsmith *
356151937Sjkim * RETURN:      None
35767754Smsmith *
35867754Smsmith * DESCRIPTION: Count and classify the entire namespace, including all
35967754Smsmith *              namespace nodes and attached objects.
36067754Smsmith *
36167754Smsmith ******************************************************************************/
36267754Smsmith
363151937Sjkimstatic void
36467754SmsmithAcpiDbCountNamespaceObjects (
36567754Smsmith    void)
36667754Smsmith{
36767754Smsmith    UINT32                  i;
36867754Smsmith
36967754Smsmith
37083174Smsmith    AcpiGbl_NumNodes = 0;
37183174Smsmith    AcpiGbl_NumObjects = 0;
37267754Smsmith
37367754Smsmith    AcpiGbl_ObjTypeCountMisc = 0;
374107325Siwasaki    for (i = 0; i < (ACPI_TYPE_NS_NODE_MAX -1); i++)
37567754Smsmith    {
37667754Smsmith        AcpiGbl_ObjTypeCount [i] = 0;
37767754Smsmith        AcpiGbl_NodeTypeCount [i] = 0;
37867754Smsmith    }
37967754Smsmith
380151937Sjkim    (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
381306536Sjkim        ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL);
38267754Smsmith}
38367754Smsmith
38467754Smsmith
38567754Smsmith/*******************************************************************************
38667754Smsmith *
38767754Smsmith * FUNCTION:    AcpiDbDisplayStatistics
38867754Smsmith *
38967754Smsmith * PARAMETERS:  TypeArg         - Subcommand
39067754Smsmith *
39167754Smsmith * RETURN:      Status
39267754Smsmith *
39367754Smsmith * DESCRIPTION: Display various statistics
39467754Smsmith *
39567754Smsmith ******************************************************************************/
39667754Smsmith
39767754SmsmithACPI_STATUS
39867754SmsmithAcpiDbDisplayStatistics (
399114237Snjl    char                    *TypeArg)
40067754Smsmith{
40167754Smsmith    UINT32                  i;
402151937Sjkim    UINT32                  Temp;
40367754Smsmith
40467754Smsmith
405151937Sjkim    AcpiUtStrupr (TypeArg);
406151937Sjkim    Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
407281075Sdim    if (Temp == ACPI_TYPE_NOT_FOUND)
40867754Smsmith    {
40967754Smsmith        AcpiOsPrintf ("Invalid or unsupported argument\n");
41067754Smsmith        return (AE_OK);
41167754Smsmith    }
41267754Smsmith
41367754Smsmith
414151937Sjkim    switch (Temp)
41567754Smsmith    {
41699679Siwasaki    case CMD_STAT_ALLOCATIONS:
417151937Sjkim
41880062Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
41977424Smsmith        AcpiUtDumpAllocationInfo ();
42080062Smsmith#endif
42167754Smsmith        break;
42267754Smsmith
42399679Siwasaki    case CMD_STAT_TABLES:
42467754Smsmith
425167802Sjkim        AcpiOsPrintf ("ACPI Table Information (not implemented):\n\n");
42667754Smsmith        break;
42767754Smsmith
42899679Siwasaki    case CMD_STAT_OBJECTS:
42967754Smsmith
43083174Smsmith        AcpiDbCountNamespaceObjects ();
43183174Smsmith
43267754Smsmith        AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
43367754Smsmith
434151937Sjkim        AcpiOsPrintf ("%16.16s %10.10s %10.10s\n",
435151937Sjkim            "ACPI_TYPE", "NODES", "OBJECTS");
43667754Smsmith
437107325Siwasaki        for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
43867754Smsmith        {
43977424Smsmith            AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
44067754Smsmith                AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
44167754Smsmith        }
442306536Sjkim
44367754Smsmith        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
44467754Smsmith            AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);
44567754Smsmith
44667754Smsmith        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
44783174Smsmith            AcpiGbl_NumNodes, AcpiGbl_NumObjects);
44867754Smsmith        break;
44967754Smsmith
45099679Siwasaki    case CMD_STAT_MEMORY:
45167754Smsmith
45282367Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
453167805Sjkim        AcpiOsPrintf ("\n----Object Statistics (all in hex)---------\n");
45467754Smsmith
455151937Sjkim        AcpiDbListInfo (AcpiGbl_GlobalList);
456151937Sjkim        AcpiDbListInfo (AcpiGbl_NsNodeList);
457167805Sjkim#endif
45867754Smsmith
459151937Sjkim#ifdef ACPI_USE_LOCAL_CACHE
460193267Sjkim        AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n");
461151937Sjkim        AcpiDbListInfo (AcpiGbl_OperandCache);
462151937Sjkim        AcpiDbListInfo (AcpiGbl_PsNodeCache);
463151937Sjkim        AcpiDbListInfo (AcpiGbl_PsNodeExtCache);
464151937Sjkim        AcpiDbListInfo (AcpiGbl_StateCache);
46582367Smsmith#endif
46682367Smsmith
46767754Smsmith        break;
46867754Smsmith
46999679Siwasaki    case CMD_STAT_MISC:
47067754Smsmith
47167754Smsmith        AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
472151937Sjkim        AcpiOsPrintf ("Calls to AcpiPsFind:..  ........% 7ld\n",
473151937Sjkim            AcpiGbl_PsFindCount);
474151937Sjkim        AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n",
475151937Sjkim            AcpiGbl_NsLookupCount);
47667754Smsmith
47767754Smsmith        AcpiOsPrintf ("\n");
47867754Smsmith
47967754Smsmith        AcpiOsPrintf ("Mutex usage:\n\n");
480167802Sjkim        for (i = 0; i < ACPI_NUM_MUTEX; i++)
48167754Smsmith        {
482151937Sjkim            AcpiOsPrintf ("%-28s:       % 7ld\n",
483151937Sjkim                AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
48467754Smsmith        }
48567754Smsmith        break;
48667754Smsmith
48799679Siwasaki    case CMD_STAT_SIZES:
48867754Smsmith
48967754Smsmith        AcpiOsPrintf ("\nInternal object sizes:\n\n");
49067754Smsmith
49167754Smsmith        AcpiOsPrintf ("Common           %3d\n", sizeof (ACPI_OBJECT_COMMON));
49271867Smsmith        AcpiOsPrintf ("Number           %3d\n", sizeof (ACPI_OBJECT_INTEGER));
49367754Smsmith        AcpiOsPrintf ("String           %3d\n", sizeof (ACPI_OBJECT_STRING));
49467754Smsmith        AcpiOsPrintf ("Buffer           %3d\n", sizeof (ACPI_OBJECT_BUFFER));
49567754Smsmith        AcpiOsPrintf ("Package          %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
49677424Smsmith        AcpiOsPrintf ("BufferField      %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
49767754Smsmith        AcpiOsPrintf ("Device           %3d\n", sizeof (ACPI_OBJECT_DEVICE));
49867754Smsmith        AcpiOsPrintf ("Event            %3d\n", sizeof (ACPI_OBJECT_EVENT));
49967754Smsmith        AcpiOsPrintf ("Method           %3d\n", sizeof (ACPI_OBJECT_METHOD));
50067754Smsmith        AcpiOsPrintf ("Mutex            %3d\n", sizeof (ACPI_OBJECT_MUTEX));
50167754Smsmith        AcpiOsPrintf ("Region           %3d\n", sizeof (ACPI_OBJECT_REGION));
50267754Smsmith        AcpiOsPrintf ("PowerResource    %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
50367754Smsmith        AcpiOsPrintf ("Processor        %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
50467754Smsmith        AcpiOsPrintf ("ThermalZone      %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
50577424Smsmith        AcpiOsPrintf ("RegionField      %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
50667754Smsmith        AcpiOsPrintf ("BankField        %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
50767754Smsmith        AcpiOsPrintf ("IndexField       %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
50867754Smsmith        AcpiOsPrintf ("Reference        %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
509117521Snjl        AcpiOsPrintf ("Notify           %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
510117521Snjl        AcpiOsPrintf ("AddressSpace     %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
51167754Smsmith        AcpiOsPrintf ("Extra            %3d\n", sizeof (ACPI_OBJECT_EXTRA));
51287031Smsmith        AcpiOsPrintf ("Data             %3d\n", sizeof (ACPI_OBJECT_DATA));
51367754Smsmith
51467754Smsmith        AcpiOsPrintf ("\n");
51567754Smsmith
51699679Siwasaki        AcpiOsPrintf ("ParseObject      %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
51799679Siwasaki        AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
51899679Siwasaki        AcpiOsPrintf ("ParseObjectAsl   %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
51967754Smsmith        AcpiOsPrintf ("OperandObject    %3d\n", sizeof (ACPI_OPERAND_OBJECT));
52067754Smsmith        AcpiOsPrintf ("NamespaceNode    %3d\n", sizeof (ACPI_NAMESPACE_NODE));
521193267Sjkim        AcpiOsPrintf ("AcpiObject       %3d\n", sizeof (ACPI_OBJECT));
52267754Smsmith
523234623Sjkim        AcpiOsPrintf ("\n");
524234623Sjkim
525234623Sjkim        AcpiOsPrintf ("Generic State    %3d\n", sizeof (ACPI_GENERIC_STATE));
526234623Sjkim        AcpiOsPrintf ("Common State     %3d\n", sizeof (ACPI_COMMON_STATE));
527234623Sjkim        AcpiOsPrintf ("Control State    %3d\n", sizeof (ACPI_CONTROL_STATE));
528234623Sjkim        AcpiOsPrintf ("Update State     %3d\n", sizeof (ACPI_UPDATE_STATE));
529234623Sjkim        AcpiOsPrintf ("Scope State      %3d\n", sizeof (ACPI_SCOPE_STATE));
530234623Sjkim        AcpiOsPrintf ("Parse Scope      %3d\n", sizeof (ACPI_PSCOPE_STATE));
531234623Sjkim        AcpiOsPrintf ("Package State    %3d\n", sizeof (ACPI_PKG_STATE));
532234623Sjkim        AcpiOsPrintf ("Thread State     %3d\n", sizeof (ACPI_THREAD_STATE));
533234623Sjkim        AcpiOsPrintf ("Result Values    %3d\n", sizeof (ACPI_RESULT_VALUES));
534234623Sjkim        AcpiOsPrintf ("Notify Info      %3d\n", sizeof (ACPI_NOTIFY_INFO));
53567754Smsmith        break;
53667754Smsmith
53799679Siwasaki    case CMD_STAT_STACK:
538102550Siwasaki#if defined(ACPI_DEBUG_OUTPUT)
53983174Smsmith
540306536Sjkim        Temp = (UINT32) ACPI_PTR_DIFF (
541306536Sjkim            AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer);
54283174Smsmith
54383174Smsmith        AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
544193267Sjkim        AcpiOsPrintf ("Entry Stack Pointer          %p\n", AcpiGbl_EntryStackPointer);
545193267Sjkim        AcpiOsPrintf ("Lowest Stack Pointer         %p\n", AcpiGbl_LowestStackPointer);
546193267Sjkim        AcpiOsPrintf ("Stack Use                    %X (%u)\n", Temp, Temp);
547193267Sjkim        AcpiOsPrintf ("Deepest Procedure Nesting    %u\n", AcpiGbl_DeepestNesting);
54899679Siwasaki#endif
54983174Smsmith        break;
55099679Siwasaki
55199679Siwasaki    default:
552250838Sjkim
55399679Siwasaki        break;
55467754Smsmith    }
55567754Smsmith
55667754Smsmith    AcpiOsPrintf ("\n");
55767754Smsmith    return (AE_OK);
55867754Smsmith}
559