diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-12-28 20:44:40 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-12-28 20:44:40 +0000 |
commit | fef433a4508472ed9b47dc068e76fb5cc743bd93 (patch) | |
tree | b1cbd5f2f12fee61e955fcfd027399338d406187 /sys/arch | |
parent | 68153d70629847b689dff52e9ddc737ad5a39d60 (diff) |
If initializing a frame buffer as glass console fails, instead of an invisible
panic (for you ichc fans out there), disable the wscons console and force a
console device reselection, which ends up in picking a serial console.
This should not happen, but just in case, it's a less rude behaviour.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/vax/vax/wscons_machdep.c | 27 | ||||
-rw-r--r-- | sys/arch/vax/vsa/gpx.c | 12 | ||||
-rw-r--r-- | sys/arch/vax/vsa/lcg.c | 12 | ||||
-rw-r--r-- | sys/arch/vax/vsa/lcspx.c | 21 | ||||
-rw-r--r-- | sys/arch/vax/vsa/smg.c | 12 |
5 files changed, 54 insertions, 30 deletions
diff --git a/sys/arch/vax/vax/wscons_machdep.c b/sys/arch/vax/vax/wscons_machdep.c index bb47bbba895..f3771673de9 100644 --- a/sys/arch/vax/vax/wscons_machdep.c +++ b/sys/arch/vax/vax/wscons_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_machdep.c,v 1.2 2006/08/27 16:55:41 miod Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.3 2007/12/28 20:44:37 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -51,11 +51,11 @@ #include "lcspx.h" #include "smg.h" -void (*wsfbcninit)(void) = NULL; +int (*wsfbcninit)(void) = NULL; #define FRAMEBUFFER_PROTOS(fb) \ extern int fb##cnprobe(void); \ -extern void fb##cninit(void); +extern int fb##cninit(void); #define FRAMEBUFFER_PROBE(fb) \ do { \ @@ -73,12 +73,23 @@ FRAMEBUFFER_PROTOS(smg); #include <dev/cons.h> cons_decl(ws); +int wscn_ignore = 0; /* nonzero if forcing a new console election */ + void wscnprobe(struct consdev *cp) { extern int getmajor(void *); /* conf.c */ int major; + /* + * If we forced a console device reelection, mark ourselves as + * non-working. + */ + if (wscn_ignore != 0) { + cp->cn_pri = CN_DEAD; + return; + } + major = getmajor(wsdisplayopen); if (major < 0) return; @@ -105,7 +116,15 @@ found: void wscninit(struct consdev *cp) { - (*wsfbcninit)(); + if ((*wsfbcninit)()) { + /* + * For some reason, the console initialization failed. + * Fallback to serial console, by re-electing a console. + */ + wscn_ignore = 1; + cninit(); + return; + } switch (vax_bustype) { case VAX_VSBUS: diff --git a/sys/arch/vax/vsa/gpx.c b/sys/arch/vax/vsa/gpx.c index b25f07fcb05..01d325975fd 100644 --- a/sys/arch/vax/vsa/gpx.c +++ b/sys/arch/vax/vsa/gpx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpx.c,v 1.17 2007/12/09 21:53:01 miod Exp $ */ +/* $OpenBSD: gpx.c,v 1.18 2007/12/28 20:44:39 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -1229,7 +1229,7 @@ gpx_resetcmap(struct gpx_screen *ss) */ int gpxcnprobe(void); -void gpxcninit(void); +int gpxcninit(void); int gpxcnprobe() @@ -1279,7 +1279,7 @@ gpxcnprobe() * Because it's called before the VM system is initialized, virtual memory * for the framebuffer can be stolen directly without disturbing anything. */ -void +int gpxcninit() { struct gpx_screen *ss = &gpx_consscr; @@ -1309,11 +1309,13 @@ gpxcninit() virtual_avail = round_page(virtual_avail); - /* this had better not fail as we can't recover there */ + /* this had better not fail */ if (gpx_setup_screen(ss) != 0) - panic(__func__); + return (1); ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); wsdisplay_cnattach(&gpx_stdscreen, ri, 0, 0, defattr); + + return (0); } diff --git a/sys/arch/vax/vsa/lcg.c b/sys/arch/vax/vsa/lcg.c index 416ab9265ca..c52a601b8a9 100644 --- a/sys/arch/vax/vsa/lcg.c +++ b/sys/arch/vax/vsa/lcg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcg.c,v 1.12 2007/12/18 19:39:27 miod Exp $ */ +/* $OpenBSD: lcg.c,v 1.13 2007/12/28 20:44:39 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -706,7 +706,7 @@ lcg_resetcmap(struct lcg_screen *ss) */ int lcgcnprobe(void); -void lcgcninit(void); +int lcgcninit(void); int lcgcnprobe() @@ -764,7 +764,7 @@ lcgcnprobe() * Because it's called before the VM system is initialized, virtual memory * for the framebuffer can be stolen directly without disturbing anything. */ -void +int lcgcninit() { struct lcg_screen *ss = &lcg_consscr; @@ -798,11 +798,13 @@ lcgcninit() virtual_avail = round_page(virtual_avail); - /* this had better not fail as we can't recover there */ + /* this had better not fail */ if (lcg_setup_screen(ss) != 0) - panic(__func__); + return (1); ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); wsdisplay_cnattach(&lcg_stdscreen, ri, 0, 0, defattr); + + return (0); } diff --git a/sys/arch/vax/vsa/lcspx.c b/sys/arch/vax/vsa/lcspx.c index 508ccfd4942..a6bf26497a0 100644 --- a/sys/arch/vax/vsa/lcspx.c +++ b/sys/arch/vax/vsa/lcspx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcspx.c,v 1.13 2007/12/09 21:54:00 miod Exp $ */ +/* $OpenBSD: lcspx.c,v 1.14 2007/12/28 20:44:39 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -170,6 +170,9 @@ lcspx_vsbus_match(struct device *parent, void *vcf, void *aux) volatile struct adder *adder; u_short status; + if (va->va_paddr != LCSPX_REG_ADDR) + return (0); + switch (vax_boardtype) { default: return (0); @@ -177,9 +180,6 @@ lcspx_vsbus_match(struct device *parent, void *vcf, void *aux) case VAX_BTYP_410: case VAX_BTYP_420: case VAX_BTYP_43: - if (va->va_paddr != LCSPX_REG_ADDR) - return (0); - /* not present on microvaxes */ if ((vax_confdata & KA420_CFG_MULTU) != 0) return (0); @@ -211,9 +211,6 @@ lcspx_vsbus_match(struct device *parent, void *vcf, void *aux) break; case VAX_BTYP_49: - if (va->va_paddr != LCSPX_REG_ADDR) - return (0); - if ((vax_confdata & 0x12) != 0x02) return (0); @@ -622,7 +619,7 @@ lcspx_resetcmap(struct lcspx_screen *ss) */ int lcspxcnprobe(void); -void lcspxcninit(void); +int lcspxcninit(void); int lcspxcnprobe() @@ -699,7 +696,7 @@ lcspxcnprobe() * Because it's called before the VM system is initialized, virtual memory * for the framebuffer can be stolen directly without disturbing anything. */ -void +int lcspxcninit() { struct lcspx_screen *ss = &lcspx_consscr; @@ -765,11 +762,13 @@ lcspxcninit() virtual_avail = round_page(virtual_avail); - /* this had better not fail as we can't recover there */ + /* this had better not fail */ if (lcspx_setup_screen(ss, width, height) != 0) - panic(__func__); + return (1); ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); wsdisplay_cnattach(&lcspx_stdscreen, ri, 0, 0, defattr); + + return (0); } diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c index 3f0fc6ef40c..b22617f2213 100644 --- a/sys/arch/vax/vsa/smg.c +++ b/sys/arch/vax/vsa/smg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smg.c,v 1.20 2007/10/01 16:11:19 krw Exp $ */ +/* $OpenBSD: smg.c,v 1.21 2007/12/28 20:44:39 miod Exp $ */ /* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */ /* * Copyright (c) 2006, Miodrag Vallat @@ -810,7 +810,7 @@ smg_erasecols(void *cookie, int row, int col, int num, long attr) */ int smgcnprobe(void); -void smgcninit(void); +int smgcninit(void); int smgcnprobe() @@ -839,7 +839,7 @@ smgcnprobe() * Because it's called before the VM system is initialized, virtual memory * for the framebuffer can be stolen directly without disturbing anything. */ -void +int smgcninit() { struct smg_screen *ss = &smg_consscr; @@ -857,11 +857,13 @@ smgcninit() virtual_avail = round_page(virtual_avail); - /* this had better not fail as we can't recover there */ + /* this had better not fail */ if (smg_setup_screen(ss) != 0) - panic(__func__); + return (1); ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); wsdisplay_cnattach(&smg_stdscreen, ri, 0, 0, defattr); + + return (0); } |