netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dean Nelson <dnelson@redhat.com>
To: jbarnes@virtuousgeek.org
Cc: netdev@vger.kernel.org, linux-pci@vger.kernel.org
Subject: [PATCH 1/3] pci: fix return value from pcix_get_max_mmrbc()
Date: Tue, 9 Mar 2010 22:26:40 -0500	[thread overview]
Message-ID: <20100310032640.6331.39506.send-patch@aqua> (raw)
In-Reply-To: <20100310032632.6331.15414.send-patch@aqua>

For the PCI_X_STATUS register, pcix_get_max_mmrbc() is returning an incorrect
value, which is based on:

	(stat & PCI_X_STATUS_MAX_READ) >> 12

Valid return values are 512, 1024, 2048, 4096, which correspond to a 'stat'
(masked and right shifted by 21) of 0, 1, 2, 3, respectively.

A right shift by 11 would generate the correct return value when 'stat' (masked
and right shifted by 21) has a value of 1 or 2. But for a value of 0 or 3 it's
not possible to generate the correct return value by only right shifting.

Fix is based on pcix_get_mmrbc()'s similar dealings with the PCI_X_CMD register.

Signed-off-by: Dean Nelson <dnelson@redhat.com>

---

 drivers/pci/pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5b548ae..1decd4f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2571,7 +2571,7 @@ int pcix_get_max_mmrbc(struct pci_dev *dev)
 	if (err)
 		return -EINVAL;
 
-	return (stat & PCI_X_STATUS_MAX_READ) >> 12;
+	return 512 << ((stat & PCI_X_STATUS_MAX_READ) >> 21);
 }
 EXPORT_SYMBOL(pcix_get_max_mmrbc);
 

  reply	other threads:[~2010-03-10  3:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10  3:26 [PATCH 0/3] pci: fix/cleanup pcix get and set mmrbc functions Dean Nelson
2010-03-10  3:26 ` Dean Nelson [this message]
2010-03-19 19:42   ` [PATCH 1/3] pci: fix return value from pcix_get_max_mmrbc() Jesse Barnes
2010-03-10  3:26 ` [PATCH 2/3] pci: fix access of PCI_X_CMD by pcix get and set mmrbc functions Dean Nelson
2010-03-10  3:26 ` [PATCH 3/3] pci: cleanup error return for " Dean Nelson
2010-03-13  1:00 ` [PATCH 0/3] pci: fix/cleanup " Jesse Barnes
2010-03-15 10:59   ` Dean Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100310032640.6331.39506.send-patch@aqua \
    --to=dnelson@redhat.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).