1 /******************************************************************************
3 * Module Name: aslxrefout.c - support for optional cross-reference file
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #include "aslcompiler.h"
153 #include "aslcompiler.y.h"
154 #include "acnamesp.h"
155 #include "acparser.h"
158 #define _COMPONENT ACPI_COMPILER
159 ACPI_MODULE_NAME ("aslxrefout")
162 /* Local prototypes */
166 ACPI_PARSE_OBJECT
*Op
,
172 ACPI_PARSE_OBJECT
*Op
,
177 OtXrefAnalysisWalkPart1 (
178 ACPI_PARSE_OBJECT
*Op
,
184 OtXrefAnalysisWalkPart2 (
185 ACPI_PARSE_OBJECT
*Op
,
190 OtXrefAnalysisWalkPart3 (
191 ACPI_PARSE_OBJECT
*Op
,
196 /*******************************************************************************
198 * FUNCTION: OtPrintHeaders
200 * PARAMETERS: Message - Main header message
204 * DESCRIPTION: Emits the main header message along with field descriptions
206 ******************************************************************************/
215 Length
= strlen (Message
);
217 FlPrintFile (ASL_FILE_XREF_OUTPUT
, "\n\n%s\n", Message
);
220 FlPrintFile (ASL_FILE_XREF_OUTPUT
, "-");
224 FlPrintFile (ASL_FILE_XREF_OUTPUT
, "\n\nLineno %-40s Description\n",
229 /*******************************************************************************
231 * FUNCTION: OtCreateXrefFile
237 * DESCRIPTION Main entry point for parts 2 and 3 of the cross-reference
240 ******************************************************************************/
246 ASL_XREF_INFO XrefInfo
;
249 /* Build cross-reference output file if requested */
251 if (!Gbl_CrossReferenceOutput
)
256 memset (&XrefInfo
, 0, sizeof (ASL_XREF_INFO
));
258 /* Cross-reference output file, part 2 (Method invocations) */
260 OtPrintHeaders ("Part 2: Method Reference Map "
261 "(Invocations of each user-defined control method)");
263 TrWalkParseTree (Gbl_ParseTreeRoot
, ASL_WALK_VISIT_DOWNWARD
,
264 OtXrefWalkPart2
, NULL
, &XrefInfo
);
266 /* Cross-reference output file, part 3 (All other object refs) */
268 OtPrintHeaders ("Part 3: Full Object Reference Map "
269 "(Methods that reference each object in namespace");
271 TrWalkParseTree (Gbl_ParseTreeRoot
, ASL_WALK_VISIT_DOWNWARD
,
272 OtXrefWalkPart3
, NULL
, &XrefInfo
);
274 /* Cross-reference summary */
276 FlPrintFile (ASL_FILE_XREF_OUTPUT
, "\n\nObject Summary\n");
278 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
279 "\nTotal methods: %u\n",
280 XrefInfo
.TotalPredefinedMethods
+ XrefInfo
.TotalUserMethods
);
281 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
282 "Total predefined methods: %u\n",
283 XrefInfo
.TotalPredefinedMethods
);
285 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
286 "\nTotal user methods: %u\n",
287 XrefInfo
.TotalUserMethods
);
288 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
289 "Total unreferenced user methods %u\n",
290 XrefInfo
.TotalUnreferenceUserMethods
);
292 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
293 "\nTotal defined objects: %u\n",
294 XrefInfo
.TotalObjects
);
295 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
296 "Total unreferenced objects: %u\n",
297 XrefInfo
.TotalUnreferencedObjects
);
302 * Part 1 of the cross reference file. This part emits the namespace objects
303 * that are referenced by each control method in the namespace.
305 * Part 2 and 3 are below part 1.
308 /*******************************************************************************
310 * FUNCTION: OtXrefWalkPart1
312 * PARAMETERS: Op - Current parse Op
313 * Level - Current tree nesting level
314 * MethodInfo - Info block for the current method
319 * DESCRIPTION: Entry point for the creation of the method call reference map.
320 * For each control method in the namespace, all other methods
321 * that invoke the method are listed. Predefined names/methods
322 * that start with an underscore are ignored, because these are
323 * essentially external/public interfaces.
325 * DESCRIPTION: Entry point for the creation of the object reference map.
326 * For each control method in the namespace, all objects that
327 * are referenced by the method are listed.
329 * Called during a normal namespace walk, once per namespace
330 * object. (MtMethodAnalysisWalkBegin)
332 ******************************************************************************/
336 ACPI_PARSE_OBJECT
*Op
,
338 ASL_METHOD_INFO
*MethodInfo
)
340 ACPI_NAMESPACE_NODE
*Node
;
341 ACPI_PARSE_OBJECT
*NextOp
;
342 ACPI_PARSE_OBJECT
*FieldOp
;
348 switch (Op
->Asl
.ParseOpcode
)
350 case PARSEOP_NAMESEG
:
351 case PARSEOP_NAMESTRING
:
352 case PARSEOP_METHODCALL
:
355 (MethodInfo
->Op
->Asl
.Child
== Op
) ||
361 MethodInfo
->CurrentOp
= Op
;
364 /* Find all objects referenced by this method */
366 Status
= TrWalkParseTree (MethodInfo
->Op
, ASL_WALK_VISIT_DOWNWARD
,
367 OtXrefAnalysisWalkPart1
, NULL
, MethodInfo
);
369 if (Status
== AE_CTRL_TERMINATE
)
371 ParentPath
= AcpiNsGetNormalizedPathname (Node
, TRUE
);
373 FlPrintFile (ASL_FILE_XREF_OUTPUT
, " %-40s %s",
374 ParentPath
, AcpiUtGetTypeName (Node
->Type
));
375 ACPI_FREE (ParentPath
);
379 /* Handle externals */
382 case ACPI_TYPE_FIELD_UNIT
:
384 FlPrintFile (ASL_FILE_XREF_OUTPUT
, " <External Object>");
387 case ACPI_TYPE_INTEGER
:
389 FlPrintFile (ASL_FILE_XREF_OUTPUT
, " %8.8X%8.8X",
390 ACPI_FORMAT_UINT64 (Op
->Asl
.Value
.Integer
));
393 case ACPI_TYPE_METHOD
:
395 FlPrintFile (ASL_FILE_XREF_OUTPUT
, " Invocation (%u args)",
399 case ACPI_TYPE_BUFFER_FIELD
:
401 NextOp
= Node
->Op
; /* Create Buffer Field Op */
402 switch (NextOp
->Asl
.ParseOpcode
)
404 case PARSEOP_CREATEBITFIELD
:
408 case PARSEOP_CREATEBYTEFIELD
:
412 case PARSEOP_CREATEWORDFIELD
:
416 case PARSEOP_CREATEDWORDFIELD
:
420 case PARSEOP_CREATEQWORDFIELD
:
429 NextOp
= NextOp
->Asl
.Child
; /* Buffer name */
431 if (!NextOp
->Asl
.ExternalName
)
433 FlPrintFile (ASL_FILE_XREF_OUTPUT
, " in Arg/Local");
437 ParentPath
= AcpiNsGetNormalizedPathname (
438 NextOp
->Asl
.Node
, TRUE
);
440 FlPrintFile (ASL_FILE_XREF_OUTPUT
, " (%.2u bit) in Buffer %s",
442 ACPI_FREE (ParentPath
);
446 case ACPI_TYPE_LOCAL_REGION_FIELD
:
449 FieldOp
= NextOp
->Asl
.Parent
;
450 NextOp
= FieldOp
->Asl
.Child
;
452 ParentPath
= AcpiNsGetNormalizedPathname (
453 NextOp
->Asl
.Node
, TRUE
);
455 FlPrintFile (ASL_FILE_XREF_OUTPUT
, " (%.2u bit) in Region %s",
456 (UINT32
) Node
->Op
->Asl
.Child
->Asl
.Value
.Integer
,
458 ACPI_FREE (ParentPath
);
460 if (FieldOp
->Asl
.ParseOpcode
== PARSEOP_FIELD
)
462 Node
= NextOp
->Asl
.Node
; /* Region node */
463 NextOp
= Node
->Op
; /* PARSEOP_REGION */
464 NextOp
= NextOp
->Asl
.Child
; /* Region name */
465 NextOp
= NextOp
->Asl
.Next
;
467 /* Get region space/addr/len? */
469 FlPrintFile (ASL_FILE_XREF_OUTPUT
, " (%s)",
470 AcpiUtGetRegionName ((UINT8
)
471 NextOp
->Asl
.Value
.Integer
));
479 FlPrintFile (ASL_FILE_XREF_OUTPUT
, "\n");
485 ParentPath
= AcpiNsGetNormalizedPathname (Op
->Asl
.Node
, TRUE
);
487 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
488 "\n[%5u] %-40s %s Declaration (%u args)\n",
489 Op
->Asl
.LogicalLineNumber
, ParentPath
,
490 AcpiUtGetTypeName (Op
->Asl
.Node
->Type
), Op
->Asl
.Node
->ArgCount
);
492 ACPI_FREE (ParentPath
);
501 /*******************************************************************************
503 * FUNCTION: OtXrefAnalysisWalkPart1
505 * PARAMETERS: ASL_WALK_CALLBACK
509 * DESCRIPTION: Secondary walk for cross-reference part 1.
511 ******************************************************************************/
514 OtXrefAnalysisWalkPart1 (
515 ACPI_PARSE_OBJECT
*Op
,
519 ASL_METHOD_INFO
*MethodInfo
= (ASL_METHOD_INFO
*) Context
;
520 ACPI_PARSE_OBJECT
*Next
;
523 /* Only interested in name string Ops -- ignore all others */
525 if ((Op
->Asl
.ParseOpcode
!= PARSEOP_NAMESEG
) &&
526 (Op
->Asl
.ParseOpcode
!= PARSEOP_NAMESTRING
) &&
527 (Op
->Asl
.ParseOpcode
!= PARSEOP_METHODCALL
))
532 /* No node means a locally declared object -- ignore */
539 /* When we encounter the source Op, we are done */
541 Next
= MethodInfo
->CurrentOp
;
544 return (AE_CTRL_TERMINATE
);
547 /* If we have a name match, this Op is a duplicate */
549 if ((Next
->Asl
.ParseOpcode
== PARSEOP_NAMESEG
) ||
550 (Next
->Asl
.ParseOpcode
== PARSEOP_NAMESTRING
) ||
551 (Next
->Asl
.ParseOpcode
== PARSEOP_METHODCALL
))
553 if (!strcmp (Op
->Asl
.ExternalName
, Next
->Asl
.ExternalName
))
555 return (AE_ALREADY_EXISTS
);
564 * Part 2 of the cross reference file. This part emits the names of each
565 * non-predefined method in the namespace (user methods), along with the
566 * names of each control method that references that method.
569 /*******************************************************************************
571 * FUNCTION: OtXrefWalkPart2
573 * PARAMETERS: ASL_WALK_CALLBACK
577 * DESCRIPTION: For each control method in the namespace, we will re-walk the
578 * namespace to find each and every invocation of that control
579 * method. Brute force, but does not matter, even for large
580 * namespaces. Ignore predefined names (start with underscore).
582 ******************************************************************************/
586 ACPI_PARSE_OBJECT
*Op
,
590 ASL_XREF_INFO
*XrefInfo
= (ASL_XREF_INFO
*) Context
;
591 ACPI_NAMESPACE_NODE
*Node
;
595 /* Looking for Method Declaration Ops only */
598 (Op
->Asl
.ParseOpcode
!= PARSEOP_METHOD
))
603 /* Ignore predefined names */
605 if (Op
->Asl
.Node
->Name
.Ascii
[0] == '_')
607 XrefInfo
->TotalPredefinedMethods
++;
612 ParentPath
= AcpiNsGetNormalizedPathname (Node
, TRUE
);
614 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
615 "\n[%5u] %-40s %s Declaration (%u args)\n",
616 Op
->Asl
.LogicalLineNumber
, ParentPath
,
617 AcpiUtGetTypeName (Node
->Type
), Node
->ArgCount
);
619 XrefInfo
->TotalUserMethods
++;
620 XrefInfo
->ThisMethodInvocations
= 0;
621 XrefInfo
->MethodOp
= Op
;
623 (void) TrWalkParseTree (Gbl_ParseTreeRoot
, ASL_WALK_VISIT_DOWNWARD
,
624 OtXrefAnalysisWalkPart2
, NULL
, XrefInfo
);
626 if (!XrefInfo
->ThisMethodInvocations
)
628 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
629 " Zero invocations of this method in this module\n");
630 XrefInfo
->TotalUnreferenceUserMethods
++;
634 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
635 " %u invocations of method %s in this module\n",
636 XrefInfo
->ThisMethodInvocations
, ParentPath
);
639 ACPI_FREE (ParentPath
);
644 /*******************************************************************************
646 * FUNCTION: OtXrefAnalysisWalkPart2
648 * PARAMETERS: ASL_WALK_CALLBACK
652 * DESCRIPTION: For every Op that is a method invocation, emit a reference
653 * line if the Op is invoking the target method.
655 ******************************************************************************/
658 OtXrefAnalysisWalkPart2 (
659 ACPI_PARSE_OBJECT
*Op
,
663 ASL_XREF_INFO
*XrefInfo
= (ASL_XREF_INFO
*) Context
;
664 ACPI_PARSE_OBJECT
*CallerOp
;
665 char *CallerFullPathname
;
668 /* Looking for MethodCall Ops only */
671 (Op
->Asl
.ParseOpcode
!= PARSEOP_METHODCALL
))
676 /* If not a match to the target method, we are done */
678 if (Op
->Asl
.Node
!= XrefInfo
->MethodOp
->Asl
.Node
)
680 return (AE_CTRL_DEPTH
);
683 /* Find parent method to get method caller namepath */
685 CallerOp
= Op
->Asl
.Parent
;
687 (CallerOp
->Asl
.ParseOpcode
!= PARSEOP_METHOD
))
689 CallerOp
= CallerOp
->Asl
.Parent
;
692 /* There is no parent method for External() statements */
699 CallerFullPathname
= AcpiNsGetNormalizedPathname (
700 CallerOp
->Asl
.Node
, TRUE
);
702 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
703 "[%5u] %-40s Invocation path: %s\n",
704 Op
->Asl
.LogicalLineNumber
, CallerFullPathname
,
705 Op
->Asl
.ExternalName
);
707 ACPI_FREE (CallerFullPathname
);
708 XrefInfo
->ThisMethodInvocations
++;
714 * Part 3 of the cross reference file. This part emits the names of each
715 * non-predefined method in the namespace (user methods), along with the
716 * names of each control method that references that method.
719 /*******************************************************************************
721 * FUNCTION: OtXrefWalkPart3
723 * PARAMETERS: ASL_WALK_CALLBACK
727 * DESCRIPTION: Cross-reference part 3. references to objects other than
730 ******************************************************************************/
734 ACPI_PARSE_OBJECT
*Op
,
738 ASL_XREF_INFO
*XrefInfo
= (ASL_XREF_INFO
*) Context
;
739 ACPI_NAMESPACE_NODE
*Node
;
741 const ACPI_OPCODE_INFO
*OpInfo
;
744 /* Ignore method declarations */
747 (Op
->Asl
.ParseOpcode
== PARSEOP_METHOD
))
752 OpInfo
= AcpiPsGetOpcodeInfo (Op
->Asl
.AmlOpcode
);
753 if (!(OpInfo
->Class
& AML_CLASS_NAMED_OBJECT
))
758 /* Only care about named object creation opcodes */
760 if ((Op
->Asl
.ParseOpcode
!= PARSEOP_NAME
) &&
761 (Op
->Asl
.ParseOpcode
!= PARSEOP_DEVICE
) &&
762 (Op
->Asl
.ParseOpcode
!= PARSEOP_MUTEX
) &&
763 (Op
->Asl
.ParseOpcode
!= PARSEOP_OPERATIONREGION
) &&
764 (Op
->Asl
.ParseOpcode
!= PARSEOP_FIELD
) &&
765 (Op
->Asl
.ParseOpcode
!= PARSEOP_EVENT
))
770 /* Ignore predefined names */
772 if (Op
->Asl
.Node
->Name
.Ascii
[0] == '_')
778 ParentPath
= AcpiNsGetNormalizedPathname (Node
, TRUE
);
780 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
781 "\n[%5u] %-40s %s Declaration\n",
782 Op
->Asl
.LogicalLineNumber
, ParentPath
,
783 AcpiUtGetTypeName (Node
->Type
));
784 ACPI_FREE (ParentPath
);
786 XrefInfo
->MethodOp
= Op
;
787 XrefInfo
->ThisObjectReferences
= 0;
788 XrefInfo
->TotalObjects
= 0;
790 (void) TrWalkParseTree (Gbl_ParseTreeRoot
, ASL_WALK_VISIT_DOWNWARD
,
791 OtXrefAnalysisWalkPart3
, NULL
, XrefInfo
);
793 if (!XrefInfo
->ThisObjectReferences
)
795 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
796 " Zero references to this object in this module\n");
797 XrefInfo
->TotalUnreferencedObjects
++;
801 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
802 " %u references to this object in this module\n",
803 XrefInfo
->ThisObjectReferences
, ParentPath
);
810 /*******************************************************************************
812 * FUNCTION: OtXrefAnalysisWalkPart3
814 * PARAMETERS: ASL_WALK_CALLBACK
818 * DESCRIPTION: Secondary walk for cross-reference part 3.
820 ******************************************************************************/
823 OtXrefAnalysisWalkPart3 (
824 ACPI_PARSE_OBJECT
*Op
,
828 ASL_XREF_INFO
*XrefInfo
= (ASL_XREF_INFO
*) Context
;
829 char *CallerFullPathname
= NULL
;
830 ACPI_PARSE_OBJECT
*CallerOp
;
831 const char *Operator
;
839 XrefInfo
->TotalObjects
++;
841 /* Ignore Op that actually defined the object */
843 if (Op
== XrefInfo
->MethodOp
)
848 /* Only interested in Ops that reference the target node */
850 if (Op
->Asl
.Node
!= XrefInfo
->MethodOp
->Asl
.Node
)
855 /* Find parent "open scope" object to get method caller namepath */
857 CallerOp
= Op
->Asl
.Parent
;
859 (CallerOp
->Asl
.ParseOpcode
!= PARSEOP_NAME
) &&
860 (CallerOp
->Asl
.ParseOpcode
!= PARSEOP_METHOD
) &&
861 (CallerOp
->Asl
.ParseOpcode
!= PARSEOP_DEVICE
) &&
862 (CallerOp
->Asl
.ParseOpcode
!= PARSEOP_POWERRESOURCE
) &&
863 (CallerOp
->Asl
.ParseOpcode
!= PARSEOP_PROCESSOR
) &&
864 (CallerOp
->Asl
.ParseOpcode
!= PARSEOP_THERMALZONE
))
866 CallerOp
= CallerOp
->Asl
.Parent
;
869 if (CallerOp
== XrefInfo
->CurrentMethodOp
)
874 /* Null CallerOp means the caller is at the namespace root */
878 CallerFullPathname
= AcpiNsGetNormalizedPathname (
879 CallerOp
->Asl
.Node
, TRUE
);
882 /* There are some special cases for the oddball operators */
884 if (Op
->Asl
.ParseOpcode
== PARSEOP_SCOPE
)
888 else if (Op
->Asl
.Parent
->Asl
.ParseOpcode
== PARSEOP_ALIAS
)
894 Operator
= "ModLevel";
898 Operator
= AcpiUtGetTypeName (CallerOp
->Asl
.Node
->Type
);
901 FlPrintFile (ASL_FILE_XREF_OUTPUT
,
902 "[%5u] %-40s %-8s via path: %s, Operator: %s\n",
903 Op
->Asl
.LogicalLineNumber
,
904 CallerFullPathname
? CallerFullPathname
: "<root>",
906 Op
->Asl
.ExternalName
,
907 Op
->Asl
.Parent
->Asl
.ParseOpName
);
911 CallerOp
= ACPI_TO_POINTER (0xFFFFFFFF);
914 if (CallerFullPathname
)
916 ACPI_FREE (CallerFullPathname
);
919 XrefInfo
->CurrentMethodOp
= CallerOp
;
920 XrefInfo
->ThisObjectReferences
++;