diff --git a/sys/conf/files b/sys/conf/files index 0b231be5d26b..b08549b9bb31 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -184,6 +184,7 @@ contrib/dev/acpica/events/evxfregn.c optional acpi contrib/dev/acpica/executer/exconfig.c optional acpi contrib/dev/acpica/executer/exconvrt.c optional acpi contrib/dev/acpica/executer/excreate.c optional acpi +contrib/dev/acpica/executer/exdebug.c optional acpi contrib/dev/acpica/executer/exdump.c optional acpi contrib/dev/acpica/executer/exfield.c optional acpi contrib/dev/acpica/executer/exfldio.c optional acpi diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 60620ce4f76b..d2c8c0e41edf 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,3 +1,131 @@ +---------------------------------------- +31 March 2010. Summary of changes for version 20100331: + +1) ACPI CA Core Subsystem: + +Completed a major update for the GPE support in order to improve support for +shared GPEs and to simplify both host OS and ACPICA code. Added a reference +count mechanism to support shared GPEs that require multiple device drivers. +Several external interfaces have changed. One external interface has been +removed. One new external interface was added. Most of the GPE external +interfaces now use the GPE spinlock instead of the events mutex (and the +Flags parameter for many GPE interfaces has been removed.) See the updated +ACPICA Programmer Reference for details. Matthew Garrett, Bob Moore, Rafael +Wysocki. ACPICA BZ 831. + +Changed: + AcpiEnableGpe, AcpiDisableGpe, AcpiClearGpe, AcpiGetGpeStatus +Removed: + AcpiSetGpeType +New: + AcpiSetGpe + +Implemented write support for DataTable operation regions. These regions are +defined via the DataTableRegion() operator. Previously, only read support was +implemented. The ACPI specification allows DataTableRegions to be read/write, +however. + +Implemented a new subsystem option to force a copy of the DSDT to local +memory. Optionally copy the entire DSDT to local memory (instead of simply +mapping it.) There are some (albeit very rare) BIOSs that corrupt or replace +the original DSDT, creating the need for this option. Default is FALSE, do +not copy the DSDT. + +Implemented detection of a corrupted or replaced DSDT. This change adds +support to detect a DSDT that has been corrupted and/or replaced from outside +the OS (by firmware). This is typically catastrophic for the system, but has +been seen on some machines. Once this problem has been detected, the DSDT +copy option can be enabled via system configuration. Lin Ming, Bob Moore. + +Fixed two problems with AcpiReallocateRootTable during the root table copy. +When copying the root table to the new allocation, the length used was +incorrect. The new size was used instead of the current table size, meaning +too much data was copied. Also, the count of available slots for ACPI tables +was not set correctly. Alexey Starikovskiy, Bob Moore. + +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: 87.5K Code, 18.4K Data, 105.9K Total + Debug Version: 163.4K Code, 51.1K Data, 214.5K Total + Current Release: + Non-Debug Version: 87.9K Code, 18.6K Data, 106.5K Total + Debug Version: 163.5K Code, 51.3K Data, 214.8K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implement limited typechecking for values returned from predefined +control methods. The type of any returned static (unnamed) object is now +validated. For example, Return(1). ACPICA BZ 786. + +iASL: Fixed a predefined name object verification regression. Fixes a problem +introduced in version 20100304. An error is incorrectly generated if a +predefined name is declared as a static named object with a value defined +using the keywords "Zero", "One", or "Ones". Lin Ming. + +iASL: Added Windows 7 support for the -g option (get local ACPI tables) by +reducing the requested registry access rights. ACPICA BZ 842. + +Disassembler: fixed a possible fault when generating External() statements. +Introduced in commit ae7d6fd: Properly handle externals with parent-prefix +(carat). Fixes a string length allocation calculation. Lin Ming. + +---------------------------------------- +04 March 2010. Summary of changes for version 20100304: + +1) ACPI CA Core Subsystem: + +Fixed a possible problem with the AML Mutex handling function +AcpiExReleaseMutex where the function could fault under the very rare +condition when the interpreter has blocked, the interpreter lock is released, +the interpreter is then reentered via the same thread, and attempts to +acquire an AML mutex that was previously acquired. FreeBSD report 140979. Lin +Ming. + +Implemented additional configuration support for the AML "Debug Object". +Output from the debug object can now be enabled via a global variable, +AcpiGbl_EnableAmlDebugObject. This will assist with remote machine debugging. +This debug output is now available in the release version of ACPICA instead +of just the debug version. Also, the entire debug output module can now be +configured out of the ACPICA build if desired. One new file added, +executer/exdebug.c. Lin Ming, Bob Moore. + +Added header support for the ACPI MCHI table (Management Controller Host +Interface Table). This table was added in ACPI 4.0, but the defining document +has only recently become available. + +Standardized output of integer values for ACPICA warnings/errors. Always use +0x prefix for hex output, always use %u for unsigned integer decimal output. +Affects ACPI_INFO, ACPI_ERROR, ACPI_EXCEPTION, and ACPI_WARNING (about 400 +invocations.) These invocations were converted from the original +ACPI_DEBUG_PRINT invocations and were not consistent. ACPICA BZ 835. + +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: 87.1K Code, 18.0K Data, 105.1K Total + Debug Version: 163.5K Code, 50.9K Data, 214.4K Total + Current Release: + Non-Debug Version: 87.5K Code, 18.4K Data, 105.9K Total + Debug Version: 163.4K Code, 51.1K Data, 214.5K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented typechecking support for static (non-control method) +predefined named objects that are declared with the Name() operator. For +example, the type of this object is now validated to be of type Integer: +Name(_BBN, 1). This change migrates the compiler to using the core predefined +name table instead of maintaining a local version. Added a new file, +aslpredef.c. ACPICA BZ 832. + +Disassembler: Added support for the ACPI 4.0 MCHI table. + ---------------------------------------- 21 January 2010. Summary of changes for version 20100121: diff --git a/sys/contrib/dev/acpica/common/dmextern.c b/sys/contrib/dev/acpica/common/dmextern.c index 943a3c2f1e6c..8d95571b04e0 100644 --- a/sys/contrib/dev/acpica/common/dmextern.c +++ b/sys/contrib/dev/acpica/common/dmextern.c @@ -270,6 +270,15 @@ AcpiDmNormalizeParentPrefix ( } Length = (ACPI_STRLEN (ParentPath) + ACPI_STRLEN (Path) + 1); + if (ParentPath[1]) + { + /* + * If ParentPath is not just a simple '\', increment the length + * for the required dot separator (ParentPath.Path) + */ + Length++; + } + Fullpath = ACPI_ALLOCATE_ZEROED (Length); if (!Fullpath) { @@ -374,7 +383,7 @@ AcpiDmAddToExternalList ( (NextExternal->Value != Value)) { ACPI_ERROR ((AE_INFO, - "Argument count mismatch for method %s %d %d", + "Argument count mismatch for method %s %u %u", NextExternal->Path, NextExternal->Value, Value)); } diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index 70858911150a..4b965756741e 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -262,6 +262,7 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, "I/O Virtualization Reporting Structure"}, {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"}, {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"}, + {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, "Management Controller Host Interface table"}, {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, "Maximum System Characteristics Table"}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"}, @@ -911,7 +912,7 @@ AcpiDmDumpTable ( default: ACPI_ERROR ((AE_INFO, - "**** Invalid table opcode [%X] ****\n", Info->Opcode)); + "**** Invalid table opcode [0x%X] ****\n", Info->Opcode)); return (AE_SUPPORT); } } diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c index 2c9725d8206b..143cf5b27ba1 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump.c +++ b/sys/contrib/dev/acpica/common/dmtbdump.c @@ -363,7 +363,7 @@ AcpiDmDumpAsf ( break; default: - AcpiOsPrintf ("\n**** Unknown ASF sub-table type %X\n", SubTable->Header.Type); + AcpiOsPrintf ("\n**** Unknown ASF sub-table type 0x%X\n", SubTable->Header.Type); return; } @@ -561,7 +561,7 @@ AcpiDmDumpDmar ( ScopeOffset = sizeof (ACPI_DMAR_RHSA); break; default: - AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown DMAR sub-table type 0x%X\n\n", SubTable->Type); return; } @@ -809,7 +809,7 @@ AcpiDmDumpHest ( default: /* Cannot continue on unknown type - no length */ - AcpiOsPrintf ("\n**** Unknown HEST sub-table type %X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown HEST sub-table type 0x%X\n", SubTable->Type); return; } @@ -916,7 +916,7 @@ AcpiDmDumpIvrs ( InfoTable = AcpiDmTableInfoIvrs1; break; default: - AcpiOsPrintf ("\n**** Unknown IVRS sub-table type %X\n", + AcpiOsPrintf ("\n**** Unknown IVRS sub-table type 0x%X\n", SubTable->Type); /* Attempt to continue */ @@ -1002,7 +1002,7 @@ AcpiDmDumpIvrs ( InfoTable = AcpiDmTableInfoIvrs4; AcpiOsPrintf ( "\n**** Unknown IVRS device entry type/length: " - "%.2X/%X at offset %.4X: (header below)\n", + "0x%.2X/0x%X at offset 0x%.4X: (header below)\n", EntryType, EntryLength, EntryOffset); break; } @@ -1110,7 +1110,7 @@ AcpiDmDumpMadt ( InfoTable = AcpiDmTableInfoMadt10; break; default: - AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type); /* Attempt to continue */ @@ -1378,7 +1378,7 @@ AcpiDmDumpSrat ( InfoTable = AcpiDmTableInfoSrat2; break; default: - AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown SRAT sub-table type 0x%X\n", SubTable->Type); /* Attempt to continue */ diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c index 6d3b500e0c0e..e3f91d94e3b6 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo.c @@ -142,6 +142,7 @@ #define ACPI_IVRS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_IVRS,f) #define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f) #define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f) +#define ACPI_MCHI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCHI,f) #define ACPI_MSCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MSCT,f) #define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f) #define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f) @@ -1224,6 +1225,30 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] = }; +/******************************************************************************* + * + * MCHI - Management Controller Host Interface table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[] = +{ + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterfaceType), "Interface Type"}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Protocol), "Protocol"}, + {ACPI_DMT_UINT64, ACPI_MCHI_OFFSET (ProtocolData), "Protocol Data"}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterruptType), "Interrupt Type"}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Gpe), "Gpe"}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDeviceFlag), "Pci Device Flag"}, + {ACPI_DMT_UINT32, ACPI_MCHI_OFFSET (GlobalInterrupt), "Global Interrupt"}, + {ACPI_DMT_GAS, ACPI_MCHI_OFFSET (ControlRegister), "Control Register"}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciSegment), "Pci Segment"}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciBus), "Pci Bus"}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDevice), "Pci Device"}, + {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciFunction), "Pci Function"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + /******************************************************************************* * * MSCT - Maximum System Characteristics Table (ACPI 4.0) diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c index 46a6db00723b..608f6e512153 100644 --- a/sys/contrib/dev/acpica/compiler/aslanalyze.c +++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c @@ -142,16 +142,6 @@ static UINT32 AnGetBtype ( ACPI_PARSE_OBJECT *Op); -static UINT32 -AnCheckForReservedName ( - ACPI_PARSE_OBJECT *Op, - char *Name); - -static void -AnCheckForReservedMethod ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo); - static UINT32 AnMapObjTypeToBtype ( ACPI_PARSE_OBJECT *Op); @@ -596,219 +586,6 @@ AnGetBtype ( } -/******************************************************************************* - * - * FUNCTION: AnCheckForReservedName - * - * PARAMETERS: Op - A parse node - * Name - NameSeg to check - * - * RETURN: None - * - * DESCRIPTION: Check a NameSeg against the reserved list. - * - ******************************************************************************/ - -static UINT32 -AnCheckForReservedName ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - UINT32 i; - - - if (Name[0] == 0) - { - AcpiOsPrintf ("Found a null name, external = %s\n", - Op->Asl.ExternalName); - } - - /* All reserved names are prefixed with a single underscore */ - - if (Name[0] != '_') - { - return (ACPI_NOT_RESERVED_NAME); - } - - /* Check for a standard reserved method name */ - - for (i = 0; ReservedMethods[i].Name; i++) - { - if (ACPI_COMPARE_NAME (Name, ReservedMethods[i].Name)) - { - if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, - Op->Asl.ExternalName); - return (ACPI_PREDEFINED_NAME); - } - else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, - Op->Asl.ExternalName); - return (ACPI_PREDEFINED_NAME); - } - - /* Return index into reserved array */ - - return i; - } - } - - /* - * Now check for the "special" reserved names -- - * GPE: _Lxx - * GPE: _Exx - * EC: _Qxx - */ - if ((Name[1] == 'L') || - (Name[1] == 'E') || - (Name[1] == 'Q')) - { - /* The next two characters must be hex digits */ - - if ((isxdigit ((int) Name[2])) && - (isxdigit ((int) Name[3]))) - { - return (ACPI_EVENT_RESERVED_NAME); - } - } - - - /* Check for the names reserved for the compiler itself: _T_x */ - - else if ((Op->Asl.ExternalName[1] == 'T') && - (Op->Asl.ExternalName[2] == '_')) - { - /* Ignore if actually emitted by the compiler */ - - if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED) - { - return (ACPI_NOT_RESERVED_NAME); - } - - /* - * Was not actually emitted by the compiler. This is a special case, - * however. If the ASL code being compiled was the result of a - * dissasembly, it may possibly contain valid compiler-emitted names - * of the form "_T_x". We don't want to issue an error or even a - * warning and force the user to manually change the names. So, we - * will issue a remark instead. - */ - AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName); - return (ACPI_COMPILER_RESERVED_NAME); - } - - /* - * The name didn't match any of the known reserved names. Flag it as a - * warning, since the entire namespace starting with an underscore is - * reserved by the ACPI spec. - */ - AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, - Op->Asl.ExternalName); - - return (ACPI_NOT_RESERVED_NAME); -} - - -/******************************************************************************* - * - * FUNCTION: AnCheckForReservedMethod - * - * PARAMETERS: Op - A parse node of type "METHOD". - * MethodInfo - Saved info about this method - * - * RETURN: None - * - * DESCRIPTION: If method is a reserved name, check that the number of arguments - * and the return type (returns a value or not) is correct. - * - ******************************************************************************/ - -static void -AnCheckForReservedMethod ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo) -{ - UINT32 Index; - UINT32 RequiredArgsCurrent; - UINT32 RequiredArgsOld; - - - /* Check for a match against the reserved name list */ - - Index = AnCheckForReservedName (Op, Op->Asl.NameSeg); - - switch (Index) - { - case ACPI_NOT_RESERVED_NAME: - case ACPI_PREDEFINED_NAME: - case ACPI_COMPILER_RESERVED_NAME: - - /* Just return, nothing to do */ - break; - - - case ACPI_EVENT_RESERVED_NAME: - - Gbl_ReservedMethods++; - - /* NumArguments must be zero for all _Lxx, _Exx, and _Qxx methods */ - - if (MethodInfo->NumArguments != 0) - { - sprintf (MsgBuffer, "%s requires %d", - Op->Asl.ExternalName, 0); - - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer); - } - break; - - - default: - - Gbl_ReservedMethods++; - - /* - * Matched a reserved method name - * - * Validate the ASL-defined argument count. Allow two different legal - * arg counts. - */ - RequiredArgsCurrent = ReservedMethods[Index].NumArguments & 0x0F; - RequiredArgsOld = ReservedMethods[Index].NumArguments >> 4; - - if ((MethodInfo->NumArguments != RequiredArgsCurrent) && - (MethodInfo->NumArguments != RequiredArgsOld)) - { - sprintf (MsgBuffer, "%s requires %d", - ReservedMethods[Index].Name, - RequiredArgsCurrent); - - if (MethodInfo->NumArguments > RequiredArgsCurrent) - { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, - MsgBuffer); - } - else - { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, - MsgBuffer); - } - } - - if (MethodInfo->NumReturnNoValue && - ReservedMethods[Index].Flags & ASL_RSVD_RETURN_VALUE) - { - sprintf (MsgBuffer, "%s", ReservedMethods[Index].Name); - - AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, MsgBuffer); - } - break; - } -} - - /******************************************************************************* * * FUNCTION: AnMapObjTypeToBtype @@ -1187,7 +964,7 @@ AnMethodAnalysisWalkBegin ( * The first operand is a name to be created in the namespace. * Check against the reserved list. */ - i = AnCheckForReservedName (Op, Op->Asl.NameSeg); + i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg); if (i < ACPI_VALID_RESERVED_NAME_MAX) { AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName); @@ -1197,51 +974,29 @@ AnMethodAnalysisWalkBegin ( case PARSEOP_NAME: - i = AnCheckForReservedName (Op, Op->Asl.NameSeg); - if (i < ACPI_VALID_RESERVED_NAME_MAX) + /* Typecheck any predefined names statically defined with Name() */ + + ApCheckForPredefinedObject (Op, Op->Asl.NameSeg); + + /* Special typechecking for _HID */ + + if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg)) { - if (ReservedMethods[i].NumArguments > 0) + Next = Op->Asl.Child->Asl.Next; + if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) { /* - * This reserved name must be a control method because - * it must have arguments + * _HID 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. */ - AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, - "with arguments"); - } - - /* Typechecking for _HID */ - - else if (!ACPI_STRCMP (METHOD_NAME__HID, ReservedMethods[i].Name)) - { - /* Examine the second operand to typecheck it */ - - Next = Op->Asl.Child->Asl.Next; - - if ((Next->Asl.ParseOpcode != PARSEOP_INTEGER) && - (Next->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)) + for (i = 0; Next->Asl.Value.String[i]; i++) { - /* _HID must be a string or an integer */ - - AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Next, - "String or Integer"); - } - - if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) - { - /* - * _HID 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. - */ - for (i = 0; Next->Asl.Value.String[i]; i++) + if (!isalnum ((int) Next->Asl.Value.String[i])) { - if (!isalnum ((int) Next->Asl.Value.String[i])) - { - AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, - Next, Next->Asl.Value.String); - break; - } + AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, + Next, Next->Asl.Value.String); + break; } } } @@ -1394,13 +1149,19 @@ AnMethodAnalysisWalkEnd ( * Check predefined method names for correct return behavior * and correct number of arguments */ - AnCheckForReservedMethod (Op, MethodInfo); + ApCheckForPredefinedMethod (Op, MethodInfo); ACPI_FREE (MethodInfo); break; case PARSEOP_RETURN: + /* + * If the parent is a predefined method name, attempt to typecheck + * the return value. Only static types can be validated. + */ + ApCheckPredefinedReturnValue (Op, MethodInfo); + /* * The parent block does not "exit" and continue execution -- the * method is terminated here with the Return() statement. diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index 16b5f723d45c..dbc2709725b5 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -452,8 +452,32 @@ ACPI_OBJECT_TYPE AslMapNamedOpcodeToDataType ( UINT16 Opcode); + +/* + * aslpredef - ACPI predefined names support + */ void -MpDisplayReservedNames ( +ApCheckForPredefinedMethod ( + ACPI_PARSE_OBJECT *Op, + ASL_METHOD_INFO *MethodInfo); + +void +ApCheckPredefinedReturnValue ( + ACPI_PARSE_OBJECT *Op, + ASL_METHOD_INFO *MethodInfo); + +UINT32 +ApCheckForPredefinedName ( + ACPI_PARSE_OBJECT *Op, + char *Name); + +void +ApCheckForPredefinedObject ( + ACPI_PARSE_OBJECT *Op, + char *Name); + +void +ApDisplayReservedNames ( void); diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h index 69fcf8438a1e..01ab931e0d0d 100644 --- a/sys/contrib/dev/acpica/compiler/aslglobal.h +++ b/sys/contrib/dev/acpica/compiler/aslglobal.h @@ -261,7 +261,6 @@ ASL_EXTERN FILE *AcpiGbl_DebugFile; /* Placeholder for oswin ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo; ASL_EXTERN ACPI_TABLE_HEADER TableHeader; -extern const ASL_RESERVED_INFO ReservedMethods[]; /* Event timing */ diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 9b9e95685439..e8b0c457ce57 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -570,7 +570,7 @@ AslDoOptions ( case 'r': /* reserved names */ - MpDisplayReservedNames (); + ApDisplayReservedNames (); exit (0); default: diff --git a/sys/contrib/dev/acpica/compiler/aslmap.c b/sys/contrib/dev/acpica/compiler/aslmap.c index be43b229ce59..4027a622067c 100644 --- a/sys/contrib/dev/acpica/compiler/aslmap.c +++ b/sys/contrib/dev/acpica/compiler/aslmap.c @@ -114,7 +114,6 @@ * *****************************************************************************/ - #include <contrib/dev/acpica/compiler/aslcompiler.h> #include <contrib/dev/acpica/include/amlcode.h> #include <contrib/dev/acpica/include/acparser.h> @@ -169,322 +168,6 @@ AslMapNamedOpcodeToDataType ( } -/******************************************************************************* - * - * FUNCTION: MpDisplayReservedNames - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Print the table above - * - ******************************************************************************/ - -void -MpDisplayReservedNames ( - void) -{ - UINT32 i; - - printf ("Reserved name information\n\n"); - - for (i = 0; ReservedMethods[i].Name; i++) - { - printf ("%s ", ReservedMethods[i].Name); - - if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE) - { - printf ("Reserved scope name\n"); - } - else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME) - { - printf ("Resource data type reserved field name\n"); - } - else - { - printf ("Method with %d arguments, ", - ReservedMethods[i].NumArguments & 0x0F); - - if (ReservedMethods[i].Flags & ASL_RSVD_RETURN_VALUE) - { - printf ("must return a value\n"); - } - else - { - printf ("no return value\n"); - } - } - } -} - - -/******************************************************************************* - * - * DATA STRUCTURE: ReservedMethods - * - * DESCRIPTION: Contains all reserved methods and names as defined in the - * ACPI specification. Used during the analysis phase to - * ensure that reserved methods have the required number of - * arguments and the proper return type. - * - * Each entry in the table contains the following items: - * - * Name - The ACPI reserved name - * Args - Number of arguments to the method - * Flags - Whether this method must return a value or not. Or if the - * name is a resource descriptor label. - * - ******************************************************************************/ - -const ASL_RESERVED_INFO ReservedMethods[] = { - {"_AC0", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC1", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC2", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC3", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC4", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC5", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC6", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC7", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC8", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC9", 0, ASL_RSVD_RETURN_VALUE}, - {"_ADR", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL0", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL1", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL2", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL3", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL4", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL5", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL6", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL7", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL8", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL9", 0, ASL_RSVD_RETURN_VALUE}, - {"_ALC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_ALI", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_ALN", 0, ASL_RSVD_RESOURCE_NAME}, - {"_ALP", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_ALR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_ALT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_ART", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_ASI", 0, ASL_RSVD_RESOURCE_NAME}, - {"_ASZ", 0, ASL_RSVD_RESOURCE_NAME}, - {"_BAS", 0, ASL_RSVD_RESOURCE_NAME}, - {"_BBN", 0, ASL_RSVD_RETURN_VALUE}, - {"_BCL", 0, ASL_RSVD_RETURN_VALUE}, - {"_BCM", 1, 0}, - {"_BCT", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_BDN", 0, ASL_RSVD_RETURN_VALUE}, - {"_BFS", 1, 0}, - {"_BIF", 0, ASL_RSVD_RETURN_VALUE}, - {"_BIX", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_BLT", 3, 0}, /* Acpi 3.0 */ - {"_BM_", 0, ASL_RSVD_RESOURCE_NAME}, - {"_BMA", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_BMC", 1, 0}, /* Acpi 3.0 */ - {"_BMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_BMS", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_BQC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_BST", 0, ASL_RSVD_RETURN_VALUE}, - {"_BTM", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_BTP", 1, 0}, - {"_CBA", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_CDM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_CID", 0, ASL_RSVD_RETURN_VALUE}, - {"_CRS", 0, ASL_RSVD_RETURN_VALUE}, - {"_CRT", 0, ASL_RSVD_RETURN_VALUE}, - {"_CSD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_CST", 0, ASL_RSVD_RETURN_VALUE}, - {"_DCK", 1, ASL_RSVD_RETURN_VALUE}, - {"_DCS", 0, ASL_RSVD_RETURN_VALUE}, - {"_DDC", 1, ASL_RSVD_RETURN_VALUE}, - {"_DDN", 0, 0}, - {"_DEC", 0, ASL_RSVD_RESOURCE_NAME}, - {"_DGS", 0, ASL_RSVD_RETURN_VALUE}, - {"_DIS", 0, 0}, - {"_DMA", 0, ASL_RSVD_RETURN_VALUE}, - {"_DOD", 0, ASL_RSVD_RETURN_VALUE}, - {"_DOS", 1, 0}, - {"_DSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_DSS", 1, 0}, - {"_DSW", 3, 0}, /* Acpi 3.0 */ - {"_DTI", 1, 0}, /* Acpi 4.0 */ - {"_EC_", 0, ASL_RSVD_RETURN_VALUE}, - {"_EDL", 0, ASL_RSVD_RETURN_VALUE}, - {"_EJ0", 1, 0}, - {"_EJ1", 1, 0}, - {"_EJ2", 1, 0}, - {"_EJ3", 1, 0}, - {"_EJ4", 1, 0}, - {"_EJD", 0, ASL_RSVD_RETURN_VALUE}, - {"_ERR", 3, ASL_RSVD_RETURN_VALUE}, - {"_FDE", 0, ASL_RSVD_RETURN_VALUE}, - {"_FDI", 0, ASL_RSVD_RETURN_VALUE}, - {"_FDM", 1, 0}, - {"_FIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_FIX", 0, ASL_RSVD_RETURN_VALUE}, - {"_FPS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_FSL", 1, 0}, /* Acpi 4.0 */ - {"_FST", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_GAI", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_GHL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_GL_", 0, ASL_RSVD_RETURN_VALUE}, - {"_GLK", 0, ASL_RSVD_RETURN_VALUE}, - {"_GPD", 0, ASL_RSVD_RETURN_VALUE}, - {"_GPE", 0, ASL_RSVD_RETURN_VALUE}, - {"_GRA", 0, ASL_RSVD_RESOURCE_NAME}, - {"_GSB", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_GTF", 0, ASL_RSVD_RETURN_VALUE}, - {"_GTM", 0, ASL_RSVD_RETURN_VALUE}, - {"_GTS", 1, 0}, - {"_HE_", 0, ASL_RSVD_RESOURCE_NAME}, - {"_HID", 0, ASL_RSVD_RETURN_VALUE}, - {"_HOT", 0, ASL_RSVD_RETURN_VALUE}, - {"_HPP", 0, ASL_RSVD_RETURN_VALUE}, - {"_HPX", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_IFT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_INI", 0, 0}, - {"_INT", 0, ASL_RSVD_RESOURCE_NAME}, - {"_IRC", 0, 0}, - {"_LCK", 1, 0}, - {"_LEN", 0, ASL_RSVD_RESOURCE_NAME}, - {"_LID", 0, ASL_RSVD_RETURN_VALUE}, - {"_LL_", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MAF", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MAT", 0, ASL_RSVD_RETURN_VALUE}, - {"_MAX", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MBM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_MEM", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MIF", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MIN", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MLS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_MSG", 1, 0}, - {"_MSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_MTP", 0, ASL_RSVD_RESOURCE_NAME}, - {"_NTT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_OFF", 0, 0}, - {"_ON_", 0, 0}, - {"_OS_", 0, ASL_RSVD_RETURN_VALUE}, - {"_OSC", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_OSI", 1, ASL_RSVD_RETURN_VALUE}, - {"_OST", 3, 0}, /* Acpi 3.0 */ - {"_PAI", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PCL", 0, ASL_RSVD_RETURN_VALUE}, - {"_PCT", 0, ASL_RSVD_RETURN_VALUE}, - {"_PDC", 1, 0}, - {"_PDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PIC", 1, 0}, - {"_PIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PLD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_PMC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PMM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PPC", 0, ASL_RSVD_RETURN_VALUE}, - {"_PPE", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_PR0", 0, ASL_RSVD_RETURN_VALUE}, - {"_PR1", 0, ASL_RSVD_RETURN_VALUE}, - {"_PR2", 0, ASL_RSVD_RETURN_VALUE}, - {"_PR3", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PRL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PRS", 0, ASL_RSVD_RETURN_VALUE}, - {"_PRT", 0, ASL_RSVD_RETURN_VALUE}, - {"_PRW", 0, ASL_RSVD_RETURN_VALUE}, - {"_PS0", 0, 0}, - {"_PS1", 0, 0}, - {"_PS2", 0, 0}, - {"_PS3", 0, 0}, - {"_PSC", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_PSL", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSR", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSS", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSV", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSW", 1, 0}, - {"_PTC", 0, ASL_RSVD_RETURN_VALUE}, - {"_PTP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PTS", 1, 0}, - {"_PUR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_PXM", 0, ASL_RSVD_RETURN_VALUE}, - {"_RBO", 0, ASL_RSVD_RESOURCE_NAME}, - {"_RBW", 0, ASL_RSVD_RESOURCE_NAME}, - {"_REG", 2, 0}, - {"_REV", 0, ASL_RSVD_RETURN_VALUE}, - {"_RMV", 0, ASL_RSVD_RETURN_VALUE}, - {"_RNG", 0, ASL_RSVD_RESOURCE_NAME}, - {"_ROM", 2, ASL_RSVD_RETURN_VALUE}, - {"_RT_", 0, ASL_RSVD_RESOURCE_NAME}, /* Acpi 3.0 */ - {"_RTV", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_RW_", 0, ASL_RSVD_RESOURCE_NAME}, - {"_S0_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S1_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S2_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S3_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S4_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S5_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S1D", 0, ASL_RSVD_RETURN_VALUE}, - {"_S2D", 0, ASL_RSVD_RETURN_VALUE}, - {"_S3D", 0, ASL_RSVD_RETURN_VALUE}, - {"_S4D", 0, ASL_RSVD_RETURN_VALUE}, - {"_S0W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_S1W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_S2W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_S3W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_S4W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_SB_", 0, ASL_RSVD_SCOPE}, - {"_SBS", 0, ASL_RSVD_RETURN_VALUE}, - {"_SCP", 0x13, 0}, /* Acpi 1.0 - one arg; Acpi 3.0 - three args */ - {"_SDD", 1, 0}, /* Acpi 3.0 */ - {"_SEG", 0, ASL_RSVD_RETURN_VALUE}, - {"_SHL", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_SHR", 0, ASL_RSVD_RESOURCE_NAME}, - {"_SI_", 0, ASL_RSVD_SCOPE}, - {"_SIZ", 0, ASL_RSVD_RESOURCE_NAME}, - {"_SLI", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_SPD", 1, ASL_RSVD_RETURN_VALUE}, - {"_SRS", 1, 0}, - {"_SRV", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_SST", 1, 0}, - {"_STA", 0, ASL_RSVD_RETURN_VALUE}, - {"_STM", 3, 0}, - {"_STP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_STR", 0, ASL_RSVD_RETURN_VALUE}, - {"_STV", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_SUN", 0, ASL_RSVD_RETURN_VALUE}, - {"_SWS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_TC1", 0, ASL_RSVD_RETURN_VALUE}, - {"_TC2", 0, ASL_RSVD_RETURN_VALUE}, - {"_TDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0b */ - {"_TIP", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_TIV", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ - {"_TMP", 0, ASL_RSVD_RETURN_VALUE}, - {"_TPC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_TPT", 1, 0}, /* Acpi 3.0 */ - {"_TRA", 0, ASL_RSVD_RESOURCE_NAME}, - {"_TRS", 0, ASL_RSVD_RESOURCE_NAME}, - {"_TRT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_TSD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_TSF", 0, ASL_RSVD_RESOURCE_NAME}, /* Acpi 3.0 */ - {"_TSP", 0, ASL_RSVD_RETURN_VALUE}, - {"_TSS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_TST", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_TTP", 0, ASL_RSVD_RESOURCE_NAME}, - {"_TTS", 1, 0}, /* Acpi 3.0 */ - {"_TYP", 0, ASL_RSVD_RESOURCE_NAME}, - {"_TZ_", 0, ASL_RSVD_SCOPE}, - {"_TZD", 0, ASL_RSVD_RETURN_VALUE}, - {"_TZM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_TZP", 0, ASL_RSVD_RETURN_VALUE}, - {"_UID", 0, ASL_RSVD_RETURN_VALUE}, - {"_UPC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_UPD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_UPP", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ - {"_VPO", 0, ASL_RSVD_RETURN_VALUE}, - {"_WAK", 1, ASL_RSVD_RETURN_VALUE}, - {"_WDG", 0, ASL_RSVD_RETURN_VALUE}, /* MS Extension */ - {"_WED", 1, ASL_RSVD_RETURN_VALUE}, /* MS Extension */ - {NULL, 0, 0}, -}; - - /******************************************************************************* * * DATA STRUCTURE: AslKeywordMapping diff --git a/sys/contrib/dev/acpica/compiler/aslpredef.c b/sys/contrib/dev/acpica/compiler/aslpredef.c new file mode 100644 index 000000000000..b9632f9c6e19 --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/aslpredef.c @@ -0,0 +1,799 @@ +/****************************************************************************** + * + * Module Name: aslpredef - support for ACPI predefined names + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define ACPI_CREATE_PREDEFINED_TABLE + +#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.y.h" +#include <contrib/dev/acpica/include/amlcode.h> +#include <contrib/dev/acpica/include/acparser.h> +#include <contrib/dev/acpica/include/acpredef.h> + + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslpredef") + + +/* Local prototypes */ + +static UINT32 +ApCheckForSpecialName ( + ACPI_PARSE_OBJECT *Op, + char *Name); + +static void +ApCheckObjectType ( + ACPI_PARSE_OBJECT *Op, + UINT32 ExpectedBtypes); + +static void +ApGetExpectedTypes ( + char *Buffer, + UINT32 ExpectedBtypes); + + +/* + * Names for the types that can be returned by the predefined objects. + * Used for warning messages. Must be in the same order as the ACPI_RTYPEs + */ +static const char *AcpiRtypeNames[] = +{ + "/Integer", + "/String", + "/Buffer", + "/Package", + "/Reference", +}; + +/* + * Predefined names for use in Resource Descriptors. These names do not + * appear in the global Predefined Name table (since these names never + * appear in actual AML byte code, only in the original ASL) + */ +static const ACPI_PREDEFINED_INFO ResourceNames[] = { + {{"_ALN", 0, 0}}, + {{"_ASI", 0, 0}}, + {{"_ASZ", 0, 0}}, + {{"_ATT", 0, 0}}, + {{"_BAS", 0, 0}}, + {{"_BM_", 0, 0}}, + {{"_DEC", 0, 0}}, + {{"_GRA", 0, 0}}, + {{"_HE_", 0, 0}}, + {{"_INT", 0, 0}}, + {{"_LEN", 0, 0}}, + {{"_LL_", 0, 0}}, + {{"_MAF", 0, 0}}, + {{"_MAX", 0, 0}}, + {{"_MEM", 0, 0}}, + {{"_MIF", 0, 0}}, + {{"_MIN", 0, 0}}, + {{"_MTP", 0, 0}}, + {{"_RBO", 0, 0}}, + {{"_RBW", 0, 0}}, + {{"_RNG", 0, 0}}, + {{"_RT_", 0, 0}}, /* Acpi 3.0 */ + {{"_RW_", 0, 0}}, + {{"_SHR", 0, 0}}, + {{"_SIZ", 0, 0}}, + {{"_TRA", 0, 0}}, + {{"_TRS", 0, 0}}, + {{"_TSF", 0, 0}}, /* Acpi 3.0 */ + {{"_TTP", 0, 0}}, + {{"_TYP", 0, 0}}, + {{{0,0,0,0}, 0, 0}} /* Table terminator */ +}; + +static const ACPI_PREDEFINED_INFO ScopeNames[] = { + {{"_SB_", 0, 0}}, + {{"_SI_", 0, 0}}, + {{"_TZ_", 0, 0}}, + {{{0,0,0,0}, 0, 0}} /* Table terminator */ +}; + + +/******************************************************************************* + * + * FUNCTION: ApCheckForPredefinedMethod + * + * PARAMETERS: Op - A parse node of type "METHOD". + * MethodInfo - Saved info about this method + * + * RETURN: None + * + * DESCRIPTION: If method is a predefined name, check that the number of + * arguments and the return type (returns a value or not) + * is correct. + * + ******************************************************************************/ + +void +ApCheckForPredefinedMethod ( + ACPI_PARSE_OBJECT *Op, + ASL_METHOD_INFO *MethodInfo) +{ + UINT32 Index; + UINT32 RequiredArgsCurrent; + UINT32 RequiredArgsOld; + + + /* Check for a match against the predefined name list */ + + Index = ApCheckForPredefinedName (Op, Op->Asl.NameSeg); + + switch (Index) + { + case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ + case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ + case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ + + /* Just return, nothing to do */ + break; + + + case ACPI_EVENT_RESERVED_NAME: /* _Lxx, _Exx, and _Qxx methods */ + + Gbl_ReservedMethods++; + + /* NumArguments must be zero for all _Lxx, _Exx, and _Qxx methods */ + + if (MethodInfo->NumArguments != 0) + { + sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName, 0); + + AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, + MsgBuffer); + } + break; + + + default: + /* + * Matched a predefined method name + * + * Validate the ASL-defined argument count. Allow two different legal + * arg counts. + */ + Gbl_ReservedMethods++; + + RequiredArgsCurrent = PredefinedNames[Index].Info.ParamCount & 0x0F; + RequiredArgsOld = PredefinedNames[Index].Info.ParamCount >> 4; + + if ((MethodInfo->NumArguments != RequiredArgsCurrent) && + (MethodInfo->NumArguments != RequiredArgsOld)) + { + sprintf (MsgBuffer, "%4.4s requires %d", + PredefinedNames[Index].Info.Name, RequiredArgsCurrent); + + if (MethodInfo->NumArguments > RequiredArgsCurrent) + { + AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, + MsgBuffer); + } + else + { + AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, + MsgBuffer); + } + } + + /* + * Check if method returns no value, but the predefined name is + * required to return a value + */ + if (MethodInfo->NumReturnNoValue && + PredefinedNames[Index].Info.ExpectedBtypes) + { + ApGetExpectedTypes (StringBuffer, + PredefinedNames[Index].Info.ExpectedBtypes); + + sprintf (MsgBuffer, "%s required for %4.4s", + StringBuffer, PredefinedNames[Index].Info.Name); + + AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, + MsgBuffer); + } + break; + } +} + + +/******************************************************************************* + * + * FUNCTION: ApCheckPredefinedReturnValue + * + * PARAMETERS: Op - A parse node of type "RETURN". + * MethodInfo - Saved info about this method + * + * RETURN: None + * + * DESCRIPTION: If method is a predefined name, attempt to validate the return + * value. Only "static" types can be validated - a simple return + * of an integer/string/buffer/package or a named reference to + * a static object. Values such as a Localx or Argx or a control + * method invocation are not checked. + * + ******************************************************************************/ + +void +ApCheckPredefinedReturnValue ( + ACPI_PARSE_OBJECT *Op, + ASL_METHOD_INFO *MethodInfo) +{ + UINT32 Index; + ACPI_PARSE_OBJECT *ReturnValueOp; + + + /* Check parent method for a match against the predefined name list */ + + Index = ApCheckForPredefinedName (MethodInfo->Op, + MethodInfo->Op->Asl.NameSeg); + + switch (Index) + { + case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */ + case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */ + case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */ + case ACPI_EVENT_RESERVED_NAME: /* _Lxx, _Exx, and _Qxx methods */ + + /* Just return, nothing to do */ + return; + + default: /* a real predefined ACPI name */ + + /* Exit if no return value expected */ + + if (!PredefinedNames[Index].Info.ExpectedBtypes) + { + return; + } + + /* Get the object returned, it is the next argument */ + + ReturnValueOp = Op->Asl.Child; + switch (ReturnValueOp->Asl.ParseOpcode) + { + case PARSEOP_ZERO: + case PARSEOP_ONE: + case PARSEOP_ONES: + case PARSEOP_INTEGER: + case PARSEOP_STRING_LITERAL: + case PARSEOP_BUFFER: + case PARSEOP_PACKAGE: + + /* Static data return object - check against expected type */ + + ApCheckObjectType (ReturnValueOp, + PredefinedNames[Index].Info.ExpectedBtypes); + break; + + default: + + /* + * All other ops are very difficult or impossible to typecheck at + * compile time. These include all Localx, Argx, and method + * invocations. Also, NAMESEG and NAMESTRING because the type of + * any named object can be changed at runtime (for example, + * CopyObject will change the type of the target object.) + */ + break; + } + } +} + + +/******************************************************************************* + * + * FUNCTION: ApCheckForPredefinedObject + * + * PARAMETERS: Op - A parse node + * Name - The ACPI name to be checked + * + * RETURN: None + * + * DESCRIPTION: Check for a predefined name for a static object (created via + * the ASL Name operator). If it is a predefined ACPI name, ensure + * that the name does not require any arguments (which would + * require a control method implemenation of the name), and that + * the type of the object is one of the expected types for the + * predefined name. + * + ******************************************************************************/ + +void +ApCheckForPredefinedObject ( + ACPI_PARSE_OBJECT *Op, + char *Name) +{ + UINT32 Index; + + + /* + * Check for a real predefined name -- not a resource descriptor name + * or a predefined scope name + */ + Index = ApCheckForPredefinedName (Op, Name); + if (Index > ACPI_VALID_RESERVED_NAME_MAX) + { + return; + } + + /* + * We found a matching predefind name. + * Check if this predefined name requires input arguments + */ + if (PredefinedNames[Index].Info.ParamCount > 0) + { + /* + * This predefined name must always be defined as a control + * method because it is required to have input arguments. + */ + AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, + "with arguments"); + } + + /* Typecheck the actual object, it is the next argument */ + + ApCheckObjectType (Op->Asl.Child->Asl.Next, + PredefinedNames[Index].Info.ExpectedBtypes); +} + + +/******************************************************************************* + * + * FUNCTION: ApCheckForPredefinedName + * + * PARAMETERS: Op - A parse node + * Name - NameSeg to check + * + * RETURN: None + * + * DESCRIPTION: Check a NameSeg against the reserved list. + * + ******************************************************************************/ + +UINT32 +ApCheckForPredefinedName ( + ACPI_PARSE_OBJECT *Op, + char *Name) +{ + UINT32 i; + + + if (Name[0] == 0) + { + AcpiOsPrintf ("Found a null name, external = %s\n", + Op->Asl.ExternalName); + } + + /* All reserved names are prefixed with a single underscore */ + + if (Name[0] != '_') + { + return (ACPI_NOT_RESERVED_NAME); + } + + /* Check for a standard predefined method name */ + + for (i = 0; PredefinedNames[i].Info.Name[0]; i++) + { + if (ACPI_COMPARE_NAME (Name, PredefinedNames[i].Info.Name)) + { + /* Return index into predefined array */ + return (i); + } + } + + /* Check for resource names and predefined scope names */ + + for (i = 0; ResourceNames[i].Info.Name[0]; i++) + { + if (ACPI_COMPARE_NAME (Name, ResourceNames[i].Info.Name)) + { + return (ACPI_PREDEFINED_NAME); + } + } + + for (i = 0; ScopeNames[i].Info.Name[0]; i++) + { + if (ACPI_COMPARE_NAME (Name, ScopeNames[i].Info.Name)) + { + return (ACPI_PREDEFINED_NAME); + } + } + + /* Check for _Lxx, _Exx, _Qxx, _T_x. Warning if unknown predefined name */ + + return (ApCheckForSpecialName (Op, Name)); +} + + +/******************************************************************************* + * + * FUNCTION: ApCheckForSpecialName + * + * PARAMETERS: Op - A parse node + * Name - NameSeg to check + * + * RETURN: None + * + * DESCRIPTION: Check for the "special" predefined names - + * _Lxx, _Exx, _Qxx, and _T_x + * + ******************************************************************************/ + +static UINT32 +ApCheckForSpecialName ( + ACPI_PARSE_OBJECT *Op, + char *Name) +{ + + /* + * Check for the "special" predefined names. We know the first char is an + * underscore already. + * GPE: _Lxx + * GPE: _Exx + * EC: _Qxx + */ + if ((Name[1] == 'L') || + (Name[1] == 'E') || + (Name[1] == 'Q')) + { + /* The next two characters must be hex digits */ + + if ((isxdigit ((int) Name[2])) && + (isxdigit ((int) Name[3]))) + { + return (ACPI_EVENT_RESERVED_NAME); + } + } + + /* Check for the names reserved for the compiler itself: _T_x */ + + else if ((Op->Asl.ExternalName[1] == 'T') && + (Op->Asl.ExternalName[2] == '_')) + { + /* Ignore if actually emitted by the compiler */ + + if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED) + { + return (ACPI_NOT_RESERVED_NAME); + } + + /* + * Was not actually emitted by the compiler. This is a special case, + * however. If the ASL code being compiled was the result of a + * dissasembly, it may possibly contain valid compiler-emitted names + * of the form "_T_x". We don't want to issue an error or even a + * warning and force the user to manually change the names. So, we + * will issue a remark instead. + */ + AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName); + return (ACPI_COMPILER_RESERVED_NAME); + } + + /* + * The name didn't match any of the known predefined names. Flag it as a + * warning, since the entire namespace starting with an underscore is + * reserved by the ACPI spec. + */ + AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, + Op->Asl.ExternalName); + + return (ACPI_NOT_RESERVED_NAME); +} + + +/******************************************************************************* + * + * FUNCTION: ApCheckObjectType + * + * PARAMETERS: Op - Current parse node + * ExpectedBtypes - Bitmap of expected return type(s) + * + * RETURN: None + * + * DESCRIPTION: Check if the object type is one of the types that is expected + * by the predefined name. Only a limited number of object types + * can be returned by the predefined names. + * + ******************************************************************************/ + +static void +ApCheckObjectType ( + ACPI_PARSE_OBJECT *Op, + UINT32 ExpectedBtypes) +{ + UINT32 ReturnBtype; + + + switch (Op->Asl.ParseOpcode) + { + case PARSEOP_ZERO: + case PARSEOP_ONE: + case PARSEOP_ONES: + case PARSEOP_INTEGER: + ReturnBtype = ACPI_RTYPE_INTEGER; + break; + + case PARSEOP_BUFFER: + ReturnBtype = ACPI_RTYPE_BUFFER; + break; + + case PARSEOP_STRING_LITERAL: + ReturnBtype = ACPI_RTYPE_STRING; + break; + + case PARSEOP_PACKAGE: + ReturnBtype = ACPI_RTYPE_PACKAGE; + break; + + default: + /* Not one of the supported object types */ + + goto TypeErrorExit; + } + + /* Exit if the object is one of the expected types */ + + if (ReturnBtype & ExpectedBtypes) + { + return; + } + + +TypeErrorExit: + + /* Format the expected types and emit an error message */ + + ApGetExpectedTypes (StringBuffer, ExpectedBtypes); + + sprintf (MsgBuffer, "found %s, requires %s", + UtGetOpName (Op->Asl.ParseOpcode), StringBuffer); + + AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, + MsgBuffer); +} + + +/******************************************************************************* + * + * FUNCTION: ApDisplayReservedNames + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Dump information about the ACPI predefined names and predefined + * resource descriptor names. + * + ******************************************************************************/ + +void +ApDisplayReservedNames ( + void) +{ + const ACPI_PREDEFINED_INFO *ThisName; + char TypeBuffer[48]; /* Room for 5 types */ + UINT32 Count; + + + /* + * Predefined names/methods + */ + printf ("\nPredefined Name Information\n\n"); + + Count = 0; + ThisName = PredefinedNames; + while (ThisName->Info.Name[0]) + { + printf ("%4.4s Requires %d arguments, ", + ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F); + + if (ThisName->Info.ExpectedBtypes) + { + ApGetExpectedTypes (TypeBuffer, ThisName->Info.ExpectedBtypes); + printf ("Must return: %s\n", TypeBuffer); + } + else + { + printf ("No return value\n"); + } + + /* + * Skip next entry in the table if this name returns a Package + * (next entry contains the package info) + */ + if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) + { + ThisName++; + } + + Count++; + ThisName++; + } + + printf ("%u Predefined Names are recognized\n", Count); + + /* + * Resource Descriptor names + */ + printf ("\nResource Descriptor Predefined Names\n\n"); + + Count = 0; + ThisName = ResourceNames; + while (ThisName->Info.Name[0]) + { + printf ("%4.4s Resource Descriptor\n", ThisName->Info.Name); + Count++; + ThisName++; + } + + printf ("%u Resource Descriptor Names are recognized\n", Count); + + /* + * Predefined scope names + */ + printf ("\nPredefined Scope Names\n\n"); + + ThisName = ScopeNames; + while (ThisName->Info.Name[0]) + { + printf ("%4.4s Scope\n", ThisName->Info.Name); + ThisName++; + } +} + + +/******************************************************************************* + * + * FUNCTION: ApGetExpectedTypes + * + * PARAMETERS: Buffer - Where the formatted string is returned + * ExpectedBTypes - Bitfield of expected data types + * + * RETURN: None, formatted string + * + * DESCRIPTION: Format the expected object types into a printable string. + * + ******************************************************************************/ + +static void +ApGetExpectedTypes ( + char *Buffer, + UINT32 ExpectedBtypes) +{ + UINT32 ThisRtype; + UINT32 i; + UINT32 j; + + + j = 1; + Buffer[0] = 0; + ThisRtype = ACPI_RTYPE_INTEGER; + + for (i = 0; i < ACPI_NUM_RTYPES; i++) + { + /* If one of the expected types, concatenate the name of this type */ + + if (ExpectedBtypes & ThisRtype) + { + ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]); + j = 0; /* Use name separator from now on */ + } + ThisRtype <<= 1; /* Next Rtype */ + } +} + diff --git a/sys/contrib/dev/acpica/compiler/aslstubs.c b/sys/contrib/dev/acpica/compiler/aslstubs.c index ebc0a7d321a1..b2fb69a96fbe 100644 --- a/sys/contrib/dev/acpica/compiler/aslstubs.c +++ b/sys/contrib/dev/acpica/compiler/aslstubs.c @@ -243,11 +243,13 @@ AcpiEvInitializeRegion ( return (AE_OK); } -ACPI_STATUS -AcpiEvCheckForWakeOnlyGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) +void +AcpiExDoDebugObject ( + ACPI_OPERAND_OBJECT *SourceDesc, + UINT32 Level, + UINT32 Index) { - return (AE_OK); + return; } ACPI_STATUS @@ -276,7 +278,6 @@ AcpiExLoadTableOp ( return (AE_SUPPORT); } - ACPI_STATUS AcpiExUnloadTable ( ACPI_OPERAND_OBJECT *DdbHandle) diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h index 9e1d426d2b75..30b8fdfe7d04 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.h +++ b/sys/contrib/dev/acpica/compiler/asltypes.h @@ -188,21 +188,6 @@ typedef struct asl_mapping_entry } ASL_MAPPING_ENTRY; -/* An entry in the Reserved Name information table */ - -#define ASL_RSVD_RETURN_VALUE 0x01 -#define ASL_RSVD_RESOURCE_NAME 0x02 -#define ASL_RSVD_SCOPE 0x04 - -typedef struct asl_reserved_info -{ - char *Name; - UINT8 NumArguments; - UINT8 Flags; - -} ASL_RESERVED_INFO; - - /* Parse tree walk info structure */ typedef struct asl_walk_info @@ -522,7 +507,7 @@ char *AslMessages [] = { /* ASL_MSG_RESERVED_ARG_COUNT_HI */ "Reserved method has too many arguments", /* ASL_MSG_RESERVED_ARG_COUNT_LO */ "Reserved method has too few arguments", /* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method", -/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid operand type for reserved name, must be", +/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name", /* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value", /* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name", /* ASL_MSG_RESERVED_WORD */ "Use of reserved name", diff --git a/sys/contrib/dev/acpica/debugger/dbdisply.c b/sys/contrib/dev/acpica/debugger/dbdisply.c index 179f6f66de95..41094891ad7d 100644 --- a/sys/contrib/dev/acpica/debugger/dbdisply.c +++ b/sys/contrib/dev/acpica/debugger/dbdisply.c @@ -848,13 +848,12 @@ AcpiDbDisplayGpes ( Block, GpeBlock, GpeBlock->Node, Buffer); AcpiOsPrintf (" Registers: %u (%u GPEs)\n", - GpeBlock->RegisterCount, - ACPI_MUL_8 (GpeBlock->RegisterCount)); + GpeBlock->RegisterCount, GpeBlock->GpeCount); - AcpiOsPrintf (" GPE range: 0x%X to 0x%X\n", + AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n", GpeBlock->BlockBaseNumber, - GpeBlock->BlockBaseNumber + - (GpeBlock->RegisterCount * 8) -1); + GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1), + GpeXruptInfo->InterruptNumber); AcpiOsPrintf ( " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", @@ -871,9 +870,12 @@ AcpiDbDisplayGpes ( GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; AcpiOsPrintf ( - " Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n", - i, GpeRegisterInfo->EnableForWake, + " Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X" + " Status %8.8X%8.8X Enable %8.8X%8.8X\n", + i, GpeRegisterInfo->BaseGpeNumber, + GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), GpeRegisterInfo->EnableForRun, + GpeRegisterInfo->EnableForWake, ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address), ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address)); @@ -886,17 +888,19 @@ AcpiDbDisplayGpes ( if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)) { - /* This GPE is not used (no method or handler) */ + /* This GPE is not used (no method or handler), ignore it */ continue; } AcpiOsPrintf ( - " GPE %.3X: %p Flags %2.2X: ", - GpeBlock->BlockBaseNumber + GpeIndex, - GpeEventInfo, + " GPE %.2X: %p RunRefs %2.2X WakeRefs %2.2X Flags %2.2X (", + GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo, + GpeEventInfo->RuntimeCount, GpeEventInfo->WakeupCount, GpeEventInfo->Flags); + /* Decode the flags byte */ + if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED) { AcpiOsPrintf ("Level, "); @@ -906,38 +910,13 @@ AcpiDbDisplayGpes ( AcpiOsPrintf ("Edge, "); } - switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) + if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) { - case ACPI_GPE_TYPE_WAKE: - AcpiOsPrintf ("WakeOnly: "); - break; - case ACPI_GPE_TYPE_RUNTIME: - AcpiOsPrintf (" RunOnly: "); - break; - case ACPI_GPE_TYPE_WAKE_RUN: - AcpiOsPrintf (" WakeRun: "); - break; - default: - AcpiOsPrintf (" NotUsed: "); - break; - } - - if (GpeEventInfo->Flags & ACPI_GPE_WAKE_ENABLED) - { - AcpiOsPrintf ("[Wake 1 "); + AcpiOsPrintf ("CanWake, "); } else { - AcpiOsPrintf ("[Wake 0 "); - } - - if (GpeEventInfo->Flags & ACPI_GPE_RUN_ENABLED) - { - AcpiOsPrintf ("Run 1], "); - } - else - { - AcpiOsPrintf ("Run 0], "); + AcpiOsPrintf ("RunOnly, "); } switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) @@ -957,7 +936,7 @@ AcpiDbDisplayGpes ( break; } - AcpiOsPrintf ("\n"); + AcpiOsPrintf (")\n"); } } Block++; diff --git a/sys/contrib/dev/acpica/dispatcher/dsfield.c b/sys/contrib/dev/acpica/dispatcher/dsfield.c index e33d6a865be8..d0240b06d650 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsfield.c +++ b/sys/contrib/dev/acpica/dispatcher/dsfield.c @@ -424,7 +424,7 @@ AcpiDsGetFieldNames ( default: ACPI_ERROR ((AE_INFO, - "Invalid opcode in field list: %X", Arg->Common.AmlOpcode)); + "Invalid opcode in field list: 0x%X", Arg->Common.AmlOpcode)); return_ACPI_STATUS (AE_AML_BAD_OPCODE); } diff --git a/sys/contrib/dev/acpica/dispatcher/dsmethod.c b/sys/contrib/dev/acpica/dispatcher/dsmethod.c index e54bb608c806..37cb867708b3 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsmethod.c +++ b/sys/contrib/dev/acpica/dispatcher/dsmethod.c @@ -318,7 +318,7 @@ AcpiDsBeginMethodExecution ( (WalkState->Thread->CurrentSyncLevel > ObjDesc->Method.Mutex->Mutex.SyncLevel)) { ACPI_ERROR ((AE_INFO, - "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%d)", + "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", AcpiUtGetNodeName (MethodNode), WalkState->Thread->CurrentSyncLevel)); diff --git a/sys/contrib/dev/acpica/dispatcher/dsmthdat.c b/sys/contrib/dev/acpica/dispatcher/dsmthdat.c index 8d2342f5f7df..593695e5cdf7 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsmthdat.c +++ b/sys/contrib/dev/acpica/dispatcher/dsmthdat.c @@ -363,7 +363,7 @@ AcpiDsMethodDataGetNode ( if (Index > ACPI_METHOD_MAX_LOCAL) { ACPI_ERROR ((AE_INFO, - "Local index %d is invalid (max %d)", + "Local index %u is invalid (max %u)", Index, ACPI_METHOD_MAX_LOCAL)); return_ACPI_STATUS (AE_AML_INVALID_INDEX); } @@ -378,7 +378,7 @@ AcpiDsMethodDataGetNode ( if (Index > ACPI_METHOD_MAX_ARG) { ACPI_ERROR ((AE_INFO, - "Arg index %d is invalid (max %d)", + "Arg index %u is invalid (max %u)", Index, ACPI_METHOD_MAX_ARG)); return_ACPI_STATUS (AE_AML_INVALID_INDEX); } @@ -389,7 +389,7 @@ AcpiDsMethodDataGetNode ( break; default: - ACPI_ERROR ((AE_INFO, "Type %d is invalid", Type)); + ACPI_ERROR ((AE_INFO, "Type %u is invalid", Type)); return_ACPI_STATUS (AE_TYPE); } @@ -540,7 +540,7 @@ AcpiDsMethodDataGetValue ( case ACPI_REFCLASS_ARG: ACPI_ERROR ((AE_INFO, - "Uninitialized Arg[%d] at node %p", + "Uninitialized Arg[%u] at node %p", Index, Node)); return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); @@ -555,7 +555,7 @@ AcpiDsMethodDataGetValue ( default: - ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Type)); + ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: 0x%X", Type)); return_ACPI_STATUS (AE_AML_INTERNAL); } } diff --git a/sys/contrib/dev/acpica/dispatcher/dsobject.c b/sys/contrib/dev/acpica/dispatcher/dsobject.c index 3e1c45e7037d..9669ca98e9c0 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsobject.c +++ b/sys/contrib/dev/acpica/dispatcher/dsobject.c @@ -365,7 +365,7 @@ AcpiDsBuildInternalBufferObj ( if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP) { ACPI_ERROR ((AE_INFO, - "Expecting bytelist, got AML opcode %X in op %p", + "Expecting bytelist, found AML opcode 0x%X in op %p", ByteList->Common.AmlOpcode, ByteList)); AcpiUtRemoveReference (ObjDesc); @@ -599,7 +599,7 @@ AcpiDsBuildInternalPackageObj ( } ACPI_INFO ((AE_INFO, - "Actual Package length (0x%X) is larger than NumElements field (0x%X), truncated\n", + "Actual Package length (%u) is larger than NumElements field (%u), truncated\n", i, ElementCount)); } else if (i < ElementCount) @@ -609,7 +609,7 @@ AcpiDsBuildInternalPackageObj ( * Note: this is not an error, the package is padded out with NULLs. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n", + "Package List length (%u) smaller than NumElements count (%u), padded with null elements\n", i, ElementCount)); } @@ -804,7 +804,7 @@ AcpiDsInitObjectFromOp ( default: ACPI_ERROR ((AE_INFO, - "Unknown constant opcode %X", Opcode)); + "Unknown constant opcode 0x%X", Opcode)); Status = AE_AML_OPERAND_TYPE; break; } @@ -821,7 +821,7 @@ AcpiDsInitObjectFromOp ( default: - ACPI_ERROR ((AE_INFO, "Unknown Integer type %X", + ACPI_ERROR ((AE_INFO, "Unknown Integer type 0x%X", OpInfo->Type)); Status = AE_AML_OPERAND_TYPE; break; @@ -902,7 +902,7 @@ AcpiDsInitObjectFromOp ( default: ACPI_ERROR ((AE_INFO, - "Unimplemented reference type for AML opcode: %4.4X", Opcode)); + "Unimplemented reference type for AML opcode: 0x%4.4X", Opcode)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } break; @@ -912,7 +912,7 @@ AcpiDsInitObjectFromOp ( default: - ACPI_ERROR ((AE_INFO, "Unimplemented data type: %X", + ACPI_ERROR ((AE_INFO, "Unimplemented data type: 0x%X", ObjDesc->Common.Type)); Status = AE_AML_OPERAND_TYPE; diff --git a/sys/contrib/dev/acpica/dispatcher/dsopcode.c b/sys/contrib/dev/acpica/dispatcher/dsopcode.c index b1c6dc36d98a..5c6004fbdfe9 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsopcode.c +++ b/sys/contrib/dev/acpica/dispatcher/dsopcode.c @@ -395,7 +395,7 @@ AcpiDsGetBufferArguments ( if (!Node) { ACPI_ERROR ((AE_INFO, - "No pointer back to NS node in buffer obj %p", ObjDesc)); + "No pointer back to namespace node in buffer object %p", ObjDesc)); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -444,7 +444,7 @@ AcpiDsGetPackageArguments ( if (!Node) { ACPI_ERROR ((AE_INFO, - "No pointer back to NS node in package %p", ObjDesc)); + "No pointer back to namespace node in package %p", ObjDesc)); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -678,7 +678,7 @@ AcpiDsInitBufferField ( default: ACPI_ERROR ((AE_INFO, - "Unknown field creation opcode %02x", + "Unknown field creation opcode 0x%02X", AmlOpcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; @@ -690,7 +690,7 @@ AcpiDsInitBufferField ( (8 * (UINT32) BufferDesc->Buffer.Length)) { ACPI_ERROR ((AE_INFO, - "Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)", + "Field [%4.4s] at %u exceeds Buffer [%4.4s] size %u (bits)", AcpiUtGetNodeName (ResultDesc), BitOffset + BitCount, AcpiUtGetNodeName (BufferDesc->Buffer.Node), @@ -806,7 +806,7 @@ AcpiDsEvalBufferFieldOperands ( ACPI_WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { - ACPI_ERROR ((AE_INFO, "(%s) bad operand(s) (%X)", + ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X", AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status)); return_ACPI_STATUS (Status); @@ -1607,7 +1607,7 @@ AcpiDsExecEndControlOp ( default: - ACPI_ERROR ((AE_INFO, "Unknown control opcode=%X Op=%p", + ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p", Op->Common.AmlOpcode, Op)); Status = AE_AML_BAD_OPCODE; diff --git a/sys/contrib/dev/acpica/dispatcher/dswexec.c b/sys/contrib/dev/acpica/dispatcher/dswexec.c index cad6f5101f90..61a7e1c0d23b 100644 --- a/sys/contrib/dev/acpica/dispatcher/dswexec.c +++ b/sys/contrib/dev/acpica/dispatcher/dswexec.c @@ -227,7 +227,7 @@ AcpiDsGetPredicateValue ( if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, - "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X", + "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X", ObjDesc, WalkState, ObjDesc->Common.Type)); Status = AE_AML_OPERAND_TYPE; @@ -463,7 +463,7 @@ AcpiDsExecEndOp ( if (OpClass == AML_CLASS_UNKNOWN) { - ACPI_ERROR ((AE_INFO, "Unknown opcode %X", Op->Common.AmlOpcode)); + ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode)); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } @@ -783,7 +783,7 @@ AcpiDsExecEndOp ( default: ACPI_ERROR ((AE_INFO, - "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p", + "Unimplemented opcode, class=0x%X type=0x%X Opcode=-0x%X Op=%p", OpClass, OpType, Op->Common.AmlOpcode, Op)); Status = AE_NOT_IMPLEMENTED; diff --git a/sys/contrib/dev/acpica/dispatcher/dswstate.c b/sys/contrib/dev/acpica/dispatcher/dswstate.c index 19bb45b3f392..622aef286f69 100644 --- a/sys/contrib/dev/acpica/dispatcher/dswstate.c +++ b/sys/contrib/dev/acpica/dispatcher/dswstate.c @@ -277,7 +277,7 @@ AcpiDsResultPush ( if (!Object) { ACPI_ERROR ((AE_INFO, - "Null Object! Obj=%p State=%p Num=%X", + "Null Object! Obj=%p State=%p Num=%u", Object, WalkState, WalkState->ResultCount)); return (AE_BAD_PARAMETER); } @@ -323,7 +323,7 @@ AcpiDsResultStackPush ( if (((UINT32) WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) > ACPI_RESULTS_OBJ_NUM_MAX) { - ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X", + ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%u", WalkState, WalkState->ResultSize)); return (AE_STACK_OVERFLOW); } @@ -426,7 +426,7 @@ AcpiDsObjStackPush ( if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS) { ACPI_ERROR ((AE_INFO, - "Object stack overflow! Obj=%p State=%p #Ops=%X", + "Object stack overflow! Obj=%p State=%p #Ops=%u", Object, WalkState, WalkState->NumOperands)); return (AE_STACK_OVERFLOW); } @@ -480,7 +480,7 @@ AcpiDsObjStackPop ( if (WalkState->NumOperands == 0) { ACPI_ERROR ((AE_INFO, - "Object stack underflow! Count=%X State=%p #Ops=%X", + "Object stack underflow! Count=%X State=%p #Ops=%u", PopCount, WalkState, WalkState->NumOperands)); return (AE_STACK_UNDERFLOW); } @@ -491,7 +491,7 @@ AcpiDsObjStackPop ( WalkState->Operands [WalkState->NumOperands] = NULL; } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%u\n", PopCount, WalkState, WalkState->NumOperands)); return (AE_OK); diff --git a/sys/contrib/dev/acpica/events/evevent.c b/sys/contrib/dev/acpica/events/evevent.c index 2c41639433cf..d743051fcb16 100644 --- a/sys/contrib/dev/acpica/events/evevent.c +++ b/sys/contrib/dev/acpica/events/evevent.c @@ -415,7 +415,7 @@ AcpiEvFixedEventDispatch ( ACPI_DISABLE_EVENT); ACPI_ERROR ((AE_INFO, - "No installed handler for fixed event [%08X]", + "No installed handler for fixed event [0x%08X]", Event)); return (ACPI_INTERRUPT_NOT_HANDLED); diff --git a/sys/contrib/dev/acpica/events/evgpe.c b/sys/contrib/dev/acpica/events/evgpe.c index 48355689fdc1..0ece12ca78c4 100644 --- a/sys/contrib/dev/acpica/events/evgpe.c +++ b/sys/contrib/dev/acpica/events/evgpe.c @@ -132,73 +132,22 @@ AcpiEvAsynchEnableGpe ( void *Context); -/******************************************************************************* - * - * FUNCTION: AcpiEvSetGpeType - * - * PARAMETERS: GpeEventInfo - GPE to set - * Type - New type - * - * RETURN: Status - * - * DESCRIPTION: Sets the new type for the GPE (wake, run, or wake/run) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvSetGpeType ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT8 Type) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvSetGpeType); - - - /* Validate type and update register enable masks */ - - switch (Type) - { - case ACPI_GPE_TYPE_WAKE: - case ACPI_GPE_TYPE_RUNTIME: - case ACPI_GPE_TYPE_WAKE_RUN: - break; - - default: - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Disable the GPE if currently enabled */ - - Status = AcpiEvDisableGpe (GpeEventInfo); - - /* Clear the type bits and insert the new Type */ - - GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK; - GpeEventInfo->Flags |= Type; - return_ACPI_STATUS (Status); -} - - /******************************************************************************* * * FUNCTION: AcpiEvUpdateGpeEnableMasks * * PARAMETERS: GpeEventInfo - GPE to update - * Type - What to do: ACPI_GPE_DISABLE or - * ACPI_GPE_ENABLE * * RETURN: Status * - * DESCRIPTION: Updates GPE register enable masks based on the GPE type + * DESCRIPTION: Updates GPE register enable masks based upon whether there are + * references (either wake or run) to this GPE * ******************************************************************************/ ACPI_STATUS AcpiEvUpdateGpeEnableMasks ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT8 Type) + ACPI_GPE_EVENT_INFO *GpeEventInfo) { ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; UINT8 RegisterBit; @@ -216,36 +165,21 @@ AcpiEvUpdateGpeEnableMasks ( RegisterBit = (UINT8) (1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)); - /* 1) Disable case. Simply clear all enable bits */ + /* Clear the wake/run bits up front */ - if (Type == ACPI_GPE_DISABLE) + ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); + ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); + + /* Set the mask bits only if there are references to this GPE */ + + if (GpeEventInfo->RuntimeCount) { - ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); - ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); - return_ACPI_STATUS (AE_OK); + ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); } - /* 2) Enable case. Set/Clear the appropriate enable bits */ - - switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) + if (GpeEventInfo->WakeupCount) { - case ACPI_GPE_TYPE_WAKE: - ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); - ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); - break; - - case ACPI_GPE_TYPE_RUNTIME: - ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); - ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); - break; - - case ACPI_GPE_TYPE_WAKE_RUN: - ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); - ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit); - break; - - default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit); } return_ACPI_STATUS (AE_OK); @@ -257,19 +191,19 @@ AcpiEvUpdateGpeEnableMasks ( * FUNCTION: AcpiEvEnableGpe * * PARAMETERS: GpeEventInfo - GPE to enable - * WriteToHardware - Enable now, or just mark data structs - * (WAKE GPEs should be deferred) * * RETURN: Status * - * DESCRIPTION: Enable a GPE based on the GPE type + * DESCRIPTION: Hardware-enable a GPE. Always enables the GPE, regardless + * of type or number of references. + * + * Note: The GPE lock should be already acquired when this function is called. * ******************************************************************************/ ACPI_STATUS AcpiEvEnableGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - BOOLEAN WriteToHardware) + ACPI_GPE_EVENT_INFO *GpeEventInfo) { ACPI_STATUS Status; @@ -277,54 +211,37 @@ AcpiEvEnableGpe ( ACPI_FUNCTION_TRACE (EvEnableGpe); - /* Make sure HW enable masks are updated */ + /* + * 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. + */ + if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)) + { + return_ACPI_STATUS (AE_NO_HANDLER); + } - Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_ENABLE); + /* Ensure the HW enable masks are current */ + + Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* Mark wake-enabled or HW enable, or both */ + /* Clear the GPE (of stale events) */ - switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) + Status = AcpiHwClearGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) { - case ACPI_GPE_TYPE_WAKE: - - ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); - break; - - case ACPI_GPE_TYPE_WAKE_RUN: - - ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); - - /*lint -fallthrough */ - - case ACPI_GPE_TYPE_RUNTIME: - - ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED); - - if (WriteToHardware) - { - /* Clear the GPE (of stale events), then enable it */ - - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Enable the requested runtime GPE */ - - Status = AcpiHwWriteGpeEnableReg (GpeEventInfo); - } - break; - - default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS (Status); } - return_ACPI_STATUS (AE_OK); + /* Enable the requested GPE */ + + Status = AcpiHwWriteGpeEnableReg (GpeEventInfo); + return_ACPI_STATUS (Status); } @@ -336,7 +253,10 @@ AcpiEvEnableGpe ( * * RETURN: Status * - * DESCRIPTION: Disable a GPE based on the GPE type + * DESCRIPTION: Hardware-disable a GPE. Always disables the requested GPE, + * regardless of the type or number of references. + * + * Note: The GPE lock should be already acquired when this function is called. * ******************************************************************************/ @@ -356,40 +276,14 @@ AcpiEvDisableGpe ( * the GPE behind our back. */ - /* Make sure HW enable masks are updated */ + /* Ensure the HW enable masks are current */ - Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE); + Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* Clear the appropriate enabled flags for this GPE */ - - switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) - { - case ACPI_GPE_TYPE_WAKE: - - ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); - break; - - case ACPI_GPE_TYPE_WAKE_RUN: - - ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); - - /*lint -fallthrough */ - - case ACPI_GPE_TYPE_RUNTIME: - - /* Disable the requested runtime GPE */ - - ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED); - break; - - default: - break; - } - /* * Always H/W disable this GPE, even if we don't know the GPE type. * Simply clear the enable bit for this particular GPE, but do not @@ -403,6 +297,49 @@ AcpiEvDisableGpe ( } +/******************************************************************************* + * + * FUNCTION: AcpiEvLowGetGpeInfo + * + * PARAMETERS: GpeNumber - Raw GPE number + * GpeBlock - A GPE info block + * + * RETURN: A GPE EventInfo struct. NULL if not a valid GPE (The GpeNumber + * is not within the specified GPE block) + * + * DESCRIPTION: Returns the EventInfo struct associated with this GPE. This is + * the low-level implementation of EvGetGpeEventInfo. + * + ******************************************************************************/ + +ACPI_GPE_EVENT_INFO * +AcpiEvLowGetGpeInfo ( + UINT32 GpeNumber, + ACPI_GPE_BLOCK_INFO *GpeBlock) +{ + UINT32 GpeIndex; + + + /* + * Validate that the GpeNumber is within the specified GpeBlock. + * (Two steps) + */ + if (!GpeBlock || + (GpeNumber < GpeBlock->BlockBaseNumber)) + { + return (NULL); + } + + GpeIndex = GpeNumber - GpeBlock->BlockBaseNumber; + if (GpeIndex >= GpeBlock->GpeCount) + { + return (NULL); + } + + return (&GpeBlock->EventInfo[GpeIndex]); +} + + /******************************************************************************* * * FUNCTION: AcpiEvGetGpeEventInfo @@ -426,7 +363,7 @@ AcpiEvGetGpeEventInfo ( UINT32 GpeNumber) { ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_GPE_BLOCK_INFO *GpeBlock; + ACPI_GPE_EVENT_INFO *GpeInfo; UINT32 i; @@ -441,16 +378,11 @@ AcpiEvGetGpeEventInfo ( for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { - GpeBlock = AcpiGbl_GpeFadtBlocks[i]; - if (GpeBlock) + GpeInfo = AcpiEvLowGetGpeInfo (GpeNumber, + AcpiGbl_GpeFadtBlocks[i]); + if (GpeInfo) { - if ((GpeNumber >= GpeBlock->BlockBaseNumber) && - (GpeNumber < GpeBlock->BlockBaseNumber + - (GpeBlock->RegisterCount * 8))) - { - return (&GpeBlock->EventInfo[GpeNumber - - GpeBlock->BlockBaseNumber]); - } + return (GpeInfo); } } @@ -468,15 +400,7 @@ AcpiEvGetGpeEventInfo ( return (NULL); } - GpeBlock = ObjDesc->Device.GpeBlock; - - if ((GpeNumber >= GpeBlock->BlockBaseNumber) && - (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))) - { - return (&GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]); - } - - return (NULL); + return (AcpiEvLowGetGpeInfo (GpeNumber, ObjDesc->Device.GpeBlock)); } @@ -654,9 +578,9 @@ AcpiEvAsynchExecuteGpeMethod ( return_VOID; } - /* Set the GPE flags for return to enabled state */ + /* Update the GPE register masks for return to enabled state */ - (void) AcpiEvEnableGpe (GpeEventInfo, FALSE); + (void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo); /* * Take a snapshot of the GPE info for this level - we copy the info to @@ -803,7 +727,7 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE[%2X]", GpeNumber)); + "Unable to clear GPE[0x%2X]", GpeNumber)); return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } } @@ -836,7 +760,7 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE[%2X]", GpeNumber)); + "Unable to clear GPE[0x%2X]", GpeNumber)); return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } } @@ -852,7 +776,7 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to disable GPE[%2X]", GpeNumber)); + "Unable to disable GPE[0x%2X]", GpeNumber)); return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } @@ -865,28 +789,31 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to queue handler for GPE[%2X] - event disabled", + "Unable to queue handler for GPE[0x%2X] - event disabled", GpeNumber)); } break; default: - /* No handler or method to run! */ - + /* + * No handler or method to run! + * 03/2010: This case should no longer be possible. We will not allow + * a GPE to be enabled if it has no handler or method. + */ ACPI_ERROR ((AE_INFO, - "No handler or method for GPE[%2X], disabling event", + "No handler or method for GPE[0x%2X], disabling event", GpeNumber)); /* - * Disable the GPE. The GPE will remain disabled until the ACPICA - * Core Subsystem is restarted, or a handler is installed. + * Disable the GPE. The GPE will remain disabled a handler + * is installed or ACPICA is restarted. */ Status = AcpiEvDisableGpe (GpeEventInfo); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to disable GPE[%2X]", GpeNumber)); + "Unable to disable GPE[0x%2X]", GpeNumber)); return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } break; diff --git a/sys/contrib/dev/acpica/events/evgpeblk.c b/sys/contrib/dev/acpica/events/evgpeblk.c index fe55162cae17..29b0e711e5f5 100644 --- a/sys/contrib/dev/acpica/events/evgpeblk.c +++ b/sys/contrib/dev/acpica/events/evgpeblk.c @@ -124,7 +124,7 @@ /* Local prototypes */ static ACPI_STATUS -AcpiEvSaveMethodInfo ( +AcpiEvMatchGpeMethod ( ACPI_HANDLE ObjHandle, UINT32 Level, void *ObjDesc, @@ -194,8 +194,7 @@ AcpiEvValidGpeEvent ( while (GpeBlock) { if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) && - (&GpeBlock->EventInfo[((ACPI_SIZE) - GpeBlock->RegisterCount) * 8] > GpeEventInfo)) + (&GpeBlock->EventInfo[GpeBlock->GpeCount] > GpeEventInfo)) { return (TRUE); } @@ -328,7 +327,7 @@ AcpiEvDeleteGpeHandlers ( /******************************************************************************* * - * FUNCTION: AcpiEvSaveMethodInfo + * FUNCTION: AcpiEvMatchGpeMethod * * PARAMETERS: Callback from WalkNamespace * @@ -340,8 +339,7 @@ AcpiEvDeleteGpeHandlers ( * information for quick lookup during GPE dispatch * * The name of each GPE control method is of the form: - * "_Lxx" or "_Exx" - * Where: + * "_Lxx" or "_Exx", where: * L - means that the GPE is level triggered * E - means that the GPE is edge triggered * xx - is the GPE number [in HEX] @@ -349,38 +347,44 @@ AcpiEvDeleteGpeHandlers ( ******************************************************************************/ static ACPI_STATUS -AcpiEvSaveMethodInfo ( +AcpiEvMatchGpeMethod ( ACPI_HANDLE ObjHandle, UINT32 Level, void *ObjDesc, void **ReturnValue) { + ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); ACPI_GPE_BLOCK_INFO *GpeBlock = (void *) ObjDesc; ACPI_GPE_EVENT_INFO *GpeEventInfo; UINT32 GpeNumber; char Name[ACPI_NAME_SIZE + 1]; UINT8 Type; - ACPI_STATUS Status; - ACPI_FUNCTION_TRACE (EvSaveMethodInfo); + ACPI_FUNCTION_TRACE (EvMatchGpeMethod); /* - * _Lxx and _Exx GPE method support + * Match and decode the _Lxx and _Exx GPE method names * - * 1) Extract the name from the object and convert to a string + * 1) Extract the method name and null terminate it */ - ACPI_MOVE_32_TO_32 ( - Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer); + ACPI_MOVE_32_TO_32 (Name, &MethodNode->Name.Integer); Name[ACPI_NAME_SIZE] = 0; + /* 2) Name must begin with an underscore */ + + if (Name[0] != '_') + { + return_ACPI_STATUS (AE_OK); /* Ignore this method */ + } + /* - * 2) Edge/Level determination is based on the 2nd character + * 3) Edge/Level determination is based on the 2nd character * of the method name * - * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE - * if a _PRW object is found that points to this GPE. + * NOTE: Default GPE type is RUNTIME only. Later, if a _PRW object is + * found that points to this GPE, the ACPI_GPE_CAN_WAKE flag is set. */ switch (Name[1]) { @@ -393,16 +397,15 @@ AcpiEvSaveMethodInfo ( break; default: - /* Unknown method type, just ignore it! */ + /* Unknown method type, just ignore it */ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Ignoring unknown GPE method type: %s " - "(name not of form _Lxx or _Exx)", - Name)); + "(name not of form _Lxx or _Exx)", Name)); return_ACPI_STATUS (AE_OK); } - /* Convert the last two characters of the name to the GPE Number */ + /* 4) The last two characters of the name are the hex GPE Number */ GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16); if (GpeNumber == ACPI_UINT32_MAX) @@ -411,45 +414,34 @@ AcpiEvSaveMethodInfo ( ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Could not extract GPE number from name: %s " - "(name is not of form _Lxx or _Exx)", - Name)); + "(name is not of form _Lxx or _Exx)", Name)); return_ACPI_STATUS (AE_OK); } /* Ensure that we have a valid GPE number for this GPE block */ - if ((GpeNumber < GpeBlock->BlockBaseNumber) || - (GpeNumber >= (GpeBlock->BlockBaseNumber + - (GpeBlock->RegisterCount * 8)))) + GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, GpeBlock); + if (!GpeEventInfo) { /* - * Not valid for this GPE block, just ignore it. However, it may be - * valid for a different GPE block, since GPE0 and GPE1 methods both - * appear under \_GPE. + * This GpeNumber is not valid for this GPE block, just ignore it. + * However, it may be valid for a different GPE block, since GPE0 + * and GPE1 methods both appear under \_GPE. */ return_ACPI_STATUS (AE_OK); } /* - * Now we can add this information to the GpeEventInfo block for use - * during dispatch of this GPE. Default type is RUNTIME, although this may - * change when the _PRW methods are executed later. + * Add the GPE information from above to the GpeEventInfo block for + * use during dispatch of this GPE. */ - GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]; - - GpeEventInfo->Flags = (UINT8) - (Type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME); - - GpeEventInfo->Dispatch.MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle; - - /* Update enable mask, but don't enable the HW GPE as of yet */ - - Status = AcpiEvEnableGpe (GpeEventInfo, FALSE); + GpeEventInfo->Flags = (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD); + GpeEventInfo->Dispatch.MethodNode = MethodNode; ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Registered GPE method %s as GPE number 0x%.2X\n", Name, GpeNumber)); - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_OK); } @@ -464,7 +456,7 @@ AcpiEvSaveMethodInfo ( * * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a * Device. Run the _PRW method. If present, extract the GPE - * number and mark the GPE as a WAKE GPE. + * number and mark the GPE as a CAN_WAKE GPE. * ******************************************************************************/ @@ -495,7 +487,7 @@ AcpiEvMatchPrwAndGpe ( ACPI_BTYPE_PACKAGE, &PkgDesc); if (ACPI_FAILURE (Status)) { - /* Ignore all errors from _PRW, we don't want to abort the subsystem */ + /* Ignore all errors from _PRW, we don't want to abort the walk */ return_ACPI_STATUS (AE_OK); } @@ -561,25 +553,17 @@ AcpiEvMatchPrwAndGpe ( * 2) The GPE index(number) is within the range of the Gpe Block * associated with the GPE device. */ - if ((GpeDevice == TargetGpeDevice) && - (GpeNumber >= GpeBlock->BlockBaseNumber) && - (GpeNumber < GpeBlock->BlockBaseNumber + - (GpeBlock->RegisterCount * 8))) + if (GpeDevice != TargetGpeDevice) { - GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - - GpeBlock->BlockBaseNumber]; + goto Cleanup; + } - /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */ + GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, GpeBlock); + if (GpeEventInfo) + { + /* This GPE can wake the system */ - GpeEventInfo->Flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); - - Status = AcpiEvSetGpeType (GpeEventInfo, ACPI_GPE_TYPE_WAKE); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE); + GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; } Cleanup: @@ -880,7 +864,7 @@ AcpiEvDeleteGpeBlock ( AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); } - AcpiCurrentGpeCount -= GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH; + AcpiCurrentGpeCount -= GpeBlock->GpeCount; /* Free the GpeBlock */ @@ -925,8 +909,8 @@ AcpiEvCreateGpeInfoBlocks ( /* Allocate the GPE register information block */ GpeRegisterInfo = ACPI_ALLOCATE_ZEROED ( - (ACPI_SIZE) GpeBlock->RegisterCount * - sizeof (ACPI_GPE_REGISTER_INFO)); + (ACPI_SIZE) GpeBlock->RegisterCount * + sizeof (ACPI_GPE_REGISTER_INFO)); if (!GpeRegisterInfo) { ACPI_ERROR ((AE_INFO, @@ -938,10 +922,8 @@ AcpiEvCreateGpeInfoBlocks ( * Allocate the GPE EventInfo block. There are eight distinct GPEs * per register. Initialization to zeros is sufficient. */ - GpeEventInfo = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) GpeBlock->RegisterCount * - ACPI_GPE_REGISTER_WIDTH) * - sizeof (ACPI_GPE_EVENT_INFO)); + GpeEventInfo = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) GpeBlock->GpeCount * + sizeof (ACPI_GPE_EVENT_INFO)); if (!GpeEventInfo) { ACPI_ERROR ((AE_INFO, @@ -1080,6 +1062,7 @@ AcpiEvCreateGpeBlock ( /* Initialize the new GPE block */ GpeBlock->Node = GpeDevice; + GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH); GpeBlock->RegisterCount = RegisterCount; GpeBlock->BlockBaseNumber = GpeBlockBaseNumber; @@ -1110,7 +1093,7 @@ AcpiEvCreateGpeBlock ( Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiEvSaveMethodInfo, NULL, GpeBlock, NULL); + AcpiEvMatchGpeMethod, NULL, GpeBlock, NULL); /* Return the new block */ @@ -1122,15 +1105,13 @@ AcpiEvCreateGpeBlock ( ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", (UINT32) GpeBlock->BlockBaseNumber, - (UINT32) (GpeBlock->BlockBaseNumber + - ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)), - GpeDevice->Name.Ascii, - GpeBlock->RegisterCount, + (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)), + GpeDevice->Name.Ascii, GpeBlock->RegisterCount, InterruptNumber)); /* Update global count of currently available GPEs */ - AcpiCurrentGpeCount += RegisterCount * ACPI_GPE_REGISTER_WIDTH; + AcpiCurrentGpeCount += GpeBlock->GpeCount; return_ACPI_STATUS (AE_OK); } @@ -1161,6 +1142,8 @@ AcpiEvInitializeGpeBlock ( ACPI_GPE_WALK_INFO GpeInfo; UINT32 WakeGpeCount; UINT32 GpeEnabledCount; + UINT32 GpeIndex; + UINT32 GpeNumber; UINT32 i; UINT32 j; @@ -1193,39 +1176,65 @@ AcpiEvInitializeGpeBlock ( Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvMatchPrwAndGpe, NULL, &GpeInfo, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While executing _PRW methods")); + } } /* - * Enable all GPEs in this block that have these attributes: - * 1) are "runtime" or "run/wake" GPEs, and - * 2) have a corresponding _Lxx or _Exx method - * - * Any other GPEs within this block must be enabled via the - * AcpiEnableGpe() external interface. + * Enable all GPEs that have a corresponding method and are not + * capable of generating wakeups. Any other GPEs within this block + * must be enabled via the AcpiEnableGpe interface. */ WakeGpeCount = 0; GpeEnabledCount = 0; + if (GpeDevice == AcpiGbl_FadtGpeDevice) + { + GpeDevice = NULL; + } + for (i = 0; i < GpeBlock->RegisterCount; i++) { - for (j = 0; j < 8; j++) + for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { /* Get the info block for this particular GPE */ - GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * - ACPI_GPE_REGISTER_WIDTH) + j]; + GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; + GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; - if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_METHOD) && - (GpeEventInfo->Flags & ACPI_GPE_TYPE_RUNTIME)) - { - GpeEnabledCount++; - } + /* Ignore GPEs that can wake the system */ - if (GpeEventInfo->Flags & ACPI_GPE_TYPE_WAKE) + if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) { WakeGpeCount++; + if (AcpiGbl_LeaveWakeGpesDisabled) + { + continue; + } } + + /* Ignore GPEs that have no corresponding _Lxx/_Exx method */ + + if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_METHOD)) + { + continue; + } + + /* Enable this GPE */ + + GpeNumber = GpeIndex + GpeBlock->BlockBaseNumber; + Status = AcpiEnableGpe (GpeDevice, GpeNumber, + ACPI_GPE_TYPE_RUNTIME); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not enable GPE 0x%02X", GpeNumber)); + continue; + } + + GpeEnabledCount++; } } @@ -1233,16 +1242,7 @@ AcpiEvInitializeGpeBlock ( "Found %u Wake, Enabled %u Runtime GPEs in this block\n", WakeGpeCount, GpeEnabledCount)); - /* Enable all valid runtime GPEs found above */ - - Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not enable GPEs in GpeBlock %p", - GpeBlock)); - } - - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_OK); } @@ -1337,8 +1337,8 @@ AcpiEvGpeInitialize ( (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base)) { ACPI_ERROR ((AE_INFO, - "GPE0 block (GPE 0 to %d) overlaps the GPE1 block " - "(GPE %d to %d) - Ignoring GPE1", + "GPE0 block (GPE 0 to %u) overlaps the GPE1 block " + "(GPE %u to %u) - Ignoring GPE1", GpeNumberMax, AcpiGbl_FADT.Gpe1Base, AcpiGbl_FADT.Gpe1Base + ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1))); diff --git a/sys/contrib/dev/acpica/events/evmisc.c b/sys/contrib/dev/acpica/events/evmisc.c index 1ee7f9d4a786..eff26cbb6eb9 100644 --- a/sys/contrib/dev/acpica/events/evmisc.c +++ b/sys/contrib/dev/acpica/events/evmisc.c @@ -696,7 +696,7 @@ AcpiEvTerminate ( if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, - "Could not disable fixed event %d", (UINT32) i)); + "Could not disable fixed event %u", (UINT32) i)); } } diff --git a/sys/contrib/dev/acpica/events/evxface.c b/sys/contrib/dev/acpica/events/evxface.c index abffad6536e5..3067fa8748d2 100644 --- a/sys/contrib/dev/acpica/events/evxface.c +++ b/sys/contrib/dev/acpica/events/evxface.c @@ -232,7 +232,7 @@ AcpiInstallFixedEventHandler ( Status = AcpiEnableEvent (Event, 0); if (ACPI_FAILURE (Status)) { - ACPI_WARNING ((AE_INFO, "Could not enable fixed event %X", Event)); + ACPI_WARNING ((AE_INFO, "Could not enable fixed event 0x%X", Event)); /* Remove the handler */ @@ -303,7 +303,7 @@ AcpiRemoveFixedEventHandler ( if (ACPI_FAILURE (Status)) { ACPI_WARNING ((AE_INFO, - "Could not write to fixed event enable register %X", Event)); + "Could not write to fixed event enable register 0x%X", Event)); } else { @@ -705,7 +705,7 @@ AcpiInstallGpeHandler ( /* Parameter validation */ - if ((!Address) || (Type > ACPI_GPE_XRUPT_TYPE_MASK)) + if ((!Address) || (Type & ~ACPI_GPE_XRUPT_TYPE_MASK)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } diff --git a/sys/contrib/dev/acpica/events/evxfevnt.c b/sys/contrib/dev/acpica/events/evxfevnt.c index 92b6d4d69db7..333e0e586914 100644 --- a/sys/contrib/dev/acpica/events/evxfevnt.c +++ b/sys/contrib/dev/acpica/events/evxfevnt.c @@ -305,70 +305,20 @@ AcpiEnableEvent ( ACPI_EXPORT_SYMBOL (AcpiEnableEvent) -/******************************************************************************* - * - * FUNCTION: AcpiSetGpeType - * - * PARAMETERS: GpeDevice - Parent GPE Device - * GpeNumber - GPE level within the GPE block - * Type - New GPE type - * - * RETURN: Status - * - * DESCRIPTION: Set the type of an individual GPE - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetGpeType ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Type) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - - - ACPI_FUNCTION_TRACE (AcpiSetGpeType); - - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - if ((GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) == Type) - { - return_ACPI_STATUS (AE_OK); - } - - /* Set the new type (will disable GPE if currently enabled) */ - - Status = AcpiEvSetGpeType (GpeEventInfo, Type); - -UnlockAndExit: - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiSetGpeType) - - /******************************************************************************* * * FUNCTION: AcpiEnableGpe * - * PARAMETERS: GpeDevice - Parent GPE Device + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 * GpeNumber - GPE level within the GPE block - * Flags - Just enable, or also wake enable? - * Called from ISR or not + * GpeType - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE + * or both * * RETURN: Status * - * DESCRIPTION: Enable an ACPI event (general purpose) + * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is + * hardware-enabled (for runtime GPEs), or the GPE register mask + * is updated (for wake GPEs). * ******************************************************************************/ @@ -376,26 +326,25 @@ ACPI_STATUS AcpiEnableGpe ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - UINT32 Flags) + UINT8 GpeType) { ACPI_STATUS Status = AE_OK; ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; ACPI_FUNCTION_TRACE (AcpiEnableGpe); - /* Use semaphore lock if not executing at interrupt level */ + /* Parameter validation */ - if (Flags & ACPI_NOT_ISR) + if (!GpeType || (GpeType & ~ACPI_GPE_TYPE_WAKE_RUN)) { - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + return_ACPI_STATUS (AE_BAD_PARAMETER); } + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + /* Ensure that we have a valid GPE number */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); @@ -405,15 +354,55 @@ AcpiEnableGpe ( goto UnlockAndExit; } - /* Perform the enable */ + if (GpeType & ACPI_GPE_TYPE_RUNTIME) + { + if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX) + { + Status = AE_LIMIT; /* Too many references */ + goto UnlockAndExit; + } - Status = AcpiEvEnableGpe (GpeEventInfo, TRUE); + GpeEventInfo->RuntimeCount++; + if (GpeEventInfo->RuntimeCount == 1) + { + Status = AcpiEvEnableGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + GpeEventInfo->RuntimeCount--; + goto UnlockAndExit; + } + } + } + + if (GpeType & ACPI_GPE_TYPE_WAKE) + { + /* The GPE must have the ability to wake the system */ + + if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) + { + Status = AE_TYPE; + goto UnlockAndExit; + } + + if (GpeEventInfo->WakeupCount == ACPI_UINT8_MAX) + { + Status = AE_LIMIT; /* Too many references */ + goto UnlockAndExit; + } + + /* + * Update the enable mask on the first wakeup reference. Wake GPEs + * are only hardware-enabled just before sleeping. + */ + GpeEventInfo->WakeupCount++; + if (GpeEventInfo->WakeupCount == 1) + { + (void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo); + } + } UnlockAndExit: - if (Flags & ACPI_NOT_ISR) - { - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - } + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); return_ACPI_STATUS (Status); } @@ -424,14 +413,16 @@ ACPI_EXPORT_SYMBOL (AcpiEnableGpe) * * FUNCTION: AcpiDisableGpe * - * PARAMETERS: GpeDevice - Parent GPE Device + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 * GpeNumber - GPE level within the GPE block - * Flags - Just disable, or also wake disable? - * Called from ISR or not + * GpeType - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE + * or both * * RETURN: Status * - * DESCRIPTION: Disable an ACPI event (general purpose) + * DESCRIPTION: Remove a reference to a GPE. When the last reference is + * removed, only then is the GPE disabled (for runtime GPEs), or + * the GPE mask bit disabled (for wake GPEs) * ******************************************************************************/ @@ -439,26 +430,25 @@ ACPI_STATUS AcpiDisableGpe ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - UINT32 Flags) + UINT8 GpeType) { ACPI_STATUS Status = AE_OK; ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; ACPI_FUNCTION_TRACE (AcpiDisableGpe); - /* Use semaphore lock if not executing at interrupt level */ + /* Parameter validation */ - if (Flags & ACPI_NOT_ISR) + if (!GpeType || (GpeType & ~ACPI_GPE_TYPE_WAKE_RUN)) { - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + return_ACPI_STATUS (AE_BAD_PARAMETER); } + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + /* Ensure that we have a valid GPE number */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); @@ -468,19 +458,127 @@ AcpiDisableGpe ( goto UnlockAndExit; } - Status = AcpiEvDisableGpe (GpeEventInfo); + /* Hardware-disable a runtime GPE on removal of the last reference */ + + if (GpeType & ACPI_GPE_TYPE_RUNTIME) + { + if (!GpeEventInfo->RuntimeCount) + { + Status = AE_LIMIT; /* There are no references to remove */ + goto UnlockAndExit; + } + + GpeEventInfo->RuntimeCount--; + if (!GpeEventInfo->RuntimeCount) + { + Status = AcpiEvDisableGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + GpeEventInfo->RuntimeCount++; + goto UnlockAndExit; + } + } + } + + /* + * Update masks for wake GPE on removal of the last reference. + * No need to hardware-disable wake GPEs here, they are not currently + * enabled. + */ + if (GpeType & ACPI_GPE_TYPE_WAKE) + { + if (!GpeEventInfo->WakeupCount) + { + Status = AE_LIMIT; /* There are no references to remove */ + goto UnlockAndExit; + } + + GpeEventInfo->WakeupCount--; + if (!GpeEventInfo->WakeupCount) + { + (void) AcpiEvUpdateGpeEnableMasks (GpeEventInfo); + } + } + UnlockAndExit: - if (Flags & ACPI_NOT_ISR) - { - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - } + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); return_ACPI_STATUS (Status); } ACPI_EXPORT_SYMBOL (AcpiDisableGpe) +/******************************************************************************* + * + * FUNCTION: AcpiSetGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE + * + * RETURN: Status + * + * DESCRIPTION: Enable or disable an individual GPE. This function bypasses + * the reference count mechanism used in the AcpiEnableGpe and + * AcpiDisableGpe interfaces -- and should be used with care. + * + * Note: Typically used to disable a runtime GPE for short period of time, + * then re-enable it, without disturbing the existing reference counts. This + * is useful, for example, in the Embedded Controller (EC) driver. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiSetGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT8 Action) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiSetGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* Perform the action */ + + switch (Action) + { + case ACPI_GPE_ENABLE: + Status = AcpiEvEnableGpe (GpeEventInfo); + break; + + case ACPI_GPE_DISABLE: + Status = AcpiEvDisableGpe (GpeEventInfo); + break; + + default: + Status = AE_BAD_PARAMETER; + break; + } + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiSetGpe) + + /******************************************************************************* * * FUNCTION: AcpiDisableEvent @@ -592,9 +690,8 @@ ACPI_EXPORT_SYMBOL (AcpiClearEvent) * * FUNCTION: AcpiClearGpe * - * PARAMETERS: GpeDevice - Parent GPE Device + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 * GpeNumber - GPE level within the GPE block - * Flags - Called from an ISR or not * * RETURN: Status * @@ -605,26 +702,17 @@ ACPI_EXPORT_SYMBOL (AcpiClearEvent) ACPI_STATUS AcpiClearGpe ( ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Flags) + UINT32 GpeNumber) { ACPI_STATUS Status = AE_OK; ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; ACPI_FUNCTION_TRACE (AcpiClearGpe); - /* Use semaphore lock if not executing at interrupt level */ - - if (Flags & ACPI_NOT_ISR) - { - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); /* Ensure that we have a valid GPE number */ @@ -638,10 +726,7 @@ AcpiClearGpe ( Status = AcpiHwClearGpe (GpeEventInfo); UnlockAndExit: - if (Flags & ACPI_NOT_ISR) - { - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - } + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); return_ACPI_STATUS (Status); } @@ -700,9 +785,8 @@ ACPI_EXPORT_SYMBOL (AcpiGetEventStatus) * * FUNCTION: AcpiGetGpeStatus * - * PARAMETERS: GpeDevice - Parent GPE Device + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 * GpeNumber - GPE level within the GPE block - * Flags - Called from an ISR or not * EventStatus - Where the current status of the event will * be returned * @@ -716,26 +800,17 @@ ACPI_STATUS AcpiGetGpeStatus ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - UINT32 Flags, ACPI_EVENT_STATUS *EventStatus) { ACPI_STATUS Status = AE_OK; ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; ACPI_FUNCTION_TRACE (AcpiGetGpeStatus); - /* Use semaphore lock if not executing at interrupt level */ - - if (Flags & ACPI_NOT_ISR) - { - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); /* Ensure that we have a valid GPE number */ @@ -751,10 +826,7 @@ AcpiGetGpeStatus ( Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus); UnlockAndExit: - if (Flags & ACPI_NOT_ISR) - { - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - } + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); return_ACPI_STATUS (Status); } @@ -823,21 +895,15 @@ AcpiInstallGpeBlock ( goto UnlockAndExit; } - /* Run the _PRW methods and enable the GPEs */ - - Status = AcpiEvInitializeGpeBlock (Node, GpeBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Get the DeviceObject attached to the node */ + /* Install block in the DeviceObject attached to the node */ ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { - /* No object, create a new one */ - + /* + * No object, create a new one (Device nodes do not always have + * an attached object) + */ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE); if (!ObjDesc) { @@ -850,17 +916,20 @@ AcpiInstallGpeBlock ( /* Remove local reference to the object */ AcpiUtRemoveReference (ObjDesc); - if (ACPI_FAILURE (Status)) { goto UnlockAndExit; } } - /* Install the GPE block in the DeviceObject */ + /* Now install the GPE block in the DeviceObject */ ObjDesc->Device.GpeBlock = GpeBlock; + /* Run the _PRW methods and enable the runtime GPEs in the new block */ + + Status = AcpiEvInitializeGpeBlock (Node, GpeBlock); + UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -1018,8 +1087,7 @@ AcpiEvGetGpeDevice ( /* Increment Index by the number of GPEs in this block */ - Info->NextBlockBaseIndex += - (GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH); + Info->NextBlockBaseIndex += GpeBlock->GpeCount; if (Info->Index < Info->NextBlockBaseIndex) { diff --git a/sys/contrib/dev/acpica/executer/exconvrt.c b/sys/contrib/dev/acpica/executer/exconvrt.c index a67122c12d4e..c8e66a68ba05 100644 --- a/sys/contrib/dev/acpica/executer/exconvrt.c +++ b/sys/contrib/dev/acpica/executer/exconvrt.c @@ -786,7 +786,7 @@ AcpiExConvertToTargetType ( default: - ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: %X", + ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: 0x%X", DestinationType)); Status = AE_AML_INTERNAL; break; @@ -803,7 +803,7 @@ AcpiExConvertToTargetType ( default: ACPI_ERROR ((AE_INFO, - "Unknown Target type ID 0x%X AmlOpcode %X DestType %s", + "Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s", GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs), WalkState->Opcode, AcpiUtGetTypeName (DestinationType))); Status = AE_AML_INTERNAL; diff --git a/sys/contrib/dev/acpica/executer/excreate.c b/sys/contrib/dev/acpica/executer/excreate.c index f6c2700e0d00..a2f3ed06b743 100644 --- a/sys/contrib/dev/acpica/executer/excreate.c +++ b/sys/contrib/dev/acpica/executer/excreate.c @@ -402,11 +402,11 @@ AcpiExCreateRegion ( if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) && (RegionSpace < ACPI_USER_REGION_BEGIN)) { - ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type %X", RegionSpace)); + ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace)); return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); } - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n", AcpiUtGetRegionName (RegionSpace), RegionSpace)); /* Create the region descriptor */ diff --git a/sys/contrib/dev/acpica/executer/exdebug.c b/sys/contrib/dev/acpica/executer/exdebug.c new file mode 100644 index 000000000000..084c6cb2cc52 --- /dev/null +++ b/sys/contrib/dev/acpica/executer/exdebug.c @@ -0,0 +1,350 @@ +/****************************************************************************** + * + * Module Name: exdebug - Support for stores to the AML Debug Object + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __EXDEBUG_C__ + +#include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/include/acinterp.h> + + +#define _COMPONENT ACPI_EXECUTER + ACPI_MODULE_NAME ("exdebug") + + +#ifndef ACPI_NO_ERROR_MESSAGES +/******************************************************************************* + * + * FUNCTION: AcpiExDoDebugObject + * + * PARAMETERS: SourceDesc - Object to be output to "Debug Object" + * Level - Indentation level (used for packages) + * Index - Current package element, zero if not pkg + * + * RETURN: None + * + * DESCRIPTION: Handles stores to the AML Debug Object. For example: + * Store(INT1, Debug) + * + * This function is not compiled if ACPI_NO_ERROR_MESSAGES is set. + * + * This function is only enabled if AcpiGbl_EnableAmlDebugObject is set, or + * if ACPI_LV_DEBUG_OBJECT is set in the AcpiDbgLevel. Thus, in the normal + * operational case, stores to the debug object are ignored but can be easily + * enabled if necessary. + * + ******************************************************************************/ + +void +AcpiExDoDebugObject ( + ACPI_OPERAND_OBJECT *SourceDesc, + UINT32 Level, + UINT32 Index) +{ + UINT32 i; + + + ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); + + + /* Output must be enabled via the DebugObject global or the DbgLevel */ + + if (!AcpiGbl_EnableAmlDebugObject && + !(AcpiDbgLevel & ACPI_LV_DEBUG_OBJECT)) + { + return_VOID; + } + + /* + * Print line header as long as we are not in the middle of an + * object display + */ + if (!((Level > 0) && Index == 0)) + { + AcpiOsPrintf ("[ACPI Debug] %*s", Level, " "); + } + + /* Display the index for package output only */ + + if (Index > 0) + { + AcpiOsPrintf ("(%.2u) ", Index-1); + } + + if (!SourceDesc) + { + AcpiOsPrintf ("[Null Object]\n"); + return_VOID; + } + + if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND) + { + AcpiOsPrintf ("%s ", AcpiUtGetObjectTypeName (SourceDesc)); + + if (!AcpiUtValidInternalObject (SourceDesc)) + { + AcpiOsPrintf ("%p, Invalid Internal Object!\n", SourceDesc); + return_VOID; + } + } + else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED) + { + AcpiOsPrintf ("%s: %p\n", + AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type), + SourceDesc); + return_VOID; + } + else + { + return_VOID; + } + + /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */ + + switch (SourceDesc->Common.Type) + { + case ACPI_TYPE_INTEGER: + + /* Output correct integer width */ + + if (AcpiGbl_IntegerByteWidth == 4) + { + AcpiOsPrintf ("0x%8.8X\n", + (UINT32) SourceDesc->Integer.Value); + } + else + { + AcpiOsPrintf ("0x%8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value)); + } + break; + + case ACPI_TYPE_BUFFER: + + AcpiOsPrintf ("[0x%.2X]\n", (UINT32) SourceDesc->Buffer.Length); + AcpiUtDumpBuffer2 (SourceDesc->Buffer.Pointer, + (SourceDesc->Buffer.Length < 256) ? + SourceDesc->Buffer.Length : 256, DB_BYTE_DISPLAY); + break; + + case ACPI_TYPE_STRING: + + AcpiOsPrintf ("[0x%.2X] \"%s\"\n", + SourceDesc->String.Length, SourceDesc->String.Pointer); + break; + + case ACPI_TYPE_PACKAGE: + + AcpiOsPrintf ("[Contains 0x%.2X Elements]\n", + SourceDesc->Package.Count); + + /* Output the entire contents of the package */ + + for (i = 0; i < SourceDesc->Package.Count; i++) + { + AcpiExDoDebugObject (SourceDesc->Package.Elements[i], + Level+4, i+1); + } + break; + + case ACPI_TYPE_LOCAL_REFERENCE: + + AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (SourceDesc)); + + /* Decode the reference */ + + switch (SourceDesc->Reference.Class) + { + case ACPI_REFCLASS_INDEX: + + AcpiOsPrintf ("0x%X\n", SourceDesc->Reference.Value); + break; + + case ACPI_REFCLASS_TABLE: + + /* Case for DdbHandle */ + + AcpiOsPrintf ("Table Index 0x%X\n", SourceDesc->Reference.Value); + return; + + default: + break; + } + + AcpiOsPrintf (" "); + + /* Check for valid node first, then valid object */ + + if (SourceDesc->Reference.Node) + { + if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) != + ACPI_DESC_TYPE_NAMED) + { + AcpiOsPrintf (" %p - Not a valid namespace node\n", + SourceDesc->Reference.Node); + } + else + { + AcpiOsPrintf ("Node %p [%4.4s] ", SourceDesc->Reference.Node, + (SourceDesc->Reference.Node)->Name.Ascii); + + switch ((SourceDesc->Reference.Node)->Type) + { + /* These types have no attached object */ + + case ACPI_TYPE_DEVICE: + AcpiOsPrintf ("Device\n"); + break; + + case ACPI_TYPE_THERMAL: + AcpiOsPrintf ("Thermal Zone\n"); + break; + + default: + AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, + Level+4, 0); + break; + } + } + } + else if (SourceDesc->Reference.Object) + { + if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) == + ACPI_DESC_TYPE_NAMED) + { + AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *) + SourceDesc->Reference.Object)->Object, + Level+4, 0); + } + else + { + AcpiExDoDebugObject (SourceDesc->Reference.Object, + Level+4, 0); + } + } + break; + + default: + + AcpiOsPrintf ("%p\n", SourceDesc); + break; + } + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); + return_VOID; +} +#endif + + diff --git a/sys/contrib/dev/acpica/executer/exfield.c b/sys/contrib/dev/acpica/executer/exfield.c index 0e06eefa74db..c0160146816f 100644 --- a/sys/contrib/dev/acpica/executer/exfield.c +++ b/sys/contrib/dev/acpica/executer/exfield.c @@ -382,7 +382,7 @@ AcpiExWriteDataToField ( if (SourceDesc->Buffer.Length < Length) { ACPI_ERROR ((AE_INFO, - "SMBus or IPMI write requires Buffer of length %X, found length %X", + "SMBus or IPMI write requires Buffer of length %u, found length %u", Length, SourceDesc->Buffer.Length)); return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); diff --git a/sys/contrib/dev/acpica/executer/exfldio.c b/sys/contrib/dev/acpica/executer/exfldio.c index 8fbc9920adba..b23b643de5b1 100644 --- a/sys/contrib/dev/acpica/executer/exfldio.c +++ b/sys/contrib/dev/acpica/executer/exfldio.c @@ -181,7 +181,7 @@ AcpiExSetupRegion ( if (RgnDesc->Common.Type != ACPI_TYPE_REGION) { - ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)", + ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)", RgnDesc->Common.Type, AcpiUtGetObjectTypeName (RgnDesc))); @@ -262,7 +262,7 @@ AcpiExSetupRegion ( * byte, and a field with Dword access specified. */ ACPI_ERROR ((AE_INFO, - "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)", + "Field [%4.4s] access width (%u bytes) too large for region [%4.4s] (length %u)", AcpiUtGetNodeName (ObjDesc->CommonField.Node), ObjDesc->CommonField.AccessByteWidth, AcpiUtGetNodeName (RgnDesc->Region.Node), @@ -274,7 +274,7 @@ AcpiExSetupRegion ( * exceeds region length, indicate an error */ ACPI_ERROR ((AE_INFO, - "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)", + "Field [%4.4s] Base+Offset+Width %u+%u+%u is beyond end of region [%4.4s] (length %u)", AcpiUtGetNodeName (ObjDesc->CommonField.Node), ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth, @@ -371,14 +371,14 @@ AcpiExAccessRegion ( if (Status == AE_NOT_IMPLEMENTED) { ACPI_ERROR ((AE_INFO, - "Region %s(%X) not implemented", + "Region %s(0x%X) not implemented", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); } else if (Status == AE_NOT_EXIST) { ACPI_ERROR ((AE_INFO, - "Region %s(%X) has no handler", + "Region %s(0x%X) has no handler", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); } @@ -633,7 +633,7 @@ AcpiExFieldDatumIo ( default: - ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X", + ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %u", ObjDesc->Common.Type)); Status = AE_AML_INTERNAL; break; @@ -743,7 +743,7 @@ AcpiExWriteWithUpdateRule ( default: ACPI_ERROR ((AE_INFO, - "Unknown UpdateRule value: %X", + "Unknown UpdateRule value: 0x%X", (ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK))); return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } @@ -806,7 +806,7 @@ AcpiExExtractFromField ( ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength)) { ACPI_ERROR ((AE_INFO, - "Field size %X (bits) is too large for buffer (%X)", + "Field size %u (bits) is too large for buffer (%u)", ObjDesc->CommonField.BitLength, BufferLength)); return_ACPI_STATUS (AE_BUFFER_OVERFLOW); diff --git a/sys/contrib/dev/acpica/executer/exmisc.c b/sys/contrib/dev/acpica/executer/exmisc.c index a639afb285c0..9d01e033778f 100644 --- a/sys/contrib/dev/acpica/executer/exmisc.c +++ b/sys/contrib/dev/acpica/executer/exmisc.c @@ -183,7 +183,7 @@ AcpiExGetObjectReference ( default: - ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X", + ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X", ObjDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -201,7 +201,7 @@ AcpiExGetObjectReference ( default: - ACPI_ERROR ((AE_INFO, "Invalid descriptor type %X", + ACPI_ERROR ((AE_INFO, "Invalid descriptor type 0x%X", ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))); return_ACPI_STATUS (AE_TYPE); } @@ -373,7 +373,7 @@ AcpiExDoConcatenate ( break; default: - ACPI_ERROR ((AE_INFO, "Invalid object type: %X", + ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X", Operand0->Common.Type)); Status = AE_AML_INTERNAL; } @@ -475,7 +475,7 @@ AcpiExDoConcatenate ( /* Invalid object type, should not happen here */ - ACPI_ERROR ((AE_INFO, "Invalid object type: %X", + ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X", Operand0->Common.Type)); Status =AE_AML_INTERNAL; goto Cleanup; diff --git a/sys/contrib/dev/acpica/executer/exmutex.c b/sys/contrib/dev/acpica/executer/exmutex.c index 0bd66b35623b..315ad100e831 100644 --- a/sys/contrib/dev/acpica/executer/exmutex.c +++ b/sys/contrib/dev/acpica/executer/exmutex.c @@ -168,10 +168,10 @@ AcpiExUnlinkMutex ( (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next; /* - * Migrate the previous sync level associated with this mutex to the - * previous mutex on the list so that it may be preserved. This handles - * the case where several mutexes have been acquired at the same level, - * but are not released in opposite order. + * Migrate the previous sync level associated with this mutex to + * the previous mutex on the list so that it may be preserved. + * This handles the case where several mutexes have been acquired + * at the same level, but are not released in opposite order. */ (ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; @@ -187,8 +187,8 @@ AcpiExUnlinkMutex ( * * FUNCTION: AcpiExLinkMutex * - * PARAMETERS: ObjDesc - The mutex to be linked - * Thread - Current executing thread object + * PARAMETERS: ObjDesc - The mutex to be linked + * Thread - Current executing thread object * * RETURN: None * @@ -228,9 +228,9 @@ AcpiExLinkMutex ( * * FUNCTION: AcpiExAcquireMutexObject * - * PARAMETERS: TimeDesc - Timeout in milliseconds + * PARAMETERS: Timeout - Timeout in milliseconds * ObjDesc - Mutex object - * Thread - Current thread state + * ThreadId - Current thread state * * RETURN: Status * @@ -337,11 +337,12 @@ AcpiExAcquireMutex ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Must have a valid thread ID */ + /* Must have a valid thread state struct */ if (!WalkState->Thread) { - ACPI_ERROR ((AE_INFO, "Cannot acquire Mutex [%4.4s], null thread info", + ACPI_ERROR ((AE_INFO, + "Cannot acquire Mutex [%4.4s], null thread info", AcpiUtGetNodeName (ObjDesc->Mutex.Node))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -353,7 +354,7 @@ AcpiExAcquireMutex ( if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel) { ACPI_ERROR ((AE_INFO, - "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%d)", + "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%u)", AcpiUtGetNodeName (ObjDesc->Mutex.Node), WalkState->Thread->CurrentSyncLevel)); return_ACPI_STATUS (AE_AML_MUTEX_ORDER); @@ -471,6 +472,7 @@ AcpiExReleaseMutex ( { ACPI_STATUS Status = AE_OK; UINT8 PreviousSyncLevel; + ACPI_THREAD_STATE *OwnerThread; ACPI_FUNCTION_TRACE (ExReleaseMutex); @@ -481,11 +483,14 @@ AcpiExReleaseMutex ( return_ACPI_STATUS (AE_BAD_PARAMETER); } + OwnerThread = ObjDesc->Mutex.OwnerThread; + /* The mutex must have been previously acquired in order to release it */ - if (!ObjDesc->Mutex.OwnerThread) + if (!OwnerThread) { - ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], not acquired", + ACPI_ERROR ((AE_INFO, + "Cannot release Mutex [%4.4s], not acquired", AcpiUtGetNodeName (ObjDesc->Mutex.Node))); return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); } @@ -494,7 +499,8 @@ AcpiExReleaseMutex ( if (!WalkState->Thread) { - ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", + ACPI_ERROR ((AE_INFO, + "Cannot release Mutex [%4.4s], null thread info", AcpiUtGetNodeName (ObjDesc->Mutex.Node))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -503,14 +509,14 @@ AcpiExReleaseMutex ( * The Mutex is owned, but this thread must be the owner. * Special case for Global Lock, any thread can release */ - if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) && + if ((OwnerThread->ThreadId != WalkState->Thread->ThreadId) && (ObjDesc != AcpiGbl_GlobalLockMutex)) { ACPI_ERROR ((AE_INFO, "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", ACPI_CAST_PTR (void, WalkState->Thread->ThreadId), AcpiUtGetNodeName (ObjDesc->Mutex.Node), - ACPI_CAST_PTR (void, ObjDesc->Mutex.OwnerThread->ThreadId))); + ACPI_CAST_PTR (void, OwnerThread->ThreadId))); return_ACPI_STATUS (AE_AML_NOT_OWNER); } @@ -521,10 +527,10 @@ AcpiExReleaseMutex ( * different level can only mean that the mutex ordering rule is being * violated. This behavior is clarified in ACPI 4.0 specification. */ - if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel) + if (ObjDesc->Mutex.SyncLevel != OwnerThread->CurrentSyncLevel) { ACPI_ERROR ((AE_INFO, - "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", + "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %u current %u", AcpiUtGetNodeName (ObjDesc->Mutex.Node), ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel)); return_ACPI_STATUS (AE_AML_MUTEX_ORDER); @@ -536,7 +542,7 @@ AcpiExReleaseMutex ( * acquired, but are not released in reverse order. */ PreviousSyncLevel = - WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel; + OwnerThread->AcquiredMutexList->Mutex.OriginalSyncLevel; Status = AcpiExReleaseMutexObject (ObjDesc); if (ACPI_FAILURE (Status)) @@ -548,8 +554,9 @@ AcpiExReleaseMutex ( { /* Restore the previous SyncLevel */ - WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel; + OwnerThread->CurrentSyncLevel = PreviousSyncLevel; } + return_ACPI_STATUS (Status); } @@ -558,7 +565,7 @@ AcpiExReleaseMutex ( * * FUNCTION: AcpiExReleaseAllMutexes * - * PARAMETERS: Thread - Current executing thread object + * PARAMETERS: Thread - Current executing thread object * * RETURN: Status * @@ -617,5 +624,3 @@ AcpiExReleaseAllMutexes ( Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; } } - - diff --git a/sys/contrib/dev/acpica/executer/exnames.c b/sys/contrib/dev/acpica/executer/exnames.c index 7134c62d6a48..bd884cb81aa6 100644 --- a/sys/contrib/dev/acpica/executer/exnames.c +++ b/sys/contrib/dev/acpica/executer/exnames.c @@ -189,7 +189,7 @@ AcpiExAllocateNameString ( if (!NameString) { ACPI_ERROR ((AE_INFO, - "Could not allocate size %d", SizeNeeded)); + "Could not allocate size %u", SizeNeeded)); return_PTR (NULL); } @@ -325,7 +325,7 @@ AcpiExNameSegment ( */ Status = AE_AML_BAD_NAME; ACPI_ERROR ((AE_INFO, - "Bad character %02x in name, at %p", + "Bad character 0x%02x in name, at %p", *AmlAddress, AmlAddress)); } diff --git a/sys/contrib/dev/acpica/executer/exoparg1.c b/sys/contrib/dev/acpica/executer/exoparg1.c index dff76c61b522..550980f9f3b4 100644 --- a/sys/contrib/dev/acpica/executer/exoparg1.c +++ b/sys/contrib/dev/acpica/executer/exoparg1.c @@ -193,7 +193,7 @@ AcpiExOpcode_0A_0T_1R ( default: /* Unknown opcode */ - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; break; @@ -286,7 +286,7 @@ AcpiExOpcode_1A_0T_0R ( default: /* Unknown opcode */ - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; break; @@ -332,7 +332,7 @@ AcpiExOpcode_1A_1T_0R ( default: /* Unknown opcode */ - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; @@ -514,7 +514,7 @@ AcpiExOpcode_1A_1T_1R ( if (Digit > 0) { ACPI_ERROR ((AE_INFO, - "Integer too large to convert to BCD: %8.8X%8.8X", + "Integer too large to convert to BCD: 0x%8.8X%8.8X", ACPI_FORMAT_UINT64 (Operand[0]->Integer.Value))); Status = AE_AML_NUMERIC_OVERFLOW; goto Cleanup; @@ -664,7 +664,7 @@ AcpiExOpcode_1A_1T_1R ( default: /* Unknown opcode */ - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; @@ -1116,7 +1116,7 @@ AcpiExOpcode_1A_0T_1R ( default: ACPI_ERROR ((AE_INFO, - "Unknown Index TargetType %X in reference object %p", + "Unknown Index TargetType 0x%X in reference object %p", Operand[0]->Reference.TargetType, Operand[0])); Status = AE_AML_OPERAND_TYPE; goto Cleanup; @@ -1143,7 +1143,7 @@ AcpiExOpcode_1A_0T_1R ( default: ACPI_ERROR ((AE_INFO, - "Unknown class in reference(%p) - %2.2X", + "Unknown class in reference(%p) - 0x%2.2X", Operand[0], Operand[0]->Reference.Class)); Status = AE_TYPE; @@ -1155,7 +1155,7 @@ AcpiExOpcode_1A_0T_1R ( default: - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; diff --git a/sys/contrib/dev/acpica/executer/exoparg2.c b/sys/contrib/dev/acpica/executer/exoparg2.c index b6e8478f22f2..2bedf5a1c9d7 100644 --- a/sys/contrib/dev/acpica/executer/exoparg2.c +++ b/sys/contrib/dev/acpica/executer/exoparg2.c @@ -206,33 +206,6 @@ AcpiExOpcode_2A_0T_0R ( break; } -#ifdef ACPI_GPE_NOTIFY_CHECK - /* - * GPE method wake/notify check. Here, we want to ensure that we - * don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx - * GPE method during system runtime. If we do, the GPE is marked - * as "wake-only" and disabled. - * - * 1) Is the Notify() value == DeviceWake? - * 2) Is this a GPE deferred method? (An _Lxx or _Exx method) - * 3) Did the original GPE happen at system runtime? - * (versus during wake) - * - * If all three cases are true, this is a wake-only GPE that should - * be disabled at runtime. - */ - if (Value == 2) /* DeviceWake */ - { - Status = AcpiEvCheckForWakeOnlyGpe (WalkState->GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ - - return_ACPI_STATUS (AE_OK) - } - } -#endif - /* * Dispatch the notify to the appropriate handler * NOTE: the request is queued for execution after this method @@ -246,7 +219,7 @@ AcpiExOpcode_2A_0T_0R ( default: - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; } @@ -319,7 +292,7 @@ AcpiExOpcode_2A_2T_1R ( default: - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; @@ -555,7 +528,7 @@ AcpiExOpcode_2A_1T_1R ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Index (%X%8.8X) is beyond end of object", + "Index (0x%8.8X%8.8X) is beyond end of object", ACPI_FORMAT_UINT64 (Index))); goto Cleanup; } @@ -579,7 +552,7 @@ AcpiExOpcode_2A_1T_1R ( default: - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; break; @@ -702,7 +675,7 @@ AcpiExOpcode_2A_0T_1R ( default: - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; diff --git a/sys/contrib/dev/acpica/executer/exoparg3.c b/sys/contrib/dev/acpica/executer/exoparg3.c index c94a26d272f9..9c640c56d6bd 100644 --- a/sys/contrib/dev/acpica/executer/exoparg3.c +++ b/sys/contrib/dev/acpica/executer/exoparg3.c @@ -206,7 +206,7 @@ AcpiExOpcode_3A_0T_0R ( default: - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; @@ -345,7 +345,7 @@ AcpiExOpcode_3A_1T_1R ( default: - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; diff --git a/sys/contrib/dev/acpica/executer/exoparg6.c b/sys/contrib/dev/acpica/executer/exoparg6.c index d13e9f6117a7..3d06fa169c54 100644 --- a/sys/contrib/dev/acpica/executer/exoparg6.c +++ b/sys/contrib/dev/acpica/executer/exoparg6.c @@ -337,7 +337,7 @@ AcpiExOpcode_6A_0T_1R ( if (Index >= Operand[0]->Package.Count) { ACPI_ERROR ((AE_INFO, - "Index (%X%8.8X) beyond package end (%X)", + "Index (0x%8.8X%8.8X) beyond package end (0x%X)", ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count)); Status = AE_AML_PACKAGE_LIMIT; goto Cleanup; @@ -411,7 +411,7 @@ AcpiExOpcode_6A_0T_1R ( default: - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; diff --git a/sys/contrib/dev/acpica/executer/exprep.c b/sys/contrib/dev/acpica/executer/exprep.c index b60e09cc15b7..3eb5a65255de 100644 --- a/sys/contrib/dev/acpica/executer/exprep.c +++ b/sys/contrib/dev/acpica/executer/exprep.c @@ -362,7 +362,7 @@ AcpiExDecodeFieldAccess ( /* Invalid field access type */ ACPI_ERROR ((AE_INFO, - "Unknown field access type %X", + "Unknown field access type 0x%X", Access)); return_UINT32 (0); } @@ -533,7 +533,7 @@ AcpiExPrepFieldValue ( if (Type != ACPI_TYPE_REGION) { ACPI_ERROR ((AE_INFO, - "Needed Region, found type %X (%s)", + "Needed Region, found type 0x%X (%s)", Type, AcpiUtGetTypeName (Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); diff --git a/sys/contrib/dev/acpica/executer/exregion.c b/sys/contrib/dev/acpica/executer/exregion.c index 3969c584bb0c..77a500c722eb 100644 --- a/sys/contrib/dev/acpica/executer/exregion.c +++ b/sys/contrib/dev/acpica/executer/exregion.c @@ -188,7 +188,7 @@ AcpiExSystemMemorySpaceHandler ( break; default: - ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %d", + ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u", BitWidth)); return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } @@ -265,7 +265,7 @@ AcpiExSystemMemorySpaceHandler ( if (!MemInfo->MappedLogicalAddress) { ACPI_ERROR ((AE_INFO, - "Could not map memory at %8.8X%8.8X, size %X", + "Could not map memory at 0x%8.8X%8.8X, size %u", ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength)); MemInfo->MappedLength = 0; return_ACPI_STATUS (AE_NO_MEMORY); @@ -608,8 +608,10 @@ AcpiExDataTableSpaceHandler ( ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler); - /* Perform the memory read or write */ - + /* + * Perform the memory read or write. The BitWidth was already + * validated. + */ switch (Function) { case ACPI_READ: @@ -619,9 +621,14 @@ AcpiExDataTableSpaceHandler ( break; case ACPI_WRITE: + + ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value), + ACPI_DIV_8 (BitWidth)); + break; + default: - return_ACPI_STATUS (AE_SUPPORT); + return_ACPI_STATUS (AE_BAD_PARAMETER); } return_ACPI_STATUS (AE_OK); diff --git a/sys/contrib/dev/acpica/executer/exresnte.c b/sys/contrib/dev/acpica/executer/exresnte.c index 9a45afde9009..7b28f851f9e4 100644 --- a/sys/contrib/dev/acpica/executer/exresnte.c +++ b/sys/contrib/dev/acpica/executer/exresnte.c @@ -344,7 +344,7 @@ AcpiExResolveNodeToValue ( /* No named references are allowed here */ ACPI_ERROR ((AE_INFO, - "Unsupported Reference type %X", + "Unsupported Reference type 0x%X", SourceDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -357,7 +357,7 @@ AcpiExResolveNodeToValue ( /* Default case is for unknown types */ ACPI_ERROR ((AE_INFO, - "Node %p - Unknown object type %X", + "Node %p - Unknown object type 0x%X", Node, EntryType)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); diff --git a/sys/contrib/dev/acpica/executer/exresolv.c b/sys/contrib/dev/acpica/executer/exresolv.c index e587bd1d4938..8b19b54f0ee5 100644 --- a/sys/contrib/dev/acpica/executer/exresolv.c +++ b/sys/contrib/dev/acpica/executer/exresolv.c @@ -326,7 +326,7 @@ AcpiExResolveObjectToValue ( /* Invalid reference object */ ACPI_ERROR ((AE_INFO, - "Unknown TargetType %X in Index/Reference object %p", + "Unknown TargetType 0x%X in Index/Reference object %p", StackDesc->Reference.TargetType, StackDesc)); Status = AE_AML_INTERNAL; break; @@ -367,7 +367,7 @@ AcpiExResolveObjectToValue ( default: ACPI_ERROR ((AE_INFO, - "Unknown Reference type %X in %p", RefType, StackDesc)); + "Unknown Reference type 0x%X in %p", RefType, StackDesc)); Status = AE_AML_INTERNAL; break; } @@ -503,7 +503,7 @@ AcpiExResolveMultiple ( if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { ACPI_ERROR ((AE_INFO, - "Not a NS node %p [%s]", + "Not a namespace node %p [%s]", Node, AcpiUtGetDescriptorName (Node))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -605,7 +605,7 @@ AcpiExResolveMultiple ( default: ACPI_ERROR ((AE_INFO, - "Unknown Reference Class %2.2X", ObjDesc->Reference.Class)); + "Unknown Reference Class 0x%2.2X", ObjDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_INTERNAL); } } diff --git a/sys/contrib/dev/acpica/executer/exresop.c b/sys/contrib/dev/acpica/executer/exresop.c index 22dd558b7d1d..211e1d983a45 100644 --- a/sys/contrib/dev/acpica/executer/exresop.c +++ b/sys/contrib/dev/acpica/executer/exresop.c @@ -243,7 +243,7 @@ AcpiExResolveOperands ( ArgTypes = OpInfo->RuntimeArgs; if (ArgTypes == ARGI_INVALID_OPCODE) { - ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X", + ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X", Opcode)); return_ACPI_STATUS (AE_AML_INTERNAL); @@ -309,7 +309,7 @@ AcpiExResolveOperands ( if (!AcpiUtValidObjectType (ObjectType)) { ACPI_ERROR ((AE_INFO, - "Bad operand object type [%X]", ObjectType)); + "Bad operand object type [0x%X]", ObjectType)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -342,7 +342,7 @@ AcpiExResolveOperands ( default: ACPI_ERROR ((AE_INFO, - "Unknown Reference Class %2.2X in %p", + "Unknown Reference Class 0x%2.2X in %p", ObjDesc->Reference.Class, ObjDesc)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -773,7 +773,7 @@ AcpiExResolveOperands ( /* Unknown type */ ACPI_ERROR ((AE_INFO, - "Internal - Unknown ARGI (required operand) type %X", + "Internal - Unknown ARGI (required operand) type 0x%X", ThisArgType)); return_ACPI_STATUS (AE_BAD_PARAMETER); diff --git a/sys/contrib/dev/acpica/executer/exstore.c b/sys/contrib/dev/acpica/executer/exstore.c index ff9b940e5bc6..c78e106c52b4 100644 --- a/sys/contrib/dev/acpica/executer/exstore.c +++ b/sys/contrib/dev/acpica/executer/exstore.c @@ -1,4 +1,3 @@ - /****************************************************************************** * * Module Name: exstore - AML Interpreter object store support @@ -129,12 +128,6 @@ /* Local prototypes */ -static void -AcpiExDoDebugObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - UINT32 Level, - UINT32 Index); - static ACPI_STATUS AcpiExStoreObjectToIndex ( ACPI_OPERAND_OBJECT *ValDesc, @@ -142,218 +135,6 @@ AcpiExStoreObjectToIndex ( ACPI_WALK_STATE *WalkState); -/******************************************************************************* - * - * FUNCTION: AcpiExDoDebugObject - * - * PARAMETERS: SourceDesc - Value to be stored - * Level - Indentation level (used for packages) - * Index - Current package element, zero if not pkg - * - * RETURN: None - * - * DESCRIPTION: Handles stores to the Debug Object. - * - ******************************************************************************/ - -static void -AcpiExDoDebugObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - UINT32 Level, - UINT32 Index) -{ - UINT32 i; - - - ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); - - - /* Print line header as long as we are not in the middle of an object display */ - - if (!((Level > 0) && Index == 0)) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", - Level, " ")); - } - - /* Display index for package output only */ - - if (Index > 0) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, - "(%.2u) ", Index -1)); - } - - if (!SourceDesc) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n")); - return_VOID; - } - - if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s ", - AcpiUtGetObjectTypeName (SourceDesc))); - - if (!AcpiUtValidInternalObject (SourceDesc)) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, - "%p, Invalid Internal Object!\n", SourceDesc)); - return_VOID; - } - } - else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n", - AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type), - SourceDesc)); - return_VOID; - } - else - { - return_VOID; - } - - /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */ - - switch (SourceDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - /* Output correct integer width */ - - if (AcpiGbl_IntegerByteWidth == 4) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", - (UINT32) SourceDesc->Integer.Value)); - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value))); - } - break; - - case ACPI_TYPE_BUFFER: - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", - (UINT32) SourceDesc->Buffer.Length)); - ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer, - (SourceDesc->Buffer.Length < 256) ? SourceDesc->Buffer.Length : 256); - break; - - case ACPI_TYPE_STRING: - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", - SourceDesc->String.Length, SourceDesc->String.Pointer)); - break; - - case ACPI_TYPE_PACKAGE: - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Contains 0x%.2X Elements]\n", - SourceDesc->Package.Count)); - - /* Output the entire contents of the package */ - - for (i = 0; i < SourceDesc->Package.Count; i++) - { - AcpiExDoDebugObject (SourceDesc->Package.Elements[i], - Level+4, i+1); - } - break; - - case ACPI_TYPE_LOCAL_REFERENCE: - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s] ", - AcpiUtGetReferenceName (SourceDesc))); - - /* Decode the reference */ - - switch (SourceDesc->Reference.Class) - { - case ACPI_REFCLASS_INDEX: - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X\n", - SourceDesc->Reference.Value)); - break; - - case ACPI_REFCLASS_TABLE: - - /* Case for DdbHandle */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Table Index 0x%X\n", - SourceDesc->Reference.Value)); - return; - - default: - break; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, " ")); - - /* Check for valid node first, then valid object */ - - if (SourceDesc->Reference.Node) - { - if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) != - ACPI_DESC_TYPE_NAMED) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, - " %p - Not a valid namespace node\n", - SourceDesc->Reference.Node)); - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Node %p [%4.4s] ", - SourceDesc->Reference.Node, (SourceDesc->Reference.Node)->Name.Ascii)); - - switch ((SourceDesc->Reference.Node)->Type) - { - /* These types have no attached object */ - - case ACPI_TYPE_DEVICE: - AcpiOsPrintf ("Device\n"); - break; - - case ACPI_TYPE_THERMAL: - AcpiOsPrintf ("Thermal Zone\n"); - break; - - default: - AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, - Level+4, 0); - break; - } - } - } - else if (SourceDesc->Reference.Object) - { - if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) == - ACPI_DESC_TYPE_NAMED) - { - AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *) - SourceDesc->Reference.Object)->Object, - Level+4, 0); - } - else - { - AcpiExDoDebugObject (SourceDesc->Reference.Object, Level+4, 0); - } - } - break; - - default: - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n", - SourceDesc)); - break; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); - return_VOID; -} - - /******************************************************************************* * * FUNCTION: AcpiExStore @@ -487,13 +268,13 @@ AcpiExStore ( "**** Write to Debug Object: Object %p %s ****:\n\n", SourceDesc, AcpiUtGetObjectTypeName (SourceDesc))); - AcpiExDoDebugObject (SourceDesc, 0, 0); + ACPI_DEBUG_OBJECT (SourceDesc, 0, 0); break; default: - ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X", + ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X", RefDesc->Reference.Class)); ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO); diff --git a/sys/contrib/dev/acpica/executer/exsystem.c b/sys/contrib/dev/acpica/executer/exsystem.c index c9f746acb364..96e3063903ef 100644 --- a/sys/contrib/dev/acpica/executer/exsystem.c +++ b/sys/contrib/dev/acpica/executer/exsystem.c @@ -265,7 +265,7 @@ AcpiExSystemDoStall ( * (ACPI specifies 100 usec as max, but this gives some slack in * order to support existing BIOSs) */ - ACPI_ERROR ((AE_INFO, "Time parameter is too large (%d)", + ACPI_ERROR ((AE_INFO, "Time parameter is too large (%u)", HowLong)); Status = AE_AML_OPERAND_VALUE; } diff --git a/sys/contrib/dev/acpica/hardware/hwregs.c b/sys/contrib/dev/acpica/hardware/hwregs.c index 26ee46299f43..050f5b3c6325 100644 --- a/sys/contrib/dev/acpica/hardware/hwregs.c +++ b/sys/contrib/dev/acpica/hardware/hwregs.c @@ -412,7 +412,7 @@ AcpiHwGetBitRegisterInfo ( if (RegisterId > ACPI_BITREG_MAX) { - ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: %X", RegisterId)); + ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: 0x%X", RegisterId)); return (NULL); } @@ -539,7 +539,7 @@ AcpiHwRegisterRead ( default: - ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X", + ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X", RegisterId)); Status = AE_BAD_PARAMETER; break; @@ -682,7 +682,7 @@ AcpiHwRegisterWrite ( default: - ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X", + ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X", RegisterId)); Status = AE_BAD_PARAMETER; break; diff --git a/sys/contrib/dev/acpica/hardware/hwsleep.c b/sys/contrib/dev/acpica/hardware/hwsleep.c index 7026c69a025a..913deb3de79b 100644 --- a/sys/contrib/dev/acpica/hardware/hwsleep.c +++ b/sys/contrib/dev/acpica/hardware/hwsleep.c @@ -320,7 +320,7 @@ AcpiEnterSleepState ( if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) || (AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX)) { - ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=%X B=%X", + ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X", AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB)); return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } @@ -474,13 +474,16 @@ AcpiEnterSleepState ( return_ACPI_STATUS (Status); } - /* - * Some BIOSs don't set WAK_STS at all. Give up waiting after - * 1000 retries if it still isn't set. - */ - if (Retry-- == 0) + if (AcpiGbl_EnableInterpreterSlack) { - break; + /* + * Some BIOSs don't set WAK_STS at all. Give up waiting after + * 1000 retries if it still isn't set. + */ + if (Retry-- == 0) + { + break; + } } /* Spin until we wake */ diff --git a/sys/contrib/dev/acpica/hardware/hwvalid.c b/sys/contrib/dev/acpica/hardware/hwvalid.c index 8c369b18bc22..a71505372687 100644 --- a/sys/contrib/dev/acpica/hardware/hwvalid.c +++ b/sys/contrib/dev/acpica/hardware/hwvalid.c @@ -237,7 +237,7 @@ AcpiHwValidateIoRequest ( if (LastAddress > ACPI_UINT16_MAX) { ACPI_ERROR ((AE_INFO, - "Illegal I/O port address/length above 64K: 0x%p/%X", + "Illegal I/O port address/length above 64K: %p/0x%X", ACPI_CAST_PTR (void, Address), ByteWidth)); return_ACPI_STATUS (AE_LIMIT); } diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index 6c61f84f38bf..6d119aa475e9 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -286,6 +286,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; diff --git a/sys/contrib/dev/acpica/include/acevents.h b/sys/contrib/dev/acpica/include/acevents.h index 567ac1ec0e13..4d945eff8aad 100644 --- a/sys/contrib/dev/acpica/include/acevents.h +++ b/sys/contrib/dev/acpica/include/acevents.h @@ -171,13 +171,11 @@ AcpiEvQueueNotifyRequest ( */ ACPI_STATUS AcpiEvUpdateGpeEnableMasks ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT8 Type); + ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_STATUS AcpiEvEnableGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - BOOLEAN WriteToHardware); + ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_STATUS AcpiEvDisableGpe ( @@ -188,6 +186,11 @@ AcpiEvGetGpeEventInfo ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber); +ACPI_GPE_EVENT_INFO * +AcpiEvLowGetGpeInfo ( + UINT32 GpeNumber, + ACPI_GPE_BLOCK_INFO *GpeBlock); + /* * evgpeblk @@ -234,15 +237,6 @@ UINT32 AcpiEvGpeDetect ( ACPI_GPE_XRUPT_INFO *GpeXruptList); -ACPI_STATUS -AcpiEvSetGpeType ( - ACPI_GPE_EVENT_INFO *GpeEventInfo, - UINT8 Type); - -ACPI_STATUS -AcpiEvCheckForWakeOnlyGpe ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); - ACPI_STATUS AcpiEvGpeInitialize ( void); diff --git a/sys/contrib/dev/acpica/include/acexcep.h b/sys/contrib/dev/acpica/include/acexcep.h index 89fe5c66898f..a46de7d82f5e 100644 --- a/sys/contrib/dev/acpica/include/acexcep.h +++ b/sys/contrib/dev/acpica/include/acexcep.h @@ -162,7 +162,7 @@ #define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL) #define AE_ABORT_METHOD (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL) #define AE_SAME_HANDLER (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL) -#define AE_WAKE_ONLY_GPE (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL) +#define AE_NO_HANDLER (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL) #define AE_OWNER_ID_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL) #define AE_CODE_ENV_MAX 0x001B diff --git a/sys/contrib/dev/acpica/include/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index 4469ee334e3b..4f0769e6f676 100644 --- a/sys/contrib/dev/acpica/include/acglobal.h +++ b/sys/contrib/dev/acpica/include/acglobal.h @@ -186,6 +186,19 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE); */ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_UseDefaultRegisterWidths, TRUE); +/* + * Optionally enable output from the AML Debug Object. + */ +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE); + +/* + * Optionally copy the entire DSDT to local memory (instead of simply + * mapping it.) There are some BIOSs that corrupt or replace the original + * DSDT, creating the need for this option. Default is FALSE, do not copy + * the DSDT. + */ +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE); + /* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ @@ -218,6 +231,11 @@ ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable; ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bStatus; ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable; +/* DSDT information. Used to check for DSDT corruption */ + +ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT; +ACPI_EXTERN ACPI_TABLE_HEADER AcpiGbl_OriginalDsdtHeader; + /* * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is * determined by the revision of the DSDT: If the DSDT revision is less than diff --git a/sys/contrib/dev/acpica/include/acinterp.h b/sys/contrib/dev/acpica/include/acinterp.h index de7dbf8030eb..67142c8911b5 100644 --- a/sys/contrib/dev/acpica/include/acinterp.h +++ b/sys/contrib/dev/acpica/include/acinterp.h @@ -202,6 +202,16 @@ AcpiExConvertToTargetType ( ACPI_WALK_STATE *WalkState); +/* + * exdebug - AML debug object + */ +void +AcpiExDoDebugObject ( + ACPI_OPERAND_OBJECT *SourceDesc, + UINT32 Level, + UINT32 Index); + + /* * exfield - ACPI AML (p-code) execution - field manipulation */ diff --git a/sys/contrib/dev/acpica/include/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index 0aeacff6c525..8818a6ea9b53 100644 --- a/sys/contrib/dev/acpica/include/aclocal.h +++ b/sys/contrib/dev/acpica/include/aclocal.h @@ -561,6 +561,8 @@ typedef struct acpi_gpe_event_info struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */ UINT8 Flags; /* Misc info about this GPE */ UINT8 GpeNumber; /* This GPE */ + UINT8 RuntimeCount; /* References to a run GPE */ + UINT8 WakeupCount; /* References to a wake GPE */ } ACPI_GPE_EVENT_INFO; @@ -590,6 +592,7 @@ typedef struct acpi_gpe_block_info ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */ ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */ UINT32 RegisterCount; /* Number of register pairs in block */ + UINT16 GpeCount; /* Number of individual GPEs in block */ UINT8 BlockBaseNumber;/* Base GPE number for this block */ } ACPI_GPE_BLOCK_INFO; diff --git a/sys/contrib/dev/acpica/include/acoutput.h b/sys/contrib/dev/acpica/include/acoutput.h index 8018fed53842..8fca0de33953 100644 --- a/sys/contrib/dev/acpica/include/acoutput.h +++ b/sys/contrib/dev/acpica/include/acoutput.h @@ -281,6 +281,7 @@ #define ACPI_WARNING(plist) AcpiWarning plist #define ACPI_EXCEPTION(plist) AcpiException plist #define ACPI_ERROR(plist) AcpiError plist +#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i) #else @@ -290,6 +291,7 @@ #define ACPI_WARNING(plist) #define ACPI_EXCEPTION(plist) #define ACPI_ERROR(plist) +#define ACPI_DEBUG_OBJECT(obj,l,i) #endif /* ACPI_NO_ERROR_MESSAGES */ diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 7111984df6a5..5562fa0215d5 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -120,7 +120,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20100121 +#define ACPI_CA_VERSION 0x20100331 #include <contrib/dev/acpica/include/actypes.h> #include <contrib/dev/acpica/include/actbl.h> @@ -145,6 +145,8 @@ extern UINT8 AcpiGbl_LeaveWakeGpesDisabled; extern UINT8 AcpiGbl_UseDefaultRegisterWidths; extern ACPI_NAME AcpiGbl_TraceMethodName; extern UINT32 AcpiGbl_TraceFlags; +extern UINT8 AcpiGbl_EnableAmlDebugObject; +extern UINT8 AcpiGbl_CopyDsdtLocally; /* @@ -462,34 +464,32 @@ AcpiGetEventStatus ( * GPE Interfaces */ ACPI_STATUS -AcpiSetGpeType ( +AcpiSetGpe ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - UINT8 Type); + UINT8 Action); ACPI_STATUS AcpiEnableGpe ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - UINT32 Flags); + UINT8 GpeType); ACPI_STATUS AcpiDisableGpe ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - UINT32 Flags); + UINT8 GpeType); ACPI_STATUS AcpiClearGpe ( ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Flags); + UINT32 GpeNumber); ACPI_STATUS AcpiGetGpeStatus ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - UINT32 Flags, ACPI_EVENT_STATUS *EventStatus); ACPI_STATUS diff --git a/sys/contrib/dev/acpica/include/actables.h b/sys/contrib/dev/acpica/include/actables.h index 54fdaae9b1a7..9f1c4f00e5a8 100644 --- a/sys/contrib/dev/acpica/include/actables.h +++ b/sys/contrib/dev/acpica/include/actables.h @@ -230,6 +230,14 @@ AcpiTbVerifyChecksum ( ACPI_TABLE_HEADER *Table, UINT32 Length); +void +AcpiTbCheckDsdtHeader ( + void); + +ACPI_TABLE_HEADER * +AcpiTbCopyDsdt ( + UINT32 TableIndex); + void AcpiTbInstallTable ( ACPI_PHYSICAL_ADDRESS Address, diff --git a/sys/contrib/dev/acpica/include/actbl2.h b/sys/contrib/dev/acpica/include/actbl2.h index c96715d3c05e..7f6ecf84a93c 100644 --- a/sys/contrib/dev/acpica/include/actbl2.h +++ b/sys/contrib/dev/acpica/include/actbl2.h @@ -143,6 +143,7 @@ #define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ +#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ #define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ @@ -862,6 +863,35 @@ typedef struct acpi_mcfg_allocation } ACPI_MCFG_ALLOCATION; +/******************************************************************************* + * + * MCHI - Management Controller Host Interface Table + * Version 1 + * + * Conforms to "Management Component Transport Protocol (MCTP) Host + * Interface Specification", Revision 1.0.0a, October 13, 2009 + * + ******************************************************************************/ + +typedef struct acpi_table_mchi +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 InterfaceType; + UINT8 Protocol; + UINT64 ProtocolData; + UINT8 InterruptType; + UINT8 Gpe; + UINT8 PciDeviceFlag; + UINT32 GlobalInterrupt; + ACPI_GENERIC_ADDRESS ControlRegister; + UINT8 PciSegment; + UINT8 PciBus; + UINT8 PciDevice; + UINT8 PciFunction; + +} ACPI_TABLE_MCHI; + + /******************************************************************************* * * SPCR - Serial Port Console Redirection table diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index 8d0d06ad62ce..3c0626ab1e35 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -742,53 +742,42 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_GPE_MAX 0xFF #define ACPI_NUM_GPE 256 +/* Actions for AcpiSetGpe */ + #define ACPI_GPE_ENABLE 0 #define ACPI_GPE_DISABLE 1 +/* GpeTypes for AcpiEnableGpe and AcpiDisableGpe */ + +#define ACPI_GPE_TYPE_WAKE (UINT8) 0x01 +#define ACPI_GPE_TYPE_RUNTIME (UINT8) 0x02 +#define ACPI_GPE_TYPE_WAKE_RUN (UINT8) 0x03 /* * GPE info flags - Per GPE - * +-+-+-+---+---+-+ - * |7|6|5|4:3|2:1|0| - * +-+-+-+---+---+-+ - * | | | | | | - * | | | | | +--- Interrupt type: Edge or Level Triggered - * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime - * | | | +--- Type of dispatch -- to method, handler, or none - * | | +--- Enabled for runtime? - * | +--- Enabled for wake? - * +--- Unused + * +-------+---+-+-+ + * | 7:4 |3:2|1|0| + * +-------+---+-+-+ + * | | | | + * | | | +--- Interrupt type: edge or level triggered + * | | +----- GPE can wake the system + * | +-------- Type of dispatch:to method, handler, or none + * +-------------- <Reserved> */ #define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01 #define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01 #define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00 -#define ACPI_GPE_TYPE_MASK (UINT8) 0x06 -#define ACPI_GPE_TYPE_WAKE_RUN (UINT8) 0x06 -#define ACPI_GPE_TYPE_WAKE (UINT8) 0x02 -#define ACPI_GPE_TYPE_RUNTIME (UINT8) 0x04 /* Default */ +#define ACPI_GPE_CAN_WAKE (UINT8) 0x02 -#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x18 -#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x08 -#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x10 -#define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00 /* Default */ - -#define ACPI_GPE_RUN_ENABLE_MASK (UINT8) 0x20 -#define ACPI_GPE_RUN_ENABLED (UINT8) 0x20 -#define ACPI_GPE_RUN_DISABLED (UINT8) 0x00 /* Default */ - -#define ACPI_GPE_WAKE_ENABLE_MASK (UINT8) 0x40 -#define ACPI_GPE_WAKE_ENABLED (UINT8) 0x40 -#define ACPI_GPE_WAKE_DISABLED (UINT8) 0x00 /* Default */ - -#define ACPI_GPE_ENABLE_MASK (UINT8) 0x60 /* Both run/wake */ +#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x0C +#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x04 +#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x08 +#define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00 /* * Flags for GPE and Lock interfaces */ -#define ACPI_EVENT_WAKE_ENABLE 0x2 /* AcpiGpeEnable */ -#define ACPI_EVENT_WAKE_DISABLE 0x2 /* AcpiGpeDisable */ - #define ACPI_NOT_ISR 0x1 #define ACPI_ISR 0x0 diff --git a/sys/contrib/dev/acpica/include/platform/acfreebsd.h b/sys/contrib/dev/acpica/include/platform/acfreebsd.h index 20ec3a20bf95..c835aaf665d8 100644 --- a/sys/contrib/dev/acpica/include/platform/acfreebsd.h +++ b/sys/contrib/dev/acpica/include/platform/acfreebsd.h @@ -114,7 +114,7 @@ *****************************************************************************/ #ifndef __ACFREEBSD_H__ -#define __ACFREEBSD_H__ +#define __ACFREEBSD_H__ /* FreeBSD uses GCC */ @@ -123,11 +123,11 @@ #include <sys/types.h> #include <machine/acpica_machdep.h> -#define ACPI_UINTPTR_T uintptr_t +#define ACPI_UINTPTR_T uintptr_t -#define ACPI_USE_DO_WHILE_0 -#define ACPI_USE_LOCAL_CACHE -#define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_USE_DO_WHILE_0 +#define ACPI_USE_LOCAL_CACHE +#define ACPI_USE_SYSTEM_CLIBRARY #ifdef _KERNEL @@ -139,18 +139,18 @@ #include "opt_acpi.h" -#define ACPI_THREAD_ID lwpid_t -#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX +#define ACPI_THREAD_ID lwpid_t +#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX #ifdef ACPI_DEBUG -#define ACPI_DEBUG_OUTPUT /* for backward compatibility */ -#define ACPI_DISASSEMBLER +#define ACPI_DEBUG_OUTPUT /* for backward compatibility */ +#define ACPI_DISASSEMBLER #endif #ifdef ACPI_DEBUG_OUTPUT #include "opt_ddb.h" #ifdef DDB -#define ACPI_DEBUGGER +#define ACPI_DEBUGGER #endif /* DDB */ #endif /* ACPI_DEBUG_OUTPUT */ @@ -158,7 +158,7 @@ #undef DEBUGGER_THREADING #endif /* DEBUGGER_THREADING */ -#define DEBUGGER_THREADING 0 /* integrated with DDB */ +#define DEBUGGER_THREADING 0 /* integrated with DDB */ #else /* _KERNEL */ @@ -166,12 +166,12 @@ #include <ctype.h> #endif -#define ACPI_THREAD_ID pthread_t +#define ACPI_THREAD_ID pthread_t -#define ACPI_USE_STANDARD_HEADERS +#define ACPI_USE_STANDARD_HEADERS -#define ACPI_FLUSH_CPU_CACHE() -#define __cdecl +#define ACPI_FLUSH_CPU_CACHE() +#define __cdecl #endif /* _KERNEL */ diff --git a/sys/contrib/dev/acpica/namespace/nsaccess.c b/sys/contrib/dev/acpica/namespace/nsaccess.c index e360e28370a9..0ee1fae45424 100644 --- a/sys/contrib/dev/acpica/namespace/nsaccess.c +++ b/sys/contrib/dev/acpica/namespace/nsaccess.c @@ -306,7 +306,7 @@ AcpiNsRootInitialize ( default: - ACPI_ERROR ((AE_INFO, "Unsupported initial type value %X", + ACPI_ERROR ((AE_INFO, "Unsupported initial type value 0x%X", InitVal->Type)); AcpiUtRemoveReference (ObjDesc); ObjDesc = NULL; diff --git a/sys/contrib/dev/acpica/namespace/nsdump.c b/sys/contrib/dev/acpica/namespace/nsdump.c index a1ae96e59194..2d37135dc21d 100644 --- a/sys/contrib/dev/acpica/namespace/nsdump.c +++ b/sys/contrib/dev/acpica/namespace/nsdump.c @@ -314,7 +314,7 @@ AcpiNsDumpOneObject ( if (Type > ACPI_TYPE_LOCAL_MAX) { - ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type %08X", Type)); + ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type 0x%08X", Type)); } AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); diff --git a/sys/contrib/dev/acpica/namespace/nsnames.c b/sys/contrib/dev/acpica/namespace/nsnames.c index c23e6de4f7f1..6f26f018a933 100644 --- a/sys/contrib/dev/acpica/namespace/nsnames.c +++ b/sys/contrib/dev/acpica/namespace/nsnames.c @@ -191,7 +191,7 @@ AcpiNsBuildExternalPath ( if (Index != 0) { ACPI_ERROR ((AE_INFO, - "Could not construct external pathname; index=%X, size=%X, Path=%s", + "Could not construct external pathname; index=%u, size=%u, Path=%s", (UINT32) Index, (UINT32) Size, &NameBuffer[Size])); return (AE_BAD_PARAMETER); diff --git a/sys/contrib/dev/acpica/namespace/nssearch.c b/sys/contrib/dev/acpica/namespace/nssearch.c index b583fab12871..24673009affe 100644 --- a/sys/contrib/dev/acpica/namespace/nssearch.c +++ b/sys/contrib/dev/acpica/namespace/nssearch.c @@ -397,7 +397,7 @@ AcpiNsSearchAndEnter ( if (!Node || !TargetName || !ReturnNode) { ACPI_ERROR ((AE_INFO, - "Null parameter: Node %p Name %X ReturnNode %p", + "Null parameter: Node %p Name 0x%X ReturnNode %p", Node, TargetName, ReturnNode)); return_ACPI_STATUS (AE_BAD_PARAMETER); } diff --git a/sys/contrib/dev/acpica/namespace/nsutils.c b/sys/contrib/dev/acpica/namespace/nsutils.c index cc42f68b592c..7a464c17358c 100644 --- a/sys/contrib/dev/acpica/namespace/nsutils.c +++ b/sys/contrib/dev/acpica/namespace/nsutils.c @@ -389,7 +389,7 @@ AcpiNsLocal ( { /* Type code out of range */ - ACPI_WARNING ((AE_INFO, "Invalid Object Type %X", Type)); + ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); return_UINT32 (ACPI_NS_NORMAL); } @@ -965,7 +965,7 @@ AcpiNsOpensScope ( { /* type code out of range */ - ACPI_WARNING ((AE_INFO, "Invalid Object Type %X", Type)); + ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); return_UINT32 (ACPI_NS_NORMAL); } diff --git a/sys/contrib/dev/acpica/parser/psargs.c b/sys/contrib/dev/acpica/parser/psargs.c index 275993d99a9d..609e642a3438 100644 --- a/sys/contrib/dev/acpica/parser/psargs.c +++ b/sys/contrib/dev/acpica/parser/psargs.c @@ -577,7 +577,7 @@ AcpiPsGetNextSimpleArg ( default: - ACPI_ERROR ((AE_INFO, "Invalid ArgType %X", ArgType)); + ACPI_ERROR ((AE_INFO, "Invalid ArgType 0x%X", ArgType)); return_VOID; } @@ -883,7 +883,7 @@ AcpiPsGetNextArg ( default: - ACPI_ERROR ((AE_INFO, "Invalid ArgType: %X", ArgType)); + ACPI_ERROR ((AE_INFO, "Invalid ArgType: 0x%X", ArgType)); Status = AE_AML_OPERAND_TYPE; break; } diff --git a/sys/contrib/dev/acpica/parser/psloop.c b/sys/contrib/dev/acpica/parser/psloop.c index 73bfdf826562..36b4c9abcfbf 100644 --- a/sys/contrib/dev/acpica/parser/psloop.c +++ b/sys/contrib/dev/acpica/parser/psloop.c @@ -228,7 +228,7 @@ AcpiPsGetAmlOpcode ( /* The opcode is unrecognized. Just skip unknown opcodes */ ACPI_ERROR ((AE_INFO, - "Found unknown opcode %X at AML address %p offset %X, ignoring", + "Found unknown opcode 0x%X at AML address %p offset 0x%X, ignoring", WalkState->Opcode, WalkState->ParserState.Aml, WalkState->AmlOffset)); ACPI_DUMP_BUFFER (WalkState->ParserState.Aml, 128); @@ -1149,7 +1149,6 @@ AcpiPsParseLoop ( { ACPI_EXCEPTION ((AE_INFO, Status, "Invoked method did not return a value")); - } ACPI_EXCEPTION ((AE_INFO, Status, "GetPredicate Failed")); diff --git a/sys/contrib/dev/acpica/parser/psxface.c b/sys/contrib/dev/acpica/parser/psxface.c index e9fc45de6898..52a53c94d9aa 100644 --- a/sys/contrib/dev/acpica/parser/psxface.c +++ b/sys/contrib/dev/acpica/parser/psxface.c @@ -120,6 +120,7 @@ #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/acdispat.h> #include <contrib/dev/acpica/include/acinterp.h> +#include <contrib/dev/acpica/include/actables.h> #include <contrib/dev/acpica/include/amlcode.h> @@ -334,6 +335,10 @@ AcpiPsExecuteMethod ( ACPI_FUNCTION_TRACE (PsExecuteMethod); + /* Quick validation of DSDT header */ + + AcpiTbCheckDsdtHeader (); + /* Validate the Info and method Node */ if (!Info || !Info->ResolvedNode) diff --git a/sys/contrib/dev/acpica/resources/rscreate.c b/sys/contrib/dev/acpica/resources/rscreate.c index 8e460d2e53c1..b5a5f6266987 100644 --- a/sys/contrib/dev/acpica/resources/rscreate.c +++ b/sys/contrib/dev/acpica/resources/rscreate.c @@ -301,7 +301,7 @@ AcpiRsCreatePciRoutingTable ( if ((*TopObjectList)->Common.Type != ACPI_TYPE_PACKAGE) { ACPI_ERROR ((AE_INFO, - "(PRT[%X]) Need sub-package, found %s", + "(PRT[%u]) Need sub-package, found %s", Index, AcpiUtGetObjectTypeName (*TopObjectList))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -311,7 +311,7 @@ AcpiRsCreatePciRoutingTable ( if ((*TopObjectList)->Package.Count != 4) { ACPI_ERROR ((AE_INFO, - "(PRT[%X]) Need package of length 4, found length %d", + "(PRT[%u]) Need package of length 4, found length %u", Index, (*TopObjectList)->Package.Count)); return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT); } @@ -328,7 +328,7 @@ AcpiRsCreatePciRoutingTable ( ObjDesc = SubObjectList[0]; if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { - ACPI_ERROR ((AE_INFO, "(PRT[%X].Address) Need Integer, found %s", + ACPI_ERROR ((AE_INFO, "(PRT[%u].Address) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -340,7 +340,7 @@ AcpiRsCreatePciRoutingTable ( ObjDesc = SubObjectList[1]; if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { - ACPI_ERROR ((AE_INFO, "(PRT[%X].Pin) Need Integer, found %s", + ACPI_ERROR ((AE_INFO, "(PRT[%u].Pin) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -378,7 +378,7 @@ AcpiRsCreatePciRoutingTable ( if (ObjDesc->Reference.Class != ACPI_REFCLASS_NAME) { ACPI_ERROR ((AE_INFO, - "(PRT[%X].Source) Need name, found Reference Class %X", + "(PRT[%u].Source) Need name, found Reference Class 0x%X", Index, ObjDesc->Reference.Class)); return_ACPI_STATUS (AE_BAD_DATA); } @@ -426,7 +426,7 @@ AcpiRsCreatePciRoutingTable ( default: ACPI_ERROR ((AE_INFO, - "(PRT[%X].Source) Need Ref/String/Integer, found %s", + "(PRT[%u].Source) Need Ref/String/Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -442,7 +442,7 @@ AcpiRsCreatePciRoutingTable ( if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, - "(PRT[%X].SourceIndex) Need Integer, found %s", + "(PRT[%u].SourceIndex) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } diff --git a/sys/contrib/dev/acpica/resources/rslist.c b/sys/contrib/dev/acpica/resources/rslist.c index 1b73cf218352..b6651473c12d 100644 --- a/sys/contrib/dev/acpica/resources/rslist.c +++ b/sys/contrib/dev/acpica/resources/rslist.c @@ -174,7 +174,7 @@ AcpiRsConvertAmlToResources ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Could not convert AML resource (Type %X)", *Aml)); + "Could not convert AML resource (Type 0x%X)", *Aml)); return_ACPI_STATUS (Status); } @@ -232,7 +232,7 @@ AcpiRsConvertResourcesToAml ( if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) { ACPI_ERROR ((AE_INFO, - "Invalid descriptor type (%X) in resource list", + "Invalid descriptor type (0x%X) in resource list", Resource->Type)); return_ACPI_STATUS (AE_BAD_DATA); } @@ -245,7 +245,7 @@ AcpiRsConvertResourcesToAml ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Could not convert resource (type %X) to AML", + "Could not convert resource (type 0x%X) to AML", Resource->Type)); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/resources/rsmisc.c b/sys/contrib/dev/acpica/resources/rsmisc.c index 37c1a050a7d9..445dea443f11 100644 --- a/sys/contrib/dev/acpica/resources/rsmisc.c +++ b/sys/contrib/dev/acpica/resources/rsmisc.c @@ -171,7 +171,7 @@ AcpiRsConvertAmlToResource ( /* Each internal resource struct is expected to be 32-bit aligned */ ACPI_WARNING ((AE_INFO, - "Misaligned resource pointer (get): %p Type %2.2X Len %X", + "Misaligned resource pointer (get): %p Type 0x%2.2X Length %u", Resource, Resource->Type, Resource->Length)); } @@ -659,7 +659,7 @@ Exit: * "IRQ Format"), so 0x00 and 0x09 are illegal. */ ACPI_ERROR ((AE_INFO, - "Invalid interrupt polarity/trigger in resource list, %X", + "Invalid interrupt polarity/trigger in resource list, 0x%X", Aml->Irq.Flags)); return_ACPI_STATUS (AE_BAD_DATA); } diff --git a/sys/contrib/dev/acpica/tables/tbfadt.c b/sys/contrib/dev/acpica/tables/tbfadt.c index 7f2ae36f435b..af7d068b8622 100644 --- a/sys/contrib/dev/acpica/tables/tbfadt.c +++ b/sys/contrib/dev/acpica/tables/tbfadt.c @@ -388,7 +388,7 @@ AcpiTbCreateLocalFadt ( { ACPI_WARNING ((AE_INFO, "FADT (revision %u) is longer than ACPI 2.0 version, " - "truncating length 0x%X to 0x%X", + "truncating length %u to %u", Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT))); } @@ -521,7 +521,7 @@ AcpiTbConvertFadt ( (Address64->Address != (UINT64) Address32)) { ACPI_ERROR ((AE_INFO, - "32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 32", + "32/64X address mismatch in %s: 0x%8.8X/0x%8.8X%8.8X, using 32", FadtInfoTable[i].Name, Address32, ACPI_FORMAT_UINT64 (Address64->Address))); } @@ -582,7 +582,7 @@ AcpiTbValidateFadt ( { ACPI_WARNING ((AE_INFO, "32/64X FACS address mismatch in FADT - " - "%8.8X/%8.8X%8.8X, using 32", + "0x%8.8X/0x%8.8X%8.8X, using 32", AcpiGbl_FADT.Facs, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XFacs))); AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs; @@ -593,7 +593,7 @@ AcpiTbValidateFadt ( { ACPI_WARNING ((AE_INFO, "32/64X DSDT address mismatch in FADT - " - "%8.8X/%8.8X%8.8X, using 32", + "0x%8.8X/0x%8.8X%8.8X, using 32", AcpiGbl_FADT.Dsdt, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XDsdt))); AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt; @@ -621,7 +621,7 @@ AcpiTbValidateFadt ( (Address64->BitWidth != ACPI_MUL_8 (Length))) { ACPI_WARNING ((AE_INFO, - "32/64X length mismatch in %s: %d/%d", + "32/64X length mismatch in %s: %u/%u", Name, ACPI_MUL_8 (Length), Address64->BitWidth)); } @@ -635,7 +635,7 @@ AcpiTbValidateFadt ( { ACPI_ERROR ((AE_INFO, "Required field %s has zero address and/or length:" - " %8.8X%8.8X/%X", + " 0x%8.8X%8.8X/0x%X", Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); } } @@ -651,7 +651,7 @@ AcpiTbValidateFadt ( { ACPI_WARNING ((AE_INFO, "Optional field %s has zero address or length: " - "%8.8X%8.8X/%X", + "0x%8.8X%8.8X/0x%X", Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); } } @@ -702,7 +702,7 @@ AcpiTbSetupFadtRegisters ( (FadtInfoTable[i].DefaultLength != Target64->BitWidth)) { ACPI_WARNING ((AE_INFO, - "Invalid length for %s: %d, using default %d", + "Invalid length for %s: %u, using default %u", FadtInfoTable[i].Name, Target64->BitWidth, FadtInfoTable[i].DefaultLength)); diff --git a/sys/contrib/dev/acpica/tables/tbutils.c b/sys/contrib/dev/acpica/tables/tbutils.c index 25b0652943b5..916c04e02415 100644 --- a/sys/contrib/dev/acpica/tables/tbutils.c +++ b/sys/contrib/dev/acpica/tables/tbutils.c @@ -349,7 +349,7 @@ AcpiTbVerifyChecksum ( if (Checksum) { ACPI_WARNING ((AE_INFO, - "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", + "Incorrect checksum in table [%4.4s] - 0x%2.2X, should be 0x%2.2X", Table->Signature, Table->Checksum, (UINT8) (Table->Checksum - Checksum))); @@ -393,6 +393,88 @@ AcpiTbChecksum ( } +/******************************************************************************* + * + * FUNCTION: AcpiTbCheckDsdtHeader + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Quick compare to check validity of the DSDT. This will detect + * if the DSDT has been replaced from outside the OS and/or if + * the DSDT header has been corrupted. + * + ******************************************************************************/ + +void +AcpiTbCheckDsdtHeader ( + void) +{ + + /* Compare original length and checksum to current values */ + + if (AcpiGbl_OriginalDsdtHeader.Length != AcpiGbl_DSDT->Length || + AcpiGbl_OriginalDsdtHeader.Checksum != AcpiGbl_DSDT->Checksum) + { + ACPI_ERROR ((AE_INFO, + "The DSDT has been corrupted or replaced - old, new headers below")); + AcpiTbPrintTableHeader (0, &AcpiGbl_OriginalDsdtHeader); + AcpiTbPrintTableHeader (0, AcpiGbl_DSDT); + + /* Disable further error messages */ + + AcpiGbl_OriginalDsdtHeader.Length = AcpiGbl_DSDT->Length; + AcpiGbl_OriginalDsdtHeader.Checksum = AcpiGbl_DSDT->Checksum; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbCopyDsdt + * + * PARAMETERS: TableDesc - Installed table to copy + * + * RETURN: None + * + * DESCRIPTION: Implements a subsystem option to copy the DSDT to local memory. + * Some very bad BIOSs are known to either corrupt the DSDT or + * install a new, bad DSDT. This copy works around the problem. + * + ******************************************************************************/ + +ACPI_TABLE_HEADER * +AcpiTbCopyDsdt ( + UINT32 TableIndex) +{ + ACPI_TABLE_HEADER *NewTable; + ACPI_TABLE_DESC *TableDesc; + + + TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex]; + + NewTable = ACPI_ALLOCATE (TableDesc->Length); + if (!NewTable) + { + ACPI_ERROR ((AE_INFO, "Could not copy DSDT of length 0x%X", + TableDesc->Length)); + return (NULL); + } + + ACPI_MEMCPY (NewTable, TableDesc->Pointer, TableDesc->Length); + AcpiTbDeleteTable (TableDesc); + TableDesc->Pointer = NewTable; + TableDesc->Flags = ACPI_TABLE_ORIGIN_ALLOCATED; + + ACPI_INFO ((AE_INFO, + "Forced DSDT copy: length 0x%05X copied locally, original unmapped", + NewTable->Length)); + + return (NewTable); +} + + /******************************************************************************* * * FUNCTION: AcpiTbInstallTable @@ -567,7 +649,7 @@ AcpiTbGetRootTableEntry ( /* Will truncate 64-bit address to 32 bits, issue warning */ ACPI_WARNING ((AE_INFO, - "64-bit Physical Address in XSDT is too large (%8.8X%8.8X)," + "64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X)," " truncating", ACPI_FORMAT_UINT64 (Address64))); } diff --git a/sys/contrib/dev/acpica/tables/tbxface.c b/sys/contrib/dev/acpica/tables/tbxface.c index 26f9472c5aa0..e2eeb2e5aed3 100644 --- a/sys/contrib/dev/acpica/tables/tbxface.c +++ b/sys/contrib/dev/acpica/tables/tbxface.c @@ -265,6 +265,7 @@ AcpiReallocateRootTable ( { ACPI_TABLE_DESC *Tables; ACPI_SIZE NewSize; + ACPI_SIZE CurrentSize; ACPI_FUNCTION_TRACE (AcpiReallocateRootTable); @@ -279,9 +280,15 @@ AcpiReallocateRootTable ( return_ACPI_STATUS (AE_SUPPORT); } - NewSize = ((ACPI_SIZE) AcpiGbl_RootTableList.Count + - ACPI_ROOT_TABLE_SIZE_INCREMENT) * - sizeof (ACPI_TABLE_DESC); + /* + * Get the current size of the root table and add the default + * increment to create the new table size. + */ + CurrentSize = (ACPI_SIZE) + AcpiGbl_RootTableList.Count * sizeof (ACPI_TABLE_DESC); + + NewSize = CurrentSize + + (ACPI_ROOT_TABLE_SIZE_INCREMENT * sizeof (ACPI_TABLE_DESC)); /* Create new array and copy the old array */ @@ -291,10 +298,16 @@ AcpiReallocateRootTable ( return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, NewSize); + ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, CurrentSize); - AcpiGbl_RootTableList.Size = AcpiGbl_RootTableList.Count; + /* + * Update the root table descriptor. The new size will be the current + * number of tables plus the increment, independent of the reserved + * size of the original table list. + */ AcpiGbl_RootTableList.Tables = Tables; + AcpiGbl_RootTableList.Size = + AcpiGbl_RootTableList.Count + ACPI_ROOT_TABLE_SIZE_INCREMENT; AcpiGbl_RootTableList.Flags = ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE; @@ -534,6 +547,7 @@ AcpiTbLoadNamespace ( { ACPI_STATUS Status; UINT32 i; + ACPI_TABLE_HEADER *NewDsdt; ACPI_FUNCTION_TRACE (TbLoadNamespace); @@ -542,30 +556,50 @@ AcpiTbLoadNamespace ( (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* - * Load the namespace. The DSDT is required, but any SSDT and PSDT tables - * are optional. + * Load the namespace. The DSDT is required, but any SSDT and + * PSDT tables are optional. Verify the DSDT. */ if (!AcpiGbl_RootTableList.Count || !ACPI_COMPARE_NAME ( &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature), ACPI_SIG_DSDT) || - ACPI_FAILURE (AcpiTbVerifyTable ( + ACPI_FAILURE (AcpiTbVerifyTable ( &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]))) { Status = AE_NO_ACPI_TABLES; goto UnlockAndExit; } - /* A valid DSDT is required */ + /* + * Save the DSDT pointer for simple access. This is the mapped memory + * address. We must take care here because the address of the .Tables + * array can change dynamically as tables are loaded at run-time. Note: + * .Pointer field is not validated until after call to AcpiTbVerifyTable. + */ + AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer; - Status = AcpiTbVerifyTable ( - &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]); - if (ACPI_FAILURE (Status)) + /* + * Optionally copy the entire DSDT to local memory (instead of simply + * mapping it.) There are some BIOSs that corrupt or replace the original + * DSDT, creating the need for this option. Default is FALSE, do not copy + * the DSDT. + */ + if (AcpiGbl_CopyDsdtLocally) { - Status = AE_NO_ACPI_TABLES; - goto UnlockAndExit; + NewDsdt = AcpiTbCopyDsdt (ACPI_TABLE_INDEX_DSDT); + if (NewDsdt) + { + AcpiGbl_DSDT = NewDsdt; + } } + /* + * Save the original DSDT header for detection of table corruption + * and/or replacement of the DSDT from outside the OS. + */ + ACPI_MEMCPY (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, + sizeof (ACPI_TABLE_HEADER)); + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); /* Load and parse tables */ diff --git a/sys/contrib/dev/acpica/tables/tbxfroot.c b/sys/contrib/dev/acpica/tables/tbxfroot.c index 021e2b60a050..9f955e8282d8 100644 --- a/sys/contrib/dev/acpica/tables/tbxfroot.c +++ b/sys/contrib/dev/acpica/tables/tbxfroot.c @@ -227,7 +227,7 @@ AcpiFindRootPointer ( if (!TablePtr) { ACPI_ERROR ((AE_INFO, - "Could not map memory at %8.8X for length %X", + "Could not map memory at 0x%8.8X for length %u", ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); return_ACPI_STATUS (AE_NO_MEMORY); @@ -254,7 +254,7 @@ AcpiFindRootPointer ( if (!TablePtr) { ACPI_ERROR ((AE_INFO, - "Could not map memory at %8.8X for length %X", + "Could not map memory at 0x%8.8X for length %u", PhysicalAddress, ACPI_EBDA_WINDOW_SIZE)); return_ACPI_STATUS (AE_NO_MEMORY); @@ -284,7 +284,7 @@ AcpiFindRootPointer ( if (!TablePtr) { ACPI_ERROR ((AE_INFO, - "Could not map memory at %8.8X for length %X", + "Could not map memory at 0x%8.8X for length %u", ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/sys/contrib/dev/acpica/utilities/utalloc.c b/sys/contrib/dev/acpica/utilities/utalloc.c index 8c6ed0b60bfa..82f81243763b 100644 --- a/sys/contrib/dev/acpica/utilities/utalloc.c +++ b/sys/contrib/dev/acpica/utilities/utalloc.c @@ -438,7 +438,7 @@ AcpiUtAllocate ( /* Report allocation error */ ACPI_WARNING ((Module, Line, - "Could not allocate size %X", (UINT32) Size)); + "Could not allocate size %u", (UINT32) Size)); return_PTR (NULL); } diff --git a/sys/contrib/dev/acpica/utilities/utdelete.c b/sys/contrib/dev/acpica/utilities/utdelete.c index bd6490dac3b0..f726cf9d1570 100644 --- a/sys/contrib/dev/acpica/utilities/utdelete.c +++ b/sys/contrib/dev/acpica/utilities/utdelete.c @@ -539,7 +539,7 @@ AcpiUtUpdateRefCount ( default: - ACPI_ERROR ((AE_INFO, "Unknown action (%X)", Action)); + ACPI_ERROR ((AE_INFO, "Unknown action (0x%X)", Action)); break; } @@ -550,7 +550,7 @@ AcpiUtUpdateRefCount ( if (Count > ACPI_MAX_REFERENCE_COUNT) { ACPI_WARNING ((AE_INFO, - "Large Reference Count (%X) in object %p", Count, Object)); + "Large Reference Count (0x%X) in object %p", Count, Object)); } } diff --git a/sys/contrib/dev/acpica/utilities/uteval.c b/sys/contrib/dev/acpica/utilities/uteval.c index be1e45e1aa9b..c0790b405a57 100644 --- a/sys/contrib/dev/acpica/utilities/uteval.c +++ b/sys/contrib/dev/acpica/utilities/uteval.c @@ -381,7 +381,7 @@ AcpiUtEvaluateObject ( PrefixNode, Path, AE_TYPE); ACPI_ERROR ((AE_INFO, - "Type returned from %s was incorrect: %s, expected Btypes: %X", + "Type returned from %s was incorrect: %s, expected Btypes: 0x%X", Path, AcpiUtGetObjectTypeName (Info->ReturnObject), ExpectedReturnBtypes)); diff --git a/sys/contrib/dev/acpica/utilities/utglobal.c b/sys/contrib/dev/acpica/utilities/utglobal.c index df32fc069f86..85a93fe77a6e 100644 --- a/sys/contrib/dev/acpica/utilities/utglobal.c +++ b/sys/contrib/dev/acpica/utilities/utglobal.c @@ -916,6 +916,7 @@ AcpiUtInitGlobals ( /* Miscellaneous variables */ + AcpiGbl_DSDT = NULL; AcpiGbl_CmSingleStep = FALSE; AcpiGbl_DbTerminateThreads = FALSE; AcpiGbl_Shutdown = FALSE; diff --git a/sys/contrib/dev/acpica/utilities/utmisc.c b/sys/contrib/dev/acpica/utilities/utmisc.c index 3bef62c1c6ec..1075b0e39b66 100644 --- a/sys/contrib/dev/acpica/utilities/utmisc.c +++ b/sys/contrib/dev/acpica/utilities/utmisc.c @@ -308,7 +308,7 @@ AcpiUtAllocateOwnerId ( if (*OwnerId) { - ACPI_ERROR ((AE_INFO, "Owner ID [%2.2X] already exists", *OwnerId)); + ACPI_ERROR ((AE_INFO, "Owner ID [0x%2.2X] already exists", *OwnerId)); return_ACPI_STATUS (AE_ALREADY_EXISTS); } @@ -427,7 +427,7 @@ AcpiUtReleaseOwnerId ( if (OwnerId == 0) { - ACPI_ERROR ((AE_INFO, "Invalid OwnerId: %2.2X", OwnerId)); + ACPI_ERROR ((AE_INFO, "Invalid OwnerId: 0x%2.2X", OwnerId)); return_VOID; } @@ -457,7 +457,7 @@ AcpiUtReleaseOwnerId ( else { ACPI_ERROR ((AE_INFO, - "Release of non-allocated OwnerId: %2.2X", OwnerId + 1)); + "Release of non-allocated OwnerId: 0x%2.2X", OwnerId + 1)); } (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); diff --git a/sys/contrib/dev/acpica/utilities/utmutex.c b/sys/contrib/dev/acpica/utilities/utmutex.c index d0d47d496d72..2231ab696f3d 100644 --- a/sys/contrib/dev/acpica/utilities/utmutex.c +++ b/sys/contrib/dev/acpica/utilities/utmutex.c @@ -374,7 +374,7 @@ AcpiUtAcquireMutex ( else { ACPI_EXCEPTION ((AE_INFO, Status, - "Thread %p could not acquire Mutex [%X]", + "Thread %p could not acquire Mutex [0x%X]", ACPI_CAST_PTR (void, ThisThreadId), MutexId)); } @@ -419,7 +419,7 @@ AcpiUtReleaseMutex ( if (AcpiGbl_MutexInfo[MutexId].ThreadId == ACPI_MUTEX_NOT_ACQUIRED) { ACPI_ERROR ((AE_INFO, - "Mutex [%X] is not acquired, cannot release", MutexId)); + "Mutex [0x%X] is not acquired, cannot release", MutexId)); return (AE_NOT_ACQUIRED); } diff --git a/sys/contrib/dev/acpica/utilities/utobject.c b/sys/contrib/dev/acpica/utilities/utobject.c index f3ec7920c4fe..f83c86b36783 100644 --- a/sys/contrib/dev/acpica/utilities/utobject.c +++ b/sys/contrib/dev/acpica/utilities/utobject.c @@ -354,7 +354,7 @@ AcpiUtCreateBufferObject ( Buffer = ACPI_ALLOCATE_ZEROED (BufferSize); if (!Buffer) { - ACPI_ERROR ((AE_INFO, "Could not allocate size %X", + ACPI_ERROR ((AE_INFO, "Could not allocate size %u", (UINT32) BufferSize)); AcpiUtRemoveReference (BufferDesc); return_PTR (NULL); @@ -413,7 +413,7 @@ AcpiUtCreateStringObject ( String = ACPI_ALLOCATE_ZEROED (StringSize + 1); if (!String) { - ACPI_ERROR ((AE_INFO, "Could not allocate size %X", + ACPI_ERROR ((AE_INFO, "Could not allocate size %u", (UINT32) StringSize)); AcpiUtRemoveReference (StringDesc); return_PTR (NULL); @@ -671,7 +671,7 @@ AcpiUtGetSimpleObjectSize ( * required eventually. */ ACPI_ERROR ((AE_INFO, "Cannot convert to external object - " - "unsupported Reference Class [%s] %X in object %p", + "unsupported Reference Class [%s] 0x%X in object %p", AcpiUtGetReferenceName (InternalObject), InternalObject->Reference.Class, InternalObject)); Status = AE_TYPE; @@ -683,7 +683,7 @@ AcpiUtGetSimpleObjectSize ( default: ACPI_ERROR ((AE_INFO, "Cannot convert to external object - " - "unsupported type [%s] %X in object %p", + "unsupported type [%s] 0x%X in object %p", AcpiUtGetObjectTypeName (InternalObject), InternalObject->Common.Type, InternalObject)); Status = AE_TYPE; diff --git a/sys/contrib/dev/acpica/utilities/uttrack.c b/sys/contrib/dev/acpica/utilities/uttrack.c index 5c48544792e6..ddb35ef891c2 100644 --- a/sys/contrib/dev/acpica/utilities/uttrack.c +++ b/sys/contrib/dev/acpica/utilities/uttrack.c @@ -282,7 +282,7 @@ AcpiUtAllocateZeroedAndTrack ( /* Report allocation error */ ACPI_ERROR ((Module, Line, - "Could not allocate size %X", (UINT32) Size)); + "Could not allocate size %u", (UINT32) Size)); return (NULL); } @@ -715,7 +715,7 @@ AcpiUtDumpAllocations ( else { ACPI_ERROR ((AE_INFO, - "%d(%X) Outstanding allocations", + "%d(0x%X) Outstanding allocations", NumOutstanding, NumOutstanding)); } diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 28bde01d1add..ec3fce5f6bf4 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -162,6 +162,7 @@ static int acpi_sname2sstate(const char *sname); static const char *acpi_sstate2sname(int sstate); static int acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS); +static int acpi_debug_objects_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_pm_func(u_long cmd, void *arg, ...); static int acpi_child_location_str_method(device_t acdev, device_t child, char *buf, size_t buflen); @@ -253,6 +254,19 @@ SYSCTL_STRING(_debug_acpi, OID_AUTO, acpi_ca_version, CTLFLAG_RD, static int acpi_serialize_methods; TUNABLE_INT("hw.acpi.serialize_methods", &acpi_serialize_methods); +/* Allow users to dump Debug objects without ACPI debugger. */ +static int acpi_debug_objects; +TUNABLE_INT("debug.acpi.enable_debug_objects", &acpi_debug_objects); +SYSCTL_PROC(_debug_acpi, OID_AUTO, enable_debug_objects, + CTLFLAG_RW | CTLTYPE_INT, NULL, 0, acpi_debug_objects_sysctl, "I", + "Enable Debug objects"); + +/* Allow the interpreter to ignore common mistakes in BIOS. */ +static int acpi_interpreter_slack = 1; +TUNABLE_INT("debug.acpi.interpreter_slack", &acpi_interpreter_slack); +SYSCTL_INT(_debug_acpi, OID_AUTO, interpreter_slack, CTLFLAG_RDTUN, + &acpi_interpreter_slack, 1, "Turn on interpreter slack mode."); + /* Power devices off and on in suspend and resume. XXX Remove once tested. */ static int acpi_do_powerstate = 1; TUNABLE_INT("debug.acpi.do_powerstate", &acpi_do_powerstate); @@ -452,8 +466,17 @@ acpi_attach(device_t dev) * Set the globals from our tunables. This is needed because ACPI-CA * uses UINT8 for some values and we have no tunable_byte. */ - AcpiGbl_AllMethodsSerialized = acpi_serialize_methods; - AcpiGbl_EnableInterpreterSlack = TRUE; + AcpiGbl_AllMethodsSerialized = acpi_serialize_methods ? TRUE : FALSE; + AcpiGbl_EnableInterpreterSlack = acpi_interpreter_slack ? TRUE : FALSE; + AcpiGbl_EnableAmlDebugObject = acpi_debug_objects ? TRUE : FALSE; + +#ifndef ACPI_DEBUG + /* + * Disable all debugging layers and levels. + */ + AcpiDbgLayer = 0; + AcpiDbgLevel = 0; +#endif /* Start up the ACPI CA subsystem. */ status = AcpiInitializeSubsystem(); @@ -2629,25 +2652,6 @@ acpi_resync_clock(struct acpi_softc *sc) inittodr(time_second + sc->acpi_sleep_delay); } -/* Initialize a device's wake GPE. */ -int -acpi_wake_init(device_t dev, int type) -{ - struct acpi_prw_data prw; - - /* Evaluate _PRW to find the GPE. */ - if (acpi_parse_prw(acpi_get_handle(dev), &prw) != 0) - return (ENXIO); - - /* Set the requested type for the GPE (runtime, wake, or both). */ - if (ACPI_FAILURE(AcpiSetGpeType(prw.gpe_handle, prw.gpe_bit, type))) { - device_printf(dev, "set GPE type failed\n"); - return (ENXIO); - } - - return (0); -} - /* Enable or disable the device's wake GPE. */ int acpi_wake_set_enable(device_t dev, int enable) @@ -2662,14 +2666,16 @@ acpi_wake_set_enable(device_t dev, int enable) flags = acpi_get_flags(dev); if (enable) { - status = AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); + status = AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit, + ACPI_GPE_TYPE_WAKE_RUN); if (ACPI_FAILURE(status)) { device_printf(dev, "enable wake failed\n"); return (ENXIO); } acpi_set_flags(dev, flags | ACPI_FLAG_WAKE_ENABLED); } else { - status = AcpiDisableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); + status = AcpiDisableGpe(prw.gpe_handle, prw.gpe_bit, + ACPI_GPE_TYPE_WAKE); if (ACPI_FAILURE(status)) { device_printf(dev, "disable wake failed\n"); return (ENXIO); @@ -2699,7 +2705,7 @@ acpi_wake_sleep_prep(ACPI_HANDLE handle, int sstate) * and set _PSW. */ if (sstate > prw.lowest_wake) { - AcpiDisableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); + AcpiDisableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_GPE_TYPE_WAKE); if (bootverbose) device_printf(dev, "wake_prep disabled wake for %s (S%d)\n", acpi_name(handle), sstate); @@ -2736,7 +2742,7 @@ acpi_wake_run_prep(ACPI_HANDLE handle, int sstate) * clear _PSW and turn off any power resources it used. */ if (sstate > prw.lowest_wake) { - AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_NOT_ISR); + AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit, ACPI_GPE_TYPE_WAKE_RUN); if (bootverbose) device_printf(dev, "run_prep re-enabled %s\n", acpi_name(handle)); } else { @@ -3534,6 +3540,26 @@ SYSCTL_PROC(_debug_acpi, OID_AUTO, level, CTLFLAG_RW | CTLTYPE_STRING, "debug.acpi.level", 0, acpi_debug_sysctl, "A", ""); #endif /* ACPI_DEBUG */ +static int +acpi_debug_objects_sysctl(SYSCTL_HANDLER_ARGS) +{ + int error; + int old; + + old = acpi_debug_objects; + error = sysctl_handle_int(oidp, &acpi_debug_objects, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (old == acpi_debug_objects || (old && acpi_debug_objects)) + return (0); + + ACPI_SERIAL_BEGIN(acpi); + AcpiGbl_EnableAmlDebugObject = acpi_debug_objects ? TRUE : FALSE; + ACPI_SERIAL_END(acpi); + + return (0); +} + static int acpi_pm_func(u_long cmd, void *arg, ...) { diff --git a/sys/dev/acpica/acpi_button.c b/sys/dev/acpica/acpi_button.c index 7814c0e3fdf5..56a1d951f793 100644 --- a/sys/dev/acpica/acpi_button.c +++ b/sys/dev/acpica/acpi_button.c @@ -164,7 +164,6 @@ acpi_button_attach(device_t dev) } /* Enable the GPE for wake/runtime. */ - acpi_wake_init(dev, ACPI_GPE_TYPE_WAKE_RUN); acpi_wake_set_enable(dev, 1); return_VALUE (0); diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index d4ef0191b887..000658c18484 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -518,14 +518,8 @@ acpi_ec_attach(device_t dev) } /* Enable runtime GPEs for the handler. */ - Status = AcpiSetGpeType(sc->ec_gpehandle, sc->ec_gpebit, - ACPI_GPE_TYPE_RUNTIME); - if (ACPI_FAILURE(Status)) { - device_printf(dev, "AcpiSetGpeType failed: %s\n", - AcpiFormatException(Status)); - goto error; - } - Status = AcpiEnableGpe(sc->ec_gpehandle, sc->ec_gpebit, ACPI_NOT_ISR); + Status = AcpiEnableGpe(sc->ec_gpehandle, sc->ec_gpebit, + ACPI_GPE_TYPE_RUNTIME); if (ACPI_FAILURE(Status)) { device_printf(dev, "AcpiEnableGpe failed: %s\n", AcpiFormatException(Status)); @@ -575,7 +569,7 @@ acpi_ec_shutdown(device_t dev) /* Disable the GPE so we don't get EC events during shutdown. */ sc = device_get_softc(dev); - AcpiDisableGpe(sc->ec_gpehandle, sc->ec_gpebit, ACPI_NOT_ISR); + AcpiDisableGpe(sc->ec_gpehandle, sc->ec_gpebit, ACPI_GPE_TYPE_RUNTIME); return (0); } diff --git a/sys/dev/acpica/acpi_lid.c b/sys/dev/acpica/acpi_lid.c index 47d5b45c1f9d..ae29aca923cd 100644 --- a/sys/dev/acpica/acpi_lid.c +++ b/sys/dev/acpica/acpi_lid.c @@ -115,7 +115,6 @@ acpi_lid_attach(device_t dev) acpi_lid_notify_handler, sc); /* Enable the GPE for wake/runtime. */ - acpi_wake_init(dev, ACPI_GPE_TYPE_WAKE_RUN); acpi_wake_set_enable(dev, 1); return (0); diff --git a/sys/dev/acpica/acpi_video.c b/sys/dev/acpica/acpi_video.c index 94ef7be655b7..a8625de89b7a 100644 --- a/sys/dev/acpica/acpi_video.c +++ b/sys/dev/acpica/acpi_video.c @@ -584,8 +584,8 @@ acpi_video_vo_bind(struct acpi_video_output *vo, ACPI_HANDLE handle) vo->vo_economy = vo->vo_levels[BCL_ECONOMY]; } if (vo->vo_levels != NULL) - AcpiInstallNotifyHandler(handle, ACPI_DEVICE_NOTIFY, - acpi_video_vo_notify_handler, vo); + AcpiInstallNotifyHandler(handle, ACPI_DEVICE_NOTIFY, + acpi_video_vo_notify_handler, vo); ACPI_SERIAL_END(video_output); } diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 5c827f2b5340..b0f2c93b8f74 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -334,7 +334,6 @@ int acpi_ReqSleepState(struct acpi_softc *sc, int state); int acpi_AckSleepState(struct apm_clone_data *clone, int error); ACPI_STATUS acpi_SetSleepState(struct acpi_softc *sc, int state); void acpi_resync_clock(struct acpi_softc *sc); -int acpi_wake_init(device_t dev, int type); int acpi_wake_set_enable(device_t dev, int enable); int acpi_parse_prw(ACPI_HANDLE h, struct acpi_prw_data *prw); ACPI_STATUS acpi_Startup(void); diff --git a/sys/modules/acpi/acpi/Makefile b/sys/modules/acpi/acpi/Makefile index 992c59c09a6a..6fa36ffcd707 100644 --- a/sys/modules/acpi/acpi/Makefile +++ b/sys/modules/acpi/acpi/Makefile @@ -1,11 +1,11 @@ # $FreeBSD$ -.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" -.error "ACPI can only be compiled into the kernel on the amd64 and ia64 platforms" +.if ${MACHINE_ARCH} == "ia64" +.error "ACPI can only be compiled into the kernel on the ia64 platform" .endif -.if ${MACHINE} != "i386" -.error "The ACPI module is only for i386" +.if ${MACHINE} != "amd64" && ${MACHINE} != "i386" +.error "The ACPI module is only for amd64 and i386" .endif .PATH: ${.CURDIR}/../../../contrib/dev/acpica/debugger \ @@ -35,10 +35,10 @@ SRCS+= dsfield.c dsinit.c dsmethod.c dsmthdat.c dsobject.c dsopcode.c SRCS+= dsutils.c dswexec.c dswload.c dswscope.c dswstate.c SRCS+= evevent.c evgpe.c evgpeblk.c evmisc.c evregion.c evrgnini.c evsci.c SRCS+= evxface.c evxfevnt.c evxfregn.c -SRCS+= exconfig.c exconvrt.c excreate.c exdump.c exfield.c exfldio.c exmisc.c -SRCS+= exmutex.c exnames.c exoparg1.c exoparg2.c exoparg3.c exoparg6.c -SRCS+= exprep.c exregion.c exresnte.c exresolv.c exresop.c exstore.c -SRCS+= exstoren.c exstorob.c exsystem.c exutils.c +SRCS+= exconfig.c exconvrt.c excreate.c exdebug.c exdump.c exfield.c +SRCS+= exfldio.c exmisc.c exmutex.c exnames.c exoparg1.c exoparg2.c +SRCS+= exoparg3.c exoparg6.c exprep.c exregion.c exresnte.c exresolv.c +SRCS+= exresop.c exstore.c exstoren.c exstorob.c exsystem.c exutils.c SRCS+= hwacpi.c hwgpe.c hwregs.c hwsleep.c hwtimer.c hwvalid.c hwxface.c SRCS+= nsaccess.c nsalloc.c nsdump.c nseval.c nsinit.c nsload.c nsnames.c SRCS+= nsobject.c nsparse.c nspredef.c nsrepair.c nsrepair2.c nssearch.c @@ -97,9 +97,13 @@ opt_ddb.h: Makefile SRCS+= acpi_machdep.c acpi_wakecode.h acpi_wakeup.c SRCS+= assym.s madt.c CLEANFILES+= acpi_wakecode.bin acpi_wakecode.h acpi_wakecode.o + .if ${MACHINE_ARCH} == "amd64" -SRCS+= opt_global.h +SRCS+= acpi_switch.S opt_global.h CLEANFILES+= acpi_wakedata.h +ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} +acpi_switch.o: acpi_switch.S + ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC} .endif acpi_wakecode.h: acpi_wakecode.S assym.s diff --git a/usr.sbin/acpi/acpidb/Makefile b/usr.sbin/acpi/acpidb/Makefile index 5981f38d3dbd..c2fe844367b7 100644 --- a/usr.sbin/acpi/acpidb/Makefile +++ b/usr.sbin/acpi/acpidb/Makefile @@ -25,11 +25,11 @@ SRCS+= dsfield.c dsinit.c dsmethod.c dsmthdat.c dsobject.c \ dswstate.c # interpreter/executer -SRCS+= exconfig.c exconvrt.c excreate.c exdump.c exfield.c \ - exfldio.c exmisc.c exmutex.c exnames.c exoparg1.c \ - exoparg2.c exoparg3.c exoparg6.c exprep.c exregion.c \ - exresnte.c exresolv.c exresop.c exstore.c exstoren.c \ - exstorob.c exsystem.c exutils.c +SRCS+= exconfig.c exconvrt.c excreate.c exdebug.c exdump.c \ + exfield.c exfldio.c exmisc.c exmutex.c exnames.c \ + exoparg1.c exoparg2.c exoparg3.c exoparg6.c exprep.c \ + exregion.c exresnte.c exresolv.c exresop.c exstore.c \ + exstoren.c exstorob.c exsystem.c exutils.c # interpreter/parser SRCS+= psargs.c psloop.c psopcode.c psparse.c psscope.c \ diff --git a/usr.sbin/acpi/iasl/Makefile b/usr.sbin/acpi/iasl/Makefile index ff6ebd7fbee8..98b0c2386491 100644 --- a/usr.sbin/acpi/iasl/Makefile +++ b/usr.sbin/acpi/iasl/Makefile @@ -13,9 +13,9 @@ SRCS+= aslanalyze.c aslcodegen.c aslcompile.c aslcompiler.y.h \ aslcompilerlex.l aslcompilerparse.y aslerror.c \ aslfiles.c aslfold.c asllength.c asllisting.c \ aslload.c asllookup.c aslmain.c aslmap.c aslopcodes.c \ - asloperands.c aslopt.c aslresource.c aslrestype1.c \ - aslrestype2.c aslstartup.c aslstubs.c asltransform.c \ - asltree.c aslutils.c + asloperands.c aslopt.c aslpredef.c aslresource.c \ + aslrestype1.c aslrestype2.c aslstartup.c aslstubs.c \ + asltransform.c asltree.c aslutils.c # debugger SRCS+= dbfileio.c