1a9d8d09cSJung-uk Kim /****************************************************************************** 2a9d8d09cSJung-uk Kim * 3a9d8d09cSJung-uk Kim * Module Name: asloptions - compiler command line processing 4a9d8d09cSJung-uk Kim * 5a9d8d09cSJung-uk Kim *****************************************************************************/ 6a9d8d09cSJung-uk Kim 7a9d8d09cSJung-uk Kim /* 8f8146b88SJung-uk Kim * Copyright (C) 2000 - 2016, Intel Corp. 9a9d8d09cSJung-uk Kim * All rights reserved. 10a9d8d09cSJung-uk Kim * 11a9d8d09cSJung-uk Kim * Redistribution and use in source and binary forms, with or without 12a9d8d09cSJung-uk Kim * modification, are permitted provided that the following conditions 13a9d8d09cSJung-uk Kim * are met: 14a9d8d09cSJung-uk Kim * 1. Redistributions of source code must retain the above copyright 15a9d8d09cSJung-uk Kim * notice, this list of conditions, and the following disclaimer, 16a9d8d09cSJung-uk Kim * without modification. 17a9d8d09cSJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18a9d8d09cSJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below 19a9d8d09cSJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon 20a9d8d09cSJung-uk Kim * including a substantially similar Disclaimer requirement for further 21a9d8d09cSJung-uk Kim * binary redistribution. 22a9d8d09cSJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names 23a9d8d09cSJung-uk Kim * of any contributors may be used to endorse or promote products derived 24a9d8d09cSJung-uk Kim * from this software without specific prior written permission. 25a9d8d09cSJung-uk Kim * 26a9d8d09cSJung-uk Kim * Alternatively, this software may be distributed under the terms of the 27a9d8d09cSJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free 28a9d8d09cSJung-uk Kim * Software Foundation. 29a9d8d09cSJung-uk Kim * 30a9d8d09cSJung-uk Kim * NO WARRANTY 31a9d8d09cSJung-uk Kim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32a9d8d09cSJung-uk Kim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33a9d8d09cSJung-uk Kim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34a9d8d09cSJung-uk Kim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35a9d8d09cSJung-uk Kim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36a9d8d09cSJung-uk Kim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37a9d8d09cSJung-uk Kim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38a9d8d09cSJung-uk Kim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39a9d8d09cSJung-uk Kim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40a9d8d09cSJung-uk Kim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41a9d8d09cSJung-uk Kim * POSSIBILITY OF SUCH DAMAGES. 42a9d8d09cSJung-uk Kim */ 43a9d8d09cSJung-uk Kim 44a9d8d09cSJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h> 45a9d8d09cSJung-uk Kim #include <contrib/dev/acpica/include/acapps.h> 46a9d8d09cSJung-uk Kim #include <contrib/dev/acpica/include/acdisasm.h> 47a9d8d09cSJung-uk Kim 48a9d8d09cSJung-uk Kim #define _COMPONENT ACPI_COMPILER 49a9d8d09cSJung-uk Kim ACPI_MODULE_NAME ("asloption") 50a9d8d09cSJung-uk Kim 51a9d8d09cSJung-uk Kim 52a9d8d09cSJung-uk Kim /* Local prototypes */ 53a9d8d09cSJung-uk Kim 54a9d8d09cSJung-uk Kim static int 55a9d8d09cSJung-uk Kim AslDoOptions ( 56a9d8d09cSJung-uk Kim int argc, 57a9d8d09cSJung-uk Kim char **argv, 58a9d8d09cSJung-uk Kim BOOLEAN IsResponseFile); 59a9d8d09cSJung-uk Kim 60a9d8d09cSJung-uk Kim static void 61a9d8d09cSJung-uk Kim AslMergeOptionTokens ( 62a9d8d09cSJung-uk Kim char *InBuffer, 63a9d8d09cSJung-uk Kim char *OutBuffer); 64a9d8d09cSJung-uk Kim 65a9d8d09cSJung-uk Kim static int 66a9d8d09cSJung-uk Kim AslDoResponseFile ( 67a9d8d09cSJung-uk Kim char *Filename); 68a9d8d09cSJung-uk Kim 69a9d8d09cSJung-uk Kim 70a9d8d09cSJung-uk Kim #define ASL_TOKEN_SEPARATORS " \t\n" 71f8146b88SJung-uk Kim #define ASL_SUPPORTED_OPTIONS "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z" 72a9d8d09cSJung-uk Kim 73*493deb39SJung-uk Kim static char ASL_BUILD_DATE[] = __DATE__; 74*493deb39SJung-uk Kim static char ASL_BUILD_TIME[] = __TIME__; 75*493deb39SJung-uk Kim 76a9d8d09cSJung-uk Kim 77a9d8d09cSJung-uk Kim /******************************************************************************* 78a9d8d09cSJung-uk Kim * 79a9d8d09cSJung-uk Kim * FUNCTION: AslCommandLine 80a9d8d09cSJung-uk Kim * 81a9d8d09cSJung-uk Kim * PARAMETERS: argc/argv 82a9d8d09cSJung-uk Kim * 83a9d8d09cSJung-uk Kim * RETURN: Last argv index 84a9d8d09cSJung-uk Kim * 85a9d8d09cSJung-uk Kim * DESCRIPTION: Command line processing 86a9d8d09cSJung-uk Kim * 87a9d8d09cSJung-uk Kim ******************************************************************************/ 88a9d8d09cSJung-uk Kim 89a9d8d09cSJung-uk Kim int 90a9d8d09cSJung-uk Kim AslCommandLine ( 91a9d8d09cSJung-uk Kim int argc, 92a9d8d09cSJung-uk Kim char **argv) 93a9d8d09cSJung-uk Kim { 94a9d8d09cSJung-uk Kim int BadCommandLine = 0; 95a9d8d09cSJung-uk Kim ACPI_STATUS Status; 96a9d8d09cSJung-uk Kim 97a9d8d09cSJung-uk Kim 98a9d8d09cSJung-uk Kim /* Minimum command line contains at least the command and an input file */ 99a9d8d09cSJung-uk Kim 100a9d8d09cSJung-uk Kim if (argc < 2) 101a9d8d09cSJung-uk Kim { 102a9d8d09cSJung-uk Kim printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); 103a9d8d09cSJung-uk Kim Usage (); 104a9d8d09cSJung-uk Kim exit (1); 105a9d8d09cSJung-uk Kim } 106a9d8d09cSJung-uk Kim 107a9d8d09cSJung-uk Kim /* Process all command line options */ 108a9d8d09cSJung-uk Kim 109a9d8d09cSJung-uk Kim BadCommandLine = AslDoOptions (argc, argv, FALSE); 110a9d8d09cSJung-uk Kim 111a9d8d09cSJung-uk Kim if (Gbl_DoTemplates) 112a9d8d09cSJung-uk Kim { 113f8146b88SJung-uk Kim Status = DtCreateTemplates (argv); 114a9d8d09cSJung-uk Kim if (ACPI_FAILURE (Status)) 115a9d8d09cSJung-uk Kim { 116a9d8d09cSJung-uk Kim exit (-1); 117a9d8d09cSJung-uk Kim } 118a9d8d09cSJung-uk Kim exit (1); 119a9d8d09cSJung-uk Kim } 120a9d8d09cSJung-uk Kim 121a9d8d09cSJung-uk Kim /* Next parameter must be the input filename */ 122a9d8d09cSJung-uk Kim 123a9d8d09cSJung-uk Kim if (!argv[AcpiGbl_Optind] && 124313a0c13SJung-uk Kim !Gbl_DisasmFlag) 125a9d8d09cSJung-uk Kim { 126a9d8d09cSJung-uk Kim printf ("Missing input filename\n"); 127a9d8d09cSJung-uk Kim BadCommandLine = TRUE; 128a9d8d09cSJung-uk Kim } 129a9d8d09cSJung-uk Kim 130a9d8d09cSJung-uk Kim if (Gbl_DoSignon) 131a9d8d09cSJung-uk Kim { 132a9d8d09cSJung-uk Kim printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); 133a9d8d09cSJung-uk Kim if (Gbl_IgnoreErrors) 134a9d8d09cSJung-uk Kim { 135a9d8d09cSJung-uk Kim printf ("Ignoring all errors, forcing AML file generation\n\n"); 136a9d8d09cSJung-uk Kim } 137a9d8d09cSJung-uk Kim } 138a9d8d09cSJung-uk Kim 139a9d8d09cSJung-uk Kim if (BadCommandLine) 140a9d8d09cSJung-uk Kim { 14179c6d946SJung-uk Kim printf ("Use -h option for help information\n"); 142a9d8d09cSJung-uk Kim exit (1); 143a9d8d09cSJung-uk Kim } 144a9d8d09cSJung-uk Kim 145a9d8d09cSJung-uk Kim return (AcpiGbl_Optind); 146a9d8d09cSJung-uk Kim } 147a9d8d09cSJung-uk Kim 148a9d8d09cSJung-uk Kim 149a9d8d09cSJung-uk Kim /******************************************************************************* 150a9d8d09cSJung-uk Kim * 151a9d8d09cSJung-uk Kim * FUNCTION: AslDoOptions 152a9d8d09cSJung-uk Kim * 153a9d8d09cSJung-uk Kim * PARAMETERS: argc/argv - Standard argc/argv 154a9d8d09cSJung-uk Kim * IsResponseFile - TRUE if executing a response file. 155a9d8d09cSJung-uk Kim * 156a9d8d09cSJung-uk Kim * RETURN: Status 157a9d8d09cSJung-uk Kim * 158a9d8d09cSJung-uk Kim * DESCRIPTION: Command line option processing 159a9d8d09cSJung-uk Kim * 160a9d8d09cSJung-uk Kim ******************************************************************************/ 161a9d8d09cSJung-uk Kim 162a9d8d09cSJung-uk Kim static int 163a9d8d09cSJung-uk Kim AslDoOptions ( 164a9d8d09cSJung-uk Kim int argc, 165a9d8d09cSJung-uk Kim char **argv, 166a9d8d09cSJung-uk Kim BOOLEAN IsResponseFile) 167a9d8d09cSJung-uk Kim { 168a9d8d09cSJung-uk Kim ACPI_STATUS Status; 169a9d8d09cSJung-uk Kim UINT32 j; 170a9d8d09cSJung-uk Kim 171a9d8d09cSJung-uk Kim 172a9d8d09cSJung-uk Kim /* Get the command line options */ 173a9d8d09cSJung-uk Kim 174313a0c13SJung-uk Kim while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch (j) 175a9d8d09cSJung-uk Kim { 176a9d8d09cSJung-uk Kim case '@': /* Begin a response file */ 177a9d8d09cSJung-uk Kim 178a9d8d09cSJung-uk Kim if (IsResponseFile) 179a9d8d09cSJung-uk Kim { 180a9d8d09cSJung-uk Kim printf ("Nested command files are not supported\n"); 181a9d8d09cSJung-uk Kim return (-1); 182a9d8d09cSJung-uk Kim } 183a9d8d09cSJung-uk Kim 184a9d8d09cSJung-uk Kim if (AslDoResponseFile (AcpiGbl_Optarg)) 185a9d8d09cSJung-uk Kim { 186a9d8d09cSJung-uk Kim return (-1); 187a9d8d09cSJung-uk Kim } 188a9d8d09cSJung-uk Kim break; 189a9d8d09cSJung-uk Kim 190f8146b88SJung-uk Kim case 'a': /* Debug options */ 191f8146b88SJung-uk Kim 192f8146b88SJung-uk Kim switch (AcpiGbl_Optarg[0]) 193f8146b88SJung-uk Kim { 194f8146b88SJung-uk Kim case 'r': 195f8146b88SJung-uk Kim 196f8146b88SJung-uk Kim Gbl_EnableReferenceTypechecking = TRUE; 197f8146b88SJung-uk Kim break; 198f8146b88SJung-uk Kim 199f8146b88SJung-uk Kim default: 200f8146b88SJung-uk Kim 201f8146b88SJung-uk Kim printf ("Unknown option: -a%s\n", AcpiGbl_Optarg); 202f8146b88SJung-uk Kim return (-1); 203f8146b88SJung-uk Kim } 204f8146b88SJung-uk Kim 205f8146b88SJung-uk Kim break; 206f8146b88SJung-uk Kim 207f8146b88SJung-uk Kim 2081c0e1b6dSJung-uk Kim case 'b': /* Debug options */ 209a9d8d09cSJung-uk Kim 210a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 211a9d8d09cSJung-uk Kim { 212a9d8d09cSJung-uk Kim case 'f': 213a9d8d09cSJung-uk Kim 214a9d8d09cSJung-uk Kim AslCompilerdebug = 1; /* same as yydebug */ 215a9d8d09cSJung-uk Kim DtParserdebug = 1; 216a9d8d09cSJung-uk Kim PrParserdebug = 1; 2171c0e1b6dSJung-uk Kim Gbl_DebugFlag = TRUE; 2185ef50723SJung-uk Kim Gbl_KeepPreprocessorTempFile = TRUE; 2191c0e1b6dSJung-uk Kim break; 2201c0e1b6dSJung-uk Kim 2211c0e1b6dSJung-uk Kim case 'p': /* Prune ASL parse tree */ 2221c0e1b6dSJung-uk Kim 2231c0e1b6dSJung-uk Kim /* Get the required argument */ 2241c0e1b6dSJung-uk Kim 2251c0e1b6dSJung-uk Kim if (AcpiGetoptArgument (argc, argv)) 2261c0e1b6dSJung-uk Kim { 2271c0e1b6dSJung-uk Kim return (-1); 2281c0e1b6dSJung-uk Kim } 2291c0e1b6dSJung-uk Kim 2301c0e1b6dSJung-uk Kim Gbl_PruneParseTree = TRUE; 2311c0e1b6dSJung-uk Kim Gbl_PruneDepth = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); 2321c0e1b6dSJung-uk Kim break; 2331c0e1b6dSJung-uk Kim 2341c0e1b6dSJung-uk Kim case 's': 2351c0e1b6dSJung-uk Kim 2361c0e1b6dSJung-uk Kim Gbl_DebugFlag = TRUE; 237a9d8d09cSJung-uk Kim break; 238a9d8d09cSJung-uk Kim 239a9d8d09cSJung-uk Kim case 't': 240a9d8d09cSJung-uk Kim 2411c0e1b6dSJung-uk Kim /* Get the required argument */ 2421c0e1b6dSJung-uk Kim 2431c0e1b6dSJung-uk Kim if (AcpiGetoptArgument (argc, argv)) 2441c0e1b6dSJung-uk Kim { 2451c0e1b6dSJung-uk Kim return (-1); 2461c0e1b6dSJung-uk Kim } 2471c0e1b6dSJung-uk Kim 2481c0e1b6dSJung-uk Kim Gbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); 249a9d8d09cSJung-uk Kim break; 250a9d8d09cSJung-uk Kim 251a9d8d09cSJung-uk Kim default: 252a9d8d09cSJung-uk Kim 253a9d8d09cSJung-uk Kim printf ("Unknown option: -b%s\n", AcpiGbl_Optarg); 254a9d8d09cSJung-uk Kim return (-1); 255a9d8d09cSJung-uk Kim } 256a9d8d09cSJung-uk Kim 257a9d8d09cSJung-uk Kim break; 258a9d8d09cSJung-uk Kim 259a9d8d09cSJung-uk Kim case 'c': 260a9d8d09cSJung-uk Kim 261a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 262a9d8d09cSJung-uk Kim { 263a9d8d09cSJung-uk Kim case 'r': 264a9d8d09cSJung-uk Kim 265a9d8d09cSJung-uk Kim Gbl_NoResourceChecking = TRUE; 266a9d8d09cSJung-uk Kim break; 267a9d8d09cSJung-uk Kim 268a9d8d09cSJung-uk Kim default: 269a9d8d09cSJung-uk Kim 270a9d8d09cSJung-uk Kim printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); 271a9d8d09cSJung-uk Kim return (-1); 272a9d8d09cSJung-uk Kim } 273a9d8d09cSJung-uk Kim break; 274a9d8d09cSJung-uk Kim 275a9d8d09cSJung-uk Kim case 'd': /* Disassembler */ 276a9d8d09cSJung-uk Kim 277a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 278a9d8d09cSJung-uk Kim { 279a9d8d09cSJung-uk Kim case '^': 280a9d8d09cSJung-uk Kim 281*493deb39SJung-uk Kim /* Get the required argument */ 282*493deb39SJung-uk Kim 283*493deb39SJung-uk Kim if (AcpiGetoptArgument (argc, argv)) 284*493deb39SJung-uk Kim { 285*493deb39SJung-uk Kim return (-1); 286*493deb39SJung-uk Kim } 287*493deb39SJung-uk Kim 288a9d8d09cSJung-uk Kim Gbl_DoCompile = FALSE; 289a9d8d09cSJung-uk Kim break; 290a9d8d09cSJung-uk Kim 291a9d8d09cSJung-uk Kim case 'a': 292a9d8d09cSJung-uk Kim 293*493deb39SJung-uk Kim /* Get the required argument */ 294*493deb39SJung-uk Kim 295*493deb39SJung-uk Kim if (AcpiGetoptArgument (argc, argv)) 296*493deb39SJung-uk Kim { 297*493deb39SJung-uk Kim return (-1); 298*493deb39SJung-uk Kim } 299*493deb39SJung-uk Kim 300a9d8d09cSJung-uk Kim Gbl_DoCompile = FALSE; 301a9d8d09cSJung-uk Kim Gbl_DisassembleAll = TRUE; 302a9d8d09cSJung-uk Kim break; 303a9d8d09cSJung-uk Kim 304a9d8d09cSJung-uk Kim case 'b': /* Do not convert buffers to resource descriptors */ 305a9d8d09cSJung-uk Kim 306a9d8d09cSJung-uk Kim AcpiGbl_NoResourceDisassembly = TRUE; 307a9d8d09cSJung-uk Kim break; 308a9d8d09cSJung-uk Kim 309a9d8d09cSJung-uk Kim case 'c': 310a9d8d09cSJung-uk Kim 311a9d8d09cSJung-uk Kim break; 312a9d8d09cSJung-uk Kim 3137cf3e94aSJung-uk Kim case 'f': 3147cf3e94aSJung-uk Kim 3157cf3e94aSJung-uk Kim AcpiGbl_ForceAmlDisassembly = TRUE; 3167cf3e94aSJung-uk Kim break; 3177cf3e94aSJung-uk Kim 3181c0e1b6dSJung-uk Kim case 'l': /* Use legacy ASL code (not ASL+) for disassembly */ 3191c0e1b6dSJung-uk Kim 3201c0e1b6dSJung-uk Kim Gbl_DoCompile = FALSE; 3211c0e1b6dSJung-uk Kim AcpiGbl_CstyleDisassembly = FALSE; 3221c0e1b6dSJung-uk Kim break; 3231c0e1b6dSJung-uk Kim 324a9d8d09cSJung-uk Kim default: 325a9d8d09cSJung-uk Kim 326a9d8d09cSJung-uk Kim printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); 327a9d8d09cSJung-uk Kim return (-1); 328a9d8d09cSJung-uk Kim } 329a9d8d09cSJung-uk Kim 330a9d8d09cSJung-uk Kim Gbl_DisasmFlag = TRUE; 331a9d8d09cSJung-uk Kim break; 332a9d8d09cSJung-uk Kim 333a9d8d09cSJung-uk Kim case 'D': /* Define a symbol */ 334a9d8d09cSJung-uk Kim 335a9d8d09cSJung-uk Kim PrAddDefine (AcpiGbl_Optarg, NULL, TRUE); 336a9d8d09cSJung-uk Kim break; 337a9d8d09cSJung-uk Kim 338a9d8d09cSJung-uk Kim case 'e': /* External files for disassembler */ 339a9d8d09cSJung-uk Kim 340313a0c13SJung-uk Kim /* Get entire list of external files */ 341313a0c13SJung-uk Kim 342313a0c13SJung-uk Kim AcpiGbl_Optind--; 343313a0c13SJung-uk Kim argv[AcpiGbl_Optind] = AcpiGbl_Optarg; 344313a0c13SJung-uk Kim 345313a0c13SJung-uk Kim while (argv[AcpiGbl_Optind] && 346313a0c13SJung-uk Kim (argv[AcpiGbl_Optind][0] != '-')) 347313a0c13SJung-uk Kim { 348313a0c13SJung-uk Kim Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]); 349a9d8d09cSJung-uk Kim if (ACPI_FAILURE (Status)) 350a9d8d09cSJung-uk Kim { 351f8146b88SJung-uk Kim printf ("Could not add %s to external list\n", 352f8146b88SJung-uk Kim argv[AcpiGbl_Optind]); 353a9d8d09cSJung-uk Kim return (-1); 354a9d8d09cSJung-uk Kim } 355313a0c13SJung-uk Kim 356313a0c13SJung-uk Kim AcpiGbl_Optind++; 357313a0c13SJung-uk Kim } 358a9d8d09cSJung-uk Kim break; 359a9d8d09cSJung-uk Kim 36079c6d946SJung-uk Kim case 'f': 36179c6d946SJung-uk Kim 36279c6d946SJung-uk Kim switch (AcpiGbl_Optarg[0]) 36379c6d946SJung-uk Kim { 36479c6d946SJung-uk Kim case '^': /* Ignore errors and force creation of aml file */ 365a9d8d09cSJung-uk Kim 366a9d8d09cSJung-uk Kim Gbl_IgnoreErrors = TRUE; 367a9d8d09cSJung-uk Kim break; 368a9d8d09cSJung-uk Kim 36979c6d946SJung-uk Kim case 'e': /* Disassembler: Get external declaration file */ 37079c6d946SJung-uk Kim 37179c6d946SJung-uk Kim if (AcpiGetoptArgument (argc, argv)) 37279c6d946SJung-uk Kim { 37379c6d946SJung-uk Kim return (-1); 37479c6d946SJung-uk Kim } 37579c6d946SJung-uk Kim 37679c6d946SJung-uk Kim Gbl_ExternalRefFilename = AcpiGbl_Optarg; 37779c6d946SJung-uk Kim break; 37879c6d946SJung-uk Kim 37979c6d946SJung-uk Kim default: 38079c6d946SJung-uk Kim 38179c6d946SJung-uk Kim printf ("Unknown option: -f%s\n", AcpiGbl_Optarg); 38279c6d946SJung-uk Kim return (-1); 38379c6d946SJung-uk Kim } 38479c6d946SJung-uk Kim break; 38579c6d946SJung-uk Kim 386a9d8d09cSJung-uk Kim case 'G': 387a9d8d09cSJung-uk Kim 388a9d8d09cSJung-uk Kim Gbl_CompileGeneric = TRUE; 389a9d8d09cSJung-uk Kim break; 390a9d8d09cSJung-uk Kim 391a9d8d09cSJung-uk Kim case 'g': /* Get all ACPI tables */ 392a9d8d09cSJung-uk Kim 393313a0c13SJung-uk Kim printf ("-g option is deprecated, use acpidump utility instead\n"); 394313a0c13SJung-uk Kim exit (1); 395a9d8d09cSJung-uk Kim 396a9d8d09cSJung-uk Kim case 'h': 397a9d8d09cSJung-uk Kim 398a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 399a9d8d09cSJung-uk Kim { 400a9d8d09cSJung-uk Kim case '^': 401a9d8d09cSJung-uk Kim 402a9d8d09cSJung-uk Kim Usage (); 403a9d8d09cSJung-uk Kim exit (0); 404a9d8d09cSJung-uk Kim 405a9d8d09cSJung-uk Kim case 'c': 406a9d8d09cSJung-uk Kim 407a9d8d09cSJung-uk Kim UtDisplayConstantOpcodes (); 408a9d8d09cSJung-uk Kim exit (0); 409a9d8d09cSJung-uk Kim 410*493deb39SJung-uk Kim case 'd': 411*493deb39SJung-uk Kim 412*493deb39SJung-uk Kim AslDisassemblyHelp (); 413*493deb39SJung-uk Kim exit (0); 414*493deb39SJung-uk Kim 415a9d8d09cSJung-uk Kim case 'f': 416a9d8d09cSJung-uk Kim 417a9d8d09cSJung-uk Kim AslFilenameHelp (); 418a9d8d09cSJung-uk Kim exit (0); 419a9d8d09cSJung-uk Kim 420a9d8d09cSJung-uk Kim case 'r': 421a9d8d09cSJung-uk Kim 422a9d8d09cSJung-uk Kim /* reserved names */ 423a9d8d09cSJung-uk Kim 424a9d8d09cSJung-uk Kim ApDisplayReservedNames (); 425a9d8d09cSJung-uk Kim exit (0); 426a9d8d09cSJung-uk Kim 427a9d8d09cSJung-uk Kim case 't': 428a9d8d09cSJung-uk Kim 429a9d8d09cSJung-uk Kim UtDisplaySupportedTables (); 430a9d8d09cSJung-uk Kim exit (0); 431a9d8d09cSJung-uk Kim 432a9d8d09cSJung-uk Kim default: 433a9d8d09cSJung-uk Kim 434a9d8d09cSJung-uk Kim printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); 435a9d8d09cSJung-uk Kim return (-1); 436a9d8d09cSJung-uk Kim } 437a9d8d09cSJung-uk Kim 438a9d8d09cSJung-uk Kim case 'I': /* Add an include file search directory */ 439a9d8d09cSJung-uk Kim 440a9d8d09cSJung-uk Kim FlAddIncludeDirectory (AcpiGbl_Optarg); 441a9d8d09cSJung-uk Kim break; 442a9d8d09cSJung-uk Kim 443a9d8d09cSJung-uk Kim case 'i': /* Output AML as an include file */ 444a9d8d09cSJung-uk Kim 445a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 446a9d8d09cSJung-uk Kim { 447a9d8d09cSJung-uk Kim case 'a': 448a9d8d09cSJung-uk Kim 449a9d8d09cSJung-uk Kim /* Produce assembly code include file */ 450a9d8d09cSJung-uk Kim 451a9d8d09cSJung-uk Kim Gbl_AsmIncludeOutputFlag = TRUE; 452a9d8d09cSJung-uk Kim break; 453a9d8d09cSJung-uk Kim 454a9d8d09cSJung-uk Kim case 'c': 455a9d8d09cSJung-uk Kim 456a9d8d09cSJung-uk Kim /* Produce C include file */ 457a9d8d09cSJung-uk Kim 458a9d8d09cSJung-uk Kim Gbl_C_IncludeOutputFlag = TRUE; 459a9d8d09cSJung-uk Kim break; 460a9d8d09cSJung-uk Kim 461a9d8d09cSJung-uk Kim case 'n': 462a9d8d09cSJung-uk Kim 463a9d8d09cSJung-uk Kim /* Compiler/Disassembler: Ignore the NOOP operator */ 464a9d8d09cSJung-uk Kim 465a9d8d09cSJung-uk Kim AcpiGbl_IgnoreNoopOperator = TRUE; 466a9d8d09cSJung-uk Kim break; 467a9d8d09cSJung-uk Kim 468a9d8d09cSJung-uk Kim default: 469a9d8d09cSJung-uk Kim 470a9d8d09cSJung-uk Kim printf ("Unknown option: -i%s\n", AcpiGbl_Optarg); 471a9d8d09cSJung-uk Kim return (-1); 472a9d8d09cSJung-uk Kim } 473a9d8d09cSJung-uk Kim break; 474a9d8d09cSJung-uk Kim 475a9d8d09cSJung-uk Kim case 'l': /* Listing files */ 476a9d8d09cSJung-uk Kim 477a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 478a9d8d09cSJung-uk Kim { 479a9d8d09cSJung-uk Kim case '^': 480a9d8d09cSJung-uk Kim 481a9d8d09cSJung-uk Kim /* Produce listing file (Mixed source/aml) */ 482a9d8d09cSJung-uk Kim 483a9d8d09cSJung-uk Kim Gbl_ListingFlag = TRUE; 48470e6ab8fSJung-uk Kim AcpiGbl_DmOpt_Listing = TRUE; 485a9d8d09cSJung-uk Kim break; 486a9d8d09cSJung-uk Kim 487a9d8d09cSJung-uk Kim case 'i': 488a9d8d09cSJung-uk Kim 489a9d8d09cSJung-uk Kim /* Produce preprocessor output file */ 490a9d8d09cSJung-uk Kim 491a9d8d09cSJung-uk Kim Gbl_PreprocessorOutputFlag = TRUE; 492a9d8d09cSJung-uk Kim break; 493a9d8d09cSJung-uk Kim 494313a0c13SJung-uk Kim case 'm': 495313a0c13SJung-uk Kim 496313a0c13SJung-uk Kim /* Produce hardware map summary file */ 497313a0c13SJung-uk Kim 498313a0c13SJung-uk Kim Gbl_MapfileFlag = TRUE; 499313a0c13SJung-uk Kim break; 500313a0c13SJung-uk Kim 501a9d8d09cSJung-uk Kim case 'n': 502a9d8d09cSJung-uk Kim 503a9d8d09cSJung-uk Kim /* Produce namespace file */ 504a9d8d09cSJung-uk Kim 505a9d8d09cSJung-uk Kim Gbl_NsOutputFlag = TRUE; 506a9d8d09cSJung-uk Kim break; 507a9d8d09cSJung-uk Kim 508a9d8d09cSJung-uk Kim case 's': 509a9d8d09cSJung-uk Kim 510a9d8d09cSJung-uk Kim /* Produce combined source file */ 511a9d8d09cSJung-uk Kim 512a9d8d09cSJung-uk Kim Gbl_SourceOutputFlag = TRUE; 513a9d8d09cSJung-uk Kim break; 514a9d8d09cSJung-uk Kim 515f8146b88SJung-uk Kim case 'x': 516f8146b88SJung-uk Kim 517f8146b88SJung-uk Kim /* Produce cross-reference file */ 518f8146b88SJung-uk Kim 519f8146b88SJung-uk Kim Gbl_CrossReferenceOutput = TRUE; 520f8146b88SJung-uk Kim break; 521f8146b88SJung-uk Kim 522a9d8d09cSJung-uk Kim default: 523a9d8d09cSJung-uk Kim 524a9d8d09cSJung-uk Kim printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); 525a9d8d09cSJung-uk Kim return (-1); 526a9d8d09cSJung-uk Kim } 527a9d8d09cSJung-uk Kim break; 528a9d8d09cSJung-uk Kim 529a9d8d09cSJung-uk Kim case 'm': /* Set line buffer size */ 530a9d8d09cSJung-uk Kim 531a9d8d09cSJung-uk Kim Gbl_LineBufferSize = (UINT32) strtoul (AcpiGbl_Optarg, NULL, 0) * 1024; 532a9d8d09cSJung-uk Kim if (Gbl_LineBufferSize < ASL_DEFAULT_LINE_BUFFER_SIZE) 533a9d8d09cSJung-uk Kim { 534a9d8d09cSJung-uk Kim Gbl_LineBufferSize = ASL_DEFAULT_LINE_BUFFER_SIZE; 535a9d8d09cSJung-uk Kim } 536a9d8d09cSJung-uk Kim printf ("Line Buffer Size: %u\n", Gbl_LineBufferSize); 537a9d8d09cSJung-uk Kim break; 538a9d8d09cSJung-uk Kim 539a9d8d09cSJung-uk Kim case 'n': /* Parse only */ 540a9d8d09cSJung-uk Kim 541a9d8d09cSJung-uk Kim Gbl_ParseOnlyFlag = TRUE; 542a9d8d09cSJung-uk Kim break; 543a9d8d09cSJung-uk Kim 544a9d8d09cSJung-uk Kim case 'o': /* Control compiler AML optimizations */ 545a9d8d09cSJung-uk Kim 546a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 547a9d8d09cSJung-uk Kim { 548a9d8d09cSJung-uk Kim case 'a': 549a9d8d09cSJung-uk Kim 550a9d8d09cSJung-uk Kim /* Disable all optimizations */ 551a9d8d09cSJung-uk Kim 552a9d8d09cSJung-uk Kim Gbl_FoldConstants = FALSE; 553a9d8d09cSJung-uk Kim Gbl_IntegerOptimizationFlag = FALSE; 554a9d8d09cSJung-uk Kim Gbl_ReferenceOptimizationFlag = FALSE; 555a9d8d09cSJung-uk Kim break; 556a9d8d09cSJung-uk Kim 557f8146b88SJung-uk Kim case 'c': 558f8146b88SJung-uk Kim 559f8146b88SJung-uk Kim /* Display compile time(s) */ 560f8146b88SJung-uk Kim 561f8146b88SJung-uk Kim Gbl_CompileTimesFlag = TRUE; 562f8146b88SJung-uk Kim break; 563f8146b88SJung-uk Kim 564*493deb39SJung-uk Kim case 'd': 565*493deb39SJung-uk Kim 566*493deb39SJung-uk Kim /* Disable disassembler code optimizations */ 567*493deb39SJung-uk Kim 568*493deb39SJung-uk Kim AcpiGbl_DoDisassemblerOptimizations = FALSE; 569*493deb39SJung-uk Kim break; 570*493deb39SJung-uk Kim 571f8146b88SJung-uk Kim case 'e': 572f8146b88SJung-uk Kim 5733920312eSJung-uk Kim /* iASL: Disable External opcode generation */ 574f8146b88SJung-uk Kim 575f8146b88SJung-uk Kim Gbl_DoExternals = FALSE; 5763920312eSJung-uk Kim 5773920312eSJung-uk Kim /* Disassembler: Emit embedded external operators */ 5783920312eSJung-uk Kim 5793920312eSJung-uk Kim AcpiGbl_DmEmitExternalOpcodes = TRUE; 580f8146b88SJung-uk Kim break; 581f8146b88SJung-uk Kim 582a9d8d09cSJung-uk Kim case 'f': 583a9d8d09cSJung-uk Kim 584a9d8d09cSJung-uk Kim /* Disable folding on "normal" expressions */ 585a9d8d09cSJung-uk Kim 586a9d8d09cSJung-uk Kim Gbl_FoldConstants = FALSE; 587a9d8d09cSJung-uk Kim break; 588a9d8d09cSJung-uk Kim 589a9d8d09cSJung-uk Kim case 'i': 590a9d8d09cSJung-uk Kim 591a9d8d09cSJung-uk Kim /* Disable integer optimization to constants */ 592a9d8d09cSJung-uk Kim 593a9d8d09cSJung-uk Kim Gbl_IntegerOptimizationFlag = FALSE; 594a9d8d09cSJung-uk Kim break; 595a9d8d09cSJung-uk Kim 596a9d8d09cSJung-uk Kim case 'n': 597a9d8d09cSJung-uk Kim 598a9d8d09cSJung-uk Kim /* Disable named reference optimization */ 599a9d8d09cSJung-uk Kim 600a9d8d09cSJung-uk Kim Gbl_ReferenceOptimizationFlag = FALSE; 601a9d8d09cSJung-uk Kim break; 602a9d8d09cSJung-uk Kim 603a9d8d09cSJung-uk Kim case 't': 604a9d8d09cSJung-uk Kim 605f8146b88SJung-uk Kim /* Disable heavy typechecking */ 606a9d8d09cSJung-uk Kim 607f8146b88SJung-uk Kim Gbl_DoTypechecking = FALSE; 608a9d8d09cSJung-uk Kim break; 609a9d8d09cSJung-uk Kim 610a9d8d09cSJung-uk Kim default: 611a9d8d09cSJung-uk Kim 612a9d8d09cSJung-uk Kim printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); 613a9d8d09cSJung-uk Kim return (-1); 614a9d8d09cSJung-uk Kim } 615a9d8d09cSJung-uk Kim break; 616a9d8d09cSJung-uk Kim 617a9d8d09cSJung-uk Kim case 'P': /* Preprocessor options */ 618a9d8d09cSJung-uk Kim 619a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 620a9d8d09cSJung-uk Kim { 621a9d8d09cSJung-uk Kim case '^': /* Proprocess only, emit (.i) file */ 622a9d8d09cSJung-uk Kim 623a9d8d09cSJung-uk Kim Gbl_PreprocessOnly = TRUE; 624a9d8d09cSJung-uk Kim Gbl_PreprocessorOutputFlag = TRUE; 625a9d8d09cSJung-uk Kim break; 626a9d8d09cSJung-uk Kim 627a9d8d09cSJung-uk Kim case 'n': /* Disable preprocessor */ 628a9d8d09cSJung-uk Kim 629a9d8d09cSJung-uk Kim Gbl_PreprocessFlag = FALSE; 630a9d8d09cSJung-uk Kim break; 631a9d8d09cSJung-uk Kim 632a9d8d09cSJung-uk Kim default: 633a9d8d09cSJung-uk Kim 634a9d8d09cSJung-uk Kim printf ("Unknown option: -P%s\n", AcpiGbl_Optarg); 635a9d8d09cSJung-uk Kim return (-1); 636a9d8d09cSJung-uk Kim } 637a9d8d09cSJung-uk Kim break; 638a9d8d09cSJung-uk Kim 639a9d8d09cSJung-uk Kim case 'p': /* Override default AML output filename */ 640a9d8d09cSJung-uk Kim 641a9d8d09cSJung-uk Kim Gbl_OutputFilenamePrefix = AcpiGbl_Optarg; 642313a0c13SJung-uk Kim UtConvertBackslashes (Gbl_OutputFilenamePrefix); 643a9d8d09cSJung-uk Kim Gbl_UseDefaultAmlFilename = FALSE; 644a9d8d09cSJung-uk Kim break; 645a9d8d09cSJung-uk Kim 646a9d8d09cSJung-uk Kim case 'r': /* Override revision found in table header */ 647a9d8d09cSJung-uk Kim 648a9d8d09cSJung-uk Kim Gbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); 649a9d8d09cSJung-uk Kim break; 650a9d8d09cSJung-uk Kim 651a9d8d09cSJung-uk Kim case 's': /* Create AML in a source code file */ 652a9d8d09cSJung-uk Kim 653a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 654a9d8d09cSJung-uk Kim { 655a9d8d09cSJung-uk Kim case 'a': 656a9d8d09cSJung-uk Kim 657a9d8d09cSJung-uk Kim /* Produce assembly code output file */ 658a9d8d09cSJung-uk Kim 659a9d8d09cSJung-uk Kim Gbl_AsmOutputFlag = TRUE; 660a9d8d09cSJung-uk Kim break; 661a9d8d09cSJung-uk Kim 662a9d8d09cSJung-uk Kim case 'c': 663a9d8d09cSJung-uk Kim 664a9d8d09cSJung-uk Kim /* Produce C hex output file */ 665a9d8d09cSJung-uk Kim 666a9d8d09cSJung-uk Kim Gbl_C_OutputFlag = TRUE; 667a9d8d09cSJung-uk Kim break; 668a9d8d09cSJung-uk Kim 669a9d8d09cSJung-uk Kim case 'o': 670a9d8d09cSJung-uk Kim 671a9d8d09cSJung-uk Kim /* Produce AML offset table in C */ 672a9d8d09cSJung-uk Kim 673a9d8d09cSJung-uk Kim Gbl_C_OffsetTableFlag = TRUE; 674a9d8d09cSJung-uk Kim break; 675a9d8d09cSJung-uk Kim 676a9d8d09cSJung-uk Kim default: 677a9d8d09cSJung-uk Kim 678a9d8d09cSJung-uk Kim printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); 679a9d8d09cSJung-uk Kim return (-1); 680a9d8d09cSJung-uk Kim } 681a9d8d09cSJung-uk Kim break; 682a9d8d09cSJung-uk Kim 683a9d8d09cSJung-uk Kim case 't': /* Produce hex table output file */ 684a9d8d09cSJung-uk Kim 685a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 686a9d8d09cSJung-uk Kim { 687a9d8d09cSJung-uk Kim case 'a': 688a9d8d09cSJung-uk Kim 689a9d8d09cSJung-uk Kim Gbl_HexOutputFlag = HEX_OUTPUT_ASM; 690a9d8d09cSJung-uk Kim break; 691a9d8d09cSJung-uk Kim 692a9d8d09cSJung-uk Kim case 'c': 693a9d8d09cSJung-uk Kim 694a9d8d09cSJung-uk Kim Gbl_HexOutputFlag = HEX_OUTPUT_C; 695a9d8d09cSJung-uk Kim break; 696a9d8d09cSJung-uk Kim 697a9d8d09cSJung-uk Kim case 's': 698a9d8d09cSJung-uk Kim 699a9d8d09cSJung-uk Kim Gbl_HexOutputFlag = HEX_OUTPUT_ASL; 700a9d8d09cSJung-uk Kim break; 701a9d8d09cSJung-uk Kim 702a9d8d09cSJung-uk Kim default: 703a9d8d09cSJung-uk Kim 704a9d8d09cSJung-uk Kim printf ("Unknown option: -t%s\n", AcpiGbl_Optarg); 705a9d8d09cSJung-uk Kim return (-1); 706a9d8d09cSJung-uk Kim } 707a9d8d09cSJung-uk Kim break; 708a9d8d09cSJung-uk Kim 709a9d8d09cSJung-uk Kim case 'T': /* Create a ACPI table template file */ 710a9d8d09cSJung-uk Kim 711a9d8d09cSJung-uk Kim Gbl_DoTemplates = TRUE; 712a9d8d09cSJung-uk Kim break; 713a9d8d09cSJung-uk Kim 714a9d8d09cSJung-uk Kim case 'v': /* Version and verbosity settings */ 715a9d8d09cSJung-uk Kim 716a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 717a9d8d09cSJung-uk Kim { 718a9d8d09cSJung-uk Kim case '^': 719a9d8d09cSJung-uk Kim 720a9d8d09cSJung-uk Kim printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); 721a9d8d09cSJung-uk Kim exit (0); 722a9d8d09cSJung-uk Kim 723a9d8d09cSJung-uk Kim case 'a': 724a9d8d09cSJung-uk Kim 725313a0c13SJung-uk Kim /* Disable all error/warning/remark messages */ 726a9d8d09cSJung-uk Kim 727a9d8d09cSJung-uk Kim Gbl_NoErrors = TRUE; 728a9d8d09cSJung-uk Kim break; 729a9d8d09cSJung-uk Kim 730*493deb39SJung-uk Kim case 'd': 731*493deb39SJung-uk Kim 732*493deb39SJung-uk Kim printf ("%s Build date/time: %s %s\n", 733*493deb39SJung-uk Kim ASL_COMPILER_NAME, ASL_BUILD_DATE, ASL_BUILD_TIME); 734*493deb39SJung-uk Kim exit (0); 735*493deb39SJung-uk Kim 736313a0c13SJung-uk Kim case 'e': 737313a0c13SJung-uk Kim 738313a0c13SJung-uk Kim /* Disable all warning/remark messages (errors only) */ 739313a0c13SJung-uk Kim 740313a0c13SJung-uk Kim Gbl_DisplayRemarks = FALSE; 741313a0c13SJung-uk Kim Gbl_DisplayWarnings = FALSE; 742313a0c13SJung-uk Kim break; 743313a0c13SJung-uk Kim 744a9d8d09cSJung-uk Kim case 'i': 745a9d8d09cSJung-uk Kim /* 746a9d8d09cSJung-uk Kim * Support for integrated development environment(s). 747a9d8d09cSJung-uk Kim * 748a9d8d09cSJung-uk Kim * 1) No compiler signon 749a9d8d09cSJung-uk Kim * 2) Send stderr messages to stdout 750a9d8d09cSJung-uk Kim * 3) Less verbose error messages (single line only for each) 751a9d8d09cSJung-uk Kim * 4) Error/warning messages are formatted appropriately to 752a9d8d09cSJung-uk Kim * be recognized by MS Visual Studio 753a9d8d09cSJung-uk Kim */ 754a9d8d09cSJung-uk Kim Gbl_VerboseErrors = FALSE; 755a9d8d09cSJung-uk Kim Gbl_DoSignon = FALSE; 756a9d8d09cSJung-uk Kim Gbl_Files[ASL_FILE_STDERR].Handle = stdout; 757a9d8d09cSJung-uk Kim break; 758a9d8d09cSJung-uk Kim 759a9d8d09cSJung-uk Kim case 'o': 760a9d8d09cSJung-uk Kim 761a9d8d09cSJung-uk Kim Gbl_DisplayOptimizations = TRUE; 762a9d8d09cSJung-uk Kim break; 763a9d8d09cSJung-uk Kim 764a9d8d09cSJung-uk Kim case 'r': 765a9d8d09cSJung-uk Kim 766a9d8d09cSJung-uk Kim Gbl_DisplayRemarks = FALSE; 767a9d8d09cSJung-uk Kim break; 768a9d8d09cSJung-uk Kim 769a9d8d09cSJung-uk Kim case 's': 770a9d8d09cSJung-uk Kim 771a9d8d09cSJung-uk Kim Gbl_DoSignon = FALSE; 772a9d8d09cSJung-uk Kim break; 773a9d8d09cSJung-uk Kim 774a9d8d09cSJung-uk Kim case 't': 775a9d8d09cSJung-uk Kim 776a9d8d09cSJung-uk Kim Gbl_VerboseTemplates = TRUE; 777a9d8d09cSJung-uk Kim break; 778a9d8d09cSJung-uk Kim 779a9d8d09cSJung-uk Kim case 'w': 780a9d8d09cSJung-uk Kim 781a9d8d09cSJung-uk Kim /* Get the required argument */ 782a9d8d09cSJung-uk Kim 783a9d8d09cSJung-uk Kim if (AcpiGetoptArgument (argc, argv)) 784a9d8d09cSJung-uk Kim { 785a9d8d09cSJung-uk Kim return (-1); 786a9d8d09cSJung-uk Kim } 787a9d8d09cSJung-uk Kim 788a9d8d09cSJung-uk Kim Status = AslDisableException (AcpiGbl_Optarg); 789a9d8d09cSJung-uk Kim if (ACPI_FAILURE (Status)) 790a9d8d09cSJung-uk Kim { 791a9d8d09cSJung-uk Kim return (-1); 792a9d8d09cSJung-uk Kim } 793a9d8d09cSJung-uk Kim break; 794a9d8d09cSJung-uk Kim 795a9d8d09cSJung-uk Kim default: 796a9d8d09cSJung-uk Kim 797a9d8d09cSJung-uk Kim printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); 798a9d8d09cSJung-uk Kim return (-1); 799a9d8d09cSJung-uk Kim } 800a9d8d09cSJung-uk Kim break; 801a9d8d09cSJung-uk Kim 802a9d8d09cSJung-uk Kim case 'w': /* Set warning levels */ 803a9d8d09cSJung-uk Kim 804a9d8d09cSJung-uk Kim switch (AcpiGbl_Optarg[0]) 805a9d8d09cSJung-uk Kim { 806a9d8d09cSJung-uk Kim case '1': 807a9d8d09cSJung-uk Kim 808a9d8d09cSJung-uk Kim Gbl_WarningLevel = ASL_WARNING; 809a9d8d09cSJung-uk Kim break; 810a9d8d09cSJung-uk Kim 811a9d8d09cSJung-uk Kim case '2': 812a9d8d09cSJung-uk Kim 813a9d8d09cSJung-uk Kim Gbl_WarningLevel = ASL_WARNING2; 814a9d8d09cSJung-uk Kim break; 815a9d8d09cSJung-uk Kim 816a9d8d09cSJung-uk Kim case '3': 817a9d8d09cSJung-uk Kim 818a9d8d09cSJung-uk Kim Gbl_WarningLevel = ASL_WARNING3; 819a9d8d09cSJung-uk Kim break; 820a9d8d09cSJung-uk Kim 821a9d8d09cSJung-uk Kim case 'e': 822a9d8d09cSJung-uk Kim 823a9d8d09cSJung-uk Kim Gbl_WarningsAsErrors = TRUE; 824a9d8d09cSJung-uk Kim break; 825a9d8d09cSJung-uk Kim 826a9d8d09cSJung-uk Kim default: 827a9d8d09cSJung-uk Kim 828a9d8d09cSJung-uk Kim printf ("Unknown option: -w%s\n", AcpiGbl_Optarg); 829a9d8d09cSJung-uk Kim return (-1); 830a9d8d09cSJung-uk Kim } 831a9d8d09cSJung-uk Kim break; 832a9d8d09cSJung-uk Kim 833a9d8d09cSJung-uk Kim case 'x': /* Set debug print output level */ 834a9d8d09cSJung-uk Kim 835a9d8d09cSJung-uk Kim AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16); 836a9d8d09cSJung-uk Kim break; 837a9d8d09cSJung-uk Kim 838a9d8d09cSJung-uk Kim case 'z': 839a9d8d09cSJung-uk Kim 840a9d8d09cSJung-uk Kim Gbl_UseOriginalCompilerId = TRUE; 841a9d8d09cSJung-uk Kim break; 842a9d8d09cSJung-uk Kim 843a9d8d09cSJung-uk Kim default: 844a9d8d09cSJung-uk Kim 845a9d8d09cSJung-uk Kim return (-1); 846a9d8d09cSJung-uk Kim } 847a9d8d09cSJung-uk Kim 848a9d8d09cSJung-uk Kim return (0); 849a9d8d09cSJung-uk Kim } 850a9d8d09cSJung-uk Kim 851a9d8d09cSJung-uk Kim 852a9d8d09cSJung-uk Kim /******************************************************************************* 853a9d8d09cSJung-uk Kim * 854a9d8d09cSJung-uk Kim * FUNCTION: AslMergeOptionTokens 855a9d8d09cSJung-uk Kim * 856a9d8d09cSJung-uk Kim * PARAMETERS: InBuffer - Input containing an option string 857a9d8d09cSJung-uk Kim * OutBuffer - Merged output buffer 858a9d8d09cSJung-uk Kim * 859a9d8d09cSJung-uk Kim * RETURN: None 860a9d8d09cSJung-uk Kim * 861a9d8d09cSJung-uk Kim * DESCRIPTION: Remove all whitespace from an option string. 862a9d8d09cSJung-uk Kim * 863a9d8d09cSJung-uk Kim ******************************************************************************/ 864a9d8d09cSJung-uk Kim 865a9d8d09cSJung-uk Kim static void 866a9d8d09cSJung-uk Kim AslMergeOptionTokens ( 867a9d8d09cSJung-uk Kim char *InBuffer, 868a9d8d09cSJung-uk Kim char *OutBuffer) 869a9d8d09cSJung-uk Kim { 870a9d8d09cSJung-uk Kim char *Token; 871a9d8d09cSJung-uk Kim 872a9d8d09cSJung-uk Kim 873a9d8d09cSJung-uk Kim *OutBuffer = 0; 874a9d8d09cSJung-uk Kim 875a9d8d09cSJung-uk Kim Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS); 876a9d8d09cSJung-uk Kim while (Token) 877a9d8d09cSJung-uk Kim { 878a9d8d09cSJung-uk Kim strcat (OutBuffer, Token); 879a9d8d09cSJung-uk Kim Token = strtok (NULL, ASL_TOKEN_SEPARATORS); 880a9d8d09cSJung-uk Kim } 881a9d8d09cSJung-uk Kim } 882a9d8d09cSJung-uk Kim 883a9d8d09cSJung-uk Kim 884a9d8d09cSJung-uk Kim /******************************************************************************* 885a9d8d09cSJung-uk Kim * 886a9d8d09cSJung-uk Kim * FUNCTION: AslDoResponseFile 887a9d8d09cSJung-uk Kim * 888a9d8d09cSJung-uk Kim * PARAMETERS: Filename - Name of the response file 889a9d8d09cSJung-uk Kim * 890a9d8d09cSJung-uk Kim * RETURN: Status 891a9d8d09cSJung-uk Kim * 892a9d8d09cSJung-uk Kim * DESCRIPTION: Open a response file and process all options within. 893a9d8d09cSJung-uk Kim * 894a9d8d09cSJung-uk Kim ******************************************************************************/ 895a9d8d09cSJung-uk Kim 896a9d8d09cSJung-uk Kim static int 897a9d8d09cSJung-uk Kim AslDoResponseFile ( 898a9d8d09cSJung-uk Kim char *Filename) 899a9d8d09cSJung-uk Kim { 900a9d8d09cSJung-uk Kim char *argv = StringBuffer2; 901a9d8d09cSJung-uk Kim FILE *ResponseFile; 902a9d8d09cSJung-uk Kim int OptStatus = 0; 903a9d8d09cSJung-uk Kim int Opterr; 904a9d8d09cSJung-uk Kim int Optind; 905a9d8d09cSJung-uk Kim 906a9d8d09cSJung-uk Kim 907a9d8d09cSJung-uk Kim ResponseFile = fopen (Filename, "r"); 908a9d8d09cSJung-uk Kim if (!ResponseFile) 909a9d8d09cSJung-uk Kim { 910a9d8d09cSJung-uk Kim printf ("Could not open command file %s, %s\n", 911a9d8d09cSJung-uk Kim Filename, strerror (errno)); 912a9d8d09cSJung-uk Kim return (-1); 913a9d8d09cSJung-uk Kim } 914a9d8d09cSJung-uk Kim 915a9d8d09cSJung-uk Kim /* Must save the current GetOpt globals */ 916a9d8d09cSJung-uk Kim 917a9d8d09cSJung-uk Kim Opterr = AcpiGbl_Opterr; 918a9d8d09cSJung-uk Kim Optind = AcpiGbl_Optind; 919a9d8d09cSJung-uk Kim 920a9d8d09cSJung-uk Kim /* 921a9d8d09cSJung-uk Kim * Process all lines in the response file. There must be one complete 922a9d8d09cSJung-uk Kim * option per line 923a9d8d09cSJung-uk Kim */ 924a9d8d09cSJung-uk Kim while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile)) 925a9d8d09cSJung-uk Kim { 926a9d8d09cSJung-uk Kim /* Compress all tokens, allowing us to use a single argv entry */ 927a9d8d09cSJung-uk Kim 928a9d8d09cSJung-uk Kim AslMergeOptionTokens (StringBuffer, StringBuffer2); 929a9d8d09cSJung-uk Kim 930a9d8d09cSJung-uk Kim /* Process the option */ 931a9d8d09cSJung-uk Kim 932a9d8d09cSJung-uk Kim AcpiGbl_Opterr = 0; 933a9d8d09cSJung-uk Kim AcpiGbl_Optind = 0; 934a9d8d09cSJung-uk Kim 935a9d8d09cSJung-uk Kim OptStatus = AslDoOptions (1, &argv, TRUE); 936a9d8d09cSJung-uk Kim if (OptStatus) 937a9d8d09cSJung-uk Kim { 938a9d8d09cSJung-uk Kim printf ("Invalid option in command file %s: %s\n", 939a9d8d09cSJung-uk Kim Filename, StringBuffer); 940a9d8d09cSJung-uk Kim break; 941a9d8d09cSJung-uk Kim } 942a9d8d09cSJung-uk Kim } 943a9d8d09cSJung-uk Kim 944a9d8d09cSJung-uk Kim /* Restore the GetOpt globals */ 945a9d8d09cSJung-uk Kim 946a9d8d09cSJung-uk Kim AcpiGbl_Opterr = Opterr; 947a9d8d09cSJung-uk Kim AcpiGbl_Optind = Optind; 948a9d8d09cSJung-uk Kim 949a9d8d09cSJung-uk Kim fclose (ResponseFile); 950a9d8d09cSJung-uk Kim return (OptStatus); 951a9d8d09cSJung-uk Kim } 952