summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2003-07-13 22:44:13 +0000
committernjl <njl@FreeBSD.org>2003-07-13 22:44:13 +0000
commit148a8cc4ac210f6d3692eb478d20cc64818d274a (patch)
treedd1a453ab93efa28848b21047ec45d003c6f262e /sys/contrib/dev
parent857b9ae7f340e84e806f355c2a19d9cac1ab3faf (diff)
downloadFreeBSD-src-148a8cc4ac210f6d3692eb478d20cc64818d274a.zip
FreeBSD-src-148a8cc4ac210f6d3692eb478d20cc64818d274a.tar.gz
ACPICA import from the 0619 dist.
Diffstat (limited to 'sys/contrib/dev')
-rw-r--r--sys/contrib/dev/acpica/CHANGES.txt266
-rw-r--r--sys/contrib/dev/acpica/acconfig.h55
-rw-r--r--sys/contrib/dev/acpica/acdebug.h19
-rw-r--r--sys/contrib/dev/acpica/acdisasm.h30
-rw-r--r--sys/contrib/dev/acpica/acevents.h35
-rw-r--r--sys/contrib/dev/acpica/acexcep.h8
-rw-r--r--sys/contrib/dev/acpica/acfreebsd.h9
-rw-r--r--sys/contrib/dev/acpica/acglobal.h23
-rw-r--r--sys/contrib/dev/acpica/achware.h22
-rw-r--r--sys/contrib/dev/acpica/acinterp.h8
-rw-r--r--sys/contrib/dev/acpica/aclocal.h120
-rw-r--r--sys/contrib/dev/acpica/acmacros.h243
-rw-r--r--sys/contrib/dev/acpica/acnamesp.h7
-rw-r--r--sys/contrib/dev/acpica/acobject.h15
-rw-r--r--sys/contrib/dev/acpica/acpi.h2
-rw-r--r--sys/contrib/dev/acpica/acpiosxf.h43
-rw-r--r--sys/contrib/dev/acpica/acpixf.h55
-rw-r--r--sys/contrib/dev/acpica/actables.h12
-rw-r--r--sys/contrib/dev/acpica/actbl.h11
-rw-r--r--sys/contrib/dev/acpica/actypes.h102
-rw-r--r--sys/contrib/dev/acpica/acutils.h4
-rw-r--r--sys/contrib/dev/acpica/dbcmds.c66
-rw-r--r--sys/contrib/dev/acpica/dbdisply.c403
-rw-r--r--sys/contrib/dev/acpica/dbexec.c35
-rw-r--r--sys/contrib/dev/acpica/dbfileio.c105
-rw-r--r--sys/contrib/dev/acpica/dbinput.c8
-rw-r--r--sys/contrib/dev/acpica/dbstats.c34
-rw-r--r--sys/contrib/dev/acpica/dbutils.c19
-rw-r--r--sys/contrib/dev/acpica/dmbuffer.c14
-rw-r--r--sys/contrib/dev/acpica/dmobject.c580
-rw-r--r--sys/contrib/dev/acpica/dmopcode.c38
-rw-r--r--sys/contrib/dev/acpica/dmresrc.c4
-rw-r--r--sys/contrib/dev/acpica/dmwalk.c17
-rw-r--r--sys/contrib/dev/acpica/dsfield.c14
-rw-r--r--sys/contrib/dev/acpica/dsinit.c6
-rw-r--r--sys/contrib/dev/acpica/dsmethod.c2
-rw-r--r--sys/contrib/dev/acpica/dsmthdat.c40
-rw-r--r--sys/contrib/dev/acpica/dsobject.c7
-rw-r--r--sys/contrib/dev/acpica/dsopcode.c8
-rw-r--r--sys/contrib/dev/acpica/dswexec.c16
-rw-r--r--sys/contrib/dev/acpica/evevent.c12
-rw-r--r--sys/contrib/dev/acpica/evgpe.c179
-rw-r--r--sys/contrib/dev/acpica/evgpeblk.c535
-rw-r--r--sys/contrib/dev/acpica/evmisc.c80
-rw-r--r--sys/contrib/dev/acpica/evregion.c359
-rw-r--r--sys/contrib/dev/acpica/evrgnini.c179
-rw-r--r--sys/contrib/dev/acpica/evsci.c60
-rw-r--r--sys/contrib/dev/acpica/evxface.c127
-rw-r--r--sys/contrib/dev/acpica/evxfevnt.c619
-rw-r--r--sys/contrib/dev/acpica/evxfregn.c175
-rw-r--r--sys/contrib/dev/acpica/exconfig.c10
-rw-r--r--sys/contrib/dev/acpica/exdump.c40
-rw-r--r--sys/contrib/dev/acpica/exfldio.c57
-rw-r--r--sys/contrib/dev/acpica/exoparg1.c85
-rw-r--r--sys/contrib/dev/acpica/exregion.c13
-rw-r--r--sys/contrib/dev/acpica/exstore.c6
-rw-r--r--sys/contrib/dev/acpica/exsystem.c6
-rw-r--r--sys/contrib/dev/acpica/exutils.c8
-rw-r--r--sys/contrib/dev/acpica/hwacpi.c6
-rw-r--r--sys/contrib/dev/acpica/hwgpe.c301
-rw-r--r--sys/contrib/dev/acpica/hwregs.c196
-rw-r--r--sys/contrib/dev/acpica/hwsleep.c18
-rw-r--r--sys/contrib/dev/acpica/hwtimer.c4
-rw-r--r--sys/contrib/dev/acpica/nsaccess.c9
-rw-r--r--sys/contrib/dev/acpica/nsalloc.c4
-rw-r--r--sys/contrib/dev/acpica/nsdumpdv.c16
-rw-r--r--sys/contrib/dev/acpica/nsload.c20
-rw-r--r--sys/contrib/dev/acpica/nsnames.c4
-rw-r--r--sys/contrib/dev/acpica/nsparse.c5
-rw-r--r--sys/contrib/dev/acpica/nssearch.c13
-rw-r--r--sys/contrib/dev/acpica/nsutils.c71
-rw-r--r--sys/contrib/dev/acpica/nswalk.c15
-rw-r--r--sys/contrib/dev/acpica/nsxfeval.c40
-rw-r--r--sys/contrib/dev/acpica/nsxfname.c150
-rw-r--r--sys/contrib/dev/acpica/psargs.c19
-rw-r--r--sys/contrib/dev/acpica/pswalk.c4
-rw-r--r--sys/contrib/dev/acpica/psxface.c4
-rw-r--r--sys/contrib/dev/acpica/rsaddr.c106
-rw-r--r--sys/contrib/dev/acpica/rscalc.c14
-rw-r--r--sys/contrib/dev/acpica/rsio.c14
-rw-r--r--sys/contrib/dev/acpica/rsirq.c14
-rw-r--r--sys/contrib/dev/acpica/rsmemory.c58
-rw-r--r--sys/contrib/dev/acpica/rsmisc.c6
-rw-r--r--sys/contrib/dev/acpica/rsxface.c47
-rw-r--r--sys/contrib/dev/acpica/tbconvrt.c126
-rw-r--r--sys/contrib/dev/acpica/tbget.c17
-rw-r--r--sys/contrib/dev/acpica/tbgetall.c6
-rw-r--r--sys/contrib/dev/acpica/tbinstal.c209
-rw-r--r--sys/contrib/dev/acpica/tbutils.c21
-rw-r--r--sys/contrib/dev/acpica/tbxface.c22
-rw-r--r--sys/contrib/dev/acpica/utcopy.c23
-rw-r--r--sys/contrib/dev/acpica/utdebug.c14
-rw-r--r--sys/contrib/dev/acpica/utdelete.c87
-rw-r--r--sys/contrib/dev/acpica/uteval.c192
-rw-r--r--sys/contrib/dev/acpica/utglobal.c42
-rw-r--r--sys/contrib/dev/acpica/utinit.c30
-rw-r--r--sys/contrib/dev/acpica/utmisc.c62
-rw-r--r--sys/contrib/dev/acpica/utobject.c23
-rw-r--r--sys/contrib/dev/acpica/utxface.c70
99 files changed, 4595 insertions, 2562 deletions
diff --git a/sys/contrib/dev/acpica/CHANGES.txt b/sys/contrib/dev/acpica/CHANGES.txt
index 999f103..816c8ba 100644
--- a/sys/contrib/dev/acpica/CHANGES.txt
+++ b/sys/contrib/dev/acpica/CHANGES.txt
@@ -1,3 +1,268 @@
+----------------------------------------
+19 June 2003. Summary of changes for version 20030619:
+
+1) ACPI CA Core Subsystem:
+
+Fix To/FromBCD, eliminating the need for an arch-specific
+#define.
+
+Do not acquire a semaphore in the S5 shutdown path.
+
+Fix ex_digits_needed for 0. (Takayoshi Kochi)
+
+Fix sleep/stall code reversal. (Andi Kleen)
+
+Revert a change having to do with control method calling
+semantics.
+
+2) Linux:
+
+acpiphp update (Takayoshi Kochi)
+
+Export acpi_disabled for sonypi (Stelian Pop)
+
+Mention acpismp=force in config help
+
+Re-add acpitable.c and acpismp=force. This improves backwards
+compatibility and also cleans up the code to a significant
+degree.
+
+Add ASUS Value-add driver (Karol Kozimor and Julien Lerouge)
+
+
+
+----------------------------------------
+22 May 2003. Summary of changes for version 20030522:
+
+1) ACPI CA Core Subsystem:
+
+Found and fixed a reported problem where an AE_NOT_FOUND error
+occurred occasionally during _BST evaluation. This turned out to
+be an Owner ID allocation issue where a called method did not get
+a new ID assigned to it. Eventually, (after 64k calls), the
+Owner ID UINT16 would wraparound so that the ID would be the same
+as the caller's and the called method would delete the caller's
+namespace.
+
+Implemented extended error reporting for control methods that are
+aborted due to a run-time exception. Output includes the exact
+AML instruction that caused the method abort, a dump of the
+method locals and arguments at the time of the abort, and a trace
+of all nested control method calls.
+
+Modified the interpreter to allow the creation of buffers of zero
+length from the AML code. Implemented new code to ensure that no
+attempt is made to actually allocate a memory buffer (of length
+zero) - instead, a simple buffer object with a NULL buffer
+pointer and length zero is created. A warning is no longer
+issued when the AML attempts to create a zero-length buffer.
+
+Implemented a workaround for the "leading asterisk issue" in
+_HIDs, _UIDs, and _CIDs in the AML interpreter. One leading
+asterisk is automatically removed if present in any HID, UID, or
+CID strings. The iASL compiler will still flag this asterisk as
+an error, however.
+
+Implemented full support for _CID methods that return a package
+of multiple CIDs (Compatible IDs). The AcpiGetObjectInfo()
+interface now additionally returns a device _CID list if present.
+This required a change to the external interface in order to pass
+an ACPI_BUFFER object as a parameter since the _CID list is of
+variable length.
+
+Fixed a problem with the new AE_SAME_HANDLER exception where
+handler initialization code did not know about this exception.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release (20030509):
+ Non-Debug Version: 73.4K Code, 9.7K Data, 83.1K Total
+ Debug Version: 156.1K Code, 63.9K Data, 220.0K Total
+ Current Release:
+ Non-Debug Version: 73.7K Code, 9.7K Data, 83.4K Total
+ Debug Version: 156.9K Code, 64.2K Data, 221.1K Total
+
+
+2) Linux:
+
+Fixed a bug in which we would reinitialize the ACPI interrupt
+after it was already working, thus disabling all ACPI and the
+IRQs for any other device sharing the interrupt. (Thanks to Stian
+Jordet)
+
+Toshiba driver update (John Belmonte)
+
+Return only 0 or 1 for our interrupt handler status (Andrew
+Morton)
+
+
+3) iASL Compiler:
+
+Fixed a reported problem where multiple (nested) ElseIf()
+statements were not handled correctly by the compiler, resulting
+in incorrect warnings and incorrect AML code. This was a problem
+in both the ASL parser and the code generator.
+
+
+4) Documentation:
+
+Added changes to existing interfaces, new exception codes, and
+new text concerning reference count object management versus
+garbage collection.
+
+----------------------------------------
+09 May 2003. Summary of changes for version 20030509.
+
+
+1) ACPI CA Core Subsystem:
+
+Changed the subsystem initialization sequence to hold off
+installation of address space handlers until the hardware has
+been initialized and the system has entered ACPI mode. This is
+because the installation of space handlers can cause _REG methods
+to be run. Previously, the _REG methods could potentially be run
+before ACPI mode was enabled.
+
+Fixed some memory leak issues related to address space handler
+and notify handler installation. There were some problems with
+the reference count mechanism caused by the fact that the handler
+objects are shared across several namespace objects.
+
+Fixed a reported problem where reference counts within the
+namespace were not properly updated when named objects created by
+method execution were deleted.
+
+Fixed a reported problem where multiple SSDTs caused a deletion
+issue during subsystem termination. Restructured the table data
+structures to simplify the linked lists and the related code.
+
+Fixed a problem where the table ID associated with secondary
+tables (SSDTs) was not being propagated into the namespace
+objects created by those tables. This would only present a
+problem for tables that are unloaded at run-time, however.
+
+Updated AcpiOsReadable and AcpiOsWritable to use the ACPI_SIZE
+type as the length parameter (instead of UINT32).
+
+Solved a long-standing problem where an ALREADY_EXISTS error
+appears on various systems. This problem could happen when there
+are multiple PCI_Config operation regions under a single PCI root
+bus. This doesn't happen very frequently, but there are some
+systems that do this in the ASL.
+
+Fixed a reported problem where the internal DeleteNode function
+was incorrectly handling the case where a namespace node was the
+first in the parent's child list, and had additional peers (not
+the only child, but first in the list of children.)
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 73.7K Code, 9.5K Data, 83.2K Total
+ Debug Version: 156.1K Code, 63.6K Data, 219.7K Total
+ Current Release:
+ Non-Debug Version: 73.4K Code, 9.7K Data, 83.1K Total
+ Debug Version: 156.1K Code, 63.9K Data, 220.0K Total
+
+
+2) Linux:
+
+Allow ":" in OS override string (Ducrot Bruno)
+
+Kobject fix (Greg KH)
+
+
+3 iASL Compiler/Disassembler:
+
+Fixed a problem in the generation of the C source code files (AML
+is emitted in C source statements for BIOS inclusion) where the
+Ascii dump that appears within a C comment at the end of each
+line could cause a compile time error if the AML sequence happens
+to have an open comment or close comment sequence embedded.
+
+
+----------------------------------------
+24 April 2003. Summary of changes for version 20030424.
+
+
+1) ACPI CA Core Subsystem:
+
+Support for big-endian systems has been implemented. Most of the
+support has been invisibly added behind big-endian versions of
+the ACPI_MOVE_* macros.
+
+Fixed a problem in AcpiHwDisableGpeBlock() and
+AcpiHwClearGpeBlock() where an incorrect offset was passed to the
+low level hardware write routine. The offset parameter was
+actually eliminated from the low level read/write routines
+because they had become obsolete.
+
+Fixed a problem where a handler object was deleted twice during
+the removal of a fixed event handler.
+
+
+2) Linux:
+
+A fix for SMP systems with link devices was contributed by
+Compaq's Dan Zink.
+
+(2.5) Return whether we handled the interrupt in our IRQ handler.
+(Linux ISRs no longer return void, so we can propagate the
+handler return value from the ACPI CA core back to the OS.)
+
+
+3) Documentation:
+
+The ACPI CA Programmer Reference has been updated to reflect new
+interfaces and changes to existing interfaces.
+
+----------------------------------------
+28 March 2003. Summary of changes for version 20030328.
+
+1) ACPI CA Core Subsystem:
+
+The GPE Block Device support has been completed. New interfaces
+are AcpiInstallGpeBlock and AcpiRemoveGpeBlock. The Event
+interfaces (enable, disable, clear, getstatus) have been split
+into separate interfaces for Fixed Events and General Purpose
+Events (GPEs) in order to support GPE Block Devices properly.
+
+Fixed a problem where the error message "Failed to acquire
+semaphore" would appear during operations on the embedded
+controller (EC).
+
+Code and Data Size: Current core subsystem library sizes are
+shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release
+ Non-Debug Version: 72.3K Code, 9.5K Data, 81.8K Total
+ Debug Version: 154.0K Code, 63.4K Data, 217.4K Total
+ Current Release:
+ Non-Debug Version: 73.7K Code, 9.5K Data, 83.2K Total
+ Debug Version: 156.1K Code, 63.6K Data, 219.7K Total
+
+
+----------------------------------------
28 February 2003. Summary of changes for version 20030228.
@@ -82,6 +347,7 @@ opened.
Added support for the _PDC reserved name.
+----------------------------------------
22 January 2003. Summary of changes for version 20030122.
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h
index 25d30f7..bba73c6 100644
--- a/sys/contrib/dev/acpica/acconfig.h
+++ b/sys/contrib/dev/acpica/acconfig.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
- * $Revision: 129 $
+ * $Revision: 139 $
*
*****************************************************************************/
@@ -120,7 +120,7 @@
/******************************************************************************
*
- * Compile-time options
+ * Configuration options
*
*****************************************************************************/
@@ -135,21 +135,9 @@
*
*/
-
-/******************************************************************************
- *
- * Subsystem Constants
- *
- *****************************************************************************/
-
-
/* Version string */
-#define ACPI_CA_VERSION 0x20030228
-
-/* Version of ACPI supported */
-
-#define ACPI_CA_SUPPORT_LEVEL 2
+#define ACPI_CA_VERSION 0x20030619
/* Maximum objects in the various object caches */
@@ -159,6 +147,23 @@
#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
+/*
+ * Should the subystem abort the loading of an ACPI table if the
+ * table checksum is incorrect?
+ */
+#define ACPI_CHECKSUM_ABORT FALSE
+
+
+/******************************************************************************
+ *
+ * Subsystem Constants
+ *
+ *****************************************************************************/
+
+/* Version of ACPI supported */
+
+#define ACPI_CA_SUPPORT_LEVEL 2
+
/* String size constants */
#define ACPI_MAX_STRING_LENGTH 512
@@ -179,20 +184,6 @@
/******************************************************************************
*
- * Configuration of subsystem behavior
- *
- *****************************************************************************/
-
-
-/*
- * Should the subystem abort the loading of an ACPI table if the
- * table checksum is incorrect?
- */
-#define ACPI_CHECKSUM_ABORT FALSE
-
-
-/******************************************************************************
- *
* ACPI Specification constants (Do not change unless the specification changes)
*
*****************************************************************************/
@@ -215,6 +206,11 @@
#define ACPI_MAX_STRING_CONVERSION 200
+/* Length of _HID, _UID, and _CID values */
+
+#define ACPI_DEVICE_ID_LENGTH 0x09
+#define ACPI_MAX_CID_LENGTH 48
+
/*
* Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
*/
@@ -269,7 +265,6 @@
*
*****************************************************************************/
-
#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */
#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
diff --git a/sys/contrib/dev/acpica/acdebug.h b/sys/contrib/dev/acpica/acdebug.h
index 4ca325b..ac4bd5f 100644
--- a/sys/contrib/dev/acpica/acdebug.h
+++ b/sys/contrib/dev/acpica/acdebug.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
- * $Revision: 70 $
+ * $Revision: 72 $
*
*****************************************************************************/
@@ -305,10 +305,6 @@ AcpiDbDecodeAndDisplayObject (
char *OutputType);
void
-AcpiDbDecodeNode (
- ACPI_NAMESPACE_NODE *Node);
-
-void
AcpiDbDisplayResultObject (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState);
@@ -318,11 +314,6 @@ AcpiDbDisplayAllMethods (
char *DisplayCountArg);
void
-AcpiDbDisplayInternalObject (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_WALK_STATE *WalkState);
-
-void
AcpiDbDisplayArguments (
void);
@@ -339,6 +330,10 @@ AcpiDbDisplayCallingTree (
void);
void
+AcpiDbDisplayObjectType (
+ char *ObjectArg);
+
+void
AcpiDbDisplayArgumentObject (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState);
@@ -351,10 +346,6 @@ void *
AcpiDbGetPointer (
void *Target);
-void
-AcpiDbDecodeInternalObject (
- ACPI_OPERAND_OBJECT *ObjDesc);
-
/*
* dbexec - debugger control method execution
diff --git a/sys/contrib/dev/acpica/acdisasm.h b/sys/contrib/dev/acpica/acdisasm.h
index 021d189..8df05f9 100644
--- a/sys/contrib/dev/acpica/acdisasm.h
+++ b/sys/contrib/dev/acpica/acdisasm.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
- * $Revision: 8 $
+ * $Revision: 9 $
*
*****************************************************************************/
@@ -277,6 +277,34 @@ AcpiDmCommaIfFieldMember (
/*
+ * dmobject
+ */
+
+void
+AcpiDmDecodeNode (
+ ACPI_NAMESPACE_NODE *Node);
+
+void
+AcpiDmDisplayInternalObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDmDisplayArguments (
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDmDisplayLocals (
+ ACPI_WALK_STATE *WalkState);
+
+void
+AcpiDmDumpMethodInfo (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*
* dmbuffer
*/
diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/acevents.h
index a18b999..172a5f7 100644
--- a/sys/contrib/dev/acpica/acevents.h
+++ b/sys/contrib/dev/acpica/acevents.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
- * $Revision: 83 $
+ * $Revision: 91 $
*
*****************************************************************************/
@@ -182,21 +182,44 @@ AcpiEvNotifyDispatch (
* Evgpe - GPE handling and dispatch
*/
+ACPI_STATUS
+AcpiEvWalkGpeList (
+ ACPI_GPE_CALLBACK GpeWalkCallback);
+
+BOOLEAN
+AcpiEvValidGpeEvent (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo);
+
ACPI_GPE_EVENT_INFO *
AcpiEvGetGpeEventInfo (
+ ACPI_HANDLE GpeDevice,
UINT32 GpeNumber);
ACPI_STATUS
AcpiEvGpeInitialize (
void);
+ACPI_STATUS
+AcpiEvCreateGpeBlock (
+ ACPI_NAMESPACE_NODE *GpeDevice,
+ ACPI_GENERIC_ADDRESS *GpeBlockAddress,
+ UINT32 RegisterCount,
+ UINT8 GpeBlockBaseNumber,
+ UINT32 InterruptLevel,
+ ACPI_GPE_BLOCK_INFO **ReturnGpeBlock);
+
+ACPI_STATUS
+AcpiEvDeleteGpeBlock (
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
UINT32
AcpiEvGpeDispatch (
- ACPI_GPE_EVENT_INFO *GpeEventInfo);
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ UINT32 GpeNumber);
UINT32
AcpiEvGpeDetect (
- void);
+ ACPI_GPE_XRUPT_INFO *GpeXruptList);
/*
* Evregion - Address Space handling
@@ -215,7 +238,7 @@ AcpiEvAddressSpaceDispatch (
void *Value);
ACPI_STATUS
-AcpiEvAddrHandlerHelper (
+AcpiEvInstallHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
@@ -289,6 +312,10 @@ AcpiEvInitializeRegion (
* Evsci - SCI (System Control Interrupt) handling/dispatch
*/
+UINT32 ACPI_SYSTEM_XFACE
+AcpiEvGpeXruptHandler (
+ void *Context);
+
UINT32
AcpiEvInstallSciHandler (
void);
diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/acexcep.h
index 9034a4a..8aaacf2 100644
--- a/sys/contrib/dev/acpica/acexcep.h
+++ b/sys/contrib/dev/acpica/acexcep.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
- * $Revision: 67 $
+ * $Revision: 68 $
*
*****************************************************************************/
@@ -167,8 +167,9 @@
#define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_LOGICAL_ADDRESS (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL)
#define AE_ABORT_METHOD (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL)
+#define AE_SAME_HANDLER (ACPI_STATUS) (0x001D | AE_CODE_ENVIRONMENTAL)
-#define AE_CODE_ENV_MAX 0x001C
+#define AE_CODE_ENV_MAX 0x001D
/*
* Programmer exceptions
@@ -292,7 +293,8 @@ char const *AcpiGbl_ExceptionNames_Env[] =
"AE_NO_HARDWARE_RESPONSE",
"AE_NO_GLOBAL_LOCK",
"AE_LOGICAL_ADDRESS",
- "AE_ABORT_METHOD"
+ "AE_ABORT_METHOD",
+ "AE_SAME_HANDLER"
};
char const *AcpiGbl_ExceptionNames_Pgm[] =
diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h
index 9d3d5f3..e158982 100644
--- a/sys/contrib/dev/acpica/acfreebsd.h
+++ b/sys/contrib/dev/acpica/acfreebsd.h
@@ -129,14 +129,6 @@
#include <machine/acpica_machdep.h>
#ifdef _KERNEL
-#include "opt_acpi.h"
-#endif
-
-#ifdef ACPI_DEBUG
-#define ACPI_DEBUG_OUTPUT /* for backward compatibility */
-#endif
-
-#ifdef _KERNEL
#include <sys/ctype.h>
#include <sys/param.h>
#include <sys/systm.h>
@@ -165,7 +157,6 @@
#define __cli()
#define __sti()
-#define ACPI_FLUSH_CPU_CACHE()
#endif /* _KERNEL */
diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h
index 92541f7..7ee14d3 100644
--- a/sys/contrib/dev/acpica/acglobal.h
+++ b/sys/contrib/dev/acpica/acglobal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
- * $Revision: 137 $
+ * $Revision: 143 $
*
*****************************************************************************/
@@ -178,6 +178,9 @@ ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS;
*/
ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth;
ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth;
+ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth;
+ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable;
+ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable;
/*
* Since there may be multiple SSDTs and PSDTS, a single pointer is not
@@ -188,15 +191,15 @@ ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth;
/*
* ACPI Table info arrays
*/
-extern ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES];
-extern ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES];
+extern ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
+extern ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES];
/*
* Predefined mutex objects. This array contains the
* actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
* (The table maps local handles to the real OS handles)
*/
-ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_AcpiMutexInfo [NUM_MTX];
+ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[NUM_MUTEX];
/*****************************************************************************
@@ -207,8 +210,8 @@ ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_AcpiMutexInfo [NUM_MTX];
ACPI_EXTERN ACPI_MEMORY_LIST AcpiGbl_MemoryLists[ACPI_NUM_MEM_LISTS];
-ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DrvNotify;
-ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SysNotify;
+ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify;
+ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify;
ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler;
ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk;
ACPI_EXTERN ACPI_HANDLE AcpiGbl_GlobalLockSemaphore;
@@ -273,7 +276,7 @@ ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting;
****************************************************************************/
-ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList;
+ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList;
/* Control method single step flag */
@@ -286,7 +289,7 @@ ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep;
*
****************************************************************************/
-ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
+ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
/*****************************************************************************
*
@@ -307,7 +310,9 @@ ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB;
extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS];
ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS];
-ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeBlockListHead;
+ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead;
+ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS];
+ACPI_EXTERN ACPI_HANDLE AcpiGbl_GpeLock;
/*****************************************************************************
diff --git a/sys/contrib/dev/acpica/achware.h b/sys/contrib/dev/acpica/achware.h
index addc164..459848e 100644
--- a/sys/contrib/dev/acpica/achware.h
+++ b/sys/contrib/dev/acpica/achware.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
- * $Revision: 62 $
+ * $Revision: 67 $
*
*****************************************************************************/
@@ -171,19 +171,17 @@ ACPI_STATUS
AcpiHwLowLevelRead (
UINT32 Width,
UINT32 *Value,
- ACPI_GENERIC_ADDRESS *Reg,
- UINT32 Offset);
+ ACPI_GENERIC_ADDRESS *Reg);
ACPI_STATUS
AcpiHwLowLevelWrite (
UINT32 Width,
UINT32 Value,
- ACPI_GENERIC_ADDRESS *Reg,
- UINT32 Offset);
+ ACPI_GENERIC_ADDRESS *Reg);
ACPI_STATUS
AcpiHwClearAcpiStatus (
- void);
+ UINT32 Flags);
/* GPE support */
@@ -200,6 +198,11 @@ ACPI_STATUS
AcpiHwDisableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
+ACPI_STATUS
+AcpiHwDisableGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
void
AcpiHwDisableGpeForWakeup (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
@@ -209,8 +212,13 @@ AcpiHwClearGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS
+AcpiHwClearGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
+ACPI_STATUS
AcpiHwGetGpeStatus (
- UINT32 GpeNumber,
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
ACPI_EVENT_STATUS *EventStatus);
ACPI_STATUS
diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h
index 240981f..1756b8d 100644
--- a/sys/contrib/dev/acpica/acinterp.h
+++ b/sys/contrib/dev/acpica/acinterp.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
- * $Revision: 145 $
+ * $Revision: 146 $
*
*****************************************************************************/
@@ -237,15 +237,17 @@ void
AcpiExGetBufferDatum(
ACPI_INTEGER *Datum,
void *Buffer,
+ UINT32 BufferLength,
UINT32 ByteGranularity,
- UINT32 Offset);
+ UINT32 BufferOffset);
void
AcpiExSetBufferDatum (
ACPI_INTEGER MergedDatum,
void *Buffer,
+ UINT32 BufferLength,
UINT32 ByteGranularity,
- UINT32 Offset);
+ UINT32 BufferOffset);
ACPI_STATUS
AcpiExReadDataFromField (
diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h
index 4144788..e867e09 100644
--- a/sys/contrib/dev/acpica/aclocal.h
+++ b/sys/contrib/dev/acpica/aclocal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
- * $Revision: 189 $
+ * $Revision: 197 $
*
*****************************************************************************/
@@ -160,8 +160,8 @@ typedef UINT32 ACPI_MUTEX_HANDLE;
#define ACPI_MTX_DEBUG_CMD_COMPLETE 11
#define ACPI_MTX_DEBUG_CMD_READY 12
-#define MAX_MTX 12
-#define NUM_MTX MAX_MTX+1
+#define MAX_MUTEX 12
+#define NUM_MUTEX MAX_MUTEX+1
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
@@ -214,12 +214,8 @@ typedef struct acpi_mutex_info
typedef UINT16 ACPI_OWNER_ID;
#define ACPI_OWNER_TYPE_TABLE 0x0
#define ACPI_OWNER_TYPE_METHOD 0x1
-#define ACPI_FIRST_METHOD_ID 0x0000
-#define ACPI_FIRST_TABLE_ID 0x8000
-
-/* TBD: [Restructure] get rid of the need for this! */
-
-#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0x8000
+#define ACPI_FIRST_METHOD_ID 0x0001
+#define ACPI_FIRST_TABLE_ID 0xF000
/* Field access granularities */
@@ -271,7 +267,7 @@ typedef struct acpi_namespace_node
union acpi_operand_object *Object; /* Pointer to attached ACPI object (optional) */
- struct acpi_namespace_node *Child; /* first child */
+ struct acpi_namespace_node *Child; /* First child */
struct acpi_namespace_node *Peer; /* Next peer*/
UINT16 ReferenceCount; /* Current count of references and children */
UINT8 Flags;
@@ -308,7 +304,6 @@ typedef struct acpi_table_desc
UINT64 PhysicalAddress;
UINT32 AmlLength;
ACPI_SIZE Length;
- UINT32 Count;
ACPI_OWNER_ID TableId;
UINT8 Type;
UINT8 Allocation;
@@ -316,6 +311,13 @@ typedef struct acpi_table_desc
} ACPI_TABLE_DESC;
+typedef struct acpi_table_list
+{
+ struct acpi_table_desc *Next;
+ UINT32 Count;
+
+} ACPI_TABLE_LIST;
+
typedef struct acpi_find_context
{
@@ -390,20 +392,20 @@ typedef struct acpi_create_field_info
*
****************************************************************************/
-/* Information about each particular GPE level */
+/* Information about a GPE, one per each GPE in an array */
typedef struct acpi_gpe_event_info
{
ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */
ACPI_GPE_HANDLER Handler; /* Address of handler, if any */
void *Context; /* Context to be passed to handler */
- struct acpi_gpe_register_info *RegisterInfo;
- UINT8 Type; /* Level or Edge */
- UINT8 BitMask;
+ struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
+ UINT8 Flags; /* Level or Edge */
+ UINT8 BitMask; /* This GPE within the register */
} ACPI_GPE_EVENT_INFO;
-/* Information about a particular GPE register pair */
+/* Information about a GPE register pair, one per each status/enable pair in an array */
typedef struct acpi_gpe_register_info
{
@@ -416,26 +418,39 @@ typedef struct acpi_gpe_register_info
} ACPI_GPE_REGISTER_INFO;
-
-#define ACPI_GPE_LEVEL_TRIGGERED 1
-#define ACPI_GPE_EDGE_TRIGGERED 2
-
-
-/* Information about each GPE register block */
-
+/*
+ * Information about a GPE register block, one per each installed block --
+ * GPE0, GPE1, and one per each installed GPE Block Device.
+ */
typedef struct acpi_gpe_block_info
{
struct acpi_gpe_block_info *Previous;
struct acpi_gpe_block_info *Next;
- struct acpi_gpe_block_info *NextOnInterrupt;
- ACPI_GPE_REGISTER_INFO *RegisterInfo;
- ACPI_GPE_EVENT_INFO *EventInfo;
- ACPI_GENERIC_ADDRESS BlockAddress;
- UINT32 RegisterCount;
- UINT8 BlockBaseNumber;
+ struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */
+ ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */
+ ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */
+ ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */
+ UINT32 RegisterCount; /* Number of register pairs in block */
+ UINT8 BlockBaseNumber;/* Base GPE number for this block */
} ACPI_GPE_BLOCK_INFO;
+/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
+
+typedef struct acpi_gpe_xrupt_info
+{
+ struct acpi_gpe_xrupt_info *Previous;
+ struct acpi_gpe_xrupt_info *Next;
+ ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */
+ UINT32 InterruptLevel; /* System interrupt level */
+
+} ACPI_GPE_XRUPT_INFO;
+
+
+typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
/* Information about each particular fixed event */
@@ -446,7 +461,6 @@ typedef struct acpi_fixed_event_handler
} ACPI_FIXED_EVENT_HANDLER;
-
typedef struct acpi_fixed_event_info
{
UINT8 StatusRegisterId;
@@ -557,10 +571,10 @@ typedef struct acpi_scope_state
typedef struct acpi_pscope_state
{
ACPI_STATE_COMMON
- union acpi_parse_object *Op; /* current op being parsed */
- UINT8 *ArgEnd; /* current argument end */
- UINT8 *PkgEnd; /* current package end */
- UINT32 ArgList; /* next argument to parse */
+ union acpi_parse_object *Op; /* Current op being parsed */
+ UINT8 *ArgEnd; /* Current argument end */
+ UINT8 *PkgEnd; /* Current package end */
+ UINT32 ArgList; /* Next argument to parse */
UINT32 ArgCount; /* Number of fixed arguments */
} ACPI_PSCOPE_STATE;
@@ -672,11 +686,8 @@ typedef struct acpi_opcode_info
typedef union acpi_parse_value
{
- ACPI_INTEGER Integer; /* integer constant (Up to 64 bits) */
+ ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */
UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */
- UINT32 Integer32; /* integer constant, 32 bits only */
- UINT16 Integer16; /* integer constant, 16 bits only */
- UINT8 Integer8; /* integer constant, 8 bits only */
UINT32 Size; /* bytelist or field size */
char *String; /* NULL terminated string */
UINT8 *Buffer; /* buffer or string */
@@ -690,15 +701,15 @@ typedef union acpi_parse_value
UINT8 DataType; /* To differentiate various internal objs */\
UINT8 Flags; /* Type of Op */\
UINT16 AmlOpcode; /* AML opcode */\
- UINT32 AmlOffset; /* offset of declaration in AML */\
- union acpi_parse_object *Parent; /* parent op */\
- union acpi_parse_object *Next; /* next op */\
+ UINT32 AmlOffset; /* Offset of declaration in AML */\
+ union acpi_parse_object *Parent; /* Parent op */\
+ union acpi_parse_object *Next; /* Next op */\
ACPI_DISASM_ONLY_MEMBERS (\
UINT8 DisasmFlags; /* Used during AML disassembly */\
UINT8 DisasmOpcode; /* Subtype used for disassembly */\
- char AmlOpName[16]) /* op name (debug only) */\
+ char AmlOpName[16]) /* Op name (debug only) */\
/* NON-DEBUG members below: */\
- ACPI_NAMESPACE_NODE *Node; /* for use by interpreter */\
+ ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
@@ -782,14 +793,14 @@ typedef union acpi_parse_object
typedef struct acpi_parse_state
{
UINT32 AmlSize;
- UINT8 *AmlStart; /* first AML byte */
- UINT8 *Aml; /* next AML byte */
+ UINT8 *AmlStart; /* First AML byte */
+ UINT8 *Aml; /* Next AML byte */
UINT8 *AmlEnd; /* (last + 1) AML byte */
- UINT8 *PkgStart; /* current package begin */
- UINT8 *PkgEnd; /* current package end */
- union acpi_parse_object *StartOp; /* root of parse tree */
+ UINT8 *PkgStart; /* Current package begin */
+ UINT8 *PkgEnd; /* Current package end */
+ union acpi_parse_object *StartOp; /* Root of parse tree */
struct acpi_namespace_node *StartNode;
- union acpi_generic_state *Scope; /* current scope */
+ union acpi_generic_state *Scope; /* Current scope */
union acpi_parse_object *StartScope;
} ACPI_PARSE_STATE;
@@ -951,17 +962,6 @@ typedef struct acpi_bit_register_info
#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
-/* String version of device HIDs and UIDs */
-
-#define ACPI_DEVICE_ID_LENGTH 0x09
-
-typedef struct acpi_device_id
-{
- char Buffer[ACPI_DEVICE_ID_LENGTH];
-
-} ACPI_DEVICE_ID;
-
-
/*****************************************************************************
*
* Miscellaneous
diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h
index 998cab4..a0212aa 100644
--- a/sys/contrib/dev/acpica/acmacros.h
+++ b/sys/contrib/dev/acpica/acmacros.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
- * $Revision: 137 $
+ * $Revision: 145 $
*
*****************************************************************************/
@@ -189,7 +189,7 @@
#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
#if ACPI_MACHINE_WIDTH == 16
-#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_UNALIGNED32_TO_32(d,s)
+#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
#define ACPI_PTR_TO_PHYSADDR(i) (UINT32) (char *)(i)
#else
@@ -203,41 +203,169 @@
* Otherwise, we have to move one byte at a time.
*/
-#ifdef _HW_ALIGNMENT_SUPPORT
+#ifdef ACPI_BIG_ENDIAN
+/*
+ * Macros for big-endian machines
+ */
+
+/* This macro sets a buffer index, starting from the end of the buffer */
+
+#define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) ((BufLen) - (((BufOffset)+1) * (ByteGran)))
+
+/* These macros reverse the bytes during the move, converting little-endian to big endian */
+
+ /* Big Endian <== Little Endian */
+ /* Hi...Lo Lo...Hi */
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[0];}
+
+#define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d))=0;\
+ ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\
+ ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];}
+
+#define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\
+ ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
+ ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
-/* The hardware supports unaligned transfers, just do the move */
+/* 32-bit source, 16/32/64 destination */
-#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
-#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
-#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
-#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s)
+#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+
+#define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\
+ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];}
+
+#define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\
+ ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\
+ ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\
+ ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
+ ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+
+#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
+
+#define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
+ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\
+ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];\
+ (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\
+ (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\
+ (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
+#else
+/*
+ * Macros for little-endian machines
+ */
+
+/* This macro sets a buffer index, starting from the beginning of the buffer */
+
+#define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) (BufOffset)
+
+#ifdef ACPI_MISALIGNED_TRANSFERS
+
+/* The hardware supports unaligned transfers, just do the little-endian move */
+
+#if ACPI_MACHINE_WIDTH == 16
+
+/* No 64-bit integers */
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s)
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
+#define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
+
+#else
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s)
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
+#define ACPI_MOVE_32_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s)
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s)
+#endif
#else
/*
* The hardware does not support unaligned transfers. We must move the
* data one byte at a time. These macros work whether the source or
- * the destination (or both) is/are unaligned.
+ * the destination (or both) is/are unaligned. (Little-endian move)
*/
-#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
- ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];}
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];}
+
+#define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
+#define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+
+#define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\
+ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];}
+
+#define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);}
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
+ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\
+ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\
+ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\
+ (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\
+ (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\
+ (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\
+ (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];}
+#endif
+#endif
+
+/* Macros based on machine integer width */
-#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
- ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\
- ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\
- ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];}
+#if ACPI_MACHINE_WIDTH == 16
+#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s)
-#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(void *)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);}
+#elif ACPI_MACHINE_WIDTH == 32
+#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s)
-#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
- ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\
- ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\
- ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\
- ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\
- ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\
- ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\
- ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];}
+#elif ACPI_MACHINE_WIDTH == 64
+#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s)
+#else
+#error unknown ACPI_MACHINE_WIDTH
#endif
@@ -305,21 +433,6 @@
#if ACPI_MACHINE_WIDTH != 16
-#define ACPI_PCI_DEVICE_MASK (UINT64) 0x0000FFFF00000000
-#define ACPI_PCI_FUNCTION_MASK (UINT64) 0x00000000FFFF0000
-#define ACPI_PCI_REGISTER_MASK (UINT64) 0x000000000000FFFF
-
-/*
- * Obsolete
- */
-
-/*
-#define ACPI_PCI_FUNCTION(a) (UINT16) ((((UINT64)((UINT64)(a) & ACPI_PCI_FUNCTION_MASK)) >> 16))
-#define ACPI_PCI_DEVICE(a) (UINT16) ((((UINT64)((UINT64)(a) & ACPI_PCI_DEVICE_MASK)) >> 32))
-#define ACPI_PCI_REGISTER(a) (UINT16) (((UINT64)((UINT64)(a) & ACPI_PCI_REGISTER_MASK)))
-*/
-
-
#define ACPI_PCI_DEVICE(a) (UINT16) ((ACPI_HIDWORD ((a))) & 0x0000FFFF)
#define ACPI_PCI_FUNCTION(a) (UINT16) ((ACPI_LODWORD ((a))) >> 16)
#define ACPI_PCI_REGISTER(a) (UINT16) ((ACPI_LODWORD ((a))) & 0x0000FFFF)
@@ -401,30 +514,10 @@
/*
- * Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions)
- *
- * 1) Address space
- * 2) Length in bytes -- convert to length in bits
- * 3) Bit offset is zero
- * 4) Reserved field is zero
- * 5) Expand address to 64 bits
- */
-#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d) do {a.AddressSpaceId = (UINT8) d;\
- a.RegisterBitWidth = (UINT8) ACPI_MUL_8 (b);\
- a.RegisterBitOffset = 0;\
- a.Reserved = 0;\
- ACPI_STORE_ADDRESS (a.Address,(ACPI_PHYSICAL_ADDRESS) c);} while (0)
-
-/* ACPI V1.0 entries -- address space is always I/O */
-
-#define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c) ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ACPI_ADR_SPACE_SYSTEM_IO)
-
-
-/*
* Reporting macros that are never compiled out
*/
-#define ACPI_PARAM_LIST(pl) pl
+#define ACPI_PARAM_LIST(pl) pl
/*
* Error reporting. These versions add callers module and line#. Since
@@ -481,21 +574,21 @@
* as a local string ("_ProcName) so that it can be also used by the function exit macros below.
*/
-#define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _Dbg; \
- _Dbg.ComponentId = _COMPONENT; \
- _Dbg.ProcName = a; \
- _Dbg.ModuleName = _THIS_MODULE;
-
-#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a)\
- AcpiUtTrace(__LINE__,&_Dbg)
-#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a)\
- AcpiUtTracePtr(__LINE__,&_Dbg,(void *)b)
-#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a)\
- AcpiUtTraceU32(__LINE__,&_Dbg,(UINT32)b)
-#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a)\
- AcpiUtTraceStr(__LINE__,&_Dbg,(char *)b)
-
-#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr()
+#define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _Dbg; \
+ _Dbg.ComponentId = _COMPONENT; \
+ _Dbg.ProcName = a; \
+ _Dbg.ModuleName = _THIS_MODULE;
+
+#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTrace(__LINE__,&_Dbg)
+#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTracePtr(__LINE__,&_Dbg,(void *)b)
+#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTraceU32(__LINE__,&_Dbg,(UINT32)b)
+#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTraceStr(__LINE__,&_Dbg,(char *)b)
+
+#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr()
/*
* Function exit tracing.
diff --git a/sys/contrib/dev/acpica/acnamesp.h b/sys/contrib/dev/acpica/acnamesp.h
index 54c1c25..ed1ec33 100644
--- a/sys/contrib/dev/acpica/acnamesp.h
+++ b/sys/contrib/dev/acpica/acnamesp.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
- * $Revision: 133 $
+ * $Revision: 134 $
*
*****************************************************************************/
@@ -274,6 +274,11 @@ AcpiNsCompareNames (
char *Name1,
char *Name2);
+void
+AcpiNsRemoveReference (
+ ACPI_NAMESPACE_NODE *Node);
+
+
/*
* Namespace modification - nsmodify
*/
diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/acobject.h
index 2f92f05..5abe983 100644
--- a/sys/contrib/dev/acpica/acobject.h
+++ b/sys/contrib/dev/acpica/acobject.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
- * $Revision: 118 $
+ * $Revision: 120 $
*
*****************************************************************************/
@@ -185,9 +185,9 @@
* Common fields for objects that support ASL notifications
*/
#define ACPI_COMMON_NOTIFY_INFO \
- union acpi_operand_object *SysHandler; /* Handler for system notifies */\
- union acpi_operand_object *DrvHandler; /* Handler for driver notifies */\
- union acpi_operand_object *AddrHandler; /* Handler for Address space */
+ union acpi_operand_object *SystemNotify; /* Handler for system notifies */\
+ union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\
+ union acpi_operand_object *AddressSpace; /* Handler for Address space */
/******************************************************************************
@@ -295,7 +295,7 @@ typedef struct acpi_object_region
ACPI_OBJECT_COMMON_HEADER
UINT8 SpaceId;
- union acpi_operand_object *AddrHandler; /* Handler for system notifies */
+ union acpi_operand_object *AddressSpace; /* Handler for region access */
ACPI_NAMESPACE_NODE *Node; /* containing object */
union acpi_operand_object *Next;
UINT32 Length;
@@ -322,6 +322,7 @@ typedef struct acpi_object_device
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_NOTIFY_INFO
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
} ACPI_OBJECT_DEVICE;
@@ -542,8 +543,8 @@ typedef union acpi_operand_object
ACPI_OBJECT_BUFFER_FIELD BufferField;
ACPI_OBJECT_BANK_FIELD BankField;
ACPI_OBJECT_INDEX_FIELD IndexField;
- ACPI_OBJECT_NOTIFY_HANDLER NotifyHandler;
- ACPI_OBJECT_ADDR_HANDLER AddrHandler;
+ ACPI_OBJECT_NOTIFY_HANDLER Notify;
+ ACPI_OBJECT_ADDR_HANDLER AddressSpace;
ACPI_OBJECT_REFERENCE Reference;
ACPI_OBJECT_EXTRA Extra;
ACPI_OBJECT_DATA Data;
diff --git a/sys/contrib/dev/acpica/acpi.h b/sys/contrib/dev/acpica/acpi.h
index 0ae41b2..11fdb69 100644
--- a/sys/contrib/dev/acpica/acpi.h
+++ b/sys/contrib/dev/acpica/acpi.h
@@ -123,7 +123,7 @@
* in the rest of the source code again and again.
*/
#include "acconfig.h" /* Configuration constants */
-#include "acenv.h" /* Target environment specific items */
+#include "acenv.h" /* Target environment specific items */
#include "actypes.h" /* Fundamental common data types */
#include "acexcep.h" /* ACPI exception codes */
#include "acmacros.h" /* C macros */
diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/acpiosxf.h
index acbd985..d0e82b2 100644
--- a/sys/contrib/dev/acpica/acpiosxf.h
+++ b/sys/contrib/dev/acpica/acpiosxf.h
@@ -151,19 +151,6 @@ typedef struct acpi_signal_fatal_info
/*
- * Types specific to the OS service interfaces
- */
-
-typedef UINT32
-(ACPI_SYSTEM_XFACE *OSD_HANDLER) (
- void *Context);
-
-typedef void
-(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) (
- void *Context);
-
-
-/*
* OSL Initialization and shutdown primitives
*/
@@ -221,6 +208,24 @@ AcpiOsSignalSemaphore (
ACPI_HANDLE Handle,
UINT32 Units);
+ACPI_STATUS
+AcpiOsCreateLock (
+ ACPI_HANDLE *OutHandle);
+
+void
+AcpiOsDeleteLock (
+ ACPI_HANDLE Handle);
+
+void
+AcpiOsAcquireLock (
+ ACPI_HANDLE Handle,
+ UINT32 Flags);
+
+void
+AcpiOsReleaseLock (
+ ACPI_HANDLE Handle,
+ UINT32 Flags);
+
/*
* Memory allocation and mapping
@@ -298,13 +303,13 @@ AcpiOsStall (
ACPI_STATUS
AcpiOsReadPort (
ACPI_IO_ADDRESS Address,
- void *Value,
+ UINT32 *Value,
UINT32 Width);
ACPI_STATUS
AcpiOsWritePort (
ACPI_IO_ADDRESS Address,
- ACPI_INTEGER Value,
+ UINT32 Value,
UINT32 Width);
@@ -315,13 +320,13 @@ AcpiOsWritePort (
ACPI_STATUS
AcpiOsReadMemory (
ACPI_PHYSICAL_ADDRESS Address,
- void *Value,
+ UINT32 *Value,
UINT32 Width);
ACPI_STATUS
AcpiOsWriteMemory (
ACPI_PHYSICAL_ADDRESS Address,
- ACPI_INTEGER Value,
+ UINT32 Value,
UINT32 Width);
@@ -359,12 +364,12 @@ AcpiOsDerivePciId(
BOOLEAN
AcpiOsReadable (
void *Pointer,
- UINT32 Length);
+ ACPI_SIZE Length);
BOOLEAN
AcpiOsWritable (
void *Pointer,
- UINT32 Length);
+ ACPI_SIZE Length);
UINT32
AcpiOsGetTimer (
diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h
index ea13888..c30c94e 100644
--- a/sys/contrib/dev/acpica/acpixf.h
+++ b/sys/contrib/dev/acpica/acpixf.h
@@ -300,8 +300,8 @@ AcpiEvaluateObjectTyped (
ACPI_STATUS
AcpiGetObjectInfo (
- ACPI_HANDLE Device,
- ACPI_DEVICE_INFO *Info);
+ ACPI_HANDLE Handle,
+ ACPI_BUFFER *ReturnBuffer);
ACPI_STATUS
AcpiGetNextObject (
@@ -365,6 +365,7 @@ AcpiRemoveAddressSpaceHandler (
ACPI_STATUS
AcpiInstallGpeHandler (
+ ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Type,
ACPI_GPE_HANDLER Handler,
@@ -381,32 +382,66 @@ AcpiReleaseGlobalLock (
ACPI_STATUS
AcpiRemoveGpeHandler (
+ ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
ACPI_GPE_HANDLER Handler);
ACPI_STATUS
AcpiEnableEvent (
- UINT32 AcpiEvent,
- UINT32 Type,
+ UINT32 Event,
UINT32 Flags);
ACPI_STATUS
AcpiDisableEvent (
- UINT32 AcpiEvent,
- UINT32 Type,
+ UINT32 Event,
UINT32 Flags);
ACPI_STATUS
AcpiClearEvent (
- UINT32 AcpiEvent,
- UINT32 Type);
+ UINT32 Event);
ACPI_STATUS
AcpiGetEventStatus (
- UINT32 AcpiEvent,
- UINT32 Type,
+ UINT32 Event,
ACPI_EVENT_STATUS *EventStatus);
+ACPI_STATUS
+AcpiEnableGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiDisableGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiClearGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags);
+
+ACPI_STATUS
+AcpiGetGpeStatus (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags,
+ ACPI_EVENT_STATUS *EventStatus);
+
+ACPI_STATUS
+AcpiInstallGpeBlock (
+ ACPI_HANDLE GpeDevice,
+ ACPI_GENERIC_ADDRESS *GpeBlockAddress,
+ UINT32 RegisterCount,
+ UINT32 InterruptLevel);
+
+ACPI_STATUS
+AcpiRemoveGpeBlock (
+ ACPI_HANDLE GpeDevice);
+
+
/*
* Resource interfaces
*/
diff --git a/sys/contrib/dev/acpica/actables.h b/sys/contrib/dev/acpica/actables.h
index ecf733f..b40588a 100644
--- a/sys/contrib/dev/acpica/actables.h
+++ b/sys/contrib/dev/acpica/actables.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actables.h - ACPI table management
- * $Revision: 44 $
+ * $Revision: 45 $
*
*****************************************************************************/
@@ -230,7 +230,7 @@ AcpiTbMatchSignature (
ACPI_STATUS
AcpiTbRecognizeTable (
ACPI_TABLE_DESC *TableInfo,
- UINT8 SearchType);
+ UINT8 SearchType);
ACPI_STATUS
AcpiTbInitTableDescriptor (
@@ -243,11 +243,11 @@ AcpiTbInitTableDescriptor (
*/
void
-AcpiTbDeleteAcpiTables (
+AcpiTbDeleteAllTables (
void);
void
-AcpiTbDeleteAcpiTable (
+AcpiTbDeleteTablesByType (
ACPI_TABLE_TYPE Type);
void
@@ -258,10 +258,6 @@ ACPI_TABLE_DESC *
AcpiTbUninstallTable (
ACPI_TABLE_DESC *TableDesc);
-void
-AcpiTbFreeAcpiTablesOfType (
- ACPI_TABLE_DESC *TableInfo);
-
/*
* tbrsd - RSDP, RSDT utilities
diff --git a/sys/contrib/dev/acpica/actbl.h b/sys/contrib/dev/acpica/actbl.h
index 82f3d28..0482fac 100644
--- a/sys/contrib/dev/acpica/actbl.h
+++ b/sys/contrib/dev/acpica/actbl.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl.h - Table data structures defined in ACPI specification
- * $Revision: 58 $
+ * $Revision: 59 $
*
*****************************************************************************/
@@ -261,7 +261,16 @@ typedef struct smart_battery_description_table
} SMART_BATTERY_DESCRIPTION_TABLE;
+typedef struct hpet_description_table
+{
+ ACPI_TABLE_HEADER Header;
+ UINT32 HardwareId;
+ UINT32 BaseAddress[3];
+ UINT8 HpetNumber;
+ UINT16 ClockTick;
+ UINT8 Attributes;
+} HPET_DESCRIPTION_TABLE;
#pragma pack()
diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h
index 0b19399..3064a1f 100644
--- a/sys/contrib/dev/acpica/actypes.h
+++ b/sys/contrib/dev/acpica/actypes.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
- * $Revision: 253 $
+ * $Revision: 261 $
*
*****************************************************************************/
@@ -123,11 +123,14 @@
/*
* Data type ranges
+ * Note: These macros are designed to be compiler independent as well as
+ * working around problems that some 32-bit compilers have with 64-bit
+ * constants.
*/
-#define ACPI_UINT8_MAX (UINT8) 0xFF
-#define ACPI_UINT16_MAX (UINT16) 0xFFFF
-#define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF
-#define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF
+#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */
+#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */
+#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */
+#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
#define ACPI_ASCII_MAX 0x7F
@@ -228,7 +231,7 @@ typedef char *ACPI_PHYSICAL_ADDRESS;
typedef UINT16 ACPI_SIZE;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
-#define _HW_ALIGNMENT_SUPPORT
+#define ACPI_MISALIGNED_TRANSFERS
#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
#define ACPI_MAX_PTR ACPI_UINT16_MAX
#define ACPI_SIZE_MAX ACPI_UINT16_MAX
@@ -266,7 +269,7 @@ typedef UINT64 ACPI_PHYSICAL_ADDRESS;
typedef UINT32 ACPI_SIZE;
#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
-#define _HW_ALIGNMENT_SUPPORT
+#define ACPI_MISALIGNED_TRANSFERS
#define ACPI_MAX_PTR ACPI_UINT32_MAX
#define ACPI_SIZE_MAX ACPI_UINT32_MAX
@@ -378,8 +381,6 @@ typedef struct uint32_struct
typedef UINT32 ACPI_INTEGER;
#define ACPI_INTEGER_MAX ACPI_UINT32_MAX
#define ACPI_INTEGER_BIT_SIZE 32
-#define ACPI_MAX_BCD_VALUE 99999999
-#define ACPI_MAX_BCD_DIGITS 8
#define ACPI_MAX_DECIMAL_DIGITS 10
#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
@@ -392,8 +393,6 @@ typedef UINT32 ACPI_INTEGER;
typedef UINT64 ACPI_INTEGER;
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
#define ACPI_INTEGER_BIT_SIZE 64
-#define ACPI_MAX_BCD_VALUE 9999999999999999
-#define ACPI_MAX_BCD_DIGITS 16
#define ACPI_MAX_DECIMAL_DIGITS 19
#if ACPI_MACHINE_WIDTH == 64
@@ -486,7 +485,7 @@ typedef UINT32 ACPI_TABLE_TYPE;
#define ACPI_TABLE_SSDT (ACPI_TABLE_TYPE) 5
#define ACPI_TABLE_XSDT (ACPI_TABLE_TYPE) 6
#define ACPI_TABLE_MAX 6
-#define NUM_ACPI_TABLES (ACPI_TABLE_MAX+1)
+#define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1)
/*
@@ -595,13 +594,10 @@ typedef UINT32 ACPI_OBJECT_TYPE;
/*
- * AcpiEvent Types: Fixed & General Purpose
+ * Acpi Event Types: Fixed & General Purpose
*/
typedef UINT32 ACPI_EVENT_TYPE;
-#define ACPI_EVENT_FIXED 0
-#define ACPI_EVENT_GPE 1
-
/*
* Fixed events
*/
@@ -621,10 +617,13 @@ typedef UINT32 ACPI_EVENT_TYPE;
#define ACPI_EVENT_EDGE_TRIGGERED 2
/*
- * GPEs
+ * Flags for GPE and Lock interfaces
*/
-#define ACPI_EVENT_WAKE_ENABLE 0x1
-#define ACPI_EVENT_WAKE_DISABLE 0x1
+#define ACPI_EVENT_WAKE_ENABLE 0x2
+#define ACPI_EVENT_WAKE_DISABLE 0x2
+
+#define ACPI_NOT_ISR 0x1
+#define ACPI_ISR 0x0
/*
@@ -830,12 +829,24 @@ typedef struct acpi_system_info
UINT32 DebugLevel;
UINT32 DebugLayer;
UINT32 NumTableTypes;
- ACPI_TABLE_INFO TableInfo [NUM_ACPI_TABLES];
+ ACPI_TABLE_INFO TableInfo [NUM_ACPI_TABLE_TYPES];
} ACPI_SYSTEM_INFO;
/*
+ * Types specific to the OS service interfaces
+ */
+
+typedef UINT32
+(ACPI_SYSTEM_XFACE *OSD_HANDLER) (
+ void *Context);
+
+typedef void
+(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) (
+ void *Context);
+
+/*
* Various handlers and callback procedures
*/
typedef
@@ -904,12 +915,38 @@ ACPI_STATUS (*ACPI_WALK_CALLBACK) (
#define ACPI_INTERRUPT_HANDLED 0x01
-/* Structure and flags for AcpiGetDeviceInfo */
+/* Common string version of device HIDs and UIDs */
+
+typedef struct acpi_device_id
+{
+ char Value[ACPI_DEVICE_ID_LENGTH];
+
+} ACPI_DEVICE_ID;
+
+/* Common string version of device CIDs */
+
+typedef struct acpi_compatible_id
+{
+ char Value[ACPI_MAX_CID_LENGTH];
+
+} ACPI_COMPATIBLE_ID;
+
+typedef struct acpi_compatible_id_list
+{
+ UINT32 Count;
+ UINT32 Size;
+ ACPI_COMPATIBLE_ID Id[1];
+
+} ACPI_COMPATIBLE_ID_LIST;
+
-#define ACPI_VALID_HID 0x1
-#define ACPI_VALID_UID 0x2
-#define ACPI_VALID_ADR 0x4
-#define ACPI_VALID_STA 0x8
+/* Structure and flags for AcpiGetObjectInfo */
+
+#define ACPI_VALID_STA 0x0001
+#define ACPI_VALID_ADR 0x0002
+#define ACPI_VALID_HID 0x0004
+#define ACPI_VALID_UID 0x0008
+#define ACPI_VALID_CID 0x0010
#define ACPI_COMMON_OBJ_INFO \
@@ -924,15 +961,18 @@ typedef struct acpi_obj_info_header
} ACPI_OBJ_INFO_HEADER;
+/* Structure returned from Get Object Info */
+
typedef struct acpi_device_info
{
ACPI_COMMON_OBJ_INFO;
- UINT32 Valid; /* Are the next bits legit? */
- char HardwareId[9]; /* _HID value if any */
- char UniqueId[9]; /* _UID value if any */
- ACPI_INTEGER Address; /* _ADR value if any */
- UINT32 CurrentStatus; /* _STA value */
+ UINT32 Valid; /* Indicates which fields are valid */
+ UINT32 CurrentStatus; /* _STA value */
+ ACPI_INTEGER Address; /* _ADR value if any */
+ ACPI_DEVICE_ID HardwareId; /* _HID value if any */
+ ACPI_DEVICE_ID UniqueId; /* _UID value if any */
+ ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */
} ACPI_DEVICE_INFO;
@@ -1291,7 +1331,7 @@ typedef struct acpi_resource
#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
-#ifdef _HW_ALIGNMENT_SUPPORT
+#ifdef ACPI_MISALIGNED_TRANSFERS
#define ACPI_ALIGN_RESOURCE_SIZE(Length) (Length)
#else
#define ACPI_ALIGN_RESOURCE_SIZE(Length) ACPI_ROUND_UP_TO_NATIVE_WORD(Length)
diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h
index 31826e2..ca52024 100644
--- a/sys/contrib/dev/acpica/acutils.h
+++ b/sys/contrib/dev/acpica/acutils.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- * $Revision: 154 $
+ * $Revision: 155 $
*
*****************************************************************************/
@@ -562,7 +562,7 @@ AcpiUtExecute_HID (
ACPI_STATUS
AcpiUtExecute_CID (
ACPI_NAMESPACE_NODE *DeviceNode,
- ACPI_DEVICE_ID *Cid);
+ ACPI_COMPATIBLE_ID_LIST **ReturnCidList);
ACPI_STATUS
AcpiUtExecute_STA (
diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c
index 467256b..6ac31de 100644
--- a/sys/contrib/dev/acpica/dbcmds.c
+++ b/sys/contrib/dev/acpica/dbcmds.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
- * $Revision: 97 $
+ * $Revision: 105 $
*
******************************************************************************/
@@ -249,10 +249,10 @@ AcpiDbDisplayLocks (void)
UINT32 i;
- for (i = 0; i < MAX_MTX; i++)
+ for (i = 0; i < MAX_MUTEX; i++)
{
AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
- AcpiGbl_AcpiMutexInfo[i].OwnerId == ACPI_MUTEX_NOT_ACQUIRED
+ AcpiGbl_MutexInfo[i].OwnerId == ACPI_MUTEX_NOT_ACQUIRED
? "Locked" : "Unlocked");
}
}
@@ -276,15 +276,28 @@ AcpiDbDisplayTableInfo (
char *TableArg)
{
UINT32 i;
+ ACPI_TABLE_DESC *TableDesc;
- for (i = 0; i < NUM_ACPI_TABLES; i++)
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
{
- if (AcpiGbl_AcpiTables[i].Pointer)
+ TableDesc = AcpiGbl_TableLists[i].Next;
+ while (TableDesc)
{
- AcpiOsPrintf ("%s at %p length %X\n", AcpiGbl_AcpiTableData[i].Name,
- AcpiGbl_AcpiTables[i].Pointer,
- (UINT32) AcpiGbl_AcpiTables[i].Length);
+ AcpiOsPrintf ( "%s at %p length %.5X",
+ AcpiGbl_TableData[i].Name, TableDesc->Pointer,
+ (UINT32) TableDesc->Length);
+
+ if (i != ACPI_TABLE_FACS)
+ {
+ AcpiOsPrintf (" OemID=%6s TableId=%8s OemRevision=%8.8X",
+ TableDesc->Pointer->OemId,
+ TableDesc->Pointer->OemTableId,
+ TableDesc->Pointer->OemRevision);
+ }
+ AcpiOsPrintf ("\n");
+
+ TableDesc = TableDesc->Next;
}
}
}
@@ -316,10 +329,10 @@ AcpiDbUnloadAcpiTable (
/* Search all tables for the target type */
- for (i = 0; i < NUM_ACPI_TABLES; i++)
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
{
- if (!ACPI_STRNCMP (TableArg, AcpiGbl_AcpiTableData[i].Signature,
- AcpiGbl_AcpiTableData[i].SigLength))
+ if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature,
+ AcpiGbl_TableData[i].SigLength))
{
/* Found the table, unload it */
@@ -497,11 +510,9 @@ AcpiDbDumpNamespace (
return;
}
}
-
- /* Alpha argument */
-
else
{
+ /* Alpha argument */
/* The parameter is a name string that must be resolved to a Named obj*/
SubtreeEntry = AcpiDbLocalNsLookup (StartArg);
@@ -624,7 +635,6 @@ AcpiDbSendNotify (
AcpiOsPrintf ("Named object is not a device or a thermal object\n");
break;
}
-
}
@@ -680,7 +690,6 @@ AcpiDbSetMethodData (
return;
}
-
/* Create and initialize the new object */
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
@@ -692,7 +701,6 @@ AcpiDbSetMethodData (
ObjDesc->Integer.Value = Value;
-
/* Store the new object into the target */
switch (Type)
@@ -716,7 +724,7 @@ AcpiDbSetMethodData (
ObjDesc = WalkState->Arguments[Index].Object;
AcpiOsPrintf ("Arg%d: ", Index);
- AcpiDbDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
break;
case 'L':
@@ -738,7 +746,7 @@ AcpiDbSetMethodData (
ObjDesc = WalkState->LocalVariables[Index].Object;
AcpiOsPrintf ("Local%d: ", Index);
- AcpiDbDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
break;
default:
@@ -786,7 +794,6 @@ AcpiDbWalkForSpecificObjects (
AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
ACPI_MEM_FREE (Buffer.Pointer);
-
/* Display short information about the object */
if (ObjDesc)
@@ -922,7 +929,6 @@ AcpiDbWalkAndMatchName (
}
}
-
/* Get the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
@@ -1005,7 +1011,6 @@ AcpiDbSetScope (
AcpiDbPrepNamestring (Name);
-
if (Name[0] == '\\')
{
/* Validate new scope from the root */
@@ -1037,7 +1042,6 @@ AcpiDbSetScope (
AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
return;
-
ErrorExit:
AcpiOsPrintf ("Could not attach scope: %s, %s\n", Name, AcpiFormatException (Status));
@@ -1098,7 +1102,6 @@ AcpiDbDisplayResources (
{
AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiFormatException (Status));
}
-
else
{
AcpiRsDumpIrqList ((UINT8 *) AcpiGbl_DbBuffer);
@@ -1129,7 +1132,6 @@ GetCrs:
AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiFormatException (Status));
goto GetPrs;
}
-
else
{
AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
@@ -1166,19 +1168,16 @@ GetPrs:
{
AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", AcpiFormatException (Status));
}
-
else
{
AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
}
-
Cleanup:
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return;
#endif
-
}
@@ -1235,7 +1234,6 @@ AcpiDbIntegrityWalk (
}
}
-
return (AE_OK);
}
@@ -1263,7 +1261,6 @@ AcpiDbCheckIntegrity (void)
AcpiDbIntegrityWalk, (void *) &Info, NULL);
AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", Info.Nodes, Info.Objects);
-
}
@@ -1289,19 +1286,18 @@ AcpiDbGenerateGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 10);
- BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 10);
+ GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0);
+ BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0);
- GpeEventInfo = AcpiEvGetGpeEventInfo (GpeNumber);
+ GpeEventInfo = AcpiEvGetGpeEventInfo ((void *) BlockNumber, GpeNumber);
if (!GpeEventInfo)
{
AcpiOsPrintf ("Invalid GPE\n");
return;
}
- AcpiEvGpeDispatch (GpeEventInfo);
-
+ AcpiEvGpeDispatch (GpeEventInfo, GpeNumber);
}
#endif /* ACPI_DEBUGGER */
diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c
index 2f74d1f..11f6930 100644
--- a/sys/contrib/dev/acpica/dbdisply.c
+++ b/sys/contrib/dev/acpica/dbdisply.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
- * $Revision: 89 $
+ * $Revision: 95 $
*
******************************************************************************/
@@ -122,6 +122,7 @@
#include "acparser.h"
#include "acinterp.h"
#include "acdebug.h"
+#include "acdisasm.h"
#ifdef ACPI_DEBUGGER
@@ -388,272 +389,6 @@ DumpNte:
/*******************************************************************************
*
- * FUNCTION: AcpiDbDecodeInternalObject
- *
- * PARAMETERS: ObjDesc - Object to be displayed
- *
- * RETURN: None
- *
- * DESCRIPTION: Short display of an internal object. Numbers and Strings.
- *
- ******************************************************************************/
-
-void
-AcpiDbDecodeInternalObject (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- UINT32 i;
-
-
- if (!ObjDesc)
- {
- AcpiOsPrintf (" Uninitialized");
- return;
- }
-
- if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
- {
- AcpiOsPrintf (" %p", ObjDesc);
- return;
- }
-
- AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
-
- switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
- {
- case ACPI_TYPE_INTEGER:
-
- AcpiOsPrintf (" %8.8X%8.8X", ACPI_HIDWORD (ObjDesc->Integer.Value),
- ACPI_LODWORD (ObjDesc->Integer.Value));
- break;
-
-
- case ACPI_TYPE_STRING:
-
- AcpiOsPrintf ("(%d) \"%.24s",
- ObjDesc->String.Length, ObjDesc->String.Pointer);
-
- if (ObjDesc->String.Length > 24)
- {
- AcpiOsPrintf ("...");
- }
- else
- {
- AcpiOsPrintf ("\"");
- }
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length);
- for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
- {
- AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
- }
- break;
-
-
- default:
-
- AcpiOsPrintf (" %p", ObjDesc);
- break;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbDecodeNode
- *
- * PARAMETERS: Node - Object to be displayed
- *
- * RETURN: None
- *
- * DESCRIPTION: Short display of a namespace node
- *
- ******************************************************************************/
-
-void
-AcpiDbDecodeNode (
- ACPI_NAMESPACE_NODE *Node)
-{
-
-
- AcpiOsPrintf ("<Node> Name %4.4s",
- Node->Name.Ascii);
-
- if (Node->Flags & ANOBJ_METHOD_ARG)
- {
- AcpiOsPrintf (" [Method Arg]");
- }
- if (Node->Flags & ANOBJ_METHOD_LOCAL)
- {
- AcpiOsPrintf (" [Method Local]");
- }
-
- AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbDisplayInternalObject
- *
- * PARAMETERS: ObjDesc - Object to be displayed
- * WalkState - Current walk state
- *
- * RETURN: None
- *
- * DESCRIPTION: Short display of an internal object
- *
- ******************************************************************************/
-
-void
-AcpiDbDisplayInternalObject (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_WALK_STATE *WalkState)
-{
- UINT8 Type;
-
-
- AcpiOsPrintf ("%p ", ObjDesc);
-
- if (!ObjDesc)
- {
- AcpiOsPrintf ("<NullObj>\n");
- return;
- }
-
- /* Decode the object type */
-
- switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
- {
- case ACPI_DESC_TYPE_PARSER:
-
- AcpiOsPrintf ("<Parser> ");
- break;
-
-
- case ACPI_DESC_TYPE_NAMED:
-
- AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc);
- break;
-
-
- case ACPI_DESC_TYPE_OPERAND:
-
- Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
- if (Type > ACPI_TYPE_LOCAL_MAX)
- {
- AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type);
- return;
- }
-
- /* Decode the ACPI object type */
-
- switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
- {
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- switch (ObjDesc->Reference.Opcode)
- {
- case AML_LOCAL_OP:
-
- AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset);
- if (WalkState)
- {
- ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object;
- AcpiOsPrintf ("%p", ObjDesc);
- AcpiDbDecodeInternalObject (ObjDesc);
- }
- break;
-
-
- case AML_ARG_OP:
-
- AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset);
- if (WalkState)
- {
- ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object;
- AcpiOsPrintf ("%p", ObjDesc);
- AcpiDbDecodeInternalObject (ObjDesc);
- }
- break;
-
-
- case AML_DEBUG_OP:
-
- AcpiOsPrintf ("[Debug] ");
- break;
-
-
- case AML_INDEX_OP:
-
- AcpiOsPrintf ("[Index] ");
- if (!ObjDesc->Reference.Where)
- {
- AcpiOsPrintf ("Uninitialized WHERE ptr");
- }
- else
- {
- AcpiDbDecodeInternalObject (*(ObjDesc->Reference.Where));
- }
- break;
-
-
- case AML_REF_OF_OP:
-
- AcpiOsPrintf ("[RefOf] ");
-
- /* Reference can be to a Node or an Operand object */
-
- switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object))
- {
- case ACPI_DESC_TYPE_NAMED:
- AcpiDbDecodeNode (ObjDesc->Reference.Object);
- break;
-
- case ACPI_DESC_TYPE_OPERAND:
- AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
- break;
-
- default:
- break;
- }
- break;
-
-
- default:
-
- AcpiOsPrintf ("Unknown Reference opcode %X\n",
- ObjDesc->Reference.Opcode);
- break;
- }
- break;
-
- default:
-
- AcpiOsPrintf ("<Obj> ");
- AcpiOsPrintf (" ");
- AcpiDbDecodeInternalObject (ObjDesc);
- break;
- }
- break;
-
-
- default:
-
- AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> ");
- break;
- }
-
- AcpiOsPrintf ("\n");
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDbDisplayMethodInfo
*
* PARAMETERS: StartOp - Root of the control method parse tree
@@ -778,10 +513,7 @@ AcpiDbDisplayMethodInfo (
void
AcpiDbDisplayLocals (void)
{
- UINT32 i;
ACPI_WALK_STATE *WalkState;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *Node;
WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
@@ -791,22 +523,7 @@ AcpiDbDisplayLocals (void)
return;
}
- ObjDesc = WalkState->MethodDesc;
- Node = WalkState->MethodNode;
- if (!Node)
- {
- AcpiOsPrintf ("No method node (Executing subtree for buffer or opregion)\n");
- return;
- }
-
- AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", Node->Name.Ascii);
-
- for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
- {
- ObjDesc = WalkState->LocalVariables[i].Object;
- AcpiOsPrintf ("Local%d: ", i);
- AcpiDbDisplayInternalObject (ObjDesc, WalkState);
- }
+ AcpiDmDisplayLocals (WalkState);
}
@@ -825,12 +542,7 @@ AcpiDbDisplayLocals (void)
void
AcpiDbDisplayArguments (void)
{
- UINT32 i;
ACPI_WALK_STATE *WalkState;
- ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 NumArgs;
- UINT32 Concurrency;
- ACPI_NAMESPACE_NODE *Node;
WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
@@ -840,26 +552,7 @@ AcpiDbDisplayArguments (void)
return;
}
- ObjDesc = WalkState->MethodDesc;
- Node = WalkState->MethodNode;
- if (!Node)
- {
- AcpiOsPrintf ("No method node (Executing subtree for buffer or opregion)\n");
- return;
- }
-
- NumArgs = ObjDesc->Method.ParamCount;
- Concurrency = ObjDesc->Method.Concurrency;
-
- AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n",
- Node->Name.Ascii, NumArgs, Concurrency);
-
- for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
- {
- ObjDesc = WalkState->Arguments[i].Object;
- AcpiOsPrintf ("Arg%d: ", i);
- AcpiDbDisplayInternalObject (ObjDesc, WalkState);
- }
+ AcpiDmDisplayArguments (WalkState);
}
@@ -907,7 +600,7 @@ AcpiDbDisplayResults (void)
{
ObjDesc = WalkState->Results->Results.ObjDesc[i];
AcpiOsPrintf ("Result%d: ", i);
- AcpiDbDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
}
}
@@ -954,6 +647,59 @@ AcpiDbDisplayCallingTree (void)
/*******************************************************************************
*
+ * FUNCTION: AcpiDbDisplayObjectType
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display current calling tree of nested control methods
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayObjectType (
+ char *ObjectArg)
+{
+ ACPI_HANDLE Handle;
+ ACPI_BUFFER Buffer;
+ ACPI_DEVICE_INFO *Info;
+ ACPI_STATUS Status;
+ ACPI_NATIVE_UINT i;
+
+
+ Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ Status = AcpiGetObjectInfo (Handle, &Buffer);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info = Buffer.Pointer;
+ AcpiOsPrintf ("HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n",
+ &Info->HardwareId,
+ ACPI_HIDWORD (Info->Address), ACPI_LODWORD (Info->Address),
+ Info->CurrentStatus);
+
+ if (Info->Valid & ACPI_VALID_CID)
+ {
+ for (i = 0; i < Info->CompatibilityId.Count; i++)
+ {
+ AcpiOsPrintf ("CID #%d: %s\n", i, &Info->CompatibilityId.Id[i]);
+ }
+ }
+
+ ACPI_MEM_FREE (Info);
+ }
+ else
+ {
+ AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
+ }
+
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDbDisplayResultObject
*
* PARAMETERS: ObjDesc - Object to be displayed
@@ -983,7 +729,7 @@ AcpiDbDisplayResultObject (
}
AcpiOsPrintf ("ResultObj: ");
- AcpiDbDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
AcpiOsPrintf ("\n");
}
@@ -1013,7 +759,7 @@ AcpiDbDisplayArgumentObject (
}
AcpiOsPrintf ("ArgObj: ");
- AcpiDbDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
}
@@ -1033,21 +779,28 @@ void
AcpiDbDisplayGpes (void)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
UINT32 i = 0;
- GpeBlock = AcpiGbl_GpeBlockListHead;
- while (GpeBlock)
+ GpeXruptInfo = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptInfo)
{
- AcpiOsPrintf ("Block %d - %p\n", i, GpeBlock);
- AcpiOsPrintf (" Registers: %d\n", GpeBlock->RegisterCount);
- AcpiOsPrintf (" GPE range: %d to %d\n", GpeBlock->BlockBaseNumber,
- GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8) -1);
- AcpiOsPrintf (" RegisterInfo: %p\n", GpeBlock->RegisterInfo);
- AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
- i++;
-
- GpeBlock = GpeBlock->Next;
+ GpeBlock = GpeXruptInfo->GpeBlockListHead;
+ while (GpeBlock)
+ {
+ AcpiOsPrintf ("Block %d - %p\n", i, GpeBlock);
+ AcpiOsPrintf (" Registers: %d\n", GpeBlock->RegisterCount);
+ AcpiOsPrintf (" GPE range: %d to %d\n", GpeBlock->BlockBaseNumber,
+ GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8) -1);
+ AcpiOsPrintf (" RegisterInfo: %p\n", GpeBlock->RegisterInfo);
+ AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
+ i++;
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+ GpeXruptInfo = GpeXruptInfo->Next;
}
}
diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c
index 505496e..309fe78 100644
--- a/sys/contrib/dev/acpica/dbexec.c
+++ b/sys/contrib/dev/acpica/dbexec.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
- * $Revision: 53 $
+ * $Revision: 54 $
*
******************************************************************************/
@@ -466,16 +466,35 @@ AcpiDbMethodThread (
for (i = 0; i < Info->NumLoops; i++)
{
+#if 0
+ if (i == 0xEFDC)
+ {
+ AcpiDbgLevel = 0x00FFFFFF;
+ }
+#endif
+
Status = AcpiDbExecuteMethod (Info, &ReturnObj);
- if (ACPI_SUCCESS (Status))
+
+ if (ACPI_FAILURE (Status))
{
- if (ReturnObj.Length)
- {
- AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n",
- Info->Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length);
- AcpiDbDumpObject (ReturnObj.Pointer, 1);
- }
+ AcpiOsPrintf ("%s During execution of %s at iteration %X\n",
+ AcpiFormatException (Status), Info->Pathname, i);
+ break;
}
+
+ if ((i % 1000) == 0)
+ {
+ AcpiOsPrintf ("%d executions\n", i);
+ }
+
+#if 0
+ if (ReturnObj.Length)
+ {
+ AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n",
+ Info->Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length);
+ AcpiDbDumpObject (ReturnObj.Pointer, 1);
+ }
+#endif
}
/* Signal our completion */
diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c
index 11c0206..a0dd713 100644
--- a/sys/contrib/dev/acpica/dbfileio.c
+++ b/sys/contrib/dev/acpica/dbfileio.c
@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 72 $
+ * $Revision: 74 $
*
******************************************************************************/
@@ -206,6 +206,76 @@ AcpiDbOpenDebugFile (
#ifdef ACPI_APPLICATION
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbCheckTextModeCorruption
+ *
+ * PARAMETERS: Table - Table buffer
+ * TableLength - Length of table from the table header
+ * FileLength - Length of the file that contains the table
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check table for text mode file corruption where all linefeed
+ * characters (LF) have been replaced by carriage return linefeed
+ * pairs (CR/LF).
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbCheckTextModeCorruption (
+ UINT8 *Table,
+ UINT32 TableLength,
+ UINT32 FileLength)
+{
+ UINT32 i;
+ UINT32 Pairs = 0;
+
+
+ if (TableLength != FileLength)
+ {
+ ACPI_REPORT_WARNING (("File length (0x%X) is not the same as the table length (0x%X)\n",
+ FileLength, TableLength));
+ }
+
+ /* Scan entire table to determine if each LF has been prefixed with a CR */
+
+ for (i = 1; i < FileLength; i++)
+ {
+ if (Table[i] == 0x0A)
+ {
+ if (Table[i - 1] != 0x0D)
+ {
+ /* the LF does not have a preceeding CR, table is not corrupted */
+
+ return (AE_OK);
+ }
+ else
+ {
+ /* Found a CR/LF pair */
+
+ Pairs++;
+ }
+ i++;
+ }
+ }
+
+ /*
+ * Entire table scanned, each CR is part of a CR/LF pair --
+ * meaning that the table was treated as a text file somewhere.
+ *
+ * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the
+ * original table are left untouched by the text conversion process --
+ * meaning that we cannot simply replace CR/LF pairs with LFs.
+ */
+ AcpiOsPrintf ("Table has been corrupted by text mode conversion\n");
+ AcpiOsPrintf ("All LFs (%d) were changed to CR/LF pairs\n", Pairs);
+ AcpiOsPrintf ("Table cannot be repaired!\n");
+ return (AE_BAD_VALUE);
+}
+
+
/*******************************************************************************
*
* FUNCTION: AcpiDbReadTable
@@ -227,11 +297,14 @@ AcpiDbReadTable (
UINT32 *TableLength)
{
ACPI_TABLE_HEADER TableHeader;
- UINT8 *AmlStart;
- UINT32 AmlLength;
UINT32 Actual;
ACPI_STATUS Status;
+ UINT32 FileSize;
+
+ fseek (fp, 0, SEEK_END);
+ FileSize = ftell (fp);
+ fseek (fp, 0, SEEK_SET);
/* Read the table header */
@@ -265,7 +338,7 @@ AcpiDbReadTable (
/* Allocate a buffer for the table */
*TableLength = TableHeader.Length;
- *Table = AcpiOsAllocate ((size_t) *TableLength);
+ *Table = AcpiOsAllocate ((size_t) (FileSize));
if (!*Table)
{
AcpiOsPrintf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n",
@@ -273,27 +346,29 @@ AcpiDbReadTable (
return (AE_NO_MEMORY);
}
- AmlStart = (UINT8 *) *Table + sizeof (TableHeader);
- AmlLength = *TableLength - sizeof (TableHeader);
-
- /* Copy the header to the buffer */
-
- ACPI_MEMCPY (*Table, &TableHeader, sizeof (TableHeader));
-
/* Get the rest of the table */
- Actual = fread (AmlStart, 1, (size_t) AmlLength, fp);
- if (Actual == AmlLength)
+ fseek (fp, 0, SEEK_SET);
+ Actual = fread (*Table, 1, (size_t) FileSize, fp);
+ if (Actual == FileSize)
{
/* Now validate the checksum */
Status = AcpiTbVerifyTableChecksum (*Table);
+
+ if (Status == AE_BAD_CHECKSUM)
+ {
+ Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,
+ FileSize, (*Table)->Length);
+ return (Status);
+ }
return (AE_OK);
}
if (Actual > 0)
{
- AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n", AmlLength, Actual);
+ AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n",
+ FileSize, Actual);
return (AE_OK);
}
@@ -364,7 +439,7 @@ AeLocalLoadTable (
{
/* Uninstall table and free the buffer */
- AcpiTbDeleteAcpiTable (ACPI_TABLE_DSDT);
+ AcpiTbDeleteTablesByType (ACPI_TABLE_DSDT);
return_ACPI_STATUS (Status);
}
#endif
diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c
index 546a09f..66c4c08 100644
--- a/sys/contrib/dev/acpica/dbinput.c
+++ b/sys/contrib/dev/acpica/dbinput.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 96 $
+ * $Revision: 97 $
*
******************************************************************************/
@@ -181,6 +181,7 @@ enum AcpiExDebuggerCommands
CMD_TERMINATE,
CMD_THREADS,
CMD_TREE,
+ CMD_TYPE,
CMD_UNLOAD
};
@@ -238,6 +239,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"TERMINATE", 0},
{"THREADS", 3},
{"TREE", 0},
+ {"TYPE", 1},
{"UNLOAD", 1},
{NULL, 0}
};
@@ -801,6 +803,10 @@ AcpiDbCommandDispatch (
AcpiDbDisplayCallingTree ();
break;
+ case CMD_TYPE:
+ AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
+ break;
+
case CMD_UNLOAD:
AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
break;
diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c
index cf6c531..68c68df 100644
--- a/sys/contrib/dev/acpica/dbstats.c
+++ b/sys/contrib/dev/acpica/dbstats.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
- * $Revision: 66 $
+ * $Revision: 68 $
*
******************************************************************************/
@@ -202,9 +202,9 @@ AcpiDbEnumerateObject (
case ACPI_TYPE_DEVICE:
- AcpiDbEnumerateObject (ObjDesc->Device.SysHandler);
- AcpiDbEnumerateObject (ObjDesc->Device.DrvHandler);
- AcpiDbEnumerateObject (ObjDesc->Device.AddrHandler);
+ AcpiDbEnumerateObject (ObjDesc->Device.SystemNotify);
+ AcpiDbEnumerateObject (ObjDesc->Device.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->Device.AddressSpace);
break;
case ACPI_TYPE_BUFFER_FIELD:
@@ -218,27 +218,27 @@ AcpiDbEnumerateObject (
case ACPI_TYPE_REGION:
AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++;
- AcpiDbEnumerateObject (ObjDesc->Region.AddrHandler);
+ AcpiDbEnumerateObject (ObjDesc->Region.AddressSpace);
break;
case ACPI_TYPE_POWER:
- AcpiDbEnumerateObject (ObjDesc->PowerResource.SysHandler);
- AcpiDbEnumerateObject (ObjDesc->PowerResource.DrvHandler);
+ AcpiDbEnumerateObject (ObjDesc->PowerResource.SystemNotify);
+ AcpiDbEnumerateObject (ObjDesc->PowerResource.DeviceNotify);
break;
case ACPI_TYPE_PROCESSOR:
- AcpiDbEnumerateObject (ObjDesc->Processor.SysHandler);
- AcpiDbEnumerateObject (ObjDesc->Processor.DrvHandler);
- AcpiDbEnumerateObject (ObjDesc->Processor.AddrHandler);
+ AcpiDbEnumerateObject (ObjDesc->Processor.SystemNotify);
+ AcpiDbEnumerateObject (ObjDesc->Processor.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->Processor.AddressSpace);
break;
case ACPI_TYPE_THERMAL:
- AcpiDbEnumerateObject (ObjDesc->ThermalZone.SysHandler);
- AcpiDbEnumerateObject (ObjDesc->ThermalZone.DrvHandler);
- AcpiDbEnumerateObject (ObjDesc->ThermalZone.AddrHandler);
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.SystemNotify);
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.DeviceNotify);
+ AcpiDbEnumerateObject (ObjDesc->ThermalZone.AddressSpace);
break;
default:
@@ -488,9 +488,9 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("\n");
AcpiOsPrintf ("Mutex usage:\n\n");
- for (i = 0; i < NUM_MTX; i++)
+ for (i = 0; i < NUM_MUTEX; i++)
{
- AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_AcpiMutexInfo[i].UseCount);
+ AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
}
break;
@@ -517,8 +517,8 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
- AcpiOsPrintf ("NotifyHandler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
- AcpiOsPrintf ("AddrHandler %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
+ AcpiOsPrintf ("Notify %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
+ AcpiOsPrintf ("AddressSpace %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
AcpiOsPrintf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA));
AcpiOsPrintf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA));
diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/dbutils.c
index 3fa3eb0..70c84fa 100644
--- a/sys/contrib/dev/acpica/dbutils.c
+++ b/sys/contrib/dev/acpica/dbutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
- * $Revision: 61 $
+ * $Revision: 64 $
*
******************************************************************************/
@@ -220,7 +220,8 @@ AcpiDbDumpBuffer (
AcpiOsPrintf ("\nLocation %X:\n", Address);
AcpiDbgLevel |= ACPI_LV_TABLES;
- AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+ AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY,
+ ACPI_UINT32_MAX);
}
@@ -288,7 +289,8 @@ AcpiDbDumpObject (
AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
if (ObjDesc->Buffer.Length)
{
- AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
+ AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer,
+ ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
}
else
{
@@ -299,7 +301,8 @@ AcpiDbDumpObject (
case ACPI_TYPE_PACKAGE:
- AcpiOsPrintf ("[Package] Contains %d Elements: \n", ObjDesc->Package.Count);
+ AcpiOsPrintf ("[Package] Contains %d Elements: \n",
+ ObjDesc->Package.Count);
for (i = 0; i < ObjDesc->Package.Count; i++)
{
@@ -427,8 +430,7 @@ AcpiDbSecondPassParse (
/* Create a new walk state for the parse */
- WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
- NULL, NULL, NULL);
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
return (AE_NO_MEMORY);
@@ -522,10 +524,11 @@ AcpiDbLocalNsLookup (
* (Uses root node as the search starting point)
*/
Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
- ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could not locate name: %s %s\n", Name, AcpiFormatException (Status));
+ AcpiOsPrintf ("Could not locate name: %s %s\n",
+ Name, AcpiFormatException (Status));
}
ACPI_MEM_FREE (InternalPath);
diff --git a/sys/contrib/dev/acpica/dmbuffer.c b/sys/contrib/dev/acpica/dmbuffer.c
index 5d734c4..e78b6ce 100644
--- a/sys/contrib/dev/acpica/dmbuffer.c
+++ b/sys/contrib/dev/acpica/dmbuffer.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmbuffer - AML disassembler, buffer and string support
- * $Revision: 10 $
+ * $Revision: 12 $
*
******************************************************************************/
@@ -205,7 +205,7 @@ AcpiDmByteList (
ByteData = Op->Named.Data;
- ByteCount = Op->Common.Value.Integer32;
+ ByteCount = (UINT32) Op->Common.Value.Integer;
/*
* The byte list belongs to a buffer, and can be produced by either
@@ -282,7 +282,7 @@ AcpiDmIsUnicodeBuffer (
/* Extract the byte list info */
ByteData = NextOp->Named.Data;
- ByteCount = NextOp->Common.Value.Integer32;
+ ByteCount = (UINT32) NextOp->Common.Value.Integer;
WordCount = ACPI_DIV_2 (ByteCount);
/*
@@ -353,7 +353,7 @@ AcpiDmIsStringBuffer (
/* Extract the byte list info */
ByteData = NextOp->Named.Data;
- ByteCount = NextOp->Common.Value.Integer32;
+ ByteCount = (UINT32) NextOp->Common.Value.Integer;
/* Last byte must be the null terminator */
@@ -405,7 +405,7 @@ AcpiDmUnicode (
/* Extract the buffer info as a WORD buffer */
WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
- WordCount = ACPI_DIV_2 (Op->Common.Value.Integer32);
+ WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
AcpiOsPrintf ("\"");
@@ -454,7 +454,7 @@ AcpiIsEisaId (
/* We are looking for _HID */
- if (ACPI_STRNCMP ((char *) &Name, "_HID", 4))
+ if (ACPI_STRNCMP ((char *) &Name, METHOD_NAME__HID, 4))
{
return;
}
@@ -470,7 +470,7 @@ AcpiIsEisaId (
/* Swap from little-endian to big-endian to simplify conversion */
- BigEndianId = AcpiUtDwordByteSwap (NextOp->Common.Value.Integer32);
+ BigEndianId = AcpiUtDwordByteSwap ((UINT32) NextOp->Common.Value.Integer);
/* Create the 3 leading ASCII letters */
diff --git a/sys/contrib/dev/acpica/dmobject.c b/sys/contrib/dev/acpica/dmobject.c
new file mode 100644
index 0000000..692e7c6
--- /dev/null
+++ b/sys/contrib/dev/acpica/dmobject.c
@@ -0,0 +1,580 @@
+/*******************************************************************************
+ *
+ * Module Name: dmobject - ACPI object decode and display
+ * $Revision: 1 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include "acpi.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acdisasm.h"
+
+
+#ifdef ACPI_DISASSEMBLER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dmnames")
+
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpMethodInfo
+ *
+ * PARAMETERS: Status - Method execution status
+ * WalkState - Current state of the parse tree walk
+ * Op - Executing parse op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Called when a method has been aborted because of an error.
+ * Dumps the method execution stack, and the method locals/args,
+ * and disassembles the AML opcode that failed.
+ *
+ ****************************************************************************/
+
+void
+AcpiDmDumpMethodInfo (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+ ACPI_THREAD_STATE *Thread;
+ ACPI_WALK_STATE *NextWalkState;
+ ACPI_NAMESPACE_NODE *PreviousMethod = NULL;
+
+
+ /* Ignore control codes, they are not errors */
+
+ if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL)
+ {
+ return;
+ }
+
+ /* Display exception and method name */
+
+ AcpiOsPrintf ("\n**** Exception %s during execution of method ",
+ AcpiFormatException (Status));
+ AcpiNsPrintNodePathname (WalkState->MethodNode, NULL);
+
+ /* Display stack of executing methods */
+
+ AcpiOsPrintf ("\n\nMethod Execution Stack:\n");
+ Thread = WalkState->Thread;
+ NextWalkState = Thread->WalkStateList;
+
+ /* Walk list of linked walk states */
+
+ while (NextWalkState)
+ {
+ AcpiOsPrintf (" Method [%4.4s] executing: ",
+ NextWalkState->MethodNode->Name.Ascii);
+
+ /* First method is the currently executing method */
+
+ if (NextWalkState == WalkState)
+ {
+ /* Display currently executing ASL statement */
+
+ Next = Op->Common.Next;
+ Op->Common.Next = NULL;
+
+ AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
+ Op->Common.Next = Next;
+ }
+ else
+ {
+ /*
+ * This method has called another method
+ * NOTE: the method call parse subtree is already deleted at this
+ * point, so we cannot disassemble the method invocation.
+ */
+ AcpiOsPrintf ("Call to method ");
+ AcpiNsPrintNodePathname (PreviousMethod, NULL);
+ }
+
+ PreviousMethod = NextWalkState->MethodNode;
+ NextWalkState = NextWalkState->Next;
+ AcpiOsPrintf ("\n");
+ }
+
+ /* Display the method locals and arguments */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDisplayLocals (WalkState);
+ AcpiOsPrintf ("\n");
+ AcpiDmDisplayArguments (WalkState);
+ AcpiOsPrintf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDecodeInternalObject
+ *
+ * PARAMETERS: ObjDesc - Object to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Short display of an internal object. Numbers and Strings.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDecodeInternalObject (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ UINT32 i;
+
+
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf (" Uninitialized");
+ return;
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
+ {
+ AcpiOsPrintf (" %p", ObjDesc);
+ return;
+ }
+
+ AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ AcpiOsPrintf (" %8.8X%8.8X", ACPI_HIDWORD (ObjDesc->Integer.Value),
+ ACPI_LODWORD (ObjDesc->Integer.Value));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ AcpiOsPrintf ("(%d) \"%.24s",
+ ObjDesc->String.Length, ObjDesc->String.Pointer);
+
+ if (ObjDesc->String.Length > 24)
+ {
+ AcpiOsPrintf ("...");
+ }
+ else
+ {
+ AcpiOsPrintf ("\"");
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length);
+ for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
+ {
+ AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
+ }
+ break;
+
+
+ default:
+
+ AcpiOsPrintf (" %p", ObjDesc);
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDecodeNode
+ *
+ * PARAMETERS: Node - Object to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Short display of a namespace node
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDecodeNode (
+ ACPI_NAMESPACE_NODE *Node)
+{
+
+
+ AcpiOsPrintf ("<Node> Name %4.4s",
+ Node->Name.Ascii);
+
+ if (Node->Flags & ANOBJ_METHOD_ARG)
+ {
+ AcpiOsPrintf (" [Method Arg]");
+ }
+ if (Node->Flags & ANOBJ_METHOD_LOCAL)
+ {
+ AcpiOsPrintf (" [Method Local]");
+ }
+
+ AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisplayInternalObject
+ *
+ * PARAMETERS: ObjDesc - Object to be displayed
+ * WalkState - Current walk state
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Short display of an internal object
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisplayInternalObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT8 Type;
+
+
+ AcpiOsPrintf ("%p ", ObjDesc);
+
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf ("<NullObj>\n");
+ return;
+ }
+
+ /* Decode the object type */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
+ {
+ case ACPI_DESC_TYPE_PARSER:
+
+ AcpiOsPrintf ("<Parser> ");
+ break;
+
+
+ case ACPI_DESC_TYPE_NAMED:
+
+ AcpiDmDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc);
+ break;
+
+
+ case ACPI_DESC_TYPE_OPERAND:
+
+ Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
+ if (Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type);
+ return;
+ }
+
+ /* Decode the ACPI object type */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ switch (ObjDesc->Reference.Opcode)
+ {
+ case AML_LOCAL_OP:
+
+ AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset);
+ if (WalkState)
+ {
+ ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object;
+ AcpiOsPrintf ("%p", ObjDesc);
+ AcpiDmDecodeInternalObject (ObjDesc);
+ }
+ break;
+
+
+ case AML_ARG_OP:
+
+ AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset);
+ if (WalkState)
+ {
+ ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object;
+ AcpiOsPrintf ("%p", ObjDesc);
+ AcpiDmDecodeInternalObject (ObjDesc);
+ }
+ break;
+
+
+ case AML_DEBUG_OP:
+
+ AcpiOsPrintf ("[Debug] ");
+ break;
+
+
+ case AML_INDEX_OP:
+
+ AcpiOsPrintf ("[Index] ");
+ if (!ObjDesc->Reference.Where)
+ {
+ AcpiOsPrintf ("Uninitialized WHERE ptr");
+ }
+ else
+ {
+ AcpiDmDecodeInternalObject (*(ObjDesc->Reference.Where));
+ }
+ break;
+
+
+ case AML_REF_OF_OP:
+
+ AcpiOsPrintf ("[RefOf] ");
+
+ /* Reference can be to a Node or an Operand object */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object))
+ {
+ case ACPI_DESC_TYPE_NAMED:
+ AcpiDmDecodeNode (ObjDesc->Reference.Object);
+ break;
+
+ case ACPI_DESC_TYPE_OPERAND:
+ AcpiDmDecodeInternalObject (ObjDesc->Reference.Object);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+
+ default:
+
+ AcpiOsPrintf ("Unknown Reference opcode %X\n",
+ ObjDesc->Reference.Opcode);
+ break;
+ }
+ break;
+
+ default:
+
+ AcpiOsPrintf ("<Obj> ");
+ AcpiOsPrintf (" ");
+ AcpiDmDecodeInternalObject (ObjDesc);
+ break;
+ }
+ break;
+
+
+ default:
+
+ AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> ");
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisplayLocals
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display all locals for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisplayLocals (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ObjDesc = WalkState->MethodDesc;
+ Node = WalkState->MethodNode;
+ if (!Node)
+ {
+ AcpiOsPrintf ("No method node (Executing subtree for buffer or opregion)\n");
+ return;
+ }
+
+ AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", Node->Name.Ascii);
+
+ for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
+ {
+ ObjDesc = WalkState->LocalVariables[i].Object;
+ AcpiOsPrintf (" Local%X: ", i);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDisplayArguments
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display all arguments for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDisplayArguments (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ UINT32 NumArgs;
+ UINT32 Concurrency;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ObjDesc = WalkState->MethodDesc;
+ Node = WalkState->MethodNode;
+ if (!Node)
+ {
+ AcpiOsPrintf ("No method node (Executing subtree for buffer or opregion)\n");
+ return;
+ }
+
+ NumArgs = ObjDesc->Method.ParamCount;
+ Concurrency = ObjDesc->Method.Concurrency;
+
+ AcpiOsPrintf ("Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n",
+ Node->Name.Ascii, NumArgs, Concurrency);
+
+ for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
+ {
+ ObjDesc = WalkState->Arguments[i].Object;
+ AcpiOsPrintf (" Arg%d: ", i);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ }
+}
+
+#endif
+
+
+
+
+
+
diff --git a/sys/contrib/dev/acpica/dmopcode.c b/sys/contrib/dev/acpica/dmopcode.c
index 4059848..3b6b6f1 100644
--- a/sys/contrib/dev/acpica/dmopcode.c
+++ b/sys/contrib/dev/acpica/dmopcode.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmopcode - AML disassembler, specific AML opcodes
- * $Revision: 81 $
+ * $Revision: 84 $
*
******************************************************************************/
@@ -118,7 +118,6 @@
#include "acparser.h"
#include "amlcode.h"
#include "acdisasm.h"
-#include "acdebug.h"
#ifdef ACPI_DISASSEMBLER
@@ -149,7 +148,7 @@ AcpiDmMethodFlags (
/* The next Op contains the flags */
Op = AcpiPsGetDepthNext (NULL, Op);
- Flags = Op->Common.Value.Integer8;
+ Flags = (UINT8) Op->Common.Value.Integer;
Args = Flags & 0x07;
/* Mark the Op as completed */
@@ -200,7 +199,7 @@ AcpiDmFieldFlags (
/* The next Op contains the flags */
Op = AcpiPsGetDepthNext (NULL, Op);
- Flags = Op->Common.Value.Integer8;
+ Flags = (UINT8) Op->Common.Value.Integer;
/* Mark the Op as completed */
@@ -274,7 +273,7 @@ AcpiDmRegionFlags (
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
AcpiOsPrintf (", ");
- AcpiDmAddressSpace (Op->Common.Value.Integer8);
+ AcpiDmAddressSpace ((UINT8) Op->Common.Value.Integer);
}
@@ -335,13 +334,13 @@ AcpiDmMatchKeyword (
{
- if (Op->Common.Value.Integer32 >= ACPI_NUM_MATCH_OPS)
+ if (((UINT32) Op->Common.Value.Integer) >= ACPI_NUM_MATCH_OPS)
{
AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
}
else
{
- AcpiOsPrintf ("%s", (char *) AcpiGbl_MatchOps[Op->Common.Value.Integer32]);
+ AcpiOsPrintf ("%s", (char *) AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]);
}
}
@@ -388,8 +387,7 @@ AcpiDmDisassembleOneOp (
break;
}
-
- /* op and arguments */
+ /* The op and arguments */
switch (Op->Common.AmlOpcode)
{
@@ -419,7 +417,7 @@ AcpiDmDisassembleOneOp (
case AML_BYTE_OP:
- AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer8);
+ AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
break;
@@ -427,11 +425,11 @@ AcpiDmDisassembleOneOp (
if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
{
- AcpiDmEisaId (Op->Common.Value.Integer32);
+ AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
}
else
{
- AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer16);
+ AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer);
}
break;
@@ -440,11 +438,11 @@ AcpiDmDisassembleOneOp (
if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
{
- AcpiDmEisaId (Op->Common.Value.Integer32);
+ AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
}
else
{
- AcpiOsPrintf ("0x%8.8X", Op->Common.Value.Integer32);
+ AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer);
}
break;
@@ -522,10 +520,10 @@ AcpiDmDisassembleOneOp (
case AML_INT_NAMEDFIELD_OP:
Length = AcpiDmDumpName ((char *) &Op->Named.Name);
- AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ", Op->Common.Value.Integer32);
+ AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ", (UINT32) Op->Common.Value.Integer);
AcpiDmCommaIfFieldMember (Op);
- Info->BitOffset += Op->Common.Value.Integer32;
+ Info->BitOffset += (UINT32) Op->Common.Value.Integer;
break;
@@ -533,7 +531,7 @@ AcpiDmDisassembleOneOp (
/* Offset() -- Must account for previous offsets */
- Offset = Op->Common.Value.Integer32;
+ Offset = (UINT32) Op->Common.Value.Integer;
Info->BitOffset += Offset;
if (Info->BitOffset % 8 == 0)
@@ -552,9 +550,9 @@ AcpiDmDisassembleOneOp (
case AML_INT_ACCESSFIELD_OP:
AcpiOsPrintf ("AccessAs (%s, ",
- AcpiGbl_AccessTypes [Op->Common.Value.Integer32 >> 8]);
+ AcpiGbl_AccessTypes [(UINT32) Op->Common.Value.Integer >> 8]);
- AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer32);
+ AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer);
AcpiOsPrintf (")");
AcpiDmCommaIfFieldMember (Op);
break;
@@ -591,7 +589,7 @@ AcpiDmDisassembleOneOp (
(WalkState->Results) &&
(WalkState->Results->Results.NumResults))
{
- AcpiDbDecodeInternalObject (
+ AcpiDmDecodeInternalObject (
WalkState->Results->Results.ObjDesc [WalkState->Results->Results.NumResults-1]);
}
#endif
diff --git a/sys/contrib/dev/acpica/dmresrc.c b/sys/contrib/dev/acpica/dmresrc.c
index 5c8c52f..0fb4cb5 100644
--- a/sys/contrib/dev/acpica/dmresrc.c
+++ b/sys/contrib/dev/acpica/dmresrc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrc.c - Resource Descriptor disassembly
- * $Revision: 7 $
+ * $Revision: 8 $
*
******************************************************************************/
@@ -430,7 +430,7 @@ AcpiDmIsResourceDescriptor (
/* Extract the data pointer and data length */
- ByteCount = NextOp->Common.Value.Integer32;
+ ByteCount = (UINT32) NextOp->Common.Value.Integer;
ByteData = NextOp->Named.Data;
/* The list must have a valid END_TAG */
diff --git a/sys/contrib/dev/acpica/dmwalk.c b/sys/contrib/dev/acpica/dmwalk.c
index d73db16..23dec95 100644
--- a/sys/contrib/dev/acpica/dmwalk.c
+++ b/sys/contrib/dev/acpica/dmwalk.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmwalk - AML disassembly tree walk
- * $Revision: 9 $
+ * $Revision: 10 $
*
******************************************************************************/
@@ -210,9 +210,8 @@ AcpiDmWalkParseTree (
}
else
{
- /*
- * Let the callback process the node.
- */
+ /* Let the callback process the node */
+
Status = DescendingCallback (Op, Info->Level, Context);
if (ACPI_SUCCESS (Status))
{
@@ -477,9 +476,8 @@ AcpiDmDescendingOp (
Info->Level--;
}
- /*
- * Start the opcode argument list if necessary
- */
+ /* Start the opcode argument list if necessary */
+
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
if ((OpInfo->Flags & AML_HAS_ARGS) ||
@@ -492,9 +490,8 @@ AcpiDmDescendingOp (
AcpiOsPrintf (" (");
}
- /*
- * If this is a named opcode, print the associated name value
- */
+ /* If this is a named opcode, print the associated name value */
+
if (OpInfo->Flags & AML_NAMED)
{
switch (Op->Common.AmlOpcode)
diff --git a/sys/contrib/dev/acpica/dsfield.c b/sys/contrib/dev/acpica/dsfield.c
index 58d35c4..aef5bc2 100644
--- a/sys/contrib/dev/acpica/dsfield.c
+++ b/sys/contrib/dev/acpica/dsfield.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
- * $Revision: 71 $
+ * $Revision: 72 $
*
*****************************************************************************/
@@ -335,9 +335,9 @@ AcpiDsGetFieldNames (
* In FieldFlags, preserve the flag bits other than the ACCESS_TYPE bits
*/
Info->FieldFlags = (UINT8) ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
- ((UINT8) (Arg->Common.Value.Integer32 >> 8)));
+ ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8)));
- Info->Attribute = (UINT8) (Arg->Common.Value.Integer32);
+ Info->Attribute = (UINT8) (Arg->Common.Value.Integer);
break;
@@ -449,7 +449,7 @@ AcpiDsCreateField (
/* Second arg is the field flags */
Arg = Arg->Common.Next;
- Info.FieldFlags = Arg->Common.Value.Integer8;
+ Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
Info.Attribute = 0;
/* Each remaining arg is a Named Field */
@@ -610,12 +610,12 @@ AcpiDsCreateBankField (
/* Third arg is the BankValue */
Arg = Arg->Common.Next;
- Info.BankValue = Arg->Common.Value.Integer32;
+ Info.BankValue = (UINT32) Arg->Common.Value.Integer;
/* Fourth arg is the field flags */
Arg = Arg->Common.Next;
- Info.FieldFlags = Arg->Common.Value.Integer8;
+ Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
/* Each remaining arg is a Named Field */
@@ -683,7 +683,7 @@ AcpiDsCreateIndexField (
/* Next arg is the field flags */
Arg = Arg->Common.Next;
- Info.FieldFlags = Arg->Common.Value.Integer8;
+ Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
/* Each remaining arg is a Named Field */
diff --git a/sys/contrib/dev/acpica/dsinit.c b/sys/contrib/dev/acpica/dsinit.c
index 543621b..2045bf2 100644
--- a/sys/contrib/dev/acpica/dsinit.c
+++ b/sys/contrib/dev/acpica/dsinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsinit - Object initialization namespace walk
- * $Revision: 6 $
+ * $Revision: 7 $
*
*****************************************************************************/
@@ -303,8 +303,8 @@ AcpiDsInitializeObjects (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "\nTable [%4.4s] - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
- TableDesc->Pointer->Signature, Info.ObjectCount,
+ "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
+ TableDesc->Pointer->Signature, TableDesc->TableId, Info.ObjectCount,
Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c
index d043121..83968c4 100644
--- a/sys/contrib/dev/acpica/dsmethod.c
+++ b/sys/contrib/dev/acpica/dsmethod.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- * $Revision: 90 $
+ * $Revision: 91 $
*
*****************************************************************************/
diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c
index 61a4fc5..3515957 100644
--- a/sys/contrib/dev/acpica/dsmthdat.c
+++ b/sys/contrib/dev/acpica/dsmthdat.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
- * $Revision: 69 $
+ * $Revision: 71 $
*
******************************************************************************/
@@ -162,8 +162,8 @@ AcpiDsMethodDataInit (
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
{
- ACPI_MOVE_UNALIGNED32_TO_32 (&WalkState->Arguments[i].Name,
- NAMEOF_ARG_NTE);
+ ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name,
+ NAMEOF_ARG_NTE);
WalkState->Arguments[i].Name.Integer |= (i << 24);
WalkState->Arguments[i].Descriptor = ACPI_DESC_TYPE_NAMED;
WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
@@ -174,8 +174,8 @@ AcpiDsMethodDataInit (
for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
{
- ACPI_MOVE_UNALIGNED32_TO_32 (&WalkState->LocalVariables[i].Name,
- NAMEOF_LOCAL_NTE);
+ ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name,
+ NAMEOF_LOCAL_NTE);
WalkState->LocalVariables[i].Name.Integer |= (i << 24);
WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
@@ -392,7 +392,6 @@ AcpiDsMethodDataSetValue (
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
- ACPI_OPERAND_OBJECT *NewDesc = Object;
ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
@@ -411,32 +410,17 @@ AcpiDsMethodDataSetValue (
return_ACPI_STATUS (Status);
}
- /*
- * If the object has just been created and is not attached to anything,
- * (the reference count is 1), then we can just store it directly into
- * the arg/local. Otherwise, we must copy it.
+ /*
+ * Increment ref count so object can't be deleted while installed.
+ * NOTE: We do not copy the object in order to preserve the call by
+ * reference semantics of ACPI Control Method invocation.
+ * (See ACPI Specification 2.0C)
*/
- if (Object->Common.ReferenceCount > 1)
- {
- Status = AcpiUtCopyIobjectToIobject (Object, &NewDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object Copied %p, new %p\n",
- Object, NewDesc));
- }
- else
- {
- /* Increment ref count so object can't be deleted while installed */
-
- AcpiUtAddReference (NewDesc);
- }
+ AcpiUtAddReference (Object);
/* Install the object */
- Node->Object = NewDesc;
+ Node->Object = Object;
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dsobject.c
index aa455c5..0f91fcd 100644
--- a/sys/contrib/dev/acpica/dsobject.c
+++ b/sys/contrib/dev/acpica/dsobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
- * $Revision: 114 $
+ * $Revision: 117 $
*
*****************************************************************************/
@@ -271,7 +271,7 @@ AcpiDsBuildInternalBufferObj (
return (AE_TYPE);
}
- ByteListLength = ByteList->Common.Value.Integer32;
+ ByteListLength = (UINT32) ByteList->Common.Value.Integer;
}
/*
@@ -290,7 +290,8 @@ AcpiDsBuildInternalBufferObj (
if (ObjDesc->Buffer.Length == 0)
{
ObjDesc->Buffer.Pointer = NULL;
- ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Buffer defined with zero length in AML, creating\n"));
}
else
{
diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c
index a2ec1dd..62d14f4 100644
--- a/sys/contrib/dev/acpica/dsopcode.c
+++ b/sys/contrib/dev/acpica/dsopcode.c
@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
- * $Revision: 85 $
+ * $Revision: 87 $
*
*****************************************************************************/
@@ -156,7 +156,7 @@ AcpiDsExecuteArguments (
ACPI_PARSE_OBJECT *Arg;
- ACPI_FUNCTION_TRACE ("AcpiDsExecuteArguments");
+ ACPI_FUNCTION_TRACE ("DsExecuteArguments");
/*
@@ -174,7 +174,7 @@ AcpiDsExecuteArguments (
/* Create and initialize a new parser state */
- WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL);
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -218,7 +218,7 @@ AcpiDsExecuteArguments (
/* Create and initialize a new parser state */
- WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL);
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
return_ACPI_STATUS (AE_NO_MEMORY);
diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c
index 9e80c37..6466788 100644
--- a/sys/contrib/dev/acpica/dswexec.c
+++ b/sys/contrib/dev/acpica/dswexec.c
@@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
- * $Revision: 98 $
+ * $Revision: 103 $
*
*****************************************************************************/
@@ -124,6 +124,7 @@
#include "acinterp.h"
#include "acnamesp.h"
#include "acdebug.h"
+#include "acdisasm.h"
#define _COMPONENT ACPI_DISPATCHER
@@ -763,7 +764,7 @@ Cleanup:
AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
}
-#if _UNDER_DEVELOPMENT
+#ifdef _UNDER_DEVELOPMENT
if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
{
@@ -774,6 +775,17 @@ Cleanup:
/* Always clear the object stack */
WalkState->NumOperands = 0;
+
+#ifdef ACPI_DISASSEMBLER
+
+ /* On error, display method locals/args */
+
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDmDumpMethodInfo (Status, WalkState, Op);
+ }
+#endif
+
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/evevent.c
index 76e8aa2..f2a852f 100644
--- a/sys/contrib/dev/acpica/evevent.c
+++ b/sys/contrib/dev/acpica/evevent.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evevent - Fixed Event handling and dispatch
- * $Revision: 108 $
+ * $Revision: 111 $
*
*****************************************************************************/
@@ -152,9 +152,9 @@ AcpiEvInitialize (
}
/*
- * Initialize the Fixed and General Purpose AcpiEvents prior. This is
- * done prior to enabling SCIs to prevent interrupts from occurring
- * before handers are installed.
+ * Initialize the Fixed and General Purpose Events. This is
+ * done prior to enabling SCIs to prevent interrupts from
+ * occurring before handers are installed.
*/
Status = AcpiEvFixedEventInitialize ();
if (ACPI_FAILURE (Status))
@@ -306,7 +306,7 @@ AcpiEvFixedEventDetect (
(void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &FixedEnable);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
- "Fixed AcpiEvent Block: Enable %08X Status %08X\n",
+ "Fixed Event Block: Enable %08X Status %08X\n",
FixedEnable, FixedStatus));
/*
@@ -366,7 +366,7 @@ AcpiEvFixedEventDispatch (
0, ACPI_MTX_DO_NOT_LOCK);
ACPI_REPORT_ERROR (
- ("EvGpeDispatch: No installed handler for fixed event [%08X]\n",
+ ("No installed handler for fixed event [%08X]\n",
Event));
return (ACPI_INTERRUPT_NOT_HANDLED);
diff --git a/sys/contrib/dev/acpica/evgpe.c b/sys/contrib/dev/acpica/evgpe.c
index d19058c..6f6402d 100644
--- a/sys/contrib/dev/acpica/evgpe.c
+++ b/sys/contrib/dev/acpica/evgpe.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evgpe - General Purpose Event handling and dispatch
- * $Revision: 12 $
+ * $Revision: 27 $
*
*****************************************************************************/
@@ -126,47 +126,68 @@
*
* FUNCTION: AcpiEvGetGpeEventInfo
*
- * PARAMETERS: GpeNumber - Raw GPE number
+ * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1
+ * GpeNumber - Raw GPE number
*
- * RETURN: None.
+ * RETURN: A GPE EventInfo struct. NULL if not a valid GPE
*
- * DESCRIPTION: Returns the EventInfo struct
- * associated with this GPE.
+ * DESCRIPTION: Returns the EventInfo struct associated with this GPE.
+ * Validates the GpeBlock and the GpeNumber
*
- * TBD: this function will go away when full support of GPE block devices
- * is implemented!
+ * Should be called only when the GPE lists are semaphore locked
+ * and not subject to change.
*
******************************************************************************/
ACPI_GPE_EVENT_INFO *
AcpiEvGetGpeEventInfo (
+ ACPI_HANDLE GpeDevice,
UINT32 GpeNumber)
{
+ ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_NATIVE_UINT i;
- /* Examine GPE Block 0 */
+ ACPI_FUNCTION_ENTRY ();
- GpeBlock = AcpiGbl_GpeBlockListHead;
- if (!GpeBlock)
- {
- return (NULL);
- }
- if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
- (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
+ /* A NULL GpeBlock means use the FADT-defined GPE block(s) */
+
+ if (!GpeDevice)
{
- return (&GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]);
- }
+ /* Examine GPE Block 0 and 1 (These blocks are permanent) */
+
+ for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++)
+ {
+ GpeBlock = AcpiGbl_GpeFadtBlocks[i];
+ if (GpeBlock)
+ {
+ if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
+ (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
+ {
+ return (&GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]);
+ }
+ }
+ }
- /* Examine GPE Block 1 */
+ /* The GpeNumber was not in the range of either FADT GPE block */
- GpeBlock = GpeBlock->Next;
- if (!GpeBlock)
+ return (NULL);
+ }
+
+ /*
+ * A Non-null GpeDevice means this is a GPE Block Device.
+ */
+ ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) GpeDevice);
+ if (!ObjDesc ||
+ !ObjDesc->Device.GpeBlock)
{
return (NULL);
}
+ GpeBlock = ObjDesc->Device.GpeBlock;
+
if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
(GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
{
@@ -176,11 +197,13 @@ AcpiEvGetGpeEventInfo (
return (NULL);
}
+
/*******************************************************************************
*
* FUNCTION: AcpiEvGpeDetect
*
- * PARAMETERS: None
+ * PARAMETERS: GpeXruptList - Interrupt block for this interrupt.
+ * Can have multiple GPE blocks attached.
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
@@ -190,17 +213,19 @@ AcpiEvGetGpeEventInfo (
******************************************************************************/
UINT32
-AcpiEvGpeDetect (void)
+AcpiEvGpeDetect (
+ ACPI_GPE_XRUPT_INFO *GpeXruptList)
{
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
- UINT32 i;
- UINT32 j;
UINT8 EnabledStatusByte;
UINT8 BitMask;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT32 InValue;
ACPI_STATUS Status;
ACPI_GPE_BLOCK_INFO *GpeBlock;
+ UINT32 GpeNumber;
+ UINT32 i;
+ UINT32 j;
ACPI_FUNCTION_NAME ("EvGpeDetect");
@@ -208,7 +233,8 @@ AcpiEvGpeDetect (void)
/* Examine all GPE blocks attached to this interrupt level */
- GpeBlock = AcpiGbl_GpeBlockListHead;
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_ISR);
+ GpeBlock = GpeXruptList->GpeBlockListHead;
while (GpeBlock)
{
/*
@@ -222,28 +248,34 @@ AcpiEvGpeDetect (void)
GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
+ /* Read the Status Register */
+
Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &InValue,
- &GpeRegisterInfo->StatusAddress, 0);
+ &GpeRegisterInfo->StatusAddress);
GpeRegisterInfo->Status = (UINT8) InValue;
if (ACPI_FAILURE (Status))
{
- return (ACPI_INTERRUPT_NOT_HANDLED);
+ goto UnlockAndExit;
}
+ /* Read the Enable Register */
+
Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &InValue,
- &GpeRegisterInfo->EnableAddress, 0);
+ &GpeRegisterInfo->EnableAddress);
GpeRegisterInfo->Enable = (UINT8) InValue;
if (ACPI_FAILURE (Status))
{
- return (ACPI_INTERRUPT_NOT_HANDLED);
+ goto UnlockAndExit;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
- "GPE block at %8.8X%8.8X - Values: Enable %02X Status %02X\n",
+ "GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n",
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)),
+ GpeRegisterInfo->Status,
ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)),
- GpeRegisterInfo->Enable,
- GpeRegisterInfo->Status));
+ GpeRegisterInfo->Enable));
/* First check if there is anything active at all in this register */
@@ -268,8 +300,11 @@ AcpiEvGpeDetect (void)
* Found an active GPE. Dispatch the event to a handler
* or method.
*/
+ GpeNumber = (i * ACPI_GPE_REGISTER_WIDTH) + j;
+
IntStatus |= AcpiEvGpeDispatch (
- &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) +j]);
+ &GpeBlock->EventInfo[GpeNumber],
+ GpeNumber + GpeBlock->RegisterInfo[GpeNumber].BaseGpeNumber);
}
}
}
@@ -277,6 +312,9 @@ AcpiEvGpeDetect (void)
GpeBlock = GpeBlock->Next;
}
+UnlockAndExit:
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_ISR);
return (IntStatus);
}
@@ -285,7 +323,7 @@ AcpiEvGpeDetect (void)
*
* FUNCTION: AcpiEvAsynchExecuteGpeMethod
*
- * PARAMETERS: GpeEventInfo - Info for this GPE
+ * PARAMETERS: Context (GpeEventInfo) - Info for this GPE
*
* RETURN: None
*
@@ -293,7 +331,7 @@ AcpiEvGpeDetect (void)
* function is called from an invocation of AcpiOsQueueForExecution
* (and therefore does NOT execute at interrupt level) so that
* the control method itself is not executed in the context of
- * the SCI interrupt handler.
+ * an interrupt handler.
*
******************************************************************************/
@@ -304,49 +342,60 @@ AcpiEvAsynchExecuteGpeMethod (
ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context;
UINT32 GpeNumber = 0;
ACPI_STATUS Status;
+ ACPI_GPE_EVENT_INFO LocalGpeEventInfo;
ACPI_FUNCTION_TRACE ("EvAsynchExecuteGpeMethod");
- /*
- * Take a snapshot of the GPE info for this level - we copy the
- * info to prevent a race condition with RemoveHandler.
- */
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_VOID;
}
+ /* Must revalidate the GpeNumber/GpeBlock */
+
+ if (!AcpiEvValidGpeEvent (GpeEventInfo))
+ {
+ Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_VOID;
+ }
+
+ /*
+ * Take a snapshot of the GPE info for this level - we copy the
+ * info to prevent a race condition with RemoveHandler/RemoveBlock.
+ */
+ ACPI_MEMCPY (&LocalGpeEventInfo, GpeEventInfo, sizeof (ACPI_GPE_EVENT_INFO));
+
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_VOID;
}
- if (GpeEventInfo->MethodNode)
+ if (LocalGpeEventInfo.MethodNode)
{
/*
* Invoke the GPE Method (_Lxx, _Exx):
* (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
*/
- Status = AcpiNsEvaluateByHandle (GpeEventInfo->MethodNode, NULL, NULL);
+ Status = AcpiNsEvaluateByHandle (LocalGpeEventInfo.MethodNode, NULL, NULL);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2.2X]\n",
+ ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2X]\n",
AcpiFormatException (Status),
- GpeEventInfo->MethodNode->Name.Ascii, GpeNumber));
+ LocalGpeEventInfo.MethodNode->Name.Ascii, GpeNumber));
}
}
- if (GpeEventInfo->Type & ACPI_EVENT_LEVEL_TRIGGERED)
+ if (LocalGpeEventInfo.Flags & ACPI_EVENT_LEVEL_TRIGGERED)
{
/*
* GPE is level-triggered, we clear the GPE status bit after handling
* the event.
*/
- Status = AcpiHwClearGpe (GpeEventInfo);
+ Status = AcpiHwClearGpe (&LocalGpeEventInfo);
if (ACPI_FAILURE (Status))
{
return_VOID;
@@ -355,7 +404,7 @@ AcpiEvAsynchExecuteGpeMethod (
/* Enable this GPE */
- (void) AcpiHwEnableGpe (GpeEventInfo);
+ (void) AcpiHwEnableGpe (&LocalGpeEventInfo);
return_VOID;
}
@@ -364,21 +413,23 @@ AcpiEvAsynchExecuteGpeMethod (
*
* FUNCTION: AcpiEvGpeDispatch
*
- * PARAMETERS: GpeEventInfo - info for this GPE
+ * PARAMETERS: GpeEventInfo - info for this GPE
+ * GpeNumber - Number relative to the parent GPE block
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
* DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC)
- * or method (e.g. _Lxx/_Exx) handler. This function executes
- * at interrupt level.
+ * or method (e.g. _Lxx/_Exx) handler.
+ *
+ * This function executes at interrupt level.
*
******************************************************************************/
UINT32
AcpiEvGpeDispatch (
- ACPI_GPE_EVENT_INFO *GpeEventInfo)
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ UINT32 GpeNumber)
{
- UINT32 GpeNumber = 0; /* TBD: remove */
ACPI_STATUS Status;
@@ -389,12 +440,12 @@ AcpiEvGpeDispatch (
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
- if (GpeEventInfo->Type & ACPI_EVENT_EDGE_TRIGGERED)
+ if (GpeEventInfo->Flags & ACPI_EVENT_EDGE_TRIGGERED)
{
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%2.2X]\n",
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n",
GpeNumber));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
@@ -422,20 +473,19 @@ AcpiEvGpeDispatch (
Status = AcpiHwDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2.2X]\n",
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n",
GpeNumber));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
- /*
- * Execute the method associated with the GPE.
- */
+ /* Execute the method associated with the GPE. */
+
if (ACPI_FAILURE (AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
AcpiEvAsynchExecuteGpeMethod,
GpeEventInfo)))
{
ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: Unable to queue handler for GPE[%2.2X], event is disabled\n",
+ "AcpiEvGpeDispatch: Unable to queue handler for GPE[%2X], event is disabled\n",
GpeNumber));
}
}
@@ -444,7 +494,7 @@ AcpiEvGpeDispatch (
/* No handler or method to run! */
ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: No handler or method for GPE[%2.2X], disabling event\n",
+ "AcpiEvGpeDispatch: No handler or method for GPE[%2X], disabling event\n",
GpeNumber));
/*
@@ -454,21 +504,20 @@ AcpiEvGpeDispatch (
Status = AcpiHwDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2.2X]\n",
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n",
GpeNumber));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
}
- /*
- * It is now safe to clear level-triggered evnets.
- */
- if (GpeEventInfo->Type & ACPI_EVENT_LEVEL_TRIGGERED)
+ /* It is now safe to clear level-triggered events. */
+
+ if (GpeEventInfo->Flags & ACPI_EVENT_LEVEL_TRIGGERED)
{
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%2.2X]\n",
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n",
GpeNumber));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
diff --git a/sys/contrib/dev/acpica/evgpeblk.c b/sys/contrib/dev/acpica/evgpeblk.c
index 89aa409..bd2fd22 100644
--- a/sys/contrib/dev/acpica/evgpeblk.c
+++ b/sys/contrib/dev/acpica/evgpeblk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evgpeblk - GPE block creation and initialization.
- * $Revision: 4 $
+ * $Revision: 23 $
*
*****************************************************************************/
@@ -119,7 +119,118 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_EVENTS
- ACPI_MODULE_NAME ("evgpe")
+ ACPI_MODULE_NAME ("evgpeblk")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvValidGpeEvent
+ *
+ * PARAMETERS: GpeEventInfo - Info for this GPE
+ *
+ * RETURN: TRUE if the GpeEvent is valid
+ *
+ * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
+ * Should be called only when the GPE lists are semaphore locked
+ * and not subject to change.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiEvValidGpeEvent (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo)
+{
+ ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* No need for spin lock since we are not changing any list elements */
+
+ /* Walk the GPE interrupt levels */
+
+ GpeXruptBlock = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptBlock)
+ {
+ GpeBlock = GpeXruptBlock->GpeBlockListHead;
+
+ /* Walk the GPE blocks on this interrupt level */
+
+ while (GpeBlock)
+ {
+ if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
+ (&GpeBlock->EventInfo[((ACPI_SIZE) GpeBlock->RegisterCount) * 8] > GpeEventInfo))
+ {
+ return (TRUE);
+ }
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+ GpeXruptBlock = GpeXruptBlock->Next;
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvWalkGpeList
+ *
+ * PARAMETERS: GpeWalkCallback - Routine called for each GPE block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk the GPE lists.
+ * FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvWalkGpeList (
+ ACPI_GPE_CALLBACK GpeWalkCallback)
+{
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("EvWalkGpeList");
+
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_ISR);
+
+ /* Walk the interrupt level descriptor list */
+
+ GpeXruptInfo = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptInfo)
+ {
+ /* Walk all Gpe Blocks attached to this interrupt level */
+
+ GpeBlock = GpeXruptInfo->GpeBlockListHead;
+ while (GpeBlock)
+ {
+ /* One callback per GPE block */
+
+ Status = GpeWalkCallback (GpeXruptInfo, GpeBlock);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+ GpeXruptInfo = GpeXruptInfo->Next;
+ }
+
+UnlockAndExit:
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_ISR);
+ return_ACPI_STATUS (Status);
+}
/*******************************************************************************
@@ -128,7 +239,7 @@
*
* PARAMETERS: Callback from WalkNamespace
*
- * RETURN: None
+ * RETURN: Status
*
* DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
* control method under the _GPE portion of the namespace.
@@ -137,10 +248,10 @@
*
* The name of each GPE control method is of the form:
* "_Lnn" or "_Enn"
- * Where:
- * L - means that the GPE is level triggered
- * E - means that the GPE is edge triggered
- * nn - is the GPE number [in HEX]
+ * Where:
+ * L - means that the GPE is level triggered
+ * E - means that the GPE is edge triggered
+ * nn - is the GPE number [in HEX]
*
******************************************************************************/
@@ -159,17 +270,18 @@ AcpiEvSaveMethodInfo (
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("EvSaveMethodInfo");
+ ACPI_FUNCTION_TRACE ("EvSaveMethodInfo");
/* Extract the name from the object and convert to a string */
- ACPI_MOVE_UNALIGNED32_TO_32 (Name,
- &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer);
+ ACPI_MOVE_32_TO_32 (Name,
+ &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer);
Name[ACPI_NAME_SIZE] = 0;
/*
- * Edge/Level determination is based on the 2nd character of the method name
+ * Edge/Level determination is based on the 2nd character
+ * of the method name
*/
switch (Name[1])
{
@@ -187,7 +299,7 @@ AcpiEvSaveMethodInfo (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n",
Name));
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
/* Convert the last two characters of the name to the GPE Number */
@@ -200,19 +312,20 @@ AcpiEvSaveMethodInfo (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not extract GPE number from name: %s (name is not of form _Lnn or _Enn)\n",
Name));
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
/* Ensure that we have a valid GPE number for this GPE block */
if ((GpeNumber < GpeBlock->BlockBaseNumber) ||
- (GpeNumber - GpeBlock->BlockBaseNumber >= (GpeBlock->RegisterCount * 8)))
+ (GpeNumber >= (GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))))
{
- /* Not valid, all we can do here is ignore it */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "GPE number associated with method %s is not valid\n", Name));
- return (AE_OK);
+ /*
+ * Not valid for this GPE block, just ignore it
+ * However, it may be valid for a different GPE block, since GPE0 and GPE1
+ * methods both appear under \_GPE.
+ */
+ return_ACPI_STATUS (AE_OK);
}
/*
@@ -221,21 +334,171 @@ AcpiEvSaveMethodInfo (
*/
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
- GpeEventInfo->Type = Type;
+ GpeEventInfo->Flags = Type;
GpeEventInfo->MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle;
- /*
- * Enable the GPE (SCIs should be disabled at this point)
- */
+ /* Enable the GPE (SCIs should be disabled at this point) */
+
Status = AcpiHwEnableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- return (Status);
+ return_ACPI_STATUS (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %2.2X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
+ "Registered GPE method %s as GPE number 0x%.2X\n",
Name, GpeNumber));
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGetGpeXruptBlock
+ *
+ * PARAMETERS: InterruptLevel - Interrupt for a GPE block
+ *
+ * RETURN: A GPE interrupt block
+ *
+ * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
+ * block per unique interrupt level used for GPEs.
+ * Should be called only when the GPE lists are semaphore locked
+ * and not subject to change.
+ *
+ ******************************************************************************/
+
+static ACPI_GPE_XRUPT_INFO *
+AcpiEvGetGpeXruptBlock (
+ UINT32 InterruptLevel)
+{
+ ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
+ ACPI_GPE_XRUPT_INFO *GpeXrupt;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvGetGpeXruptBlock");
+
+
+ /* No need for spin lock since we are not changing any list elements here */
+
+ NextGpeXrupt = AcpiGbl_GpeXruptListHead;
+ while (NextGpeXrupt)
+ {
+ if (NextGpeXrupt->InterruptLevel == InterruptLevel)
+ {
+ return_PTR (NextGpeXrupt);
+ }
+
+ NextGpeXrupt = NextGpeXrupt->Next;
+ }
+
+ /* Not found, must allocate a new xrupt descriptor */
+
+ GpeXrupt = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_XRUPT_INFO));
+ if (!GpeXrupt)
+ {
+ return_PTR (NULL);
+ }
+
+ GpeXrupt->InterruptLevel = InterruptLevel;
+
+ /* Install new interrupt descriptor with spin lock */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ if (AcpiGbl_GpeXruptListHead)
+ {
+ NextGpeXrupt = AcpiGbl_GpeXruptListHead;
+ while (NextGpeXrupt->Next)
+ {
+ NextGpeXrupt = NextGpeXrupt->Next;
+ }
+
+ NextGpeXrupt->Next = GpeXrupt;
+ GpeXrupt->Previous = NextGpeXrupt;
+ }
+ else
+ {
+ AcpiGbl_GpeXruptListHead = GpeXrupt;
+ }
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+
+ /* Install new interrupt handler if not SCI_INT */
+
+ if (InterruptLevel != AcpiGbl_FADT->SciInt)
+ {
+ Status = AcpiOsInstallInterruptHandler (InterruptLevel,
+ AcpiEvGpeXruptHandler, GpeXrupt);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not install GPE interrupt handler at level 0x%X\n",
+ InterruptLevel));
+ return_PTR (NULL);
+ }
+ }
+
+ return_PTR (GpeXrupt);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvDeleteGpeXrupt
+ *
+ * PARAMETERS: GpeXrupt - A GPE interrupt info block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
+ * interrupt handler if not the SCI interrupt.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiEvDeleteGpeXrupt (
+ ACPI_GPE_XRUPT_INFO *GpeXrupt)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvDeleteGpeXrupt");
+
+
+ /* We never want to remove the SCI interrupt handler */
+
+ if (GpeXrupt->InterruptLevel == AcpiGbl_FADT->SciInt)
+ {
+ GpeXrupt->GpeBlockListHead = NULL;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Disable this interrupt */
+
+ Status = AcpiOsRemoveInterruptHandler (GpeXrupt->InterruptLevel,
+ AcpiEvGpeXruptHandler);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Unlink the interrupt block with lock */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ if (GpeXrupt->Previous)
+ {
+ GpeXrupt->Previous->Next = GpeXrupt->Next;
+ }
+
+ if (GpeXrupt->Next)
+ {
+ GpeXrupt->Next->Previous = GpeXrupt->Previous;
+ }
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+
+ /* Free the block */
+
+ ACPI_MEM_FREE (GpeXrupt);
+ return_ACPI_STATUS (AE_OK);
}
@@ -243,7 +506,8 @@ AcpiEvSaveMethodInfo (
*
* FUNCTION: AcpiEvInstallGpeBlock
*
- * PARAMETERS: GpeBlock - New GPE block
+ * PARAMETERS: GpeBlock - New GPE block
+ * InterruptLevel - Level to be associated with this GPE block
*
* RETURN: Status
*
@@ -251,25 +515,38 @@ AcpiEvSaveMethodInfo (
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiEvInstallGpeBlock (
- ACPI_GPE_BLOCK_INFO *GpeBlock)
+ ACPI_GPE_BLOCK_INFO *GpeBlock,
+ UINT32 InterruptLevel)
{
ACPI_GPE_BLOCK_INFO *NextGpeBlock;
+ ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
ACPI_STATUS Status;
+ ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
+
+
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
- return (Status);
+ return_ACPI_STATUS (Status);
+ }
+
+ GpeXruptBlock = AcpiEvGetGpeXruptBlock (InterruptLevel);
+ if (!GpeXruptBlock)
+ {
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
}
- /* Install the new block at the end of the global list */
+ /* Install the new block at the end of the list for this interrupt with lock */
- if (AcpiGbl_GpeBlockListHead)
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ if (GpeXruptBlock->GpeBlockListHead)
{
- NextGpeBlock = AcpiGbl_GpeBlockListHead;
+ NextGpeBlock = GpeXruptBlock->GpeBlockListHead;
while (NextGpeBlock->Next)
{
NextGpeBlock = NextGpeBlock->Next;
@@ -280,11 +557,90 @@ AcpiEvInstallGpeBlock (
}
else
{
- AcpiGbl_GpeBlockListHead = GpeBlock;
+ GpeXruptBlock->GpeBlockListHead = GpeBlock;
+ }
+
+ GpeBlock->XruptBlock = GpeXruptBlock;
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+
+UnlockAndExit:
+ Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvDeleteGpeBlock
+ *
+ * PARAMETERS: GpeBlock - Existing GPE block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install new GPE block with mutex support
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvDeleteGpeBlock (
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Disable all GPEs in this block */
+
+ Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock);
+
+ if (!GpeBlock->Previous && !GpeBlock->Next)
+ {
+ /* This is the last GpeBlock on this interrupt */
+
+ Status = AcpiEvDeleteGpeXrupt (GpeBlock->XruptBlock);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+ }
+ else
+ {
+ /* Remove the block on this interrupt with lock */
+
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ if (GpeBlock->Previous)
+ {
+ GpeBlock->Previous->Next = GpeBlock->Next;
+ }
+ else
+ {
+ GpeBlock->XruptBlock->GpeBlockListHead = GpeBlock->Next;
+ }
+
+ if (GpeBlock->Next)
+ {
+ GpeBlock->Next->Previous = GpeBlock->Previous;
+ }
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
}
+ /* Free the GpeBlock */
+
+ ACPI_MEM_FREE (GpeBlock->RegisterInfo);
+ ACPI_MEM_FREE (GpeBlock->EventInfo);
+ ACPI_MEM_FREE (GpeBlock);
+
+UnlockAndExit:
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
- return (Status);
+ return_ACPI_STATUS (Status);
}
@@ -300,7 +656,7 @@ AcpiEvInstallGpeBlock (
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiEvCreateGpeInfoBlocks (
ACPI_GPE_BLOCK_INFO *GpeBlock)
{
@@ -342,12 +698,16 @@ AcpiEvCreateGpeInfoBlocks (
goto ErrorExit;
}
+ /* Save the new Info arrays in the GPE block */
+
+ GpeBlock->RegisterInfo = GpeRegisterInfo;
+ GpeBlock->EventInfo = GpeEventInfo;
+
/*
* Initialize the GPE Register and Event structures. A goal of these
* tables is to hide the fact that there are two separate GPE register sets
* in a given gpe hardware block, the status registers occupy the first half,
- * and the enable registers occupy the second half. Another goal is to hide
- * the fact that there may be multiple GPE hardware blocks.
+ * and the enable registers occupy the second half.
*/
ThisRegister = GpeRegisterInfo;
ThisEvent = GpeEventInfo;
@@ -390,14 +750,14 @@ AcpiEvCreateGpeInfoBlocks (
* by writing a '0'.
*/
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00,
- &ThisRegister->EnableAddress, 0);
+ &ThisRegister->EnableAddress);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0xFF,
- &ThisRegister->StatusAddress, 0);
+ &ThisRegister->StatusAddress);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@@ -406,14 +766,10 @@ AcpiEvCreateGpeInfoBlocks (
ThisRegister++;
}
- GpeBlock->RegisterInfo = GpeRegisterInfo;
- GpeBlock->EventInfo = GpeEventInfo;
-
return_ACPI_STATUS (AE_OK);
ErrorExit:
-
if (GpeRegisterInfo)
{
ACPI_MEM_FREE (GpeRegisterInfo);
@@ -423,7 +779,7 @@ ErrorExit:
ACPI_MEM_FREE (GpeEventInfo);
}
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (Status);
}
@@ -431,7 +787,12 @@ ErrorExit:
*
* FUNCTION: AcpiEvCreateGpeBlock
*
- * PARAMETERS: TBD
+ * PARAMETERS: GpeDevice - Handle to the parent GPE block
+ * GpeBlockAddress - Address and SpaceID
+ * RegisterCount - Number of GPE register pairs in the block
+ * GpeBlockBaseNumber - Starting GPE number for the block
+ * InterruptLevel - H/W interrupt for the block
+ * ReturnGpeBlock - Where the new block descriptor is returned
*
* RETURN: Status
*
@@ -441,15 +802,15 @@ ErrorExit:
ACPI_STATUS
AcpiEvCreateGpeBlock (
- char *Pathname,
+ ACPI_NAMESPACE_NODE *GpeDevice,
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
UINT8 GpeBlockBaseNumber,
- UINT32 InterruptLevel)
+ UINT32 InterruptLevel,
+ ACPI_GPE_BLOCK_INFO **ReturnGpeBlock)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_STATUS Status;
- ACPI_HANDLE ObjHandle;
ACPI_FUNCTION_TRACE ("EvCreateGpeBlock");
@@ -460,14 +821,6 @@ AcpiEvCreateGpeBlock (
return_ACPI_STATUS (AE_OK);
}
- /* Get a handle to the parent object for this GPE block */
-
- Status = AcpiGetHandle (NULL, Pathname, &ObjHandle);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
/* Allocate a new GPE block */
GpeBlock = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_BLOCK_INFO));
@@ -493,9 +846,8 @@ AcpiEvCreateGpeBlock (
}
/* Install the new block in the global list(s) */
- /* TBD: Install block in the interrupt handler list */
- Status = AcpiEvInstallGpeBlock (GpeBlock);
+ Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptLevel);
if (ACPI_FAILURE (Status))
{
ACPI_MEM_FREE (GpeBlock);
@@ -504,22 +856,29 @@ AcpiEvCreateGpeBlock (
/* Dump info about this GPE block */
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE Block: %X registers at %8.8X%8.8X\n",
- GpeBlock->RegisterCount,
- ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)),
- ACPI_LODWORD (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address))));
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE Block defined as GPE%d to GPE%d\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE %02d to %02d [%4.4s] %d regs at %8.8X%8.8X on int %d\n",
GpeBlock->BlockBaseNumber,
(UINT32) (GpeBlock->BlockBaseNumber +
- ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1))));
+ ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)),
+ GpeDevice->Name.Ascii,
+ GpeBlock->RegisterCount,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)),
+ InterruptLevel));
/* Find all GPE methods (_Lxx, _Exx) for this block */
- Status = AcpiWalkNamespace (ACPI_TYPE_METHOD, ObjHandle,
- ACPI_UINT32_MAX, AcpiEvSaveMethodInfo,
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvSaveMethodInfo,
GpeBlock, NULL);
+ /* Return the new block */
+
+ if (ReturnGpeBlock)
+ {
+ (*ReturnGpeBlock) = GpeBlock;
+ }
+
return_ACPI_STATUS (AE_OK);
}
@@ -542,11 +901,21 @@ AcpiEvGpeInitialize (void)
UINT32 RegisterCount0 = 0;
UINT32 RegisterCount1 = 0;
UINT32 GpeNumberMax = 0;
+ ACPI_HANDLE GpeDevice;
+ ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("EvGpeInitialize");
+ /* Get a handle to the predefined _GPE object */
+
+ Status = AcpiGetHandle (NULL, "\\_GPE", &GpeDevice);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/*
* Initialize the GPE Blocks defined in the FADT
*
@@ -568,6 +937,7 @@ AcpiEvGpeInitialize (void)
*
* Note: both GPE0 and GPE1 are optional, and either can exist without
* the other.
+ *
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/
@@ -580,8 +950,16 @@ AcpiEvGpeInitialize (void)
GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
- AcpiEvCreateGpeBlock ("\\_GPE", &AcpiGbl_FADT->XGpe0Blk,
- RegisterCount0, 0, AcpiGbl_FADT->SciInt);
+ /* Install GPE Block 0 */
+
+ Status = AcpiEvCreateGpeBlock (GpeDevice, &AcpiGbl_FADT->XGpe0Blk,
+ RegisterCount0, 0, AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[0]);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR ((
+ "Could not create GPE Block 0, %s\n",
+ AcpiFormatException (Status)));
+ }
}
if (AcpiGbl_FADT->Gpe1BlkLen &&
@@ -608,12 +986,21 @@ AcpiEvGpeInitialize (void)
}
else
{
- AcpiEvCreateGpeBlock ("\\_GPE", &AcpiGbl_FADT->XGpe1Blk,
- RegisterCount1, AcpiGbl_FADT->Gpe1Base, AcpiGbl_FADT->SciInt);
+ /* Install GPE Block 1 */
+
+ Status = AcpiEvCreateGpeBlock (GpeDevice, &AcpiGbl_FADT->XGpe1Blk,
+ RegisterCount1, AcpiGbl_FADT->Gpe1Base,
+ AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[1]);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_REPORT_ERROR ((
+ "Could not create GPE Block 1, %s\n",
+ AcpiFormatException (Status)));
+ }
/*
- * GPE0 and GPE1 do not have to be contiguous in the GPE number space,
- * But, GPE0 always starts at zero.
+ * GPE0 and GPE1 do not have to be contiguous in the GPE number
+ * space. However, GPE0 always starts at GPE number zero.
*/
GpeNumberMax = AcpiGbl_FADT->Gpe1Base +
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1);
diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c
index cc4d9b1..a2f08b9 100644
--- a/sys/contrib/dev/acpica/evmisc.c
+++ b/sys/contrib/dev/acpica/evmisc.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
- * $Revision: 64 $
+ * $Revision: 68 $
*
*****************************************************************************/
@@ -234,11 +234,11 @@ AcpiEvQueueNotifyRequest (
if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
{
- HandlerObj = ObjDesc->CommonNotify.SysHandler;
+ HandlerObj = ObjDesc->CommonNotify.SystemNotify;
}
else
{
- HandlerObj = ObjDesc->CommonNotify.DrvHandler;
+ HandlerObj = ObjDesc->CommonNotify.DeviceNotify;
}
break;
@@ -250,8 +250,8 @@ AcpiEvQueueNotifyRequest (
/* If there is any handler to run, schedule the dispatcher */
- if ((AcpiGbl_SysNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
- (AcpiGbl_DrvNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
+ if ((AcpiGbl_SystemNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
+ (AcpiGbl_DeviceNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
HandlerObj)
{
NotifyInfo = AcpiUtCreateGenericState ();
@@ -319,20 +319,20 @@ AcpiEvNotifyDispatch (
{
/* Global system notification handler */
- if (AcpiGbl_SysNotify.Handler)
+ if (AcpiGbl_SystemNotify.Handler)
{
- GlobalHandler = AcpiGbl_SysNotify.Handler;
- GlobalContext = AcpiGbl_SysNotify.Context;
+ GlobalHandler = AcpiGbl_SystemNotify.Handler;
+ GlobalContext = AcpiGbl_SystemNotify.Context;
}
}
else
{
/* Global driver notification handler */
- if (AcpiGbl_DrvNotify.Handler)
+ if (AcpiGbl_DeviceNotify.Handler)
{
- GlobalHandler = AcpiGbl_DrvNotify.Handler;
- GlobalContext = AcpiGbl_DrvNotify.Context;
+ GlobalHandler = AcpiGbl_DeviceNotify.Handler;
+ GlobalContext = AcpiGbl_DeviceNotify.Context;
}
}
@@ -348,8 +348,8 @@ AcpiEvNotifyDispatch (
HandlerObj = NotifyInfo->Notify.HandlerObj;
if (HandlerObj)
{
- HandlerObj->NotifyHandler.Handler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value,
- HandlerObj->NotifyHandler.Context);
+ HandlerObj->Notify.Handler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value,
+ HandlerObj->Notify.Context);
}
/* All done with the info object */
@@ -623,9 +623,6 @@ AcpiEvTerminate (void)
{
ACPI_NATIVE_UINT i;
ACPI_STATUS Status;
- ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_GPE_BLOCK_INFO *NextGpeBlock;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("EvTerminate");
@@ -638,42 +635,23 @@ AcpiEvTerminate (void)
* In all cases, on error, print a message but obviously we don't abort.
*/
- /*
- * Disable all fixed events
- */
+ /* Disable all fixed events */
+
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
- Status = AcpiDisableEvent ((UINT32) i, ACPI_EVENT_FIXED, 0);
+ Status = AcpiDisableEvent ((UINT32) i, 0);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (UINT32) i));
}
}
- /*
- * Disable all GPEs
- */
- GpeBlock = AcpiGbl_GpeBlockListHead;
- while (GpeBlock)
- {
- GpeEventInfo = GpeBlock->EventInfo;
- for (i = 0; i < (GpeBlock->RegisterCount * 8); i++)
- {
- Status = AcpiHwDisableGpe (GpeEventInfo);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable GPE %d\n", (UINT32) i));
- }
+ /* Disable all GPEs in all GPE blocks */
- GpeEventInfo++;
- }
+ Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
- GpeBlock = GpeBlock->Next;
- }
+ /* Remove SCI handler */
- /*
- * Remove SCI handler
- */
Status = AcpiEvRemoveSciHandler ();
if (ACPI_FAILURE(Status))
{
@@ -681,9 +659,8 @@ AcpiEvTerminate (void)
}
}
- /*
- * Return to original mode if necessary
- */
+ /* Return to original mode if necessary */
+
if (AcpiGbl_OriginalMode == ACPI_SYS_MODE_LEGACY)
{
Status = AcpiDisable ();
@@ -692,21 +669,6 @@ AcpiEvTerminate (void)
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "AcpiDisable failed\n"));
}
}
-
- /*
- * Free global GPE blocks and related info structures
- */
- GpeBlock = AcpiGbl_GpeBlockListHead;
- while (GpeBlock)
- {
- NextGpeBlock = GpeBlock->Next;
- ACPI_MEM_FREE (GpeBlock->EventInfo);
- ACPI_MEM_FREE (GpeBlock->RegisterInfo);
- ACPI_MEM_FREE (GpeBlock);
-
- GpeBlock = NextGpeBlock;
- }
-
return_VOID;
}
diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c
index db1ab85..1404b31 100644
--- a/sys/contrib/dev/acpica/evregion.c
+++ b/sys/contrib/dev/acpica/evregion.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
- * $Revision: 137 $
+ * $Revision: 141 $
*
*****************************************************************************/
@@ -125,16 +125,24 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evregion")
+#define ACPI_NUM_DEFAULT_SPACES 4
+
+UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = {
+ ACPI_ADR_SPACE_SYSTEM_MEMORY,
+ ACPI_ADR_SPACE_SYSTEM_IO,
+ ACPI_ADR_SPACE_PCI_CONFIG,
+ ACPI_ADR_SPACE_DATA_TABLE};
+
/*******************************************************************************
*
* FUNCTION: AcpiEvInitAddressSpaces
*
- * PARAMETERS:
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Installs the core subsystem address space handlers.
+ * DESCRIPTION: Installs the core subsystem default address space handlers.
*
******************************************************************************/
@@ -143,6 +151,7 @@ AcpiEvInitAddressSpaces (
void)
{
ACPI_STATUS Status;
+ ACPI_NATIVE_UINT i;
ACPI_FUNCTION_TRACE ("EvInitAddressSpaces");
@@ -150,9 +159,11 @@ AcpiEvInitAddressSpaces (
/*
* All address spaces (PCI Config, EC, SMBus) are scope dependent
- * and registration must occur for a specific device. In the case
- * system memory and IO address spaces there is currently no device
- * associated with the address space. For these we use the root.
+ * and registration must occur for a specific device.
+ *
+ * In the case of the system memory and IO address spaces there is currently
+ * no device associated with the address space. For these we use the root.
+ *
* We install the default PCI config space handler at the root so
* that this space is immediately available even though the we have
* not enumerated all the PCI Root Buses yet. This is to conform
@@ -161,43 +172,29 @@ AcpiEvInitAddressSpaces (
* near ready to find the PCI root buses at this point.
*
* NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
- * has already been installed (via AcpiInstallAddressSpaceHandler)
+ * has already been installed (via AcpiInstallAddressSpaceHandler).
+ * Similar for AE_SAME_HANDLER.
*/
- Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
- ACPI_ADR_SPACE_SYSTEM_MEMORY,
- ACPI_DEFAULT_HANDLER, NULL, NULL);
- if ((ACPI_FAILURE (Status)) &&
- (Status != AE_ALREADY_EXISTS))
+ for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{
- return_ACPI_STATUS (Status);
- }
+ Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
+ AcpiGbl_DefaultAddressSpaces[i],
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
+ switch (Status)
+ {
+ case AE_OK:
+ case AE_SAME_HANDLER:
+ case AE_ALREADY_EXISTS:
- Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
- ACPI_ADR_SPACE_SYSTEM_IO,
- ACPI_DEFAULT_HANDLER, NULL, NULL);
- if ((ACPI_FAILURE (Status)) &&
- (Status != AE_ALREADY_EXISTS))
- {
- return_ACPI_STATUS (Status);
- }
+ /* These exceptions are all OK */
- Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
- ACPI_ADR_SPACE_PCI_CONFIG,
- ACPI_DEFAULT_HANDLER, NULL, NULL);
- if ((ACPI_FAILURE (Status)) &&
- (Status != AE_ALREADY_EXISTS))
- {
- return_ACPI_STATUS (Status);
- }
+ break;
- Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) AcpiGbl_RootNode,
- ACPI_ADR_SPACE_DATA_TABLE,
- ACPI_DEFAULT_HANDLER, NULL, NULL);
- if ((ACPI_FAILURE (Status)) &&
- (Status != AE_ALREADY_EXISTS))
- {
- return_ACPI_STATUS (Status);
+ default:
+
+ return_ACPI_STATUS (Status);
+ }
}
return_ACPI_STATUS (AE_OK);
@@ -242,10 +239,10 @@ AcpiEvExecuteRegMethod (
}
/*
- * _REG method has two arguments
- * Arg0: Integer: Operation region space ID
+ * _REG method has two arguments
+ * Arg0: Integer: Operation region space ID
* Same value as RegionObj->Region.SpaceId
- * Arg1: Integer: connection status
+ * Arg1: Integer: connection status
* 1 for connecting the handler,
* 0 for disconnecting the handler
* Passed as a parameter
@@ -263,16 +260,14 @@ AcpiEvExecuteRegMethod (
goto Cleanup;
}
- /*
- * Set up the parameter objects
- */
+ /* Set up the parameter objects */
+
Params[0]->Integer.Value = RegionObj->Region.SpaceId;
Params[1]->Integer.Value = Function;
Params[2] = NULL;
- /*
- * Execute the method, no return value
- */
+ /* Execute the method, no return value */
+
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, RegionObj2->Extra.Method_REG, NULL));
Status = AcpiNsEvaluateByHandle (RegionObj2->Extra.Method_REG, Params, NULL);
@@ -329,10 +324,9 @@ AcpiEvAddressSpaceDispatch (
return_ACPI_STATUS (AE_NOT_EXIST);
}
- /*
- * Ensure that there is a handler associated with this region
- */
- HandlerDesc = RegionObj->Region.AddrHandler;
+ /* Ensure that there is a handler associated with this region */
+
+ HandlerDesc = RegionObj->Region.AddressSpace;
if (!HandlerDesc)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "no handler for region(%p) [%s]\n",
@@ -350,25 +344,24 @@ AcpiEvAddressSpaceDispatch (
/*
* This region has not been initialized yet, do it
*/
- RegionSetup = HandlerDesc->AddrHandler.Setup;
+ RegionSetup = HandlerDesc->AddressSpace.Setup;
if (!RegionSetup)
{
- /*
- * Bad news, no init routine and not init'd
- */
+ /* No initialization routine, exit with error */
+
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]\n",
RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
- return_ACPI_STATUS (AE_UNKNOWN_STATUS);
+ return_ACPI_STATUS (AE_NOT_EXIST);
}
/*
* We must exit the interpreter because the region setup will potentially
- * execute control methods
+ * execute control methods (e.g., _REG method for this region)
*/
AcpiExExitInterpreter ();
Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
- HandlerDesc->AddrHandler.Context, &RegionContext);
+ HandlerDesc->AddressSpace.Context, &RegionContext);
/* Re-enter the interpreter */
@@ -378,9 +371,8 @@ AcpiEvAddressSpaceDispatch (
return_ACPI_STATUS (Status2);
}
- /*
- * Init routine may fail
- */
+ /* Check for failure of the Region Setup */
+
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n",
@@ -389,40 +381,54 @@ AcpiEvAddressSpaceDispatch (
return_ACPI_STATUS (Status);
}
- RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
-
/*
- * Save the returned context for use in all accesses to
- * this particular region.
+ * Region initialization may have been completed by RegionSetup
*/
- RegionObj2->Extra.RegionContext = RegionContext;
+ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
+ {
+ RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
+
+ if (RegionObj2->Extra.RegionContext)
+ {
+ /* The handler for this region was already installed */
+
+ ACPI_MEM_FREE (RegionContext);
+ }
+ else
+ {
+ /*
+ * Save the returned context for use in all accesses to
+ * this particular region
+ */
+ RegionObj2->Extra.RegionContext = RegionContext;
+ }
+ }
}
- /*
- * We have everything we need, begin the process
- */
- Handler = HandlerDesc->AddrHandler.Handler;
+ /* We have everything we need, we can invoke the address space handler */
+
+ Handler = HandlerDesc->AddressSpace.Handler;
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
- "Addrhandler %p (%p), Address %8.8X%8.8X\n",
- &RegionObj->Region.AddrHandler->AddrHandler, Handler,
- ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
+ "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
+ &RegionObj->Region.AddressSpace->AddressSpace, Handler,
+ ACPI_HIDWORD (Address), ACPI_LODWORD (Address),
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
- if (!(HandlerDesc->AddrHandler.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
+ if (!(HandlerDesc->AddressSpace.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
/*
- * For handlers other than the default (supplied) handlers, we must
- * exit the interpreter because the handler *might* block -- we don't
- * know what it will do, so we can't hold the lock on the intepreter.
+ * For handlers other than the default (supplied) handlers, we must
+ * exit the interpreter because the handler *might* block -- we don't
+ * know what it will do, so we can't hold the lock on the intepreter.
*/
AcpiExExitInterpreter();
}
- /*
- * Invoke the handler.
- */
+ /* Call the handler */
+
Status = Handler (Function, Address, BitWidth, Value,
- HandlerDesc->AddrHandler.Context,
+ HandlerDesc->AddressSpace.Context,
RegionObj2->Extra.RegionContext);
if (ACPI_FAILURE (Status))
@@ -432,7 +438,7 @@ AcpiEvAddressSpaceDispatch (
AcpiFormatException (Status)));
}
- if (!(HandlerDesc->AddrHandler.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
+ if (!(HandlerDesc->AddressSpace.Flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
/*
* We just returned from a non-default handler, we must re-enter the
@@ -486,38 +492,33 @@ AcpiEvDetachRegion(
}
RegionContext = RegionObj2->Extra.RegionContext;
- /*
- * Get the address handler from the region object
- */
- HandlerObj = RegionObj->Region.AddrHandler;
+ /* Get the address handler from the region object */
+
+ HandlerObj = RegionObj->Region.AddressSpace;
if (!HandlerObj)
{
- /*
- * This region has no handler, all done
- */
+ /* This region has no handler, all done */
+
return_VOID;
}
+ /* Find this region in the handler's list */
- /*
- * Find this region in the handler's list
- */
- ObjDesc = HandlerObj->AddrHandler.RegionList;
- LastObjPtr = &HandlerObj->AddrHandler.RegionList;
+ ObjDesc = HandlerObj->AddressSpace.RegionList;
+ LastObjPtr = &HandlerObj->AddressSpace.RegionList;
while (ObjDesc)
{
- /*
- * See if this is the one
- */
+ /* Is this the correct Region? */
+
if (ObjDesc == RegionObj)
{
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Removing Region %p from address handler %p\n",
RegionObj, HandlerObj));
- /*
- * This is it, remove it from the handler's list
- */
+
+ /* This is it, remove it from the handler's list */
+
*LastObjPtr = ObjDesc->Region.Next;
ObjDesc->Region.Next = NULL; /* Must clear field */
@@ -530,9 +531,8 @@ AcpiEvDetachRegion(
}
}
- /*
- * Now stop region accesses by executing the _REG method
- */
+ /* Now stop region accesses by executing the _REG method */
+
Status = AcpiEvExecuteRegMethod (RegionObj, 0);
if (ACPI_FAILURE (Status))
{
@@ -550,16 +550,14 @@ AcpiEvDetachRegion(
}
}
- /*
- * Call the setup handler with the deactivate notification
- */
- RegionSetup = HandlerObj->AddrHandler.Setup;
+ /* Call the setup handler with the deactivate notification */
+
+ RegionSetup = HandlerObj->AddressSpace.Setup;
Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
- HandlerObj->AddrHandler.Context, &RegionContext);
+ HandlerObj->AddressSpace.Context, &RegionContext);
+
+ /* Init routine may fail, Just ignore errors */
- /*
- * Init routine may fail, Just ignore errors
- */
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region init, [%s]\n",
@@ -570,31 +568,29 @@ AcpiEvDetachRegion(
RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
/*
- * Remove handler reference in the region
+ * Remove handler reference in the region
*
- * NOTE: this doesn't mean that the region goes away
- * The region is just inaccessible as indicated to
- * the _REG method
+ * NOTE: this doesn't mean that the region goes away
+ * The region is just inaccessible as indicated to
+ * the _REG method
*
- * If the region is on the handler's list
- * this better be the region's handler
+ * If the region is on the handler's list
+ * this better be the region's handler
*/
- RegionObj->Region.AddrHandler = NULL;
+ RegionObj->Region.AddressSpace = NULL;
+ AcpiUtRemoveReference (HandlerObj);
return_VOID;
+ }
- } /* found the right handler */
+ /* Walk the linked list of handlers */
- /*
- * Move through the linked list of handlers
- */
LastObjPtr = &ObjDesc->Region.Next;
ObjDesc = ObjDesc->Region.Next;
}
- /*
- * If we get here, the region was not in the handler's region list
- */
+ /* If we get here, the region was not in the handler's region list */
+
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Cannot remove region %p from address handler %p\n",
RegionObj, HandlerObj));
@@ -636,16 +632,20 @@ AcpiEvAttachRegion (
RegionObj, HandlerObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
- /*
- * Link this region to the front of the handler's list
- */
- RegionObj->Region.Next = HandlerObj->AddrHandler.RegionList;
- HandlerObj->AddrHandler.RegionList = RegionObj;
+ /* Link this region to the front of the handler's list */
- /*
- * Set the region's handler
- */
- RegionObj->Region.AddrHandler = HandlerObj;
+ RegionObj->Region.Next = HandlerObj->AddressSpace.RegionList;
+ HandlerObj->AddressSpace.RegionList = RegionObj;
+
+ /* Install the region's handler */
+
+ if (RegionObj->Region.AddressSpace)
+ {
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ }
+
+ RegionObj->Region.AddressSpace = HandlerObj;
+ AcpiUtAddReference (HandlerObj);
/*
* Tell all users that this region is usable by running the _REG
@@ -677,14 +677,14 @@ AcpiEvAttachRegion (
/*******************************************************************************
*
- * FUNCTION: AcpiEvAddrHandlerHelper
+ * FUNCTION: AcpiEvInstallHandler
*
* PARAMETERS: Handle - Node to be dumped
* Level - Nesting level of the handle
* Context - Passed into AcpiNsWalkNamespace
*
* DESCRIPTION: This routine installs an address handler into objects that are
- * of type Region.
+ * of type Region or Device.
*
* If the Object is a Device, and the device has a handler of
* the same type then the search is terminated in that branch.
@@ -695,20 +695,20 @@ AcpiEvAttachRegion (
******************************************************************************/
ACPI_STATUS
-AcpiEvAddrHandlerHelper (
+AcpiEvInstallHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_OPERAND_OBJECT *HandlerObj;
- ACPI_OPERAND_OBJECT *TmpObj;
+ ACPI_OPERAND_OBJECT *NextHandlerObj;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("EvAddrHandlerHelper");
+ ACPI_FUNCTION_NAME ("EvInstallHandler");
HandlerObj = (ACPI_OPERAND_OBJECT *) Context;
@@ -729,8 +729,8 @@ AcpiEvAddrHandlerHelper (
}
/*
- * We only care about regions.and objects
- * that can have address handlers
+ * We only care about regions.and objects
+ * that are allowed to have address space handlers
*/
if ((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_REGION) &&
@@ -744,85 +744,74 @@ AcpiEvAddrHandlerHelper (
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
- /*
- * The object DNE, we don't care about it
- */
+ /* No object, just exit */
+
return (AE_OK);
}
- /*
- * Devices are handled different than regions
- */
+ /* Devices are handled different than regions */
+
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_DEVICE)
{
- /*
- * See if this guy has any handlers
- */
- TmpObj = ObjDesc->Device.AddrHandler;
- while (TmpObj)
+ /* Check if this Device already has a handler for this address space */
+
+ NextHandlerObj = ObjDesc->Device.AddressSpace;
+ while (NextHandlerObj)
{
- /*
- * Now let's see if it's for the same address space.
- */
- if (TmpObj->AddrHandler.SpaceId == HandlerObj->AddrHandler.SpaceId)
+ /* Found a handler, is it for the same address space? */
+
+ if (NextHandlerObj->AddressSpace.SpaceId == HandlerObj->AddressSpace.SpaceId)
{
- /*
- * It's for the same address space
- */
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Found handler for region [%s] in device %p(%p) handler %p\n",
- AcpiUtGetRegionName (HandlerObj->AddrHandler.SpaceId),
- ObjDesc, TmpObj, HandlerObj));
+ AcpiUtGetRegionName (HandlerObj->AddressSpace.SpaceId),
+ ObjDesc, NextHandlerObj, HandlerObj));
/*
- * Since the object we found it on was a device, then it
- * means that someone has already installed a handler for
- * the branch of the namespace from this device on. Just
- * bail out telling the walk routine to not traverse this
- * branch. This preserves the scoping rule for handlers.
+ * Since the object we found it on was a device, then it
+ * means that someone has already installed a handler for
+ * the branch of the namespace from this device on. Just
+ * bail out telling the walk routine to not traverse this
+ * branch. This preserves the scoping rule for handlers.
*/
return (AE_CTRL_DEPTH);
}
- /*
- * Move through the linked list of handlers
- */
- TmpObj = TmpObj->AddrHandler.Next;
+ /* Walk the linked list of handlers attached to this device */
+
+ NextHandlerObj = NextHandlerObj->AddressSpace.Next;
}
/*
- * As long as the device didn't have a handler for this
- * space we don't care about it. We just ignore it and
- * proceed.
+ * As long as the device didn't have a handler for this
+ * space we don't care about it. We just ignore it and
+ * proceed.
*/
return (AE_OK);
}
- /*
- * Only here if it was a region
- */
- if (ObjDesc->Region.SpaceId != HandlerObj->AddrHandler.SpaceId)
+ /* Object is a Region */
+
+ if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId)
{
/*
- * This region is for a different address space
- * ignore it
+ * This region is for a different address space
+ * -- just ignore it
*/
return (AE_OK);
}
/*
- * Now we have a region and it is for the handler's address
- * space type.
+ * Now we have a region and it is for the handler's address
+ * space type.
*
- * First disconnect region for any previous handler (if any)
+ * First disconnect region for any previous handler (if any)
*/
AcpiEvDetachRegion (ObjDesc, FALSE);
- /*
- * Then connect the region to the new handler
- */
- Status = AcpiEvAttachRegion (HandlerObj, ObjDesc, FALSE);
+ /* Connect the region to the new handler */
+ Status = AcpiEvAttachRegion (HandlerObj, ObjDesc, FALSE);
return (Status);
}
diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c
index 2a53764..12bb927 100644
--- a/sys/contrib/dev/acpica/evrgnini.c
+++ b/sys/contrib/dev/acpica/evrgnini.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
- * $Revision: 66 $
+ * $Revision: 69 $
*
*****************************************************************************/
@@ -245,10 +245,11 @@ AcpiEvPciConfigRegionSetup (
void **RegionContext)
{
ACPI_STATUS Status = AE_OK;
- ACPI_INTEGER Temp;
+ ACPI_INTEGER PciValue;
ACPI_PCI_ID *PciId = *RegionContext;
ACPI_OPERAND_OBJECT *HandlerObj;
- ACPI_NAMESPACE_NODE *Node;
+ ACPI_NAMESPACE_NODE *ParentNode;
+ ACPI_NAMESPACE_NODE *PciRootNode;
ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle;
ACPI_DEVICE_ID ObjectHID;
@@ -256,7 +257,7 @@ AcpiEvPciConfigRegionSetup (
ACPI_FUNCTION_TRACE ("EvPciConfigRegionSetup");
- HandlerObj = RegionObj->Region.AddrHandler;
+ HandlerObj = RegionObj->Region.AddressSpace;
if (!HandlerObj)
{
/*
@@ -268,49 +269,17 @@ AcpiEvPciConfigRegionSetup (
return_ACPI_STATUS (AE_NOT_EXIST);
}
+ *RegionContext = NULL;
if (Function == ACPI_REGION_DEACTIVATE)
{
if (PciId)
{
ACPI_MEM_FREE (PciId);
- *RegionContext = NULL;
}
-
return_ACPI_STATUS (Status);
}
- /* Create a new context */
-
- PciId = ACPI_MEM_CALLOCATE (sizeof (ACPI_PCI_ID));
- if (!PciId)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * For PCI Config space access, we have to pass the segment, bus,
- * device and function numbers. This routine must acquire those.
- */
-
- /*
- * First get device and function numbers from the _ADR object
- * in the parent's scope.
- */
- Node = AcpiNsGetParentNode (RegionObj->Region.Node);
-
- /* Evaluate the _ADR object */
-
- Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &Temp);
-
- /*
- * The default is zero, and since the allocation above zeroed
- * the data, just do nothing on failure.
- */
- if (ACPI_SUCCESS (Status))
- {
- PciId->Device = ACPI_HIWORD (ACPI_LODWORD (Temp));
- PciId->Function = ACPI_LOWORD (ACPI_LODWORD (Temp));
- }
+ ParentNode = AcpiNsGetParentNode (RegionObj->Region.Node);
/*
* Get the _SEG and _BBN values from the device upon which the handler
@@ -321,69 +290,119 @@ AcpiEvPciConfigRegionSetup (
*/
/*
- * If the AddrHandler.Node is still pointing to the root, we need
+ * If the AddressSpace.Node is still pointing to the root, we need
* to scan upward for a PCI Root bridge and re-associate the OpRegion
* handlers with that device.
*/
- if (HandlerObj->AddrHandler.Node == AcpiGbl_RootNode)
+ if (HandlerObj->AddressSpace.Node == AcpiGbl_RootNode)
{
- /*
- * Node is currently the parent object
- */
- while (Node != AcpiGbl_RootNode)
+ /* Start search from the parent object */
+
+ PciRootNode = ParentNode;
+ while (PciRootNode != AcpiGbl_RootNode)
{
- Status = AcpiUtExecute_HID (Node, &ObjectHID);
+ Status = AcpiUtExecute_HID (PciRootNode, &ObjectHID);
if (ACPI_SUCCESS (Status))
{
/* Got a valid _HID, check if this is a PCI root */
- if (!(ACPI_STRNCMP (ObjectHID.Buffer, PCI_ROOT_HID_STRING,
+ if (!(ACPI_STRNCMP (ObjectHID.Value, PCI_ROOT_HID_STRING,
sizeof (PCI_ROOT_HID_STRING))))
{
/* Install a handler for this PCI root bridge */
- Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) Node,
+ Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) PciRootNode,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not install PciConfig handler for %4.4s, %s\n",
- Node->Name.Ascii, AcpiFormatException (Status)));
+ if (Status == AE_SAME_HANDLER)
+ {
+ /*
+ * It is OK if the handler is already installed on the root
+ * bridge. Still need to return a context object for the
+ * new PCI_Config operation region, however.
+ */
+ Status = AE_OK;
+ }
+ else
+ {
+ ACPI_REPORT_ERROR ((
+ "Could not install PciConfig handler for Root Bridge %4.4s, %s\n",
+ PciRootNode->Name.Ascii, AcpiFormatException (Status)));
+ }
}
break;
}
}
- Node = AcpiNsGetParentNode (Node);
+ PciRootNode = AcpiNsGetParentNode (PciRootNode);
}
+
+ /* PCI root bridge not found, use namespace root node */
}
else
{
- Node = HandlerObj->AddrHandler.Node;
+ PciRootNode = HandlerObj->AddressSpace.Node;
}
/*
- * The PCI segment number comes from the _SEG method
+ * If this region is now initialized, we are done.
+ * (InstallAddressSpaceHandler could have initialized it)
*/
- Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, Node, &Temp);
- if (ACPI_SUCCESS (Status))
+ if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Region is still not initialized. Create a new context */
+
+ PciId = ACPI_MEM_CALLOCATE (sizeof (ACPI_PCI_ID));
+ if (!PciId)
{
- PciId->Segment = ACPI_LOWORD (Temp);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
- * The PCI bus number comes from the _BBN method
+ * For PCI_Config space access, we need the segment, bus,
+ * device and function numbers. Acquire them here.
+ */
+
+ /*
+ * Get the PCI device and function numbers from the _ADR object
+ * contained in the parent's scope.
+ */
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, ParentNode, &PciValue);
+
+ /*
+ * The default is zero, and since the allocation above zeroed
+ * the data, just do nothing on failure.
*/
- Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, Node, &Temp);
if (ACPI_SUCCESS (Status))
{
- PciId->Bus = ACPI_LOWORD (Temp);
+ PciId->Device = ACPI_HIWORD (ACPI_LODWORD (PciValue));
+ PciId->Function = ACPI_LOWORD (ACPI_LODWORD (PciValue));
}
- /*
- * Complete this device's PciId
- */
- AcpiOsDerivePciId (Node, RegionObj->Region.Node, &PciId);
+ /* The PCI segment number comes from the _SEG method */
+
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, PciRootNode, &PciValue);
+ if (ACPI_SUCCESS (Status))
+ {
+ PciId->Segment = ACPI_LOWORD (PciValue);
+ }
+
+ /* The PCI bus number comes from the _BBN method */
+
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, PciRootNode, &PciValue);
+ if (ACPI_SUCCESS (Status))
+ {
+ PciId->Bus = ACPI_LOWORD (PciValue);
+ }
+
+ /* Complete this device's PciId */
+
+ AcpiOsDerivePciId (PciRootNode, RegionObj->Region.Node, &PciId);
*RegionContext = PciId;
return_ACPI_STATUS (AE_OK);
@@ -549,16 +568,17 @@ AcpiEvInitializeRegion (
Node = AcpiNsGetParentNode (RegionObj->Region.Node);
SpaceId = RegionObj->Region.SpaceId;
- RegionObj->Region.AddrHandler = NULL;
+ /* Setup defaults */
+
+ RegionObj->Region.AddressSpace = NULL;
RegionObj2->Extra.Method_REG = NULL;
RegionObj->Common.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;
- /*
- * Find any "_REG" method associated with this region definition
- */
+ /* Find any "_REG" method associated with this region definition */
+
Status = AcpiNsSearchNode (*RegNamePtr, Node,
- ACPI_TYPE_METHOD, &MethodNode);
+ ACPI_TYPE_METHOD, &MethodNode);
if (ACPI_SUCCESS (Status))
{
/*
@@ -575,31 +595,29 @@ AcpiEvInitializeRegion (
*/
while (Node)
{
- /*
- * Check to see if a handler exists
- */
+ /* Check to see if a handler exists */
+
HandlerObj = NULL;
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
- /*
- * Can only be a handler if the object exists
- */
+ /* Can only be a handler if the object exists */
+
switch (Node->Type)
{
case ACPI_TYPE_DEVICE:
- HandlerObj = ObjDesc->Device.AddrHandler;
+ HandlerObj = ObjDesc->Device.AddressSpace;
break;
case ACPI_TYPE_PROCESSOR:
- HandlerObj = ObjDesc->Processor.AddrHandler;
+ HandlerObj = ObjDesc->Processor.AddressSpace;
break;
case ACPI_TYPE_THERMAL:
- HandlerObj = ObjDesc->ThermalZone.AddrHandler;
+ HandlerObj = ObjDesc->ThermalZone.AddressSpace;
break;
default:
@@ -611,7 +629,7 @@ AcpiEvInitializeRegion (
{
/* Is this handler of the correct type? */
- if (HandlerObj->AddrHandler.SpaceId == SpaceId)
+ if (HandlerObj->AddressSpace.SpaceId == SpaceId)
{
/* Found correct handler */
@@ -627,7 +645,7 @@ AcpiEvInitializeRegion (
/* Try next handler in the list */
- HandlerObj = HandlerObj->AddrHandler.Next;
+ HandlerObj = HandlerObj->AddressSpace.Next;
}
}
@@ -638,9 +656,8 @@ AcpiEvInitializeRegion (
Node = AcpiNsGetParentNode (Node);
}
- /*
- * If we get here, there is no handler for this region
- */
+ /* If we get here, there is no handler for this region */
+
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"No handler for RegionType %s(%X) (RegionObj %p)\n",
AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj));
diff --git a/sys/contrib/dev/acpica/evsci.c b/sys/contrib/dev/acpica/evsci.c
index d393387..8397fdd 100644
--- a/sys/contrib/dev/acpica/evsci.c
+++ b/sys/contrib/dev/acpica/evsci.c
@@ -2,7 +2,7 @@
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
- * $Revision: 88 $
+ * $Revision: 93 $
*
******************************************************************************/
@@ -126,26 +126,26 @@
/*******************************************************************************
*
- * FUNCTION: AcpiEvSciHandler
+ * FUNCTION: AcpiEvSciXruptHandler
*
* PARAMETERS: Context - Calling Context
*
* RETURN: Status code indicates whether interrupt was handled.
*
* DESCRIPTION: Interrupt handler that will figure out what function or
- * control method to call to deal with a SCI. Installed
- * using BU interrupt support.
+ * control method to call to deal with a SCI.
*
******************************************************************************/
static UINT32 ACPI_SYSTEM_XFACE
-AcpiEvSciHandler (
+AcpiEvSciXruptHandler (
void *Context)
{
+ ACPI_GPE_XRUPT_INFO *GpeXruptList = Context;
UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
- ACPI_FUNCTION_TRACE("EvSciHandler");
+ ACPI_FUNCTION_TRACE("EvSciXruptHandler");
/*
@@ -154,16 +154,54 @@ AcpiEvSciHandler (
*/
/*
- * Fixed AcpiEvents:
- * Check for and dispatch any Fixed AcpiEvents that have occurred
+ * Fixed Events:
+ * Check for and dispatch any Fixed Events that have occurred
*/
InterruptHandled |= AcpiEvFixedEventDetect ();
/*
+ * General Purpose Events:
+ * Check for and dispatch any GPEs that have occurred
+ */
+ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
+
+ return_VALUE (InterruptHandled);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGpeXruptHandler
+ *
+ * PARAMETERS: Context - Calling Context
+ *
+ * RETURN: Status code indicates whether interrupt was handled.
+ *
+ * DESCRIPTION: Handler for GPE Block Device interrupts
+ *
+ ******************************************************************************/
+
+UINT32 ACPI_SYSTEM_XFACE
+AcpiEvGpeXruptHandler (
+ void *Context)
+{
+ ACPI_GPE_XRUPT_INFO *GpeXruptList = Context;
+ UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
+
+
+ ACPI_FUNCTION_TRACE("EvGpeXruptHandler");
+
+
+ /*
+ * We are guaranteed by the ACPI CA 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 ();
+ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
return_VALUE (InterruptHandled);
}
@@ -191,7 +229,7 @@ AcpiEvInstallSciHandler (void)
Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
- AcpiEvSciHandler, NULL);
+ AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead);
return_ACPI_STATUS (Status);
}
@@ -227,7 +265,7 @@ AcpiEvRemoveSciHandler (void)
/* Just let the OS remove the handler and disable the level */
Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
- AcpiEvSciHandler);
+ AcpiEvSciXruptHandler);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/evxface.c
index d566c95..3c3db78 100644
--- a/sys/contrib/dev/acpica/evxface.c
+++ b/sys/contrib/dev/acpica/evxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 135 $
+ * $Revision: 141 $
*
*****************************************************************************/
@@ -180,7 +180,7 @@ AcpiInstallFixedEventHandler (
AcpiGbl_FixedEventHandlers[Event].Handler = Handler;
AcpiGbl_FixedEventHandlers[Event].Context = Context;
- Status = AcpiEnableEvent (Event, ACPI_EVENT_FIXED, 0);
+ Status = AcpiEnableEvent (Event, 0);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
@@ -242,7 +242,7 @@ AcpiRemoveFixedEventHandler (
/* Disable the event before removing the handler */
- Status = AcpiDisableEvent(Event, ACPI_EVENT_FIXED, 0);
+ Status = AcpiDisableEvent (Event, 0);
/* Always Remove the handler */
@@ -332,9 +332,9 @@ AcpiInstallNotifyHandler (
/* Make sure the handler is not already installed */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
- AcpiGbl_SysNotify.Handler) ||
+ AcpiGbl_SystemNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
- AcpiGbl_DrvNotify.Handler))
+ AcpiGbl_DeviceNotify.Handler))
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
@@ -342,15 +342,15 @@ AcpiInstallNotifyHandler (
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- AcpiGbl_SysNotify.Node = Node;
- AcpiGbl_SysNotify.Handler = Handler;
- AcpiGbl_SysNotify.Context = Context;
+ AcpiGbl_SystemNotify.Node = Node;
+ AcpiGbl_SystemNotify.Handler = Handler;
+ AcpiGbl_SystemNotify.Context = Context;
}
else /* ACPI_DEVICE_NOTIFY */
{
- AcpiGbl_DrvNotify.Node = Node;
- AcpiGbl_DrvNotify.Handler = Handler;
- AcpiGbl_DrvNotify.Context = Context;
+ AcpiGbl_DeviceNotify.Node = Node;
+ AcpiGbl_DeviceNotify.Handler = Handler;
+ AcpiGbl_DeviceNotify.Context = Context;
}
/* Global notify handler installed */
@@ -376,13 +376,12 @@ AcpiInstallNotifyHandler (
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
-
/* Object exists - make sure there's no handler */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
- ObjDesc->CommonNotify.SysHandler) ||
+ ObjDesc->CommonNotify.SystemNotify) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
- ObjDesc->CommonNotify.DrvHandler))
+ ObjDesc->CommonNotify.DeviceNotify))
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
@@ -402,6 +401,11 @@ AcpiInstallNotifyHandler (
/* Attach new object to the Node */
Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -417,17 +421,17 @@ AcpiInstallNotifyHandler (
goto UnlockAndExit;
}
- NotifyObj->NotifyHandler.Node = Node;
- NotifyObj->NotifyHandler.Handler = Handler;
- NotifyObj->NotifyHandler.Context = Context;
+ NotifyObj->Notify.Node = Node;
+ NotifyObj->Notify.Handler = Handler;
+ NotifyObj->Notify.Context = Context;
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- ObjDesc->CommonNotify.SysHandler = NotifyObj;
+ ObjDesc->CommonNotify.SystemNotify = NotifyObj;
}
else /* ACPI_DEVICE_NOTIFY */
{
- ObjDesc->CommonNotify.DrvHandler = NotifyObj;
+ ObjDesc->CommonNotify.DeviceNotify = NotifyObj;
}
}
@@ -500,9 +504,9 @@ AcpiRemoveNotifyHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n"));
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
- !AcpiGbl_SysNotify.Handler) ||
+ !AcpiGbl_SystemNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
- !AcpiGbl_DrvNotify.Handler))
+ !AcpiGbl_DeviceNotify.Handler))
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
@@ -510,15 +514,15 @@ AcpiRemoveNotifyHandler (
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- AcpiGbl_SysNotify.Node = NULL;
- AcpiGbl_SysNotify.Handler = NULL;
- AcpiGbl_SysNotify.Context = NULL;
+ AcpiGbl_SystemNotify.Node = NULL;
+ AcpiGbl_SystemNotify.Handler = NULL;
+ AcpiGbl_SystemNotify.Context = NULL;
}
else
{
- AcpiGbl_DrvNotify.Node = NULL;
- AcpiGbl_DrvNotify.Handler = NULL;
- AcpiGbl_DrvNotify.Context = NULL;
+ AcpiGbl_DeviceNotify.Node = NULL;
+ AcpiGbl_DeviceNotify.Handler = NULL;
+ AcpiGbl_DeviceNotify.Context = NULL;
}
}
@@ -548,15 +552,15 @@ AcpiRemoveNotifyHandler (
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- NotifyObj = ObjDesc->CommonNotify.SysHandler;
+ NotifyObj = ObjDesc->CommonNotify.SystemNotify;
}
else
{
- NotifyObj = ObjDesc->CommonNotify.DrvHandler;
+ NotifyObj = ObjDesc->CommonNotify.DeviceNotify;
}
if ((!NotifyObj) ||
- (NotifyObj->NotifyHandler.Handler != Handler))
+ (NotifyObj->Notify.Handler != Handler))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@@ -566,11 +570,11 @@ AcpiRemoveNotifyHandler (
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- ObjDesc->CommonNotify.SysHandler = NULL;
+ ObjDesc->CommonNotify.SystemNotify = NULL;
}
else
{
- ObjDesc->CommonNotify.DrvHandler = NULL;
+ ObjDesc->CommonNotify.DeviceNotify = NULL;
}
AcpiUtRemoveReference (NotifyObj);
@@ -587,8 +591,8 @@ UnlockAndExit:
*
* FUNCTION: AcpiInstallGpeHandler
*
- * PARAMETERS: GpeNumber - The GPE number. The numbering scheme is
- * bank 0 first, then bank 1.
+ * PARAMETERS: GpeNumber - The GPE number within the GPE block
+ * GpeBlock - GPE block (NULL == FADT GPEs)
* Type - Whether this GPE should be treated as an
* edge- or level-triggered interrupt.
* Handler - Address of the handler
@@ -602,6 +606,7 @@ UnlockAndExit:
ACPI_STATUS
AcpiInstallGpeHandler (
+ ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Type,
ACPI_GPE_HANDLER Handler,
@@ -621,46 +626,49 @@ AcpiInstallGpeHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Ensure that we have a valid GPE number */
-
- GpeEventInfo = AcpiEvGetGpeEventInfo (GpeNumber);
- if (!GpeEventInfo)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
+ /* Ensure that we have a valid GPE number */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
/* Make sure that there isn't a handler there already */
if (GpeEventInfo->Handler)
{
Status = AE_ALREADY_EXISTS;
- goto Cleanup;
+ goto UnlockAndExit;
}
/* Install the handler */
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
GpeEventInfo->Handler = Handler;
GpeEventInfo->Context = Context;
- GpeEventInfo->Type = (UINT8) Type;
+ GpeEventInfo->Flags = (UINT8) Type;
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
/* Clear the GPE (of stale events), the enable it */
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- goto Cleanup;
+ goto UnlockAndExit;
}
Status = AcpiHwEnableGpe (GpeEventInfo);
-Cleanup:
+UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@@ -671,6 +679,7 @@ Cleanup:
* FUNCTION: AcpiRemoveGpeHandler
*
* PARAMETERS: GpeNumber - The event to remove a handler
+ * GpeBlock - GPE block (NULL == FADT GPEs)
* Handler - Address of the handler
*
* RETURN: Status
@@ -681,6 +690,7 @@ Cleanup:
ACPI_STATUS
AcpiRemoveGpeHandler (
+ ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
ACPI_GPE_HANDLER Handler)
{
@@ -698,12 +708,19 @@ AcpiRemoveGpeHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Ensure that we have a valid GPE number */
- GpeEventInfo = AcpiEvGetGpeEventInfo (GpeNumber);
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
}
/* Disable the GPE before removing the handler */
@@ -711,13 +728,7 @@ AcpiRemoveGpeHandler (
Status = AcpiHwDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
+ goto UnlockAndExit;
}
/* Make sure that the installed handler is the same */
@@ -726,16 +737,18 @@ AcpiRemoveGpeHandler (
{
(void) AcpiHwEnableGpe (GpeEventInfo);
Status = AE_BAD_PARAMETER;
- goto Cleanup;
+ goto UnlockAndExit;
}
/* Remove the handler */
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
GpeEventInfo->Handler = NULL;
GpeEventInfo->Context = NULL;
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
-Cleanup:
+UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c
index 753c6d0..668ecfd 100644
--- a/sys/contrib/dev/acpica/evxfevnt.c
+++ b/sys/contrib/dev/acpica/evxfevnt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- * $Revision: 62 $
+ * $Revision: 73 $
*
*****************************************************************************/
@@ -119,6 +119,7 @@
#include "acpi.h"
#include "acevents.h"
+#include "acnamesp.h"
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evxfevnt")
@@ -195,6 +196,7 @@ AcpiDisable (void)
ACPI_FUNCTION_TRACE ("AcpiDisable");
+
if (!AcpiGbl_FADT)
{
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
@@ -228,102 +230,131 @@ AcpiDisable (void)
*
* FUNCTION: AcpiEnableEvent
*
- * PARAMETERS: Event - The fixed event or GPE to be enabled
- * Type - The type of event
- * Flags - Just enable, or also wake enable?
+ * PARAMETERS: Event - The fixed eventto be enabled
+ * Flags - Reserved
*
* RETURN: Status
*
- * DESCRIPTION: Enable an ACPI event (fixed and general purpose)
+ * DESCRIPTION: Enable an ACPI event (fixed)
*
******************************************************************************/
ACPI_STATUS
AcpiEnableEvent (
UINT32 Event,
- UINT32 Type,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
UINT32 Value;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiEnableEvent");
- /* The Type must be either Fixed Event or GPE */
+ /* Decode the Fixed Event */
- switch (Type)
+ if (Event > ACPI_EVENT_MAX)
{
- case ACPI_EVENT_FIXED:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
- /* Decode the Fixed Event */
+ /*
+ * Enable the requested fixed event (by writing a one to the
+ * enable register bit)
+ */
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ 1, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- if (Event > ACPI_EVENT_MAX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ /* Make sure that the hardware responded */
- /*
- * Enable the requested fixed event (by writing a one to the
- * enable register bit)
- */
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- 1, ACPI_MTX_LOCK);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ &Value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- /* Make sure that the hardware responded */
+ if (Value != 1)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not enable %s event\n", AcpiUtGetEventName (Event)));
+ return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+ }
- Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- &Value, ACPI_MTX_LOCK);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ return_ACPI_STATUS (Status);
+}
- if (Value != 1)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not enable %s event\n", AcpiUtGetEventName (Event)));
- return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
- }
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEnableGpe
+ *
+ * PARAMETERS: GpeDevice - Parent GPE Device
+ * GpeNumber - GPE level within the GPE block
+ * Flags - Just enable, or also wake enable?
+ * Called from ISR or not
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enable an ACPI event (general purpose)
+ *
+ ******************************************************************************/
- case ACPI_EVENT_GPE:
+ACPI_STATUS
+AcpiEnableGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
- /* Ensure that we have a valid GPE number */
- GpeEventInfo = AcpiEvGetGpeEventInfo (Event);
- if (!GpeEventInfo)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ ACPI_FUNCTION_TRACE ("AcpiEnableGpe");
- /* Enable the requested GPE number */
- Status = AcpiHwEnableGpe (GpeEventInfo);
+ /* Use semaphore lock if not executing at interrupt level */
+
+ if (Flags & ACPI_NOT_ISR)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
+ }
- if (Flags & ACPI_EVENT_WAKE_ENABLE)
- {
- AcpiHwEnableGpeForWakeup (GpeEventInfo);
- }
- break;
+ /* Ensure that we have a valid GPE number */
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
- default:
+ /* Enable the requested GPE number */
- Status = AE_BAD_PARAMETER;
+ Status = AcpiHwEnableGpe (GpeEventInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ if (Flags & ACPI_EVENT_WAKE_ENABLE)
+ {
+ AcpiHwEnableGpeForWakeup (GpeEventInfo);
}
+UnlockAndExit:
+ if (Flags & ACPI_NOT_ISR)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ }
return_ACPI_STATUS (Status);
}
@@ -332,100 +363,129 @@ AcpiEnableEvent (
*
* FUNCTION: AcpiDisableEvent
*
- * PARAMETERS: Event - The fixed event or GPE to be enabled
- * Type - The type of event, fixed or general purpose
- * Flags - Wake disable vs. non-wake disable
+ * PARAMETERS: Event - The fixed eventto be enabled
+ * Flags - Reserved
*
* RETURN: Status
*
- * DESCRIPTION: Disable an ACPI event (fixed and general purpose)
+ * DESCRIPTION: Disable an ACPI event (fixed)
*
******************************************************************************/
ACPI_STATUS
AcpiDisableEvent (
UINT32 Event,
- UINT32 Type,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
UINT32 Value;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiDisableEvent");
- /* The Type must be either Fixed Event or GPE */
+ /* Decode the Fixed Event */
- switch (Type)
+ if (Event > ACPI_EVENT_MAX)
{
- case ACPI_EVENT_FIXED:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
- /* Decode the Fixed Event */
+ /*
+ * Disable the requested fixed event (by writing a zero to the
+ * enable register bit)
+ */
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ 0, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- if (Event > ACPI_EVENT_MAX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+ &Value, ACPI_MTX_LOCK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- /*
- * Disable the requested fixed event (by writing a zero to the
- * enable register bit)
- */
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- 0, ACPI_MTX_LOCK);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ if (Value != 0)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not disable %s events\n", AcpiUtGetEventName (Event)));
+ return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+ }
- Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- &Value, ACPI_MTX_LOCK);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ return_ACPI_STATUS (Status);
+}
- if (Value != 0)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not disable %s events\n", AcpiUtGetEventName (Event)));
- return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
- }
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDisableGpe
+ *
+ * PARAMETERS: GpeDevice - Parent GPE Device
+ * GpeNumber - GPE level within the GPE block
+ * Flags - Just enable, or also wake enable?
+ * Called from ISR or not
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Disable an ACPI event (general purpose)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDisableGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
- case ACPI_EVENT_GPE:
- /* Ensure that we have a valid GPE number */
+ ACPI_FUNCTION_TRACE ("AcpiDisableGpe");
- GpeEventInfo = AcpiEvGetGpeEventInfo (Event);
- if (!GpeEventInfo)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
- /*
- * Only disable the requested GPE number for wake if specified.
- * Otherwise, turn it totally off
- */
+ /* Use semaphore lock if not executing at interrupt level */
- if (Flags & ACPI_EVENT_WAKE_DISABLE)
- {
- AcpiHwDisableGpeForWakeup (GpeEventInfo);
- }
- else
+ if (Flags & ACPI_NOT_ISR)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
{
- Status = AcpiHwDisableGpe (GpeEventInfo);
+ return_ACPI_STATUS (Status);
}
- break;
+ }
+ /* Ensure that we have a valid GPE number */
- default:
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
}
+ /*
+ * Only disable the requested GPE number for wake if specified.
+ * Otherwise, turn it totally off
+ */
+ if (Flags & ACPI_EVENT_WAKE_DISABLE)
+ {
+ AcpiHwDisableGpeForWakeup (GpeEventInfo);
+ }
+ else
+ {
+ Status = AcpiHwDisableGpe (GpeEventInfo);
+ }
+
+UnlockAndExit:
+ if (Flags & ACPI_NOT_ISR)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ }
return_ACPI_STATUS (Status);
}
@@ -434,68 +494,96 @@ AcpiDisableEvent (
*
* FUNCTION: AcpiClearEvent
*
- * PARAMETERS: Event - The fixed event or GPE to be cleared
- * Type - The type of event
+ * PARAMETERS: Event - The fixed event to be cleared
*
* RETURN: Status
*
- * DESCRIPTION: Clear an ACPI event (fixed and general purpose)
+ * DESCRIPTION: Clear an ACPI event (fixed)
*
******************************************************************************/
ACPI_STATUS
AcpiClearEvent (
- UINT32 Event,
- UINT32 Type)
+ UINT32 Event)
{
ACPI_STATUS Status = AE_OK;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiClearEvent");
- /* The Type must be either Fixed Event or GPE */
+ /* Decode the Fixed Event */
- switch (Type)
+ if (Event > ACPI_EVENT_MAX)
{
- case ACPI_EVENT_FIXED:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
- /* Decode the Fixed Event */
+ /*
+ * Clear the requested fixed event (By writing a one to the
+ * status register bit)
+ */
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+ 1, ACPI_MTX_LOCK);
- if (Event > ACPI_EVENT_MAX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ return_ACPI_STATUS (Status);
+}
- /*
- * Clear the requested fixed event (By writing a one to the
- * status register bit)
- */
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
- 1, ACPI_MTX_LOCK);
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiClearGpe
+ *
+ * PARAMETERS: GpeDevice - Parent GPE Device
+ * GpeNumber - GPE level within the GPE block
+ * Flags - Called from an ISR or not
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Clear an ACPI event (general purpose)
+ *
+ ******************************************************************************/
- case ACPI_EVENT_GPE:
+ACPI_STATUS
+AcpiClearGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
- /* Ensure that we have a valid GPE number */
- GpeEventInfo = AcpiEvGetGpeEventInfo (Event);
- if (!GpeEventInfo)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ ACPI_FUNCTION_TRACE ("AcpiClearGpe");
- Status = AcpiHwClearGpe (GpeEventInfo);
- break;
+ /* Use semaphore lock if not executing at interrupt level */
- default:
+ if (Flags & ACPI_NOT_ISR)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* Ensure that we have a valid GPE number */
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
}
+ Status = AcpiHwClearGpe (GpeEventInfo);
+
+UnlockAndExit:
+ if (Flags & ACPI_NOT_ISR)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ }
return_ACPI_STATUS (Status);
}
@@ -504,9 +592,8 @@ AcpiClearEvent (
*
* FUNCTION: AcpiGetEventStatus
*
- * PARAMETERS: Event - The fixed event or GPE
- * Type - The type of event
- * Status - Where the current status of the event will
+ * PARAMETERS: Event - The fixed event
+ * Event Status - Where the current status of the event will
* be returned
*
* RETURN: Status
@@ -515,15 +602,12 @@ AcpiClearEvent (
*
******************************************************************************/
-
ACPI_STATUS
AcpiGetEventStatus (
UINT32 Event,
- UINT32 Type,
ACPI_EVENT_STATUS *EventStatus)
{
ACPI_STATUS Status = AE_OK;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE ("AcpiGetEventStatus");
@@ -534,48 +618,245 @@ AcpiGetEventStatus (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ /* Decode the Fixed Event */
- /* The Type must be either Fixed Event or GPE */
-
- switch (Type)
+ if (Event > ACPI_EVENT_MAX)
{
- case ACPI_EVENT_FIXED:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
- /* Decode the Fixed Event */
+ /* Get the status of the requested fixed event */
- if (Event > ACPI_EVENT_MAX)
+ Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+ EventStatus, ACPI_MTX_LOCK);
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetGpeStatus
+ *
+ * PARAMETERS: GpeDevice - Parent GPE Device
+ * GpeNumber - GPE level within the GPE block
+ * Flags - Called from an ISR or not
+ * Event Status - Where the current status of the event will
+ * be returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get status of an event (general purpose)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetGpeStatus (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ UINT32 Flags,
+ ACPI_EVENT_STATUS *EventStatus)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiGetGpeStatus");
+
+
+ /* Use semaphore lock if not executing at interrupt level */
+
+ if (Flags & ACPI_NOT_ISR)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (Status);
}
+ }
- /* Get the status of the requested fixed event */
+ /* Ensure that we have a valid GPE number */
- Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
- EventStatus, ACPI_MTX_LOCK);
- break;
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Obtain status on the requested GPE number */
+ Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);
+
+UnlockAndExit:
+ if (Flags & ACPI_NOT_ISR)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ }
+ return_ACPI_STATUS (Status);
+}
- case ACPI_EVENT_GPE:
- /* Ensure that we have a valid GPE number */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInstallGpeBlock
+ *
+ * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
+ * GpeBlockAddress - Address and SpaceID
+ * RegisterCount - Number of GPE register pairs in the block
+ * InterruptLevel - H/W interrupt for the block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create and Install a block of GPE registers
+ *
+ ******************************************************************************/
- GpeEventInfo = AcpiEvGetGpeEventInfo (Event);
- if (!GpeEventInfo)
+ACPI_STATUS
+AcpiInstallGpeBlock (
+ ACPI_HANDLE GpeDevice,
+ ACPI_GENERIC_ADDRESS *GpeBlockAddress,
+ UINT32 RegisterCount,
+ UINT32 InterruptLevel)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiInstallGpeBlock");
+
+
+ if ((!GpeDevice) ||
+ (!GpeBlockAddress) ||
+ (!RegisterCount))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Node = AcpiNsMapHandleToNode (GpeDevice);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /*
+ * For user-installed GPE Block Devices, the GpeBlockBaseNumber
+ * is always zero
+ */
+ Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
+ 0, InterruptLevel, &GpeBlock);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Get the DeviceObject attached to the node */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc)
+ {
+ /* No object, create a new one */
+
+ ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE);
+ if (!ObjDesc)
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ Status = AE_NO_MEMORY;
+ goto UnlockAndExit;
}
- /* Obtain status on the requested GPE number */
+ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE);
- Status = AcpiHwGetGpeStatus (Event, EventStatus);
- break;
+ /* Remove local reference to the object */
+ AcpiUtRemoveReference (ObjDesc);
- default:
- Status = AE_BAD_PARAMETER;
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
}
+ /* Install the GPE block in the DeviceObject */
+
+ ObjDesc->Device.GpeBlock = GpeBlock;
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRemoveGpeBlock
+ *
+ * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove a previously installed block of GPE registers
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRemoveGpeBlock (
+ ACPI_HANDLE GpeDevice)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ACPI_FUNCTION_TRACE ("AcpiRemoveGpeBlock");
+
+
+ if (!GpeDevice)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Node = AcpiNsMapHandleToNode (GpeDevice);
+ if (!Node)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ /* Get the DeviceObject attached to the node */
+
+ ObjDesc = AcpiNsGetAttachedObject (Node);
+ if (!ObjDesc ||
+ !ObjDesc->Device.GpeBlock)
+ {
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
+
+ /* Delete the GPE block (but not the DeviceObject) */
+
+ Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock);
+ if (ACPI_SUCCESS (Status))
+ {
+ ObjDesc->Device.GpeBlock = NULL;
+ }
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/evxfregn.c
index 6bd920c..ed16c7a 100644
--- a/sys/contrib/dev/acpica/evxfregn.c
+++ b/sys/contrib/dev/acpica/evxfregn.c
@@ -2,7 +2,7 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
- * $Revision: 53 $
+ * $Revision: 56 $
*
*****************************************************************************/
@@ -234,49 +234,58 @@ AcpiInstallAddressSpaceHandler (
break;
default:
- Status = AE_NOT_EXIST;
+ Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
}
- /*
- * If the caller hasn't specified a setup routine, use the default
- */
+ /* If the caller hasn't specified a setup routine, use the default */
+
if (!Setup)
{
Setup = AcpiEvDefaultRegionSetup;
}
- /*
- * Check for an existing internal object
- */
+ /* Check for an existing internal object */
+
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
/*
- * The object exists.
+ * The attached device object already exists.
* Make sure the handler is not already installed.
*/
+ HandlerObj = ObjDesc->Device.AddressSpace;
- /* check the address handler the user requested */
+ /* Walk the handler list for this device */
- HandlerObj = ObjDesc->Device.AddrHandler;
while (HandlerObj)
{
- /*
- * We have an Address handler, see if user requested this
- * address space.
- */
- if(HandlerObj->AddrHandler.SpaceId == SpaceId)
+ /* Same SpaceId indicates a handler already installed */
+
+ if(HandlerObj->AddressSpace.SpaceId == SpaceId)
{
- Status = AE_ALREADY_EXISTS;
+ if (HandlerObj->AddressSpace.Handler == Handler)
+ {
+ /*
+ * It is (relatively) OK to attempt to install the SAME
+ * handler twice. This can easily happen with PCI_Config space.
+ */
+ Status = AE_SAME_HANDLER;
+ goto UnlockAndExit;
+ }
+ else
+ {
+ /* A handler is already installed */
+
+ Status = AE_ALREADY_EXISTS;
+ }
goto UnlockAndExit;
}
- /*
- * Move through the linked list of handlers
- */
- HandlerObj = HandlerObj->AddrHandler.Next;
+ /* Walk the linked list of handlers */
+
+ HandlerObj = HandlerObj->AddressSpace.Next;
}
}
else
@@ -309,9 +318,13 @@ AcpiInstallAddressSpaceHandler (
/* Attach the new object to the Node */
Status = AcpiNsAttachObject (Node, ObjDesc, Type);
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+
if (ACPI_FAILURE (Status))
{
- AcpiUtRemoveReference (ObjDesc);
goto UnlockAndExit;
}
}
@@ -321,10 +334,10 @@ AcpiInstallAddressSpaceHandler (
AcpiUtGetRegionName (SpaceId), SpaceId, Node->Name.Ascii, Node, ObjDesc));
/*
- * Now we can install the handler
+ * Install the handler
*
- * At this point we know that there is no existing handler.
- * So, we just allocate the object for the handler and link it
+ * At this point there is no existing handler.
+ * Just allocate the object for the handler and link it
* into the list.
*/
HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
@@ -334,40 +347,41 @@ AcpiInstallAddressSpaceHandler (
goto UnlockAndExit;
}
- HandlerObj->AddrHandler.SpaceId = (UINT8) SpaceId;
- HandlerObj->AddrHandler.Hflags = Flags;
- HandlerObj->AddrHandler.Next = ObjDesc->Device.AddrHandler;
- HandlerObj->AddrHandler.RegionList = NULL;
- HandlerObj->AddrHandler.Node = Node;
- HandlerObj->AddrHandler.Handler = Handler;
- HandlerObj->AddrHandler.Context = Context;
- HandlerObj->AddrHandler.Setup = Setup;
+ /* Init handler obj */
+
+ HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
+ HandlerObj->AddressSpace.Hflags = Flags;
+ HandlerObj->AddressSpace.RegionList = NULL;
+ HandlerObj->AddressSpace.Node = Node;
+ HandlerObj->AddressSpace.Handler = Handler;
+ HandlerObj->AddressSpace.Context = Context;
+ HandlerObj->AddressSpace.Setup = Setup;
+
+ /* Install at head of Device.AddressSpace list */
+
+ HandlerObj->AddressSpace.Next = ObjDesc->Device.AddressSpace;
+
+ /*
+ * The Device object is the first reference on the HandlerObj.
+ * Each region that uses the handler adds a reference.
+ */
+ ObjDesc->Device.AddressSpace = HandlerObj;
/*
- * Now walk the namespace finding all of the regions this
+ * Walk the namespace finding all of the regions this
* handler will manage.
*
- * We start at the device and search the branch toward
+ * Start at the device and search the branch toward
* the leaf nodes until either the leaf is encountered or
* a device is detected that has an address handler of the
* same type.
*
- * In either case we back up and search down the remainder
+ * In either case, back up and search down the remainder
* of the branch
*/
- Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Device,
- ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
- AcpiEvAddrHandlerHelper,
- HandlerObj, NULL);
-
- /*
- * Place this handler 1st on the list
- */
- HandlerObj->Common.ReferenceCount =
- (UINT16) (HandlerObj->Common.ReferenceCount +
- ObjDesc->Common.ReferenceCount - 1);
- ObjDesc->Device.AddrHandler = HandlerObj;
-
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Device, ACPI_UINT32_MAX,
+ ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler,
+ HandlerObj, NULL);
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
@@ -379,12 +393,13 @@ UnlockAndExit:
*
* FUNCTION: AcpiRemoveAddressSpaceHandler
*
- * PARAMETERS: SpaceId - The address space ID
+ * PARAMETERS: Device - Handle for the device
+ * SpaceId - The address space ID
* Handler - Address of the handler
*
* RETURN: Status
*
- * DESCRIPTION: Install a handler for accesses on an Operation Region
+ * DESCRIPTION: Remove a previously installed handler.
*
******************************************************************************/
@@ -436,27 +451,24 @@ AcpiRemoveAddressSpaceHandler (
goto UnlockAndExit;
}
- /*
- * find the address handler the user requested
- */
- HandlerObj = ObjDesc->Device.AddrHandler;
- LastObjPtr = &ObjDesc->Device.AddrHandler;
+ /* Find the address handler the user requested */
+
+ HandlerObj = ObjDesc->Device.AddressSpace;
+ LastObjPtr = &ObjDesc->Device.AddressSpace;
while (HandlerObj)
{
- /*
- * We have a handler, see if user requested this one
- */
- if (HandlerObj->AddrHandler.SpaceId == SpaceId)
+ /* We have a handler, see if user requested this one */
+
+ if (HandlerObj->AddressSpace.SpaceId == SpaceId)
{
- /*
- * Got it, first dereference this in the Regions
- */
+ /* Matched SpaceId, first dereference this in the Regions */
+
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Removing address handler %p(%p) for region %s on Device %p(%p)\n",
HandlerObj, Handler, AcpiUtGetRegionName (SpaceId),
Node, ObjDesc));
- RegionObj = HandlerObj->AddrHandler.RegionList;
+ RegionObj = HandlerObj->AddressSpace.RegionList;
/* Walk the handler's region list */
@@ -472,46 +484,37 @@ AcpiRemoveAddressSpaceHandler (
AcpiEvDetachRegion (RegionObj, TRUE);
/*
- * Walk the list, since we took the first region and it
- * was removed from the list by the dissassociate call
- * we just get the first item on the list again
+ * Walk the list: Just grab the head because the
+ * DetachRegion removed the previous head.
*/
- RegionObj = HandlerObj->AddrHandler.RegionList;
+ RegionObj = HandlerObj->AddressSpace.RegionList;
}
- /*
- * Remove this Handler object from the list
- */
- *LastObjPtr = HandlerObj->AddrHandler.Next;
+ /* Remove this Handler object from the list */
- /*
- * Now we can delete the handler object
- */
- AcpiUtRemoveReference (HandlerObj);
- AcpiUtRemoveReference (HandlerObj);
+ *LastObjPtr = HandlerObj->AddressSpace.Next;
+
+ /* Now we can delete the handler object */
+ AcpiUtRemoveReference (HandlerObj);
goto UnlockAndExit;
}
- /*
- * Move through the linked list of handlers
- */
- LastObjPtr = &HandlerObj->AddrHandler.Next;
- HandlerObj = HandlerObj->AddrHandler.Next;
+ /* Walk the linked list of handlers */
+
+ LastObjPtr = &HandlerObj->AddressSpace.Next;
+ HandlerObj = HandlerObj->AddressSpace.Next;
}
+ /* The handler does not exist */
- /*
- * The handler does not exist
- */
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n",
Handler, AcpiUtGetRegionName (SpaceId), SpaceId, Node, ObjDesc));
Status = AE_NOT_EXIST;
-
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c
index 48190e9..77be255 100644
--- a/sys/contrib/dev/acpica/exconfig.c
+++ b/sys/contrib/dev/acpica/exconfig.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- * $Revision: 71 $
+ * $Revision: 72 $
*
*****************************************************************************/
@@ -457,11 +457,11 @@ AcpiExLoadOp (
/* The table must be either an SSDT or a PSDT */
if ((!ACPI_STRNCMP (TablePtr->Signature,
- AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].Signature,
- AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].SigLength)) &&
+ AcpiGbl_TableData[ACPI_TABLE_PSDT].Signature,
+ AcpiGbl_TableData[ACPI_TABLE_PSDT].SigLength)) &&
(!ACPI_STRNCMP (TablePtr->Signature,
- AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].Signature,
- AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].SigLength)))
+ AcpiGbl_TableData[ACPI_TABLE_SSDT].Signature,
+ AcpiGbl_TableData[ACPI_TABLE_SSDT].SigLength)))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c
index 798b3c0..180c4e0 100644
--- a/sys/contrib/dev/acpica/exdump.c
+++ b/sys/contrib/dev/acpica/exdump.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
- * $Revision: 166 $
+ * $Revision: 167 $
*
*****************************************************************************/
@@ -741,9 +741,9 @@ AcpiExDumpObjectDescriptor (
case ACPI_TYPE_DEVICE:
- AcpiExOutPointer ("AddrHandler", ObjDesc->Device.AddrHandler);
- AcpiExOutPointer ("SysHandler", ObjDesc->Device.SysHandler);
- AcpiExOutPointer ("DrvHandler", ObjDesc->Device.DrvHandler);
+ AcpiExOutPointer ("AddressSpace", ObjDesc->Device.AddressSpace);
+ AcpiExOutPointer ("SystemNotify", ObjDesc->Device.SystemNotify);
+ AcpiExOutPointer ("DeviceNotify", ObjDesc->Device.DeviceNotify);
break;
@@ -779,7 +779,7 @@ AcpiExDumpObjectDescriptor (
AcpiExOutInteger ("Flags", ObjDesc->Region.Flags);
AcpiExOutAddress ("Address", ObjDesc->Region.Address);
AcpiExOutInteger ("Length", ObjDesc->Region.Length);
- AcpiExOutPointer ("AddrHandler", ObjDesc->Region.AddrHandler);
+ AcpiExOutPointer ("AddressSpace", ObjDesc->Region.AddressSpace);
AcpiExOutPointer ("Next", ObjDesc->Region.Next);
break;
@@ -788,8 +788,8 @@ AcpiExDumpObjectDescriptor (
AcpiExOutInteger ("SystemLevel", ObjDesc->PowerResource.SystemLevel);
AcpiExOutInteger ("ResourceOrder", ObjDesc->PowerResource.ResourceOrder);
- AcpiExOutPointer ("SysHandler", ObjDesc->PowerResource.SysHandler);
- AcpiExOutPointer ("DrvHandler", ObjDesc->PowerResource.DrvHandler);
+ AcpiExOutPointer ("SystemNotify", ObjDesc->PowerResource.SystemNotify);
+ AcpiExOutPointer ("DeviceNotify", ObjDesc->PowerResource.DeviceNotify);
break;
@@ -798,17 +798,17 @@ AcpiExDumpObjectDescriptor (
AcpiExOutInteger ("Processor ID", ObjDesc->Processor.ProcId);
AcpiExOutInteger ("Length", ObjDesc->Processor.Length);
AcpiExOutAddress ("Address", (ACPI_PHYSICAL_ADDRESS) ObjDesc->Processor.Address);
- AcpiExOutPointer ("SysHandler", ObjDesc->Processor.SysHandler);
- AcpiExOutPointer ("DrvHandler", ObjDesc->Processor.DrvHandler);
- AcpiExOutPointer ("AddrHandler", ObjDesc->Processor.AddrHandler);
+ AcpiExOutPointer ("SystemNotify", ObjDesc->Processor.SystemNotify);
+ AcpiExOutPointer ("DeviceNotify", ObjDesc->Processor.DeviceNotify);
+ AcpiExOutPointer ("AddressSpace", ObjDesc->Processor.AddressSpace);
break;
case ACPI_TYPE_THERMAL:
- AcpiExOutPointer ("SysHandler", ObjDesc->ThermalZone.SysHandler);
- AcpiExOutPointer ("DrvHandler", ObjDesc->ThermalZone.DrvHandler);
- AcpiExOutPointer ("AddrHandler", ObjDesc->ThermalZone.AddrHandler);
+ AcpiExOutPointer ("SystemNotify", ObjDesc->ThermalZone.SystemNotify);
+ AcpiExOutPointer ("DeviceNotify", ObjDesc->ThermalZone.DeviceNotify);
+ AcpiExOutPointer ("AddressSpace", ObjDesc->ThermalZone.AddressSpace);
break;
@@ -869,18 +869,18 @@ AcpiExDumpObjectDescriptor (
case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
- AcpiExOutInteger ("SpaceId", ObjDesc->AddrHandler.SpaceId);
- AcpiExOutPointer ("Next", ObjDesc->AddrHandler.Next);
- AcpiExOutPointer ("RegionList", ObjDesc->AddrHandler.RegionList);
- AcpiExOutPointer ("Node", ObjDesc->AddrHandler.Node);
- AcpiExOutPointer ("Context", ObjDesc->AddrHandler.Context);
+ AcpiExOutInteger ("SpaceId", ObjDesc->AddressSpace.SpaceId);
+ AcpiExOutPointer ("Next", ObjDesc->AddressSpace.Next);
+ AcpiExOutPointer ("RegionList", ObjDesc->AddressSpace.RegionList);
+ AcpiExOutPointer ("Node", ObjDesc->AddressSpace.Node);
+ AcpiExOutPointer ("Context", ObjDesc->AddressSpace.Context);
break;
case ACPI_TYPE_LOCAL_NOTIFY:
- AcpiExOutPointer ("Node", ObjDesc->NotifyHandler.Node);
- AcpiExOutPointer ("Context", ObjDesc->NotifyHandler.Context);
+ AcpiExOutPointer ("Node", ObjDesc->Notify.Node);
+ AcpiExOutPointer ("Context", ObjDesc->Notify.Context);
break;
diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c
index 9bfc5d9..1cc535d 100644
--- a/sys/contrib/dev/acpica/exfldio.c
+++ b/sys/contrib/dev/acpica/exfldio.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
- * $Revision: 92 $
+ * $Revision: 96 $
*
*****************************************************************************/
@@ -676,9 +676,10 @@ AcpiExWriteWithUpdateRule (
*
* PARAMETERS: Datum - Where the Datum is returned
* Buffer - Raw field buffer
+ * BufferLength - Entire length (used for big-endian only)
* ByteGranularity - 1/2/4/8 Granularity of the field
* (aka Datum Size)
- * Offset - Datum offset into the buffer
+ * BufferOffset - Datum offset into the buffer
*
* RETURN: none
*
@@ -688,36 +689,45 @@ AcpiExWriteWithUpdateRule (
******************************************************************************/
void
-AcpiExGetBufferDatum(
+AcpiExGetBufferDatum (
ACPI_INTEGER *Datum,
void *Buffer,
+ UINT32 BufferLength,
UINT32 ByteGranularity,
- UINT32 Offset)
+ UINT32 BufferOffset)
{
+ UINT32 Index;
+
ACPI_FUNCTION_ENTRY ();
+ /* Get proper index into buffer (handles big/little endian) */
+
+ Index = ACPI_BUFFER_INDEX (BufferLength, BufferOffset, ByteGranularity);
+
+ /* Move the requested number of bytes */
+
switch (ByteGranularity)
{
case ACPI_FIELD_BYTE_GRANULARITY:
- *Datum = ((UINT8 *) Buffer) [Offset];
+ *Datum = ((UINT8 *) Buffer) [Index];
break;
case ACPI_FIELD_WORD_GRANULARITY:
- ACPI_MOVE_UNALIGNED16_TO_32 (Datum, &(((UINT16 *) Buffer) [Offset]));
+ ACPI_MOVE_16_TO_64 (Datum, &(((UINT16 *) Buffer) [Index]));
break;
case ACPI_FIELD_DWORD_GRANULARITY:
- ACPI_MOVE_UNALIGNED32_TO_32 (Datum, &(((UINT32 *) Buffer) [Offset]));
+ ACPI_MOVE_32_TO_64 (Datum, &(((UINT32 *) Buffer) [Index]));
break;
case ACPI_FIELD_QWORD_GRANULARITY:
- ACPI_MOVE_UNALIGNED64_TO_64 (Datum, &(((UINT64 *) Buffer) [Offset]));
+ ACPI_MOVE_64_TO_64 (Datum, &(((UINT64 *) Buffer) [Index]));
break;
default:
@@ -733,9 +743,10 @@ AcpiExGetBufferDatum(
*
* PARAMETERS: MergedDatum - Value to store
* Buffer - Receiving buffer
+ * BufferLength - Entire length (used for big-endian only)
* ByteGranularity - 1/2/4/8 Granularity of the field
* (aka Datum Size)
- * Offset - Datum offset into the buffer
+ * BufferOffset - Datum offset into the buffer
*
* RETURN: none
*
@@ -748,33 +759,41 @@ void
AcpiExSetBufferDatum (
ACPI_INTEGER MergedDatum,
void *Buffer,
+ UINT32 BufferLength,
UINT32 ByteGranularity,
- UINT32 Offset)
+ UINT32 BufferOffset)
{
+ UINT32 Index;
ACPI_FUNCTION_ENTRY ();
+ /* Get proper index into buffer (handles big/little endian) */
+
+ Index = ACPI_BUFFER_INDEX (BufferLength, BufferOffset, ByteGranularity);
+
+ /* Move the requested number of bytes */
+
switch (ByteGranularity)
{
case ACPI_FIELD_BYTE_GRANULARITY:
- ((UINT8 *) Buffer) [Offset] = (UINT8) MergedDatum;
+ ((UINT8 *) Buffer) [Index] = (UINT8) MergedDatum;
break;
case ACPI_FIELD_WORD_GRANULARITY:
- ACPI_MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[Offset]), &MergedDatum);
+ ACPI_MOVE_64_TO_16 (&(((UINT16 *) Buffer)[Index]), &MergedDatum);
break;
case ACPI_FIELD_DWORD_GRANULARITY:
- ACPI_MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[Offset]), &MergedDatum);
+ ACPI_MOVE_64_TO_32 (&(((UINT32 *) Buffer)[Index]), &MergedDatum);
break;
case ACPI_FIELD_QWORD_GRANULARITY:
- ACPI_MOVE_UNALIGNED64_TO_64 (&(((UINT64 *) Buffer)[Offset]), &MergedDatum);
+ ACPI_MOVE_64_TO_64 (&(((UINT64 *) Buffer)[Index]), &MergedDatum);
break;
default:
@@ -876,8 +895,8 @@ AcpiExExtractFromField (
/* Store the datum to the caller buffer */
- AcpiExSetBufferDatum (MergedDatum, Buffer, ObjDesc->CommonField.AccessByteWidth,
- DatumOffset);
+ AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength,
+ ObjDesc->CommonField.AccessByteWidth, DatumOffset);
return_ACPI_STATUS (AE_OK);
}
@@ -956,7 +975,7 @@ AcpiExExtractFromField (
* Store the merged field datum in the caller's buffer, according to
* the granularity of the field (size of each datum).
*/
- AcpiExSetBufferDatum (MergedDatum, Buffer,
+ AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength,
ObjDesc->CommonField.AccessByteWidth, DatumOffset);
/*
@@ -1038,7 +1057,7 @@ AcpiExInsertIntoField (
/* Get a single datum from the caller's buffer */
- AcpiExGetBufferDatum (&PreviousRawDatum, Buffer,
+ AcpiExGetBufferDatum (&PreviousRawDatum, Buffer, BufferLength,
ObjDesc->CommonField.AccessByteWidth, DatumOffset);
/*
@@ -1105,7 +1124,7 @@ AcpiExInsertIntoField (
* Get the next raw buffer datum. It may contain bits of the previous
* field datum
*/
- AcpiExGetBufferDatum (&ThisRawDatum, Buffer,
+ AcpiExGetBufferDatum (&ThisRawDatum, Buffer, BufferLength,
ObjDesc->CommonField.AccessByteWidth, DatumOffset);
/* Create the field datum based on the field alignment */
diff --git a/sys/contrib/dev/acpica/exoparg1.c b/sys/contrib/dev/acpica/exoparg1.c
index fae1ff8..46a149b 100644
--- a/sys/contrib/dev/acpica/exoparg1.c
+++ b/sys/contrib/dev/acpica/exoparg1.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
- * $Revision: 147 $
+ * $Revision: 148 $
*
*****************************************************************************/
@@ -298,7 +298,7 @@ AcpiExOpcode_1A_1T_1R (
ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL;
UINT32 Temp32;
UINT32 i;
- UINT32 j;
+ UINT32 PowerOfTen;
ACPI_INTEGER Digit;
@@ -372,69 +372,74 @@ AcpiExOpcode_1A_1T_1R (
case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */
/*
- * The 64-bit ACPI integer can hold 16 4-bit BCD integers
+ * The 64-bit ACPI integer can hold 16 4-bit BCD characters
+ * (if table is 32-bit, integer can hold 8 BCD characters)
+ * Convert each 4-bit BCD value
*/
+ PowerOfTen = 1;
ReturnDesc->Integer.Value = 0;
- for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
+ Digit = Operand[0]->Integer.Value;
+
+ /* Convert each BCD digit (each is one nybble wide) */
+
+ for (i = 0; (i < AcpiGbl_IntegerNybbleWidth) && (Digit > 0); i++)
{
- /* Get one BCD digit */
+ /* Get the least significant 4-bit BCD digit */
- Digit = (ACPI_INTEGER) ((Operand[0]->Integer.Value >> (i * 4)) & 0xF);
+ Temp32 = ((UINT32) Digit) & 0xF;
/* Check the range of the digit */
- if (Digit > 9)
+ if (Temp32 > 9)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n",
- (UINT32) Digit));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "BCD digit too large (not decimal): 0x%X\n",
+ Temp32));
+
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
}
- if (Digit > 0)
- {
- /* Sum into the result with the appropriate power of 10 */
+ /* Sum the digit into the result with the current power of 10 */
- for (j = 0; j < i; j++)
- {
- Digit *= 10;
- }
+ ReturnDesc->Integer.Value += (((ACPI_INTEGER) Temp32) * PowerOfTen);
- ReturnDesc->Integer.Value += Digit;
- }
+ /* Shift to next BCD digit */
+
+ Digit >>= 4;
+
+ /* Next power of 10 */
+
+ PowerOfTen *= 10;
}
break;
case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
- if (Operand[0]->Integer.Value > ACPI_MAX_BCD_VALUE)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
- ACPI_HIDWORD(Operand[0]->Integer.Value),
- ACPI_LODWORD(Operand[0]->Integer.Value)));
- Status = AE_AML_NUMERIC_OVERFLOW;
- goto Cleanup;
- }
-
ReturnDesc->Integer.Value = 0;
- for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
+ Digit = Operand[0]->Integer.Value;
+
+ /* Each BCD digit is one nybble wide */
+
+ for (i = 0; (i < AcpiGbl_IntegerNybbleWidth) && (Digit > 0); i++)
{
- /* Divide by nth factor of 10 */
+ (void) AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32);
- Temp32 = 0;
- Digit = Operand[0]->Integer.Value;
- for (j = 0; j < i; j++)
- {
- (void) AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32);
- }
+ /* Insert the BCD digit that resides in the remainder from above */
- /* Create the BCD digit from the remainder above */
+ ReturnDesc->Integer.Value |= (((ACPI_INTEGER) Temp32) << (i * 4));
+ }
- if (Digit > 0)
- {
- ReturnDesc->Integer.Value += ((ACPI_INTEGER) Temp32 << (i * 4));
- }
+ /* Overflow if there is any data left in Digit */
+
+ if (Digit > 0)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Integer too large to convert to BCD: %8.8X%8.8X\n",
+ ACPI_HIDWORD(Operand[0]->Integer.Value),
+ ACPI_LODWORD(Operand[0]->Integer.Value)));
+ Status = AE_AML_NUMERIC_OVERFLOW;
+ goto Cleanup;
}
break;
diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c
index 049f5c7..4136305 100644
--- a/sys/contrib/dev/acpica/exregion.c
+++ b/sys/contrib/dev/acpica/exregion.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
- * $Revision: 82 $
+ * $Revision: 84 $
*
*****************************************************************************/
@@ -158,7 +158,7 @@ AcpiExSystemMemorySpaceHandler (
ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext;
UINT32 Length;
ACPI_SIZE WindowSize;
-#ifndef _HW_ALIGNMENT_SUPPORT
+#ifndef ACPI_MISALIGNED_TRANSFERS
UINT32 Remainder;
#endif
@@ -192,7 +192,7 @@ AcpiExSystemMemorySpaceHandler (
}
-#ifndef _HW_ALIGNMENT_SUPPORT
+#ifndef ACPI_MISALIGNED_TRANSFERS
/*
* Hardware does not support non-aligned data transfers, we must verify
* the request.
@@ -367,6 +367,7 @@ AcpiExSystemIoSpaceHandler (
void *RegionContext)
{
ACPI_STATUS Status = AE_OK;
+ UINT32 Value32;
ACPI_FUNCTION_TRACE ("ExSystemIoSpaceHandler");
@@ -382,13 +383,13 @@ AcpiExSystemIoSpaceHandler (
{
case ACPI_READ:
- *Value = 0;
- Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, Value, BitWidth);
+ Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, &Value32, BitWidth);
+ *Value = Value32;
break;
case ACPI_WRITE:
- Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address, *Value, BitWidth);
+ Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address, (UINT32) *Value, BitWidth);
break;
default:
diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c
index bcc926b..b43b47c 100644
--- a/sys/contrib/dev/acpica/exstore.c
+++ b/sys/contrib/dev/acpica/exstore.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
- * $Revision: 175 $
+ * $Revision: 176 $
*
*****************************************************************************/
@@ -270,8 +270,8 @@ AcpiExStore (
case ACPI_TYPE_INTEGER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n",
- ACPI_HIWORD (SourceDesc->Integer.Value),
- ACPI_LOWORD (SourceDesc->Integer.Value)));
+ ACPI_HIDWORD (SourceDesc->Integer.Value),
+ ACPI_LODWORD (SourceDesc->Integer.Value)));
break;
diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c
index 36380f9..ae38ec8 100644
--- a/sys/contrib/dev/acpica/exsystem.c
+++ b/sys/contrib/dev/acpica/exsystem.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
- * $Revision: 75 $
+ * $Revision: 76 $
*
*****************************************************************************/
@@ -212,7 +212,7 @@ AcpiExSystemDoStall (
AcpiExExitInterpreter ();
- AcpiOsStall (HowLong);
+ AcpiOsSleep (0, (HowLong / 1000) + 1);
/* And now we must get the interpreter again */
@@ -221,7 +221,7 @@ AcpiExSystemDoStall (
else
{
- AcpiOsSleep (0, (HowLong / 1000) + 1);
+ AcpiOsStall (HowLong);
}
return (Status);
diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c
index 30760a89..6d3083d 100644
--- a/sys/contrib/dev/acpica/exutils.c
+++ b/sys/contrib/dev/acpica/exutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 108 $
+ * $Revision: 109 $
*
*****************************************************************************/
@@ -372,7 +372,11 @@ AcpiExDigitsNeeded (
/*
* ACPI_INTEGER is unsigned, so we don't worry about a '-'
*/
- CurrentValue = Value;
+ if ((CurrentValue = Value) == 0)
+ {
+ return_VALUE (1);
+ }
+
NumDigits = 0;
while (CurrentValue)
diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hwacpi.c
index d0bb320..e271965 100644
--- a/sys/contrib/dev/acpica/hwacpi.c
+++ b/sys/contrib/dev/acpica/hwacpi.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- * $Revision: 62 $
+ * $Revision: 63 $
*
*****************************************************************************/
@@ -220,7 +220,7 @@ AcpiHwSetMode (
/* BIOS should have disabled ALL fixed and GP events */
Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
- (ACPI_INTEGER) AcpiGbl_FADT->AcpiEnable, 8);
+ (UINT32) AcpiGbl_FADT->AcpiEnable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
break;
@@ -231,7 +231,7 @@ AcpiHwSetMode (
* enable bits to default
*/
Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
- (ACPI_INTEGER) AcpiGbl_FADT->AcpiDisable, 8);
+ (UINT32) AcpiGbl_FADT->AcpiDisable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Attempting to enable Legacy (non-ACPI) mode\n"));
break;
diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hwgpe.c
index 29f8b04..547acbb 100644
--- a/sys/contrib/dev/acpica/hwgpe.c
+++ b/sys/contrib/dev/acpica/hwgpe.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 47 $
+ * $Revision: 53 $
*
*****************************************************************************/
@@ -150,7 +150,7 @@ AcpiHwEnableGpe (
* to enable the GPE, and write out the new register.
*/
Status = AcpiHwLowLevelRead (8, &InByte,
- &GpeEventInfo->RegisterInfo->EnableAddress, 0);
+ &GpeEventInfo->RegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -159,7 +159,7 @@ AcpiHwEnableGpe (
/* Write with the new GPE bit enabled */
Status = AcpiHwLowLevelWrite (8, (InByte | GpeEventInfo->BitMask),
- &GpeEventInfo->RegisterInfo->EnableAddress, 0);
+ &GpeEventInfo->RegisterInfo->EnableAddress);
return (Status);
}
@@ -240,7 +240,7 @@ AcpiHwDisableGpe (
* and write out the new register value to disable the GPE.
*/
Status = AcpiHwLowLevelRead (8, &InByte,
- &GpeRegisterInfo->EnableAddress, 0);
+ &GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -249,7 +249,7 @@ AcpiHwDisableGpe (
/* Write the byte with this GPE bit cleared */
Status = AcpiHwLowLevelWrite (8, (InByte & ~(GpeEventInfo->BitMask)),
- &GpeRegisterInfo->EnableAddress, 0);
+ &GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -325,7 +325,7 @@ AcpiHwClearGpe (
* clear this GPE.
*/
Status = AcpiHwLowLevelWrite (8, GpeEventInfo->BitMask,
- &GpeEventInfo->RegisterInfo->StatusAddress, 0);
+ &GpeEventInfo->RegisterInfo->StatusAddress);
return (Status);
}
@@ -345,13 +345,12 @@ AcpiHwClearGpe (
ACPI_STATUS
AcpiHwGetGpeStatus (
- UINT32 GpeNumber,
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
ACPI_EVENT_STATUS *EventStatus)
{
UINT32 InByte;
UINT8 BitMask;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_STATUS Status;
ACPI_EVENT_STATUS LocalEventStatus = 0;
@@ -364,12 +363,6 @@ AcpiHwGetGpeStatus (
return (AE_BAD_PARAMETER);
}
- GpeEventInfo = AcpiEvGetGpeEventInfo (GpeNumber);
- if (!GpeEventInfo)
- {
- return (AE_BAD_PARAMETER);
- }
-
/* Get the info block for the entire GPE register */
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
@@ -380,10 +373,10 @@ AcpiHwGetGpeStatus (
/* GPE Enabled? */
- Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->EnableAddress, 0);
+ Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
- return (Status);
+ goto UnlockAndExit;
}
if (BitMask & InByte)
@@ -400,10 +393,10 @@ AcpiHwGetGpeStatus (
/* GPE active (set)? */
- Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress, 0);
+ Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress);
if (ACPI_FAILURE (Status))
{
- return (Status);
+ goto UnlockAndExit;
}
if (BitMask & InByte)
@@ -414,6 +407,157 @@ AcpiHwGetGpeStatus (
/* Set return value */
(*EventStatus) = LocalEventStatus;
+
+
+UnlockAndExit:
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwDisableGpeBlock
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Disable all GPEs within a GPE block
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwDisableGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ UINT32 i;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ ACPI_STATUS Status;
+
+
+ /* Get the register info for the entire GPE block */
+
+ GpeRegisterInfo = GpeBlock->RegisterInfo;
+
+ /* Examine each GPE Register within the block */
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ Status = AcpiHwLowLevelWrite (8, 0x00,
+ &GpeBlock->RegisterInfo[i].EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwClearGpeBlock
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Clear all GPEs within a GPE block
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiHwClearGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ UINT32 i;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ ACPI_STATUS Status;
+
+
+ /* Get the register info for the entire GPE block */
+
+ GpeRegisterInfo = GpeBlock->RegisterInfo;
+
+ /* Examine each GPE Register within the block */
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ Status = AcpiHwLowLevelWrite (8, 0xFF,
+ &GpeBlock->RegisterInfo[i].StatusAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwDisableNonWakeupGpeBlock
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Disable all GPEs except wakeup GPEs in a GPE block
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwDisableNonWakeupGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ UINT32 i;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ UINT32 InValue;
+ ACPI_STATUS Status;
+
+
+ /* Get the register info for the entire GPE block */
+
+ GpeRegisterInfo = GpeBlock->RegisterInfo;
+
+ /* Examine each GPE Register within the block */
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ /*
+ * Read the enabled status of all GPEs. We
+ * will be using it to restore all the GPEs later.
+ */
+ Status = AcpiHwLowLevelRead (8, &InValue,
+ &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ GpeRegisterInfo->Enable = (UINT8) InValue;
+
+ /*
+ * Disable all GPEs except wakeup GPEs.
+ */
+ Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->WakeEnable,
+ &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ GpeRegisterInfo++;
+ }
+
return (AE_OK);
}
@@ -427,7 +571,7 @@ AcpiHwGetGpeStatus (
* RETURN: None
*
* DESCRIPTION: Disable all non-wakeup GPEs
- * Call with interrupts disabled. The interrupt handler also
+ * Called with interrupts disabled. The interrupt handler also
* modifies GpeRegisterInfo->Enable, so it should not be
* given the chance to run until after non-wake GPEs are
* re-enabled.
@@ -438,58 +582,66 @@ ACPI_STATUS
AcpiHwDisableNonWakeupGpes (
void)
{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Status = AcpiEvWalkGpeList (AcpiHwDisableNonWakeupGpeBlock);
+
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwEnableNonWakeupGpeBlock
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Enable a single GPE.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwEnableNonWakeupGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
UINT32 i;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
- UINT32 InValue;
ACPI_STATUS Status;
- ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_FUNCTION_ENTRY ();
+ /* This callback processes one entire GPE block */
+ /* Get the register info for the entire GPE block */
- GpeBlock = AcpiGbl_GpeBlockListHead;
- while (GpeBlock)
- {
- /* Get the register info for the entire GPE block */
+ GpeRegisterInfo = GpeBlock->RegisterInfo;
- GpeRegisterInfo = GpeBlock->RegisterInfo;
- if (!GpeRegisterInfo)
- {
- return (AE_BAD_PARAMETER);
- }
+ /* Examine each GPE register within the block */
- for (i = 0; i < GpeBlock->RegisterCount; i++)
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ /*
+ * We previously stored the enabled status of all GPEs.
+ * Blast them back in.
+ */
+ Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->Enable,
+ &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
{
- /*
- * Read the enabled status of all GPEs. We
- * will be using it to restore all the GPEs later.
- */
- Status = AcpiHwLowLevelRead (8, &InValue,
- &GpeRegisterInfo->EnableAddress, 0);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- GpeRegisterInfo->Enable = (UINT8) InValue;
-
- /*
- * Disable all GPEs except wakeup GPEs.
- */
- Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->WakeEnable,
- &GpeRegisterInfo->EnableAddress, 0);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- GpeRegisterInfo++;
+ return (Status);
}
- GpeBlock = GpeBlock->Next;
+ GpeRegisterInfo++;
}
+
return (AE_OK);
}
@@ -510,44 +662,13 @@ ACPI_STATUS
AcpiHwEnableNonWakeupGpes (
void)
{
- UINT32 i;
- ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_STATUS Status;
- ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_FUNCTION_ENTRY ();
- GpeBlock = AcpiGbl_GpeBlockListHead;
- while (GpeBlock)
- {
- /* Get the register info for the entire GPE block */
-
- GpeRegisterInfo = GpeBlock->RegisterInfo;
- if (!GpeRegisterInfo)
- {
- return (AE_BAD_PARAMETER);
- }
-
- for (i = 0; i < GpeBlock->RegisterCount; i++)
- {
- /*
- * We previously stored the enabled status of all GPEs.
- * Blast them back in.
- */
- Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->Enable,
- &GpeRegisterInfo->EnableAddress, 0);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- GpeRegisterInfo++;
- }
-
- GpeBlock = GpeBlock->Next;
- }
+ Status = AcpiEvWalkGpeList (AcpiHwEnableNonWakeupGpeBlock);
- return (AE_OK);
+ return (Status);
}
diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c
index c06cbbf..19cdb81 100644
--- a/sys/contrib/dev/acpica/hwregs.c
+++ b/sys/contrib/dev/acpica/hwregs.c
@@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
- * $Revision: 142 $
+ * $Revision: 149 $
*
******************************************************************************/
@@ -120,6 +120,7 @@
#include "acpi.h"
#include "acnamesp.h"
+#include "acevents.h"
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwregs")
@@ -129,7 +130,7 @@
*
* FUNCTION: AcpiHwClearAcpiStatus
*
- * PARAMETERS: none
+ * PARAMETERS: Flags - Lock the hardware or not
*
* RETURN: none
*
@@ -138,11 +139,10 @@
******************************************************************************/
ACPI_STATUS
-AcpiHwClearAcpiStatus (void)
+AcpiHwClearAcpiStatus (
+ UINT32 Flags)
{
- ACPI_NATIVE_UINT i;
ACPI_STATUS Status;
- ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_FUNCTION_TRACE ("HwClearAcpiStatus");
@@ -152,11 +152,13 @@ AcpiHwClearAcpiStatus (void)
ACPI_BITMASK_ALL_FIXED_STATUS,
(UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)));
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
+ if (Flags & ACPI_MTX_LOCK)
{
- return_ACPI_STATUS (Status);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
@@ -171,7 +173,7 @@ AcpiHwClearAcpiStatus (void)
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address))
{
Status = AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS,
- &AcpiGbl_FADT->XPm1bEvtBlk, 0);
+ &AcpiGbl_FADT->XPm1bEvtBlk);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -180,24 +182,13 @@ AcpiHwClearAcpiStatus (void)
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
- GpeBlock = AcpiGbl_GpeBlockListHead;
- while (GpeBlock)
- {
- for (i = 0; i < GpeBlock->RegisterCount; i++)
- {
- Status = AcpiHwLowLevelWrite (8, 0xFF,
- &GpeBlock->RegisterInfo[i].StatusAddress, (UINT32) 0);
- if (ACPI_FAILURE (Status))
- {
- goto UnlockAndExit;
- }
- }
-
- GpeBlock = GpeBlock->Next;
- }
+ Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
UnlockAndExit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ if (Flags & ACPI_MTX_LOCK)
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ }
return_ACPI_STATUS (Status);
}
@@ -339,8 +330,9 @@ AcpiHwGetBitRegisterInfo (
*
* FUNCTION: AcpiGetRegister
*
- * PARAMETERS: RegisterId - Index of ACPI Register to access
- * UseLock - Lock the hardware
+ * PARAMETERS: RegisterId - ID of ACPI BitRegister to access
+ * ReturnValue - Value that was read from the register
+ * Flags - Lock the hardware or not
*
* RETURN: Value is read from specified Register. Value returned is
* normalized to bit0 (is shifted all the way right)
@@ -397,7 +389,8 @@ AcpiGetRegister (
*ReturnValue = RegisterValue;
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %X\n", RegisterValue));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
+ RegisterValue, BitRegInfo->ParentRegister));
}
return_ACPI_STATUS (Status);
@@ -510,8 +503,8 @@ AcpiSetRegister (
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
BitRegInfo->AccessBitMask, Value);
- Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
- ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue);
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, RegisterId,
+ (UINT16) RegisterValue);
break;
@@ -558,7 +551,8 @@ UnlockAndExit:
ACPI_DEBUG_EXEC (RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition));
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI Register Write actual %X\n", RegisterValue));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
+ Value, RegisterValue, BitRegInfo->ParentRegister));
return_ACPI_STATUS (Status);
}
@@ -585,7 +579,6 @@ AcpiHwRegisterRead (
{
UINT32 Value1 = 0;
UINT32 Value2 = 0;
- UINT32 BankOffset;
ACPI_STATUS Status;
@@ -605,53 +598,56 @@ AcpiHwRegisterRead (
{
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
- Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aEvtBlk, 0);
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aEvtBlk);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
- Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bEvtBlk, 0);
+ /* PM1B is optional */
+
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bEvtBlk);
Value1 |= Value2;
break;
- case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
+ case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
- BankOffset = ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen);
- Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset);
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_XPm1aEnable);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
- Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset);
+ /* PM1B is optional */
+
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_XPm1bEnable);
Value1 |= Value2;
break;
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aCntBlk, 0);
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aCntBlk);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
- Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bCntBlk, 0);
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bCntBlk);
Value1 |= Value2;
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT->XPm2CntBlk, 0);
+ Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT->XPm2CntBlk);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT->XPmTmrBlk, 0);
+ Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT->XPmTmrBlk);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
@@ -700,7 +696,6 @@ AcpiHwRegisterWrite (
UINT32 RegisterId,
UINT32 Value)
{
- UINT32 BankOffset;
ACPI_STATUS Status;
@@ -720,62 +715,65 @@ AcpiHwRegisterWrite (
{
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, 0);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, 0);
+ /* PM1B is optional */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk);
break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
- BankOffset = ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen);
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1aEnable);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset);
+ /* PM1B is optional */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1bEnable);
break;
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk);
break;
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
break;
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk);
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk, 0);
+ Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk, 0);
+ Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk);
break;
@@ -783,7 +781,7 @@ AcpiHwRegisterWrite (
/* SMI_CMD is currently always in IO space */
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (ACPI_INTEGER) Value, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, Value, 8);
break;
@@ -806,11 +804,11 @@ UnlockAndExit:
*
* FUNCTION: AcpiHwLowLevelRead
*
- * PARAMETERS: Register - GAS register structure
- * Offset - Offset from the base address in the GAS
- * Width - 8, 16, or 32
+ * PARAMETERS: Width - 8, 16, or 32
+ * Value - Where the value is returned
+ * Register - GAS register structure
*
- * RETURN: Value read
+ * RETURN: Status
*
* DESCRIPTION: Read from either memory, IO, or PCI config space.
*
@@ -820,11 +818,8 @@ ACPI_STATUS
AcpiHwLowLevelRead (
UINT32 Width,
UINT32 *Value,
- ACPI_GENERIC_ADDRESS *Reg,
- UINT32 Offset)
+ ACPI_GENERIC_ADDRESS *Reg)
{
- ACPI_PHYSICAL_ADDRESS MemAddress;
- ACPI_IO_ADDRESS IoAddress;
ACPI_PCI_ID PciId;
UINT16 PciRegister;
ACPI_STATUS Status;
@@ -853,19 +848,16 @@ AcpiHwLowLevelRead (
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
- MemAddress = (ACPI_GET_ADDRESS (Reg->Address)
- + (ACPI_PHYSICAL_ADDRESS) Offset);
-
- Status = AcpiOsReadMemory (MemAddress, Value, Width);
+ Status = AcpiOsReadMemory (
+ (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
+ Value, Width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
- IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address)
- + (ACPI_PHYSICAL_ADDRESS) Offset);
-
- Status = AcpiOsReadPort (IoAddress, Value, Width);
+ Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
+ Value, Width);
break;
@@ -875,19 +867,25 @@ AcpiHwLowLevelRead (
PciId.Bus = 0;
PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address));
PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address));
- PciRegister = (UINT16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address))
- + Offset);
+ PciRegister = (UINT16) ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address));
- Status = AcpiOsReadPciConfiguration (&PciId, PciRegister, Value, Width);
+ Status = AcpiOsReadPciConfiguration (&PciId, PciRegister,
+ Value, Width);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported address space: %X\n", Reg->AddressSpaceId));
- Status = AE_BAD_PARAMETER;
- break;
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unsupported address space: %X\n", Reg->AddressSpaceId));
+ return (AE_BAD_PARAMETER);
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
+ *Value, Width,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)),
+ AcpiUtGetRegionName (Reg->AddressSpaceId)));
+
return (Status);
}
@@ -899,12 +897,10 @@ AcpiHwLowLevelRead (
* PARAMETERS: Width - 8, 16, or 32
* Value - To be written
* Register - GAS register structure
- * Offset - Offset from the base address in the GAS
*
+ * RETURN: Status
*
- * RETURN: Value read
- *
- * DESCRIPTION: Read from either memory, IO, or PCI config space.
+ * DESCRIPTION: Write to either memory, IO, or PCI config space.
*
******************************************************************************/
@@ -912,11 +908,8 @@ ACPI_STATUS
AcpiHwLowLevelWrite (
UINT32 Width,
UINT32 Value,
- ACPI_GENERIC_ADDRESS *Reg,
- UINT32 Offset)
+ ACPI_GENERIC_ADDRESS *Reg)
{
- ACPI_PHYSICAL_ADDRESS MemAddress;
- ACPI_IO_ADDRESS IoAddress;
ACPI_PCI_ID PciId;
UINT16 PciRegister;
ACPI_STATUS Status;
@@ -943,19 +936,16 @@ AcpiHwLowLevelWrite (
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
- MemAddress = (ACPI_GET_ADDRESS (Reg->Address)
- + (ACPI_PHYSICAL_ADDRESS) Offset);
-
- Status = AcpiOsWriteMemory (MemAddress, (ACPI_INTEGER) Value, Width);
+ Status = AcpiOsWriteMemory (
+ (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
+ Value, Width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
- IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address)
- + (ACPI_PHYSICAL_ADDRESS) Offset);
-
- Status = AcpiOsWritePort (IoAddress, (ACPI_INTEGER) Value, Width);
+ Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Reg->Address),
+ Value, Width);
break;
@@ -965,18 +955,24 @@ AcpiHwLowLevelWrite (
PciId.Bus = 0;
PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address));
PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address));
- PciRegister = (UINT16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address))
- + Offset);
+ PciRegister = (UINT16) ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address));
- Status = AcpiOsWritePciConfiguration (&PciId, PciRegister, (ACPI_INTEGER) Value, Width);
+ Status = AcpiOsWritePciConfiguration (&PciId, PciRegister,
+ (ACPI_INTEGER) Value, Width);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported address space: %X\n", Reg->AddressSpaceId));
- Status = AE_BAD_PARAMETER;
- break;
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unsupported address space: %X\n", Reg->AddressSpaceId));
+ return (AE_BAD_PARAMETER);
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
+ Value, Width,
+ ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)),
+ ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)),
+ AcpiUtGetRegionName (Reg->AddressSpaceId)));
+
return (Status);
}
diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c
index 50b0fa9..73c89ab 100644
--- a/sys/contrib/dev/acpica/hwsleep.c
+++ b/sys/contrib/dev/acpica/hwsleep.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- * $Revision: 52 $
+ * $Revision: 56 $
*
*****************************************************************************/
@@ -308,13 +308,13 @@ AcpiEnterSleepState (
/* Clear wake status */
- Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiHwClearAcpiStatus();
+ Status = AcpiHwClearAcpiStatus(ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -322,7 +322,7 @@ AcpiEnterSleepState (
/* Disable BM arbitration */
- Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -422,12 +422,6 @@ AcpiEnterSleepState (
} while (!InValue);
- Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
return_ACPI_STATUS (AE_OK);
}
@@ -456,13 +450,13 @@ AcpiEnterSleepStateS4bios (
ACPI_FUNCTION_TRACE ("AcpiEnterSleepStateS4bios");
AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
- AcpiHwClearAcpiStatus();
+ AcpiHwClearAcpiStatus(ACPI_MTX_DO_NOT_LOCK);
AcpiHwDisableNonWakeupGpes();
ACPI_FLUSH_CPU_CACHE();
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (ACPI_INTEGER) AcpiGbl_FADT->S4BiosReq, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (UINT32) AcpiGbl_FADT->S4BiosReq, 8);
do {
AcpiOsStall(1000);
diff --git a/sys/contrib/dev/acpica/hwtimer.c b/sys/contrib/dev/acpica/hwtimer.c
index 92267a6..5e4cb26 100644
--- a/sys/contrib/dev/acpica/hwtimer.c
+++ b/sys/contrib/dev/acpica/hwtimer.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
- * $Revision: 24 $
+ * $Revision: 25 $
*
*****************************************************************************/
@@ -185,7 +185,7 @@ AcpiGetTimer (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT->XPmTmrBlk, 0);
+ Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT->XPmTmrBlk);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c
index ca46558..a1c8a19 100644
--- a/sys/contrib/dev/acpica/nsaccess.c
+++ b/sys/contrib/dev/acpica/nsaccess.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- * $Revision: 171 $
+ * $Revision: 173 $
*
******************************************************************************/
@@ -147,6 +147,7 @@ AcpiNsRootInitialize (void)
const ACPI_PREDEFINED_NAMES *InitVal = NULL;
ACPI_NAMESPACE_NODE *NewNode;
ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STRING Val = NULL;
ACPI_FUNCTION_TRACE ("NsRootInitialize");
@@ -198,9 +199,7 @@ AcpiNsRootInitialize (void)
*/
if (InitVal->Val)
{
- ACPI_STRING Val;
-
- Status = AcpiOsPredefinedOverride(InitVal, &Val);
+ Status = AcpiOsPredefinedOverride (InitVal, &Val);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not override predefined %s\n",
@@ -633,7 +632,7 @@ AcpiNsLookup (
/* Extract one ACPI name from the front of the pathname */
- ACPI_MOVE_UNALIGNED32_TO_32 (&SimpleName, Path);
+ ACPI_MOVE_32_TO_32 (&SimpleName, Path);
/* Try to find the single (4 character) ACPI name */
diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c
index 35c329f..e221973 100644
--- a/sys/contrib/dev/acpica/nsalloc.c
+++ b/sys/contrib/dev/acpica/nsalloc.c
@@ -321,7 +321,7 @@ AcpiNsInstallNode (
ACPI_NAMESPACE_NODE *Node, /* New Child*/
ACPI_OBJECT_TYPE Type)
{
- UINT16 OwnerId = TABLE_ID_DSDT;
+ UINT16 OwnerId = 0;
ACPI_NAMESPACE_NODE *ChildNode;
#ifdef ACPI_ALPHABETIC_NAMESPACE
@@ -652,7 +652,7 @@ AcpiNsDeleteNamespaceSubtree (
*
******************************************************************************/
-static void
+void
AcpiNsRemoveReference (
ACPI_NAMESPACE_NODE *Node)
{
diff --git a/sys/contrib/dev/acpica/nsdumpdv.c b/sys/contrib/dev/acpica/nsdumpdv.c
index d8058ac6..702b1d1 100644
--- a/sys/contrib/dev/acpica/nsdumpdv.c
+++ b/sys/contrib/dev/acpica/nsdumpdv.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 5 $
+ * $Revision: 8 $
*
*****************************************************************************/
@@ -147,7 +147,8 @@ AcpiNsDumpOneDevice (
void *Context,
void **ReturnValue)
{
- ACPI_DEVICE_INFO Info;
+ ACPI_BUFFER Buffer;
+ ACPI_DEVICE_INFO *Info;
ACPI_STATUS Status;
UINT32 i;
@@ -157,18 +158,21 @@ AcpiNsDumpOneDevice (
Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
- Status = AcpiGetObjectInfo (ObjHandle, &Info);
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiGetObjectInfo (ObjHandle, &Buffer);
if (ACPI_SUCCESS (Status))
{
+ Info = Buffer.Pointer;
for (i = 0; i < Level; i++)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
- Info.HardwareId,
- ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address),
- Info.CurrentStatus));
+ Info->HardwareId.Value,
+ ACPI_HIDWORD (Info->Address), ACPI_LODWORD (Info->Address),
+ Info->CurrentStatus));
+ ACPI_MEM_FREE (Info);
}
return (Status);
diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/nsload.c
index eb8cd5d..5cd5d43 100644
--- a/sys/contrib/dev/acpica/nsload.c
+++ b/sys/contrib/dev/acpica/nsload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
- * $Revision: 64 $
+ * $Revision: 66 $
*
*****************************************************************************/
@@ -153,7 +153,7 @@ AcpiNsLoadTable (
/* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
- if (!(AcpiGbl_AcpiTableData[TableDesc->Type].Flags & ACPI_TABLE_EXECUTABLE))
+ if (!(AcpiGbl_TableData[TableDesc->Type].Flags & ACPI_TABLE_EXECUTABLE))
{
/* Just ignore this table */
@@ -263,7 +263,7 @@ AcpiNsLoadTableByType (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
- TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_DSDT];
+ TableDesc = AcpiGbl_TableLists[ACPI_TABLE_DSDT].Next;
/* If table already loaded into namespace, just return */
@@ -272,8 +272,6 @@ AcpiNsLoadTableByType (
goto UnlockAndExit;
}
- TableDesc->TableId = TABLE_ID_DSDT;
-
/* Now load the single DSDT */
Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode);
@@ -288,13 +286,13 @@ AcpiNsLoadTableByType (
case ACPI_TABLE_SSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
- AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count));
+ AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count));
/*
* Traverse list of SSDT tables
*/
- TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_SSDT];
- for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count; i++)
+ TableDesc = AcpiGbl_TableLists[ACPI_TABLE_SSDT].Next;
+ for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count; i++)
{
/*
* Only attempt to load table if it is not
@@ -319,14 +317,14 @@ AcpiNsLoadTableByType (
case ACPI_TABLE_PSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
- AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count));
+ AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count));
/*
* Traverse list of PSDT tables
*/
- TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_PSDT];
+ TableDesc = AcpiGbl_TableLists[ACPI_TABLE_PSDT].Next;
- for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count; i++)
+ for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count; i++)
{
/* Only attempt to load table if it is not already loaded! */
diff --git a/sys/contrib/dev/acpica/nsnames.c b/sys/contrib/dev/acpica/nsnames.c
index f69239f..f7f3528 100644
--- a/sys/contrib/dev/acpica/nsnames.c
+++ b/sys/contrib/dev/acpica/nsnames.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
- * $Revision: 82 $
+ * $Revision: 83 $
*
******************************************************************************/
@@ -174,7 +174,7 @@ AcpiNsBuildExternalPath (
/* Put the name into the buffer */
- ACPI_MOVE_UNALIGNED32_TO_32 ((NameBuffer + Index), &ParentNode->Name);
+ ACPI_MOVE_32_TO_32 ((NameBuffer + Index), &ParentNode->Name);
ParentNode = AcpiNsGetParentNode (ParentNode);
/* Prefix name with the path separator */
diff --git a/sys/contrib/dev/acpica/nsparse.c b/sys/contrib/dev/acpica/nsparse.c
index 3314efe..54fd0c1 100644
--- a/sys/contrib/dev/acpica/nsparse.c
+++ b/sys/contrib/dev/acpica/nsparse.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsparse - namespace interface to AML parser
- * $Revision: 3 $
+ * $Revision: 4 $
*
*****************************************************************************/
@@ -160,10 +160,9 @@ AcpiNsOneCompleteParse (
return_ACPI_STATUS (AE_NO_MEMORY);
}
-
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
+ WalkState = AcpiDsCreateWalkState (TableDesc->TableId,
NULL, NULL, NULL);
if (!WalkState)
{
diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c
index 56763a5..4051d3f 100644
--- a/sys/contrib/dev/acpica/nssearch.c
+++ b/sys/contrib/dev/acpica/nssearch.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
- * $Revision: 95 $
+ * $Revision: 97 $
*
******************************************************************************/
@@ -195,8 +195,9 @@ AcpiNsSearchNode (
* Found matching entry.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Name %4.4s Type [%s] found at %p\n",
- (char *) &TargetName, AcpiUtGetTypeName (NextNode->Type), NextNode));
+ "Name %4.4s Type [%s] found in scope [%4.4s] %p\n",
+ (char *) &TargetName, AcpiUtGetTypeName (NextNode->Type),
+ NextNode->Name.Ascii, NextNode));
*ReturnNode = NextNode;
return_ACPI_STATUS (AE_OK);
@@ -220,8 +221,10 @@ AcpiNsSearchNode (
/* Searched entire namespace level, not found */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s Type [%s] not found at %p\n",
- (char *) &TargetName, AcpiUtGetTypeName (Type), NextNode));
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "Name %4.4s Type [%s] not found in search in scope [%4.4s] %p first child %p\n",
+ (char *) &TargetName, AcpiUtGetTypeName (Type),
+ Node->Name.Ascii, Node, Node->Child));
return_ACPI_STATUS (AE_NOT_FOUND);
}
diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c
index 321cb30..3f1b574 100644
--- a/sys/contrib/dev/acpica/nsutils.c
+++ b/sys/contrib/dev/acpica/nsutils.c
@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
- * $Revision: 122 $
+ * $Revision: 129 $
*
*****************************************************************************/
@@ -150,34 +150,43 @@ AcpiNsReportError (
ACPI_STATUS LookupStatus)
{
ACPI_STATUS Status;
- char *Name;
+ char *Name = NULL;
- /* Convert path to external format */
-
- Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalName, NULL, &Name);
-
AcpiOsPrintf ("%8s-%04d: *** Error: Looking up ",
ModuleName, LineNumber);
- /* Print target name */
-
- if (ACPI_SUCCESS (Status))
+ if (LookupStatus == AE_BAD_CHARACTER)
{
- AcpiOsPrintf ("[%s]", Name);
+ /* There is a non-ascii character in the name */
+
+ AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)\n", *(ACPI_CAST_PTR (UINT32, InternalName)));
}
else
{
- AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
+ /* Convert path to external format */
+
+ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalName, NULL, &Name);
+
+ /* Print target name */
+
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf ("[%s]", Name);
+ }
+ else
+ {
+ AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
+ }
+
+ if (Name)
+ {
+ ACPI_MEM_FREE (Name);
+ }
}
AcpiOsPrintf (" in namespace, %s\n",
AcpiFormatException (LookupStatus));
-
- if (Name)
- {
- ACPI_MEM_FREE (Name);
- }
}
@@ -254,7 +263,12 @@ AcpiNsPrintNodePathname (
Status = AcpiNsHandleToPathname (Node, &Buffer);
if (ACPI_SUCCESS (Status))
{
- AcpiOsPrintf ("%s [%s] (Node %p)", Msg, (char *) Buffer.Pointer, Node);
+ if (Msg)
+ {
+ AcpiOsPrintf ("%s ", Msg);
+ }
+
+ AcpiOsPrintf ("[%s] (Node %p)", (char *) Buffer.Pointer, Node);
ACPI_MEM_FREE (Buffer.Pointer);
}
}
@@ -725,7 +739,7 @@ AcpiNsExternalizeName (
/* <count> 4-byte names */
NamesIndex = PrefixLength + 2;
- NumSegments = (UINT32) (UINT8) InternalName[(ACPI_NATIVE_UINT) (PrefixLength + 1)];
+ NumSegments = (ACPI_NATIVE_UINT) (UINT8) InternalName[(ACPI_NATIVE_UINT) (PrefixLength + 1)];
break;
case AML_DUAL_NAME_PREFIX:
@@ -918,39 +932,32 @@ void
AcpiNsTerminate (void)
{
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *ThisNode;
ACPI_FUNCTION_TRACE ("NsTerminate");
- ThisNode = AcpiGbl_RootNode;
-
/*
- * 1) Free the entire namespace -- all objects, tables, and stacks
+ * 1) Free the entire namespace -- all nodes and objects
*
- * Delete all objects linked to the root
- * (additional table descriptors)
+ * Delete all object descriptors attached to namepsace nodes
*/
- AcpiNsDeleteNamespaceSubtree (ThisNode);
+ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
- /* Detach any object(s) attached to the root */
+ /* Detach any objects attached to the root */
- ObjDesc = AcpiNsGetAttachedObject (ThisNode);
+ ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
if (ObjDesc)
{
- AcpiNsDetachObject (ThisNode);
- AcpiUtRemoveReference (ObjDesc);
+ AcpiNsDetachObject (AcpiGbl_RootNode);
}
- AcpiNsDeleteChildren (ThisNode);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
-
/*
* 2) Now we can delete the ACPI tables
*/
- AcpiTbDeleteAcpiTables ();
+ AcpiTbDeleteAllTables ();
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
return_VOID;
diff --git a/sys/contrib/dev/acpica/nswalk.c b/sys/contrib/dev/acpica/nswalk.c
index abe25a8..b1dad48 100644
--- a/sys/contrib/dev/acpica/nswalk.c
+++ b/sys/contrib/dev/acpica/nswalk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the ACPI namespace
- * $Revision: 34 $
+ * $Revision: 35 $
*
*****************************************************************************/
@@ -245,6 +245,7 @@ AcpiNsWalkNamespace (
void **ReturnValue)
{
ACPI_STATUS Status;
+ ACPI_STATUS MutexStatus;
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *ParentNode;
ACPI_OBJECT_TYPE ChildType;
@@ -298,10 +299,10 @@ AcpiNsWalkNamespace (
*/
if (UnlockBeforeCallback)
{
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
+ MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (MutexStatus))
{
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (MutexStatus);
}
}
@@ -310,10 +311,10 @@ AcpiNsWalkNamespace (
if (UnlockBeforeCallback)
{
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
+ MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (MutexStatus))
{
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (MutexStatus);
}
}
diff --git a/sys/contrib/dev/acpica/nsxfeval.c b/sys/contrib/dev/acpica/nsxfeval.c
index 3e732b0..e779c44 100644
--- a/sys/contrib/dev/acpica/nsxfeval.c
+++ b/sys/contrib/dev/acpica/nsxfeval.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfeval - Public interfaces to the ACPI subsystem
* ACPI Object evaluation interfaces
- * $Revision: 7 $
+ * $Revision: 10 $
*
******************************************************************************/
@@ -542,16 +542,15 @@ AcpiNsGetDeviceCallback (
void *Context,
void **ReturnValue)
{
+ ACPI_GET_DEVICES_INFO *Info = Context;
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
UINT32 Flags;
ACPI_DEVICE_ID Hid;
- ACPI_DEVICE_ID Cid;
- ACPI_GET_DEVICES_INFO *Info;
+ ACPI_COMPATIBLE_ID_LIST *Cid;
+ ACPI_NATIVE_UINT i;
- Info = Context;
-
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
@@ -570,9 +569,8 @@ AcpiNsGetDeviceCallback (
return (AE_BAD_PARAMETER);
}
- /*
- * Run _STA to determine if device is present
- */
+ /* Run _STA to determine if device is present */
+
Status = AcpiUtExecute_STA (Node, &Flags);
if (ACPI_FAILURE (Status))
{
@@ -582,12 +580,12 @@ AcpiNsGetDeviceCallback (
if (!(Flags & 0x01))
{
/* Don't return at the device or children of the device if not there */
+
return (AE_CTRL_DEPTH);
}
- /*
- * Filter based on device HID & CID
- */
+ /* Filter based on device HID & CID */
+
if (Info->Hid != NULL)
{
Status = AcpiUtExecute_HID (Node, &Hid);
@@ -600,8 +598,10 @@ AcpiNsGetDeviceCallback (
return (AE_CTRL_DEPTH);
}
- if (ACPI_STRNCMP (Hid.Buffer, Info->Hid, sizeof (Hid.Buffer)) != 0)
+ if (ACPI_STRNCMP (Hid.Value, Info->Hid, sizeof (Hid.Value)) != 0)
{
+ /* Get the list of Compatible IDs */
+
Status = AcpiUtExecute_CID (Node, &Cid);
if (Status == AE_NOT_FOUND)
{
@@ -612,12 +612,18 @@ AcpiNsGetDeviceCallback (
return (AE_CTRL_DEPTH);
}
- /* TBD: Handle CID packages */
+ /* Walk the CID list */
- if (ACPI_STRNCMP (Cid.Buffer, Info->Hid, sizeof (Cid.Buffer)) != 0)
+ for (i = 0; i < Cid->Count; i++)
{
- return (AE_OK);
+ if (ACPI_STRNCMP (Cid->Id[i].Value, Info->Hid,
+ sizeof (ACPI_COMPATIBLE_ID)) != 0)
+ {
+ ACPI_MEM_FREE (Cid);
+ return (AE_OK);
+ }
}
+ ACPI_MEM_FREE (Cid);
}
}
@@ -641,8 +647,8 @@ AcpiNsGetDeviceCallback (
*
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
* starting (and ending) at the object specified by StartHandle.
- * The UserFunction is called whenever an object that matches
- * the type parameter is found. If the user function returns
+ * The UserFunction is called whenever an object of type
+ * Device is found. If the user function returns
* a non-zero value, the search is terminated immediately and this
* value is returned to the caller.
*
diff --git a/sys/contrib/dev/acpica/nsxfname.c b/sys/contrib/dev/acpica/nsxfname.c
index ed33940..cac3914 100644
--- a/sys/contrib/dev/acpica/nsxfname.c
+++ b/sys/contrib/dev/acpica/nsxfname.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
- * $Revision: 94 $
+ * $Revision: 97 $
*
*****************************************************************************/
@@ -125,7 +125,7 @@
ACPI_MODULE_NAME ("nsxfname")
-/****************************************************************************
+/******************************************************************************
*
* FUNCTION: AcpiGetHandle
*
@@ -199,7 +199,8 @@ AcpiGetHandle (
/*
* Find the Node and convert to a handle
*/
- Status = AcpiNsGetNodeByPath (Pathname, PrefixNode, ACPI_NS_NO_UPSEARCH, &Node);
+ Status = AcpiNsGetNodeByPath (Pathname, PrefixNode, ACPI_NS_NO_UPSEARCH,
+ &Node);
*RetHandle = NULL;
if (ACPI_SUCCESS (Status))
@@ -211,7 +212,7 @@ AcpiGetHandle (
}
-/****************************************************************************
+/******************************************************************************
*
* FUNCTION: AcpiGetName
*
@@ -298,7 +299,7 @@ UnlockAndExit:
}
-/****************************************************************************
+/******************************************************************************
*
* FUNCTION: AcpiGetObjectInfo
*
@@ -316,23 +317,29 @@ UnlockAndExit:
ACPI_STATUS
AcpiGetObjectInfo (
ACPI_HANDLE Handle,
- ACPI_DEVICE_INFO *Info)
+ ACPI_BUFFER *Buffer)
{
- ACPI_DEVICE_ID Hid;
- ACPI_DEVICE_ID Uid;
ACPI_STATUS Status;
- UINT32 DeviceStatus = 0;
- ACPI_INTEGER Address = 0;
ACPI_NAMESPACE_NODE *Node;
+ ACPI_DEVICE_INFO Info;
+ ACPI_DEVICE_INFO *ReturnInfo;
+ ACPI_COMPATIBLE_ID_LIST *CidList = NULL;
+ ACPI_SIZE Size;
/* Parameter validation */
- if (!Handle || !Info)
+ if (!Handle || !Buffer)
{
return (AE_BAD_PARAMETER);
}
+ Status = AcpiUtValidateBuffer (Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
@@ -346,8 +353,14 @@ AcpiGetObjectInfo (
return (AE_BAD_PARAMETER);
}
- Info->Type = Node->Type;
- Info->Name = Node->Name.Integer;
+ /* Init return structure */
+
+ Size = sizeof (ACPI_DEVICE_INFO);
+ ACPI_MEMSET (&Info, 0, Size);
+
+ Info.Type = Node->Type;
+ Info.Name = Node->Name.Integer;
+ Info.Valid = 0;
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
@@ -355,66 +368,89 @@ AcpiGetObjectInfo (
return (Status);
}
- /*
- * If not a device, we are all done.
- */
- if (Info->Type != ACPI_TYPE_DEVICE)
+ /* If not a device, we are all done */
+
+ if (Info.Type == ACPI_TYPE_DEVICE)
{
- return (AE_OK);
- }
+ /*
+ * Get extra info for ACPI Devices objects only:
+ * Run the Device _HID, _UID, _CID, _STA, and _ADR methods.
+ *
+ * Note: none of these methods are required, so they may or may
+ * not be present for this device. The Info.Valid bitfield is used
+ * to indicate which methods were found and ran successfully.
+ */
+
+ /* Execute the Device._HID method */
+
+ Status = AcpiUtExecute_HID (Node, &Info.HardwareId);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info.Valid |= ACPI_VALID_HID;
+ }
+ /* Execute the Device._UID method */
- /*
- * Get extra info for ACPI devices only. Run the
- * _HID, _UID, _STA, and _ADR methods. Note: none
- * of these methods are required, so they may or may
- * not be present. The Info->Valid bits are used
- * to indicate which methods ran successfully.
- */
- Info->Valid = 0;
+ Status = AcpiUtExecute_UID (Node, &Info.UniqueId);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info.Valid |= ACPI_VALID_UID;
+ }
- /* Execute the _HID method and save the result */
+ /* Execute the Device._CID method */
- Status = AcpiUtExecute_HID (Node, &Hid);
- if (ACPI_SUCCESS (Status))
- {
- ACPI_STRNCPY (Info->HardwareId, Hid.Buffer, sizeof(Info->HardwareId));
- Info->Valid |= ACPI_VALID_HID;
+ Status = AcpiUtExecute_CID (Node, &CidList);
+ if (ACPI_SUCCESS (Status))
+ {
+ Size += ((ACPI_SIZE) CidList->Count - 1) *
+ sizeof (ACPI_COMPATIBLE_ID);
+ Info.Valid |= ACPI_VALID_CID;
+ }
+
+ /* Execute the Device._STA method */
+
+ Status = AcpiUtExecute_STA (Node, &Info.CurrentStatus);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info.Valid |= ACPI_VALID_STA;
+ }
+
+ /* Execute the Device._ADR method */
+
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node,
+ &Info.Address);
+ if (ACPI_SUCCESS (Status))
+ {
+ Info.Valid |= ACPI_VALID_ADR;
+ }
+
+ Status = AE_OK;
}
- /* Execute the _UID method and save the result */
+ /* Validate/Allocate/Clear caller buffer */
- Status = AcpiUtExecute_UID (Node, &Uid);
- if (ACPI_SUCCESS (Status))
+ Status = AcpiUtInitializeBuffer (Buffer, Size);
+ if (ACPI_FAILURE (Status))
{
- ACPI_STRCPY (Info->UniqueId, Uid.Buffer);
- Info->Valid |= ACPI_VALID_UID;
+ goto Cleanup;
}
- /*
- * Execute the _STA method and save the result
- * _STA is not always present
- */
- Status = AcpiUtExecute_STA (Node, &DeviceStatus);
- if (ACPI_SUCCESS (Status))
+ /* Populate the return buffer */
+
+ ReturnInfo = Buffer->Pointer;
+ ACPI_MEMCPY (ReturnInfo, &Info, sizeof (ACPI_DEVICE_INFO));
+
+ if (CidList)
{
- Info->CurrentStatus = DeviceStatus;
- Info->Valid |= ACPI_VALID_STA;
+ ACPI_MEMCPY (&ReturnInfo->CompatibilityId, CidList, CidList->Size);
}
- /*
- * Execute the _ADR method and save result if successful
- * _ADR is not always present
- */
- Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,
- Node, &Address);
- if (ACPI_SUCCESS (Status))
+Cleanup:
+ if (CidList)
{
- Info->Address = Address;
- Info->Valid |= ACPI_VALID_ADR;
+ ACPI_MEM_FREE (CidList);
}
-
- return (AE_OK);
+ return (Status);
}
diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/psargs.c
index 3db9b7a..7ada389 100644
--- a/sys/contrib/dev/acpica/psargs.c
+++ b/sys/contrib/dev/acpica/psargs.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
- * $Revision: 69 $
+ * $Revision: 73 $
*
*****************************************************************************/
@@ -436,6 +436,11 @@ AcpiPsGetNextNamepath (
(Status != AE_NOT_FOUND))
{
ACPI_REPORT_NSERROR (Path, Status);
+
+ AcpiOsPrintf ("SearchNode %p StartNode %p ReturnNode %p\n",
+ ScopeInfo.Scope.Node, ParserState->StartNode, Node);
+
+
}
else
{
@@ -500,7 +505,7 @@ AcpiPsGetNextSimpleArg (
/* Get 2 bytes from the AML stream */
- ACPI_MOVE_UNALIGNED16_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
+ ACPI_MOVE_16_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
ParserState->Aml += 2;
break;
@@ -511,7 +516,7 @@ AcpiPsGetNextSimpleArg (
/* Get 4 bytes from the AML stream */
- ACPI_MOVE_UNALIGNED32_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
+ ACPI_MOVE_32_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
ParserState->Aml += 4;
break;
@@ -522,7 +527,7 @@ AcpiPsGetNextSimpleArg (
/* Get 8 bytes from the AML stream */
- ACPI_MOVE_UNALIGNED64_TO_64 (&Arg->Common.Value.Integer, ParserState->Aml);
+ ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, ParserState->Aml);
ParserState->Aml += 8;
break;
@@ -625,7 +630,7 @@ AcpiPsGetNextField (
/* Get the 4-character name */
- ACPI_MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml);
+ ACPI_MOVE_32_TO_32 (&Name, ParserState->Aml);
AcpiPsSetName (Field, Name);
ParserState->Aml += ACPI_NAME_SIZE;
@@ -649,9 +654,9 @@ AcpiPsGetNextField (
* Get AccessType and AccessAttrib and merge into the field Op
* AccessType is first operand, AccessAttribute is second
*/
- Field->Common.Value.Integer32 = (ACPI_GET8 (ParserState->Aml) << 8);
+ Field->Common.Value.Integer = (ACPI_GET8 (ParserState->Aml) << 8);
ParserState->Aml++;
- Field->Common.Value.Integer32 |= ACPI_GET8 (ParserState->Aml);
+ Field->Common.Value.Integer |= ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
break;
diff --git a/sys/contrib/dev/acpica/pswalk.c b/sys/contrib/dev/acpica/pswalk.c
index 9cb6a70..74813c2 100644
--- a/sys/contrib/dev/acpica/pswalk.c
+++ b/sys/contrib/dev/acpica/pswalk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
- * $Revision: 68 $
+ * $Revision: 69 $
*
*****************************************************************************/
@@ -353,7 +353,7 @@ AcpiPsDeleteParseTree (
return_VOID;
}
- WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, Thread);
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, Thread);
if (!WalkState)
{
return_VOID;
diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c
index ef9addc..4f8795a 100644
--- a/sys/contrib/dev/acpica/psxface.c
+++ b/sys/contrib/dev/acpica/psxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
- * $Revision: 67 $
+ * $Revision: 68 $
*
*****************************************************************************/
@@ -261,7 +261,7 @@ AcpiPsxExecute (
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL);
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
return_ACPI_STATUS (AE_NO_MEMORY);
diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/rsaddr.c
index 4787ffa..fe083cb 100644
--- a/sys/contrib/dev/acpica/rsaddr.c
+++ b/sys/contrib/dev/acpica/rsaddr.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsaddr - Address resource descriptors (16/32/64)
- * $Revision: 29 $
+ * $Revision: 32 $
*
******************************************************************************/
@@ -166,7 +166,7 @@ AcpiRsAddress16Resource (
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
*BytesConsumed = Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_ADDRESS16;
@@ -241,36 +241,31 @@ AcpiRsAddress16Resource (
* Get Granularity (Bytes 6-7)
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.Granularity,
- Buffer);
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.Granularity, Buffer);
/*
* Get MinAddressRange (Bytes 8-9)
*/
Buffer += 2;
- ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.MinAddressRange,
- Buffer);
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MinAddressRange, Buffer);
/*
* Get MaxAddressRange (Bytes 10-11)
*/
Buffer += 2;
- ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.MaxAddressRange,
- Buffer);
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MaxAddressRange, Buffer);
/*
* Get AddressTranslationOffset (Bytes 12-13)
*/
Buffer += 2;
- ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressTranslationOffset,
- Buffer);
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressTranslationOffset, Buffer);
/*
* Get AddressLength (Bytes 14-15)
*/
Buffer += 2;
- ACPI_MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressLength,
- Buffer);
+ ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressLength, Buffer);
/*
* Resource Source Index (if present)
@@ -444,36 +439,31 @@ AcpiRsAddress16Stream (
/*
* Set the address space granularity
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
- &LinkedList->Data.Address16.Granularity);
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.Granularity);
Buffer += 2;
/*
* Set the address range minimum
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
- &LinkedList->Data.Address16.MinAddressRange);
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MinAddressRange);
Buffer += 2;
/*
* Set the address range maximum
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
- &LinkedList->Data.Address16.MaxAddressRange);
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MaxAddressRange);
Buffer += 2;
/*
* Set the address translation offset
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
- &LinkedList->Data.Address16.AddressTranslationOffset);
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.AddressTranslationOffset);
Buffer += 2;
/*
* Set the address length
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer,
- &LinkedList->Data.Address16.AddressLength);
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.AddressLength);
Buffer += 2;
/*
@@ -498,7 +488,7 @@ AcpiRsAddress16Stream (
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- Buffer += (ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + 1);
+ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + 1);
}
/*
@@ -512,7 +502,7 @@ AcpiRsAddress16Stream (
* minus the header size (3 bytes)
*/
ActualBytes -= 3;
- ACPI_MOVE_UNALIGNED16_TO_16 (LengthField, &ActualBytes);
+ ACPI_MOVE_SIZE_TO_16 (LengthField, &ActualBytes);
return_ACPI_STATUS (AE_OK);
}
@@ -564,7 +554,7 @@ AcpiRsAddress32Resource (
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
*BytesConsumed = Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_ADDRESS32;
@@ -643,36 +633,31 @@ AcpiRsAddress32Resource (
* Get Granularity (Bytes 6-9)
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.Granularity,
- Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.Granularity, Buffer);
/*
* Get MinAddressRange (Bytes 10-13)
*/
Buffer += 4;
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.MinAddressRange,
- Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MinAddressRange, Buffer);
/*
* Get MaxAddressRange (Bytes 14-17)
*/
Buffer += 4;
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.MaxAddressRange,
- Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MaxAddressRange, Buffer);
/*
* Get AddressTranslationOffset (Bytes 18-21)
*/
Buffer += 4;
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset,
- Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset, Buffer);
/*
* Get AddressLength (Bytes 22-25)
*/
Buffer += 4;
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.AddressLength,
- Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressLength, Buffer);
/*
* Resource Source Index (if present)
@@ -844,36 +829,31 @@ AcpiRsAddress32Stream (
/*
* Set the address space granularity
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
- &LinkedList->Data.Address32.Granularity);
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.Granularity);
Buffer += 4;
/*
* Set the address range minimum
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
- &LinkedList->Data.Address32.MinAddressRange);
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MinAddressRange);
Buffer += 4;
/*
* Set the address range maximum
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
- &LinkedList->Data.Address32.MaxAddressRange);
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MaxAddressRange);
Buffer += 4;
/*
* Set the address translation offset
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
- &LinkedList->Data.Address32.AddressTranslationOffset);
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.AddressTranslationOffset);
Buffer += 4;
/*
* Set the address length
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
- &LinkedList->Data.Address32.AddressLength);
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.AddressLength);
Buffer += 4;
/*
@@ -898,7 +878,7 @@ AcpiRsAddress32Stream (
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- Buffer += (ACPI_STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1);
+ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1);
}
/*
@@ -962,7 +942,7 @@ AcpiRsAddress64Resource (
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
*BytesConsumed = Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_ADDRESS64;
@@ -1042,36 +1022,31 @@ AcpiRsAddress64Resource (
* Get Granularity (Bytes 6-13)
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.Granularity,
- Buffer);
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.Granularity, Buffer);
/*
* Get MinAddressRange (Bytes 14-21)
*/
Buffer += 8;
- ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange,
- Buffer);
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange, Buffer);
/*
* Get MaxAddressRange (Bytes 22-29)
*/
Buffer += 8;
- ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange,
- Buffer);
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange, Buffer);
/*
* Get AddressTranslationOffset (Bytes 30-37)
*/
Buffer += 8;
- ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset,
- Buffer);
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset, Buffer);
/*
* Get AddressLength (Bytes 38-45)
*/
Buffer += 8;
- ACPI_MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressLength,
- Buffer);
+ ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressLength, Buffer);
/*
* Resource Source Index (if present)
@@ -1247,36 +1222,31 @@ AcpiRsAddress64Stream (
/*
* Set the address space granularity
*/
- ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
- &LinkedList->Data.Address64.Granularity);
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.Granularity);
Buffer += 8;
/*
* Set the address range minimum
*/
- ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
- &LinkedList->Data.Address64.MinAddressRange);
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MinAddressRange);
Buffer += 8;
/*
* Set the address range maximum
*/
- ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
- &LinkedList->Data.Address64.MaxAddressRange);
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MaxAddressRange);
Buffer += 8;
/*
* Set the address translation offset
*/
- ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
- &LinkedList->Data.Address64.AddressTranslationOffset);
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.AddressTranslationOffset);
Buffer += 8;
/*
* Set the address length
*/
- ACPI_MOVE_UNALIGNED64_TO_64 (Buffer,
- &LinkedList->Data.Address64.AddressLength);
+ ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.AddressLength);
Buffer += 8;
/*
@@ -1300,7 +1270,7 @@ AcpiRsAddress64Stream (
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- Buffer += (ACPI_STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1);
+ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1);
}
/*
diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/rscalc.c
index 5d2277a..f1aafce 100644
--- a/sys/contrib/dev/acpica/rscalc.c
+++ b/sys/contrib/dev/acpica/rscalc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
- * $Revision: 47 $
+ * $Revision: 48 $
*
******************************************************************************/
@@ -433,7 +433,7 @@ AcpiRsGetListLength (
Buffer = ByteStreamBuffer;
++Buffer;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
/*
@@ -474,7 +474,7 @@ AcpiRsGetListLength (
Buffer = ByteStreamBuffer;
++Buffer;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
@@ -514,7 +514,7 @@ AcpiRsGetListLength (
Buffer = ByteStreamBuffer;
++Buffer;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
@@ -554,7 +554,7 @@ AcpiRsGetListLength (
Buffer = ByteStreamBuffer;
++Buffer;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
@@ -594,7 +594,7 @@ AcpiRsGetListLength (
Buffer = ByteStreamBuffer;
++Buffer;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
BytesConsumed = Temp16 + 3;
@@ -667,7 +667,7 @@ AcpiRsGetListLength (
/*
* Look at the number of bits set
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
for (Index = 0; Index < 16; Index++)
{
diff --git a/sys/contrib/dev/acpica/rsio.c b/sys/contrib/dev/acpica/rsio.c
index fc63577..d321909 100644
--- a/sys/contrib/dev/acpica/rsio.c
+++ b/sys/contrib/dev/acpica/rsio.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsio - IO and DMA resource descriptors
- * $Revision: 23 $
+ * $Revision: 24 $
*
******************************************************************************/
@@ -180,7 +180,7 @@ AcpiRsIoResource (
* Check MinBase Address
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.Io.MinBaseAddress = Temp16;
@@ -188,7 +188,7 @@ AcpiRsIoResource (
* Check MaxBase Address
*/
Buffer += 2;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.Io.MaxBaseAddress = Temp16;
@@ -270,7 +270,7 @@ AcpiRsFixedIoResource (
* Check Range Base Address
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.FixedIo.BaseAddress = Temp16;
@@ -344,7 +344,7 @@ AcpiRsIoStream (
*/
Temp16 = (UINT16) LinkedList->Data.Io.MinBaseAddress;
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -352,7 +352,7 @@ AcpiRsIoStream (
*/
Temp16 = (UINT16) LinkedList->Data.Io.MaxBaseAddress;
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -421,7 +421,7 @@ AcpiRsFixedIoStream (
*/
Temp16 = (UINT16) LinkedList->Data.FixedIo.BaseAddress;
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/rsirq.c
index 7da1fdc..a8d5c16 100644
--- a/sys/contrib/dev/acpica/rsirq.c
+++ b/sys/contrib/dev/acpica/rsirq.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsirq - IRQ resource descriptors
- * $Revision: 32 $
+ * $Revision: 34 $
*
******************************************************************************/
@@ -175,7 +175,7 @@ AcpiRsIrqResource (
* Point to the 16-bits of Bytes 1 and 2
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.Irq.NumberOfInterrupts = 0;
@@ -328,7 +328,7 @@ AcpiRsIrqStream (
Temp16 |= 0x1 << Temp8;
}
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -406,7 +406,7 @@ AcpiRsExtendedIrqResource (
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
*BytesConsumed = Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_EXT_IRQ;
@@ -464,7 +464,7 @@ AcpiRsExtendedIrqResource (
*/
for (Index = 0; Index < Temp8; Index++)
{
- ACPI_MOVE_UNALIGNED32_TO_32 (
+ ACPI_MOVE_32_TO_32 (
&OutputStruct->Data.ExtendedIrq.Interrupts[Index], Buffer);
/* Point to the next IRQ */
@@ -628,7 +628,7 @@ AcpiRsExtendedIrqStream (
for (Index = 0; Index < LinkedList->Data.ExtendedIrq.NumberOfInterrupts;
Index++)
{
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_32_TO_32 (Buffer,
&LinkedList->Data.ExtendedIrq.Interrupts[Index]);
Buffer += 4;
}
@@ -653,7 +653,7 @@ AcpiRsExtendedIrqStream (
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- Buffer += (ACPI_STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1);
+ Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1);
}
/*
diff --git a/sys/contrib/dev/acpica/rsmemory.c b/sys/contrib/dev/acpica/rsmemory.c
index d33e352..7462de4 100644
--- a/sys/contrib/dev/acpica/rsmemory.c
+++ b/sys/contrib/dev/acpica/rsmemory.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsmem24 - Memory resource descriptors
- * $Revision: 22 $
+ * $Revision: 24 $
*
******************************************************************************/
@@ -166,7 +166,7 @@ AcpiRsMemory24Resource (
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
Buffer += 2;
*BytesConsumed = (ACPI_SIZE) Temp16 + 3;
OutputStruct->Id = ACPI_RSTYPE_MEM24;
@@ -181,28 +181,28 @@ AcpiRsMemory24Resource (
/*
* Get MinBaseAddress (Bytes 4-5)
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
Buffer += 2;
OutputStruct->Data.Memory24.MinBaseAddress = Temp16;
/*
* Get MaxBaseAddress (Bytes 6-7)
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
Buffer += 2;
OutputStruct->Data.Memory24.MaxBaseAddress = Temp16;
/*
* Get Alignment (Bytes 8-9)
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
Buffer += 2;
OutputStruct->Data.Memory24.Alignment = Temp16;
/*
* Get RangeLength (Bytes 10-11)
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
OutputStruct->Data.Memory24.RangeLength = Temp16;
/*
@@ -258,7 +258,7 @@ AcpiRsMemory24Stream (
* The length field is static
*/
Temp16 = 0x09;
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -271,25 +271,25 @@ AcpiRsMemory24Stream (
/*
* Set the Range minimum base address
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
Buffer += 2;
/*
* Set the Range maximum base address
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
Buffer += 2;
/*
* Set the base alignment
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
Buffer += 2;
/*
* Set the range length
*/
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
+ ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
Buffer += 2;
/*
@@ -343,7 +343,7 @@ AcpiRsMemory32RangeResource (
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
Buffer += 2;
*BytesConsumed = (ACPI_SIZE) Temp16 + 3;
@@ -370,27 +370,25 @@ AcpiRsMemory32RangeResource (
/*
* Get MinBaseAddress (Bytes 4-7)
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress,
- Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress, Buffer);
Buffer += 4;
/*
* Get MaxBaseAddress (Bytes 8-11)
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress,
- Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress, Buffer);
Buffer += 4;
/*
* Get Alignment (Bytes 12-15)
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
Buffer += 4;
/*
* Get RangeLength (Bytes 16-19)
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
/*
* Set the Length parameter
@@ -447,7 +445,7 @@ AcpiRsFixedMemory32Resource (
* Point past the Descriptor to get the number of bytes consumed
*/
Buffer += 1;
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
Buffer += 2;
*BytesConsumed = (ACPI_SIZE) Temp16 + 3;
@@ -464,15 +462,13 @@ AcpiRsFixedMemory32Resource (
/*
* Get RangeBaseAddress (Bytes 4-7)
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress,
- Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress, Buffer);
Buffer += 4;
/*
* Get RangeLength (Bytes 8-11)
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength,
- Buffer);
+ ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength, Buffer);
/*
* Set the Length parameter
@@ -528,7 +524,7 @@ AcpiRsMemory32RangeStream (
*/
Temp16 = 0x11;
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -541,25 +537,25 @@ AcpiRsMemory32RangeStream (
/*
* Set the Range minimum base address
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
Buffer += 4;
/*
* Set the Range maximum base address
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
Buffer += 4;
/*
* Set the base alignment
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
Buffer += 4;
/*
* Set the range length
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
+ ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
Buffer += 4;
/*
@@ -611,7 +607,7 @@ AcpiRsFixedMemory32Stream (
*/
Temp16 = 0x09;
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
Buffer += 2;
/*
@@ -624,14 +620,14 @@ AcpiRsFixedMemory32Stream (
/*
* Set the Range base address
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_32_TO_32 (Buffer,
&LinkedList->Data.FixedMemory32.RangeBaseAddress);
Buffer += 4;
/*
* Set the range length
*/
- ACPI_MOVE_UNALIGNED32_TO_32 (Buffer,
+ ACPI_MOVE_32_TO_32 (Buffer,
&LinkedList->Data.FixedMemory32.RangeLength);
Buffer += 4;
diff --git a/sys/contrib/dev/acpica/rsmisc.c b/sys/contrib/dev/acpica/rsmisc.c
index 83b109f..0aca8a6 100644
--- a/sys/contrib/dev/acpica/rsmisc.c
+++ b/sys/contrib/dev/acpica/rsmisc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsmisc - Miscellaneous resource descriptors
- * $Revision: 25 $
+ * $Revision: 26 $
*
******************************************************************************/
@@ -286,7 +286,7 @@ AcpiRsVendorResource (
/* Dereference */
- ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
/* Calculate bytes consumed */
@@ -385,7 +385,7 @@ AcpiRsVendorStream (
Temp16 = (UINT16) LinkedList->Data.VendorSpecific.Length;
- ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
+ ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
Buffer += 2;
}
else
diff --git a/sys/contrib/dev/acpica/rsxface.c b/sys/contrib/dev/acpica/rsxface.c
index 5ec7c337..2785898 100644
--- a/sys/contrib/dev/acpica/rsxface.c
+++ b/sys/contrib/dev/acpica/rsxface.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsxface - Public interfaces to the resource manager
- * $Revision: 24 $
+ * $Revision: 27 $
*
******************************************************************************/
@@ -426,21 +426,20 @@ AcpiSetCurrentResources (
}
-
-#define COPY_FIELD(Out, In, Field) Out->Field = In->Field
-#define COPY_ADDRESS(Out, In) \
- COPY_FIELD(Out, In, ResourceType); \
- COPY_FIELD(Out, In, ProducerConsumer); \
- COPY_FIELD(Out, In, Decode); \
- COPY_FIELD(Out, In, MinAddressFixed); \
- COPY_FIELD(Out, In, MaxAddressFixed); \
- COPY_FIELD(Out, In, Attribute); \
- COPY_FIELD(Out, In, Granularity); \
- COPY_FIELD(Out, In, MinAddressRange); \
- COPY_FIELD(Out, In, MaxAddressRange); \
- COPY_FIELD(Out, In, AddressTranslationOffset); \
- COPY_FIELD(Out, In, AddressLength); \
- COPY_FIELD(Out, In, ResourceSource);
+#define ACPI_COPY_FIELD(Out, In, Field) ((Out)->Field = (In)->Field)
+#define ACPI_COPY_ADDRESS(Out, In) \
+ ACPI_COPY_FIELD(Out, In, ResourceType); \
+ ACPI_COPY_FIELD(Out, In, ProducerConsumer); \
+ ACPI_COPY_FIELD(Out, In, Decode); \
+ ACPI_COPY_FIELD(Out, In, MinAddressFixed); \
+ ACPI_COPY_FIELD(Out, In, MaxAddressFixed); \
+ ACPI_COPY_FIELD(Out, In, Attribute); \
+ ACPI_COPY_FIELD(Out, In, Granularity); \
+ ACPI_COPY_FIELD(Out, In, MinAddressRange); \
+ ACPI_COPY_FIELD(Out, In, MaxAddressRange); \
+ ACPI_COPY_FIELD(Out, In, AddressTranslationOffset); \
+ ACPI_COPY_FIELD(Out, In, AddressLength); \
+ ACPI_COPY_FIELD(Out, In, ResourceSource);
/******************************************************************************
*
@@ -467,25 +466,31 @@ AcpiResourceToAddress64 (
{
ACPI_RESOURCE_ADDRESS16 *Address16;
ACPI_RESOURCE_ADDRESS32 *Address32;
- ACPI_RESOURCE_ADDRESS64 *Address64;
switch (Resource->Id) {
case ACPI_RSTYPE_ADDRESS16:
+
Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data;
- COPY_ADDRESS(Out, Address16);
+ ACPI_COPY_ADDRESS(Out, Address16);
break;
+
case ACPI_RSTYPE_ADDRESS32:
+
Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data;
- COPY_ADDRESS(Out, Address32);
+ ACPI_COPY_ADDRESS(Out, Address32);
break;
+
case ACPI_RSTYPE_ADDRESS64:
- Address64 = (ACPI_RESOURCE_ADDRESS64 *) &Resource->Data;
- COPY_ADDRESS(Out, Address64);
+
+ /* Simple copy for 64 bit source */
+
+ ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
break;
+
default:
return (AE_BAD_PARAMETER);
}
diff --git a/sys/contrib/dev/acpica/tbconvrt.c b/sys/contrib/dev/acpica/tbconvrt.c
index 1bf7535..c3502e5 100644
--- a/sys/contrib/dev/acpica/tbconvrt.c
+++ b/sys/contrib/dev/acpica/tbconvrt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbconvrt - ACPI Table conversion utilities
- * $Revision: 47 $
+ * $Revision: 52 $
*
*****************************************************************************/
@@ -243,6 +243,36 @@ AcpiTbConvertToXsdt (
}
+/******************************************************************************
+ *
+ * FUNCTION: AcpiTbInitGenericAddress
+ *
+ * PARAMETERS: NewGasStruct - GAS struct to be initialized
+ * RegisterBitWidth - Width of this register
+ * Address - Address of the register
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize a GAS structure.
+ *
+ ******************************************************************************/
+
+static void
+AcpiTbInitGenericAddress (
+ ACPI_GENERIC_ADDRESS *NewGasStruct,
+ UINT8 RegisterBitWidth,
+ ACPI_PHYSICAL_ADDRESS Address)
+{
+
+ ACPI_STORE_ADDRESS (NewGasStruct->Address, Address);
+
+ NewGasStruct->AddressSpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
+ NewGasStruct->RegisterBitWidth = RegisterBitWidth;
+ NewGasStruct->RegisterBitOffset = 0;
+ NewGasStruct->Reserved = 0;
+}
+
+
/*******************************************************************************
*
* FUNCTION: AcpiTbConvertFadt1
@@ -312,14 +342,39 @@ AcpiTbConvertFadt1 (
/*
* Convert the V1.0 block addresses to V2.0 GAS structures
*/
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1aEvtBlk, LocalFadt->Pm1EvtLen, LocalFadt->V1_Pm1aEvtBlk);
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1bEvtBlk, LocalFadt->Pm1EvtLen, LocalFadt->V1_Pm1bEvtBlk);
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1aCntBlk, LocalFadt->Pm1CntLen, LocalFadt->V1_Pm1aCntBlk);
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1bCntBlk, LocalFadt->Pm1CntLen, LocalFadt->V1_Pm1bCntBlk);
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm2CntBlk, LocalFadt->Pm2CntLen, LocalFadt->V1_Pm2CntBlk);
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPmTmrBlk, LocalFadt->PmTmLen, LocalFadt->V1_PmTmrBlk);
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XGpe0Blk, 0, LocalFadt->V1_Gpe0Blk);
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XGpe1Blk, 0, LocalFadt->V1_Gpe1Blk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1aEvtBlk, LocalFadt->Pm1EvtLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aEvtBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1bEvtBlk, LocalFadt->Pm1EvtLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bEvtBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1aCntBlk, LocalFadt->Pm1CntLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aCntBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1bCntBlk, LocalFadt->Pm1CntLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bCntBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm2CntBlk, LocalFadt->Pm2CntLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm2CntBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPmTmrBlk, LocalFadt->PmTmLen,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_PmTmrBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XGpe0Blk, 0,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe0Blk);
+ AcpiTbInitGenericAddress (&LocalFadt->XGpe1Blk, 0,
+ (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe1Blk);
+
+ /* Create separate GAS structs for the PM1 Enable registers */
+
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable,
+ (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
+ (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address) +
+ ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));
+
+ /* PM1B is optional; leave null if not present */
+
+ if (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address))
+ {
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable,
+ (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
+ (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address) +
+ ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));
+ }
}
@@ -364,50 +419,69 @@ AcpiTbConvertFadt2 (
if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address)))
{
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1aEvtBlk,
- LocalFadt->Pm1EvtLen, LocalFadt->V1_Pm1aEvtBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1aEvtBlk,
+ LocalFadt->Pm1EvtLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aEvtBlk);
}
if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address)))
{
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1bEvtBlk,
- LocalFadt->Pm1EvtLen, LocalFadt->V1_Pm1bEvtBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1bEvtBlk,
+ LocalFadt->Pm1EvtLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bEvtBlk);
}
if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1aCntBlk.Address)))
{
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1aCntBlk,
- LocalFadt->Pm1CntLen, LocalFadt->V1_Pm1aCntBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1aCntBlk,
+ LocalFadt->Pm1CntLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1aCntBlk);
}
if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1bCntBlk.Address)))
{
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1bCntBlk,
- LocalFadt->Pm1CntLen, LocalFadt->V1_Pm1bCntBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm1bCntBlk,
+ LocalFadt->Pm1CntLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm1bCntBlk);
}
if (!(ACPI_GET_ADDRESS (LocalFadt->XPm2CntBlk.Address)))
{
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm2CntBlk,
- LocalFadt->Pm2CntLen, LocalFadt->V1_Pm2CntBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPm2CntBlk,
+ LocalFadt->Pm2CntLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Pm2CntBlk);
}
if (!(ACPI_GET_ADDRESS (LocalFadt->XPmTmrBlk.Address)))
{
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPmTmrBlk,
- LocalFadt->PmTmLen, LocalFadt->V1_PmTmrBlk);
+ AcpiTbInitGenericAddress (&LocalFadt->XPmTmrBlk,
+ LocalFadt->PmTmLen, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_PmTmrBlk);
}
if (!(ACPI_GET_ADDRESS (LocalFadt->XGpe0Blk.Address)))
{
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XGpe0Blk,
- 0, LocalFadt->V1_Gpe0Blk);
+ AcpiTbInitGenericAddress (&LocalFadt->XGpe0Blk,
+ 0, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe0Blk);
}
if (!(ACPI_GET_ADDRESS (LocalFadt->XGpe1Blk.Address)))
{
- ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XGpe1Blk,
- 0, LocalFadt->V1_Gpe1Blk);
+ AcpiTbInitGenericAddress (&LocalFadt->XGpe1Blk,
+ 0, (ACPI_PHYSICAL_ADDRESS) LocalFadt->V1_Gpe1Blk);
+ }
+
+ /* Create separate GAS structs for the PM1 Enable registers */
+
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable,
+ (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
+ (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address) +
+ ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));
+ AcpiGbl_XPm1aEnable.AddressSpaceId = LocalFadt->XPm1aEvtBlk.AddressSpaceId;
+
+ /* PM1B is optional; leave null if not present */
+
+ if (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address))
+ {
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable,
+ (UINT8) ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen),
+ (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address) +
+ ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen)));
+ AcpiGbl_XPm1bEnable.AddressSpaceId = LocalFadt->XPm1bEvtBlk.AddressSpaceId;
}
}
@@ -491,7 +565,7 @@ AcpiTbConvertTableFadt (void)
/* Free the original table */
- TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_FADT];
+ TableDesc = AcpiGbl_TableLists[ACPI_TABLE_FADT].Next;
AcpiTbDeleteSingleTable (TableDesc);
/* Install the new table */
diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c
index 9dc70b6..01fac0e 100644
--- a/sys/contrib/dev/acpica/tbget.c
+++ b/sys/contrib/dev/acpica/tbget.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbget - ACPI Table get* routines
- * $Revision: 83 $
+ * $Revision: 84 $
*
*****************************************************************************/
@@ -547,18 +547,19 @@ AcpiTbGetTablePtr (
*/
if (Instance == 1)
{
- /*
- * Just pluck the pointer out of the global table!
- * Will be null if no table is present
- */
- *TablePtrLoc = AcpiGbl_AcpiTables[TableType].Pointer;
+ /* Get the first */
+
+ if (AcpiGbl_TableLists[TableType].Next)
+ {
+ *TablePtrLoc = AcpiGbl_TableLists[TableType].Next->Pointer;
+ }
return_ACPI_STATUS (AE_OK);
}
/*
* Check for instance out of range
*/
- if (Instance > AcpiGbl_AcpiTables[TableType].Count)
+ if (Instance > AcpiGbl_TableLists[TableType].Count)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
@@ -570,7 +571,7 @@ AcpiTbGetTablePtr (
* need to walk from the 2nd table until we reach the Instance
* that the user is looking for and return its table pointer.
*/
- TableDesc = AcpiGbl_AcpiTables[TableType].Next;
+ TableDesc = AcpiGbl_TableLists[TableType].Next;
for (i = 2; i < Instance; i++)
{
TableDesc = TableDesc->Next;
diff --git a/sys/contrib/dev/acpica/tbgetall.c b/sys/contrib/dev/acpica/tbgetall.c
index 3e7989a..4ed22b0 100644
--- a/sys/contrib/dev/acpica/tbgetall.c
+++ b/sys/contrib/dev/acpica/tbgetall.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbgetall - Get all required ACPI tables
- * $Revision: 5 $
+ * $Revision: 7 $
*
*****************************************************************************/
@@ -311,7 +311,7 @@ AcpiTbGetRequiredTables (
*/
for (i = 0; i < AcpiGbl_RsdtTableCount; i++)
{
- /* Get the table addresss from the common internal XSDT */
+ /* Get the table address from the common internal XSDT */
Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[i]);
@@ -396,7 +396,7 @@ AcpiTbGetRequiredTables (
/* Always delete the RSDP mapping, we are done with it */
- AcpiTbDeleteAcpiTable (ACPI_TABLE_RSDP);
+ AcpiTbDeleteTablesByType (ACPI_TABLE_RSDP);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c
index 5e5f017..4471e80 100644
--- a/sys/contrib/dev/acpica/tbinstal.c
+++ b/sys/contrib/dev/acpica/tbinstal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
- * $Revision: 68 $
+ * $Revision: 69 $
*
*****************************************************************************/
@@ -154,15 +154,15 @@ AcpiTbMatchSignature (
/*
* Search for a signature match among the known table types
*/
- for (i = 0; i < NUM_ACPI_TABLES; i++)
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
{
- if (!(AcpiGbl_AcpiTableData[i].Flags & SearchType))
+ if (!(AcpiGbl_TableData[i].Flags & SearchType))
{
continue;
}
- if (!ACPI_STRNCMP (Signature, AcpiGbl_AcpiTableData[i].Signature,
- AcpiGbl_AcpiTableData[i].SigLength))
+ if (!ACPI_STRNCMP (Signature, AcpiGbl_TableData[i].Signature,
+ AcpiGbl_TableData[i].SigLength))
{
/* Found a signature match, return index if requested */
@@ -173,7 +173,7 @@ AcpiTbMatchSignature (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Table [%4.4s] is an ACPI table consumed by the core subsystem\n",
- (char *) AcpiGbl_AcpiTableData[i].Signature));
+ (char *) AcpiGbl_TableData[i].Signature));
return_ACPI_STATUS (AE_OK);
}
@@ -230,7 +230,7 @@ AcpiTbInstallTable (
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
- AcpiGbl_AcpiTableData[TableInfo->Type].Name, TableInfo->Pointer));
+ AcpiGbl_TableData[TableInfo->Type].Name, TableInfo->Pointer));
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
@@ -323,76 +323,62 @@ AcpiTbInitTableDescriptor (
ACPI_TABLE_TYPE TableType,
ACPI_TABLE_DESC *TableInfo)
{
- ACPI_TABLE_DESC *ListHead;
+ ACPI_TABLE_LIST *ListHead;
ACPI_TABLE_DESC *TableDesc;
ACPI_FUNCTION_TRACE_U32 ("TbInitTableDescriptor", TableType);
+
+ /* Allocate a descriptor for this table */
+
+ TableDesc = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC));
+ if (!TableDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
/*
* Install the table into the global data structure
*/
- ListHead = &AcpiGbl_AcpiTables[TableType];
- TableDesc = ListHead;
+ ListHead = &AcpiGbl_TableLists[TableType];
/*
* Two major types of tables: 1) Only one instance is allowed. This
* includes most ACPI tables such as the DSDT. 2) Multiple instances of
* the table are allowed. This includes SSDT and PSDTs.
*/
- if (ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags))
+ if (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags))
{
/*
* Only one table allowed, and a table has alread been installed
* at this location, so return an error.
*/
- if (ListHead->Pointer)
+ if (ListHead->Next)
{
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
-
- TableDesc->Count = 1;
- TableDesc->Prev = NULL;
- TableDesc->Next = NULL;
}
- else
- {
- /*
- * Multiple tables allowed for this table type, we must link
- * the new table in to the list of tables of this type.
- */
- if (ListHead->Pointer)
- {
- TableDesc = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC));
- if (!TableDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- ListHead->Count++;
-
- /* Update the original previous */
- ListHead->Prev->Next = TableDesc;
-
- /* Update new entry */
-
- TableDesc->Prev = ListHead->Prev;
- TableDesc->Next = ListHead;
-
- /* Update list head */
+ /*
+ * Link the new table in to the list of tables of this type.
+ * Just insert at the start of the list, order unimportant.
+ *
+ * TableDesc->Prev is already NULL from calloc()
+ */
+ TableDesc->Next = ListHead->Next;
+ ListHead->Next = TableDesc;
- ListHead->Prev = TableDesc;
- }
- else
- {
- TableDesc->Count = 1;
- }
+ if (TableDesc->Next)
+ {
+ TableDesc->Next->Prev = TableDesc;
}
- /* Common initialization of the table descriptor */
+ ListHead->Count++;
+
+ /* Finish initialization of the table descriptor */
- TableDesc->Type = TableInfo->Type;
+ TableDesc->Type = (UINT8) TableType;
TableDesc->Pointer = TableInfo->Pointer;
TableDesc->Length = TableInfo->Length;
TableDesc->Allocation = TableInfo->Allocation;
@@ -406,9 +392,9 @@ AcpiTbInitTableDescriptor (
* Set the appropriate global pointer (if there is one) to point to the
* newly installed table
*/
- if (AcpiGbl_AcpiTableData[TableType].GlobalPtr)
+ if (AcpiGbl_TableData[TableType].GlobalPtr)
{
- *(AcpiGbl_AcpiTableData[TableType].GlobalPtr) = TableInfo->Pointer;
+ *(AcpiGbl_TableData[TableType].GlobalPtr) = TableInfo->Pointer;
}
/* Return Data */
@@ -422,7 +408,7 @@ AcpiTbInitTableDescriptor (
/*******************************************************************************
*
- * FUNCTION: AcpiTbDeleteAcpiTables
+ * FUNCTION: AcpiTbDeleteAllTables
*
* PARAMETERS: None.
*
@@ -433,7 +419,7 @@ AcpiTbInitTableDescriptor (
******************************************************************************/
void
-AcpiTbDeleteAcpiTables (void)
+AcpiTbDeleteAllTables (void)
{
ACPI_TABLE_TYPE Type;
@@ -442,16 +428,16 @@ AcpiTbDeleteAcpiTables (void)
* Free memory allocated for ACPI tables
* Memory can either be mapped or allocated
*/
- for (Type = 0; Type < NUM_ACPI_TABLES; Type++)
+ for (Type = 0; Type < NUM_ACPI_TABLE_TYPES; Type++)
{
- AcpiTbDeleteAcpiTable (Type);
+ AcpiTbDeleteTablesByType (Type);
}
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbDeleteAcpiTable
+ * FUNCTION: AcpiTbDeleteTablesByType
*
* PARAMETERS: Type - The table type to be deleted
*
@@ -463,11 +449,15 @@ AcpiTbDeleteAcpiTables (void)
******************************************************************************/
void
-AcpiTbDeleteAcpiTable (
+AcpiTbDeleteTablesByType (
ACPI_TABLE_TYPE Type)
{
+ ACPI_TABLE_DESC *TableDesc;
+ UINT32 Count;
+ UINT32 i;
- ACPI_FUNCTION_TRACE_U32 ("TbDeleteAcpiTable", Type);
+
+ ACPI_FUNCTION_TRACE_U32 ("TbDeleteTablesByType", Type);
if (Type > ACPI_TABLE_MAX)
@@ -511,43 +501,10 @@ AcpiTbDeleteAcpiTable (
}
/* Free the table */
-
- AcpiTbFreeAcpiTablesOfType (&AcpiGbl_AcpiTables[Type]);
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbFreeAcpiTablesOfType
- *
- * PARAMETERS: TableInfo - A table info struct
- *
- * RETURN: None.
- *
- * DESCRIPTION: Free the memory associated with an internal ACPI table
- * Table mutex should be locked.
- *
- ******************************************************************************/
-
-void
-AcpiTbFreeAcpiTablesOfType (
- ACPI_TABLE_DESC *ListHead)
-{
- ACPI_TABLE_DESC *TableDesc;
- UINT32 Count;
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE_PTR ("TbFreeAcpiTablesOfType", ListHead);
-
-
/* Get the head of the list */
- TableDesc = ListHead;
- Count = ListHead->Count;
+ TableDesc = AcpiGbl_TableLists[Type].Next;
+ Count = AcpiGbl_TableLists[Type].Count;
/*
* Walk the entire list, deleting both the allocated tables
@@ -558,6 +515,7 @@ AcpiTbFreeAcpiTablesOfType (
TableDesc = AcpiTbUninstallTable (TableDesc);
}
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_VOID;
}
@@ -580,33 +538,33 @@ AcpiTbDeleteSingleTable (
ACPI_TABLE_DESC *TableDesc)
{
- if (!TableDesc)
+ /* Must have a valid table descriptor and pointer */
+
+ if ((!TableDesc) ||
+ (!TableDesc->Pointer))
{
return;
}
- if (TableDesc->Pointer)
- {
- /* Valid table, determine type of memory allocation */
+ /* Valid table, determine type of memory allocation */
- switch (TableDesc->Allocation)
- {
- case ACPI_MEM_NOT_ALLOCATED:
- break;
+ switch (TableDesc->Allocation)
+ {
+ case ACPI_MEM_NOT_ALLOCATED:
+ break;
- case ACPI_MEM_ALLOCATED:
+ case ACPI_MEM_ALLOCATED:
- ACPI_MEM_FREE (TableDesc->Pointer);
- break;
+ ACPI_MEM_FREE (TableDesc->Pointer);
+ break;
- case ACPI_MEM_MAPPED:
+ case ACPI_MEM_MAPPED:
- AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
- break;
+ AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
+ break;
- default:
- break;
- }
+ default:
+ break;
}
}
@@ -632,7 +590,7 @@ AcpiTbUninstallTable (
ACPI_TABLE_DESC *NextDesc;
- ACPI_FUNCTION_TRACE_PTR ("AcpiTbUninstallTable", TableDesc);
+ ACPI_FUNCTION_TRACE_PTR ("TbUninstallTable", TableDesc);
if (!TableDesc)
@@ -640,12 +598,18 @@ AcpiTbUninstallTable (
return_PTR (NULL);
}
- /* Unlink the descriptor */
+ /* Unlink the descriptor from the doubly linked list */
if (TableDesc->Prev)
{
TableDesc->Prev->Next = TableDesc->Next;
}
+ else
+ {
+ /* Is first on list, update list head */
+
+ AcpiGbl_TableLists[TableDesc->Type].Next = TableDesc->Next;
+ }
if (TableDesc->Next)
{
@@ -656,25 +620,12 @@ AcpiTbUninstallTable (
AcpiTbDeleteSingleTable (TableDesc);
- /* Free the table descriptor (Don't delete the list head, tho) */
-
- if ((TableDesc->Prev) == (TableDesc->Next))
- {
- NextDesc = NULL;
-
- /* Clear the list head */
+ /* Free the table descriptor */
- TableDesc->Pointer = NULL;
- TableDesc->Length = 0;
- TableDesc->Count = 0;
- }
- else
- {
- /* Free the table descriptor */
+ NextDesc = TableDesc->Next;
+ ACPI_MEM_FREE (TableDesc);
- NextDesc = TableDesc->Next;
- ACPI_MEM_FREE (TableDesc);
- }
+ /* Return pointer to the next descriptor */
return_PTR (NextDesc);
}
diff --git a/sys/contrib/dev/acpica/tbutils.c b/sys/contrib/dev/acpica/tbutils.c
index d3cb75b..c006a5b 100644
--- a/sys/contrib/dev/acpica/tbutils.c
+++ b/sys/contrib/dev/acpica/tbutils.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
- * $Revision: 58 $
+ * $Revision: 60 $
*
*****************************************************************************/
@@ -140,10 +140,10 @@
ACPI_STATUS
AcpiTbHandleToObject (
UINT16 TableId,
- ACPI_TABLE_DESC **TableDesc)
+ ACPI_TABLE_DESC **ReturnTableDesc)
{
UINT32 i;
- ACPI_TABLE_DESC *ListHead;
+ ACPI_TABLE_DESC *TableDesc;
ACPI_FUNCTION_NAME ("TbHandleToObject");
@@ -151,18 +151,17 @@ AcpiTbHandleToObject (
for (i = 0; i < ACPI_TABLE_MAX; i++)
{
- ListHead = &AcpiGbl_AcpiTables[i];
- do
+ TableDesc = AcpiGbl_TableLists[i].Next;
+ while (TableDesc)
{
- if (ListHead->TableId == TableId)
+ if (TableDesc->TableId == TableId)
{
- *TableDesc = ListHead;
+ *ReturnTableDesc = TableDesc;
return (AE_OK);
}
- ListHead = ListHead->Next;
-
- } while (ListHead != &AcpiGbl_AcpiTables[i]);
+ TableDesc = TableDesc->Next;
+ }
}
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "TableId=%X does not exist\n", TableId));
@@ -211,7 +210,7 @@ AcpiTbValidateTableHeader (
/* Ensure that the signature is 4 ASCII characters */
- ACPI_MOVE_UNALIGNED32_TO_32 (&Signature, TableHeader->Signature);
+ ACPI_MOVE_32_TO_32 (&Signature, TableHeader->Signature);
if (!AcpiUtValidAcpiName (Signature))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c
index 6a345dc..ede9724 100644
--- a/sys/contrib/dev/acpica/tbxface.c
+++ b/sys/contrib/dev/acpica/tbxface.c
@@ -2,7 +2,7 @@
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
- * $Revision: 61 $
+ * $Revision: 62 $
*
*****************************************************************************/
@@ -319,7 +319,7 @@ ACPI_STATUS
AcpiUnloadTable (
ACPI_TABLE_TYPE TableType)
{
- ACPI_TABLE_DESC *ListHead;
+ ACPI_TABLE_DESC *TableDesc;
ACPI_FUNCTION_TRACE ("AcpiUnloadTable");
@@ -335,8 +335,8 @@ AcpiUnloadTable (
/* Find all tables of the requested type */
- ListHead = &AcpiGbl_AcpiTables[TableType];
- do
+ TableDesc = AcpiGbl_TableLists[TableType].Next;
+ while (TableDesc);
{
/*
* Delete all namespace entries owned by this table. Note that these
@@ -344,14 +344,14 @@ AcpiUnloadTable (
* "Scope" operator. Thus, we need to track ownership by an ID, not
* simply a position within the hierarchy
*/
- AcpiNsDeleteNamespaceByOwner (ListHead->TableId);
+ AcpiNsDeleteNamespaceByOwner (TableDesc->TableId);
- /* Delete (or unmap) the actual table */
-
- AcpiTbDeleteAcpiTable (TableType);
+ TableDesc = TableDesc->Next;
+ }
- } while (ListHead != &AcpiGbl_AcpiTables[TableType]);
+ /* Delete (or unmap) all tables of this type */
+ AcpiTbDeleteTablesByType (TableType);
return_ACPI_STATUS (AE_OK);
}
@@ -400,7 +400,7 @@ AcpiGetTableHeader (
/* Check the table type and instance */
if ((TableType > ACPI_TABLE_MAX) ||
- (ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags) &&
+ (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) &&
Instance > 1))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -486,7 +486,7 @@ AcpiGetTable (
/* Check the table type and instance */
if ((TableType > ACPI_TABLE_MAX) ||
- (ACPI_IS_SINGLE_TABLE (AcpiGbl_AcpiTableData[TableType].Flags) &&
+ (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) &&
Instance > 1))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utcopy.c
index 2153f17..d385678 100644
--- a/sys/contrib/dev/acpica/utcopy.c
+++ b/sys/contrib/dev/acpica/utcopy.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
- * $Revision: 112 $
+ * $Revision: 113 $
*
*****************************************************************************/
@@ -741,14 +741,23 @@ AcpiUtCopySimpleObject (
if ((SourceDesc->Buffer.Pointer) &&
(!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
{
- DestDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length);
- if (!DestDesc->Buffer.Pointer)
+ DestDesc->Buffer.Pointer = NULL;
+
+ /* Create an actual buffer only if length > 0 */
+
+ if (SourceDesc->Buffer.Length)
{
- return (AE_NO_MEMORY);
- }
+ DestDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length);
+ if (!DestDesc->Buffer.Pointer)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Copy the actual buffer data */
- ACPI_MEMCPY (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer,
- SourceDesc->Buffer.Length);
+ ACPI_MEMCPY (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer,
+ SourceDesc->Buffer.Length);
+ }
}
break;
diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c
index 842c7d6..f3a5118 100644
--- a/sys/contrib/dev/acpica/utdebug.c
+++ b/sys/contrib/dev/acpica/utdebug.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
- * $Revision: 108 $
+ * $Revision: 109 $
*
*****************************************************************************/
@@ -648,8 +648,7 @@ AcpiUtDumpBuffer (
case DB_WORD_DISPLAY:
- ACPI_MOVE_UNALIGNED16_TO_32 (&Temp32,
- &Buffer[i + j]);
+ ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[i + j]);
AcpiOsPrintf ("%04X ", Temp32);
j += 2;
break;
@@ -657,8 +656,7 @@ AcpiUtDumpBuffer (
case DB_DWORD_DISPLAY:
- ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32,
- &Buffer[i + j]);
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]);
AcpiOsPrintf ("%08X ", Temp32);
j += 4;
break;
@@ -666,12 +664,10 @@ AcpiUtDumpBuffer (
case DB_QWORD_DISPLAY:
- ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32,
- &Buffer[i + j]);
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]);
AcpiOsPrintf ("%08X", Temp32);
- ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32,
- &Buffer[i + j + 4]);
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j + 4]);
AcpiOsPrintf ("%08X ", Temp32);
j += 8;
break;
diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c
index 890973e..56f546b 100644
--- a/sys/contrib/dev/acpica/utdelete.c
+++ b/sys/contrib/dev/acpica/utdelete.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
- * $Revision: 95 $
+ * $Revision: 97 $
*
******************************************************************************/
@@ -119,6 +119,7 @@
#include "acpi.h"
#include "acinterp.h"
#include "acnamesp.h"
+#include "acevents.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utdelete")
@@ -144,6 +145,7 @@ AcpiUtDeleteInternalObj (
void *ObjPointer = NULL;
ACPI_OPERAND_OBJECT *HandlerDesc;
ACPI_OPERAND_OBJECT *SecondDesc;
+ ACPI_OPERAND_OBJECT *NextDesc;
ACPI_FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object);
@@ -208,6 +210,25 @@ AcpiUtDeleteInternalObj (
break;
+ case ACPI_TYPE_DEVICE:
+
+ if (Object->Device.GpeBlock)
+ {
+ (void) AcpiEvDeleteGpeBlock (Object->Device.GpeBlock);
+ }
+
+ /* Walk the handler list for this device */
+
+ HandlerDesc = Object->Device.AddressSpace;
+ while (HandlerDesc)
+ {
+ NextDesc = HandlerDesc->AddressSpace.Next;
+ AcpiUtRemoveReference (HandlerDesc);
+ HandlerDesc = NextDesc;
+ }
+ break;
+
+
case ACPI_TYPE_MUTEX:
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n",
@@ -254,11 +275,15 @@ AcpiUtDeleteInternalObj (
* default handlers -- and therefore, we created the context object
* locally, it was not created by an external caller.
*/
- HandlerDesc = Object->Region.AddrHandler;
- if ((HandlerDesc) &&
- (HandlerDesc->AddrHandler.Hflags == ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
+ HandlerDesc = Object->Region.AddressSpace;
+ if (HandlerDesc)
{
- ObjPointer = SecondDesc->Extra.RegionContext;
+ if (HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
+ {
+ ObjPointer = SecondDesc->Extra.RegionContext;
+ }
+
+ AcpiUtRemoveReference (HandlerDesc);
}
/* Now we can free the Extra object */
@@ -284,7 +309,6 @@ AcpiUtDeleteInternalObj (
break;
}
-
/* Free any allocated memory (pointer within the object) found above */
if (ObjPointer)
@@ -375,7 +399,7 @@ AcpiUtUpdateRefCount (
NewCount = Count;
/*
- * Reference count action (increment, decrement, or force delete)
+ * Perform the reference count action (increment, decrement, or force delete)
*/
switch (Action)
{
@@ -484,8 +508,6 @@ AcpiUtUpdateObjectReference (
{
ACPI_STATUS Status;
UINT32 i;
- ACPI_OPERAND_OBJECT *Next;
- ACPI_OPERAND_OBJECT *New;
ACPI_GENERIC_STATE *StateList = NULL;
ACPI_GENERIC_STATE *State;
@@ -500,9 +522,8 @@ AcpiUtUpdateObjectReference (
return_ACPI_STATUS (AE_OK);
}
- /*
- * Make sure that this isn't a namespace handle
- */
+ /* Make sure that this isn't a namespace handle */
+
if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", Object));
@@ -525,30 +546,8 @@ AcpiUtUpdateObjectReference (
{
case ACPI_TYPE_DEVICE:
- Status = AcpiUtCreateUpdateStateAndPush (Object->Device.AddrHandler,
- Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
-
- AcpiUtUpdateRefCount (Object->Device.SysHandler, Action);
- AcpiUtUpdateRefCount (Object->Device.DrvHandler, Action);
- break;
-
-
- case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
-
- /* Must walk list of address handlers */
-
- Next = Object->AddrHandler.Next;
- while (Next)
- {
- New = Next->AddrHandler.Next;
- AcpiUtUpdateRefCount (Next, Action);
-
- Next = New;
- }
+ AcpiUtUpdateRefCount (Object->Device.SystemNotify, Action);
+ AcpiUtUpdateRefCount (Object->Device.DeviceNotify, Action);
break;
@@ -686,17 +685,15 @@ AcpiUtAddReference (
ACPI_FUNCTION_TRACE_PTR ("UtAddReference", Object);
- /*
- * Ensure that we have a valid object
- */
+ /* Ensure that we have a valid object */
+
if (!AcpiUtValidInternalObject (Object))
{
return_VOID;
}
- /*
- * We have a valid ACPI internal object, now increment the reference count
- */
+ /* Increment the reference count */
+
(void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
return_VOID;
}
@@ -721,6 +718,7 @@ AcpiUtRemoveReference (
ACPI_FUNCTION_TRACE_PTR ("UtRemoveReference", Object);
+
/*
* Allow a NULL pointer to be passed in, just ignore it. This saves
* each caller from having to check. Also, ignore NS nodes.
@@ -733,9 +731,8 @@ AcpiUtRemoveReference (
return_VOID;
}
- /*
- * Ensure that we have a valid object
- */
+ /* Ensure that we have a valid object */
+
if (!AcpiUtValidInternalObject (Object))
{
return_VOID;
diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c
index 6d69728..49ef9e0 100644
--- a/sys/contrib/dev/acpica/uteval.c
+++ b/sys/contrib/dev/acpica/uteval.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: uteval - Object evaluation
- * $Revision: 45 $
+ * $Revision: 48 $
*
*****************************************************************************/
@@ -292,6 +292,47 @@ AcpiUtEvaluateNumericObject (
/*******************************************************************************
*
+ * FUNCTION: AcpiUtCopyIdString
+ *
+ * PARAMETERS: Destination - Where to copy the string
+ * Source - Source string
+ * MaxLength - Length of the destination buffer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
+ * Performs removal of a leading asterisk if present -- workaround
+ * for a known issue on a bunch of machines.
+ *
+ ******************************************************************************/
+
+static void
+AcpiUtCopyIdString (
+ char *Destination,
+ char *Source,
+ ACPI_SIZE MaxLength)
+{
+
+
+ /*
+ * Workaround for ID strings that have a leading asterisk. This construct
+ * is not allowed by the ACPI specification (ID strings must be
+ * alphanumeric), but enough existing machines have this embedded in their
+ * ID strings that the following code is useful.
+ */
+ if (*Source == '*')
+ {
+ Source++;
+ }
+
+ /* Do the actual copy */
+
+ ACPI_STRNCPY (Destination, Source, MaxLength);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtExecute_HID
*
* PARAMETERS: DeviceNode - Node for the device
@@ -329,13 +370,14 @@ AcpiUtExecute_HID (
{
/* Convert the Numeric HID to string */
- AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer);
+ AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Value);
}
else
{
/* Copy the String HID from the returned object */
- ACPI_STRNCPY (Hid->Buffer, ObjDesc->String.Pointer, sizeof(Hid->Buffer));
+ AcpiUtCopyIdString (Hid->Value, ObjDesc->String.Pointer,
+ sizeof (Hid->Value));
}
/* On exit, we must delete the return object */
@@ -347,6 +389,59 @@ AcpiUtExecute_HID (
/*******************************************************************************
*
+ * FUNCTION: AcpiUtTranslateOneCid
+ *
+ * PARAMETERS: ObjDesc - _CID object, must be integer or string
+ * OneCid - Where the CID string is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Return a numeric or string _CID value as a string.
+ * (Compatible ID)
+ *
+ * NOTE: Assumes a maximum _CID string length of
+ * ACPI_MAX_CID_LENGTH.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtTranslateOneCid (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_COMPATIBLE_ID *OneCid)
+{
+
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ /* Convert the Numeric CID to string */
+
+ AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, OneCid->Value);
+ return (AE_OK);
+
+ case ACPI_TYPE_STRING:
+
+ if (ObjDesc->String.Length > ACPI_MAX_CID_LENGTH)
+ {
+ return (AE_AML_STRING_LIMIT);
+ }
+
+ /* Copy the String CID from the returned object */
+
+ AcpiUtCopyIdString (OneCid->Value, ObjDesc->String.Pointer,
+ ACPI_MAX_CID_LENGTH);
+ return (AE_OK);
+
+ default:
+
+ return (AE_TYPE);
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtExecute_CID
*
* PARAMETERS: DeviceNode - Node for the device
@@ -364,57 +459,95 @@ AcpiUtExecute_HID (
ACPI_STATUS
AcpiUtExecute_CID (
ACPI_NAMESPACE_NODE *DeviceNode,
- ACPI_DEVICE_ID *Cid)
+ ACPI_COMPATIBLE_ID_LIST **ReturnCidList)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
+ UINT32 Count;
+ UINT32 Size;
+ ACPI_COMPATIBLE_ID_LIST *CidList;
+ ACPI_NATIVE_UINT i;
ACPI_FUNCTION_TRACE ("UtExecute_CID");
+ /* Evaluate the _CID method for this device */
+
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID,
- ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, &ObjDesc);
+ ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE,
+ &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- /*
- * A _CID can return either a single compatible ID or a package of compatible
- * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or
- * string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
- */
- switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ /* Get the number of _CIDs returned */
+
+ Count = 1;
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
{
- case ACPI_TYPE_INTEGER:
+ Count = ObjDesc->Package.Count;
+ }
- /* Convert the Numeric CID to string */
+ /* Allocate a worst-case buffer for the _CIDs */
- AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Cid->Buffer);
- break;
+ Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) +
+ sizeof (ACPI_COMPATIBLE_ID_LIST));
- case ACPI_TYPE_STRING:
+ CidList = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Size);
+ if (!CidList)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
- /* Copy the String CID from the returned object */
+ /* Init CID list */
- ACPI_STRNCPY (Cid->Buffer, ObjDesc->String.Pointer, sizeof (Cid->Buffer));
- break;
+ CidList->Count = Count;
+ CidList->Size = Size;
- case ACPI_TYPE_PACKAGE:
+ /*
+ * A _CID can return either a single compatible ID or a package of compatible
+ * IDs. Each compatible ID can be one of the following:
+ * -- Number (32 bit compressed EISA ID) or
+ * -- String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
+ */
- /* TBD: Parse package elements; need different return struct, etc. */
+ /* The _CID object can be either a single CID or a package (list) of CIDs */
- Status = AE_SUPPORT;
- break;
+ if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
+ {
+ /* Translate each package element */
- default:
+ for (i = 0; i < Count; i++)
+ {
+ Status = AcpiUtTranslateOneCid (ObjDesc->Package.Elements[i],
+ &CidList->Id[i]);
+ if (ACPI_FAILURE (Status))
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* Only one CID, translate to a string */
- Status = AE_TYPE;
- break;
+ Status = AcpiUtTranslateOneCid (ObjDesc, CidList->Id);
}
- /* On exit, we must delete the return object */
+ /* Cleanup on error */
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_MEM_FREE (CidList);
+ }
+ else
+ {
+ *ReturnCidList = CidList;
+ }
+
+ /* On exit, we must delete the _CID return object */
AcpiUtRemoveReference (ObjDesc);
return_ACPI_STATUS (Status);
@@ -460,13 +593,14 @@ AcpiUtExecute_UID (
{
/* Convert the Numeric UID to string */
- AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer);
+ AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Value);
}
else
{
/* Copy the String UID from the returned object */
- ACPI_STRNCPY (Uid->Buffer, ObjDesc->String.Pointer, sizeof (Uid->Buffer));
+ AcpiUtCopyIdString (Uid->Value, ObjDesc->String.Pointer,
+ sizeof (Uid->Value));
}
/* On exit, we must delete the return object */
diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c
index 2611ea2..9a16eea 100644
--- a/sys/contrib/dev/acpica/utglobal.c
+++ b/sys/contrib/dev/acpica/utglobal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 180 $
+ * $Revision: 185 $
*
*****************************************************************************/
@@ -380,10 +380,10 @@ AcpiUtHexToAsciiChar (
******************************************************************************/
-ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES];
+ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
-ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] =
+ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES] =
{
/*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
@@ -616,12 +616,10 @@ AcpiUtGetObjectTypeName (
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-
/*
* Strings and procedures used for debug only
*/
-
/*****************************************************************************
*
* FUNCTION: AcpiUtGetMutexName
@@ -639,7 +637,7 @@ AcpiUtGetMutexName (
UINT32 MutexId)
{
- if (MutexId > MAX_MTX)
+ if (MutexId > MAX_MUTEX)
{
return ("Invalid Mutex ID");
}
@@ -647,7 +645,6 @@ AcpiUtGetMutexName (
return (AcpiGbl_MutexNames[MutexId]);
}
-
#endif
@@ -711,9 +708,12 @@ AcpiUtAllocateOwnerId (
OwnerId = AcpiGbl_NextTableOwnerId;
AcpiGbl_NextTableOwnerId++;
+ /* Check for wraparound */
+
if (AcpiGbl_NextTableOwnerId == ACPI_FIRST_METHOD_ID)
{
AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
+ ACPI_REPORT_WARNING (("Table owner ID wraparound\n"));
}
break;
@@ -725,6 +725,8 @@ AcpiUtAllocateOwnerId (
if (AcpiGbl_NextMethodOwnerId == ACPI_FIRST_TABLE_ID)
{
+ /* Check for wraparound */
+
AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
}
break;
@@ -791,33 +793,31 @@ AcpiUtInitGlobals (
/* ACPI table structure */
- for (i = 0; i < NUM_ACPI_TABLES; i++)
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
{
- AcpiGbl_AcpiTables[i].Prev = &AcpiGbl_AcpiTables[i];
- AcpiGbl_AcpiTables[i].Next = &AcpiGbl_AcpiTables[i];
- AcpiGbl_AcpiTables[i].Pointer = NULL;
- AcpiGbl_AcpiTables[i].Length = 0;
- AcpiGbl_AcpiTables[i].Allocation = ACPI_MEM_NOT_ALLOCATED;
- AcpiGbl_AcpiTables[i].Count = 0;
+ AcpiGbl_TableLists[i].Next = NULL;
+ AcpiGbl_TableLists[i].Count = 0;
}
/* Mutex locked flags */
- for (i = 0; i < NUM_MTX; i++)
+ for (i = 0; i < NUM_MUTEX; i++)
{
- AcpiGbl_AcpiMutexInfo[i].Mutex = NULL;
- AcpiGbl_AcpiMutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
- AcpiGbl_AcpiMutexInfo[i].UseCount = 0;
+ AcpiGbl_MutexInfo[i].Mutex = NULL;
+ AcpiGbl_MutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[i].UseCount = 0;
}
/* GPE support */
- AcpiGbl_GpeBlockListHead = NULL;
+ AcpiGbl_GpeXruptListHead = NULL;
+ AcpiGbl_GpeFadtBlocks[0] = NULL;
+ AcpiGbl_GpeFadtBlocks[1] = NULL;
/* Global notify handlers */
- AcpiGbl_SysNotify.Handler = NULL;
- AcpiGbl_DrvNotify.Handler = NULL;
+ AcpiGbl_SystemNotify.Handler = NULL;
+ AcpiGbl_DeviceNotify.Handler = NULL;
AcpiGbl_InitHandler = NULL;
/* Global "typed" ACPI table pointers */
diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c
index 10e52eb..dca1f78 100644
--- a/sys/contrib/dev/acpica/utinit.c
+++ b/sys/contrib/dev/acpica/utinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utinit - Common ACPI subsystem initialization
- * $Revision: 116 $
+ * $Revision: 117 $
*
*****************************************************************************/
@@ -250,20 +250,44 @@ AcpiUtValidateFadt (
*
* RETURN: none
*
- * DESCRIPTION: free memory allocated for table storage.
+ * DESCRIPTION: free global memory
*
******************************************************************************/
void
AcpiUtTerminate (void)
{
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_BLOCK_INFO *NextGpeBlock;
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
+ ACPI_GPE_XRUPT_INFO *NextGpeXruptInfo;
+
ACPI_FUNCTION_TRACE ("UtTerminate");
/* Free global tables, etc. */
- /* Nothing to do at this time */
+
+ /* Free global GPE blocks and related info structures */
+
+ GpeXruptInfo = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptInfo)
+ {
+ GpeBlock = GpeXruptInfo->GpeBlockListHead;
+ while (GpeBlock)
+ {
+ NextGpeBlock = GpeBlock->Next;
+ ACPI_MEM_FREE (GpeBlock->EventInfo);
+ ACPI_MEM_FREE (GpeBlock->RegisterInfo);
+ ACPI_MEM_FREE (GpeBlock);
+
+ GpeBlock = NextGpeBlock;
+ }
+ NextGpeXruptInfo = GpeXruptInfo->Next;
+ ACPI_MEM_FREE (GpeXruptInfo);
+ GpeXruptInfo = NextGpeXruptInfo;
+ }
return_VOID;
}
diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c
index 91b2382..7d927bc 100644
--- a/sys/contrib/dev/acpica/utmisc.c
+++ b/sys/contrib/dev/acpica/utmisc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
- * $Revision: 93 $
+ * $Revision: 97 $
*
******************************************************************************/
@@ -284,13 +284,15 @@ AcpiUtSetIntegerWidth (
if (Revision <= 1)
{
- AcpiGbl_IntegerBitWidth = 32;
- AcpiGbl_IntegerByteWidth = 4;
+ AcpiGbl_IntegerBitWidth = 32;
+ AcpiGbl_IntegerNybbleWidth = 8;
+ AcpiGbl_IntegerByteWidth = 4;
}
else
{
- AcpiGbl_IntegerBitWidth = 64;
- AcpiGbl_IntegerByteWidth = 8;
+ AcpiGbl_IntegerBitWidth = 64;
+ AcpiGbl_IntegerNybbleWidth = 16;
+ AcpiGbl_IntegerByteWidth = 8;
}
}
@@ -656,7 +658,7 @@ AcpiUtMutexInitialize (
/*
* Create each of the predefined mutex objects
*/
- for (i = 0; i < NUM_MTX; i++)
+ for (i = 0; i < NUM_MUTEX; i++)
{
Status = AcpiUtCreateMutex (i);
if (ACPI_FAILURE (Status))
@@ -665,6 +667,9 @@ AcpiUtMutexInitialize (
}
}
+
+ Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
+
return_ACPI_STATUS (AE_OK);
}
@@ -694,11 +699,12 @@ AcpiUtMutexTerminate (
/*
* Delete each predefined mutex object
*/
- for (i = 0; i < NUM_MTX; i++)
+ for (i = 0; i < NUM_MUTEX; i++)
{
(void) AcpiUtDeleteMutex (i);
}
+ AcpiOsDeleteLock (AcpiGbl_GpeLock);
return_VOID;
}
@@ -725,17 +731,17 @@ AcpiUtCreateMutex (
ACPI_FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId);
- if (MutexId > MAX_MTX)
+ if (MutexId > MAX_MUTEX)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- if (!AcpiGbl_AcpiMutexInfo[MutexId].Mutex)
+ if (!AcpiGbl_MutexInfo[MutexId].Mutex)
{
Status = AcpiOsCreateSemaphore (1, 1,
- &AcpiGbl_AcpiMutexInfo[MutexId].Mutex);
- AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
- AcpiGbl_AcpiMutexInfo[MutexId].UseCount = 0;
+ &AcpiGbl_MutexInfo[MutexId].Mutex);
+ AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[MutexId].UseCount = 0;
}
return_ACPI_STATUS (Status);
@@ -764,15 +770,15 @@ AcpiUtDeleteMutex (
ACPI_FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId);
- if (MutexId > MAX_MTX)
+ if (MutexId > MAX_MUTEX)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- Status = AcpiOsDeleteSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex);
+ Status = AcpiOsDeleteSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex);
- AcpiGbl_AcpiMutexInfo[MutexId].Mutex = NULL;
- AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[MutexId].Mutex = NULL;
+ AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
return_ACPI_STATUS (Status);
}
@@ -802,7 +808,7 @@ AcpiUtAcquireMutex (
ACPI_FUNCTION_NAME ("UtAcquireMutex");
- if (MutexId > MAX_MTX)
+ if (MutexId > MAX_MUTEX)
{
return (AE_BAD_PARAMETER);
}
@@ -815,9 +821,9 @@ AcpiUtAcquireMutex (
* the mutex ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
- for (i = MutexId; i < MAX_MTX; i++)
+ for (i = MutexId; i < MAX_MUTEX; i++)
{
- if (AcpiGbl_AcpiMutexInfo[i].OwnerId == ThisThreadId)
+ if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
{
if (i == MutexId)
{
@@ -841,15 +847,15 @@ AcpiUtAcquireMutex (
"Thread %X attempting to acquire Mutex [%s]\n",
ThisThreadId, AcpiUtGetMutexName (MutexId)));
- Status = AcpiOsWaitSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex,
+ Status = AcpiOsWaitSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex,
1, ACPI_WAIT_FOREVER);
if (ACPI_SUCCESS (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
ThisThreadId, AcpiUtGetMutexName (MutexId)));
- AcpiGbl_AcpiMutexInfo[MutexId].UseCount++;
- AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ThisThreadId;
+ AcpiGbl_MutexInfo[MutexId].UseCount++;
+ AcpiGbl_MutexInfo[MutexId].OwnerId = ThisThreadId;
}
else
{
@@ -891,7 +897,7 @@ AcpiUtReleaseMutex (
"Thread %X releasing Mutex [%s]\n", ThisThreadId,
AcpiUtGetMutexName (MutexId)));
- if (MutexId > MAX_MTX)
+ if (MutexId > MAX_MUTEX)
{
return (AE_BAD_PARAMETER);
}
@@ -899,7 +905,7 @@ AcpiUtReleaseMutex (
/*
* Mutex must be acquired in order to release it!
*/
- if (AcpiGbl_AcpiMutexInfo[MutexId].OwnerId == ACPI_MUTEX_NOT_ACQUIRED)
+ if (AcpiGbl_MutexInfo[MutexId].OwnerId == ACPI_MUTEX_NOT_ACQUIRED)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Mutex [%s] is not acquired, cannot release\n",
@@ -914,9 +920,9 @@ AcpiUtReleaseMutex (
* ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
- for (i = MutexId; i < MAX_MTX; i++)
+ for (i = MutexId; i < MAX_MUTEX; i++)
{
- if (AcpiGbl_AcpiMutexInfo[i].OwnerId == ThisThreadId)
+ if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
{
if (i == MutexId)
{
@@ -933,9 +939,9 @@ AcpiUtReleaseMutex (
/* Mark unlocked FIRST */
- AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
- Status = AcpiOsSignalSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex, 1);
+ Status = AcpiOsSignalSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex, 1);
if (ACPI_FAILURE (Status))
{
diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c
index babdcf6..cd8d04c 100644
--- a/sys/contrib/dev/acpica/utobject.c
+++ b/sys/contrib/dev/acpica/utobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
- * $Revision: 82 $
+ * $Revision: 83 $
*
*****************************************************************************/
@@ -226,7 +226,7 @@ AcpiUtCreateBufferObject (
ACPI_SIZE BufferSize)
{
ACPI_OPERAND_OBJECT *BufferDesc;
- UINT8 *Buffer;
+ UINT8 *Buffer = NULL;
ACPI_FUNCTION_TRACE_U32 ("UtCreateBufferObject", BufferSize);
@@ -241,15 +241,20 @@ AcpiUtCreateBufferObject (
return_PTR (NULL);
}
- /* Allocate the actual buffer */
+ /* Create an actual buffer only if size > 0 */
- Buffer = ACPI_MEM_CALLOCATE (BufferSize);
- if (!Buffer)
+ if (BufferSize > 0)
{
- ACPI_REPORT_ERROR (("CreateBuffer: could not allocate size %X\n",
- (UINT32) BufferSize));
- AcpiUtRemoveReference (BufferDesc);
- return_PTR (NULL);
+ /* Allocate the actual buffer */
+
+ Buffer = ACPI_MEM_CALLOCATE (BufferSize);
+ if (!Buffer)
+ {
+ ACPI_REPORT_ERROR (("CreateBuffer: could not allocate size %X\n",
+ (UINT32) BufferSize));
+ AcpiUtRemoveReference (BufferDesc);
+ return_PTR (NULL);
+ }
}
/* Complete buffer object initialization */
diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utxface.c
index 6a99631..e0d8500 100644
--- a/sys/contrib/dev/acpica/utxface.c
+++ b/sys/contrib/dev/acpica/utxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
- * $Revision: 101 $
+ * $Revision: 104 $
*
*****************************************************************************/
@@ -223,24 +223,8 @@ AcpiEnableSubsystem (
/*
- * Install the default OpRegion handlers. These are installed unless
- * other handlers have already been installed via the
- * InstallAddressSpaceHandler interface
- */
- if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
-
- Status = AcpiEvInitAddressSpaces ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /*
* We must initialize the hardware before we can enable ACPI.
- * FADT values are validated here.
+ * The values from the FADT are validated here.
*/
if (!(Flags & ACPI_NO_HARDWARE_INIT))
{
@@ -254,7 +238,7 @@ AcpiEnableSubsystem (
}
/*
- * Enable ACPI on this platform
+ * Enable ACPI mode
*/
if (!(Flags & ACPI_NO_ACPI_ENABLE))
{
@@ -271,8 +255,9 @@ AcpiEnableSubsystem (
}
/*
- * Note:
- * We must have the hardware AND events initialized before we can execute
+ * Initialize ACPI Event handling
+ *
+ * NOTE: We must have the hardware AND events initialized before we can execute
* ANY control methods SAFELY. Any control method can require ACPI hardware
* support, so the hardware MUST be initialized before execution!
*/
@@ -287,7 +272,7 @@ AcpiEnableSubsystem (
}
}
- /* Install SCI handler, Global Lock handler, GPE handlers */
+ /* Install the SCI handler, Global Lock handler, and GPE handlers */
if (!(Flags & ACPI_NO_HANDLER_INIT))
{
@@ -325,15 +310,21 @@ AcpiInitializeObjects (
ACPI_FUNCTION_TRACE ("AcpiInitializeObjects");
+
/*
- * Initialize all device objects in the namespace
- * This runs the _STA and _INI methods.
+ * Install the default OpRegion handlers. These are installed unless
+ * other handlers have already been installed via the
+ * InstallAddressSpaceHandler interface.
+ *
+ * NOTE: This will cause _REG methods to be run. Any objects accessed
+ * by the _REG methods will be automatically initialized, even if they
+ * contain executable AML (see call to AcpiNsInitializeObjects below).
*/
- if (!(Flags & ACPI_NO_DEVICE_INIT))
+ if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
- Status = AcpiNsInitializeDevices ();
+ Status = AcpiEvInitAddressSpaces ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -342,8 +333,8 @@ AcpiInitializeObjects (
/*
* Initialize the objects that remain uninitialized. This
- * runs the executable AML that is part of the declaration of OpRegions
- * and Fields.
+ * runs the executable AML that may be part of the declaration of these
+ * objects: OperationRegions, BufferFields, Buffers, and Packages.
*/
if (!(Flags & ACPI_NO_OBJECT_INIT))
{
@@ -357,6 +348,21 @@ AcpiInitializeObjects (
}
/*
+ * Initialize all device objects in the namespace
+ * This runs the _STA and _INI methods.
+ */
+ if (!(Flags & ACPI_NO_DEVICE_INIT))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n"));
+
+ Status = AcpiNsInitializeDevices ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /*
* Empty the caches (delete the cached objects) on the assumption that
* the table load filled them up more than they will be at runtime --
* thus wasting non-paged memory.
@@ -530,10 +536,10 @@ AcpiGetSystemInfo (
/* Current status of the ACPI tables, per table type */
- InfoPtr->NumTableTypes = NUM_ACPI_TABLES;
- for (i = 0; i < NUM_ACPI_TABLES; i++)
+ InfoPtr->NumTableTypes = NUM_ACPI_TABLE_TYPES;
+ for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
{
- InfoPtr->TableInfo[i].Count = AcpiGbl_AcpiTables[i].Count;
+ InfoPtr->TableInfo[i].Count = AcpiGbl_TableLists[i].Count;
}
return_ACPI_STATUS (AE_OK);
OpenPOWER on IntegriCloud