/******************************************************************************
*
* Module Name: evgpeblk - GPE block creation and initialization.
*
*****************************************************************************/
/*
* 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"
#include "acnamesp.h"
ACPI_MODULE_NAME ("evgpeblk")
#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/* Local prototypes */
static ACPI_STATUS
static ACPI_STATUS
/*******************************************************************************
*
* FUNCTION: AcpiEvInstallGpeBlock
*
* PARAMETERS: GpeBlock - New GPE block
* InterruptNumber - Xrupt to be associated with this
* GPE block
*
* RETURN: Status
*
* DESCRIPTION: Install new GPE block with mutex support
*
******************************************************************************/
static ACPI_STATUS
{
if (ACPI_FAILURE (Status))
{
}
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Install the new block at the end of the list with lock */
{
while (NextGpeBlock->Next)
{
}
}
else
{
}
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvDeleteGpeBlock
*
* PARAMETERS: GpeBlock - Existing GPE block
*
* RETURN: Status
*
* DESCRIPTION: Remove a GPE block
*
******************************************************************************/
{
if (ACPI_FAILURE (Status))
{
}
/* Disable all GPEs in this block */
{
/* This is the last GpeBlock on this interrupt */
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
}
else
{
/* Remove the block on this interrupt with lock */
{
}
else
{
}
{
}
}
/* Free the GpeBlock */
}
/*******************************************************************************
*
* FUNCTION: AcpiEvCreateGpeInfoBlocks
*
* PARAMETERS: GpeBlock - New GPE block
*
* RETURN: Status
*
* DESCRIPTION: Create the RegisterInfo and EventInfo blocks for this GPE block
*
******************************************************************************/
static ACPI_STATUS
{
UINT32 i;
UINT32 j;
/* Allocate the GPE register information block */
sizeof (ACPI_GPE_REGISTER_INFO));
if (!GpeRegisterInfo)
{
"Could not allocate the GpeRegisterInfo table"));
}
/*
* Allocate the GPE EventInfo block. There are eight distinct GPEs
* per register. Initialization to zeros is sufficient.
*/
sizeof (ACPI_GPE_EVENT_INFO));
if (!GpeEventInfo)
{
"Could not allocate the GpeEventInfo table"));
goto ErrorExit;
}
/* Save the new Info arrays in the GPE block */
/*
* Initialize the GPE Register and Event structures. A goal of these
* tables is to hide the fact that there are two separate GPE register
* sets in a given GPE hardware block, the status registers occupy the
* first half, and the enable registers occupy the second half.
*/
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
/* Init the RegisterInfo for this GPE register (8 GPEs) */
/* Init the EventInfo for each GPE within this register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
ThisEvent++;
}
/* Disable all GPEs within this register */
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
/* Clear any pending GPE events within this register */
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
ThisRegister++;
}
if (GpeRegisterInfo)
{
}
if (GpeEventInfo)
{
}
}
/*******************************************************************************
*
* FUNCTION: AcpiEvCreateGpeBlock
*
* PARAMETERS: GpeDevice - Handle to the parent GPE block
* GpeBlockAddress - Address and SpaceID
* RegisterCount - Number of GPE register pairs in the block
* GpeBlockBaseNumber - Starting GPE number for the block
* InterruptNumber - H/W interrupt for the block
* ReturnGpeBlock - Where the new block descriptor is returned
*
* RETURN: Status
*
* DESCRIPTION: Create and Install a block of GPE registers. All GPEs within
* the block are disabled at exit.
* Note: Assumes namespace is locked.
*
******************************************************************************/
{
if (!RegisterCount)
{
}
/* Allocate a new GPE block */
if (!GpeBlock)
{
}
/* Initialize the new GPE block */
/*
* Create the RegisterInfo and EventInfo sub-structures
* Note: disables and clears all GPEs in the block
*/
if (ACPI_FAILURE (Status))
{
}
/* Install the new block in the global lists */
if (ACPI_FAILURE (Status))
{
}
/* Find all GPE methods (_Lxx or_Exx) for this block */
/* Return the new block */
if (ReturnGpeBlock)
{
(*ReturnGpeBlock) = GpeBlock;
}
" Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n",
/* Update global count of currently available GPEs */
}
/*******************************************************************************
*
* FUNCTION: AcpiEvInitializeGpeBlock
*
* PARAMETERS: ACPI_GPE_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Initialize and enable a GPE block. Enable GPEs that have
* associated methods.
* Note: Assumes namespace is locked.
*
******************************************************************************/
void *Ignored)
{
UINT32 i;
UINT32 j;
/*
* Ignore a null GPE block (e.g., if no GPE block 1 exists), and
* any GPE blocks that have been initialized already.
*/
{
}
/*
* Enable all GPEs that have a corresponding method and have the
* ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block
* must be enabled via the acpi_enable_gpe() interface.
*/
GpeEnabledCount = 0;
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
/* Get the info block for this particular GPE */
GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
/*
* Ignore GPEs that have no corresponding _Lxx/_Exx method
* and GPEs that are used to wake the system
*/
{
continue;
}
if (ACPI_FAILURE (Status))
{
"Could not enable GPE 0x%02X",
continue;
}
}
}
if (GpeEnabledCount)
{
ACPI_INFO ((
"Enabled %u GPEs in block %02X to %02X", GpeEnabledCount,
}
}
#endif /* !ACPI_REDUCED_HARDWARE */