Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9dc625e72309e1c919ea3e7f51d0ffca96123787
Commit:     9dc625e72309e1c919ea3e7f51d0ffca96123787
Parent:     8b3c7622057266d77222a7b54ea7c529270b8901
Author:     Peer Chen <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 4 23:50:13 2008 -0800
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Thu Feb 21 15:34:37 2008 -0800

    PCI: quirks: set 'En' bit of MSI Mapping for devices onHT-based nvidia 
platform
    
    According to HT spec, to get message interrupt from devices mapped to HT
    interrupt message, the 'En' bit of MSI Mapping capability need to be set.
    The patch do this setting in quirks code for the devices on HT-based nvidia
    platform.
    
    [EMAIL PROTECTED]: coding-style fixes]
    
    Signed-off-by: Andy Currid <[EMAIL PROTECTED]>
    Signed-off-by: Peer Chen <[EMAIL PROTECTED]>
    Cc: "Eric W. Biederman" <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Cc: Thomas Gleixner <[EMAIL PROTECTED]>
    Cc: Andi Kleen <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/pci/quirks.c |   62 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index f0b3b71..bbad4a9 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1778,6 +1778,68 @@ static void __devinit 
quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
                        quirk_nvidia_ck804_msi_ht_cap);
 
+/*
+ *  Force enable MSI mapping capability on HT bridges  */
+static inline void ht_enable_msi_mapping(struct pci_dev *dev)
+{
+       int pos, ttl = 48;
+
+       pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
+       while (pos && ttl--) {
+               u8 flags;
+
+               if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
+                                        &flags) == 0) {
+                       dev_info(&dev->dev, "Enabling HT MSI Mapping\n");
+
+                       pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
+                                             flags | HT_MSI_FLAGS_ENABLE);
+               }
+               pos = pci_find_next_ht_capability(dev, pos,
+                                                 HT_CAPTYPE_MSI_MAPPING);
+       }
+}
+
+static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
+{
+       struct pci_dev *host_bridge;
+       int pos, ttl = 48;
+
+       /*
+        * HT MSI mapping should be disabled on devices that are below
+        * a non-Hypertransport host bridge. Locate the host bridge...
+        */
+       host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
+       if (host_bridge == NULL) {
+               dev_warn(&dev->dev,
+                        "nv_msi_ht_cap_quirk didn't locate host bridge\n");
+               return;
+       }
+
+       pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE);
+       if (pos != 0) {
+               /* Host bridge is to HT */
+               ht_enable_msi_mapping(dev);
+               return;
+       }
+
+       /* Host bridge is not to HT, disable HT MSI mapping on this device */
+       pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
+       while (pos && ttl--) {
+               u8 flags;
+
+               if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
+                                        &flags) == 0) {
+                       dev_info(&dev->dev, "Quirk disabling HT MSI mapping");
+                       pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
+                                             flags & ~HT_MSI_FLAGS_ENABLE);
+               }
+               pos = pci_find_next_ht_capability(dev, pos,
+                                                 HT_CAPTYPE_MSI_MAPPING);
+       }
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk);
+
 static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
 {
        dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to