diff options
author | julian <julian@FreeBSD.org> | 1996-10-16 00:19:40 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1996-10-16 00:19:40 +0000 |
commit | a81c502ffc241c0469d2dc38a4049252ec645ed0 (patch) | |
tree | 8589eebd090c5861ef119a8b470fd3455a7aefd0 /sys | |
parent | 09ecea6256343d7919a1a4c0f715ae15056afb4d (diff) | |
download | FreeBSD-src-a81c502ffc241c0469d2dc38a4049252ec645ed0.zip FreeBSD-src-a81c502ffc241c0469d2dc38a4049252ec645ed0.tar.gz |
Add support for embedded operation withou console
The boot.c patch is applied only to teh JULIAN_HACK branch
the muted console is controlable by a sysctl variable kern.consmute
Diffstat (limited to 'sys')
-rw-r--r-- | sys/i386/i386/cons.c | 31 | ||||
-rw-r--r-- | sys/kern/tty_cons.c | 31 | ||||
-rw-r--r-- | sys/sys/reboot.h | 4 | ||||
-rw-r--r-- | sys/sys/sysctl.h | 6 |
4 files changed, 53 insertions, 19 deletions
diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c index 3b25fc8..38a0898 100644 --- a/sys/i386/i386/cons.c +++ b/sys/i386/i386/cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.46 1996/05/01 03:32:46 bde Exp $ + * $Id: cons.c,v 1.47 1996/09/14 04:25:32 bde Exp $ */ #include <sys/param.h> @@ -46,6 +46,7 @@ #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> @@ -88,6 +89,8 @@ struct tty *constty = 0; /* virtual console output device */ static dev_t cn_dev_t; SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD, &cn_dev_t, sizeof cn_dev_t, "T,dev_t", ""); +static int cn_mute; +SYSCTL_INT(_kern, KERN_CONSMUTE, consmute, CTLFLAG_RW, &cn_mute, 0, ""); int cons_unavail = 0; /* XXX: * physical console not available for @@ -121,6 +124,18 @@ cninit() } /* + * 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) { @@ -220,7 +235,7 @@ cnread(dev, uio, flag) struct uio *uio; int flag; { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (0); dev = cn_tab->cn_dev; return ((*cdevsw[major(dev)]->d_read)(dev, uio, flag)); @@ -232,7 +247,7 @@ cnwrite(dev, uio, flag) struct uio *uio; int flag; { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (0); if (constty) dev = constty->t_dev; @@ -251,7 +266,7 @@ cnioctl(dev, cmd, data, flag, p) { int error; - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (0); /* * Superuser can always use this to wrest control of console @@ -274,7 +289,7 @@ cnselect(dev, rw, p) int rw; struct proc *p; { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (1); dev = cn_tab->cn_dev; @@ -286,7 +301,7 @@ int cngetc() { int c; - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (0); c = (*cn_tab->cn_getc)(cn_tab->cn_dev); if (c == '\r') c = '\n'; /* console input is always ICRNL */ @@ -296,7 +311,7 @@ cngetc() int cncheckc() { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (-1); return ((*cn_tab->cn_checkc)(cn_tab->cn_dev)); } @@ -305,7 +320,7 @@ void cnputc(c) register int c; { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return; if (c) { if (c == '\n') diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 3b25fc8..38a0898 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.46 1996/05/01 03:32:46 bde Exp $ + * $Id: cons.c,v 1.47 1996/09/14 04:25:32 bde Exp $ */ #include <sys/param.h> @@ -46,6 +46,7 @@ #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> @@ -88,6 +89,8 @@ struct tty *constty = 0; /* virtual console output device */ static dev_t cn_dev_t; SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD, &cn_dev_t, sizeof cn_dev_t, "T,dev_t", ""); +static int cn_mute; +SYSCTL_INT(_kern, KERN_CONSMUTE, consmute, CTLFLAG_RW, &cn_mute, 0, ""); int cons_unavail = 0; /* XXX: * physical console not available for @@ -121,6 +124,18 @@ cninit() } /* + * 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) { @@ -220,7 +235,7 @@ cnread(dev, uio, flag) struct uio *uio; int flag; { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (0); dev = cn_tab->cn_dev; return ((*cdevsw[major(dev)]->d_read)(dev, uio, flag)); @@ -232,7 +247,7 @@ cnwrite(dev, uio, flag) struct uio *uio; int flag; { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (0); if (constty) dev = constty->t_dev; @@ -251,7 +266,7 @@ cnioctl(dev, cmd, data, flag, p) { int error; - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (0); /* * Superuser can always use this to wrest control of console @@ -274,7 +289,7 @@ cnselect(dev, rw, p) int rw; struct proc *p; { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (1); dev = cn_tab->cn_dev; @@ -286,7 +301,7 @@ int cngetc() { int c; - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (0); c = (*cn_tab->cn_getc)(cn_tab->cn_dev); if (c == '\r') c = '\n'; /* console input is always ICRNL */ @@ -296,7 +311,7 @@ cngetc() int cncheckc() { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return (-1); return ((*cn_tab->cn_checkc)(cn_tab->cn_dev)); } @@ -305,7 +320,7 @@ void cnputc(c) register int c; { - if (cn_tab == NULL) + if ((cn_tab == NULL) || cn_mute) return; if (c) { if (c == '\n') diff --git a/sys/sys/reboot.h b/sys/sys/reboot.h index d4b5ccb..0a12e4e 100644 --- a/sys/sys/reboot.h +++ b/sys/sys/reboot.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)reboot.h 8.3 (Berkeley) 12/13/94 - * $Id: reboot.h,v 1.12 1996/08/22 03:50:32 julian Exp $ + * $Id: reboot.h,v 1.13 1996/08/27 19:45:58 pst Exp $ */ #ifndef _SYS_REBOOT_H_ @@ -59,6 +59,8 @@ #define RB_CDROM 0x2000 /* use cdrom as root */ #define RB_POWEROFF 0x4000 /* if you can, turn the power off */ #define RB_GDB 0x8000 /* use GDB remote debugger instead of DDB */ +#define RB_MUTE 0x10000 /* Come up with the console muted */ +#define RB_SELFTEST 0x20000 /* don't boot to normal operation, do selftest */ #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index b46d7b7..8076055 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 - * $Id: sysctl.h,v 1.45 1996/09/19 00:54:29 pst Exp $ + * $Id: sysctl.h,v 1.46 1996/10/07 04:32:42 pst Exp $ */ #ifndef _SYS_SYSCTL_H_ @@ -223,7 +223,8 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS; #define KERN_MAXSOCKBUF 31 /* int: max size of a socket buffer */ #define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */ #define KERN_USRSTACK 33 /* int: address of USRSTACK */ -#define KERN_MAXID 34 /* number of valid kern ids */ +#define KERN_CONSMUTE 34 /* Mute the console output? */ +#define KERN_MAXID 35 /* number of valid kern ids */ #define CTL_KERN_NAMES { \ { 0, 0 }, \ @@ -260,6 +261,7 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS; { "maxsockbuf", CTLTYPE_INT }, \ { "ps_strings", CTLTYPE_INT }, \ { "usrstack", CTLTYPE_INT }, \ + { "consmute", CTLTYPE_INT }, \ } /* |