Skip to contentSkip to conversation

Late init of HPET after PCI quirk detection

PATCH In review Venki Pallipadi 1 participant 1 message May 7, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 5/8 Late init of HPET after PCI quirk detection

Enable HPET later during boot, after the force detect in PCI quirks.

include/asm-i386/hpet.h +1 -0
Index: linux-2.6.21-rc-mm-hpet/include/asm-i386/hpet.h
===================================================================
@@ -91,6 +91,7 @@
 #define HPET_TICK_RATE  (HZ * 100000UL)
 
 extern unsigned long hpet_address;	/* hpet memory map physical address */
+extern unsigned long force_hpet_address;/* hpet address as detected by quirks */
 extern int is_hpet_enabled(void);
 
 #ifdef CONFIG_X86_64
arch/i386/kernel/hpet.c +24 -0
Index: linux-2.6.21-rc-mm-hpet/arch/i386/kernel/hpet.c
===================================================================
@@ -125,6 +125,7 @@
 	.set_next_event = hpet_legacy_next_event,
 	.shift		= 32,
 	.irq		= 0,
+	.rating		= 50,
 };
 
 static void hpet_start_counter(void)
@@ -285,6 +286,9 @@
 {
 	unsigned long id;
 
+	if (hpet_virt_address)
+		return 0;
+
 	if (!is_hpet_capable())
 		return 0;
 
@@ -329,6 +333,26 @@
 }
 
 
+static int __init hpet_late_init(void)
+{
+	if (boot_hpet_disable)
+		return -ENODEV;
+
+	if (!hpet_address) {
+		if (!force_hpet_address)
+			return -ENODEV;
+
+		hpet_address = force_hpet_address;
+		hpet_enable();
+		if (!hpet_virt_address)
+			return -ENODEV;
+	}
+
+	return 0;
+}
+module_init(hpet_late_init);
+
+
 #ifdef CONFIG_HPET_EMULATE_RTC
 
 /* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET