Subject: patch for the zs driver in 1.2
To: None <port-sun3@NetBSD.ORG>
From: Gordon W. Ross <gwr@mc.com>
List: port-sun3
Date: 10/16/1996 12:50:51
Here is a ptach for the zs driver that fixes a problem with CRTSCTS
flow control where output may fail to restart if we get multiple
status interrupts before the "software interrupt" routine gets a
chance to run.  Hopefully, this will be in "1.2+patch1" soon.

Many thanks to Bill Studenmund for finding the problem.

Gordon

[ Diff follows.  Based on netbsd-1-2 (z8530tty.c,v 1.8.4.2)]

*** sys/dev/ic/z8530tty.c.orig	Wed Oct 16 12:35:35 1996
--- sys/dev/ic/z8530tty.c	Wed Oct 16 12:37:07 1996
***************
*** 79,84 ****
--- 79,88 ----
  #include <sys/syslog.h>
  
  #include <dev/ic/z8530reg.h>
+ 
+ /* XXX - Temporary hack to minimize changes on the release branch. */
+ #define cs_rr0_new cs_rr0_delta 	/* cheap field rename */
+ 
  #include <machine/z8530var.h>
  
  #ifdef KGDB
***************
*** 1067,1073 ****
  		zst->zst_tx_stopped = 1;
  	}
  
! 	cs->cs_rr0_new = rr0;
  	zst->zst_st_check = 1;
  
  	/* Ask for softint() call. */
--- 1071,1085 ----
  		zst->zst_tx_stopped = 1;
  	}
  
! 	/*
! 	 * We have to accumulate status line changes here.
! 	 * Otherwise, if we get multiple status interrupts
! 	 * before the softint runs, we could fail to notice
! 	 * some status line changes in the softint routine.
! 	 * Fix from Bill Studenmund, October 1996.
! 	 */
! 	cs->cs_rr0_delta |= (cs->cs_rr0 ^ rr0);
! 	cs->cs_rr0 = rr0;
  	zst->zst_st_check = 1;
  
  	/* Ask for softint() call. */
***************
*** 1182,1190 ****
  	if (zst->zst_st_check) {
  		zst->zst_st_check = 0;
  
! 		rr0 = cs->cs_rr0_new;
! 		delta = rr0 ^ cs->cs_rr0;
! 		cs->cs_rr0 = rr0;
  		if (delta & ZSRR0_DCD) {
  			c = ((rr0 & ZSRR0_DCD) != 0);
  			if (line->l_modem(tp, c) == 0)
--- 1194,1202 ----
  	if (zst->zst_st_check) {
  		zst->zst_st_check = 0;
  
! 		rr0 = cs->cs_rr0;
! 		delta = cs->cs_rr0_delta;
! 		cs->cs_rr0_delta = 0;
  		if (delta & ZSRR0_DCD) {
  			c = ((rr0 & ZSRR0_DCD) != 0);
  			if (line->l_modem(tp, c) == 0)