From owner-svn-src-all@FreeBSD.ORG Tue Mar 20 21:37:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86BD01065670; Tue, 20 Mar 2012 21:37:53 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D7528FC12; Tue, 20 Mar 2012 21:37:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KLbrP5039034; Tue, 20 Mar 2012 21:37:53 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KLbrFu039018; Tue, 20 Mar 2012 21:37:53 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203202137.q2KLbrFu039018@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 20 Mar 2012 21:37:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233250 - in head: share/man/man4 sys/amd64/acpica sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/co... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 21:37:53 -0000 Author: jkim Date: Tue Mar 20 21:37:52 2012 New Revision: 233250 URL: http://svn.freebsd.org/changeset/base/233250 Log: Merge ACPICA 20120320. Added: head/sys/contrib/dev/acpica/compiler/preprocess.h - copied unchanged from r233238, vendor-sys/acpica/dist/source/compiler/preprocess.h head/sys/contrib/dev/acpica/compiler/prexpress.c - copied, changed from r233238, vendor-sys/acpica/dist/source/compiler/prexpress.c head/sys/contrib/dev/acpica/compiler/prmacros.c - copied, changed from r233238, vendor-sys/acpica/dist/source/compiler/prmacros.c head/sys/contrib/dev/acpica/compiler/prparser.l - copied, changed from r233238, vendor-sys/acpica/dist/source/compiler/prparser.l head/sys/contrib/dev/acpica/compiler/prparser.y - copied, changed from r233238, vendor-sys/acpica/dist/source/compiler/prparser.y head/sys/contrib/dev/acpica/compiler/prscan.c - copied, changed from r233238, vendor-sys/acpica/dist/source/compiler/prscan.c head/sys/contrib/dev/acpica/compiler/prutils.c - copied, changed from r233238, vendor-sys/acpica/dist/source/compiler/prutils.c Modified: head/share/man/man4/acpi.4 head/sys/amd64/acpica/acpi_wakeup.c head/sys/contrib/dev/acpica/acpica_prep.sh head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/adisasm.c head/sys/contrib/dev/acpica/common/getopt.c head/sys/contrib/dev/acpica/compiler/aslcodegen.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslcompiler.h head/sys/contrib/dev/acpica/compiler/aslcompiler.y head/sys/contrib/dev/acpica/compiler/aslerror.c head/sys/contrib/dev/acpica/compiler/aslfiles.c head/sys/contrib/dev/acpica/compiler/aslglobal.h head/sys/contrib/dev/acpica/compiler/aslmain.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslstartup.c head/sys/contrib/dev/acpica/compiler/asltypes.h head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/dtcompile.c head/sys/contrib/dev/acpica/compiler/dtcompiler.h head/sys/contrib/dev/acpica/compiler/dtexpress.c head/sys/contrib/dev/acpica/compiler/dtio.c head/sys/contrib/dev/acpica/compiler/dtparser.y head/sys/contrib/dev/acpica/components/debugger/dbcmds.c head/sys/contrib/dev/acpica/components/hardware/hwesleep.c head/sys/contrib/dev/acpica/components/hardware/hwsleep.c head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c head/sys/contrib/dev/acpica/components/namespace/nsdump.c head/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c head/sys/contrib/dev/acpica/components/namespace/nspredef.c head/sys/contrib/dev/acpica/components/namespace/nsrepair.c head/sys/contrib/dev/acpica/components/namespace/nsutils.c head/sys/contrib/dev/acpica/components/tables/tbfadt.c head/sys/contrib/dev/acpica/components/tables/tbinstal.c head/sys/contrib/dev/acpica/components/tables/tbutils.c head/sys/contrib/dev/acpica/include/achware.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acnames.h head/sys/contrib/dev/acpica/include/acnamesp.h head/sys/contrib/dev/acpica/include/acoutput.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpivar.h head/sys/i386/acpica/acpi_wakeup.c head/usr.sbin/acpi/iasl/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) head/sys/contrib/dev/acpica/common/ (props changed) head/sys/contrib/dev/acpica/compiler/ (props changed) head/sys/contrib/dev/acpica/components/debugger/ (props changed) head/sys/contrib/dev/acpica/components/hardware/ (props changed) head/sys/contrib/dev/acpica/components/namespace/ (props changed) head/sys/contrib/dev/acpica/components/tables/ (props changed) head/sys/contrib/dev/acpica/include/ (props changed) Modified: head/share/man/man4/acpi.4 ============================================================================== --- head/share/man/man4/acpi.4 Tue Mar 20 20:37:23 2012 (r233249) +++ head/share/man/man4/acpi.4 Tue Mar 20 21:37:52 2012 (r233250) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 26, 2010 +.Dd March 20, 2012 .Dt ACPI 4 .Os .Sh NAME @@ -214,6 +214,14 @@ Override any automatic quirks completely Beep the PC speaker on resume. This can help diagnose suspend/resume problems. Default is 0 (disabled). +.It Va debug.acpi.sleep_flags +Execute optional ACPI methods for suspend/resume. +If the bit 0 is set (1), it will try to execute _GTS (Going To Sleep) method +when entering suspend state. +If the bit 1 is set (2), it will try to execute _BFS (Back From Sleep) method +when leaving suspend state. +If both the bits are set (3), both the methods will be tried. +Default is 0 (disabled). .It Va hint.acpi.0.disabled Set this to 1 to disable all of ACPI. If ACPI has been disabled on your system due to a blacklist entry for your Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/amd64/acpica/acpi_wakeup.c Tue Mar 20 21:37:52 2012 (r233250) @@ -270,7 +270,7 @@ acpi_sleep_machdep(struct acpi_softc *sc if (state == ACPI_STATE_S4 && sc->acpi_s4bios) status = AcpiEnterSleepStateS4bios(); else - status = AcpiEnterSleepState(state); + status = AcpiEnterSleepState(state, acpi_sleep_flags); if (status != AE_OK) { device_printf(sc->acpi_dev, Modified: head/sys/contrib/dev/acpica/acpica_prep.sh ============================================================================== --- head/sys/contrib/dev/acpica/acpica_prep.sh Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/acpica_prep.sh Tue Mar 20 21:37:52 2012 (r233250) @@ -31,7 +31,7 @@ src_headers="acapps.h accommon.h acconfi actbl2.h actbl3.h actypes.h acutils.h amlcode.h amlresrc.h \ platform/acenv.h platform/acfreebsd.h platform/acgcc.h" comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \ - asltypes.h dtcompiler.h dttemplate.h" + asltypes.h dtcompiler.h dttemplate.h preprocess.h" platform_headers="acfreebsd.h acgcc.h" # pre-clean Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/changes.txt Tue Mar 20 21:37:52 2012 (r233250) @@ -1,4 +1,96 @@ ---------------------------------------- +20 March 2012. Summary of changes for version 20120320: + +This release is available at www.acpica.org/downloads. +The ACPI 5.0 specification is available at www.acpi.info. + +1) ACPICA Core Subsystem: + +Enhanced the sleep/wake interfaces to optionally execute the _GTS method +(Going To Sleep) and the _BFS method (Back From Sleep). Windows apparently +does not execute these methods, and therefore these methods are often +untested. It has been seen on some systems where the execution of these +methods causes errors and also prevents the machine from entering S5. It is +therefore suggested that host operating systems do not execute these methods +by default. In the future, perhaps these methods can be optionally executed +based on the age of the system and/or what is the newest version of Windows +that the BIOS asks for via _OSI. Changed interfaces: AcpiEnterSleepState and +AcpileaveSleepStatePrep. See the ACPICA reference and Linux BZ 13041. Lin +Ming. + +Fixed a problem where the length of the local/common FADT was set too early. +The local FADT table length cannot be set to the common length until the +original length has been examined. There is code that checks the table length +and sets various fields appropriately. This can affect older machines with +early FADT versions. For example, this can cause inadvertent writes to the +CST_CNT register. Julian Anastasov. + +Fixed a mapping issue related to a physical table override. Use the deferred +mapping mechanism for tables loaded via the physical override OSL interface. +This allows for early mapping before the virtual memory manager is available. +Thomas Renninger, Bob Moore. + +Enhanced the automatic return-object repair code: Repair a common problem with +predefined methods that are defined to return a variable-length Package of +sub-objects. If there is only one sub-object, some BIOS ASL code mistakenly +simply returns the single object instead of a Package with one sub-object. +This new support will repair this error by wrapping a Package object around +the original object, creating the correct and expected Package with one sub- +object. Names that can be repaired in this manner include: _ALR, _CSD, _HPX, +_MLS, _PLD, _PRT, _PSS, _TRT, _TSS, _BCL, _DOD, _FIX, and _Sx. ACPICA BZ 939. + +Changed the exception code returned for invalid ACPI paths passed as +parameters to external interfaces such as AcpiEvaluateObject. Was +AE_BAD_PARAMETER, now is the more sensible AE_BAD_PATHNAME. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug +version of the code includes the debug output trace mechanism and has a much +larger code and data size. + + Previous Release: + Non-Debug Version: 93.0K Code, 25.0K Data, 118.0K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + Current Release: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Added the infrastructure and initial implementation of a integrated C- +like preprocessor. This will simplify BIOS development process by eliminating +the need for a separate preprocessing step during builds. On Windows, it also +eliminates the need to install a separate C compiler. ACPICA BZ 761. Some +features including full #define() macro support are still under development. +These preprocessor directives are supported: + #define + #elif + #else + #endif + #error + #if + #ifdef + #ifndef + #include + #pragma message + #undef + #warning +In addition, these new command line options are supported: + -D Define symbol for preprocessor use + -li Create preprocessed output file (*.i) + -P Preprocess only and create preprocessor output file (*.i) + +Table Compiler: Fixed a problem where the equals operator within an expression +did not work properly. + +Updated iASL to use the current versions of Bison/Flex. Updated the Windows +project file to invoke these tools from the standard location. ACPICA BZ 904. +Versions supported: + Flex for Windows: V2.5.4 + Bison for Windows: V2.4.1 + +---------------------------------------- 15 February 2012. Summary of changes for version 20120215: This release is available at www.acpica.org/downloads. Modified: head/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adisasm.c Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/common/adisasm.c Tue Mar 20 21:37:52 2012 (r233250) @@ -75,6 +75,10 @@ LsSetupNsList ( /* Local prototypes */ +static UINT32 +AdGetFileSize ( + FILE *File); + static void AdCreateTableHeader ( char *Filename, @@ -160,6 +164,38 @@ static ACPI_PARSE_OBJECT *AcpiGbl_Par /******************************************************************************* * + * FUNCTION: AdGetFileSize + * + * PARAMETERS: File - Open file handle + * + * RETURN: File Size + * + * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. + * + ******************************************************************************/ + +static UINT32 +AdGetFileSize ( + FILE *File) +{ + UINT32 FileSize; + long Offset; + + + Offset = ftell (File); + + fseek (File, 0, SEEK_END); + FileSize = (UINT32) ftell (File); + + /* Restore file pointer */ + + fseek (File, Offset, SEEK_SET); + return (FileSize); +} + + +/******************************************************************************* + * * FUNCTION: AdInitialize * * PARAMETERS: None @@ -380,8 +416,10 @@ AdAmlDisassemble ( "FieldName : FieldValue\n */\n\n"); AcpiDmDumpDataTable (Table); - fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n", - Table->Signature, DisasmFilename); + fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", + Table->Signature); + fprintf (stderr, "Formatted output: %s - %u bytes\n", + DisasmFilename, AdGetFileSize (File)); } else { @@ -490,9 +528,9 @@ AdAmlDisassemble ( if (AcpiGbl_DbOpt_disasm) { AdDisplayTables (Filename, Table); - fprintf (stderr, - "Disassembly completed, written to \"%s\"\n", - DisasmFilename); + fprintf (stderr, "Disassembly completed\n"); + fprintf (stderr, "ASL Output: %s - %u bytes\n", + DisasmFilename, AdGetFileSize (File)); } } Modified: head/sys/contrib/dev/acpica/common/getopt.c ============================================================================== --- head/sys/contrib/dev/acpica/common/getopt.c Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/common/getopt.c Tue Mar 20 21:37:52 2012 (r233250) @@ -49,7 +49,8 @@ #include #include -#define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);} +#define ACPI_OPTION_ERROR(msg, badchar) \ + if (AcpiGbl_Opterr) {fprintf (stderr, "%s%c\n", msg, badchar);} int AcpiGbl_Opterr = 1; @@ -87,12 +88,12 @@ AcpiGetopt( argv[AcpiGbl_Optind][0] != '-' || argv[AcpiGbl_Optind][1] == '\0') { - return(EOF); + return (EOF); } else if (strcmp (argv[AcpiGbl_Optind], "--") == 0) { AcpiGbl_Optind++; - return(EOF); + return (EOF); } } @@ -105,7 +106,7 @@ AcpiGetopt( if (CurrentChar == ':' || (OptsPtr = strchr (opts, CurrentChar)) == NULL) { - ERR (": illegal option -- ", CurrentChar); + ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar); if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0') { @@ -126,7 +127,7 @@ AcpiGetopt( } else if (++AcpiGbl_Optind >= argc) { - ERR (": option requires an argument -- ", CurrentChar); + ACPI_OPTION_ERROR ("Option requires an argument: -", CurrentChar); CurrentCharPtr = 1; return ('?'); @@ -156,6 +157,26 @@ AcpiGetopt( CurrentCharPtr = 1; } + /* Option has a required single-char argument? */ + + else if (*OptsPtr == '|') + { + if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') + { + AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)]; + } + else + { + ACPI_OPTION_ERROR ("Option requires a single-character suboption: -", CurrentChar); + + CurrentCharPtr = 1; + return ('?'); + } + + AcpiGbl_Optind++; + CurrentCharPtr = 1; + } + /* Option with no arguments */ else Modified: head/sys/contrib/dev/acpica/compiler/aslcodegen.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcodegen.c Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/compiler/aslcodegen.c Tue Mar 20 21:37:52 2012 (r233250) @@ -264,7 +264,7 @@ CgWriteAmlOpcode ( /* These opcodes should not get here */ printf ("Found a node with an unassigned AML opcode\n"); - fprintf (stderr, "Found a node with an unassigned AML opcode\n"); + FlPrintFile (ASL_FILE_STDERR, "Found a node with an unassigned AML opcode\n"); return; case AML_INT_RESERVEDFIELD_OP: Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Tue Mar 20 21:37:52 2012 (r233250) @@ -457,6 +457,17 @@ CmDoCompile ( Event = UtBeginEvent ("Open input and output files"); UtEndEvent (Event); + /* Preprocessor */ + + Event = UtBeginEvent ("Preprocess input file"); + PrDoPreprocess (); + UtEndEvent (Event); + if (Gbl_PreprocessOnly) + { + CmCleanupAndExit (); + return 0; + } + /* Build the parse tree */ Event = UtBeginEvent ("Parse source code and build parse tree"); @@ -474,8 +485,7 @@ CmDoCompile ( { AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, "- Could not resolve parse tree root node"); - CmCleanupAndExit (); - return -1; + goto ErrorExit; } /* Optional parse tree dump, compiler debug output only */ @@ -508,12 +518,12 @@ CmDoCompile ( */ Event = UtBeginEvent ("Open AML output file"); Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); + UtEndEvent (Event); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return -1; } - UtEndEvent (Event); /* Interpret and generate all compile-time constants */ @@ -552,6 +562,7 @@ CmDoCompile ( AePrintErrorLog (ASL_FILE_STDERR); UtDisplaySummary (ASL_FILE_STDERR); } + UtEndEvent (FullCompile); return 0; } @@ -566,7 +577,7 @@ CmDoCompile ( UtEndEvent (Event); if (ACPI_FAILURE (Status)) { - return -1; + goto ErrorExit; } /* Namespace cross-reference */ @@ -575,7 +586,7 @@ CmDoCompile ( Status = LkCrossReferenceNamespace (); if (ACPI_FAILURE (Status)) { - return -1; + goto ErrorExit; } /* Namespace - Check for non-referenced objects */ @@ -646,6 +657,11 @@ CmDoCompile ( UtEndEvent (FullCompile); CmCleanupAndExit (); return 0; + +ErrorExit: + UtEndEvent (FullCompile); + CmCleanupAndExit (); + return (-1); } @@ -799,7 +815,9 @@ CmCleanupAndExit ( /* Close all open files */ - for (i = 2; i < ASL_MAX_FILE_TYPE; i++) + Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */ + + for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { FlCloseFile (i); } @@ -817,6 +835,18 @@ CmCleanupAndExit ( } } + /* Delete the preprocessor output file (.i) unless -li flag is set */ + + if (!Gbl_PreprocessorOutputFlag && Gbl_Files[ASL_FILE_PREPROCESSOR].Filename) + { + if (remove (Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)) + { + printf ("%s: ", + Gbl_Files[ASL_FILE_PREPROCESSOR].Filename); + perror ("Could not delete preprocessor .i file"); + } + } + /* * Delete intermediate ("combined") source file (if -ls flag not set) * This file is created during normal ASL/AML compiles. It is not Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.h Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.h Tue Mar 20 21:37:52 2012 (r233250) @@ -75,6 +75,7 @@ #include #include #include +#include /******************************************************************************* @@ -84,7 +85,7 @@ ******************************************************************************/ /* - * parser - generated from flex/bison, lex/yacc, etc. + * Main ASL parser - generated from flex/bison, lex/yacc, etc. */ int AslCompilerparse( @@ -303,6 +304,16 @@ AslCommonError ( char *ExtraMessage); void +AslCommonError2 ( + UINT8 Level, + UINT8 MessageId, + UINT32 LineNumber, + UINT32 Column, + char *SourceLine, + char *Filename, + char *ExtraMessage); + +void AePrintException ( UINT32 FileId, ASL_ERROR_MSG *Enode, Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.y ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.y Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.y Tue Mar 20 21:37:52 2012 (r233250) @@ -78,6 +78,11 @@ void * AslLocalAllo #define YYDEBUG 1 /* Enable debug output */ #define YYERROR_VERBOSE 1 /* Verbose error messages */ +/* Define YYMALLOC/YYFREE to prevent redefinition errors */ + +#define YYMALLOC malloc +#define YYFREE free + /* * The windows version of bison defines this incorrectly as "32768" (Not negative). * We use a custom (edited binary) version of bison that defines YYFLAG as YYFBAD Modified: head/sys/contrib/dev/acpica/compiler/aslerror.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslerror.c Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/compiler/aslerror.c Tue Mar 20 21:37:52 2012 (r233250) @@ -55,6 +55,18 @@ AeAddToErrorLog ( ASL_ERROR_MSG *Enode); +/******************************************************************************* + * + * FUNCTION: AeClearErrorLog + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Empty the error list + * + ******************************************************************************/ + void AeClearErrorLog ( void) @@ -168,7 +180,7 @@ AePrintException ( UINT32 SourceColumn; UINT32 ErrorColumn; FILE *OutputFile; - FILE *SourceFile; + FILE *SourceFile = NULL; long FileSize; BOOLEAN PrematureEOF = FALSE; @@ -211,24 +223,28 @@ AePrintException ( OutputFile = Gbl_Files[FileId].Handle; - /* Use the merged header/source file if present, otherwise use input file */ - SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; - if (!SourceFile) + if (!Enode->SourceLine) { - SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle; - } + /* Use the merged header/source file if present, otherwise use input file */ - if (SourceFile) - { - /* Determine if the error occurred at source file EOF */ - - fseek (SourceFile, 0, SEEK_END); - FileSize = ftell (SourceFile); + SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; + if (!SourceFile) + { + SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle; + } - if ((long) Enode->LogicalByteOffset >= FileSize) + if (SourceFile) { - PrematureEOF = TRUE; + /* Determine if the error occurred at source file EOF */ + + fseek (SourceFile, 0, SEEK_END); + FileSize = ftell (SourceFile); + + if ((long) Enode->LogicalByteOffset >= FileSize) + { + PrematureEOF = TRUE; + } } } @@ -247,46 +263,59 @@ AePrintException ( if (Enode->LineNumber) { - fprintf (OutputFile, " %6u: ", Enode->LineNumber); - - /* - * If not at EOF, get the corresponding source code line and - * display it. Don't attempt this if we have a premature EOF - * condition. - */ - if (!PrematureEOF) + if (Enode->SourceLine) + { + fprintf (OutputFile, " %6u: %s", + Enode->LineNumber, Enode->SourceLine); + } + else { + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL) + fprintf (OutputFile, " %6u: ", + PrGetLineNumber (Enode->LineNumber)); + else + fprintf (OutputFile, " %6u: ", + Enode->LineNumber); + /* - * Seek to the offset in the combined source file, read - * the source line, and write it to the output. + * If not at EOF, get the corresponding source code line and + * display it. Don't attempt this if we have a premature EOF + * condition. */ - Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, - (int) SEEK_SET); - if (Actual) + if (!PrematureEOF) { - fprintf (OutputFile, - "[*** iASL: Seek error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - else - { - RActual = fread (&SourceByte, 1, 1, SourceFile); - if (!RActual) + /* + * Seek to the offset in the combined source file, read + * the source line, and write it to the output. + */ + Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, + (int) SEEK_SET); + if (Actual) { fprintf (OutputFile, - "[*** iASL: Read error on source code temp file %s ***]", + "[*** iASL: Seek error on source code temp file %s ***]", Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } - - else while (RActual && SourceByte && (SourceByte != '\n')) + else { - fwrite (&SourceByte, 1, 1, OutputFile); RActual = fread (&SourceByte, 1, 1, SourceFile); + if (!RActual) + { + fprintf (OutputFile, + "[*** iASL: Read error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + } + + else while (RActual && SourceByte && (SourceByte != '\n')) + { + fwrite (&SourceByte, 1, 1, OutputFile); + RActual = fread (&SourceByte, 1, 1, SourceFile); + } } } - } - fprintf (OutputFile, "\n"); + fprintf (OutputFile, "\n"); + } } } else @@ -295,7 +324,16 @@ AePrintException ( if (Enode->LineNumber) { - fprintf (OutputFile, "(%u) : ", Enode->LineNumber); + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL) + { + fprintf (OutputFile, "(%u) i:%6u : ", + PrGetLineNumber (Enode->LineNumber), Enode->LineNumber); + } + else + { + fprintf (OutputFile, "(%u) i:%6u : ", + Enode->LineNumber, Enode->LineNumber); + } } } } @@ -421,6 +459,91 @@ AePrintErrorLog ( /******************************************************************************* * + * FUNCTION: AslCommonError2 + * + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer + * LineNumber - Actual file line number + * Column - Column in current line + * SourceLine - Actual source code line + * Filename - source filename + * ExtraMessage - additional error message + * + * RETURN: None + * + * DESCRIPTION: Create a new error node and add it to the error log + * + ******************************************************************************/ + +void +AslCommonError2 ( + UINT8 Level, + UINT8 MessageId, + UINT32 LineNumber, + UINT32 Column, + char *SourceLine, + char *Filename, + char *ExtraMessage) +{ + char *MessageBuffer = NULL; + char *LineBuffer; + ASL_ERROR_MSG *Enode; + + + Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); + + if (ExtraMessage) + { + /* Allocate a buffer for the message and a new error node */ + + MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1); + + /* Keep a copy of the extra message */ + + ACPI_STRCPY (MessageBuffer, ExtraMessage); + } + + LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1); + ACPI_STRCPY (LineBuffer, SourceLine); + + /* Initialize the error node */ + + if (Filename) + { + Enode->Filename = Filename; + Enode->FilenameLength = strlen (Filename); + if (Enode->FilenameLength < 6) + { + Enode->FilenameLength = 6; + } + } + + Enode->MessageId = MessageId; + Enode->Level = Level; + Enode->LineNumber = LineNumber; + Enode->LogicalLineNumber = LineNumber; + Enode->LogicalByteOffset = 0; + Enode->Column = Column; + Enode->Message = MessageBuffer; + Enode->SourceLine = LineBuffer; + + /* Add the new node to the error node list */ + + AeAddToErrorLog (Enode); + + if (Gbl_DebugFlag) + { + /* stderr is a file, send error to it immediately */ + + AePrintException (ASL_FILE_STDERR, Enode, NULL); + } + + Gbl_ExceptionCount[Level]++; +} + + +/******************************************************************************* + * * FUNCTION: AslCommonError * * PARAMETERS: Level - Seriousness (Warning/error, etc.) @@ -487,6 +610,7 @@ AslCommonError ( Enode->LogicalByteOffset = LogicalByteOffset; Enode->Column = Column; Enode->Message = MessageBuffer; + Enode->SourceLine = NULL; /* Add the new node to the error node list */ @@ -553,7 +677,6 @@ AslError ( break; } - if (Op) { AslCommonError (Level, MessageId, Op->Asl.LineNumber, @@ -643,5 +766,3 @@ AslCompilererror ( return 0; } - - Modified: head/sys/contrib/dev/acpica/compiler/aslfiles.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslfiles.c Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/compiler/aslfiles.c Tue Mar 20 21:37:52 2012 (r233250) @@ -50,7 +50,7 @@ /* Local prototypes */ -static FILE * +FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, char *Filename); @@ -363,14 +363,13 @@ FlCloseFile ( } Error = fclose (Gbl_Files[FileId].Handle); - Gbl_Files[FileId].Handle = NULL; - if (Error) { FlFileError (FileId, ASL_MSG_CLOSE); AslAbort (); } + Gbl_Files[FileId].Handle = NULL; return; } @@ -478,7 +477,7 @@ FlAddIncludeDirectory ( * ******************************************************************************/ -static FILE * +FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, char *Filename) @@ -740,6 +739,13 @@ FlOpenMiscOutputFiles ( Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = freopen (Filename, "w+t", stderr); + if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle) + { + AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT); } @@ -764,12 +770,26 @@ FlOpenMiscOutputFiles ( AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); } + /* Create the preprocessor output file */ + + Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR); + if (!Filename) + { + AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + + FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b"); + + /* All done for data table compiler */ + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) { return (AE_OK); } - /* Create/Open a combined source output file */ + /* Create/Open a combined source output file */ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE); if (!Filename) @@ -786,6 +806,10 @@ FlOpenMiscOutputFiles ( */ FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b"); +/* +// TBD: TEMP +// AslCompilerin = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; +*/ /* Create/Open a assembly code source output file if asked */ if (Gbl_AsmOutputFlag) Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslglobal.h Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h Tue Mar 20 21:37:52 2012 (r233250) @@ -70,10 +70,11 @@ extern int yyde extern FILE *AslCompilerin; extern int AslCompilerdebug; extern int DtParserdebug; +extern int PrParserdebug; extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; extern char *AslCompilertext; -#define ASL_LINE_BUFFER_SIZE 1024 +#define ASL_LINE_BUFFER_SIZE 4096 #define ASL_MSG_BUFFER_SIZE 4096 #define HEX_TABLE_LINE_SIZE 8 #define HEX_LISTING_LINE_SIZE 8 @@ -88,22 +89,22 @@ ASL_EXTERN UINT32 ASL_ ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, Gbl_CurrentLineBuffer); - /* Exception reporting */ ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL); ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL); - /* Option flags */ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessOnly, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE); @@ -203,7 +204,7 @@ extern char AslH /* Event timing */ -#define ASL_NUM_EVENTS 19 +#define ASL_NUM_EVENTS 20 ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[ASL_NUM_EVENTS]; ASL_EXTERN UINT8 AslGbl_NextEvent; ASL_EXTERN UINT8 AslGbl_NamespaceEvent; Modified: head/sys/contrib/dev/acpica/compiler/aslmain.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmain.c Tue Mar 20 20:37:23 2012 (r233249) +++ head/sys/contrib/dev/acpica/compiler/aslmain.c Tue Mar 20 21:37:52 2012 (r233250) @@ -96,7 +96,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^mno:p:r:s:t:T:G^v:w:x:z" +#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^mno|p:Pr:s|t|T:G^v|w|x:z" /******************************************************************************* @@ -120,6 +120,11 @@ Options ( ACPI_OPTION ("-@ ", "Specify command file"); ACPI_OPTION ("-I ", "Specify additional include directory"); + printf ("\nPreprocessor:\n"); + ACPI_OPTION ("-D ", "Define symbol for preprocessor use"); + ACPI_OPTION ("-li", "Create preprocessed output file (*.i)"); + ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)"); + printf ("\nGeneral Output:\n"); ACPI_OPTION ("-p ", "Specify path/filename prefix for all output files"); ACPI_OPTION ("-va", "Disable all errors and warnings (summary only)"); @@ -127,12 +132,12 @@ Options ( ACPI_OPTION ("-vo", "Enable optimization comments"); ACPI_OPTION ("-vr", "Disable remarks"); ACPI_OPTION ("-vs", "Disable signon"); - ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level"); + ACPI_OPTION ("-w1 -w2 -w3", "Set warning reporting level"); printf ("\nAML Output Files:\n"); - ACPI_OPTION ("-s ", "Create AML in assembler or C source file (*.asm or *.c)"); - ACPI_OPTION ("-i ", "Create assembler or C include file (*.inc or *.h)"); - ACPI_OPTION ("-t ", "Create AML in assembler, C, or ASL hex table (*.hex)"); + ACPI_OPTION ("-sa -sc", "Create AML in assembler or C source file (*.asm or *.c)"); + ACPI_OPTION ("-ia -ic", "Create assembler or C include file (*.inc or *.h)"); + ACPI_OPTION ("-ta -tc -ts", "Create AML in assembler, C, or ASL hex table (*.hex)"); printf ("\nAML Code Generation:\n"); ACPI_OPTION ("-oa", "Disable all optimizations (compatibility mode)"); @@ -199,12 +204,12 @@ HelpMessage ( Options (); printf ("\nCompiler/Disassembler Debug Options:\n"); - ACPI_OPTION ("-b", "Create compiler debug/trace file (*.txt)"); + ACPI_OPTION ("-bb -bp -bt", "Create compiler debug/trace file (*.txt)"); ACPI_OPTION ("", "Types: Parse/Tree/Both"); ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); ACPI_OPTION ("-n", "Parse only, no output generation"); ACPI_OPTION ("-ot", "Display compile times"); - ACPI_OPTION ("-x", "Set debug level for trace output"); + ACPI_OPTION ("-x ", "Set debug level for trace output"); ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } @@ -405,34 +410,34 @@ AslDoOptions ( if (IsResponseFile) { printf ("Nested command files are not supported\n"); - return -1; + return (-1); } if (AslDoResponseFile (AcpiGbl_Optarg)) { - return -1; + return (-1); } break; - case '2': - + case '2': /* ACPI 2.0 compatibility mode */ Gbl_Acpi2 = TRUE; break; - case 'b': - + case 'b': /* Debug output options */ switch (AcpiGbl_Optarg[0]) { case 'b': AslCompilerdebug = 1; /* same as yydebug */ DtParserdebug = 1; + PrParserdebug = 1; break; case 'p': AslCompilerdebug = 1; /* same as yydebug */ DtParserdebug = 1; + PrParserdebug = 1; break; case 't': @@ -463,7 +468,7 @@ AslDoOptions ( break; - case 'd': *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***