linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / infiniband / hw / mthca / mthca_main.c
index 7b82c19..9c849d2 100644 (file)
@@ -34,6 +34,7 @@
  * $Id: mthca_main.c 1396 2004-12-28 04:10:27Z roland $
  */
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/errno.h>
@@ -51,14 +52,6 @@ MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_VERSION(DRV_VERSION);
 
-#ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
-
-int mthca_debug_level = 0;
-module_param_named(debug_level, mthca_debug_level, int, 0644);
-MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
-
-#endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */
-
 #ifdef CONFIG_PCI_MSI
 
 static int msi_x = 0;
@@ -76,10 +69,6 @@ MODULE_PARM_DESC(msi, "attempt to use MSI if nonzero");
 
 #endif /* CONFIG_PCI_MSI */
 
-static int tune_pci = 0;
-module_param(tune_pci, int, 0444);
-MODULE_PARM_DESC(tune_pci, "increase PCI burst from the default set by BIOS if nonzero");
-
 static const char mthca_version[] __devinitdata =
        DRV_NAME ": Mellanox InfiniBand HCA driver v"
        DRV_VERSION " (" DRV_RELDATE ")\n";
@@ -101,9 +90,6 @@ static int __devinit mthca_tune_pci(struct mthca_dev *mdev)
        int cap;
        u16 val;
 
-       if (!tune_pci)
-               return 0;
-
        /* First try to max out Read Byte Count */
        cap = pci_find_capability(mdev->pdev, PCI_CAP_ID_PCIX);
        if (cap) {
@@ -171,9 +157,8 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim
 
        if (dev_lim->uar_size > pci_resource_len(mdev->pdev, 2)) {
                mthca_err(mdev, "HCA reported UAR size of 0x%x bigger than "
-                         "PCI resource 2 size of 0x%llx, aborting.\n",
-                         dev_lim->uar_size,
-                         (unsigned long long)pci_resource_len(mdev->pdev, 2));
+                         "PCI resource 2 size of 0x%lx, aborting.\n",
+                         dev_lim->uar_size, pci_resource_len(mdev->pdev, 2));
                return -ENODEV;
        }
 
@@ -191,7 +176,6 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim
        mdev->limits.reserved_srqs      = dev_lim->reserved_srqs;
        mdev->limits.reserved_eecs      = dev_lim->reserved_eecs;
        mdev->limits.max_desc_sz        = dev_lim->max_desc_sz;
-       mdev->limits.max_srq_sge        = mthca_max_srq_sge(mdev);
        /*
         * Subtract 1 from the limit because we need to allocate a
         * spare CQE so the HCA HW can tell the difference between an
@@ -207,18 +191,6 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim
        mdev->limits.port_width_cap     = dev_lim->max_port_width;
        mdev->limits.page_size_cap      = ~(u32) (dev_lim->min_page_sz - 1);
        mdev->limits.flags              = dev_lim->flags;
-       /*
-        * For old FW that doesn't return static rate support, use a
-        * value of 0x3 (only static rate values of 0 or 1 are handled),
-        * except on Sinai, where even old FW can handle static rate
-        * values of 2 and 3.
-        */
-       if (dev_lim->stat_rate_support)
-               mdev->limits.stat_rate_support = dev_lim->stat_rate_support;
-       else if (mdev->mthca_flags & MTHCA_FLAG_SINAI_OPT)
-               mdev->limits.stat_rate_support = 0xf;
-       else
-               mdev->limits.stat_rate_support = 0x3;
 
        /* IB_DEVICE_RESIZE_MAX_WR not supported by driver.
           May be doable since hardware supports it for SRQ.
@@ -963,19 +935,13 @@ enum {
 
 static struct {
        u64 latest_fw;
-       u32 flags;
+       int is_memfree;
+       int is_pcie;
 } mthca_hca_table[] = {
-       [TAVOR]        = { .latest_fw = MTHCA_FW_VER(3, 4, 0),
-                          .flags     = 0 },
-       [ARBEL_COMPAT] = { .latest_fw = MTHCA_FW_VER(4, 7, 600),
-                          .flags     = MTHCA_FLAG_PCIE },
-       [ARBEL_NATIVE] = { .latest_fw = MTHCA_FW_VER(5, 1, 400),
-                          .flags     = MTHCA_FLAG_MEMFREE |
-                                       MTHCA_FLAG_PCIE },
-       [SINAI]        = { .latest_fw = MTHCA_FW_VER(1, 1, 0),
-                          .flags     = MTHCA_FLAG_MEMFREE |
-                                       MTHCA_FLAG_PCIE    |
-                                       MTHCA_FLAG_SINAI_OPT }
+       [TAVOR]        = { .latest_fw = MTHCA_FW_VER(3, 3, 3), .is_memfree = 0, .is_pcie = 0 },
+       [ARBEL_COMPAT] = { .latest_fw = MTHCA_FW_VER(4, 7, 0), .is_memfree = 0, .is_pcie = 1 },
+       [ARBEL_NATIVE] = { .latest_fw = MTHCA_FW_VER(5, 1, 0), .is_memfree = 1, .is_pcie = 1 },
+       [SINAI]        = { .latest_fw = MTHCA_FW_VER(1, 0, 1), .is_memfree = 1, .is_pcie = 1 }
 };
 
 static int __devinit mthca_init_one(struct pci_dev *pdev,
@@ -1065,9 +1031,12 @@ static int __devinit mthca_init_one(struct pci_dev *pdev,
 
        mdev->pdev = pdev;
 
-       mdev->mthca_flags = mthca_hca_table[id->driver_data].flags;
        if (ddr_hidden)
                mdev->mthca_flags |= MTHCA_FLAG_DDR_HIDDEN;
+       if (mthca_hca_table[id->driver_data].is_memfree)
+               mdev->mthca_flags |= MTHCA_FLAG_MEMFREE;
+       if (mthca_hca_table[id->driver_data].is_pcie)
+               mdev->mthca_flags |= MTHCA_FLAG_PCIE;
 
        /*
         * Now reset the HCA before we touch the PCI capabilities or