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 2/6] e1000: use pcix_set_mmrbc
Date: Fri, 08 Dec 2006 10:22:43 -0800 [thread overview]
Message-ID: <20061208182500.478856000@osdl.org> (raw)
In-Reply-To: 20061208182241.786324000@osdl.org
[-- Attachment #1: e1000-mmrbc --]
[-- Type: text/plain, Size: 3008 bytes --]
Use new pcix_set_mmrbc interface, this prevents possible data
corruption on broken PCI-X chipsets.
The E1000 PCI hardware wrappers are a nuisance.
Untested on real hardware.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
drivers/net/e1000/e1000_hw.c | 23 ++---------------------
drivers/net/e1000/e1000_hw.h | 1 +
drivers/net/e1000/e1000_main.c | 8 ++++++++
3 files changed, 11 insertions(+), 21 deletions(-)
--- pci-x.orig/drivers/net/e1000/e1000_hw.c
+++ pci-x/drivers/net/e1000/e1000_hw.c
@@ -846,10 +846,6 @@ e1000_init_hw(struct e1000_hw *hw)
uint32_t ctrl;
uint32_t i;
int32_t ret_val;
- uint16_t pcix_cmd_word;
- uint16_t pcix_stat_hi_word;
- uint16_t cmd_mmrbc;
- uint16_t stat_mmrbc;
uint32_t mta_size;
uint32_t reg_data;
uint32_t ctrl_ext;
@@ -939,23 +935,8 @@ e1000_init_hw(struct e1000_hw *hw)
break;
default:
/* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */
- if (hw->bus_type == e1000_bus_type_pcix) {
- e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd_word);
- e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI,
- &pcix_stat_hi_word);
- cmd_mmrbc = (pcix_cmd_word & PCIX_COMMAND_MMRBC_MASK) >>
- PCIX_COMMAND_MMRBC_SHIFT;
- stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >>
- PCIX_STATUS_HI_MMRBC_SHIFT;
- if (stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K)
- stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K;
- if (cmd_mmrbc > stat_mmrbc) {
- pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK;
- pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT;
- e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER,
- &pcix_cmd_word);
- }
- }
+ if (hw->bus_type == e1000_bus_type_pcix)
+ e1000_pcix_set_mmrbc(hw, 2048);
break;
}
--- pci-x.orig/drivers/net/e1000/e1000_main.c
+++ pci-x/drivers/net/e1000/e1000_main.c
@@ -4770,6 +4770,14 @@ e1000_read_pci_cfg(struct e1000_hw *hw,
}
void
+e1000_pcix_set_mmrbc(struct e1000_hw *hw, int mmrbc)
+{
+ struct e1000_adapter *adapter = hw->back;
+
+ pcix_set_mmrbc(adapter->pdev, mmrbc);
+}
+
+void
e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value)
{
struct e1000_adapter *adapter = hw->back;
--- pci-x.orig/drivers/net/e1000/e1000_hw.h
+++ pci-x/drivers/net/e1000/e1000_hw.h
@@ -421,6 +421,7 @@ void e1000_tbi_adjust_stats(struct e1000
void e1000_get_bus_info(struct e1000_hw *hw);
void e1000_pci_set_mwi(struct e1000_hw *hw);
void e1000_pci_clear_mwi(struct e1000_hw *hw);
+void e1000_pcix_set_mmrbc(struct e1000_hw *hw, int mmbrc);
void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
int32_t e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value);
--
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 ` Stephen Hemminger [this message]
2006-12-08 21:45 ` [PATCH 2/6] e1000: use pcix_set_mmrbc 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 ` [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.478856000@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