* proposed patch for bugzilla bug 1000281
@ 2007-09-04 14:35 Stephen Finney
2007-09-04 16:08 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Finney @ 2007-09-04 14:35 UTC (permalink / raw)
To: ecos-patches; +Cc: gary
[-- 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;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: proposed patch for bugzilla bug 1000281
2007-09-04 14:35 proposed patch for bugzilla bug 1000281 Stephen Finney
@ 2007-09-04 16:08 ` Andrew Lunn
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2007-09-04 16:08 UTC (permalink / raw)
To: Stephen Finney; +Cc: ecos-patches
> + stat = get_reg(base, PP_BusStat);
> + if( stat & PP_BusStat_TxBid )
> + diag_printf( "cs8900a_send: Bid error!\n" );
Maybe this diag_printf() should be inside a
#if DEBUG & 1
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: proposed patch for bugzilla bug 1000281
2007-09-04 17:06 Stephen Finney
@ 2007-09-11 17:58 ` Andrew Lunn
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2007-09-11 17:58 UTC (permalink / raw)
To: Stephen Finney; +Cc: andrew, ecos-patches
On Tue, Sep 04, 2007 at 01:05:39PM -0400, Stephen Finney wrote:
> Andrew,
>
> That's a great idea; I should have thought of it.
>
> Stephen
>
> >>> Andrew Lunn <andrew@lunn.ch> 09/04/07 12:08PM >>>
> > + stat = get_reg(base, PP_BusStat);
> > + if( stat & PP_BusStat_TxBid )
> > + diag_printf( "cs8900a_send: Bid error!\n" );
>
> Maybe this diag_printf() should be inside a
> #if DEBUG & 1
Thanks for the patch. I have applied it.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: proposed patch for bugzilla bug 1000281
@ 2007-09-04 17:06 Stephen Finney
2007-09-11 17:58 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Finney @ 2007-09-04 17:06 UTC (permalink / raw)
To: andrew; +Cc: ecos-patches
[-- Attachment #1: Type: text/plain, Size: 369 bytes --]
Andrew,
That's a great idea; I should have thought of it.
Stephen
>>> Andrew Lunn <andrew@lunn.ch> 09/04/07 12:08PM >>>
> + stat = get_reg(base, PP_BusStat);
> + if( stat & PP_BusStat_TxBid )
> + diag_printf( "cs8900a_send: Bid error!\n" );
Maybe this diag_printf() should be inside a
#if DEBUG & 1
Andrew
[-- Attachment #2: cs8900a_infinite_loop.patch --]
[-- Type: text/plain, Size: 2204 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 17:00:04 -0000
@@ -503,13 +503,28 @@ 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 DEBUG & 1
+ if( stat & PP_BusStat_TxBid )
+ diag_printf( "cs8900a_send: Bid error!\n" );
+#endif
+ } 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;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-09-11 17:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-04 14:35 proposed patch for bugzilla bug 1000281 Stephen Finney
2007-09-04 16:08 ` Andrew Lunn
2007-09-04 17:06 Stephen Finney
2007-09-11 17:58 ` Andrew Lunn
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).