summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-08-17 05:52:42 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-08-17 05:52:42 +0000
commit60820c0548766952babe2fc2ca87618fdf141ba5 (patch)
treebfd00fb8b6a34aa64bf912874c2823ccd06a81cf
parent7152c194cef9abc370bc9d6b08e2ebe6e23ed3df (diff)
implement WSDISPLAYIO_{S,G}MODE
-rw-r--r--sys/dev/ic/sti.c23
-rw-r--r--sys/dev/ic/stivar.h3
2 files changed, 23 insertions, 3 deletions
diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c
index b4a3d64ee33..ba14680f68b 100644
--- a/sys/dev/ic/sti.c
+++ b/sys/dev/ic/sti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sti.c,v 1.28 2003/08/17 02:55:08 mickey Exp $ */
+/* $OpenBSD: sti.c,v 1.29 2003/08/17 05:52:41 mickey Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -312,6 +312,7 @@ sti_attach_common(sc)
return;
}
+ sc->sc_wsmode = WSDISPLAYIO_MODE_EMUL;
printf(": %s rev %d.%02d;%d, ID 0x%016llX\n"
"%s: %dx%d frame buffer, %dx%dx%d display, offset %dx%d\n",
cfg.name, dd->dd_grrev >> 4, dd->dd_grrev & 0xf, dd->dd_lrrev,
@@ -562,8 +563,26 @@ sti_ioctl(v, cmd, data, flag, p)
{
struct sti_softc *sc = v;
struct wsdisplay_fbinfo *wdf;
+ u_int mode;
+ int ret;
+ ret = 0;
switch (cmd) {
+ case WSDISPLAYIO_GMODE:
+ *(u_int *)data = sc->sc_wsmode;
+ break;
+
+ case WSDISPLAYIO_SMODE:
+ mode = *(u_int *)data;
+ if (sc->sc_wsmode == WSDISPLAYIO_MODE_EMUL &&
+ mode == WSDISPLAYIO_MODE_DUMBFB)
+ ret = sti_init(sc, 0);
+ else if (sc->sc_wsmode == WSDISPLAYIO_MODE_DUMBFB &&
+ mode == WSDISPLAYIO_MODE_EMUL)
+ ret = sti_init(sc, STI_TEXTMODE);
+ sc->sc_wsmode = mode;
+ break;
+
case WSDISPLAYIO_GTYPE:
*(u_int *)data = WSDISPLAY_TYPE_STI;
break;
@@ -593,7 +612,7 @@ sti_ioctl(v, cmd, data, flag, p)
return (-1); /* not supported yet */
}
- return (0);
+ return (ret);
}
paddr_t
diff --git a/sys/dev/ic/stivar.h b/sys/dev/ic/stivar.h
index e851add5b6c..5515eea2163 100644
--- a/sys/dev/ic/stivar.h
+++ b/sys/dev/ic/stivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stivar.h,v 1.11 2003/08/17 02:47:47 mickey Exp $ */
+/* $OpenBSD: stivar.h,v 1.12 2003/08/17 05:52:41 mickey Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -33,6 +33,7 @@ struct sti_softc {
struct device sc_dev;
void *sc_ih;
+ u_int sc_wsmode;
u_int sc_flags;
#define STI_TEXTMODE 0x0001
#define STI_CLEARSCR 0x0002