diff options
Diffstat (limited to 'drivers/acpi/tables/tbconvrt.c')
-rw-r--r-- | drivers/acpi/tables/tbconvrt.c | 105 |
1 files changed, 73 insertions, 32 deletions
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 334327c1f66f..92e0c31539be 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c | |||
@@ -50,6 +50,24 @@ | |||
50 | #define _COMPONENT ACPI_TABLES | 50 | #define _COMPONENT ACPI_TABLES |
51 | ACPI_MODULE_NAME ("tbconvrt") | 51 | ACPI_MODULE_NAME ("tbconvrt") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static void | ||
56 | acpi_tb_init_generic_address ( | ||
57 | struct acpi_generic_address *new_gas_struct, | ||
58 | u8 register_bit_width, | ||
59 | acpi_physical_address address); | ||
60 | |||
61 | static void | ||
62 | acpi_tb_convert_fadt1 ( | ||
63 | struct fadt_descriptor_rev2 *local_fadt, | ||
64 | struct fadt_descriptor_rev1 *original_fadt); | ||
65 | |||
66 | static void | ||
67 | acpi_tb_convert_fadt2 ( | ||
68 | struct fadt_descriptor_rev2 *local_fadt, | ||
69 | struct fadt_descriptor_rev2 *original_fadt); | ||
70 | |||
53 | 71 | ||
54 | u8 acpi_fadt_is_v1; | 72 | u8 acpi_fadt_is_v1; |
55 | EXPORT_SYMBOL(acpi_fadt_is_v1); | 73 | EXPORT_SYMBOL(acpi_fadt_is_v1); |
@@ -142,11 +160,13 @@ acpi_tb_convert_to_xsdt ( | |||
142 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 160 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
143 | if (acpi_gbl_RSDP->revision < 2) { | 161 | if (acpi_gbl_RSDP->revision < 2) { |
144 | ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], | 162 | ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], |
145 | (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, table_info->pointer))->table_offset_entry[i]); | 163 | (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, |
164 | table_info->pointer))->table_offset_entry[i]); | ||
146 | } | 165 | } |
147 | else { | 166 | else { |
148 | new_table->table_offset_entry[i] = | 167 | new_table->table_offset_entry[i] = |
149 | (ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info->pointer))->table_offset_entry[i]; | 168 | (ACPI_CAST_PTR (XSDT_DESCRIPTOR, |
169 | table_info->pointer))->table_offset_entry[i]; | ||
150 | } | 170 | } |
151 | } | 171 | } |
152 | 172 | ||
@@ -164,7 +184,7 @@ acpi_tb_convert_to_xsdt ( | |||
164 | } | 184 | } |
165 | 185 | ||
166 | 186 | ||
167 | /****************************************************************************** | 187 | /******************************************************************************* |
168 | * | 188 | * |
169 | * FUNCTION: acpi_tb_init_generic_address | 189 | * FUNCTION: acpi_tb_init_generic_address |
170 | * | 190 | * |
@@ -201,7 +221,7 @@ acpi_tb_init_generic_address ( | |||
201 | * PARAMETERS: local_fadt - Pointer to new FADT | 221 | * PARAMETERS: local_fadt - Pointer to new FADT |
202 | * original_fadt - Pointer to old FADT | 222 | * original_fadt - Pointer to old FADT |
203 | * | 223 | * |
204 | * RETURN: Populates local_fadt | 224 | * RETURN: None, populates local_fadt |
205 | * | 225 | * |
206 | * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format | 226 | * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format |
207 | * | 227 | * |
@@ -213,7 +233,6 @@ acpi_tb_convert_fadt1 ( | |||
213 | struct fadt_descriptor_rev1 *original_fadt) | 233 | struct fadt_descriptor_rev1 *original_fadt) |
214 | { | 234 | { |
215 | 235 | ||
216 | |||
217 | /* ACPI 1.0 FACS */ | 236 | /* ACPI 1.0 FACS */ |
218 | /* The BIOS stored FADT should agree with Revision 1.0 */ | 237 | /* The BIOS stored FADT should agree with Revision 1.0 */ |
219 | acpi_fadt_is_v1 = 1; | 238 | acpi_fadt_is_v1 = 1; |
@@ -232,7 +251,8 @@ acpi_tb_convert_fadt1 ( | |||
232 | ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); | 251 | ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); |
233 | 252 | ||
234 | /* | 253 | /* |
235 | * System Interrupt Model isn't used in ACPI 2.0 (local_fadt->Reserved1 = 0;) | 254 | * System Interrupt Model isn't used in ACPI 2.0 |
255 | * (local_fadt->Reserved1 = 0;) | ||
236 | */ | 256 | */ |
237 | 257 | ||
238 | /* | 258 | /* |
@@ -269,7 +289,8 @@ acpi_tb_convert_fadt1 ( | |||
269 | * that immediately follows. | 289 | * that immediately follows. |
270 | */ | 290 | */ |
271 | ACPI_MEMCPY (&local_fadt->reset_register, | 291 | ACPI_MEMCPY (&local_fadt->reset_register, |
272 | &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, original_fadt))->reset_register, | 292 | &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, |
293 | original_fadt))->reset_register, | ||
273 | sizeof (struct acpi_generic_address) + 1); | 294 | sizeof (struct acpi_generic_address) + 1); |
274 | } | 295 | } |
275 | else { | 296 | else { |
@@ -304,7 +325,8 @@ acpi_tb_convert_fadt1 ( | |||
304 | 325 | ||
305 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, | 326 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, |
306 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 327 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
307 | (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + | 328 | (acpi_physical_address) |
329 | (local_fadt->xpm1a_evt_blk.address + | ||
308 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 330 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
309 | 331 | ||
310 | /* PM1B is optional; leave null if not present */ | 332 | /* PM1B is optional; leave null if not present */ |
@@ -312,7 +334,8 @@ acpi_tb_convert_fadt1 ( | |||
312 | if (local_fadt->xpm1b_evt_blk.address) { | 334 | if (local_fadt->xpm1b_evt_blk.address) { |
313 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, | 335 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, |
314 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 336 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
315 | (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + | 337 | (acpi_physical_address) |
338 | (local_fadt->xpm1b_evt_blk.address + | ||
316 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 339 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
317 | } | 340 | } |
318 | } | 341 | } |
@@ -325,7 +348,7 @@ acpi_tb_convert_fadt1 ( | |||
325 | * PARAMETERS: local_fadt - Pointer to new FADT | 348 | * PARAMETERS: local_fadt - Pointer to new FADT |
326 | * original_fadt - Pointer to old FADT | 349 | * original_fadt - Pointer to old FADT |
327 | * | 350 | * |
328 | * RETURN: Populates local_fadt | 351 | * RETURN: None, populates local_fadt |
329 | * | 352 | * |
330 | * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. | 353 | * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. |
331 | * Handles optional "X" fields. | 354 | * Handles optional "X" fields. |
@@ -348,7 +371,8 @@ acpi_tb_convert_fadt2 ( | |||
348 | * is zero. | 371 | * is zero. |
349 | */ | 372 | */ |
350 | if (!(local_fadt->xfirmware_ctrl)) { | 373 | if (!(local_fadt->xfirmware_ctrl)) { |
351 | ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl); | 374 | ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, |
375 | local_fadt->V1_firmware_ctrl); | ||
352 | } | 376 | } |
353 | 377 | ||
354 | if (!(local_fadt->Xdsdt)) { | 378 | if (!(local_fadt->Xdsdt)) { |
@@ -357,32 +381,38 @@ acpi_tb_convert_fadt2 ( | |||
357 | 381 | ||
358 | if (!(local_fadt->xpm1a_evt_blk.address)) { | 382 | if (!(local_fadt->xpm1a_evt_blk.address)) { |
359 | acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, | 383 | acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, |
360 | local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); | 384 | local_fadt->pm1_evt_len, |
385 | (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); | ||
361 | } | 386 | } |
362 | 387 | ||
363 | if (!(local_fadt->xpm1b_evt_blk.address)) { | 388 | if (!(local_fadt->xpm1b_evt_blk.address)) { |
364 | acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, | 389 | acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, |
365 | local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); | 390 | local_fadt->pm1_evt_len, |
391 | (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); | ||
366 | } | 392 | } |
367 | 393 | ||
368 | if (!(local_fadt->xpm1a_cnt_blk.address)) { | 394 | if (!(local_fadt->xpm1a_cnt_blk.address)) { |
369 | acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, | 395 | acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, |
370 | local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); | 396 | local_fadt->pm1_cnt_len, |
397 | (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); | ||
371 | } | 398 | } |
372 | 399 | ||
373 | if (!(local_fadt->xpm1b_cnt_blk.address)) { | 400 | if (!(local_fadt->xpm1b_cnt_blk.address)) { |
374 | acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, | 401 | acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, |
375 | local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); | 402 | local_fadt->pm1_cnt_len, |
403 | (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); | ||
376 | } | 404 | } |
377 | 405 | ||
378 | if (!(local_fadt->xpm2_cnt_blk.address)) { | 406 | if (!(local_fadt->xpm2_cnt_blk.address)) { |
379 | acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, | 407 | acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, |
380 | local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); | 408 | local_fadt->pm2_cnt_len, |
409 | (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); | ||
381 | } | 410 | } |
382 | 411 | ||
383 | if (!(local_fadt->xpm_tmr_blk.address)) { | 412 | if (!(local_fadt->xpm_tmr_blk.address)) { |
384 | acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, | 413 | acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, |
385 | local_fadt->pm_tm_len, (acpi_physical_address) local_fadt->V1_pm_tmr_blk); | 414 | local_fadt->pm_tm_len, |
415 | (acpi_physical_address) local_fadt->V1_pm_tmr_blk); | ||
386 | } | 416 | } |
387 | 417 | ||
388 | if (!(local_fadt->xgpe0_blk.address)) { | 418 | if (!(local_fadt->xgpe0_blk.address)) { |
@@ -399,18 +429,24 @@ acpi_tb_convert_fadt2 ( | |||
399 | 429 | ||
400 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, | 430 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, |
401 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 431 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
402 | (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + | 432 | (acpi_physical_address) |
433 | (local_fadt->xpm1a_evt_blk.address + | ||
403 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 434 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
404 | acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id; | 435 | |
436 | acpi_gbl_xpm1a_enable.address_space_id = | ||
437 | local_fadt->xpm1a_evt_blk.address_space_id; | ||
405 | 438 | ||
406 | /* PM1B is optional; leave null if not present */ | 439 | /* PM1B is optional; leave null if not present */ |
407 | 440 | ||
408 | if (local_fadt->xpm1b_evt_blk.address) { | 441 | if (local_fadt->xpm1b_evt_blk.address) { |
409 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, | 442 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, |
410 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 443 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
411 | (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + | 444 | (acpi_physical_address) |
445 | (local_fadt->xpm1b_evt_blk.address + | ||
412 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 446 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
413 | acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id; | 447 | |
448 | acpi_gbl_xpm1b_enable.address_space_id = | ||
449 | local_fadt->xpm1b_evt_blk.address_space_id; | ||
414 | } | 450 | } |
415 | } | 451 | } |
416 | 452 | ||
@@ -432,7 +468,8 @@ acpi_tb_convert_fadt2 ( | |||
432 | ******************************************************************************/ | 468 | ******************************************************************************/ |
433 | 469 | ||
434 | acpi_status | 470 | acpi_status |
435 | acpi_tb_convert_table_fadt (void) | 471 | acpi_tb_convert_table_fadt ( |
472 | void) | ||
436 | { | 473 | { |
437 | struct fadt_descriptor_rev2 *local_fadt; | 474 | struct fadt_descriptor_rev2 *local_fadt; |
438 | struct acpi_table_desc *table_desc; | 475 | struct acpi_table_desc *table_desc; |
@@ -446,7 +483,8 @@ acpi_tb_convert_table_fadt (void) | |||
446 | * at least as long as the version 1.0 FADT | 483 | * at least as long as the version 1.0 FADT |
447 | */ | 484 | */ |
448 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { | 485 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { |
449 | ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", acpi_gbl_FADT->length)); | 486 | ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", |
487 | acpi_gbl_FADT->length)); | ||
450 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); | 488 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); |
451 | } | 489 | } |
452 | 490 | ||
@@ -461,8 +499,9 @@ acpi_tb_convert_table_fadt (void) | |||
461 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { | 499 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { |
462 | /* Length is too short to be a V2.0 table */ | 500 | /* Length is too short to be a V2.0 table */ |
463 | 501 | ||
464 | ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", | 502 | ACPI_REPORT_WARNING (( |
465 | acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); | 503 | "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", |
504 | acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); | ||
466 | 505 | ||
467 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); | 506 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); |
468 | } | 507 | } |
@@ -478,9 +517,8 @@ acpi_tb_convert_table_fadt (void) | |||
478 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); | 517 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); |
479 | } | 518 | } |
480 | 519 | ||
481 | /* | 520 | /* Global FADT pointer will point to the new common V2.0 FADT */ |
482 | * Global FADT pointer will point to the new common V2.0 FADT | 521 | |
483 | */ | ||
484 | acpi_gbl_FADT = local_fadt; | 522 | acpi_gbl_FADT = local_fadt; |
485 | acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); | 523 | acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); |
486 | 524 | ||
@@ -508,7 +546,7 @@ acpi_tb_convert_table_fadt (void) | |||
508 | 546 | ||
509 | /******************************************************************************* | 547 | /******************************************************************************* |
510 | * | 548 | * |
511 | * FUNCTION: acpi_tb_convert_table_facs | 549 | * FUNCTION: acpi_tb_build_common_facs |
512 | * | 550 | * |
513 | * PARAMETERS: table_info - Info for currently installed FACS | 551 | * PARAMETERS: table_info - Info for currently installed FACS |
514 | * | 552 | * |
@@ -530,12 +568,14 @@ acpi_tb_build_common_facs ( | |||
530 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ | 568 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ |
531 | 569 | ||
532 | if (acpi_gbl_FACS->length < 24) { | 570 | if (acpi_gbl_FACS->length < 24) { |
533 | ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", acpi_gbl_FACS->length)); | 571 | ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", |
572 | acpi_gbl_FACS->length)); | ||
534 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); | 573 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); |
535 | } | 574 | } |
536 | 575 | ||
537 | if (acpi_gbl_FACS->length < 64) { | 576 | if (acpi_gbl_FACS->length < 64) { |
538 | ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", | 577 | ACPI_REPORT_WARNING (( |
578 | "FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", | ||
539 | acpi_gbl_FACS->length)); | 579 | acpi_gbl_FACS->length)); |
540 | } | 580 | } |
541 | 581 | ||
@@ -548,7 +588,8 @@ acpi_tb_build_common_facs ( | |||
548 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { | 588 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { |
549 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ | 589 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ |
550 | 590 | ||
551 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, &(acpi_gbl_FACS->firmware_waking_vector)); | 591 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, |
592 | &(acpi_gbl_FACS->firmware_waking_vector)); | ||
552 | acpi_gbl_common_fACS.vector_width = 32; | 593 | acpi_gbl_common_fACS.vector_width = 32; |
553 | } | 594 | } |
554 | else { | 595 | else { |