diff options
Diffstat (limited to 'drivers/acpi/acpica/tbfadt.c')
-rw-r--r-- | drivers/acpi/acpica/tbfadt.c | 144 |
1 files changed, 82 insertions, 62 deletions
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 4c9c760db4a4..390651860bf0 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -49,9 +49,10 @@ | |||
49 | ACPI_MODULE_NAME("tbfadt") | 49 | ACPI_MODULE_NAME("tbfadt") |
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static ACPI_INLINE void | 52 | static void |
53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
54 | u8 space_id, u8 byte_width, u64 address); | 54 | u8 space_id, |
55 | u8 byte_width, u64 address, char *register_name); | ||
55 | 56 | ||
56 | static void acpi_tb_convert_fadt(void); | 57 | static void acpi_tb_convert_fadt(void); |
57 | 58 | ||
@@ -172,7 +173,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { | |||
172 | * | 173 | * |
173 | * PARAMETERS: generic_address - GAS struct to be initialized | 174 | * PARAMETERS: generic_address - GAS struct to be initialized |
174 | * byte_width - Width of this register | 175 | * byte_width - Width of this register |
175 | * Address - Address of the register | 176 | * address - Address of the register |
176 | * | 177 | * |
177 | * RETURN: None | 178 | * RETURN: None |
178 | * | 179 | * |
@@ -182,10 +183,25 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { | |||
182 | * | 183 | * |
183 | ******************************************************************************/ | 184 | ******************************************************************************/ |
184 | 185 | ||
185 | static ACPI_INLINE void | 186 | static void |
186 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 187 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
187 | u8 space_id, u8 byte_width, u64 address) | 188 | u8 space_id, |
189 | u8 byte_width, u64 address, char *register_name) | ||
188 | { | 190 | { |
191 | u8 bit_width; | ||
192 | |||
193 | /* Bit width field in the GAS is only one byte long, 255 max */ | ||
194 | |||
195 | bit_width = (u8)(byte_width * 8); | ||
196 | |||
197 | if (byte_width > 31) { /* (31*8)=248 */ | ||
198 | ACPI_ERROR((AE_INFO, | ||
199 | "%s - 32-bit FADT register is too long (%u bytes, %u bits) " | ||
200 | "to convert to GAS struct - 255 bits max, truncating", | ||
201 | register_name, byte_width, (byte_width * 8))); | ||
202 | |||
203 | bit_width = 255; | ||
204 | } | ||
189 | 205 | ||
190 | /* | 206 | /* |
191 | * The 64-bit Address field is non-aligned in the byte packed | 207 | * The 64-bit Address field is non-aligned in the byte packed |
@@ -196,7 +212,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | |||
196 | /* All other fields are byte-wide */ | 212 | /* All other fields are byte-wide */ |
197 | 213 | ||
198 | generic_address->space_id = space_id; | 214 | generic_address->space_id = space_id; |
199 | generic_address->bit_width = (u8)ACPI_MUL_8(byte_width); | 215 | generic_address->bit_width = bit_width; |
200 | generic_address->bit_offset = 0; | 216 | generic_address->bit_offset = 0; |
201 | generic_address->access_width = 0; /* Access width ANY */ | 217 | generic_address->access_width = 0; /* Access width ANY */ |
202 | } | 218 | } |
@@ -267,8 +283,8 @@ void acpi_tb_parse_fadt(u32 table_index) | |||
267 | * | 283 | * |
268 | * FUNCTION: acpi_tb_create_local_fadt | 284 | * FUNCTION: acpi_tb_create_local_fadt |
269 | * | 285 | * |
270 | * PARAMETERS: Table - Pointer to BIOS FADT | 286 | * PARAMETERS: table - Pointer to BIOS FADT |
271 | * Length - Length of the table | 287 | * length - Length of the table |
272 | * | 288 | * |
273 | * RETURN: None | 289 | * RETURN: None |
274 | * | 290 | * |
@@ -287,11 +303,11 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | |||
287 | * a warning. | 303 | * a warning. |
288 | */ | 304 | */ |
289 | if (length > sizeof(struct acpi_table_fadt)) { | 305 | if (length > sizeof(struct acpi_table_fadt)) { |
290 | ACPI_WARNING((AE_INFO, | 306 | ACPI_BIOS_WARNING((AE_INFO, |
291 | "FADT (revision %u) is longer than ACPI 5.0 version, " | 307 | "FADT (revision %u) is longer than ACPI 5.0 version, " |
292 | "truncating length %u to %u", | 308 | "truncating length %u to %u", |
293 | table->revision, length, | 309 | table->revision, length, |
294 | (u32)sizeof(struct acpi_table_fadt))); | 310 | (u32)sizeof(struct acpi_table_fadt))); |
295 | } | 311 | } |
296 | 312 | ||
297 | /* Clear the entire local FADT */ | 313 | /* Clear the entire local FADT */ |
@@ -436,11 +452,13 @@ static void acpi_tb_convert_fadt(void) | |||
436 | * they must match. | 452 | * they must match. |
437 | */ | 453 | */ |
438 | if (address64->address && address32 && | 454 | if (address64->address && address32 && |
439 | (address64->address != (u64) address32)) { | 455 | (address64->address != (u64)address32)) { |
440 | ACPI_ERROR((AE_INFO, | 456 | ACPI_BIOS_ERROR((AE_INFO, |
441 | "32/64X address mismatch in %s: 0x%8.8X/0x%8.8X%8.8X, using 32", | 457 | "32/64X address mismatch in FADT/%s: " |
442 | fadt_info_table[i].name, address32, | 458 | "0x%8.8X/0x%8.8X%8.8X, using 32", |
443 | ACPI_FORMAT_UINT64(address64->address))); | 459 | fadt_info_table[i].name, address32, |
460 | ACPI_FORMAT_UINT64(address64-> | ||
461 | address))); | ||
444 | } | 462 | } |
445 | 463 | ||
446 | /* Always use 32-bit address if it is valid (non-null) */ | 464 | /* Always use 32-bit address if it is valid (non-null) */ |
@@ -456,7 +474,8 @@ static void acpi_tb_convert_fadt(void) | |||
456 | &acpi_gbl_FADT, | 474 | &acpi_gbl_FADT, |
457 | fadt_info_table | 475 | fadt_info_table |
458 | [i].length), | 476 | [i].length), |
459 | (u64) address32); | 477 | (u64) address32, |
478 | fadt_info_table[i].name); | ||
460 | } | 479 | } |
461 | } | 480 | } |
462 | } | 481 | } |
@@ -465,7 +484,7 @@ static void acpi_tb_convert_fadt(void) | |||
465 | * | 484 | * |
466 | * FUNCTION: acpi_tb_validate_fadt | 485 | * FUNCTION: acpi_tb_validate_fadt |
467 | * | 486 | * |
468 | * PARAMETERS: Table - Pointer to the FADT to be validated | 487 | * PARAMETERS: table - Pointer to the FADT to be validated |
469 | * | 488 | * |
470 | * RETURN: None | 489 | * RETURN: None |
471 | * | 490 | * |
@@ -494,25 +513,25 @@ static void acpi_tb_validate_fadt(void) | |||
494 | * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. | 513 | * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. |
495 | */ | 514 | */ |
496 | if (acpi_gbl_FADT.facs && | 515 | if (acpi_gbl_FADT.facs && |
497 | (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) { | 516 | (acpi_gbl_FADT.Xfacs != (u64)acpi_gbl_FADT.facs)) { |
498 | ACPI_WARNING((AE_INFO, | 517 | ACPI_BIOS_WARNING((AE_INFO, |
499 | "32/64X FACS address mismatch in FADT - " | 518 | "32/64X FACS address mismatch in FADT - " |
500 | "0x%8.8X/0x%8.8X%8.8X, using 32", | 519 | "0x%8.8X/0x%8.8X%8.8X, using 32", |
501 | acpi_gbl_FADT.facs, | 520 | acpi_gbl_FADT.facs, |
502 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs))); | 521 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs))); |
503 | 522 | ||
504 | acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs; | 523 | acpi_gbl_FADT.Xfacs = (u64)acpi_gbl_FADT.facs; |
505 | } | 524 | } |
506 | 525 | ||
507 | if (acpi_gbl_FADT.dsdt && | 526 | if (acpi_gbl_FADT.dsdt && |
508 | (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) { | 527 | (acpi_gbl_FADT.Xdsdt != (u64)acpi_gbl_FADT.dsdt)) { |
509 | ACPI_WARNING((AE_INFO, | 528 | ACPI_BIOS_WARNING((AE_INFO, |
510 | "32/64X DSDT address mismatch in FADT - " | 529 | "32/64X DSDT address mismatch in FADT - " |
511 | "0x%8.8X/0x%8.8X%8.8X, using 32", | 530 | "0x%8.8X/0x%8.8X%8.8X, using 32", |
512 | acpi_gbl_FADT.dsdt, | 531 | acpi_gbl_FADT.dsdt, |
513 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt))); | 532 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt))); |
514 | 533 | ||
515 | acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; | 534 | acpi_gbl_FADT.Xdsdt = (u64)acpi_gbl_FADT.dsdt; |
516 | } | 535 | } |
517 | 536 | ||
518 | /* If Hardware Reduced flag is set, we are all done */ | 537 | /* If Hardware Reduced flag is set, we are all done */ |
@@ -542,10 +561,10 @@ static void acpi_tb_validate_fadt(void) | |||
542 | */ | 561 | */ |
543 | if (address64->address && | 562 | if (address64->address && |
544 | (address64->bit_width != ACPI_MUL_8(length))) { | 563 | (address64->bit_width != ACPI_MUL_8(length))) { |
545 | ACPI_WARNING((AE_INFO, | 564 | ACPI_BIOS_WARNING((AE_INFO, |
546 | "32/64X length mismatch in %s: %u/%u", | 565 | "32/64X length mismatch in FADT/%s: %u/%u", |
547 | name, ACPI_MUL_8(length), | 566 | name, ACPI_MUL_8(length), |
548 | address64->bit_width)); | 567 | address64->bit_width)); |
549 | } | 568 | } |
550 | 569 | ||
551 | if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) { | 570 | if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) { |
@@ -554,29 +573,29 @@ static void acpi_tb_validate_fadt(void) | |||
554 | * Both the address and length must be non-zero. | 573 | * Both the address and length must be non-zero. |
555 | */ | 574 | */ |
556 | if (!address64->address || !length) { | 575 | if (!address64->address || !length) { |
557 | ACPI_ERROR((AE_INFO, | 576 | ACPI_BIOS_ERROR((AE_INFO, |
558 | "Required field %s has zero address and/or length:" | 577 | "Required FADT field %s has zero address and/or length: " |
559 | " 0x%8.8X%8.8X/0x%X", | 578 | "0x%8.8X%8.8X/0x%X", |
560 | name, | 579 | name, |
561 | ACPI_FORMAT_UINT64(address64-> | 580 | ACPI_FORMAT_UINT64(address64-> |
562 | address), | 581 | address), |
563 | length)); | 582 | length)); |
564 | } | 583 | } |
565 | } else if (fadt_info_table[i].type & ACPI_FADT_SEPARATE_LENGTH) { | 584 | } else if (fadt_info_table[i].type & ACPI_FADT_SEPARATE_LENGTH) { |
566 | /* | 585 | /* |
567 | * Field is optional (PM2Control, GPE0, GPE1) AND has its own | 586 | * Field is optional (Pm2_control, GPE0, GPE1) AND has its own |
568 | * length field. If present, both the address and length must | 587 | * length field. If present, both the address and length must |
569 | * be valid. | 588 | * be valid. |
570 | */ | 589 | */ |
571 | if ((address64->address && !length) || | 590 | if ((address64->address && !length) || |
572 | (!address64->address && length)) { | 591 | (!address64->address && length)) { |
573 | ACPI_WARNING((AE_INFO, | 592 | ACPI_BIOS_WARNING((AE_INFO, |
574 | "Optional field %s has zero address or length: " | 593 | "Optional FADT field %s has zero address or length: " |
575 | "0x%8.8X%8.8X/0x%X", | 594 | "0x%8.8X%8.8X/0x%X", |
576 | name, | 595 | name, |
577 | ACPI_FORMAT_UINT64(address64-> | 596 | ACPI_FORMAT_UINT64 |
578 | address), | 597 | (address64->address), |
579 | length)); | 598 | length)); |
580 | } | 599 | } |
581 | } | 600 | } |
582 | } | 601 | } |
@@ -621,12 +640,12 @@ static void acpi_tb_setup_fadt_registers(void) | |||
621 | (fadt_info_table[i].default_length > 0) && | 640 | (fadt_info_table[i].default_length > 0) && |
622 | (fadt_info_table[i].default_length != | 641 | (fadt_info_table[i].default_length != |
623 | target64->bit_width)) { | 642 | target64->bit_width)) { |
624 | ACPI_WARNING((AE_INFO, | 643 | ACPI_BIOS_WARNING((AE_INFO, |
625 | "Invalid length for %s: %u, using default %u", | 644 | "Invalid length for FADT/%s: %u, using default %u", |
626 | fadt_info_table[i].name, | 645 | fadt_info_table[i].name, |
627 | target64->bit_width, | 646 | target64->bit_width, |
628 | fadt_info_table[i]. | 647 | fadt_info_table[i]. |
629 | default_length)); | 648 | default_length)); |
630 | 649 | ||
631 | /* Incorrect size, set width to the default */ | 650 | /* Incorrect size, set width to the default */ |
632 | 651 | ||
@@ -670,7 +689,8 @@ static void acpi_tb_setup_fadt_registers(void) | |||
670 | source64->address + | 689 | source64->address + |
671 | (fadt_pm_info_table[i]. | 690 | (fadt_pm_info_table[i]. |
672 | register_num * | 691 | register_num * |
673 | pm1_register_byte_width)); | 692 | pm1_register_byte_width), |
693 | "PmRegisters"); | ||
674 | } | 694 | } |
675 | } | 695 | } |
676 | } | 696 | } |