aboutsummaryrefslogtreecommitdiffstats
path: root/source/tools
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2012-04-20 23:39:48 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2012-04-20 23:39:48 +0000
commitb43c4dd5abdb09fe2e7f73f186586b962c9dc9f5 (patch)
tree79677aa8d9d6e5b97246264fe36dcad25ae471a1 /source/tools
parent9fd6e3caab6c4754f50b66bcc8bdbf7ef8397f74 (diff)
downloadsrc-b43c4dd5abdb09fe2e7f73f186586b962c9dc9f5.tar.gz
src-b43c4dd5abdb09fe2e7f73f186586b962c9dc9f5.zip
Import ACPICA 20120420.vendor/acpica/20120420
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=234518 svn path=/vendor-sys/acpica/20120420/; revision=234519; tag=vendor/acpica/20120420
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/acpiexec/aehandlers.c163
-rw-r--r--source/tools/acpisrc/astable.c1
2 files changed, 142 insertions, 22 deletions
diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c
index f41dd53d31ed..84ed57e1b340 100644
--- a/source/tools/acpiexec/aehandlers.c
+++ b/source/tools/acpiexec/aehandlers.c
@@ -49,12 +49,24 @@
/* Local prototypes */
static void
-AeNotifyHandler (
+AeNotifyHandler1 (
ACPI_HANDLE Device,
UINT32 Value,
void *Context);
static void
+AeNotifyHandler2 (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context);
+
+static void
+AeCommonNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ UINT32 HandlerId);
+
+static void
AeDeviceNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
@@ -186,24 +198,51 @@ AeCtrlCHandler (
/******************************************************************************
*
- * FUNCTION: AeNotifyHandler
+ * FUNCTION: AeNotifyHandler(s)
*
* PARAMETERS: Standard notify handler parameters
*
* RETURN: Status
*
- * DESCRIPTION: System notify handler for AcpiExec utility. Used by the ASL
+ * DESCRIPTION: Notify handlers for AcpiExec utility. Used by the ASL
* test suite(s) to communicate errors and other information to
- * this utility via the Notify() operator.
+ * this utility via the Notify() operator. Tests notify handling
+ * and multiple notify handler support.
*
*****************************************************************************/
static void
-AeNotifyHandler (
- ACPI_HANDLE Device,
- UINT32 Value,
- void *Context)
+AeNotifyHandler1 (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context)
+{
+ AeCommonNotifyHandler (Device, Value, 1);
+}
+
+static void
+AeNotifyHandler2 (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context)
{
+ AeCommonNotifyHandler (Device, Value, 2);
+}
+
+static void
+AeCommonNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ UINT32 HandlerId)
+{
+ char *Type;
+
+
+ Type = "Device";
+ if (Value <= ACPI_MAX_SYS_NOTIFY)
+ {
+ Type = "System";
+ }
switch (Value)
{
@@ -237,12 +276,13 @@ AeNotifyHandler (
#endif
default:
- printf ("[AcpiExec] Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
- AcpiUtGetNodeName (Device), Device, Value,
+ printf ("[AcpiExec] Handler %u: Received a %s Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
+ HandlerId, Type, AcpiUtGetNodeName (Device), Device, Value,
AcpiUtGetNotifyName (Value));
if (AcpiGbl_DebugFile)
{
- AcpiOsPrintf ("[AcpiExec] Received a system notify, Value 0x%2.2X\n", Value);
+ AcpiOsPrintf ("[AcpiExec] Handler %u: Received a %s notify, Value 0x%2.2X\n",
+ HandlerId, Type, Value);
}
(void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
@@ -253,6 +293,39 @@ AeNotifyHandler (
/******************************************************************************
*
+ * FUNCTION: AeSystemNotifyHandler
+ *
+ * PARAMETERS: Standard notify handler parameters
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: System notify handler for AcpiExec utility. Used by the ASL
+ * test suite(s) to communicate errors and other information to
+ * this utility via the Notify() operator.
+ *
+ *****************************************************************************/
+
+static void
+AeSystemNotifyHandler (
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context)
+{
+
+ printf ("[AcpiExec] Global: Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
+ AcpiUtGetNodeName (Device), Device, Value,
+ AcpiUtGetNotifyName (Value));
+ if (AcpiGbl_DebugFile)
+ {
+ AcpiOsPrintf ("[AcpiExec] Global: Received a System Notify, Value 0x%2.2X\n", Value);
+ }
+
+ (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AeDeviceNotifyHandler
*
* PARAMETERS: Standard notify handler parameters
@@ -272,12 +345,12 @@ AeDeviceNotifyHandler (
void *Context)
{
- printf ("[AcpiExec] Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
+ printf ("[AcpiExec] Global: Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
AcpiUtGetNodeName (Device), Device, Value,
AcpiUtGetNotifyName (Value));
if (AcpiGbl_DebugFile)
{
- AcpiOsPrintf ("[AcpiExec] Received a device notify, Value 0x%2.2X\n", Value);
+ AcpiOsPrintf ("[AcpiExec] Global: Received a Device Notify, Value 0x%2.2X\n", Value);
}
(void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
@@ -687,18 +760,18 @@ AeInstallEarlyHandlers (
AcpiFormatException (Status));
}
- /* Install global notify handler */
+ /* Install global notify handlers */
Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
- AeNotifyHandler, NULL);
+ AeSystemNotifyHandler, NULL);
if (ACPI_FAILURE (Status))
{
- printf ("Could not install a global notify handler, %s\n",
+ printf ("Could not install a global system notify handler, %s\n",
AcpiFormatException (Status));
}
Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_DEVICE_NOTIFY,
- AeDeviceNotifyHandler, NULL);
+ AeDeviceNotifyHandler, NULL);
if (ACPI_FAILURE (Status))
{
printf ("Could not install a global notify handler, %s\n",
@@ -709,7 +782,7 @@ AeInstallEarlyHandlers (
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
- AeNotifyHandler, NULL);
+ AeNotifyHandler1, NULL);
if (ACPI_FAILURE (Status))
{
printf ("Could not install a notify handler, %s\n",
@@ -717,7 +790,7 @@ AeInstallEarlyHandlers (
}
Status = AcpiRemoveNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
- AeNotifyHandler);
+ AeNotifyHandler1);
if (ACPI_FAILURE (Status))
{
printf ("Could not remove a notify handler, %s\n",
@@ -725,20 +798,35 @@ AeInstallEarlyHandlers (
}
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
- AeNotifyHandler, NULL);
+ AeNotifyHandler1, NULL);
AE_CHECK_OK (AcpiInstallNotifyHandler, Status);
Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
- AeNotifyHandler);
+ AeNotifyHandler1);
AE_CHECK_OK (AcpiRemoveNotifyHandler, Status);
+#if 0
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
- AeNotifyHandler, NULL);
+ AeNotifyHandler1, NULL);
if (ACPI_FAILURE (Status))
{
printf ("Could not install a notify handler, %s\n",
AcpiFormatException (Status));
}
+#endif
+
+ /* Install two handlers for _SB_ */
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
+ AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
+
+ /* Attempt duplicate handler installation, should fail */
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x77777777));
Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
AE_CHECK_OK (AcpiAttachData, Status);
@@ -755,6 +843,37 @@ AeInstallEarlyHandlers (
}
+ Status = AcpiGetHandle (NULL, "\\_TZ.TZ1", &Handle);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
+
+ Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler1);
+ Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler2);
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
+ }
+
+ Status = AcpiGetHandle (NULL, "\\_PR.CPU0", &Handle);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
+ AeNotifyHandler1, ACPI_CAST_PTR (void, 0x01234567));
+
+ Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY,
+ AeNotifyHandler2, ACPI_CAST_PTR (void, 0x89ABCDEF));
+ }
+
/*
* Install handlers that will override the default handlers for some of
* the space IDs.
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index 52218be1864e..1f93e33dfc34 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -229,6 +229,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_GENERIC_ADDRESS", SRC_TYPE_STRUCT},
{"ACPI_GENERIC_STATE", SRC_TYPE_UNION},
{"ACPI_GET_DEVICES_INFO", SRC_TYPE_STRUCT},
+ {"ACPI_GLOBAL_NOTIFY_HANDLER", SRC_TYPE_STRUCT},
{"ACPI_GPE_BLOCK_INFO", SRC_TYPE_STRUCT},
{"ACPI_GPE_CALLBACK", SRC_TYPE_SIMPLE},
{"ACPI_GPE_DEVICE_INFO", SRC_TYPE_STRUCT},