Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Dec 1996 08:10:58 -0500 (EST)
From:      Andrew Webster <andrew@fortress.org>
To:        Damian Hamill <damian@cablenet.net>
Cc:        freebsd-isp@FreeBSD.org
Subject:   Re: getty login prompt delay
Message-ID:  <Pine.BSF.3.91.961223075142.11745N-100000@guardian.fortress.org>
In-Reply-To: <199612231012.KAA11077@axe.cablenet.net>

index | next in thread | previous in thread | raw e-mail

On Mon, 23 Dec 1996, Damian Hamill wrote:

> 
> I found the sources, added a delay option to gettytab and hey presto
> I've since been getting a 97% connection success rate.
> 
> Who should I mail the patch to ?

I used a more 'brute force' method and added a sleep(1) into the getty 
program, but I'd like to see your patch.  

I'll trade you for my more than 32 sio ports patch ;-)

Actually the patch does two things to sio.c in 2.1.6.  

	1. It adds DCD/DSR swapping support for boards like the Boca BB2016
	   which uses 10pin RJ45s (RJ68) which are hard to find and expensive
           and unfortunately have DCD on pin 1!  By swapping DCD/DSR you can
           get away with RJ45s since the other signal lost is Ring.  
           You can enable this feature turn in on Bit 4 in the flags during
           kernel config.

	2. To allow upto 256 sio ports (I don't think that the hardware
           can run THAT fast) I've moved the Callout, Lock and Init bits
           From 7,6,5 to 18,17,16.  This enables support for oodles more
           ports.  
           My current config is 1 Boca BB2016 (16 ports as sio 0-15), plus 2 
           Digi PC/8 as sio16-23 and 24-31, as well as the regular com1 and 
           com2 in the machine setup as sio32 and sio33 respectively for 
           a total of 34 ports.
           Now that there are more than 32 ports, I renamed some of the
           device entries as follows:

	ttyd0-v first 32 ports
	ttye0-v next 32 ports
	ttyf0-v, and so on... to ttyk0-v for a total of 256.

	the cua devices were also illogically defined.  What's the relationship 
        between ttyd0 and cuaa0?  To that end I've renamed cuaa to cuad 
        so the dialouts are cuad0-v, cuae0-v, etc.  Not too important, 
        they're only used to program the modems once in a while.

 	You'll need to modifiy /dev/MAKEDEV to reflect the changes to the
	lock, callout and init bits:  

cuad?|cua?)
        umask 7
        unit=`expr $i : 'cua.*\(.\)$'`
        rm -f cua*d$unit
        m=`ttyminor $unit`
        mknod cuad$unit c 28 `expr $m + 262144`
        mknod cuaid$unit c 28 `expr $m + 65536 + 262144`
        mknod cuald$unit c 28 `expr $m + 131072 + 262144`
        chown uucp.dialer cua*d$unit
        umask 77
        ;;

tty0?|ttyd?|tty?)
        unit=`expr $i : 'tty.*\(.\)$'`
        rm -f tty*d$unit
        m=`ttyminor $unit`
        mknod ttyd$unit c 28 $m 
        mknod ttyid$unit c 28 `expr $m + 65536`
        mknod ttyld$unit c 28 `expr $m + 131072`
        chown root.wheel tty*d$unit
        ;; 


Or as a total hack you can generate all the devices you'll need like this:

allmdm)
        count=0
# Only do 128 for now.
        for x in d e f g
# Uncomment to do all 256.
#       for x in d e f g h i j k
        do
                for y in 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v
                do
                rm -f tty$x$y tty[il]$x$y cua$x$y cua[il]$x$y
                mknod tty$x$y c 28 $count
                mknod ttyi$x$y c 28 `expr $count + 65536`
                mknod ttyl$x$y c 28 `expr $count + 131072`
                mknod cua$x$y c 28 `expr $count + 262144`
                mknod cuai$x$y c 28 `expr $count + 262144 + 65536`
                mknod cual$x$y c 28 `expr $count + 262144 + 131072`
                chown root.wheel tty*$x$y
                chown uucp.dialer cua*$x$y
                count=`expr $count + 1`
                done
        done
        ;;



Oh yeah, the patch:

--- cut here ---

*** sio.c.orig	Fri Nov 15 18:36:37 1996
--- sio.c	Fri Dec 20 11:24:46 1996
***************
*** 70,79 ****
  #define	RB_I_HIGH_WATER	(TTYHOG - 2 * RS_IBUFSIZE)
  #define	RS_IBUFSIZE	256
  
! #define	CALLOUT_MASK		0x80
! #define	CONTROL_MASK		0x60
! #define	CONTROL_INIT_STATE	0x20
! #define	CONTROL_LOCK_STATE	0x40
  #define	DEV_TO_UNIT(dev)	(MINOR_TO_UNIT(minor(dev)))
  #define	MINOR_MAGIC_MASK	(CALLOUT_MASK | CONTROL_MASK)
  #define	MINOR_TO_UNIT(mynor)	((mynor) & ~MINOR_MAGIC_MASK)
--- 70,79 ----
  #define	RB_I_HIGH_WATER	(TTYHOG - 2 * RS_IBUFSIZE)
  #define	RS_IBUFSIZE	256
  
! #define	CALLOUT_MASK		0x40000		/* 262144 - AW */
! #define	CONTROL_MASK		0x30000
! #define	CONTROL_INIT_STATE	0x10000		/* 65536 */
! #define	CONTROL_LOCK_STATE	0x20000		/* 131072 */
  #define	DEV_TO_UNIT(dev)	(MINOR_TO_UNIT(minor(dev)))
  #define	MINOR_MAGIC_MASK	(CALLOUT_MASK | CONTROL_MASK)
  #define	MINOR_TO_UNIT(mynor)	((mynor) & ~MINOR_MAGIC_MASK)
***************
*** 90,95 ****
--- 90,99 ----
  #define	COM_LOSESOUTINTS(dev)	((dev)->id_flags & 0x08)
  #define	COM_NOFIFO(dev)		((dev)->id_flags & 0x02)
  #define	COM_VERBOSE(dev)	((dev)->id_flags & 0x80)
+ #define COM_SWAPDCDDSR(dev)	((dev)->id_flags & 0x10)
+ #define SWAPMASKDCD		(MSR_DCD | MSR_DDCD)
+ #define SWAPMASKDSR		(MSR_DSR | MSR_DDSR)
+ #define SWAPMASKDCDDSR		(SWAPMASKDCD | SWAPMASKDSR)
  
  #define	com_scr		7	/* scratch register for 16450-16550 (R/W) */
  
***************
*** 168,173 ****
--- 172,178 ----
  #ifdef COM_MULTIPORT
  	bool_t	multiport;	/* is this unit part of a multiport device? */
  #endif /* COM_MULTIPORT */
+ 	bool_t	swapdcddsr;
  	bool_t	no_irq;		/* nonzero if irq is not attached */
  	bool_t	poll;		/* nonzero if polling is required */
  	bool_t	poll_output;	/* nonzero if polling for output is required */
***************
*** 410,415 ****
--- 415,421 ----
  		}
  	}
  #endif /* COM_MULTIPORT */
+ 		
  	if (idev->id_irq == 0)
  		mcr_image = 0;
  
***************
*** 683,688 ****
--- 689,698 ----
  	outb(iobase + com_fifo, 0);
  determined_type: ;
  
+ 	if (COM_SWAPDCDDSR(isdp)) {
+ 		com->swapdcddsr = TRUE;
+ 		printf (" DSR<->DCD ");
+ 	}
  #ifdef COM_MULTIPORT
  	if (COM_ISMULTIPORT(isdp)) {
  		com->multiport = TRUE;
***************
*** 752,757 ****
--- 762,768 ----
  	int		s;
  	struct tty	*tp;
  	int		unit;
+ 	u_char		tmp1;
  
  	mynor = minor(dev);
  	unit = MINOR_TO_UNIT(mynor);
***************
*** 857,864 ****
  		disable_intr();
  		(void) inb(com->line_status_port);
  		(void) inb(com->data_port);
! 		com->prev_modem_status = com->last_modem_status
! 		    = inb(com->modem_status_port);
  		outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS
  				       | IER_EMSC);
  		enable_intr();
--- 868,884 ----
  		disable_intr();
  		(void) inb(com->line_status_port);
  		(void) inb(com->data_port);
! 		tmp1 = inb(com->modem_status_port);
! 		if (com->swapdcddsr) 
! 			com->prev_modem_status = com->last_modem_status = 
!   		             ((tmp1 & ~SWAPMASKDCDDSR)
! 				    | ((tmp1 & SWAPMASKDCD) >> 2)
! 				    | ((tmp1 & SWAPMASKDSR) << 2));
! 		else  
! 			com->prev_modem_status = com->last_modem_status = tmp1;	
! 		
! 		
! 			
  		outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS
  				       | IER_EMSC);
  		enable_intr();
***************
*** 1102,1107 ****
--- 1122,1128 ----
  	u_char	modem_status;
  	u_char	*ioptr;
  	u_char	recv_data;
+ 	u_char	tmp1;
  
  	if (com->do_timestamp)
  		/* XXX a little bloat here... */
***************
*** 1187,1193 ****
  		}
  
  		/* modem status change? (always check before doing output) */
! 		modem_status = inb(com->modem_status_port);
  		if (modem_status != com->last_modem_status) {
  			/*
  			 * Schedule high level to handle DCD changes.  Note
--- 1208,1220 ----
  		}
  
  		/* modem status change? (always check before doing output) */
! 		tmp1 = inb(com->modem_status_port);
! 		if (com->swapdcddsr) 
! 		modem_status = ((tmp1 & ~SWAPMASKDCDDSR)
! 				    | ((tmp1 & SWAPMASKDCD) >> 2)
! 				    | ((tmp1 & SWAPMASKDSR) << 2));
! 		else 
! 		modem_status = tmp1;
  		if (modem_status != com->last_modem_status) {
  			/*
  			 * Schedule high level to handle DCD changes.  Note

--- cut here ---

Regards,

Andrew Webster                              andrew@pubnix.net   
PubNIX Montreal    Connected to the world   Branche au monde
P.O. Box 147       Cote Saint Luc, Quebec   H4V 2Y3
tel 514.990.5911   http://www.pubnix.net    fax 514.990.9443



help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.961223075142.11745N-100000>