diff options
| author | Bruce Evans <bde@FreeBSD.org> | 1995-09-10 18:57:26 +0000 |
|---|---|---|
| committer | Bruce Evans <bde@FreeBSD.org> | 1995-09-10 18:57:26 +0000 |
| commit | f2cb5630d010a45468009559e99b322a5e9c1ff2 (patch) | |
| tree | cc5d35112b3b28ec65cb8336b5a3a765378bdd13 | |
| parent | 26f1808769d099fa0f3f78d0d12531cbddc3feb9 (diff) | |
Notes
| -rw-r--r-- | sys/amd64/amd64/autoconf.c | 23 | ||||
| -rw-r--r-- | sys/i386/i386/autoconf.c | 23 | ||||
| -rw-r--r-- | sys/i386/i386/cons.c | 58 | ||||
| -rw-r--r-- | sys/i386/i386/cons.h | 3 | ||||
| -rw-r--r-- | sys/kern/tty_cons.c | 58 | ||||
| -rw-r--r-- | sys/sys/cons.h | 3 |
6 files changed, 110 insertions, 58 deletions
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c index ecf5def4f8ed2..e3b0770aad50e 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.37 1995/09/03 05:43:00 julian Exp $ + * $Id: autoconf.c,v 1.38 1995/09/09 18:09:41 davidg Exp $ */ /* @@ -55,9 +55,17 @@ #include <sys/kernel.h> #include <sys/mount.h> /* mountrootvfsops, struct vfsops*/ +#include <machine/cons.h> #include <machine/md_var.h> #include <machine/pte.h> +static void configure __P((void *)); +SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure, NULL) + +int find_cdrom_root __P((void *)); +void configure_start __P((void)); +void configure_finish __P((void)); + static void setroot(void); /* @@ -128,7 +136,7 @@ find_cdrom_root(dummy) rootdev = makedev(try_cdrom[k].major,j*8); printf("trying rootdev=0x%lx (%s%d)\n", rootdev, try_cdrom[k].name,j); - i = (*cd9660_mountroot)(NULL); + i = (*cd9660_mountroot)((void *)NULL); if (!i) return i; } return EINVAL; @@ -159,8 +167,8 @@ configure_finish() /* * Determine i/o configuration for a machine. */ -void -configure(dummy) /* arg not used */ +static void +configure(dummy) void *dummy; { @@ -185,6 +193,8 @@ configure(dummy) /* arg not used */ configure_finish(); + cninit_finish(); + #ifdef MFS_ROOT mfs_initminiroot(mfs_root); /* XXX UGLY*/ #endif /* MFS_ROOT */ @@ -241,11 +251,6 @@ configure(dummy) /* arg not used */ setconf(); cold = 0; } -/* - * Add a SYSINIT entry so that Configure gets called at the right time. - */ -SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure, NULL) - int setdumpdev(dev) diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index ecf5def4f8ed2..e3b0770aad50e 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.37 1995/09/03 05:43:00 julian Exp $ + * $Id: autoconf.c,v 1.38 1995/09/09 18:09:41 davidg Exp $ */ /* @@ -55,9 +55,17 @@ #include <sys/kernel.h> #include <sys/mount.h> /* mountrootvfsops, struct vfsops*/ +#include <machine/cons.h> #include <machine/md_var.h> #include <machine/pte.h> +static void configure __P((void *)); +SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure, NULL) + +int find_cdrom_root __P((void *)); +void configure_start __P((void)); +void configure_finish __P((void)); + static void setroot(void); /* @@ -128,7 +136,7 @@ find_cdrom_root(dummy) rootdev = makedev(try_cdrom[k].major,j*8); printf("trying rootdev=0x%lx (%s%d)\n", rootdev, try_cdrom[k].name,j); - i = (*cd9660_mountroot)(NULL); + i = (*cd9660_mountroot)((void *)NULL); if (!i) return i; } return EINVAL; @@ -159,8 +167,8 @@ configure_finish() /* * Determine i/o configuration for a machine. */ -void -configure(dummy) /* arg not used */ +static void +configure(dummy) void *dummy; { @@ -185,6 +193,8 @@ configure(dummy) /* arg not used */ configure_finish(); + cninit_finish(); + #ifdef MFS_ROOT mfs_initminiroot(mfs_root); /* XXX UGLY*/ #endif /* MFS_ROOT */ @@ -241,11 +251,6 @@ configure(dummy) /* arg not used */ setconf(); cold = 0; } -/* - * Add a SYSINIT entry so that Configure gets called at the right time. - */ -SYSINIT(configure, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure, NULL) - int setdumpdev(dev) diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c index a47b6cea07666..7cddb5e1a2354 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.31 1995/09/03 05:43:01 julian Exp $ + * $Id: cons.c,v 1.32 1995/09/09 18:09:44 davidg Exp $ */ #include <sys/param.h> @@ -76,40 +76,65 @@ 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 +#ifdef DEVFS +#include <sys/kernel.h> #include <sys/devfsext.h> -#include "sys/kernel.h" -void cndev_init(void *data) /* data not used */ +static void cndev_init __P((void *)); +SYSINIT(cndev, SI_SUB_DEVFS, SI_ORDER_ANY, cndev_init, NULL) + +static void +cndev_init(dummy) + void *dummy; { void * x; /* path name devsw minor type uid gid perm*/ x=dev_add("/misc", "console", cnopen, 0, DV_CHR, 0, 0, 0640); } -SYSINIT(cndev,SI_SUB_DEVFS, SI_ORDER_ANY, cndev_init, NULL) -#endif /*DEVFS*/ +#endif /* DEVFS */ void cninit() { - register struct consdev *cp; - struct cdevsw *cdp; + struct consdev *best_cp, *cp; /* - * Collect information about all possible consoles - * and find the one with highest priority + * Find the first console with the highest priority. */ + best_cp = NULL; for (cp = constab; cp->cn_probe; cp++) { (*cp->cn_probe)(cp); if (cp->cn_pri > CN_DEAD && - (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri)) - cn_tab = cp; + (best_cp == NULL || cp->cn_pri > best_cp->cn_pri)) + best_cp = cp; } + /* - * No console, give up. + * If no console, give up. */ - if ((cp = cn_tab) == NULL) + if (best_cp == NULL) { + cn_tab = best_cp; + return; + } + + /* + * Initialize console, then attach to it. This ordering allows + * debugging using the previous console, if any. + * XXX if there was a previous console, then its driver should + * be informed when we forget about it. + */ + (*best_cp->cn_init)(best_cp); + cn_tab = best_cp; +} + +void +cninit_finish() +{ + struct cdevsw *cdp; + + if (cn_tab == NULL) return; + /* * Hook the open and close functions. */ @@ -127,10 +152,6 @@ cninit() * cn_tty to the wrong value) for a year or two. */ cn_tty = cn_tp; - /* - * Turn on console - */ - (*cp->cn_init)(cp); } int @@ -243,7 +264,6 @@ cnioctl(dev, cmd, data, flag, p) return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p)); } -/*ARGSUSED*/ int cnselect(dev, rw, p) dev_t dev; diff --git a/sys/i386/i386/cons.h b/sys/i386/i386/cons.h index d99c3e5b06ea3..35d919ae5819b 100644 --- a/sys/i386/i386/cons.h +++ b/sys/i386/i386/cons.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 - * $Id: cons.h,v 1.8 1995/04/23 12:55:55 bde Exp $ + * $Id: cons.h,v 1.9 1995/04/24 16:43:01 bde Exp $ */ #ifndef _MACHINE_CONS_H_ @@ -110,6 +110,7 @@ extern int cnselect(dev_t, int, struct proc *); /* other kernel entry points */ extern void cninit(void); +extern void cninit_finish(void); extern int cngetc(void); extern int cncheckc(void); extern void cnputc(int); diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index a47b6cea07666..7cddb5e1a2354 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.31 1995/09/03 05:43:01 julian Exp $ + * $Id: cons.c,v 1.32 1995/09/09 18:09:44 davidg Exp $ */ #include <sys/param.h> @@ -76,40 +76,65 @@ 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 +#ifdef DEVFS +#include <sys/kernel.h> #include <sys/devfsext.h> -#include "sys/kernel.h" -void cndev_init(void *data) /* data not used */ +static void cndev_init __P((void *)); +SYSINIT(cndev, SI_SUB_DEVFS, SI_ORDER_ANY, cndev_init, NULL) + +static void +cndev_init(dummy) + void *dummy; { void * x; /* path name devsw minor type uid gid perm*/ x=dev_add("/misc", "console", cnopen, 0, DV_CHR, 0, 0, 0640); } -SYSINIT(cndev,SI_SUB_DEVFS, SI_ORDER_ANY, cndev_init, NULL) -#endif /*DEVFS*/ +#endif /* DEVFS */ void cninit() { - register struct consdev *cp; - struct cdevsw *cdp; + struct consdev *best_cp, *cp; /* - * Collect information about all possible consoles - * and find the one with highest priority + * Find the first console with the highest priority. */ + best_cp = NULL; for (cp = constab; cp->cn_probe; cp++) { (*cp->cn_probe)(cp); if (cp->cn_pri > CN_DEAD && - (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri)) - cn_tab = cp; + (best_cp == NULL || cp->cn_pri > best_cp->cn_pri)) + best_cp = cp; } + /* - * No console, give up. + * If no console, give up. */ - if ((cp = cn_tab) == NULL) + if (best_cp == NULL) { + cn_tab = best_cp; + return; + } + + /* + * Initialize console, then attach to it. This ordering allows + * debugging using the previous console, if any. + * XXX if there was a previous console, then its driver should + * be informed when we forget about it. + */ + (*best_cp->cn_init)(best_cp); + cn_tab = best_cp; +} + +void +cninit_finish() +{ + struct cdevsw *cdp; + + if (cn_tab == NULL) return; + /* * Hook the open and close functions. */ @@ -127,10 +152,6 @@ cninit() * cn_tty to the wrong value) for a year or two. */ cn_tty = cn_tp; - /* - * Turn on console - */ - (*cp->cn_init)(cp); } int @@ -243,7 +264,6 @@ cnioctl(dev, cmd, data, flag, p) return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p)); } -/*ARGSUSED*/ int cnselect(dev, rw, p) dev_t dev; diff --git a/sys/sys/cons.h b/sys/sys/cons.h index d99c3e5b06ea3..35d919ae5819b 100644 --- a/sys/sys/cons.h +++ b/sys/sys/cons.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 - * $Id: cons.h,v 1.8 1995/04/23 12:55:55 bde Exp $ + * $Id: cons.h,v 1.9 1995/04/24 16:43:01 bde Exp $ */ #ifndef _MACHINE_CONS_H_ @@ -110,6 +110,7 @@ extern int cnselect(dev_t, int, struct proc *); /* other kernel entry points */ extern void cninit(void); +extern void cninit_finish(void); extern int cngetc(void); extern int cncheckc(void); extern void cnputc(int); |
