*BSD News Article 17574


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!wupost!gumby!yale!zip.eecs.umich.edu!quip.eecs.umich.edu!dmuntz
From: dmuntz@quip.eecs.umich.edu (Dan Muntz)
Newsgroups: comp.os.386bsd.development
Subject: RT multiport support for sio.c
Date: 26 Jun 1993 19:56:04 GMT
Organization: University of Michigan EECS Dept., Ann Arbor, MI
Lines: 127
Distribution: world
Message-ID: <20i9kk$jba@zip.eecs.umich.edu>
NNTP-Posting-Host: quip.eecs.umich.edu


Here is a first crack at getting the RT multiport card working with the new
sio driver (sio.c included with patchkit 0.2.4).  To use this patch, you must
have "options COM_MULTIPORT" and "options RT_MULTIPORT" in your kernel
configuration file and entries for your serial ports similar to these:

device  sio0    at isa? port "IO_COM1" tty irq 4 flags 0x0000 vector siointr
device  sio1    at isa? port "IO_COM2" tty irq 3 flags 0x0000 vector siointr
device  sio2    at isa? port 0x1230 tty irq 10 flags 0x0503 vector siointr
device  sio3    at isa? port 0x1238 tty irq 10 flags 0x0503 vector siointr
device  sio4    at isa? port 0x1240 tty irq 10 flags 0x0503 vector siointr
device  sio5    at isa? port 0x1248 tty irq 10 flags 0x0503 vector siointr

sio0 and sio1 are standard PC serial ports.  For the RT ports, the flags
values are or'ed  with 0x02 (standard multiport flags for this setup would be
0x0501) to indicate the ports are on an RT multiport card.  I suggest setting
the RT card to the io-addresses and irq I've chosen (i.e., the "standard"
settings) although it shouldn't be difficult to change things to work with
alternative settings, in fact, changing the kernel configuration file may be
all that is necessary.

I'd like to hear about any successes or failures anyone has with this patch.

  -Dan
   dmuntz@eecs.umich.edu
   dmuntz@citi.umich.edu

*** sio.c.ORIG	Sat Jun 26 13:23:43 1993
--- sio.c	Sat Jun 26 15:18:26 1993
***************
*** 93,98 ****
--- 93,102 ----
  #define COM_MPMASTER(dev)    (((dev)->id_flags >> 8) & 0x0ff)
  #endif /* COM_MULTIPORT */
  
+ #ifdef RT_MULTIPORT
+ #define RTPORT		0x02
+ #endif
+ 
  #define	com_scr		7	/* scratch register for 16450-16550 (R/W) */
  #define	schedsoftcom()	(ipending |= 1 << 4)	/* XXX */
  
***************
*** 326,332 ****
--- 330,340 ----
  };
  
  /* XXX - configure this list */
+ #ifdef RT_MULTIPORT
+ static Port_t likely_com_ports[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x1230, 0x1238, 0x1240, 0x1248, };
+ #else
  static Port_t likely_com_ports[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, };
+ #endif
  
  static int
  sioprobe(dev)
***************
*** 337,342 ****
--- 345,353 ----
  	Port_t		iobase;
  	int		result;
  
+ #ifdef RT_MULTIPORT
+ 	outb(0x6f2,0);
+ #endif
  	if (!already_init) {
  		/*
  		 * Turn off MCR_IENABLE for all likely serial ports.  An unused
***************
*** 378,384 ****
--- 389,399 ----
  	    || inb(iobase + com_mcr) != MCR_IENABLE
  	    || !isa_irq_pending(dev)
  	    || (inb(iobase + com_iir) & IIR_IMASK) != IIR_TXRDY
+ #ifdef RT_MULTIPORT
+ 	    || (isa_irq_pending(dev) && !(dev->id_flags & RTPORT))
+ #else
  	    || isa_irq_pending(dev)
+ #endif
  	    || (inb(iobase + com_iir) & IIR_IMASK) != IIR_NOPEND)
  		result = 0;
  
***************
*** 393,399 ****
--- 408,418 ----
  	outb(iobase + com_ier, 0);
  	outb(iobase + com_mcr, MCR_IENABLE);	/* dummy to avoid bus echo */
  	if (   inb(iobase + com_ier) != 0
+ #ifdef RT_MULTIPORT
+ 	    || (isa_irq_pending(dev) && !(dev->id_flags & RTPORT))
+ #else
  	    || isa_irq_pending(dev)
+ #endif
  	    || (inb(iobase + com_iir) & IIR_IMASK) != IIR_NOPEND)
  		result = 0;
  
***************
*** 465,472 ****
--- 484,497 ----
  	outb(iobase + com_scr, 0x5a);
  	scr2 = inb(iobase + com_scr);
  	outb(iobase + com_scr, scr);
+ #ifdef RT_MULTIPORT
+ 	/* RT cards don't have 8250's, but "pass" this test for them */
+ 	if ((scr1 != 0xa5 || scr2 != 0x5a) && !(isdp->id_flags & RTPORT))
+ 		printf(" <8250>");
+ #else
  	if (scr1 != 0xa5 || scr2 != 0x5a)
  		printf(" <8250>");
+ #endif
  	else {
  		outb(iobase + com_fifo, FIFO_ENABLE | FIFO_TRIGGER_14);
  		DELAY(100);
***************
*** 843,848 ****
--- 868,876 ----
  	bool_t		donesomething;
  
  	do {
+ #ifdef RT_MULTIPORT
+ 		outb(0x6f2,0);
+ #endif
  		donesomething = FALSE;
  		for(i=0;i<NSIO;i++) {
  			com=com_addr(i);