summaryrefslogtreecommitdiffstats
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.c103
1 files changed, 80 insertions, 23 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c
index 8d82026..3e8d2c6 100644
--- a/sys/contrib/dev/acpica/compiler/aslmain.c
+++ b/sys/contrib/dev/acpica/compiler/aslmain.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslmain - compiler main and utilities
- * $Revision: 77 $
+ * $Revision: 1.87 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,9 +118,9 @@
#define _DECLARE_GLOBALS
-#include "aslcompiler.h"
-#include "acnamesp.h"
-#include "acapps.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/acapps.h>
#ifdef _DEBUG
#include <crtdbg.h>
@@ -133,9 +133,39 @@ BOOLEAN AslToFile = TRUE;
BOOLEAN DoCompile = TRUE;
BOOLEAN DoSignon = TRUE;
-char hex[] = {'0','1','2','3','4','5','6','7',
- '8','9','A','B','C','D','E','F'};
+char hex[] =
+{
+ '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
+};
+
+/* Local prototypes */
+
+static void
+Options (
+ void);
+
+static void
+HelpMessage (
+ void);
+
+static void
+Usage (
+ void);
+
+static void
+AslInitialize (
+ void);
+static void
+AslCommandLine (
+ int argc,
+ char **argv);
+
+#ifdef _DEBUG
+#if ACPI_MACHINE_WIDTH != 16
+#include <crtdbg.h>
+#endif
+#endif
/*******************************************************************************
*
@@ -149,7 +179,7 @@ char hex[] = {'0','1','2','3','4','5','6','7',
*
******************************************************************************/
-void
+static void
Options (
void)
{
@@ -182,9 +212,13 @@ Options (
printf (" -d [file] Disassemble AML to ASL source code file (*.dsl)\n");
printf (" -dc [file] Disassemble AML and immediately compile it\n");
printf (" (Obtain DSDT from current system if no input file)\n");
+ printf (" -2 Emit ACPI 2.0 compatible ASL code\n");
printf (" -e Generate External() statements for unresolved symbols\n");
printf (" -g Get ACPI tables and write to files (*.dat)\n");
+ printf ("\nMiscellaneous:\n");
+ printf (" -a Verify source file is entirely ASCII text (0x00-0x7F)\n");
+
printf ("\nHelp:\n");
printf (" -h Additional help and compiler debug options\n");
printf (" -hc Display operators allowed in constant expressions\n");
@@ -194,7 +228,7 @@ Options (
/*******************************************************************************
*
- * FUNCTION: Usage
+ * FUNCTION: HelpMessage
*
* PARAMETERS: None
*
@@ -204,7 +238,7 @@ Options (
*
******************************************************************************/
-void
+static void
HelpMessage (
void)
{
@@ -242,7 +276,7 @@ HelpMessage (
*
******************************************************************************/
-void
+static void
Usage (
void)
{
@@ -264,8 +298,9 @@ Usage (
*
******************************************************************************/
-void
-AslInitialize (void)
+static void
+AslInitialize (
+ void)
{
UINT32 i;
@@ -302,13 +337,13 @@ AslInitialize (void)
*
******************************************************************************/
-void
+static void
AslCommandLine (
int argc,
char **argv)
{
BOOLEAN BadCommandLine = FALSE;
- ACPI_NATIVE_UINT j;
+ ACPI_NATIVE_INT j;
/* Minimum command line contains at least one option or an input file */
@@ -322,10 +357,15 @@ AslCommandLine (
/* Get the command line options */
- while ((j = AcpiGetopt (argc, argv, "ab:cd^efgh^i^l^o:p:r:s:t:v:x:")) != EOF) switch (j)
+ while ((j = AcpiGetopt (argc, argv, "2ab:cd^efgh^i^l^o:p:r:s:t:v:x:")) != EOF) switch (j)
{
+ case '2':
+ Gbl_Acpi2 = TRUE;
+ break;
+
+
case 'a':
- AslToFile = FALSE;
+ Gbl_CheckForAscii = TRUE;
break;
@@ -647,7 +687,10 @@ AslCommandLine (
/* Next parameter must be the input filename */
Gbl_Files[ASL_FILE_INPUT].Filename = argv[AcpiGbl_Optind];
- if (!Gbl_Files[ASL_FILE_INPUT].Filename && !Gbl_DisasmFlag && !Gbl_GetAllTables)
+
+ if (!Gbl_Files[ASL_FILE_INPUT].Filename &&
+ !Gbl_DisasmFlag &&
+ !Gbl_GetAllTables)
{
printf ("Missing input filename\n");
BadCommandLine = TRUE;
@@ -697,6 +740,13 @@ main (
char *Prefix;
+#ifdef _DEBUG
+#if ACPI_MACHINE_WIDTH != 16
+ _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF |
+ _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
+#endif
+#endif
+
/* Init and command line */
AslInitialize ();
@@ -706,17 +756,20 @@ main (
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
- FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
+ Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
&Gbl_DirectoryPath, &Prefix);
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
if (Gbl_UseDefaultAmlFilename)
{
Gbl_OutputFilenamePrefix = Prefix;
}
- /*
- * AML Disassembly (Optional)
- */
+ /* AML Disassembly (Optional) */
+
if (Gbl_DisasmFlag || Gbl_GetAllTables)
{
/* ACPI CA subsystem initialization */
@@ -768,8 +821,12 @@ main (
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
- FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
+ Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
&Gbl_DirectoryPath, &Prefix);
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
if (Gbl_UseDefaultAmlFilename)
{
OpenPOWER on IntegriCloud