summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2013-08-23 18:01:58 +0000
committerjkim <jkim@FreeBSD.org>2013-08-23 18:01:58 +0000
commitb2a92415360aacb32d9b6107bdcf100d16d09167 (patch)
tree89234dd9f502de2faaf4a280ccd0d3785a7ae96f
parent8e9a373708032aaf58694e237e3889d7d3fd796f (diff)
downloadFreeBSD-src-b2a92415360aacb32d9b6107bdcf100d16d09167.zip
FreeBSD-src-b2a92415360aacb32d9b6107bdcf100d16d09167.tar.gz
Import ACPICA 20130823.
-rw-r--r--changes.txt84
-rw-r--r--generate/unix/acpidump/Makefile2
-rw-r--r--source/common/adisasm.c4
-rw-r--r--source/common/adwalk.c10
-rw-r--r--source/common/dmextern.c326
-rw-r--r--source/common/dmtable.c2
-rw-r--r--source/compiler/aslcompile.c25
-rw-r--r--source/compiler/aslglobal.h1
-rw-r--r--source/compiler/aslload.c4
-rw-r--r--source/compiler/aslmain.c1
-rw-r--r--source/compiler/asloptions.c30
-rw-r--r--source/compiler/dtcompile.c2
-rw-r--r--source/components/debugger/dbcmds.c8
-rw-r--r--source/components/debugger/dbfileio.c9
-rw-r--r--source/components/debugger/dbinput.c28
-rw-r--r--source/components/debugger/dbnames.c31
-rw-r--r--source/components/events/evgpeutil.c2
-rw-r--r--source/components/events/evmisc.c18
-rw-r--r--source/components/events/evregion.c26
-rw-r--r--source/components/events/evsci.c87
-rw-r--r--source/components/events/evxface.c163
-rw-r--r--source/components/hardware/hwxface.c25
-rw-r--r--source/components/namespace/nsaccess.c4
-rw-r--r--source/components/namespace/nsdump.c152
-rw-r--r--source/components/namespace/nsxfeval.c9
-rw-r--r--source/components/tables/tbinstal.c9
-rw-r--r--source/components/tables/tbprint.c13
-rw-r--r--source/components/tables/tbxfroot.c3
-rw-r--r--source/components/utilities/utdebug.c2
-rw-r--r--source/components/utilities/utglobal.c3
-rw-r--r--source/include/acdebug.h8
-rw-r--r--source/include/acdisasm.h3
-rw-r--r--source/include/acevents.h10
-rw-r--r--source/include/acexcep.h8
-rw-r--r--source/include/acglobal.h18
-rw-r--r--source/include/aclocal.h13
-rw-r--r--source/include/acnamesp.h8
-rw-r--r--source/include/acpiosxf.h1
-rw-r--r--source/include/acpixf.h13
-rw-r--r--source/include/actypes.h9
-rw-r--r--source/include/platform/aclinux.h2
-rw-r--r--source/os_specific/service_layers/osfreebsdtbl.c107
-rw-r--r--source/os_specific/service_layers/oslinuxtbl.c1236
-rw-r--r--source/os_specific/service_layers/osunixdir.c11
-rw-r--r--source/os_specific/service_layers/osunixmap.c171
-rw-r--r--source/os_specific/service_layers/osunixxf.c1
-rw-r--r--source/os_specific/service_layers/oswintbl.c54
-rw-r--r--source/os_specific/service_layers/oswinxf.c1
-rw-r--r--source/tools/acpibin/abmain.c25
-rw-r--r--source/tools/acpidump/acpidump.h18
-rw-r--r--source/tools/acpidump/apdump.c145
-rw-r--r--source/tools/acpidump/apfiles.c40
-rw-r--r--source/tools/acpidump/apmain.c23
-rw-r--r--source/tools/acpiexec/aehandlers.c83
-rw-r--r--source/tools/acpiexec/aemain.c10
-rw-r--r--source/tools/acpiexec/aetables.c2
-rw-r--r--source/tools/acpihelp/ahmain.c12
-rw-r--r--source/tools/acpinames/anmain.c12
-rw-r--r--source/tools/acpinames/antables.c2
-rw-r--r--source/tools/acpisrc/asmain.c30
-rw-r--r--source/tools/acpisrc/astable.c2
-rw-r--r--source/tools/acpixtract/axmain.c12
-rw-r--r--tests/misc/grammar.asl84
63 files changed, 2382 insertions, 875 deletions
diff --git a/changes.txt b/changes.txt
index 83c156b..ab43358 100644
--- a/changes.txt
+++ b/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/generate/unix/acpidump/Makefile b/generate/unix/acpidump/Makefile
index 9865b2c..b7d2021 100644
--- a/generate/unix/acpidump/Makefile
+++ b/generate/unix/acpidump/Makefile
@@ -31,6 +31,8 @@ OBJECTS = \
$(OBJDIR)/apdump.o\
$(OBJDIR)/apfiles.o\
$(OBJDIR)/apmain.o\
+ $(OBJDIR)/osunixdir.o\
+ $(OBJDIR)/osunixmap.o\
$(OBJDIR)/tbprint.o\
$(OBJDIR)/tbxfroot.o\
$(OBJDIR)/utbuffer.o\
diff --git a/source/common/adisasm.c b/source/common/adisasm.c
index fd20a22..582761d 100644
--- a/source/common/adisasm.c
+++ b/source/common/adisasm.c
@@ -341,6 +341,10 @@ AdAmlDisassemble (
{
AcpiDmClearExternalList ();
}
+
+ /* Load any externals defined in the optional external ref file */
+
+ AcpiDmGetExternalsFromFile ();
}
else
{
diff --git a/source/common/adwalk.c b/source/common/adwalk.c
index 5ba7922..2fb42fd 100644
--- a/source/common/adwalk.c
+++ b/source/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/source/common/dmextern.c b/source/common/dmextern.c
index e743117..b783040 100644
--- a/source/common/dmextern.c
+++ b/source/common/dmextern.c
@@ -46,7 +46,9 @@
#include "amlcode.h"
#include "acnamesp.h"
#include "acdisasm.h"
+#include "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/source/common/dmtable.c b/source/common/dmtable.c
index e57b8cc..255c3c2 100644
--- a/source/common/dmtable.c
+++ b/source/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/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 87f97ef..6aa8701 100644
--- a/source/compiler/aslcompile.c
+++ b/source/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/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index e1be4ae..3f2c401 100644
--- a/source/compiler/aslglobal.h
+++ b/source/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/source/compiler/aslload.c b/source/compiler/aslload.c
index 7f3ce1d..9a768d8 100644
--- a/source/compiler/aslload.c
+++ b/source/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/source/compiler/aslmain.c b/source/compiler/aslmain.c
index a75a6fd..2e62c87 100644
--- a/source/compiler/aslmain.c
+++ b/source/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/source/compiler/asloptions.c b/source/compiler/asloptions.c
index 441dbb3..5fbd43e 100644
--- a/source/compiler/asloptions.c
+++ b/source/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/source/compiler/dtcompile.c b/source/compiler/dtcompile.c
index 0931536..2b92322 100644
--- a/source/compiler/dtcompile.c
+++ b/source/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/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c
index 307644b..be35763 100644
--- a/source/components/debugger/dbcmds.c
+++ b/source/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/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c
index 3a8ece7..3ba9653 100644
--- a/source/components/debugger/dbfileio.c
+++ b/source/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/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c
index e7d88bc..511e585 100644
--- a/source/components/debugger/dbinput.c
+++ b/source/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/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c
index 1e1543c..e3c6d71 100644
--- a/source/components/debugger/dbnames.c
+++ b/source/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/source/components/events/evgpeutil.c b/source/components/events/evgpeutil.c
index 5dad4f0..492c16f 100644
--- a/source/components/events/evgpeutil.c
+++ b/source/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/source/components/events/evmisc.c b/source/components/events/evmisc.c
index 1990a41..ad95c5a 100644
--- a/source/components/events/evmisc.c
+++ b/source/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/source/components/events/evregion.c b/source/components/events/evregion.c
index 8e11b29..278c685 100644
--- a/source/components/events/evregion.c
+++ b/source/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/source/components/events/evsci.c b/source/components/events/evsci.c
index eca143f..c254356 100644
--- a/source/components/events/evsci.c
+++ b/source/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/source/components/events/evxface.c b/source/components/events/evxface.c
index 99ea6cc..0e83930 100644
--- a/source/components/events/evxface.c
+++ b/source/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/source/components/hardware/hwxface.c b/source/components/hardware/hwxface.c
index 25ad60a..45d5654 100644
--- a/source/components/hardware/hwxface.c
+++ b/source/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/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c
index ad94f6c..d1271a4 100644
--- a/source/components/namespace/nsaccess.c
+++ b/source/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/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c
index 82e6602..5559d9a 100644
--- a/source/components/namespace/nsdump.c
+++ b/source/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/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c
index e5c1e17..007ade3 100644
--- a/source/components/namespace/nsxfeval.c
+++ b/source/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/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c
index e480749..ecbf256 100644
--- a/source/components/tables/tbinstal.c
+++ b/source/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/source/components/tables/tbprint.c b/source/components/tables/tbprint.c
index 7823ffc..f24de49 100644
--- a/source/components/tables/tbprint.c
+++ b/source/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/source/components/tables/tbxfroot.c b/source/components/tables/tbxfroot.c
index fa67781..812f180 100644
--- a/source/components/tables/tbxfroot.c
+++ b/source/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/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c
index e879967..712c188 100644
--- a/source/components/utilities/utdebug.c
+++ b/source/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/source/components/utilities/utglobal.c b/source/components/utilities/utglobal.c
index 56c4e06..ff24515 100644
--- a/source/components/utilities/utglobal.c
+++ b/source/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/source/include/acdebug.h b/source/include/acdebug.h
index 5fef182..37d41d3 100644
--- a/source/include/acdebug.h
+++ b/source/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/source/include/acdisasm.h b/source/include/acdisasm.h
index 84af4a6..d9257e9 100644
--- a/source/include/acdisasm.h
+++ b/source/include/acdisasm.h
@@ -694,6 +694,9 @@ void
AcpiDmUnresolvedWarning (
UINT8 Type);
+void
+AcpiDmGetExternalsFromFile (
+ void);
/*
* dmresrc
diff --git a/source/include/acevents.h b/source/include/acevents.h
index fc652b4..67095aa 100644
--- a/source/include/acevents.h
+++ b/source/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/source/include/acexcep.h b/source/include/acexcep.h
index 9961acc..7bcfe1d 100644
--- a/source/include/acexcep.h
+++ b/source/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/source/include/acglobal.h b/source/include/acglobal.h
index a453805..cb76f65 100644
--- a/source/include/acglobal.h
+++ b/source/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/source/include/aclocal.h b/source/include/aclocal.h
index a3569fb..5ee1430 100644
--- a/source/include/aclocal.h
+++ b/source/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/source/include/acnamesp.h b/source/include/acnamesp.h
index 63caba3..2dba629 100644
--- a/source/include/acnamesp.h
+++ b/source/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/source/include/acpiosxf.h b/source/include/acpiosxf.h
index a1ac1d9..f3f624d 100644
--- a/source/include/acpiosxf.h
+++ b/source/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/source/include/acpixf.h b/source/include/acpixf.h
index 7dee52a..18e5200 100644
--- a/source/include/acpixf.h
+++ b/source/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 "acconfig.h"
#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/source/include/actypes.h b/source/include/actypes.h
index cf98e4b..dafbfd5 100644
--- a/source/include/actypes.h
+++ b/source/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/source/include/platform/aclinux.h b/source/include/platform/aclinux.h
index e59a3c3..edd4556 100644
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -87,7 +87,7 @@
#define ACPI_FLUSH_CPU_CACHE()
#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (pthread))
-#if defined(__ia64__) || defined(__x86_64__)
+#if defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long
diff --git a/source/os_specific/service_layers/osfreebsdtbl.c b/source/os_specific/service_layers/osfreebsdtbl.c
index 9d39bc3..3f9fa4b 100644
--- a/source/os_specific/service_layers/osfreebsdtbl.c
+++ b/source/os_specific/service_layers/osfreebsdtbl.c
@@ -45,7 +45,6 @@
#include <kenv.h>
#include <unistd.h>
-#include <sys/mman.h>
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -78,10 +77,6 @@ OslGetTableViaRoot (
ACPI_PHYSICAL_ADDRESS *Address);
-/* File locations */
-
-#define SYSTEM_MEMORY "/dev/mem"
-
/* Hints for RSDP */
#define SYSTEM_KENV "hint.acpi.0.rsdp"
@@ -278,6 +273,8 @@ AcpiOsGetTableByName (
*
* PARAMETERS: Index - Which table to get
* Table - Where a pointer to the table is returned
+ * Instance - Where a pointer to the table instance no. is
+ * returned
* Address - Where the table physical address is returned
*
* RETURN: Status; Table buffer and physical address returned if AE_OK.
@@ -293,6 +290,7 @@ ACPI_STATUS
AcpiOsGetTableByIndex (
UINT32 Index,
ACPI_TABLE_HEADER **Table,
+ UINT32 *Instance,
ACPI_PHYSICAL_ADDRESS *Address)
{
OSL_TABLE_INFO *Info;
@@ -346,86 +344,12 @@ AcpiOsGetTableByIndex (
Status = AcpiOsGetTableByName (Info->Signature, Info->Instance,
Table, Address);
}
- return (Status);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiOsMapMemory
- *
- * PARAMETERS: Where - Physical address of memory to be mapped
- * Length - How much memory to map
- *
- * RETURN: Pointer to mapped memory. Null on error.
- *
- * DESCRIPTION: Map physical memory into local address space.
- *
- *****************************************************************************/
-void *
-AcpiOsMapMemory (
- ACPI_PHYSICAL_ADDRESS Where,
- ACPI_SIZE Length)
-{
- UINT8 *MappedMemory;
- ACPI_PHYSICAL_ADDRESS Offset;
- int fd;
-
-
- fd = open (SYSTEM_MEMORY, O_RDONLY);
- if (fd < 0)
- {
- fprintf (stderr, "Cannot open %s\n", SYSTEM_MEMORY);
- return (NULL);
- }
-
- /* Align the offset to use mmap */
-
- Offset = Where % PAGE_SIZE;
-
- /* Map the table header to get the length of the full table */
-
- MappedMemory = mmap (NULL, (Length + Offset), PROT_READ, MAP_SHARED,
- fd, (Where - Offset));
- close (fd);
-
- if (MappedMemory == MAP_FAILED)
+ if (ACPI_SUCCESS (Status))
{
- fprintf (stderr,
- "Could not map memory at 0x%8.8X%8.8X length 0x%8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (Where), ACPI_FORMAT_NATIVE_UINT (Length));
- return (NULL);
+ *Instance = Info->Instance;
}
-
- return (ACPI_CAST8 (MappedMemory + Offset));
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiOsUnmapMemory
- *
- * PARAMETERS: Where - Logical address of memory to be unmapped
- * Length - How much memory to unmap
- *
- * RETURN: None.
- *
- * DESCRIPTION: Delete a previously created mapping. Where and Length must
- * correspond to a previous mapping exactly.
- *
- *****************************************************************************/
-
-void
-AcpiOsUnmapMemory (
- void *Where,
- ACPI_SIZE Length)
-{
- ACPI_PHYSICAL_ADDRESS Offset;
-
-
- Offset = (ACPI_PHYSICAL_ADDRESS) Where % PAGE_SIZE;
- munmap ((UINT8 *) Where - Offset, (Length + Offset));
+ return (Status);
}
@@ -467,7 +391,11 @@ OslTableInitialize (
/* Attempt to use kenv or sysctl to find RSD PTR record. */
- if (kenv (KENV_GET, SYSTEM_KENV, Buffer, sizeof (Buffer)) > 0)
+ if (Gbl_RsdpBase)
+ {
+ Address = Gbl_RsdpBase;
+ }
+ else if (kenv (KENV_GET, SYSTEM_KENV, Buffer, sizeof (Buffer)) > 0)
{
Address = ACPI_STRTOUL (Buffer, NULL, 0);
}
@@ -962,18 +890,9 @@ OslMapTable (
return (AE_BAD_ADDRESS);
}
- *Table = MappedTable;
-
- /*
- * Checksum for RSDP.
- * Note: Other checksums are computed during the table dump.
- */
+ (void) ApIsValidChecksum (MappedTable);
- if (AcpiTbValidateRsdp (ACPI_CAST_PTR (ACPI_TABLE_RSDP, MappedTable)) ==
- AE_BAD_CHECKSUM)
- {
- fprintf (stderr, "Warning: wrong checksum for RSDP\n");
- }
+ *Table = MappedTable;
return (AE_OK);
}
diff --git a/source/os_specific/service_layers/oslinuxtbl.c b/source/os_specific/service_layers/oslinuxtbl.c
index fd593a1..1d27b0c 100644
--- a/source/os_specific/service_layers/oslinuxtbl.c
+++ b/source/os_specific/service_layers/oslinuxtbl.c
@@ -43,23 +43,26 @@
#include "acpidump.h"
-#include <dirent.h>
-#include <sys/mman.h>
-
#define _COMPONENT ACPI_OS_SERVICES
ACPI_MODULE_NAME ("oslinuxtbl")
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
#ifndef PATH_MAX
#define PATH_MAX 256
#endif
+/* List of information about obtained ACPI tables */
+
+typedef struct table_info
+{
+ struct table_info *Next;
+ UINT32 Instance;
+ char Signature[ACPI_NAME_SIZE];
+
+} OSL_TABLE_INFO;
+
/* Local prototypes */
static ACPI_STATUS
@@ -67,8 +70,19 @@ OslTableInitialize (
void);
static ACPI_STATUS
+OslTableNameFromFile (
+ char *Filename,
+ char *Signature,
+ UINT32 *Instance);
+
+static ACPI_STATUS
+OslAddTableToList (
+ char *Signature,
+ UINT32 Instance);
+
+static ACPI_STATUS
OslReadTableFromFile (
- FILE *TableFile,
+ char *Filename,
ACPI_SIZE FileOffset,
char *Signature,
ACPI_TABLE_HEADER **Table);
@@ -79,72 +93,117 @@ OslMapTable (
char *Signature,
ACPI_TABLE_HEADER **Table);
+static void
+OslUnmapTable (
+ ACPI_TABLE_HEADER *Table);
+
+static ACPI_PHYSICAL_ADDRESS
+OslFindRsdpViaEfi (
+ void);
+
static ACPI_STATUS
-OslGetOverrideTable (
- char *Signature,
- UINT32 Instance,
- ACPI_TABLE_HEADER **Table,
- ACPI_PHYSICAL_ADDRESS *Address);
+OslLoadRsdp (
+ void);
+
+static ACPI_STATUS
+OslListCustomizedTables (
+ char *Directory);
static ACPI_STATUS
-OslGetDynamicSsdt (
+OslGetCustomizedTable (
+ char *Pathname,
+ char *Signature,
UINT32 Instance,
ACPI_TABLE_HEADER **Table,
ACPI_PHYSICAL_ADDRESS *Address);
static ACPI_STATUS
-OslAddTablesToList (
- char *Directory);
+OslListBiosTables (
+ void);
static ACPI_STATUS
-OslGetTableViaRoot (
+OslGetBiosTable (
char *Signature,
UINT32 Instance,
ACPI_TABLE_HEADER **Table,
ACPI_PHYSICAL_ADDRESS *Address);
+static ACPI_STATUS
+OslGetLastStatus (
+ ACPI_STATUS DefaultStatus);
+
/* File locations */
-#define DYNAMIC_SSDT_DIR "/sys/firmware/acpi/tables/dynamic"
-#define OVERRIDE_TABLE_DIR "/sys/firmware/acpi/tables"
-#define SYSTEM_MEMORY "/dev/mem"
+#define DYNAMIC_TABLE_DIR "/sys/firmware/acpi/tables/dynamic"
+#define STATIC_TABLE_DIR "/sys/firmware/acpi/tables"
+#define EFI_SYSTAB "/sys/firmware/efi/systab"
-/* Should we get dynamically loaded SSDTs from DYNAMIC_SSDT_DIR? */
+/* Should we get dynamically loaded SSDTs from DYNAMIC_TABLE_DIR? */
-UINT8 Gbl_DumpDynamicSsdts = TRUE;
+UINT8 Gbl_DumpDynamicTables = TRUE;
/* Initialization flags */
UINT8 Gbl_TableListInitialized = FALSE;
-UINT8 Gbl_MainTableObtained = FALSE;
/* Local copies of main ACPI tables */
ACPI_TABLE_RSDP Gbl_Rsdp;
-ACPI_TABLE_FADT *Gbl_Fadt;
-ACPI_TABLE_RSDT *Gbl_Rsdt;
-ACPI_TABLE_XSDT *Gbl_Xsdt;
+ACPI_TABLE_FADT *Gbl_Fadt = NULL;
+ACPI_TABLE_RSDT *Gbl_Rsdt = NULL;
+ACPI_TABLE_XSDT *Gbl_Xsdt = NULL;
-/* Fadt address */
+/* Table addresses */
-ACPI_PHYSICAL_ADDRESS Gbl_FadtAddress;
+ACPI_PHYSICAL_ADDRESS Gbl_FadtAddress = 0;
+ACPI_PHYSICAL_ADDRESS Gbl_RsdpAddress = 0;
/* Revision of RSD PTR */
-UINT8 Gbl_Revision;
+UINT8 Gbl_Revision = 0;
-/* List of information about obtained ACPI tables */
+OSL_TABLE_INFO *Gbl_TableListHead = NULL;
+UINT32 Gbl_TableCount = 0;
-typedef struct table_info
+
+/******************************************************************************
+ *
+ * FUNCTION: OslGetLastStatus
+ *
+ * PARAMETERS: DefaultStatus - Default error status to return
+ *
+ * RETURN: Status; Converted from errno.
+ *
+ * DESCRIPTION: Get last errno and conver it to ACPI_STATUS.
+ *
+ *****************************************************************************/
+
+static ACPI_STATUS
+OslGetLastStatus (
+ ACPI_STATUS DefaultStatus)
{
- struct table_info *Next;
- UINT32 Instance;
- char Signature[4];
-} OSL_TABLE_INFO;
+ switch (errno)
+ {
+ case EACCES:
+ case EPERM:
-OSL_TABLE_INFO *Gbl_TableListHead = NULL;
+ return (AE_ACCESS);
+
+ case ENOENT:
+
+ return (AE_NOT_FOUND);
+
+ case ENOMEM:
+
+ return (AE_NO_MEMORY);
+
+ default:
+
+ return (DefaultStatus);
+ }
+}
/******************************************************************************
@@ -166,18 +225,18 @@ AcpiOsGetTableByAddress (
ACPI_PHYSICAL_ADDRESS Address,
ACPI_TABLE_HEADER **Table)
{
+ UINT32 TableLength;
ACPI_TABLE_HEADER *MappedTable;
- ACPI_TABLE_HEADER *LocalTable;
- ACPI_STATUS Status;
+ ACPI_TABLE_HEADER *LocalTable = NULL;
+ ACPI_STATUS Status = AE_OK;
- /* Validate the input physical address to avoid program crash */
+ /* Get main ACPI tables from memory on first invocation of this function */
- if (Address < ACPI_HI_RSDP_WINDOW_BASE)
+ Status = OslTableInitialize ();
+ if (ACPI_FAILURE (Status))
{
- fprintf (stderr, "Invalid table address: 0x%8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (Address));
- return (AE_BAD_ADDRESS);
+ return (Status);
}
/* Map the table and validate it */
@@ -190,16 +249,24 @@ AcpiOsGetTableByAddress (
/* Copy table to local buffer and return it */
- LocalTable = calloc (1, MappedTable->Length);
+ TableLength = ApGetTableLength (MappedTable);
+ if (TableLength == 0)
+ {
+ Status = AE_BAD_HEADER;
+ goto ErrorExit;
+ }
+
+ LocalTable = calloc (1, TableLength);
if (!LocalTable)
{
- AcpiOsUnmapMemory (MappedTable, MappedTable->Length);
- return (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto ErrorExit;
}
- ACPI_MEMCPY (LocalTable, MappedTable, MappedTable->Length);
- AcpiOsUnmapMemory (MappedTable, MappedTable->Length);
+ ACPI_MEMCPY (LocalTable, MappedTable, TableLength);
+ErrorExit:
+ OslUnmapTable (MappedTable);
*Table = LocalTable;
return (AE_OK);
}
@@ -234,81 +301,122 @@ AcpiOsGetTableByName (
ACPI_STATUS Status;
- /* Instance is only valid for SSDTs */
+ /* Get main ACPI tables from memory on first invocation of this function */
- if (Instance &&
- !ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT) &&
- !ACPI_COMPARE_NAME (Signature, ACPI_SIG_UEFI))
+ Status = OslTableInitialize ();
+ if (ACPI_FAILURE (Status))
{
- return (AE_LIMIT);
+ return (Status);
}
- /* Get main ACPI tables from memory on first invocation of this function */
+ /* Not a main ACPI table, attempt to extract it from the RSDT/XSDT */
- if (!Gbl_MainTableObtained)
+ if (!Gbl_DumpCustomizedTables)
{
- Status = OslTableInitialize ();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ /* Attempt to get the table from the memory */
- Gbl_MainTableObtained = TRUE;
+ Status = OslGetBiosTable (Signature, Instance, Table, Address);
}
-
- /*
- * If one of the main ACPI tables was requested (RSDT/XSDT/FADT),
- * simply return it immediately.
- */
- if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_XSDT))
+ else
{
- if (!Gbl_Revision)
- {
- return (AE_NOT_FOUND);
- }
+ /* Attempt to get the table from the static directory */
- *Address = Gbl_Rsdp.XsdtPhysicalAddress;
- *Table = (ACPI_TABLE_HEADER *) Gbl_Xsdt;
- return (AE_OK);
+ Status = OslGetCustomizedTable (STATIC_TABLE_DIR, Signature,
+ Instance, Table, Address);
}
- if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDT))
+ if (ACPI_FAILURE (Status) && Status == AE_LIMIT)
{
- if (!Gbl_Rsdp.RsdtPhysicalAddress)
+ if (Gbl_DumpDynamicTables)
{
- return (AE_NOT_FOUND);
- }
+ /* Attempt to get a dynamic table */
- *Address = Gbl_Rsdp.RsdtPhysicalAddress;
- *Table = (ACPI_TABLE_HEADER *) Gbl_Rsdt;
- return (AE_OK);
+ Status = OslGetCustomizedTable (DYNAMIC_TABLE_DIR, Signature,
+ Instance, Table, Address);
+ }
}
- if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FADT))
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: OslAddTableToList
+ *
+ * PARAMETERS: Signature - Table signature
+ * Instance - Table instance
+ *
+ * RETURN: Status; Successfully added if AE_OK.
+ * AE_NO_MEMORY: Memory allocation error
+ *
+ * DESCRIPTION: Insert a table structure into OSL table list.
+ *
+ *****************************************************************************/
+
+static ACPI_STATUS
+OslAddTableToList (
+ char *Signature,
+ UINT32 Instance)
+{
+ OSL_TABLE_INFO *NewInfo;
+ OSL_TABLE_INFO *Next;
+ UINT32 NextInstance = 0;
+ BOOLEAN Found = FALSE;
+
+
+ NewInfo = calloc (1, sizeof (OSL_TABLE_INFO));
+ if (!NewInfo)
{
- *Address = Gbl_FadtAddress;
- *Table = (ACPI_TABLE_HEADER *) Gbl_Fadt;
- return (AE_OK);
+ return (AE_NO_MEMORY);
}
- /* Not a main ACPI table, attempt to extract it from the RSDT/XSDT */
+ ACPI_MOVE_NAME (NewInfo->Signature, Signature);
- Status = OslGetTableViaRoot (Signature, Instance, Table, Address);
- if (ACPI_FAILURE (Status))
+ if (!Gbl_TableListHead)
{
- /* Attempt to get the table from the override directory */
-
- Status = OslGetOverrideTable (Signature, Instance, Table, Address);
- if ((Status == AE_LIMIT) && Gbl_DumpDynamicSsdts)
+ Gbl_TableListHead = NewInfo;
+ }
+ else
+ {
+ Next = Gbl_TableListHead;
+ while (1)
{
- /* Attempt to get a dynamic SSDT */
+ if (ACPI_COMPARE_NAME (Next->Signature, Signature))
+ {
+ if (Next->Instance == Instance)
+ {
+ Found = TRUE;
+ }
+ if (Next->Instance >= NextInstance)
+ {
+ NextInstance = Next->Instance + 1;
+ }
+ }
- Status = OslGetDynamicSsdt (Instance, Table, Address);
+ if (!Next->Next)
+ {
+ break;
+ }
+ Next = Next->Next;
}
+ Next->Next = NewInfo;
+ }
- return (Status);
+ if (Found)
+ {
+ if (Instance)
+ {
+ fprintf (stderr,
+ "%4.4s: Warning unmatched table instance %d, expected %d\n",
+ Signature, Instance, NextInstance);
+ }
+ Instance = NextInstance;
}
+ NewInfo->Instance = Instance;
+ Gbl_TableCount++;
+
return (AE_OK);
}
@@ -319,6 +427,8 @@ AcpiOsGetTableByName (
*
* PARAMETERS: Index - Which table to get
* Table - Where a pointer to the table is returned
+ * Instance - Where a pointer to the table instance no. is
+ * returned
* Address - Where the table physical address is returned
*
* RETURN: Status; Table buffer and physical address returned if AE_OK.
@@ -334,6 +444,7 @@ ACPI_STATUS
AcpiOsGetTableByIndex (
UINT32 Index,
ACPI_TABLE_HEADER **Table,
+ UINT32 *Instance,
ACPI_PHYSICAL_ADDRESS *Address)
{
OSL_TABLE_INFO *Info;
@@ -341,38 +452,17 @@ AcpiOsGetTableByIndex (
UINT32 i;
- /* Initialize the table list on first invocation */
+ /* Get main ACPI tables from memory on first invocation of this function */
- if (!Gbl_TableListInitialized)
+ Status = OslTableInitialize ();
+ if (ACPI_FAILURE (Status))
{
- Gbl_TableListHead = calloc (1, sizeof (OSL_TABLE_INFO));
-
- /* List head records the length of the list */
-
- Gbl_TableListHead->Instance = 0;
-
- /* Add all tables found in the override directory */
-
- Status = OslAddTablesToList (OVERRIDE_TABLE_DIR);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- /* Add all dynamically loaded SSDTs in the dynamic directory */
-
- OslAddTablesToList (DYNAMIC_SSDT_DIR);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- Gbl_TableListInitialized = TRUE;
+ return (Status);
}
/* Validate Index */
- if (Index >= Gbl_TableListHead->Instance)
+ if (Index >= Gbl_TableCount)
{
return (AE_LIMIT);
}
@@ -380,7 +470,7 @@ AcpiOsGetTableByIndex (
/* Point to the table list entry specified by the Index argument */
Info = Gbl_TableListHead;
- for (i = 0; i <= Index; i++)
+ for (i = 0; i < Index; i++)
{
Info = Info->Next;
}
@@ -389,87 +479,115 @@ AcpiOsGetTableByIndex (
Status = AcpiOsGetTableByName (Info->Signature, Info->Instance,
Table, Address);
+
+ if (ACPI_SUCCESS (Status))
+ {
+ *Instance = Info->Instance;
+ }
return (Status);
}
/******************************************************************************
*
- * FUNCTION: AcpiOsMapMemory
+ * FUNCTION: OslFindRsdpViaEfi
*
- * PARAMETERS: Where - Physical address of memory to be mapped
- * Length - How much memory to map
+ * PARAMETERS: None
*
- * RETURN: Pointer to mapped memory. Null on error.
+ * RETURN: RSDP address if found
*
- * DESCRIPTION: Map physical memory into local address space.
+ * DESCRIPTION: Find RSDP address via EFI.
*
*****************************************************************************/
-void *
-AcpiOsMapMemory (
- ACPI_PHYSICAL_ADDRESS Where,
- ACPI_SIZE Length)
+static ACPI_PHYSICAL_ADDRESS
+OslFindRsdpViaEfi (
+ void)
{
- UINT8 *MappedMemory;
- ACPI_PHYSICAL_ADDRESS Offset;
- ACPI_SIZE PageSize;
- int fd;
-
-
- fd = open (SYSTEM_MEMORY, O_RDONLY | O_BINARY);
- if (fd < 0)
- {
- fprintf (stderr, "Cannot open %s\n", SYSTEM_MEMORY);
- return (NULL);
- }
-
- /* Align the offset to use mmap */
+ FILE *File;
+ char Buffer[80];
+ unsigned long Address = 0;
- PageSize = sysconf (_SC_PAGESIZE);
- Offset = Where % PageSize;
- /* Map the table header to get the length of the full table */
-
- MappedMemory = mmap (NULL, (Length + Offset), PROT_READ, MAP_PRIVATE,
- fd, (Where - Offset));
- close (fd);
-
- if (MappedMemory == MAP_FAILED)
+ File = fopen (EFI_SYSTAB, "r");
+ if (File)
{
- return (NULL);
+ while (fgets (Buffer, 80, File))
+ {
+ if (sscanf (Buffer, "ACPI20=0x%lx", &Address) == 1)
+ {
+ break;
+ }
+ }
+ fclose (File);
}
- return (ACPI_CAST8 (MappedMemory + Offset));
+ return ((ACPI_PHYSICAL_ADDRESS) (Address));
}
/******************************************************************************
*
- * FUNCTION: AcpiOsUnmapMemory
+ * FUNCTION: OslLoadRsdp
*
- * PARAMETERS: Where - Logical address of memory to be unmapped
- * Length - How much memory to unmap
+ * PARAMETERS: None
*
- * RETURN: None.
+ * RETURN: Status
*
- * DESCRIPTION: Delete a previously created mapping. Where and Length must
- * correspond to a previous mapping exactly.
+ * DESCRIPTION: Scan and load RSDP.
*
*****************************************************************************/
-void
-AcpiOsUnmapMemory (
- void *Where,
- ACPI_SIZE Length)
+static ACPI_STATUS
+OslLoadRsdp (
+ void)
{
- ACPI_PHYSICAL_ADDRESS Offset;
- ACPI_SIZE PageSize;
+ ACPI_TABLE_HEADER *MappedTable;
+ UINT8 *RsdpAddress;
+ ACPI_PHYSICAL_ADDRESS RsdpBase;
+ ACPI_SIZE RsdpSize;
+
+
+ /* Get RSDP from memory */
+
+ RsdpSize = sizeof (ACPI_TABLE_RSDP);
+ if (Gbl_RsdpBase)
+ {
+ RsdpBase = Gbl_RsdpBase;
+ }
+ else
+ {
+ RsdpBase = OslFindRsdpViaEfi ();
+ }
+
+ if (!RsdpBase)
+ {
+ RsdpBase = ACPI_HI_RSDP_WINDOW_BASE;
+ RsdpSize = ACPI_HI_RSDP_WINDOW_SIZE;
+ }
+
+ RsdpAddress = AcpiOsMapMemory (RsdpBase, RsdpSize);
+ if (!RsdpAddress)
+ {
+ return (OslGetLastStatus (AE_BAD_ADDRESS));
+ }
+
+ /* Search low memory for the RSDP */
+
+ MappedTable = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
+ AcpiTbScanMemoryForRsdp (RsdpAddress, RsdpSize));
+ if (!MappedTable)
+ {
+ AcpiOsUnmapMemory (RsdpAddress, RsdpSize);
+ return (AE_NOT_FOUND);
+ }
+ Gbl_RsdpAddress = RsdpBase + (ACPI_CAST8 (MappedTable) - RsdpAddress);
- PageSize = sysconf (_SC_PAGESIZE);
- Offset = (ACPI_PHYSICAL_ADDRESS) Where % PageSize;
- munmap ((UINT8 *) Where - Offset, (Length + Offset));
+ ACPI_MEMCPY (&Gbl_Rsdp, MappedTable, sizeof (ACPI_TABLE_RSDP));
+ AcpiOsUnmapMemory (RsdpAddress, RsdpSize);
+
+ return (AE_OK);
}
@@ -491,130 +609,224 @@ static ACPI_STATUS
OslTableInitialize (
void)
{
- ACPI_TABLE_HEADER *MappedTable;
- UINT8 *TableData;
- UINT8 *RsdpAddress;
- ACPI_PHYSICAL_ADDRESS RsdpBase;
- ACPI_SIZE RsdpSize;
ACPI_STATUS Status;
+ ACPI_PHYSICAL_ADDRESS Address;
- /* Get RSDP from memory */
-
- RsdpBase = ACPI_HI_RSDP_WINDOW_BASE;
- RsdpSize = ACPI_HI_RSDP_WINDOW_SIZE;
-
- RsdpAddress = AcpiOsMapMemory (RsdpBase, RsdpSize);
- if (!RsdpAddress)
+ if (Gbl_TableListInitialized)
{
- return (AE_BAD_ADDRESS);
+ return (AE_OK);
}
- /* Search low memory for the RSDP */
+ /* Get RSDP from memory */
- MappedTable = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
- AcpiTbScanMemoryForRsdp (RsdpAddress, RsdpSize));
- if (!MappedTable)
+ Status = OslLoadRsdp ();
+ if (ACPI_FAILURE (Status))
{
- AcpiOsUnmapMemory (RsdpAddress, RsdpSize);
- return (AE_ERROR);
+ return (Status);
}
- ACPI_MEMCPY (&Gbl_Rsdp, MappedTable, sizeof (ACPI_TABLE_RSDP));
- AcpiOsUnmapMemory (RsdpAddress, RsdpSize);
-
/* Get XSDT from memory */
if (Gbl_Rsdp.Revision)
{
- Status = OslMapTable (Gbl_Rsdp.XsdtPhysicalAddress,
- ACPI_SIG_XSDT, &MappedTable);
- if (ACPI_FAILURE (Status))
+ if (Gbl_Xsdt)
{
- return (Status);
+ free (Gbl_Xsdt);
+ Gbl_Xsdt = NULL;
}
Gbl_Revision = 2;
- Gbl_Xsdt = calloc (1, MappedTable->Length);
- if (!Gbl_Xsdt)
+ Status = OslGetBiosTable (ACPI_SIG_XSDT, 0,
+ ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Xsdt), &Address);
+ if (ACPI_FAILURE (Status))
{
- fprintf (stderr,
- "XSDT: Could not allocate buffer for table of length %X\n",
- MappedTable->Length);
- return (AE_NO_MEMORY);
+ return (Status);
}
-
- ACPI_MEMCPY (Gbl_Xsdt, MappedTable, MappedTable->Length);
- AcpiOsUnmapMemory (MappedTable, MappedTable->Length);
}
/* Get RSDT from memory */
if (Gbl_Rsdp.RsdtPhysicalAddress)
{
- Status = OslMapTable (Gbl_Rsdp.RsdtPhysicalAddress,
- ACPI_SIG_RSDT, &MappedTable);
- if (ACPI_FAILURE (Status))
+ if (Gbl_Rsdt)
{
- return (Status);
+ free (Gbl_Rsdt);
+ Gbl_Rsdt = NULL;
}
- Gbl_Rsdt = calloc (1, MappedTable->Length);
- if (!Gbl_Rsdt)
+ Status = OslGetBiosTable (ACPI_SIG_RSDT, 0,
+ ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Rsdt), &Address);
+ if (ACPI_FAILURE (Status))
{
- fprintf (stderr,
- "RSDT: Could not allocate buffer for table of length %X\n",
- MappedTable->Length);
- return (AE_NO_MEMORY);
+ return (Status);
}
-
- ACPI_MEMCPY (Gbl_Rsdt, MappedTable, MappedTable->Length);
- AcpiOsUnmapMemory (MappedTable, MappedTable->Length);
}
/* Get FADT from memory */
- if (Gbl_Revision)
+ if (Gbl_Fadt)
{
- TableData = ACPI_CAST8 (Gbl_Xsdt) + sizeof (ACPI_TABLE_HEADER);
- Gbl_FadtAddress = (ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST64 (TableData));
+ free (Gbl_Fadt);
+ Gbl_Fadt = NULL;
+ }
+
+ Status = OslGetBiosTable (ACPI_SIG_FADT, 0,
+ ACPI_CAST_PTR (ACPI_TABLE_HEADER *, &Gbl_Fadt), &Gbl_FadtAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ if (!Gbl_DumpCustomizedTables)
+ {
+ /* Add mandatory tables to global table list first */
+
+ Status = OslAddTableToList (AP_DUMP_SIG_RSDP, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = OslAddTableToList (ACPI_SIG_RSDT, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ if (Gbl_Revision == 2)
+ {
+ Status = OslAddTableToList (ACPI_SIG_XSDT, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ Status = OslAddTableToList (ACPI_SIG_DSDT, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = OslAddTableToList (ACPI_SIG_FACS, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Add all tables found in the memory */
+
+ Status = OslListBiosTables ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
}
else
{
- TableData = ACPI_CAST8 (Gbl_Rsdt) + sizeof (ACPI_TABLE_HEADER);
- Gbl_FadtAddress = (ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST32 (TableData));
+ /* Add all tables found in the static directory */
+
+ Status = OslListCustomizedTables (STATIC_TABLE_DIR);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
}
- if (!Gbl_FadtAddress)
+ if (Gbl_DumpDynamicTables)
{
- fprintf(stderr, "FADT: Table could not be found\n");
- return (AE_ERROR);
+ /* Add all dynamically loaded tables in the dynamic directory */
+
+ Status = OslListCustomizedTables (DYNAMIC_TABLE_DIR);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
}
- Status = OslMapTable (Gbl_FadtAddress, ACPI_SIG_FADT, &MappedTable);
- if (ACPI_FAILURE (Status))
+ Gbl_TableListInitialized = TRUE;
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: OslListBiosTables
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status; Table list is initialized if AE_OK.
+ *
+ * DESCRIPTION: Add ACPI tables to the table list from memory.
+ *
+ * NOTE: This works on Linux as table customization does not modify the
+ * addresses stored in RSDP/RSDT/XSDT/FADT.
+ *
+ *****************************************************************************/
+
+static ACPI_STATUS
+OslListBiosTables (
+ void)
+{
+ ACPI_TABLE_HEADER *MappedTable = NULL;
+ UINT8 *TableData;
+ UINT8 NumberOfTables;
+ UINT8 ItemSize;
+ ACPI_PHYSICAL_ADDRESS TableAddress = 0;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 i;
+
+
+ if (Gbl_Revision)
{
- return (Status);
+ ItemSize = sizeof (UINT64);
+ TableData = ACPI_CAST8 (Gbl_Xsdt) + sizeof (ACPI_TABLE_HEADER);
+ NumberOfTables =
+ (UINT8) ((Gbl_Xsdt->Header.Length - sizeof (ACPI_TABLE_HEADER))
+ / ItemSize);
}
+ else /* Use RSDT if XSDT is not available */
+ {
+ ItemSize = sizeof (UINT32);
+ TableData = ACPI_CAST8 (Gbl_Rsdt) + sizeof (ACPI_TABLE_HEADER);
+ NumberOfTables =
+ (UINT8) ((Gbl_Rsdt->Header.Length - sizeof (ACPI_TABLE_HEADER))
+ / ItemSize);
+ }
+
+ /* Search RSDT/XSDT for the requested table */
- Gbl_Fadt = calloc (1, MappedTable->Length);
- if (!Gbl_Fadt)
+ for (i = 0; i < NumberOfTables; ++i, TableData += ItemSize)
{
- fprintf (stderr,
- "FADT: Could not allocate buffer for table of length %X\n",
- MappedTable->Length);
- return (AE_NO_MEMORY);
+ if (Gbl_Revision)
+ {
+ TableAddress =
+ (ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST64 (TableData));
+ }
+ else
+ {
+ TableAddress =
+ (ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST32 (TableData));
+ }
+
+ Status = OslMapTable (TableAddress, NULL, &MappedTable);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ OslAddTableToList (MappedTable->Signature, 0);
+ OslUnmapTable (MappedTable);
}
- ACPI_MEMCPY (Gbl_Fadt, MappedTable, MappedTable->Length);
- AcpiOsUnmapMemory (MappedTable, MappedTable->Length);
return (AE_OK);
}
/******************************************************************************
*
- * FUNCTION: OslGetTableViaRoot
+ * FUNCTION: OslGetBiosTable
*
* PARAMETERS: Signature - ACPI Signature for common table. Must be
* a null terminated 4-character string.
@@ -627,14 +839,14 @@ OslTableInitialize (
* AE_LIMIT: Instance is beyond valid limit
* AE_NOT_FOUND: A table with the signature was not found
*
- * DESCRIPTION: Get an ACPI table via the root table (RSDT/XSDT)
+ * DESCRIPTION: Get a BIOS provided ACPI table
*
* NOTE: Assumes the input signature is uppercase.
*
*****************************************************************************/
static ACPI_STATUS
-OslGetTableViaRoot (
+OslGetBiosTable (
char *Signature,
UINT32 Instance,
ACPI_TABLE_HEADER **Table,
@@ -647,13 +859,17 @@ OslGetTableViaRoot (
UINT8 ItemSize;
UINT32 CurrentInstance = 0;
ACPI_PHYSICAL_ADDRESS TableAddress = 0;
- ACPI_STATUS Status;
+ UINT32 TableLength = 0;
+ ACPI_STATUS Status = AE_OK;
UINT32 i;
- /* DSDT and FACS address must be extracted from the FADT */
+ /* Handle special tables whose addresses are not in RSDT/XSDT */
- if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) ||
+ if (ACPI_COMPARE_NAME (Signature, AP_DUMP_SIG_RSDP) ||
+ ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDT) ||
+ ACPI_COMPARE_NAME (Signature, ACPI_SIG_XSDT) ||
+ ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) ||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
{
/*
@@ -674,7 +890,7 @@ OslGetTableViaRoot (
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Dsdt;
}
}
- else /* FACS */
+ else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
{
if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XFACS) &&
Gbl_Fadt->XFacs)
@@ -687,23 +903,33 @@ OslGetTableViaRoot (
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Facs;
}
}
-
- if (!TableAddress)
+ else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_XSDT))
{
- fprintf (stderr,
- "Could not find a valid address for %4.4s in the FADT\n",
- Signature);
-
- return (AE_NOT_FOUND);
+ if (!Gbl_Revision)
+ {
+ return (AE_BAD_SIGNATURE);
+ }
+ TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.XsdtPhysicalAddress;
+ }
+ else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDT))
+ {
+ TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.RsdtPhysicalAddress;
+ }
+ else
+ {
+ TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_RsdpAddress;
+ Signature = ACPI_SIG_RSDP;
}
- /* Now we can get the requested table (DSDT or FACS) */
+ /* Now we can get the requested special table */
Status = OslMapTable (TableAddress, Signature, &MappedTable);
if (ACPI_FAILURE (Status))
{
return (Status);
}
+
+ TableLength = ApGetTableLength (MappedTable);
}
else /* Case for a normal ACPI table */
{
@@ -712,16 +938,16 @@ OslGetTableViaRoot (
ItemSize = sizeof (UINT64);
TableData = ACPI_CAST8 (Gbl_Xsdt) + sizeof (ACPI_TABLE_HEADER);
NumberOfTables =
- (Gbl_Xsdt->Header.Length - sizeof (ACPI_TABLE_HEADER))
- / ItemSize;
+ (UINT8) ((Gbl_Xsdt->Header.Length - sizeof (ACPI_TABLE_HEADER))
+ / ItemSize);
}
else /* Use RSDT if XSDT is not available */
{
ItemSize = sizeof (UINT32);
TableData = ACPI_CAST8 (Gbl_Rsdt) + sizeof (ACPI_TABLE_HEADER);
NumberOfTables =
- (Gbl_Rsdt->Header.Length - sizeof (ACPI_TABLE_HEADER))
- / ItemSize;
+ (UINT8) ((Gbl_Rsdt->Header.Length - sizeof (ACPI_TABLE_HEADER))
+ / ItemSize);
}
/* Search RSDT/XSDT for the requested table */
@@ -744,12 +970,13 @@ OslGetTableViaRoot (
{
return (Status);
}
+ TableLength = MappedTable->Length;
/* Does this table match the requested signature? */
if (!ACPI_COMPARE_NAME (MappedTable->Signature, Signature))
{
- AcpiOsUnmapMemory (MappedTable, MappedTable->Length);
+ OslUnmapTable (MappedTable);
MappedTable = NULL;
continue;
}
@@ -758,7 +985,7 @@ OslGetTableViaRoot (
if (CurrentInstance != Instance)
{
- AcpiOsUnmapMemory (MappedTable, MappedTable->Length);
+ OslUnmapTable (MappedTable);
MappedTable = NULL;
CurrentInstance++;
continue;
@@ -768,36 +995,39 @@ OslGetTableViaRoot (
}
}
- if (CurrentInstance != Instance)
+ if (!MappedTable)
{
return (AE_LIMIT);
}
- if (!MappedTable)
+ if (TableLength == 0)
{
- return (AE_NOT_FOUND);
+ Status = AE_BAD_HEADER;
+ goto ErrorExit;
}
/* Copy table to local buffer and return it */
- LocalTable = calloc (1, MappedTable->Length);
+ LocalTable = calloc (1, TableLength);
if (!LocalTable)
{
- return (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto ErrorExit;
}
- ACPI_MEMCPY (LocalTable, MappedTable, MappedTable->Length);
- AcpiOsUnmapMemory (MappedTable, MappedTable->Length);
+ ACPI_MEMCPY (LocalTable, MappedTable, TableLength);
*Address = TableAddress;
-
*Table = LocalTable;
+
+ErrorExit:
+ OslUnmapTable (MappedTable);
return (AE_OK);
}
/******************************************************************************
*
- * FUNCTION: OslAddTablesToList
+ * FUNCTION: OslListCustomizedTables
*
* PARAMETERS: Directory - Directory that contains the tables
*
@@ -808,84 +1038,50 @@ OslGetTableViaRoot (
*****************************************************************************/
static ACPI_STATUS
-OslAddTablesToList(
+OslListCustomizedTables (
char *Directory)
{
- struct stat FileInfo;
- OSL_TABLE_INFO *NewInfo;
- OSL_TABLE_INFO *Info;
- struct dirent *DirInfo;
- DIR *TableDir;
- char TempName[4];
- char Filename[PATH_MAX];
- UINT32 i;
+ void *TableDir;
+ UINT32 Instance;
+ char TempName[ACPI_NAME_SIZE];
+ char *Filename;
+ ACPI_STATUS Status = AE_OK;
/* Open the requested directory */
- if (stat (Directory, &FileInfo) == -1)
- {
- return (AE_NOT_FOUND);
- }
-
- if (!(TableDir = opendir (Directory)))
+ TableDir = AcpiOsOpenDirectory (Directory, "*", REQUEST_FILE_ONLY);
+ if (!TableDir)
{
- return (AE_ERROR);
+ return (OslGetLastStatus (AE_NOT_FOUND));
}
- /* Move pointer to the end of the list */
-
- if (!Gbl_TableListHead)
- {
- return (AE_ERROR);
- }
+ /* Examine all entries in this directory */
- Info = Gbl_TableListHead;
- for (i = 0; i < Gbl_TableListHead->Instance; i++)
+ while ((Filename = AcpiOsGetNextFilename (TableDir)))
{
- Info = Info->Next;
- }
+ /* Extract table name and instance number */
- /* Examine all entries in this directory */
+ Status = OslTableNameFromFile (Filename, TempName, &Instance);
- while ((DirInfo = readdir (TableDir)) != 0)
- {
/* Ignore meaningless files */
- if (DirInfo->d_name[0] == '.')
+ if (ACPI_FAILURE (Status))
{
continue;
}
- /* Skip any subdirectories and create a new info node */
+ /* Add new info node to global table list */
- sprintf (Filename, "%s/%s", Directory, DirInfo->d_name);
-
- if (stat (Filename, &FileInfo) == -1)
- {
- return (AE_ERROR);
- }
-
- if (!S_ISDIR (FileInfo.st_mode))
+ Status = OslAddTableToList (TempName, Instance);
+ if (ACPI_FAILURE (Status))
{
- NewInfo = calloc (1, sizeof (OSL_TABLE_INFO));
- if (strlen (DirInfo->d_name) > ACPI_NAME_SIZE)
- {
- sscanf (DirInfo->d_name, "%[^1-9]%d",
- TempName, &NewInfo->Instance);
- }
-
- /* Add new info node to global table list */
-
- sscanf (DirInfo->d_name, "%4s", NewInfo->Signature);
- Info->Next = NewInfo;
- Info = NewInfo;
- Gbl_TableListHead->Instance++;
+ break;
}
}
- closedir (TableDir);
- return (AE_OK);
+ AcpiOsCloseDirectory (TableDir);
+ return (Status);
}
@@ -900,9 +1096,9 @@ OslAddTablesToList(
* returned
*
* RETURN: Status; Mapped table is returned if AE_OK.
+ * AE_NOT_FOUND: A valid table was not found at the address
*
- * DESCRIPTION: Map entire ACPI table into caller's address space. Also
- * validates the table and checksum.
+ * DESCRIPTION: Map entire ACPI table into caller's address space.
*
*****************************************************************************/
@@ -916,21 +1112,23 @@ OslMapTable (
UINT32 Length;
- /* Map the header so we can get the table length */
+ if (!Address)
+ {
+ return (AE_BAD_ADDRESS);
+ }
+ /*
+ * Map the header so we can get the table length.
+ * Use sizeof (ACPI_TABLE_HEADER) as:
+ * 1. it is bigger than 24 to include RSDP->Length
+ * 2. it is smaller than sizeof (ACPI_TABLE_RSDP)
+ */
MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
if (!MappedTable)
{
fprintf (stderr, "Could not map table header at 0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Address));
- return (AE_BAD_ADDRESS);
- }
-
- /* Check if table is valid */
-
- if (!ApIsValidHeader (MappedTable))
- {
- return (AE_BAD_HEADER);
+ return (OslGetLastStatus (AE_BAD_ADDRESS));
}
/* If specified, signature must match */
@@ -938,35 +1136,106 @@ OslMapTable (
if (Signature &&
!ACPI_COMPARE_NAME (Signature, MappedTable->Signature))
{
- return (AE_NOT_EXIST);
+ AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER));
+ return (AE_BAD_SIGNATURE);
}
/* Map the entire table */
- Length = MappedTable->Length;
+ Length = ApGetTableLength (MappedTable);
AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER));
+ if (Length == 0)
+ {
+ return (AE_BAD_HEADER);
+ }
MappedTable = AcpiOsMapMemory (Address, Length);
if (!MappedTable)
{
fprintf (stderr, "Could not map table at 0x%8.8X%8.8X length %8.8X\n",
ACPI_FORMAT_UINT64 (Address), Length);
- return (AE_NO_MEMORY);
+ return (OslGetLastStatus (AE_INVALID_TABLE_LENGTH));
}
+ (void) ApIsValidChecksum (MappedTable);
+
*Table = MappedTable;
+ return (AE_OK);
+}
- /*
- * Checksum for RSDP.
- * Note: Other checksums are computed during the table dump.
- */
- if (AcpiTbValidateRsdp (ACPI_CAST_PTR (ACPI_TABLE_RSDP, MappedTable)) ==
- AE_BAD_CHECKSUM)
+/******************************************************************************
+ *
+ * FUNCTION: OslUnmapTable
+ *
+ * PARAMETERS: Table - A pointer to the mapped table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Unmap entire ACPI table.
+ *
+ *****************************************************************************/
+
+static void
+OslUnmapTable (
+ ACPI_TABLE_HEADER *Table)
+{
+ if (Table)
+ {
+ AcpiOsUnmapMemory (Table, ApGetTableLength (Table));
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: OslTableNameFromFile
+ *
+ * PARAMETERS: Filename - File that contains the desired table
+ * Signature - Pointer to 4-character buffer to store
+ * extracted table signature.
+ * Instance - Pointer to integer to store extracted
+ * table instance number.
+ *
+ * RETURN: Status; Table name is extracted if AE_OK.
+ *
+ * DESCRIPTION: Extract table signature and instance number from a table file
+ * name.
+ *
+ *****************************************************************************/
+
+static ACPI_STATUS
+OslTableNameFromFile (
+ char *Filename,
+ char *Signature,
+ UINT32 *Instance)
+{
+
+ /* Ignore meaningless files */
+
+ if (strlen (Filename) < ACPI_NAME_SIZE)
+ {
+ return (AE_BAD_SIGNATURE);
+ }
+
+ /* Extract instance number */
+
+ if (isdigit ((int) Filename[ACPI_NAME_SIZE]))
+ {
+ sscanf (&Filename[ACPI_NAME_SIZE], "%d", Instance);
+ }
+ else if (strlen (Filename) != ACPI_NAME_SIZE)
+ {
+ return (AE_BAD_SIGNATURE);
+ }
+ else
{
- fprintf (stderr, "Warning: wrong checksum for RSDP\n");
+ *Instance = 0;
}
+ /* Extract signature */
+
+ ACPI_MOVE_NAME (Signature, Filename);
return (AE_OK);
}
@@ -975,7 +1244,7 @@ OslMapTable (
*
* FUNCTION: OslReadTableFromFile
*
- * PARAMETERS: TableFile - File that contains the desired table
+ * PARAMETERS: Filename - File that contains the desired table
* FileOffset - Offset of the table in file
* Signature - Optional ACPI Signature for desired table.
* A null terminated 4-character string.
@@ -989,34 +1258,39 @@ OslMapTable (
static ACPI_STATUS
OslReadTableFromFile (
- FILE *TableFile,
+ char *Filename,
ACPI_SIZE FileOffset,
char *Signature,
ACPI_TABLE_HEADER **Table)
{
+ FILE *TableFile;
ACPI_TABLE_HEADER Header;
- ACPI_TABLE_RSDP Rsdp;
- ACPI_TABLE_HEADER *LocalTable;
+ ACPI_TABLE_HEADER *LocalTable = NULL;
UINT32 TableLength;
- UINT32 Count;
+ INT32 Count;
+ UINT32 Total = 0;
+ ACPI_STATUS Status = AE_OK;
- /* Read the table header */
-
- fseek (TableFile, FileOffset, SEEK_SET);
+ /* Open the file */
- Count = fread (&Header, 1, sizeof (ACPI_TABLE_HEADER), TableFile);
- if (Count != sizeof (ACPI_TABLE_HEADER))
+ TableFile = fopen (Filename, "rb");
+ if (TableFile == NULL)
{
- fprintf (stderr, "Could not read ACPI table header from file\n");
- return (AE_BAD_HEADER);
+ fprintf (stderr, "Could not open table file: %s\n", Filename);
+ return (OslGetLastStatus (AE_NOT_FOUND));
}
- /* Check if table is valid */
+ fseek (TableFile, FileOffset, SEEK_SET);
+
+ /* Read the Table header to get the table length */
- if (!ApIsValidHeader (&Header))
+ Count = fread (&Header, 1, sizeof (ACPI_TABLE_HEADER), TableFile);
+ if (Count != sizeof (ACPI_TABLE_HEADER))
{
- return (AE_BAD_HEADER);
+ fprintf (stderr, "Could not read table header: %s\n", Filename);
+ Status = AE_BAD_HEADER;
+ goto ErrorExit;
}
/* If signature is specified, it must match the table */
@@ -1026,29 +1300,15 @@ OslReadTableFromFile (
{
fprintf (stderr, "Incorrect signature: Expecting %4.4s, found %4.4s\n",
Signature, Header.Signature);
- return (AE_NOT_FOUND);
+ Status = AE_BAD_SIGNATURE;
+ goto ErrorExit;
}
- /*
- * For RSDP, we must read the entire table, because the length field
- * is in a non-standard place, beyond the normal ACPI header.
- */
- if (ACPI_COMPARE_NAME (Header.Signature, ACPI_SIG_RSDP))
- {
- fseek (TableFile, FileOffset, SEEK_SET);
-
- Count = fread (&Rsdp, 1, sizeof (ACPI_TABLE_RSDP), TableFile);
- if (Count != sizeof (ACPI_TABLE_RSDP))
- {
- fprintf (stderr, "Error while reading RSDP\n");
- return (AE_NOT_FOUND);
- }
-
- TableLength = Rsdp.Length;
- }
- else
+ TableLength = ApGetTableLength (&Header);
+ if (TableLength == 0)
{
- TableLength = Header.Length;
+ Status = AE_BAD_HEADER;
+ goto ErrorExit;
}
/* Read the entire table into a local buffer */
@@ -1059,41 +1319,43 @@ OslReadTableFromFile (
fprintf (stderr,
"%4.4s: Could not allocate buffer for table of length %X\n",
Header.Signature, TableLength);
- return (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto ErrorExit;
}
fseek (TableFile, FileOffset, SEEK_SET);
- Count = fread (LocalTable, 1, TableLength, TableFile);
- if (Count != TableLength)
- {
- fprintf (stderr, "%4.4s: Error while reading table content\n",
- Header.Signature);
- return (AE_NOT_FOUND);
- }
-
- /* Validate checksum, except for special tables */
-
- if (!ACPI_COMPARE_NAME (Header.Signature, ACPI_SIG_S3PT) &&
- !ACPI_COMPARE_NAME (Header.Signature, ACPI_SIG_FACS))
+ while (!feof (TableFile) && Total < TableLength)
{
- if (AcpiTbChecksum ((UINT8 *) LocalTable, TableLength))
+ Count = fread (LocalTable, 1, TableLength-Total, TableFile);
+ if (Count < 0)
{
- fprintf (stderr, "%4.4s: Warning: wrong checksum\n",
+ fprintf (stderr, "%4.4s: Could not read table content\n",
Header.Signature);
+ Status = AE_INVALID_TABLE_LENGTH;
+ goto ErrorExit;
}
+
+ Total += Count;
}
+ /* Validate checksum */
+
+ (void) ApIsValidChecksum (LocalTable);
+
+ErrorExit:
+ fclose (TableFile);
*Table = LocalTable;
- return (AE_OK);
+ return (Status);
}
/******************************************************************************
*
- * FUNCTION: OslGetOverrideTable
+ * FUNCTION: OslGetCustomizedTable
*
- * PARAMETERS: Signature - ACPI Signature for desired table. Must be
+ * PARAMETERS: Pathname - Directory to find Linux customized table
+ * Signature - ACPI Signature for desired table. Must be
* a null terminated 4-character string.
* Instance - Multiple table support for SSDT/UEFI (0...n)
* Must be 0 for other tables.
@@ -1101,211 +1363,83 @@ OslReadTableFromFile (
* Address - Where the table physical address is returned
*
* RETURN: Status; Table buffer is returned if AE_OK.
- * AE_NOT_FOUND: A valid table was not found at the address
+ * AE_LIMIT: Instance is beyond valid limit
+ * AE_NOT_FOUND: A table with the signature was not found
*
- * DESCRIPTION: Get a table that was overridden and appears under the
- * directory OVERRIDE_TABLE_DIR.
+ * DESCRIPTION: Get an OS customized table.
*
*****************************************************************************/
static ACPI_STATUS
-OslGetOverrideTable (
+OslGetCustomizedTable (
+ char *Pathname,
char *Signature,
UINT32 Instance,
ACPI_TABLE_HEADER **Table,
ACPI_PHYSICAL_ADDRESS *Address)
{
- ACPI_TABLE_HEADER Header;
- struct stat FileInfo;
- struct dirent *DirInfo;
- DIR *TableDir;
- FILE *TableFile = NULL;
+ void *TableDir;
UINT32 CurrentInstance = 0;
- UINT32 Count;
- char TempName[4];
+ char TempName[ACPI_NAME_SIZE];
char TableFilename[PATH_MAX];
+ char *Filename;
ACPI_STATUS Status;
- /* Open the directory for override tables */
+ /* Open the directory for customized tables */
- if (stat (OVERRIDE_TABLE_DIR, &FileInfo) == -1)
+ TableDir = AcpiOsOpenDirectory (Pathname, "*", REQUEST_FILE_ONLY);
+ if (!TableDir)
{
- return (AE_NOT_FOUND);
- }
-
- if (!(TableDir = opendir (OVERRIDE_TABLE_DIR)))
- {
- return (AE_ERROR);
+ return (OslGetLastStatus (AE_NOT_FOUND));
}
/* Attempt to find the table in the directory */
- while ((DirInfo = readdir (TableDir)) != 0)
+ while ((Filename = AcpiOsGetNextFilename (TableDir)))
{
/* Ignore meaningless files */
- if (DirInfo->d_name[0] == '.')
- {
- continue;
- }
-
- if (!ACPI_COMPARE_NAME (DirInfo->d_name, Signature))
+ if (!ACPI_COMPARE_NAME (Filename, Signature))
{
continue;
}
- if (strlen (DirInfo->d_name) > 4)
- {
- sscanf (DirInfo->d_name, "%[^1-9]%d", TempName, &CurrentInstance);
- if (CurrentInstance != Instance)
- {
- continue;
- }
- }
+ /* Extract table name and instance number */
- /* Create the table pathname and open the file */
+ Status = OslTableNameFromFile (Filename, TempName, &CurrentInstance);
- sprintf (TableFilename, "%s/%s", OVERRIDE_TABLE_DIR, DirInfo->d_name);
-
- TableFile = fopen (TableFilename, "rb");
- if (TableFile == NULL)
- {
- perror (TableFilename);
- return (AE_ERROR);
- }
-
- /* Read the Table header to get the table length */
-
- Count = fread (&Header, 1, sizeof (ACPI_TABLE_HEADER), TableFile);
- if (Count != sizeof (ACPI_TABLE_HEADER))
- {
- fclose (TableFile);
- return (AE_ERROR);
- }
-
- break;
- }
-
- closedir (TableDir);
- if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT) && !TableFile)
- {
- return (AE_LIMIT);
- }
-
- if (!TableFile)
- {
- return (AE_NOT_FOUND);
- }
-
- /* There is no physical address saved for override tables, use zero */
-
- *Address = 0;
- Status = OslReadTableFromFile (TableFile, 0, NULL, Table);
-
- fclose (TableFile);
- return (Status);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: OslGetDynamicSsdt
- *
- * PARAMETERS: Instance - For SSDTs (0...n)
- * Table - Where a pointer to the table is returned
- * Address - Where the table physical address is returned
- *
- * RETURN: Status; Table buffer is returned if AE_OK.
- * AE_NOT_FOUND: A valid table was not found at the address
- *
- * DESCRIPTION: Get an SSDT table under directory DYNAMIC_SSDT_DIR.
- *
- *****************************************************************************/
-
-static ACPI_STATUS
-OslGetDynamicSsdt (
- UINT32 Instance,
- ACPI_TABLE_HEADER **Table,
- ACPI_PHYSICAL_ADDRESS *Address)
-{
- ACPI_TABLE_HEADER Header;
- struct stat FileInfo;
- struct dirent *DirInfo;
- DIR *TableDir;
- FILE *TableFile = NULL;
- UINT32 Count;
- UINT32 CurrentInstance = 0;
- char TempName[4];
- char TableFilename[PATH_MAX];
- ACPI_STATUS Status;
-
-
- /* Open the directory for dynamically loaded SSDTs */
-
- if (stat (DYNAMIC_SSDT_DIR, &FileInfo) == -1)
- {
- return (AE_NOT_FOUND);
- }
-
- if (!(TableDir = opendir (DYNAMIC_SSDT_DIR)))
- {
- return (AE_ERROR);
- }
-
- /* Search directory for correct SSDT instance */
-
- while ((DirInfo = readdir (TableDir)) != 0)
- {
/* Ignore meaningless files */
- if (DirInfo->d_name[0] == '.')
+ if (ACPI_FAILURE (Status) || CurrentInstance != Instance)
{
continue;
}
- /* Check if this table is what we need */
+ /* Create the table pathname */
- sscanf (DirInfo->d_name, "%[^1-9]%d", TempName, &CurrentInstance);
- if (CurrentInstance != Instance)
+ if (Instance != 0)
{
- continue;
+ sprintf (TableFilename, "%s/%4.4s%d", Pathname, TempName, Instance);
}
-
- /* Get the SSDT filename and open the file */
-
- sprintf (TableFilename, "%s/%s", DYNAMIC_SSDT_DIR, DirInfo->d_name);
-
- TableFile = fopen (TableFilename, "rb");
- if (TableFile == NULL)
- {
- perror (TableFilename);
- return (AE_ERROR);
- }
-
- /* Read the Table header to get the table length */
-
- Count = fread (&Header, 1, sizeof (ACPI_TABLE_HEADER), TableFile);
- if (Count != sizeof (ACPI_TABLE_HEADER))
+ else
{
- fclose (TableFile);
- return (AE_ERROR);
+ sprintf (TableFilename, "%s/%4.4s", Pathname, TempName);
}
-
break;
}
- closedir (TableDir);
- if (CurrentInstance != Instance)
+ AcpiOsCloseDirectory (TableDir);
+
+ if (!Filename)
{
return (AE_LIMIT);
}
- /* There is no physical address saved for dynamic SSDTs, use zero */
+ /* There is no physical address saved for customized tables, use zero */
*Address = 0;
- Status = OslReadTableFromFile (TableFile, Header.Length, NULL, Table);
+ Status = OslReadTableFromFile (TableFilename, 0, NULL, Table);
- fclose (TableFile);
return (Status);
}
diff --git a/source/os_specific/service_layers/osunixdir.c b/source/os_specific/service_layers/osunixdir.c
index 58351a6..2e007e9 100644
--- a/source/os_specific/service_layers/osunixdir.c
+++ b/source/os_specific/service_layers/osunixdir.c
@@ -41,6 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
+#include <acpi.h>
#include <stdio.h>
#include <stdlib.h>
@@ -50,8 +51,6 @@
#include <ctype.h>
#include <sys/stat.h>
-#include "acpisrc.h"
-
/*
* Allocated structure returned from OsOpenDirectory
*/
@@ -103,6 +102,7 @@ AcpiOsOpenDirectory (
dir = opendir (DirPathname);
if (!dir)
{
+ fprintf (stderr, "Cannot open directory - %s\n", DirPathname);
free (ExternalInfo);
return (NULL);
}
@@ -157,7 +157,8 @@ AcpiOsGetNextFilename (
temp_str = calloc (str_len, 1);
if (!temp_str)
{
- printf ("Could not allocate buffer for temporary string\n");
+ fprintf (stderr,
+ "Could not allocate buffer for temporary string\n");
return (NULL);
}
@@ -169,7 +170,9 @@ AcpiOsGetNextFilename (
free (temp_str);
if (err == -1)
{
- printf ("stat() error - should not happen\n");
+ fprintf (stderr,
+ "Cannot stat file (should not happen) - %s\n",
+ temp_str);
return (NULL);
}
diff --git a/source/os_specific/service_layers/osunixmap.c b/source/os_specific/service_layers/osunixmap.c
new file mode 100644
index 0000000..6b6304e
--- /dev/null
+++ b/source/os_specific/service_layers/osunixmap.c
@@ -0,0 +1,171 @@
+/******************************************************************************
+ *
+ * Module Name: osunixmap - Unix OSL for file mappings
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2013, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpidump.h"
+#include <unistd.h>
+#include <sys/mman.h>
+#ifdef _FreeBSD
+#include <sys/param.h>
+#endif
+
+#define _COMPONENT ACPI_OS_SERVICES
+ ACPI_MODULE_NAME ("osunixmap")
+
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#ifdef _FreeBSD
+#define MMAP_FLAGS MAP_SHARED
+#else
+#define MMAP_FLAGS MAP_PRIVATE
+#endif
+
+#define SYSTEM_MEMORY "/dev/mem"
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsGetPageSize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Page size of the platform.
+ *
+ * DESCRIPTION: Obtain page size of the platform.
+ *
+ ******************************************************************************/
+
+static ACPI_SIZE
+AcpiOsGetPageSize (
+ void)
+{
+
+#ifdef PAGE_SIZE
+ return PAGE_SIZE;
+#else
+ return sysconf (_SC_PAGESIZE);
+#endif
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsMapMemory
+ *
+ * PARAMETERS: Where - Physical address of memory to be mapped
+ * Length - How much memory to map
+ *
+ * RETURN: Pointer to mapped memory. Null on error.
+ *
+ * DESCRIPTION: Map physical memory into local address space.
+ *
+ *****************************************************************************/
+
+void *
+AcpiOsMapMemory (
+ ACPI_PHYSICAL_ADDRESS Where,
+ ACPI_SIZE Length)
+{
+ UINT8 *MappedMemory;
+ ACPI_PHYSICAL_ADDRESS Offset;
+ ACPI_SIZE PageSize;
+ int fd;
+
+
+ fd = open (SYSTEM_MEMORY, O_RDONLY | O_BINARY);
+ if (fd < 0)
+ {
+ fprintf (stderr, "Cannot open %s\n", SYSTEM_MEMORY);
+ return (NULL);
+ }
+
+ /* Align the offset to use mmap */
+
+ PageSize = AcpiOsGetPageSize ();
+ Offset = Where % PageSize;
+
+ /* Map the table header to get the length of the full table */
+
+ MappedMemory = mmap (NULL, (Length + Offset), PROT_READ, MMAP_FLAGS,
+ fd, (Where - Offset));
+ if (MappedMemory == MAP_FAILED)
+ {
+ fprintf (stderr, "Cannot map %s\n", SYSTEM_MEMORY);
+ close (fd);
+ return (NULL);
+ }
+
+ close (fd);
+ return (ACPI_CAST8 (MappedMemory + Offset));
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsUnmapMemory
+ *
+ * PARAMETERS: Where - Logical address of memory to be unmapped
+ * Length - How much memory to unmap
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Delete a previously created mapping. Where and Length must
+ * correspond to a previous mapping exactly.
+ *
+ *****************************************************************************/
+
+void
+AcpiOsUnmapMemory (
+ void *Where,
+ ACPI_SIZE Length)
+{
+ ACPI_PHYSICAL_ADDRESS Offset;
+ ACPI_SIZE PageSize;
+
+
+ PageSize = AcpiOsGetPageSize ();
+ Offset = (ACPI_PHYSICAL_ADDRESS) Where % PageSize;
+ munmap ((UINT8 *) Where - Offset, (Length + Offset));
+}
diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c
index f77d70e..fab1cd1 100644
--- a/source/os_specific/service_layers/osunixxf.c
+++ b/source/os_specific/service_layers/osunixxf.c
@@ -1023,6 +1023,7 @@ AcpiOsReadPciConfiguration (
UINT32 Width)
{
+ *Value = 0;
return (AE_OK);
}
diff --git a/source/os_specific/service_layers/oswintbl.c b/source/os_specific/service_layers/oswintbl.c
index 347927f..c03851d 100644
--- a/source/os_specific/service_layers/oswintbl.c
+++ b/source/os_specific/service_layers/oswintbl.c
@@ -144,6 +144,8 @@ AcpiOsGetTableByAddress (
*
* PARAMETERS: Index - Which table to get
* Table - Where a pointer to the table is returned
+ * Instance - Where a pointer to the table instance no. is
+ * returned
* Address - Where the table physical address is returned
*
* RETURN: Status; Table buffer and physical address returned if AE_OK.
@@ -163,6 +165,7 @@ ACPI_STATUS
AcpiOsGetTableByIndex (
UINT32 Index,
ACPI_TABLE_HEADER **Table,
+ UINT32 *Instance,
ACPI_PHYSICAL_ADDRESS *Address)
{
ACPI_STATUS Status;
@@ -352,3 +355,54 @@ Cleanup:
*Address = 0;
return (AE_OK);
}
+
+
+/* These are here for acpidump only, so we don't need to link oswinxf */
+
+#ifdef ACPI_DUMP_APP
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsMapMemory
+ *
+ * PARAMETERS: Where - Physical address of memory to be mapped
+ * Length - How much memory to map
+ *
+ * RETURN: Pointer to mapped memory. Null on error.
+ *
+ * DESCRIPTION: Map physical memory into caller's address space
+ *
+ *****************************************************************************/
+
+void *
+AcpiOsMapMemory (
+ ACPI_PHYSICAL_ADDRESS Where,
+ ACPI_SIZE Length)
+{
+
+ return (ACPI_TO_POINTER ((ACPI_SIZE) Where));
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsUnmapMemory
+ *
+ * PARAMETERS: Where - Logical address of memory to be unmapped
+ * Length - How much memory to unmap
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Delete a previously created mapping. Where and Length must
+ * correspond to a previous mapping exactly.
+ *
+ *****************************************************************************/
+
+void
+AcpiOsUnmapMemory (
+ void *Where,
+ ACPI_SIZE Length)
+{
+
+ return;
+}
+#endif
diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c
index f1c567c..b946f32 100644
--- a/source/os_specific/service_layers/oswinxf.c
+++ b/source/os_specific/service_layers/oswinxf.c
@@ -1167,6 +1167,7 @@ AcpiOsReadPciConfiguration (
UINT32 Width)
{
+ *Value = 0;
return (AE_OK);
}
diff --git a/source/tools/acpibin/abmain.c b/source/tools/acpibin/abmain.c
index 67fbc24..a4ca919 100644
--- a/source/tools/acpibin/abmain.c
+++ b/source/tools/acpibin/abmain.c
@@ -53,6 +53,10 @@ AbDisplayUsage (
UINT8 OptionCount);
+#define AB_UTILITY_NAME "ACPI Binary Table Dump Utility"
+#define AB_SUPPORTED_OPTIONS "c:d:e:h:s:tv"
+
+
/******************************************************************************
*
* FUNCTION: AbDisplayUsage
@@ -73,12 +77,13 @@ AbDisplayUsage (
ACPI_USAGE_HEADER ("acpibin [options]");
- ACPI_OPTION ("-c <File1><File2>", "Compare two binary AML files");
- ACPI_OPTION ("-d <In><Out>", "Dump AML binary to text file");
- ACPI_OPTION ("-e <Sig><In><Out>", "Extract binary AML table from AcpiDump file");
- ACPI_OPTION ("-h <File>", "Display table header for binary AML file");
- ACPI_OPTION ("-s <File>", "Update checksum for binary AML file");
- ACPI_OPTION ("-t", "Terse mode");
+ ACPI_OPTION ("-c <File1><File2>", "Compare two binary AML files");
+ ACPI_OPTION ("-d <In><Out>", "Dump AML binary to text file");
+ ACPI_OPTION ("-e <Sig><In><Out>", "Extract binary AML table from AcpiDump file");
+ ACPI_OPTION ("-h <File>", "Display table header for binary AML file");
+ ACPI_OPTION ("-s <File>", "Update checksum for binary AML file");
+ ACPI_OPTION ("-t", "Terse mode");
+ ACPI_OPTION ("-v", "Display version information");
}
@@ -105,7 +110,7 @@ main (
AcpiGbl_DbOutputFlags = DB_CONSOLE_OUTPUT;
AcpiOsInitialize ();
- printf (ACPI_COMMON_SIGNON ("ACPI Binary AML File Utility"));
+ printf (ACPI_COMMON_SIGNON (AB_UTILITY_NAME));
if (argc < 2)
{
@@ -115,7 +120,7 @@ main (
/* Command line options */
- while ((j = AcpiGetopt (argc, argv, "c:d:e:h:s:t")) != EOF) switch(j)
+ while ((j = AcpiGetopt (argc, argv, AB_SUPPORTED_OPTIONS)) != EOF) switch(j)
{
case 'c': /* Compare Files */
@@ -178,6 +183,10 @@ main (
Gbl_TerseMode = TRUE;
break;
+ case 'v': /* -v: (Version): signon already emitted, just exit */
+
+ return (0);
+
default:
AbDisplayUsage (0);
diff --git a/source/tools/acpidump/acpidump.h b/source/tools/acpidump/acpidump.h
index 44fd7d3..203108f 100644
--- a/source/tools/acpidump/acpidump.h
+++ b/source/tools/acpidump/acpidump.h
@@ -67,9 +67,10 @@
EXTERN BOOLEAN INIT_GLOBAL (Gbl_SummaryMode, FALSE);
EXTERN BOOLEAN INIT_GLOBAL (Gbl_VerboseMode, FALSE);
EXTERN BOOLEAN INIT_GLOBAL (Gbl_BinaryMode, FALSE);
-EXTERN UINT32 INIT_GLOBAL (Gbl_SsdtCount, 0);
+EXTERN BOOLEAN INIT_GLOBAL (Gbl_DumpCustomizedTables, FALSE);
EXTERN FILE INIT_GLOBAL (*Gbl_OutputFile, NULL);
EXTERN char INIT_GLOBAL (*Gbl_OutputFilename, NULL);
+EXTERN UINT64 INIT_GLOBAL (Gbl_RsdpBase, 0);
/* Globals required for use with ACPICA modules */
@@ -89,6 +90,10 @@ typedef struct ap_dump_action
} AP_DUMP_ACTION;
+/* Local RSDP signature (Not the same as the actual signature which is "RSD PTR ") */
+
+#define AP_DUMP_SIG_RSDP "RSDP"
+
#define AP_MAX_ACTIONS 32
#define AP_DUMP_ALL_TABLES 0
@@ -129,6 +134,14 @@ BOOLEAN
ApIsValidHeader (
ACPI_TABLE_HEADER *Table);
+BOOLEAN
+ApIsValidChecksum (
+ ACPI_TABLE_HEADER *Table);
+
+UINT32
+ApGetTableLength (
+ ACPI_TABLE_HEADER *Table);
+
/*
* apfiles - File I/O utilities
@@ -143,7 +156,8 @@ ApOpenOutputFile (
int
ApWriteToBinaryFile (
- ACPI_TABLE_HEADER *Table);
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Instance);
ACPI_TABLE_HEADER *
ApGetTableFromFile (
diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c
index 5000e4d..6317b25 100644
--- a/source/tools/acpidump/apdump.c
+++ b/source/tools/acpidump/apdump.c
@@ -49,6 +49,7 @@
static int
ApDumpTableBuffer (
ACPI_TABLE_HEADER *Table,
+ UINT32 Instance,
ACPI_PHYSICAL_ADDRESS Address);
@@ -68,26 +69,111 @@ BOOLEAN
ApIsValidHeader (
ACPI_TABLE_HEADER *Table)
{
+ if (!ACPI_VALIDATE_RSDP_SIG (Table->Signature))
+ {
+ /* Make sure signature is all ASCII and a valid ACPI name */
+
+ if (!AcpiUtValidAcpiName (Table->Signature))
+ {
+ fprintf (stderr, "Table signature (0x%8.8X) is invalid\n",
+ *(UINT32 *) Table->Signature);
+ return (FALSE);
+ }
+
+ /* Check for minimum table length */
+
+ if (Table->Length <= sizeof (ACPI_TABLE_HEADER))
+ {
+ fprintf (stderr, "Table length (0x%8.8X) is invalid\n",
+ Table->Length);
+ return (FALSE);
+ }
+ }
- /* Make sure signature is all ASCII and a valid ACPI name */
+ return (TRUE);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: ApIsValidChecksum
+ *
+ * PARAMETERS: Table - Pointer to table to be validated
+ *
+ * RETURN: TRUE if the checksum appears to be valid. FALSE otherwise
+ *
+ * DESCRIPTION: Check for a valid ACPI table checksum
+ *
+ ******************************************************************************/
+
+BOOLEAN
+ApIsValidChecksum (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_RSDP *Rsdp;
+
+
+ if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
+ {
+ /*
+ * Checksum for RSDP.
+ * Note: Other checksums are computed during the table dump.
+ */
+
+ Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
+ Status = AcpiTbValidateRsdp (Rsdp);
+ }
+ else
+ {
+ Status = AcpiTbVerifyChecksum (Table, Table->Length);
+ }
- if (!AcpiUtValidAcpiName (Table->Signature))
+ if (ACPI_FAILURE (Status))
{
- fprintf (stderr, "Table signature (0x%8.8X) is invalid\n",
- *(UINT32 *) Table->Signature);
- return (FALSE);
+ fprintf (stderr, "%4.4s: Warning: wrong checksum\n",
+ Table->Signature);
}
- /* Check for minimum table length */
+ return (AE_OK);
+}
+
- if (Table->Length <= sizeof (ACPI_TABLE_HEADER))
+/******************************************************************************
+ *
+ * FUNCTION: ApGetTableLength
+ *
+ * PARAMETERS: Table - Pointer to the table
+ *
+ * RETURN: Table length
+ *
+ * DESCRIPTION: Obtain table length according to table signature
+ *
+ ******************************************************************************/
+
+UINT32
+ApGetTableLength (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_TABLE_RSDP *Rsdp;
+
+
+ /* Check if table is valid */
+
+ if (!ApIsValidHeader (Table))
{
- fprintf (stderr, "Table length (0x%8.8X) is invalid\n",
- Table->Length);
- return (FALSE);
+ return (0);
}
- return (TRUE);
+ if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
+ {
+ Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
+ return (Rsdp->Length);
+ }
+ else
+ {
+ return (Table->Length);
+ }
}
@@ -96,6 +182,7 @@ ApIsValidHeader (
* FUNCTION: ApDumpTableBuffer
*
* PARAMETERS: Table - ACPI table to be dumped
+ * Instance - ACPI table instance no. to be dumped
* Address - Physical address of the table
*
* RETURN: None
@@ -108,22 +195,13 @@ ApIsValidHeader (
static int
ApDumpTableBuffer (
ACPI_TABLE_HEADER *Table,
+ UINT32 Instance,
ACPI_PHYSICAL_ADDRESS Address)
{
+ UINT32 TableLength;
- /* Check if the table header appears to be valid */
-
- if (!ApIsValidHeader (Table))
- {
- return (-1);
- }
-
- /* Validate the table checksum (except FACS - has no checksum) */
- if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
- {
- (void) AcpiTbVerifyChecksum (Table, Table->Length);
- }
+ TableLength = ApGetTableLength (Table);
/* Print only the header if requested */
@@ -137,7 +215,7 @@ ApDumpTableBuffer (
if (Gbl_BinaryMode)
{
- return (ApWriteToBinaryFile (Table));
+ return (ApWriteToBinaryFile (Table, Instance));
}
/*
@@ -148,7 +226,7 @@ ApDumpTableBuffer (
printf ("%4.4s @ 0x%8.8X%8.8X\n", Table->Signature,
ACPI_FORMAT_UINT64 (Address));
- AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table), Table->Length,
+ AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, Table), TableLength,
DB_BYTE_DISPLAY, 0);
printf ("\n");
return (0);
@@ -173,6 +251,7 @@ ApDumpAllTables (
void)
{
ACPI_TABLE_HEADER *Table;
+ UINT32 Instance = 0;
ACPI_PHYSICAL_ADDRESS Address;
ACPI_STATUS Status;
UINT32 i;
@@ -182,7 +261,7 @@ ApDumpAllTables (
for (i = 0; i < AP_MAX_ACPI_FILES; i++)
{
- Status = AcpiOsGetTableByIndex (i, &Table, &Address);
+ Status = AcpiOsGetTableByIndex (i, &Table, &Instance, &Address);
if (ACPI_FAILURE (Status))
{
/* AE_LIMIT means that no more tables are available */
@@ -205,7 +284,7 @@ ApDumpAllTables (
}
}
- if (ApDumpTableBuffer (Table, Address))
+ if (ApDumpTableBuffer (Table, Instance, Address))
{
return (-1);
}
@@ -261,7 +340,7 @@ ApDumpTableByAddress (
return (-1);
}
- TableStatus = ApDumpTableBuffer (Table, Address);
+ TableStatus = ApDumpTableBuffer (Table, 0, Address);
free (Table);
return (TableStatus);
}
@@ -306,7 +385,11 @@ ApDumpTableByName (
/* To be friendly, handle tables whose signatures do not match the name */
- if (ACPI_COMPARE_NAME (LocalSignature, "FADT"))
+ if (ACPI_COMPARE_NAME (LocalSignature, AP_DUMP_SIG_RSDP))
+ {
+ strcpy (LocalSignature, AP_DUMP_SIG_RSDP);
+ }
+ else if (ACPI_COMPARE_NAME (LocalSignature, "FADT"))
{
strcpy (LocalSignature, ACPI_SIG_FADT);
}
@@ -336,7 +419,7 @@ ApDumpTableByName (
return (-1);
}
- if (ApDumpTableBuffer (Table, Address))
+ if (ApDumpTableBuffer (Table, Instance, Address))
{
return (-1);
}
@@ -395,7 +478,7 @@ ApDumpTableFromFile (
Pathname, Table->Signature, FileSize, FileSize);
}
- TableStatus = ApDumpTableBuffer (Table, 0);
+ TableStatus = ApDumpTableBuffer (Table, 0, 0);
free (Table);
return (TableStatus);
}
diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c
index fd17423..5c4b0dc 100644
--- a/source/tools/acpidump/apfiles.c
+++ b/source/tools/acpidump/apfiles.c
@@ -100,6 +100,7 @@ ApOpenOutputFile (
* FUNCTION: ApWriteToBinaryFile
*
* PARAMETERS: Table - ACPI table to be written
+ * Instance - ACPI table instance no. to be written
*
* RETURN: Status
*
@@ -110,29 +111,42 @@ ApOpenOutputFile (
int
ApWriteToBinaryFile (
- ACPI_TABLE_HEADER *Table)
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Instance)
{
char Filename[ACPI_NAME_SIZE + 16];
- char SsdtInstance [16];
+ char InstanceStr [16];
FILE *File;
size_t Actual;
+ UINT32 TableLength;
- /* Construct lower-case filename from the table signature */
+ /* Obtain table length */
- Filename[0] = (char) ACPI_TOLOWER (Table->Signature[0]);
- Filename[1] = (char) ACPI_TOLOWER (Table->Signature[1]);
- Filename[2] = (char) ACPI_TOLOWER (Table->Signature[2]);
- Filename[3] = (char) ACPI_TOLOWER (Table->Signature[3]);
+ TableLength = ApGetTableLength (Table);
+
+ /* Construct lower-case filename from the table local signature */
+
+ if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
+ {
+ ACPI_MOVE_NAME (Filename, AP_DUMP_SIG_RSDP);
+ }
+ else
+ {
+ ACPI_MOVE_NAME (Filename, Table->Signature);
+ }
+ Filename[0] = (char) ACPI_TOLOWER (Filename[0]);
+ Filename[1] = (char) ACPI_TOLOWER (Filename[1]);
+ Filename[2] = (char) ACPI_TOLOWER (Filename[2]);
+ Filename[3] = (char) ACPI_TOLOWER (Filename[3]);
Filename[ACPI_NAME_SIZE] = 0;
/* Handle multiple SSDTs - create different filenames for each */
- if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT))
+ if (Instance > 0)
{
- sprintf (SsdtInstance, "%u", Gbl_SsdtCount);
- strcat (Filename, SsdtInstance);
- Gbl_SsdtCount++;
+ sprintf (InstanceStr, "%u", Instance);
+ strcat (Filename, InstanceStr);
}
strcat (Filename, ACPI_TABLE_FILE_SUFFIX);
@@ -153,8 +167,8 @@ ApWriteToBinaryFile (
return (-1);
}
- Actual = fwrite (Table, 1, Table->Length, File);
- if (Actual != Table->Length)
+ Actual = fwrite (Table, 1, TableLength, File);
+ if (Actual != TableLength)
{
perror ("Error writing binary output file");
fclose (File);
diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c
index 4c90cb7..b9e62eb 100644
--- a/source/tools/acpidump/apmain.c
+++ b/source/tools/acpidump/apmain.c
@@ -92,7 +92,7 @@ UINT32 CurrentAction = 0;
#define AP_UTILITY_NAME "ACPI Binary Table Dump Utility"
-#define AP_SUPPORTED_OPTIONS "?a:bf:hn:o:svz"
+#define AP_SUPPORTED_OPTIONS "?a:bcf:hn:o:r:svz"
/******************************************************************************
@@ -111,10 +111,12 @@ ApDisplayUsage (
ACPI_USAGE_HEADER ("acpidump [options]");
ACPI_OPTION ("-b", "Dump tables to binary files");
+ ACPI_OPTION ("-c", "Dump customized tables");
ACPI_OPTION ("-h -?", "This help message");
ACPI_OPTION ("-o <File>", "Redirect output to file");
+ ACPI_OPTION ("-r <Address>", "Dump tables from specified RSDP");
ACPI_OPTION ("-s", "Print table summaries only");
- ACPI_OPTION ("-v", "Version of this utility");
+ ACPI_OPTION ("-v", "Display version information");
ACPI_OPTION ("-z", "Verbose mode");
printf ("\nTable Options:\n");
@@ -182,6 +184,7 @@ ApDoOptions (
char **argv)
{
int j;
+ ACPI_STATUS Status;
/* Command line options */
@@ -196,6 +199,11 @@ ApDoOptions (
Gbl_BinaryMode = TRUE;
continue;
+ case 'c': /* Dump customized tables */
+
+ Gbl_DumpCustomizedTables = TRUE;
+ continue;
+
case 'h':
case '?':
@@ -210,6 +218,17 @@ ApDoOptions (
}
continue;
+ case 'r': /* Dump tables from specified RSDP */
+
+ Status = AcpiUtStrtoul64 (AcpiGbl_Optarg, 0, &Gbl_RsdpBase);
+ if (ACPI_FAILURE (Status))
+ {
+ fprintf (stderr, "%s: Could not convert to a physical address\n",
+ AcpiGbl_Optarg);
+ exit (-1);
+ }
+ continue;
+
case 's': /* Print table summaries only */
Gbl_SummaryMode = TRUE;
diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c
index 44ce31f..5272f41 100644
--- a/source/tools/acpiexec/aehandlers.c
+++ b/source/tools/acpiexec/aehandlers.c
@@ -126,6 +126,10 @@ static UINT32
AeEventHandler (
void *Context);
+static UINT32
+AeSciHandler (
+ void *Context);
+
static char *TableEvents[] =
{
"LOAD",
@@ -632,9 +636,9 @@ AeInterfaceHandler (
#if (!ACPI_REDUCED_HARDWARE)
/******************************************************************************
*
- * FUNCTION: AeEventHandler
+ * FUNCTION: AeEventHandler, AeSciHandler
*
- * DESCRIPTION: Handler for Fixed Events
+ * DESCRIPTION: Handler for Fixed Events and SCIs
*
*****************************************************************************/
@@ -644,6 +648,16 @@ AeEventHandler (
{
return (0);
}
+
+static UINT32
+AeSciHandler (
+ void *Context)
+{
+
+ AcpiOsPrintf ("[AcpiExec] Received an SCI at handler\n");
+ return (0);
+}
+
#endif /* !ACPI_REDUCED_HARDWARE */
@@ -666,10 +680,15 @@ AeRegionInit (
void *HandlerContext,
void **RegionContext)
{
- /*
- * Real simple, set the RegionContext to the RegionHandle
- */
- *RegionContext = RegionHandle;
+
+ if (Function == ACPI_REGION_DEACTIVATE)
+ {
+ *RegionContext = NULL;
+ }
+ else
+ {
+ *RegionContext = RegionHandle;
+ }
return (AE_OK);
}
@@ -677,6 +696,51 @@ AeRegionInit (
/*******************************************************************************
*
+ * FUNCTION: AeInstallSciHandler
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install handler for SCIs. Exercise the code by doing an
+ * install/remove/install.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AeInstallSciHandler (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not install an SCI handler (1)"));
+ }
+
+ Status = AcpiRemoveSciHandler (AeSciHandler);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not remove an SCI handler"));
+ }
+
+ Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not install an SCI handler (2)"));
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AeInstallDeviceHandlers, AeInstallEcHandler,
* AeInstallPciHandler
*
@@ -685,7 +749,7 @@ AeRegionInit (
* RETURN: Status
*
* DESCRIPTION: Walk entire namespace, install a handler for every EC
- * device found.
+ * and PCI device found.
*
******************************************************************************/
@@ -785,6 +849,11 @@ AeInstallLateHandlers (
#if (!ACPI_REDUCED_HARDWARE)
if (!AcpiGbl_ReducedHardware)
{
+ /* Install a user SCI handler */
+
+ Status = AeInstallSciHandler ();
+ AE_CHECK_OK (AeInstallSciHandler, Status);
+
/* Install some fixed event handlers */
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL);
diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c
index aa0612c..dbd0301 100644
--- a/source/tools/acpiexec/aemain.c
+++ b/source/tools/acpiexec/aemain.c
@@ -91,7 +91,8 @@ static char BatchBuffer[AE_BUFFER_SIZE]; /* Batch command buf
static char *FileList[ASL_MAX_FILES];
static AE_TABLE_DESC *AeTableListHead = NULL;
-#define AE_SUPPORTED_OPTIONS "?b:d:e:f:ghm^orv:x:"
+#define ACPIEXEC_NAME "AML Execution/Debug Utility"
+#define AE_SUPPORTED_OPTIONS "?b:d:e:f:ghm^orv^:x:"
/******************************************************************************
@@ -134,6 +135,7 @@ usage (
ACPI_OPTION ("-f <Value>", "Operation Region initialization fill value");
ACPI_OPTION ("-r", "Use hardware-reduced FADT V5");
+ ACPI_OPTION ("-v", "Display version information");
ACPI_OPTION ("-vi", "Verbose initialization output");
ACPI_OPTION ("-vr", "Verbose region handler output");
ACPI_OPTION ("-x <DebugLevel>", "Debug output level");
@@ -302,6 +304,10 @@ AeDoOptions (
switch (AcpiGbl_Optarg[0])
{
+ case '^': /* -v: (Version): signon already emitted, just exit */
+
+ exit (0);
+
case 'i':
AcpiDbgLevel |= ACPI_LV_INIT_NAMES;
@@ -366,7 +372,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
- printf (ACPI_COMMON_SIGNON ("AML Execution/Debug Utility"));
+ printf (ACPI_COMMON_SIGNON (ACPIEXEC_NAME));
if (argc < 2)
{
usage ();
diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c
index a32c4c5..1ba876e 100644
--- a/source/tools/acpiexec/aetables.c
+++ b/source/tools/acpiexec/aetables.c
@@ -247,7 +247,7 @@ AeBuildLocalTables (
/* Build an RSDP */
ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP));
- ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8);
+ ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature);
ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6);
LocalRSDP.Revision = 2;
LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT);
diff --git a/source/tools/acpihelp/ahmain.c b/source/tools/acpihelp/ahmain.c
index 07e162c..036ab75 100644
--- a/source/tools/acpihelp/ahmain.c
+++ b/source/tools/acpihelp/ahmain.c
@@ -50,6 +50,9 @@ static void
AhDisplayUsage (
void);
+#define AH_UTILITY_NAME "ACPI Help Utility"
+#define AH_SUPPORTED_OPTIONS "ehikmopsv"
+
/******************************************************************************
*
@@ -66,6 +69,7 @@ AhDisplayUsage (
ACPI_USAGE_HEADER ("acpihelp <options> [NamePrefix | HexValue]");
ACPI_OPTION ("-h", "Display help");
+ ACPI_OPTION ("-v", "Display version information");
printf ("\nACPI Names and Symbols:\n");
ACPI_OPTION ("-k [NamePrefix]", "Find/Display ASL non-operator keyword(s)");
@@ -104,7 +108,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
- printf (ACPI_COMMON_SIGNON ("ACPI Help Utility"));
+ printf (ACPI_COMMON_SIGNON (AH_UTILITY_NAME));
DecodeType = AH_DECODE_DEFAULT;
if (argc < 2)
@@ -115,7 +119,7 @@ main (
/* Command line options */
- while ((j = AcpiGetopt (argc, argv, "ehikmops")) != EOF) switch (j)
+ while ((j = AcpiGetopt (argc, argv, AH_SUPPORTED_OPTIONS)) != EOF) switch (j)
{
case 'e':
@@ -152,6 +156,10 @@ main (
DecodeType = AH_DECODE_ASL;
break;
+ case 'v': /* -v: (Version): signon already emitted, just exit */
+
+ return (0);
+
case 'h':
default:
diff --git a/source/tools/acpinames/anmain.c b/source/tools/acpinames/anmain.c
index 2bc4c6e..c30ae7a 100644
--- a/source/tools/acpinames/anmain.c
+++ b/source/tools/acpinames/anmain.c
@@ -53,7 +53,8 @@ FILE *AcpiGbl_DebugFile;
static AE_TABLE_DESC *AeTableListHead = NULL;
-#define AE_SUPPORTED_OPTIONS "?h"
+#define AN_UTILITY_NAME "ACPI Namespace Dump Utility"
+#define AN_SUPPORTED_OPTIONS "?hv"
/******************************************************************************
@@ -75,6 +76,7 @@ usage (
ACPI_USAGE_HEADER ("AcpiNames [options] AMLfile");
ACPI_OPTION ("-?", "Display this message");
+ ACPI_OPTION ("-v", "Display version information");
}
@@ -240,7 +242,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
- printf (ACPI_COMMON_SIGNON ("ACPI Namespace Dump Utility"));
+ printf (ACPI_COMMON_SIGNON (AN_UTILITY_NAME));
if (argc < 2)
{
@@ -258,8 +260,12 @@ main (
/* Get the command line options */
- while ((j = AcpiGetopt (argc, argv, AE_SUPPORTED_OPTIONS)) != EOF) switch(j)
+ while ((j = AcpiGetopt (argc, argv, AN_SUPPORTED_OPTIONS)) != EOF) switch(j)
{
+ case 'v': /* -v: (Version): signon already emitted, just exit */
+
+ return (0);
+
case '?':
case 'h':
default:
diff --git a/source/tools/acpinames/antables.c b/source/tools/acpinames/antables.c
index dcf2fa9..6473e6b 100644
--- a/source/tools/acpinames/antables.c
+++ b/source/tools/acpinames/antables.c
@@ -178,7 +178,7 @@ AeBuildLocalTables (
/* Build an RSDP */
ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP));
- ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8);
+ ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature);
ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6);
LocalRSDP.Revision = 2;
LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT);
diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c
index dc69189..e34eff0 100644
--- a/source/tools/acpisrc/asmain.c
+++ b/source/tools/acpisrc/asmain.c
@@ -98,6 +98,9 @@ BOOLEAN Gbl_IgnoreLoneLineFeeds = FALSE;
BOOLEAN Gbl_HasLoneLineFeeds = FALSE;
BOOLEAN Gbl_Cleanup = FALSE;
+#define AS_UTILITY_NAME "ACPI Source Code Conversion Utility"
+#define AS_SUPPORTED_OPTIONS "cdhlqsuv^y"
+
/******************************************************************************
*
@@ -295,7 +298,8 @@ AsDisplayUsage (
printf ("\n");
ACPI_OPTION ("-d", "Leave debug statements in code");
ACPI_OPTION ("-s", "Generate source statistics only");
- ACPI_OPTION ("-v", "Verbose mode");
+ ACPI_OPTION ("-v", "Display version information");
+ ACPI_OPTION ("-vb", "Verbose mode");
ACPI_OPTION ("-y", "Suppress file overwrite prompts");
}
@@ -321,7 +325,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
- printf (ACPI_COMMON_SIGNON ("ACPI Source Code Conversion Utility"));
+ printf (ACPI_COMMON_SIGNON (AS_UTILITY_NAME));
if (argc < 2)
{
@@ -331,7 +335,7 @@ main (
/* Command line options */
- while ((j = AcpiGetopt (argc, argv, "cdhlqsuvy")) != EOF) switch(j)
+ while ((j = AcpiGetopt (argc, argv, AS_SUPPORTED_OPTIONS)) != EOF) switch(j)
{
case 'l':
@@ -376,9 +380,25 @@ main (
case 'v':
- /* Verbose mode */
+ switch (AcpiGbl_Optarg[0])
+ {
+ case '^': /* -v: (Version): signon already emitted, just exit */
+
+ exit (0);
+
+ case 'b':
+
+ /* Verbose mode */
+
+ Gbl_VerboseMode = TRUE;
+ break;
+
+ default:
+
+ printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
+ return (-1);
+ }
- Gbl_VerboseMode = TRUE;
break;
case 'y':
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index 18317ff..d382523 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -383,6 +383,8 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_RSDUMP_INFO", SRC_TYPE_STRUCT},
{"ACPI_RW_LOCK", SRC_TYPE_STRUCT},
{"ACPI_S3PT_HEADER", SRC_TYPE_STRUCT},
+ {"ACPI_SCI_HANDLER", SRC_TYPE_SIMPLE},
+ {"ACPI_SCI_HANDLER_INFO", SRC_TYPE_STRUCT},
{"ACPI_SCOPE_STATE", SRC_TYPE_STRUCT},
{"ACPI_SEMAPHORE", SRC_TYPE_SIMPLE},
{"ACPI_SIGNAL_FATAL_INFO", SRC_TYPE_STRUCT},
diff --git a/source/tools/acpixtract/axmain.c b/source/tools/acpixtract/axmain.c
index b0cadfc..bfc27bb 100644
--- a/source/tools/acpixtract/axmain.c
+++ b/source/tools/acpixtract/axmain.c
@@ -74,6 +74,9 @@ static int AxAction = AX_EXTRACT_AML_TABLES; /* DSDT & SSDTs */
#define AX_OPTIONAL_TABLES 0
#define AX_REQUIRED_TABLE 1
+#define AX_UTILITY_NAME "ACPI Binary Table Extraction Utility"
+#define AX_SUPPORTED_OPTIONS "ahls:v"
+
/******************************************************************************
*
@@ -93,6 +96,7 @@ DisplayUsage (
ACPI_OPTION ("-a", "Extract all tables, not just DSDT/SSDT");
ACPI_OPTION ("-l", "List table summaries, do not extract");
ACPI_OPTION ("-s <signature>", "Extract all tables with <signature>");
+ ACPI_OPTION ("-v", "Display version information");
printf ("\nExtract binary ACPI tables from text acpidump output\n");
printf ("Default invocation extracts the DSDT and all SSDTs\n");
@@ -118,7 +122,7 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
- printf (ACPI_COMMON_SIGNON ("ACPI Binary Table Extraction Utility"));
+ printf (ACPI_COMMON_SIGNON (AX_UTILITY_NAME));
if (argc < 2)
{
@@ -128,7 +132,7 @@ main (
/* Command line options */
- while ((j = AcpiGetopt (argc, argv, "ahls:")) != EOF) switch (j)
+ while ((j = AcpiGetopt (argc, argv, AX_SUPPORTED_OPTIONS)) != EOF) switch (j)
{
case 'a':
@@ -145,6 +149,10 @@ main (
AxAction = AX_EXTRACT_SIGNATURE; /* Extract only tables with this sig */
break;
+ case 'v': /* -v: (Version): signon already emitted, just exit */
+
+ return (0);
+
case 'h':
default:
diff --git a/tests/misc/grammar.asl b/tests/misc/grammar.asl
index 792e859..774fcfd 100644
--- a/tests/misc/grammar.asl
+++ b/tests/misc/grammar.asl
@@ -242,7 +242,7 @@ DefinitionBlock (
}
})
- Method (_CRS, 0, NotSerialized)
+ Method (_CRS, 0, Serialized)
{
Name (PRT0, ResourceTemplate ()
{
@@ -401,7 +401,7 @@ DefinitionBlock (
Return (PRT0)
}
- Method (_PRS, 0, NotSerialized)
+ Method (_PRS, 0, Serialized)
{
Name (BUF0, ResourceTemplate ()
{
@@ -508,7 +508,7 @@ DefinitionBlock (
MFLD,8
}
- Method (TCOP)
+ Method (TCOP,, Serialized)
{
Name (_STR, Unicode ("test"))
Store (4, MFLD)
@@ -707,7 +707,7 @@ DefinitionBlock (
Name(_HID,EISAID("PNP0A03"))
Name(_ADR,0x0)
- Method(_CRS)
+ Method(_CRS,, Serialized)
{
Name(PRT0, ResourceTemplate() {
WORDBusNumber( // Bus number resource(0)
@@ -870,7 +870,7 @@ DefinitionBlock (
Return(RBIF)
}
- Method(_BST) {
+ Method(_BST,, Serialized) {
_INI()
@@ -1310,7 +1310,7 @@ DefinitionBlock (
* Field Creation
*/
- Method (FLDS)
+ Method (FLDS,, Serialized)
{
Store ("++++++++ Creating BufferFields", Debug)
Name (BUF2, Buffer (128) {})
@@ -1401,7 +1401,7 @@ DefinitionBlock (
/* Field execution */
- Method (FLDX)
+ Method (FLDX,, Serialized)
{
Field (\_SB_.MEM.SMEM, AnyAcc, NoLock, Preserve)
{ // Field: SMEM overlay using 32-bit field elements
@@ -1434,7 +1434,7 @@ DefinitionBlock (
}
- Method (OBJ2, 1)
+ Method (OBJ2, 1, Serialized)
{
Store ("++++++++ Creating Buffer BUFO", Debug)
Name (BUFO, Buffer (32) {})
@@ -1906,7 +1906,7 @@ DefinitionBlock (
}
- Method (REFS)
+ Method (REFS,, Serialized)
{
Name (BBUF, Buffer() {0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7})
@@ -1982,7 +1982,7 @@ DefinitionBlock (
}
- Method (INDX, 0)
+ Method (INDX, 0, Serialized)
{
Name(STAT,Package(4){})
Store(0x44443333,Index(STAT,0))
@@ -2158,7 +2158,7 @@ DefinitionBlock (
//
Device (NOSV)
{
- Method (TEST)
+ Method (TEST,, Serialized)
{
Store ("++++++++ NoSave Test", Debug)
@@ -2659,7 +2659,7 @@ DefinitionBlock (
Return (Arg0)
}
- Method (RBUF)
+ Method (RBUF,, Serialized)
{ // RBUF: Return Buffer from local variable
Name (ABUF, Buffer() {"ARBITRARY_BUFFER"})
@@ -3333,7 +3333,7 @@ DefinitionBlock (
}//OROP
- Method(TEST)
+ Method(TEST,, Serialized)
{
Store ("++++++++ AndOrOp Test", Debug)
@@ -3425,7 +3425,7 @@ DefinitionBlock (
SMBY, 8, // 8-bit BYTE
} // Field(RAM)
- Method (TEST)
+ Method (TEST,, Serialized)
{
Store ("++++++++ AddSubOp Test", Debug)
@@ -3518,7 +3518,7 @@ DefinitionBlock (
SMBY, 8, // 8-bit BYTE
} // Field(RAM)
- Method (TEST)
+ Method (TEST,, Serialized)
{
Store ("++++++++ IncDecOp Test", Debug)
@@ -4125,7 +4125,7 @@ DefinitionBlock (
SMBY, 8, // 8-bit BYTE
} // Field(RAM)
- Method (TEST)
+ Method (TEST,, Serialized)
{
Store ("++++++++ MulDivOp Test", Debug)
@@ -4682,7 +4682,7 @@ DefinitionBlock (
Device (XORD)
{
//This Method tests XOr operator for all the data types i.e. BYTE, WORD and DWORD
- Method (TEST)
+ Method (TEST,, Serialized)
{
Store ("++++++++ Xor Test", Debug)
@@ -5108,7 +5108,7 @@ DefinitionBlock (
// index), but are guaranteed to be unique so the failing test
// case can be uniquely identified.
//
- Method (MADM, 1) // Misaligned Dynamic RAM SystemMemory OperationRegion
+ Method (MADM, 1, Serialized) // Misaligned Dynamic RAM SystemMemory OperationRegion
// Arg0 -- SystemMemory OperationRegion base address
{ // MADM: Misaligned Dynamic RAM SystemMemory OperationRegion
OperationRegion (RAM, SystemMemory, Arg0, 0x100)
@@ -6396,7 +6396,7 @@ DefinitionBlock (
// zero if the strings mismatch, or 1 if the strings match.
// This exercises the test case of copying a string into a buffer
// and performing an IndexOp on the resulting buffer.
- Method (MCTH, 2) // Control Method to compare two strings
+ Method (MCTH, 2, Serialized) // Control Method to compare two strings
{ // MCTH: Control Method to compare two strings
// Arg0: first string to compare
// Arg1: second string to compare
@@ -6546,7 +6546,7 @@ DefinitionBlock (
{ Return (0x0F) } // Battery not present
} // _STA
- Method (_BIF)
+ Method (_BIF,, Serialized)
{
Name (BUFR, Package(13) {})
Store (\_SB.PCI2.ISA.EC0.BPU0, Index (BUFR,0)) // Power Unit
@@ -6570,7 +6570,7 @@ DefinitionBlock (
Return (BUFR)
} // _BIF
- Method (_BST)
+ Method (_BST,, Serialized)
{
Name (BUFR, Package(4) {1, 0x100, 0x76543210, 0x180})
Return (BUFR)
@@ -6581,7 +6581,7 @@ DefinitionBlock (
Store (arg0, \_SB.PCI2.ISA.EC0.BTP0) // Set Battery Trip point
}
- Method (TEST)
+ Method (TEST,, Serialized)
{
Store ("++++++++ IndexOp Test", Debug)
@@ -6838,7 +6838,7 @@ DefinitionBlock (
Package (3) {0, 0, 0}
}) // C17A
- Method (C17B, 1)
+ Method (C17B, 1, Serialized)
{ // C17B: _BIF implementation
Name (C17C, Package (13)
{ // C17C: _BIF control method return package
@@ -6908,7 +6908,7 @@ DefinitionBlock (
Device (IDX3)
{
- Method (LCLB)
+ Method (LCLB,, Serialized)
{ // LCLB control method: test Index(Local#) where Local# is buffer
// Local0 is index counter
// Local1 is buffer
@@ -6960,7 +6960,7 @@ DefinitionBlock (
Return (0) // Pass
} // LCLB control method: test Index(Local#) where Local# is buffer
- Method (LCLP)
+ Method (LCLP,, Serialized)
{ // LCLP control method: test Index(Local#) where Local# is package
// Local0 is index counter
// Local1 is package
@@ -7066,7 +7066,7 @@ DefinitionBlock (
// Generic Test method
//
// This test returns 0xE (14) - ObjectType = Buffer Field
- Method(TST1)
+ Method(TST1,, Serialized)
{
Name (DEST, Buffer () // 62 characters plus NULL
{"Destination buffer that is longer than the short source buffer"})
@@ -7085,7 +7085,7 @@ DefinitionBlock (
}
- Method(TST2)
+ Method(TST2,, Serialized)
{
Name (BUF0, Buffer() {0x1, 0x2, 0x3, 0x4, 0x5})
Store(0x55, Index(BUF0, 2))
@@ -7102,7 +7102,7 @@ DefinitionBlock (
}
- Method(TST3)
+ Method(TST3,, Serialized)
{
Name (BUF1, Buffer() {0x1, 0x2, 0x3, 0x4, 0x5})
Store(Index(BUF1, 1), Local0)
@@ -7293,7 +7293,7 @@ DefinitionBlock (
}
- Method (TSTF)
+ Method (TSTF,, Serialized)
{
Name (SRCB, Buffer (12) {}) // 12 characters
Store ("Short Buffer", SRCB)
@@ -7318,7 +7318,7 @@ DefinitionBlock (
Return(0)
}
- Method (TSTG)
+ Method (TSTG,, Serialized)
{
Name (SRCB, Buffer (12) {}) // 12 characters
@@ -7403,7 +7403,7 @@ DefinitionBlock (
// This test shows that MS ACPI.SYS stores only the lower 8-bits of a 32-bit
// number into the index'ed buffer
//
- Method (TSTH)
+ Method (TSTH,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@@ -7439,7 +7439,7 @@ DefinitionBlock (
Return(0)
}
- Method (TSTI)
+ Method (TSTI,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@@ -7475,7 +7475,7 @@ DefinitionBlock (
Return(0)
}
- Method(TSTJ)
+ Method(TSTJ,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@@ -7511,7 +7511,7 @@ DefinitionBlock (
Return(0)
}
- Method(TSTK)
+ Method(TSTK,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@@ -7547,7 +7547,7 @@ DefinitionBlock (
Return(0)
}
- Method(TSTL)
+ Method(TSTL,, Serialized)
{
// Create a Destination Buffer
Name (DBUF, Buffer () {"abcdefghijklmnopqrstuvwxyz"})
@@ -7733,7 +7733,7 @@ DefinitionBlock (
Device (MTCH)
{
- Method (TEST)
+ Method (TEST,, Serialized)
{
Store ("++++++++ MatchOp Test", Debug)
@@ -8267,7 +8267,7 @@ DefinitionBlock (
{ Return (0x0F) } // battery not present
} // _STA
- Method (_BIF)
+ Method (_BIF,, Serialized)
{ // _BIF
Name (BUFR, Package (13) {})
@@ -8291,7 +8291,7 @@ DefinitionBlock (
Device (IDX2)
{
- Method (B2IB)
+ Method (B2IB,, Serialized)
{ // B2IB: store from Buffer into Index'ed Buffer
Name (SRCB, Buffer () {"Short Buffer"}) // 12 characters plus NULL
@@ -8485,7 +8485,7 @@ DefinitionBlock (
Return (0) // pass
} // B2IB: store from Buffer into Index'ed Buffer
- Method (FB2P)
+ Method (FB2P,, Serialized)
{ // FB2P: store from Field Buffer into Index'ed Package
Name (DEST, Package (2) {})
@@ -8700,7 +8700,7 @@ DefinitionBlock (
Return (0)
} // SAR0: SizeOf(Arg) test control method
- Method (SARG)
+ Method (SARG,, Serialized)
{ // SARG: SizeOf(Arg) test control method
Name (BUFR, Buffer (12) {}) // uninitialized Buffer
Name (BUF1, Buffer() {0x01, 0x02, 0x03, 0x04, 0x05})
@@ -8965,7 +8965,7 @@ DefinitionBlock (
Return (0)
} // SARG: SizeOf(Arg) test control method
- Method (SBUF)
+ Method (SBUF,, Serialized)
{ // SBUF: SizeOf(Buffer) test control method
Name (BUFR, Buffer (12) {})
@@ -9026,7 +9026,7 @@ DefinitionBlock (
} // SIND: SizeOf(Index(,,)) test control method
****************************************************/
- Method (SLOC)
+ Method (SLOC,, Serialized)
{ // SLOC: SizeOf(Local) test control method
Name (BUFR, Buffer (12) {}) // uninitialized Buffer
Name (STR0, "String")
OpenPOWER on IntegriCloud