summaryrefslogtreecommitdiffstats
path: root/source/tools/acpiexec/aeexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/tools/acpiexec/aeexec.c')
-rw-r--r--source/tools/acpiexec/aeexec.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/source/tools/acpiexec/aeexec.c b/source/tools/acpiexec/aeexec.c
index 8f6d6da..e76e7b9 100644
--- a/source/tools/acpiexec/aeexec.c
+++ b/source/tools/acpiexec/aeexec.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2014, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -150,13 +150,15 @@ AfInstallGpeBlock (
{
ACPI_STATUS Status;
ACPI_HANDLE Handle;
- ACPI_HANDLE Handle2 = NULL;
- ACPI_HANDLE Handle3 = NULL;
ACPI_GENERIC_ADDRESS BlockAddress;
ACPI_HANDLE GpeDevice;
+ ACPI_OBJECT_TYPE Type;
+ /* _GPE should always exist */
+
Status = AcpiGetHandle (NULL, "\\_GPE", &Handle);
+ AE_CHECK_OK (AcpiGetHandle, Status);
if (ACPI_FAILURE (Status))
{
return;
@@ -166,17 +168,26 @@ AfInstallGpeBlock (
BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
BlockAddress.Address = 0x76540000;
- Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2);
+ /* Attempt to install a GPE block on GPE2 (if present) */
+
+ Status = AcpiGetHandle (NULL, "\\GPE2", &Handle);
if (ACPI_SUCCESS (Status))
{
- Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8);
+ Status = AcpiGetType (Handle, &Type);
+ if (ACPI_FAILURE (Status) ||
+ (Type != ACPI_TYPE_DEVICE))
+ {
+ return;
+ }
+
+ Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 7, 8);
AE_CHECK_OK (AcpiInstallGpeBlock, Status);
- Status = AcpiInstallGpeHandler (Handle2, 8,
+ Status = AcpiInstallGpeHandler (Handle, 8,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
- Status = AcpiEnableGpe (Handle2, 8);
+ Status = AcpiEnableGpe (Handle, 8);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiGetGpeDevice (0x30, &GpeDevice);
@@ -191,14 +202,23 @@ AfInstallGpeBlock (
Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST);
- Status = AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
+ Status = AcpiRemoveGpeHandler (Handle, 8, AeGpeHandler);
AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
}
- Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
+ /* Attempt to install a GPE block on GPE3 (if present) */
+
+ Status = AcpiGetHandle (NULL, "\\GPE3", &Handle);
if (ACPI_SUCCESS (Status))
{
- Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
+ Status = AcpiGetType (Handle, &Type);
+ if (ACPI_FAILURE (Status) ||
+ (Type != ACPI_TYPE_DEVICE))
+ {
+ return;
+ }
+
+ Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 8, 11);
AE_CHECK_OK (AcpiInstallGpeBlock, Status);
}
}
OpenPOWER on IntegriCloud