Re: Re: [PATCH]quirks: set 'En' bit of MSI Mapping for devices onHT-based nvidia platform

2008-01-11 Thread peerchen
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.


Signed-off-by: Andy Currid <[EMAIL PROTECTED]>
Signed-off-by: Peer Chen <[EMAIL PROTECTED]>

---
--- linux-2.6.24-rc7/drivers/pci/quirks.c.orig  2008-01-09 16:37:36.0 
-0500
+++ linux-2.6.24-rc7/drivers/pci/quirks.c   2008-01-10 15:03:09.0 
-0500
@@ -1705,6 +1705,70 @@ static void __devinit quirk_nvidia_ck804
 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, ) == 0) 
{
+   printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n",
+   dev->dev.bus_id);
+
+   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...
+*/
+
+   if ((host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0,0))) == NULL) {
+   printk(KERN_WARNING
+   "PCI: nv_msi_ht_cap_quirk didn't locate host bridge\n");
+   return;
+   }
+
+   if ((pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE)) != 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, ) == 0) 
{
+   printk(KERN_INFO "PCI: Quirk disabling HT MSI mapping 
on %s\n",
+  pci_name(dev));
+
+   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 linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Re: [PATCH]quirks: set 'En' bit of MSI Mapping for devices onHT-based nvidia platform

2008-01-11 Thread peerchen
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.


Signed-off-by: Andy Currid [EMAIL PROTECTED]
Signed-off-by: Peer Chen [EMAIL PROTECTED]

---
--- linux-2.6.24-rc7/drivers/pci/quirks.c.orig  2008-01-09 16:37:36.0 
-0500
+++ linux-2.6.24-rc7/drivers/pci/quirks.c   2008-01-10 15:03:09.0 
-0500
@@ -1705,6 +1705,70 @@ static void __devinit quirk_nvidia_ck804
 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) 
{
+   printk(KERN_INFO PCI: Enabling HT MSI Mapping on %s\n,
+   dev-dev.bus_id);
+
+   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...
+*/
+
+   if ((host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0,0))) == NULL) {
+   printk(KERN_WARNING
+   PCI: nv_msi_ht_cap_quirk didn't locate host bridge\n);
+   return;
+   }
+
+   if ((pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE)) != 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) 
{
+   printk(KERN_INFO PCI: Quirk disabling HT MSI mapping 
on %s\n,
+  pci_name(dev));
+
+   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 linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH]quirks: set 'En' bit of MSI Mapping for devices on HT-based nvidia platform

2008-01-10 Thread peerchen
Signed-off-by: Andy Currid <[EMAIL PROTECTED]>
Signed-off-by: Peer Chen <[EMAIL PROTECTED]>

---
--- linux-2.6.24-rc7/drivers/pci/quirks.c.orig  2008-01-09 16:37:36.0 
-0500
+++ linux-2.6.24-rc7/drivers/pci/quirks.c   2008-01-10 15:03:09.0 
-0500
@@ -1705,6 +1705,70 @@ static void __devinit quirk_nvidia_ck804
 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, ) == 0) 
{
+   printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n",
+   dev->dev.bus_id);
+
+   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...
+*/
+
+   if ((host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0,0))) == NULL) {
+   printk(KERN_WARNING
+   "PCI: nv_msi_ht_cap_quirk didn't locate host bridge\n");
+   return;
+   }
+
+   if ((pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE)) != 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, ) == 0) 
{
+   printk(KERN_INFO "PCI: Quirk disabling HT MSI mapping 
on %s\n",
+  pci_name(dev));
+
+   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 linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH]quirks: set 'En' bit of MSI Mapping for devices on HT-based nvidia platform

2008-01-10 Thread peerchen
Signed-off-by: Andy Currid [EMAIL PROTECTED]
Signed-off-by: Peer Chen [EMAIL PROTECTED]

---
--- linux-2.6.24-rc7/drivers/pci/quirks.c.orig  2008-01-09 16:37:36.0 
-0500
+++ linux-2.6.24-rc7/drivers/pci/quirks.c   2008-01-10 15:03:09.0 
-0500
@@ -1705,6 +1705,70 @@ static void __devinit quirk_nvidia_ck804
 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) 
{
+   printk(KERN_INFO PCI: Enabling HT MSI Mapping on %s\n,
+   dev-dev.bus_id);
+
+   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...
+*/
+
+   if ((host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0,0))) == NULL) {
+   printk(KERN_WARNING
+   PCI: nv_msi_ht_cap_quirk didn't locate host bridge\n);
+   return;
+   }
+
+   if ((pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE)) != 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) 
{
+   printk(KERN_INFO PCI: Quirk disabling HT MSI mapping 
on %s\n,
+  pci_name(dev));
+
+   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 linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] msi: set 'En' bit of MSI Mapping Capability

2007-12-18 Thread peerchen
According to the HyperTransport spec, 'En' indicate if the MSI Mapping is 
active.
Set the 'En' bit when setup pci and add the quirk for some nvidia devices. 

The patch base on kernel 2.6.24-rc5

Signed-off-by: Andy Currid <[EMAIL PROTECTED]>
Signed-off-by: Peer Chen <[EMAIL PROTECTED]>

---
diff -uprN -X linux-2.6.24-rc5-vanilla/Documentation/dontdiff 
linux-2.6.24-rc5-vanilla/drivers/pci/probe.c 
linux-2.6.24-rc5/drivers/pci/probe.c
--- linux-2.6.24-rc5-vanilla/drivers/pci/probe.c2007-12-18 
14:35:46.0 -0500
+++ linux-2.6.24-rc5/drivers/pci/probe.c2007-12-18 16:28:29.0 
-0500
@@ -721,6 +721,9 @@ static int pci_setup_device(struct pci_d
 
/* "Unknown power state" */
dev->current_state = PCI_UNKNOWN;
+   
+   /* Enable HT MSI mapping */
+   ht_enable_msi_mapping(dev);
 
/* Early fixups, before probing the BARs */
pci_fixup_device(pci_fixup_early, dev);
diff -uprN -X linux-2.6.24-rc5-vanilla/Documentation/dontdiff 
linux-2.6.24-rc5-vanilla/drivers/pci/quirks.c 
linux-2.6.24-rc5/drivers/pci/quirks.c
--- linux-2.6.24-rc5-vanilla/drivers/pci/quirks.c   2007-12-18 
14:35:46.0 -0500
+++ linux-2.6.24-rc5/drivers/pci/quirks.c   2007-12-18 16:28:41.0 
-0500
@@ -1705,6 +1705,45 @@ static void __devinit quirk_nvidia_ck804
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
quirk_nvidia_ck804_msi_ht_cap);
 
+static void __devinit quirk_msi_ht_cap_disable(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...
+*/
+
+   if ((host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0,0))) == NULL) {
+   printk(KERN_WARNING
+"PCI: quirk_msi_ht_cap_disable didn't locate host 
bridge\n");
+   return;
+   }
+
+   if ((pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE)) != 0) 
{
+   /* Host bridge is to HT */
+   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, ) == 0) 
{
+   printk(KERN_INFO "PCI: Quirk disabling HT MSI mapping 
on %s\n",
+  pci_name(dev));
+
+   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,
+   
quirk_msi_ht_cap_disable);
+
 static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
 {
dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
diff -uprN -X linux-2.6.24-rc5-vanilla/Documentation/dontdiff 
linux-2.6.24-rc5-vanilla/include/asm-generic/pci.h 
linux-2.6.24-rc5/include/asm-generic/pci.h
--- linux-2.6.24-rc5-vanilla/include/asm-generic/pci.h  2007-12-18 
14:35:52.0 -0500
+++ linux-2.6.24-rc5/include/asm-generic/pci.h  2007-12-18 16:29:12.0 
-0500
@@ -45,6 +45,10 @@ pcibios_select_root(struct pci_dev *pdev
 
 #define pcibios_scan_all_fns(a, b) 0
 
+#ifndef HAVE_ARCH_HT_ENABLE_MSI_MAPPING
+#define ht_enable_msi_mapping(a)   0
+#endif /* HAVE_ARCH_HT_ENABLE_MSI_MAPPING */
+
 #ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
 static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 {
diff -uprN -X linux-2.6.24-rc5-vanilla/Documentation/dontdiff 
linux-2.6.24-rc5-vanilla/include/asm-x86/pci.h 
linux-2.6.24-rc5/include/asm-x86/pci.h
--- linux-2.6.24-rc5-vanilla/include/asm-x86/pci.h  2007-12-18 
14:35:51.0 -0500
+++ linux-2.6.24-rc5/include/asm-x86/pci.h  2007-12-18 16:28:58.0 
-0500
@@ -75,6 +75,27 @@ static inline void pci_dma_burst_advice(
 }
 #endif
 
+#ifdef CONFIG_PCI
+#define HAVE_ARCH_HT_ENABLE_MSI_MAPPING
+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, ) == 0) 
{
+   printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n",
+   dev->dev.bus_id);
+
+   pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
+ flags | HT_MSI_FLAGS_ENABLE);
+   }
+   pos = 

[PATCH] msi: set 'En' bit of MSI Mapping Capability

2007-12-18 Thread peerchen
According to the HyperTransport spec, 'En' indicate if the MSI Mapping is 
active.
Set the 'En' bit when setup pci and add the quirk for some nvidia devices. 

The patch base on kernel 2.6.24-rc5

Signed-off-by: Andy Currid [EMAIL PROTECTED]
Signed-off-by: Peer Chen [EMAIL PROTECTED]

---
diff -uprN -X linux-2.6.24-rc5-vanilla/Documentation/dontdiff 
linux-2.6.24-rc5-vanilla/drivers/pci/probe.c 
linux-2.6.24-rc5/drivers/pci/probe.c
--- linux-2.6.24-rc5-vanilla/drivers/pci/probe.c2007-12-18 
14:35:46.0 -0500
+++ linux-2.6.24-rc5/drivers/pci/probe.c2007-12-18 16:28:29.0 
-0500
@@ -721,6 +721,9 @@ static int pci_setup_device(struct pci_d
 
/* Unknown power state */
dev-current_state = PCI_UNKNOWN;
+   
+   /* Enable HT MSI mapping */
+   ht_enable_msi_mapping(dev);
 
/* Early fixups, before probing the BARs */
pci_fixup_device(pci_fixup_early, dev);
diff -uprN -X linux-2.6.24-rc5-vanilla/Documentation/dontdiff 
linux-2.6.24-rc5-vanilla/drivers/pci/quirks.c 
linux-2.6.24-rc5/drivers/pci/quirks.c
--- linux-2.6.24-rc5-vanilla/drivers/pci/quirks.c   2007-12-18 
14:35:46.0 -0500
+++ linux-2.6.24-rc5/drivers/pci/quirks.c   2007-12-18 16:28:41.0 
-0500
@@ -1705,6 +1705,45 @@ static void __devinit quirk_nvidia_ck804
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
quirk_nvidia_ck804_msi_ht_cap);
 
+static void __devinit quirk_msi_ht_cap_disable(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...
+*/
+
+   if ((host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0,0))) == NULL) {
+   printk(KERN_WARNING
+PCI: quirk_msi_ht_cap_disable didn't locate host 
bridge\n);
+   return;
+   }
+
+   if ((pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE)) != 0) 
{
+   /* Host bridge is to HT */
+   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) 
{
+   printk(KERN_INFO PCI: Quirk disabling HT MSI mapping 
on %s\n,
+  pci_name(dev));
+
+   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,
+   
quirk_msi_ht_cap_disable);
+
 static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
 {
dev-dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
diff -uprN -X linux-2.6.24-rc5-vanilla/Documentation/dontdiff 
linux-2.6.24-rc5-vanilla/include/asm-generic/pci.h 
linux-2.6.24-rc5/include/asm-generic/pci.h
--- linux-2.6.24-rc5-vanilla/include/asm-generic/pci.h  2007-12-18 
14:35:52.0 -0500
+++ linux-2.6.24-rc5/include/asm-generic/pci.h  2007-12-18 16:29:12.0 
-0500
@@ -45,6 +45,10 @@ pcibios_select_root(struct pci_dev *pdev
 
 #define pcibios_scan_all_fns(a, b) 0
 
+#ifndef HAVE_ARCH_HT_ENABLE_MSI_MAPPING
+#define ht_enable_msi_mapping(a)   0
+#endif /* HAVE_ARCH_HT_ENABLE_MSI_MAPPING */
+
 #ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
 static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 {
diff -uprN -X linux-2.6.24-rc5-vanilla/Documentation/dontdiff 
linux-2.6.24-rc5-vanilla/include/asm-x86/pci.h 
linux-2.6.24-rc5/include/asm-x86/pci.h
--- linux-2.6.24-rc5-vanilla/include/asm-x86/pci.h  2007-12-18 
14:35:51.0 -0500
+++ linux-2.6.24-rc5/include/asm-x86/pci.h  2007-12-18 16:28:58.0 
-0500
@@ -75,6 +75,27 @@ static inline void pci_dma_burst_advice(
 }
 #endif
 
+#ifdef CONFIG_PCI
+#define HAVE_ARCH_HT_ENABLE_MSI_MAPPING
+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) 
{
+   printk(KERN_INFO PCI: Enabling HT MSI Mapping on %s\n,
+   dev-dev.bus_id);
+
+   pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
+ flags | HT_MSI_FLAGS_ENABLE);
+   }
+   pos = pci_find_next_ht_capability(dev, pos, 

[PATCH] ahci: add the Device IDs of MCP79 AHCI controller to ahci.c

2007-12-03 Thread peerchen
Add the device IDs of legacy mode of MCP79 AHCI controller to ahci.c

The patch base on kernel 2.6.24-rc3

Signed-off-by: Peer Chen <[EMAIL PROTECTED]>
---
--- linux-2.6.24-rc3/drivers/ata/ahci.c.orig2007-12-03 16:20:15.0 
-0500
+++ linux-2.6.24-rc3/drivers/ata/ahci.c 2007-12-03 16:32:11.0 -0500
@@ -536,6 +536,10 @@ static const struct pci_device_id ahci_p
{ PCI_VDEVICE(NVIDIA, 0x0ad9), board_ahci },/* MCP77 */
{ PCI_VDEVICE(NVIDIA, 0x0ada), board_ahci },/* MCP77 */
{ PCI_VDEVICE(NVIDIA, 0x0adb), board_ahci },/* MCP77 */
+   { PCI_VDEVICE(NVIDIA, 0x0ab4), board_ahci },/* MCP79 */
+   { PCI_VDEVICE(NVIDIA, 0x0ab5), board_ahci },/* MCP79 */
+   { PCI_VDEVICE(NVIDIA, 0x0ab6), board_ahci },/* MCP79 */
+   { PCI_VDEVICE(NVIDIA, 0x0ab7), board_ahci },/* MCP79 */
{ PCI_VDEVICE(NVIDIA, 0x0ab8), board_ahci },/* MCP79 */
{ PCI_VDEVICE(NVIDIA, 0x0ab9), board_ahci },/* MCP79 */
{ PCI_VDEVICE(NVIDIA, 0x0aba), board_ahci },/* MCP79 */
-

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ahci: add the Device IDs of MCP79 AHCI controller to ahci.c

2007-12-03 Thread peerchen
Add the device IDs of legacy mode of MCP79 AHCI controller to ahci.c

The patch base on kernel 2.6.24-rc3

Signed-off-by: Peer Chen [EMAIL PROTECTED]
---
--- linux-2.6.24-rc3/drivers/ata/ahci.c.orig2007-12-03 16:20:15.0 
-0500
+++ linux-2.6.24-rc3/drivers/ata/ahci.c 2007-12-03 16:32:11.0 -0500
@@ -536,6 +536,10 @@ static const struct pci_device_id ahci_p
{ PCI_VDEVICE(NVIDIA, 0x0ad9), board_ahci },/* MCP77 */
{ PCI_VDEVICE(NVIDIA, 0x0ada), board_ahci },/* MCP77 */
{ PCI_VDEVICE(NVIDIA, 0x0adb), board_ahci },/* MCP77 */
+   { PCI_VDEVICE(NVIDIA, 0x0ab4), board_ahci },/* MCP79 */
+   { PCI_VDEVICE(NVIDIA, 0x0ab5), board_ahci },/* MCP79 */
+   { PCI_VDEVICE(NVIDIA, 0x0ab6), board_ahci },/* MCP79 */
+   { PCI_VDEVICE(NVIDIA, 0x0ab7), board_ahci },/* MCP79 */
{ PCI_VDEVICE(NVIDIA, 0x0ab8), board_ahci },/* MCP79 */
{ PCI_VDEVICE(NVIDIA, 0x0ab9), board_ahci },/* MCP79 */
{ PCI_VDEVICE(NVIDIA, 0x0aba), board_ahci },/* MCP79 */
-

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] msi: set 'En' bit of MSI Mapping Capability on HT platform

2007-11-24 Thread peerchen
According to the HyperTransport spec, 'En' indicate if the MSI Mapping is 
active. So it should be set when enable the MSI.

The patch base on kernel 2.6.24-rc3

Signed-off-by: Andy Currid <[EMAIL PROTECTED]>
Signed-off-by: Peer Chen <[EMAIL PROTECTED]>

---
--- linux-2.6.24-rc3/include/linux/pci_ids.h.orig   2007-11-23 
17:50:30.0 -0500
+++ linux-2.6.24-rc3/include/linux/pci_ids.h2007-11-23 17:50:42.0 
-0500
@@ -1153,7 +1153,16 @@
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE  0x0265
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA20x0267
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC0   0x02F0
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC1   0x02F1
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC2   0x02F2
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC3   0x02F3
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC4   0x02F4
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC5   0x02F5
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC6   0x02F6
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC7   0x02F7
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS0x0368
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_MEMC 0x0369
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE  0x036E
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA20x037F
-

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] msi: set 'En' bit of MSI Mapping Capability on HT platform

2007-11-24 Thread peerchen
According to the HyperTransport spec, 'En' indicate if the MSI Mapping is 
active. So it should be set when enable the MSI.

The patch base on kernel 2.6.24-rc3

Signed-off-by: Andy Currid <[EMAIL PROTECTED]>
Signed-off-by: Peer Chen <[EMAIL PROTECTED]>

---
--- linux-2.6.24-rc3/drivers/pci/msi.c.orig 2007-11-23 17:28:45.0 
-0500
+++ linux-2.6.24-rc3/drivers/pci/msi.c  2007-11-23 17:50:59.0 -0500
@@ -20,6 +20,8 @@
 #include 
 #include 
 
+#include 
+
 #include "pci.h"
 #include "msi.h"
 
@@ -290,6 +292,99 @@ void pci_restore_msi_state(struct pci_de
 }
 #endif /* CONFIG_PM */
 
+/*
+ * pci_enable_msi_ht_cap - Set the HT MSI mapping capability En bit of
+ * a device.
+ *
+ * @dev: pointer to the pci_dev data structure of MSI device function
+ */
+
+static int pci_enable_msi_ht_cap(struct pci_dev *dev)
+{
+   int pos;
+   u8 flags;
+
+   if ((pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING)) != 0)
+   {   
+   pci_read_config_byte(dev, pos + HT_MSI_FLAGS, );
+   pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
+ flags | HT_MSI_FLAGS_ENABLE);
+
+   printk(KERN_INFO "PCI: %s: enabled HT MSI mapping\n", 
pci_name(dev));
+   }
+
+   return pos;
+}
+
+/**
+ * pci_check_msi_ht_cap - check for and enable the MSI mapping capability En 
bit
+ * of devices or upstream bridge on HT-base system.
+ * @dev: pointer to the pci_dev data structure of MSI device function
+ *
+ * Search if device support ht MSI mapping capability on HT-base 
+ * platform, if yes, enable the En bit. If device can't support MSI mapping,
+ * search the the upstream bridge for that capability, enable En bit find it, 
+ * otherwise disable the MSI function if device and upstream bridge can't 
+ * support MSI mapping capability.
+ **/
+
+static int pci_check_msi_ht_cap(struct pci_dev *dev)
+{
+   struct pci_dev *bridge_dev;
+   
+   if (num_k8_northbridges != 0) { /* If the system is the HT-base */
+
+   /* Check for upstream NVIDIA host bridges */
+
+   if (((bridge_dev = pci_find_slot(0, 0)) != NULL) &&
+(bridge_dev->vendor == PCI_VENDOR_ID_NVIDIA)) {
+   switch (bridge_dev->device) {
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC0:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC1:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC2:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC3:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC4:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC5:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC6:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC7:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_MEMC:
+
+   pci_enable_msi_ht_cap(bridge_dev);
+
+   bridge_dev = NULL;
+   while ((bridge_dev = 
pci_get_device(PCI_VENDOR_ID_NVIDIA,
+   PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_MEMC, 
bridge_dev))
+   != NULL) {
+   pci_enable_msi_ht_cap(bridge_dev);
+   }
+
+   break;
+
+   default:
+   break;
+   }
+   }
+
+
+   if (pci_enable_msi_ht_cap(dev) != 0) {
+   return 0;
+   } else {
+   /* Get upstream bridge device handle */
+
+   bridge_dev = dev->bus->self;
+   while(bridge_dev != 0) {
+   if (pci_enable_msi_ht_cap(bridge_dev) != 0) {
+   return 0;
+   } else
+   bridge_dev = bridge_dev->bus->self;
+   }
+
+   return 1;
+   }
+   }
+   return 0;
+}
+
 /**
  * msi_capability_init - configure device's MSI capability structure
  * @dev: pointer to the pci_dev data structure of MSI device function
@@ -510,6 +605,10 @@ int pci_enable_msi(struct pci_dev* dev)
status = pci_msi_check_device(dev, 1, PCI_CAP_ID_MSI);
if (status)
return status;
+   
+   status = pci_check_msi_ht_cap(dev);
+   if(status)
+   return status;
 
WARN_ON(!!dev->msi_enabled);
 
@@ -606,6 +705,10 @@ int pci_enable_msix(struct pci_dev* dev,
if (status)
return status;
 
+   status = pci_check_msi_ht_cap(dev);
+   if(status)
+   return status;
+
pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
pci_read_config_word(dev, msi_control_reg(pos), );
nr_entries 

[PATCH 1/2] msi: set 'En' bit of MSI Mapping Capability on HT platform

2007-11-24 Thread peerchen
According to the HyperTransport spec, 'En' indicate if the MSI Mapping is 
active. So it should be set when enable the MSI.

The patch base on kernel 2.6.24-rc3

Signed-off-by: Andy Currid [EMAIL PROTECTED]
Signed-off-by: Peer Chen [EMAIL PROTECTED]

---
--- linux-2.6.24-rc3/drivers/pci/msi.c.orig 2007-11-23 17:28:45.0 
-0500
+++ linux-2.6.24-rc3/drivers/pci/msi.c  2007-11-23 17:50:59.0 -0500
@@ -20,6 +20,8 @@
 #include asm/errno.h
 #include asm/io.h
 
+#include asm/k8.h
+
 #include pci.h
 #include msi.h
 
@@ -290,6 +292,99 @@ void pci_restore_msi_state(struct pci_de
 }
 #endif /* CONFIG_PM */
 
+/*
+ * pci_enable_msi_ht_cap - Set the HT MSI mapping capability En bit of
+ * a device.
+ *
+ * @dev: pointer to the pci_dev data structure of MSI device function
+ */
+
+static int pci_enable_msi_ht_cap(struct pci_dev *dev)
+{
+   int pos;
+   u8 flags;
+
+   if ((pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING)) != 0)
+   {   
+   pci_read_config_byte(dev, pos + HT_MSI_FLAGS, flags);
+   pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
+ flags | HT_MSI_FLAGS_ENABLE);
+
+   printk(KERN_INFO PCI: %s: enabled HT MSI mapping\n, 
pci_name(dev));
+   }
+
+   return pos;
+}
+
+/**
+ * pci_check_msi_ht_cap - check for and enable the MSI mapping capability En 
bit
+ * of devices or upstream bridge on HT-base system.
+ * @dev: pointer to the pci_dev data structure of MSI device function
+ *
+ * Search if device support ht MSI mapping capability on HT-base 
+ * platform, if yes, enable the En bit. If device can't support MSI mapping,
+ * search the the upstream bridge for that capability, enable En bit find it, 
+ * otherwise disable the MSI function if device and upstream bridge can't 
+ * support MSI mapping capability.
+ **/
+
+static int pci_check_msi_ht_cap(struct pci_dev *dev)
+{
+   struct pci_dev *bridge_dev;
+   
+   if (num_k8_northbridges != 0) { /* If the system is the HT-base */
+
+   /* Check for upstream NVIDIA host bridges */
+
+   if (((bridge_dev = pci_find_slot(0, 0)) != NULL) 
+(bridge_dev-vendor == PCI_VENDOR_ID_NVIDIA)) {
+   switch (bridge_dev-device) {
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC0:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC1:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC2:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC3:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC4:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC5:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC6:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC7:
+   case PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_MEMC:
+
+   pci_enable_msi_ht_cap(bridge_dev);
+
+   bridge_dev = NULL;
+   while ((bridge_dev = 
pci_get_device(PCI_VENDOR_ID_NVIDIA,
+   PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_MEMC, 
bridge_dev))
+   != NULL) {
+   pci_enable_msi_ht_cap(bridge_dev);
+   }
+
+   break;
+
+   default:
+   break;
+   }
+   }
+
+
+   if (pci_enable_msi_ht_cap(dev) != 0) {
+   return 0;
+   } else {
+   /* Get upstream bridge device handle */
+
+   bridge_dev = dev-bus-self;
+   while(bridge_dev != 0) {
+   if (pci_enable_msi_ht_cap(bridge_dev) != 0) {
+   return 0;
+   } else
+   bridge_dev = bridge_dev-bus-self;
+   }
+
+   return 1;
+   }
+   }
+   return 0;
+}
+
 /**
  * msi_capability_init - configure device's MSI capability structure
  * @dev: pointer to the pci_dev data structure of MSI device function
@@ -510,6 +605,10 @@ int pci_enable_msi(struct pci_dev* dev)
status = pci_msi_check_device(dev, 1, PCI_CAP_ID_MSI);
if (status)
return status;
+   
+   status = pci_check_msi_ht_cap(dev);
+   if(status)
+   return status;
 
WARN_ON(!!dev-msi_enabled);
 
@@ -606,6 +705,10 @@ int pci_enable_msix(struct pci_dev* dev,
if (status)
return status;
 
+   status = pci_check_msi_ht_cap(dev);
+   if(status)
+   return status;
+
pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
pci_read_config_word(dev, msi_control_reg(pos), control);

[PATCH 2/2] msi: set 'En' bit of MSI Mapping Capability on HT platform

2007-11-24 Thread peerchen
According to the HyperTransport spec, 'En' indicate if the MSI Mapping is 
active. So it should be set when enable the MSI.

The patch base on kernel 2.6.24-rc3

Signed-off-by: Andy Currid [EMAIL PROTECTED]
Signed-off-by: Peer Chen [EMAIL PROTECTED]

---
--- linux-2.6.24-rc3/include/linux/pci_ids.h.orig   2007-11-23 
17:50:30.0 -0500
+++ linux-2.6.24-rc3/include/linux/pci_ids.h2007-11-23 17:50:42.0 
-0500
@@ -1153,7 +1153,16 @@
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE  0x0265
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA20x0267
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC0   0x02F0
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC1   0x02F1
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC2   0x02F2
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC3   0x02F3
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC4   0x02F4
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC5   0x02F5
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC6   0x02F6
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_C51_MEMC7   0x02F7
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS0x0368
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_MEMC 0x0369
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE  0x036E
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA20x037F
-

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] sata_nv: add the wildcard support for ahci legacy mode

2007-10-08 Thread peerchen
Add the wildcard support to sata_nv driver for those new ahci controllers being 
configured
as IDE/RAID mode and also their DIDs haven't been added into ahci driver.

The patch base on kernel 2.6.23-rc9

Signed-off-by: Peer Chen <[EMAIL PROTECTED]>
---
--- linux-2.6.23-rc9/drivers/ata/sata_nv.c.orig 2007-10-08 10:32:52.0 
-0400
+++ linux-2.6.23-rc9/drivers/ata/sata_nv.c  2007-10-08 10:33:04.0 
-0400
@@ -266,6 +266,7 @@ static void nv_adma_tf_read(struct ata_p
 enum nv_host_type
 {
GENERIC,
+   AHCI_LEG,
NFORCE2,
NFORCE3 = NFORCE2,  /* NF2 == NF3 as far as sata_nv is concerned */
CK804,
@@ -287,6 +288,12 @@ static const struct pci_device_id nv_pci
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC 
},
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC 
},
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC 
},
+   { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+   PCI_ANY_ID, PCI_ANY_ID,
+   PCI_CLASS_STORAGE_RAID<<8, 0x00, AHCI_LEG },
+   { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+   PCI_ANY_ID, PCI_ANY_ID,
+   PCI_CLASS_STORAGE_IDE<<8, 0x00, AHCI_LEG },
 
{ } /* terminate list */
 };
@@ -365,6 +372,30 @@ static const struct ata_port_operations 
.port_start = ata_port_start,
 };
 
+static const struct ata_port_operations nv_ahci_leg_ops = {
+   .port_disable   = ata_port_disable,
+   .tf_load= ata_tf_load,
+   .tf_read= ata_tf_read,
+   .exec_command   = ata_exec_command,
+   .check_status   = ata_check_status,
+   .dev_select = ata_std_dev_select,
+   .bmdma_setup= ata_bmdma_setup,
+   .bmdma_start= ata_bmdma_start,
+   .bmdma_stop = ata_bmdma_stop,
+   .bmdma_status   = ata_bmdma_status,
+   .qc_prep= ata_qc_prep,
+   .qc_issue   = ata_qc_issue_prot,
+   .freeze = ata_bmdma_freeze,
+   .thaw   = ata_bmdma_thaw,
+   .error_handler  = nv_error_handler,
+   .post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .data_xfer  = ata_data_xfer,
+   .irq_clear  = ata_bmdma_irq_clear,
+   .irq_on = ata_irq_on,
+   .irq_ack= ata_irq_ack,
+   .port_start = ata_port_start,
+};
+
 static const struct ata_port_operations nv_nf2_ops = {
.port_disable   = ata_port_disable,
.tf_load= ata_tf_load,
@@ -463,6 +494,17 @@ static const struct ata_port_info nv_por
.port_ops   = _generic_ops,
.irq_handler= nv_generic_interrupt,
},
+   /* ahci legacy */
+   {
+   .sht= _sht,
+   .flags  = ATA_FLAG_SATA | ATA_FLAG_SLAVE_POSS |
+ ATA_FLAG_HRST_TO_RESUME,
+   .pio_mask   = NV_PIO_MASK,
+   .mwdma_mask = NV_MWDMA_MASK,
+   .udma_mask  = NV_UDMA_MASK,
+   .port_ops   = _ahci_leg_ops,
+   .irq_handler= nv_generic_interrupt,
+   },
/* nforce2/3 */
{
.sht= _sht,
-

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] sata_nv: add the wildcard support for ahci legacy mode

2007-10-08 Thread peerchen
Add the wildcard support to sata_nv driver for those new ahci controllers being 
configured
as IDE/RAID mode and also their DIDs haven't been added into ahci driver.

The patch base on kernel 2.6.23-rc9

Signed-off-by: Peer Chen [EMAIL PROTECTED]
---
--- linux-2.6.23-rc9/drivers/ata/sata_nv.c.orig 2007-10-08 10:32:52.0 
-0400
+++ linux-2.6.23-rc9/drivers/ata/sata_nv.c  2007-10-08 10:33:04.0 
-0400
@@ -266,6 +266,7 @@ static void nv_adma_tf_read(struct ata_p
 enum nv_host_type
 {
GENERIC,
+   AHCI_LEG,
NFORCE2,
NFORCE3 = NFORCE2,  /* NF2 == NF3 as far as sata_nv is concerned */
CK804,
@@ -287,6 +288,12 @@ static const struct pci_device_id nv_pci
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC 
},
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC 
},
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC 
},
+   { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+   PCI_ANY_ID, PCI_ANY_ID,
+   PCI_CLASS_STORAGE_RAID8, 0x00, AHCI_LEG },
+   { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
+   PCI_ANY_ID, PCI_ANY_ID,
+   PCI_CLASS_STORAGE_IDE8, 0x00, AHCI_LEG },
 
{ } /* terminate list */
 };
@@ -365,6 +372,30 @@ static const struct ata_port_operations 
.port_start = ata_port_start,
 };
 
+static const struct ata_port_operations nv_ahci_leg_ops = {
+   .port_disable   = ata_port_disable,
+   .tf_load= ata_tf_load,
+   .tf_read= ata_tf_read,
+   .exec_command   = ata_exec_command,
+   .check_status   = ata_check_status,
+   .dev_select = ata_std_dev_select,
+   .bmdma_setup= ata_bmdma_setup,
+   .bmdma_start= ata_bmdma_start,
+   .bmdma_stop = ata_bmdma_stop,
+   .bmdma_status   = ata_bmdma_status,
+   .qc_prep= ata_qc_prep,
+   .qc_issue   = ata_qc_issue_prot,
+   .freeze = ata_bmdma_freeze,
+   .thaw   = ata_bmdma_thaw,
+   .error_handler  = nv_error_handler,
+   .post_internal_cmd  = ata_bmdma_post_internal_cmd,
+   .data_xfer  = ata_data_xfer,
+   .irq_clear  = ata_bmdma_irq_clear,
+   .irq_on = ata_irq_on,
+   .irq_ack= ata_irq_ack,
+   .port_start = ata_port_start,
+};
+
 static const struct ata_port_operations nv_nf2_ops = {
.port_disable   = ata_port_disable,
.tf_load= ata_tf_load,
@@ -463,6 +494,17 @@ static const struct ata_port_info nv_por
.port_ops   = nv_generic_ops,
.irq_handler= nv_generic_interrupt,
},
+   /* ahci legacy */
+   {
+   .sht= nv_sht,
+   .flags  = ATA_FLAG_SATA | ATA_FLAG_SLAVE_POSS |
+ ATA_FLAG_HRST_TO_RESUME,
+   .pio_mask   = NV_PIO_MASK,
+   .mwdma_mask = NV_MWDMA_MASK,
+   .udma_mask  = NV_UDMA_MASK,
+   .port_ops   = nv_ahci_leg_ops,
+   .irq_handler= nv_generic_interrupt,
+   },
/* nforce2/3 */
{
.sht= nv_sht,
-

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/