/******************************************************************************
*
* Module Name: utinit - Common ACPI subsystem 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 "acnamesp.h"
#include "acevents.h"
#include "actables.h"
ACPI_MODULE_NAME ("utinit")
/* Local prototypes */
static void AcpiUtTerminate (
void);
#if (!ACPI_REDUCED_HARDWARE)
static void
void);
#else
#define AcpiUtFreeGpeLists()
#endif /* !ACPI_REDUCED_HARDWARE */
#if (!ACPI_REDUCED_HARDWARE)
/******************************************************************************
*
* FUNCTION: AcpiUtFreeGpeLists
*
* PARAMETERS: none
*
* RETURN: none
*
* DESCRIPTION: Free global GPE lists
*
******************************************************************************/
static void
void)
{
/* Free global GPE blocks and related info structures */
while (GpeXruptInfo)
{
while (GpeBlock)
{
}
}
}
#endif /* !ACPI_REDUCED_HARDWARE */
/*******************************************************************************
*
* FUNCTION: AcpiUtInitGlobals
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Initialize ACPICA globals. All globals that require specific
* initialization should be initialized here. This allows for
* a warm restart.
*
******************************************************************************/
void)
{
UINT32 i;
/* Create all memory caches */
Status = AcpiUtCreateCaches ();
if (ACPI_FAILURE (Status))
{
}
/* Address Range lists */
for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
{
AcpiGbl_AddressRangeList[i] = NULL;
}
/* Mutex locked flags */
for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
AcpiGbl_MutexInfo[i].UseCount = 0;
}
for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
{
AcpiGbl_OwnerIdMask[i] = 0;
}
/* Last OwnerID is never valid */
/* Event counters */
AcpiMethodCount = 0;
AcpiSciCount = 0;
AcpiGpeCount = 0;
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
AcpiFixedEventCount[i] = 0;
}
#if (!ACPI_REDUCED_HARDWARE)
AcpiGbl_GpeFadtBlocks[0] = NULL;
AcpiCurrentGpeCount = 0;
#endif /* !ACPI_REDUCED_HARDWARE */
/* Global handlers */
/* Global Lock support */
/* Miscellaneous variables */
AcpiGbl_DSDT = NULL;
AcpiGbl_PsFindCount = 0;
AcpiGbl_MaxLoopIterations = 0xFFFF;
/* Hardware oriented */
/* Namespace */
#ifdef ACPI_DISASSEMBLER
#endif
#ifdef ACPI_DEBUG_OUTPUT
#endif
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
#endif
}
/******************************************************************************
*
* FUNCTION: AcpiUtTerminate
*
* PARAMETERS: none
*
* RETURN: none
*
* DESCRIPTION: Free global memory
*
******************************************************************************/
static void
void)
{
}
/*******************************************************************************
*
* FUNCTION: AcpiUtSubsystemShutdown
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Shutdown the various components. Do not delete the mutex
* objects here, because the AML debugger may be still running.
*
******************************************************************************/
void
void)
{
/* Just exit if subsystem is already shutdown */
if (AcpiGbl_Shutdown)
{
}
/* Subsystem appears active, go ahead and shut it down */
AcpiGbl_StartupFlags = 0;
#ifndef ACPI_ASL_COMPILER
/* Close the AcpiEvent Handling */
AcpiEvTerminate ();
/* Delete any dynamic _OSI interfaces */
#endif
/* Close the Namespace */
AcpiNsTerminate ();
/* Delete the ACPI tables */
AcpiTbTerminate ();
/* Close the globals */
AcpiUtTerminate ();
/* Purge the local caches */
(void) AcpiUtDeleteCaches ();
}