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