[1531] in linux-net channel archive
Small fix for 3c503-PIO driver
daemon@ATHENA.MIT.EDU (Paul Gortmaker)
Mon Dec 18 18:13:15 1995
From: Paul Gortmaker <gpg109@rsphy1.anu.edu.au>
To: linux-net@vger.rutgers.edu
Date: Mon, 18 Dec 1995 14:09:48 +1100 (EST)
Cc: torvalds@cs.helsinki.fi (Linus Torvalds)
Hi,
Here is a small fix to the semi-unsupported programmed i/o part of the
3c503 driver. It appears that there are still some evil site-admins
out there that won't let users pop the lid and jumper the card
for the shared memory mode.
And if you are voluntarily using the card in PIO mode, then you need
to seek out psychiatric help, or just slam your car door on your head
a few times.
This will fix the bogus packet messages that were reported to the
kernel channel earlier. (The patch, that is. Not the door slamming...)
Paul.
--- linux/drivers/net/3c503.c.orig Sun Dec 17 01:51:36 1995
+++ linux/drivers/net/3c503.c Mon Dec 18 13:34:46 1995
@@ -475,6 +475,7 @@
{
unsigned int i;
unsigned long hdr_start = dev->mem_start + ((ring_page - EL2_MB1_START_PG)<<8);
+ unsigned long fifo_watchdog;
if (dev->mem_start) { /* Use the shared memory. */
#ifdef notdef
@@ -492,7 +493,15 @@
outb_p((ei_status.interface_num == 0 ? ECNTRL_THIN : ECNTRL_AUI) | ECNTRL_INPUT
| ECNTRL_START, E33G_CNTRL);
- /* Header is less than 8 bytes, so we can ignore the FIFO. */
+ /* Header is < 8 bytes, so only check the FIFO at the beginning. */
+ fifo_watchdog = jiffies;
+ while ((inb(E33G_STATUS) & ESTAT_DPRDY) == 0) {
+ if (jiffies - fifo_watchdog > 2*HZ/100) {
+ printk("%s: FIFO blocked in el2_get_8390_hdr.\n", dev->name);
+ break;
+ }
+ }
+
for(i = 0; i < sizeof(struct e8390_pkt_hdr); i++)
((char *)(hdr))[i] = inb_p(E33G_FIFOH);