utinit.c revision 210976
1260684Skaiw/******************************************************************************
2260684Skaiw *
3260684Skaiw * Module Name: utinit - Common ACPI subsystem initialization
4260684Skaiw *
5260684Skaiw *****************************************************************************/
6260684Skaiw
7260684Skaiw/******************************************************************************
8260684Skaiw *
9260684Skaiw * 1. Copyright Notice
10260684Skaiw *
11260684Skaiw * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12260684Skaiw * All rights reserved.
13260684Skaiw *
14260684Skaiw * 2. License
15260684Skaiw *
16260684Skaiw * 2.1. This is your license from Intel Corp. under its intellectual property
17260684Skaiw * rights.  You may have additional license terms from the party that provided
18260684Skaiw * you this software, covering your right to use that party's intellectual
19260684Skaiw * property rights.
20260684Skaiw *
21260684Skaiw * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22260684Skaiw * copy of the source code appearing in this file ("Covered Code") an
23260684Skaiw * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24260684Skaiw * base code distributed originally by Intel ("Original Intel Code") to copy,
25367466Sdim * make derivatives, distribute, use and display any portion of the Covered
26260684Skaiw * Code in any form, with the right to sublicense such rights; and
27260684Skaiw *
28367466Sdim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29260684Skaiw * license (with the right to sublicense), under only those claims of Intel
30260684Skaiw * patents that are infringed by the Original Intel Code, to make, use, sell,
31260684Skaiw * offer to sell, and import the Covered Code and derivative works thereof
32260684Skaiw * solely to the minimum extent necessary to exercise the above copyright
33260684Skaiw * license, and in no event shall the patent license extend to any additions
34260684Skaiw * to or modifications of the Original Intel Code.  No other license or right
35260684Skaiw * is granted directly or by implication, estoppel or otherwise;
36260684Skaiw *
37260684Skaiw * The above copyright and patent license is granted only if the following
38260684Skaiw * conditions are met:
39260684Skaiw *
40260684Skaiw * 3. Conditions
41260684Skaiw *
42260684Skaiw * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43260684Skaiw * Redistribution of source code of any substantial portion of the Covered
44260684Skaiw * Code or modification with rights to further distribute source must include
45260684Skaiw * the above Copyright Notice, the above License, this list of Conditions,
46260684Skaiw * and the following Disclaimer and Export Compliance provision.  In addition,
47260684Skaiw * Licensee must cause all Covered Code to which Licensee contributes to
48260684Skaiw * contain a file documenting the changes Licensee made to create that Covered
49260684Skaiw * Code and the date of any change.  Licensee must include in that file the
50260684Skaiw * documentation of any changes made by any predecessor Licensee.  Licensee
51260684Skaiw * must include a prominent statement that the modification is derived,
52260684Skaiw * directly or indirectly, from Original Intel Code.
53260684Skaiw *
54260684Skaiw * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55260684Skaiw * Redistribution of source code of any substantial portion of the Covered
56260684Skaiw * Code or modification without rights to further distribute source must
57260684Skaiw * include the following Disclaimer and Export Compliance provision in the
58260684Skaiw * documentation and/or other materials provided with distribution.  In
59260684Skaiw * addition, Licensee may not authorize further sublicense of source of any
60260684Skaiw * portion of the Covered Code, and must include terms to the effect that the
61260684Skaiw * license from Licensee to its licensee is limited to the intellectual
62260684Skaiw * property embodied in the software Licensee provides to its licensee, and
63260684Skaiw * not to intellectual property embodied in modifications its licensee may
64260684Skaiw * make.
65260684Skaiw *
66260684Skaiw * 3.3. Redistribution of Executable. Redistribution in executable form of any
67260684Skaiw * substantial portion of the Covered Code or modification must reproduce the
68260684Skaiw * above Copyright Notice, and the following Disclaimer and Export Compliance
69260684Skaiw * provision in the documentation and/or other materials provided with the
70260684Skaiw * distribution.
71260684Skaiw *
72260684Skaiw * 3.4. Intel retains all right, title, and interest in and to the Original
73260684Skaiw * Intel Code.
74260684Skaiw *
75260684Skaiw * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76260684Skaiw * Intel shall be used in advertising or otherwise to promote the sale, use or
77260684Skaiw * other dealings in products derived from or relating to the Covered Code
78260684Skaiw * without prior written authorization from Intel.
79260684Skaiw *
80260684Skaiw * 4. Disclaimer and Export Compliance
81260684Skaiw *
82260684Skaiw * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83260684Skaiw * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84260684Skaiw * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85260684Skaiw * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86260684Skaiw * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87260684Skaiw * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88260684Skaiw * PARTICULAR PURPOSE.
89260684Skaiw *
90260684Skaiw * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91260684Skaiw * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92260684Skaiw * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93260684Skaiw * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94260684Skaiw * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95260684Skaiw * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96260684Skaiw * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97260684Skaiw * LIMITED REMEDY.
98260684Skaiw *
99260684Skaiw * 4.3. Licensee shall not export, either directly or indirectly, any of this
100260684Skaiw * software or system incorporating such software without first obtaining any
101260684Skaiw * required license or other approval from the U. S. Department of Commerce or
102260684Skaiw * any other agency or department of the United States Government.  In the
103260684Skaiw * event Licensee exports any such software from the United States or
104260684Skaiw * re-exports any such software from a foreign destination, Licensee shall
105260684Skaiw * ensure that the distribution and export/re-export of the software is in
106260684Skaiw * compliance with all laws, regulations, orders, or other restrictions of the
107260684Skaiw * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108260684Skaiw * any of its subsidiaries will export/re-export any technical data, process,
109260684Skaiw * software, or service, directly or indirectly, to any country for which the
110260684Skaiw * United States government or any agency thereof requires an export license,
111260684Skaiw * other governmental approval, or letter of assurance, without first obtaining
112260684Skaiw * such license, approval or letter.
113260684Skaiw *
114260684Skaiw *****************************************************************************/
115260684Skaiw
116260684Skaiw
117260684Skaiw#define __UTINIT_C__
118260684Skaiw
119260684Skaiw#include <contrib/dev/acpica/include/acpi.h>
120367466Sdim#include <contrib/dev/acpica/include/accommon.h>
121260684Skaiw#include <contrib/dev/acpica/include/acnamesp.h>
122#include <contrib/dev/acpica/include/acevents.h>
123#include <contrib/dev/acpica/include/actables.h>
124
125#define _COMPONENT          ACPI_UTILITIES
126        ACPI_MODULE_NAME    ("utinit")
127
128/* Local prototypes */
129
130static void AcpiUtTerminate (
131    void);
132
133
134/******************************************************************************
135 *
136 * FUNCTION:    AcpiUtTerminate
137 *
138 * PARAMETERS:  none
139 *
140 * RETURN:      none
141 *
142 * DESCRIPTION: Free global memory
143 *
144 ******************************************************************************/
145
146static void
147AcpiUtTerminate (
148    void)
149{
150    ACPI_GPE_BLOCK_INFO     *GpeBlock;
151    ACPI_GPE_BLOCK_INFO     *NextGpeBlock;
152    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo;
153    ACPI_GPE_XRUPT_INFO     *NextGpeXruptInfo;
154
155
156    ACPI_FUNCTION_TRACE (UtTerminate);
157
158
159    /* Free global GPE blocks and related info structures */
160
161    GpeXruptInfo = AcpiGbl_GpeXruptListHead;
162    while (GpeXruptInfo)
163    {
164        GpeBlock = GpeXruptInfo->GpeBlockListHead;
165        while (GpeBlock)
166        {
167            NextGpeBlock = GpeBlock->Next;
168            ACPI_FREE (GpeBlock->EventInfo);
169            ACPI_FREE (GpeBlock->RegisterInfo);
170            ACPI_FREE (GpeBlock);
171
172            GpeBlock = NextGpeBlock;
173        }
174        NextGpeXruptInfo = GpeXruptInfo->Next;
175        ACPI_FREE (GpeXruptInfo);
176        GpeXruptInfo = NextGpeXruptInfo;
177    }
178
179    return_VOID;
180}
181
182
183/*******************************************************************************
184 *
185 * FUNCTION:    AcpiUtSubsystemShutdown
186 *
187 * PARAMETERS:  None
188 *
189 * RETURN:      None
190 *
191 * DESCRIPTION: Shutdown the various components. Do not delete the mutex
192 *              objects here, because the AML debugger may be still running.
193 *
194 ******************************************************************************/
195
196void
197AcpiUtSubsystemShutdown (
198    void)
199{
200    ACPI_FUNCTION_TRACE (UtSubsystemShutdown);
201
202
203#ifndef ACPI_ASL_COMPILER
204
205    /* Close the AcpiEvent Handling */
206
207    AcpiEvTerminate ();
208
209    /* Delete any dynamic _OSI interfaces */
210
211    AcpiUtInterfaceTerminate ();
212#endif
213
214    /* Close the Namespace */
215
216    AcpiNsTerminate ();
217
218    /* Delete the ACPI tables */
219
220    AcpiTbTerminate ();
221
222    /* Close the globals */
223
224    AcpiUtTerminate ();
225
226    /* Purge the local caches */
227
228    (void) AcpiUtDeleteCaches ();
229    return_VOID;
230}
231
232
233