diff options
author | bde <bde@FreeBSD.org> | 1995-12-29 13:21:10 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1995-12-29 13:21:10 +0000 |
commit | ff6f507f6bbb3fda77fb14c7201db37bafea7a3f (patch) | |
tree | 18f16aea00f6dec8f41197a17c419ebb6d668c3f /sys/gnu | |
parent | a82695f60f1a6634d35bd489bf1bc7ee9bd9b3f0 (diff) | |
download | FreeBSD-src-ff6f507f6bbb3fda77fb14c7201db37bafea7a3f.zip FreeBSD-src-ff6f507f6bbb3fda77fb14c7201db37bafea7a3f.tar.gz |
Fixed erroneous resending of the output buffer.
Fixed panics for events on nonexistent ports.
Fixed devconf class initialization and devconf state tracking.
Submitted by: Serge A. Babkin <babkin@hq.icb.chel.su>
Diffstat (limited to 'sys/gnu')
-rw-r--r-- | sys/gnu/i386/isa/dgb.c | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index e96cbc7..42810f0 100644 --- a/sys/gnu/i386/isa/dgb.c +++ b/sys/gnu/i386/isa/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.13 1995/12/10 20:54:21 bde Exp $ + * dgb.c $Id: dgb.c,v 1.14 1995/12/17 21:14:29 phk Exp $ * * Digiboard driver. * @@ -410,15 +410,17 @@ dgbprobe(dev) return 4; /* we need I/O space of 4 ports */ } -static struct kern_devconf kdc_dgb[NDGB] = { { +static struct kern_devconf kdc_dgb[NDGB]; +static struct kern_devconf kdc_dgb_init = { 0, 0, 0, /* filled in by dev_attach */ "dgb", 0, { MDDT_ISA, 0, "tty" }, isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, - "DigiBoard multiport card" -} }; + "DigiBoard multiport card", + DC_CLS_SERIAL, +}; static void dgbregisterdev(id) @@ -427,13 +429,12 @@ dgbregisterdev(id) int unit; unit = id->id_unit; - if (unit != 0) - kdc_dgb[unit] = kdc_dgb[0]; + kdc_dgb[unit] = kdc_dgb_init; kdc_dgb[unit].kdc_unit = unit; kdc_dgb[unit].kdc_isa = id; - /* now we assume that multiport is always 'open' for simplicity */ - kdc_dgb[unit].kdc_state = DC_BUSY; + /* no ports are open yet */ + kdc_dgb[unit].kdc_state = DC_IDLE; dev_attach(&kdc_dgb[unit]); } @@ -878,6 +879,8 @@ load_fep: hidewin(sc); + dgbregisterdev(dev); + /* register the polling function */ timeout(dgbpoll, (void *)unit, hz/25); @@ -1040,6 +1043,12 @@ open_top: port->active_out = TRUE; port->used=1; + + /* If any port is open (i.e. the open() call is completed for it) + * the device is busy + */ + + kdc_dgb[unit].kdc_state = DC_BUSY; out: splx(s); @@ -1066,6 +1075,7 @@ dgbclose(dev, flag, mode, p) struct dgb_softc *sc; struct dgb_p *port; int s; + int i; mynor=minor(dev); unit=MINOR_TO_UNIT(mynor); @@ -1090,6 +1100,15 @@ dgbclose(dev, flag, mode, p) port->closing=0; wakeup(&port->closing); port->used=0; + /* mark the card idle when all ports are closed */ + + for(i=0; i<sc->numports; i++) + if(sc->ports[i].used) + break; + + if(i>= sc->numports) + kdc_dgb[unit].kdc_state = DC_IDLE; + splx(s); wakeup(TSA_CARR_ON(tp)); @@ -1224,13 +1243,14 @@ dgbpoll(unit_c) lstat=eventbuf[3]; port=&sc->ports[pnum]; - bc=port->brdchan; tp=&sc->ttys[pnum]; if(pnum>=sc->numports || port->status==DISABLED) { printf("dgb%d: port %d: got event on nonexisting port\n",unit,pnum); } else if(port->used || port->wopeners>0 ) { + bc=port->brdchan; + if( !(event & ALL_IND) ) printf("dgb%d: port%d: ? event 0x%x mstat 0x%x lstat 0x%x\n", unit, pnum, event, mstat, lstat); @@ -1382,14 +1402,15 @@ dgbpoll(unit_c) #endif end_of_buffer: } + bc->idata=1; + } else { + bc=port->brdchan; DPRINT4("dgb%d: port %d: got event 0x%x on closed port\n", unit,pnum,event); bc->rout=bc->rin; bc->idata=bc->iempty=bc->ilow=0; } - - bc->idata=1; tail= (tail+4) & (FEP_IMAX-FEP_ISTART-4); } @@ -1935,6 +1956,8 @@ dgbstart(tp) ocount=q_to_b(&tp->t_outq, port->txptr+head, size); head+=ocount; + if(head>=port->txbufsize) + head-=port->txbufsize; setwin(sc,0); bc->tin=head; |