From 0903ac5cd261f16b9b43e26966c557023824c1f9 Mon Sep 17 00:00:00 2001 From: mycroft Date: Tue, 5 Mar 1996 12:57:30 +0000 Subject: [PATCH] Do an async_update() iff the output buffer is empty. Make the IOPL handling #ifdef COMPAT_1[01]. --- sys/arch/i386/isa/pcvt/pcvt_conf.h | 12 -------- sys/arch/i386/isa/pcvt/pcvt_drv.c | 34 +++++++++++------------ sys/arch/i386/isa/pcvt/pcvt_ext.c | 12 ++++---- sys/arch/i386/isa/pcvt/pcvt_hdr.h | 8 +----- sys/arch/i386/isa/pcvt/pcvt_ioctl.h | 2 -- sys/arch/i386/isa/pcvt/pcvt_sup.c | 43 +++++------------------------ 6 files changed, 31 insertions(+), 80 deletions(-) diff --git a/sys/arch/i386/isa/pcvt/pcvt_conf.h b/sys/arch/i386/isa/pcvt/pcvt_conf.h index 379475bf49f9..c47173d4c9dd 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_conf.h +++ b/sys/arch/i386/isa/pcvt/pcvt_conf.h @@ -105,8 +105,6 @@ * * options "PCVT_NSCREENS=x" * options "PCVT_SCANSET=x" - * options "PCVT_UPDATEFAST=x" - * options "PCVT_UPDATESLOW=x" * options "PCVT_SYSBEEPF=x" * * which are always numeric! @@ -334,16 +332,6 @@ # 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,*/ diff --git a/sys/arch/i386/isa/pcvt/pcvt_drv.c b/sys/arch/i386/isa/pcvt/pcvt_drv.c index 220b4465b3a4..3dcf57bb3d19 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_drv.c +++ b/sys/arch/i386/isa/pcvt/pcvt_drv.c @@ -323,7 +323,7 @@ pcattach(struct isa_device *dev) 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 */ @@ -940,7 +940,6 @@ extern void ttrstrt(); void pcstart(register struct tty *tp) { - register struct clist *rbp; int s, len; u_char buf[PCVT_PCBURST]; @@ -949,41 +948,42 @@ pcstart(register struct tty *tp) 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); } @@ -1171,7 +1171,7 @@ pccnputc(Dev_t dev, U_char c) sput((char *) &c, 1, 1, 0); - async_update(UPDATE_KERN); + async_update(); #if ((PCVT_NETBSD && (PCVT_NETBSD <= 101)) || \ (PCVT_FREEBSD && (PCVT_FREEBSD <= 205))) @@ -1193,7 +1193,7 @@ pccngetc(Dev_t dev) 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 */ @@ -1279,7 +1279,7 @@ getchar(void) sput(">", 1, 1, 0); - async_update(UPDATE_KERN); + async_update(); thechar = *(sgetc(0)); diff --git a/sys/arch/i386/isa/pcvt/pcvt_ext.c b/sys/arch/i386/isa/pcvt/pcvt_ext.c index 4b031d60b2bc..ab937801b76e 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_ext.c +++ b/sys/arch/i386/isa/pcvt/pcvt_ext.c @@ -2196,8 +2196,6 @@ switch_screen(int n, int oldgrafx, int newgrafx) 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) @@ -2265,9 +2263,6 @@ switch_screen(int n, int oldgrafx, int newgrafx) 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) @@ -2759,10 +2754,13 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) 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; @@ -2772,6 +2770,8 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) /* 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; @@ -2782,7 +2782,7 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) struct syscframe *fp = (struct syscframe *)p->p_regs; fp->sf_eflags &= ~PSL_IOPL; #endif - +#endif return 0; } diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h index 2f1331be505e..e6716d46f399 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h @@ -693,12 +693,6 @@ in the config file" #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 @@ -1264,7 +1258,7 @@ void pcvt_set_scrnsv_tmo ( int ); 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 ); diff --git a/sys/arch/i386/isa/pcvt/pcvt_ioctl.h b/sys/arch/i386/isa/pcvt/pcvt_ioctl.h index a3e7d413406a..7bb920c9e67c 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_ioctl.h +++ b/sys/arch/i386/isa/pcvt/pcvt_ioctl.h @@ -427,8 +427,6 @@ struct pcvtinfo { /* compile time option values */ 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 */ diff --git a/sys/arch/i386/isa/pcvt/pcvt_sup.c b/sys/arch/i386/isa/pcvt/pcvt_sup.c index 38a94722d490..bbaf3fc7424a 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_sup.c +++ b/sys/arch/i386/isa/pcvt/pcvt_sup.c @@ -265,8 +265,6 @@ vgapcvtinfo(struct pcvtinfo *data) 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 @@ -865,43 +863,30 @@ vgapaletteio(unsigned idx, struct rgb *val, int writeit) * * 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 */ - - if(arg == UPDATE_STOP) - { - untimeout((TIMEOUT_FUNC_T)async_update, UPDATE_START); - return; - } -#endif /* XSERVER */ /* first check if update is possible */ + if(vsp->vt_status & VT_GRAFX) + return; + 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 */ @@ -930,13 +915,6 @@ async_update(int arg) } } - if (arg == UPDATE_KERN) /* Magic arg: for kernel printfs */ - return; - - if(--counter) /* below is possible update */ - goto async_update_exit; /* just now and then ..... */ - counter = PCVT_UPDATESLOW; /* caution, see screensaver above !! */ - /*-------------------------------------------------------------------*/ /* this takes place ONLY on screen 0 if in HP mode, labels on, !X */ /*-------------------------------------------------------------------*/ @@ -1066,13 +1044,6 @@ async_update(int arg) *(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); - } } /*---------------------------------------------------------------------------*