utinit.c revision 1.1.1.2.2.2 1 1.1.1.2.2.2 bouyer /******************************************************************************
2 1.1.1.2.2.2 bouyer *
3 1.1.1.2.2.2 bouyer * Module Name: utinit - Common ACPI subsystem initialization
4 1.1.1.2.2.2 bouyer *
5 1.1.1.2.2.2 bouyer *****************************************************************************/
6 1.1.1.2.2.2 bouyer
7 1.1.1.2.2.2 bouyer /*
8 1.1.1.2.2.2 bouyer * Copyright (C) 2000 - 2011, Intel Corp.
9 1.1.1.2.2.2 bouyer * All rights reserved.
10 1.1.1.2.2.2 bouyer *
11 1.1.1.2.2.2 bouyer * Redistribution and use in source and binary forms, with or without
12 1.1.1.2.2.2 bouyer * modification, are permitted provided that the following conditions
13 1.1.1.2.2.2 bouyer * are met:
14 1.1.1.2.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2.2.2 bouyer * without modification.
17 1.1.1.2.2.2 bouyer * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2.2.2 bouyer * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2.2.2 bouyer * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2.2.2 bouyer * including a substantially similar Disclaimer requirement for further
21 1.1.1.2.2.2 bouyer * binary redistribution.
22 1.1.1.2.2.2 bouyer * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2.2.2 bouyer * of any contributors may be used to endorse or promote products derived
24 1.1.1.2.2.2 bouyer * from this software without specific prior written permission.
25 1.1.1.2.2.2 bouyer *
26 1.1.1.2.2.2 bouyer * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2.2.2 bouyer * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2.2.2 bouyer * Software Foundation.
29 1.1.1.2.2.2 bouyer *
30 1.1.1.2.2.2 bouyer * NO WARRANTY
31 1.1.1.2.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2.2.2 bouyer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2.2.2 bouyer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2.2.2 bouyer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2.2.2 bouyer * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2.2.2 bouyer * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2.2.2 bouyer * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2.2.2 bouyer * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2.2.2 bouyer */
43 1.1.1.2.2.2 bouyer
44 1.1.1.2.2.2 bouyer
45 1.1.1.2.2.2 bouyer #define __UTINIT_C__
46 1.1.1.2.2.2 bouyer
47 1.1.1.2.2.2 bouyer #include "acpi.h"
48 1.1.1.2.2.2 bouyer #include "accommon.h"
49 1.1.1.2.2.2 bouyer #include "acnamesp.h"
50 1.1.1.2.2.2 bouyer #include "acevents.h"
51 1.1.1.2.2.2 bouyer #include "actables.h"
52 1.1.1.2.2.2 bouyer
53 1.1.1.2.2.2 bouyer #define _COMPONENT ACPI_UTILITIES
54 1.1.1.2.2.2 bouyer ACPI_MODULE_NAME ("utinit")
55 1.1.1.2.2.2 bouyer
56 1.1.1.2.2.2 bouyer /* Local prototypes */
57 1.1.1.2.2.2 bouyer
58 1.1.1.2.2.2 bouyer static void AcpiUtTerminate (
59 1.1.1.2.2.2 bouyer void);
60 1.1.1.2.2.2 bouyer
61 1.1.1.2.2.2 bouyer
62 1.1.1.2.2.2 bouyer /******************************************************************************
63 1.1.1.2.2.2 bouyer *
64 1.1.1.2.2.2 bouyer * FUNCTION: AcpiUtTerminate
65 1.1.1.2.2.2 bouyer *
66 1.1.1.2.2.2 bouyer * PARAMETERS: none
67 1.1.1.2.2.2 bouyer *
68 1.1.1.2.2.2 bouyer * RETURN: none
69 1.1.1.2.2.2 bouyer *
70 1.1.1.2.2.2 bouyer * DESCRIPTION: Free global memory
71 1.1.1.2.2.2 bouyer *
72 1.1.1.2.2.2 bouyer ******************************************************************************/
73 1.1.1.2.2.2 bouyer
74 1.1.1.2.2.2 bouyer static void
75 1.1.1.2.2.2 bouyer AcpiUtTerminate (
76 1.1.1.2.2.2 bouyer void)
77 1.1.1.2.2.2 bouyer {
78 1.1.1.2.2.2 bouyer ACPI_GPE_BLOCK_INFO *GpeBlock;
79 1.1.1.2.2.2 bouyer ACPI_GPE_BLOCK_INFO *NextGpeBlock;
80 1.1.1.2.2.2 bouyer ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
81 1.1.1.2.2.2 bouyer ACPI_GPE_XRUPT_INFO *NextGpeXruptInfo;
82 1.1.1.2.2.2 bouyer
83 1.1.1.2.2.2 bouyer
84 1.1.1.2.2.2 bouyer ACPI_FUNCTION_TRACE (UtTerminate);
85 1.1.1.2.2.2 bouyer
86 1.1.1.2.2.2 bouyer
87 1.1.1.2.2.2 bouyer /* Free global GPE blocks and related info structures */
88 1.1.1.2.2.2 bouyer
89 1.1.1.2.2.2 bouyer GpeXruptInfo = AcpiGbl_GpeXruptListHead;
90 1.1.1.2.2.2 bouyer while (GpeXruptInfo)
91 1.1.1.2.2.2 bouyer {
92 1.1.1.2.2.2 bouyer GpeBlock = GpeXruptInfo->GpeBlockListHead;
93 1.1.1.2.2.2 bouyer while (GpeBlock)
94 1.1.1.2.2.2 bouyer {
95 1.1.1.2.2.2 bouyer NextGpeBlock = GpeBlock->Next;
96 1.1.1.2.2.2 bouyer ACPI_FREE (GpeBlock->EventInfo);
97 1.1.1.2.2.2 bouyer ACPI_FREE (GpeBlock->RegisterInfo);
98 1.1.1.2.2.2 bouyer ACPI_FREE (GpeBlock);
99 1.1.1.2.2.2 bouyer
100 1.1.1.2.2.2 bouyer GpeBlock = NextGpeBlock;
101 1.1.1.2.2.2 bouyer }
102 1.1.1.2.2.2 bouyer NextGpeXruptInfo = GpeXruptInfo->Next;
103 1.1.1.2.2.2 bouyer ACPI_FREE (GpeXruptInfo);
104 1.1.1.2.2.2 bouyer GpeXruptInfo = NextGpeXruptInfo;
105 1.1.1.2.2.2 bouyer }
106 1.1.1.2.2.2 bouyer
107 1.1.1.2.2.2 bouyer return_VOID;
108 1.1.1.2.2.2 bouyer }
109 1.1.1.2.2.2 bouyer
110 1.1.1.2.2.2 bouyer
111 1.1.1.2.2.2 bouyer /*******************************************************************************
112 1.1.1.2.2.2 bouyer *
113 1.1.1.2.2.2 bouyer * FUNCTION: AcpiUtSubsystemShutdown
114 1.1.1.2.2.2 bouyer *
115 1.1.1.2.2.2 bouyer * PARAMETERS: None
116 1.1.1.2.2.2 bouyer *
117 1.1.1.2.2.2 bouyer * RETURN: None
118 1.1.1.2.2.2 bouyer *
119 1.1.1.2.2.2 bouyer * DESCRIPTION: Shutdown the various components. Do not delete the mutex
120 1.1.1.2.2.2 bouyer * objects here, because the AML debugger may be still running.
121 1.1.1.2.2.2 bouyer *
122 1.1.1.2.2.2 bouyer ******************************************************************************/
123 1.1.1.2.2.2 bouyer
124 1.1.1.2.2.2 bouyer void
125 1.1.1.2.2.2 bouyer AcpiUtSubsystemShutdown (
126 1.1.1.2.2.2 bouyer void)
127 1.1.1.2.2.2 bouyer {
128 1.1.1.2.2.2 bouyer ACPI_FUNCTION_TRACE (UtSubsystemShutdown);
129 1.1.1.2.2.2 bouyer
130 1.1.1.2.2.2 bouyer
131 1.1.1.2.2.2 bouyer #ifndef ACPI_ASL_COMPILER
132 1.1.1.2.2.2 bouyer
133 1.1.1.2.2.2 bouyer /* Close the AcpiEvent Handling */
134 1.1.1.2.2.2 bouyer
135 1.1.1.2.2.2 bouyer AcpiEvTerminate ();
136 1.1.1.2.2.2 bouyer
137 1.1.1.2.2.2 bouyer /* Delete any dynamic _OSI interfaces */
138 1.1.1.2.2.2 bouyer
139 1.1.1.2.2.2 bouyer AcpiUtInterfaceTerminate ();
140 1.1.1.2.2.2 bouyer #endif
141 1.1.1.2.2.2 bouyer
142 1.1.1.2.2.2 bouyer /* Close the Namespace */
143 1.1.1.2.2.2 bouyer
144 1.1.1.2.2.2 bouyer AcpiNsTerminate ();
145 1.1.1.2.2.2 bouyer
146 1.1.1.2.2.2 bouyer /* Delete the ACPI tables */
147 1.1.1.2.2.2 bouyer
148 1.1.1.2.2.2 bouyer AcpiTbTerminate ();
149 1.1.1.2.2.2 bouyer
150 1.1.1.2.2.2 bouyer /* Close the globals */
151 1.1.1.2.2.2 bouyer
152 1.1.1.2.2.2 bouyer AcpiUtTerminate ();
153 1.1.1.2.2.2 bouyer
154 1.1.1.2.2.2 bouyer /* Purge the local caches */
155 1.1.1.2.2.2 bouyer
156 1.1.1.2.2.2 bouyer (void) AcpiUtDeleteCaches ();
157 1.1.1.2.2.2 bouyer return_VOID;
158 1.1.1.2.2.2 bouyer }
159 1.1.1.2.2.2 bouyer
160 1.1.1.2.2.2 bouyer
161