Home | History | Annotate | Line # | Download | only in compiler
aslmain.c revision 1.1.1.7
      1      1.1    jruoho /******************************************************************************
      2      1.1    jruoho  *
      3      1.1    jruoho  * Module Name: aslmain - compiler main and utilities
      4      1.1    jruoho  *
      5      1.1    jruoho  *****************************************************************************/
      6      1.1    jruoho 
      7  1.1.1.2    jruoho /*
      8  1.1.1.6  christos  * Copyright (C) 2000 - 2015, Intel Corp.
      9      1.1    jruoho  * All rights reserved.
     10      1.1    jruoho  *
     11  1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
     12  1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
     13  1.1.1.2    jruoho  * are met:
     14  1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
     15  1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16  1.1.1.2    jruoho  *    without modification.
     17  1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
     21  1.1.1.2    jruoho  *    binary redistribution.
     22  1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
     24  1.1.1.2    jruoho  *    from this software without specific prior written permission.
     25  1.1.1.2    jruoho  *
     26  1.1.1.2    jruoho  * Alternatively, this software may be distributed under the terms of the
     27  1.1.1.2    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.1.1.2    jruoho  * Software Foundation.
     29  1.1.1.2    jruoho  *
     30  1.1.1.2    jruoho  * NO WARRANTY
     31  1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.2    jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.1.1.2    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.1.1.2    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.1.1.2    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.1.1.2    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.1.1.2    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.1.1.2    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.1.1.2    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42  1.1.1.2    jruoho  */
     43      1.1    jruoho 
     44      1.1    jruoho #define _DECLARE_GLOBALS
     45      1.1    jruoho 
     46      1.1    jruoho #include "aslcompiler.h"
     47      1.1    jruoho #include "acapps.h"
     48  1.1.1.2    jruoho #include "acdisasm.h"
     49  1.1.1.4  christos #include <signal.h>
     50      1.1    jruoho 
     51      1.1    jruoho #define _COMPONENT          ACPI_COMPILER
     52      1.1    jruoho         ACPI_MODULE_NAME    ("aslmain")
     53      1.1    jruoho 
     54  1.1.1.4  christos /*
     55  1.1.1.4  christos  * Main routine for the iASL compiler.
     56  1.1.1.4  christos  *
     57  1.1.1.4  christos  * Portability note: The compiler depends upon the host for command-line
     58  1.1.1.4  christos  * wildcard support - it is not implemented locally. For example:
     59  1.1.1.4  christos  *
     60  1.1.1.4  christos  * Linux/Unix systems: Shell expands wildcards automatically.
     61  1.1.1.4  christos  *
     62  1.1.1.4  christos  * Windows: The setargv.obj module must be linked in to automatically
     63  1.1.1.4  christos  * expand wildcards.
     64  1.1.1.4  christos  */
     65      1.1    jruoho 
     66  1.1.1.4  christos /* Local prototypes */
     67      1.1    jruoho 
     68  1.1.1.4  christos static void ACPI_SYSTEM_XFACE
     69  1.1.1.4  christos AslSignalHandler (
     70  1.1.1.4  christos     int                     Sig);
     71      1.1    jruoho 
     72      1.1    jruoho static void
     73      1.1    jruoho AslInitialize (
     74      1.1    jruoho     void);
     75      1.1    jruoho 
     76  1.1.1.5  christos UINT8
     77  1.1.1.5  christos AcpiIsBigEndianMachine (
     78  1.1.1.5  christos     void);
     79  1.1.1.5  christos 
     80  1.1.1.5  christos 
     81  1.1.1.5  christos /*******************************************************************************
     82  1.1.1.5  christos  *
     83  1.1.1.5  christos  * FUNCTION:    AcpiIsBigEndianMachine
     84  1.1.1.5  christos  *
     85  1.1.1.5  christos  * PARAMETERS:  None
     86  1.1.1.5  christos  *
     87  1.1.1.5  christos  * RETURN:      TRUE if machine is big endian
     88  1.1.1.5  christos  *              FALSE if machine is little endian
     89  1.1.1.5  christos  *
     90  1.1.1.5  christos  * DESCRIPTION: Detect whether machine is little endian or big endian.
     91  1.1.1.5  christos  *
     92  1.1.1.5  christos  ******************************************************************************/
     93  1.1.1.5  christos 
     94  1.1.1.5  christos UINT8
     95  1.1.1.5  christos AcpiIsBigEndianMachine (
     96  1.1.1.5  christos     void)
     97  1.1.1.5  christos {
     98  1.1.1.5  christos     union {
     99  1.1.1.5  christos         UINT32              Integer;
    100  1.1.1.5  christos         UINT8               Bytes[4];
    101  1.1.1.5  christos     } Overlay = {0xFF000000};
    102  1.1.1.5  christos 
    103  1.1.1.5  christos     return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */
    104  1.1.1.5  christos }
    105  1.1.1.5  christos 
    106      1.1    jruoho 
    107      1.1    jruoho /*******************************************************************************
    108      1.1    jruoho  *
    109  1.1.1.4  christos  * FUNCTION:    Usage
    110      1.1    jruoho  *
    111      1.1    jruoho  * PARAMETERS:  None
    112      1.1    jruoho  *
    113      1.1    jruoho  * RETURN:      None
    114      1.1    jruoho  *
    115  1.1.1.4  christos  * DESCRIPTION: Display option help message.
    116  1.1.1.4  christos  *              Optional items in square brackets.
    117      1.1    jruoho  *
    118      1.1    jruoho  ******************************************************************************/
    119      1.1    jruoho 
    120  1.1.1.4  christos void
    121  1.1.1.4  christos Usage (
    122      1.1    jruoho     void)
    123      1.1    jruoho {
    124  1.1.1.4  christos     printf ("%s\n\n", ASL_COMPLIANCE);
    125  1.1.1.4  christos     ACPI_USAGE_HEADER ("iasl [Options] [Files]");
    126      1.1    jruoho 
    127  1.1.1.4  christos     printf ("\nGeneral:\n");
    128  1.1.1.4  christos     ACPI_OPTION ("-@ <file>",       "Specify command file");
    129  1.1.1.4  christos     ACPI_OPTION ("-I <dir>",        "Specify additional include directory");
    130  1.1.1.4  christos     ACPI_OPTION ("-T <sig>|ALL|*",  "Create table template file for ACPI <Sig>");
    131  1.1.1.4  christos     ACPI_OPTION ("-p <prefix>",     "Specify path/filename prefix for all output files");
    132  1.1.1.4  christos     ACPI_OPTION ("-v",              "Display compiler version");
    133  1.1.1.4  christos     ACPI_OPTION ("-vo",             "Enable optimization comments");
    134  1.1.1.4  christos     ACPI_OPTION ("-vs",             "Disable signon");
    135      1.1    jruoho 
    136      1.1    jruoho     printf ("\nHelp:\n");
    137  1.1.1.4  christos     ACPI_OPTION ("-h",              "This message");
    138  1.1.1.4  christos     ACPI_OPTION ("-hc",             "Display operators allowed in constant expressions");
    139  1.1.1.4  christos     ACPI_OPTION ("-hf",             "Display help for output filename generation");
    140  1.1.1.4  christos     ACPI_OPTION ("-hr",             "Display ACPI reserved method names");
    141  1.1.1.4  christos     ACPI_OPTION ("-ht",             "Display currently supported ACPI table names");
    142  1.1.1.4  christos 
    143  1.1.1.4  christos     printf ("\nPreprocessor:\n");
    144  1.1.1.4  christos     ACPI_OPTION ("-D <symbol>",     "Define symbol for preprocessor use");
    145  1.1.1.4  christos     ACPI_OPTION ("-li",             "Create preprocessed output file (*.i)");
    146  1.1.1.4  christos     ACPI_OPTION ("-P",              "Preprocess only and create preprocessor output file (*.i)");
    147  1.1.1.4  christos     ACPI_OPTION ("-Pn",             "Disable preprocessor");
    148  1.1.1.4  christos 
    149  1.1.1.4  christos     printf ("\nErrors, Warnings, and Remarks:\n");
    150  1.1.1.4  christos     ACPI_OPTION ("-va",             "Disable all errors/warnings/remarks");
    151  1.1.1.4  christos     ACPI_OPTION ("-ve",             "Report only errors (ignore warnings and remarks)");
    152  1.1.1.4  christos     ACPI_OPTION ("-vi",             "Less verbose errors and warnings for use with IDEs");
    153  1.1.1.4  christos     ACPI_OPTION ("-vr",             "Disable remarks");
    154  1.1.1.4  christos     ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark");
    155  1.1.1.4  christos     ACPI_OPTION ("-w1 -w2 -w3",     "Set warning reporting level");
    156  1.1.1.4  christos     ACPI_OPTION ("-we",             "Report warnings as errors");
    157  1.1.1.4  christos 
    158  1.1.1.4  christos     printf ("\nAML Code Generation (*.aml):\n");
    159  1.1.1.4  christos     ACPI_OPTION ("-oa",             "Disable all optimizations (compatibility mode)");
    160  1.1.1.4  christos     ACPI_OPTION ("-of",             "Disable constant folding");
    161  1.1.1.4  christos     ACPI_OPTION ("-oi",             "Disable integer optimization to Zero/One/Ones");
    162  1.1.1.4  christos     ACPI_OPTION ("-on",             "Disable named reference string optimization");
    163  1.1.1.4  christos     ACPI_OPTION ("-cr",             "Disable Resource Descriptor error checking");
    164  1.1.1.4  christos     ACPI_OPTION ("-in",             "Ignore NoOp operators");
    165  1.1.1.4  christos     ACPI_OPTION ("-r <revision>",   "Override table header Revision (1-255)");
    166  1.1.1.4  christos 
    167  1.1.1.4  christos     printf ("\nOptional Source Code Output Files:\n");
    168  1.1.1.4  christos     ACPI_OPTION ("-sc -sa",         "Create source file in C or assembler (*.c or *.asm)");
    169  1.1.1.4  christos     ACPI_OPTION ("-ic -ia",         "Create include file in C or assembler (*.h or *.inc)");
    170  1.1.1.4  christos     ACPI_OPTION ("-tc -ta -ts",     "Create hex AML table in C, assembler, or ASL (*.hex)");
    171  1.1.1.4  christos     ACPI_OPTION ("-so",             "Create offset table in C (*.offset.h)");
    172  1.1.1.4  christos 
    173  1.1.1.4  christos     printf ("\nOptional Listing Files:\n");
    174  1.1.1.4  christos     ACPI_OPTION ("-l",              "Create mixed listing file (ASL source and AML) (*.lst)");
    175  1.1.1.5  christos     ACPI_OPTION ("-lm",             "Create hardware summary map file (*.map)");
    176  1.1.1.4  christos     ACPI_OPTION ("-ln",             "Create namespace file (*.nsp)");
    177  1.1.1.4  christos     ACPI_OPTION ("-ls",             "Create combined source file (expanded includes) (*.src)");
    178  1.1.1.4  christos 
    179  1.1.1.4  christos     printf ("\nData Table Compiler:\n");
    180  1.1.1.4  christos     ACPI_OPTION ("-G",              "Compile custom table that contains generic operators");
    181  1.1.1.4  christos     ACPI_OPTION ("-vt",             "Create verbose template files (full disassembly)");
    182  1.1.1.4  christos 
    183  1.1.1.4  christos     printf ("\nAML Disassembler:\n");
    184  1.1.1.4  christos     ACPI_OPTION ("-d  <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
    185  1.1.1.4  christos     ACPI_OPTION ("",                "  (Optional, file type is automatically detected)");
    186  1.1.1.4  christos     ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace");
    187  1.1.1.4  christos     ACPI_OPTION ("-db",             "Do not translate Buffers to Resource Templates");
    188  1.1.1.4  christos     ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
    189  1.1.1.4  christos     ACPI_OPTION ("",                "  (Obtain DSDT from current system if no input file)");
    190  1.1.1.6  christos     ACPI_OPTION ("-df",             "Force disassembler to assume table contains valid AML");
    191  1.1.1.6  christos     ACPI_OPTION ("-dl",             "Emit legacy ASL code only (no C-style operators)");
    192  1.1.1.4  christos     ACPI_OPTION ("-e  <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
    193  1.1.1.4  christos     ACPI_OPTION ("-fe <file>",      "Specify external symbol declaration file");
    194  1.1.1.4  christos     ACPI_OPTION ("-in",             "Ignore NoOp opcodes");
    195  1.1.1.4  christos     ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");
    196  1.1.1.4  christos 
    197  1.1.1.4  christos     printf ("\nDebug Options:\n");
    198  1.1.1.6  christos     ACPI_OPTION ("-bf",             "Create debug file (full output) (*.txt)");
    199  1.1.1.6  christos     ACPI_OPTION ("-bs",             "Create debug file (parse tree only) (*.txt)");
    200  1.1.1.6  christos     ACPI_OPTION ("-bp <depth>",     "Prune ASL parse tree");
    201  1.1.1.6  christos     ACPI_OPTION ("-bt <type>",      "Object type to be pruned from the parse tree");
    202  1.1.1.4  christos     ACPI_OPTION ("-f",              "Ignore errors, force creation of AML output file(s)");
    203  1.1.1.4  christos     ACPI_OPTION ("-m <size>",       "Set internal line buffer size (in Kbytes)");
    204  1.1.1.4  christos     ACPI_OPTION ("-n",              "Parse only, no output generation");
    205  1.1.1.4  christos     ACPI_OPTION ("-ot",             "Display compile times and statistics");
    206  1.1.1.4  christos     ACPI_OPTION ("-x <level>",      "Set debug level for trace output");
    207  1.1.1.4  christos     ACPI_OPTION ("-z",              "Do not insert new compiler ID for DataTables");
    208      1.1    jruoho }
    209      1.1    jruoho 
    210      1.1    jruoho 
    211      1.1    jruoho /*******************************************************************************
    212      1.1    jruoho  *
    213  1.1.1.4  christos  * FUNCTION:    FilenameHelp
    214      1.1    jruoho  *
    215      1.1    jruoho  * PARAMETERS:  None
    216      1.1    jruoho  *
    217      1.1    jruoho  * RETURN:      None
    218      1.1    jruoho  *
    219  1.1.1.4  christos  * DESCRIPTION: Display help message for output filename generation
    220      1.1    jruoho  *
    221      1.1    jruoho  ******************************************************************************/
    222      1.1    jruoho 
    223  1.1.1.4  christos void
    224  1.1.1.4  christos AslFilenameHelp (
    225      1.1    jruoho     void)
    226      1.1    jruoho {
    227      1.1    jruoho 
    228  1.1.1.4  christos     printf ("\nAML output filename generation:\n");
    229      1.1    jruoho     printf ("  Output filenames are generated by appending an extension to a common\n");
    230  1.1.1.4  christos     printf ("  filename prefix. The filename prefix is obtained via one of the\n");
    231      1.1    jruoho     printf ("  following methods (in priority order):\n");
    232      1.1    jruoho     printf ("    1) The -p option specifies the prefix\n");
    233      1.1    jruoho     printf ("    2) The prefix of the AMLFileName in the ASL Definition Block\n");
    234      1.1    jruoho     printf ("    3) The prefix of the input filename\n");
    235      1.1    jruoho     printf ("\n");
    236      1.1    jruoho }
    237      1.1    jruoho 
    238      1.1    jruoho 
    239  1.1.1.4  christos /******************************************************************************
    240      1.1    jruoho  *
    241  1.1.1.4  christos  * FUNCTION:    AslSignalHandler
    242      1.1    jruoho  *
    243  1.1.1.4  christos  * PARAMETERS:  Sig                 - Signal that invoked this handler
    244      1.1    jruoho  *
    245      1.1    jruoho  * RETURN:      None
    246      1.1    jruoho  *
    247  1.1.1.4  christos  * DESCRIPTION: Control-C handler. Delete any intermediate files and any
    248  1.1.1.4  christos  *              output files that may be left in an indeterminate state.
    249      1.1    jruoho  *
    250  1.1.1.4  christos  *****************************************************************************/
    251      1.1    jruoho 
    252  1.1.1.4  christos static void ACPI_SYSTEM_XFACE
    253  1.1.1.4  christos AslSignalHandler (
    254  1.1.1.4  christos     int                     Sig)
    255      1.1    jruoho {
    256  1.1.1.4  christos     UINT32                  i;
    257  1.1.1.4  christos 
    258  1.1.1.4  christos 
    259  1.1.1.4  christos     signal (Sig, SIG_IGN);
    260  1.1.1.4  christos     printf ("Aborting\n\n");
    261  1.1.1.4  christos 
    262  1.1.1.4  christos     /* Close all open files */
    263  1.1.1.4  christos 
    264  1.1.1.7  christos     Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */
    265  1.1.1.4  christos 
    266  1.1.1.4  christos     for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
    267  1.1.1.4  christos     {
    268  1.1.1.4  christos         FlCloseFile (i);
    269  1.1.1.4  christos     }
    270  1.1.1.4  christos 
    271  1.1.1.4  christos     /* Delete any output files */
    272      1.1    jruoho 
    273  1.1.1.4  christos     for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++)
    274  1.1.1.4  christos     {
    275  1.1.1.4  christos         FlDeleteFile (i);
    276  1.1.1.4  christos     }
    277  1.1.1.4  christos 
    278  1.1.1.4  christos     exit (0);
    279      1.1    jruoho }
    280      1.1    jruoho 
    281      1.1    jruoho 
    282      1.1    jruoho /*******************************************************************************
    283      1.1    jruoho  *
    284      1.1    jruoho  * FUNCTION:    AslInitialize
    285      1.1    jruoho  *
    286      1.1    jruoho  * PARAMETERS:  None
    287      1.1    jruoho  *
    288      1.1    jruoho  * RETURN:      None
    289      1.1    jruoho  *
    290      1.1    jruoho  * DESCRIPTION: Initialize compiler globals
    291      1.1    jruoho  *
    292      1.1    jruoho  ******************************************************************************/
    293      1.1    jruoho 
    294      1.1    jruoho static void
    295      1.1    jruoho AslInitialize (
    296      1.1    jruoho     void)
    297      1.1    jruoho {
    298      1.1    jruoho     UINT32                  i;
    299      1.1    jruoho 
    300      1.1    jruoho 
    301      1.1    jruoho     for (i = 0; i < ASL_NUM_FILES; i++)
    302      1.1    jruoho     {
    303      1.1    jruoho         Gbl_Files[i].Handle = NULL;
    304      1.1    jruoho         Gbl_Files[i].Filename = NULL;
    305      1.1    jruoho     }
    306      1.1    jruoho 
    307      1.1    jruoho     Gbl_Files[ASL_FILE_STDOUT].Handle   = stdout;
    308      1.1    jruoho     Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
    309      1.1    jruoho 
    310      1.1    jruoho     Gbl_Files[ASL_FILE_STDERR].Handle   = stderr;
    311      1.1    jruoho     Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
    312      1.1    jruoho }
    313      1.1    jruoho 
    314      1.1    jruoho 
    315      1.1    jruoho /*******************************************************************************
    316      1.1    jruoho  *
    317      1.1    jruoho  * FUNCTION:    main
    318      1.1    jruoho  *
    319      1.1    jruoho  * PARAMETERS:  Standard argc/argv
    320      1.1    jruoho  *
    321      1.1    jruoho  * RETURN:      Program termination code
    322      1.1    jruoho  *
    323      1.1    jruoho  * DESCRIPTION: C main routine for the Asl Compiler. Handle command line
    324      1.1    jruoho  *              options and begin the compile for each file on the command line
    325      1.1    jruoho  *
    326      1.1    jruoho  ******************************************************************************/
    327      1.1    jruoho 
    328      1.1    jruoho int ACPI_SYSTEM_XFACE
    329      1.1    jruoho main (
    330      1.1    jruoho     int                     argc,
    331      1.1    jruoho     char                    **argv)
    332      1.1    jruoho {
    333      1.1    jruoho     ACPI_STATUS             Status;
    334  1.1.1.2    jruoho     int                     Index1;
    335  1.1.1.2    jruoho     int                     Index2;
    336  1.1.1.5  christos     int                     ReturnStatus = 0;
    337  1.1.1.2    jruoho 
    338      1.1    jruoho 
    339  1.1.1.5  christos     /*
    340  1.1.1.5  christos      * Big-endian machines are not currently supported. ACPI tables must
    341  1.1.1.5  christos      * be little-endian, and support for big-endian machines needs to
    342  1.1.1.5  christos      * be implemented.
    343  1.1.1.5  christos      */
    344  1.1.1.5  christos     if (AcpiIsBigEndianMachine ())
    345  1.1.1.5  christos     {
    346  1.1.1.5  christos         fprintf (stderr,
    347  1.1.1.5  christos             "iASL is not currently supported on big-endian machines.\n");
    348  1.1.1.5  christos         return (-1);
    349  1.1.1.5  christos     }
    350  1.1.1.5  christos 
    351  1.1.1.5  christos     AcpiOsInitialize ();
    352  1.1.1.4  christos     ACPI_DEBUG_INITIALIZE (); /* For debug version only */
    353      1.1    jruoho 
    354  1.1.1.4  christos     /* Initialize preprocessor and compiler before command line processing */
    355      1.1    jruoho 
    356  1.1.1.4  christos     signal (SIGINT, AslSignalHandler);
    357  1.1.1.4  christos     AcpiGbl_ExternalFileList = NULL;
    358  1.1.1.4  christos     AcpiDbgLevel = 0;
    359  1.1.1.4  christos     PrInitializePreprocessor ();
    360      1.1    jruoho     AslInitialize ();
    361  1.1.1.4  christos 
    362  1.1.1.2    jruoho     Index1 = Index2 = AslCommandLine (argc, argv);
    363      1.1    jruoho 
    364  1.1.1.4  christos     /* Allocate the line buffer(s), must be after command line */
    365  1.1.1.4  christos 
    366  1.1.1.4  christos     Gbl_LineBufferSize /= 2;
    367  1.1.1.4  christos     UtExpandLineBuffers ();
    368  1.1.1.4  christos 
    369  1.1.1.4  christos     /* Perform global actions first/only */
    370      1.1    jruoho 
    371  1.1.1.2    jruoho     if (Gbl_DisassembleAll)
    372  1.1.1.2    jruoho     {
    373  1.1.1.2    jruoho         while (argv[Index1])
    374  1.1.1.2    jruoho         {
    375  1.1.1.4  christos             Status = AcpiDmAddToExternalFileList (argv[Index1]);
    376  1.1.1.2    jruoho             if (ACPI_FAILURE (Status))
    377  1.1.1.2    jruoho             {
    378  1.1.1.2    jruoho                 return (-1);
    379  1.1.1.2    jruoho             }
    380  1.1.1.2    jruoho 
    381  1.1.1.2    jruoho             Index1++;
    382  1.1.1.2    jruoho         }
    383  1.1.1.2    jruoho     }
    384  1.1.1.2    jruoho 
    385      1.1    jruoho     /* Process each pathname/filename in the list, with possible wildcards */
    386      1.1    jruoho 
    387  1.1.1.2    jruoho     while (argv[Index2])
    388      1.1    jruoho     {
    389  1.1.1.4  christos         /*
    390  1.1.1.4  christos          * If -p not specified, we will use the input filename as the
    391  1.1.1.4  christos          * output filename prefix
    392  1.1.1.4  christos          */
    393  1.1.1.4  christos         if (Gbl_UseDefaultAmlFilename)
    394  1.1.1.4  christos         {
    395  1.1.1.4  christos             Gbl_OutputFilenamePrefix = argv[Index2];
    396  1.1.1.4  christos             UtConvertBackslashes (Gbl_OutputFilenamePrefix);
    397  1.1.1.4  christos         }
    398  1.1.1.4  christos 
    399  1.1.1.4  christos         Status = AslDoOneFile (argv[Index2]);
    400      1.1    jruoho         if (ACPI_FAILURE (Status))
    401      1.1    jruoho         {
    402  1.1.1.5  christos             ReturnStatus = -1;
    403  1.1.1.5  christos             goto CleanupAndExit;
    404      1.1    jruoho         }
    405      1.1    jruoho 
    406  1.1.1.2    jruoho         Index2++;
    407  1.1.1.2    jruoho     }
    408  1.1.1.2    jruoho 
    409  1.1.1.5  christos 
    410  1.1.1.5  christos CleanupAndExit:
    411  1.1.1.5  christos 
    412  1.1.1.5  christos     UtFreeLineBuffers ();
    413  1.1.1.5  christos     AslParserCleanup ();
    414  1.1.1.5  christos 
    415  1.1.1.2    jruoho     if (AcpiGbl_ExternalFileList)
    416  1.1.1.2    jruoho     {
    417  1.1.1.2    jruoho         AcpiDmClearExternalFileList();
    418      1.1    jruoho     }
    419      1.1    jruoho 
    420  1.1.1.5  christos     return (ReturnStatus);
    421      1.1    jruoho }
    422