Merge branch 'timers/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6.git] / arch / x86 / kernel / quirks.c
index f327aba..d138588 100644 (file)
@@ -65,6 +65,7 @@ static enum {
        ICH_FORCE_HPET_RESUME,
        VT8237_FORCE_HPET_RESUME,
        NVIDIA_FORCE_HPET_RESUME,
+       ATI_FORCE_HPET_RESUME,
 } force_hpet_resume_type;
 
 static void __iomem *rcba_base;
@@ -176,6 +177,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7,
 
 static struct pci_dev *cached_dev;
 
+static void hpet_print_force_info(void)
+{
+       printk(KERN_INFO "HPET not enabled in BIOS. "
+              "You might try hpet=force boot option\n");
+}
+
 static void old_ich_force_hpet_resume(void)
 {
        u32 val;
@@ -255,6 +262,8 @@ static void old_ich_force_enable_hpet_user(struct pci_dev *dev)
 {
        if (hpet_force_user)
                old_ich_force_enable_hpet(dev);
+       else
+               hpet_print_force_info();
 }
 
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1,
@@ -294,8 +303,13 @@ static void vt8237_force_enable_hpet(struct pci_dev *dev)
 {
        u32 uninitialized_var(val);
 
-       if (!hpet_force_user || hpet_address || force_hpet_address)
+       if (hpet_address || force_hpet_address)
+               return;
+
+       if (!hpet_force_user) {
+               hpet_print_force_info();
                return;
+       }
 
        pci_read_config_dword(dev, 0x68, &val);
        /*
@@ -334,6 +348,36 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235,
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
                         vt8237_force_enable_hpet);
 
+static void ati_force_hpet_resume(void)
+{
+       pci_write_config_dword(cached_dev, 0x14, 0xfed00000);
+       printk(KERN_DEBUG "Force enabled HPET at resume\n");
+}
+
+static void ati_force_enable_hpet(struct pci_dev *dev)
+{
+       u32 uninitialized_var(val);
+
+       if (hpet_address || force_hpet_address)
+               return;
+
+       if (!hpet_force_user) {
+               hpet_print_force_info();
+               return;
+       }
+
+       pci_write_config_dword(dev, 0x14, 0xfed00000);
+       pci_read_config_dword(dev, 0x14, &val);
+       force_hpet_address = val;
+       force_hpet_resume_type = ATI_FORCE_HPET_RESUME;
+       dev_printk(KERN_DEBUG, &dev->dev, "Force enabled HPET at 0x%lx\n",
+                  force_hpet_address);
+       cached_dev = dev;
+       return;
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS,
+                        ati_force_enable_hpet);
+
 /*
  * Undocumented chipset feature taken from LinuxBIOS.
  */
@@ -347,9 +391,14 @@ static void nvidia_force_enable_hpet(struct pci_dev *dev)
 {
        u32 uninitialized_var(val);
 
-       if (!hpet_force_user || hpet_address || force_hpet_address)
+       if (hpet_address || force_hpet_address)
                return;
 
+       if (!hpet_force_user) {
+               hpet_print_force_info();
+               return;
+       }
+
        pci_write_config_dword(dev, 0x44, 0xfed00001);
        pci_read_config_dword(dev, 0x44, &val);
        force_hpet_address = val & 0xfffffffe;
@@ -401,6 +450,9 @@ void force_hpet_resume(void)
        case NVIDIA_FORCE_HPET_RESUME:
                nvidia_force_hpet_resume();
                return;
+       case ATI_FORCE_HPET_RESUME:
+               ati_force_hpet_resume();
+               return;
        default:
                break;
        }