aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbinstal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/tables/tbinstal.c')
-rw-r--r--drivers/acpi/tables/tbinstal.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 7ffd0fddb4e5..7ca2df75bb11 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -73,17 +73,18 @@ acpi_tb_match_signature(char *signature,
73{ 73{
74 acpi_native_uint i; 74 acpi_native_uint i;
75 75
76 ACPI_FUNCTION_TRACE("tb_match_signature"); 76 ACPI_FUNCTION_TRACE(tb_match_signature);
77 77
78 /* Search for a signature match among the known table types */ 78 /* Search for a signature match among the known table types */
79 79
80 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { 80 for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
81 if (!(acpi_gbl_table_data[i].flags & search_type)) { 81 if (!(acpi_gbl_table_data[i].flags & search_type)) {
82 continue; 82 continue;
83 } 83 }
84 84
85 if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, 85 if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature,
86 acpi_gbl_table_data[i].sig_length)) { 86 acpi_gbl_table_data[i].sig_length)) {
87
87 /* Found a signature match, return index if requested */ 88 /* Found a signature match, return index if requested */
88 89
89 if (table_info) { 90 if (table_info) {
@@ -122,7 +123,7 @@ acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info)
122{ 123{
123 acpi_status status; 124 acpi_status status;
124 125
125 ACPI_FUNCTION_TRACE("tb_install_table"); 126 ACPI_FUNCTION_TRACE(tb_install_table);
126 127
127 /* Lock tables while installing */ 128 /* Lock tables while installing */
128 129
@@ -187,7 +188,7 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type)
187 struct acpi_table_header *table_header; 188 struct acpi_table_header *table_header;
188 acpi_status status; 189 acpi_status status;
189 190
190 ACPI_FUNCTION_TRACE("tb_recognize_table"); 191 ACPI_FUNCTION_TRACE(tb_recognize_table);
191 192
192 /* Ensure that we have a valid table pointer */ 193 /* Ensure that we have a valid table pointer */
193 194
@@ -218,7 +219,6 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type)
218 /* Return the table type and length via the info struct */ 219 /* Return the table type and length via the info struct */
219 220
220 table_info->length = (acpi_size) table_header->length; 221 table_info->length = (acpi_size) table_header->length;
221
222 return_ACPI_STATUS(status); 222 return_ACPI_STATUS(status);
223} 223}
224 224
@@ -243,11 +243,11 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
243 struct acpi_table_desc *table_desc; 243 struct acpi_table_desc *table_desc;
244 acpi_status status; 244 acpi_status status;
245 245
246 ACPI_FUNCTION_TRACE_U32("tb_init_table_descriptor", table_type); 246 ACPI_FUNCTION_TRACE_U32(tb_init_table_descriptor, table_type);
247 247
248 /* Allocate a descriptor for this table */ 248 /* Allocate a descriptor for this table */
249 249
250 table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); 250 table_desc = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc));
251 if (!table_desc) { 251 if (!table_desc) {
252 return_ACPI_STATUS(AE_NO_MEMORY); 252 return_ACPI_STATUS(AE_NO_MEMORY);
253 } 253 }
@@ -274,7 +274,7 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
274 * at this location, so return an error. 274 * at this location, so return an error.
275 */ 275 */
276 if (list_head->next) { 276 if (list_head->next) {
277 ACPI_MEM_FREE(table_desc); 277 ACPI_FREE(table_desc);
278 return_ACPI_STATUS(AE_ALREADY_EXISTS); 278 return_ACPI_STATUS(AE_ALREADY_EXISTS);
279 } 279 }
280 280
@@ -312,15 +312,14 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
312 312
313 /* Finish initialization of the table descriptor */ 313 /* Finish initialization of the table descriptor */
314 314
315 table_desc->loaded_into_namespace = FALSE;
315 table_desc->type = (u8) table_type; 316 table_desc->type = (u8) table_type;
316 table_desc->pointer = table_info->pointer; 317 table_desc->pointer = table_info->pointer;
317 table_desc->length = table_info->length; 318 table_desc->length = table_info->length;
318 table_desc->allocation = table_info->allocation; 319 table_desc->allocation = table_info->allocation;
319 table_desc->aml_start = (u8 *) (table_desc->pointer + 1), 320 table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
320 table_desc->aml_length = (u32) (table_desc->length - 321 table_desc->aml_length = (u32)
321 (u32) sizeof(struct 322 (table_desc->length - (u32) sizeof(struct acpi_table_header));
322 acpi_table_header));
323 table_desc->loaded_into_namespace = FALSE;
324 323
325 /* 324 /*
326 * Set the appropriate global pointer (if there is one) to point to the 325 * Set the appropriate global pointer (if there is one) to point to the
@@ -335,7 +334,6 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
335 334
336 table_info->owner_id = table_desc->owner_id; 335 table_info->owner_id = table_desc->owner_id;
337 table_info->installed_desc = table_desc; 336 table_info->installed_desc = table_desc;
338
339 return_ACPI_STATUS(AE_OK); 337 return_ACPI_STATUS(AE_OK);
340} 338}
341 339
@@ -359,7 +357,7 @@ void acpi_tb_delete_all_tables(void)
359 * Free memory allocated for ACPI tables 357 * Free memory allocated for ACPI tables
360 * Memory can either be mapped or allocated 358 * Memory can either be mapped or allocated
361 */ 359 */
362 for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) { 360 for (type = 0; type < (ACPI_TABLE_ID_MAX + 1); type++) {
363 acpi_tb_delete_tables_by_type(type); 361 acpi_tb_delete_tables_by_type(type);
364 } 362 }
365} 363}
@@ -383,9 +381,9 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type)
383 u32 count; 381 u32 count;
384 u32 i; 382 u32 i;
385 383
386 ACPI_FUNCTION_TRACE_U32("tb_delete_tables_by_type", type); 384 ACPI_FUNCTION_TRACE_U32(tb_delete_tables_by_type, type);
387 385
388 if (type > ACPI_TABLE_MAX) { 386 if (type > ACPI_TABLE_ID_MAX) {
389 return_VOID; 387 return_VOID;
390 } 388 }
391 389
@@ -396,28 +394,28 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type)
396 /* Clear the appropriate "typed" global table pointer */ 394 /* Clear the appropriate "typed" global table pointer */
397 395
398 switch (type) { 396 switch (type) {
399 case ACPI_TABLE_RSDP: 397 case ACPI_TABLE_ID_RSDP:
400 acpi_gbl_RSDP = NULL; 398 acpi_gbl_RSDP = NULL;
401 break; 399 break;
402 400
403 case ACPI_TABLE_DSDT: 401 case ACPI_TABLE_ID_DSDT:
404 acpi_gbl_DSDT = NULL; 402 acpi_gbl_DSDT = NULL;
405 break; 403 break;
406 404
407 case ACPI_TABLE_FADT: 405 case ACPI_TABLE_ID_FADT:
408 acpi_gbl_FADT = NULL; 406 acpi_gbl_FADT = NULL;
409 break; 407 break;
410 408
411 case ACPI_TABLE_FACS: 409 case ACPI_TABLE_ID_FACS:
412 acpi_gbl_FACS = NULL; 410 acpi_gbl_FACS = NULL;
413 break; 411 break;
414 412
415 case ACPI_TABLE_XSDT: 413 case ACPI_TABLE_ID_XSDT:
416 acpi_gbl_XSDT = NULL; 414 acpi_gbl_XSDT = NULL;
417 break; 415 break;
418 416
419 case ACPI_TABLE_SSDT: 417 case ACPI_TABLE_ID_SSDT:
420 case ACPI_TABLE_PSDT: 418 case ACPI_TABLE_ID_PSDT:
421 default: 419 default:
422 break; 420 break;
423 } 421 }
@@ -471,7 +469,7 @@ void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc)
471 469
472 case ACPI_MEM_ALLOCATED: 470 case ACPI_MEM_ALLOCATED:
473 471
474 ACPI_MEM_FREE(table_desc->pointer); 472 ACPI_FREE(table_desc->pointer);
475 break; 473 break;
476 474
477 case ACPI_MEM_MAPPED: 475 case ACPI_MEM_MAPPED:
@@ -503,7 +501,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc
503{ 501{
504 struct acpi_table_desc *next_desc; 502 struct acpi_table_desc *next_desc;
505 503
506 ACPI_FUNCTION_TRACE_PTR("tb_uninstall_table", table_desc); 504 ACPI_FUNCTION_TRACE_PTR(tb_uninstall_table, table_desc);
507 505
508 if (!table_desc) { 506 if (!table_desc) {
509 return_PTR(NULL); 507 return_PTR(NULL);
@@ -530,7 +528,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc
530 /* Free the table descriptor */ 528 /* Free the table descriptor */
531 529
532 next_desc = table_desc->next; 530 next_desc = table_desc->next;
533 ACPI_MEM_FREE(table_desc); 531 ACPI_FREE(table_desc);
534 532
535 /* Return pointer to the next descriptor */ 533 /* Return pointer to the next descriptor */
536 534