diff options
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/cons.c | 20 | ||||
| -rw-r--r-- | sys/dev/cons.h | 4 |
2 files changed, 21 insertions, 3 deletions
diff --git a/sys/dev/cons.c b/sys/dev/cons.c index eef38cbbc51..5763736654b 100644 --- a/sys/dev/cons.c +++ b/sys/dev/cons.c @@ -1,4 +1,4 @@ -/* $NetBSD: cons.c,v 1.79 2022/08/22 00:20:56 riastradh Exp $ */ +/* $NetBSD: cons.c,v 1.80 2022/10/03 19:12:29 riastradh Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.79 2022/08/22 00:20:56 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.80 2022/10/03 19:12:29 riastradh Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -87,6 +87,22 @@ struct tty *constty = NULL; /* virtual console output device */ struct consdev *cn_tab; /* physical console device info */ struct vnode *cn_devvp[2]; /* vnode for underlying device. */ +void +cn_set_tab(struct consdev *tab) +{ + + /* + * This is a point that we should have KASSERT(cold) or add + * synchronization in case this can happen after cold boot. + * However, cn_tab initialization is so critical to any + * diagnostics or debugging that we need to tread carefully + * about introducing new ways to crash. So let's put the + * assertion in only after we've audited most or all of the + * cn_tab updates. + */ + cn_tab = tab; +} + int cnopen(dev_t dev, int flag, int mode, struct lwp *l) { diff --git a/sys/dev/cons.h b/sys/dev/cons.h index 7ccdc5d6e74..9fed7cb0eb0 100644 --- a/sys/dev/cons.h +++ b/sys/dev/cons.h @@ -1,4 +1,4 @@ -/* $NetBSD: cons.h,v 1.28 2022/08/28 09:52:43 riastradh Exp $ */ +/* $NetBSD: cons.h,v 1.29 2022/10/03 19:12:29 riastradh Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -76,6 +76,8 @@ struct consdev { extern struct consdev constab[]; extern struct consdev *cn_tab; +void cn_set_tab(struct consdev *); + void cninit(void); int cngetc(void); int cngetsn(char *, int); |
