From 831039f850fe8debd06d2a8b256f8d74cf2bcafc Mon Sep 17 00:00:00 2001 From: Matt Jacob Date: Fri, 26 Oct 2001 16:13:47 +0000 Subject: [PATCH] Detach the prom console when platform.cons_init is called. This seems to avoid most of the double character kernel goop we've been having by having both a prom console && a normal console. Was not able to test with graphics head. Hope this doesn't break anything. Reviewed by: silence on alpha --- sys/alpha/alpha/machdep.c | 6 ++++-- sys/alpha/alpha/promcons.c | 10 ++++++++++ sys/alpha/include/prom.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 38bcc516d93d..d9a5104d593b 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -145,6 +145,7 @@ #include #include + u_int64_t cycles_per_usec; u_int32_t cycles_per_sec; int cold = 1; @@ -621,9 +622,10 @@ alpha_init(pfn, ptb, bim, bip, biv) * Initalize the real console, so the the bootstrap console is * no longer necessary. */ - if (platform.cons_init) + if (platform.cons_init) { platform.cons_init(); - + promcndetach(); + } /* NO MORE FIRMWARE ACCESS ALLOWED */ #ifdef _PMAP_MAY_USE_PROM_CONSOLE /* diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c index 063d8300286b..cd2da680dc62 100644 --- a/sys/alpha/alpha/promcons.c +++ b/sys/alpha/alpha/promcons.c @@ -263,6 +263,7 @@ DEV_MODULE(prom, prom_modevent, 0); CONS_DRIVER(prom, NULL, NULL, NULL, promcngetc, promcncheckc, promcnputc, NULL); +static int promcn_attached = 0; void promcnattach(int alpha_console) { @@ -270,8 +271,17 @@ promcnattach(int alpha_console) prom_consdev.cn_dev = makedev(CDEV_MAJOR, 0); make_dev(&prom_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "promcons"); cnadd(&prom_consdev); + promcn_attached = 1; } +void +promcndetach(void) +{ + if (promcn_attached) { + cnremove(&prom_consdev); + promcn_attached = 0; + } +} /* * promcnputc, promcngetc and promchcheckc in prom.c for layering reasons */ diff --git a/sys/alpha/include/prom.h b/sys/alpha/include/prom.h index c0e6eef6f213..537f9cfb411a 100644 --- a/sys/alpha/include/prom.h +++ b/sys/alpha/include/prom.h @@ -96,6 +96,7 @@ int prom_getenv __P((int, char *, int)); #ifndef ASSEMBLER #ifdef _KERNEL void promcnattach __P((int)); +void promcndetach __P((void)); void promcnputc __P((dev_t, int)); int promcngetc __P((dev_t)); int promcncheckc __P((dev_t));