--- linux-2.6.18-gentoo-r2/arch/x86_64/kernel/time.c.unpatched 2006-11-15 19:29:07.000000000 +0100 +++ linux-2.6.18-gentoo-r2/arch/x86_64/kernel/time.c 2006-11-15 19:30:51.000000000 +0100 @@ -42,6 +42,9 @@ #ifdef CONFIG_X86_LOCAL_APIC #include #endif +#if 1 +#include +#endif #ifdef CONFIG_CPU_FREQ static void cpufreq_delayed_get(void); @@ -815,6 +818,48 @@ static int hpet_init(void) { unsigned int id; +#if 1 + union conf_address { + struct { + u8 reg; + u8 func: 3; + u8 dev: 5; + u8 bus; + u8 reserved:7; + u8 enable: 1; + } bits; + u32 dword; + }; + union conf_address ca = { + .bits.reg = 0, + .bits.dev = 17, + .bits.enable = 1 + }; + union { + struct { + u8 control; + u8 address[3]; + } hpet; + unsigned raw; + } hpet; + u32 vendor_id, control; + + control = inl(0xcf8); + printk("%X\n", control); + outl(ca.dword, 0xcf8); + vendor_id = inl(0xcfc); + if (vendor_id == (PCI_VENDOR_ID_VIA + (PCI_DEVICE_ID_VIA_8237 << 16))) { + hpet.raw = 0xFED00000; + hpet.hpet.control = 0x80; + ca.bits.reg = 0x68; + outl(ca.dword, 0xcf8); + outl(hpet.raw, 0xcfc); + outl(ca.dword, 0xcf8); + vxtime.hpet_address = (inl(0xcfc) & 0xFFFFFF00); + printk(KERN_WARNING "time.c: WARNING: Enabled VIA8237 HPET " + "at %#lx.\n", vxtime.hpet_address); + } +#endif if (!vxtime.hpet_address) return -1;