summaryrefslogtreecommitdiff
path: root/source/tools/acpiexec/aehandlers.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/tools/acpiexec/aehandlers.c')
-rw-r--r--source/tools/acpiexec/aehandlers.c84
1 files changed, 73 insertions, 11 deletions
diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c
index 077c52c586c4..7f704efccda0 100644
--- a/source/tools/acpiexec/aehandlers.c
+++ b/source/tools/acpiexec/aehandlers.c
@@ -104,14 +104,21 @@ AeInterfaceHandler (
UINT32 Supported);
static ACPI_STATUS
-AeInstallOneEcHandler (
+AeInstallEcHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
static ACPI_STATUS
-AeInstallEcHandlers (
+AeInstallPciHandler (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AeInstallDeviceHandlers (
void);
#if (!ACPI_REDUCED_HARDWARE)
@@ -259,6 +266,7 @@ AeCommonNotifyHandler (
{
#if 0
case 0:
+
printf ("[AcpiExec] Method Error 0x%X: Results not equal\n", Value);
if (AcpiGbl_DebugFile)
{
@@ -266,8 +274,8 @@ AeCommonNotifyHandler (
}
break;
-
case 1:
+
printf ("[AcpiExec] Method Error: Incorrect numeric result\n");
if (AcpiGbl_DebugFile)
{
@@ -275,8 +283,8 @@ AeCommonNotifyHandler (
}
break;
-
case 2:
+
printf ("[AcpiExec] Method Error: An operand was overwritten\n");
if (AcpiGbl_DebugFile)
{
@@ -287,6 +295,7 @@ AeCommonNotifyHandler (
#endif
default:
+
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));
@@ -554,14 +563,17 @@ AeGlobalEventHandler (
switch (Type)
{
case ACPI_EVENT_TYPE_GPE:
+
TypeName = "GPE";
break;
case ACPI_EVENT_TYPE_FIXED:
+
TypeName = "FixedEvent";
break;
default:
+
TypeName = "UNKNOWN";
break;
}
@@ -665,7 +677,8 @@ AeRegionInit (
/*******************************************************************************
*
- * FUNCTION: AeInstallEcHandlers, AeInstallOneEcHandler
+ * FUNCTION: AeInstallDeviceHandlers, AeInstallEcHandler,
+ * AeInstallPciHandler
*
* PARAMETERS: ACPI_WALK_NAMESPACE callback
*
@@ -677,7 +690,7 @@ AeRegionInit (
******************************************************************************/
static ACPI_STATUS
-AeInstallOneEcHandler (
+AeInstallEcHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
@@ -701,13 +714,50 @@ AeInstallOneEcHandler (
}
static ACPI_STATUS
-AeInstallEcHandlers (
+AeInstallPciHandler (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_STATUS Status;
+
+
+ /* Install memory and I/O handlers for the PCI device */
+
+ Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_SYSTEM_IO,
+ AeRegionHandler, AeRegionInit, &AeMyContext);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not install an OpRegion handler for PCI device (%p)",
+ ObjHandle));
+ }
+
+ Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_SYSTEM_MEMORY,
+ AeRegionHandler, AeRegionInit, &AeMyContext);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not install an OpRegion handler for PCI device (%p)",
+ ObjHandle));
+ }
+
+ return (AE_CTRL_TERMINATE);
+}
+
+static ACPI_STATUS
+AeInstallDeviceHandlers (
void)
{
/* Find all Embedded Controller devices */
- AcpiGetDevices ("PNP0C09", AeInstallOneEcHandler, NULL, NULL);
+ AcpiGetDevices ("PNP0C09", AeInstallEcHandler, NULL, NULL);
+
+ /* Install a PCI handler */
+
+ AcpiGetDevices ("PNP0A08", AeInstallPciHandler, NULL, NULL);
return (AE_OK);
}
@@ -751,9 +801,10 @@ AeInstallLateHandlers (
/*
* We will install a handler for each EC device, directly under the EC
* device definition. This is unlike the other handlers which we install
- * at the root node.
+ * at the root node. Also install memory and I/O handlers at any PCI
+ * devices.
*/
- AeInstallEcHandlers ();
+ AeInstallDeviceHandlers ();
/*
* Install handlers for some of the "device driver" address spaces
@@ -1110,6 +1161,7 @@ AeRegionHandler (
break;
default:
+
Status = AE_BAD_PARAMETER;
break;
}
@@ -1134,25 +1186,28 @@ AeRegionHandler (
switch (Function & ACPI_IO_MASK)
{
case ACPI_READ:
+
switch (Function >> 16)
{
case AML_FIELD_ATTRIB_QUICK:
case AML_FIELD_ATTRIB_SEND_RCV:
case AML_FIELD_ATTRIB_BYTE:
+
Length = 1;
break;
case AML_FIELD_ATTRIB_WORD:
case AML_FIELD_ATTRIB_WORD_CALL:
+
Length = 2;
break;
case AML_FIELD_ATTRIB_BLOCK:
case AML_FIELD_ATTRIB_BLOCK_CALL:
+
Length = 32;
break;
-
case AML_FIELD_ATTRIB_MULTIBYTE:
case AML_FIELD_ATTRIB_RAW_BYTES:
case AML_FIELD_ATTRIB_RAW_PROCESS:
@@ -1162,11 +1217,13 @@ AeRegionHandler (
break;
default:
+
break;
}
break;
case ACPI_WRITE:
+
switch (Function >> 16)
{
case AML_FIELD_ATTRIB_QUICK:
@@ -1174,6 +1231,7 @@ AeRegionHandler (
case AML_FIELD_ATTRIB_BYTE:
case AML_FIELD_ATTRIB_WORD:
case AML_FIELD_ATTRIB_BLOCK:
+
Length = 0;
break;
@@ -1194,11 +1252,13 @@ AeRegionHandler (
break;
default:
+
break;
}
break;
default:
+
break;
}
@@ -1397,6 +1457,7 @@ DoFunction:
break;
default:
+
return (AE_BAD_PARAMETER);
}
@@ -1427,6 +1488,7 @@ DoFunction:
break;
default:
+
break;
}
}