From 84c6b9dbd7f4ff0b2319c6bede7a69e95c220642 Mon Sep 17 00:00:00 2001 From: wrstuden Date: Thu, 5 Mar 1998 22:03:34 +0000 Subject: [PATCH] Make zs_iflush not loop indefinitly. Some Mac PowerBooks lie about having two SCC channels, and can get stuck in an infinite loop. This change stops after flushing 4 bytes. Might need upping to 8 bytes if we support 85230 ESCC's. Idea bounced off of scottr & gwr --- sys/dev/ic/z8530sc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/z8530sc.c b/sys/dev/ic/z8530sc.c index a3275e106768..9380e368bc50 100644 --- a/sys/dev/ic/z8530sc.c +++ b/sys/dev/ic/z8530sc.c @@ -1,4 +1,4 @@ -/* $NetBSD: z8530sc.c,v 1.7 1998/02/19 21:26:10 mycroft Exp $ */ +/* $NetBSD: z8530sc.c,v 1.8 1998/03/05 22:03:34 wrstuden Exp $ */ /* * Copyright (c) 1994 Gordon W. Ross @@ -92,8 +92,13 @@ zs_iflush(cs) struct zs_chanstate *cs; { u_char c, rr0, rr1; + int i; - for (;;) { + /* + * Count how many times we loop. Some systems, such as some + * Apple PowerBooks, claim to have SCC's which they really don't. + */ + for (i=0; i<4; i++) { /* Is there input available? */ rr0 = zs_read_csr(cs); if ((rr0 & ZSRR0_RX_READY) == 0)