summaryrefslogtreecommitdiff
path: root/sys/dev/wscons
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-03-07 06:23:05 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-03-07 06:23:05 +0000
commit7b0be7b999199903470157428c3fe5453e6c093f (patch)
tree6b7599bb298b7e666a9d83a186dc97e835c8a34b /sys/dev/wscons
parentf7463a8e82b2e34f2b68a92b0bfda8a1b20870c9 (diff)
For unsupported (yet) Expert3D style frame buffers, attach pcons and attach
a really dumb wsdisplay to pcons, so that wskbd/wsmouse input drivers can be used for input, and prom for output. This is a band-aid for the release, so that people with such frame buffers do not need to unplug them or switch to serial console to install OpenBSD. Probably not the best way to do this, but this one has a minimal footprint and no tentacles in wscons. ok deraadt@
Diffstat (limited to 'sys/dev/wscons')
-rw-r--r--sys/dev/wscons/wsdisplay.c17
-rw-r--r--sys/dev/wscons/wsemul_dumb.c26
2 files changed, 38 insertions, 5 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index 89b2ff521fb..8b78a22f0a0 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.76 2007/02/14 00:53:48 jsg Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.77 2007/03/07 06:23:04 miod Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -777,6 +777,7 @@ wsdisplay_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
int crow, long defattr)
{
const struct wsemul_ops *wsemul;
+ const struct wsdisplay_emulops *emulops;
KASSERT(!wsdisplay_console_initted);
KASSERT(type->nrows > 0);
@@ -784,11 +785,21 @@ wsdisplay_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol,
KASSERT(crow < type->nrows);
KASSERT(ccol < type->ncols);
- wsdisplay_console_conf.emulops = type->textops;
+ wsdisplay_console_conf.emulops = emulops = type->textops;
wsdisplay_console_conf.emulcookie = cookie;
wsdisplay_console_conf.scrdata = type;
- wsemul = wsemul_pick(""); /* default */
+#ifdef WSEMUL_DUMB
+ /*
+ * If the emulops structure is crippled, force a dumb emulation.
+ */
+ if (emulops->cursor == NULL ||
+ emulops->copycols == NULL || emulops->copyrows == NULL ||
+ emulops->erasecols == NULL || emulops->eraserows == NULL)
+ wsemul = wsemul_pick("dumb");
+ else
+#endif
+ wsemul = wsemul_pick("");
wsdisplay_console_conf.wsemul = wsemul;
wsdisplay_console_conf.wsemulcookie =
(*wsemul->cnattach)(type, cookie, ccol, crow, defattr);
diff --git a/sys/dev/wscons/wsemul_dumb.c b/sys/dev/wscons/wsemul_dumb.c
index fc8d55ea557..a347703988f 100644
--- a/sys/dev/wscons/wsemul_dumb.c
+++ b/sys/dev/wscons/wsemul_dumb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_dumb.c,v 1.3 2007/02/14 01:12:16 jsg Exp $ */
+/* $OpenBSD: wsemul_dumb.c,v 1.4 2007/03/07 06:23:04 miod Exp $ */
/* $NetBSD: wsemul_dumb.c,v 1.7 2000/01/05 11:19:36 drochner Exp $ */
/*
@@ -68,6 +68,7 @@ struct wsemul_dumb_emuldata {
const struct wsdisplay_emulops *emulops;
void *emulcookie;
void *cbcookie;
+ int crippled;
u_int nrows, ncols, crow, ccol;
long defattr;
};
@@ -82,10 +83,11 @@ wsemul_dumb_cnattach(type, cookie, ccol, crow, defattr)
long defattr;
{
struct wsemul_dumb_emuldata *edp;
+ const struct wsdisplay_emulops *emulops;
edp = &wsemul_dumb_console_emuldata;
- edp->emulops = type->textops;
+ edp->emulops = emulops = type->textops;
edp->emulcookie = cookie;
edp->nrows = type->nrows;
edp->ncols = type->ncols;
@@ -93,6 +95,9 @@ wsemul_dumb_cnattach(type, cookie, ccol, crow, defattr)
edp->ccol = ccol;
edp->defattr = defattr;
edp->cbcookie = NULL;
+ edp->crippled = emulops->cursor == NULL ||
+ emulops->copycols == NULL || emulops->copyrows == NULL ||
+ emulops->erasecols == NULL || emulops->eraserows == NULL;
return (edp);
}
@@ -138,10 +143,24 @@ wsemul_dumb_output(cookie, data, count, kernel)
u_char c;
int n;
+ if (edp->crippled) {
+ while (count-- > 0) {
+ c = *data++;
+
+ if (c == ASCII_BEL)
+ wsdisplay_emulbell(edp->cbcookie);
+ else
+ (*edp->emulops->putchar)(edp->emulcookie, 0,
+ 0, c, 0);
+ }
+ return;
+ }
+
/* XXX */
(*edp->emulops->cursor)(edp->emulcookie, 0, edp->crow, edp->ccol);
while (count-- > 0) {
c = *data++;
+
switch (c) {
case ASCII_BEL:
wsdisplay_emulbell(edp->cbcookie);
@@ -238,6 +257,9 @@ wsemul_dumb_resetop(cookie, op)
{
struct wsemul_dumb_emuldata *edp = cookie;
+ if (edp->crippled)
+ return;
+
switch (op) {
case WSEMUL_CLEARSCREEN:
(*edp->emulops->eraserows)(edp->emulcookie, 0, edp->nrows,