Subject: zs driver patch.
To: None <port-sparc@netbsd.org>
From: Ron Roskens <roskens@Elfin.Net>
List: port-sparc
Date: 10/01/1999 16:45:57
After reading the latest thread about using serial consoles on the sparcs,
I thought I'd take a crack at implementing a sequence pattern for sending
the machine down into either the debugger or to the prom.

The included patch updates the the zs driver, such that you need to key in
a sequence ( BREAK, any char, BREAK, any char, BREAK ) before it will drop
to the debugger/prom.

Its a first cut at something and I do not know if there are other hidden
side effects from what I've done.

Ron

*** z8530tty.c.ORIG	Mon Jun 28 19:04:48 1999
--- z8530tty.c	Fri Oct  1 16:24:00 1999
***************
*** 134,139 ****
--- 134,144 ----
   */
  u_int zstty_rbuf_size = ZSTTY_RING_SIZE;
  
+ /*
+  * console abort sequence.
+  */
+ u_int zstty_abort_count = 0;
+ 
  /* Stop input when 3/4 of the ring is full; restart when only 1/4 is full. */
  u_int zstty_rbuf_hiwat = (ZSTTY_RING_SIZE * 1) / 4;
  u_int zstty_rbuf_lowat = (ZSTTY_RING_SIZE * 3) / 4;
***************
*** 1349,1354 ****
--- 1354,1377 ----
  			zs_write_csr(cs, ZSWR0_RESET_ERRORS);
  		}
  
+ 		/* reset zstty_abort_count if we get a character. */
+ 		if (c && zstty_abort_count) {
+ 			switch(zstty_abort_count) {
+ 			case 2:
+ 			case 4:
+ 				zstty_abort_count = 0;
+ 				break;
+ 			case 1:
+ 			case 3:
+ 				zstty_abort_count++;
+ 				break;
+ 			}
+ 			printf("(rxint) zstty_abort_count = %d\n", zstty_abort_count);
+ 			/* printf("(rxint) char = '%c' [%d]\n", c,c); */
+ 
+ 			break;
+ 		}
+ 
  		put[0] = c;
  		put[1] = rr1;
  		put += 2;
***************
*** 1460,1466 ****
  	 */
  	if (ISSET(rr0, ZSRR0_BREAK) &&
  	    ISSET(zst->zst_hwflags, ZS_HWFLAG_CONSOLE)) {
! 		zs_abort(cs);
  		return;
  	}
  
--- 1483,1504 ----
  	 */
  	if (ISSET(rr0, ZSRR0_BREAK) &&
  	    ISSET(zst->zst_hwflags, ZS_HWFLAG_CONSOLE)) {
! 		switch(zstty_abort_count) {
! 		case 0:
! 		case 2:
! 			zstty_abort_count++;
! 			break;
! 		case 4:
! 			zstty_abort_count = 0;
! 			zs_abort(cs);
! 			break;
! 		case 1:
! 		case 3:
! 		default:
! 			zstty_abort_count = 0;
! 			break;
! 		}
! 		printf("(stint) zstty_abort_count = %d\n", zstty_abort_count);
  		return;
  	}
  
====