diff options
author | Bob Moore <robert.moore@intel.com> | 2012-08-16 22:51:47 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2012-09-21 00:26:16 -0400 |
commit | d978348b300595b067b80980f6a78db09fcd584c (patch) | |
tree | cbed0e02491147b51eebe64238195e3858fa8f15 /drivers/acpi/acpica | |
parent | 28f538b56d321dd5e027267f8240f06ce045e0aa (diff) |
ACPICA: Split ACPICA initialization functions to new file, utxfinit.c
Split utxface.c to improve modularity and reduce file size.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r-- | drivers/acpi/acpica/Makefile | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxface.c | 267 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxfinit.c | 317 |
3 files changed, 319 insertions, 266 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 0a1b3435f920..7f1d40797e80 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -158,5 +158,6 @@ acpi-y += \ | |||
158 | utresrc.o \ | 158 | utresrc.o \ |
159 | utstate.o \ | 159 | utstate.o \ |
160 | utxface.o \ | 160 | utxface.o \ |
161 | utxfinit.o \ | ||
161 | utxferror.o \ | 162 | utxferror.o \ |
162 | utxfmutex.o | 163 | utxfmutex.o |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 534179f1177b..667229dbcbad 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Module Name: utxface - External interfaces for "global" ACPI functions | 3 | * Module Name: utxface - External interfaces, miscellaneous utility functions |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
@@ -53,271 +53,6 @@ | |||
53 | #define _COMPONENT ACPI_UTILITIES | 53 | #define _COMPONENT ACPI_UTILITIES |
54 | ACPI_MODULE_NAME("utxface") | 54 | ACPI_MODULE_NAME("utxface") |
55 | 55 | ||
56 | #ifndef ACPI_ASL_COMPILER | ||
57 | /******************************************************************************* | ||
58 | * | ||
59 | * FUNCTION: acpi_initialize_subsystem | ||
60 | * | ||
61 | * PARAMETERS: None | ||
62 | * | ||
63 | * RETURN: Status | ||
64 | * | ||
65 | * DESCRIPTION: Initializes all global variables. This is the first function | ||
66 | * called, so any early initialization belongs here. | ||
67 | * | ||
68 | ******************************************************************************/ | ||
69 | acpi_status __init acpi_initialize_subsystem(void) | ||
70 | { | ||
71 | acpi_status status; | ||
72 | |||
73 | ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); | ||
74 | |||
75 | acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE; | ||
76 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); | ||
77 | |||
78 | /* Initialize the OS-Dependent layer */ | ||
79 | |||
80 | status = acpi_os_initialize(); | ||
81 | if (ACPI_FAILURE(status)) { | ||
82 | ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization")); | ||
83 | return_ACPI_STATUS(status); | ||
84 | } | ||
85 | |||
86 | /* Initialize all globals used by the subsystem */ | ||
87 | |||
88 | status = acpi_ut_init_globals(); | ||
89 | if (ACPI_FAILURE(status)) { | ||
90 | ACPI_EXCEPTION((AE_INFO, status, | ||
91 | "During initialization of globals")); | ||
92 | return_ACPI_STATUS(status); | ||
93 | } | ||
94 | |||
95 | /* Create the default mutex objects */ | ||
96 | |||
97 | status = acpi_ut_mutex_initialize(); | ||
98 | if (ACPI_FAILURE(status)) { | ||
99 | ACPI_EXCEPTION((AE_INFO, status, | ||
100 | "During Global Mutex creation")); | ||
101 | return_ACPI_STATUS(status); | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * Initialize the namespace manager and | ||
106 | * the root of the namespace tree | ||
107 | */ | ||
108 | status = acpi_ns_root_initialize(); | ||
109 | if (ACPI_FAILURE(status)) { | ||
110 | ACPI_EXCEPTION((AE_INFO, status, | ||
111 | "During Namespace initialization")); | ||
112 | return_ACPI_STATUS(status); | ||
113 | } | ||
114 | |||
115 | /* Initialize the global OSI interfaces list with the static names */ | ||
116 | |||
117 | status = acpi_ut_initialize_interfaces(); | ||
118 | if (ACPI_FAILURE(status)) { | ||
119 | ACPI_EXCEPTION((AE_INFO, status, | ||
120 | "During OSI interfaces initialization")); | ||
121 | return_ACPI_STATUS(status); | ||
122 | } | ||
123 | |||
124 | /* If configured, initialize the AML debugger */ | ||
125 | |||
126 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); | ||
127 | return_ACPI_STATUS(status); | ||
128 | } | ||
129 | |||
130 | /******************************************************************************* | ||
131 | * | ||
132 | * FUNCTION: acpi_enable_subsystem | ||
133 | * | ||
134 | * PARAMETERS: flags - Init/enable Options | ||
135 | * | ||
136 | * RETURN: Status | ||
137 | * | ||
138 | * DESCRIPTION: Completes the subsystem initialization including hardware. | ||
139 | * Puts system into ACPI mode if it isn't already. | ||
140 | * | ||
141 | ******************************************************************************/ | ||
142 | acpi_status acpi_enable_subsystem(u32 flags) | ||
143 | { | ||
144 | acpi_status status = AE_OK; | ||
145 | |||
146 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); | ||
147 | |||
148 | #if (!ACPI_REDUCED_HARDWARE) | ||
149 | |||
150 | /* Enable ACPI mode */ | ||
151 | |||
152 | if (!(flags & ACPI_NO_ACPI_ENABLE)) { | ||
153 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
154 | "[Init] Going into ACPI mode\n")); | ||
155 | |||
156 | acpi_gbl_original_mode = acpi_hw_get_mode(); | ||
157 | |||
158 | status = acpi_enable(); | ||
159 | if (ACPI_FAILURE(status)) { | ||
160 | ACPI_WARNING((AE_INFO, "AcpiEnable failed")); | ||
161 | return_ACPI_STATUS(status); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | /* | ||
166 | * Obtain a permanent mapping for the FACS. This is required for the | ||
167 | * Global Lock and the Firmware Waking Vector | ||
168 | */ | ||
169 | status = acpi_tb_initialize_facs(); | ||
170 | if (ACPI_FAILURE(status)) { | ||
171 | ACPI_WARNING((AE_INFO, "Could not map the FACS table")); | ||
172 | return_ACPI_STATUS(status); | ||
173 | } | ||
174 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
175 | |||
176 | /* | ||
177 | * Install the default op_region handlers. These are installed unless | ||
178 | * other handlers have already been installed via the | ||
179 | * install_address_space_handler interface. | ||
180 | */ | ||
181 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
182 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
183 | "[Init] Installing default address space handlers\n")); | ||
184 | |||
185 | status = acpi_ev_install_region_handlers(); | ||
186 | if (ACPI_FAILURE(status)) { | ||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
189 | } | ||
190 | #if (!ACPI_REDUCED_HARDWARE) | ||
191 | /* | ||
192 | * Initialize ACPI Event handling (Fixed and General Purpose) | ||
193 | * | ||
194 | * Note1: We must have the hardware and events initialized before we can | ||
195 | * execute any control methods safely. Any control method can require | ||
196 | * ACPI hardware support, so the hardware must be fully initialized before | ||
197 | * any method execution! | ||
198 | * | ||
199 | * Note2: Fixed events are initialized and enabled here. GPEs are | ||
200 | * initialized, but cannot be enabled until after the hardware is | ||
201 | * completely initialized (SCI and global_lock activated) | ||
202 | */ | ||
203 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
204 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
205 | "[Init] Initializing ACPI events\n")); | ||
206 | |||
207 | status = acpi_ev_initialize_events(); | ||
208 | if (ACPI_FAILURE(status)) { | ||
209 | return_ACPI_STATUS(status); | ||
210 | } | ||
211 | } | ||
212 | |||
213 | /* | ||
214 | * Install the SCI handler and Global Lock handler. This completes the | ||
215 | * hardware initialization. | ||
216 | */ | ||
217 | if (!(flags & ACPI_NO_HANDLER_INIT)) { | ||
218 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
219 | "[Init] Installing SCI/GL handlers\n")); | ||
220 | |||
221 | status = acpi_ev_install_xrupt_handlers(); | ||
222 | if (ACPI_FAILURE(status)) { | ||
223 | return_ACPI_STATUS(status); | ||
224 | } | ||
225 | } | ||
226 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
227 | |||
228 | return_ACPI_STATUS(status); | ||
229 | } | ||
230 | |||
231 | ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) | ||
232 | |||
233 | /******************************************************************************* | ||
234 | * | ||
235 | * FUNCTION: acpi_initialize_objects | ||
236 | * | ||
237 | * PARAMETERS: flags - Init/enable Options | ||
238 | * | ||
239 | * RETURN: Status | ||
240 | * | ||
241 | * DESCRIPTION: Completes namespace initialization by initializing device | ||
242 | * objects and executing AML code for Regions, buffers, etc. | ||
243 | * | ||
244 | ******************************************************************************/ | ||
245 | acpi_status acpi_initialize_objects(u32 flags) | ||
246 | { | ||
247 | acpi_status status = AE_OK; | ||
248 | |||
249 | ACPI_FUNCTION_TRACE(acpi_initialize_objects); | ||
250 | |||
251 | /* | ||
252 | * Run all _REG methods | ||
253 | * | ||
254 | * Note: Any objects accessed by the _REG methods will be automatically | ||
255 | * initialized, even if they contain executable AML (see the call to | ||
256 | * acpi_ns_initialize_objects below). | ||
257 | */ | ||
258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
260 | "[Init] Executing _REG OpRegion methods\n")); | ||
261 | |||
262 | status = acpi_ev_initialize_op_regions(); | ||
263 | if (ACPI_FAILURE(status)) { | ||
264 | return_ACPI_STATUS(status); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | /* | ||
269 | * Execute any module-level code that was detected during the table load | ||
270 | * phase. Although illegal since ACPI 2.0, there are many machines that | ||
271 | * contain this type of code. Each block of detected executable AML code | ||
272 | * outside of any control method is wrapped with a temporary control | ||
273 | * method object and placed on a global list. The methods on this list | ||
274 | * are executed below. | ||
275 | */ | ||
276 | acpi_ns_exec_module_code_list(); | ||
277 | |||
278 | /* | ||
279 | * Initialize the objects that remain uninitialized. This runs the | ||
280 | * executable AML that may be part of the declaration of these objects: | ||
281 | * operation_regions, buffer_fields, Buffers, and Packages. | ||
282 | */ | ||
283 | if (!(flags & ACPI_NO_OBJECT_INIT)) { | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
285 | "[Init] Completing Initialization of ACPI Objects\n")); | ||
286 | |||
287 | status = acpi_ns_initialize_objects(); | ||
288 | if (ACPI_FAILURE(status)) { | ||
289 | return_ACPI_STATUS(status); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * Initialize all device objects in the namespace. This runs the device | ||
295 | * _STA and _INI methods. | ||
296 | */ | ||
297 | if (!(flags & ACPI_NO_DEVICE_INIT)) { | ||
298 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
299 | "[Init] Initializing ACPI Devices\n")); | ||
300 | |||
301 | status = acpi_ns_initialize_devices(); | ||
302 | if (ACPI_FAILURE(status)) { | ||
303 | return_ACPI_STATUS(status); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * Empty the caches (delete the cached objects) on the assumption that | ||
309 | * the table load filled them up more than they will be at runtime -- | ||
310 | * thus wasting non-paged memory. | ||
311 | */ | ||
312 | status = acpi_purge_cached_objects(); | ||
313 | |||
314 | acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK; | ||
315 | return_ACPI_STATUS(status); | ||
316 | } | ||
317 | |||
318 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | ||
319 | |||
320 | #endif | ||
321 | /******************************************************************************* | 56 | /******************************************************************************* |
322 | * | 57 | * |
323 | * FUNCTION: acpi_terminate | 58 | * FUNCTION: acpi_terminate |
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c new file mode 100644 index 000000000000..14f523627a5e --- /dev/null +++ b/drivers/acpi/acpica/utxfinit.c | |||
@@ -0,0 +1,317 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: utxfinit - External interfaces for ACPICA initialization | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2012, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <linux/export.h> | ||
45 | #include <acpi/acpi.h> | ||
46 | #include "accommon.h" | ||
47 | #include "acevents.h" | ||
48 | #include "acnamesp.h" | ||
49 | #include "acdebug.h" | ||
50 | #include "actables.h" | ||
51 | |||
52 | #define _COMPONENT ACPI_UTILITIES | ||
53 | ACPI_MODULE_NAME("utxfinit") | ||
54 | |||
55 | /******************************************************************************* | ||
56 | * | ||
57 | * FUNCTION: acpi_initialize_subsystem | ||
58 | * | ||
59 | * PARAMETERS: None | ||
60 | * | ||
61 | * RETURN: Status | ||
62 | * | ||
63 | * DESCRIPTION: Initializes all global variables. This is the first function | ||
64 | * called, so any early initialization belongs here. | ||
65 | * | ||
66 | ******************************************************************************/ | ||
67 | acpi_status acpi_initialize_subsystem(void) | ||
68 | { | ||
69 | acpi_status status; | ||
70 | |||
71 | ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); | ||
72 | |||
73 | acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE; | ||
74 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); | ||
75 | |||
76 | /* Initialize the OS-Dependent layer */ | ||
77 | |||
78 | status = acpi_os_initialize(); | ||
79 | if (ACPI_FAILURE(status)) { | ||
80 | ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization")); | ||
81 | return_ACPI_STATUS(status); | ||
82 | } | ||
83 | |||
84 | /* Initialize all globals used by the subsystem */ | ||
85 | |||
86 | status = acpi_ut_init_globals(); | ||
87 | if (ACPI_FAILURE(status)) { | ||
88 | ACPI_EXCEPTION((AE_INFO, status, | ||
89 | "During initialization of globals")); | ||
90 | return_ACPI_STATUS(status); | ||
91 | } | ||
92 | |||
93 | /* Create the default mutex objects */ | ||
94 | |||
95 | status = acpi_ut_mutex_initialize(); | ||
96 | if (ACPI_FAILURE(status)) { | ||
97 | ACPI_EXCEPTION((AE_INFO, status, | ||
98 | "During Global Mutex creation")); | ||
99 | return_ACPI_STATUS(status); | ||
100 | } | ||
101 | |||
102 | /* | ||
103 | * Initialize the namespace manager and | ||
104 | * the root of the namespace tree | ||
105 | */ | ||
106 | status = acpi_ns_root_initialize(); | ||
107 | if (ACPI_FAILURE(status)) { | ||
108 | ACPI_EXCEPTION((AE_INFO, status, | ||
109 | "During Namespace initialization")); | ||
110 | return_ACPI_STATUS(status); | ||
111 | } | ||
112 | |||
113 | /* Initialize the global OSI interfaces list with the static names */ | ||
114 | |||
115 | status = acpi_ut_initialize_interfaces(); | ||
116 | if (ACPI_FAILURE(status)) { | ||
117 | ACPI_EXCEPTION((AE_INFO, status, | ||
118 | "During OSI interfaces initialization")); | ||
119 | return_ACPI_STATUS(status); | ||
120 | } | ||
121 | |||
122 | /* If configured, initialize the AML debugger */ | ||
123 | |||
124 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); | ||
125 | return_ACPI_STATUS(status); | ||
126 | } | ||
127 | ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) | ||
128 | |||
129 | /******************************************************************************* | ||
130 | * | ||
131 | * FUNCTION: acpi_enable_subsystem | ||
132 | * | ||
133 | * PARAMETERS: flags - Init/enable Options | ||
134 | * | ||
135 | * RETURN: Status | ||
136 | * | ||
137 | * DESCRIPTION: Completes the subsystem initialization including hardware. | ||
138 | * Puts system into ACPI mode if it isn't already. | ||
139 | * | ||
140 | ******************************************************************************/ | ||
141 | acpi_status acpi_enable_subsystem(u32 flags) | ||
142 | { | ||
143 | acpi_status status = AE_OK; | ||
144 | |||
145 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); | ||
146 | |||
147 | #if (!ACPI_REDUCED_HARDWARE) | ||
148 | |||
149 | /* Enable ACPI mode */ | ||
150 | |||
151 | if (!(flags & ACPI_NO_ACPI_ENABLE)) { | ||
152 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
153 | "[Init] Going into ACPI mode\n")); | ||
154 | |||
155 | acpi_gbl_original_mode = acpi_hw_get_mode(); | ||
156 | |||
157 | status = acpi_enable(); | ||
158 | if (ACPI_FAILURE(status)) { | ||
159 | ACPI_WARNING((AE_INFO, "AcpiEnable failed")); | ||
160 | return_ACPI_STATUS(status); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | /* | ||
165 | * Obtain a permanent mapping for the FACS. This is required for the | ||
166 | * Global Lock and the Firmware Waking Vector | ||
167 | */ | ||
168 | status = acpi_tb_initialize_facs(); | ||
169 | if (ACPI_FAILURE(status)) { | ||
170 | ACPI_WARNING((AE_INFO, "Could not map the FACS table")); | ||
171 | return_ACPI_STATUS(status); | ||
172 | } | ||
173 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
174 | |||
175 | /* | ||
176 | * Install the default op_region handlers. These are installed unless | ||
177 | * other handlers have already been installed via the | ||
178 | * install_address_space_handler interface. | ||
179 | */ | ||
180 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
181 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
182 | "[Init] Installing default address space handlers\n")); | ||
183 | |||
184 | status = acpi_ev_install_region_handlers(); | ||
185 | if (ACPI_FAILURE(status)) { | ||
186 | return_ACPI_STATUS(status); | ||
187 | } | ||
188 | } | ||
189 | #if (!ACPI_REDUCED_HARDWARE) | ||
190 | /* | ||
191 | * Initialize ACPI Event handling (Fixed and General Purpose) | ||
192 | * | ||
193 | * Note1: We must have the hardware and events initialized before we can | ||
194 | * execute any control methods safely. Any control method can require | ||
195 | * ACPI hardware support, so the hardware must be fully initialized before | ||
196 | * any method execution! | ||
197 | * | ||
198 | * Note2: Fixed events are initialized and enabled here. GPEs are | ||
199 | * initialized, but cannot be enabled until after the hardware is | ||
200 | * completely initialized (SCI and global_lock activated) and the various | ||
201 | * initialization control methods are run (_REG, _STA, _INI) on the | ||
202 | * entire namespace. | ||
203 | */ | ||
204 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
206 | "[Init] Initializing ACPI events\n")); | ||
207 | |||
208 | status = acpi_ev_initialize_events(); | ||
209 | if (ACPI_FAILURE(status)) { | ||
210 | return_ACPI_STATUS(status); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | /* | ||
215 | * Install the SCI handler and Global Lock handler. This completes the | ||
216 | * hardware initialization. | ||
217 | */ | ||
218 | if (!(flags & ACPI_NO_HANDLER_INIT)) { | ||
219 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
220 | "[Init] Installing SCI/GL handlers\n")); | ||
221 | |||
222 | status = acpi_ev_install_xrupt_handlers(); | ||
223 | if (ACPI_FAILURE(status)) { | ||
224 | return_ACPI_STATUS(status); | ||
225 | } | ||
226 | } | ||
227 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
228 | |||
229 | return_ACPI_STATUS(status); | ||
230 | } | ||
231 | ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) | ||
232 | |||
233 | /******************************************************************************* | ||
234 | * | ||
235 | * FUNCTION: acpi_initialize_objects | ||
236 | * | ||
237 | * PARAMETERS: flags - Init/enable Options | ||
238 | * | ||
239 | * RETURN: Status | ||
240 | * | ||
241 | * DESCRIPTION: Completes namespace initialization by initializing device | ||
242 | * objects and executing AML code for Regions, buffers, etc. | ||
243 | * | ||
244 | ******************************************************************************/ | ||
245 | acpi_status acpi_initialize_objects(u32 flags) | ||
246 | { | ||
247 | acpi_status status = AE_OK; | ||
248 | |||
249 | ACPI_FUNCTION_TRACE(acpi_initialize_objects); | ||
250 | |||
251 | /* | ||
252 | * Run all _REG methods | ||
253 | * | ||
254 | * Note: Any objects accessed by the _REG methods will be automatically | ||
255 | * initialized, even if they contain executable AML (see the call to | ||
256 | * acpi_ns_initialize_objects below). | ||
257 | */ | ||
258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | ||
259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
260 | "[Init] Executing _REG OpRegion methods\n")); | ||
261 | |||
262 | status = acpi_ev_initialize_op_regions(); | ||
263 | if (ACPI_FAILURE(status)) { | ||
264 | return_ACPI_STATUS(status); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | /* | ||
269 | * Execute any module-level code that was detected during the table load | ||
270 | * phase. Although illegal since ACPI 2.0, there are many machines that | ||
271 | * contain this type of code. Each block of detected executable AML code | ||
272 | * outside of any control method is wrapped with a temporary control | ||
273 | * method object and placed on a global list. The methods on this list | ||
274 | * are executed below. | ||
275 | */ | ||
276 | acpi_ns_exec_module_code_list(); | ||
277 | |||
278 | /* | ||
279 | * Initialize the objects that remain uninitialized. This runs the | ||
280 | * executable AML that may be part of the declaration of these objects: | ||
281 | * operation_regions, buffer_fields, Buffers, and Packages. | ||
282 | */ | ||
283 | if (!(flags & ACPI_NO_OBJECT_INIT)) { | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
285 | "[Init] Completing Initialization of ACPI Objects\n")); | ||
286 | |||
287 | status = acpi_ns_initialize_objects(); | ||
288 | if (ACPI_FAILURE(status)) { | ||
289 | return_ACPI_STATUS(status); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | /* | ||
294 | * Initialize all device objects in the namespace. This runs the device | ||
295 | * _STA and _INI methods. | ||
296 | */ | ||
297 | if (!(flags & ACPI_NO_DEVICE_INIT)) { | ||
298 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
299 | "[Init] Initializing ACPI Devices\n")); | ||
300 | |||
301 | status = acpi_ns_initialize_devices(); | ||
302 | if (ACPI_FAILURE(status)) { | ||
303 | return_ACPI_STATUS(status); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * Empty the caches (delete the cached objects) on the assumption that | ||
309 | * the table load filled them up more than they will be at runtime -- | ||
310 | * thus wasting non-paged memory. | ||
311 | */ | ||
312 | status = acpi_purge_cached_objects(); | ||
313 | |||
314 | acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK; | ||
315 | return_ACPI_STATUS(status); | ||
316 | } | ||
317 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | ||