Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a855b1a7423ac83c76638f156d79c854b0feb94d
Commit:     a855b1a7423ac83c76638f156d79c854b0feb94d
Parent:     3c10c7c929b30e8813d15960cb97f95a0b2ba615
Author:     Peter Oruba <[EMAIL PROTECTED]>
AuthorDate: Fri Aug 10 13:54:33 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Oct 9 19:59:07 2007 -0700

    IB/mthca: Use PCI-X/PCI-Express read control interfaces
    
    These driver changes incorporate the proposed PCI-X / PCI-Express read
    byte count interface.  Reading and setting those values doesn't take
    place "manually", instead wrapping functions are called to allow
    quirks for some PCI bridges.
    
    Signed-off by: Peter Oruba <[EMAIL PROTECTED]>
    Based on work by Stephen Hemminger <[EMAIL PROTECTED]>
    Cc: Roland Dreier <[EMAIL PROTECTED]>
    Cc: Michael S. Tsirkin <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mthca/mthca_main.c |   33 +++++++----------------------
 1 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_main.c 
b/drivers/infiniband/hw/mthca/mthca_main.c
index 04c1520..60de6f9 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -137,40 +137,23 @@ static const char mthca_version[] __devinitdata =
 
 static int 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) {
-               if (pci_read_config_word(mdev->pdev, cap + PCI_X_CMD, &val)) {
-                       mthca_err(mdev, "Couldn't read PCI-X command register, "
-                                 "aborting.\n");
-                       return -ENODEV;
-               }
-               val = (val & ~PCI_X_CMD_MAX_READ) | (3 << 2);
-               if (pci_write_config_word(mdev->pdev, cap + PCI_X_CMD, val)) {
-                       mthca_err(mdev, "Couldn't write PCI-X command register, 
"
-                                 "aborting.\n");
+       if (pci_find_capability(mdev->pdev, PCI_CAP_ID_PCIX)) {
+               if (pcix_set_mmrbc(mdev->pdev, pcix_get_max_mmrbc(mdev->pdev))) 
{
+                       mthca_err(mdev, "Couldn't set PCI-X max read count, "
+                               "aborting.\n");
                        return -ENODEV;
                }
        } else if (!(mdev->mthca_flags & MTHCA_FLAG_PCIE))
                mthca_info(mdev, "No PCI-X capability, not setting RBC.\n");
 
-       cap = pci_find_capability(mdev->pdev, PCI_CAP_ID_EXP);
-       if (cap) {
-               if (pci_read_config_word(mdev->pdev, cap + PCI_EXP_DEVCTL, 
&val)) {
-                       mthca_err(mdev, "Couldn't read PCI Express device 
control "
-                                 "register, aborting.\n");
-                       return -ENODEV;
-               }
-               val = (val & ~PCI_EXP_DEVCTL_READRQ) | (5 << 12);
-               if (pci_write_config_word(mdev->pdev, cap + PCI_EXP_DEVCTL, 
val)) {
-                       mthca_err(mdev, "Couldn't write PCI Express device 
control "
-                                 "register, aborting.\n");
+       if (pci_find_capability(mdev->pdev, PCI_CAP_ID_EXP)) {
+               if (pcie_set_readrq(mdev->pdev, 4096)) {
+                       mthca_err(mdev, "Couldn't write PCI Express read 
request, "
+                               "aborting.\n");
                        return -ENODEV;
                }
        } else if (mdev->mthca_flags & MTHCA_FLAG_PCIE)
-
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