aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/compiler/aslmain.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/aslmain.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmain.c129
1 files changed, 96 insertions, 33 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c
index 67e561acf0aa..8c3d2d296e2d 100644
--- a/sys/contrib/dev/acpica/compiler/aslmain.c
+++ b/sys/contrib/dev/acpica/compiler/aslmain.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2014, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,17 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslmain")
+/*
+ * Main routine for the iASL compiler.
+ *
+ * Portability note: The compiler depends upon the host for command-line
+ * wildcard support - it is not implemented locally. For example:
+ *
+ * Linux/Unix systems: Shell expands wildcards automatically.
+ *
+ * Windows: The setargv.obj module must be linked in to automatically
+ * expand wildcards.
+ */
/* Local prototypes */
@@ -62,6 +73,36 @@ static void
AslInitialize (
void);
+UINT8
+AcpiIsBigEndianMachine (
+ void);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiIsBigEndianMachine
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: TRUE if machine is big endian
+ * FALSE if machine is little endian
+ *
+ * DESCRIPTION: Detect whether machine is little endian or big endian.
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiIsBigEndianMachine (
+ void)
+{
+ union {
+ UINT32 Integer;
+ UINT8 Bytes[4];
+ } Overlay = {0xFF000000};
+
+ return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */
+}
+
/*******************************************************************************
*
@@ -83,11 +124,21 @@ Usage (
printf ("%s\n\n", ASL_COMPLIANCE);
ACPI_USAGE_HEADER ("iasl [Options] [Files]");
- printf ("\nGlobal:\n");
+ printf ("\nGeneral:\n");
ACPI_OPTION ("-@ <file>", "Specify command file");
ACPI_OPTION ("-I <dir>", "Specify additional include directory");
ACPI_OPTION ("-T <sig>|ALL|*", "Create table template file for ACPI <Sig>");
+ ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files");
ACPI_OPTION ("-v", "Display compiler version");
+ ACPI_OPTION ("-vo", "Enable optimization comments");
+ ACPI_OPTION ("-vs", "Disable signon");
+
+ printf ("\nHelp:\n");
+ ACPI_OPTION ("-h", "This message");
+ ACPI_OPTION ("-hc", "Display operators allowed in constant expressions");
+ ACPI_OPTION ("-hf", "Display help for output filename generation");
+ ACPI_OPTION ("-hr", "Display ACPI reserved method names");
+ ACPI_OPTION ("-ht", "Display currently supported ACPI table names");
printf ("\nPreprocessor:\n");
ACPI_OPTION ("-D <symbol>", "Define symbol for preprocessor use");
@@ -95,13 +146,11 @@ Usage (
ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)");
ACPI_OPTION ("-Pn", "Disable preprocessor");
- printf ("\nGeneral Processing:\n");
- ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files");
- ACPI_OPTION ("-va", "Disable all errors and warnings (summary only)");
+ printf ("\nErrors, Warnings, and Remarks:\n");
+ ACPI_OPTION ("-va", "Disable all errors/warnings/remarks");
+ ACPI_OPTION ("-ve", "Report only errors (ignore warnings and remarks)");
ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs");
- ACPI_OPTION ("-vo", "Enable optimization comments");
ACPI_OPTION ("-vr", "Disable remarks");
- ACPI_OPTION ("-vs", "Disable signon");
ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark");
ACPI_OPTION ("-w1 -w2 -w3", "Set warning reporting level");
ACPI_OPTION ("-we", "Report warnings as errors");
@@ -123,6 +172,7 @@ Usage (
printf ("\nOptional Listing Files:\n");
ACPI_OPTION ("-l", "Create mixed listing file (ASL source and AML) (*.lst)");
+ ACPI_OPTION ("-lm", "Create hardware summary map file (*.map)");
ACPI_OPTION ("-ln", "Create namespace file (*.nsp)");
ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)");
@@ -131,25 +181,17 @@ Usage (
ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)");
printf ("\nAML Disassembler:\n");
- ACPI_OPTION ("-d <f1,f2>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
+ ACPI_OPTION ("-d <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
ACPI_OPTION ("", " (Optional, file type is automatically detected)");
- ACPI_OPTION ("-da <f1,f2>", "Disassemble multiple tables from single namespace");
+ ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace");
ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates");
- ACPI_OPTION ("-dc <f1,f2>", "Disassemble AML and immediately compile it");
+ ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
- ACPI_OPTION ("-e <f1,f2>", "Include ACPI table(s) for external symbol resolution");
+ ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file");
- ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
ACPI_OPTION ("-in", "Ignore NoOp opcodes");
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
- printf ("\nHelp:\n");
- ACPI_OPTION ("-h", "This message");
- ACPI_OPTION ("-hc", "Display operators allowed in constant expressions");
- ACPI_OPTION ("-hf", "Display help for output filename generation");
- ACPI_OPTION ("-hr", "Display ACPI reserved method names");
- ACPI_OPTION ("-ht", "Display currently supported ACPI table names");
-
printf ("\nDebug Options:\n");
ACPI_OPTION ("-bf -bt", "Create debug file (full or parse tree only) (*.txt)");
ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)");
@@ -286,8 +328,22 @@ main (
ACPI_STATUS Status;
int Index1;
int Index2;
+ int ReturnStatus = 0;
+
+ /*
+ * Big-endian machines are not currently supported. ACPI tables must
+ * be little-endian, and support for big-endian machines needs to
+ * be implemented.
+ */
+ if (AcpiIsBigEndianMachine ())
+ {
+ fprintf (stderr,
+ "iASL is not currently supported on big-endian machines.\n");
+ return (-1);
+ }
+ AcpiOsInitialize ();
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
/* Initialize preprocessor and compiler before command line processing */
@@ -307,21 +363,11 @@ main (
/* Perform global actions first/only */
- if (Gbl_GetAllTables)
- {
- Status = AslDoOneFile (NULL);
- if (ACPI_FAILURE (Status))
- {
- return (-1);
- }
- return (0);
- }
-
if (Gbl_DisassembleAll)
{
while (argv[Index1])
{
- Status = AslDoOnePathname (argv[Index1], AcpiDmAddToExternalFileList);
+ Status = AcpiDmAddToExternalFileList (argv[Index1]);
if (ACPI_FAILURE (Status))
{
return (-1);
@@ -335,19 +381,36 @@ main (
while (argv[Index2])
{
- Status = AslDoOnePathname (argv[Index2], AslDoOneFile);
+ /*
+ * If -p not specified, we will use the input filename as the
+ * output filename prefix
+ */
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = argv[Index2];
+ UtConvertBackslashes (Gbl_OutputFilenamePrefix);
+ }
+
+ Status = AslDoOneFile (argv[Index2]);
if (ACPI_FAILURE (Status))
{
- return (-1);
+ ReturnStatus = -1;
+ goto CleanupAndExit;
}
Index2++;
}
+
+CleanupAndExit:
+
+ UtFreeLineBuffers ();
+ AslParserCleanup ();
+
if (AcpiGbl_ExternalFileList)
{
AcpiDmClearExternalFileList();
}
- return (0);
+ return (ReturnStatus);
}