Add a new cn_flags fields to struct consdev, the low-level console

definition structure.  Define one flag, CN_FLAG_NODEBUG, which
indicates the console driver cannot be used in the context of the
debugger.  This may be used, for example, if the console device
interacts with kernel services that cannot be used from the
debugger context, such as the network stack.  These drivers are
skipped over for calls to cn_checkc() and cn_putc(), and the
calling function simply moves on to the next available console.
This commit is contained in:
Robert Watson 2003-10-18 02:13:39 +00:00
parent 59571d2ba6
commit 90e6b5447f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121182
2 changed files with 14 additions and 6 deletions

View File

@ -538,9 +538,11 @@ cncheckc(void)
return (-1);
STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) {
cn = cnd->cnd_cn;
c = cn->cn_checkc(cn);
if (c != -1) {
return (c);
if (!db_active || (cn->cn_flags & CN_FLAG_NODEBUG)) {
c = cn->cn_checkc(cn);
if (c != -1) {
return (c);
}
}
}
return (-1);
@ -557,9 +559,11 @@ cnputc(int c)
return;
STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) {
cn = cnd->cnd_cn;
if (c == '\n')
cn->cn_putc(cn, '\r');
cn->cn_putc(cn, c);
if (!db_active || (cn->cn_flags & CN_FLAG_NODEBUG)) {
if (c == '\n')
cn->cn_putc(cn, '\r');
cn->cn_putc(cn, c);
}
}
#ifdef DDB
if (console_pausing && !db_active && (c == '\n')) {

View File

@ -70,6 +70,7 @@ struct consdev {
short cn_pri; /* pecking order; the higher the better */
void *cn_arg; /* drivers method argument */
int cn_unit; /* some drivers prefer this */
int cn_flags; /* capabilities of this console */
char cn_name[SPECNAMELEN + 1]; /* console (device) name */
};
@ -80,6 +81,9 @@ struct consdev {
#define CN_INTERNAL 3 /* "internal" bit-mapped display */
#define CN_REMOTE 4 /* serial interface with remote bit set */
/* Values for cn_flags. */
#define CN_FLAG_NODEBUG 0x00000001 /* Not supported with debugger. */
#ifdef _KERNEL
extern int cons_unavail;