public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Stephen Finney" <shf@pfinc.com>
To: <ecos-patches@ecos.sourceware.org>
Cc: <gary@mlbassoc.com>
Subject: proposed patch for bugzilla bug 1000281
Date: Tue, 04 Sep 2007 14:35:00 -0000	[thread overview]
Message-ID: <s6dd34fb.027@mail.pfinc.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 86 bytes --]

Gary,

Here is my proposed patch for the cs8900a infinite loop bug.

Stephen



[-- Attachment #2: cs8900a_infinite_loop.patch --]
[-- Type: text/plain, Size: 2181 bytes --]

Index: devs/eth/cl/cs8900a/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/cl/cs8900a/current/ChangeLog,v
retrieving revision 1.13
diff -u -5 -p -r1.13 ChangeLog
--- devs/eth/cl/cs8900a/current/ChangeLog	23 Nov 2005 21:26:50 -0000	1.13
+++ devs/eth/cl/cs8900a/current/ChangeLog	4 Sep 2007 13:26:21 -0000
@@ -1,5 +1,10 @@
+2007-09-04  Stephen Finney <shf@pfinc.com>
+
+	* add timeout to potential infinite loop in cs8900a_send per 
+	bugzilla report 1000281
+
 2005-11-10  Laurent Gonzalez <laurent.gonzalez@trango-systems.com>
 
 	* include/cs8900a.h:
 	* src/if_cs8900a.c: Added a priority field in cpd
 	that makes interrupt priority configurable
Index: devs/eth/cl/cs8900a/current/src/if_cs8900a.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c,v
retrieving revision 1.13
diff -u -5 -p -r1.13 if_cs8900a.c
--- devs/eth/cl/cs8900a/current/src/if_cs8900a.c	23 Nov 2005 21:26:50 -0000	1.13
+++ devs/eth/cl/cs8900a/current/src/if_cs8900a.c	4 Sep 2007 13:15:39 -0000
@@ -503,13 +503,26 @@ cs8900a_send(struct eth_drv_sc *sc, stru
     // Start only when all data sent to chip
     HAL_WRITE_UINT16(cpd->base+CS8900A_TxCMD, PP_TxCmd_TxStart_Full);
 
     HAL_WRITE_UINT16(cpd->base+CS8900A_TxLEN, total_len);
     // Wait for controller ready signal
-    do {
-        stat = get_reg(base, PP_BusStat);
-    } while (!(stat & PP_BusStat_TxRDY));
+    {
+        // add timeout per cs8900a bugzilla report 1000281 */
+        int timeout = 1000;
+
+        do {
+            stat = get_reg(base, PP_BusStat);
+            if( stat & PP_BusStat_TxBid )
+                diag_printf( "cs8900a_send: Bid error!\n" );
+        } while (!(stat & PP_BusStat_TxRDY) && --timeout);
+
+        if( !timeout ) {
+            // we might as well just return, since if we write the data it will
+            // just get thrown away
+            return;
+        }
+    }
 
     // Put data into buffer
     for (i = 0;  i < sg_len;  i++) {
         data = (cyg_uint8 *)sg_list[i].buf;
         len = sg_list[i].len;

             reply	other threads:[~2007-09-04 14:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-04 14:35 Stephen Finney [this message]
2007-09-04 16:08 ` Andrew Lunn
2007-09-04 17:06 Stephen Finney
2007-09-11 17:58 ` Andrew Lunn

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=s6dd34fb.027@mail.pfinc.com \
    --to=shf@pfinc.com \
    --cc=ecos-patches@ecos.sourceware.org \
    --cc=gary@mlbassoc.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).