aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorGrant Grundler <iod00d@hp.com>2006-02-17 02:58:29 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:35:14 -0500
commita0454b40ee8fac03194bb71f01730266506e75e1 (patch)
treea746423eeeeb968bd271de17f4f8e80acac56999 /drivers/pci
parentb408cbc704352eccee301e1103b23203ba1c3a0e (diff)
[PATCH] PCI: fix problems with MSI-X on ia64
Use "unsigned long" when dealing with PCI resources. The BAR Indicator Register (BIR) can be a 64-bit value or the resource could be a 64-bit host physical address. Enables ib_mthca and cciss drivers to use MSI-X on ia64 HW. Problem showed up now because of new system firmware on one platform. Symptom will either be memory corruption or MCA. Second part of this patch deals with "useless" code. We walk through the steps to find the phys_addr and then don't use the result. I suspect the intent was to zero out the respective MSI-X entry but I'm not sure at the moment. Delete the code inside the #if 0/#endif if it's really not needed. Signed-off-by: Grant Grundler <iod00d@hp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/msi.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 4de1c17ee573..aea8b258b9b8 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -600,7 +600,8 @@ static int msix_capability_init(struct pci_dev *dev,
600 struct msg_address address; 600 struct msg_address address;
601 struct msg_data data; 601 struct msg_data data;
602 int vector, pos, i, j, nr_entries, temp = 0; 602 int vector, pos, i, j, nr_entries, temp = 0;
603 u32 phys_addr, table_offset; 603 unsigned long phys_addr;
604 u32 table_offset;
604 u16 control; 605 u16 control;
605 u8 bir; 606 u8 bir;
606 void __iomem *base; 607 void __iomem *base;
@@ -609,11 +610,11 @@ static int msix_capability_init(struct pci_dev *dev,
609 /* Request & Map MSI-X table region */ 610 /* Request & Map MSI-X table region */
610 pci_read_config_word(dev, msi_control_reg(pos), &control); 611 pci_read_config_word(dev, msi_control_reg(pos), &control);
611 nr_entries = multi_msix_capable(control); 612 nr_entries = multi_msix_capable(control);
612 pci_read_config_dword(dev, msix_table_offset_reg(pos), 613
613 &table_offset); 614 pci_read_config_dword(dev, msix_table_offset_reg(pos), &table_offset);
614 bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); 615 bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
615 phys_addr = pci_resource_start (dev, bir); 616 table_offset &= ~PCI_MSIX_FLAGS_BIRMASK;
616 phys_addr += (u32)(table_offset & ~PCI_MSIX_FLAGS_BIRMASK); 617 phys_addr = pci_resource_start (dev, bir) + table_offset;
617 base = ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE); 618 base = ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
618 if (base == NULL) 619 if (base == NULL)
619 return -ENOMEM; 620 return -ENOMEM;
@@ -838,8 +839,10 @@ static int msi_free_vector(struct pci_dev* dev, int vector, int reassign)
838 * Detect last MSI-X vector to be released. 839 * Detect last MSI-X vector to be released.
839 * Release the MSI-X memory-mapped table. 840 * Release the MSI-X memory-mapped table.
840 */ 841 */
842#if 0
841 int pos, nr_entries; 843 int pos, nr_entries;
842 u32 phys_addr, table_offset; 844 unsigned long phys_addr;
845 u32 table_offset;
843 u16 control; 846 u16 control;
844 u8 bir; 847 u8 bir;
845 848
@@ -850,9 +853,12 @@ static int msi_free_vector(struct pci_dev* dev, int vector, int reassign)
850 pci_read_config_dword(dev, msix_table_offset_reg(pos), 853 pci_read_config_dword(dev, msix_table_offset_reg(pos),
851 &table_offset); 854 &table_offset);
852 bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); 855 bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
853 phys_addr = pci_resource_start (dev, bir); 856 table_offset &= ~PCI_MSIX_FLAGS_BIRMASK;
854 phys_addr += (u32)(table_offset & 857 phys_addr = pci_resource_start(dev, bir) + table_offset;
855 ~PCI_MSIX_FLAGS_BIRMASK); 858/*
859 * FIXME! and what did you want to do with phys_addr?
860 */
861#endif
856 iounmap(base); 862 iounmap(base);
857 } 863 }
858 } 864 }
@@ -1119,7 +1125,9 @@ void msi_remove_pci_irq_vectors(struct pci_dev* dev)
1119 msi_free_vector(dev, vector, 0); 1125 msi_free_vector(dev, vector, 0);
1120 if (warning) { 1126 if (warning) {
1121 /* Force to release the MSI-X memory-mapped table */ 1127 /* Force to release the MSI-X memory-mapped table */
1122 u32 phys_addr, table_offset; 1128#if 0
1129 unsigned long phys_addr;
1130 u32 table_offset;
1123 u16 control; 1131 u16 control;
1124 u8 bir; 1132 u8 bir;
1125 1133
@@ -1128,9 +1136,12 @@ void msi_remove_pci_irq_vectors(struct pci_dev* dev)
1128 pci_read_config_dword(dev, msix_table_offset_reg(pos), 1136 pci_read_config_dword(dev, msix_table_offset_reg(pos),
1129 &table_offset); 1137 &table_offset);
1130 bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); 1138 bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
1131 phys_addr = pci_resource_start (dev, bir); 1139 table_offset &= ~PCI_MSIX_FLAGS_BIRMASK;
1132 phys_addr += (u32)(table_offset & 1140 phys_addr = pci_resource_start(dev, bir) + table_offset;
1133 ~PCI_MSIX_FLAGS_BIRMASK); 1141/*
1142 * FIXME! and what did you want to do with phys_addr?
1143 */
1144#endif
1134 iounmap(base); 1145 iounmap(base);
1135 printk(KERN_WARNING "PCI: %s: msi_remove_pci_irq_vectors() " 1146 printk(KERN_WARNING "PCI: %s: msi_remove_pci_irq_vectors() "
1136 "called without free_irq() on all MSI-X vectors\n", 1147 "called without free_irq() on all MSI-X vectors\n",