1 /******************************************************************************
3 * Module Name: evxfgpe - External Interfaces for General Purpose Events (GPEs)
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2012, 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:
253 Status = AcpiEvEnableGpe (GpeEventInfo);
256 case ACPI_GPE_DISABLE:
257 Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
261 Status = AE_BAD_PARAMETER;
266 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
267 return_ACPI_STATUS (Status);
270 ACPI_EXPORT_SYMBOL (AcpiSetGpe)
273 /*******************************************************************************
275 * FUNCTION: AcpiSetupGpeForWake
277 * PARAMETERS: WakeDevice - Device associated with the GPE (via _PRW)
278 * GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
279 * GpeNumber - GPE level within the GPE block
283 * DESCRIPTION: Mark a GPE as having the ability to wake the system. This
284 * interface is intended to be used as the host executes the
285 * _PRW methods (Power Resources for Wake) in the system tables.
286 * Each _PRW appears under a Device Object (The WakeDevice), and
287 * contains the info for the wake GPE associated with the
290 ******************************************************************************/
293 AcpiSetupGpeForWake (
294 ACPI_HANDLE WakeDevice,
295 ACPI_HANDLE GpeDevice,
299 ACPI_GPE_EVENT_INFO *GpeEventInfo;
300 ACPI_NAMESPACE_NODE *DeviceNode;
301 ACPI_GPE_NOTIFY_INFO *Notify;
302 ACPI_GPE_NOTIFY_INFO *NewNotify;
303 ACPI_CPU_FLAGS Flags;
306 ACPI_FUNCTION_TRACE (AcpiSetupGpeForWake);
309 /* Parameter Validation */
314 * By forcing WakeDevice to be valid, we automatically enable the
315 * implicit notify feature on all hosts.
317 return_ACPI_STATUS (AE_BAD_PARAMETER);
320 /* Handle root object case */
322 if (WakeDevice == ACPI_ROOT_OBJECT)
324 DeviceNode = AcpiGbl_RootNode;
328 DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, WakeDevice);
331 /* Validate WakeDevice is of type Device */
333 if (DeviceNode->Type != ACPI_TYPE_DEVICE)
335 return_ACPI_STATUS (AE_BAD_PARAMETER);
339 * Allocate a new notify object up front, in case it is needed.
340 * Memory allocation while holding a spinlock is a big no-no
343 NewNotify = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_NOTIFY_INFO));
346 return_ACPI_STATUS (AE_NO_MEMORY);
349 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
351 /* Ensure that we have a valid GPE number */
353 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
356 Status = AE_BAD_PARAMETER;
361 * If there is no method or handler for this GPE, then the
362 * WakeDevice will be notified whenever this GPE fires. This is
363 * known as an "implicit notify". Note: The GPE is assumed to be
364 * level-triggered (for windows compatibility).
366 if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
367 ACPI_GPE_DISPATCH_NONE)
370 * This is the first device for implicit notify on this GPE.
371 * Just set the flags here, and enter the NOTIFY block below.
373 GpeEventInfo->Flags =
374 (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED);
378 * If we already have an implicit notify on this GPE, add
379 * this device to the notify list.
381 if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
382 ACPI_GPE_DISPATCH_NOTIFY)
384 /* Ensure that the device is not already in the list */
386 Notify = GpeEventInfo->Dispatch.NotifyList;
389 if (Notify->DeviceNode == DeviceNode)
391 Status = AE_ALREADY_EXISTS;
394 Notify = Notify->Next;
397 /* Add this device to the notify list for this GPE */
399 NewNotify->DeviceNode = DeviceNode;
400 NewNotify->Next = GpeEventInfo->Dispatch.NotifyList;
401 GpeEventInfo->Dispatch.NotifyList = NewNotify;
405 /* Mark the GPE as a possible wake event */
407 GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE;
412 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
414 /* Delete the notify object if it was not used above */
418 ACPI_FREE (NewNotify);
420 return_ACPI_STATUS (Status);
423 ACPI_EXPORT_SYMBOL (AcpiSetupGpeForWake)
426 /*******************************************************************************
428 * FUNCTION: AcpiSetGpeWakeMask
430 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
431 * GpeNumber - GPE level within the GPE block
432 * Action - Enable or Disable
436 * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. The GPE must
437 * already be marked as a WAKE GPE.
439 ******************************************************************************/
443 ACPI_HANDLE GpeDevice,
447 ACPI_STATUS Status = AE_OK;
448 ACPI_GPE_EVENT_INFO *GpeEventInfo;
449 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
450 ACPI_CPU_FLAGS Flags;
454 ACPI_FUNCTION_TRACE (AcpiSetGpeWakeMask);
457 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
460 * Ensure that we have a valid GPE number and that this GPE is in
463 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
466 Status = AE_BAD_PARAMETER;
470 if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
476 GpeRegisterInfo = GpeEventInfo->RegisterInfo;
477 if (!GpeRegisterInfo)
479 Status = AE_NOT_EXIST;
483 RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
485 /* Perform the action */
489 case ACPI_GPE_ENABLE:
490 ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
493 case ACPI_GPE_DISABLE:
494 ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
498 ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action));
499 Status = AE_BAD_PARAMETER;
504 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
505 return_ACPI_STATUS (Status);
508 ACPI_EXPORT_SYMBOL (AcpiSetGpeWakeMask)
511 /*******************************************************************************
513 * FUNCTION: AcpiClearGpe
515 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
516 * GpeNumber - GPE level within the GPE block
520 * DESCRIPTION: Clear an ACPI event (general purpose)
522 ******************************************************************************/
526 ACPI_HANDLE GpeDevice,
529 ACPI_STATUS Status = AE_OK;
530 ACPI_GPE_EVENT_INFO *GpeEventInfo;
531 ACPI_CPU_FLAGS Flags;
534 ACPI_FUNCTION_TRACE (AcpiClearGpe);
537 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
539 /* Ensure that we have a valid GPE number */
541 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
544 Status = AE_BAD_PARAMETER;
548 Status = AcpiHwClearGpe (GpeEventInfo);
551 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
552 return_ACPI_STATUS (Status);
555 ACPI_EXPORT_SYMBOL (AcpiClearGpe)
558 /*******************************************************************************
560 * FUNCTION: AcpiGetGpeStatus
562 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
563 * GpeNumber - GPE level within the GPE block
564 * EventStatus - Where the current status of the event
569 * DESCRIPTION: Get the current status of a GPE (signalled/not_signalled)
571 ******************************************************************************/
575 ACPI_HANDLE GpeDevice,
577 ACPI_EVENT_STATUS *EventStatus)
579 ACPI_STATUS Status = AE_OK;
580 ACPI_GPE_EVENT_INFO *GpeEventInfo;
581 ACPI_CPU_FLAGS Flags;
584 ACPI_FUNCTION_TRACE (AcpiGetGpeStatus);
587 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
589 /* Ensure that we have a valid GPE number */
591 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
594 Status = AE_BAD_PARAMETER;
598 /* Obtain status on the requested GPE number */
600 Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);
603 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
604 return_ACPI_STATUS (Status);
607 ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus)
610 /*******************************************************************************
612 * FUNCTION: AcpiFinishGpe
614 * PARAMETERS: GpeDevice - Namespace node for the GPE Block
615 * (NULL for FADT defined GPEs)
616 * GpeNumber - GPE level within the GPE block
620 * DESCRIPTION: Clear and conditionally reenable a GPE. This completes the GPE
621 * processing. Intended for use by asynchronous host-installed
622 * GPE handlers. The GPE is only reenabled if the EnableForRun bit
623 * is set in the GPE info.
625 ******************************************************************************/
629 ACPI_HANDLE GpeDevice,
632 ACPI_GPE_EVENT_INFO *GpeEventInfo;
634 ACPI_CPU_FLAGS Flags;
637 ACPI_FUNCTION_TRACE (AcpiFinishGpe);
640 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
642 /* Ensure that we have a valid GPE number */
644 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
647 Status = AE_BAD_PARAMETER;
651 Status = AcpiEvFinishGpe (GpeEventInfo);
654 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
655 return_ACPI_STATUS (Status);
658 ACPI_EXPORT_SYMBOL (AcpiFinishGpe)
661 /******************************************************************************
663 * FUNCTION: AcpiDisableAllGpes
669 * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
671 ******************************************************************************/
680 ACPI_FUNCTION_TRACE (AcpiDisableAllGpes);
683 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
684 if (ACPI_FAILURE (Status))
686 return_ACPI_STATUS (Status);
689 Status = AcpiHwDisableAllGpes ();
690 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
692 return_ACPI_STATUS (Status);
695 ACPI_EXPORT_SYMBOL (AcpiDisableAllGpes)
698 /******************************************************************************
700 * FUNCTION: AcpiEnableAllRuntimeGpes
706 * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
708 ******************************************************************************/
711 AcpiEnableAllRuntimeGpes (
717 ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes);
720 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
721 if (ACPI_FAILURE (Status))
723 return_ACPI_STATUS (Status);
726 Status = AcpiHwEnableAllRuntimeGpes ();
727 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
729 return_ACPI_STATUS (Status);
732 ACPI_EXPORT_SYMBOL (AcpiEnableAllRuntimeGpes)
735 /*******************************************************************************
737 * FUNCTION: AcpiInstallGpeBlock
739 * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
740 * GpeBlockAddress - Address and SpaceID
741 * RegisterCount - Number of GPE register pairs in the block
742 * InterruptNumber - H/W interrupt for the block
746 * DESCRIPTION: Create and Install a block of GPE registers. The GPEs are not
749 ******************************************************************************/
752 AcpiInstallGpeBlock (
753 ACPI_HANDLE GpeDevice,
754 ACPI_GENERIC_ADDRESS *GpeBlockAddress,
755 UINT32 RegisterCount,
756 UINT32 InterruptNumber)
759 ACPI_OPERAND_OBJECT *ObjDesc;
760 ACPI_NAMESPACE_NODE *Node;
761 ACPI_GPE_BLOCK_INFO *GpeBlock;
764 ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock);
768 (!GpeBlockAddress) ||
771 return_ACPI_STATUS (AE_BAD_PARAMETER);
774 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
775 if (ACPI_FAILURE (Status))
780 Node = AcpiNsValidateHandle (GpeDevice);
783 Status = AE_BAD_PARAMETER;
788 * For user-installed GPE Block Devices, the GpeBlockBaseNumber
791 Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
792 0, InterruptNumber, &GpeBlock);
793 if (ACPI_FAILURE (Status))
798 /* Install block in the DeviceObject attached to the node */
800 ObjDesc = AcpiNsGetAttachedObject (Node);
804 * No object, create a new one (Device nodes do not always have
805 * an attached object)
807 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE);
810 Status = AE_NO_MEMORY;
814 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE);
816 /* Remove local reference to the object */
818 AcpiUtRemoveReference (ObjDesc);
819 if (ACPI_FAILURE (Status))
825 /* Now install the GPE block in the DeviceObject */
827 ObjDesc->Device.GpeBlock = GpeBlock;
831 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
832 return_ACPI_STATUS (Status);
835 ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock)
838 /*******************************************************************************
840 * FUNCTION: AcpiRemoveGpeBlock
842 * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
846 * DESCRIPTION: Remove a previously installed block of GPE registers
848 ******************************************************************************/
852 ACPI_HANDLE GpeDevice)
854 ACPI_OPERAND_OBJECT *ObjDesc;
856 ACPI_NAMESPACE_NODE *Node;
859 ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock);
864 return_ACPI_STATUS (AE_BAD_PARAMETER);
867 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
868 if (ACPI_FAILURE (Status))
873 Node = AcpiNsValidateHandle (GpeDevice);
876 Status = AE_BAD_PARAMETER;
880 /* Get the DeviceObject attached to the node */
882 ObjDesc = AcpiNsGetAttachedObject (Node);
884 !ObjDesc->Device.GpeBlock)
886 return_ACPI_STATUS (AE_NULL_OBJECT);
889 /* Delete the GPE block (but not the DeviceObject) */
891 Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock);
892 if (ACPI_SUCCESS (Status))
894 ObjDesc->Device.GpeBlock = NULL;
898 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
899 return_ACPI_STATUS (Status);
902 ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock)
905 /*******************************************************************************
907 * FUNCTION: AcpiGetGpeDevice
909 * PARAMETERS: Index - System GPE index (0-CurrentGpeCount)
910 * GpeDevice - Where the parent GPE Device is returned
914 * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
915 * gpe device indicates that the gpe number is contained in one of
916 * the FADT-defined gpe blocks. Otherwise, the GPE block device.
918 ******************************************************************************/
923 ACPI_HANDLE *GpeDevice)
925 ACPI_GPE_DEVICE_INFO Info;
929 ACPI_FUNCTION_TRACE (AcpiGetGpeDevice);
934 return_ACPI_STATUS (AE_BAD_PARAMETER);
937 if (Index >= AcpiCurrentGpeCount)
939 return_ACPI_STATUS (AE_NOT_EXIST);
942 /* Setup and walk the GPE list */
945 Info.Status = AE_NOT_EXIST;
946 Info.GpeDevice = NULL;
947 Info.NextBlockBaseIndex = 0;
949 Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info);
950 if (ACPI_FAILURE (Status))
952 return_ACPI_STATUS (Status);
955 *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice);
956 return_ACPI_STATUS (Info.Status);
959 ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice)
961 #endif /* !ACPI_REDUCED_HARDWARE */