From: Stephen Hemminger <shemminger@osdl.org>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-pci@atrey.karlin.mff.cuni.cz, linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] PCI-X relaxed ordering interface
Date: Fri, 08 Dec 2006 10:22:47 -0800 [thread overview]
Message-ID: <20061208182500.750734000@osdl.org> (raw)
In-Reply-To: 20061208182241.786324000@osdl.org
[-- Attachment #1: pcix-ero --]
[-- Type: text/plain, Size: 3216 bytes --]
Add an interface for set/clearing relaxed ordering
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
drivers/net/bnx2.c | 10 +-------
drivers/net/tg3.c | 4 ---
drivers/pci/pci.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/pci.h | 2 +
4 files changed, 63 insertions(+), 11 deletions(-)
--- pci-x.orig/drivers/net/bnx2.c
+++ pci-x/drivers/net/bnx2.c
@@ -3384,14 +3384,8 @@ bnx2_init_chip(struct bnx2 *bp)
REG_WR(bp, BNX2_TDMA_CONFIG, val);
}
- if (bp->flags & PCIX_FLAG) {
- u16 val16;
-
- pci_read_config_word(bp->pdev, bp->pcix_cap + PCI_X_CMD,
- &val16);
- pci_write_config_word(bp->pdev, bp->pcix_cap + PCI_X_CMD,
- val16 & ~PCI_X_CMD_ERO);
- }
+ if (bp->flags & PCIX_FLAG)
+ pcix_clear_ero(bp->pdev);
REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS,
BNX2_MISC_ENABLE_SET_BITS_HOST_COALESCE_ENABLE |
--- pci-x.orig/drivers/net/tg3.c
+++ pci-x/drivers/net/tg3.c
@@ -4884,9 +4884,7 @@ static int tg3_chip_reset(struct tg3 *tp
pci_restore_state(tp->pdev);
/* Make sure PCI-X relaxed ordering bit is clear. */
- pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val);
- val &= ~PCIX_CAPS_RELAXED_ORDERING;
- pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val);
+ pcix_clear_ero(tp->pdev);
if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) {
u32 val;
--- pci-x.orig/drivers/pci/pci.c
+++ pci-x/drivers/pci/pci.c
@@ -1203,6 +1203,64 @@ out:
}
EXPORT_SYMBOL(pcie_set_readrq);
+/**
+ * pcix_set_ero - enable relaxed operations
+ * @dev: PCI device to enable
+ *
+ * Enables PCI-X Relaxed Ordering
+ */
+int
+pcix_set_ero(struct pci_dev *dev)
+{
+ int cap, err;
+ u16 val;
+
+ cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
+ if (!cap)
+ return -EINVAL;
+
+ err = pci_read_config_word(dev, cap + PCI_X_CMD, &val);
+ if (err)
+ goto out;
+
+ if (!(val & PCI_X_CMD_ERO)) {
+ val |= PCI_X_CMD_ERO;
+ err = pci_write_config_dword(dev, cap + PCI_X_CMD, val);
+ }
+out:
+ return err;
+}
+EXPORT_SYMBOL(pcix_set_ero);
+
+/**
+ * pcix_clear_ero - enable relaxed operations
+ * @dev: PCI device to disable reordering
+ *
+ * Disables PCI-X Relaxed Ordering
+ */
+int
+pcix_clear_ero(struct pci_dev *dev)
+{
+ int cap, err;
+ u16 val;
+
+ cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
+ if (!cap)
+ return -EINVAL;
+
+ err = pci_read_config_word(dev, cap + PCI_X_CMD, &val);
+ if (err)
+ goto out;
+
+ if (val & PCI_X_CMD_ERO) {
+ val &= ~PCI_X_CMD_ERO;
+ err = pci_write_config_dword(dev, cap + PCI_X_CMD, val);
+ }
+out:
+ return err;
+}
+EXPORT_SYMBOL(pcix_clear_ero);
+
static int __devinit pci_init(void)
{
struct pci_dev *dev = NULL;
--- pci-x.orig/include/linux/pci.h
+++ pci-x/include/linux/pci.h
@@ -516,6 +516,8 @@ int pcix_get_mmrbc(struct pci_dev *dev);
int pcix_set_mmrbc(struct pci_dev *dev, int rq);
int pcie_get_readrq(struct pci_dev *dev);
int pcie_set_readrq(struct pci_dev *dev, int rq);
+int pcix_set_ero(struct pci_dev *dev);
+int pcix_clear_ero(struct pci_dev *dev);
void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
int __must_check pci_assign_resource(struct pci_dev *dev, int i);
int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
--
next prev parent reply other threads:[~2006-12-08 18:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-08 18:22 [PATCH 0/6] PCI-X/PCI-Express read control interfaces Stephen Hemminger
2006-12-08 18:22 ` [PATCH 1/6] PCI-X Max Read Byte Count interface Stephen Hemminger
2006-12-08 22:56 ` [PATCH 1/6] PCI-X Max Read Byte Count interface (v2) Stephen Hemminger
2006-12-08 18:22 ` [PATCH 2/6] e1000: use pcix_set_mmrbc Stephen Hemminger
2006-12-08 21:45 ` Roland Dreier
2006-12-08 22:43 ` Stephen Hemminger
2006-12-08 22:58 ` Auke Kok
2006-12-08 23:38 ` Jeff Kirsher
2006-12-08 18:22 ` [PATCH 3/6] PCI Express get/set read request size Stephen Hemminger
2006-12-08 18:22 ` [PATCH 4/6] MTHCA driver (infiniband) use new pci interfaces Stephen Hemminger
2006-12-08 21:46 ` Roland Dreier
2006-12-11 3:55 ` Benjamin Herrenschmidt
2006-12-11 5:56 ` Grant Grundler
2006-12-12 1:38 ` Roland Dreier
2006-12-12 1:59 ` Benjamin Herrenschmidt
2006-12-08 18:22 ` [PATCH 5/6] QLA2 use pci read tuning interface Stephen Hemminger
2006-12-08 18:22 ` Stephen Hemminger [this message]
2006-12-11 3:48 ` [PATCH 0/6] PCI-X/PCI-Express read control interfaces Benjamin Herrenschmidt
2006-12-14 0:17 ` Stephen Hemminger
2006-12-14 0:34 ` Benjamin Herrenschmidt
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=20061208182500.750734000@osdl.org \
--to=shemminger@osdl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
/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).