diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1994-05-25 09:21:21 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1994-05-25 09:21:21 +0000 |
commit | 2469c867a164210ce96143517059f21db7f1fd17 (patch) | |
tree | 9179427ac860211c445df663fd2b86267366bfba /sys/i386/isa | |
parent | cb0aba89af15a48e2655e898a503946ac4cb42ae (diff) | |
download | FreeBSD-src-2469c867a164210ce96143517059f21db7f1fd17.zip FreeBSD-src-2469c867a164210ce96143517059f21db7f1fd17.tar.gz |
The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.
Reviewed by: Rodney W. Grimes
Submitted by: John Dyson and David Greenman
Diffstat (limited to 'sys/i386/isa')
-rw-r--r-- | sys/i386/isa/aha1542.c | 20 | ||||
-rw-r--r-- | sys/i386/isa/aha1742.c | 10 | ||||
-rw-r--r-- | sys/i386/isa/bt742a.c | 4 | ||||
-rw-r--r-- | sys/i386/isa/clock.c | 40 | ||||
-rw-r--r-- | sys/i386/isa/fd.c | 34 | ||||
-rw-r--r-- | sys/i386/isa/ft.c | 4 | ||||
-rw-r--r-- | sys/i386/isa/icu.s | 12 | ||||
-rw-r--r-- | sys/i386/isa/if_ed.c | 17 | ||||
-rw-r--r-- | sys/i386/isa/if_ep.c | 5 | ||||
-rw-r--r-- | sys/i386/isa/if_ie.c | 3 | ||||
-rw-r--r-- | sys/i386/isa/isa.c | 1 | ||||
-rw-r--r-- | sys/i386/isa/mcd.c | 2 | ||||
-rw-r--r-- | sys/i386/isa/mse.c | 10 | ||||
-rw-r--r-- | sys/i386/isa/npx.c | 2 | ||||
-rw-r--r-- | sys/i386/isa/sio.c | 81 | ||||
-rw-r--r-- | sys/i386/isa/sound/os.h | 2 | ||||
-rw-r--r-- | sys/i386/isa/syscons.c | 41 | ||||
-rw-r--r-- | sys/i386/isa/ultra14f.c | 4 | ||||
-rw-r--r-- | sys/i386/isa/wd.c | 84 | ||||
-rw-r--r-- | sys/i386/isa/wt.c | 4 |
20 files changed, 191 insertions, 189 deletions
diff --git a/sys/i386/isa/aha1542.c b/sys/i386/isa/aha1542.c index 84c5e57..670f212 100644 --- a/sys/i386/isa/aha1542.c +++ b/sys/i386/isa/aha1542.c @@ -43,6 +43,10 @@ #define NAHA 1 #endif /*KERNEL */ +#ifndef NetBSD +typedef timeout_func_t timeout_t; +#endif + /************************** board definitions *******************************/ /* @@ -310,7 +314,7 @@ void aha_done(); int ahaattach(); int ahaintr(); int32 aha_scsi_cmd(); -void aha_timeout(caddr_t, int); +void aha_timeout(caddr_t); void ahaminphys(); u_int32 aha_adapter_info(); @@ -684,7 +688,7 @@ ahaintr(unit) #endif /*AHADEBUG */ } if (ccb) { - untimeout(aha_timeout, (caddr_t)ccb); + untimeout((timeout_t)aha_timeout, (caddr_t)ccb); aha_done(unit, ccb); } aha->aha_mbx.mbi[i].stat = AHA_MBI_FREE; @@ -1213,7 +1217,7 @@ aha_scsi_cmd(xs) bcopy(xs->cmd, &ccb->scsi_cmd, ccb->scsi_cmd_length); if (!(flags & SCSI_NOMASK)) { s = splbio(); /* stop instant timeouts */ - timeout(aha_timeout, (caddr_t)ccb, (xs->timeout * hz) / 1000); + timeout((timeout_t)aha_timeout, (caddr_t)ccb, (xs->timeout * hz) / 1000); aha_startmbx(ccb->mbx); /* * Usually return SUCCESSFULLY QUEUED @@ -1268,13 +1272,13 @@ aha_poll(unit, xs, ccb) * clock is not running yet by taking out the * clock queue entry it makes */ - aha_timeout((caddr_t)ccb, 0); + aha_timeout((caddr_t)ccb); /* * because we are polling, * take out the timeout entry aha_timeout made */ - untimeout(aha_timeout, (caddr_t)ccb); + untimeout((timeout_t)aha_timeout, (caddr_t)ccb); count = 2000; while (count) { /* @@ -1296,7 +1300,7 @@ aha_poll(unit, xs, ccb) * Notice that this time there is no * clock queue entry to remove */ - aha_timeout((caddr_t)ccb, 0); + aha_timeout((caddr_t)ccb); } } if (xs->error) @@ -1432,7 +1436,7 @@ aha_bus_speed_check(unit, speed) #endif /*TUNE_1542*/ void -aha_timeout(caddr_t arg1, int arg2) +aha_timeout(caddr_t arg1) { struct aha_ccb * ccb = (struct aha_ccb *)arg1; int unit; @@ -1468,7 +1472,7 @@ aha_timeout(caddr_t arg1, int arg2) printf("\n"); aha_abortmbx(ccb->mbx); /* 4 secs for the abort */ - timeout(aha_timeout, (caddr_t)ccb, 4 * hz); + timeout((timeout_t)aha_timeout, (caddr_t)ccb, 4 * hz); ccb->flags = CCB_ABORTED; } splx(s); } diff --git a/sys/i386/isa/aha1742.c b/sys/i386/isa/aha1742.c index 95c0aed..27bce5f 100644 --- a/sys/i386/isa/aha1742.c +++ b/sys/i386/isa/aha1742.c @@ -274,7 +274,7 @@ int ahb_attach(); int ahb_init __P((int unit)); int ahbintr(); int32 ahb_scsi_cmd(); -void ahb_timeout(caddr_t, int); +void ahb_timeout(caddr_t); void ahb_done(); struct ecb *cheat; void ahb_free_ecb(); @@ -993,7 +993,7 @@ ahb_scsi_cmd(xs) if (!(flags & SCSI_NOMASK)) { s = splbio(); ahb_send_immed(unit, xs->sc_link->target, AHB_TARG_RESET); - timeout(ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000); + timeout((timeout_t)ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000); splx(s); return (SUCCESSFULLY_QUEUED); } else { @@ -1122,7 +1122,7 @@ ahb_scsi_cmd(xs) if (!(flags & SCSI_NOMASK)) { s = splbio(); ahb_send_mbox(unit, OP_START_ECB, xs->sc_link->target, ecb); - timeout(ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000); + timeout((timeout_t)ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000); splx(s); SC_DEBUG(xs->sc_link, SDEV_DB3, ("cmd_sent\n")); return (SUCCESSFULLY_QUEUED); @@ -1152,7 +1152,7 @@ ahb_scsi_cmd(xs) } void -ahb_timeout(caddr_t arg1, int arg2) +ahb_timeout(caddr_t arg1) { struct ecb * ecb = (struct ecb *)arg1; int unit; @@ -1199,7 +1199,7 @@ ahb_timeout(caddr_t arg1, int arg2) printf("\n"); ahb_send_mbox(unit, OP_ABORT_ECB, ecb->xs->sc_link->target, ecb); /* 2 secs for the abort */ - timeout(ahb_timeout, (caddr_t)ecb, 2 * hz); + timeout((timeout_t)ahb_timeout, (caddr_t)ecb, 2 * hz); ecb->flags = ECB_ABORTED; } splx(s); diff --git a/sys/i386/isa/bt742a.c b/sys/i386/isa/bt742a.c index ac24e81..58b53f9 100644 --- a/sys/i386/isa/bt742a.c +++ b/sys/i386/isa/bt742a.c @@ -342,7 +342,7 @@ int btprobe(); int btattach(); int btintr(); int32 bt_scsi_cmd(); -void bt_timeout(caddr_t, int); +void bt_timeout(caddr_t); void bt_inquire_setup_information(); void bt_done(); void btminphys(); @@ -1440,7 +1440,7 @@ bt_poll(unit, xs, ccb) } void -bt_timeout(caddr_t arg1, int arg2) +bt_timeout(caddr_t arg1) { struct bt_ccb * ccb = (struct bt_ccb *)arg1; int unit; diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index d338cd5..e40079a 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -50,6 +50,7 @@ #include "i386/isa/isa.h" #include "i386/isa/rtc.h" #include "i386/isa/timerreg.h" +#include <machine/cpu.h> /* X-tals being what they are, it's nice to be able to fudge this one... */ /* Note, the name changed here from XTALSPEED to TIMER_FREQ rgrimes 4/26/93 */ @@ -71,15 +72,23 @@ static u_int hardclock_divisor; void -timerintr(struct intrframe frame) +clkintr(frame) + struct clockframe frame; { - timer_func(frame); + hardclock(&frame); +} + +#if 0 +void +timerintr(struct clockframe frame) +{ + timer_func(&frame); switch (timer0_state) { case 0: break; case 1: if ((timer0_prescale+=timer0_divisor) >= hardclock_divisor) { - hardclock(frame); + hardclock(&frame); timer0_prescale = 0; } break; @@ -96,7 +105,7 @@ timerintr(struct intrframe frame) break; case 3: if ((timer0_prescale+=timer0_divisor) >= hardclock_divisor) { - hardclock(frame); + hardclock(&frame); disable_intr(); outb(TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT); outb(TIMER_CNTR0, TIMER_DIV(hz)%256); @@ -111,6 +120,7 @@ timerintr(struct intrframe frame) } } +#endif int acquire_timer0(int rate, void (*function)() ) @@ -395,16 +405,6 @@ test_inittodr(time_t base) } #endif - -/* - * Restart the clock. - */ -void -resettodr() -{ -} - - /* * Wire clock interrupt in. */ @@ -428,3 +428,15 @@ spinwait(int millisecs) { DELAY(1000 * millisecs); } + +void +cpu_initclocks() +{ + startrtclock(); + enablertclock(); +} + +void +setstatclockrate(int newhz) +{ +} diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c index d05c361..259d451 100644 --- a/sys/i386/isa/fd.c +++ b/sys/i386/isa/fd.c @@ -199,7 +199,7 @@ int fd_debug = 1; static void fdstart(fdcu_t); void fdintr(fdcu_t); -static void fd_turnoff(caddr_t, int); +static void fd_turnoff(caddr_t); /****************************************************************************/ /* autoconfiguration stuff */ @@ -347,7 +347,7 @@ fdattach(dev) break; } - fd_turnoff((caddr_t)fdu, 0); + fd_turnoff((caddr_t)fdu); hdr = 1; } printf("\n"); @@ -417,7 +417,7 @@ void fdstrategy(struct buf *bp) dp = &(fdc->head); s = splbio(); disksort(dp, bp); - untimeout(fd_turnoff, (caddr_t)fdu); /* a good idea */ + untimeout((timeout_func_t)fd_turnoff, (caddr_t)fdu); /* a good idea */ fdstart(fdcu); splx(s); return; @@ -463,7 +463,7 @@ set_motor(fdcu, fdu, reset) } static void -fd_turnoff(caddr_t arg1, int arg2) +fd_turnoff(caddr_t arg1) { fdu_t fdu = (fdu_t)arg1; int s; @@ -476,7 +476,7 @@ fd_turnoff(caddr_t arg1, int arg2) } void -fd_motor_on(caddr_t arg1, int arg2) +fd_motor_on(caddr_t arg1) { fdu_t fdu = (fdu_t)arg1; int s; @@ -502,7 +502,7 @@ fd_turnon(fdu) { fd_turnon1(fdu); fd->flags |= FD_MOTOR_WAIT; - timeout(fd_motor_on, (caddr_t)fdu, hz); /* in 1 sec its ok */ + timeout((timeout_func_t)fd_motor_on, (caddr_t)fdu, hz); /* in 1 sec its ok */ } } @@ -685,7 +685,7 @@ fdstart(fdcu) } static void -fd_timeout(caddr_t arg1, int arg2) +fd_timeout(caddr_t arg1) { fdcu_t fdcu = (fdcu_t)arg1; fdu_t fdu = fdc_data[fdcu].fdu; @@ -809,8 +809,8 @@ fdstate(fdcu, fdc) TRACE1("fd%d",fdu); TRACE1("[%s]",fdstates[fdc->state]); TRACE1("(0x%x)",fd->flags); - untimeout(fd_turnoff, (caddr_t)fdu); - timeout(fd_turnoff, (caddr_t)fdu, 4 * hz); + untimeout((timeout_func_t)fd_turnoff, (caddr_t)fdu); + timeout((timeout_func_t)fd_turnoff, (caddr_t)fdu, 4 * hz); switch (fdc->state) { case DEVIDLE: @@ -855,12 +855,12 @@ fdstate(fdcu, fdc) out_fdc(fdcu,bp->b_cylin * fd->ft->steptrac); fd->track = -2; fdc->state = SEEKWAIT; - timeout(fd_timeout, (caddr_t)fdcu, 2 * hz); + timeout((timeout_func_t)fd_timeout, (caddr_t)fdcu, 2 * hz); return(0); /* will return later */ case SEEKWAIT: - untimeout(fd_timeout, (caddr_t)fdcu); + untimeout((timeout_func_t)fd_timeout, (caddr_t)fdcu); /* allow heads to settle */ - timeout(fd_pseudointr, (caddr_t)fdcu, hz / 50); + timeout((timeout_func_t)fd_pseudointr, (caddr_t)fdcu, hz / 50); fdc->state = SEEKCOMPLETE; return(0); /* will return later */ break; @@ -925,10 +925,10 @@ fdstate(fdcu, fdc) out_fdc(fdcu,fd->ft->datalen); /* data length */ } fdc->state = IOCOMPLETE; - timeout(fd_timeout, (caddr_t)fdcu, 2 * hz); + timeout((timeout_func_t)fd_timeout, (caddr_t)fdcu, 2 * hz); return(0); /* will return later */ case IOCOMPLETE: /* IO DONE, post-analyze */ - untimeout(fd_timeout, (caddr_t)fdcu); + untimeout((timeout_func_t)fd_timeout, (caddr_t)fdcu); for(i=0;i<7;i++) { fdc->status[i] = in_fdc(fdcu); @@ -964,7 +964,7 @@ fdstate(fdcu, fdc) /* ALL DONE */ fd->skip = 0; bp->b_resid = 0; - dp->b_actf = bp->av_forw; + dp->b_actf = bp->b_actf; biodone(bp); fdc->fd = (fd_p) 0; fdc->fdu = -1; @@ -991,7 +991,7 @@ fdstate(fdcu, fdc) return(0); /* will return later */ case RECALWAIT: /* allow heads to settle */ - timeout(fd_pseudointr, (caddr_t)fdcu, hz / 30); + timeout((timeout_func_t)fd_pseudointr, (caddr_t)fdcu, hz / 30); fdc->state = RECALCOMPLETE; return(0); /* will return later */ case RECALCOMPLETE: @@ -1079,7 +1079,7 @@ retrier(fdcu) bp->b_flags |= B_ERROR; bp->b_error = EIO; bp->b_resid = bp->b_bcount - fdc->fd->skip; - dp->b_actf = bp->av_forw; + dp->b_actf = bp->b_actf; fdc->fd->skip = 0; biodone(bp); fdc->state = FINDWORK; diff --git a/sys/i386/isa/ft.c b/sys/i386/isa/ft.c index 4022b20..5f4f62c 100644 --- a/sys/i386/isa/ft.c +++ b/sys/i386/isa/ft.c @@ -261,7 +261,7 @@ void ftstrategy(struct buf *); int ftioctl(dev_t, int, caddr_t, int, struct proc *); int ftdump(dev_t); int ftsize(dev_t); -static void ft_timeout(caddr_t arg1, int arg2); +static void ft_timeout(caddr_t arg1); void async_cmd(ftu_t); void async_req(ftu_t, int); void async_read(ftu_t, int); @@ -1150,7 +1150,7 @@ huh_what: /* * Interrupt timeout routine. */ -static void ft_timeout(caddr_t arg1, int arg2) +static void ft_timeout(caddr_t arg1) { int s; ftu_t ftu = (ftu_t)arg1; diff --git a/sys/i386/isa/icu.s b/sys/i386/isa/icu.s index b8bf1a8..c713806 100644 --- a/sys/i386/isa/icu.s +++ b/sys/i386/isa/icu.s @@ -296,24 +296,18 @@ swi_clock: ALIGN_TEXT swi_net: MCOUNT -#if 0 - DONET(NETISR_RAW, _rawintr,netisr_raw) -#endif #ifdef INET + DONET(NETISR_ARP, _arpintr,netisr_ip) DONET(NETISR_IP, _ipintr,netisr_ip) #endif -#ifdef IMP - DONET(NETISR_IMP, _impintr,netisr_imp) -#endif #ifdef NS DONET(NETISR_NS, _nsintr,netisr_ns) #endif #ifdef ISO DONET(NETISR_ISO, _clnlintr,netisr_iso) #endif -#ifdef CCITT - DONET(NETISR_X25, _pkintr, 29) - DONET(NETISR_HDLC, _hdintr, 30) +#ifdef CCITT + DONET(NETISR_CCITT, _ccittintr, 29) #endif ret diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c index 84047e2..26e3ebd 100644 --- a/sys/i386/isa/if_ed.c +++ b/sys/i386/isa/if_ed.c @@ -63,7 +63,7 @@ /* For backwards compatibility */ #ifndef IFF_ALTPHYS -#define IFF_ALTPHYS IFF_LLC0 +#define IFF_ALTPHYS IFF_LINK0 #endif /* @@ -113,7 +113,7 @@ void edintr(int); int ed_ioctl(struct ifnet *, int, caddr_t); int ed_probe(struct isa_device *); void ed_start(struct ifnet *); -void ed_reset(int, int); +void ed_reset(int); void ed_watchdog(int); static void ed_get_packet(struct ed_softc *, char *, int /*u_short*/); @@ -1090,9 +1090,8 @@ ed_attach(isa_dev) * Reset interface. */ void -ed_reset(unit, uban) +ed_reset(unit) int unit; - int uban; /* XXX */ { int s; @@ -1147,7 +1146,7 @@ ed_watchdog(unit) log(LOG_ERR, "ed%d: device timeout\n", unit); ++sc->arpcom.ac_if.if_oerrors; - ed_reset(unit, 0); + ed_reset(unit); } /* @@ -1501,7 +1500,7 @@ outloop: len = ed_pio_write_mbufs(sc, m, buffer); } - sc->txb_len[sc->txb_new] = MAX(len, ETHER_MIN_LEN); + sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN); sc->txb_inuse++; @@ -1652,7 +1651,7 @@ ed_rint(unit) "ed%d: NIC memory corrupt - invalid packet length %d\n", unit, len); ++sc->arpcom.ac_if.if_ierrors; - ed_reset(unit, 0); + ed_reset(unit); return; } @@ -1817,7 +1816,7 @@ edintr(unit) /* * Stop/reset/re-init NIC */ - ed_reset(unit, 0); + ed_reset(unit); } else { /* @@ -2388,7 +2387,7 @@ ed_pio_write_mbufs(sc,m,dst) if (!maxwait) { log(LOG_WARNING, "ed%d: remote transmit DMA failed to complete\n", sc->arpcom.ac_if.if_unit); - ed_reset(sc->arpcom.ac_if.if_unit, 0); + ed_reset(sc->arpcom.ac_if.if_unit); } return(len); diff --git a/sys/i386/isa/if_ep.c b/sys/i386/isa/if_ep.c index e8d3112..b47f829 100644 --- a/sys/i386/isa/if_ep.c +++ b/sys/i386/isa/if_ep.c @@ -99,7 +99,7 @@ static int epioctl __P((struct ifnet * ifp, int, caddr_t)); void epinit __P((int)); void epintr __P((int)); -void epmbuffill __P((caddr_t, int)); +void epmbuffill __P((caddr_t)); void epmbufempty __P((struct ep_softc *)); void epread __P((struct ep_softc *)); void epreset __P((int)); @@ -953,9 +953,8 @@ is_eeprom_busy(is) } void -epmbuffill(sp, dummy_arg) +epmbuffill(sp) caddr_t sp; - int dummy_arg; { struct ep_softc *sc = (struct ep_softc *)sp; int s, i; diff --git a/sys/i386/isa/if_ie.c b/sys/i386/isa/if_ie.c index 95095bd..cb6b96a 100644 --- a/sys/i386/isa/if_ie.c +++ b/sys/i386/isa/if_ie.c @@ -1320,9 +1320,8 @@ iereset(unit, dummy) * This is called if we time out. */ static void -chan_attn_timeout(rock, arg2) +chan_attn_timeout(rock) caddr_t rock; - int arg2; { *(int *)rock = 1; } diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c index b0d84ef..32e59e7 100644 --- a/sys/i386/isa/isa.c +++ b/sys/i386/isa/isa.c @@ -59,6 +59,7 @@ #include "rlist.h" #include "machine/segments.h" #include "vm/vm.h" +#include <machine/spl.h> #include "i386/isa/isa_device.h" #include "i386/isa/isa.h" #include "i386/isa/icu.h" diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c index 7309f42..683b0e1 100644 --- a/sys/i386/isa/mcd.c +++ b/sys/i386/isa/mcd.c @@ -387,7 +387,7 @@ static void mcd_start(int unit) if ((bp = qp->b_actf) != 0) { /* block found to process, dequeue */ /*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/ - qp->b_actf = bp->av_forw; + qp->b_actf = bp->b_actf; splx(s); } else { /* nothing to do */ diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index eebe163..5f80b21 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/mse.c @@ -71,7 +71,7 @@ struct isa_driver msedriver = { struct mse_softc { int sc_flags; int sc_mousetype; - pid_t sc_selp; + struct selinfo sc_selp; u_int sc_port; void (*sc_enablemouse)(); void (*sc_disablemouse)(); @@ -316,7 +316,7 @@ mseselect(dev, rw, p) * Since this is an exclusive open device, any previous proc. * pointer is trash now, so we can just assign it. */ - sc->sc_selp = p->p_pid; + selrecord(p, &sc->sc_selp); splx(s); return (0); } @@ -350,11 +350,7 @@ mseintr(unit) sc->sc_flags &= ~MSESC_WANT; wakeup((caddr_t)sc); } - if (sc->sc_selp) { - p = sc->sc_selp; - sc->sc_selp = (pid_t)0; - selwakeup(p, 0); - } + selwakeup(&sc->sc_selp); } } diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 00424bf..17400bd 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -438,7 +438,7 @@ npxintr(frame) * in doreti, and the frame for that could easily be set up * just before it is used). */ - curproc->p_regs = (int *)&frame.if_es; + curproc->p_md.md_regs = (int *)&frame.if_es; #ifdef notyet /* * Encode the appropriate code for detailed information on diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index ad09f7a3..9bdb8c4 100644 --- a/sys/i386/isa/sio.c +++ b/sys/i386/isa/sio.c @@ -36,6 +36,7 @@ #include "sio.h" #if NSIO > 0 +#define DONT_MALLOC_TTYS /* * Serial driver, based on 386BSD-0.1 com driver. * Mostly rewritten to use pseudo-DMA. @@ -61,9 +62,11 @@ #define FAKE_DCD(unit) ((unit) == comconsole) #define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */ +#define RBSZ 1024 #define RB_I_HIGH_WATER (RBSZ - 2 * RS_IBUFSIZE) #define RB_I_LOW_WATER ((RBSZ - 2 * RS_IBUFSIZE) * 7 / 8) #define RS_IBUFSIZE 256 +#define RS_OBUFSIZE 256 #define TTY_BI TTY_FE /* XXX */ #define TTY_OE TTY_PE /* XXX */ @@ -221,39 +224,39 @@ struct com_s { #define CE_INPUT_OFFSET RS_IBUFSIZE u_char ibuf1[2 * RS_IBUFSIZE]; u_char ibuf2[2 * RS_IBUFSIZE]; + u_char obuf[RS_OBUFSIZE]; }; /* * The public functions in the com module ought to be declared in a com-driver * system header. */ -#define Dev_t int /* promoted dev_t */ /* Interrupt handling entry points. */ void siointr __P((int unit)); void siopoll __P((void)); /* Device switch entry points. */ -int sioopen __P((Dev_t dev, int oflags, int devtype, +int sioopen __P((dev_t dev, int oflags, int devtype, struct proc *p)); -int sioclose __P((Dev_t dev, int fflag, int devtype, +int sioclose __P((dev_t dev, int fflag, int devtype, struct proc *p)); -int sioread __P((Dev_t dev, struct uio *uio, int ioflag)); -int siowrite __P((Dev_t dev, struct uio *uio, int ioflag)); -int sioioctl __P((Dev_t dev, int cmd, caddr_t data, +int sioread __P((dev_t dev, struct uio *uio, int ioflag)); +int siowrite __P((dev_t dev, struct uio *uio, int ioflag)); +int sioioctl __P((dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)); void siostop __P((struct tty *tp, int rw)); #define sioreset noreset -int sioselect __P((Dev_t dev, int rw, struct proc *p)); +int sioselect __P((dev_t dev, int rw, struct proc *p)); #define siommap nommap #define siostrategy nostrategy /* Console device entry points. */ -int siocngetc __P((Dev_t dev)); +int siocngetc __P((dev_t dev)); struct consdev; void siocninit __P((struct consdev *cp)); void siocnprobe __P((struct consdev *cp)); -void siocnputc __P((Dev_t dev, int c)); +void siocnputc __P((dev_t dev, int c)); static int sioattach __P((struct isa_device *dev)); static void comflush __P((struct com_s *com)); @@ -288,15 +291,9 @@ static int comconsole = -1; static speed_t comdefaultrate = TTYDEF_SPEED; static u_int com_events; /* input chars + weighted output completions */ static int commajor; -#ifdef DONT_MALLOC_TTYS -#define TB_OUT(tp) (&(tp)->t_out) -#define TB_RAW(tp) (&(tp)->t_raw) +#define TB_OUT(tp) (&(tp)->t_outq) +#define TB_RAW(tp) (&(tp)->t_rawq) struct tty sio_tty[NSIO]; -#else -#define TB_OUT(tp) ((tp)->t_out) -#define TB_RAW(tp) ((tp)->t_raw) -struct tty *sio_tty[NSIO]; -#endif extern struct tty *constty; extern int tk_nin; /* XXX */ extern int tk_rawcc; /* XXX */ @@ -787,7 +784,7 @@ bidir_open_top: } out: if (error == 0) - error = (*linesw[tp->t_line].l_open)(dev, tp, 0); + error = (*linesw[tp->t_line].l_open)(dev, tp); splx(s); #ifdef COM_BIDIR @@ -1129,7 +1126,7 @@ sioioctl(dev, cmd, data, flag, p) com = com_addr(UNIT(dev)); tp = com->tp; - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); if (error >= 0) return (error); error = ttioctl(tp, cmd, data, flag); @@ -1222,6 +1219,7 @@ sioioctl(dev, cmd, data, flag, p) *(int *)data = com->bidir; break; #endif /* COM_BIDIR */ +#if 0 case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ error = suser(p->p_ucred, &p->p_acflag); @@ -1240,6 +1238,7 @@ sioioctl(dev, cmd, data, flag, p) case TIOCMGDTRWAIT: *(int *)data = com->dtr_wait; break; +#endif #ifdef TIOCTIMESTAMP case TIOCTIMESTAMP: com->do_timestamp = TRUE; @@ -1259,16 +1258,14 @@ static void comflush(com) struct com_s *com; { - struct ringb *rbp; + struct clist *rbp; disable_intr(); if (com->state & CS_ODONE) com_events -= LOTS_OF_EVENTS; com->state &= ~(CS_ODONE | CS_BUSY); enable_intr(); - rbp = TB_OUT(com->tp); - rbp->rb_hd += com->ocount; - rbp->rb_hd = RB_ROLLOVER(rbp, rbp->rb_hd); + while( getc( TB_OUT(com->tp)) != -1); com->ocount = 0; com->tp->t_state &= ~TS_BUSY; } @@ -1343,8 +1340,8 @@ repeat: * CS_RTS_IFLOW is on. */ if ((com->state & CS_RTS_IFLOW) - && !(com->mcr_image & MCR_RTS) - && !(tp->t_state & TS_RTS_IFLOW)) + && !(com->mcr_image & MCR_RTS) /* + && !(tp->t_state & TS_RTS_IFLOW) */) outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); enable_intr(); @@ -1404,16 +1401,17 @@ repeat: if (incc <= 0 || !(tp->t_state & TS_ISOPEN)) continue; if (com->state & CS_RTS_IFLOW - && RB_LEN(TB_RAW(tp)) + incc >= RB_I_HIGH_WATER - && !(tp->t_state & TS_RTS_IFLOW) + && TB_RAW(tp)->c_cc + incc >= RB_I_HIGH_WATER /* + && !(tp->t_state & TS_RTS_IFLOW) */ /* * XXX - need RTS flow control for all line disciplines. * Only have it in standard one now. */ && linesw[tp->t_line].l_rint == ttyinput) { - tp->t_state |= TS_RTS_IFLOW; +/* tp->t_state |= TS_RTS_IFLOW; */ ttstart(tp); } +#if 0 /* * Avoid the grotesquely inefficient lineswitch routine * (ttyinput) in "raw" mode. It usually takes about 450 @@ -1442,6 +1440,7 @@ repeat: ttstart(tp); } } else { +#endif do { u_char line_status; int recv_data; @@ -1461,7 +1460,9 @@ repeat: } (*linesw[tp->t_line].l_rint)(recv_data, tp); } while (--incc > 0); +#if 0 } +#endif if (com_events == 0) break; } @@ -1624,10 +1625,12 @@ comstart(tp) com->state &= ~CS_TTGO; else com->state |= CS_TTGO; +#if 0 if (tp->t_state & TS_RTS_IFLOW) { if (com->mcr_image & MCR_RTS && com->state & CS_RTS_IFLOW) outb(com->modem_ctl_port, com->mcr_image &= ~MCR_RTS); } else { +#endif /* * XXX don't raise MCR_RTS if CTS_RTS_IFLOW is off. Set it * appropriately in comparam() if RTS-flow is being changed. @@ -1635,31 +1638,29 @@ comstart(tp) */ if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater) outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); +#if 0 } +#endif enable_intr(); if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) goto out; - if (RB_LEN(TB_OUT(tp)) <= tp->t_lowat) { + if (TB_OUT(tp)->c_cc <= tp->t_lowat) { if (tp->t_state & TS_ASLEEP) { tp->t_state &= ~TS_ASLEEP; wakeup((caddr_t)TB_OUT(tp)); } - if (tp->t_wsel) { - selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL); - tp->t_wsel = 0; - tp->t_state &= ~TS_WCOLL; - } + selwakeup(&tp->t_wsel); } if (com->ocount != 0) { disable_intr(); siointr1(com); enable_intr(); - } else if (RB_LEN(TB_OUT(tp)) != 0) { + } else if (TB_OUT(tp)->c_cc != 0) { tp->t_state |= TS_BUSY; - com->ocount = RB_CONTIGGET(TB_OUT(tp)); disable_intr(); - com->obufend = (com->optr = (u_char *)TB_OUT(tp)->rb_hd) - + com->ocount; + com->ocount = q_to_b(TB_OUT(tp), com->obuf, sizeof com->obuf); + com->optr = com->obuf; + com->obufend = com->obuf + com->ocount; com->state |= CS_BUSY; siointr1(com); /* fake interrupt to start output */ enable_intr(); @@ -1728,11 +1729,11 @@ comwakeup(chan, ticks) { int unit; - timeout(comwakeup, (caddr_t) NULL, hz / 100); + timeout((timeout_func_t)comwakeup, (caddr_t) NULL, hz / 100); if (com_events != 0) { #ifndef OLD_INTERRUPT_HANDLING - int s = splsofttty(); + int s = spltty(); #endif siopoll(); #ifndef OLD_INTERRUPT_HANDLING diff --git a/sys/i386/isa/sound/os.h b/sys/i386/isa/sound/os.h index c6b688a..fea169b 100644 --- a/sys/i386/isa/sound/os.h +++ b/sys/i386/isa/sound/os.h @@ -186,7 +186,7 @@ struct snd_wait { * 1 or 0 could be returned (1 should be better than 0). * I'm not sure if the following is correct for FreeBSD. */ -#define PROCESS_ABORTING(q, f) (f.aborting | curproc->p_sig) +#define PROCESS_ABORTING(q, f) (f.aborting | curproc->p_siglist) /* * The following macro calls sleep. It should be implemented such that diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index 8757295..39292f9 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -44,6 +44,7 @@ #endif #include "param.h" +#include <sys/systm.h> #include "conf.h" #include "ioctl.h" #include "proc.h" @@ -51,7 +52,6 @@ #include "tty.h" #include "uio.h" #include "callout.h" -#include "systm.h" #include "kernel.h" #include "syslog.h" #include "errno.h" @@ -277,14 +277,20 @@ int ttrstrt(); #endif #if defined(__FreeBSD__) +#if 0 #define VIRTUAL_TTY(x) (pccons[x] = ttymalloc(pccons[x])) #define CONSOLE_TTY (pccons[NCONS] = ttymalloc(pccons[NCONS])) +struct tty *pccons[NCONS+1]; +#else +#define VIRTUAL_TTY(x) &pccons[x] +#define CONSOLE_TTY &pccons[NCONS] +struct tty pccons[NCONS+1]; +#endif +#define timeout_t timeout_func_t #define frametype struct trapframe #define eflags tf_eflags -#define timeout_t timeout_func_t #define MONO_BUF (KERNBASE+0xB0000) #define CGA_BUF (KERNBASE+0xB8000) -struct tty *pccons[NCONS+1]; #endif #if defined(__386BSD__) && !defined(__FreeBSD__) @@ -456,11 +462,7 @@ int pcopen(dev_t dev, int flag, int mode, struct proc *p) return(EBUSY); tp->t_state |= TS_CARR_ON; tp->t_cflag |= CLOCAL; -#if defined(__FreeBSD__) - return((*linesw[tp->t_line].l_open)(dev, tp, 0)); -#else return((*linesw[tp->t_line].l_open)(dev, tp)); -#endif } @@ -744,12 +746,12 @@ int pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) return 0; case KDENABIO: /* allow io operations */ - fp = (frametype *)p->p_regs; + fp = (frametype *)p->p_md.md_regs; fp->eflags |= PSL_IOPL; return 0; case KDDISABIO: /* disallow io operations (default) */ - fp = (frametype *)p->p_regs; + fp = (frametype *)p->p_md.md_regs; fp->eflags &= ~PSL_IOPL; return 0; @@ -960,7 +962,7 @@ int pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) if (saved_console < 0) { saved_console = get_scr_num(); switch_scr(minor(dev)); - fp = (frametype *)p->p_regs; + fp = (frametype *)p->p_md.md_regs; fp->eflags |= PSL_IOPL; scp->status |= UNKNOWN_MODE; scp->status |= KBD_RAW_MODE; @@ -969,7 +971,7 @@ int pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) return EAGAIN; case CONSOLE_X_MODE_OFF:/* just to be compatible */ - fp = (frametype *)p->p_regs; + fp = (frametype *)p->p_md.md_regs; fp->eflags &= ~PSL_IOPL; if (crtc_vga) { load_font(0, 16, font_8x16); @@ -1002,7 +1004,7 @@ int pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) break; } - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); if (error >= 0) return(error); error = ttioctl(tp, cmd, data, flag); @@ -1028,7 +1030,7 @@ void pcxint(dev_t dev) void pcstart(struct tty *tp) { -#if defined(NetBSD) +#if defined(NetBSD) || defined(__FreeBSD__) struct clist *rbp; int i, s, len; u_char buf[PCBURST]; @@ -1046,10 +1048,6 @@ void pcstart(struct tty *tp) if (buf[i]) ansi_put(scp, buf[i]); s = spltty(); tp->t_state &= ~TS_BUSY; - if (rbp->c_cc) { - tp->t_state |= TS_TIMEOUT; - timeout((timeout_t)ttrstrt, (caddr_t)tp, 1); - } if (rbp->c_cc <= tp->t_lowat) { if (tp->t_state & TS_ASLEEP) { tp->t_state &= ~TS_ASLEEP; @@ -1060,7 +1058,7 @@ void pcstart(struct tty *tp) } splx(s); -#else /* __FreeBSD__ & __386BSD__ */ +#else /* __386BSD__ */ int c, s, len, i; scr_stat *scp = get_scr_stat(tp->t_dev); @@ -1076,12 +1074,7 @@ void pcstart(struct tty *tp) tp->t_state &= ~TS_ASLEEP; wakeup((caddr_t)tp->t_out); } - if (tp->t_wsel) { - selwakeup(tp->t_wsel, - tp->t_state & TS_WCOLL); - tp->t_wsel = 0; - tp->t_state &= ~TS_WCOLL; - } + selwakeup(&tp->t_wsel); } if (RB_LEN(tp->t_out) == 0) break; diff --git a/sys/i386/isa/ultra14f.c b/sys/i386/isa/ultra14f.c index c184904..b901744 100644 --- a/sys/i386/isa/ultra14f.c +++ b/sys/i386/isa/ultra14f.c @@ -238,7 +238,7 @@ int uhaprobe(); int uha_attach(); int uhaintr(); int32 uha_scsi_cmd(); -void uha_timeout(caddr_t, int); +void uha_timeout(caddr_t); void uha_free_mscp(); int uha_abort(); void uhaminphys(); @@ -1077,7 +1077,7 @@ uha_scsi_cmd(xs) } void -uha_timeout(caddr_t arg1, int arg2) +uha_timeout(caddr_t arg1) { struct mscp *mscp = (struct mscp *)arg1; int unit; diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index b8cf448..2794ecd 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -176,7 +176,7 @@ static void wderror(struct buf *bp, struct disk *du, char *mesg); static void wdflushirq(struct disk *du, int old_ipl); static int wdreset(struct disk *du); static void wdsleep(int ctrlr, char *wmesg); -static void wdtimeout(caddr_t cdu, int ticks); +static void wdtimeout(caddr_t cdu); static int wdunwedge(struct disk *du); static int wdwait(struct disk *du, u_char bits_wanted, int timeout); @@ -184,6 +184,8 @@ struct isa_driver wdcdriver = { wdprobe, wdattach, "wdc", }; +extern char *readdisklabel(); + /* * Probe for controller. */ @@ -321,7 +323,7 @@ wdattach(struct isa_device *dvp) * Start timeout routine for this drive. * XXX timeout should be per controller. */ - wdtimeout((caddr_t)du, 0); + wdtimeout((caddr_t)du); } else { free(du, M_TEMP); wddrives[lunit] = NULL; @@ -397,7 +399,8 @@ wdstrategy(register struct buf *bp) dp = &wdutab[lunit]; s = splbio(); - cldisksort(dp, bp, 254*DEV_BSIZE); + /* cldisksort(dp, bp, 254*DEV_BSIZE); */ + disksort(dp, bp); if (dp->b_active == 0) wdustart(du); /* start drive */ @@ -440,13 +443,15 @@ wdustart(register struct disk *du) if (bp == NULL) return; + dp->b_actf = bp->b_actf; + bp->b_actf = NULL; /* link onto controller queue */ - dp->b_forw = NULL; - if (wdtab[ctrlr].b_actf == NULL) - wdtab[ctrlr].b_actf = dp; - else - wdtab[ctrlr].b_actl->b_forw = dp; - wdtab[ctrlr].b_actl = dp; + if (wdtab[ctrlr].b_actf == NULL) { + wdtab[ctrlr].b_actf = bp; + } else { + *wdtab[ctrlr].b_actb = bp; + } + wdtab[ctrlr].b_actb = &bp->b_actf; /* mark the drive unit as busy */ dp->b_active = 1; @@ -474,20 +479,10 @@ wdstart(int ctrlr) loop: /* is there a drive for the controller to do a transfer with? */ - dp = wdtab[ctrlr].b_actf; - if (dp == NULL) + bp = wdtab[ctrlr].b_actf; + if (bp == NULL) return; - /* - * Is there a transfer to this drive? If so, link it on the - * controller's queue. - */ - bp = dp->b_actf; - if (bp == NULL) { - wdtab[ctrlr].b_actf = dp->b_forw; - goto loop; - } - /* obtain controller and drive information */ lunit = wdunit(bp->b_dev); du = wddrives[lunit]; @@ -671,9 +666,10 @@ wdintr(int unit) return; } - dp = wdtab[unit].b_actf; - bp = dp->b_actf; + bp = wdtab[unit].b_actf; du = wddrives[wdunit(bp->b_dev)]; + dp = &wdutab[du->dk_lunit]; + du->dk_timeout = 0; if (wdwait(du, 0, TIMEOUT) < 0) { @@ -783,13 +779,12 @@ outt: done: ; /* done with this transfer, with or without error */ du->dk_flags &= ~DKFL_SINGLE; - wdtab[unit].b_actf = dp->b_forw; + wdtab[unit].b_actf = bp->b_actf; wdtab[unit].b_errcnt = 0; bp->b_resid = bp->b_bcount - du->dk_skip * DEV_BSIZE; - du->dk_skip = 0; dp->b_active = 0; - dp->b_actf = bp->av_forw; dp->b_errcnt = 0; + du->dk_skip = 0; biodone(bp); } @@ -797,8 +792,7 @@ done: ; wdtab[unit].b_active = 0; /* anything more on drive queue? */ - if (dp->b_actf) - wdustart(du); + wdustart(du); /* anything more for controller to do? */ if (wdtab[unit].b_actf) wdstart(unit); @@ -871,11 +865,16 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) * to the driver by resetting the state machine. */ save_label = du->dk_dd; + du->dk_dd.d_partitions[WDRAW].p_offset = 0; + du->dk_dd.d_partitions[WDRAW].p_size = 0x7fffffff;/* XXX */ #define WDSTRATEGY ((int (*)(struct buf *)) wdstrategy) /* XXX */ msg = readdisklabel(makewddev(major(dev), lunit, WDRAW), - (d_strategy_t *) WDSTRATEGY, &du->dk_dd, - du->dk_dospartitions, &du->dk_bad, - (struct buf **)NULL); + WDSTRATEGY, &du->dk_dd, + du->dk_dospartitions, &du->dk_bad); +/* + msg = readdisklabel(makewddev(major(dev), lunit, WDRAW), + WDSTRATEGY, &du->dk_dd); +*/ du->dk_flags &= ~DKFL_LABELLING; if (msg != NULL) { du->dk_dd = save_label; @@ -1347,7 +1346,7 @@ wdioctl(dev_t dev, int cmd, caddr_t addr, int flag) du->dk_openpart |= (1 << 0); /* XXX */ wlab = du->dk_wlabel; du->dk_wlabel = 1; - error = writedisklabel(dev, (d_strategy_t *) WDSTRATEGY, + error = writedisklabel(dev, WDSTRATEGY, &du->dk_dd, du->dk_dospartitions); du->dk_openpart = du->dk_copenpart | du->dk_bopenpart; du->dk_wlabel = wlab; @@ -1406,19 +1405,24 @@ wdsize(dev_t dev) { int lunit = wdunit(dev), part = wdpart(dev), val; struct disk *du; + int size; - if (lunit >= NWD || wddospart(dev) || (du = wddrives[lunit]) == NULL) + if (lunit >= NWD || wddospart(dev) || (du = wddrives[lunit]) == NULL) { return (-1); + } val = 0; - if (du->dk_state == CLOSED) + if (du->dk_state == CLOSED) { val = wdopen(makewddev(major(dev), lunit, WDRAW), FREAD, S_IFBLK, 0); - if (val != 0 || du->dk_flags & DKFL_WRITEPROT) + } + if (val != 0 || du->dk_flags & DKFL_WRITEPROT) { return (-1); - return ((int)du->dk_dd.d_partitions[part].p_size); + } + size = ((int)du->dk_dd.d_partitions[part].p_size); + return size; } -extern char *vmmap; /* poor name! */ +extern char *ptvmmap; /* poor name! */ /* * Dump core after a system crash. @@ -1580,7 +1584,7 @@ out: return (EIO); } while (blkcnt != 0) { - pmap_enter(kernel_pmap, CADDR1, trunc_page(addr), + pmap_enter(kernel_pmap, (vm_offset_t)CADDR1, trunc_page(addr), VM_PROT_READ, TRUE); /* Ready to send data? */ @@ -1685,7 +1689,7 @@ wdsleep(int ctrlr, char *wmesg) } static void -wdtimeout(caddr_t cdu, int ticks) +wdtimeout(caddr_t cdu) { struct disk *du; int x; @@ -1700,7 +1704,7 @@ wdtimeout(caddr_t cdu, int ticks) du->dk_flags |= DKFL_SINGLE; wdstart(du->dk_ctrlr); } - timeout(wdtimeout, cdu, hz); + timeout((timeout_func_t)wdtimeout, cdu, hz); splx(x); } diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index 1e97553..5ed78a2 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -156,7 +156,7 @@ static int wtwait (wtinfo_t *t, int catch, char *msg); static int wtcmd (wtinfo_t *t, int cmd); static int wtstart (wtinfo_t *t, unsigned mode, void *vaddr, unsigned len); static void wtdma (wtinfo_t *t); -static void wtimer (caddr_t, int); +static void wtimer (caddr_t); static void wtclock (wtinfo_t *t); static int wtreset (wtinfo_t *t); static int wtsense (wtinfo_t *t, int verb, int ignor); @@ -782,7 +782,7 @@ static void wtclock (wtinfo_t *t) * This is necessary in case interrupts get eaten due to * multiple devices on a single IRQ line. */ -static void wtimer (caddr_t xt, int dummy) +static void wtimer (caddr_t xt) { wtinfo_t *t = (wtinfo_t *)xt; int s; |