diff options
author | phk <phk@FreeBSD.org> | 1999-08-09 10:35:05 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-08-09 10:35:05 +0000 |
commit | ee871b6440719fbe58a0cb8e994ad543265f4e1a (patch) | |
tree | 5e644fe7bdaf6b601abb674aac52092ad3fd8b45 /sys | |
parent | f0f8bd1b55697613d6f80eb5c65838ecc4b246e6 (diff) | |
download | FreeBSD-src-ee871b6440719fbe58a0cb8e994ad543265f4e1a.zip FreeBSD-src-ee871b6440719fbe58a0cb8e994ad543265f4e1a.tar.gz |
Merge the cons.c and cons.h to the best of my ability. alpha may or
may not compile, I can't test it.
Diffstat (limited to 'sys')
66 files changed, 113 insertions, 1259 deletions
diff --git a/sys/alpha/alpha/alpha-gdbstub.c b/sys/alpha/alpha/alpha-gdbstub.c index e344fe6..0c8cf5d 100644 --- a/sys/alpha/alpha/alpha-gdbstub.c +++ b/sys/alpha/alpha/alpha-gdbstub.c @@ -96,9 +96,9 @@ #include <sys/reboot.h> #include <sys/systm.h> #include <sys/signal.h> +#include <sys/cons.h> #include <machine/reg.h> -#include <machine/cons.h> #include <ddb/ddb.h> diff --git a/sys/alpha/alpha/autoconf.c b/sys/alpha/alpha/autoconf.c index 7f1f868..74daa01 100644 --- a/sys/alpha/alpha/autoconf.c +++ b/sys/alpha/alpha/autoconf.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: autoconf.c,v 1.29 1999/07/17 20:47:40 phk Exp $ + * $Id: autoconf.c,v 1.30 1999/07/21 21:11:28 dfr Exp $ */ #include "opt_bootp.h" @@ -42,8 +42,8 @@ #include <sys/sysctl.h> #include <sys/bus.h> #include <sys/devicestat.h> +#include <sys/cons.h> -#include <machine/cons.h> #include <machine/ipl.h> #include <machine/md_var.h> #include <machine/cpuconf.h> diff --git a/sys/alpha/alpha/cons.c b/sys/alpha/alpha/cons.c deleted file mode 100644 index 3df65ef..0000000 --- a/sys/alpha/alpha/cons.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.11 1999/06/22 14:13:16 yokota Exp $ - */ - -#include "opt_devfs.h" - -#include <sys/param.h> -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/kernel.h> -#include <sys/reboot.h> -#include <sys/sysctl.h> -#include <sys/proc.h> -#include <sys/tty.h> -#include <sys/uio.h> - -#include <machine/cpu.h> -#include <machine/cons.h> - -static d_open_t cnopen; -static d_close_t cnclose; -static d_read_t cnread; -static d_write_t cnwrite; -static d_ioctl_t cnioctl; -static d_poll_t cnpoll; - -#define CDEV_MAJOR 0 -static struct cdevsw cn_cdevsw = { - /* open */ cnopen, - /* close */ cnclose, - /* read */ cnread, - /* write */ cnwrite, - /* ioctl */ cnioctl, - /* stop */ nostop, - /* reset */ noreset, - /* devtotty */ nodevtotty, - /* poll */ cnpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "console", - /* parms */ noparms, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY, - /* maxio */ 0, - /* bmaj */ -1 -}; - -static dev_t cn_dev_t; /* seems to be never really used */ -static udev_t cn_udev_t; -SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLFLAG_RD, - &cn_udev_t, sizeof cn_udev_t, "T,dev_t", ""); - -static int cn_mute; - -int cons_unavail = 0; /* XXX: - * physical console not available for - * input (i.e., it is in graphics mode) - */ - -static u_char cn_is_open; /* nonzero if logical console is open */ -static int openmode, openflag; /* how /dev/console was openned */ -static u_char cn_phys_is_open; /* nonzero if physical device is open */ -static d_close_t *cn_phys_close; /* physical device close function */ -static d_open_t *cn_phys_open; /* physical device open function */ -struct consdev *cn_tab; /* physical console device info */ -static struct tty *cn_tp; /* physical console tty struct */ -#ifdef DEVFS -static void *cn_devfs_token; /* represents the devfs entry */ -#endif /* DEVFS */ - -CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL, NULL); - -void -cninit() -{ - struct consdev *best_cp, *cp; - struct consdev **list; - - /* - * Find the first console with the highest priority. - */ - best_cp = NULL; - list = (struct consdev **)cons_set.ls_items; - while ((cp = *list++) != NULL) { - if (cp->cn_probe == NULL) - continue; - (*cp->cn_probe)(cp); - if (cp->cn_pri > CN_DEAD && - (best_cp == NULL || cp->cn_pri > best_cp->cn_pri)) - best_cp = cp; - } - - /* - * Check if we should mute the console (for security reasons perhaps) - * It can be changes dynamically using sysctl kern.consmute - * once we are up and going. - * - */ - cn_mute = ((boothowto & (RB_MUTE - |RB_SINGLE - |RB_VERBOSE - |RB_ASKNAME - |RB_CONFIG)) == RB_MUTE); - - /* - * If no console, give up. - */ - if (best_cp == NULL) { - if (cn_tab != NULL && cn_tab->cn_term != NULL) - (*cn_tab->cn_term)(cn_tab); - cn_tab = best_cp; - return; - } - - /* - * Initialize console, then attach to it. This ordering allows - * debugging using the previous console, if any. - */ - (*best_cp->cn_init)(best_cp); - if (cn_tab != NULL && cn_tab != best_cp) { - /* Turn off the previous console. */ - if (cn_tab->cn_term != NULL) - (*cn_tab->cn_term)(cn_tab); - } - cn_tab = best_cp; -} - -void -cninit_finish() -{ - struct cdevsw *cdp; - - if ((cn_tab == NULL) || cn_mute) - return; - - /* - * Hook the open and close functions. - */ - cdp = devsw(cn_tab->cn_dev); - cn_phys_close = cdp->d_close; - cdp->d_close = cnclose; - cn_phys_open = cdp->d_open; - cdp->d_open = cnopen; - cn_tp = (*cdp->d_devtotty)(cn_tab->cn_dev); - cn_dev_t = cn_tab->cn_dev; - cn_udev_t = dev2udev(cn_dev_t); -} - -static void -cnuninit(void) -{ - struct cdevsw *cdp; - - if (cn_tab == NULL) - return; - - /* - * Unhook the open and close functions. - */ - cdp = devsw(cn_tab->cn_dev); - cdp->d_close = cn_phys_close; - cn_phys_close = NULL; - cdp->d_open = cn_phys_open; - cn_phys_open = NULL; - cn_tp = NULL; - cn_dev_t = NODEV; - cn_udev_t = NOUDEV; -} - -/* - * User has changed the state of the console muting. - * This may require us to open or close the device in question. - */ -static int -sysctl_kern_consmute SYSCTL_HANDLER_ARGS -{ - int error; - int ocn_mute; - - ocn_mute = cn_mute; - error = sysctl_handle_int(oidp, &cn_mute, 0, req); - if((error == 0) && (cn_tab != NULL) && (req->newptr != NULL)) { - if(ocn_mute && !cn_mute) { - /* - * going from muted to unmuted.. open the physical dev - * if the console has been openned - */ - cninit_finish(); - if(cn_is_open) - /* XXX curproc is not what we want really */ - error = cnopen(cn_dev_t, openflag, - openmode, curproc); - /* if it failed, back it out */ - if ( error != 0) cnuninit(); - } else if (!ocn_mute && cn_mute) { - /* - * going from unmuted to muted.. close the physical dev - * if it's only open via /dev/console - */ - if(cn_is_open) - error = cnclose(cn_dev_t, openflag, - openmode, curproc); - if ( error == 0) cnuninit(); - } - if (error != 0) { - /* - * back out the change if there was an error - */ - cn_mute = ocn_mute; - } - } - return (error); -} - -SYSCTL_PROC(_kern, OID_AUTO, consmute, CTLTYPE_INT|CTLFLAG_RW, - 0, sizeof cn_mute, sysctl_kern_consmute, "I", ""); - -static int -cnopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - dev_t cndev, physdev; - int retval = 0; - - if (cn_tab == NULL) - return (0); - cndev = cn_tab->cn_dev; - physdev = (major(dev) == major(cndev) ? dev : cndev); - /* - * If mute is active, then non console opens don't get here - * so we don't need to check for that. They - * bypass this and go straight to the device. - */ - if(!cn_mute) - retval = (*cn_phys_open)(physdev, flag, mode, p); - if (retval == 0) { - /* - * check if we openned it via /dev/console or - * via the physical entry (e.g. /dev/sio0). - */ - if (dev == cndev) - cn_phys_is_open = 1; - else if (physdev == cndev) { - openmode = mode; - openflag = flag; - cn_is_open = 1; - } - } - return (retval); -} - -static int -cnclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - dev_t cndev; - - if (cn_tab == NULL) - return (0); - cndev = cn_tab->cn_dev; - /* - * act appropriatly depending on whether it's /dev/console - * or the pysical device (e.g. /dev/sio) that's being closed. - * in either case, don't actually close the device unless - * both are closed. - */ - if (dev == cndev) { - /* the physical device is about to be closed */ - cn_phys_is_open = 0; - if (cn_is_open) { - if (cn_tp) { - /* perform a ttyhalfclose() */ - /* reset session and proc group */ - cn_tp->t_pgrp = NULL; - cn_tp->t_session = NULL; - } - return (0); - } - } else if (major(dev) != major(cndev)) { - /* the logical console is about to be closed */ - cn_is_open = 0; - if (cn_phys_is_open) - return (0); - dev = cndev; - } - if(cn_phys_close) - return ((*cn_phys_close)(dev, flag, mode, p)); - return (0); -} - -static int -cnread(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - if ((cn_tab == NULL) || cn_mute) - return (0); - dev = cn_tab->cn_dev; - return ((*devsw(dev)->d_read)(dev, uio, flag)); -} - -static int -cnwrite(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - if ((cn_tab == NULL) || cn_mute) { - uio->uio_resid = 0; /* dump the data */ - return (0); - } - if (constty) - dev = constty->t_dev; - else - dev = cn_tab->cn_dev; - return ((*devsw(dev)->d_write)(dev, uio, flag)); -} - -static int -cnioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; -{ - int error; - - if ((cn_tab == NULL) || cn_mute) - return (0); - /* - * Superuser can always use this to wrest control of console - * output from the "virtual" console. - */ - if (cmd == TIOCCONS && constty) { - error = suser(p); - if (error) - return (error); - constty = NULL; - return (0); - } - dev = cn_tab->cn_dev; - return ((*devsw(dev)->d_ioctl)(dev, cmd, data, flag, p)); -} - -static int -cnpoll(dev, events, p) - dev_t dev; - int events; - struct proc *p; -{ - if ((cn_tab == NULL) || cn_mute) - return (1); - - dev = cn_tab->cn_dev; - - return ((*devsw(dev)->d_poll)(dev, events, p)); -} - -int -cngetc() -{ - int c; - if ((cn_tab == NULL) || cn_mute) - return (-1); - c = (*cn_tab->cn_getc)(cn_tab->cn_dev); - if (c == '\r') c = '\n'; /* console input is always ICRNL */ - return (c); -} - -int -cncheckc() -{ - if ((cn_tab == NULL) || cn_mute) - return (-1); - return ((*cn_tab->cn_checkc)(cn_tab->cn_dev)); -} - -void -cnputc(c) - register int c; -{ - if ((cn_tab == NULL) || cn_mute) - return; - if (c) { - if (c == '\n') - (*cn_tab->cn_putc)(cn_tab->cn_dev, '\r'); - (*cn_tab->cn_putc)(cn_tab->cn_dev, c); - } -} - -static void -cn_drvinit(void *unused) -{ - - cdevsw_add(&cn_cdevsw); -#ifdef DEVFS - cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, "console"); -#endif -} - -SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL) - - diff --git a/sys/alpha/alpha/db_interface.c b/sys/alpha/alpha/db_interface.c index ffd82c1..f1189f1 100644 --- a/sys/alpha/alpha/db_interface.c +++ b/sys/alpha/alpha/db_interface.c @@ -56,11 +56,10 @@ #include <sys/reboot.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/cons.h> #include <vm/vm.h> -#include <machine/cons.h> - #include <machine/db_machdep.h> #include <machine/pal.h> #include <machine/prom.h> diff --git a/sys/alpha/alpha/prom.c b/sys/alpha/alpha/prom.c index 4724eb4..06d43ef 100644 --- a/sys/alpha/alpha/prom.c +++ b/sys/alpha/alpha/prom.c @@ -42,13 +42,12 @@ #include <vm/vm_map.h> #include <sys/proc.h> #include <sys/user.h> +#include <sys/cons.h> #include <machine/rpb.h> #include <machine/prom.h> #include <machine/vmparam.h> -#include <machine/cons.h> - /* XXX this is to fake out the console routines, while booting. */ struct consdev promcons = { NULL, NULL, promcngetc, promcncheckc, promcnputc, NULL, 0 /* makedev(97,0) */, CN_NORMAL }; diff --git a/sys/alpha/conf/files.alpha b/sys/alpha/conf/files.alpha index 6446559..52ef13c 100644 --- a/sys/alpha/conf/files.alpha +++ b/sys/alpha/conf/files.alpha @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.alpha,v 1.22 1999/06/22 14:13:18 yokota Exp $ +# $Id: files.alpha,v 1.23 1999/07/03 19:19:30 peter Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -36,7 +36,6 @@ alpha/alpha/ipl_funcs.c standard alpha/alpha/pal.s standard alpha/alpha/busdma_machdep.c standard alpha/alpha/sgmap.c standard -alpha/alpha/cons.c standard alpha/alpha/prom.c standard alpha/alpha/promcons.c standard alpha/alpha/prom_disp.s standard diff --git a/sys/alpha/include/cons.h b/sys/alpha/include/cons.h deleted file mode 100644 index fdc0da0..0000000 --- a/sys/alpha/include/cons.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 - * $Id: cons.h,v 1.2 1999/01/23 16:53:27 dfr Exp $ - */ - -#ifndef _MACHINE_CONS_H_ -#define _MACHINE_CONS_H_ - -struct consdev; -typedef void cn_probe_t __P((struct consdev *)); -typedef void cn_init_t __P((struct consdev *)); -typedef void cn_term_t __P((struct consdev *)); -typedef int cn_getc_t __P((dev_t)); -typedef int cn_checkc_t __P((dev_t)); -typedef void cn_putc_t __P((dev_t, int)); - -#ifdef KERNEL -/* - * XXX public functions in drivers should be declared in headers produced - * by `config', not here. - */ -cn_probe_t siocnprobe; -cn_init_t siocninit; -cn_getc_t siocngetc; -cn_checkc_t siocncheckc; -cn_putc_t siocnputc; -#endif /* KERNEL */ - -struct consdev { - cn_probe_t *cn_probe; - /* probe hardware and fill in consdev info */ - cn_init_t *cn_init; - /* turn on as console */ - cn_term_t *cn_term; - /* turn off as console */ - cn_getc_t *cn_getc; - /* kernel getchar interface */ - cn_checkc_t *cn_checkc; - /* kernel "return char if available" interface */ - cn_putc_t *cn_putc; - /* kernel putchar interface */ - struct tty *cn_tp; /* tty structure for console device */ - dev_t cn_dev; /* major/minor of device */ - short cn_pri; /* pecking order; the higher the better */ -}; - -/* values for cn_pri - reflect our policy for console selection */ -#define CN_DEAD 0 /* device doesn't exist */ -#define CN_NORMAL 1 /* device exists but is nothing special */ -#define CN_INTERNAL 2 /* "internal" bit-mapped display */ -#define CN_REMOTE 3 /* serial interface with remote bit set */ - -#ifdef KERNEL -extern struct linker_set cons_set; -extern int cons_unavail; - -#define CONS_DRIVER(name, probe, init, term, getc, checkc, putc) \ - static struct consdev name##_consdev = { \ - probe, init, term, getc, checkc, putc \ - }; \ - DATA_SET(cons_set, name##_consdev) - -/* Other kernel entry points. */ -int cncheckc __P((void)); -int cngetc __P((void)); -void cninit __P((void)); -void cninit_finish __P((void)); -void cnputc __P((int)); - -#endif /* KERNEL */ - -#endif /* !_MACHINE_CONS_H_ */ diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index 337706d..04ea7ee 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: zs_tlsb.c,v 1.14 1999/07/04 14:58:04 phk Exp $ + * $Id: zs_tlsb.c,v 1.15 1999/07/29 01:02:45 mdodd Exp $ */ /* * This driver is a hopeless hack to get the SimOS console working. A real @@ -41,7 +41,7 @@ #include <sys/tty.h> #include <sys/proc.h> #include <sys/ucred.h> -#include <machine/cons.h> +#include <sys/cons.h> #include <machine/clock.h> #include <alpha/tlsb/gbusvar.h> diff --git a/sys/amd64/amd64/amd64-gdbstub.c b/sys/amd64/amd64/amd64-gdbstub.c index 40530bf..a2323ce 100644 --- a/sys/amd64/amd64/amd64-gdbstub.c +++ b/sys/amd64/amd64/amd64-gdbstub.c @@ -95,8 +95,7 @@ #include <sys/param.h> #include <sys/reboot.h> #include <sys/systm.h> - -#include <machine/cons.h> +#include <sys/cons.h> #include <ddb/ddb.h> diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c index 6e2b68a..ea12b1a 100644 --- a/sys/amd64/amd64/autoconf.c +++ b/sys/amd64/amd64/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.129 1999/07/17 20:47:49 phk Exp $ + * $Id: autoconf.c,v 1.130 1999/08/06 20:29:46 phk Exp $ */ /* @@ -63,9 +63,9 @@ #include <sys/malloc.h> #include <sys/mount.h> #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/bootinfo.h> -#include <machine/cons.h> #include <machine/ipl.h> #include <machine/md_var.h> #ifdef APIC_IO diff --git a/sys/amd64/amd64/db_interface.c b/sys/amd64/amd64/db_interface.c index 2998597..0ad6dfb 100644 --- a/sys/amd64/amd64/db_interface.c +++ b/sys/amd64/amd64/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.43 1998/12/28 23:02:56 msmith Exp $ + * $Id: db_interface.c,v 1.44 1999/04/28 01:03:17 luoqi Exp $ */ /* @@ -32,8 +32,8 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/reboot.h> +#include <sys/cons.h> -#include <machine/cons.h> #include <machine/cpu.h> #ifdef SMP #include <machine/smp.h> diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index c0dc2eb..a74c108 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.356 1999/07/19 23:36:30 peter Exp $ + * $Id: machdep.c,v 1.357 1999/07/29 01:49:18 msmith Exp $ */ #include "apm.h" @@ -97,6 +97,7 @@ #include <sys/user.h> #include <sys/exec.h> +#include <sys/cons.h> #include <ddb/ddb.h> @@ -106,7 +107,6 @@ #include <machine/reg.h> #include <machine/clock.h> #include <machine/specialreg.h> -#include <machine/cons.h> #include <machine/bootinfo.h> #include <machine/ipl.h> #include <machine/md_var.h> diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index e81efef..969cd08 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.105 1999/06/23 23:02:38 msmith Exp $ + * $Id: mp_machdep.c,v 1.106 1999/07/20 06:52:26 msmith Exp $ */ #include "opt_smp.h" @@ -45,6 +45,7 @@ #ifdef BETTER_CLOCK #include <sys/dkstat.h> #endif +#include <sys/cons.h> /* cngetc() */ #include <vm/vm.h> #include <vm/vm_param.h> @@ -73,8 +74,6 @@ #include <machine/cputypes.h> #include <machine/globaldata.h> -#include <i386/i386/cons.h> /* cngetc() */ - #if defined(APIC_IO) #include <machine/md_var.h> /* setidt() */ #include <i386/isa/icu.h> /* IPIs */ diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c index e81efef..969cd08 100644 --- a/sys/amd64/amd64/mptable.c +++ b/sys/amd64/amd64/mptable.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.105 1999/06/23 23:02:38 msmith Exp $ + * $Id: mp_machdep.c,v 1.106 1999/07/20 06:52:26 msmith Exp $ */ #include "opt_smp.h" @@ -45,6 +45,7 @@ #ifdef BETTER_CLOCK #include <sys/dkstat.h> #endif +#include <sys/cons.h> /* cngetc() */ #include <vm/vm.h> #include <vm/vm_param.h> @@ -73,8 +74,6 @@ #include <machine/cputypes.h> #include <machine/globaldata.h> -#include <i386/i386/cons.h> /* cngetc() */ - #if defined(APIC_IO) #include <machine/md_var.h> /* setidt() */ #include <i386/isa/icu.h> /* IPIs */ diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index 1c8d8f6..188e20b 100644 --- a/sys/amd64/amd64/tsc.c +++ b/sys/amd64/amd64/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.141 1999/07/28 20:22:30 msmith Exp $ + * $Id: clock.c,v 1.142 1999/07/29 01:20:47 green Exp $ */ /* @@ -59,10 +59,10 @@ #include <sys/lock.h> #endif #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/clock.h> #ifdef CLK_CALIBRATION_LOOP -#include <machine/cons.h> #endif #include <machine/cputypes.h> #include <machine/frame.h> diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h index e81efef..969cd08 100644 --- a/sys/amd64/include/mptable.h +++ b/sys/amd64/include/mptable.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.105 1999/06/23 23:02:38 msmith Exp $ + * $Id: mp_machdep.c,v 1.106 1999/07/20 06:52:26 msmith Exp $ */ #include "opt_smp.h" @@ -45,6 +45,7 @@ #ifdef BETTER_CLOCK #include <sys/dkstat.h> #endif +#include <sys/cons.h> /* cngetc() */ #include <vm/vm.h> #include <vm/vm_param.h> @@ -73,8 +74,6 @@ #include <machine/cputypes.h> #include <machine/globaldata.h> -#include <i386/i386/cons.h> /* cngetc() */ - #if defined(APIC_IO) #include <machine/md_var.h> /* setidt() */ #include <i386/isa/icu.h> /* IPIs */ diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index 1c8d8f6..188e20b 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.141 1999/07/28 20:22:30 msmith Exp $ + * $Id: clock.c,v 1.142 1999/07/29 01:20:47 green Exp $ */ /* @@ -59,10 +59,10 @@ #include <sys/lock.h> #endif #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/clock.h> #ifdef CLK_CALIBRATION_LOOP -#include <machine/cons.h> #endif #include <machine/cputypes.h> #include <machine/frame.h> diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 630b946..71c15f7 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_da.c,v 1.29 1999/07/06 01:40:03 mjacob Exp $ + * $Id: scsi_da.c,v 1.30 1999/07/07 18:14:01 mjacob Exp $ */ #include "opt_hw_wdog.h" @@ -40,8 +40,8 @@ #include <sys/diskslice.h> #include <sys/malloc.h> #include <sys/conf.h> +#include <sys/cons.h> -#include <machine/cons.h> #include <machine/md_var.h> #include <vm/vm.h> diff --git a/sys/conf/files b/sys/conf/files index 0ab54a3..f536d21 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -324,6 +324,7 @@ kern/sysv_shm.c optional sysvshm kern/tty.c standard kern/tty_compat.c standard kern/tty_conf.c standard +kern/tty_cons.c standard kern/tty_pty.c optional pty kern/tty_snoop.c optional snp kern/tty_subr.c standard diff --git a/sys/conf/files.alpha b/sys/conf/files.alpha index 6446559..52ef13c 100644 --- a/sys/conf/files.alpha +++ b/sys/conf/files.alpha @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.alpha,v 1.22 1999/06/22 14:13:18 yokota Exp $ +# $Id: files.alpha,v 1.23 1999/07/03 19:19:30 peter Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -36,7 +36,6 @@ alpha/alpha/ipl_funcs.c standard alpha/alpha/pal.s standard alpha/alpha/busdma_machdep.c standard alpha/alpha/sgmap.c standard -alpha/alpha/cons.c standard alpha/alpha/prom.c standard alpha/alpha/promcons.c standard alpha/alpha/prom_disp.s standard diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index b79f016..cf586fc 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.i386,v 1.256 1999/08/06 14:01:55 hm Exp $ +# $Id: files.i386,v 1.257 1999/08/07 12:19:41 peter Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -121,7 +121,6 @@ i386/i386/autoconf.c standard i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/busdma_machdep.c standard -i386/i386/cons.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb diff --git a/sys/conf/files.pc98 b/sys/conf/files.pc98 index 719f7c7..ca228d2 100644 --- a/sys/conf/files.pc98 +++ b/sys/conf/files.pc98 @@ -3,7 +3,7 @@ # # modified for PC-9801 # -# $Id: files.pc98,v 1.103 1999/07/30 11:40:55 kato Exp $ +# $Id: files.pc98,v 1.104 1999/08/08 11:12:00 kato Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -64,7 +64,6 @@ i386/i386/autoconf.c standard i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/busdma_machdep.c standard -i386/i386/cons.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index e5a9f03..53c79c6 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_command.c,v 1.31 1999/05/09 10:51:03 phk Exp $ + * $Id: db_command.c,v 1.32 1999/07/01 19:42:55 peter Exp $ */ /* @@ -38,8 +38,7 @@ #include <sys/linker_set.h> #include <sys/reboot.h> #include <sys/systm.h> - -#include <machine/cons.h> +#include <sys/cons.h> #include <ddb/ddb.h> #include <ddb/db_command.h> diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c index a9797d2..b17bdff 100644 --- a/sys/ddb/db_input.c +++ b/sys/ddb/db_input.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_input.c,v 1.23 1997/12/05 05:36:58 dyson Exp $ + * $Id: db_input.c,v 1.24 1999/07/14 10:53:41 yokota Exp $ */ /* @@ -33,8 +33,7 @@ #include <sys/param.h> #include <sys/systm.h> - -#include <machine/cons.h> +#include <sys/cons.h> #include <ddb/ddb.h> #include <ddb/db_output.h> diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index 4959154..3318322 100644 --- a/sys/ddb/db_output.c +++ b/sys/ddb/db_output.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_output.c,v 1.23 1998/06/07 17:09:37 dfr Exp $ + * $Id: db_output.c,v 1.24 1998/07/08 09:11:36 bde Exp $ */ /* @@ -37,8 +37,8 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/cons.h> -#include <machine/cons.h> #include <machine/stdarg.h> #include <ddb/ddb.h> diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c index bddfbed..8060322 100644 --- a/sys/ddb/db_ps.c +++ b/sys/ddb/db_ps.c @@ -30,13 +30,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: db_ps.c,v 1.17 1999/01/27 19:00:49 dillon Exp $ + * $Id: db_ps.c,v 1.18 1999/05/13 13:01:46 bde Exp $ */ #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> - -#include <machine/cons.h> +#include <sys/cons.h> #include <ddb/ddb.h> diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index d36318d..d6d8fd4 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.252 1999/07/04 14:58:35 phk Exp $ + * $Id: sio.c,v 1.253 1999/08/08 20:25:14 phk Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -2624,7 +2624,7 @@ disc_optim(tp, t, com) /* * Following are all routines needed for SIO to act as console */ -#include <machine/cons.h> +#include <sys/cons.h> struct siocnstate { u_char dlbl; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index fbf8ea8..518d0b5 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.314 1999/07/18 06:16:53 yokota Exp $ + * $Id: syscons.c,v 1.315 1999/08/08 21:35:17 phk Exp $ */ #include "sc.h" @@ -46,9 +46,9 @@ #include <sys/tty.h> #include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/cons.h> #include <machine/clock.h> -#include <machine/cons.h> #include <machine/console.h> #include <machine/psl.h> #include <machine/pc/display.h> diff --git a/sys/i386/conf/files.i386 b/sys/i386/conf/files.i386 index b79f016..cf586fc 100644 --- a/sys/i386/conf/files.i386 +++ b/sys/i386/conf/files.i386 @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.i386,v 1.256 1999/08/06 14:01:55 hm Exp $ +# $Id: files.i386,v 1.257 1999/08/07 12:19:41 peter Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -121,7 +121,6 @@ i386/i386/autoconf.c standard i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/busdma_machdep.c standard -i386/i386/cons.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index 6e2b68a..ea12b1a 100644 --- a/sys/i386/i386/autoconf.c +++ b/sys/i386/i386/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.129 1999/07/17 20:47:49 phk Exp $ + * $Id: autoconf.c,v 1.130 1999/08/06 20:29:46 phk Exp $ */ /* @@ -63,9 +63,9 @@ #include <sys/malloc.h> #include <sys/mount.h> #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/bootinfo.h> -#include <machine/cons.h> #include <machine/ipl.h> #include <machine/md_var.h> #ifdef APIC_IO diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c deleted file mode 100644 index 92544f8..0000000 --- a/sys/i386/i386/cons.c +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.69 1999/06/26 12:19:03 peter Exp $ - */ - -#include "opt_devfs.h" - -#include <sys/param.h> -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/kernel.h> -#include <sys/reboot.h> -#include <sys/sysctl.h> -#include <sys/proc.h> -#include <sys/tty.h> -#include <sys/uio.h> - -#include <machine/cpu.h> -#include <machine/cons.h> - -static d_open_t cnopen; -static d_close_t cnclose; -static d_read_t cnread; -static d_write_t cnwrite; -static d_ioctl_t cnioctl; -static d_poll_t cnpoll; - -#define CDEV_MAJOR 0 -static struct cdevsw cn_cdevsw = { - /* open */ cnopen, - /* close */ cnclose, - /* read */ cnread, - /* write */ cnwrite, - /* ioctl */ cnioctl, - /* stop */ nostop, - /* reset */ noreset, - /* devtotty */ nodevtotty, - /* poll */ cnpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "console", - /* parms */ noparms, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY, - /* maxio */ 0, - /* bmaj */ -1 -}; - -static dev_t cn_dev_t; /* seems to be never really used */ -static udev_t cn_udev_t; -SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLFLAG_RD, - &cn_udev_t, sizeof cn_udev_t, "T,dev_t", ""); - -static int cn_mute; - -int cons_unavail = 0; /* XXX: - * physical console not available for - * input (i.e., it is in graphics mode) - */ - -static u_char cn_is_open; /* nonzero if logical console is open */ -static int openmode, openflag; /* how /dev/console was openned */ -static u_char cn_phys_is_open; /* nonzero if physical device is open */ -static d_close_t *cn_phys_close; /* physical device close function */ -static d_open_t *cn_phys_open; /* physical device open function */ -static struct consdev *cn_tab; /* physical console device info */ -static struct tty *cn_tp; /* physical console tty struct */ -#ifdef DEVFS -static void *cn_devfs_token; /* represents the devfs entry */ -#endif /* DEVFS */ - -CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL, NULL); - -void -cninit() -{ - struct consdev **list, *best_cp, *cp; - - /* - * Find the first console with the highest priority. - */ - best_cp = NULL; - list = (struct consdev **)cons_set.ls_items; - while ((cp = *list++) != NULL) { - if (cp->cn_probe == NULL) - continue; - (*cp->cn_probe)(cp); - if (cp->cn_pri > CN_DEAD && - (best_cp == NULL || cp->cn_pri > best_cp->cn_pri)) - best_cp = cp; - } - - /* - * Check if we should mute the console (for security reasons perhaps) - * It can be changes dynamically using sysctl kern.consmute - * once we are up and going. - * - */ - cn_mute = ((boothowto & (RB_MUTE - |RB_SINGLE - |RB_VERBOSE - |RB_ASKNAME - |RB_CONFIG)) == RB_MUTE); - - /* - * If no console, give up. - */ - if (best_cp == NULL) { - if (cn_tab != NULL && cn_tab->cn_term != NULL) - (*cn_tab->cn_term)(cn_tab); - cn_tab = best_cp; - return; - } - - /* - * Initialize console, then attach to it. This ordering allows - * debugging using the previous console, if any. - */ - (*best_cp->cn_init)(best_cp); - if (cn_tab != NULL && cn_tab != best_cp) { - /* Turn off the previous console. */ - if (cn_tab->cn_term != NULL) - (*cn_tab->cn_term)(cn_tab); - } - cn_tab = best_cp; -} - -void -cninit_finish() -{ - struct cdevsw *cdp; - - if ((cn_tab == NULL) || cn_mute) - return; - - /* - * Hook the open and close functions. - */ - cdp = devsw(cn_tab->cn_dev); - cn_phys_close = cdp->d_close; - cdp->d_close = cnclose; - cn_phys_open = cdp->d_open; - cdp->d_open = cnopen; - cn_tp = (*cdp->d_devtotty)(cn_tab->cn_dev); - cn_dev_t = cn_tab->cn_dev; - cn_udev_t = dev2udev(cn_dev_t); -} - -static void -cnuninit(void) -{ - struct cdevsw *cdp; - - if (cn_tab == NULL) - return; - - /* - * Unhook the open and close functions. - */ - cdp = devsw(cn_tab->cn_dev); - cdp->d_close = cn_phys_close; - cn_phys_close = NULL; - cdp->d_open = cn_phys_open; - cn_phys_open = NULL; - cn_tp = NULL; - cn_dev_t = NODEV; - cn_udev_t = NOUDEV; -} - -/* - * User has changed the state of the console muting. - * This may require us to open or close the device in question. - */ -static int -sysctl_kern_consmute SYSCTL_HANDLER_ARGS -{ - int error; - int ocn_mute; - - ocn_mute = cn_mute; - error = sysctl_handle_int(oidp, &cn_mute, 0, req); - if((error == 0) && (cn_tab != NULL) && (req->newptr != NULL)) { - if(ocn_mute && !cn_mute) { - /* - * going from muted to unmuted.. open the physical dev - * if the console has been openned - */ - cninit_finish(); - if(cn_is_open) - /* XXX curproc is not what we want really */ - error = cnopen(cn_dev_t, openflag, - openmode, curproc); - /* if it failed, back it out */ - if ( error != 0) cnuninit(); - } else if (!ocn_mute && cn_mute) { - /* - * going from unmuted to muted.. close the physical dev - * if it's only open via /dev/console - */ - if(cn_is_open) - error = cnclose(cn_dev_t, openflag, - openmode, curproc); - if ( error == 0) cnuninit(); - } - if (error != 0) { - /* - * back out the change if there was an error - */ - cn_mute = ocn_mute; - } - } - return (error); -} - -SYSCTL_PROC(_kern, OID_AUTO, consmute, CTLTYPE_INT|CTLFLAG_RW, - 0, sizeof cn_mute, sysctl_kern_consmute, "I", ""); - -static int -cnopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - dev_t cndev, physdev; - int retval = 0; - - if (cn_tab == NULL) - return (0); - cndev = cn_tab->cn_dev; - physdev = (major(dev) == major(cndev) ? dev : cndev); - /* - * If mute is active, then non console opens don't get here - * so we don't need to check for that. They - * bypass this and go straight to the device. - */ - if(!cn_mute) - retval = (*cn_phys_open)(physdev, flag, mode, p); - if (retval == 0) { - /* - * check if we openned it via /dev/console or - * via the physical entry (e.g. /dev/sio0). - */ - if (dev == cndev) - cn_phys_is_open = 1; - else if (physdev == cndev) { - openmode = mode; - openflag = flag; - cn_is_open = 1; - } - } - return (retval); -} - -static int -cnclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - dev_t cndev; - - if (cn_tab == NULL) - return (0); - cndev = cn_tab->cn_dev; - /* - * act appropriatly depending on whether it's /dev/console - * or the pysical device (e.g. /dev/sio) that's being closed. - * in either case, don't actually close the device unless - * both are closed. - */ - if (dev == cndev) { - /* the physical device is about to be closed */ - cn_phys_is_open = 0; - if (cn_is_open) { - if (cn_tp) { - /* perform a ttyhalfclose() */ - /* reset session and proc group */ - cn_tp->t_pgrp = NULL; - cn_tp->t_session = NULL; - } - return (0); - } - } else if (major(dev) != major(cndev)) { - /* the logical console is about to be closed */ - cn_is_open = 0; - if (cn_phys_is_open) - return (0); - dev = cndev; - } - if(cn_phys_close) - return ((*cn_phys_close)(dev, flag, mode, p)); - return (0); -} - -static int -cnread(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - if ((cn_tab == NULL) || cn_mute) - return (0); - dev = cn_tab->cn_dev; - return ((*devsw(dev)->d_read)(dev, uio, flag)); -} - -static int -cnwrite(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - if ((cn_tab == NULL) || cn_mute) { - uio->uio_resid = 0; /* dump the data */ - return (0); - } - if (constty) - dev = constty->t_dev; - else - dev = cn_tab->cn_dev; - return ((*devsw(dev)->d_write)(dev, uio, flag)); -} - -static int -cnioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; -{ - int error; - - if ((cn_tab == NULL) || cn_mute) - return (0); - /* - * Superuser can always use this to wrest control of console - * output from the "virtual" console. - */ - if (cmd == TIOCCONS && constty) { - error = suser(p); - if (error) - return (error); - constty = NULL; - return (0); - } - dev = cn_tab->cn_dev; - return ((*devsw(dev)->d_ioctl)(dev, cmd, data, flag, p)); -} - -static int -cnpoll(dev, events, p) - dev_t dev; - int events; - struct proc *p; -{ - if ((cn_tab == NULL) || cn_mute) - return (1); - - dev = cn_tab->cn_dev; - - return ((*devsw(dev)->d_poll)(dev, events, p)); -} - -int -cngetc() -{ - int c; - if ((cn_tab == NULL) || cn_mute) - return (-1); - c = (*cn_tab->cn_getc)(cn_tab->cn_dev); - if (c == '\r') c = '\n'; /* console input is always ICRNL */ - return (c); -} - -int -cncheckc() -{ - if ((cn_tab == NULL) || cn_mute) - return (-1); - return ((*cn_tab->cn_checkc)(cn_tab->cn_dev)); -} - -void -cnputc(c) - register int c; -{ - if ((cn_tab == NULL) || cn_mute) - return; - if (c) { - if (c == '\n') - (*cn_tab->cn_putc)(cn_tab->cn_dev, '\r'); - (*cn_tab->cn_putc)(cn_tab->cn_dev, c); - } -} - -static int cn_devsw_installed; - -static void -cn_drvinit(void *unused) -{ - - if( ! cn_devsw_installed ) { - cdevsw_add(&cn_cdevsw); - cn_devsw_installed = 1; -#ifdef DEVFS - cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "console"); -#endif - } -} - -SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL) - - diff --git a/sys/i386/i386/cons.h b/sys/i386/i386/cons.h deleted file mode 100644 index ea84d7e..0000000 --- a/sys/i386/i386/cons.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 - * $Id: cons.h,v 1.19 1999/01/09 14:07:37 bde Exp $ - */ - -#ifndef _MACHINE_CONS_H_ -#define _MACHINE_CONS_H_ - -struct consdev; -typedef void cn_probe_t __P((struct consdev *)); -typedef void cn_init_t __P((struct consdev *)); -typedef void cn_term_t __P((struct consdev *)); -typedef int cn_getc_t __P((dev_t)); -typedef int cn_checkc_t __P((dev_t)); -typedef void cn_putc_t __P((dev_t, int)); - -struct consdev { - cn_probe_t *cn_probe; - /* probe hardware and fill in consdev info */ - cn_init_t *cn_init; - /* turn on as console */ - cn_term_t *cn_term; - /* turn off as console */ - cn_getc_t *cn_getc; - /* kernel getchar interface */ - cn_checkc_t *cn_checkc; - /* kernel "return char if available" interface */ - cn_putc_t *cn_putc; - /* kernel putchar interface */ - struct tty *cn_tp; /* tty structure for console device */ - dev_t cn_dev; /* major/minor of device */ - short cn_pri; /* pecking order; the higher the better */ -}; - -/* values for cn_pri - reflect our policy for console selection */ -#define CN_DEAD 0 /* device doesn't exist */ -#define CN_NORMAL 1 /* device exists but is nothing special */ -#define CN_INTERNAL 2 /* "internal" bit-mapped display */ -#define CN_REMOTE 3 /* serial interface with remote bit set */ - -#ifdef KERNEL -extern struct linker_set cons_set; -extern int cons_unavail; - -#define CONS_DRIVER(name, probe, init, term, getc, checkc, putc) \ - static struct consdev name##_consdev = { \ - probe, init, term, getc, checkc, putc \ - }; \ - DATA_SET(cons_set, name##_consdev) - -/* Other kernel entry points. */ -int cncheckc __P((void)); -int cngetc __P((void)); -void cninit __P((void)); -void cninit_finish __P((void)); -void cnputc __P((int)); - -#endif /* KERNEL */ - -#endif /* !_MACHINE_CONS_H_ */ diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index 2998597..0ad6dfb 100644 --- a/sys/i386/i386/db_interface.c +++ b/sys/i386/i386/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.43 1998/12/28 23:02:56 msmith Exp $ + * $Id: db_interface.c,v 1.44 1999/04/28 01:03:17 luoqi Exp $ */ /* @@ -32,8 +32,8 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/reboot.h> +#include <sys/cons.h> -#include <machine/cons.h> #include <machine/cpu.h> #ifdef SMP #include <machine/smp.h> diff --git a/sys/i386/i386/i386-gdbstub.c b/sys/i386/i386/i386-gdbstub.c index 40530bf..a2323ce 100644 --- a/sys/i386/i386/i386-gdbstub.c +++ b/sys/i386/i386/i386-gdbstub.c @@ -95,8 +95,7 @@ #include <sys/param.h> #include <sys/reboot.h> #include <sys/systm.h> - -#include <machine/cons.h> +#include <sys/cons.h> #include <ddb/ddb.h> diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index c0dc2eb..a74c108 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.356 1999/07/19 23:36:30 peter Exp $ + * $Id: machdep.c,v 1.357 1999/07/29 01:49:18 msmith Exp $ */ #include "apm.h" @@ -97,6 +97,7 @@ #include <sys/user.h> #include <sys/exec.h> +#include <sys/cons.h> #include <ddb/ddb.h> @@ -106,7 +107,6 @@ #include <machine/reg.h> #include <machine/clock.h> #include <machine/specialreg.h> -#include <machine/cons.h> #include <machine/bootinfo.h> #include <machine/ipl.h> #include <machine/md_var.h> diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index e81efef..969cd08 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.105 1999/06/23 23:02:38 msmith Exp $ + * $Id: mp_machdep.c,v 1.106 1999/07/20 06:52:26 msmith Exp $ */ #include "opt_smp.h" @@ -45,6 +45,7 @@ #ifdef BETTER_CLOCK #include <sys/dkstat.h> #endif +#include <sys/cons.h> /* cngetc() */ #include <vm/vm.h> #include <vm/vm_param.h> @@ -73,8 +74,6 @@ #include <machine/cputypes.h> #include <machine/globaldata.h> -#include <i386/i386/cons.h> /* cngetc() */ - #if defined(APIC_IO) #include <machine/md_var.h> /* setidt() */ #include <i386/isa/icu.h> /* IPIs */ diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c index e81efef..969cd08 100644 --- a/sys/i386/i386/mptable.c +++ b/sys/i386/i386/mptable.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.105 1999/06/23 23:02:38 msmith Exp $ + * $Id: mp_machdep.c,v 1.106 1999/07/20 06:52:26 msmith Exp $ */ #include "opt_smp.h" @@ -45,6 +45,7 @@ #ifdef BETTER_CLOCK #include <sys/dkstat.h> #endif +#include <sys/cons.h> /* cngetc() */ #include <vm/vm.h> #include <vm/vm_param.h> @@ -73,8 +74,6 @@ #include <machine/cputypes.h> #include <machine/globaldata.h> -#include <i386/i386/cons.h> /* cngetc() */ - #if defined(APIC_IO) #include <machine/md_var.h> /* setidt() */ #include <i386/isa/icu.h> /* IPIs */ diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c index 1c8d8f6..188e20b 100644 --- a/sys/i386/i386/tsc.c +++ b/sys/i386/i386/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.141 1999/07/28 20:22:30 msmith Exp $ + * $Id: clock.c,v 1.142 1999/07/29 01:20:47 green Exp $ */ /* @@ -59,10 +59,10 @@ #include <sys/lock.h> #endif #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/clock.h> #ifdef CLK_CALIBRATION_LOOP -#include <machine/cons.h> #endif #include <machine/cputypes.h> #include <machine/frame.h> diff --git a/sys/i386/i386/userconfig.c b/sys/i386/i386/userconfig.c index 85360f0..ed08d90 100644 --- a/sys/i386/i386/userconfig.c +++ b/sys/i386/i386/userconfig.c @@ -46,7 +46,7 @@ ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** - ** $Id: userconfig.c,v 1.149 1999/07/25 04:32:46 wpaul Exp $ + ** $Id: userconfig.c,v 1.150 1999/07/25 13:16:06 cracauer Exp $ **/ /** @@ -116,8 +116,8 @@ #include <sys/linker.h> #include <sys/sysctl.h> #include <sys/bus.h> +#include <sys/cons.h> -#include <machine/cons.h> #include <machine/md_var.h> #include <machine/limits.h> @@ -2544,7 +2544,7 @@ visuserconfig(void) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: userconfig.c,v 1.149 1999/07/25 04:32:46 wpaul Exp $ + * $Id: userconfig.c,v 1.150 1999/07/25 13:16:06 cracauer Exp $ */ #include "scbus.h" diff --git a/sys/i386/include/cons.h b/sys/i386/include/cons.h deleted file mode 100644 index faa17d1..0000000 --- a/sys/i386/include/cons.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Console support headers should be in <machine/cons.h> since MI software - * needs to access these functions. In the mean time, just include the - * header where it sits. - * - * $Id$ - */ -#include <i386/i386/cons.h> diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h index e81efef..969cd08 100644 --- a/sys/i386/include/mptable.h +++ b/sys/i386/include/mptable.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.105 1999/06/23 23:02:38 msmith Exp $ + * $Id: mp_machdep.c,v 1.106 1999/07/20 06:52:26 msmith Exp $ */ #include "opt_smp.h" @@ -45,6 +45,7 @@ #ifdef BETTER_CLOCK #include <sys/dkstat.h> #endif +#include <sys/cons.h> /* cngetc() */ #include <vm/vm.h> #include <vm/vm_param.h> @@ -73,8 +74,6 @@ #include <machine/cputypes.h> #include <machine/globaldata.h> -#include <i386/i386/cons.h> /* cngetc() */ - #if defined(APIC_IO) #include <machine/md_var.h> /* setidt() */ #include <i386/isa/icu.h> /* IPIs */ diff --git a/sys/i386/isa/bs/bshw.c b/sys/i386/isa/bs/bshw.c index 2cfe064..7c97b32 100644 --- a/sys/i386/isa/bs/bshw.c +++ b/sys/i386/isa/bs/bshw.c @@ -43,7 +43,7 @@ #include <i386/isa/bs/bsif.h> #include <i386/isa/bs/bshw.lst> #include <machine/clock.h> -#include <i386/i386/cons.h> +#include <sys/cons.h> #endif static struct bs_softc *gbsc; diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 1c8d8f6..188e20b 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.141 1999/07/28 20:22:30 msmith Exp $ + * $Id: clock.c,v 1.142 1999/07/29 01:20:47 green Exp $ */ /* @@ -59,10 +59,10 @@ #include <sys/lock.h> #endif #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/clock.h> #ifdef CLK_CALIBRATION_LOOP -#include <machine/cons.h> #endif #include <machine/cputypes.h> #include <machine/frame.h> diff --git a/sys/i386/isa/pcvt/pcvt_hdr.h b/sys/i386/isa/pcvt/pcvt_hdr.h index 8603f37..07851aa 100644 --- a/sys/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/i386/isa/pcvt/pcvt_hdr.h @@ -141,7 +141,7 @@ #if PCVT_NETBSD > 9 #include "dev/cons.h" #elif PCVT_FREEBSD >= 200 -#include <machine/cons.h> +#include <sys/cons.h> #else #include "i386/i386/cons.h" #endif diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index 6a5100a..07ffd23 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.198 1999/05/30 16:52:29 phk Exp $ + * $Id: wd.c,v 1.199 1999/05/31 11:26:36 phk Exp $ */ /* TODO: @@ -79,12 +79,12 @@ #include <sys/buf.h> #include <sys/devicestat.h> #include <sys/malloc.h> +#include <sys/cons.h> #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ #include <machine/bootinfo.h> #include <machine/clock.h> -#include <machine/cons.h> #include <machine/md_var.h> #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 1c8d8f6..188e20b 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.141 1999/07/28 20:22:30 msmith Exp $ + * $Id: clock.c,v 1.142 1999/07/29 01:20:47 green Exp $ */ /* @@ -59,10 +59,10 @@ #include <sys/lock.h> #endif #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/clock.h> #ifdef CLK_CALIBRATION_LOOP -#include <machine/cons.h> #endif #include <machine/cputypes.h> #include <machine/frame.h> diff --git a/sys/isa/sio.c b/sys/isa/sio.c index d36318d..d6d8fd4 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.252 1999/07/04 14:58:35 phk Exp $ + * $Id: sio.c,v 1.253 1999/08/08 20:25:14 phk Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -2624,7 +2624,7 @@ disc_optim(tp, t, com) /* * Following are all routines needed for SIO to act as console */ -#include <machine/cons.h> +#include <sys/cons.h> struct siocnstate { u_char dlbl; diff --git a/sys/isa/syscons_isa.c b/sys/isa/syscons_isa.c index 1104e26..499a902 100644 --- a/sys/isa/syscons_isa.c +++ b/sys/isa/syscons_isa.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons_isa.c,v 1.5 1999/06/22 14:13:41 yokota Exp $ + * $Id: syscons_isa.c,v 1.6 1999/06/24 09:06:48 yokota Exp $ */ #include "sc.h" @@ -36,8 +36,8 @@ #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> +#include <sys/cons.h> -#include <machine/cons.h> #include <machine/console.h> #ifdef __i386__ diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 8cc58ca..5b18718 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 - * $Id: kern_shutdown.c,v 1.56 1999/07/20 20:55:50 green Exp $ + * $Id: kern_shutdown.c,v 1.57 1999/07/20 21:29:13 green Exp $ */ #include "opt_ddb.h" @@ -57,10 +57,10 @@ #include <sys/sysctl.h> #include <sys/conf.h> #include <sys/sysproto.h> +#include <sys/cons.h> #include <machine/pcb.h> #include <machine/clock.h> -#include <machine/cons.h> #include <machine/md_var.h> #ifdef SMP #include <machine/smp.h> /* smp_active, cpuid */ diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 69bd3a8..932b6e5 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 - * $Id: subr_prf.c,v 1.58 1999/07/24 09:34:12 dfr Exp $ + * $Id: subr_prf.c,v 1.59 1999/08/07 20:13:32 green Exp $ */ #include <sys/param.h> @@ -48,7 +48,7 @@ #include <sys/tty.h> #include <sys/tprintf.h> #include <sys/syslog.h> -#include <machine/cons.h> +#include <sys/cons.h> /* * Note that stdarg.h and the ANSI style va_start macro is used for both diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index e81efef..969cd08 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.105 1999/06/23 23:02:38 msmith Exp $ + * $Id: mp_machdep.c,v 1.106 1999/07/20 06:52:26 msmith Exp $ */ #include "opt_smp.h" @@ -45,6 +45,7 @@ #ifdef BETTER_CLOCK #include <sys/dkstat.h> #endif +#include <sys/cons.h> /* cngetc() */ #include <vm/vm.h> #include <vm/vm_param.h> @@ -73,8 +74,6 @@ #include <machine/cputypes.h> #include <machine/globaldata.h> -#include <i386/i386/cons.h> /* cngetc() */ - #if defined(APIC_IO) #include <machine/md_var.h> /* setidt() */ #include <i386/isa/icu.h> /* IPIs */ diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 92544f8..5d57712 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.69 1999/06/26 12:19:03 peter Exp $ + * $Id: tty_cons.c,v 1.70 1999/07/24 09:41:06 yokota Exp $ */ #include "opt_devfs.h" @@ -53,9 +53,9 @@ #include <sys/proc.h> #include <sys/tty.h> #include <sys/uio.h> +#include <sys/cons.h> #include <machine/cpu.h> -#include <machine/cons.h> static d_open_t cnopen; static d_close_t cnclose; @@ -435,21 +435,15 @@ cnputc(c) } } -static int cn_devsw_installed; - static void cn_drvinit(void *unused) { - if( ! cn_devsw_installed ) { - cdevsw_add(&cn_cdevsw); - cn_devsw_installed = 1; + cdevsw_add(&cn_cdevsw); #ifdef DEVFS - cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR, - UID_ROOT, GID_WHEEL, 0600, - "console"); + cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR, + UID_ROOT, GID_WHEEL, 0600, "console"); #endif - } } SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL) diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index 4676b74..eb96363 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.73 1999/07/26 12:21:09 kato Exp $ + * $Id: clock.c,v 1.74 1999/07/30 11:43:10 kato Exp $ */ /* @@ -63,10 +63,10 @@ #include <sys/lock.h> #endif #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/clock.h> #ifdef CLK_CALIBRATION_LOOP -#include <machine/cons.h> #endif #include <machine/cputypes.h> #include <machine/frame.h> diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c index 4676b74..eb96363 100644 --- a/sys/pc98/cbus/pcrtc.c +++ b/sys/pc98/cbus/pcrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.73 1999/07/26 12:21:09 kato Exp $ + * $Id: clock.c,v 1.74 1999/07/30 11:43:10 kato Exp $ */ /* @@ -63,10 +63,10 @@ #include <sys/lock.h> #endif #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/clock.h> #ifdef CLK_CALIBRATION_LOOP -#include <machine/cons.h> #endif #include <machine/cputypes.h> #include <machine/frame.h> diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index fb4928f..2689707 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.98 1999/06/24 10:51:35 kato Exp $ + * $Id: sio.c,v 1.99 1999/07/04 14:58:45 phk Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -3909,7 +3909,7 @@ disc_optim(tp, t, com) /* * Following are all routines needed for SIO to act as console */ -#include <machine/cons.h> +#include <sys/cons.h> struct siocnstate { u_char dlbl; diff --git a/sys/pc98/cbus/syscons_cbus.c b/sys/pc98/cbus/syscons_cbus.c index 9db33ac..51d0917 100644 --- a/sys/pc98/cbus/syscons_cbus.c +++ b/sys/pc98/cbus/syscons_cbus.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons_pc98.c,v 1.2 1999/06/24 12:13:08 kato Exp $ + * $Id: syscons_pc98.c,v 1.3 1999/07/03 08:50:45 kato Exp $ */ #include "sc.h" @@ -37,7 +37,7 @@ #include <sys/module.h> #include <sys/bus.h> -#include <machine/cons.h> +#include <sys/cons.h> #include <machine/console.h> #include <machine/clock.h> diff --git a/sys/pc98/conf/files.pc98 b/sys/pc98/conf/files.pc98 index 719f7c7..ca228d2 100644 --- a/sys/pc98/conf/files.pc98 +++ b/sys/pc98/conf/files.pc98 @@ -3,7 +3,7 @@ # # modified for PC-9801 # -# $Id: files.pc98,v 1.103 1999/07/30 11:40:55 kato Exp $ +# $Id: files.pc98,v 1.104 1999/08/08 11:12:00 kato Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -64,7 +64,6 @@ i386/i386/autoconf.c standard i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/busdma_machdep.c standard -i386/i386/cons.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 9c0728e..ff54786 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.127 1999/07/26 12:14:00 kato Exp $ + * $Id: machdep.c,v 1.128 1999/07/30 11:42:05 kato Exp $ */ #include "apm.h" @@ -97,6 +97,7 @@ #include <sys/user.h> #include <sys/exec.h> +#include <sys/cons.h> #include <ddb/ddb.h> @@ -106,7 +107,6 @@ #include <machine/reg.h> #include <machine/clock.h> #include <machine/specialreg.h> -#include <machine/cons.h> #include <machine/bootinfo.h> #include <machine/ipl.h> #include <machine/md_var.h> diff --git a/sys/pc98/i386/userconfig.c b/sys/pc98/i386/userconfig.c index ab32545..0760e21 100644 --- a/sys/pc98/i386/userconfig.c +++ b/sys/pc98/i386/userconfig.c @@ -46,7 +46,7 @@ ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** - ** $Id: userconfig.c,v 1.84 1999/07/09 12:52:09 kato Exp $ + ** $Id: userconfig.c,v 1.85 1999/07/26 12:14:59 kato Exp $ **/ /** @@ -120,8 +120,8 @@ #include <sys/linker.h> #include <sys/sysctl.h> #include <sys/bus.h> +#include <sys/cons.h> -#include <machine/cons.h> #include <machine/md_var.h> #include <machine/limits.h> @@ -2560,7 +2560,7 @@ visuserconfig(void) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: userconfig.c,v 1.84 1999/07/09 12:52:09 kato Exp $ + * $Id: userconfig.c,v 1.85 1999/07/26 12:14:59 kato Exp $ */ #include "scbus.h" diff --git a/sys/pc98/pc98/clock.c b/sys/pc98/pc98/clock.c index 4676b74..eb96363 100644 --- a/sys/pc98/pc98/clock.c +++ b/sys/pc98/pc98/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.73 1999/07/26 12:21:09 kato Exp $ + * $Id: clock.c,v 1.74 1999/07/30 11:43:10 kato Exp $ */ /* @@ -63,10 +63,10 @@ #include <sys/lock.h> #endif #include <sys/sysctl.h> +#include <sys/cons.h> #include <machine/clock.h> #ifdef CLK_CALIBRATION_LOOP -#include <machine/cons.h> #endif #include <machine/cputypes.h> #include <machine/frame.h> diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 9c0728e..ff54786 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.127 1999/07/26 12:14:00 kato Exp $ + * $Id: machdep.c,v 1.128 1999/07/30 11:42:05 kato Exp $ */ #include "apm.h" @@ -97,6 +97,7 @@ #include <sys/user.h> #include <sys/exec.h> +#include <sys/cons.h> #include <ddb/ddb.h> @@ -106,7 +107,6 @@ #include <machine/reg.h> #include <machine/clock.h> #include <machine/specialreg.h> -#include <machine/cons.h> #include <machine/bootinfo.h> #include <machine/ipl.h> #include <machine/md_var.h> diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index fb4928f..2689707 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.98 1999/06/24 10:51:35 kato Exp $ + * $Id: sio.c,v 1.99 1999/07/04 14:58:45 phk Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -3909,7 +3909,7 @@ disc_optim(tp, t, com) /* * Following are all routines needed for SIO to act as console */ -#include <machine/cons.h> +#include <sys/cons.h> struct siocnstate { u_char dlbl; diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index e5455137..3d679b7 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.123 1999/06/24 12:13:06 kato Exp $ + * $Id: syscons.c,v 1.124 1999/07/08 12:53:38 kato Exp $ */ #include "sc.h" @@ -52,7 +52,7 @@ #endif #include <machine/clock.h> -#include <machine/cons.h> +#include <sys/cons.h> #include <machine/console.h> #include <machine/psl.h> #include <machine/pc/display.h> diff --git a/sys/pc98/pc98/syscons_pc98.c b/sys/pc98/pc98/syscons_pc98.c index 9db33ac..51d0917 100644 --- a/sys/pc98/pc98/syscons_pc98.c +++ b/sys/pc98/pc98/syscons_pc98.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons_pc98.c,v 1.2 1999/06/24 12:13:08 kato Exp $ + * $Id: syscons_pc98.c,v 1.3 1999/07/03 08:50:45 kato Exp $ */ #include "sc.h" @@ -37,7 +37,7 @@ #include <sys/module.h> #include <sys/bus.h> -#include <machine/cons.h> +#include <sys/cons.h> #include <machine/console.h> #include <machine/clock.h> diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index 8a7c163..ae8e02e 100644 --- a/sys/pc98/pc98/wd.c +++ b/sys/pc98/pc98/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.83 1999/05/30 16:53:26 phk Exp $ + * $Id: wd.c,v 1.84 1999/05/31 11:28:44 phk Exp $ */ /* TODO: @@ -84,7 +84,7 @@ #endif /*DEVFS*/ #include <machine/bootinfo.h> #include <machine/clock.h> -#include <machine/cons.h> +#include <sys/cons.h> #include <machine/md_var.h> #ifdef PC98 #include <pc98/pc98/pc98.h> diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 22682b7..91feed0 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_object.c,v 1.160 1999/07/16 05:11:36 alc Exp $ + * $Id: vm_object.c,v 1.161 1999/08/01 06:05:09 alc Exp $ */ /* @@ -1523,7 +1523,7 @@ vm_object_coalesce(prev_object, prev_pindex, prev_size, next_size) #ifdef DDB #include <sys/kernel.h> -#include <machine/cons.h> +#include <sys/cons.h> #include <ddb/ddb.h> |