RE: [PATCH 1/5] RT kernel: force detect HPET from PCI space

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mikko Tiihonen
Date: Friday, March 30, 2007 - 3:09 pm

> Anyone got the same thing for CK804? I had my hopes high, and then I saw

I have an A8N-E motherboard with AthlonX2 and the ACPI definitions are 
missing the HPET (standard feature of Asus motherboards).

I too got interested to get my motherboard working. Luckily I found this 
http://lkml.org/lkml/2006/12/17/69 from which I generated the following patch:

--- arch/i386/kernel/quirks.c.orig	2007-03-30 23:43:06.000000000 +0300
+++ arch/i386/kernel/quirks.c	2007-03-30 23:26:47.000000000 +0300
@@ -101,5 +101,39 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I
  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_1,     force_enable_hpet);
  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH7_31,     force_enable_hpet);
  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,   PCI_DEVICE_ID_INTEL_ICH8_1,     force_enable_hpet);
+
+static void __init force_enable_nvidia_hpet(struct pci_dev *dev)
+{
+        u8 enabled;
+	u32 addr;
+
+	if (hpet_address)
+		return;
+
+	pci_read_config_dword(dev, 0x44, &addr);
+	if (addr != 0xfefff000L) {
+		printk(KERN_INFO "Unsafe HPET address 0x%08x. Cannot force enable HPET\n", addr);
+		return;
+	}
+
+	pci_read_config_byte(dev, 0xA3, &enabled);
+	if ((enabled & 4) == 0) {
+	        if (enabled != 0xc1) {
+		  printk(KERN_INFO "Unsafe HPET enable 0x%02x. Cannot force enable HPET\n", enabled);
+		  return;
+		}
+		pci_write_config_byte(dev, 0xA3, enabled | 4);
+		pci_read_config_byte(dev, 0xA3, &enabled);
+		if ((enabled & 4) == 0) {
+			printk(KERN_INFO "Failed to force enable HPET\n");
+			return;
+		}
+	}
+
+	force_hpet_address = addr;
+	printk(KERN_INFO "Force enabled HPET. Base address 0x%08lx\n", force_hpet_address);
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA,	0x0050,     force_enable_nvidia_hpet); // NForce4
  #endif

Now Linux seems to detect HPET and it passes at least the basic sanity checks:

Force enabled HPET. Base address 0xfefff000
HPET: hpet_period 40000000, hpet_tick 83333
Successfully registered HPET clocksource

Unfortunately the 2.6.20-mm2 kernel to which I tried to patch the patch series 
seems to hang few seconds later after half way in udev startup event 
processing.

It could either be something totally different in 2.6.20-mm2 that just happens 
to fail or more likely some interrupt setup that still needs to be done.

I have no idea how to continue from here.

-Mikko
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
RE: [PATCH 1/5] RT kernel: force detect HPET from PCI space, Mikko Tiihonen, (Fri Mar 30, 3:09 pm)
RE: [PATCH 1/5] RT kernel: force detect HPET from PCI space, Nicolas Mailhot, (Fri Mar 30, 3:38 pm)
Re: [PATCH 1/5] RT kernel: force detect HPET from PCI space, Krzysztof Halasa, (Sat Mar 31, 3:37 am)
Re: [PATCH 1/5] RT kernel: force detect HPET from PCI space, Nicolas Mailhot, (Sat Mar 31, 4:36 am)