xref: /freebsd/sys/contrib/dev/acpica/compiler/aslmain.c (revision 87569f75a91f298c52a71823c04d41cf53c88889)
1 
2 /******************************************************************************
3  *
4  * Module Name: aslmain - compiler main and utilities
5  *              $Revision: 1.87 $
6  *
7  *****************************************************************************/
8 
9 /******************************************************************************
10  *
11  * 1. Copyright Notice
12  *
13  * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
14  * All rights reserved.
15  *
16  * 2. License
17  *
18  * 2.1. This is your license from Intel Corp. under its intellectual property
19  * rights.  You may have additional license terms from the party that provided
20  * you this software, covering your right to use that party's intellectual
21  * property rights.
22  *
23  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24  * copy of the source code appearing in this file ("Covered Code") an
25  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26  * base code distributed originally by Intel ("Original Intel Code") to copy,
27  * make derivatives, distribute, use and display any portion of the Covered
28  * Code in any form, with the right to sublicense such rights; and
29  *
30  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31  * license (with the right to sublicense), under only those claims of Intel
32  * patents that are infringed by the Original Intel Code, to make, use, sell,
33  * offer to sell, and import the Covered Code and derivative works thereof
34  * solely to the minimum extent necessary to exercise the above copyright
35  * license, and in no event shall the patent license extend to any additions
36  * to or modifications of the Original Intel Code.  No other license or right
37  * is granted directly or by implication, estoppel or otherwise;
38  *
39  * The above copyright and patent license is granted only if the following
40  * conditions are met:
41  *
42  * 3. Conditions
43  *
44  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45  * Redistribution of source code of any substantial portion of the Covered
46  * Code or modification with rights to further distribute source must include
47  * the above Copyright Notice, the above License, this list of Conditions,
48  * and the following Disclaimer and Export Compliance provision.  In addition,
49  * Licensee must cause all Covered Code to which Licensee contributes to
50  * contain a file documenting the changes Licensee made to create that Covered
51  * Code and the date of any change.  Licensee must include in that file the
52  * documentation of any changes made by any predecessor Licensee.  Licensee
53  * must include a prominent statement that the modification is derived,
54  * directly or indirectly, from Original Intel Code.
55  *
56  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57  * Redistribution of source code of any substantial portion of the Covered
58  * Code or modification without rights to further distribute source must
59  * include the following Disclaimer and Export Compliance provision in the
60  * documentation and/or other materials provided with distribution.  In
61  * addition, Licensee may not authorize further sublicense of source of any
62  * portion of the Covered Code, and must include terms to the effect that the
63  * license from Licensee to its licensee is limited to the intellectual
64  * property embodied in the software Licensee provides to its licensee, and
65  * not to intellectual property embodied in modifications its licensee may
66  * make.
67  *
68  * 3.3. Redistribution of Executable. Redistribution in executable form of any
69  * substantial portion of the Covered Code or modification must reproduce the
70  * above Copyright Notice, and the following Disclaimer and Export Compliance
71  * provision in the documentation and/or other materials provided with the
72  * distribution.
73  *
74  * 3.4. Intel retains all right, title, and interest in and to the Original
75  * Intel Code.
76  *
77  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78  * Intel shall be used in advertising or otherwise to promote the sale, use or
79  * other dealings in products derived from or relating to the Covered Code
80  * without prior written authorization from Intel.
81  *
82  * 4. Disclaimer and Export Compliance
83  *
84  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90  * PARTICULAR PURPOSE.
91  *
92  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99  * LIMITED REMEDY.
100  *
101  * 4.3. Licensee shall not export, either directly or indirectly, any of this
102  * software or system incorporating such software without first obtaining any
103  * required license or other approval from the U. S. Department of Commerce or
104  * any other agency or department of the United States Government.  In the
105  * event Licensee exports any such software from the United States or
106  * re-exports any such software from a foreign destination, Licensee shall
107  * ensure that the distribution and export/re-export of the software is in
108  * compliance with all laws, regulations, orders, or other restrictions of the
109  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110  * any of its subsidiaries will export/re-export any technical data, process,
111  * software, or service, directly or indirectly, to any country for which the
112  * United States government or any agency thereof requires an export license,
113  * other governmental approval, or letter of assurance, without first obtaining
114  * such license, approval or letter.
115  *
116  *****************************************************************************/
117 
118 
119 #define _DECLARE_GLOBALS
120 
121 #include <contrib/dev/acpica/compiler/aslcompiler.h>
122 #include <contrib/dev/acpica/acnamesp.h>
123 #include <contrib/dev/acpica/acapps.h>
124 
125 #ifdef _DEBUG
126 #include <crtdbg.h>
127 #endif
128 
129 #define _COMPONENT          ACPI_COMPILER
130         ACPI_MODULE_NAME    ("aslmain")
131 
132 BOOLEAN                 AslToFile = TRUE;
133 BOOLEAN                 DoCompile = TRUE;
134 BOOLEAN                 DoSignon = TRUE;
135 
136 char                    hex[] =
137 {
138     '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
139 };
140 
141 /* Local prototypes */
142 
143 static void
144 Options (
145     void);
146 
147 static void
148 HelpMessage (
149     void);
150 
151 static void
152 Usage (
153     void);
154 
155 static void
156 AslInitialize (
157     void);
158 
159 static void
160 AslCommandLine (
161     int                     argc,
162     char                    **argv);
163 
164 #ifdef _DEBUG
165 #if ACPI_MACHINE_WIDTH != 16
166 #include <crtdbg.h>
167 #endif
168 #endif
169 
170 /*******************************************************************************
171  *
172  * FUNCTION:    Options
173  *
174  * PARAMETERS:  None
175  *
176  * RETURN:      None
177  *
178  * DESCRIPTION: Display option help message
179  *
180  ******************************************************************************/
181 
182 static void
183 Options (
184     void)
185 {
186 
187     printf ("General Output:\n");
188     printf ("  -p <prefix>    Specify filename prefix for all output files (including .aml)\n");
189     printf ("  -vi            Less verbose errors and warnings for use with IDEs\n");
190     printf ("  -vo            Enable optimization comments\n");
191     printf ("  -vr            Disable remarks\n");
192     printf ("  -vs            Disable signon\n");
193 
194     printf ("\nAML Output Files:\n");
195     printf ("  -s<a|c>        Create AML in assembler or C source file (*.asm or *.c)\n");
196     printf ("  -i<a|c>        Create assembler or C include file (*.inc or *.h)\n");
197     printf ("  -t<a|c>        Create AML in assembler or C hex table (*.hex)\n");
198 
199     printf ("\nAML Code Generation:\n");
200     printf ("  -oa            Disable all optimizations (compatibility mode)\n");
201     printf ("  -of            Disable constant folding\n");
202     printf ("  -oi            Disable integer optimization to Zero/One/Ones\n");
203     printf ("  -on            Disable named reference string optimization\n");
204     printf ("  -r<Revision>   Override table header Revision (1-255)\n");
205 
206     printf ("\nListings:\n");
207     printf ("  -l             Create mixed listing file (ASL source and AML) (*.lst)\n");
208     printf ("  -ln            Create namespace file (*.nsp)\n");
209     printf ("  -ls            Create combined source file (expanded includes) (*.src)\n");
210 
211     printf ("\nAML Disassembler:\n");
212     printf ("  -d  [file]     Disassemble AML to ASL source code file (*.dsl)\n");
213     printf ("  -dc [file]     Disassemble AML and immediately compile it\n");
214     printf ("                 (Obtain DSDT from current system if no input file)\n");
215     printf ("  -2             Emit ACPI 2.0 compatible ASL code\n");
216     printf ("  -e             Generate External() statements for unresolved symbols\n");
217     printf ("  -g             Get ACPI tables and write to files (*.dat)\n");
218 
219     printf ("\nMiscellaneous:\n");
220     printf ("  -a             Verify source file is entirely ASCII text (0x00-0x7F)\n");
221 
222     printf ("\nHelp:\n");
223     printf ("  -h             Additional help and compiler debug options\n");
224     printf ("  -hc            Display operators allowed in constant expressions\n");
225     printf ("  -hr            Display ACPI reserved method names\n");
226 }
227 
228 
229 /*******************************************************************************
230  *
231  * FUNCTION:    HelpMessage
232  *
233  * PARAMETERS:  None
234  *
235  * RETURN:      None
236  *
237  * DESCRIPTION: Display help message
238  *
239  ******************************************************************************/
240 
241 static void
242 HelpMessage (
243     void)
244 {
245 
246     printf ("AML output filename generation:\n");
247     printf ("  Output filenames are generated by appending an extension to a common\n");
248     printf ("  filename prefix.  The filename prefix is obtained via one of the\n");
249     printf ("  following methods (in priority order):\n");
250     printf ("    1) The -p option specifies the prefix\n");
251     printf ("    2) The prefix of the AMLFileName in the ASL Definition Block\n");
252     printf ("    3) The prefix of the input filename\n");
253     printf ("\n");
254 
255     Options ();
256 
257     printf ("\nCompiler Debug Options:\n");
258     printf ("  -b<p|t|b>      Create compiler debug/trace file (*.txt)\n");
259     printf ("                   Types: Parse/Tree/Both\n");
260     printf ("  -f             Ignore errors, force creation of AML output file(s)\n");
261     printf ("  -c             Parse only, no output generation\n");
262     printf ("  -ot            Display compile times\n");
263     printf ("  -x<level>      Set debug level for trace output\n");
264 }
265 
266 
267 /*******************************************************************************
268  *
269  * FUNCTION:    Usage
270  *
271  * PARAMETERS:  None
272  *
273  * RETURN:      None
274  *
275  * DESCRIPTION: Display usage and option message
276  *
277  ******************************************************************************/
278 
279 static void
280 Usage (
281     void)
282 {
283 
284     printf ("Usage:    %s [Options] [InputFile]\n\n", CompilerName);
285     Options ();
286 }
287 
288 
289 /*******************************************************************************
290  *
291  * FUNCTION:    AslInitialize
292  *
293  * PARAMETERS:  None
294  *
295  * RETURN:      None
296  *
297  * DESCRIPTION: Initialize compiler globals
298  *
299  ******************************************************************************/
300 
301 static void
302 AslInitialize (
303     void)
304 {
305     UINT32                  i;
306 
307 
308 #ifdef _DEBUG
309     _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0));
310 #endif
311 
312     AcpiDbgLevel = 0;
313 
314     for (i = 0; i < ASL_NUM_FILES; i++)
315     {
316         Gbl_Files[i].Handle = NULL;
317         Gbl_Files[i].Filename = NULL;
318     }
319 
320     Gbl_Files[ASL_FILE_STDOUT].Handle   = stdout;
321     Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
322 
323     Gbl_Files[ASL_FILE_STDERR].Handle   = stderr;
324     Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
325 }
326 
327 
328 /*******************************************************************************
329  *
330  * FUNCTION:    AslCommandLine
331  *
332  * PARAMETERS:  argc/argv
333  *
334  * RETURN:      None
335  *
336  * DESCRIPTION: Command line processing
337  *
338  ******************************************************************************/
339 
340 static void
341 AslCommandLine (
342     int                     argc,
343     char                    **argv)
344 {
345     BOOLEAN                 BadCommandLine = FALSE;
346     ACPI_NATIVE_INT         j;
347 
348 
349     /* Minimum command line contains at least one option or an input file */
350 
351     if (argc < 2)
352     {
353         AslCompilerSignon (ASL_FILE_STDOUT);
354         Usage ();
355         exit (1);
356     }
357 
358     /* Get the command line options */
359 
360     while ((j = AcpiGetopt (argc, argv, "2ab:cd^efgh^i^l^o:p:r:s:t:v:x:")) != EOF) switch (j)
361     {
362     case '2':
363         Gbl_Acpi2 = TRUE;
364         break;
365 
366 
367     case 'a':
368         Gbl_CheckForAscii = TRUE;
369         break;
370 
371 
372     case 'b':
373 
374         switch (AcpiGbl_Optarg[0])
375         {
376         case 'b':
377             AslCompilerdebug = 1; /* same as yydebug */
378             break;
379 
380         case 'p':
381             AslCompilerdebug = 1; /* same as yydebug */
382             break;
383 
384         case 't':
385             break;
386 
387         default:
388             printf ("Unknown option: -b%s\n", AcpiGbl_Optarg);
389             BadCommandLine = TRUE;
390             break;
391         }
392 
393         /* Produce debug output file */
394 
395         Gbl_DebugFlag = TRUE;
396         break;
397 
398 
399     case 'c':
400 
401         /* Parse only */
402 
403         Gbl_ParseOnlyFlag = TRUE;
404         break;
405 
406 
407     case 'd':
408         switch (AcpiGbl_Optarg[0])
409         {
410         case '^':
411             DoCompile = FALSE;
412             break;
413 
414         case 'c':
415             break;
416 
417         default:
418             printf ("Unknown option: -d%s\n", AcpiGbl_Optarg);
419             BadCommandLine = TRUE;
420             break;
421         }
422 
423         Gbl_DisasmFlag = TRUE;
424         break;
425 
426 
427     case 'e':
428 
429         /* Generate external statements for unresolved symbols */
430 
431         Gbl_GenerateExternals = TRUE;
432         break;
433 
434 
435     case 'f':
436 
437         /* Ignore errors and force creation of aml file */
438 
439         Gbl_IgnoreErrors = TRUE;
440         break;
441 
442 
443     case 'g':
444 
445         /* Get all ACPI tables */
446 
447         Gbl_GetAllTables = TRUE;
448         DoCompile = FALSE;
449         break;
450 
451 
452     case 'h':
453 
454         switch (AcpiGbl_Optarg[0])
455         {
456         case '^':
457             HelpMessage ();
458             exit (0);
459 
460         case 'c':
461             UtDisplayConstantOpcodes ();
462             exit (0);
463 
464         case 'r':
465             /* reserved names */
466 
467             MpDisplayReservedNames ();
468             exit (0);
469 
470         default:
471             printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
472             BadCommandLine = TRUE;
473             break;
474         }
475         break;
476 
477 
478     case 'i':
479 
480         switch (AcpiGbl_Optarg[0])
481         {
482         case 'a':
483 
484             /* Produce assembly code include file */
485 
486             Gbl_AsmIncludeOutputFlag = TRUE;
487             break;
488 
489         case 'c':
490 
491             /* Produce C include file */
492 
493             Gbl_C_IncludeOutputFlag = TRUE;
494             break;
495 
496         default:
497             printf ("Unknown option: -s%s\n", AcpiGbl_Optarg);
498             BadCommandLine = TRUE;
499             break;
500         }
501         break;
502 
503 
504     case 'l':
505 
506         switch (AcpiGbl_Optarg[0])
507         {
508         case '^':
509             /* Produce listing file (Mixed source/aml) */
510 
511             Gbl_ListingFlag = TRUE;
512             break;
513 
514         case 'n':
515             /* Produce namespace file */
516 
517             Gbl_NsOutputFlag = TRUE;
518             break;
519 
520         case 's':
521             /* Produce combined source file */
522 
523             Gbl_SourceOutputFlag = TRUE;
524             break;
525 
526         default:
527             printf ("Unknown option: -l%s\n", AcpiGbl_Optarg);
528             BadCommandLine = TRUE;
529             break;
530         }
531         break;
532 
533 
534     case 'o':
535 
536         switch (AcpiGbl_Optarg[0])
537         {
538         case 'a':
539 
540             /* Disable all optimizations */
541 
542             Gbl_FoldConstants = FALSE;
543             Gbl_IntegerOptimizationFlag = FALSE;
544             Gbl_ReferenceOptimizationFlag = FALSE;
545             break;
546 
547         case 'f':
548 
549             /* Disable folding on "normal" expressions */
550 
551             Gbl_FoldConstants = FALSE;
552             break;
553 
554         case 'i':
555 
556             /* Disable integer optimization to constants */
557 
558             Gbl_IntegerOptimizationFlag = FALSE;
559             break;
560 
561         case 'n':
562 
563             /* Disable named reference optimization */
564 
565             Gbl_ReferenceOptimizationFlag = FALSE;
566             break;
567 
568         case 't':
569 
570             /* Display compile time(s) */
571 
572             Gbl_CompileTimesFlag = TRUE;
573             break;
574 
575         default:
576             printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
577             BadCommandLine = TRUE;
578             break;
579         }
580         break;
581 
582 
583     case 'p':
584 
585         /* Override default AML output filename */
586 
587         Gbl_OutputFilenamePrefix = AcpiGbl_Optarg;
588         Gbl_UseDefaultAmlFilename = FALSE;
589         break;
590 
591 
592     case 'r':
593         Gbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
594         break;
595 
596 
597     case 's':
598 
599         switch (AcpiGbl_Optarg[0])
600         {
601         case 'a':
602 
603             /* Produce assembly code output file */
604 
605             Gbl_AsmOutputFlag = TRUE;
606             break;
607 
608         case 'c':
609 
610             /* Produce C hex output file */
611 
612             Gbl_C_OutputFlag = TRUE;
613             break;
614 
615         default:
616             printf ("Unknown option: -s%s\n", AcpiGbl_Optarg);
617             BadCommandLine = TRUE;
618             break;
619         }
620         break;
621 
622 
623     case 't':
624 
625         /* Produce hex table output file */
626 
627         switch (AcpiGbl_Optarg[0])
628         {
629         case 'a':
630             Gbl_HexOutputFlag = HEX_OUTPUT_ASM;
631             break;
632 
633         case 'c':
634             Gbl_HexOutputFlag = HEX_OUTPUT_C;
635             break;
636 
637         default:
638             printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
639             BadCommandLine = TRUE;
640             break;
641         }
642         break;
643 
644 
645     case 'v':
646 
647         switch (AcpiGbl_Optarg[0])
648         {
649         case 'i':
650             /* Less verbose error messages */
651 
652             Gbl_VerboseErrors = FALSE;
653             break;
654 
655         case 'o':
656             Gbl_DisplayOptimizations = TRUE;
657             break;
658 
659         case 'r':
660             Gbl_DisplayRemarks = FALSE;
661             break;
662 
663         case 's':
664             DoSignon = FALSE;
665             break;
666 
667         default:
668             printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
669             BadCommandLine = TRUE;
670             break;
671         }
672         break;
673 
674 
675     case 'x':
676 
677         AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16);
678         break;
679 
680 
681     default:
682 
683         BadCommandLine = TRUE;
684         break;
685     }
686 
687     /* Next parameter must be the input filename */
688 
689     Gbl_Files[ASL_FILE_INPUT].Filename = argv[AcpiGbl_Optind];
690 
691     if (!Gbl_Files[ASL_FILE_INPUT].Filename &&
692         !Gbl_DisasmFlag &&
693         !Gbl_GetAllTables)
694     {
695         printf ("Missing input filename\n");
696         BadCommandLine = TRUE;
697     }
698 
699     if (DoSignon)
700     {
701         AslCompilerSignon (ASL_FILE_STDOUT);
702     }
703 
704     /* Abort if anything went wrong on the command line */
705 
706     if (BadCommandLine)
707     {
708         printf ("\n");
709         Usage ();
710         exit (1);
711     }
712 
713     if ((AcpiGbl_Optind + 1) < argc)
714     {
715         printf ("Warning: extra arguments (%d) after input filename are ignored\n\n",
716             argc - AcpiGbl_Optind - 1);
717     }
718 }
719 
720 
721 /*******************************************************************************
722  *
723  * FUNCTION:    main
724  *
725  * PARAMETERS:  Standard argc/argv
726  *
727  * RETURN:      Program termination code
728  *
729  * DESCRIPTION: C main routine for the Asl Compiler.  Handle command line
730  *              options and begin the compile.
731  *
732  ******************************************************************************/
733 
734 int ACPI_SYSTEM_XFACE
735 main (
736     int                     argc,
737     char                    **argv)
738 {
739     ACPI_STATUS             Status;
740     char                    *Prefix;
741 
742 
743 #ifdef _DEBUG
744 #if ACPI_MACHINE_WIDTH != 16
745     _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF |
746                     _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
747 #endif
748 #endif
749 
750     /* Init and command line */
751 
752     AslInitialize ();
753     AslCommandLine (argc, argv);
754 
755     /*
756      * If -p not specified, we will use the input filename as the
757      * output filename prefix
758      */
759     Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
760         &Gbl_DirectoryPath, &Prefix);
761     if (ACPI_FAILURE (Status))
762     {
763         return -1;
764     }
765 
766     if (Gbl_UseDefaultAmlFilename)
767     {
768         Gbl_OutputFilenamePrefix = Prefix;
769     }
770 
771     /* AML Disassembly (Optional) */
772 
773     if (Gbl_DisasmFlag || Gbl_GetAllTables)
774     {
775         /* ACPI CA subsystem initialization */
776 
777         Status = AcpiOsInitialize ();
778         AcpiUtInitGlobals ();
779         Status = AcpiUtMutexInitialize ();
780         if (ACPI_FAILURE (Status))
781         {
782             return -1;
783         }
784 
785         Status = AcpiNsRootInitialize ();
786         if (ACPI_FAILURE (Status))
787         {
788             return -1;
789         }
790 
791         /* This is where the disassembly happens */
792 
793         AcpiGbl_DbOpt_disasm = TRUE;
794         Status = AdAmlDisassemble (AslToFile,
795                         Gbl_Files[ASL_FILE_INPUT].Filename,
796                         Gbl_OutputFilenamePrefix,
797                         &Gbl_Files[ASL_FILE_INPUT].Filename,
798                         Gbl_GetAllTables);
799         if (ACPI_FAILURE (Status))
800         {
801             return -1;
802         }
803 
804         /*
805          * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the
806          * .DSL disassembly file, which can now be compiled if requested
807          */
808         if (DoCompile)
809         {
810             AcpiOsPrintf ("\nCompiling \"%s\"\n",
811                 Gbl_Files[ASL_FILE_INPUT].Filename);
812         }
813     }
814 
815     /*
816      * ASL Compilation (Optional)
817      */
818     if (DoCompile)
819     {
820         /*
821          * If -p not specified, we will use the input filename as the
822          * output filename prefix
823          */
824         Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
825             &Gbl_DirectoryPath, &Prefix);
826         if (ACPI_FAILURE (Status))
827         {
828             return -1;
829         }
830 
831         if (Gbl_UseDefaultAmlFilename)
832         {
833             Gbl_OutputFilenamePrefix = Prefix;
834         }
835 
836         /* ACPI CA subsystem initialization (Must be re-initialized) */
837 
838         Status = AcpiOsInitialize ();
839         AcpiUtInitGlobals ();
840         Status = AcpiUtMutexInitialize ();
841         if (ACPI_FAILURE (Status))
842         {
843             return -1;
844         }
845 
846         Status = AcpiNsRootInitialize ();
847         if (ACPI_FAILURE (Status))
848         {
849             return -1;
850         }
851         Status = CmDoCompile ();
852     }
853 
854     return (0);
855 }
856 
857 
858