/******************************************************************************
*
* Module Name: evgpeutil - GPE utilities
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
ACPI_MODULE_NAME ("evgpeutil")
#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/*******************************************************************************
*
* FUNCTION: AcpiEvWalkGpeList
*
* PARAMETERS: GpeWalkCallback - Routine called for each GPE block
* Context - Value passed to callback
*
* RETURN: Status
*
* DESCRIPTION: Walk the GPE lists.
*
******************************************************************************/
void *Context)
{
/* Walk the interrupt level descriptor list */
while (GpeXruptInfo)
{
/* Walk all Gpe Blocks attached to this interrupt level */
while (GpeBlock)
{
/* One callback per GPE block */
if (ACPI_FAILURE (Status))
{
{
}
goto UnlockAndExit;
}
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiEvGetGpeDevice
*
* PARAMETERS: GPE_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE
* block device. NULL if the GPE is one of the FADT-defined GPEs.
*
******************************************************************************/
void *Context)
{
/* Increment Index by the number of GPEs in this block */
{
/*
* The GPE index is within this block, get the node. Leave the node
* NULL for the FADT-defined GPEs
*/
{
}
return (AE_CTRL_END);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvGetGpeXruptBlock
*
* PARAMETERS: InterruptNumber - Interrupt for a GPE block
* GpeXruptBlock - Where the block is returned
*
* RETURN: Status
*
* DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
* block per unique interrupt level used for GPEs. Should be
* called only when the GPE lists are semaphore locked and not
* subject to change.
*
******************************************************************************/
{
/* No need for lock since we are not changing any list elements here */
while (NextGpeXrupt)
{
{
}
}
/* Not found, must allocate a new xrupt descriptor */
if (!GpeXrupt)
{
}
/* Install new interrupt descriptor with spin lock */
{
while (NextGpeXrupt->Next)
{
}
}
else
{
}
/* Install new interrupt handler if not SCI_INT */
{
if (ACPI_FAILURE (Status))
{
"Could not install GPE interrupt handler at level 0x%X",
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiEvDeleteGpeXrupt
*
* PARAMETERS: GpeXrupt - A GPE interrupt info block
*
* RETURN: Status
*
* DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
* interrupt handler if not the SCI interrupt.
*
******************************************************************************/
{
/* We never want to remove the SCI interrupt handler */
{
}
/* Disable this interrupt */
if (ACPI_FAILURE (Status))
{
}
/* Unlink the interrupt block with lock */
{
}
else
{
/* No previous, update list head */
}
{
}
/* Free the block */
}
/*******************************************************************************
*
* FUNCTION: AcpiEvDeleteGpeHandlers
*
* PARAMETERS: GpeXruptInfo - GPE Interrupt info
* GpeBlock - Gpe Block info
*
* RETURN: Status
*
* DESCRIPTION: Delete all Handler objects found in the GPE data structs.
* Used only prior to termination.
*
******************************************************************************/
void *Context)
{
UINT32 i;
UINT32 j;
/* Examine each GPE Register within the block */
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
/* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
ACPI_GPE_REGISTER_WIDTH) + j];
{
/* Delete an installed handler block */
}
{
/* Delete the implicit notification device list */
while (Notify)
{
}
}
}
}
}
#endif /* !ACPI_REDUCED_HARDWARE */