evgpeblk.c revision 30082d0cc16bf5799269ca464a219de900f519cd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Module Name: evgpeblk - GPE block creation and initialization.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * $Revision: 1.53 $
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *****************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1. Copyright Notice
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2. License
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2.1. This is your license from Intel Corp. under its intellectual property
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * rights. You may have additional license terms from the party that provided
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * you this software, covering your right to use that party's intellectual
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * property rights.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * copy of the source code appearing in this file ("Covered Code") an
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * irrevocable, perpetual, worldwide license under Intel's copyrights in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * base code distributed originally by Intel ("Original Intel Code") to copy,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * make derivatives, distribute, use and display any portion of the Covered
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Code in any form, with the right to sublicense such rights; and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * license (with the right to sublicense), under only those claims of Intel
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * patents that are infringed by the Original Intel Code, to make, use, sell,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * offer to sell, and import the Covered Code and derivative works thereof
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * solely to the minimum extent necessary to exercise the above copyright
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * license, and in no event shall the patent license extend to any additions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to or modifications of the Original Intel Code. No other license or right
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is granted directly or by implication, estoppel or otherwise;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The above copyright and patent license is granted only if the following
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * conditions are met:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 3. Conditions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 3.1. Redistribution of Source with Rights to Further Distribute Source.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Redistribution of source code of any substantial portion of the Covered
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Code or modification with rights to further distribute source must include
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the above Copyright Notice, the above License, this list of Conditions,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and the following Disclaimer and Export Compliance provision. In addition,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Licensee must cause all Covered Code to which Licensee contributes to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * contain a file documenting the changes Licensee made to create that Covered
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Code and the date of any change. Licensee must include in that file the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * documentation of any changes made by any predecessor Licensee. Licensee
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * must include a prominent statement that the modification is derived,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * directly or indirectly, from Original Intel Code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Redistribution of source code of any substantial portion of the Covered
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Code or modification without rights to further distribute source must
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * include the following Disclaimer and Export Compliance provision in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * documentation and/or other materials provided with distribution. In
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * addition, Licensee may not authorize further sublicense of source of any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * portion of the Covered Code, and must include terms to the effect that the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * license from Licensee to its licensee is limited to the intellectual
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * property embodied in the software Licensee provides to its licensee, and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * not to intellectual property embodied in modifications its licensee may
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * make.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 3.3. Redistribution of Executable. Redistribution in executable form of any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * substantial portion of the Covered Code or modification must reproduce the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * above Copyright Notice, and the following Disclaimer and Export Compliance
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * provision in the documentation and/or other materials provided with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * distribution.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 3.4. Intel retains all right, title, and interest in and to the Original
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Intel Code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 3.5. Neither the name Intel nor any other trademark owned or controlled by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Intel shall be used in advertising or otherwise to promote the sale, use or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * other dealings in products derived from or relating to the Covered Code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * without prior written authorization from Intel.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 4. Disclaimer and Export Compliance
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARTICULAR PURPOSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * LIMITED REMEDY.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 4.3. Licensee shall not export, either directly or indirectly, any of this
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * software or system incorporating such software without first obtaining any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * required license or other approval from the U. S. Department of Commerce or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * any other agency or department of the United States Government. In the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * event Licensee exports any such software from the United States or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * re-exports any such software from a foreign destination, Licensee shall
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ensure that the distribution and export/re-export of the software is in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compliance with all laws, regulations, orders, or other restrictions of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * U.S. Export Administration Regulations. Licensee agrees that neither it nor
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * any of its subsidiaries will export/re-export any technical data, process,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * software, or service, directly or indirectly, to any country for which the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * United States government or any agency thereof requires an export license,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * other governmental approval, or letter of assurance, without first obtaining
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * such license, approval or letter.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *****************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "acpi.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "acevents.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "acnamesp.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _COMPONENT ACPI_EVENTS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MODULE_NAME ("evgpeblk")
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Local prototypes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvSaveMethodInfo (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_HANDLE ObjHandle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 Level,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *ObjDesc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void **ReturnValue);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvMatchPrwAndGpe (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_HANDLE ObjHandle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 Level,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *Info,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void **ReturnValue);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_GPE_XRUPT_INFO *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvGetGpeXruptBlock (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 InterruptNumber);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvDeleteGpeXrupt (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_XRUPT_INFO *GpeXrupt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvInstallGpeBlock (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 InterruptNumber);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvCreateGpeInfoBlocks (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvValidGpeEvent
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: GpeEventInfo - Info for this GPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: TRUE if the GpeEvent is valid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Should be called only when the GPE lists are semaphore locked
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and not subject to change.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBOOLEAN
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvValidGpeEvent (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_EVENT_INFO *GpeEventInfo)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_ENTRY ();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* No need for spin lock since we are not changing any list elements */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Walk the GPE interrupt levels */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXruptBlock = AcpiGbl_GpeXruptListHead;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (GpeXruptBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock = GpeXruptBlock->GpeBlockListHead;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Walk the GPE blocks on this interrupt level */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (GpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (&GpeBlock->EventInfo[((ACPI_SIZE) GpeBlock->RegisterCount) * 8] > GpeEventInfo))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock = GpeBlock->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXruptBlock = GpeXruptBlock->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvWalkGpeList
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: GpeWalkCallback - Routine called for each GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Walk the GPE lists.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvWalkGpeList (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_CALLBACK GpeWalkCallback)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status = AE_OK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_CPU_FLAGS Flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvWalkGpeList");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Walk the interrupt level descriptor list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXruptInfo = AcpiGbl_GpeXruptListHead;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (GpeXruptInfo)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Walk all Gpe Blocks attached to this interrupt level */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock = GpeXruptInfo->GpeBlockListHead;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (GpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* One callback per GPE block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = GpeWalkCallback (GpeXruptInfo, GpeBlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto UnlockAndExit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock = GpeBlock->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXruptInfo = GpeXruptInfo->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteUnlockAndExit:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvDeleteGpeHandlers
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: GpeXruptInfo - GPE Interrupt info
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * GpeBlock - Gpe Block info
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Delete all Handler objects found in the GPE data structs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used only prior to termination.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvDeleteGpeHandlers (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_EVENT_INFO *GpeEventInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NATIVE_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NATIVE_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvDeleteGpeHandlers");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Examine each GPE Register within the block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < GpeBlock->RegisterCount; i++)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now look at the individual GPEs in this byte register */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_DISPATCH_HANDLER)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEM_FREE (GpeEventInfo->Dispatch.Handler);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo->Dispatch.Handler = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvSaveMethodInfo
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: Callback from WalkNamespace
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * control method under the _GPE portion of the namespace.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Extract the name and GPE type from the object, saving this
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information for quick lookup during GPE dispatch
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The name of each GPE control method is of the form:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * "_Lxx" or "_Exx"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Where:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * L - means that the GPE is level triggered
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * E - means that the GPE is edge triggered
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * xx - is the GPE number [in HEX]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvSaveMethodInfo (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_HANDLE ObjHandle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 Level,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *ObjDesc,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void **ReturnValue)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock = (void *) ObjDesc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_EVENT_INFO *GpeEventInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 GpeNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char Name[ACPI_NAME_SIZE + 1];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT8 Type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvSaveMethodInfo");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * _Lxx and _Exx GPE method support
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1) Extract the name from the object and convert to a string
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MOVE_32_TO_32 (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Name[ACPI_NAME_SIZE] = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2) Edge/Level determination is based on the 2nd character
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of the method name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if a _PRW object is found that points to this GPE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (Name[1])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'L':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Type = ACPI_GPE_LEVEL_TRIGGERED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'E':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Type = ACPI_GPE_EDGE_TRIGGERED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Unknown method type, just ignore it! */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_ERROR ((AE_INFO,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Unknown GPE method type: %s (name not of form _Lxx or _Exx)",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Convert the last two characters of the name to the GPE Number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeNumber == ACPI_UINT32_MAX)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Conversion failed; invalid method, just ignore it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_ERROR ((AE_INFO,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Ensure that we have a valid GPE number for this GPE block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((GpeNumber < GpeBlock->BlockBaseNumber) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (GpeNumber >= (GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Not valid for this GPE block, just ignore it
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * However, it may be valid for a different GPE block, since GPE0 and GPE1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * methods both appear under \_GPE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now we can add this information to the GpeEventInfo block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for use during dispatch of this GPE. Default type is RUNTIME, although
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * this may change when the _PRW methods are executed later.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo->Flags = (UINT8)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (Type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo->Dispatch.MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Update enable mask, but don't enable the HW GPE as of yet */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiEvEnableGpe (GpeEventInfo, FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Registered GPE method %s as GPE number 0x%.2X\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Name, GpeNumber));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvMatchPrwAndGpe
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: Callback from WalkNamespace
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * not aborted on a single _PRW failure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Device. Run the _PRW method. If present, extract the GPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * number and mark the GPE as a WAKE GPE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvMatchPrwAndGpe (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_HANDLE ObjHandle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 Level,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *Info,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void **ReturnValue)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_WALK_INFO *GpeInfo = (void *) Info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NAMESPACE_NODE *GpeDevice;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NAMESPACE_NODE *TargetGpeDevice;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_EVENT_INFO *GpeEventInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_OPERAND_OBJECT *PkgDesc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_OPERAND_OBJECT *ObjDesc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 GpeNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvMatchPrwAndGpe");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for a _PRW method under this device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiUtEvaluateObject (ObjHandle, METHOD_NAME__PRW,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_BTYPE_PACKAGE, &PkgDesc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Ignore all errors from _PRW, we don't want to abort the subsystem */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* The returned _PRW package must have at least two elements */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (PkgDesc->Package.Count < 2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto Cleanup;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Extract pointers from the input context */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeDevice = GpeInfo->GpeDevice;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock = GpeInfo->GpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The _PRW object must return a package, we are only interested
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in the first element
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ObjDesc = PkgDesc->Package.Elements[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Use FADT-defined GPE device (from definition of _PRW) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TargetGpeDevice = AcpiGbl_FadtGpeDevice;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Integer is the GPE number in the FADT described GPE blocks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeNumber = (UINT32) ObjDesc->Integer.Value;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Package contains a GPE reference and GPE number within a GPE block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ObjDesc->Package.Count < 2) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[1]) != ACPI_TYPE_INTEGER))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto Cleanup;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get GPE block reference and decode */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TargetGpeDevice = ObjDesc->Package.Elements[0]->Reference.Node;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeNumber = (UINT32) ObjDesc->Package.Elements[1]->Integer.Value;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Unknown type, just ignore it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto Cleanup;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Is this GPE within this block?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * TRUE iff these conditions are true:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1) The GPE devices match.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2) The GPE index(number) is within the range of the Gpe Block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * associated with the GPE device.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((GpeDevice == TargetGpeDevice) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (GpeNumber >= GpeBlock->BlockBaseNumber) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo->Flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiEvSetGpeType (GpeEventInfo, ACPI_GPE_TYPE_WAKE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto Cleanup;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteCleanup:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiUtRemoveReference (PkgDesc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvGetGpeXruptBlock
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: InterruptNumber - Interrupt for a GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: A GPE interrupt block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * block per unique interrupt level used for GPEs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Should be called only when the GPE lists are semaphore locked
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and not subject to change.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_GPE_XRUPT_INFO *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvGetGpeXruptBlock (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 InterruptNumber)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_XRUPT_INFO *GpeXrupt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_CPU_FLAGS Flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvGetGpeXruptBlock");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* No need for lock since we are not changing any list elements here */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NextGpeXrupt = AcpiGbl_GpeXruptListHead;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (NextGpeXrupt)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NextGpeXrupt->InterruptNumber == InterruptNumber)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_PTR (NextGpeXrupt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NextGpeXrupt = NextGpeXrupt->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Not found, must allocate a new xrupt descriptor */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXrupt = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_XRUPT_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!GpeXrupt)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_PTR (NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXrupt->InterruptNumber = InterruptNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Install new interrupt descriptor with spin lock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (AcpiGbl_GpeXruptListHead)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NextGpeXrupt = AcpiGbl_GpeXruptListHead;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (NextGpeXrupt->Next)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NextGpeXrupt = NextGpeXrupt->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NextGpeXrupt->Next = GpeXrupt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXrupt->Previous = NextGpeXrupt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiGbl_GpeXruptListHead = GpeXrupt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Install new interrupt handler if not SCI_INT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (InterruptNumber != AcpiGbl_FADT->SciInt)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiOsInstallInterruptHandler (InterruptNumber,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiEvGpeXruptHandler, GpeXrupt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_ERROR ((AE_INFO,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Could not install GPE interrupt handler at level 0x%X",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InterruptNumber));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_PTR (NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_PTR (GpeXrupt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvDeleteGpeXrupt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: GpeXrupt - A GPE interrupt info block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * interrupt handler if not the SCI interrupt.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvDeleteGpeXrupt (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_XRUPT_INFO *GpeXrupt)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_CPU_FLAGS Flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvDeleteGpeXrupt");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* We never want to remove the SCI interrupt handler */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeXrupt->InterruptNumber == AcpiGbl_FADT->SciInt)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXrupt->GpeBlockListHead = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Disable this interrupt */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiOsRemoveInterruptHandler (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Unlink the interrupt block with lock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeXrupt->Previous)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXrupt->Previous->Next = GpeXrupt->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeXrupt->Next)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXrupt->Next->Previous = GpeXrupt->Previous;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Free the block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEM_FREE (GpeXrupt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvInstallGpeBlock
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: GpeBlock - New GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * InterruptNumber - Xrupt to be associated with this GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Install new GPE block with mutex support
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvInstallGpeBlock (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 InterruptNumber)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *NextGpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_CPU_FLAGS Flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXruptBlock = AcpiEvGetGpeXruptBlock (InterruptNumber);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!GpeXruptBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AE_NO_MEMORY;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto UnlockAndExit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Install the new block at the end of the list with lock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeXruptBlock->GpeBlockListHead)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NextGpeBlock = GpeXruptBlock->GpeBlockListHead;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (NextGpeBlock->Next)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NextGpeBlock = NextGpeBlock->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NextGpeBlock->Next = GpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->Previous = NextGpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeXruptBlock->GpeBlockListHead = GpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->XruptBlock = GpeXruptBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteUnlockAndExit:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvDeleteGpeBlock
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: GpeBlock - Existing GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Remove a GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvDeleteGpeBlock (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_CPU_FLAGS Flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Disable all GPEs in this block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!GpeBlock->Previous && !GpeBlock->Next)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This is the last GpeBlock on this interrupt */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiEvDeleteGpeXrupt (GpeBlock->XruptBlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto UnlockAndExit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Remove the block on this interrupt with lock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeBlock->Previous)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->Previous->Next = GpeBlock->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->XruptBlock->GpeBlockListHead = GpeBlock->Next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeBlock->Next)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->Next->Previous = GpeBlock->Previous;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Free the GpeBlock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEM_FREE (GpeBlock->RegisterInfo);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEM_FREE (GpeBlock->EventInfo);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEM_FREE (GpeBlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteUnlockAndExit:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvCreateGpeInfoBlocks
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: GpeBlock - New GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Create the RegisterInfo and EventInfo blocks for this GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvCreateGpeInfoBlocks (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_REGISTER_INFO *GpeRegisterInfo = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_EVENT_INFO *GpeEventInfo = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_EVENT_INFO *ThisEvent;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_REGISTER_INFO *ThisRegister;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NATIVE_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NATIVE_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvCreateGpeInfoBlocks");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate the GPE register information block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeRegisterInfo = ACPI_MEM_CALLOCATE (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ACPI_SIZE) GpeBlock->RegisterCount *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (ACPI_GPE_REGISTER_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!GpeRegisterInfo)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_ERROR ((AE_INFO,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Could not allocate the GpeRegisterInfo table"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_NO_MEMORY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Allocate the GPE EventInfo block. There are eight distinct GPEs
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * per register. Initialization to zeros is sufficient.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo = ACPI_MEM_CALLOCATE (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((ACPI_SIZE) GpeBlock->RegisterCount *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_REGISTER_WIDTH) *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (ACPI_GPE_EVENT_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!GpeEventInfo)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_ERROR ((AE_INFO,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Could not allocate the GpeEventInfo table"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AE_NO_MEMORY;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto ErrorExit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Save the new Info arrays in the GPE block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->RegisterInfo = GpeRegisterInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->EventInfo = GpeEventInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Initialize the GPE Register and Event structures. A goal of these
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tables is to hide the fact that there are two separate GPE register sets
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in a given GPE hardware block, the status registers occupy the first half,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and the enable registers occupy the second half.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisRegister = GpeRegisterInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisEvent = GpeEventInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < GpeBlock->RegisterCount; i++)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Init the RegisterInfo for this GPE register (8 GPEs) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisRegister->BaseGpeNumber = (UINT8) (GpeBlock->BlockBaseNumber +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (i * ACPI_GPE_REGISTER_WIDTH));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STORE_ADDRESS (ThisRegister->StatusAddress.Address,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte + i));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STORE_ADDRESS (ThisRegister->EnableAddress.Address,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte + i
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte + GpeBlock->RegisterCount));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisRegister->StatusAddress.AddressSpaceId = GpeBlock->BlockAddress.AddressSpaceId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisRegister->EnableAddress.AddressSpaceId = GpeBlock->BlockAddress.AddressSpaceId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisRegister->StatusAddress.RegisterBitWidth = ACPI_GPE_REGISTER_WIDTH;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisRegister->EnableAddress.RegisterBitWidth = ACPI_GPE_REGISTER_WIDTH;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisRegister->StatusAddress.RegisterBitOffset = ACPI_GPE_REGISTER_WIDTH;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisRegister->EnableAddress.RegisterBitOffset = ACPI_GPE_REGISTER_WIDTH;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Init the EventInfo for each GPE within this register */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisEvent->RegisterBit = AcpiGbl_DecodeTo8bit[j];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisEvent->RegisterInfo = ThisRegister;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisEvent++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Disable all GPEs within this register */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &ThisRegister->EnableAddress);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto ErrorExit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Clear any pending GPE events within this register */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0xFF,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &ThisRegister->StatusAddress);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto ErrorExit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ThisRegister++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteErrorExit:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeRegisterInfo)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEM_FREE (GpeRegisterInfo);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeEventInfo)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEM_FREE (GpeEventInfo);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvCreateGpeBlock
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: GpeDevice - Handle to the parent GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * GpeBlockAddress - Address and SpaceID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RegisterCount - Number of GPE register pairs in the block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * GpeBlockBaseNumber - Starting GPE number for the block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * InterruptNumber - H/W interrupt for the block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ReturnGpeBlock - Where the new block descriptor is returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the block are disabled at exit.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: Assumes namespace is locked.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvCreateGpeBlock (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NAMESPACE_NODE *GpeDevice,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GENERIC_ADDRESS *GpeBlockAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 RegisterCount,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT8 GpeBlockBaseNumber,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 InterruptNumber,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO **ReturnGpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvCreateGpeBlock");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!RegisterCount)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate a new GPE block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_BLOCK_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!GpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_NO_MEMORY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Initialize the new GPE block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->Node = GpeDevice;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->RegisterCount = RegisterCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (ACPI_GENERIC_ADDRESS));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Create the RegisterInfo and EventInfo sub-structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: disables and clears all GPEs in the block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiEvCreateGpeInfoBlocks (GpeBlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEM_FREE (GpeBlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Install the new block in the global lists */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_MEM_FREE (GpeBlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Find all GPE methods (_Lxx, _Exx) for this block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiEvSaveMethodInfo, GpeBlock, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return the new block */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ReturnGpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*ReturnGpeBlock) = GpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (UINT32) GpeBlock->BlockBaseNumber,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (UINT32) (GpeBlock->BlockBaseNumber +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeDevice->Name.Ascii,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock->RegisterCount,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte InterruptNumber));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvInitializeGpeBlock
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: GpeDevice - Handle to the parent GPE block
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * GpeBlock - Gpe Block info
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Initialize and enable a GPE block. First find and run any
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * _PRT methods associated with the block, then enable the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * appropriate GPEs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: Assumes namespace is locked.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvInitializeGpeBlock (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NAMESPACE_NODE *GpeDevice,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_BLOCK_INFO *GpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_EVENT_INFO *GpeEventInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GPE_WALK_INFO GpeInfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 WakeGpeCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 GpeEnabledCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NATIVE_UINT i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_NATIVE_UINT j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvInitializeGpeBlock");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!GpeBlock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (AE_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Runtime option: Should wake GPEs be enabled at runtime? The default
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is no, they should only be enabled just as the machine goes to sleep.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (AcpiGbl_LeaveWakeGpesDisabled)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Differentiate runtime vs wake GPEs, via the _PRW control methods.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Each GPE that has one or more _PRWs that reference it is by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * definition a wake GPE and will not be enabled while the machine
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is running.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeInfo.GpeBlock = GpeBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeInfo.GpeDevice = GpeDevice;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiEvMatchPrwAndGpe, &GpeInfo, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Enable all GPEs in this block that have these attributes:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1) are "runtime" or "run/wake" GPEs, and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2) have a corresponding _Lxx or _Exx method
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Any other GPEs within this block must be enabled via the AcpiEnableGpe()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * external interface.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WakeGpeCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEnabledCount = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < GpeBlock->RegisterCount; i++)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < 8; j++)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the info block for this particular GPE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (GpeEventInfo->Flags & ACPI_GPE_TYPE_RUNTIME))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeEnabledCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (GpeEventInfo->Flags & ACPI_GPE_TYPE_WAKE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WakeGpeCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte WakeGpeCount, GpeEnabledCount));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Enable all valid runtime GPEs found above */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_ERROR ((AE_INFO, "Could not enable GPEs in GpeBlock %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeBlock));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*******************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: AcpiEvGpeInitialize
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PARAMETERS: None
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURN: Status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DESCRIPTION: Initialize the GPE data structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ******************************************************************************/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteACPI_STATUS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteAcpiEvGpeInitialize (
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 RegisterCount0 = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 RegisterCount1 = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte UINT32 GpeNumberMax = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_STATUS Status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_FUNCTION_TRACE ("EvGpeInitialize");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return_ACPI_STATUS (Status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Initialize the GPE Block(s) defined in the FADT
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Why the GPE register block lengths are divided by 2: From the ACPI Spec,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * section "General-Purpose Event Registers", we have:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * "Each register block contains two registers of equal length
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The length of the GPE1_STS and GPE1_EN registers is equal to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * half the GPE1_LEN. If a generic register block is not supported
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * then its respective block pointer and block length values in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to be the same size."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Determine the maximum GPE number for this machine.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: both GPE0 and GPE1 are optional, and either can exist without
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the other.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If EITHER the register length OR the block address are zero, then that
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * particular block is not supported.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (AcpiGbl_FADT->Gpe0BlkLen &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* GPE block 0 exists (has both length and address > 0) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RegisterCount0 = (UINT16) (AcpiGbl_FADT->Gpe0BlkLen / 2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Install GPE Block 0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &AcpiGbl_FADT->XGpe0Blk, RegisterCount0, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ACPI_FAILURE (Status))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_EXCEPTION ((AE_INFO, Status,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Could not create GPE Block 0"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (AcpiGbl_FADT->Gpe1BlkLen &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* GPE block 1 exists (has both length and address > 0) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RegisterCount1 = (UINT16) (AcpiGbl_FADT->Gpe1BlkLen / 2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for GPE0/GPE1 overlap (if both banks exist) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((RegisterCount0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (GpeNumberMax >= AcpiGbl_FADT->Gpe1Base))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ACPI_ERROR ((AE_INFO,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GpeNumberMax, AcpiGbl_FADT->Gpe1Base,
AcpiGbl_FADT->Gpe1Base +
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
/* Ignore GPE1 block by setting the register count to zero */
RegisterCount1 = 0;
}
else
{
/* Install GPE Block 1 */
Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
&AcpiGbl_FADT->XGpe1Blk, RegisterCount1,
AcpiGbl_FADT->Gpe1Base,
AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[1]);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not create GPE Block 1"));
}
/*
* GPE0 and GPE1 do not have to be contiguous in the GPE number
* space. However, GPE0 always starts at GPE number zero.
*/
GpeNumberMax = AcpiGbl_FADT->Gpe1Base +
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1);
}
}
/* Exit if there are no GPE registers */
if ((RegisterCount0 + RegisterCount1) == 0)
{
/* GPEs are not required by ACPI, this is OK */
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"There are no GPE blocks defined in the FADT\n"));
Status = AE_OK;
goto Cleanup;
}
/* Check for Max GPE number out-of-range */
if (GpeNumberMax > ACPI_GPE_MAX)
{
ACPI_ERROR ((AE_INFO,
"Maximum GPE number from FADT is too large: 0x%X",
GpeNumberMax));
Status = AE_BAD_VALUE;
goto Cleanup;
}
Cleanup:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_OK);
}