summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authorrgrimes <rgrimes@FreeBSD.org>1994-05-25 09:21:21 +0000
committerrgrimes <rgrimes@FreeBSD.org>1994-05-25 09:21:21 +0000
commit2469c867a164210ce96143517059f21db7f1fd17 (patch)
tree9179427ac860211c445df663fd2b86267366bfba /sys/isa
parentcb0aba89af15a48e2655e898a503946ac4cb42ae (diff)
downloadFreeBSD-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/isa')
-rw-r--r--sys/isa/atrtc.c40
-rw-r--r--sys/isa/fd.c34
-rw-r--r--sys/isa/sio.c81
-rw-r--r--sys/isa/syscons.c41
4 files changed, 101 insertions, 95 deletions
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index d338cd5..e40079a 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.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/isa/fd.c b/sys/isa/fd.c
index d05c361..259d451 100644
--- a/sys/isa/fd.c
+++ b/sys/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/isa/sio.c b/sys/isa/sio.c
index ad09f7a3..9bdb8c4 100644
--- a/sys/isa/sio.c
+++ b/sys/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/isa/syscons.c b/sys/isa/syscons.c
index 8757295..39292f9 100644
--- a/sys/isa/syscons.c
+++ b/sys/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;
OpenPOWER on IntegriCloud