diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2010-04-03 14:37:23 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-05-19 03:37:58 -0400 |
commit | 3a8663ee6171e1e61f5c139ed65aa0a769380f00 (patch) | |
tree | 1950967276af3cc4579c20a7ab925d8c7ecf04fb /drivers/pci/dmar.c | |
parent | 92946bc72f2e74c3281b7fc12be9704d455fb3ed (diff) |
intel-iommu: Combine the BIOS DMAR table warning messages
We have nearly the same code for warnings repeated four times. Move
it into a separate function.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/pci/dmar.c')
-rw-r--r-- | drivers/pci/dmar.c | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c index 7771b2dd5978..1959cdadad51 100644 --- a/drivers/pci/dmar.c +++ b/drivers/pci/dmar.c | |||
@@ -618,7 +618,15 @@ int __init dmar_table_init(void) | |||
618 | return 0; | 618 | return 0; |
619 | } | 619 | } |
620 | 620 | ||
621 | static int bios_warned; | 621 | static void warn_invalid_dmar(u64 addr, const char *message) |
622 | { | ||
623 | WARN_ONCE(1, "Your BIOS is broken; DMAR reported at address %llx%s!\n" | ||
624 | "BIOS vendor: %s; Ver: %s; Product Version: %s\n", | ||
625 | addr, message, | ||
626 | dmi_get_system_info(DMI_BIOS_VENDOR), | ||
627 | dmi_get_system_info(DMI_BIOS_VERSION), | ||
628 | dmi_get_system_info(DMI_PRODUCT_VERSION)); | ||
629 | } | ||
622 | 630 | ||
623 | int __init check_zero_address(void) | 631 | int __init check_zero_address(void) |
624 | { | 632 | { |
@@ -644,13 +652,7 @@ int __init check_zero_address(void) | |||
644 | 652 | ||
645 | drhd = (void *)entry_header; | 653 | drhd = (void *)entry_header; |
646 | if (!drhd->address) { | 654 | if (!drhd->address) { |
647 | /* Promote an attitude of violence to a BIOS engineer today */ | 655 | warn_invalid_dmar(0, ""); |
648 | WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n" | ||
649 | "BIOS vendor: %s; Ver: %s; Product Version: %s\n", | ||
650 | dmi_get_system_info(DMI_BIOS_VENDOR), | ||
651 | dmi_get_system_info(DMI_BIOS_VERSION), | ||
652 | dmi_get_system_info(DMI_PRODUCT_VERSION)); | ||
653 | bios_warned = 1; | ||
654 | goto failed; | 656 | goto failed; |
655 | } | 657 | } |
656 | 658 | ||
@@ -663,14 +665,8 @@ int __init check_zero_address(void) | |||
663 | ecap = dmar_readq(addr + DMAR_ECAP_REG); | 665 | ecap = dmar_readq(addr + DMAR_ECAP_REG); |
664 | early_iounmap(addr, VTD_PAGE_SIZE); | 666 | early_iounmap(addr, VTD_PAGE_SIZE); |
665 | if (cap == (uint64_t)-1 && ecap == (uint64_t)-1) { | 667 | if (cap == (uint64_t)-1 && ecap == (uint64_t)-1) { |
666 | /* Promote an attitude of violence to a BIOS engineer today */ | 668 | warn_invalid_dmar(drhd->address, |
667 | WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n" | 669 | " returns all ones"); |
668 | "BIOS vendor: %s; Ver: %s; Product Version: %s\n", | ||
669 | drhd->address, | ||
670 | dmi_get_system_info(DMI_BIOS_VENDOR), | ||
671 | dmi_get_system_info(DMI_BIOS_VERSION), | ||
672 | dmi_get_system_info(DMI_PRODUCT_VERSION)); | ||
673 | bios_warned = 1; | ||
674 | goto failed; | 670 | goto failed; |
675 | } | 671 | } |
676 | } | 672 | } |
@@ -735,14 +731,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd) | |||
735 | int msagaw = 0; | 731 | int msagaw = 0; |
736 | 732 | ||
737 | if (!drhd->reg_base_addr) { | 733 | if (!drhd->reg_base_addr) { |
738 | if (!bios_warned) { | 734 | warn_invalid_dmar(0, ""); |
739 | WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n" | ||
740 | "BIOS vendor: %s; Ver: %s; Product Version: %s\n", | ||
741 | dmi_get_system_info(DMI_BIOS_VENDOR), | ||
742 | dmi_get_system_info(DMI_BIOS_VERSION), | ||
743 | dmi_get_system_info(DMI_PRODUCT_VERSION)); | ||
744 | bios_warned = 1; | ||
745 | } | ||
746 | return -EINVAL; | 735 | return -EINVAL; |
747 | } | 736 | } |
748 | 737 | ||
@@ -762,16 +751,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd) | |||
762 | iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG); | 751 | iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG); |
763 | 752 | ||
764 | if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) { | 753 | if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) { |
765 | if (!bios_warned) { | 754 | warn_invalid_dmar(drhd->reg_base_addr, " returns all ones"); |
766 | /* Promote an attitude of violence to a BIOS engineer today */ | ||
767 | WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n" | ||
768 | "BIOS vendor: %s; Ver: %s; Product Version: %s\n", | ||
769 | drhd->reg_base_addr, | ||
770 | dmi_get_system_info(DMI_BIOS_VENDOR), | ||
771 | dmi_get_system_info(DMI_BIOS_VERSION), | ||
772 | dmi_get_system_info(DMI_PRODUCT_VERSION)); | ||
773 | bios_warned = 1; | ||
774 | } | ||
775 | goto err_unmap; | 755 | goto err_unmap; |
776 | } | 756 | } |
777 | 757 | ||