+/* $OpenBSD: pcvt_conf.h,v 1.3 1996/04/18 17:48:27 niklas Exp $ */
+
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
#endif
#ifdef NetBSD1_1
-#define PCVT_NETBSD 110
+#define PCVT_NETBSD (110 + (NetBSD1_1 - 1))
#endif
/*---------------------------------------------------------------------------
*
* options "PCVT_NSCREENS=x"
* options "PCVT_SCANSET=x"
- * options "PCVT_UPDATEFAST=x"
- * options "PCVT_UPDATESLOW=x"
* options "PCVT_SYSBEEPF=x"
*
* which are always numeric!
# define PCVT_BACKUP_FONTS 1
#endif
-#ifndef PCVT_UPDATEFAST /* this is the rate at which the cursor */
-# define PCVT_UPDATEFAST (hz/10) /* gets updated with it's new position */
-#endif /* see: async_update() in pcvt_sup.c */
-
-#ifndef PCVT_UPDATESLOW /* this is the rate at which the cursor */
-# define PCVT_UPDATESLOW 3 /* position display and the system load */
-#endif /* (or the keyboard scancode display) */
- /* is updated. the relation is: */
- /* PCVT_UPDATEFAST/PCVT_UPDATESLOW */
-
#ifndef PCVT_SYSBEEPF /* timer chip value to be used for the */
# define PCVT_SYSBEEPF 1193182 /* sysbeep frequency value. */
#endif /* this should really go somewhere else,*/
+/* $OpenBSD: pcvt_drv.c,v 1.9 1996/04/18 17:48:28 niklas Exp $ */
+
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
vs[i].vs_tty = &pccons[i];
#endif /* !PCVT_NETBSD && !(PCVT_FREEBSD > 110 && PCVT_FREEBSD < 200) */
- async_update(UPDATE_START); /* start asynchronous updates */
+ async_update();
#if PCVT_FREEBSD > 205
/* mark the device busy now if we are the console */
#if PCVT_NETBSD > 101
sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_TTY, pcintr,
(void *)0, sc->sc_dev.dv_xname);
+
+#if PCVT_NETBSD > 110
+ /*
+ * Look for children of the keyboard controller.
+ * XXX Really should decouple keyboard controller
+ * from the console code.
+ */
+ while (config_found(self, NULL, NULL))
+ /* will break when no more children */ ;
+#endif /* PVCT_NETBSD > 110 */
#else /* PCVT_NETBSD > 100 */
vthand.ih_fun = pcrint;
vthand.ih_arg = 0;
void
pcstart(register struct tty *tp)
{
- register struct clist *rbp;
int s, len;
u_char buf[PCVT_PCBURST];
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
goto out;
+ if (tp->t_outq.c_cc == 0 &&
+ tp->t_wsel.si_pid == 0)
+ {
+ async_update();
+ goto low;
+ }
+
tp->t_state |= TS_BUSY;
splx(s);
- async_update(UPDATE_KERN);
-
/*
* We need to do this outside spl since it could be fairly
* expensive and we don't want our serial ports to overflow.
*/
- rbp = &tp->t_outq;
-
- while (len = q_to_b(rbp, buf, PCVT_PCBURST))
+ while (len = q_to_b(&tp->t_outq, buf, PCVT_PCBURST))
sput(&buf[0], 0, len, minor(tp->t_dev));
s = spltty();
tp->t_state &= ~TS_BUSY;
- if (rbp->c_cc)
- {
- tp->t_state |= TS_TIMEOUT;
- timeout(ttrstrt, tp, 1);
- }
+ tp->t_state |= TS_TIMEOUT;
+ timeout(ttrstrt, tp, 1);
#if PCVT_FREEBSD >= 210 && !defined(TS_ASLEEP)
ttwakeup(tp);
#else
- if (rbp->c_cc <= tp->t_lowat)
+ if (tp->t_outq.c_cc <= tp->t_lowat)
{
+low:
if (tp->t_state&TS_ASLEEP)
{
tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)rbp);
+ wakeup((caddr_t)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
sput((char *) &c, 1, 1, 0);
- async_update(UPDATE_KERN);
+ async_update();
#if ((PCVT_NETBSD && (PCVT_NETBSD <= 101)) || \
(PCVT_FREEBSD && (PCVT_FREEBSD <= 205)))
s = spltty(); /* block pcrint while we poll */
cp = sgetc(0);
splx(s);
- async_update(UPDATE_KERN);
+ async_update();
#if ! (PCVT_FREEBSD >= 201)
/* this belongs to cons.c */
sput(">", 1, 1, 0);
- async_update(UPDATE_KERN);
+ async_update();
thechar = *(sgetc(0));
+/* $OpenBSD: pcvt_ext.c,v 1.3 1996/04/18 17:48:29 niklas Exp $ */
+
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
if((saved_scrnsv_tmo = scrnsv_timeout))
pcvt_set_scrnsv_tmo(0); /* screensaver off */
#endif /* PCVT_SCREENSAVER */
-
- async_update(UPDATE_STOP); /* status display off */
}
if(!oldgrafx)
outb(addr_6845, CRTC_CUREND); /* select low register */
outb(addr_6845+1, vsp->cursor_end);
}
-
- /* make status display happy */
- async_update(UPDATE_START);
}
if(!newgrafx)
if(suser(p->p_ucred, &p->p_acflag) != 0)
return (EPERM);
+#if (PCVT_NETBSD <= 100) || defined(COMPAT_10) || defined(COMPAT_11)
+ /* This is done by i386_iopl(3) now. */
#if PCVT_NETBSD || (PCVT_FREEBSD && PCVT_FREEBSD > 102)
fp->tf_eflags |= PSL_IOPL;
#else
fp->sf_eflags |= PSL_IOPL;
+#endif
#endif
return 0;
/* abandon IO access permission */
{
+#if (PCVT_NETBSD <= 100) || defined(COMPAT_10) || defined(COMPAT_11)
+ /* This is done by i386_iopl(3) now. */
#if PCVT_NETBSD > 9 || PCVT_FREEBSD >= 200
struct trapframe *fp = (struct trapframe *)p->p_md.md_regs;
fp->tf_eflags &= ~PSL_IOPL;
struct syscframe *fp = (struct syscframe *)p->p_regs;
fp->sf_eflags &= ~PSL_IOPL;
#endif
-
+#endif
return 0;
}
+/* $OpenBSD: pcvt_hdr.h,v 1.6 1996/04/18 17:48:31 niklas Exp $ */
+
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
#define SYS_FKL 0 /* in hp mode, sys-fkls are active */
#define USR_FKL 1 /* in hp mode, user-fkls are active */
-/* arguments to async_update() */
-
-#define UPDATE_START 0 /* do cursor update and requeue */
-#define UPDATE_STOP 1 /* suspend cursor updates */
-#define UPDATE_KERN 2 /* do cursor updates for kernel output */
-
/* variables */
#ifdef EXTERN
void vga_move_charset ( unsigned n, unsigned char *b, int save_it);
#endif /* XSERVER */
-void async_update ( int arg );
+void async_update ( void );
void clr_parms ( struct video_state *svsp );
void cons_highlight ( void );
void cons_normal ( void );
+/* $OpenBSD: pcvt_ioctl.h,v 1.3 1996/04/18 17:48:32 niklas Exp $ */
+
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
u_int opsysrel; /* Release */
u_int nscreens; /* PCVT_NSCREENS */
u_int scanset; /* PCVT_SCANSET */
- u_int updatefast; /* PCVT_UPDATEFAST */
- u_int updateslow; /* PCVT_UPDATESLOW */
u_int sysbeepf; /* PCVT_SYSBEEPF */
u_int pcburst; /* PCVT_PCBURST */
u_int kbd_fifo_sz; /* PCVT_KBD_FIFO_SZ */
+/* $OpenBSD: pcvt_kbd.c,v 1.4 1996/04/18 17:48:33 niklas Exp $ */
+
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
/*---------------------------------------------------------------------------*
* Pass command to keyboard controller (8042)
*---------------------------------------------------------------------------*/
+static inline int
+kbd_wait_output()
+{
+ u_int i;
+
+ for (i = 100000; i; i--)
+ if ((inb(CONTROLLER_CTRL) & STATUS_INPBF) == 0) {
+ PCVT_KBD_DELAY();
+ return 1;
+ }
+ return 0;
+}
+
+static inline int
+kbd_wait_input()
+{
+ u_int i;
+
+ for (i = 100000; i; i--)
+ if ((inb(CONTROLLER_CTRL) & STATUS_OUTPBF) != 0) {
+ PCVT_KBD_DELAY();
+ return 1;
+ }
+ return 0;
+}
+
static int
kbc_8042cmd(int val)
{
- unsigned timeo;
- timeo = 100000; /* > 100 msec */
- while (inb(CONTROLLER_CTRL) & STATUS_INPBF)
- if (--timeo == 0)
- return (-1);
+ if (!kbd_wait_output())
+ return (-1);
outb(CONTROLLER_CTRL, val);
+
return (0);
}
int
kbd_cmd(int val)
{
- unsigned timeo;
- timeo = 100000; /* > 100 msec */
- while (inb(CONTROLLER_CTRL) & STATUS_INPBF)
- if (--timeo == 0)
- return (-1);
+ if (!kbd_wait_output())
+ return (-1);
outb(CONTROLLER_DATA, val);
#if PCVT_SHOWKEYS
kbd_response(void)
{
u_char ch;
- unsigned timeo;
-
- timeo = 500000; /* > 500 msec (KEYB_R_SELFOK requires 87) */
- while (!(inb(CONTROLLER_CTRL) & STATUS_OUTPBF))
- if (--timeo == 0)
- return (-1);
- PCVT_KBD_DELAY(); /* 7 us delay */
+ if (!kbd_wait_input())
+ return (-1);
ch = inb(CONTROLLER_DATA);
#if PCVT_SHOWKEYS
#if PCVT_SCANSET > 1 /* switch only if we are running */
/* keyboard scancode 2 */
- int cmd, timeo = 10000;
+ int cmd;
#if PCVT_USEKBDSEC
cmd = COMMAND_SYSFLG | COMMAND_IRQEN;
cmd |= COMMAND_PCSCAN; /* yes, setup command */
kbc_8042cmd(CONTR_WRITE);
+ kbc_cmd(cmd);
- while (inb(CONTROLLER_CTRL) & STATUS_INPBF)
- {
- if (--timeo == 0)
- break;
- }
-
- outb(CONTROLLER_DATA, cmd);
-
#endif /* PCVT_SCANSET > 1 */
if(mode == K_RAW)
+/* $OpenBSD: pcvt_kbd.h,v 1.2 1996/04/18 17:48:35 niklas Exp $ */
+
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
/* 6*/ KBD_ASCII, I, {S,1,C "5"}, {S,1,C "%"}, {S,1,C "5"}, DFAULT, DFAULT, DFAULT, DFAULT,
/* 7*/ KBD_ASCII, I, {S,1,C "6"}, {S,1,C "^"}, {S,1,C "\036"}, DFAULT, DFAULT, DFAULT, DFAULT,
/* 8*/ KBD_ASCII, I, {S,1,C "7"}, {S,1,C "&"}, {S,1,C "7"}, DFAULT, DFAULT, DFAULT, DFAULT,
-/* 9*/ KBD_ASCII, I, {S,1,C "8"}, {S,1,C "*"}, {S,1,C "9"}, DFAULT, DFAULT, DFAULT, DFAULT,
+/* 9*/ KBD_ASCII, I, {S,1,C "8"}, {S,1,C "*"}, {S,1,C "8"}, DFAULT, DFAULT, DFAULT, DFAULT,
/* 10*/ KBD_ASCII, I, {S,1,C "9"}, {S,1,C "("}, {S,1,C "9"}, DFAULT, DFAULT, DFAULT, DFAULT,
/* 11*/ KBD_ASCII, I, {S,1,C "0"}, {S,1,C ")"}, {S,1,C "0"}, DFAULT, DFAULT, DFAULT, DFAULT,
/* 12*/ KBD_ASCII, I, {S,1,C "-"}, {S,1,C "_"}, {S,1,C "\037"}, DFAULT, DFAULT, DFAULT, DFAULT,
+/* $OpenBSD: pcvt_sup.c,v 1.2 1996/04/18 17:48:36 niklas Exp $ */
+
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
data->nscreens = PCVT_NSCREENS;
data->scanset = PCVT_SCANSET;
- data->updatefast= PCVT_UPDATEFAST;
- data->updateslow= PCVT_UPDATESLOW;
data->sysbeepf = PCVT_SYSBEEPF;
#if PCVT_NETBSD || PCVT_FREEBSD >= 200
*
* update asynchronous: cursor, cursor pos displ, sys load, keyb scan
*
- * arg is:
- * UPDATE_START = 0 = do update; requeue
- * UPDATE_STOP = 1 = suspend updates
- * UPDATE_KERN = 2 = do update for kernel printfs
- *
*---------------------------------------------------------------------------*/
void
-async_update(int arg)
+async_update()
{
+ static int lastadr = 0;
static int lastpos = 0;
- static int counter = PCVT_UPDATESLOW;
-#ifdef XSERVER
- /* need a method to suspend the updates */
+ /* first check if update is possible */
- if(arg == UPDATE_STOP)
- {
- untimeout((TIMEOUT_FUNC_T)async_update, UPDATE_START);
+ if(vsp->vt_status & VT_GRAFX)
return;
- }
-#endif /* XSERVER */
-
- /* first check if update is possible */
if(chargen_access) /* does someone load characters? */
- goto async_update_exit; /* yes, do not update anything */
+ return; /* yes, do not update anything */
#if PCVT_SCREENSAVER
- if(reset_screen_saver && (counter == PCVT_UPDATESLOW))
+ if(reset_screen_saver)
{
pcvt_scrnsv_reset(); /* yes, do it */
reset_screen_saver = 0; /* re-init */
}
else if(scrnsv_active) /* is the screen not blanked? */
{
- goto async_update_exit; /* do not update anything */
+ return; /* do not update anything */
}
#endif /* PCVT_SCREENSAVER */
/* this takes place on EVERY virtual screen (if not in X mode etc...)*/
/*-------------------------------------------------------------------*/
- if ( cursor_pos_valid &&
- (lastpos != (vsp->Crtat + vsp->cur_offset - Crtat)))
+ if (cursor_pos_valid)
{
- lastpos = vsp->Crtat + vsp->cur_offset - Crtat;
- outb(addr_6845, CRTC_CURSORH); /* high register */
- outb(addr_6845+1, ((lastpos) >> 8));
- outb(addr_6845, CRTC_CURSORL); /* low register */
- outb(addr_6845+1, (lastpos));
- }
-
- if (arg == UPDATE_KERN) /* Magic arg: for kernel printfs */
- return;
+ if (lastadr != (vsp->Crtat - Crtat))
+ {
+ lastadr = vsp->Crtat - Crtat;
+ outb(addr_6845, CRTC_STARTADRH); /* high register */
+ outb(addr_6845+1, ((lastadr) >> 8));
+ outb(addr_6845, CRTC_STARTADRL); /* low register */
+ outb(addr_6845+1, (lastadr));
+ }
- if(--counter) /* below is possible update */
- goto async_update_exit; /* just now and then ..... */
- counter = PCVT_UPDATESLOW; /* caution, see screensaver above !! */
+ if (lastpos != (lastadr + vsp->cur_offset))
+ {
+ lastpos = lastadr + vsp->cur_offset;
+ outb(addr_6845, CRTC_CURSORH); /* high register */
+ outb(addr_6845+1, ((lastpos) >> 8));
+ outb(addr_6845, CRTC_CURSORL); /* low register */
+ outb(addr_6845+1, (lastpos));
+ }
+ }
/*-------------------------------------------------------------------*/
/* this takes place ONLY on screen 0 if in HP mode, labels on, !X */
*(p + LABEL_ROWH) = (user_attr | (((vsp->row+1)/10) + '0'));
*(p + LABEL_ROWL) = (user_attr | (((vsp->row+1)%10) + '0'));
}
-
-async_update_exit:
-
- if(arg == UPDATE_START)
- {
- timeout((TIMEOUT_FUNC_T)async_update, UPDATE_START, PCVT_UPDATEFAST);
- }
}
/*---------------------------------------------------------------------------*
+/* $OpenBSD: pcvt_vtf.c,v 1.2 1996/04/18 17:48:37 niklas Exp $ */
+
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
*
{
svsp->Crtat += n * svsp->maxcol;
}
-
- if(vsp == svsp && !(vsp->vt_status & VT_GRAFX))
- {
- outb(addr_6845, CRTC_STARTADRH);
- outb(addr_6845+1, (svsp->Crtat - Crtat) >> 8);
- outb(addr_6845, CRTC_STARTADRL);
- outb(addr_6845+1, (svsp->Crtat - Crtat));
- }
}
else
#endif
{
svsp->Crtat -= n * svsp->maxcol;
}
-
- if(vsp == svsp && !(vsp->vt_status & VT_GRAFX))
- {
- outb(addr_6845, CRTC_STARTADRH);
- outb(addr_6845+1, (svsp->Crtat - Crtat) >> 8);
- outb(addr_6845, CRTC_STARTADRL);
- outb(addr_6845+1, (svsp->Crtat - Crtat));
- }
}
else
#endif