From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31111 invoked by alias); 4 Sep 2007 17:06:10 -0000 Received: (qmail 31103 invoked by uid 22791); 4 Sep 2007 17:06:08 -0000 X-Spam-Status: No, hits=-2.2 required=5.0 tests=BAYES_00,DK_POLICY_SIGNSOME,FORGED_RCVD_HELO,SPF_HELO_PASS,SPF_PASS,SUBJ_HAS_UNIQ_ID,TW_DR X-Spam-Check-By: sourceware.org Received: from pfinc.lightlink.com (HELO mail.pfinc.com) (205.232.89.202) by sourceware.org (qpsmtpd/0.31) with SMTP; Tue, 04 Sep 2007 17:05:59 +0000 Received: from PF_Domain-Message_Server by mail.pfinc.com with Novell_GroupWise; Tue, 04 Sep 2007 13:05:57 -0400 Message-Id: X-Mailer: Novell GroupWise 5.5.5 Date: Tue, 04 Sep 2007 17:06:00 -0000 From: "Stephen Finney" To: Cc: Subject: Re: proposed patch for bugzilla bug 1000281 Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_06219065.DABBEBDE" X-Virus-Checked: Checked by ClamAV on sourceware.org Mailing-List: contact ecos-patches-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-patches-owner@ecos.sourceware.org X-SW-Source: 2007-09/txt/msg00007.txt.bz2 This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=_06219065.DABBEBDE Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-length: 355 Andrew, That's a great idea; I should have thought of it. Stephen >>> Andrew Lunn 09/04/07 12:08PM >>> > + stat =3D 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 --=_06219065.DABBEBDE Content-Type: text/plain Content-Disposition: attachment; filename="cs8900a_infinite_loop.patch" Content-length: 2204 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 + + * add timeout to potential infinite loop in cs8900a_send per + bugzilla report 1000281 + 2005-11-10 Laurent Gonzalez * 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; --=_06219065.DABBEBDE--