aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nsload.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/namespace/nsload.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/namespace/nsload.c')
-rw-r--r--drivers/acpi/namespace/nsload.c228
1 files changed, 98 insertions, 130 deletions
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c
index 1428a84a31e6..c28849de465a 100644
--- a/drivers/acpi/namespace/nsload.c
+++ b/drivers/acpi/namespace/nsload.c
@@ -41,32 +41,22 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acnamesp.h> 45#include <acpi/acnamesp.h>
47#include <acpi/acdispat.h> 46#include <acpi/acdispat.h>
48 47
49
50#define _COMPONENT ACPI_NAMESPACE 48#define _COMPONENT ACPI_NAMESPACE
51 ACPI_MODULE_NAME ("nsload") 49ACPI_MODULE_NAME("nsload")
52 50
53/* Local prototypes */ 51/* Local prototypes */
54 52static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type);
55static acpi_status
56acpi_ns_load_table_by_type (
57 acpi_table_type table_type);
58 53
59#ifdef ACPI_FUTURE_IMPLEMENTATION 54#ifdef ACPI_FUTURE_IMPLEMENTATION
60acpi_status 55acpi_status acpi_ns_unload_namespace(acpi_handle handle);
61acpi_ns_unload_namespace (
62 acpi_handle handle);
63 56
64static acpi_status 57static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
65acpi_ns_delete_subtree (
66 acpi_handle start_handle);
67#endif 58#endif
68 59
69
70#ifndef ACPI_NO_METHOD_EXECUTION 60#ifndef ACPI_NO_METHOD_EXECUTION
71/******************************************************************************* 61/*******************************************************************************
72 * 62 *
@@ -82,40 +72,39 @@ acpi_ns_delete_subtree (
82 ******************************************************************************/ 72 ******************************************************************************/
83 73
84acpi_status 74acpi_status
85acpi_ns_load_table ( 75acpi_ns_load_table(struct acpi_table_desc *table_desc,
86 struct acpi_table_desc *table_desc, 76 struct acpi_namespace_node *node)
87 struct acpi_namespace_node *node)
88{ 77{
89 acpi_status status; 78 acpi_status status;
90
91
92 ACPI_FUNCTION_TRACE ("ns_load_table");
93 79
80 ACPI_FUNCTION_TRACE("ns_load_table");
94 81
95 /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ 82 /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
96 83
97 if (!(acpi_gbl_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) { 84 if (!
85 (acpi_gbl_table_data[table_desc->type].
86 flags & ACPI_TABLE_EXECUTABLE)) {
98 /* Just ignore this table */ 87 /* Just ignore this table */
99 88
100 return_ACPI_STATUS (AE_OK); 89 return_ACPI_STATUS(AE_OK);
101 } 90 }
102 91
103 /* Check validity of the AML start and length */ 92 /* Check validity of the AML start and length */
104 93
105 if (!table_desc->aml_start) { 94 if (!table_desc->aml_start) {
106 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n")); 95 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n"));
107 return_ACPI_STATUS (AE_BAD_PARAMETER); 96 return_ACPI_STATUS(AE_BAD_PARAMETER);
108 } 97 }
109 98
110 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", 99 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AML block at %p\n",
111 table_desc->aml_start)); 100 table_desc->aml_start));
112 101
113 /* Ignore table if there is no AML contained within */ 102 /* Ignore table if there is no AML contained within */
114 103
115 if (!table_desc->aml_length) { 104 if (!table_desc->aml_length) {
116 ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n", 105 ACPI_REPORT_WARNING(("Zero-length AML block in table [%4.4s]\n",
117 table_desc->pointer->signature)); 106 table_desc->pointer->signature));
118 return_ACPI_STATUS (AE_OK); 107 return_ACPI_STATUS(AE_OK);
119 } 108 }
120 109
121 /* 110 /*
@@ -127,19 +116,19 @@ acpi_ns_load_table (
127 * to another control method, we can't continue parsing 116 * to another control method, we can't continue parsing
128 * because we don't know how many arguments to parse next! 117 * because we don't know how many arguments to parse next!
129 */ 118 */
130 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 119 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
131 "**** Loading table into namespace ****\n")); 120 "**** Loading table into namespace ****\n"));
132 121
133 status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); 122 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
134 if (ACPI_FAILURE (status)) { 123 if (ACPI_FAILURE(status)) {
135 return_ACPI_STATUS (status); 124 return_ACPI_STATUS(status);
136 } 125 }
137 126
138 status = acpi_ns_parse_table (table_desc, node->child); 127 status = acpi_ns_parse_table(table_desc, node->child);
139 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 128 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
140 129
141 if (ACPI_FAILURE (status)) { 130 if (ACPI_FAILURE(status)) {
142 return_ACPI_STATUS (status); 131 return_ACPI_STATUS(status);
143 } 132 }
144 133
145 /* 134 /*
@@ -148,18 +137,17 @@ acpi_ns_load_table (
148 * just-in-time parsing, we delete the control method 137 * just-in-time parsing, we delete the control method
149 * parse trees. 138 * parse trees.
150 */ 139 */
151 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 140 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
152 "**** Begin Table Method Parsing and Object Initialization ****\n")); 141 "**** Begin Table Method Parsing and Object Initialization ****\n"));
153 142
154 status = acpi_ds_initialize_objects (table_desc, node); 143 status = acpi_ds_initialize_objects(table_desc, node);
155 144
156 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 145 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
157 "**** Completed Table Method Parsing and Object Initialization ****\n")); 146 "**** Completed Table Method Parsing and Object Initialization ****\n"));
158 147
159 return_ACPI_STATUS (status); 148 return_ACPI_STATUS(status);
160} 149}
161 150
162
163/******************************************************************************* 151/*******************************************************************************
164 * 152 *
165 * FUNCTION: acpi_ns_load_table_by_type 153 * FUNCTION: acpi_ns_load_table_by_type
@@ -174,21 +162,17 @@ acpi_ns_load_table (
174 * 162 *
175 ******************************************************************************/ 163 ******************************************************************************/
176 164
177static acpi_status 165static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
178acpi_ns_load_table_by_type (
179 acpi_table_type table_type)
180{ 166{
181 u32 i; 167 u32 i;
182 acpi_status status; 168 acpi_status status;
183 struct acpi_table_desc *table_desc; 169 struct acpi_table_desc *table_desc;
184
185
186 ACPI_FUNCTION_TRACE ("ns_load_table_by_type");
187 170
171 ACPI_FUNCTION_TRACE("ns_load_table_by_type");
188 172
189 status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES); 173 status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
190 if (ACPI_FAILURE (status)) { 174 if (ACPI_FAILURE(status)) {
191 return_ACPI_STATUS (status); 175 return_ACPI_STATUS(status);
192 } 176 }
193 177
194 /* 178 /*
@@ -198,7 +182,7 @@ acpi_ns_load_table_by_type (
198 switch (table_type) { 182 switch (table_type) {
199 case ACPI_TABLE_DSDT: 183 case ACPI_TABLE_DSDT:
200 184
201 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n")); 185 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n"));
202 186
203 table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; 187 table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
204 188
@@ -210,18 +194,18 @@ acpi_ns_load_table_by_type (
210 194
211 /* Now load the single DSDT */ 195 /* Now load the single DSDT */
212 196
213 status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); 197 status = acpi_ns_load_table(table_desc, acpi_gbl_root_node);
214 if (ACPI_SUCCESS (status)) { 198 if (ACPI_SUCCESS(status)) {
215 table_desc->loaded_into_namespace = TRUE; 199 table_desc->loaded_into_namespace = TRUE;
216 } 200 }
217 break; 201 break;
218 202
219
220 case ACPI_TABLE_SSDT: 203 case ACPI_TABLE_SSDT:
221 case ACPI_TABLE_PSDT: 204 case ACPI_TABLE_PSDT:
222 205
223 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n", 206 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
224 acpi_gbl_table_lists[table_type].count)); 207 "Namespace load: %d SSDT or PSDTs\n",
208 acpi_gbl_table_lists[table_type].count));
225 209
226 /* 210 /*
227 * Traverse list of SSDT or PSDT tables 211 * Traverse list of SSDT or PSDT tables
@@ -233,8 +217,10 @@ acpi_ns_load_table_by_type (
233 * already loaded! 217 * already loaded!
234 */ 218 */
235 if (!table_desc->loaded_into_namespace) { 219 if (!table_desc->loaded_into_namespace) {
236 status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); 220 status =
237 if (ACPI_FAILURE (status)) { 221 acpi_ns_load_table(table_desc,
222 acpi_gbl_root_node);
223 if (ACPI_FAILURE(status)) {
238 break; 224 break;
239 } 225 }
240 226
@@ -245,19 +231,16 @@ acpi_ns_load_table_by_type (
245 } 231 }
246 break; 232 break;
247 233
248
249 default: 234 default:
250 status = AE_SUPPORT; 235 status = AE_SUPPORT;
251 break; 236 break;
252 } 237 }
253 238
254 239 unlock_and_exit:
255unlock_and_exit: 240 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
256 (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); 241 return_ACPI_STATUS(status);
257 return_ACPI_STATUS (status);
258} 242}
259 243
260
261/******************************************************************************* 244/*******************************************************************************
262 * 245 *
263 * FUNCTION: acpi_load_namespace 246 * FUNCTION: acpi_load_namespace
@@ -271,45 +254,40 @@ unlock_and_exit:
271 * 254 *
272 ******************************************************************************/ 255 ******************************************************************************/
273 256
274acpi_status 257acpi_status acpi_ns_load_namespace(void)
275acpi_ns_load_namespace (
276 void)
277{ 258{
278 acpi_status status; 259 acpi_status status;
279
280
281 ACPI_FUNCTION_TRACE ("acpi_load_name_space");
282 260
261 ACPI_FUNCTION_TRACE("acpi_load_name_space");
283 262
284 /* There must be at least a DSDT installed */ 263 /* There must be at least a DSDT installed */
285 264
286 if (acpi_gbl_DSDT == NULL) { 265 if (acpi_gbl_DSDT == NULL) {
287 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n")); 266 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n"));
288 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 267 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
289 } 268 }
290 269
291 /* 270 /*
292 * Load the namespace. The DSDT is required, 271 * Load the namespace. The DSDT is required,
293 * but the SSDT and PSDT tables are optional. 272 * but the SSDT and PSDT tables are optional.
294 */ 273 */
295 status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT); 274 status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT);
296 if (ACPI_FAILURE (status)) { 275 if (ACPI_FAILURE(status)) {
297 return_ACPI_STATUS (status); 276 return_ACPI_STATUS(status);
298 } 277 }
299 278
300 /* Ignore exceptions from these */ 279 /* Ignore exceptions from these */
301 280
302 (void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT); 281 (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT);
303 (void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT); 282 (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT);
304 283
305 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, 284 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
306 "ACPI Namespace successfully loaded at root %p\n", 285 "ACPI Namespace successfully loaded at root %p\n",
307 acpi_gbl_root_node)); 286 acpi_gbl_root_node));
308 287
309 return_ACPI_STATUS (status); 288 return_ACPI_STATUS(status);
310} 289}
311 290
312
313#ifdef ACPI_FUTURE_IMPLEMENTATION 291#ifdef ACPI_FUTURE_IMPLEMENTATION
314/******************************************************************************* 292/*******************************************************************************
315 * 293 *
@@ -327,24 +305,20 @@ acpi_ns_load_namespace (
327 * 305 *
328 ******************************************************************************/ 306 ******************************************************************************/
329 307
330static acpi_status 308static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
331acpi_ns_delete_subtree (
332 acpi_handle start_handle)
333{ 309{
334 acpi_status status; 310 acpi_status status;
335 acpi_handle child_handle; 311 acpi_handle child_handle;
336 acpi_handle parent_handle; 312 acpi_handle parent_handle;
337 acpi_handle next_child_handle; 313 acpi_handle next_child_handle;
338 acpi_handle dummy; 314 acpi_handle dummy;
339 u32 level; 315 u32 level;
340
341
342 ACPI_FUNCTION_TRACE ("ns_delete_subtree");
343 316
317 ACPI_FUNCTION_TRACE("ns_delete_subtree");
344 318
345 parent_handle = start_handle; 319 parent_handle = start_handle;
346 child_handle = NULL; 320 child_handle = NULL;
347 level = 1; 321 level = 1;
348 322
349 /* 323 /*
350 * Traverse the tree of objects until we bubble back up 324 * Traverse the tree of objects until we bubble back up
@@ -353,18 +327,19 @@ acpi_ns_delete_subtree (
353 while (level > 0) { 327 while (level > 0) {
354 /* Attempt to get the next object in this scope */ 328 /* Attempt to get the next object in this scope */
355 329
356 status = acpi_get_next_object (ACPI_TYPE_ANY, parent_handle, 330 status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle,
357 child_handle, &next_child_handle); 331 child_handle, &next_child_handle);
358 332
359 child_handle = next_child_handle; 333 child_handle = next_child_handle;
360 334
361 /* Did we get a new object? */ 335 /* Did we get a new object? */
362 336
363 if (ACPI_SUCCESS (status)) { 337 if (ACPI_SUCCESS(status)) {
364 /* Check if this object has any children */ 338 /* Check if this object has any children */
365 339
366 if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle, 340 if (ACPI_SUCCESS
367 NULL, &dummy))) { 341 (acpi_get_next_object
342 (ACPI_TYPE_ANY, child_handle, NULL, &dummy))) {
368 /* 343 /*
369 * There is at least one child of this object, 344 * There is at least one child of this object,
370 * visit the object 345 * visit the object
@@ -373,8 +348,7 @@ acpi_ns_delete_subtree (
373 parent_handle = child_handle; 348 parent_handle = child_handle;
374 child_handle = NULL; 349 child_handle = NULL;
375 } 350 }
376 } 351 } else {
377 else {
378 /* 352 /*
379 * No more children in this object, go back up to 353 * No more children in this object, go back up to
380 * the object's parent 354 * the object's parent
@@ -383,24 +357,23 @@ acpi_ns_delete_subtree (
383 357
384 /* Delete all children now */ 358 /* Delete all children now */
385 359
386 acpi_ns_delete_children (child_handle); 360 acpi_ns_delete_children(child_handle);
387 361
388 child_handle = parent_handle; 362 child_handle = parent_handle;
389 status = acpi_get_parent (parent_handle, &parent_handle); 363 status = acpi_get_parent(parent_handle, &parent_handle);
390 if (ACPI_FAILURE (status)) { 364 if (ACPI_FAILURE(status)) {
391 return_ACPI_STATUS (status); 365 return_ACPI_STATUS(status);
392 } 366 }
393 } 367 }
394 } 368 }
395 369
396 /* Now delete the starting object, and we are done */ 370 /* Now delete the starting object, and we are done */
397 371
398 acpi_ns_delete_node (child_handle); 372 acpi_ns_delete_node(child_handle);
399 373
400 return_ACPI_STATUS (AE_OK); 374 return_ACPI_STATUS(AE_OK);
401} 375}
402 376
403
404/******************************************************************************* 377/*******************************************************************************
405 * 378 *
406 * FUNCTION: acpi_ns_unload_name_space 379 * FUNCTION: acpi_ns_unload_name_space
@@ -415,32 +388,27 @@ acpi_ns_delete_subtree (
415 * 388 *
416 ******************************************************************************/ 389 ******************************************************************************/
417 390
418acpi_status 391acpi_status acpi_ns_unload_namespace(acpi_handle handle)
419acpi_ns_unload_namespace (
420 acpi_handle handle)
421{ 392{
422 acpi_status status; 393 acpi_status status;
423
424
425 ACPI_FUNCTION_TRACE ("ns_unload_name_space");
426 394
395 ACPI_FUNCTION_TRACE("ns_unload_name_space");
427 396
428 /* Parameter validation */ 397 /* Parameter validation */
429 398
430 if (!acpi_gbl_root_node) { 399 if (!acpi_gbl_root_node) {
431 return_ACPI_STATUS (AE_NO_NAMESPACE); 400 return_ACPI_STATUS(AE_NO_NAMESPACE);
432 } 401 }
433 402
434 if (!handle) { 403 if (!handle) {
435 return_ACPI_STATUS (AE_BAD_PARAMETER); 404 return_ACPI_STATUS(AE_BAD_PARAMETER);
436 } 405 }
437 406
438 /* This function does the real work */ 407 /* This function does the real work */
439 408
440 status = acpi_ns_delete_subtree (handle); 409 status = acpi_ns_delete_subtree(handle);
441 410
442 return_ACPI_STATUS (status); 411 return_ACPI_STATUS(status);
443} 412}
444#endif 413#endif
445#endif 414#endif
446