1 /******************************************************************************
3 * Module Name: evxfgpe - External Interfaces for General Purpose Events (GPEs)
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2013, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
47 #include <contrib/dev/acpica/include/acpi.h>
48 #include <contrib/dev/acpica/include/accommon.h>
49 #include <contrib/dev/acpica/include/acevents.h>
50 #include <contrib/dev/acpica/include/acnamesp.h>
52 #define _COMPONENT ACPI_EVENTS
53 ACPI_MODULE_NAME ("evxfgpe")
56 #if (!ACPI_REDUCED_HARDWARE) /* Entire module */
57 /*******************************************************************************
59 * FUNCTION: AcpiUpdateAllGpes
65 * DESCRIPTION: Complete GPE initialization and enable all GPEs that have
66 * associated _Lxx or _Exx methods and are not pointed to by any
67 * device _PRW methods (this indicates that these GPEs are
68 * generally intended for system or device wakeup. Such GPEs
69 * have to be enabled directly when the devices whose _PRW
70 * methods point to them are set up for wakeup signaling.)
72 * NOTE: Should be called after any GPEs are added to the system. Primarily,
73 * after the system _PRW methods have been run, but also after a GPE Block
74 * Device has been added or if any new GPE methods have been added via a
77 ******************************************************************************/
86 ACPI_FUNCTION_TRACE (AcpiUpdateAllGpes);
89 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
90 if (ACPI_FAILURE (Status))
92 return_ACPI_STATUS (Status);
95 if (AcpiGbl_AllGpesInitialized)
100 Status = AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock, NULL);
101 if (ACPI_SUCCESS (Status))
103 AcpiGbl_AllGpesInitialized = TRUE;
107 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
108 return_ACPI_STATUS (Status);
111 ACPI_EXPORT_SYMBOL (AcpiUpdateAllGpes)
114 /*******************************************************************************
116 * FUNCTION: AcpiEnableGpe
118 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
119 * GpeNumber - GPE level within the GPE block
123 * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
126 ******************************************************************************/
130 ACPI_HANDLE GpeDevice,
133 ACPI_STATUS Status = AE_BAD_PARAMETER;
134 ACPI_GPE_EVENT_INFO *GpeEventInfo;
135 ACPI_CPU_FLAGS Flags;
138 ACPI_FUNCTION_TRACE (AcpiEnableGpe);
141 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
143 /* Ensure that we have a valid GPE number */
145 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
148 Status = AcpiEvAddGpeReference (GpeEventInfo);
151 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
152 return_ACPI_STATUS (Status);
155 ACPI_EXPORT_SYMBOL (AcpiEnableGpe)
158 /*******************************************************************************
160 * FUNCTION: AcpiDisableGpe
162 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
163 * GpeNumber - GPE level within the GPE block
167 * DESCRIPTION: Remove a reference to a GPE. When the last reference is
168 * removed, only then is the GPE disabled (for runtime GPEs), or
169 * the GPE mask bit disabled (for wake GPEs)
171 ******************************************************************************/
175 ACPI_HANDLE GpeDevice,
178 ACPI_STATUS Status = AE_BAD_PARAMETER;
179 ACPI_GPE_EVENT_INFO *GpeEventInfo;
180 ACPI_CPU_FLAGS Flags;
183 ACPI_FUNCTION_TRACE (AcpiDisableGpe);
186 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
188 /* Ensure that we have a valid GPE number */
190 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
193 Status = AcpiEvRemoveGpeReference (GpeEventInfo);
196 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
197 return_ACPI_STATUS (Status);
200 ACPI_EXPORT_SYMBOL (AcpiDisableGpe)
203 /*******************************************************************************
205 * FUNCTION: AcpiSetGpe
207 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
208 * GpeNumber - GPE level within the GPE block
209 * Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE
213 * DESCRIPTION: Enable or disable an individual GPE. This function bypasses
214 * the reference count mechanism used in the AcpiEnableGpe and
215 * AcpiDisableGpe interfaces -- and should be used with care.
217 * Note: Typically used to disable a runtime GPE for short period of time,
218 * then re-enable it, without disturbing the existing reference counts. This
219 * is useful, for example, in the Embedded Controller (EC) driver.
221 ******************************************************************************/
225 ACPI_HANDLE GpeDevice,
229 ACPI_GPE_EVENT_INFO *GpeEventInfo;
231 ACPI_CPU_FLAGS Flags;
234 ACPI_FUNCTION_TRACE (AcpiSetGpe);
237 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
239 /* Ensure that we have a valid GPE number */
241 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
244 Status = AE_BAD_PARAMETER;
248 /* Perform the action */
252 case ACPI_GPE_ENABLE:
254 Status = AcpiEvEnableGpe (GpeEventInfo);
257 case ACPI_GPE_DISABLE:
259 Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
264 Status = AE_BAD_PARAMETER;
269 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
270 return_ACPI_STATUS (Status);
273 ACPI_EXPORT_SYMBOL (AcpiSetGpe)
276 /*******************************************************************************
278 * FUNCTION: AcpiSetupGpeForWake
280 * PARAMETERS: WakeDevice - Device associated with the GPE (via _PRW)
281 * GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
282 * GpeNumber - GPE level within the GPE block
286 * DESCRIPTION: Mark a GPE as having the ability to wake the system. This
287 * interface is intended to be used as the host executes the
288 * _PRW methods (Power Resources for Wake) in the system tables.
289 * Each _PRW appears under a Device Object (The WakeDevice), and
290 * contains the info for the wake GPE associated with the
293 ******************************************************************************/
296 AcpiSetupGpeForWake (
297 ACPI_HANDLE WakeDevice,
298 ACPI_HANDLE GpeDevice,
302 ACPI_GPE_EVENT_INFO *GpeEventInfo;
303 ACPI_NAMESPACE_NODE *DeviceNode;
304 ACPI_GPE_NOTIFY_INFO *Notify;
305 ACPI_GPE_NOTIFY_INFO *NewNotify;
306 ACPI_CPU_FLAGS Flags;
309 ACPI_FUNCTION_TRACE (AcpiSetupGpeForWake);
312 /* Parameter Validation */
317 * By forcing WakeDevice to be valid, we automatically enable the
318 * implicit notify feature on all hosts.
320 return_ACPI_STATUS (AE_BAD_PARAMETER);
323 /* Handle root object case */
325 if (WakeDevice == ACPI_ROOT_OBJECT)
327 DeviceNode = AcpiGbl_RootNode;
331 DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, WakeDevice);
334 /* Validate WakeDevice is of type Device */
336 if (DeviceNode->Type != ACPI_TYPE_DEVICE)
338 return_ACPI_STATUS (AE_BAD_PARAMETER);
342 * Allocate a new notify object up front, in case it is needed.
343 * Memory allocation while holding a spinlock is a big no-no
346 NewNotify = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_NOTIFY_INFO));
349 return_ACPI_STATUS (AE_NO_MEMORY);
352 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
354 /* Ensure that we have a valid GPE number */
356 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
359 Status = AE_BAD_PARAMETER;
364 * If there is no method or handler for this GPE, then the
365 * WakeDevice will be notified whenever this GPE fires. This is
366 * known as an "implicit notify". Note: The GPE is assumed to be
367 * level-triggered (for windows compatibility).
369 if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
370 ACPI_GPE_DISPATCH_NONE)
373 * This is the first device for implicit notify on this GPE.
374 * Just set the flags here, and enter the NOTIFY block below.
376 GpeEventInfo->Flags =
377 (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED);
381 * If we already have an implicit notify on this GPE, add
382 * this device to the notify list.
384 if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
385 ACPI_GPE_DISPATCH_NOTIFY)
387 /* Ensure that the device is not already in the list */
389 Notify = GpeEventInfo->Dispatch.NotifyList;
392 if (Notify->DeviceNode == DeviceNode)
394 Status = AE_ALREADY_EXISTS;
397 Notify = Notify->Next;
400 /* Add this device to the notify list for this GPE */
402 NewNotify->DeviceNode = DeviceNode;
403 NewNotify->Next = GpeEventInfo->Dispatch.NotifyList;
404 GpeEventInfo->Dispatch.NotifyList = NewNotify;
408 /* Mark the GPE as a possible wake event */
410 GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE;
415 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
417 /* Delete the notify object if it was not used above */
421 ACPI_FREE (NewNotify);
423 return_ACPI_STATUS (Status);
426 ACPI_EXPORT_SYMBOL (AcpiSetupGpeForWake)
429 /*******************************************************************************
431 * FUNCTION: AcpiSetGpeWakeMask
433 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
434 * GpeNumber - GPE level within the GPE block
435 * Action - Enable or Disable
439 * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. The GPE must
440 * already be marked as a WAKE GPE.
442 ******************************************************************************/
446 ACPI_HANDLE GpeDevice,
450 ACPI_STATUS Status = AE_OK;
451 ACPI_GPE_EVENT_INFO *GpeEventInfo;
452 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
453 ACPI_CPU_FLAGS Flags;
457 ACPI_FUNCTION_TRACE (AcpiSetGpeWakeMask);
460 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
463 * Ensure that we have a valid GPE number and that this GPE is in
466 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
469 Status = AE_BAD_PARAMETER;
473 if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
479 GpeRegisterInfo = GpeEventInfo->RegisterInfo;
480 if (!GpeRegisterInfo)
482 Status = AE_NOT_EXIST;
486 RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
488 /* Perform the action */
492 case ACPI_GPE_ENABLE:
494 ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
497 case ACPI_GPE_DISABLE:
499 ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
504 ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action));
505 Status = AE_BAD_PARAMETER;
510 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
511 return_ACPI_STATUS (Status);
514 ACPI_EXPORT_SYMBOL (AcpiSetGpeWakeMask)
517 /*******************************************************************************
519 * FUNCTION: AcpiClearGpe
521 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
522 * GpeNumber - GPE level within the GPE block
526 * DESCRIPTION: Clear an ACPI event (general purpose)
528 ******************************************************************************/
532 ACPI_HANDLE GpeDevice,
535 ACPI_STATUS Status = AE_OK;
536 ACPI_GPE_EVENT_INFO *GpeEventInfo;
537 ACPI_CPU_FLAGS Flags;
540 ACPI_FUNCTION_TRACE (AcpiClearGpe);
543 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
545 /* Ensure that we have a valid GPE number */
547 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
550 Status = AE_BAD_PARAMETER;
554 Status = AcpiHwClearGpe (GpeEventInfo);
557 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
558 return_ACPI_STATUS (Status);
561 ACPI_EXPORT_SYMBOL (AcpiClearGpe)
564 /*******************************************************************************
566 * FUNCTION: AcpiGetGpeStatus
568 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
569 * GpeNumber - GPE level within the GPE block
570 * EventStatus - Where the current status of the event
575 * DESCRIPTION: Get the current status of a GPE (signalled/not_signalled)
577 ******************************************************************************/
581 ACPI_HANDLE GpeDevice,
583 ACPI_EVENT_STATUS *EventStatus)
585 ACPI_STATUS Status = AE_OK;
586 ACPI_GPE_EVENT_INFO *GpeEventInfo;
587 ACPI_CPU_FLAGS Flags;
590 ACPI_FUNCTION_TRACE (AcpiGetGpeStatus);
593 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
595 /* Ensure that we have a valid GPE number */
597 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
600 Status = AE_BAD_PARAMETER;
604 /* Obtain status on the requested GPE number */
606 Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);
609 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
610 return_ACPI_STATUS (Status);
613 ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus)
616 /*******************************************************************************
618 * FUNCTION: AcpiFinishGpe
620 * PARAMETERS: GpeDevice - Namespace node for the GPE Block
621 * (NULL for FADT defined GPEs)
622 * GpeNumber - GPE level within the GPE block
626 * DESCRIPTION: Clear and conditionally reenable a GPE. This completes the GPE
627 * processing. Intended for use by asynchronous host-installed
628 * GPE handlers. The GPE is only reenabled if the EnableForRun bit
629 * is set in the GPE info.
631 ******************************************************************************/
635 ACPI_HANDLE GpeDevice,
638 ACPI_GPE_EVENT_INFO *GpeEventInfo;
640 ACPI_CPU_FLAGS Flags;
643 ACPI_FUNCTION_TRACE (AcpiFinishGpe);
646 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
648 /* Ensure that we have a valid GPE number */
650 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
653 Status = AE_BAD_PARAMETER;
657 Status = AcpiEvFinishGpe (GpeEventInfo);
660 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
661 return_ACPI_STATUS (Status);
664 ACPI_EXPORT_SYMBOL (AcpiFinishGpe)
667 /******************************************************************************
669 * FUNCTION: AcpiDisableAllGpes
675 * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
677 ******************************************************************************/
686 ACPI_FUNCTION_TRACE (AcpiDisableAllGpes);
689 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
690 if (ACPI_FAILURE (Status))
692 return_ACPI_STATUS (Status);
695 Status = AcpiHwDisableAllGpes ();
696 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
698 return_ACPI_STATUS (Status);
701 ACPI_EXPORT_SYMBOL (AcpiDisableAllGpes)
704 /******************************************************************************
706 * FUNCTION: AcpiEnableAllRuntimeGpes
712 * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
714 ******************************************************************************/
717 AcpiEnableAllRuntimeGpes (
723 ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes);
726 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
727 if (ACPI_FAILURE (Status))
729 return_ACPI_STATUS (Status);
732 Status = AcpiHwEnableAllRuntimeGpes ();
733 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
735 return_ACPI_STATUS (Status);
738 ACPI_EXPORT_SYMBOL (AcpiEnableAllRuntimeGpes)
741 /*******************************************************************************
743 * FUNCTION: AcpiInstallGpeBlock
745 * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
746 * GpeBlockAddress - Address and SpaceID
747 * RegisterCount - Number of GPE register pairs in the block
748 * InterruptNumber - H/W interrupt for the block
752 * DESCRIPTION: Create and Install a block of GPE registers. The GPEs are not
755 ******************************************************************************/
758 AcpiInstallGpeBlock (
759 ACPI_HANDLE GpeDevice,
760 ACPI_GENERIC_ADDRESS *GpeBlockAddress,
761 UINT32 RegisterCount,
762 UINT32 InterruptNumber)
765 ACPI_OPERAND_OBJECT *ObjDesc;
766 ACPI_NAMESPACE_NODE *Node;
767 ACPI_GPE_BLOCK_INFO *GpeBlock;
770 ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock);
774 (!GpeBlockAddress) ||
777 return_ACPI_STATUS (AE_BAD_PARAMETER);
780 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
781 if (ACPI_FAILURE (Status))
783 return_ACPI_STATUS (Status);
786 Node = AcpiNsValidateHandle (GpeDevice);
789 Status = AE_BAD_PARAMETER;
794 * For user-installed GPE Block Devices, the GpeBlockBaseNumber
797 Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
798 0, InterruptNumber, &GpeBlock);
799 if (ACPI_FAILURE (Status))
804 /* Install block in the DeviceObject attached to the node */
806 ObjDesc = AcpiNsGetAttachedObject (Node);
810 * No object, create a new one (Device nodes do not always have
811 * an attached object)
813 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE);
816 Status = AE_NO_MEMORY;
820 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE);
822 /* Remove local reference to the object */
824 AcpiUtRemoveReference (ObjDesc);
825 if (ACPI_FAILURE (Status))
831 /* Now install the GPE block in the DeviceObject */
833 ObjDesc->Device.GpeBlock = GpeBlock;
837 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
838 return_ACPI_STATUS (Status);
841 ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock)
844 /*******************************************************************************
846 * FUNCTION: AcpiRemoveGpeBlock
848 * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
852 * DESCRIPTION: Remove a previously installed block of GPE registers
854 ******************************************************************************/
858 ACPI_HANDLE GpeDevice)
860 ACPI_OPERAND_OBJECT *ObjDesc;
862 ACPI_NAMESPACE_NODE *Node;
865 ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock);
870 return_ACPI_STATUS (AE_BAD_PARAMETER);
873 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
874 if (ACPI_FAILURE (Status))
876 return_ACPI_STATUS (Status);
879 Node = AcpiNsValidateHandle (GpeDevice);
882 Status = AE_BAD_PARAMETER;
886 /* Get the DeviceObject attached to the node */
888 ObjDesc = AcpiNsGetAttachedObject (Node);
890 !ObjDesc->Device.GpeBlock)
892 return_ACPI_STATUS (AE_NULL_OBJECT);
895 /* Delete the GPE block (but not the DeviceObject) */
897 Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock);
898 if (ACPI_SUCCESS (Status))
900 ObjDesc->Device.GpeBlock = NULL;
904 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
905 return_ACPI_STATUS (Status);
908 ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock)
911 /*******************************************************************************
913 * FUNCTION: AcpiGetGpeDevice
915 * PARAMETERS: Index - System GPE index (0-CurrentGpeCount)
916 * GpeDevice - Where the parent GPE Device is returned
920 * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
921 * gpe device indicates that the gpe number is contained in one of
922 * the FADT-defined gpe blocks. Otherwise, the GPE block device.
924 ******************************************************************************/
929 ACPI_HANDLE *GpeDevice)
931 ACPI_GPE_DEVICE_INFO Info;
935 ACPI_FUNCTION_TRACE (AcpiGetGpeDevice);
940 return_ACPI_STATUS (AE_BAD_PARAMETER);
943 if (Index >= AcpiCurrentGpeCount)
945 return_ACPI_STATUS (AE_NOT_EXIST);
948 /* Setup and walk the GPE list */
951 Info.Status = AE_NOT_EXIST;
952 Info.GpeDevice = NULL;
953 Info.NextBlockBaseIndex = 0;
955 Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info);
956 if (ACPI_FAILURE (Status))
958 return_ACPI_STATUS (Status);
961 *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice);
962 return_ACPI_STATUS (Info.Status);
965 ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice)
967 #endif /* !ACPI_REDUCED_HARDWARE */