From: ishii@kuee.kuee.kyoto-u.ac.jp (Masahiro ISHII)
Newsgroups: fj.os.386bsd
Subject: [386bsd(98)] i386/isa/com.c patch
Date: 10 Nov 92 13:59:35 GMT
Distribution: fj
Organization: Dept. of Electr. Eng., Kyoto Univ., Japan


  $@@P0f!w5~Bg(J.$@EE;R(J.$@;3ED8&$G$9!#(JRelease$@8eH/3P$7$?LdBjE@$=$N#8!#(J

  $@MM!9$JLdBj$r$O$i$s$@(JRS232C$@$G$9$,!"(Jsilo overflow $@0J30$O$@$$$?$$D>$C$?(J
$@$h$&$J$N$G!"(Jpatch$@$rN.$7$^$9!#(J

patch-1)
  EPSON$@$G%\!<%l!<%H$,@5$7$/@_Dj$5$l$J$$$N$r=$@5!#(J(clock.c$@$X$N%Q%C%A$r(J
$@4^$_$^$9(J)
  tip$@Ey$r;HMQ$7$F$$$F!"(Jopen$@$G$-$?$j$G$-$J$+$C$?$jIT0BDj$J$N$rD>$9!#(J
  [$@$3$l$O0JA0(J fj.os.misc $@$KN.$7$?$b$N$N(J REPOST]

patch-2)
  silo overflow$@$r5/$3$7$F=*N;$7!"<!$K(J/dev/com0$@$r(Jopen$@$7$?:]$K%O%s%0$9$k(J
$@%P%0$r=$@5!#(J($@$3$l$O!"Ln<s!w(JNEC$@%^%$%3%s%F%/%N%m%8!<(J $@$5$s$K$h$k$b$N$G$9!#(J
$@$"$j$,$H$&$4$6$$$^$7$?!#(J)
  tip$@$r(Jmodem$@Ey$G;HMQ$9$k$H$-!"(Jmodem$@@)8f@~$N%A%'%C%/4V3V$,D9$9$.$F(Jopen
$@$G$-$J$$LdBj$r2r7h!#(J

# $@$9$G$K$"$F$F$"$C$?(Jpatch$@$,(Jterry's patch kit$@$K$"$C$?$N$G!"$=$l$N(Jheader
# $@$N%3%a%s%H$@$1DI2C$7$^$7$?!#(J

  $@$^$?!"(Jcom$@$N%F%9%H$K6(NO$$$?$@$$$?(J $@Bg@P!w%f!<%(%9%7!<(J $@$5$s$K$O!"$3$N(J
$@>l$r<Z$j$F$*Ni?=$7>e$2$^$9!#$"$j$,$H$&$4$6$$$^$7$?!#(J

------------------------------------------------------------------
$@5~ETBg3X(J $@EE;R9)3X@l96(J $@;3ED8&(J M2 ishii@kuee.kyoto-u.ac.jp  $@@P0f@59((J
$@5~Bg%^%$%3%s%/%i%V(J              ishii@kmc.kyoto-u.ac.jp

----  patch-1   ----  patch-1   ----  patch-1   ----  patch-1   ----
----  $@$3$3$+$i(J  ----  cut here  ----  $@$3$3$+$i(J  ----  cut here  ----
*** com.c.pc98-a	Thu Oct  1 06:12:25 1992
--- com.c	Sun Nov  1 07:27:13 1992
***************
*** 949,956 ****
  		break;
  
  	case DMGET:
! #if 1 /* debugged by M.Ishii 9/24 */
! 		bits = inb(com+com_msr);
  #else
  		tmp = prev_siocmd[unit];
  		bits = 0;
--- 949,956 ----
  		break;
  
  	case DMGET:
! #if 1 /* debugged by M.Ishii 10/21 */
! 		bits = pc98_get_msr( com );
  #else
  		tmp = prev_siocmd[unit];
  		bits = 0;
***************
*** 1289,1294 ****
--- 1289,1296 ----
  {
  	int	sysclock;
  	int	counter;
+ 	int	s;
+ 	int	i;
  
  	if ( com != IO_COM1 ) {
  		/* ext. RS232C board: speed is determined by DIP switch */
***************
*** 1296,1304 ****
  	}
  	/* get system clock from port */
  #if 1
! 	if (PC98_SYSTEM_PARAMETER(0x501)&0x80) {
  #else
! 	if (inb(0x42) & 0x20) {
  #endif
  	/* 8 MHz system & H98 */
  		sysclock = 8;
--- 1298,1308 ----
  	}
  	/* get system clock from port */
  #if 1
! 	if ( PC98_SYSTEM_PARAMETER(0x501) & 0x08 ?
! 		/*HighReso*/	inb(0x63) & 0x01 :
! 		/*Normal*/	inb(0x42) & 0x20) {
  #else
! 	if (PC98_SYSTEM_PARAMETER(0x501)&0x80) {
  #endif
  	/* 8 MHz system & H98 */
  		sysclock = 8;
***************
*** 1309,1319 ****
  	}
  	counter = (sysclock == 5 ? 153600 : 124800) / speed;
  	/* set i8253 */
  	outb( 0x77, 0xb6 );
! DELAY(10);
  	outb( 0x75, counter & 0xff );
! DELAY(10);
  	outb( 0x75, (counter >> 8) & 0xff );
  	COMDEBUG2(printf( "[bps clock %d cnt %d]", sysclock, counter ));
  }
  
--- 1313,1329 ----
  	}
  	counter = (sysclock == 5 ? 153600 : 124800) / speed;
  	/* set i8253 */
+ 	s = splhigh();
  	outb( 0x77, 0xb6 );
! 	for(i=0;i<5;i++){
! 		inb(0x5f);
! 	}
  	outb( 0x75, counter & 0xff );
! 	for(i=0;i<5;i++){
! 		inb(0x5f);
! 	}
  	outb( 0x75, (counter >> 8) & 0xff );
+ 	splx(s);
  	COMDEBUG2(printf( "[bps clock %d cnt %d]", sysclock, counter ));
  }
  
*** clock.c.pc98-a	Thu Oct  1 06:14:40 1992
--- clock.c	Fri Oct 30 03:55:00 1992
***************
*** 66,72 ****
--- 66,78 ----
  	/* initialize 8253 clock */
  #ifdef PC98
  	outb (IO_TIMER+3*2, 0x36);	/* control register */
+ #if 1
+ 	if ( PC98_SYSTEM_PARAMETER(0x501) & 0x08 ?
+ 		/*HighReso*/	inb(0x63) & 0x01 :
+ 		/*Normal*/	inb(0x42) & 0x20) {
+ #else
  	if (PC98_SYSTEM_PARAMETER(0x501)&0x80) {
+ #endif
  		/* 8 MHz system */
  		outb (IO_TIMER, 1996800/hz);		/* 1.9968 MHz */
  		outb (IO_TIMER, (1996800/hz)/256);
----  $@$3$3$^$G(J  ----  cut here  ----  $@$3$3$^$G(J  ----  cut here  ----

----  patch-2   ----  patch-2   ----  patch-2   ----  patch-2   ----
----  $@$3$3$+$i(J  ----  cut here  ----  $@$3$3$+$i(J  ----  cut here  ----
*** com.c-patch1	Tue Nov 10 22:53:41 1992
--- com.c	Tue Nov 10 22:53:48 1992
***************
*** 31,38 ****
   * SUCH DAMAGE.
   *
   *	@(#)com.c	7.5 (Berkeley) 5/16/91
   */
! static char rcsid[] = "$Header: /usr/bill/working/sys/i386/isa/RCS/com.c,v 1.2 92/01/21 14:34:11 william Exp $";
  
  /*
   * modified for PC9801 by M.Ishii 
--- 31,46 ----
   * SUCH DAMAGE.
   *
   *	@(#)com.c	7.5 (Berkeley) 5/16/91
+  *
+  * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
+  * --------------------         -----   ----------------------
+  * CURRENT PATCH LEVEL:         2       00019
+  * --------------------         -----   ----------------------
+  *
+  * 30 Aug 92	Poul-Henning Kamp	Stabilize SLIP on lossy lines/UARTS
+  * 09 Aug 92	Christoph Robitschko	Correct minor number on com ports
   */
! static char rcsid[] = "$Header: /usr1/ishii/386/i386/isa/RCS/com.c,v 1.1 1992/11/05 15:38:50 ishii Exp ishii $";
  
  /*
   * modified for PC9801 by M.Ishii 
***************
*** 158,164 ****
    	pc98_i8251_set_cmd(), pc98_i8251_or_cmd(), pc98_i8251_clear_cmd(),
  	pc98_i8251_clear_or_cmd();
  static pc98_check_msr();
! # define	PC98_CHECK_MODEM_INTERVAL	(10*hz)
  #endif
  
  comprobe(dev)
--- 166,172 ----
    	pc98_i8251_set_cmd(), pc98_i8251_or_cmd(), pc98_i8251_clear_cmd(),
  	pc98_i8251_clear_or_cmd();
  static pc98_check_msr();
! # define	PC98_CHECK_MODEM_INTERVAL	(1*hz)
  #endif
  
  comprobe(dev)
***************
*** 585,590 ****
--- 593,601 ----
  
  	tp = &com_tty[unit];
  	c = inb(com+com_data);
+ #ifdef PC98 /* debug by h-nokubi@mcscs26.lsi.tmg.nec.co.jp */
+ 	pc98_i8251_or_cmd(com,CMD8251_ER);
+ #endif
  	if ((tp->t_state & TS_ISOPEN) == 0) {
  #ifdef KGDB
  		/* we don't care about parity errors */
***************
*** 615,627 ****
  #else
  	else if (stat & LSR_OE)
  #endif
! 	{
! 		c |= TTY_PE;	/* with patch for stable SLIP */
  		log(LOG_WARNING, "com%d: silo overflow\n", unit);
  	}
- #ifdef PC98
- 	pc98_i8251_or_cmd(com,CMD8251_ER);
- #endif
  	(*linesw[tp->t_line].l_rint)(c, tp);
  }
  
--- 626,635 ----
  #else
  	else if (stat & LSR_OE)
  #endif
! 	{			/* 30 Aug 92*/
! 		c |= TTY_PE;	/* Ought to have it's own define... */
  		log(LOG_WARNING, "com%d: silo overflow\n", unit);
  	}
  	(*linesw[tp->t_line].l_rint)(c, tp);
  }
----  $@$3$3$^$G(J  ----  cut here  ----  $@$3$3$^$G(J  ----  cut here  ----
----  patch-2   ----  patch-2   ----  patch-2   ----  patch-2   ----
Newsgroups: fj.os.386bsd