rtl8139 pci mem freeze (more info)

Daniel Kobras daniel.kobras@student.uni-tuebingen.de
Mon Sep 27 17:36:56 1999


Hi!

I've been looking a bit further into the rtl8139 freezing my boxes when
using PCI mem access, which I reported some days ago. Here's the minimal
patch that makes the difference between messing up the PCI bus, locking
the computer hard and on my Dual-PII even wrecking the ATX power off (this
happens reliably on my SMP box but never on the UP one), and a network
card that will complain loudly on tons of strange errors but at least
leaves the system running. 

[Patch against rtl8139.c from 2.3.18ac8]

---[snip]---

--- rtl8139.c	Mon Sep 27 23:14:29 1999
+++ rtl8139.c.safe	Mon Sep 27 23:14:12 1999
@@ -137,7 +137,7 @@
 /*
  *	For now while we investigate a few things.
  */
-#define USE_IO_OPS
+/* #define USE_IO_OPS */
 
 static void *rtl8139_probe1(struct pci_dev *pdev, void *init_dev,
 							long ioaddr, int irq, int chp_idx, int card_idx);
@@ -186,10 +186,17 @@
 #define outb writeb
 #define outw writew
 #define outl writel
+#define outb_f(val,port)	do{writeb((val),(port));readb((port));}while(0)
+#define outw_f(val,port)	do{writew((val),(port));readw((port));}while(0)
+#define outl_f(val,port)	do{writel((val),(port));readl((port));}while(0)
 #undef request_region
 #undef release_region
 #define request_region request_mem_region
 #define release_region release_mem_region
+#else
+#define outb_f	outb
+#define outw_f	outw
+#define outl_f	outl
 #endif
 
 /* The rest of these values should never change. */
@@ -603,7 +610,7 @@
 			break;
 
 	for (i = 0; i < 6; i++)
-		outb(dev->dev_addr[i], ioaddr + MAC0 + i);
+		outb_f(dev->dev_addr[i], ioaddr + MAC0 + i);
 
 	/* Must enable Tx/Rx before setting transfer thresholds! */
 	outb(CmdRxEnb | CmdTxEnb, ioaddr + ChipCmd);
@@ -678,7 +685,7 @@
 			break;
 	/* Restore our idea of the MAC address. */ 
 	for (i = 0; i < 6; i++)
-		outb(dev->dev_addr[i], ioaddr + MAC0 + i);
+		outb_f(dev->dev_addr[i], ioaddr + MAC0 + i);
 
 	/* Hmmm, do these belong here? */
 	outb(0x00, ioaddr + Cfg9346);
@@ -837,7 +844,7 @@
 		if ((inb(ioaddr + ChipCmd) & CmdReset) == 0)
 			break;
 	for (i = 0; i < 6; i++)
-		outb(dev->dev_addr[i], ioaddr + MAC0 + i);
+		outb_f(dev->dev_addr[i], ioaddr + MAC0 + i);
 
 	outb(0x00, ioaddr + Cfg9346);
 	tp->cur_rx = 0;
@@ -1370,7 +1377,7 @@
 	}
 	/* We can safely update without stopping the chip. */
 	outb(rx_mode, ioaddr + RxConfig);
-	outl(mc_filter[0], ioaddr + MAR0 + 0);
+	outl_f(mc_filter[0], ioaddr + MAR0 + 0);
 	outl(mc_filter[1], ioaddr + MAR0 + 4);
 	return;
 }

---[snap]---

Note that on my machine, I still don't have a running network with this
patch - I keep getting rx underruns and assorted errors and only very
rarely a ping will go out - but maybe this will give someone a clue as to
what might be going on. My boxes are an AMD K6-200 on an HX board, 
equipped with an Intel PIIX3 PCI bridge, and a Dual-PII/350 on BX, PIIX4. 

Regards,

Daniel.


 | To unsubscribe, send mail to Majordomo@cesdis.gsfc.nasa.gov, and within the
 |  body of the mail, include only the text:
 |   unsubscribe this-list-name youraddress@wherever.org
 | You will be unsubscribed as speedily as possible.