[PATCH] diff for PCI Express bge(4) NICs needs testing

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] diff for PCI Express bge(4) NICs needs testing

Brad Smith-14
Hi,

The following diff provides alternate PCI DMA control register settings
for PCI Express-based Broadcom Gigabit network interfaces. The following
list is an example of appropriate hardware from dmesg entries..


bge0 at pci1 dev 0 function 0 "Broadcom BCM5721" rev 0x11, BCM5750 B1

bge0 at pci3 dev 0 function 0 "Broadcom BCM5751" rev 0x11, BCM5750 B1

bge0 at pci2 dev 0 function 0 "Broadcom BCM5751M" rev 0x11, BCM5750 B1

bge0 at pci2 dev 0 function 0 "Broadcom BCM5789" rev 0x11, BCM5750 B1


Please e-mail me a dmesg from any systems you're able to test with.
I do not own such hardware so this hasn't been tested yet.


Index: if_bge.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.123
diff -u -p -r1.123 if_bge.c
--- if_bge.c 1 Feb 2006 01:53:32 -0000 1.123
+++ if_bge.c 1 Feb 2006 01:57:39 -0000
@@ -1171,9 +1171,27 @@ bge_chipinit(struct bge_softc *sc)
  /* Set up the PCI DMA control register. */
  if (sc->bge_pcie) {
  /* PCI Express bus */
- dma_rw_ctl = BGE_PCI_READ_CMD | BGE_PCI_WRITE_CMD |
-    (0xf << BGE_PCIDMARWCTL_RD_WAT_SHIFT) |
-    (0x2 << BGE_PCIDMARWCTL_WR_WAT_SHIFT);
+ u_int32_t device_ctl;
+
+ /* alternative from Linux driver */
+#define DMA_CTRL_WRITE_PCIE_H20MARK_128 0x00180000
+#define DMA_CTRL_WRITE_PCIE_H20MARK_256 0x00380000
+
+ dma_rw_ctl = 0x76000000; /* XXX XXX XXX */;
+ device_ctl = pci_conf_read(pa->pa_pc, pa->pa_tag,
+   BGE_PCI_CONF_DEV_CTRL);
+
+ if ((device_ctl & 0x00e0) && 0) {
+ /*
+ * This clause is exactly what the Broadcom-supplied
+ * Linux does; but given overall register programming
+ * by bge(4), this larger DMA-write watermark
+ * value causes BCM5721 chips to totally wedge.
+ */
+ dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_256;
+ } else {
+ dma_rw_ctl |= BGE_PCIDMA_RWCTL_PCIE_WRITE_WATRMARK_128;
+ }
  } else if (sc->bge_pcix) {
  /* PCI-X bus */
  if (BGE_IS_5714_FAMILY(sc)) {