From: Ben Hutchings <ben@decadent.org.uk>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: David Woodhouse <dwmw2@infradead.org>,
linux-pci@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/4] pci/dmar: Combine the BIOS DMAR table warning messages
Date: Sat, 20 Mar 2010 23:01:37 +0000 [thread overview]
Message-ID: <1269126097.18314.111.camel@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 3487 bytes --]
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>
---
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 ffe22bc..f101057 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -613,7 +613,15 @@ int __init dmar_table_init(void)
return 0;
}
-static int bios_warned;
+static void warn_invalid_dmar(u64 addr, const char *message)
+{
+ WARN_ONCE(1, "Your BIOS is broken; DMAR reported at address %llx%s!\n"
+ "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
+ addr, message,
+ dmi_get_system_info(DMI_BIOS_VENDOR),
+ dmi_get_system_info(DMI_BIOS_VERSION),
+ dmi_get_system_info(DMI_PRODUCT_VERSION));
+}
int __init check_zero_address(void)
{
@@ -639,13 +647,7 @@ int __init check_zero_address(void)
drhd = (void *)entry_header;
if (!drhd->address) {
- /* Promote an attitude of violence to a BIOS engineer today */
- WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n"
- "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
- dmi_get_system_info(DMI_BIOS_VENDOR),
- dmi_get_system_info(DMI_BIOS_VERSION),
- dmi_get_system_info(DMI_PRODUCT_VERSION));
- bios_warned = 1;
+ warn_invalid_dmar(0, "");
goto failed;
}
@@ -658,14 +660,8 @@ int __init check_zero_address(void)
ecap = dmar_readq(addr + DMAR_ECAP_REG);
early_iounmap(addr, VTD_PAGE_SIZE);
if (cap == (uint64_t)-1 && ecap == (uint64_t)-1) {
- /* Promote an attitude of violence to a BIOS engineer today */
- WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
- "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
- drhd->address,
- dmi_get_system_info(DMI_BIOS_VENDOR),
- dmi_get_system_info(DMI_BIOS_VERSION),
- dmi_get_system_info(DMI_PRODUCT_VERSION));
- bios_warned = 1;
+ warn_invalid_dmar(drhd->address,
+ " returns all ones");
goto failed;
}
}
@@ -730,14 +726,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
int msagaw = 0;
if (!drhd->reg_base_addr) {
- if (!bios_warned) {
- WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n"
- "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
- dmi_get_system_info(DMI_BIOS_VENDOR),
- dmi_get_system_info(DMI_BIOS_VERSION),
- dmi_get_system_info(DMI_PRODUCT_VERSION));
- bios_warned = 1;
- }
+ warn_invalid_dmar(0, "");
return -EINVAL;
}
@@ -757,16 +746,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) {
- if (!bios_warned) {
- /* Promote an attitude of violence to a BIOS engineer today */
- WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
- "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
- drhd->reg_base_addr,
- dmi_get_system_info(DMI_BIOS_VENDOR),
- dmi_get_system_info(DMI_BIOS_VERSION),
- dmi_get_system_info(DMI_PRODUCT_VERSION));
- bios_warned = 1;
- }
+ warn_invalid_dmar(drhd->reg_base_addr, " returns all ones");
goto err_unmap;
}
--
1.7.0
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next reply other threads:[~2010-03-20 23:01 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-20 23:01 Ben Hutchings [this message]
2010-03-20 23:05 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed from TAINT_WARN Ben Hutchings
2010-03-20 23:05 ` Ben Hutchings
2010-03-20 23:05 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed Ben Hutchings
2010-03-21 19:10 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed from TAINT_WARN Andi Kleen
2010-03-21 19:10 ` Andi Kleen
2010-03-21 19:10 ` Andi Kleen
2010-03-21 19:25 ` Ben Hutchings
2010-03-21 19:25 ` Ben Hutchings
2010-03-21 19:25 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed Ben Hutchings
2010-03-23 2:47 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed from TAINT_WARN Andrew Morton
2010-03-23 2:47 ` Andrew Morton
2010-03-23 2:47 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed Andrew Morton
2010-03-23 13:20 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed from TAINT_WARN Ben Hutchings
2010-03-23 13:20 ` Ben Hutchings
2010-03-23 13:20 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed Ben Hutchings
2010-03-23 7:45 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed from TAINT_WARN Paul Mundt
2010-03-23 7:45 ` Paul Mundt
2010-03-23 7:45 ` Paul Mundt
2010-03-23 13:23 ` Ben Hutchings
2010-03-23 13:23 ` Ben Hutchings
2010-03-23 13:23 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed Ben Hutchings
2010-03-24 11:11 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed from TAINT_WARN Michael Ellerman
2010-03-24 11:11 ` Michael Ellerman
2010-03-24 11:11 ` [PATCH 2/4] panic: Allow taint flag for warnings to be changed Michael Ellerman
2010-03-20 23:06 ` [PATCH 3/4] panic: Add taint flag TAINT_FIRMWARE_WORKAROUND ('I') Ben Hutchings
2010-03-21 1:56 ` Randy Dunlap
2010-03-20 23:07 ` [PATCH 4/4] pci/dmar: Tone down warnings about invalid BIOS DMAR tables Ben Hutchings
2010-03-21 8:43 ` David Woodhouse
2010-03-21 14:57 ` Ben Hutchings
2010-03-21 15:57 ` David Woodhouse
2010-03-23 2:46 ` [PATCH 1/4] pci/dmar: Combine the BIOS DMAR table warning messages Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1269126097.18314.111.camel@localhost \
--to=ben@decadent.org.uk \
--cc=dwmw2@infradead.org \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.