Pull bugzilla-9345 into release branch
[sfrench/cifs-2.6.git] / arch / x86 / kernel / hpet.c
index f8367074da0dc1919fc45049c6ccaff94e0cc2a3..4a86ffd67ec5e23ecec8c9ed42d9f00ecc051631 100644 (file)
@@ -69,12 +69,15 @@ static inline void hpet_clear_mapping(void)
  * HPET command line enable / disable
  */
 static int boot_hpet_disable;
+int hpet_force_user;
 
 static int __init hpet_setup(char* str)
 {
        if (str) {
                if (!strncmp("disable", str, 7))
                        boot_hpet_disable = 1;
+               if (!strncmp("force", str, 5))
+                       hpet_force_user = 1;
        }
        return 1;
 }
@@ -350,7 +353,7 @@ static int hpet_clocksource_register(void)
         *
         * hpet period is in femto seconds per cycle
         * so we need to convert this to ns/cyc units
-        * aproximated by mult/2^shift
+        * approximated by mult/2^shift
         *
         *  fsec/cyc * 1nsec/1000000fsec = nsec/cyc = mult/2^shift
         *  fsec/cyc * 1ns/1000000fsec * 2^shift = mult
@@ -443,6 +446,20 @@ static __init int hpet_late_init(void)
 }
 fs_initcall(hpet_late_init);
 
+void hpet_disable(void)
+{
+       if (is_hpet_capable()) {
+               unsigned long cfg = hpet_readl(HPET_CFG);
+
+               if (hpet_legacy_int_enabled) {
+                       cfg &= ~HPET_CFG_LEGACY;
+                       hpet_legacy_int_enabled = 0;
+               }
+               cfg &= ~HPET_CFG_ENABLE;
+               hpet_writel(cfg, HPET_CFG);
+       }
+}
+
 #ifdef CONFIG_HPET_EMULATE_RTC
 
 /* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET