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 3/6] PCI Express get/set read request size
Date: Fri, 08 Dec 2006 10:22:44 -0800 [thread overview]
Message-ID: <20061208182500.550052000@osdl.org> (raw)
In-Reply-To: 20061208182241.786324000@osdl.org
[-- Attachment #1: pcie-rrbc.patch --]
[-- Type: text/plain, Size: 2607 bytes --]
Add PCI infrastructure for setting read request size.
The pcie_get_readrq is commented out because there are no drivers
that need it.
---
drivers/pci/pci.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++-
include/linux/pci.h | 4 ++-
2 files changed, 67 insertions(+), 2 deletions(-)
--- pci-x.orig/drivers/pci/pci.c
+++ pci-x/drivers/pci/pci.c
@@ -1139,7 +1139,70 @@ out:
}
EXPORT_SYMBOL(pcix_set_mmrbc);
-
+#if 0
+/**
+ * pcie_get_readrq - get PCI Express read request size
+ * @dev: PCI device to query
+ *
+ * Returns maximum memory read request in bytes
+ * or appropriate error value.
+ */
+int pcie_get_readrq(struct pci_dev *dev)
+{
+ int ret, cap;
+ u16 ctl;
+
+ cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
+ if (!cap)
+ return -EINVAL;
+
+ ret = pci_read_config_word(dev, cap + PCI_EXP_DEVCTL, &ctl);
+ if (!ret)
+ ret = 128 << ((ctl & PCI_EXP_DEVCTL_READRQ) >> 12);
+
+ return ret;
+}
+EXPORT_SYMBOL(pcie_get_readrq);
+#endif
+
+/**
+ * pcie_set_readrq - set PCI Express maximum memory read request
+ * @dev: PCI device to query
+ * @count: maximum memory read count in bytes
+ * valid values are 128, 256, 512, 1024, 2048, 4096
+ *
+ * If possible sets maximum read byte count
+ */
+int
+pcie_set_readrq(struct pci_dev *dev, int count)
+{
+ int cap, err = -EINVAL;
+ u16 ctl, v;
+
+ if (count < 128 || count > 4096 || (count & (count-1)))
+ goto out;
+
+ v = (ffs(count) - 8) << 12;
+
+ cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
+ if (!cap)
+ goto out;
+
+ err = pci_read_config_word(dev, cap + PCI_EXP_DEVCTL, &ctl);
+ if (err)
+ goto out;
+
+ if ((ctl & PCI_EXP_DEVCTL_READRQ) != v) {
+ ctl &= ~PCI_EXP_DEVCTL_READRQ;
+ ctl |= v;
+ err = pci_write_config_dword(dev, cap + PCI_EXP_DEVCTL, ctl);
+ }
+
+out:
+ return err;
+}
+EXPORT_SYMBOL(pcie_set_readrq);
+
static int __devinit pci_init(void)
{
struct pci_dev *dev = NULL;
--- pci-x.orig/include/linux/pci.h
+++ pci-x/include/linux/pci.h
@@ -513,7 +513,9 @@ void pci_intx(struct pci_dev *dev, int e
int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
int pcix_get_mmrbc(struct pci_dev *dev);
-int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
+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);
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 ` Stephen Hemminger [this message]
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 ` [PATCH 6/6] PCI-X relaxed ordering interface Stephen Hemminger
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.550052000@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.