diff options
Diffstat (limited to 'sys/contrib')
41 files changed, 1070 insertions, 105 deletions
diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh index b82586d..4a467a1 100755 --- a/sys/contrib/dev/acpica/acpica_prep.sh +++ b/sys/contrib/dev/acpica/acpica_prep.sh @@ -21,7 +21,7 @@ stripdirs="generate libraries tests tools" stripfiles="Makefile README accygwin.h acefi.h achaiku.h acintel.h \ aclinux.h acmacosx.h acmsvc.h acnetbsd.h acos2.h acwin.h \ acwin64.h new_table.txt osfreebsdtbl.c oslinuxtbl.c osunixdir.c \ - oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c" + osunixmap.c oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c" # include files to canonify src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h \ diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 83c156b..ab43358 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,4 +1,88 @@ ---------------------------------------- +23 August 2013. Summary of changes for version 20130823: + +1) ACPICA kernel-resident subsystem: + +Implemented support for host-installed System Control Interrupt (SCI) +handlers. Certain ACPI functionality requires the host to handle raw +SCIs. For example, the "SCI Doorbell" that is defined for memory power +state support requires the host device driver to handle SCIs to examine +if the doorbell has been activated. Multiple SCI handlers can be +installed to allow for future expansion. New external interfaces are +AcpiInstallSciHandler, AcpiRemoveSciHandler; see the ACPICA reference for +details. Lv Zheng, Bob Moore. ACPICA BZ 1032. + +Operation region support: Never locally free the handler "context" +pointer. This change removes some dangerous code that attempts to free +the handler context pointer in some (rare) circumstances. The owner of +the handler owns this pointer and the ACPICA code should never touch it. +Although not seen to be an issue in any kernel, it did show up as a +problem (fault) under AcpiExec. Also, set the internal storage field for +the context pointer to zero when the region is deactivated, simply for +sanity. David Box. ACPICA BZ 1039. + +AcpiRead: On error, do not modify the return value target location. If an +error happens in the middle of a split 32/32 64-bit I/O operation, do not +modify the target of the return value pointer. Makes the code consistent +with the rest of ACPICA. Bjorn Helgaas. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 96.7K Code, 27.1K Data, 123.9K Total + Debug Version: 184.4K Code, 76.8K Data, 261.2K Total + Previous Release: + Non-Debug Version: 96.2K Code, 27.1K Data, 123.3K Total + Debug Version: 185.4K Code, 77.1K Data, 262.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiDump: Implemented several new features and fixed some problems: +1) Added support to dump the RSDP, RSDT, and XSDT tables. +2) Added support for multiple table instances (SSDT, UEFI). +3) Added option to dump "customized" (overridden) tables (-c). +4) Fixed a problem where some table filenames were improperly +constructed. +5) Improved some error messages, removed some unnecessary messages. + +iASL: Implemented additional support for disassembly of ACPI tables that +contain invocations of external control methods. The -fe<file> option +allows the import of a file that specifies the external methods along +with the required number of arguments for each -- allowing for the +correct disassembly of the table. This is a workaround for a limitation +of AML code where the disassembler often cannot determine the number of +arguments required for an external control method and generates incorrect +ASL code. See the iASL reference for details. ACPICA BZ 1030. + +Debugger: Implemented a new command (paths) that displays the full +pathnames (namepaths) and object types of all objects in the namespace. +This is an alternative to the namespace command. + +Debugger: Implemented a new command (sci) that invokes the SCI dispatch +mechanism and any installed handlers. + +iASL: Fixed a possible segfault for "too many parent prefixes" condition. +This can occur if there are too many parent prefixes in a namepath (for +example, ^^^^^^PCI0.ECRD). ACPICA BZ 1035. + +Application OSLs: Set the return value for the PCI read functions. These +functions simply return AE_OK, but should set the return value to zero +also. This change implements this. ACPICA BZ 1038. + +Debugger: Prevent possible command line buffer overflow. Increase the +size of a couple of the debugger line buffers, and ensure that overflow +cannot happen. ACPICA BZ 1037. + +iASL: Changed to abort immediately on serious errors during the parsing +phase. Due to the nature of ASL, there is no point in attempting to +compile these types of errors, and they typically end up causing a +cascade of hundreds of errors which obscure the original problem. + +---------------------------------------- 25 July 2013. Summary of changes for version 20130725: 1) ACPICA kernel-resident subsystem: diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index 6065bd1..c361a6a 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -341,6 +341,10 @@ AdAmlDisassemble ( { AcpiDmClearExternalList (); } + + /* Load any externals defined in the optional external ref file */ + + AcpiDmGetExternalsFromFile (); } else { diff --git a/sys/contrib/dev/acpica/common/adwalk.c b/sys/contrib/dev/acpica/common/adwalk.c index fb136b9..80f6d83 100644 --- a/sys/contrib/dev/acpica/common/adwalk.c +++ b/sys/contrib/dev/acpica/common/adwalk.c @@ -373,10 +373,18 @@ AcpiDmDumpDescending ( switch (Op->Common.AmlOpcode) { case AML_BYTE_OP: + + AcpiOsPrintf ("%2.2X", (UINT32) Op->Common.Value.Integer); + break; + case AML_WORD_OP: + + AcpiOsPrintf ("%4.4X", (UINT32) Op->Common.Value.Integer); + break; + case AML_DWORD_OP: - AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer); + AcpiOsPrintf ("%8.8X", (UINT32) Op->Common.Value.Integer); break; case AML_QWORD_OP: diff --git a/sys/contrib/dev/acpica/common/dmextern.c b/sys/contrib/dev/acpica/common/dmextern.c index 3ded428..56e2781 100644 --- a/sys/contrib/dev/acpica/common/dmextern.c +++ b/sys/contrib/dev/acpica/common/dmextern.c @@ -46,7 +46,9 @@ #include <contrib/dev/acpica/include/amlcode.h> #include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/acdisasm.h> +#include <contrib/dev/acpica/compiler/aslcompiler.h> #include <stdio.h> +#include <errno.h> /* @@ -87,6 +89,8 @@ static const char *AcpiGbl_DmTypeNames[] = /* 19 */ ", FieldUnitObj" }; +#define METHOD_SEPARATORS " \t,()\n" + /* Local prototypes */ @@ -99,6 +103,12 @@ AcpiDmNormalizeParentPrefix ( ACPI_PARSE_OBJECT *Op, char *Path); +static void +AcpiDmAddToExternalListFromFile ( + char *Path, + UINT8 Type, + UINT32 Value); + /******************************************************************************* * @@ -444,7 +454,7 @@ AcpiDmAddToExternalList ( (NextExternal->Value != Value)) { ACPI_ERROR ((AE_INFO, - "Argument count mismatch for method %s %u %u", + "External method arg count mismatch %s: Current %u, attempted %u", NextExternal->Path, NextExternal->Value, Value)); } @@ -536,6 +546,275 @@ AcpiDmAddToExternalList ( /******************************************************************************* * + * FUNCTION: AcpiDmGetExternalsFromFile + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Process the optional external reference file. + * + * Each line in the file should be of the form: + * External (<Method namepath>, MethodObj, <ArgCount>) + * + * Example: + * External (_SB_.PCI0.XHC_.PS0X, MethodObj, 4) + * + ******************************************************************************/ + +void +AcpiDmGetExternalsFromFile ( + void) +{ + FILE *ExternalRefFile; + char *Token; + char *MethodName; + UINT32 ArgCount; + UINT32 ImportCount = 0; + + + if (!Gbl_ExternalRefFilename) + { + return; + } + + /* Open the file */ + + ExternalRefFile = fopen (Gbl_ExternalRefFilename, "r"); + if (!ExternalRefFile) + { + fprintf (stderr, "Could not open external reference file \"%s\"\n", + Gbl_ExternalRefFilename); + return; + } + + /* Each line defines a method */ + + while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ExternalRefFile)) + { + Token = strtok (StringBuffer, METHOD_SEPARATORS); /* "External" */ + if (!Token) continue; + if (strcmp (Token, "External")) continue; + + MethodName = strtok (NULL, METHOD_SEPARATORS); /* Method namepath */ + if (!MethodName) continue; + + Token = strtok (NULL, METHOD_SEPARATORS); /* "MethodObj" */ + if (!Token) continue; + if (strcmp (Token, "MethodObj")) continue; + + Token = strtok (NULL, METHOD_SEPARATORS); /* Arg count */ + if (!Token) continue; + + /* Convert arg count string to an integer */ + + errno = 0; + ArgCount = strtoul (Token, NULL, 0); + if (errno) + { + fprintf (stderr, "Invalid argument count (%s)\n", Token); + continue; + } + if (ArgCount > 7) + { + fprintf (stderr, "Invalid argument count (%u)\n", ArgCount); + continue; + } + + /* Add this external to the global list */ + + AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n", + Gbl_ExternalRefFilename, ArgCount, MethodName); + + AcpiDmAddToExternalListFromFile (MethodName, ACPI_TYPE_METHOD, ArgCount | 0x80); + ImportCount++; + } + + if (!ImportCount) + { + fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n", + Gbl_ExternalRefFilename); + } + else + { + /* Add the external(s) to the namespace */ + + AcpiDmAddExternalsToNamespace (); + + AcpiOsPrintf ("%s: Imported %u external method definitions\n", + Gbl_ExternalRefFilename, ImportCount); + } + + fclose (ExternalRefFile); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmAddToExternalListFromFile + * + * PARAMETERS: Path - Internal (AML) path to the object + * Type - ACPI object type to be added + * Value - Arg count if adding a Method object + * + * RETURN: None + * + * DESCRIPTION: Insert a new name into the global list of Externals which + * will in turn be later emitted as an External() declaration + * in the disassembled output. + * + ******************************************************************************/ + +static void +AcpiDmAddToExternalListFromFile ( + char *Path, + UINT8 Type, + UINT32 Value) +{ + char *InternalPath; + char *ExternalPath; + ACPI_EXTERNAL_LIST *NewExternal; + ACPI_EXTERNAL_LIST *NextExternal; + ACPI_EXTERNAL_LIST *PrevExternal = NULL; + ACPI_STATUS Status; + BOOLEAN Resolved = FALSE; + + + if (!Path) + { + return; + } + + /* TBD: Add a flags parameter */ + + if (Type == ACPI_TYPE_METHOD) + { + if (Value & 0x80) + { + Resolved = TRUE; + } + Value &= 0x07; + } + + /* + * We don't want External() statements to contain a leading '\'. + * This prevents duplicate external statements of the form: + * + * External (\ABCD) + * External (ABCD) + * + * This would cause a compile time error when the disassembled + * output file is recompiled. + */ + if ((*Path == AML_ROOT_PREFIX) && (Path[1])) + { + Path++; + } + + /* Check all existing externals to ensure no duplicates */ + + NextExternal = AcpiGbl_ExternalList; + while (NextExternal) + { + if (!ACPI_STRCMP (Path, NextExternal->Path)) + { + /* Duplicate method, check that the Value (ArgCount) is the same */ + + if ((NextExternal->Type == ACPI_TYPE_METHOD) && + (NextExternal->Value != Value)) + { + ACPI_ERROR ((AE_INFO, + "(File) External method arg count mismatch %s: Current %u, override to %u", + NextExternal->Path, NextExternal->Value, Value)); + + /* Override, since new value came from external reference file */ + + NextExternal->Value = Value; + } + + /* Allow upgrade of type from ANY */ + + else if (NextExternal->Type == ACPI_TYPE_ANY) + { + NextExternal->Type = Type; + NextExternal->Value = Value; + } + + return; + } + + NextExternal = NextExternal->Next; + } + + /* Get the internal pathname (AML format) */ + + Status = AcpiNsInternalizeName (Path, &InternalPath); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Allocate and init a new External() descriptor */ + + NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST)); + if (!NewExternal) + { + ACPI_FREE (InternalPath); + return; + } + + /* Must copy and normalize the input path */ + + AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, NULL, &ExternalPath); + + NewExternal->Path = ExternalPath; + NewExternal->Type = Type; + NewExternal->Value = Value; + NewExternal->Resolved = Resolved; + NewExternal->Length = (UINT16) ACPI_STRLEN (Path); + NewExternal->InternalPath = InternalPath; + + /* Set flag to indicate External->InternalPath needs to be freed */ + + NewExternal->Flags |= ACPI_IPATH_ALLOCATED | ACPI_FROM_REFERENCE_FILE; + + /* Link the new descriptor into the global list, alphabetically ordered */ + + NextExternal = AcpiGbl_ExternalList; + while (NextExternal) + { + if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0) + { + if (PrevExternal) + { + PrevExternal->Next = NewExternal; + } + else + { + AcpiGbl_ExternalList = NewExternal; + } + + NewExternal->Next = NextExternal; + return; + } + + PrevExternal = NextExternal; + NextExternal = NextExternal->Next; + } + + if (PrevExternal) + { + PrevExternal->Next = NewExternal; + } + else + { + AcpiGbl_ExternalList = NewExternal; + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmAddExternalsToNamespace * * PARAMETERS: None @@ -563,7 +842,7 @@ AcpiDmAddExternalsToNamespace ( Status = AcpiNsLookup (NULL, External->InternalPath, External->Type, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, + ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (ACPI_FAILURE (Status)) @@ -731,7 +1010,8 @@ AcpiDmEmitExternals ( NextExternal->Path, AcpiDmGetObjectTypeName (NextExternal->Type)); - AcpiOsPrintf (") // Warning: Unresolved Method, " + AcpiOsPrintf ( + ") // Warning: Unresolved Method, " "guessing %u arguments (may be incorrect, see warning above)\n", NextExternal->Value); @@ -743,9 +1023,45 @@ AcpiDmEmitExternals ( AcpiOsPrintf ("\n"); + + /* Emit externals that were imported from a file */ + + if (Gbl_ExternalRefFilename) + { + AcpiOsPrintf ( + " /*\n * External declarations that were imported from\n" + " * the reference file [%s]\n */\n", + Gbl_ExternalRefFilename); + + NextExternal = AcpiGbl_ExternalList; + while (NextExternal) + { + if (!NextExternal->Emitted && (NextExternal->Flags & ACPI_FROM_REFERENCE_FILE)) + { + AcpiOsPrintf (" External (%s%s", + NextExternal->Path, + AcpiDmGetObjectTypeName (NextExternal->Type)); + + if (NextExternal->Type == ACPI_TYPE_METHOD) + { + AcpiOsPrintf (") // %u Arguments\n", + NextExternal->Value); + } + else + { + AcpiOsPrintf (")\n"); + } + NextExternal->Emitted = TRUE; + } + + NextExternal = NextExternal->Next; + } + + AcpiOsPrintf ("\n"); + } + /* - * Walk the list of externals (unresolved references) - * found during the AML parsing + * Walk the list of externals found during the AML parsing */ while (AcpiGbl_ExternalList) { diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index 6aab9e5..e7ce520 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -446,7 +446,7 @@ AcpiDmDumpDataTable ( Length = Table->Length; AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); } - else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP)) + else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature)) { Length = AcpiDmDumpRsdp (Table); } diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index 7b2393c..48ccfa3 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -593,10 +593,15 @@ CmDoCompile ( AslCompilerparse(); UtEndEvent (Event); - /* Flush out any remaining source after parse tree is complete */ + /* Check for parse errors */ - Event = UtBeginEvent ("Flush source input"); - CmFlushSourceCode (); + Status = AslCheckForErrorExit (); + if (ACPI_FAILURE (Status)) + { + fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n"); + LsDumpParseTree (); + goto ErrorExit; + } /* Did the parse tree get successfully constructed? */ @@ -606,16 +611,18 @@ CmDoCompile ( * If there are no errors, then we have some sort of * internal problem. */ - Status = AslCheckForErrorExit (); - if (Status == AE_OK) - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, - NULL, "- Could not resolve parse tree root node"); - } + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + NULL, "- Could not resolve parse tree root node"); goto ErrorExit; } + + /* Flush out any remaining source after parse tree is complete */ + + Event = UtBeginEvent ("Flush source input"); + CmFlushSourceCode (); + /* Optional parse tree dump, compiler debug output only */ LsDumpParseTree (); diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h index e1be4ae..3f2c401 100644 --- a/sys/contrib/dev/acpica/compiler/aslglobal.h +++ b/sys/contrib/dev/acpica/compiler/aslglobal.h @@ -186,6 +186,7 @@ ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL) ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); ASL_EXTERN char *Gbl_CurrentInputFilename; +ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalRefFilename, NULL); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); diff --git a/sys/contrib/dev/acpica/compiler/aslload.c b/sys/contrib/dev/acpica/compiler/aslload.c index 57519d1..bc4d593 100644 --- a/sys/contrib/dev/acpica/compiler/aslload.c +++ b/sys/contrib/dev/acpica/compiler/aslload.c @@ -487,6 +487,10 @@ LdNamespace1Begin ( ACPI_TYPE_LOCAL_SCOPE, ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node)); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* * However, this is an error -- primarily because the MS diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 2a70588..67e561a 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -138,6 +138,7 @@ Usage ( ACPI_OPTION ("-dc <f1,f2>", "Disassemble AML and immediately compile it"); ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)"); ACPI_OPTION ("-e <f1,f2>", "Include ACPI table(s) for external symbol resolution"); + ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file"); ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); ACPI_OPTION ("-in", "Ignore NoOp opcodes"); ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file"); diff --git a/sys/contrib/dev/acpica/compiler/asloptions.c b/sys/contrib/dev/acpica/compiler/asloptions.c index 877fb68..66a9249 100644 --- a/sys/contrib/dev/acpica/compiler/asloptions.c +++ b/sys/contrib/dev/acpica/compiler/asloptions.c @@ -68,7 +68,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z" +#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z" /******************************************************************************* @@ -136,8 +136,7 @@ AslCommandLine ( if (BadCommandLine) { - printf ("\n"); - Usage (); + printf ("Use -h option for help information\n"); exit (1); } @@ -276,9 +275,30 @@ AslDoOptions ( } break; - case 'f': /* Ignore errors and force creation of aml file */ + case 'f': + + switch (AcpiGbl_Optarg[0]) + { + case '^': /* Ignore errors and force creation of aml file */ + + Gbl_IgnoreErrors = TRUE; + break; + + case 'e': /* Disassembler: Get external declaration file */ + + if (AcpiGetoptArgument (argc, argv)) + { + return (-1); + } + + Gbl_ExternalRefFilename = AcpiGbl_Optarg; + break; - Gbl_IgnoreErrors = TRUE; + default: + + printf ("Unknown option: -f%s\n", AcpiGbl_Optarg); + return (-1); + } break; case 'G': diff --git a/sys/contrib/dev/acpica/compiler/dtcompile.c b/sys/contrib/dev/acpica/compiler/dtcompile.c index 1b24af26..3407e1d 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompile.c +++ b/sys/contrib/dev/acpica/compiler/dtcompile.c @@ -317,7 +317,7 @@ DtCompileDataTable ( DtSetTableLength (); return (Status); } - else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDP)) + else if (ACPI_VALIDATE_RSDP_SIG (Signature)) { Status = DtCompileRsdp (FieldList); return (Status); diff --git a/sys/contrib/dev/acpica/components/debugger/dbcmds.c b/sys/contrib/dev/acpica/components/debugger/dbcmds.c index 89c6333..921f428 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbcmds.c +++ b/sys/contrib/dev/acpica/components/debugger/dbcmds.c @@ -1211,6 +1211,14 @@ AcpiDbGenerateGpe ( (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber); } + +void +AcpiDbGenerateSci ( + void) +{ + AcpiEvSciDispatch (); +} + #endif /* !ACPI_REDUCED_HARDWARE */ #endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbfileio.c b/sys/contrib/dev/acpica/components/debugger/dbfileio.c index e03bb40..05fa4e7 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbfileio.c +++ b/sys/contrib/dev/acpica/components/debugger/dbfileio.c @@ -142,7 +142,8 @@ AcpiDbOpenDebugFile ( } AcpiOsPrintf ("Debug output file %s opened\n", Name); - ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name); + ACPI_STRNCPY (AcpiGbl_DbDebugFilename, Name, + sizeof (AcpiGbl_DbDebugFilename)); AcpiGbl_DbOutputToFile = TRUE; #endif @@ -274,11 +275,9 @@ AcpiDbReadTable ( fseek (fp, 0, SEEK_SET); - /* The RSDT, FACS and S3PT tables do not have standard ACPI headers */ + /* The RSDP table does not have standard ACPI header */ - if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") || - ACPI_COMPARE_NAME (TableHeader.Signature, "FACS") || - ACPI_COMPARE_NAME (TableHeader.Signature, "S3PT")) + if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ")) { *TableLength = FileSize; StandardHeader = FALSE; diff --git a/sys/contrib/dev/acpica/components/debugger/dbinput.c b/sys/contrib/dev/acpica/components/debugger/dbinput.c index a54c239..c1a51f8 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbinput.c +++ b/sys/contrib/dev/acpica/components/debugger/dbinput.c @@ -132,12 +132,14 @@ enum AcpiExDebuggerCommands CMD_OPEN, CMD_OSI, CMD_OWNER, + CMD_PATHS, CMD_PREDEFINED, CMD_PREFIX, CMD_QUIT, CMD_REFERENCES, CMD_RESOURCES, CMD_RESULTS, + CMD_SCI, CMD_SET, CMD_SLEEP, CMD_STATS, @@ -203,12 +205,14 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = {"OPEN", 1}, {"OSI", 0}, {"OWNER", 1}, + {"PATHS", 0}, {"PREDEFINED", 0}, {"PREFIX", 0}, {"QUIT", 0}, {"REFERENCES", 1}, {"RESOURCES", 0}, {"RESULTS", 0}, + {"SCI", 0}, {"SET", 3}, {"SLEEP", 0}, {"STATS", 1}, @@ -259,22 +263,19 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {0, "\nNamespace Access Commands:", "\n"}, {1, " Businfo", "Display system bus info\n"}, {1, " Disassemble <Method>", "Disassemble a control method\n"}, - {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"}, - {1, " Gpe <GpeNum> <GpeBlock>", "Simulate a GPE\n"}, - {1, " Gpes", "Display info on all GPEs\n"}, {1, " Integrity", "Validate namespace integrity\n"}, {1, " Methods", "Display list of loaded control methods\n"}, {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"}, {1, " Notify <Object> <Value>", "Send a notification on Object\n"}, {1, " Objects <ObjectType>", "Display all objects of the given type\n"}, {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"}, + {1, " Paths", "Display full pathnames of namespace objects\n"}, {1, " Predefined", "Check all predefined names\n"}, {1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"}, {1, " References <Addr>", "Find all references to object at addr\n"}, {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"}, - {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"}, {1, " Terminate", "Delete namespace and all internal objects\n"}, {1, " Type <Object>", "Display object type\n"}, @@ -288,7 +289,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {5, " Execute <Namepath> [Arguments]", "Execute control method\n"}, {1, " Hex Integer", "Integer method argument\n"}, {1, " \"Ascii String\"", "String method argument\n"}, - {1, " (Byte List)", "Buffer method argument\n"}, + {1, " (Hex Byte List)", "Buffer method argument\n"}, {1, " [Package Element List]", "Package method argument\n"}, {1, " Go", "Allow method to run to completion\n"}, {1, " Information", "Display info about the current method\n"}, @@ -303,6 +304,13 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Tree", "Display control method calling tree\n"}, {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, + {0, "\nHardware Related Commands:", "\n"}, + {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, + {1, " Gpe <GpeNum> <GpeBlock>", "Simulate a GPE\n"}, + {1, " Gpes", "Display info on all GPEs\n"}, + {1, " Sci", "Generate an SCI\n"}, + {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, + {0, "\nFile I/O Commands:", "\n"}, {1, " Close", "Close debug output file\n"}, {1, " Load <Input Filename>", "Load ACPI table from a file\n"}, @@ -1002,6 +1010,11 @@ AcpiDbCommandDispatch ( AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; + case CMD_PATHS: + + AcpiDbDumpNamespacePaths (); + break; + case CMD_PREDEFINED: AcpiDbCheckPredefinedNames (); @@ -1027,6 +1040,11 @@ AcpiDbCommandDispatch ( AcpiDbDisplayResults (); break; + case CMD_SCI: + + AcpiDbGenerateSci (); + break; + case CMD_SET: AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], diff --git a/sys/contrib/dev/acpica/components/debugger/dbnames.c b/sys/contrib/dev/acpica/components/debugger/dbnames.c index c9f3e0a..5ac39fd 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbnames.c +++ b/sys/contrib/dev/acpica/components/debugger/dbnames.c @@ -256,6 +256,37 @@ AcpiDbDumpNamespace ( /******************************************************************************* * + * FUNCTION: AcpiDbDumpNamespacePaths + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Dump entire namespace with full object pathnames and object + * type information. Alternative to "namespace" command. + * + ******************************************************************************/ + +void +AcpiDbDumpNamespacePaths ( + void) +{ + + AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); + AcpiOsPrintf ("ACPI Namespace (from root):\n"); + + /* Display the entire namespace */ + + AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); + AcpiNsDumpObjectPaths (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, + ACPI_UINT32_MAX, ACPI_OWNER_ID_MAX, AcpiGbl_RootNode); + + AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbDumpNamespaceByOwner * * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed diff --git a/sys/contrib/dev/acpica/components/events/evgpeutil.c b/sys/contrib/dev/acpica/components/events/evgpeutil.c index 1841f9d..35caa5a 100644 --- a/sys/contrib/dev/acpica/components/events/evgpeutil.c +++ b/sys/contrib/dev/acpica/components/events/evgpeutil.c @@ -216,7 +216,7 @@ AcpiEvGetGpeDevice ( * * FUNCTION: AcpiEvGetGpeXruptBlock * - * PARAMETERS: InterruptNumber - Interrupt for a GPE block + * PARAMETERS: InterruptNumber - Interrupt for a GPE block * * RETURN: A GPE interrupt block * diff --git a/sys/contrib/dev/acpica/components/events/evmisc.c b/sys/contrib/dev/acpica/components/events/evmisc.c index 740eb28..547534b 100644 --- a/sys/contrib/dev/acpica/components/events/evmisc.c +++ b/sys/contrib/dev/acpica/components/events/evmisc.c @@ -292,15 +292,6 @@ AcpiEvTerminate ( Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL); - /* Remove SCI handler */ - - Status = AcpiEvRemoveSciHandler (); - if (ACPI_FAILURE(Status)) - { - ACPI_ERROR ((AE_INFO, - "Could not remove SCI handler")); - } - Status = AcpiEvRemoveGlobalLockHandler (); if (ACPI_FAILURE(Status)) { @@ -311,6 +302,15 @@ AcpiEvTerminate ( AcpiGbl_EventsInitialized = FALSE; } + /* Remove SCI handlers */ + + Status = AcpiEvRemoveAllSciHandlers (); + if (ACPI_FAILURE(Status)) + { + ACPI_ERROR ((AE_INFO, + "Could not remove SCI handler")); + } + /* Deallocate all handler objects installed within GPE info structs */ Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL); diff --git a/sys/contrib/dev/acpica/components/events/evregion.c b/sys/contrib/dev/acpica/components/events/evregion.c index 43fe9b2..d469d6e 100644 --- a/sys/contrib/dev/acpica/components/events/evregion.c +++ b/sys/contrib/dev/acpica/components/events/evregion.c @@ -234,18 +234,12 @@ AcpiEvAddressSpaceDispatch ( { RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE; - if (RegionObj2->Extra.RegionContext) - { - /* The handler for this region was already installed */ - - ACPI_FREE (RegionContext); - } - else + /* + * Save the returned context for use in all accesses to + * the handler for this particular region + */ + if (!(RegionObj2->Extra.RegionContext)) { - /* - * Save the returned context for use in all accesses to - * this particular region - */ RegionObj2->Extra.RegionContext = RegionContext; } } @@ -261,7 +255,6 @@ AcpiEvAddressSpaceDispatch ( ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - /* * Special handling for GenericSerialBus and GeneralPurposeIo: * There are three extra parameters that must be passed to the @@ -424,6 +417,15 @@ AcpiEvDetachRegion( Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE, HandlerObj->AddressSpace.Context, RegionContext); + /* + * RegionContext should have been released by the deactivate + * operation. We don't need access to it anymore here. + */ + if (RegionContext) + { + *RegionContext = NULL; + } + /* Init routine may fail, Just ignore errors */ if (ACPI_FAILURE (Status)) diff --git a/sys/contrib/dev/acpica/components/events/evsci.c b/sys/contrib/dev/acpica/components/events/evsci.c index ed87c63..4fa84f3 100644 --- a/sys/contrib/dev/acpica/components/events/evsci.c +++ b/sys/contrib/dev/acpica/components/events/evsci.c @@ -61,6 +61,57 @@ AcpiEvSciXruptHandler ( /******************************************************************************* * + * FUNCTION: AcpiEvSciDispatch + * + * PARAMETERS: None + * + * RETURN: Status code indicates whether interrupt was handled. + * + * DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers. + * + ******************************************************************************/ + +UINT32 +AcpiEvSciDispatch ( + void) +{ + ACPI_SCI_HANDLER_INFO *SciHandler; + ACPI_CPU_FLAGS Flags; + UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; + + + ACPI_FUNCTION_NAME (EvSciDispatch); + + + /* Are there any host-installed SCI handlers? */ + + if (!AcpiGbl_SciHandlerList) + { + return (IntStatus); + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Invoke all host-installed SCI handlers */ + + SciHandler = AcpiGbl_SciHandlerList; + while (SciHandler) + { + /* Invoke the installed handler (at interrupt level) */ + + IntStatus |= SciHandler->Address ( + SciHandler->Context); + + SciHandler = SciHandler->Next; + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return (IntStatus); +} + + +/******************************************************************************* + * * FUNCTION: AcpiEvSciXruptHandler * * PARAMETERS: Context - Calling Context @@ -100,6 +151,10 @@ AcpiEvSciXruptHandler ( */ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); + /* Invoke all host-installed SCI handlers */ + + InterruptHandled |= AcpiEvSciDispatch (); + AcpiSciCount++; return_UINT32 (InterruptHandled); } @@ -129,14 +184,13 @@ AcpiEvGpeXruptHandler ( /* - * We are guaranteed by the ACPI CA initialization/shutdown code that + * We are guaranteed by the ACPICA initialization/shutdown code that * if this interrupt handler is installed, ACPI is enabled. */ /* GPEs: Check for and dispatch any GPEs that have occurred */ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); - return_UINT32 (InterruptHandled); } @@ -171,15 +225,15 @@ AcpiEvInstallSciHandler ( /****************************************************************************** * - * FUNCTION: AcpiEvRemoveSciHandler + * FUNCTION: AcpiEvRemoveAllSciHandlers * * PARAMETERS: none * - * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not + * RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not * installed to begin with * * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be - * taken. + * taken. Remove all host-installed SCI handlers. * * Note: It doesn't seem important to disable all events or set the event * enable registers to their original values. The OS should disable @@ -189,13 +243,15 @@ AcpiEvInstallSciHandler ( ******************************************************************************/ ACPI_STATUS -AcpiEvRemoveSciHandler ( +AcpiEvRemoveAllSciHandlers ( void) { + ACPI_SCI_HANDLER_INFO *SciHandler; + ACPI_CPU_FLAGS Flags; ACPI_STATUS Status; - ACPI_FUNCTION_TRACE (EvRemoveSciHandler); + ACPI_FUNCTION_TRACE (EvRemoveAllSciHandlers); /* Just let the OS remove the handler and disable the level */ @@ -203,6 +259,23 @@ AcpiEvRemoveSciHandler ( Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt, AcpiEvSciXruptHandler); + if (!AcpiGbl_SciHandlerList) + { + return (Status); + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Free all host-installed SCI handlers */ + + while (AcpiGbl_SciHandlerList) + { + SciHandler = AcpiGbl_SciHandlerList; + AcpiGbl_SciHandlerList = SciHandler->Next; + ACPI_FREE (SciHandler); + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/components/events/evxface.c b/sys/contrib/dev/acpica/components/events/evxface.c index cf5dbed..4ed3247 100644 --- a/sys/contrib/dev/acpica/components/events/evxface.c +++ b/sys/contrib/dev/acpica/components/events/evxface.c @@ -435,6 +435,169 @@ ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler) #if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * + * FUNCTION: AcpiInstallSciHandler + * + * PARAMETERS: Address - Address of the handler + * Context - Value passed to the handler on each SCI + * + * RETURN: Status + * + * DESCRIPTION: Install a handler for a System Control Interrupt. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallSciHandler ( + ACPI_SCI_HANDLER Address, + void *Context) +{ + ACPI_SCI_HANDLER_INFO *NewSciHandler; + ACPI_SCI_HANDLER_INFO *SciHandler; + ACPI_CPU_FLAGS Flags; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiInstallSciHandler); + + + if (!Address) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Allocate and init a handler object */ + + NewSciHandler = ACPI_ALLOCATE (sizeof (ACPI_SCI_HANDLER_INFO)); + if (!NewSciHandler) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + NewSciHandler->Address = Address; + NewSciHandler->Context = Context; + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* Lock list during installation */ + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + SciHandler = AcpiGbl_SciHandlerList; + + /* Ensure handler does not already exist */ + + while (SciHandler) + { + if (Address == SciHandler->Address) + { + Status = AE_ALREADY_EXISTS; + goto UnlockAndExit; + } + + SciHandler = SciHandler->Next; + } + + /* Install the new handler into the global list (at head) */ + + NewSciHandler->Next = AcpiGbl_SciHandlerList; + AcpiGbl_SciHandlerList = NewSciHandler; + + +UnlockAndExit: + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + +Exit: + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (NewSciHandler); + } + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRemoveSciHandler + * + * PARAMETERS: Address - Address of the handler + * + * RETURN: Status + * + * DESCRIPTION: Remove a handler for a System Control Interrupt. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRemoveSciHandler ( + ACPI_SCI_HANDLER Address) +{ + ACPI_SCI_HANDLER_INFO *PrevSciHandler; + ACPI_SCI_HANDLER_INFO *NextSciHandler; + ACPI_CPU_FLAGS Flags; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiRemoveSciHandler); + + + if (!Address) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Remove the SCI handler with lock */ + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + PrevSciHandler = NULL; + NextSciHandler = AcpiGbl_SciHandlerList; + while (NextSciHandler) + { + if (NextSciHandler->Address == Address) + { + /* Unlink and free the SCI handler info block */ + + if (PrevSciHandler) + { + PrevSciHandler->Next = NextSciHandler->Next; + } + else + { + AcpiGbl_SciHandlerList = NextSciHandler->Next; + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + ACPI_FREE (NextSciHandler); + goto UnlockAndExit; + } + + PrevSciHandler = NextSciHandler; + NextSciHandler = NextSciHandler->Next; + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + Status = AE_NOT_EXIST; + + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiInstallGlobalEventHandler * * PARAMETERS: Handler - Pointer to the global event handler function diff --git a/sys/contrib/dev/acpica/components/hardware/hwxface.c b/sys/contrib/dev/acpica/components/hardware/hwxface.c index ded0a6b..8e0e5be 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwxface.c +++ b/sys/contrib/dev/acpica/components/hardware/hwxface.c @@ -131,7 +131,8 @@ AcpiRead ( UINT64 *ReturnValue, ACPI_GENERIC_ADDRESS *Reg) { - UINT32 Value; + UINT32 ValueLo; + UINT32 ValueHi; UINT32 Width; UINT64 Address; ACPI_STATUS Status; @@ -153,13 +154,8 @@ AcpiRead ( return (Status); } - /* Initialize entire 64-bit return value to zero */ - - *ReturnValue = 0; - Value = 0; - /* - * Two address spaces supported: Memory or IO. PCI_Config is + * Two address spaces supported: Memory or I/O. PCI_Config is * not supported here because the GAS structure is insufficient */ if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) @@ -173,6 +169,9 @@ AcpiRead ( } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { + ValueLo = 0; + ValueHi = 0; + Width = Reg->BitWidth; if (Width == 64) { @@ -180,25 +179,27 @@ AcpiRead ( } Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) - Address, &Value, Width); + Address, &ValueLo, Width); if (ACPI_FAILURE (Status)) { return (Status); } - *ReturnValue = Value; if (Reg->BitWidth == 64) { /* Read the top 32 bits */ Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) - (Address + 4), &Value, 32); + (Address + 4), &ValueHi, 32); if (ACPI_FAILURE (Status)) { return (Status); } - *ReturnValue |= ((UINT64) Value << 32); } + + /* Set the return value only if status is AE_OK */ + + *ReturnValue = (ValueLo | ((UINT64) ValueHi << 32)); } ACPI_DEBUG_PRINT ((ACPI_DB_IO, @@ -207,7 +208,7 @@ AcpiRead ( ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); - return (Status); + return (AE_OK); } ACPI_EXPORT_SYMBOL (AcpiRead) diff --git a/sys/contrib/dev/acpica/components/namespace/nsaccess.c b/sys/contrib/dev/acpica/components/namespace/nsaccess.c index aedb550..523e092 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsaccess.c +++ b/sys/contrib/dev/acpica/components/namespace/nsaccess.c @@ -448,8 +448,8 @@ AcpiNsLookup ( /* Current scope has no parent scope */ ACPI_ERROR ((AE_INFO, - "ACPI path has too many parent prefixes (^) " - "- reached beyond root node")); + "%s: Path has too many parent prefixes (^) " + "- reached beyond root node", Pathname)); return_ACPI_STATUS (AE_NOT_FOUND); } } diff --git a/sys/contrib/dev/acpica/components/namespace/nsdump.c b/sys/contrib/dev/acpica/components/namespace/nsdump.c index 41f1214..0ec5642 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsdump.c +++ b/sys/contrib/dev/acpica/components/namespace/nsdump.c @@ -69,6 +69,22 @@ AcpiNsDumpOneDevice ( #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + +static ACPI_STATUS +AcpiNsDumpOneObjectPath ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + +static ACPI_STATUS +AcpiNsGetMaxDepth ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + + /******************************************************************************* * * FUNCTION: AcpiNsPrintPathname @@ -697,6 +713,142 @@ AcpiNsDumpObjects ( /******************************************************************************* * + * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth + * + * PARAMETERS: ObjHandle - Node to be dumped + * Level - Nesting level of the handle + * Context - Passed into WalkNamespace + * ReturnValue - Not used + * + * RETURN: Status + * + * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth + * computes the maximum nesting depth in the namespace tree, in + * order to simplify formatting in AcpiNsDumpOneObjectPath. + * These procedures are UserFunctions called by AcpiNsWalkNamespace. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiNsDumpOneObjectPath ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) +{ + UINT32 MaxLevel = *((UINT32 *) Context); + char *Pathname; + ACPI_NAMESPACE_NODE *Node; + int PathIndent; + + + if (!ObjHandle) + { + return (AE_OK); + } + + Node = AcpiNsValidateHandle (ObjHandle); + Pathname = AcpiNsGetExternalPathname (Node); + + PathIndent = 1; + if (Level <= MaxLevel) + { + PathIndent = MaxLevel - Level + 1; + } + + AcpiOsPrintf ("%2d%*s%-12s%*s", + Level, Level, " ", AcpiUtGetTypeName (Node->Type), + PathIndent, " "); + + AcpiOsPrintf ("%s\n", &Pathname[1]); + ACPI_FREE (Pathname); + return (AE_OK); +} + + +static ACPI_STATUS +AcpiNsGetMaxDepth ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) +{ + UINT32 *MaxLevel = (UINT32 *) Context; + + + if (Level > *MaxLevel) + { + *MaxLevel = Level; + } + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsDumpObjectPaths + * + * PARAMETERS: Type - Object type to be dumped + * DisplayType - 0 or ACPI_DISPLAY_SUMMARY + * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX + * for an effectively unlimited depth. + * OwnerId - Dump only objects owned by this ID. Use + * ACPI_UINT32_MAX to match all owners. + * StartHandle - Where in namespace to start/end search + * + * RETURN: None + * + * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses + * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath. + * + ******************************************************************************/ + +void +AcpiNsDumpObjectPaths ( + ACPI_OBJECT_TYPE Type, + UINT8 DisplayType, + UINT32 MaxDepth, + ACPI_OWNER_ID OwnerId, + ACPI_HANDLE StartHandle) +{ + ACPI_STATUS Status; + UINT32 MaxLevel = 0; + + + ACPI_FUNCTION_ENTRY (); + + + /* + * Just lock the entire namespace for the duration of the dump. + * We don't want any changes to the namespace during this time, + * especially the temporary nodes since we are going to display + * them also. + */ + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not acquire namespace mutex\n"); + return; + } + + /* Get the max depth of the namespace tree, for formatting later */ + + (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL); + + /* Now dump the entire namespace */ + + (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, + ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, + AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); +} + + +/******************************************************************************* + * * FUNCTION: AcpiNsDumpEntry * * PARAMETERS: Handle - Node to be dumped diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c index 2ec6418..984ee64 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c @@ -654,10 +654,19 @@ AcpiWalkNamespace ( goto UnlockAndExit; } + /* Now we can validate the starting node */ + + if (!AcpiNsValidateHandle (StartObject)) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit2; + } + Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, ACPI_NS_WALK_UNLOCK, DescendingCallback, AscendingCallback, Context, ReturnValue); +UnlockAndExit2: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); UnlockAndExit: diff --git a/sys/contrib/dev/acpica/components/tables/tbinstal.c b/sys/contrib/dev/acpica/components/tables/tbinstal.c index 6ca141f..0652b16 100644 --- a/sys/contrib/dev/acpica/components/tables/tbinstal.c +++ b/sys/contrib/dev/acpica/components/tables/tbinstal.c @@ -93,14 +93,9 @@ AcpiTbVerifyTable ( } } - /* FACS is the odd table, has no standard ACPI header and no checksum */ + /* Always calculate checksum, ignore bad checksum if requested */ - if (!ACPI_COMPARE_NAME (&TableDesc->Signature, ACPI_SIG_FACS)) - { - /* Always calculate checksum, ignore bad checksum if requested */ - - Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length); - } + Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/components/tables/tbprint.c b/sys/contrib/dev/acpica/components/tables/tbprint.c index 6c83bf3..e85acce 100644 --- a/sys/contrib/dev/acpica/components/tables/tbprint.c +++ b/sys/contrib/dev/acpica/components/tables/tbprint.c @@ -158,7 +158,7 @@ AcpiTbPrintTableHeader ( Header->Signature, ACPI_CAST_PTR (void, Address), Header->Length)); } - else if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_RSDP)) + else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature)) { /* RSDP has no common fields */ @@ -211,6 +211,17 @@ AcpiTbVerifyChecksum ( UINT8 Checksum; + /* + * FACS/S3PT: + * They are the odd tables, have no standard ACPI header and no checksum + */ + + if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT) || + ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS)) + { + return (AE_OK); + } + /* Compute the checksum on the table */ Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length); diff --git a/sys/contrib/dev/acpica/components/tables/tbxfroot.c b/sys/contrib/dev/acpica/components/tables/tbxfroot.c index c509350..0b9fe72 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxfroot.c +++ b/sys/contrib/dev/acpica/components/tables/tbxfroot.c @@ -75,8 +75,7 @@ AcpiTbValidateRsdp ( * Note: Sometimes there exists more than one RSDP in memory; the valid * RSDP has a valid checksum, all others have an invalid checksum. */ - if (ACPI_STRNCMP ((char *) Rsdp->Signature, ACPI_SIG_RSDP, - sizeof (ACPI_SIG_RSDP)-1) != 0) + if (!ACPI_VALIDATE_RSDP_SIG (Rsdp->Signature)) { /* Nope, BAD Signature */ diff --git a/sys/contrib/dev/acpica/components/utilities/utdebug.c b/sys/contrib/dev/acpica/components/utilities/utdebug.c index 1780595..93c0361 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdebug.c +++ b/sys/contrib/dev/acpica/components/utilities/utdebug.c @@ -216,7 +216,7 @@ AcpiDebugPrint ( * Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ - AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber); + AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber); if (ACPI_LV_THREADS & AcpiDbgLevel) { diff --git a/sys/contrib/dev/acpica/components/utilities/utglobal.c b/sys/contrib/dev/acpica/components/utilities/utglobal.c index be45950..6233a4a 100644 --- a/sys/contrib/dev/acpica/components/utilities/utglobal.c +++ b/sys/contrib/dev/acpica/components/utilities/utglobal.c @@ -274,7 +274,7 @@ AcpiUtInitGlobals ( #if (!ACPI_REDUCED_HARDWARE) - /* GPE support */ + /* GPE/SCI support */ AcpiGbl_AllGpesInitialized = FALSE; AcpiGbl_GpeXruptListHead = NULL; @@ -283,6 +283,7 @@ AcpiUtInitGlobals ( AcpiCurrentGpeCount = 0; AcpiGbl_GlobalEventHandler = NULL; + AcpiGbl_SciHandlerList = NULL; #endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/sys/contrib/dev/acpica/include/acdebug.h b/sys/contrib/dev/acpica/include/acdebug.h index 5fef182..37d41d3 100644 --- a/sys/contrib/dev/acpica/include/acdebug.h +++ b/sys/contrib/dev/acpica/include/acdebug.h @@ -159,6 +159,10 @@ AcpiDbGenerateGpe ( char *GpeArg, char *BlockArg)) +ACPI_HW_DEPENDENT_RETURN_VOID ( +void +AcpiDbGenerateSci ( + void)) /* * dbconvert - miscellaneous conversion routines @@ -234,6 +238,10 @@ AcpiDbDumpNamespace ( char *DepthArg); void +AcpiDbDumpNamespacePaths ( + void); + +void AcpiDbDumpNamespaceByOwner ( char *OwnerArg, char *DepthArg); diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index 45b8212..4fadd40 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -694,6 +694,9 @@ void AcpiDmUnresolvedWarning ( UINT8 Type); +void +AcpiDmGetExternalsFromFile ( + void); /* * dmresrc diff --git a/sys/contrib/dev/acpica/include/acevents.h b/sys/contrib/dev/acpica/include/acevents.h index fc652b4..67095aa 100644 --- a/sys/contrib/dev/acpica/include/acevents.h +++ b/sys/contrib/dev/acpica/include/acevents.h @@ -339,17 +339,17 @@ AcpiEvGpeXruptHandler ( void *Context); UINT32 +AcpiEvSciDispatch ( + void); + +UINT32 AcpiEvInstallSciHandler ( void); ACPI_STATUS -AcpiEvRemoveSciHandler ( +AcpiEvRemoveAllSciHandlers ( void); -UINT32 -AcpiEvInitializeSCI ( - UINT32 ProgramSCI); - ACPI_HW_DEPENDENT_RETURN_VOID ( void AcpiEvTerminate ( diff --git a/sys/contrib/dev/acpica/include/acexcep.h b/sys/contrib/dev/acpica/include/acexcep.h index 9961acc..7bcfe1d 100644 --- a/sys/contrib/dev/acpica/include/acexcep.h +++ b/sys/contrib/dev/acpica/include/acexcep.h @@ -127,8 +127,9 @@ typedef struct acpi_exception_info #define AE_NO_HANDLER EXCEP_ENV (0x001A) #define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B) #define AE_NOT_CONFIGURED EXCEP_ENV (0x001C) +#define AE_ACCESS EXCEP_ENV (0x001D) -#define AE_CODE_ENV_MAX 0x001C +#define AE_CODE_ENV_MAX 0x001D /* @@ -235,7 +236,7 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Env[] = EXCEP_TXT ("AE_NO_ACPI_TABLES", "ACPI tables could not be found"), EXCEP_TXT ("AE_NO_NAMESPACE", "A namespace has not been loaded"), EXCEP_TXT ("AE_NO_MEMORY", "Insufficient dynamic memory"), - EXCEP_TXT ("AE_NOT_FOUND", "The name was not found in the namespace"), + EXCEP_TXT ("AE_NOT_FOUND", "A requested entity is not found"), EXCEP_TXT ("AE_NOT_EXIST", "A required entity does not exist"), EXCEP_TXT ("AE_ALREADY_EXISTS", "An entity already exists"), EXCEP_TXT ("AE_TYPE", "The object type is incorrect"), @@ -258,7 +259,8 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Env[] = EXCEP_TXT ("AE_SAME_HANDLER", "Attempt was made to install the same handler that is already installed"), EXCEP_TXT ("AE_NO_HANDLER", "A handler for the operation is not installed"), EXCEP_TXT ("AE_OWNER_ID_LIMIT", "There are no more Owner IDs available for ACPI tables or control methods"), - EXCEP_TXT ("AE_NOT_CONFIGURED", "The interface is not part of the current subsystem configuration") + EXCEP_TXT ("AE_NOT_CONFIGURED", "The interface is not part of the current subsystem configuration"), + EXCEP_TXT ("AE_ACCESS", "Permission denied for the requested operation") }; static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Pgm[] = diff --git a/sys/contrib/dev/acpica/include/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index a453805..cb76f65 100644 --- a/sys/contrib/dev/acpica/include/acglobal.h +++ b/sys/contrib/dev/acpica/include/acglobal.h @@ -274,6 +274,7 @@ ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler; ACPI_EXTERN void *AcpiGbl_TableHandlerContext; ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; ACPI_EXTERN ACPI_INTERFACE_HANDLER AcpiGbl_InterfaceHandler; +ACPI_EXTERN ACPI_SCI_HANDLER_INFO *AcpiGbl_SciHandlerList; /* Owner ID support */ @@ -453,13 +454,6 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport; - -ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]; -ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]; -ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char AcpiGbl_DbScopeBuf[80]; -ACPI_EXTERN char AcpiGbl_DbDebugFilename[80]; ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile; ACPI_EXTERN char *AcpiGbl_DbBuffer; ACPI_EXTERN char *AcpiGbl_DbFilename; @@ -467,6 +461,16 @@ ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel; ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode; +ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]; + +/* These buffers should all be the same size */ + +ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_EXTERN char AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_EXTERN char AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]; + /* * Statistic globals */ diff --git a/sys/contrib/dev/acpica/include/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index a3569fb..5ee1430 100644 --- a/sys/contrib/dev/acpica/include/aclocal.h +++ b/sys/contrib/dev/acpica/include/aclocal.h @@ -453,6 +453,16 @@ typedef struct acpi_simple_repair_info * ****************************************************************************/ +/* Dispatch info for each host-installed SCI handler */ + +typedef struct acpi_sci_handler_info +{ + struct acpi_sci_handler_info *Next; + ACPI_SCI_HANDLER Address; /* Address of handler */ + void *Context; /* Context to be passed to handler */ + +} ACPI_SCI_HANDLER_INFO; + /* Dispatch info for each GPE -- either a method or handler, cannot be both */ typedef struct acpi_gpe_handler_info @@ -1217,7 +1227,8 @@ typedef struct acpi_external_list /* Values for Flags field above */ -#define ACPI_IPATH_ALLOCATED 0x01 +#define ACPI_IPATH_ALLOCATED 0x01 +#define ACPI_FROM_REFERENCE_FILE 0x02 typedef struct acpi_external_file diff --git a/sys/contrib/dev/acpica/include/acnamesp.h b/sys/contrib/dev/acpica/include/acnamesp.h index 63caba3..2dba629 100644 --- a/sys/contrib/dev/acpica/include/acnamesp.h +++ b/sys/contrib/dev/acpica/include/acnamesp.h @@ -272,6 +272,14 @@ AcpiNsDumpObjects ( ACPI_OWNER_ID OwnerId, ACPI_HANDLE StartHandle); +void +AcpiNsDumpObjectPaths ( + ACPI_OBJECT_TYPE Type, + UINT8 DisplayType, + UINT32 MaxDepth, + ACPI_OWNER_ID OwnerId, + ACPI_HANDLE StartHandle); + /* * nseval - Namespace evaluation functions diff --git a/sys/contrib/dev/acpica/include/acpiosxf.h b/sys/contrib/dev/acpica/include/acpiosxf.h index 747a4ed..c948d3f 100644 --- a/sys/contrib/dev/acpica/include/acpiosxf.h +++ b/sys/contrib/dev/acpica/include/acpiosxf.h @@ -404,6 +404,7 @@ ACPI_STATUS AcpiOsGetTableByIndex ( UINT32 Index, ACPI_TABLE_HEADER **Table, + UINT32 *Instance, ACPI_PHYSICAL_ADDRESS *Address); ACPI_STATUS diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 4f4e81a..80f724a 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -47,7 +47,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20130725 +#define ACPI_CA_VERSION 0x20130823 #include <contrib/dev/acpica/include/acconfig.h> #include <contrib/dev/acpica/include/actypes.h> @@ -377,6 +377,17 @@ AcpiInstallInitializationHandler ( ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS +AcpiInstallSciHandler ( + ACPI_SCI_HANDLER Address, + void *Context)) + +ACPI_HW_DEPENDENT_RETURN_STATUS ( +ACPI_STATUS +AcpiRemoveSciHandler ( + ACPI_SCI_HANDLER Address)) + +ACPI_HW_DEPENDENT_RETURN_STATUS ( +ACPI_STATUS AcpiInstallGlobalEventHandler ( ACPI_GBL_EVENT_HANDLER Handler, void *Context)) diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index cf98e4b..dafbfd5 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -488,6 +488,11 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) #endif +/* Support for the special RSDP signature (8 characters) */ + +#define ACPI_VALIDATE_RSDP_SIG(a) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) +#define ACPI_MAKE_RSDP_SIG(dest) (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) + /******************************************************************************* * @@ -1006,6 +1011,10 @@ typedef void * Various handlers and callback procedures */ typedef +UINT32 (*ACPI_SCI_HANDLER) ( + void *Context); + +typedef void (*ACPI_GBL_EVENT_HANDLER) ( UINT32 EventType, ACPI_HANDLE Device, diff --git a/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c b/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c index 19637a0..31bb471 100644 --- a/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c +++ b/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c @@ -1023,6 +1023,7 @@ AcpiOsReadPciConfiguration ( UINT32 Width) { + *Value = 0; return (AE_OK); } |