public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86, HPET: ignore any PCI BARs that match an HPET we already know about
@ 2010-09-22 20:15 Bjorn Helgaas
  2010-09-22 20:19 ` Bjorn Helgaas
  2010-09-22 21:22 ` [tip:x86/pci] x86, pci: Ignore " tip-bot for Bjorn Helgaas
  0 siblings, 2 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2010-09-22 20:15 UTC (permalink / raw)
  To: Venkatesh Pallipadi
  Cc: Prarit Bhargava, Simon Arlott, x86, Clemens Ladisch, linux-kernel,
	Marc Jones, Jordan Crouse, Ingo Molnar, H. Peter Anvin,
	Thomas Gleixner


We often discover the HPET early, via the static ACPI HPET table, before
enumerating PCI devices.  If the HPET is implemented as a PCI function,
we will discover it again during PCI device enumeration.  We must ignore
the PCI function so we don't inadvertently move it out from under the
driver.

I think it's better to ignore *any* PCI BAR that matches a previously
discovered HPET; that way we don't need platform-specific knowledge,
and we won't have to add more quirks for future machines.

This is for a regression from 2.6.34, but the reporter has been
unable to test it yet.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=18482
Reported-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---

 arch/x86/kernel/quirks.c |   21 +++++++++++++++++++++
 arch/x86/pci/fixup.c     |   28 ----------------------------
 2 files changed, 21 insertions(+), 28 deletions(-)


diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 939b9e9..99a7d4b 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -507,6 +507,27 @@ static void force_disable_hpet_msi(struct pci_dev *unused)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
 			 force_disable_hpet_msi);
 
+static void disable_pci_hpet(struct pci_dev *dev)
+{
+	int i;
+
+	if (!hpet_address)
+		return;
+
+	for (i = 0; i < 6; i++) {
+		struct resource *res = &dev->resource[i];
+
+		if (resource_type(res) == IORESOURCE_MEM &&
+		    res->start == hpet_address) {
+			dev_info(&dev->dev, "BAR %d: %pR is an HPET we found earlier; ignoring this BAR\n",
+				 i, res);
+			res->flags = 0;
+			res->start = 0;
+			res->end = 0;
+		}
+	}
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, disable_pci_hpet);
 #endif
 
 #if defined(CONFIG_PCI) && defined(CONFIG_NUMA)
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 6dd8955..08eba69 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -493,31 +493,3 @@ static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015,
 			  pci_siemens_interrupt_controller);
-
-/*
- * SB600: Disable BAR1 on device 14.0 to avoid HPET resources from
- * confusing the PCI engine:
- */
-static void sb600_disable_hpet_bar(struct pci_dev *dev)
-{
-	u8 val;
-
-	/*
-	 * The SB600 and SB700 both share the same device
-	 * ID, but the PM register 0x55 does something different
-	 * for the SB700, so make sure we are dealing with the
-	 * SB600 before touching the bit:
-	 */
-
-	pci_read_config_byte(dev, 0x08, &val);
-
-	if (val < 0x2F) {
-		outb(0x55, 0xCD6);
-		val = inb(0xCD7);
-
-		/* Set bit 7 in PM register 0x55 */
-		outb(0x55, 0xCD6);
-		outb(val | 0x80, 0xCD7);
-	}
-}
-DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, 0x4385, sb600_disable_hpet_bar);


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-09-23 22:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-22 20:15 [PATCH] x86, HPET: ignore any PCI BARs that match an HPET we already know about Bjorn Helgaas
2010-09-22 20:19 ` Bjorn Helgaas
2010-09-22 20:21   ` H. Peter Anvin
2010-09-22 20:56     ` H. Peter Anvin
2010-09-22 21:52       ` Bjorn Helgaas
2010-09-22 22:02         ` H. Peter Anvin
2010-09-22 22:10         ` H. Peter Anvin
2010-09-22 22:37           ` Bjorn Helgaas
2010-09-22 22:39             ` H. Peter Anvin
2010-09-22 21:22 ` [tip:x86/pci] x86, pci: Ignore " tip-bot for Bjorn Helgaas
2010-09-22 21:48   ` Yinghai Lu
2010-09-22 22:41     ` Bjorn Helgaas
2010-09-22 22:53       ` H. Peter Anvin
2010-09-23 22:51     ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox