xref: /freebsd/sys/contrib/dev/acpica/compiler/aslhelp.c (revision 076ad2f836d5f49dc1375f1677335a48fe0d4b82)
1 /******************************************************************************
2  *
3  * Module Name: aslhelp - iASL help screens
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2017, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #include <contrib/dev/acpica/compiler/aslcompiler.h>
45 #include <contrib/dev/acpica/include/acapps.h>
46 
47 #define _COMPONENT          ACPI_COMPILER
48         ACPI_MODULE_NAME    ("aslhelp")
49 
50 
51 /*******************************************************************************
52  *
53  * FUNCTION:    Usage
54  *
55  * PARAMETERS:  None
56  *
57  * RETURN:      None
58  *
59  * DESCRIPTION: Display option help message.
60  *              Optional items in square brackets.
61  *
62  ******************************************************************************/
63 
64 void
65 Usage (
66     void)
67 {
68     printf ("%s\n\n", ASL_COMPLIANCE);
69     ACPI_USAGE_HEADER ("iasl [Options] [Files]");
70 
71     printf ("\nGeneral:\n");
72     ACPI_OPTION ("-@ <file>",       "Specify command file");
73     ACPI_OPTION ("-I <dir>",        "Specify additional include directory");
74     ACPI_OPTION ("-p <prefix>",     "Specify path/filename prefix for all output files");
75     ACPI_OPTION ("-v",              "Display compiler version");
76     ACPI_OPTION ("-vo",             "Enable optimization comments");
77     ACPI_OPTION ("-vs",             "Disable signon");
78 
79     printf ("\nHelp:\n");
80     ACPI_OPTION ("-h",              "This message");
81     ACPI_OPTION ("-hc",             "Display operators allowed in constant expressions");
82     ACPI_OPTION ("-hd",             "Info for obtaining and disassembling binary ACPI tables");
83     ACPI_OPTION ("-hf",             "Display help for output filename generation");
84     ACPI_OPTION ("-hr",             "Display ACPI reserved method names");
85     ACPI_OPTION ("-ht",             "Display currently supported ACPI table names");
86 
87     printf ("\nPreprocessor:\n");
88     ACPI_OPTION ("-D <symbol>",     "Define symbol for preprocessor use");
89     ACPI_OPTION ("-li",             "Create preprocessed output file (*.i)");
90     ACPI_OPTION ("-P",              "Preprocess only and create preprocessor output file (*.i)");
91     ACPI_OPTION ("-Pn",             "Disable preprocessor");
92 
93     printf ("\nErrors, Warnings, and Remarks:\n");
94     ACPI_OPTION ("-va",             "Disable all errors/warnings/remarks");
95     ACPI_OPTION ("-ve",             "Report only errors (ignore warnings and remarks)");
96     ACPI_OPTION ("-vi",             "Less verbose errors and warnings for use with IDEs");
97     ACPI_OPTION ("-vr",             "Disable remarks");
98     ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark");
99     ACPI_OPTION ("-w <1|2|3>",      "Set warning reporting level");
100     ACPI_OPTION ("-we",             "Report warnings as errors");
101 
102     printf ("\nAML Code Generation (*.aml):\n");
103     ACPI_OPTION ("-oa",             "Disable all optimizations (compatibility mode)");
104     ACPI_OPTION ("-of",             "Disable constant folding");
105     ACPI_OPTION ("-oi",             "Disable integer optimization to Zero/One/Ones");
106     ACPI_OPTION ("-on",             "Disable named reference string optimization");
107     ACPI_OPTION ("-ot",             "Disable typechecking");
108     ACPI_OPTION ("-cr",             "Disable Resource Descriptor error checking");
109     ACPI_OPTION ("-in",             "Ignore NoOp operators");
110     ACPI_OPTION ("-r <revision>",   "Override table header Revision (1-255)");
111 
112     printf ("\nListings:\n");
113     ACPI_OPTION ("-l",              "Create mixed listing file (ASL source and AML) (*.lst)");
114     ACPI_OPTION ("-lm",             "Create hardware summary map file (*.map)");
115     ACPI_OPTION ("-ln",             "Create namespace file (*.nsp)");
116     ACPI_OPTION ("-ls",             "Create combined source file (expanded includes) (*.src)");
117     ACPI_OPTION ("-lx",             "Create cross-reference file (*.xrf)");
118 
119     printf ("\nFirmware Support - C Output:\n");
120     ACPI_OPTION ("-tc",             "Create hex AML table in C (*.hex)");
121     ACPI_OPTION ("-sc",             "Create named hex AML arrays in C (*.c)");
122     ACPI_OPTION ("-ic",             "Create include file in C for -sc symbols (*.h)");
123     ACPI_OPTION ("-so",             "Create namespace AML offset table in C (*.offset.h)");
124 
125     printf ("\nFirmware Support - Assembler Output:\n");
126     ACPI_OPTION ("-ta",             "Create hex AML table in assembler (*.hex)");
127     ACPI_OPTION ("-sa",             "Create named hex AML arrays in assembler (*.asm)");
128     ACPI_OPTION ("-ia",             "Create include file in assembler for -sa symbols (*.inc)");
129 
130     printf ("\nFirmware Support - ASL Output:\n");
131     ACPI_OPTION ("-ts",             "Create hex AML table in ASL (Buffer object) (*.hex)");
132 
133     printf ("\nData Table Compiler:\n");
134     ACPI_OPTION ("-G",              "Compile custom table that contains generic operators");
135     ACPI_OPTION ("-T <sig list>|ALL",   "Create ACPI table template/example files");
136     ACPI_OPTION ("-T <count>",      "Emit DSDT and <count> SSDTs to same file");
137     ACPI_OPTION ("-vt",             "Create verbose template files (full disassembly)");
138 
139     printf ("\nAML Disassembler:\n");
140     ACPI_OPTION ("-d  <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
141     ACPI_OPTION ("",                "  (Optional, file type is automatically detected)");
142     ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace");
143     ACPI_OPTION ("-db",             "Do not translate Buffers to Resource Templates");
144     ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
145     ACPI_OPTION ("",                "  (Obtain DSDT from current system if no input file)");
146     ACPI_OPTION ("-df",             "Force disassembler to assume table contains valid AML");
147     ACPI_OPTION ("-dl",             "Emit legacy ASL code only (no C-style operators)");
148     ACPI_OPTION ("-e  <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
149     ACPI_OPTION ("-fe <file>",      "Specify external symbol declaration file");
150     ACPI_OPTION ("-in",             "Ignore NoOp opcodes");
151     ACPI_OPTION ("-l",              "Disassemble to mixed ASL and AML code");
152     ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");
153 
154     printf ("\nDebug Options:\n");
155     ACPI_OPTION ("-bf",             "Create debug file (full output) (*.txt)");
156     ACPI_OPTION ("-bs",             "Create debug file (parse tree only) (*.txt)");
157     ACPI_OPTION ("-bp <depth>",     "Prune ASL parse tree");
158     ACPI_OPTION ("-bt <type>",      "Object type to be pruned from the parse tree");
159     ACPI_OPTION ("-f",              "Ignore errors, force creation of AML output file(s)");
160     ACPI_OPTION ("-m <size>",       "Set internal line buffer size (in Kbytes)");
161     ACPI_OPTION ("-n",              "Parse only, no output generation");
162     ACPI_OPTION ("-oc",             "Display compile times and statistics");
163     ACPI_OPTION ("-x <level>",      "Set debug level for trace output");
164     ACPI_OPTION ("-z",              "Do not insert new compiler ID for DataTables");
165 }
166 
167 
168 /*******************************************************************************
169  *
170  * FUNCTION:    FilenameHelp
171  *
172  * PARAMETERS:  None
173  *
174  * RETURN:      None
175  *
176  * DESCRIPTION: Display help message for output filename generation
177  *
178  ******************************************************************************/
179 
180 void
181 AslFilenameHelp (
182     void)
183 {
184 
185     printf ("\nAML output filename generation:\n");
186     printf ("  Output filenames are generated by appending an extension to a common\n");
187     printf ("  filename prefix. The filename prefix is obtained via one of the\n");
188     printf ("  following methods (in priority order):\n");
189     printf ("    1) The -p option specifies the prefix\n");
190     printf ("    2) The prefix of the AMLFileName in the ASL Definition Block\n");
191     printf ("    3) The prefix of the input filename\n");
192     printf ("\n");
193 }
194 
195 /*******************************************************************************
196  *
197  * FUNCTION:    AslDisassemblyHelp
198  *
199  * PARAMETERS:  None
200  *
201  * RETURN:      None
202  *
203  * DESCRIPTION: Display help message for obtaining and disassembling AML/ASL
204  *              files.
205  *
206  ******************************************************************************/
207 
208 void
209 AslDisassemblyHelp (
210     void)
211 {
212 
213     printf ("\nObtaining binary ACPI tables and disassembling to ASL source code.\n\n");
214     printf ("Use the following ACPICA toolchain:\n");
215     printf ("  AcpiDump: Dump all ACPI tables to a hex ascii file\n");
216     printf ("  AcpiXtract: Extract one or more binary ACPI tables from AcpiDump output\n");
217     printf ("  iASL -d <file>: Disassemble a binary ACPI table to ASL source code\n");
218     printf ("\n");
219 }
220