aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbinstal.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/tables/tbinstal.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables/tbinstal.c')
-rw-r--r--drivers/acpi/tables/tbinstal.c256
1 files changed, 107 insertions, 149 deletions
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 698799901f55..10db8484e462 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -41,22 +41,16 @@
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/actables.h> 45#include <acpi/actables.h>
47 46
48
49#define _COMPONENT ACPI_TABLES 47#define _COMPONENT ACPI_TABLES
50 ACPI_MODULE_NAME ("tbinstal") 48ACPI_MODULE_NAME("tbinstal")
51 49
52/* Local prototypes */ 50/* Local prototypes */
53
54static acpi_status 51static acpi_status
55acpi_tb_match_signature ( 52acpi_tb_match_signature(char *signature,
56 char *signature, 53 struct acpi_table_desc *table_info, u8 search_type);
57 struct acpi_table_desc *table_info,
58 u8 search_type);
59
60 54
61/******************************************************************************* 55/*******************************************************************************
62 * 56 *
@@ -74,16 +68,12 @@ acpi_tb_match_signature (
74 ******************************************************************************/ 68 ******************************************************************************/
75 69
76static acpi_status 70static acpi_status
77acpi_tb_match_signature ( 71acpi_tb_match_signature(char *signature,
78 char *signature, 72 struct acpi_table_desc *table_info, u8 search_type)
79 struct acpi_table_desc *table_info,
80 u8 search_type)
81{ 73{
82 acpi_native_uint i; 74 acpi_native_uint i;
83
84
85 ACPI_FUNCTION_TRACE ("tb_match_signature");
86 75
76 ACPI_FUNCTION_TRACE("tb_match_signature");
87 77
88 /* Search for a signature match among the known table types */ 78 /* Search for a signature match among the known table types */
89 79
@@ -92,30 +82,30 @@ acpi_tb_match_signature (
92 continue; 82 continue;
93 } 83 }
94 84
95 if (!ACPI_STRNCMP (signature, acpi_gbl_table_data[i].signature, 85 if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature,
96 acpi_gbl_table_data[i].sig_length)) { 86 acpi_gbl_table_data[i].sig_length)) {
97 /* Found a signature match, return index if requested */ 87 /* Found a signature match, return index if requested */
98 88
99 if (table_info) { 89 if (table_info) {
100 table_info->type = (u8) i; 90 table_info->type = (u8) i;
101 } 91 }
102 92
103 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 93 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
104 "Table [%4.4s] is an ACPI table consumed by the core subsystem\n", 94 "Table [%4.4s] is an ACPI table consumed by the core subsystem\n",
105 (char *) acpi_gbl_table_data[i].signature)); 95 (char *)acpi_gbl_table_data[i].
96 signature));
106 97
107 return_ACPI_STATUS (AE_OK); 98 return_ACPI_STATUS(AE_OK);
108 } 99 }
109 } 100 }
110 101
111 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 102 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
112 "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n", 103 "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n",
113 (char *) signature)); 104 (char *)signature));
114 105
115 return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED); 106 return_ACPI_STATUS(AE_TABLE_NOT_SUPPORTED);
116} 107}
117 108
118
119/******************************************************************************* 109/*******************************************************************************
120 * 110 *
121 * FUNCTION: acpi_tb_install_table 111 * FUNCTION: acpi_tb_install_table
@@ -128,52 +118,48 @@ acpi_tb_match_signature (
128 * 118 *
129 ******************************************************************************/ 119 ******************************************************************************/
130 120
131acpi_status 121acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info)
132acpi_tb_install_table (
133 struct acpi_table_desc *table_info)
134{ 122{
135 acpi_status status; 123 acpi_status status;
136
137
138 ACPI_FUNCTION_TRACE ("tb_install_table");
139 124
125 ACPI_FUNCTION_TRACE("tb_install_table");
140 126
141 /* Lock tables while installing */ 127 /* Lock tables while installing */
142 128
143 status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES); 129 status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
144 if (ACPI_FAILURE (status)) { 130 if (ACPI_FAILURE(status)) {
145 ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n", 131 ACPI_REPORT_ERROR(("Could not acquire table mutex, %s\n",
146 acpi_format_exception (status))); 132 acpi_format_exception(status)));
147 return_ACPI_STATUS (status); 133 return_ACPI_STATUS(status);
148 } 134 }
149 135
150 /* 136 /*
151 * Ignore a table that is already installed. For example, some BIOS 137 * Ignore a table that is already installed. For example, some BIOS
152 * ASL code will repeatedly attempt to load the same SSDT. 138 * ASL code will repeatedly attempt to load the same SSDT.
153 */ 139 */
154 status = acpi_tb_is_table_installed (table_info); 140 status = acpi_tb_is_table_installed(table_info);
155 if (ACPI_FAILURE (status)) { 141 if (ACPI_FAILURE(status)) {
156 goto unlock_and_exit; 142 goto unlock_and_exit;
157 } 143 }
158 144
159 /* Install the table into the global data structure */ 145 /* Install the table into the global data structure */
160 146
161 status = acpi_tb_init_table_descriptor (table_info->type, table_info); 147 status = acpi_tb_init_table_descriptor(table_info->type, table_info);
162 if (ACPI_FAILURE (status)) { 148 if (ACPI_FAILURE(status)) {
163 ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n", 149 ACPI_REPORT_ERROR(("Could not install table [%4.4s], %s\n",
164 table_info->pointer->signature, acpi_format_exception (status))); 150 table_info->pointer->signature,
151 acpi_format_exception(status)));
165 } 152 }
166 153
167 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", 154 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s located at %p\n",
168 acpi_gbl_table_data[table_info->type].name, table_info->pointer)); 155 acpi_gbl_table_data[table_info->type].name,
156 table_info->pointer));
169 157
170 158 unlock_and_exit:
171unlock_and_exit: 159 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
172 (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); 160 return_ACPI_STATUS(status);
173 return_ACPI_STATUS (status);
174} 161}
175 162
176
177/******************************************************************************* 163/*******************************************************************************
178 * 164 *
179 * FUNCTION: acpi_tb_recognize_table 165 * FUNCTION: acpi_tb_recognize_table
@@ -196,22 +182,18 @@ unlock_and_exit:
196 ******************************************************************************/ 182 ******************************************************************************/
197 183
198acpi_status 184acpi_status
199acpi_tb_recognize_table ( 185acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type)
200 struct acpi_table_desc *table_info,
201 u8 search_type)
202{ 186{
203 struct acpi_table_header *table_header; 187 struct acpi_table_header *table_header;
204 acpi_status status; 188 acpi_status status;
205
206
207 ACPI_FUNCTION_TRACE ("tb_recognize_table");
208 189
190 ACPI_FUNCTION_TRACE("tb_recognize_table");
209 191
210 /* Ensure that we have a valid table pointer */ 192 /* Ensure that we have a valid table pointer */
211 193
212 table_header = (struct acpi_table_header *) table_info->pointer; 194 table_header = (struct acpi_table_header *)table_info->pointer;
213 if (!table_header) { 195 if (!table_header) {
214 return_ACPI_STATUS (AE_BAD_PARAMETER); 196 return_ACPI_STATUS(AE_BAD_PARAMETER);
215 } 197 }
216 198
217 /* 199 /*
@@ -222,25 +204,24 @@ acpi_tb_recognize_table (
222 * This can be any one of many valid ACPI tables, it just isn't one of 204 * This can be any one of many valid ACPI tables, it just isn't one of
223 * the tables that is consumed by the core subsystem 205 * the tables that is consumed by the core subsystem
224 */ 206 */
225 status = acpi_tb_match_signature (table_header->signature, 207 status = acpi_tb_match_signature(table_header->signature,
226 table_info, search_type); 208 table_info, search_type);
227 if (ACPI_FAILURE (status)) { 209 if (ACPI_FAILURE(status)) {
228 return_ACPI_STATUS (status); 210 return_ACPI_STATUS(status);
229 } 211 }
230 212
231 status = acpi_tb_validate_table_header (table_header); 213 status = acpi_tb_validate_table_header(table_header);
232 if (ACPI_FAILURE (status)) { 214 if (ACPI_FAILURE(status)) {
233 return_ACPI_STATUS (status); 215 return_ACPI_STATUS(status);
234 } 216 }
235 217
236 /* Return the table type and length via the info struct */ 218 /* Return the table type and length via the info struct */
237 219
238 table_info->length = (acpi_size) table_header->length; 220 table_info->length = (acpi_size) table_header->length;
239 221
240 return_ACPI_STATUS (status); 222 return_ACPI_STATUS(status);
241} 223}
242 224
243
244/******************************************************************************* 225/*******************************************************************************
245 * 226 *
246 * FUNCTION: acpi_tb_init_table_descriptor 227 * FUNCTION: acpi_tb_init_table_descriptor
@@ -255,30 +236,27 @@ acpi_tb_recognize_table (
255 ******************************************************************************/ 236 ******************************************************************************/
256 237
257acpi_status 238acpi_status
258acpi_tb_init_table_descriptor ( 239acpi_tb_init_table_descriptor(acpi_table_type table_type,
259 acpi_table_type table_type, 240 struct acpi_table_desc *table_info)
260 struct acpi_table_desc *table_info)
261{ 241{
262 struct acpi_table_list *list_head; 242 struct acpi_table_list *list_head;
263 struct acpi_table_desc *table_desc; 243 struct acpi_table_desc *table_desc;
264 acpi_status status; 244 acpi_status status;
265
266
267 ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type);
268 245
246 ACPI_FUNCTION_TRACE_U32("tb_init_table_descriptor", table_type);
269 247
270 /* Allocate a descriptor for this table */ 248 /* Allocate a descriptor for this table */
271 249
272 table_desc = ACPI_MEM_CALLOCATE (sizeof (struct acpi_table_desc)); 250 table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc));
273 if (!table_desc) { 251 if (!table_desc) {
274 return_ACPI_STATUS (AE_NO_MEMORY); 252 return_ACPI_STATUS(AE_NO_MEMORY);
275 } 253 }
276 254
277 /* Get a new owner ID for the table */ 255 /* Get a new owner ID for the table */
278 256
279 status = acpi_ut_allocate_owner_id (&table_desc->owner_id); 257 status = acpi_ut_allocate_owner_id(&table_desc->owner_id);
280 if (ACPI_FAILURE (status)) { 258 if (ACPI_FAILURE(status)) {
281 return_ACPI_STATUS (status); 259 return_ACPI_STATUS(status);
282 } 260 }
283 261
284 /* Install the table into the global data structure */ 262 /* Install the table into the global data structure */
@@ -290,14 +268,14 @@ acpi_tb_init_table_descriptor (
290 * includes most ACPI tables such as the DSDT. 2) Multiple instances of 268 * includes most ACPI tables such as the DSDT. 2) Multiple instances of
291 * the table are allowed. This includes SSDT and PSDTs. 269 * the table are allowed. This includes SSDT and PSDTs.
292 */ 270 */
293 if (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags)) { 271 if (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags)) {
294 /* 272 /*
295 * Only one table allowed, and a table has alread been installed 273 * Only one table allowed, and a table has alread been installed
296 * at this location, so return an error. 274 * at this location, so return an error.
297 */ 275 */
298 if (list_head->next) { 276 if (list_head->next) {
299 ACPI_MEM_FREE (table_desc); 277 ACPI_MEM_FREE(table_desc);
300 return_ACPI_STATUS (AE_ALREADY_EXISTS); 278 return_ACPI_STATUS(AE_ALREADY_EXISTS);
301 } 279 }
302 280
303 table_desc->next = list_head->next; 281 table_desc->next = list_head->next;
@@ -308,8 +286,7 @@ acpi_tb_init_table_descriptor (
308 } 286 }
309 287
310 list_head->count++; 288 list_head->count++;
311 } 289 } else {
312 else {
313 /* 290 /*
314 * Link the new table in to the list of tables of this type. 291 * Link the new table in to the list of tables of this type.
315 * Insert at the end of the list, order IS IMPORTANT. 292 * Insert at the end of the list, order IS IMPORTANT.
@@ -320,8 +297,7 @@ acpi_tb_init_table_descriptor (
320 297
321 if (!list_head->next) { 298 if (!list_head->next) {
322 list_head->next = table_desc; 299 list_head->next = table_desc;
323 } 300 } else {
324 else {
325 table_desc->next = list_head->next; 301 table_desc->next = list_head->next;
326 302
327 while (table_desc->next->next) { 303 while (table_desc->next->next) {
@@ -336,13 +312,14 @@ acpi_tb_init_table_descriptor (
336 312
337 /* Finish initialization of the table descriptor */ 313 /* Finish initialization of the table descriptor */
338 314
339 table_desc->type = (u8) table_type; 315 table_desc->type = (u8) table_type;
340 table_desc->pointer = table_info->pointer; 316 table_desc->pointer = table_info->pointer;
341 table_desc->length = table_info->length; 317 table_desc->length = table_info->length;
342 table_desc->allocation = table_info->allocation; 318 table_desc->allocation = table_info->allocation;
343 table_desc->aml_start = (u8 *) (table_desc->pointer + 1), 319 table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
344 table_desc->aml_length = (u32) (table_desc->length - 320 table_desc->aml_length = (u32) (table_desc->length -
345 (u32) sizeof (struct acpi_table_header)); 321 (u32) sizeof(struct
322 acpi_table_header));
346 table_desc->loaded_into_namespace = FALSE; 323 table_desc->loaded_into_namespace = FALSE;
347 324
348 /* 325 /*
@@ -350,18 +327,18 @@ acpi_tb_init_table_descriptor (
350 * newly installed table 327 * newly installed table
351 */ 328 */
352 if (acpi_gbl_table_data[table_type].global_ptr) { 329 if (acpi_gbl_table_data[table_type].global_ptr) {
353 *(acpi_gbl_table_data[table_type].global_ptr) = table_info->pointer; 330 *(acpi_gbl_table_data[table_type].global_ptr) =
331 table_info->pointer;
354 } 332 }
355 333
356 /* Return Data */ 334 /* Return Data */
357 335
358 table_info->owner_id = table_desc->owner_id; 336 table_info->owner_id = table_desc->owner_id;
359 table_info->installed_desc = table_desc; 337 table_info->installed_desc = table_desc;
360 338
361 return_ACPI_STATUS (AE_OK); 339 return_ACPI_STATUS(AE_OK);
362} 340}
363 341
364
365/******************************************************************************* 342/*******************************************************************************
366 * 343 *
367 * FUNCTION: acpi_tb_delete_all_tables 344 * FUNCTION: acpi_tb_delete_all_tables
@@ -374,23 +351,19 @@ acpi_tb_init_table_descriptor (
374 * 351 *
375 ******************************************************************************/ 352 ******************************************************************************/
376 353
377void 354void acpi_tb_delete_all_tables(void)
378acpi_tb_delete_all_tables (
379 void)
380{ 355{
381 acpi_table_type type; 356 acpi_table_type type;
382
383 357
384 /* 358 /*
385 * Free memory allocated for ACPI tables 359 * Free memory allocated for ACPI tables
386 * Memory can either be mapped or allocated 360 * Memory can either be mapped or allocated
387 */ 361 */
388 for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) { 362 for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) {
389 acpi_tb_delete_tables_by_type (type); 363 acpi_tb_delete_tables_by_type(type);
390 } 364 }
391} 365}
392 366
393
394/******************************************************************************* 367/*******************************************************************************
395 * 368 *
396 * FUNCTION: acpi_tb_delete_tables_by_type 369 * FUNCTION: acpi_tb_delete_tables_by_type
@@ -404,23 +377,19 @@ acpi_tb_delete_all_tables (
404 * 377 *
405 ******************************************************************************/ 378 ******************************************************************************/
406 379
407void 380void acpi_tb_delete_tables_by_type(acpi_table_type type)
408acpi_tb_delete_tables_by_type (
409 acpi_table_type type)
410{ 381{
411 struct acpi_table_desc *table_desc; 382 struct acpi_table_desc *table_desc;
412 u32 count; 383 u32 count;
413 u32 i; 384 u32 i;
414
415
416 ACPI_FUNCTION_TRACE_U32 ("tb_delete_tables_by_type", type);
417 385
386 ACPI_FUNCTION_TRACE_U32("tb_delete_tables_by_type", type);
418 387
419 if (type > ACPI_TABLE_MAX) { 388 if (type > ACPI_TABLE_MAX) {
420 return_VOID; 389 return_VOID;
421 } 390 }
422 391
423 if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_TABLES))) { 392 if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_TABLES))) {
424 return; 393 return;
425 } 394 }
426 395
@@ -458,21 +427,20 @@ acpi_tb_delete_tables_by_type (
458 * 1) Get the head of the list 427 * 1) Get the head of the list
459 */ 428 */
460 table_desc = acpi_gbl_table_lists[type].next; 429 table_desc = acpi_gbl_table_lists[type].next;
461 count = acpi_gbl_table_lists[type].count; 430 count = acpi_gbl_table_lists[type].count;
462 431
463 /* 432 /*
464 * 2) Walk the entire list, deleting both the allocated tables 433 * 2) Walk the entire list, deleting both the allocated tables
465 * and the table descriptors 434 * and the table descriptors
466 */ 435 */
467 for (i = 0; i < count; i++) { 436 for (i = 0; i < count; i++) {
468 table_desc = acpi_tb_uninstall_table (table_desc); 437 table_desc = acpi_tb_uninstall_table(table_desc);
469 } 438 }
470 439
471 (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); 440 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
472 return_VOID; 441 return_VOID;
473} 442}
474 443
475
476/******************************************************************************* 444/*******************************************************************************
477 * 445 *
478 * FUNCTION: acpi_tb_delete_single_table 446 * FUNCTION: acpi_tb_delete_single_table
@@ -486,15 +454,12 @@ acpi_tb_delete_tables_by_type (
486 * 454 *
487 ******************************************************************************/ 455 ******************************************************************************/
488 456
489void 457void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc)
490acpi_tb_delete_single_table (
491 struct acpi_table_desc *table_desc)
492{ 458{
493 459
494 /* Must have a valid table descriptor and pointer */ 460 /* Must have a valid table descriptor and pointer */
495 461
496 if ((!table_desc) || 462 if ((!table_desc) || (!table_desc->pointer)) {
497 (!table_desc->pointer)) {
498 return; 463 return;
499 } 464 }
500 465
@@ -506,12 +471,12 @@ acpi_tb_delete_single_table (
506 471
507 case ACPI_MEM_ALLOCATED: 472 case ACPI_MEM_ALLOCATED:
508 473
509 ACPI_MEM_FREE (table_desc->pointer); 474 ACPI_MEM_FREE(table_desc->pointer);
510 break; 475 break;
511 476
512 case ACPI_MEM_MAPPED: 477 case ACPI_MEM_MAPPED:
513 478
514 acpi_os_unmap_memory (table_desc->pointer, table_desc->length); 479 acpi_os_unmap_memory(table_desc->pointer, table_desc->length);
515 break; 480 break;
516 481
517 default: 482 default:
@@ -519,7 +484,6 @@ acpi_tb_delete_single_table (
519 } 484 }
520} 485}
521 486
522
523/******************************************************************************* 487/*******************************************************************************
524 * 488 *
525 * FUNCTION: acpi_tb_uninstall_table 489 * FUNCTION: acpi_tb_uninstall_table
@@ -534,26 +498,22 @@ acpi_tb_delete_single_table (
534 * 498 *
535 ******************************************************************************/ 499 ******************************************************************************/
536 500
537struct acpi_table_desc * 501struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc
538acpi_tb_uninstall_table ( 502 *table_desc)
539 struct acpi_table_desc *table_desc)
540{ 503{
541 struct acpi_table_desc *next_desc; 504 struct acpi_table_desc *next_desc;
542
543
544 ACPI_FUNCTION_TRACE_PTR ("tb_uninstall_table", table_desc);
545 505
506 ACPI_FUNCTION_TRACE_PTR("tb_uninstall_table", table_desc);
546 507
547 if (!table_desc) { 508 if (!table_desc) {
548 return_PTR (NULL); 509 return_PTR(NULL);
549 } 510 }
550 511
551 /* Unlink the descriptor from the doubly linked list */ 512 /* Unlink the descriptor from the doubly linked list */
552 513
553 if (table_desc->prev) { 514 if (table_desc->prev) {
554 table_desc->prev->next = table_desc->next; 515 table_desc->prev->next = table_desc->next;
555 } 516 } else {
556 else {
557 /* Is first on list, update list head */ 517 /* Is first on list, update list head */
558 518
559 acpi_gbl_table_lists[table_desc->type].next = table_desc->next; 519 acpi_gbl_table_lists[table_desc->type].next = table_desc->next;
@@ -565,16 +525,14 @@ acpi_tb_uninstall_table (
565 525
566 /* Free the memory allocated for the table itself */ 526 /* Free the memory allocated for the table itself */
567 527
568 acpi_tb_delete_single_table (table_desc); 528 acpi_tb_delete_single_table(table_desc);
569 529
570 /* Free the table descriptor */ 530 /* Free the table descriptor */
571 531
572 next_desc = table_desc->next; 532 next_desc = table_desc->next;
573 ACPI_MEM_FREE (table_desc); 533 ACPI_MEM_FREE(table_desc);
574 534
575 /* Return pointer to the next descriptor */ 535 /* Return pointer to the next descriptor */
576 536
577 return_PTR (next_desc); 537 return_PTR(next_desc);
578} 538}
579
580