1 /******************************************************************************
2  *
3  * Module Name: aslhelp - iASL help screens
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2022, 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 MERCHANTABILITY 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 "aslcompiler.h"
45 #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
Usage(void)65 Usage (
66     void)
67 {
68     printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
69     printf ("%s\n\n", ASL_COMPLIANCE);
70     ACPI_USAGE_HEADER ("iasl [Options] [Files]");
71 
72     printf ("\nGeneral:\n");
73     ACPI_OPTION ("-@  <file>",      "Specify command file");
74     ACPI_OPTION ("-I  <dir>",       "Specify additional include directory");
75     ACPI_OPTION ("-p  <prefix>",    "Specify path/filename prefix for all output files");
76     ACPI_OPTION ("-v",              "Display compiler version");
77     ACPI_OPTION ("-vd",             "Display compiler build date and time");
78     ACPI_OPTION ("-vo",             "Enable optimization comments");
79     ACPI_OPTION ("-vs",             "Disable signon");
80 
81     printf ("\nHelp:\n");
82     ACPI_OPTION ("-h",              "This message");
83     ACPI_OPTION ("-hc",             "Display operators allowed in constant expressions");
84     ACPI_OPTION ("-hd",             "Info for obtaining and disassembling binary ACPI tables");
85     ACPI_OPTION ("-hf",             "Display help for output filename generation");
86     ACPI_OPTION ("-hr",             "Display ACPI reserved method names");
87     ACPI_OPTION ("-ht",             "Display currently supported ACPI table names");
88 
89     printf ("\nPreprocessor:\n");
90     ACPI_OPTION ("-D <symbol>",     "Define symbol for preprocessor use");
91     ACPI_OPTION ("-li",             "Create preprocessed output file (*.i)");
92     ACPI_OPTION ("-P",              "Preprocess only and create preprocessor output file (*.i)");
93     ACPI_OPTION ("-Pn",             "Disable preprocessor");
94 
95     printf ("\nErrors, Warnings, and Remarks:\n");
96     ACPI_OPTION ("-va",             "Disable all errors/warnings/remarks");
97     ACPI_OPTION ("-ve",             "Report only errors (ignore warnings and remarks)");
98     ACPI_OPTION ("-vi",             "Less verbose errors and warnings for use with IDEs");
99     ACPI_OPTION ("-vr",             "Disable remarks");
100     ACPI_OPTION ("-vw <messageid>", "Ignore specific error, warning or remark");
101     ACPI_OPTION ("-vx <messageid>", "Expect a specific warning, remark, or error");
102     ACPI_OPTION ("-w <1|2|3>",      "Set warning reporting level");
103     ACPI_OPTION ("-we",             "Report warnings as errors");
104     ACPI_OPTION ("-ww <messageid>", "Report specific warning or remark as error");
105 
106     printf ("\nAML Bytecode Generation (*.aml):\n");
107     ACPI_OPTION ("-oa",             "Disable all optimizations (compatibility mode)");
108     ACPI_OPTION ("-of",             "Disable constant folding");
109     ACPI_OPTION ("-oi",             "Disable integer optimization to Zero/One/Ones");
110     ACPI_OPTION ("-on",             "Disable named reference string optimization");
111     ACPI_OPTION ("-ot",             "Disable typechecking");
112     ACPI_OPTION ("-cr",             "Disable Resource Descriptor error checking");
113     ACPI_OPTION ("-in",             "Ignore NoOp operators");
114     ACPI_OPTION ("-r <revision>",   "Override table header Revision (1-255)");
115 
116     printf ("\nListings:\n");
117     ACPI_OPTION ("-l",              "Create mixed listing file (ASL source and AML) (*.lst)");
118     ACPI_OPTION ("-lm",             "Create hardware summary map file (*.map)");
119     ACPI_OPTION ("-ln",             "Create namespace file (*.nsp)");
120     ACPI_OPTION ("-ls",             "Create combined source file (expanded includes) (*.src)");
121     ACPI_OPTION ("-lx",             "Create cross-reference file (*.xrf)");
122 
123     printf ("\nFirmware Support - C Text Output:\n");
124     ACPI_OPTION ("-tc",             "Create hex AML table in C (*.hex)");
125     ACPI_OPTION ("-sc",             "Create named hex AML arrays in C (*.c)");
126     ACPI_OPTION ("-ic",             "Create include file in C for -sc symbols (*.h)");
127     ACPI_OPTION ("-so",             "Create namespace AML offset table in C (*.offset.h)");
128 
129     printf ("\nFirmware Support - Assembler Text Output:\n");
130     ACPI_OPTION ("-ta",             "Create hex AML table in assembler (*.hex)");
131     ACPI_OPTION ("-sa",             "Create named hex AML arrays in assembler (*.asm)");
132     ACPI_OPTION ("-ia",             "Create include file in assembler for -sa symbols (*.inc)");
133 
134     printf ("\nFirmware Support - ASL Text Output:\n");
135     ACPI_OPTION ("-ts",             "Create hex AML table in ASL (Buffer object) (*.hex)");
136 
137     printf ("\nLegacy-ASL to ASL+ Converter:\n");
138     ACPI_OPTION ("-ca <file>",      "Convert legacy-ASL source file to new ASL+ file");
139     ACPI_OPTION ("",                "  (Original comments are passed through to ASL+ file)");
140 
141     printf ("\nData Table Compiler:\n");
142     ACPI_OPTION ("-tp",             "Compile tables with flex/bison prototype");
143     ACPI_OPTION ("-G",              "Compile custom table that contains generic operators");
144     ACPI_OPTION ("-T <sig list>|ALL",   "Create ACPI table template/example files");
145     ACPI_OPTION ("-T <count>",      "Emit DSDT and <count> SSDTs to same file");
146     ACPI_OPTION ("-vt",             "Create verbose template files (full disassembly)");
147 
148     printf ("\nAML Disassembler:\n");
149     ACPI_OPTION ("-d  <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
150     ACPI_OPTION ("",                "  (Optional, file type is automatically detected)");
151     ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace");
152     ACPI_OPTION ("-db",             "Do not translate Buffers to Resource Templates");
153     ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
154     ACPI_OPTION ("",                "  (Obtain DSDT from current system if no input file)");
155     ACPI_OPTION ("-df",             "Force disassembler to assume table contains valid AML");
156     ACPI_OPTION ("-dl",             "Emit legacy ASL code only (no C-style operators)");
157     ACPI_OPTION ("-ds <signature(4)>", "Specify a table signature(4) (CDAT table only)");
158     ACPI_OPTION ("-e  <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
159     ACPI_OPTION ("-fe <file>",      "Specify external symbol declaration file");
160     ACPI_OPTION ("-in",             "Ignore NoOp opcodes");
161     ACPI_OPTION ("-l",              "Disassemble to mixed ASL and AML code");
162     ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");
163 
164     printf ("\nDebug Options:\n");
165     ACPI_OPTION ("-bc",             "Create converter debug file (*.cdb)");
166     ACPI_OPTION ("-bf",             "Create debug file (full output) (*.txt)");
167     ACPI_OPTION ("-bs",             "Create debug file (parse tree only) (*.txt)");
168     ACPI_OPTION ("-bp <depth>",     "Prune ASL parse tree");
169     ACPI_OPTION ("-bt <type>",      "Object type to be pruned from the parse tree");
170     ACPI_OPTION ("-f",              "Ignore errors, force creation of AML output file(s)");
171     ACPI_OPTION ("-m <size>",       "Set internal line buffer size (in Kbytes)");
172     ACPI_OPTION ("-n",              "Parse only, no output generation");
173     ACPI_OPTION ("-oc",             "Display compile times and statistics");
174     ACPI_OPTION ("-x <level>",      "Set debug level for trace output");
175     ACPI_OPTION ("-z",              "Do not insert new compiler ID for DataTables");
176 }
177 
178 
179 /*******************************************************************************
180  *
181  * FUNCTION:    FilenameHelp
182  *
183  * PARAMETERS:  None
184  *
185  * RETURN:      None
186  *
187  * DESCRIPTION: Display help message for output filename generation
188  *
189  ******************************************************************************/
190 
191 void
AslFilenameHelp(void)192 AslFilenameHelp (
193     void)
194 {
195 
196     printf ("\nAML output filename generation:\n");
197     printf ("  Output filenames are generated by appending an extension to a common\n");
198     printf ("  filename prefix. The filename prefix is obtained via one of the\n");
199     printf ("  following methods (in priority order):\n");
200     printf ("    1) The -p option specifies the prefix\n");
201     printf ("    2) The prefix of the AMLFileName in the ASL Definition Block\n");
202     printf ("    3) The prefix of the input filename\n");
203     printf ("\n");
204 }
205 
206 /*******************************************************************************
207  *
208  * FUNCTION:    AslDisassemblyHelp
209  *
210  * PARAMETERS:  None
211  *
212  * RETURN:      None
213  *
214  * DESCRIPTION: Display help message for obtaining and disassembling AML/ASL
215  *              files.
216  *
217  ******************************************************************************/
218 
219 void
AslDisassemblyHelp(void)220 AslDisassemblyHelp (
221     void)
222 {
223 
224     printf ("\nObtaining binary ACPI tables and disassembling to ASL source code.\n\n");
225     printf ("Use the following ACPICA toolchain:\n");
226     printf ("  AcpiDump: Dump all ACPI tables to a hex ascii file\n");
227     printf ("  AcpiXtract: Extract one or more binary ACPI tables from AcpiDump output\n");
228     printf ("  iASL -d <file>: Disassemble a binary ACPI table to ASL source code\n");
229     printf ("\n");
230 }
231