1 /******************************************************************************
3 * Module Name: evxfgpe - External Interfaces for General Purpose Events (GPEs)
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************/
117 #define __EVXFGPE_C__
120 #include "accommon.h"
121 #include "acevents.h"
122 #include "acnamesp.h"
124 #define _COMPONENT ACPI_EVENTS
125 ACPI_MODULE_NAME ("evxfgpe")
128 /*******************************************************************************
130 * FUNCTION: AcpiUpdateAllGpes
136 * DESCRIPTION: Complete GPE initialization and enable all GPEs that have
137 * associated _Lxx or _Exx methods and are not pointed to by any
138 * device _PRW methods (this indicates that these GPEs are
139 * generally intended for system or device wakeup. Such GPEs
140 * have to be enabled directly when the devices whose _PRW
141 * methods point to them are set up for wakeup signaling.)
143 * NOTE: Should be called after any GPEs are added to the system. Primarily,
144 * after the system _PRW methods have been run, but also after a GPE Block
145 * Device has been added or if any new GPE methods have been added via a
146 * dynamic table load.
148 ******************************************************************************/
157 ACPI_FUNCTION_TRACE (AcpiUpdateGpes);
160 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
161 if (ACPI_FAILURE (Status))
163 return_ACPI_STATUS (Status);
166 if (AcpiGbl_AllGpesInitialized)
171 Status = AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock, NULL);
172 if (ACPI_SUCCESS (Status))
174 AcpiGbl_AllGpesInitialized = TRUE;
178 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
179 return_ACPI_STATUS (Status);
182 ACPI_EXPORT_SYMBOL (AcpiUpdateAllGpes)
185 /*******************************************************************************
187 * FUNCTION: AcpiEnableGpe
189 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
190 * GpeNumber - GPE level within the GPE block
194 * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
197 ******************************************************************************/
201 ACPI_HANDLE GpeDevice,
204 ACPI_STATUS Status = AE_BAD_PARAMETER;
205 ACPI_GPE_EVENT_INFO *GpeEventInfo;
206 ACPI_CPU_FLAGS Flags;
209 ACPI_FUNCTION_TRACE (AcpiEnableGpe);
212 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
214 /* Ensure that we have a valid GPE number */
216 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
219 Status = AcpiEvAddGpeReference (GpeEventInfo);
222 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
223 return_ACPI_STATUS (Status);
226 ACPI_EXPORT_SYMBOL (AcpiEnableGpe)
229 /*******************************************************************************
231 * FUNCTION: AcpiDisableGpe
233 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
234 * GpeNumber - GPE level within the GPE block
238 * DESCRIPTION: Remove a reference to a GPE. When the last reference is
239 * removed, only then is the GPE disabled (for runtime GPEs), or
240 * the GPE mask bit disabled (for wake GPEs)
242 ******************************************************************************/
246 ACPI_HANDLE GpeDevice,
249 ACPI_STATUS Status = AE_BAD_PARAMETER;
250 ACPI_GPE_EVENT_INFO *GpeEventInfo;
251 ACPI_CPU_FLAGS Flags;
254 ACPI_FUNCTION_TRACE (AcpiDisableGpe);
257 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
259 /* Ensure that we have a valid GPE number */
261 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
264 Status = AcpiEvRemoveGpeReference (GpeEventInfo);
267 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
268 return_ACPI_STATUS (Status);
271 ACPI_EXPORT_SYMBOL (AcpiDisableGpe)
274 /*******************************************************************************
276 * FUNCTION: AcpiSetGpe
278 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
279 * GpeNumber - GPE level within the GPE block
280 * Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE
284 * DESCRIPTION: Enable or disable an individual GPE. This function bypasses
285 * the reference count mechanism used in the AcpiEnableGpe and
286 * AcpiDisableGpe interfaces -- and should be used with care.
288 * Note: Typically used to disable a runtime GPE for short period of time,
289 * then re-enable it, without disturbing the existing reference counts. This
290 * is useful, for example, in the Embedded Controller (EC) driver.
292 ******************************************************************************/
296 ACPI_HANDLE GpeDevice,
300 ACPI_GPE_EVENT_INFO *GpeEventInfo;
302 ACPI_CPU_FLAGS Flags;
305 ACPI_FUNCTION_TRACE (AcpiSetGpe);
308 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
310 /* Ensure that we have a valid GPE number */
312 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
315 Status = AE_BAD_PARAMETER;
319 /* Perform the action */
323 case ACPI_GPE_ENABLE:
324 Status = AcpiEvEnableGpe (GpeEventInfo);
327 case ACPI_GPE_DISABLE:
328 Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
332 Status = AE_BAD_PARAMETER;
337 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
338 return_ACPI_STATUS (Status);
341 ACPI_EXPORT_SYMBOL (AcpiSetGpe)
344 /*******************************************************************************
346 * FUNCTION: AcpiSetupGpeForWake
348 * PARAMETERS: WakeDevice - Device associated with the GPE (via _PRW)
349 * GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
350 * GpeNumber - GPE level within the GPE block
354 * DESCRIPTION: Mark a GPE as having the ability to wake the system. This
355 * interface is intended to be used as the host executes the
356 * _PRW methods (Power Resources for Wake) in the system tables.
357 * Each _PRW appears under a Device Object (The WakeDevice), and
358 * contains the info for the wake GPE associated with the
361 ******************************************************************************/
364 AcpiSetupGpeForWake (
365 ACPI_HANDLE WakeDevice,
366 ACPI_HANDLE GpeDevice,
369 ACPI_STATUS Status = AE_BAD_PARAMETER;
370 ACPI_GPE_EVENT_INFO *GpeEventInfo;
371 ACPI_NAMESPACE_NODE *DeviceNode;
372 ACPI_CPU_FLAGS Flags;
375 ACPI_FUNCTION_TRACE (AcpiSetupGpeForWake);
378 /* Parameter Validation */
383 * By forcing WakeDevice to be valid, we automatically enable the
384 * implicit notify feature on all hosts.
386 return_ACPI_STATUS (AE_BAD_PARAMETER);
389 /* Validate WakeDevice is of type Device */
391 DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, WakeDevice);
392 if (DeviceNode->Type != ACPI_TYPE_DEVICE)
394 return_ACPI_STATUS (AE_BAD_PARAMETER);
397 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
399 /* Ensure that we have a valid GPE number */
401 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
405 * If there is no method or handler for this GPE, then the
406 * WakeDevice will be notified whenever this GPE fires (aka
407 * "implicit notify") Note: The GPE is assumed to be
408 * level-triggered (for windows compatibility).
410 if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
411 ACPI_GPE_DISPATCH_NONE)
413 GpeEventInfo->Flags =
414 (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED);
415 GpeEventInfo->Dispatch.DeviceNode = DeviceNode;
418 GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE;
422 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
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, GpeRegisterInfo);
488 /* Perform the action */
492 case ACPI_GPE_ENABLE:
493 ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
496 case ACPI_GPE_DISABLE:
497 ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
501 ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action));
502 Status = AE_BAD_PARAMETER;
507 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
508 return_ACPI_STATUS (Status);
511 ACPI_EXPORT_SYMBOL (AcpiSetGpeWakeMask)
514 /*******************************************************************************
516 * FUNCTION: AcpiClearGpe
518 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
519 * GpeNumber - GPE level within the GPE block
523 * DESCRIPTION: Clear an ACPI event (general purpose)
525 ******************************************************************************/
529 ACPI_HANDLE GpeDevice,
532 ACPI_STATUS Status = AE_OK;
533 ACPI_GPE_EVENT_INFO *GpeEventInfo;
534 ACPI_CPU_FLAGS Flags;
537 ACPI_FUNCTION_TRACE (AcpiClearGpe);
540 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
542 /* Ensure that we have a valid GPE number */
544 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
547 Status = AE_BAD_PARAMETER;
551 Status = AcpiHwClearGpe (GpeEventInfo);
554 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
555 return_ACPI_STATUS (Status);
558 ACPI_EXPORT_SYMBOL (AcpiClearGpe)
561 /*******************************************************************************
563 * FUNCTION: AcpiGetGpeStatus
565 * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
566 * GpeNumber - GPE level within the GPE block
567 * EventStatus - Where the current status of the event
572 * DESCRIPTION: Get the current status of a GPE (signalled/not_signalled)
574 ******************************************************************************/
578 ACPI_HANDLE GpeDevice,
580 ACPI_EVENT_STATUS *EventStatus)
582 ACPI_STATUS Status = AE_OK;
583 ACPI_GPE_EVENT_INFO *GpeEventInfo;
584 ACPI_CPU_FLAGS Flags;
587 ACPI_FUNCTION_TRACE (AcpiGetGpeStatus);
590 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
592 /* Ensure that we have a valid GPE number */
594 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
597 Status = AE_BAD_PARAMETER;
601 /* Obtain status on the requested GPE number */
603 Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus);
606 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
607 return_ACPI_STATUS (Status);
610 ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus)
613 /*******************************************************************************
615 * FUNCTION: AcpiFinishGpe
617 * PARAMETERS: GpeDevice - Namespace node for the GPE Block
618 * (NULL for FADT defined GPEs)
619 * GpeNumber - GPE level within the GPE block
623 * DESCRIPTION: Clear and conditionally reenable a GPE. This completes the GPE
624 * processing. Intended for use by asynchronous host-installed
625 * GPE handlers. The GPE is only reenabled if the EnableForRun bit
626 * is set in the GPE info.
628 ******************************************************************************/
632 ACPI_HANDLE GpeDevice,
635 ACPI_GPE_EVENT_INFO *GpeEventInfo;
637 ACPI_CPU_FLAGS Flags;
640 ACPI_FUNCTION_TRACE (AcpiFinishGpe);
643 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
645 /* Ensure that we have a valid GPE number */
647 GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
650 Status = AE_BAD_PARAMETER;
654 Status = AcpiEvFinishGpe (GpeEventInfo);
657 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
658 return_ACPI_STATUS (Status);
661 ACPI_EXPORT_SYMBOL (AcpiFinishGpe)
664 /******************************************************************************
666 * FUNCTION: AcpiDisableAllGpes
672 * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
674 ******************************************************************************/
683 ACPI_FUNCTION_TRACE (AcpiDisableAllGpes);
686 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
687 if (ACPI_FAILURE (Status))
689 return_ACPI_STATUS (Status);
692 Status = AcpiHwDisableAllGpes ();
693 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
695 return_ACPI_STATUS (Status);
698 ACPI_EXPORT_SYMBOL (AcpiDisableAllGpes)
701 /******************************************************************************
703 * FUNCTION: AcpiEnableAllRuntimeGpes
709 * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
711 ******************************************************************************/
714 AcpiEnableAllRuntimeGpes (
720 ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes);
723 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
724 if (ACPI_FAILURE (Status))
726 return_ACPI_STATUS (Status);
729 Status = AcpiHwEnableAllRuntimeGpes ();
730 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
732 return_ACPI_STATUS (Status);
735 ACPI_EXPORT_SYMBOL (AcpiEnableAllRuntimeGpes)
738 /*******************************************************************************
740 * FUNCTION: AcpiInstallGpeBlock
742 * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
743 * GpeBlockAddress - Address and SpaceID
744 * RegisterCount - Number of GPE register pairs in the block
745 * InterruptNumber - H/W interrupt for the block
749 * DESCRIPTION: Create and Install a block of GPE registers. The GPEs are not
752 ******************************************************************************/
755 AcpiInstallGpeBlock (
756 ACPI_HANDLE GpeDevice,
757 ACPI_GENERIC_ADDRESS *GpeBlockAddress,
758 UINT32 RegisterCount,
759 UINT32 InterruptNumber)
762 ACPI_OPERAND_OBJECT *ObjDesc;
763 ACPI_NAMESPACE_NODE *Node;
764 ACPI_GPE_BLOCK_INFO *GpeBlock;
767 ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock);
771 (!GpeBlockAddress) ||
774 return_ACPI_STATUS (AE_BAD_PARAMETER);
777 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
778 if (ACPI_FAILURE (Status))
783 Node = AcpiNsValidateHandle (GpeDevice);
786 Status = AE_BAD_PARAMETER;
791 * For user-installed GPE Block Devices, the GpeBlockBaseNumber
794 Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
795 0, InterruptNumber, &GpeBlock);
796 if (ACPI_FAILURE (Status))
801 /* Install block in the DeviceObject attached to the node */
803 ObjDesc = AcpiNsGetAttachedObject (Node);
807 * No object, create a new one (Device nodes do not always have
808 * an attached object)
810 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE);
813 Status = AE_NO_MEMORY;
817 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE);
819 /* Remove local reference to the object */
821 AcpiUtRemoveReference (ObjDesc);
822 if (ACPI_FAILURE (Status))
828 /* Now install the GPE block in the DeviceObject */
830 ObjDesc->Device.GpeBlock = GpeBlock;
834 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
835 return_ACPI_STATUS (Status);
838 ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock)
841 /*******************************************************************************
843 * FUNCTION: AcpiRemoveGpeBlock
845 * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
849 * DESCRIPTION: Remove a previously installed block of GPE registers
851 ******************************************************************************/
855 ACPI_HANDLE GpeDevice)
857 ACPI_OPERAND_OBJECT *ObjDesc;
859 ACPI_NAMESPACE_NODE *Node;
862 ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock);
867 return_ACPI_STATUS (AE_BAD_PARAMETER);
870 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
871 if (ACPI_FAILURE (Status))
876 Node = AcpiNsValidateHandle (GpeDevice);
879 Status = AE_BAD_PARAMETER;
883 /* Get the DeviceObject attached to the node */
885 ObjDesc = AcpiNsGetAttachedObject (Node);
887 !ObjDesc->Device.GpeBlock)
889 return_ACPI_STATUS (AE_NULL_OBJECT);
892 /* Delete the GPE block (but not the DeviceObject) */
894 Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock);
895 if (ACPI_SUCCESS (Status))
897 ObjDesc->Device.GpeBlock = NULL;
901 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
902 return_ACPI_STATUS (Status);
905 ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock)
908 /*******************************************************************************
910 * FUNCTION: AcpiGetGpeDevice
912 * PARAMETERS: Index - System GPE index (0-CurrentGpeCount)
913 * GpeDevice - Where the parent GPE Device is returned
917 * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
918 * gpe device indicates that the gpe number is contained in one of
919 * the FADT-defined gpe blocks. Otherwise, the GPE block device.
921 ******************************************************************************/
926 ACPI_HANDLE *GpeDevice)
928 ACPI_GPE_DEVICE_INFO Info;
932 ACPI_FUNCTION_TRACE (AcpiGetGpeDevice);
937 return_ACPI_STATUS (AE_BAD_PARAMETER);
940 if (Index >= AcpiCurrentGpeCount)
942 return_ACPI_STATUS (AE_NOT_EXIST);
945 /* Setup and walk the GPE list */
948 Info.Status = AE_NOT_EXIST;
949 Info.GpeDevice = NULL;
950 Info.NextBlockBaseIndex = 0;
952 Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info);
953 if (ACPI_FAILURE (Status))
955 return_ACPI_STATUS (Status);
958 *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice);
959 return_ACPI_STATUS (Info.Status);
962 ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice)