Rev 1498 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1498 | Rev 2216 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | /****************************************************************************** |
7 | /****************************************************************************** |
8 | * |
8 | * |
9 | * 1. Copyright Notice |
9 | * 1. Copyright Notice |
10 | * |
10 | * |
11 | * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. |
11 | * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. |
12 | * All rights reserved. |
12 | * All rights reserved. |
13 | * |
13 | * |
14 | * 2. License |
14 | * 2. License |
15 | * |
15 | * |
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
Line 117... | Line 117... | ||
117 | #define _DECLARE_GLOBALS |
117 | #define _DECLARE_GLOBALS |
Line 118... | Line 118... | ||
118 | 118 | ||
119 | #include "aslcompiler.h" |
119 | #include "aslcompiler.h" |
- | 120 | #include "acapps.h" |
|
Line 120... | Line 121... | ||
120 | #include "acapps.h" |
121 | #include "acdisasm.h" |
121 | 122 | ||
122 | #ifdef _DEBUG |
123 | #ifdef _DEBUG |
Line 165... | Line 166... | ||
165 | char *Filename); |
166 | char *Filename); |
166 | 167 | ||
Line 167... | Line 168... | ||
167 | 168 | ||
168 | #define ASL_TOKEN_SEPARATORS " \t\n" |
169 | #define ASL_TOKEN_SEPARATORS " \t\n" |
Line 169... | Line 170... | ||
169 | #define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:yz" |
170 | #define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:T:v:w:x:z" |
170 | 171 | ||
171 | 172 | ||
Line 211... | Line 212... | ||
211 | printf (" -on Disable named reference string optimization\n"); |
212 | printf (" -on Disable named reference string optimization\n"); |
212 | printf (" -cr Disable Resource Descriptor error checking\n"); |
213 | printf (" -cr Disable Resource Descriptor error checking\n"); |
213 | printf (" -r |
214 | printf (" -r |
214 | 215 | ||
Line 215... | Line 216... | ||
215 | printf ("\nListings:\n"); |
216 | printf ("\nASL Listing Files:\n"); |
216 | printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n"); |
217 | printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n"); |
217 | printf (" -ln Create namespace file (*.nsp)\n"); |
218 | printf (" -ln Create namespace file (*.nsp)\n"); |
218 | printf (" -ls Create combined source file (expanded includes) (*.src)\n"); |
219 | printf (" -ls Create combined source file (expanded includes) (*.src)\n"); |
Line -... | Line 220... | ||
- | 220 | ||
- | 221 | printf ("\nACPI Data Tables:\n"); |
|
- | 222 | printf (" -T |
|
- | 223 | printf (" -vt Create verbose templates (full disassembly)\n"); |
|
219 | 224 | ||
220 | printf ("\nAML Disassembler:\n"); |
225 | printf ("\nAML Disassembler:\n"); |
- | 226 | printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n"); |
|
221 | printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n"); |
227 | printf (" -da [f1,f2] Disassemble multiple tables from single namespace\n"); |
222 | printf (" -dc [file] Disassemble AML and immediately compile it\n"); |
228 | printf (" -dc [file] Disassemble AML and immediately compile it\n"); |
223 | printf (" (Obtain DSDT from current system if no input file)\n"); |
229 | printf (" (Obtain DSDT from current system if no input file)\n"); |
224 | printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n"); |
230 | printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n"); |
225 | printf (" -2 Emit ACPI 2.0 compatible ASL code\n"); |
231 | printf (" -2 Emit ACPI 2.0 compatible ASL code\n"); |
Line 226... | Line 232... | ||
226 | printf (" -g Get ACPI tables and write to files (*.dat)\n"); |
232 | printf (" -g Get ACPI tables and write to files (*.dat)\n"); |
227 | 233 | ||
228 | printf ("\nHelp:\n"); |
234 | printf ("\nHelp:\n"); |
229 | printf (" -h Additional help and compiler debug options\n"); |
235 | printf (" -h Additional help and compiler debug options\n"); |
- | 236 | printf (" -hc Display operators allowed in constant expressions\n"); |
|
230 | printf (" -hc Display operators allowed in constant expressions\n"); |
237 | printf (" -hr Display ACPI reserved method names\n"); |
Line 231... | Line 238... | ||
231 | printf (" -hr Display ACPI reserved method names\n"); |
238 | printf (" -ht Display currently supported ACPI table names\n"); |
232 | } |
239 | } |
Line 266... | Line 273... | ||
266 | printf (" -f Ignore errors, force creation of AML output file(s)\n"); |
273 | printf (" -f Ignore errors, force creation of AML output file(s)\n"); |
267 | printf (" -n Parse only, no output generation\n"); |
274 | printf (" -n Parse only, no output generation\n"); |
268 | printf (" -ot Display compile times\n"); |
275 | printf (" -ot Display compile times\n"); |
269 | printf (" -x |
276 | printf (" -x |
270 | printf (" -y Temporary: Enable data table compiler\n"); |
277 | printf (" -z Do not insert new compiler ID for DataTables\n"); |
271 | printf (" -z Do not insert new compiler ID for DataTables\n"); |
- | |
272 | } |
278 | } |
273 | 279 | ||
Line 274... | Line 280... | ||
274 | 280 | ||
Line 288... | Line 294... | ||
288 | Usage ( |
294 | Usage ( |
289 | void) |
295 | void) |
290 | { |
296 | { |
291 | 297 | ||
Line -... | Line 298... | ||
- | 298 | printf ("%s\n", ASL_COMPLIANCE); |
|
292 | printf ("Usage: %s [Options] [Files]\n\n", CompilerName); |
299 | printf ("Usage: %s [Options] [Files]\n\n", ASL_INVOCATION_NAME); |
293 | Options (); |
300 | Options (); |
294 | } |
301 | } |
Line 295... | Line 302... | ||
295 | 302 | ||
Line 454... | Line 461... | ||
454 | char **argv, |
461 | char **argv, |
455 | BOOLEAN IsResponseFile) |
462 | BOOLEAN IsResponseFile) |
456 | { |
463 | { |
457 | int j; |
464 | int j; |
458 | 465 | ACPI_STATUS Status; |
|
- | 466 | ||
Line 459... | Line 467... | ||
459 | 467 | ||
Line 460... | Line 468... | ||
460 | /* Get the command line options */ |
468 | /* Get the command line options */ |
Line 487... | Line 495... | ||
487 | switch (AcpiGbl_Optarg[0]) |
495 | switch (AcpiGbl_Optarg[0]) |
488 | { |
496 | { |
489 | case 'b': |
497 | case 'b': |
490 | AslCompilerdebug = 1; /* same as yydebug */ |
498 | AslCompilerdebug = 1; /* same as yydebug */ |
- | 499 | DtParserdebug = 1; |
|
491 | break; |
500 | break; |
Line 492... | Line 501... | ||
492 | 501 | ||
493 | case 'p': |
502 | case 'p': |
- | 503 | AslCompilerdebug = 1; /* same as yydebug */ |
|
494 | AslCompilerdebug = 1; /* same as yydebug */ |
504 | DtParserdebug = 1; |
Line 495... | Line 505... | ||
495 | break; |
505 | break; |
496 | 506 | ||
Line 528... | Line 538... | ||
528 | case '^': |
538 | case '^': |
529 | Gbl_DoCompile = FALSE; |
539 | Gbl_DoCompile = FALSE; |
530 | break; |
540 | break; |
531 | 541 | ||
Line -... | Line 542... | ||
- | 542 | case 'a': |
|
- | 543 | Gbl_DoCompile = FALSE; |
|
- | 544 | Gbl_DisassembleAll = TRUE; |
|
- | 545 | break; |
|
- | 546 | ||
532 | case 'c': |
547 | case 'c': |
533 | break; |
548 | break; |
Line 534... | Line 549... | ||
534 | 549 | ||
535 | default: |
550 | default: |
Line 541... | Line 556... | ||
541 | break; |
556 | break; |
542 | 557 | ||
Line 543... | Line 558... | ||
543 | 558 | ||
544 | case 'e': |
559 | case 'e': |
- | 560 | Status = AcpiDmAddToExternalFileList (AcpiGbl_Optarg); |
|
- | 561 | if (ACPI_FAILURE (Status)) |
|
- | 562 | { |
|
- | 563 | printf ("Could not add %s to external list\n", AcpiGbl_Optarg); |
|
- | 564 | return (-1); |
|
545 | Gbl_ExternalFilename = AcpiGbl_Optarg; |
565 | } |
Line 546... | Line 566... | ||
546 | break; |
566 | break; |
Line 580... | Line 600... | ||
580 | 600 | ||
Line 581... | Line 601... | ||
581 | ApDisplayReservedNames (); |
601 | ApDisplayReservedNames (); |
582 | exit (0); |
602 | exit (0); |
Line -... | Line 603... | ||
- | 603 | ||
- | 604 | case 't': |
|
- | 605 | UtDisplaySupportedTables (); |
|
- | 606 | exit (0); |
|
583 | 607 | ||
584 | default: |
608 | default: |
585 | printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); |
609 | printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); |
586 | return (-1); |
610 | return (-1); |
587 | } |
- | |
Line 588... | Line 611... | ||
588 | break; |
611 | } |
Line 589... | Line 612... | ||
589 | 612 | ||
Line 767... | Line 790... | ||
767 | } |
790 | } |
768 | break; |
791 | break; |
769 | 792 | ||
Line -... | Line 793... | ||
- | 793 | ||
- | 794 | case 'T': |
|
- | 795 | Gbl_DoTemplates = TRUE; |
|
- | 796 | Gbl_TemplateSignature = AcpiGbl_Optarg; |
|
- | 797 | break; |
|
- | 798 | ||
770 | 799 | ||
Line 771... | Line 800... | ||
771 | case 'v': |
800 | case 'v': |
772 | 801 | ||
773 | switch (AcpiGbl_Optarg[0]) |
802 | switch (AcpiGbl_Optarg[0]) |
Line 795... | Line 824... | ||
795 | case 's': |
824 | case 's': |
796 | Gbl_DoSignon = FALSE; |
825 | Gbl_DoSignon = FALSE; |
797 | break; |
826 | break; |
Line -... | Line 827... | ||
- | 827 | ||
- | 828 | case 't': |
|
- | 829 | Gbl_VerboseTemplates = TRUE; |
|
- | 830 | break; |
|
798 | 831 | ||
799 | default: |
832 | default: |
800 | printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); |
833 | printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); |
801 | return (-1); |
834 | return (-1); |
802 | } |
835 | } |
Line 831... | Line 864... | ||
831 | AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16); |
864 | AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16); |
832 | break; |
865 | break; |
Line 833... | Line -... | ||
833 | - | ||
834 | - | ||
835 | case 'y': |
- | |
836 | - | ||
837 | Gbl_DataTableCompilerAvailable = TRUE; |
- | |
838 | break; |
- | |
839 | 866 | ||
Line 840... | Line 867... | ||
840 | 867 | ||
841 | case 'z': |
868 | case 'z': |
Line 870... | Line 897... | ||
870 | int argc, |
897 | int argc, |
871 | char **argv) |
898 | char **argv) |
872 | { |
899 | { |
873 | int BadCommandLine = 0; |
900 | int BadCommandLine = 0; |
874 | 901 | ACPI_STATUS Status; |
|
- | 902 | ||
Line 875... | Line 903... | ||
875 | 903 | ||
Line 876... | Line 904... | ||
876 | /* Minimum command line contains at least the command and an input file */ |
904 | /* Minimum command line contains at least the command and an input file */ |
877 | 905 | ||
878 | if (argc < 2) |
906 | if (argc < 2) |
879 | { |
907 | { |
880 | AslCompilerSignon (ASL_FILE_STDOUT); |
908 | printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); |
881 | Usage (); |
909 | Usage (); |
Line 882... | Line 910... | ||
882 | exit (1); |
910 | exit (1); |
Line 883... | Line 911... | ||
883 | } |
911 | } |
Line -... | Line 912... | ||
- | 912 | ||
- | 913 | /* Process all command line options */ |
|
- | 914 | ||
- | 915 | BadCommandLine = AslDoOptions (argc, argv, FALSE); |
|
- | 916 | ||
- | 917 | if (Gbl_DoTemplates) |
|
- | 918 | { |
|
- | 919 | Status = DtCreateTemplates (Gbl_TemplateSignature); |
|
- | 920 | if (ACPI_FAILURE (Status)) |
|
- | 921 | { |
|
884 | 922 | exit (-1); |
|
Line 885... | Line 923... | ||
885 | /* Process all command line options */ |
923 | } |
886 | 924 | exit (1); |
|
887 | BadCommandLine = AslDoOptions (argc, argv, FALSE); |
925 | } |
Line 897... | Line 935... | ||
897 | } |
935 | } |
898 | 936 | ||
Line 899... | Line 937... | ||
899 | if (Gbl_DoSignon) |
937 | if (Gbl_DoSignon) |
900 | { |
938 | { |
901 | AslCompilerSignon (ASL_FILE_STDOUT); |
939 | printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); |
902 | } |
940 | } |
Line 903... | Line 941... | ||
903 | 941 | ||
Line 904... | Line 942... | ||
904 | /* Abort if anything went wrong on the command line */ |
942 | /* Abort if anything went wrong on the command line */ |
Line 932... | Line 970... | ||
932 | int argc, |
970 | int argc, |
933 | char **argv) |
971 | char **argv) |
934 | { |
972 | { |
935 | ACPI_STATUS Status; |
973 | ACPI_STATUS Status; |
936 | int Index; |
974 | int Index1; |
- | 975 | int Index2; |
|
937 | 976 | ||
Line -... | Line 977... | ||
- | 977 | ||
- | 978 | AcpiGbl_ExternalFileList = NULL; |
|
938 | 979 | ||
939 | #ifdef _DEBUG |
980 | #ifdef _DEBUG |
940 | _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | |
981 | _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | |
941 | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); |
982 | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); |
Line 942... | Line 983... | ||
942 | #endif |
983 | #endif |
Line 943... | Line 984... | ||
943 | 984 | ||
944 | /* Init and command line */ |
985 | /* Init and command line */ |
Line 945... | Line 986... | ||
945 | 986 | ||
Line 946... | Line 987... | ||
946 | AslInitialize (); |
987 | AslInitialize (); |
947 | Index = AslCommandLine (argc, argv); |
988 | Index1 = Index2 = AslCommandLine (argc, argv); |
Line 957... | Line 998... | ||
957 | } |
998 | } |
958 | return (0); |
999 | return (0); |
959 | } |
1000 | } |
960 | 1001 | ||
Line -... | Line 1002... | ||
- | 1002 | if (Gbl_DisassembleAll) |
|
- | 1003 | { |
|
- | 1004 | while (argv[Index1]) |
|
- | 1005 | { |
|
- | 1006 | Status = AslDoOnePathname (argv[Index1], AcpiDmAddToExternalFileList); |
|
- | 1007 | if (ACPI_FAILURE (Status)) |
|
- | 1008 | { |
|
- | 1009 | return (-1); |
|
- | 1010 | } |
|
- | 1011 | ||
- | 1012 | Index1++; |
|
- | 1013 | } |
|
- | 1014 | } |
|
- | 1015 | ||
961 | /* Process each pathname/filename in the list, with possible wildcards */ |
1016 | /* Process each pathname/filename in the list, with possible wildcards */ |
Line 962... | Line 1017... | ||
962 | 1017 | ||
963 | while (argv[Index]) |
1018 | while (argv[Index2]) |
964 | { |
1019 | { |
965 | Status = AslDoOnePathname (argv[Index]); |
1020 | Status = AslDoOnePathname (argv[Index2], AslDoOneFile); |
966 | if (ACPI_FAILURE (Status)) |
1021 | if (ACPI_FAILURE (Status)) |
967 | { |
1022 | { |
968 | return (-1); |
1023 | return (-1); |
Line 969... | Line 1024... | ||
969 | } |
1024 | } |
- | 1025 | ||
- | 1026 | Index2++; |
|
- | 1027 | } |
|
- | 1028 | ||
- | 1029 | if (AcpiGbl_ExternalFileList) |
|
970 | 1030 | { |
|
Line 971... | Line 1031... | ||
971 | Index++; |
1031 | AcpiDmClearExternalFileList(); |
972 | } |
1032 | } |