svn commit: r200553 - in head/sys/contrib/dev/acpica: . compiler
debugger disassembler dispatcher events executer include
namespace parser resources tools/acpiexec utilities
Jung-uk Kim
jkim at FreeBSD.org
Mon Dec 14 14:24:05 PST 2009
Author: jkim
Date: Mon Dec 14 22:24:04 2009
New Revision: 200553
URL: http://svn.freebsd.org/changeset/base/200553
Log:
Merge ACPICA 20091214.
Modified:
head/sys/contrib/dev/acpica/changes.txt
head/sys/contrib/dev/acpica/compiler/aslcompile.c
head/sys/contrib/dev/acpica/debugger/dbutils.c
head/sys/contrib/dev/acpica/disassembler/dmwalk.c
head/sys/contrib/dev/acpica/dispatcher/dsmethod.c
head/sys/contrib/dev/acpica/dispatcher/dswload.c
head/sys/contrib/dev/acpica/events/evregion.c
head/sys/contrib/dev/acpica/events/evrgnini.c
head/sys/contrib/dev/acpica/events/evxface.c
head/sys/contrib/dev/acpica/events/evxfevnt.c
head/sys/contrib/dev/acpica/events/evxfregn.c
head/sys/contrib/dev/acpica/executer/exmutex.c
head/sys/contrib/dev/acpica/include/acnamesp.h
head/sys/contrib/dev/acpica/include/acobject.h
head/sys/contrib/dev/acpica/include/acoutput.h
head/sys/contrib/dev/acpica/include/acpixf.h
head/sys/contrib/dev/acpica/namespace/nsaccess.c
head/sys/contrib/dev/acpica/namespace/nsdump.c
head/sys/contrib/dev/acpica/namespace/nseval.c
head/sys/contrib/dev/acpica/namespace/nsnames.c
head/sys/contrib/dev/acpica/namespace/nspredef.c
head/sys/contrib/dev/acpica/namespace/nsrepair.c
head/sys/contrib/dev/acpica/namespace/nsrepair2.c
head/sys/contrib/dev/acpica/namespace/nsutils.c
head/sys/contrib/dev/acpica/namespace/nsxfeval.c
head/sys/contrib/dev/acpica/namespace/nsxfname.c
head/sys/contrib/dev/acpica/namespace/nsxfobj.c
head/sys/contrib/dev/acpica/parser/psxface.c
head/sys/contrib/dev/acpica/resources/rsxface.c
head/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h
head/sys/contrib/dev/acpica/utilities/utcopy.c
Directory Properties:
head/sys/contrib/dev/acpica/ (props changed)
Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/changes.txt Mon Dec 14 22:24:04 2009 (r200553)
@@ -1,4 +1,71 @@
----------------------------------------
+14 December 2009. Summary of changes for version 20091214:
+
+This release is available at www.acpica.org/downloads
+
+1) ACPI CA Core Subsystem:
+
+Enhanced automatic data type conversions for predefined name repairs. This
+change expands the automatic repairs/conversions for predefined name return
+values to make Integers, Strings, and Buffers fully interchangeable. Also, a
+Buffer can be converted to a Package of Integers if necessary. The nsrepair.c
+module was completely restructured. Lin Ming, Bob Moore.
+
+Implemented automatic removal of null package elements during predefined name
+repairs. This change will automatically remove embedded and trailing NULL
+package elements from returned package objects that are defined to contain a
+variable number of sub-packages. The driver is then presented with a package
+with no null elements to deal with. ACPICA BZ 819.
+
+Implemented a repair for the predefined _FDE and _GTM names. The expected
+return value for both names is a Buffer of 5 DWORDs. This repair fixes two
+possible problems (both seen in the field), where a package of integers is
+returned, or a buffer of BYTEs is returned. With assistance from Jung-uk Kim.
+
+Implemented additional module-level code support. This change will properly
+execute module-level code that is not at the root of the namespace (under a
+Device object, etc.). Now executes the code within the current scope instead
+of the root. ACPICA BZ 762. Lin Ming.
+
+Fixed possible mutex acquisition errors when running _REG methods. Fixes a
+problem where mutex errors can occur when running a _REG method that is in
+the same scope as a method-defined operation region or an operation region
+under a module-level IF block. This type of code is rare, so the problem has
+not been seen before. ACPICA BZ 826. Lin Ming, Bob Moore.
+
+Fixed a possible memory leak during module-level code execution. An object
+could be leaked for each block of executed module-level code if the
+interpreter slack mode is enabled This change deletes any implicitly returned
+object from the module-level code block. Lin Ming.
+
+Removed messages for successful predefined repair(s). The repair mechanism
+was considered too wordy. Now, messages are only unconditionally emitted if
+the return object cannot be repaired. Existing messages for successful
+repairs were converted to ACPI_DEBUG_PRINT messages for now. ACPICA BZ 827.
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
+debug version of the code includes the debug output trace mechanism and has a
+much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 86.6K Code, 18.2K Data, 104.8K Total
+ Debug Version: 162.7K Code, 50.8K Data, 213.5K Total
+ Current Release:
+ Non-Debug Version: 87.0K Code, 18.0K Data, 105.0K Total
+ Debug Version: 163.4K Code, 50.8K Data, 214.2K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Fixed a regression introduced in 20091112 where intermediate .SRC files
+were no longer automatically removed at the termination of the compile.
+
+acpiexec: Implemented the -f option to specify default region fill value.
+This option specifies the value used to initialize buffers that simulate
+operation regions. Default value is zero. Useful for debugging problems that
+depend on a specific initial value for a region or field.
+
+----------------------------------------
12 November 2009. Summary of changes for version 20091112:
This release is available at www.acpica.org/downloads
Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompile.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -895,20 +895,6 @@ CmCleanupAndExit (
10) / Gbl_NsLookupCount);
}
- /*
- * TBD: SourceOutput should be .TMP, then rename if we want to keep it?
- */
- if (!Gbl_SourceOutputFlag)
- {
- remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
- }
-
- /* Delete AML file if there are errors */
-
- if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
- {
- remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
- }
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
@@ -923,6 +909,27 @@ CmCleanupAndExit (
{
FlCloseFile (i);
}
+
+ /* Delete AML file if there are errors */
+
+ if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
+ {
+ remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
+ }
+
+ /*
+ * Delete intermediate ("combined") source file (if -ls flag not set)
+ *
+ * TBD: SourceOutput should be .TMP, then rename if we want to keep it?
+ */
+ if (!Gbl_SourceOutputFlag)
+ {
+ if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename))
+ {
+ printf ("Could not remove SRC file, %s\n",
+ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+ }
+ }
}
Modified: head/sys/contrib/dev/acpica/debugger/dbutils.c
==============================================================================
--- head/sys/contrib/dev/acpica/debugger/dbutils.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/debugger/dbutils.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -275,6 +275,10 @@ AcpiDbDumpExternalObject (
AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
if (ObjDesc->Buffer.Length)
{
+ if (ObjDesc->Buffer.Length > 16)
+ {
+ AcpiOsPrintf ("\n");
+ }
AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
}
Modified: head/sys/contrib/dev/acpica/disassembler/dmwalk.c
==============================================================================
--- head/sys/contrib/dev/acpica/disassembler/dmwalk.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/disassembler/dmwalk.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -160,7 +160,6 @@ AcpiDmBlockType (
ACPI_PARSE_OBJECT *Op);
-
/*******************************************************************************
*
* FUNCTION: AcpiDmDisassemble
Modified: head/sys/contrib/dev/acpica/dispatcher/dsmethod.c
==============================================================================
--- head/sys/contrib/dev/acpica/dispatcher/dsmethod.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/dispatcher/dsmethod.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -519,7 +519,7 @@ AcpiDsCallControlMethod (
if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY)
{
- Status = ObjDesc->Method.Implementation (NextWalkState);
+ Status = ObjDesc->Method.Extra.Implementation (NextWalkState);
if (Status == AE_OK)
{
Status = AE_CTRL_TERMINATE;
Modified: head/sys/contrib/dev/acpica/dispatcher/dswload.c
==============================================================================
--- head/sys/contrib/dev/acpica/dispatcher/dswload.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/dispatcher/dswload.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -296,18 +296,19 @@ AcpiDsLoad1BeginOp (
case ACPI_TYPE_BUFFER:
/*
- * These types we will allow, but we will change the type. This
- * enables some existing code of the form:
+ * These types we will allow, but we will change the type.
+ * This enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
*
- * Note: silently change the type here. On the second pass, we will report
- * a warning
+ * Note: silently change the type here. On the second pass,
+ * we will report a warning
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
- Path, AcpiUtGetTypeName (Node->Type)));
+ "Type override - [%4.4s] had invalid type (%s) "
+ "for Scope operator, changed to type ANY\n",
+ AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
Node->Type = ACPI_TYPE_ANY;
WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
@@ -318,8 +319,9 @@ AcpiDsLoad1BeginOp (
/* All other types are an error */
ACPI_ERROR ((AE_INFO,
- "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)",
- AcpiUtGetTypeName (Node->Type), Path));
+ "Invalid type (%s) for target of "
+ "Scope operator [%4.4s] (Cannot override)",
+ AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -794,15 +796,16 @@ AcpiDsLoad2BeginOp (
case ACPI_TYPE_BUFFER:
/*
- * These types we will allow, but we will change the type. This
- * enables some existing code of the form:
+ * These types we will allow, but we will change the type.
+ * This enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
*/
ACPI_WARNING ((AE_INFO,
- "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)",
- BufferPtr, AcpiUtGetTypeName (Node->Type)));
+ "Type override - [%4.4s] had invalid type (%s) "
+ "for Scope operator, changed to type ANY\n",
+ AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
Node->Type = ACPI_TYPE_ANY;
WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
@@ -813,8 +816,9 @@ AcpiDsLoad2BeginOp (
/* All other types are an error */
ACPI_ERROR ((AE_INFO,
- "Invalid type (%s) for target of Scope operator [%4.4s]",
- AcpiUtGetTypeName (Node->Type), BufferPtr));
+ "Invalid type (%s) for target of "
+ "Scope operator [%4.4s] (Cannot override)",
+ AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
return (AE_AML_OPERAND_TYPE);
}
@@ -1154,33 +1158,40 @@ AcpiDsLoad2EndOp (
}
/*
- * If we are executing a method, initialize the region
+ * The OpRegion is not fully parsed at this time. The only valid
+ * argument is the SpaceId. (We must save the address of the
+ * AML of the address and length operands)
+ *
+ * If we have a valid region, initialize it. The namespace is
+ * unlocked at this point.
+ *
+ * Need to unlock interpreter if it is locked (if we are running
+ * a control method), in order to allow _REG methods to be run
+ * during AcpiEvInitializeRegion.
*/
if (WalkState->MethodNode)
{
+ /*
+ * Executing a method: initialize the region and unlock
+ * the interpreter
+ */
Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
RegionSpace, WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
}
- }
- /*
- * The OpRegion is not fully parsed at this time. Only valid
- * argument is the SpaceId. (We must save the address of the
- * AML of the address and length operands)
- */
+ AcpiExExitInterpreter ();
+ }
- /*
- * If we have a valid region, initialize it
- * Namespace is NOT locked at this point.
- *
- * TBD: need to unlock interpreter if it is locked, in order
- * to allow _REG methods to be run.
- */
Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node),
FALSE);
+ if (WalkState->MethodNode)
+ {
+ AcpiExEnterInterpreter ();
+ }
+
if (ACPI_FAILURE (Status))
{
/*
Modified: head/sys/contrib/dev/acpica/events/evregion.c
==============================================================================
--- head/sys/contrib/dev/acpica/events/evregion.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/events/evregion.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -845,7 +845,7 @@ AcpiEvInstallHandler (
/* Convert and validate the device handle */
- Node = AcpiNsMapHandleToNode (ObjHandle);
+ Node = AcpiNsValidateHandle (ObjHandle);
if (!Node)
{
return (AE_BAD_PARAMETER);
@@ -1243,7 +1243,7 @@ AcpiEvRegRun (
/* Convert and validate the device handle */
- Node = AcpiNsMapHandleToNode (ObjHandle);
+ Node = AcpiNsValidateHandle (ObjHandle);
if (!Node)
{
return (AE_BAD_PARAMETER);
Modified: head/sys/contrib/dev/acpica/events/evrgnini.c
==============================================================================
--- head/sys/contrib/dev/acpica/events/evrgnini.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/events/evrgnini.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -716,6 +716,20 @@ AcpiEvInitializeRegion (
HandlerObj = ObjDesc->ThermalZone.Handler;
break;
+ case ACPI_TYPE_METHOD:
+ /*
+ * If we are executing module level code, the original
+ * Node's object was replaced by this Method object and we
+ * saved the handler in the method object.
+ *
+ * See AcpiNsExecModuleCode
+ */
+ if (ObjDesc->Method.Flags & AOPOBJ_MODULE_LEVEL)
+ {
+ HandlerObj = ObjDesc->Method.Extra.Handler;
+ }
+ break;
+
default:
/* Ignore other objects */
break;
Modified: head/sys/contrib/dev/acpica/events/evxface.c
==============================================================================
--- head/sys/contrib/dev/acpica/events/evxface.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/events/evxface.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -368,7 +368,7 @@ AcpiInstallNotifyHandler (
/* Convert and validate the device handle */
- Node = AcpiNsMapHandleToNode (Device);
+ Node = AcpiNsValidateHandle (Device);
if (!Node)
{
Status = AE_BAD_PARAMETER;
@@ -555,7 +555,7 @@ AcpiRemoveNotifyHandler (
/* Convert and validate the device handle */
- Node = AcpiNsMapHandleToNode (Device);
+ Node = AcpiNsValidateHandle (Device);
if (!Node)
{
Status = AE_BAD_PARAMETER;
Modified: head/sys/contrib/dev/acpica/events/evxfevnt.c
==============================================================================
--- head/sys/contrib/dev/acpica/events/evxfevnt.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/events/evxfevnt.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -805,7 +805,7 @@ AcpiInstallGpeBlock (
return (Status);
}
- Node = AcpiNsMapHandleToNode (GpeDevice);
+ Node = AcpiNsValidateHandle (GpeDevice);
if (!Node)
{
Status = AE_BAD_PARAMETER;
@@ -905,7 +905,7 @@ AcpiRemoveGpeBlock (
return (Status);
}
- Node = AcpiNsMapHandleToNode (GpeDevice);
+ Node = AcpiNsValidateHandle (GpeDevice);
if (!Node)
{
Status = AE_BAD_PARAMETER;
Modified: head/sys/contrib/dev/acpica/events/evxfregn.c
==============================================================================
--- head/sys/contrib/dev/acpica/events/evxfregn.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/events/evxfregn.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -171,7 +171,7 @@ AcpiInstallAddressSpaceHandler (
/* Convert and validate the device handle */
- Node = AcpiNsMapHandleToNode (Device);
+ Node = AcpiNsValidateHandle (Device);
if (!Node)
{
Status = AE_BAD_PARAMETER;
@@ -244,7 +244,7 @@ AcpiRemoveAddressSpaceHandler (
/* Convert and validate the device handle */
- Node = AcpiNsMapHandleToNode (Device);
+ Node = AcpiNsValidateHandle (Device);
if (!Node ||
((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_PROCESSOR) &&
Modified: head/sys/contrib/dev/acpica/executer/exmutex.c
==============================================================================
--- head/sys/contrib/dev/acpica/executer/exmutex.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/executer/exmutex.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -490,6 +490,15 @@ AcpiExReleaseMutex (
return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
}
+ /* Must have a valid thread ID */
+
+ if (!WalkState->Thread)
+ {
+ ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
/*
* The Mutex is owned, but this thread must be the owner.
* Special case for Global Lock, any thread can release
@@ -505,15 +514,6 @@ AcpiExReleaseMutex (
return_ACPI_STATUS (AE_AML_NOT_OWNER);
}
- /* Must have a valid thread ID */
-
- if (!WalkState->Thread)
- {
- ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
/*
* The sync level of the mutex must be equal to the current sync level. In
* other words, the current level means that at least one mutex at that
Modified: head/sys/contrib/dev/acpica/include/acnamesp.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acnamesp.h Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/include/acnamesp.h Mon Dec 14 22:24:04 2009 (r200553)
@@ -456,6 +456,11 @@ AcpiNsComplexRepairs (
ACPI_STATUS ValidateStatus,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
+void
+AcpiNsRemoveNullElements (
+ ACPI_PREDEFINED_DATA *Data,
+ UINT8 PackageType,
+ ACPI_OPERAND_OBJECT *ObjDesc);
/*
* nssearch - Namespace searching and entry
@@ -542,13 +547,9 @@ AcpiNsExternalizeName (
char **ConvertedName);
ACPI_NAMESPACE_NODE *
-AcpiNsMapHandleToNode (
+AcpiNsValidateHandle (
ACPI_HANDLE Handle);
-ACPI_HANDLE
-AcpiNsConvertEntryToHandle(
- ACPI_NAMESPACE_NODE *Node);
-
void
AcpiNsTerminate (
void);
Modified: head/sys/contrib/dev/acpica/include/acobject.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acobject.h Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/include/acobject.h Mon Dec 14 22:24:04 2009 (r200553)
@@ -288,7 +288,12 @@ typedef struct acpi_object_method
UINT8 SyncLevel;
union acpi_operand_object *Mutex;
UINT8 *AmlStart;
- ACPI_INTERNAL_METHOD Implementation;
+ union
+ {
+ ACPI_INTERNAL_METHOD Implementation;
+ union acpi_operand_object *Handler;
+ } Extra;
+
UINT32 AmlLength;
UINT8 ThreadCount;
ACPI_OWNER_ID OwnerId;
Modified: head/sys/contrib/dev/acpica/include/acoutput.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acoutput.h Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/include/acoutput.h Mon Dec 14 22:24:04 2009 (r200553)
@@ -158,7 +158,8 @@
#define ACPI_LV_INIT 0x00000001
#define ACPI_LV_DEBUG_OBJECT 0x00000002
#define ACPI_LV_INFO 0x00000004
-#define ACPI_LV_ALL_EXCEPTIONS 0x00000007
+#define ACPI_LV_REPAIR 0x00000008
+#define ACPI_LV_ALL_EXCEPTIONS 0x0000000F
/* Trace verbosity level 1 [Standard Trace Level] */
@@ -217,6 +218,7 @@
#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
+#define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR)
#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
/* Trace level -- also used in the global "DebugLevel" */
@@ -248,8 +250,8 @@
/* Defaults for DebugLevel, debug and normal */
-#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
-#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
+#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR)
+#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR)
#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
Modified: head/sys/contrib/dev/acpica/include/acpixf.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acpixf.h Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/include/acpixf.h Mon Dec 14 22:24:04 2009 (r200553)
@@ -120,7 +120,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20091112
+#define ACPI_CA_VERSION 0x20091214
#include <contrib/dev/acpica/include/actypes.h>
#include <contrib/dev/acpica/include/actbl.h>
Modified: head/sys/contrib/dev/acpica/namespace/nsaccess.c
==============================================================================
--- head/sys/contrib/dev/acpica/namespace/nsaccess.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/namespace/nsaccess.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -251,7 +251,7 @@ AcpiNsRootInitialize (
/* Mark this as a very SPECIAL method */
ObjDesc->Method.MethodFlags = AML_METHOD_INTERNAL_ONLY;
- ObjDesc->Method.Implementation = AcpiUtOsiImplementation;
+ ObjDesc->Method.Extra.Implementation = AcpiUtOsiImplementation;
#endif
break;
Modified: head/sys/contrib/dev/acpica/namespace/nsdump.c
==============================================================================
--- head/sys/contrib/dev/acpica/namespace/nsdump.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/namespace/nsdump.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -286,7 +286,7 @@ AcpiNsDumpOneObject (
return (AE_OK);
}
- ThisNode = AcpiNsMapHandleToNode (ObjHandle);
+ ThisNode = AcpiNsValidateHandle (ObjHandle);
if (!ThisNode)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
Modified: head/sys/contrib/dev/acpica/namespace/nseval.c
==============================================================================
--- head/sys/contrib/dev/acpica/namespace/nseval.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/namespace/nseval.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -477,6 +477,19 @@ AcpiNsExecModuleCode (
MethodObj->Method.NextObject);
Type = AcpiNsGetType (ParentNode);
+ /*
+ * Get the region handler and save it in the method object. We may need
+ * this if an operation region declaration causes a _REG method to be run.
+ *
+ * We can't do this in AcpiPsLinkModuleCode because
+ * AcpiGbl_RootNode->Object is NULL at PASS1.
+ */
+ if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object)
+ {
+ MethodObj->Method.Extra.Handler =
+ ParentNode->Object->Device.Handler;
+ }
+
/* Must clear NextObject (AcpiNsAttachObject needs the field) */
MethodObj->Method.NextObject = NULL;
@@ -513,6 +526,13 @@ AcpiNsExecModuleCode (
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Executed module-level code at %p\n",
MethodObj->Method.AmlStart));
+ /* Delete a possible implicit return value (in slack mode) */
+
+ if (Info->ReturnObject)
+ {
+ AcpiUtRemoveReference (Info->ReturnObject);
+ }
+
/* Detach the temporary method object */
AcpiNsDetachObject (ParentNode);
Modified: head/sys/contrib/dev/acpica/namespace/nsnames.c
==============================================================================
--- head/sys/contrib/dev/acpica/namespace/nsnames.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/namespace/nsnames.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -337,7 +337,7 @@ AcpiNsHandleToPathname (
ACPI_FUNCTION_TRACE_PTR (NsHandleToPathname, TargetHandle);
- Node = AcpiNsMapHandleToNode (TargetHandle);
+ Node = AcpiNsValidateHandle (TargetHandle);
if (!Node)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
Modified: head/sys/contrib/dev/acpica/namespace/nspredef.c
==============================================================================
--- head/sys/contrib/dev/acpica/namespace/nspredef.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/namespace/nspredef.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -313,31 +313,40 @@ AcpiNsCheckPredefinedNames (
Data->Pathname = Pathname;
/*
- * Check that the type of the return object is what is expected for
- * this predefined name
+ * Check that the type of the main return object is what is expected
+ * for this predefined name
*/
Status = AcpiNsCheckObjectType (Data, ReturnObjectPtr,
Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT);
if (ACPI_FAILURE (Status))
{
- goto CheckValidationStatus;
+ goto Exit;
}
- /* For returned Package objects, check the type of all sub-objects */
-
- if (ReturnObject->Common.Type == ACPI_TYPE_PACKAGE)
+ /*
+ * For returned Package objects, check the type of all sub-objects.
+ * Note: Package may have been newly created by call above.
+ */
+ if ((*ReturnObjectPtr)->Common.Type == ACPI_TYPE_PACKAGE)
{
Status = AcpiNsCheckPackage (Data, ReturnObjectPtr);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Exit;
+ }
}
/*
- * Perform additional, more complicated repairs on a per-name
- * basis.
+ * The return object was OK, or it was successfully repaired above.
+ * Now make some additional checks such as verifying that package
+ * objects are sorted correctly (if required) or buffer objects have
+ * the correct data width (bytes vs. dwords). These repairs are
+ * performed on a per-name basis, i.e., the code is specific to
+ * particular predefined names.
*/
Status = AcpiNsComplexRepairs (Data, Node, Status, ReturnObjectPtr);
-
-CheckValidationStatus:
+Exit:
/*
* If the object validation failed or if we successfully repaired one
* or more objects, mark the parent node to suppress further warning
@@ -349,7 +358,6 @@ CheckValidationStatus:
}
ACPI_FREE (Data);
-
Cleanup:
ACPI_FREE (Pathname);
return (Status);
@@ -544,6 +552,12 @@ AcpiNsCheckPackage (
"%s Validating return Package of Type %X, Count %X\n",
Data->Pathname, Package->RetInfo.Type, ReturnObject->Package.Count));
+ /*
+ * For variable-length Packages, we can safely remove all embedded
+ * and trailing NULL package elements
+ */
+ AcpiNsRemoveNullElements (Data, Package->RetInfo.Type, ReturnObject);
+
/* Extract package count and elements array */
Elements = ReturnObject->Package.Elements;
@@ -582,9 +596,10 @@ AcpiNsCheckPackage (
}
else if (Count > ExpectedCount)
{
- ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
- "Return Package is larger than needed - "
- "found %u, expected %u", Count, ExpectedCount));
+ ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
+ "%s: Return Package is larger than needed - "
+ "found %u, expected %u\n",
+ Data->Pathname, Count, ExpectedCount));
}
/* Validate all elements of the returned package */
@@ -800,56 +815,20 @@ AcpiNsCheckPackageList (
ACPI_OPERAND_OBJECT *SubPackage;
ACPI_OPERAND_OBJECT **SubElements;
ACPI_STATUS Status;
- BOOLEAN NonTrailingNull = FALSE;
UINT32 ExpectedCount;
UINT32 i;
UINT32 j;
- /* Validate each sub-Package in the parent Package */
-
+ /*
+ * Validate each sub-Package in the parent Package
+ *
+ * NOTE: assumes list of sub-packages contains no NULL elements.
+ * Any NULL elements should have been removed by earlier call
+ * to AcpiNsRemoveNullElements.
+ */
for (i = 0; i < Count; i++)
{
- /*
- * Handling for NULL package elements. For now, we will simply allow
- * a parent package with trailing NULL elements. This can happen if
- * the package was defined to be longer than the initializer list.
- * This is legal as per the ACPI specification. It is often used
- * to allow for dynamic initialization of a Package.
- *
- * A future enhancement may be to simply truncate the package to
- * remove the trailing NULL elements.
- */
- if (!(*Elements))
- {
- if (!NonTrailingNull)
- {
- /* Ensure the remaining elements are all NULL */
-
- for (j = 1; j < (Count - i + 1); j++)
- {
- if (Elements[j])
- {
- NonTrailingNull = TRUE;
- }
- }
-
- if (!NonTrailingNull)
- {
- /* Ignore the trailing NULL elements */
-
- return (AE_OK);
- }
- }
-
- /* There are trailing non-null elements, issue warning */
-
- ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
- "Found NULL element at package index %u", i));
- Elements++;
- continue;
- }
-
SubPackage = *Elements;
SubElements = SubPackage->Package.Elements;
Modified: head/sys/contrib/dev/acpica/namespace/nsrepair.c
==============================================================================
--- head/sys/contrib/dev/acpica/namespace/nsrepair.c Mon Dec 14 22:23:06 2009 (r200552)
+++ head/sys/contrib/dev/acpica/namespace/nsrepair.c Mon Dec 14 22:24:04 2009 (r200553)
@@ -119,7 +119,6 @@
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/acinterp.h>
-#include <contrib/dev/acpica/include/acpredef.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsrepair")
@@ -127,6 +126,54 @@
/*******************************************************************************
*
+ * This module attempts to repair or convert objects returned by the
+ * predefined methods to an object type that is expected, as per the ACPI
+ * specification. The need for this code is dictated by the many machines that
+ * return incorrect types for the standard predefined methods. Performing these
+ * conversions here, in one place, eliminates the need for individual ACPI
+ * device drivers to do the same. Note: Most of these conversions are different
+ * than the internal object conversion routines used for implicit object
+ * conversion.
+ *
+ * The following conversions can be performed as necessary:
+ *
+ * Integer -> String
+ * Integer -> Buffer
+ * String -> Integer
+ * String -> Buffer
+ * Buffer -> Integer
+ * Buffer -> String
+ * Buffer -> Package of Integers
+ * Package -> Package of one Package
+ *
+ ******************************************************************************/
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiNsConvertToInteger (
+ ACPI_OPERAND_OBJECT *OriginalObject,
+ ACPI_OPERAND_OBJECT **ReturnObject);
+
+static ACPI_STATUS
+AcpiNsConvertToString (
+ ACPI_OPERAND_OBJECT *OriginalObject,
+ ACPI_OPERAND_OBJECT **ReturnObject);
+
+static ACPI_STATUS
+AcpiNsConvertToBuffer (
+ ACPI_OPERAND_OBJECT *OriginalObject,
+ ACPI_OPERAND_OBJECT **ReturnObject);
+
+static ACPI_STATUS
+AcpiNsConvertToPackage (
+ ACPI_OPERAND_OBJECT *OriginalObject,
+ ACPI_OPERAND_OBJECT **ReturnObject);
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiNsRepairObject
*
* PARAMETERS: Data - Pointer to validation data structure
@@ -153,35 +200,230 @@ AcpiNsRepairObject (
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
ACPI_OPERAND_OBJECT *NewObject;
- ACPI_SIZE Length;
ACPI_STATUS Status;
+ ACPI_FUNCTION_NAME (NsRepairObject);
+
+
/*
* At this point, we know that the type of the returned object was not
* one of the expected types for this predefined name. Attempt to
- * repair the object. Only a limited number of repairs are possible.
+ * repair the object by converting it to one of the expected object
+ * types for this predefined name.
*/
- switch (ReturnObject->Common.Type)
+ if (ExpectedBtypes & ACPI_RTYPE_INTEGER)
+ {
+ Status = AcpiNsConvertToInteger (ReturnObject, &NewObject);
+ if (ACPI_SUCCESS (Status))
+ {
+ goto ObjectRepaired;
+ }
+ }
+ if (ExpectedBtypes & ACPI_RTYPE_STRING)
+ {
+ Status = AcpiNsConvertToString (ReturnObject, &NewObject);
+ if (ACPI_SUCCESS (Status))
+ {
+ goto ObjectRepaired;
+ }
+ }
+ if (ExpectedBtypes & ACPI_RTYPE_BUFFER)
+ {
+ Status = AcpiNsConvertToBuffer (ReturnObject, &NewObject);
+ if (ACPI_SUCCESS (Status))
+ {
+ goto ObjectRepaired;
+ }
+ }
+ if (ExpectedBtypes & ACPI_RTYPE_PACKAGE)
+ {
+ Status = AcpiNsConvertToPackage (ReturnObject, &NewObject);
+ if (ACPI_SUCCESS (Status))
+ {
+ goto ObjectRepaired;
+ }
+ }
+
+ /* We cannot repair this object */
+
+ return (AE_AML_OPERAND_TYPE);
+
+
+ObjectRepaired:
+
+ /* Object was successfully repaired */
+
+ /*
+ * If the original object is a package element, we need to:
+ * 1. Set the reference count of the new object to match the
+ * reference count of the old object.
+ * 2. Decrement the reference count of the original object.
+ */
+ if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
+ {
+ NewObject->Common.ReferenceCount =
+ ReturnObject->Common.ReferenceCount;
+
+ if (ReturnObject->Common.ReferenceCount > 1)
+ {
+ ReturnObject->Common.ReferenceCount--;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
+ "%s: Converted %s to expected %s at index %u\n",
+ Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject),
+ AcpiUtGetObjectTypeName (NewObject), PackageIndex));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
+ "%s: Converted %s to expected %s\n",
+ Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject),
+ AcpiUtGetObjectTypeName (NewObject)));
+ }
+
+ /* Delete old object, install the new return object */
+
+ AcpiUtRemoveReference (ReturnObject);
+ *ReturnObjectPtr = NewObject;
+ Data->Flags |= ACPI_OBJECT_REPAIRED;
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsConvertToInteger
+ *
+ * PARAMETERS: OriginalObject - Object to be converted
+ * ReturnObject - Where the new converted object is returned
+ *
+ * RETURN: Status. AE_OK if conversion was successful.
+ *
+ * DESCRIPTION: Attempt to convert a String/Buffer object to an Integer.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsConvertToInteger (
+ ACPI_OPERAND_OBJECT *OriginalObject,
+ ACPI_OPERAND_OBJECT **ReturnObject)
+{
+ ACPI_OPERAND_OBJECT *NewObject;
+ ACPI_STATUS Status;
+ UINT64 Value = 0;
+ UINT32 i;
+
+
+ switch (OriginalObject->Common.Type)
{
+ case ACPI_TYPE_STRING:
+
+ /* String-to-Integer conversion */
+
+ Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer,
+ ACPI_ANY_BASE, &Value);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ break;
+
case ACPI_TYPE_BUFFER:
- /* Does the method/object legally return a string? */
+ /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */
- if (!(ExpectedBtypes & ACPI_RTYPE_STRING))
+ if (OriginalObject->Buffer.Length > 8)
{
return (AE_AML_OPERAND_TYPE);
}
+ /* Extract each buffer byte to create the integer */
+
+ for (i = 0; i < OriginalObject->Buffer.Length; i++)
+ {
+ Value |= ((UINT64) OriginalObject->Buffer.Pointer[i] << (i * 8));
+ }
+ break;
+
+ default:
+ return (AE_AML_OPERAND_TYPE);
+ }
+
+ NewObject = AcpiUtCreateIntegerObject (Value);
+ if (!NewObject)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ *ReturnObject = NewObject;
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsConvertToString
+ *
+ * PARAMETERS: OriginalObject - Object to be converted
+ * ReturnObject - Where the new converted object is returned
+ *
+ * RETURN: Status. AE_OK if conversion was successful.
+ *
+ * DESCRIPTION: Attempt to convert a Integer/Buffer object to a String.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsConvertToString (
+ ACPI_OPERAND_OBJECT *OriginalObject,
+ ACPI_OPERAND_OBJECT **ReturnObject)
+{
+ ACPI_OPERAND_OBJECT *NewObject;
+ ACPI_SIZE Length;
+ ACPI_STATUS Status;
+
+
+ switch (OriginalObject->Common.Type)
+ {
+ case ACPI_TYPE_INTEGER:
/*
- * Have a Buffer, expected a String, convert. Use a ToString
+ * Integer-to-String conversion. Commonly, convert
+ * an integer of value 0 to a NULL string. The last element of
+ * _BIF and _BIX packages occasionally need this fix.
+ */
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list