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.
46 #define EXPORT_ACPI_INTERFACES
53 #define _COMPONENT ACPI_EVENTS
54 ACPI_MODULE_NAME ("evxfgpe")
57 #if (!ACPI_REDUCED_HARDWARE) /* Entire module */
58 /*******************************************************************************
60 * FUNCTION: AcpiUpdateAllGpes
66 * DESCRIPTION: Complete GPE initialization and enable all GPEs that have
67 * associated _Lxx or _Exx methods and are not pointed to by any
68 * device _PRW methods (this indicates that these GPEs are
69 * generally intended for system or device wakeup. Such GPEs
70 * have to be enabled directly when the devices whose _PRW
71 * methods point to them are set up for wakeup signaling.)
73 * NOTE: Should be called after any GPEs are added to the system. Primarily,
74 * after the system _PRW methods have been run, but also after a GPE Block
75 * Device has been added or if any new GPE methods have been added via a
78 ******************************************************************************/
87 ACPI_FUNCTION_TRACE (AcpiUpdateAllGpes
);
90 Status
= AcpiUtAcquireMutex (ACPI_MTX_EVENTS
);
91 if (ACPI_FAILURE (Status
))
93 return_ACPI_STATUS (Status
);
96 if (AcpiGbl_AllGpesInitialized
)
101 Status
= AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock
, NULL
);
102 if (ACPI_SUCCESS (Status
))
104 AcpiGbl_AllGpesInitialized
= TRUE
;
108 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS
);
109 return_ACPI_STATUS (Status
);
112 ACPI_EXPORT_SYMBOL (AcpiUpdateAllGpes
)
115 /*******************************************************************************
117 * FUNCTION: AcpiEnableGpe
119 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
120 * GpeNumber - GPE level within the GPE block
124 * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
127 ******************************************************************************/
131 ACPI_HANDLE GpeDevice
,
134 ACPI_STATUS Status
= AE_BAD_PARAMETER
;
135 ACPI_GPE_EVENT_INFO
*GpeEventInfo
;
136 ACPI_CPU_FLAGS Flags
;
139 ACPI_FUNCTION_TRACE (AcpiEnableGpe
);
142 Flags
= AcpiOsAcquireLock (AcpiGbl_GpeLock
);
144 /* Ensure that we have a valid GPE number */
146 GpeEventInfo
= AcpiEvGetGpeEventInfo (GpeDevice
, GpeNumber
);
149 Status
= AcpiEvAddGpeReference (GpeEventInfo
);
152 AcpiOsReleaseLock (AcpiGbl_GpeLock
, Flags
);
153 return_ACPI_STATUS (Status
);
156 ACPI_EXPORT_SYMBOL (AcpiEnableGpe
)
159 /*******************************************************************************
161 * FUNCTION: AcpiDisableGpe
163 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
164 * GpeNumber - GPE level within the GPE block
168 * DESCRIPTION: Remove a reference to a GPE. When the last reference is
169 * removed, only then is the GPE disabled (for runtime GPEs), or
170 * the GPE mask bit disabled (for wake GPEs)
172 ******************************************************************************/
176 ACPI_HANDLE GpeDevice
,
179 ACPI_STATUS Status
= AE_BAD_PARAMETER
;
180 ACPI_GPE_EVENT_INFO
*GpeEventInfo
;
181 ACPI_CPU_FLAGS Flags
;
184 ACPI_FUNCTION_TRACE (AcpiDisableGpe
);
187 Flags
= AcpiOsAcquireLock (AcpiGbl_GpeLock
);
189 /* Ensure that we have a valid GPE number */
191 GpeEventInfo
= AcpiEvGetGpeEventInfo (GpeDevice
, GpeNumber
);
194 Status
= AcpiEvRemoveGpeReference (GpeEventInfo
);
197 AcpiOsReleaseLock (AcpiGbl_GpeLock
, Flags
);
198 return_ACPI_STATUS (Status
);
201 ACPI_EXPORT_SYMBOL (AcpiDisableGpe
)
204 /*******************************************************************************
206 * FUNCTION: AcpiSetGpe
208 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
209 * GpeNumber - GPE level within the GPE block
210 * Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE
214 * DESCRIPTION: Enable or disable an individual GPE. This function bypasses
215 * the reference count mechanism used in the AcpiEnableGpe and
216 * AcpiDisableGpe interfaces -- and should be used with care.
218 * Note: Typically used to disable a runtime GPE for short period of time,
219 * then re-enable it, without disturbing the existing reference counts. This
220 * is useful, for example, in the Embedded Controller (EC) driver.
222 ******************************************************************************/
226 ACPI_HANDLE GpeDevice
,
230 ACPI_GPE_EVENT_INFO
*GpeEventInfo
;
232 ACPI_CPU_FLAGS Flags
;
235 ACPI_FUNCTION_TRACE (AcpiSetGpe
);
238 Flags
= AcpiOsAcquireLock (AcpiGbl_GpeLock
);
240 /* Ensure that we have a valid GPE number */
242 GpeEventInfo
= AcpiEvGetGpeEventInfo (GpeDevice
, GpeNumber
);
245 Status
= AE_BAD_PARAMETER
;
249 /* Perform the action */
253 case ACPI_GPE_ENABLE
:
255 Status
= AcpiEvEnableGpe (GpeEventInfo
);
258 case ACPI_GPE_DISABLE
:
260 Status
= AcpiHwLowSetGpe (GpeEventInfo
, ACPI_GPE_DISABLE
);
265 Status
= AE_BAD_PARAMETER
;
270 AcpiOsReleaseLock (AcpiGbl_GpeLock
, Flags
);
271 return_ACPI_STATUS (Status
);
274 ACPI_EXPORT_SYMBOL (AcpiSetGpe
)
277 /*******************************************************************************
279 * FUNCTION: AcpiSetupGpeForWake
281 * PARAMETERS: WakeDevice - Device associated with the GPE (via _PRW)
282 * GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
283 * GpeNumber - GPE level within the GPE block
287 * DESCRIPTION: Mark a GPE as having the ability to wake the system. This
288 * interface is intended to be used as the host executes the
289 * _PRW methods (Power Resources for Wake) in the system tables.
290 * Each _PRW appears under a Device Object (The WakeDevice), and
291 * contains the info for the wake GPE associated with the
294 ******************************************************************************/
297 AcpiSetupGpeForWake (
298 ACPI_HANDLE WakeDevice
,
299 ACPI_HANDLE GpeDevice
,
303 ACPI_GPE_EVENT_INFO
*GpeEventInfo
;
304 ACPI_NAMESPACE_NODE
*DeviceNode
;
305 ACPI_GPE_NOTIFY_INFO
*Notify
;
306 ACPI_GPE_NOTIFY_INFO
*NewNotify
;
307 ACPI_CPU_FLAGS Flags
;
310 ACPI_FUNCTION_TRACE (AcpiSetupGpeForWake
);
313 /* Parameter Validation */
318 * By forcing WakeDevice to be valid, we automatically enable the
319 * implicit notify feature on all hosts.
321 return_ACPI_STATUS (AE_BAD_PARAMETER
);
324 /* Handle root object case */
326 if (WakeDevice
== ACPI_ROOT_OBJECT
)
328 DeviceNode
= AcpiGbl_RootNode
;
332 DeviceNode
= ACPI_CAST_PTR (ACPI_NAMESPACE_NODE
, WakeDevice
);
335 /* Validate WakeDevice is of type Device */
337 if (DeviceNode
->Type
!= ACPI_TYPE_DEVICE
)
339 return_ACPI_STATUS (AE_BAD_PARAMETER
);
343 * Allocate a new notify object up front, in case it is needed.
344 * Memory allocation while holding a spinlock is a big no-no
347 NewNotify
= ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_NOTIFY_INFO
));
350 return_ACPI_STATUS (AE_NO_MEMORY
);
353 Flags
= AcpiOsAcquireLock (AcpiGbl_GpeLock
);
355 /* Ensure that we have a valid GPE number */
357 GpeEventInfo
= AcpiEvGetGpeEventInfo (GpeDevice
, GpeNumber
);
360 Status
= AE_BAD_PARAMETER
;
365 * If there is no method or handler for this GPE, then the
366 * WakeDevice will be notified whenever this GPE fires. This is
367 * known as an "implicit notify". Note: The GPE is assumed to be
368 * level-triggered (for windows compatibility).
370 if ((GpeEventInfo
->Flags
& ACPI_GPE_DISPATCH_MASK
) ==
371 ACPI_GPE_DISPATCH_NONE
)
374 * This is the first device for implicit notify on this GPE.
375 * Just set the flags here, and enter the NOTIFY block below.
377 GpeEventInfo
->Flags
=
378 (ACPI_GPE_DISPATCH_NOTIFY
| ACPI_GPE_LEVEL_TRIGGERED
);
382 * If we already have an implicit notify on this GPE, add
383 * this device to the notify list.
385 if ((GpeEventInfo
->Flags
& ACPI_GPE_DISPATCH_MASK
) ==
386 ACPI_GPE_DISPATCH_NOTIFY
)
388 /* Ensure that the device is not already in the list */
390 Notify
= GpeEventInfo
->Dispatch
.NotifyList
;
393 if (Notify
->DeviceNode
== DeviceNode
)
395 Status
= AE_ALREADY_EXISTS
;
398 Notify
= Notify
->Next
;
401 /* Add this device to the notify list for this GPE */
403 NewNotify
->DeviceNode
= DeviceNode
;
404 NewNotify
->Next
= GpeEventInfo
->Dispatch
.NotifyList
;
405 GpeEventInfo
->Dispatch
.NotifyList
= NewNotify
;
409 /* Mark the GPE as a possible wake event */
411 GpeEventInfo
->Flags
|= ACPI_GPE_CAN_WAKE
;
416 AcpiOsReleaseLock (AcpiGbl_GpeLock
, Flags
);
418 /* Delete the notify object if it was not used above */
422 ACPI_FREE (NewNotify
);
424 return_ACPI_STATUS (Status
);
427 ACPI_EXPORT_SYMBOL (AcpiSetupGpeForWake
)
430 /*******************************************************************************
432 * FUNCTION: AcpiSetGpeWakeMask
434 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
435 * GpeNumber - GPE level within the GPE block
436 * Action - Enable or Disable
440 * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. The GPE must
441 * already be marked as a WAKE GPE.
443 ******************************************************************************/
447 ACPI_HANDLE GpeDevice
,
451 ACPI_STATUS Status
= AE_OK
;
452 ACPI_GPE_EVENT_INFO
*GpeEventInfo
;
453 ACPI_GPE_REGISTER_INFO
*GpeRegisterInfo
;
454 ACPI_CPU_FLAGS Flags
;
458 ACPI_FUNCTION_TRACE (AcpiSetGpeWakeMask
);
461 Flags
= AcpiOsAcquireLock (AcpiGbl_GpeLock
);
464 * Ensure that we have a valid GPE number and that this GPE is in
467 GpeEventInfo
= AcpiEvGetGpeEventInfo (GpeDevice
, GpeNumber
);
470 Status
= AE_BAD_PARAMETER
;
474 if (!(GpeEventInfo
->Flags
& ACPI_GPE_CAN_WAKE
))
480 GpeRegisterInfo
= GpeEventInfo
->RegisterInfo
;
481 if (!GpeRegisterInfo
)
483 Status
= AE_NOT_EXIST
;
487 RegisterBit
= AcpiHwGetGpeRegisterBit (GpeEventInfo
);
489 /* Perform the action */
493 case ACPI_GPE_ENABLE
:
495 ACPI_SET_BIT (GpeRegisterInfo
->EnableForWake
, (UINT8
) RegisterBit
);
498 case ACPI_GPE_DISABLE
:
500 ACPI_CLEAR_BIT (GpeRegisterInfo
->EnableForWake
, (UINT8
) RegisterBit
);
505 ACPI_ERROR ((AE_INFO
, "%u, Invalid action", Action
));
506 Status
= AE_BAD_PARAMETER
;
511 AcpiOsReleaseLock (AcpiGbl_GpeLock
, Flags
);
512 return_ACPI_STATUS (Status
);
515 ACPI_EXPORT_SYMBOL (AcpiSetGpeWakeMask
)
518 /*******************************************************************************
520 * FUNCTION: AcpiClearGpe
522 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
523 * GpeNumber - GPE level within the GPE block
527 * DESCRIPTION: Clear an ACPI event (general purpose)
529 ******************************************************************************/
533 ACPI_HANDLE GpeDevice
,
536 ACPI_STATUS Status
= AE_OK
;
537 ACPI_GPE_EVENT_INFO
*GpeEventInfo
;
538 ACPI_CPU_FLAGS Flags
;
541 ACPI_FUNCTION_TRACE (AcpiClearGpe
);
544 Flags
= AcpiOsAcquireLock (AcpiGbl_GpeLock
);
546 /* Ensure that we have a valid GPE number */
548 GpeEventInfo
= AcpiEvGetGpeEventInfo (GpeDevice
, GpeNumber
);
551 Status
= AE_BAD_PARAMETER
;
555 Status
= AcpiHwClearGpe (GpeEventInfo
);
558 AcpiOsReleaseLock (AcpiGbl_GpeLock
, Flags
);
559 return_ACPI_STATUS (Status
);
562 ACPI_EXPORT_SYMBOL (AcpiClearGpe
)
565 /*******************************************************************************
567 * FUNCTION: AcpiGetGpeStatus
569 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
570 * GpeNumber - GPE level within the GPE block
571 * EventStatus - Where the current status of the event
576 * DESCRIPTION: Get the current status of a GPE (signalled/not_signalled)
578 ******************************************************************************/
582 ACPI_HANDLE GpeDevice
,
584 ACPI_EVENT_STATUS
*EventStatus
)
586 ACPI_STATUS Status
= AE_OK
;
587 ACPI_GPE_EVENT_INFO
*GpeEventInfo
;
588 ACPI_CPU_FLAGS Flags
;
591 ACPI_FUNCTION_TRACE (AcpiGetGpeStatus
);
594 Flags
= AcpiOsAcquireLock (AcpiGbl_GpeLock
);
596 /* Ensure that we have a valid GPE number */
598 GpeEventInfo
= AcpiEvGetGpeEventInfo (GpeDevice
, GpeNumber
);
601 Status
= AE_BAD_PARAMETER
;
605 /* Obtain status on the requested GPE number */
607 Status
= AcpiHwGetGpeStatus (GpeEventInfo
, EventStatus
);
610 AcpiOsReleaseLock (AcpiGbl_GpeLock
, Flags
);
611 return_ACPI_STATUS (Status
);
614 ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus
)
617 /*******************************************************************************
619 * FUNCTION: AcpiFinishGpe
621 * PARAMETERS: GpeDevice - Namespace node for the GPE Block
622 * (NULL for FADT defined GPEs)
623 * GpeNumber - GPE level within the GPE block
627 * DESCRIPTION: Clear and conditionally reenable a GPE. This completes the GPE
628 * processing. Intended for use by asynchronous host-installed
629 * GPE handlers. The GPE is only reenabled if the EnableForRun bit
630 * is set in the GPE info.
632 ******************************************************************************/
636 ACPI_HANDLE GpeDevice
,
639 ACPI_GPE_EVENT_INFO
*GpeEventInfo
;
641 ACPI_CPU_FLAGS Flags
;
644 ACPI_FUNCTION_TRACE (AcpiFinishGpe
);
647 Flags
= AcpiOsAcquireLock (AcpiGbl_GpeLock
);
649 /* Ensure that we have a valid GPE number */
651 GpeEventInfo
= AcpiEvGetGpeEventInfo (GpeDevice
, GpeNumber
);
654 Status
= AE_BAD_PARAMETER
;
658 Status
= AcpiEvFinishGpe (GpeEventInfo
);
661 AcpiOsReleaseLock (AcpiGbl_GpeLock
, Flags
);
662 return_ACPI_STATUS (Status
);
665 ACPI_EXPORT_SYMBOL (AcpiFinishGpe
)
668 /******************************************************************************
670 * FUNCTION: AcpiDisableAllGpes
676 * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
678 ******************************************************************************/
687 ACPI_FUNCTION_TRACE (AcpiDisableAllGpes
);
690 Status
= AcpiUtAcquireMutex (ACPI_MTX_EVENTS
);
691 if (ACPI_FAILURE (Status
))
693 return_ACPI_STATUS (Status
);
696 Status
= AcpiHwDisableAllGpes ();
697 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS
);
699 return_ACPI_STATUS (Status
);
702 ACPI_EXPORT_SYMBOL (AcpiDisableAllGpes
)
705 /******************************************************************************
707 * FUNCTION: AcpiEnableAllRuntimeGpes
713 * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
715 ******************************************************************************/
718 AcpiEnableAllRuntimeGpes (
724 ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes
);
727 Status
= AcpiUtAcquireMutex (ACPI_MTX_EVENTS
);
728 if (ACPI_FAILURE (Status
))
730 return_ACPI_STATUS (Status
);
733 Status
= AcpiHwEnableAllRuntimeGpes ();
734 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS
);
736 return_ACPI_STATUS (Status
);
739 ACPI_EXPORT_SYMBOL (AcpiEnableAllRuntimeGpes
)
742 /*******************************************************************************
744 * FUNCTION: AcpiInstallGpeBlock
746 * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
747 * GpeBlockAddress - Address and SpaceID
748 * RegisterCount - Number of GPE register pairs in the block
749 * InterruptNumber - H/W interrupt for the block
753 * DESCRIPTION: Create and Install a block of GPE registers. The GPEs are not
756 ******************************************************************************/
759 AcpiInstallGpeBlock (
760 ACPI_HANDLE GpeDevice
,
761 ACPI_GENERIC_ADDRESS
*GpeBlockAddress
,
762 UINT32 RegisterCount
,
763 UINT32 InterruptNumber
)
766 ACPI_OPERAND_OBJECT
*ObjDesc
;
767 ACPI_NAMESPACE_NODE
*Node
;
768 ACPI_GPE_BLOCK_INFO
*GpeBlock
;
771 ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock
);
775 (!GpeBlockAddress
) ||
778 return_ACPI_STATUS (AE_BAD_PARAMETER
);
781 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
782 if (ACPI_FAILURE (Status
))
784 return_ACPI_STATUS (Status
);
787 Node
= AcpiNsValidateHandle (GpeDevice
);
790 Status
= AE_BAD_PARAMETER
;
795 * For user-installed GPE Block Devices, the GpeBlockBaseNumber
798 Status
= AcpiEvCreateGpeBlock (Node
, GpeBlockAddress
, RegisterCount
,
799 0, InterruptNumber
, &GpeBlock
);
800 if (ACPI_FAILURE (Status
))
805 /* Install block in the DeviceObject attached to the node */
807 ObjDesc
= AcpiNsGetAttachedObject (Node
);
811 * No object, create a new one (Device nodes do not always have
812 * an attached object)
814 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE
);
817 Status
= AE_NO_MEMORY
;
821 Status
= AcpiNsAttachObject (Node
, ObjDesc
, ACPI_TYPE_DEVICE
);
823 /* Remove local reference to the object */
825 AcpiUtRemoveReference (ObjDesc
);
826 if (ACPI_FAILURE (Status
))
832 /* Now install the GPE block in the DeviceObject */
834 ObjDesc
->Device
.GpeBlock
= GpeBlock
;
838 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
839 return_ACPI_STATUS (Status
);
842 ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock
)
845 /*******************************************************************************
847 * FUNCTION: AcpiRemoveGpeBlock
849 * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
853 * DESCRIPTION: Remove a previously installed block of GPE registers
855 ******************************************************************************/
859 ACPI_HANDLE GpeDevice
)
861 ACPI_OPERAND_OBJECT
*ObjDesc
;
863 ACPI_NAMESPACE_NODE
*Node
;
866 ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock
);
871 return_ACPI_STATUS (AE_BAD_PARAMETER
);
874 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
875 if (ACPI_FAILURE (Status
))
877 return_ACPI_STATUS (Status
);
880 Node
= AcpiNsValidateHandle (GpeDevice
);
883 Status
= AE_BAD_PARAMETER
;
887 /* Get the DeviceObject attached to the node */
889 ObjDesc
= AcpiNsGetAttachedObject (Node
);
891 !ObjDesc
->Device
.GpeBlock
)
893 return_ACPI_STATUS (AE_NULL_OBJECT
);
896 /* Delete the GPE block (but not the DeviceObject) */
898 Status
= AcpiEvDeleteGpeBlock (ObjDesc
->Device
.GpeBlock
);
899 if (ACPI_SUCCESS (Status
))
901 ObjDesc
->Device
.GpeBlock
= NULL
;
905 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
906 return_ACPI_STATUS (Status
);
909 ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock
)
912 /*******************************************************************************
914 * FUNCTION: AcpiGetGpeDevice
916 * PARAMETERS: Index - System GPE index (0-CurrentGpeCount)
917 * GpeDevice - Where the parent GPE Device is returned
921 * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
922 * gpe device indicates that the gpe number is contained in one of
923 * the FADT-defined gpe blocks. Otherwise, the GPE block device.
925 ******************************************************************************/
930 ACPI_HANDLE
*GpeDevice
)
932 ACPI_GPE_DEVICE_INFO Info
;
936 ACPI_FUNCTION_TRACE (AcpiGetGpeDevice
);
941 return_ACPI_STATUS (AE_BAD_PARAMETER
);
944 if (Index
>= AcpiCurrentGpeCount
)
946 return_ACPI_STATUS (AE_NOT_EXIST
);
949 /* Setup and walk the GPE list */
952 Info
.Status
= AE_NOT_EXIST
;
953 Info
.GpeDevice
= NULL
;
954 Info
.NextBlockBaseIndex
= 0;
956 Status
= AcpiEvWalkGpeList (AcpiEvGetGpeDevice
, &Info
);
957 if (ACPI_FAILURE (Status
))
959 return_ACPI_STATUS (Status
);
962 *GpeDevice
= ACPI_CAST_PTR (ACPI_HANDLE
, Info
.GpeDevice
);
963 return_ACPI_STATUS (Info
.Status
);
966 ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice
)
968 #endif /* !ACPI_REDUCED_HARDWARE */