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