svn commit: r216331 - in vendor-sys/acpica/dist: . common compiler debugger dispatcher events executer include tests/misc tools/acpiexec tools/acpisrc utilities

Jung-uk Kim jkim at FreeBSD.org
Thu Dec 9 20:04:15 UTC 2010


Author: jkim
Date: Thu Dec  9 20:04:14 2010
New Revision: 216331
URL: http://svn.freebsd.org/changeset/base/216331

Log:
  Import ACPICA 20101209.

Added:
  vendor-sys/acpica/dist/events/evxfgpe.c   (contents, props changed)
Modified:
  vendor-sys/acpica/dist/changes.txt
  vendor-sys/acpica/dist/common/dmtable.c
  vendor-sys/acpica/dist/common/dmtbinfo.c
  vendor-sys/acpica/dist/compiler/aslanalyze.c
  vendor-sys/acpica/dist/compiler/aslerror.c
  vendor-sys/acpica/dist/compiler/aslmessages.h
  vendor-sys/acpica/dist/compiler/dtutils.c
  vendor-sys/acpica/dist/debugger/dbcmds.c
  vendor-sys/acpica/dist/debugger/dbdisply.c
  vendor-sys/acpica/dist/debugger/dbexec.c
  vendor-sys/acpica/dist/dispatcher/dswexec.c
  vendor-sys/acpica/dist/events/evevent.c
  vendor-sys/acpica/dist/events/evgpe.c
  vendor-sys/acpica/dist/events/evgpeblk.c
  vendor-sys/acpica/dist/events/evgpeinit.c
  vendor-sys/acpica/dist/events/evgpeutil.c
  vendor-sys/acpica/dist/events/evxface.c
  vendor-sys/acpica/dist/events/evxfevnt.c
  vendor-sys/acpica/dist/executer/exconfig.c
  vendor-sys/acpica/dist/include/acdebug.h
  vendor-sys/acpica/dist/include/acdisasm.h
  vendor-sys/acpica/dist/include/acevents.h
  vendor-sys/acpica/dist/include/acglobal.h
  vendor-sys/acpica/dist/include/aclocal.h
  vendor-sys/acpica/dist/include/acpixf.h
  vendor-sys/acpica/dist/include/actypes.h
  vendor-sys/acpica/dist/tests/misc/badcode.asl
  vendor-sys/acpica/dist/tools/acpiexec/Makefile
  vendor-sys/acpica/dist/tools/acpiexec/aecommon.h
  vendor-sys/acpica/dist/tools/acpiexec/aeexec.c
  vendor-sys/acpica/dist/tools/acpiexec/aehandlers.c
  vendor-sys/acpica/dist/tools/acpisrc/astable.c
  vendor-sys/acpica/dist/utilities/utglobal.c
  vendor-sys/acpica/dist/utilities/utxface.c

Modified: vendor-sys/acpica/dist/changes.txt
==============================================================================
--- vendor-sys/acpica/dist/changes.txt	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/changes.txt	Thu Dec  9 20:04:14 2010	(r216331)
@@ -1,4 +1,76 @@
 ----------------------------------------
+09 December 2010. Summary of changes for version 20101209:
+
+This release is available at www.acpica.org/downloads
+
+1) ACPI CA Core Subsystem:
+
+Completed the major overhaul of the GPE support code that was begun in July 
+2010. Major features include: removal of _PRW execution in ACPICA (host 
+executes _PRWs anyway), cleanup of "wake" GPE interfaces and processing, 
+changes to existing interfaces, simplification of GPE handler operation, and 
+a handful of new interfaces:
+
+    AcpiUpdateAllGpes
+    AcpiFinishGpe
+    AcpiSetupGpeForWake
+    AcpiSetGpeWakeMask
+    One new file, evxfgpe.c to consolidate all external GPE interfaces.
+
+See the ACPICA Programmer Reference for full details and programming 
+information. See the new section 4.4 "General Purpose Event (GPE) Support" 
+for a full overview, and section 8.7 "ACPI General Purpose Event Management" 
+for programming details. ACPICA BZ 858,870,877. Matthew Garrett, Lin Ming, 
+Bob Moore, Rafael Wysocki.
+
+Implemented a new GPE feature for Windows compatibility, the "Implicit Wake 
+GPE Notify". This feature will automatically issue a Notify(2) on a device 
+when a Wake GPE is received if there is no corresponding GPE method or 
+handler. ACPICA BZ 870.
+
+Fixed a problem with the Scope() operator during table parse and load phase. 
+During load phase (table load or method execution), the scope operator should 
+not enter the target into the namespace. Instead, it should open a new scope 
+at the target location. Linux BZ 19462, ACPICA BZ 882.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.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:  89.8K Code, 18.9K Data, 108.7K Total
+    Debug Version:     166.6K Code, 52.1K Data, 218.7K Total
+  Current Release:
+    Non-Debug Version:  89.9K Code, 19.0K Data, 108.9K Total
+    Debug Version:     166.3K Code, 52.1K Data, 218.4K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Relax the alphanumeric restriction on _CID strings. These strings are 
+"bus-specific" per the ACPI specification, and therefore any characters are 
+acceptable. The only checks that can be performed are for a null string and 
+perhaps for a leading asterisk. ACPICA BZ 886.
+
+iASL: Fixed a problem where a syntax error that caused a premature EOF 
+condition on the source file emitted a very confusing error message. The 
+premature EOF is now detected correctly. ACPICA BZ 891.
+
+Disassembler: Decode the AccessSize within a Generic Address Structure (byte 
+access, word access, etc.) Note, this field does not allow arbitrary bit 
+access, the size is encoded as 1=byte, 2=word, 3=dword, and 4=qword.
+
+New: AcpiNames utility - Example namespace dump utility. Shows an example of 
+ACPICA configuration for a minimal namespace dump utility. Uses table and 
+namespace managers, but no AML interpreter. Does not add any functionality 
+over AcpiExec, it is a subset of AcpiExec. The purpose is to show how to 
+partition and configure ACPICA. ACPICA BZ 883.
+
+AML Debugger: Increased the debugger buffer size for method return objects. 
+Was 4K, increased to 16K. Also enhanced error messages for debugger method 
+execution, including the buffer overflow case.
+
+----------------------------------------
 13 October 2010. Summary of changes for version 20101013:
 
 This release is available at www.acpica.org/downloads

Modified: vendor-sys/acpica/dist/common/dmtable.c
==============================================================================
--- vendor-sys/acpica/dist/common/dmtable.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/common/dmtable.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -295,6 +295,19 @@ static const char           *AcpiDmFadtP
     "Unknown Profile Type"
 };
 
+#define ACPI_GAS_WIDTH_RESERVED     5
+
+static const char           *AcpiDmGasAccessWidth[] =
+{
+    "Undefined/Legacy",
+    "Byte Access:8",
+    "Word Access:16",
+    "DWord Access:32",
+    "QWord Access:64",
+    "Unknown Width Encoding"
+};
+
+
 /*******************************************************************************
  *
  * ACPI Table Data, indexed by signature.
@@ -669,6 +682,7 @@ AcpiDmDumpTable (
         case ACPI_DMT_UINT8:
         case ACPI_DMT_CHKSUM:
         case ACPI_DMT_SPACEID:
+        case ACPI_DMT_ACCWIDTH:
         case ACPI_DMT_IVRS:
         case ACPI_DMT_MADT:
         case ACPI_DMT_SRAT:
@@ -884,6 +898,19 @@ AcpiDmDumpTable (
             AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target));
             break;
 
+        case ACPI_DMT_ACCWIDTH:
+
+            /* Encoded Access Width */
+
+            Temp8 = *Target;
+            if (Temp8 > ACPI_GAS_WIDTH_RESERVED)
+            {
+                Temp8 = ACPI_GAS_WIDTH_RESERVED;
+            }
+
+            AcpiOsPrintf ("%2.2X (%s)\n", Temp8, AcpiDmGasAccessWidth[Temp8]);
+            break;
+
         case ACPI_DMT_GAS:
 
             /* Generic Address Structure */

Modified: vendor-sys/acpica/dist/common/dmtbinfo.c
==============================================================================
--- vendor-sys/acpica/dist/common/dmtbinfo.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/common/dmtbinfo.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -282,7 +282,7 @@ ACPI_DMTABLE_INFO           AcpiDmTableI
     {ACPI_DMT_SPACEID,  ACPI_GAS_OFFSET (SpaceId),                  "Space ID", 0},
     {ACPI_DMT_UINT8,    ACPI_GAS_OFFSET (BitWidth),                 "Bit Width", 0},
     {ACPI_DMT_UINT8,    ACPI_GAS_OFFSET (BitOffset),                "Bit Offset", 0},
-    {ACPI_DMT_UINT8,    ACPI_GAS_OFFSET (AccessWidth),              "Access Width", 0},
+    {ACPI_DMT_ACCWIDTH, ACPI_GAS_OFFSET (AccessWidth),              "Encoded Access Width", 0},
     {ACPI_DMT_UINT64,   ACPI_GAS_OFFSET (Address),                  "Address", 0},
     ACPI_DMT_TERMINATOR
 };

Modified: vendor-sys/acpica/dist/compiler/aslanalyze.c
==============================================================================
--- vendor-sys/acpica/dist/compiler/aslanalyze.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/compiler/aslanalyze.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -684,19 +684,45 @@ AnCheckId (
     UINT32                  AlphaPrefixLength;
 
 
+    /* Only care about string versions of _HID/_CID (integers are legal) */
+
     if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)
     {
         return;
     }
 
+    /* For both _HID and _CID, the string must be non-null */
+
     Length = strlen (Op->Asl.Value.String);
+    if (!Length)
+    {
+        AslError (ASL_ERROR, ASL_MSG_NULL_STRING,
+            Op, NULL);
+        return;
+    }
 
     /*
-     * If _HID/_CID is a string, all characters must be alphanumeric.
-     * One of the things we want to catch here is the use of
-     * a leading asterisk in the string -- an odd construct
-     * that certain platform manufacturers are fond of.
+     * One of the things we want to catch here is the use of a leading
+     * asterisk in the string -- an odd construct that certain platform
+     * manufacturers are fond of. Technically, a leading asterisk is OK
+     * for _CID, but a valid use of this has not been seen.
      */
+    if (*Op->Asl.Value.String == '*')
+    {
+        AslError (ASL_ERROR, ASL_MSG_LEADING_ASTERISK,
+            Op, Op->Asl.Value.String);
+        return;
+    }
+
+    /* _CID strings are bus-specific, no more checks can be performed */
+
+    if (Type == ASL_TYPE_CID)
+    {
+        return;
+    }
+
+    /* For _HID, all characters must be alphanumeric */
+
     for (i = 0; Op->Asl.Value.String[i]; i++)
     {
         if (!isalnum ((int) Op->Asl.Value.String[i]))
@@ -707,13 +733,6 @@ AnCheckId (
         }
     }
 
-    if (Type == ASL_TYPE_CID)
-    {
-        /* _CID strings are bus-specific, no more checks can be performed */
-
-        return;
-    }
-
     /* _HID String must be of the form "XXX####" or "ACPI####" */
 
     if ((Length < 7) || (Length > 8))

Modified: vendor-sys/acpica/dist/compiler/aslerror.c
==============================================================================
--- vendor-sys/acpica/dist/compiler/aslerror.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/compiler/aslerror.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -241,6 +241,8 @@ AePrintException (
     UINT32                  ErrorColumn;
     FILE                    *OutputFile;
     FILE                    *SourceFile;
+    long                    FileSize;
+    BOOLEAN                 PrematureEOF = FALSE;
 
 
     if (Gbl_NoErrors)
@@ -289,6 +291,19 @@ AePrintException (
         SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
     }
 
+    if (SourceFile)
+    {
+        /* Determine if the error occurred at source file EOF */
+
+        fseek (SourceFile, 0, SEEK_END);
+        FileSize = ftell (SourceFile);
+
+        if ((long) Enode->LogicalByteOffset >= FileSize)
+        {
+            PrematureEOF = TRUE;
+        }
+    }
+
     if (Header)
     {
         fprintf (OutputFile, "%s", Header);
@@ -307,33 +322,42 @@ AePrintException (
                 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)
-                {
-                    fprintf (OutputFile,
-                        "[*** iASL: Seek error on source code temp file %s ***]",
-                        Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
-                }
-                else
+                if (!PrematureEOF)
                 {
-                    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");
             }
         }
@@ -376,7 +400,7 @@ AePrintException (
                 ExtraMessage = NULL;
             }
 
-            if (Gbl_VerboseErrors)
+            if (Gbl_VerboseErrors && !PrematureEOF)
             {
                 SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
                 ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
@@ -406,6 +430,11 @@ AePrintException (
                 fprintf (OutputFile, " (%s)", ExtraMessage);
             }
 
+            if (PrematureEOF)
+            {
+                fprintf (OutputFile, " and premature End-Of-File");
+            }
+
             fprintf (OutputFile, "\n");
             if (Gbl_VerboseErrors)
             {

Modified: vendor-sys/acpica/dist/compiler/aslmessages.h
==============================================================================
--- vendor-sys/acpica/dist/compiler/aslmessages.h	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/compiler/aslmessages.h	Thu Dec  9 20:04:14 2010	(r216331)
@@ -258,6 +258,9 @@ typedef enum
     ASL_MSG_NULL_DESCRIPTOR,
     ASL_MSG_UPPER_CASE,
     ASL_MSG_HID_LENGTH,
+    ASL_MSG_NULL_STRING,
+    ASL_MSG_LEADING_ASTERISK,
+
     ASL_MSG_INVALID_FIELD_NAME,
     ASL_MSG_INTEGER_SIZE,
     ASL_MSG_INVALID_HEX_INTEGER,
@@ -382,7 +385,7 @@ char                        *AslMessages
 /*    ASL_MSG_VENDOR_LIST */                "Too many vendor data bytes (7 max)",
 /*    ASL_MSG_WRITE */                      "Could not write file",
 /*    ASL_MSG_MULTIPLE_DEFAULT */           "More than one Default statement within Switch construct",
-/*    ASL_MSG_TIMEOUT */                    "Possible operator timeout is ignored",
+/*    ASL_MSG_TIMEOUT */                    "Result is not used, possible operator timeout will be missed",
 /*    ASL_MSG_RESULT_NOT_USED */            "Result is not used, operator has no effect",
 /*    ASL_MSG_NOT_REFERENCED */             "Namespace object is not referenced",
 /*    ASL_MSG_NON_ZERO */                   "Operand evaluates to zero",
@@ -403,6 +406,8 @@ char                        *AslMessages
 /*    ASL_MSG_NULL_DESCRIPTOR */            "Min/Max/Length/Gran are all zero, but no resource tag",
 /*    ASL_MSG_UPPER_CASE */                 "Non-hex letters must be upper case",
 /*    ASL_MSG_HID_LENGTH */                 "_HID string must be exactly 7 or 8 characters",
+/*    ASL_MSG_NULL_STRING */                "Invalid zero-length (null) string",
+/*    ASL_MSG_LEADING_ASTERISK */           "Invalid leading asterisk",
 
 /* These messages are used by the data table compiler only */
 

Modified: vendor-sys/acpica/dist/compiler/dtutils.c
==============================================================================
--- vendor-sys/acpica/dist/compiler/dtutils.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/compiler/dtutils.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -573,6 +573,7 @@ DtGetFieldLength (
     case ACPI_DMT_UINT8:
     case ACPI_DMT_CHKSUM:
     case ACPI_DMT_SPACEID:
+    case ACPI_DMT_ACCWIDTH:
     case ACPI_DMT_IVRS:
     case ACPI_DMT_MADT:
     case ACPI_DMT_SRAT:

Modified: vendor-sys/acpica/dist/debugger/dbcmds.c
==============================================================================
--- vendor-sys/acpica/dist/debugger/dbcmds.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/debugger/dbcmds.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -2071,7 +2071,7 @@ AcpiDbGenerateGpe (
         return;
     }
 
-    (void) AcpiEvGpeDispatch (GpeEventInfo, GpeNumber);
+    (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
 }
 
 

Modified: vendor-sys/acpica/dist/debugger/dbdisply.c
==============================================================================
--- vendor-sys/acpica/dist/debugger/dbdisply.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/debugger/dbdisply.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -896,7 +896,8 @@ AcpiDbDisplayGpes (
                     GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
                     GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
 
-                    if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK))
+                    if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
+                        ACPI_GPE_DISPATCH_NONE)
                     {
                         /* This GPE is not used (no method or handler), ignore it */
 
@@ -906,8 +907,7 @@ AcpiDbDisplayGpes (
                     AcpiOsPrintf (
                         "        GPE %.2X: %p  RunRefs %2.2X Flags %2.2X (",
                         GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo,
-                        GpeEventInfo->RuntimeCount,
-                        GpeEventInfo->Flags);
+                        GpeEventInfo->RuntimeCount, GpeEventInfo->Flags);
 
                     /* Decode the flags byte */
 
@@ -931,14 +931,17 @@ AcpiDbDisplayGpes (
 
                     switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
                     {
-                    case ACPI_GPE_DISPATCH_NOT_USED:
+                    case ACPI_GPE_DISPATCH_NONE:
                         AcpiOsPrintf ("NotUsed");
                         break;
+                    case ACPI_GPE_DISPATCH_METHOD:
+                        AcpiOsPrintf ("Method");
+                        break;
                     case ACPI_GPE_DISPATCH_HANDLER:
                         AcpiOsPrintf ("Handler");
                         break;
-                    case ACPI_GPE_DISPATCH_METHOD:
-                        AcpiOsPrintf ("Method");
+                    case ACPI_GPE_DISPATCH_NOTIFY:
+                        AcpiOsPrintf ("Notify");
                         break;
                     default:
                         AcpiOsPrintf ("UNKNOWN: %X",

Modified: vendor-sys/acpica/dist/debugger/dbexec.c
==============================================================================
--- vendor-sys/acpica/dist/debugger/dbexec.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/debugger/dbexec.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -180,6 +180,9 @@ AcpiDbExecuteMethod (
     ACPI_DEVICE_INFO        *ObjInfo;
 
 
+    ACPI_FUNCTION_TRACE (DbExecuteMethod);
+
+
     if (AcpiGbl_DbOutputToFile && !AcpiDbgLevel)
     {
         AcpiOsPrintf ("Warning: debug output is not enabled!\n");
@@ -190,7 +193,7 @@ AcpiDbExecuteMethod (
     Status = AcpiGetHandle (NULL, Info->Pathname, &Handle);
     if (ACPI_FAILURE (Status))
     {
-        return (Status);
+        return_ACPI_STATUS (Status);
     }
 
     /* Get the object info for number of method parameters */
@@ -198,7 +201,7 @@ AcpiDbExecuteMethod (
     Status = AcpiGetObjectInfo (Handle, &ObjInfo);
     if (ACPI_FAILURE (Status))
     {
-        return (Status);
+        return_ACPI_STATUS (Status);
     }
 
     ParamObjects.Pointer = NULL;
@@ -269,7 +272,20 @@ AcpiDbExecuteMethod (
     AcpiGbl_CmSingleStep = FALSE;
     AcpiGbl_MethodExecuting = FALSE;
 
-    return (Status);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_EXCEPTION ((AE_INFO, Status,
+        "while executing %s from debugger", Info->Pathname));
+
+        if (Status == AE_BUFFER_OVERFLOW)
+        {
+            ACPI_ERROR ((AE_INFO,
+            "Possible overflow of internal debugger buffer (size 0x%X needed 0x%X)",
+                ACPI_DEBUG_BUFFER_SIZE, (UINT32) ReturnObj->Length));
+        }
+    }
+
+    return_ACPI_STATUS (Status);
 }
 
 

Modified: vendor-sys/acpica/dist/dispatcher/dswexec.c
==============================================================================
--- vendor-sys/acpica/dist/dispatcher/dswexec.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/dispatcher/dswexec.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -400,10 +400,26 @@ AcpiDsExecBeginOp (
              * we must enter this object into the namespace.  The created
              * object is temporary and will be deleted upon completion of
              * the execution of this method.
+             *
+             * Note 10/2010: Except for the Scope() op. This opcode does
+             * not actually create a new object, it refers to an existing
+             * object. However, for Scope(), we want to indeed open a
+             * new scope.
              */
-            Status = AcpiDsLoad2BeginOp (WalkState, NULL);
+            if (Op->Common.AmlOpcode != AML_SCOPE_OP)
+            {
+                Status = AcpiDsLoad2BeginOp (WalkState, NULL);
+            }
+            else
+            {
+                Status = AcpiDsScopeStackPush (Op->Named.Node,
+                            Op->Named.Node->Type, WalkState);
+                if (ACPI_FAILURE (Status))
+                {
+                    return_ACPI_STATUS (Status);
+                }
+            }
         }
-
         break;
 
 

Modified: vendor-sys/acpica/dist/events/evevent.c
==============================================================================
--- vendor-sys/acpica/dist/events/evevent.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/events/evevent.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -180,54 +180,6 @@ AcpiEvInitializeEvents (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiEvInstallFadtGpes
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks
- *              (0 and 1). This causes the _PRW methods to be run, so the HW
- *              must be fully initialized at this point, including global lock
- *              support.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiEvInstallFadtGpes (
-    void)
-{
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_TRACE (EvInstallFadtGpes);
-
-
-    /* Namespace must be locked */
-
-    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-    /* FADT GPE Block 0 */
-
-    (void) AcpiEvInitializeGpeBlock (
-                AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[0]);
-
-    /* FADT GPE Block 1 */
-
-    (void) AcpiEvInitializeGpeBlock (
-                AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[1]);
-
-    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-    return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
  * FUNCTION:    AcpiEvInstallXruptHandlers
  *
  * PARAMETERS:  None
@@ -366,9 +318,17 @@ AcpiEvFixedEventDetect (
         if ((FixedStatus & AcpiGbl_FixedEventInfo[i].StatusBitMask) &&
             (FixedEnable & AcpiGbl_FixedEventInfo[i].EnableBitMask))
         {
-            /* Found an active (signalled) event */
-
+            /*
+             * Found an active (signalled) event. Invoke global event
+             * handler if present.
+             */
             AcpiFixedEventCount[i]++;
+            if (AcpiGbl_GlobalEventHandler)
+            {
+                AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_FIXED, NULL,
+                     i, AcpiGbl_GlobalEventHandlerContext);
+            }
+
             IntStatus |= AcpiEvFixedEventDispatch (i);
         }
     }

Modified: vendor-sys/acpica/dist/events/evgpe.c
==============================================================================
--- vendor-sys/acpica/dist/events/evgpe.c	Thu Dec  9 19:02:23 2010	(r216330)
+++ vendor-sys/acpica/dist/events/evgpe.c	Thu Dec  9 20:04:14 2010	(r216331)
@@ -202,12 +202,13 @@ AcpiEvEnableGpe (
 
 
     /*
-     * We will only allow a GPE to be enabled if it has either an
-     * associated method (_Lxx/_Exx) or a handler. Otherwise, the
-     * GPE will be immediately disabled by AcpiEvGpeDispatch the
-     * first time it fires.
+     * We will only allow a GPE to be enabled if it has either an associated
+     * method (_Lxx/_Exx) or a handler, or is using the implicit notify
+     * feature. Otherwise, the GPE will be immediately disabled by
+     * AcpiEvGpeDispatch the first time it fires.
      */
-    if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK))
+    if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
+        ACPI_GPE_DISPATCH_NONE)
     {
         return_ACPI_STATUS (AE_NO_HANDLER);
     }
@@ -229,6 +230,104 @@ AcpiEvEnableGpe (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiEvAddGpeReference
+ *
+ * PARAMETERS:  GpeEventInfo            - Add a reference to this GPE
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
+ *              hardware-enabled.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvAddGpeReference (
+    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
+{
+    ACPI_STATUS             Status = AE_OK;
+
+
+    ACPI_FUNCTION_TRACE (EvAddGpeReference);
+
+
+    if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX)
+    {
+        return_ACPI_STATUS (AE_LIMIT);
+    }
+
+    GpeEventInfo->RuntimeCount++;
+    if (GpeEventInfo->RuntimeCount == 1)
+    {
+        /* Enable on first reference */
+
+        Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo);
+        if (ACPI_SUCCESS (Status))
+        {
+            Status = AcpiEvEnableGpe (GpeEventInfo);
+        }
+
+        if (ACPI_FAILURE (Status))
+        {
+            GpeEventInfo->RuntimeCount--;
+        }
+    }
+
+    return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiEvRemoveGpeReference
+ *
+ * PARAMETERS:  GpeEventInfo            - Remove a reference to this GPE
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Remove a reference to a GPE. When the last reference is
+ *              removed, the GPE is hardware-disabled.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvRemoveGpeReference (
+    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
+{
+    ACPI_STATUS             Status = AE_OK;
+
+
+    ACPI_FUNCTION_TRACE (EvRemoveGpeReference);
+
+
+    if (!GpeEventInfo->RuntimeCount)
+    {
+        return_ACPI_STATUS (AE_LIMIT);
+    }
+
+    GpeEventInfo->RuntimeCount--;
+    if (!GpeEventInfo->RuntimeCount)
+    {
+        /* Disable on last reference */
+
+        Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo);
+        if (ACPI_SUCCESS (Status))
+        {
+            Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
+        }
+
+        if (ACPI_FAILURE (Status))
+        {
+            GpeEventInfo->RuntimeCount++;
+        }
+    }
+
+    return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiEvLowGetGpeInfo
  *
  * PARAMETERS:  GpeNumber           - Raw GPE number
@@ -412,7 +511,7 @@ AcpiEvGpeDetect (
             }
 
             ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
-                "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
+                "Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n",
                 GpeRegisterInfo->BaseGpeNumber, StatusReg, EnableReg));
 
             /* Check if there is anything active at all in this register */
@@ -437,7 +536,7 @@ AcpiEvGpeDetect (
                      * Found an active GPE. Dispatch the event to a handler
                      * or method.
                      */
-                    IntStatus |= AcpiEvGpeDispatch (
+                    IntStatus |= AcpiEvGpeDispatch (GpeBlock->Node,
                         &GpeBlock->EventInfo[((ACPI_SIZE) i *
                             ACPI_GPE_REGISTER_WIDTH) + j],
                         j + GpeRegisterInfo->BaseGpeNumber);
@@ -521,13 +620,27 @@ AcpiEvAsynchExecuteGpeMethod (
         return_VOID;
     }
 
-    /*
-     * Must check for control method type dispatch one more time to avoid a
-     * race with EvGpeInstallHandler
-     */
-    if ((LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
-            ACPI_GPE_DISPATCH_METHOD)
+    /* Do the correct dispatch - normal method or implicit notify */
+
+    switch (LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
     {
+    case ACPI_GPE_DISPATCH_NOTIFY:
+
+        /*
+         * Implicit notify.
+         * Dispatch a DEVICE_WAKE notify to the appropriate handler.
+         * NOTE: the request is queued for execution after this method
+         * completes. The notify handlers are NOT invoked synchronously
+         * from this thread -- because handlers may in turn run other
+         * control methods.
+         */
+        Status = AcpiEvQueueNotifyRequest (
+                    LocalGpeEventInfo->Dispatch.DeviceNode,
+                    ACPI_NOTIFY_DEVICE_WAKE);
+        break;
+
+    case ACPI_GPE_DISPATCH_METHOD:
+
         /* Allocate the evaluation information block */
 
         Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
@@ -538,8 +651,8 @@ AcpiEvAsynchExecuteGpeMethod (
         else
         {
             /*
-             * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
-             * control method that corresponds to this GPE
+             * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the
+             * _Lxx/_Exx control method that corresponds to this GPE
              */
             Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode;
             Info->Flags = ACPI_IGNORE_RETURN_VALUE;
@@ -554,6 +667,11 @@ AcpiEvAsynchExecuteGpeMethod (
                 "while evaluating GPE method [%4.4s]",
                 AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode)));
         }
+
+        break;
+
+    default:
+        return_VOID; /* Should never happen */
     }
 
     /* Defer enabling of GPE until all notify handlers are done */
@@ -573,6 +691,7 @@ AcpiEvAsynchExecuteGpeMethod (
  * FUNCTION:    AcpiEvAsynchEnableGpe
  *
  * PARAMETERS:  Context (GpeEventInfo) - Info for this GPE
+ *              Callback from AcpiOsExecute
  *
  * RETURN:      None
  *
@@ -586,6 +705,32 @@ AcpiEvAsynchEnableGpe (
     void                    *Context)
 {
     ACPI_GPE_EVENT_INFO     *GpeEventInfo = Context;
+
+
+    (void) AcpiEvFinishGpe (GpeEventInfo);
+
+    ACPI_FREE (GpeEventInfo);
+    return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiEvFinishGpe
+ *
+ * PARAMETERS:  GpeEventInfo        - Info for this GPE
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Clear/Enable a GPE. Common code that is used after execution
+ *              of a GPE method or a synchronous or asynchronous GPE handler.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvFinishGpe (
+    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
+{
     ACPI_STATUS             Status;
 
 
@@ -593,25 +738,23 @@ AcpiEvAsynchEnableGpe (
             ACPI_GPE_LEVEL_TRIGGERED)
     {
         /*
-         * GPE is level-triggered, we clear the GPE status bit after handling
-         * the event.
+         * GPE is level-triggered, we clear the GPE status bit after
+         * handling the event.
          */
         Status = AcpiHwClearGpe (GpeEventInfo);
         if (ACPI_FAILURE (Status))
         {
-            goto Exit;
+            return (Status);
         }
     }
 
     /*
-     * Enable this GPE, conditionally. This means that the GPE will only be
-     * physically enabled if the EnableForRun bit is set in the EventInfo
+     * Enable this GPE, conditionally. This means that the GPE will
+     * only be physically enabled if the EnableForRun bit is set
+     * in the EventInfo.
      */
     (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE);
-
-Exit:
-    ACPI_FREE (GpeEventInfo);
-    return;
+    return (AE_OK);
 }
 
 
@@ -619,8 +762,9 @@ Exit:
  *
  * FUNCTION:    AcpiEvGpeDispatch
  *
- * PARAMETERS:  GpeEventInfo    - Info for this GPE
- *              GpeNumber       - Number relative to the parent GPE block
+ * PARAMETERS:  GpeDevice           - Device node. NULL for GPE0/GPE1
+ *              GpeEventInfo        - Info for this GPE
+ *              GpeNumber           - Number relative to the parent GPE block
  *
  * RETURN:      INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
  *
@@ -633,16 +777,25 @@ Exit:
 
 UINT32
 AcpiEvGpeDispatch (
+    ACPI_NAMESPACE_NODE     *GpeDevice,
     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
     UINT32                  GpeNumber)
 {
     ACPI_STATUS             Status;
+    UINT32                  ReturnValue;
 
 
     ACPI_FUNCTION_TRACE (EvGpeDispatch);
 
 
+    /* Invoke global event handler if present */
+
     AcpiGpeCount++;
+    if (AcpiGbl_GlobalEventHandler)
+    {
+        AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE, GpeDevice,
+             GpeNumber, AcpiGbl_GlobalEventHandlerContext);
+    }
 
     /*
      * If edge-triggered, clear the GPE status bit now. Note that
@@ -655,58 +808,55 @@ AcpiEvGpeDispatch (
         if (ACPI_FAILURE (Status))
         {
             ACPI_EXCEPTION ((AE_INFO, Status,
-                "Unable to clear GPE[0x%2X]", GpeNumber));
+                "Unable to clear GPE%02X", GpeNumber));
             return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
         }
     }
 
     /*
-     * Dispatch the GPE to either an installed handler, or the control method
-     * associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke
-     * it and do not attempt to run the method. If there is neither a handler
-     * nor a method, we disable this GPE to prevent further such pointless
-     * events from firing.
+     * Always disable the GPE so that it does not keep firing before
+     * any asynchronous activity completes (either from the execution
+     * of a GPE method or an asynchronous GPE handler.)
+     *
+     * If there is no handler or method to run, just disable the
+     * GPE and leave it disabled permanently to prevent further such
+     * pointless events from firing.
+     */
+    Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_EXCEPTION ((AE_INFO, Status,
+            "Unable to disable GPE%02X", GpeNumber));
+        return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
+    }
+
+    /*
+     * Dispatch the GPE to either an installed handler or the control
+     * method associated with this GPE (_Lxx or _Exx). If a handler
+     * exists, we invoke it and do not attempt to run the method.
+     * If there is neither a handler nor a method, leave the GPE
+     * disabled.
      */
     switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
     {
     case ACPI_GPE_DISPATCH_HANDLER:
 
-        /*
-         * Invoke the installed handler (at interrupt level)
-         * Ignore return status for now.
-         * TBD: leave GPE disabled on error?
-         */
-        (void) GpeEventInfo->Dispatch.Handler->Address (
-                        GpeEventInfo->Dispatch.Handler->Context);
+        /* Invoke the installed handler (at interrupt level) */
+
+        ReturnValue = GpeEventInfo->Dispatch.Handler->Address (
+            GpeDevice, GpeNumber,
+            GpeEventInfo->Dispatch.Handler->Context);
 
-        /* It is now safe to clear level-triggered events. */
+        /* If requested, clear (if level-triggered) and reenable the GPE */
 
-        if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
-                ACPI_GPE_LEVEL_TRIGGERED)
+        if (ReturnValue & ACPI_REENABLE_GPE)
         {
-            Status = AcpiHwClearGpe (GpeEventInfo);
-            if (ACPI_FAILURE (Status))
-            {
-                ACPI_EXCEPTION ((AE_INFO, Status,
-                    "Unable to clear GPE[0x%2X]", GpeNumber));
-                return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
-            }
+            (void) AcpiEvFinishGpe (GpeEventInfo);
         }
         break;
 
     case ACPI_GPE_DISPATCH_METHOD:
-
-        /*
-         * Disable the GPE, so it doesn't keep firing before the method has a
-         * chance to run (it runs asynchronously with interrupts enabled).
-         */
-        Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
-        if (ACPI_FAILURE (Status))
-        {
-            ACPI_EXCEPTION ((AE_INFO, Status,
-                "Unable to disable GPE[0x%2X]", GpeNumber));
-            return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
-        }
+    case ACPI_GPE_DISPATCH_NOTIFY:
 
         /*
          * Execute the method associated with the GPE
@@ -717,7 +867,7 @@ AcpiEvGpeDispatch (
         if (ACPI_FAILURE (Status))
         {
             ACPI_EXCEPTION ((AE_INFO, Status,
-                "Unable to queue handler for GPE[0x%2X] - event disabled",
+                "Unable to queue handler for GPE%02X - event disabled",
                 GpeNumber));
         }
         break;
@@ -730,20 +880,8 @@ AcpiEvGpeDispatch (
          * a GPE to be enabled if it has no handler or method.
          */
         ACPI_ERROR ((AE_INFO,
-            "No handler or method for GPE[0x%2X], disabling event",
+            "No handler or method for GPE%02X, disabling event",
             GpeNumber));
-
-        /*
-         * Disable the GPE. The GPE will remain disabled until a handler
-         * is installed or ACPICA is restarted.
-         */
-        Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
-        if (ACPI_FAILURE (Status))
-        {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list