summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>2000-05-30 19:39:38 +0000
committermickey <mickey@openbsd.org>2000-05-30 19:39:38 +0000
commitdc4d48ecfc44ea0a0b5cfefb84c0da70deefdc0b (patch)
tree3c002be576964b5d077ca61688de7e6d43440e30
parentadd sti graphics available in pci and sgc form factors (diff)
downloadwireguard-openbsd-dc4d48ecfc44ea0a0b5cfefb84c0da70deefdc0b.tar.xz
wireguard-openbsd-dc4d48ecfc44ea0a0b5cfefb84c0da70deefdc0b.zip
sti hp graphics, available in pci and hp-prop sgc bus form factors.
attach point for wsdisplay. a few problems may exist w/ certain prom versions. tested in byte- and word-wide modes. no support yet for multiple resolutions and fonts. pci not tested (obviously).
-rw-r--r--sys/dev/ic/sti.c616
-rw-r--r--sys/dev/ic/stireg.h583
-rw-r--r--sys/dev/ic/stivar.h79
3 files changed, 1278 insertions, 0 deletions
diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c
new file mode 100644
index 00000000000..56498562e84
--- /dev/null
+++ b/sys/dev/ic/sti.c
@@ -0,0 +1,616 @@
+/* $OpenBSD: sti.c,v 1.1 2000/05/30 19:39:38 mickey Exp $ */
+
+/*
+ * Copyright (c) 2000 Michael Shalayeff
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Michael Shalayeff.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <uvm/uvm.h>
+
+#include <machine/bus.h>
+
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wscons/wsconsio.h>
+
+#include <hppa/dev/cpudevs.h>
+
+#include <dev/ic/stireg.h>
+#include <dev/ic/stivar.h>
+
+struct cfdriver sti_cd = {
+ NULL, "sti", DV_DULL
+};
+
+void sti_cursor __P((void *v, int on, int row, int col));
+int sti_mapchar __P((void *v, int uni, u_int *index));
+void sti_putchar __P((void *v, int row, int col, u_int uc, long attr));
+void sti_copycols __P((void *v, int row, int srccol, int dstcol, int ncols));
+void sti_erasecols __P((void *v, int row, int startcol, int ncols, long attr));
+void sti_copyrows __P((void *v, int srcrow, int dstrow, int nrows));
+void sti_eraserows __P((void *v, int row, int nrows, long attr));
+int sti_alloc_attr __P((void *v, int fg, int bg, int flags, long *));
+
+struct wsdisplay_emulops sti_emulops = {
+ sti_cursor,
+ sti_mapchar,
+ sti_putchar,
+ sti_copycols,
+ sti_erasecols,
+ sti_copyrows,
+ sti_eraserows,
+ sti_alloc_attr
+};
+
+int sti_ioctl __P((void *v, u_long cmd, caddr_t data, int flag, struct proc *p));
+int sti_mmap __P((void *v, off_t offset, int prot));
+int sti_alloc_screen __P((void *v, const struct wsscreen_descr *type,
+ void **cookiep, int *cxp, int *cyp, long *defattr));
+ void sti_free_screen __P((void *v, void *cookie));
+int sti_show_screen __P((void *v, void *cookie, int waitok,
+ void (*cb) __P((void *, int, int)), void *cbarg));
+int sti_load_font __P((void *v, void *cookie, struct wsdisplay_font *));
+
+const struct wsdisplay_accessops sti_accessops = {
+ sti_ioctl,
+ sti_mmap,
+ sti_alloc_screen,
+ sti_free_screen,
+ sti_show_screen,
+ sti_load_font
+};
+
+enum sti_bmove_funcs {
+ bmf_clear, bmf_copy, bmf_invert, bmf_underline
+};
+
+int sti_init __P((struct sti_softc *sc, int mode));
+int sti_inqcfg __P((struct sti_softc *sc, struct sti_inqconfout *out));
+void sti_bmove __P((struct sti_softc *sc, int, int, int, int, int, int,
+ enum sti_bmove_funcs));
+
+void
+sti_attach_common(sc)
+ struct sti_softc *sc;
+{
+ struct sti_inqconfout cfg;
+ struct wsscreen_descr **sl;
+ struct wsemuldisplaydev_attach_args waa;
+ struct sti_dd *dd;
+ struct sti_cfg *cc;
+ struct sti_fontcfg *ff;
+ int error, size, i;
+
+ dd = &sc->sc_dd;
+ if (sc->sc_devtype == STI_DEVTYPE1) {
+#define parseshort(o) \
+ ((bus_space_read_1(sc->memt, sc->romh, (o) + 3) << 8) | \
+ (bus_space_read_1(sc->memt, sc->romh, (o) + 7)))
+#define parseword(o) \
+ ((bus_space_read_1(sc->memt, sc->romh, (o) + 3) << 24) | \
+ (bus_space_read_1(sc->memt, sc->romh, (o) + 7) << 16) | \
+ (bus_space_read_1(sc->memt, sc->romh, (o) + 11) << 8) | \
+ (bus_space_read_1(sc->memt, sc->romh, (o) + 15)))
+
+ dd->dd_type = bus_space_read_1(sc->memt, sc->romh, 3);
+ dd->dd_grrev = bus_space_read_1(sc->memt, sc->romh, 7);
+ dd->dd_lrrev = bus_space_read_1(sc->memt, sc->romh, 11);
+ dd->dd_grid[0] = parseword(0x10);
+ dd->dd_grid[1] = parseword(0x20);
+ dd->dd_fntaddr = parseword(0x30) & ~3;
+ dd->dd_maxst = parseword(0x40);
+ dd->dd_romend = parseword(0x50) & ~3;
+ dd->dd_reglst = parseword(0x60) & ~3;
+ dd->dd_maxreent= parseshort(0x70);
+ dd->dd_maxtimo = parseshort(0x78);
+ /* what happened to 0x80 ? */
+ dd->dd_montbl = parseword(0x90);
+ dd->dd_udaddr = parseword(0xa0) & ~3;
+ dd->dd_stimemreq=parseword(0xb0);
+ dd->dd_udsize = parseword(0xc0);
+ dd->dd_pwruse = parseshort(0xd0);
+ dd->dd_bussup = bus_space_read_1(sc->memt, sc->romh, 0xdb);
+ dd->dd_ebussup = bus_space_read_1(sc->memt, sc->romh, 0xdf);
+ dd->dd_altcodet= bus_space_read_1(sc->memt, sc->romh, 0xe3);
+ dd->dd_cfbaddr = parseword(0xf0) & ~3;
+
+ dd->dd_pacode[0x0] = parseword(0x100) & ~3;
+ dd->dd_pacode[0x1] = parseword(0x110) & ~3;
+ dd->dd_pacode[0x2] = parseword(0x120) & ~3;
+ dd->dd_pacode[0x3] = parseword(0x130) & ~3;
+ dd->dd_pacode[0x4] = parseword(0x140) & ~3;
+ dd->dd_pacode[0x5] = parseword(0x150) & ~3;
+ dd->dd_pacode[0x6] = parseword(0x160) & ~3;
+ dd->dd_pacode[0x7] = parseword(0x170) & ~3;
+ dd->dd_pacode[0x8] = parseword(0x180) & ~3;
+ dd->dd_pacode[0x9] = parseword(0x190) & ~3;
+ dd->dd_pacode[0xa] = parseword(0x1a0) & ~3;
+ dd->dd_pacode[0xb] = parseword(0x1b0) & ~3;
+ dd->dd_pacode[0xc] = parseword(0x1c0) & ~3;
+ dd->dd_pacode[0xd] = parseword(0x1d0) & ~3;
+ dd->dd_pacode[0xe] = parseword(0x1e0) & ~3;
+ dd->dd_pacode[0xf] = parseword(0x1f0) & ~3;
+ } else /* STI_DEVTYPE4 */
+ bus_space_read_region_4(sc->memt, sc->romh, 0, (u_int32_t *)dd,
+ sizeof(*dd) / 4);
+
+#ifdef STIDEBUG
+ printf("dd:\n"
+ "devtype=%x, rev=%d.%d, gid=%x%x, font=%x, mss=%x\n"
+ "end=%x, mmap=%x, msto=%x, timo=%d, mont=%x, ua=%x\n"
+ "memrq=%x, pwr=%d, bus=%x, ebus=%x, altt=%x, cfb=%x\n"
+ "code=",
+ dd->dd_type, dd->dd_grrev, dd->dd_lrrev,
+ dd->dd_grid[0], dd->dd_grid[1],
+ dd->dd_fntaddr, dd->dd_maxst, dd->dd_romend,
+ dd->dd_reglst, dd->dd_maxreent,
+ dd->dd_maxtimo, dd->dd_montbl, dd->dd_udaddr,
+ dd->dd_stimemreq, dd->dd_udsize, dd->dd_pwruse,
+ dd->dd_bussup, dd->dd_altcodet, dd->dd_cfbaddr);
+ printf("%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n",
+ dd->dd_pacode[0x0], dd->dd_pacode[0x1], dd->dd_pacode[0x2],
+ dd->dd_pacode[0x3], dd->dd_pacode[0x4], dd->dd_pacode[0x5],
+ dd->dd_pacode[0x6], dd->dd_pacode[0x7], dd->dd_pacode[0x8],
+ dd->dd_pacode[0x9], dd->dd_pacode[0xa], dd->dd_pacode[0xb],
+ dd->dd_pacode[0xc], dd->dd_pacode[0xd], dd->dd_pacode[0xe],
+ dd->dd_pacode[0xf]);
+#endif
+ /* divine code size, could be less than STI_END entries */
+ for (i = STI_END; !dd->dd_pacode[i]; i--);
+ size = dd->dd_pacode[i] - dd->dd_pacode[STI_BEGIN];
+ if (sc->sc_devtype == STI_DEVTYPE1)
+ size = (size + 3) / 4;
+ if (!(sc->sc_code = uvm_km_kmemalloc(kernel_map,
+ uvm.kernel_object, round_page(size), UVM_KMF_NOWAIT))) {
+ printf(": cannot allocate %u bytes for code\n", size);
+ return;
+ }
+
+ /* copy code into memory */
+ if (sc->sc_devtype == STI_DEVTYPE1) {
+ register u_int8_t *p = (u_int8_t *)sc->sc_code;
+
+ for (i = 0; i < size; i++)
+ *p++ = bus_space_read_1(sc->memt, sc->romh,
+ dd->dd_pacode[0] + i * 4 + 3);
+
+ } else /* STI_DEVTYPE4 */
+ bus_space_read_region_4(sc->memt, sc->romh, dd->dd_pacode[0],
+ (u_int32_t *)sc->sc_code, size / 4);
+
+ /* flush from cache */
+ MD_CACHE_CTL(sc->sc_code, size, MD_CACHE_FLUSH);
+
+#define O(i) (dd->dd_pacode[(i)]? (sc->sc_code + \
+ (dd->dd_pacode[(i)] - dd->dd_pacode[0]) / \
+ (sc->sc_devtype == STI_DEVTYPE1? 4 : 1)) : NULL)
+ sc->init = (sti_init_t) O(STI_INIT_GRAPH);
+ sc->mgmt = (sti_mgmt_t) O(STI_STATE_MGMT);
+ sc->unpmv = (sti_unpmv_t) O(STI_FONT_UNPMV);
+ sc->blkmv = (sti_blkmv_t) O(STI_BLOCK_MOVE);
+ sc->test = (sti_test_t) O(STI_SELF_TEST);
+ sc->exhdl = (sti_exhdl_t) O(STI_EXCEP_HDLR);
+ sc->inqconf = (sti_inqconf_t)O(STI_INQ_CONF);
+ sc->scment = (sti_scment_t)O(STI_SCM_ENT);
+ sc->dmac = (sti_dmac_t) O(STI_DMA_CTRL);
+ sc->flowc = (sti_flowc_t) O(STI_FLOW_CTRL);
+ sc->utiming = (sti_utiming_t)O(STI_UTIMING);
+ sc->pmgr = (sti_pmgr_t) O(STI_PROC_MGR);
+ sc->util = (sti_util_t) O(STI_UTIL);
+
+ pmap_protect(pmap_kernel(), sc->sc_code,
+ sc->sc_code + round_page(size), VM_PROT_READ|VM_PROT_EXECUTE);
+
+ cc = &sc->sc_cfg;
+ bzero(cc, sizeof (*cc));
+ {
+ register int i = dd->dd_reglst;
+ register u_int *p;
+ struct sti_region r;
+
+#ifdef STIDEBUG
+ printf ("stiregions @%p:\n", i);
+#endif
+ r.last = 0;
+ for (p = (u_int *)cc->regions; !r.last &&
+ p < (u_int *)&cc->regions[STI_REGION_MAX]; p++) {
+
+ if (sc->sc_devtype == STI_DEVTYPE1)
+ *(u_int *)&r = parseword(i), i+= 16;
+ else
+ *(u_int *)&r = bus_space_read_4(sc->memt, sc->romh, i), i += 4;
+
+ *p = (p == (u_int *)cc->regions? sc->romh : sc->ioh) +
+ (r.offset << PGSHIFT);
+#ifdef STIDEBUG
+ printf("%x @ 0x%x %s%s%s%s\n",
+ r.length << PGSHIFT, *p, r.sys_only? "sys " : "",
+ r.cache? "cache " : "", r.btlb? "btlb " : "",
+ r.last? "last" : "");
+#endif
+
+ /* rom was already mapped */
+ if (p != (u_int *)cc->regions) {
+ if (bus_space_map(sc->memt, *p,
+ r.length << PGSHIFT, 0, &sc->fbh)) {
+#ifdef STIDEBUG
+ printf("cannot map region\n");
+#endif
+ /* who cares: return; */
+ }
+ }
+ }
+ }
+
+ if ((error = sti_init(sc, 0))) {
+ printf (": can not initialize (%d)\n", error);
+ return;
+ }
+
+ if ((error = sti_inqcfg(sc, &cfg))) {
+ printf (": error %d inquiring config\n", error);
+ return;
+ }
+
+ if ((error = sti_init(sc, STI_TEXTMODE))) {
+ printf (": can not initialize (%d)\n", error);
+ return;
+ }
+
+ ff = &sc->sc_fontcfg;
+ if (sc->sc_devtype == STI_DEVTYPE1) {
+ i = dd->dd_fntaddr;
+ ff->first = parseshort(i + 0x00);
+ ff->last = parseshort(i + 0x08);
+ ff->width = bus_space_read_1(sc->memt, sc->romh, i + 0x13);
+ ff->height = bus_space_read_1(sc->memt, sc->romh, i + 0x17);
+ ff->type = bus_space_read_1(sc->memt, sc->romh, i + 0x1b);
+ ff->bpc = bus_space_read_1(sc->memt, sc->romh, i + 0x1f);
+ ff->uheight= bus_space_read_1(sc->memt, sc->romh, i + 0x33);
+ ff->uoffset= bus_space_read_1(sc->memt, sc->romh, i + 0x37);
+ } else /* STI_DEVTYPE4 */
+ bus_space_read_region_4(sc->memt, sc->romh, dd->dd_fntaddr,
+ (u_int32_t *)ff, sizeof(*ff) / 4);
+
+ printf(": %s rev %d.%02d\n"
+ "%s: %dx%d frame buffer, %dx%dx%d display, offset %dx%d\n"
+ "%s: %dx%d font type %d, %d bpc, charset %d-%d\n",
+ cfg.name, dd->dd_grrev >> 4, dd->dd_lrrev & 0xf,
+ sc->sc_dev.dv_xname, cfg.fbwidth, cfg.fbheight,
+ cfg.width, cfg.height, cfg.bpp, cfg.owidth, cfg.oheight,
+ sc->sc_dev.dv_xname,
+ ff->width, ff->height, ff->type, ff->bpc, ff->first, ff->last);
+
+ /*
+ * parse screen descriptions:
+ * figure number of fonts supported;
+ * allocate wscons structures;
+ * calculate dimentions.
+ */
+
+ MALLOC(sc->sc_screens, struct wsscreen_descr *,
+ 1*sizeof(*sc->sc_screens), M_DEVBUF, M_NOWAIT);
+ MALLOC(sl, struct wsscreen_descr **,
+ 1*sizeof(sc->sc_screens), M_DEVBUF, M_NOWAIT);
+
+ sl[0] = &sc->sc_screens[0];
+ sc->sc_screens[0].name = "default";
+ sc->sc_screens[0].ncols = cfg.width / ff->width;
+ sc->sc_screens[0].nrows = cfg.height / ff->height;
+ sc->sc_screens[0].textops = &sti_emulops;
+ sc->sc_screens[0].fontwidth = ff->width;
+ sc->sc_screens[0].fontheight = ff->height;
+ sc->sc_screens[0].capabilities = WSSCREEN_REVERSE | WSSCREEN_UNDERLINE;
+
+ sc->sti_screenlist.nscreens = 1;
+ sc->sti_screenlist.screens = (const struct wsscreen_descr **)sl;
+
+ /* attach WSDISPLAY */
+ waa.console = sc->sc_dev.dv_unit;
+ waa.scrdata = &sc->sti_screenlist;
+ waa.accessops = &sti_accessops;
+ waa.accesscookie = sc;
+
+ config_found(&sc->sc_dev, &waa, wsemuldisplaydevprint);
+}
+
+int
+sti_init(sc, mode)
+ struct sti_softc *sc;
+ int mode;
+{
+ struct {
+ struct sti_initflags flags;
+ struct sti_initin in;
+ struct sti_initout out;
+ } a;
+
+ bzero(&a, sizeof(a));
+
+ a.flags.flags = STI_INITF_WAIT | STI_INITF_CMB | STI_INITF_EBET |
+ (mode & STI_TEXTMODE? STI_INITF_TEXT | STI_INITF_PBET |
+ STI_INITF_PBETI | STI_INITF_ICMT : 0);
+ a.in.text_planes = 1;
+ sc->init(&a.flags, &a.in, &a.out, &sc->sc_cfg);
+ return (a.out.text_planes != a.in.text_planes || a.out.errno);
+}
+
+int
+sti_inqcfg(sc, out)
+ struct sti_softc *sc;
+ struct sti_inqconfout *out;
+{
+ struct {
+ struct sti_inqconfflags flags;
+ struct sti_inqconfin in;
+ } a;
+
+ bzero(&a, sizeof(a));
+ bzero(out, sizeof(*out));
+
+ a.flags.flags = STI_INQCONFF_WAIT;
+ sc->inqconf(&a.flags, &a.in, out, &sc->sc_cfg);
+
+ return out->errno;
+}
+
+void
+sti_bmove(sc, x1, y1, x2, y2, h, w, f)
+ struct sti_softc *sc;
+ int x1, y1, x2, y2, h, w;
+ enum sti_bmove_funcs f;
+{
+ struct {
+ struct sti_blkmvflags flags;
+ struct sti_blkmvin in;
+ struct sti_blkmvout out;
+ } a;
+
+ bzero(&a, sizeof(a));
+
+ a.flags.flags = STI_BLKMVF_WAIT;
+ switch (f) {
+ case bmf_clear:
+ a.flags.flags |= STI_BLKMVF_CLR;
+ a.in.bg_colour = 0;
+ break;
+ case bmf_underline:
+ case bmf_copy:
+ a.in.fg_colour = 1;
+ a.in.bg_colour = 0;
+ break;
+ case bmf_invert:
+ a.in.fg_colour = 0;
+ a.in.bg_colour = 1;
+ break;
+ }
+ a.in.srcx = x1;
+ a.in.srcy = y1;
+ a.in.dstx = x2;
+ a.in.dsty = y2;
+ a.in.height = h;
+ a.in.width = w;
+
+ sc->blkmv(&a.flags, &a.in, &a.out, &sc->sc_cfg);
+#ifdef STIDEBUG
+ if (a.out.errno)
+ printf ("%s: blkmv returned %d\n",
+ sc->sc_dev.dv_xname, a.out.errno);
+#endif
+}
+
+int
+sti_ioctl(v, cmd, data, flag, p)
+ void *v;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ /* register struct sti_softc *sc; */
+
+ return -1;
+}
+
+int
+sti_mmap(v, offset, prot)
+ void *v;
+ off_t offset;
+ int prot;
+{
+ /* XXX not finished */
+ return offset;
+}
+
+int
+sti_alloc_screen(v, type, cookiep, cxp, cyp, defattr)
+ void *v;
+ const struct wsscreen_descr *type;
+ void **cookiep;
+ int *cxp, *cyp;
+ long *defattr;
+{
+ return -1;
+}
+
+void
+sti_free_screen(v, cookie)
+ void *v;
+ void *cookie;
+{
+}
+
+int
+sti_show_screen(v, cookie, waitok, cb, cbarg)
+ void *v;
+ void *cookie;
+ int waitok;
+ void (*cb) __P((void *, int, int));
+ void *cbarg;
+{
+ return 0;
+}
+
+int
+sti_load_font(v, cookie, font)
+ void *v;
+ void *cookie;
+ struct wsdisplay_font *font;
+{
+ return -1;
+}
+
+void
+sti_cursor(v, on, row, col)
+ void *v;
+ int on, row, col;
+{
+ register struct sti_softc *sc = v;
+
+ sti_bmove(sc, row * sc->sc_fontcfg.height, col * sc->sc_fontcfg.width,
+ row * sc->sc_fontcfg.height, col * sc->sc_fontcfg.width,
+ sc->sc_fontcfg.width, sc->sc_fontcfg.height, bmf_invert);
+}
+
+int
+sti_mapchar(v, uni, index)
+ void *v;
+ int uni;
+ u_int *index;
+{
+ if (uni < 256)
+ *index = uni;
+
+ return 1;
+}
+
+void
+sti_putchar(v, row, col, uc, attr)
+ void *v;
+ int row, col;
+ u_int uc;
+ long attr;
+{
+ register struct sti_softc *sc = v;
+ struct {
+ struct sti_unpmvflags flags;
+ struct sti_unpmvin in;
+ struct sti_unpmvout out;
+ } a;
+
+ bzero(&a, sizeof(a));
+
+ a.flags.flags = STI_UNPMVF_WAIT;
+ /* XXX does not handle text attributes */
+ a.in.fg_colour = 1;
+ a.in.bg_colour = 0;
+ a.in.x = col * sc->sc_fontcfg.width;
+ a.in.y = row * sc->sc_fontcfg.height;
+ a.in.font_addr = 0/*STI_FONTAD(sc->sc_devtype, sc->sc_rom)*/;
+ a.in.index = uc;
+ sc->unpmv(&a.flags, &a.in, &a.out, &sc->sc_cfg);
+}
+
+void
+sti_copycols(v, row, srccol, dstcol, ncols)
+ void *v;
+ int row, srccol, dstcol, ncols;
+{
+ register struct sti_softc *sc = v;
+
+ sti_bmove(sc,
+ row * sc->sc_fontcfg.height, srccol * sc->sc_fontcfg.width,
+ row * sc->sc_fontcfg.height, dstcol * sc->sc_fontcfg.width,
+ ncols * sc->sc_fontcfg.width, sc->sc_fontcfg.height,
+ bmf_copy);
+}
+
+void
+sti_erasecols(v, row, startcol, ncols, attr)
+ void *v;
+ int row, startcol, ncols;
+ long attr;
+{
+ register struct sti_softc *sc = v;
+
+ sti_bmove(sc,
+ row * sc->sc_fontcfg.height, startcol * sc->sc_fontcfg.width,
+ row * sc->sc_fontcfg.height, startcol * sc->sc_fontcfg.width,
+ ncols * sc->sc_fontcfg.width, sc->sc_fontcfg.height,
+ bmf_clear);
+}
+
+void
+sti_copyrows(v, srcrow, dstrow, nrows)
+ void *v;
+ int srcrow, dstrow, nrows;
+{
+ register struct sti_softc *sc = v;
+
+ sti_bmove(sc,
+ srcrow * sc->sc_fontcfg.height, 0,
+ dstrow * sc->sc_fontcfg.height, 0,
+ sc->sc_cfg.fb_width, nrows + sc->sc_fontcfg.height,
+ bmf_copy);
+}
+
+void
+sti_eraserows(v, srcrow, nrows, attr)
+ void *v;
+ int srcrow, nrows;
+ long attr;
+{
+ register struct sti_softc *sc = v;
+
+ sti_bmove(sc,
+ srcrow * sc->sc_fontcfg.height, 0,
+ srcrow * sc->sc_fontcfg.height, 0,
+ sc->sc_cfg.fb_width, nrows + sc->sc_fontcfg.height,
+ bmf_clear);
+}
+
+int
+sti_alloc_attr(v, fg, bg, flags, pattr)
+ void *v;
+ int fg, bg, flags;
+ long *pattr;
+{
+ /* register struct sti_softc *sc = v; */
+
+ *pattr = 0;
+
+ return 0;
+}
+
diff --git a/sys/dev/ic/stireg.h b/sys/dev/ic/stireg.h
new file mode 100644
index 00000000000..2e123a56e26
--- /dev/null
+++ b/sys/dev/ic/stireg.h
@@ -0,0 +1,583 @@
+/* $OpenBSD: stireg.h,v 1.1 2000/05/30 19:39:38 mickey Exp $ */
+
+/*
+ * Copyright (c) 2000 Michael Shalayeff
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Michael Shalayeff.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _STI_H_
+#define _STI_H_
+
+#define STIDEBUG
+
+#define STI_REGION_MAX 8
+#define STI_MONITOR_MAX 256
+#define STI_DEVNAME_LEN 32
+
+/* code ROM definitions */
+#define STI_BEGIN 0
+#define STI_INIT_GRAPH 0
+#define STI_STATE_MGMT 1
+#define STI_FONT_UNPMV 2
+#define STI_BLOCK_MOVE 3
+#define STI_SELF_TEST 4
+#define STI_EXCEP_HDLR 5
+#define STI_INQ_CONF 6
+#define STI_SCM_ENT 7
+#define STI_DMA_CTRL 8
+#define STI_FLOW_CTRL 9
+#define STI_UTIMING 10
+#define STI_PROC_MGR 11
+#define STI_UTIL 12
+#define STI_END 13
+#define STI_CODECNT 16
+
+/* sti returns */
+#define STI_OK 0
+#define STI_FAIL -1
+#define STI_NRDY 1
+
+/* sti errno */
+#define STI_NOERRNO 0 /* no error */
+#define STI_BADREENTLVL 1 /* bad reentry level */
+#define STI_NOREGIONSDEF 2 /* region table is not setup */
+#define STI_ILLNPLANES 3 /* invalid num of text planes */
+#define STI_ILLINDEX 4 /* invalid fond index */
+#define STI_ILLLOC 5 /* invalid font location */
+#define STI_ILLCOLOUR 6 /* invalid colour */
+#define STI_ILLBLKMVFROM 7 /* invalid from in blkmv */
+#define STI_ILLBLKMVTO 8 /* invalid to in blkmv */
+#define STI_ILLBLKMVSIZE 9 /* invalid siz in blkmv */
+#define STI_BEIUNSUPP 10 /* bus error ints unsupported */
+#define STI_UNXPBE 11 /* unexpected bus error */
+#define STI_UNXHWF 12 /* unexpected hardware failure */
+#define STI_NEGCFG 13 /* no ext global config struct */
+#define STI_NEIG 14 /* no ext init struct */
+#define STI_ILLSCME 15 /* invalid set cmap entry */
+#define STI_ILLCMVAL 16 /* invalid cmap value */
+#define STI_NORESMEM 17 /* no requested global memory */
+#define STI_RESMEMCORR 18 /* reserved memory corrupted */
+#define STI_ILLNTBLKMV 19 /* invalid non-text blkmv */
+#define STI_ILLMONITOR 20 /* monitor selection is out of range */
+#define STI_ILLEXCADDR 21 /* invalid excpt handler addr */
+#define STI_ILLEXCFLAGS 22 /* invalid excpt handler flags */
+#define STI_NOEHE 23 /* no ext exhdl struct */
+#define STI_NOINQCE 24 /* no ext inq cfg struct */
+#define STI_ILLRGNPTR 25 /* invalid region pointer */
+#define STI_ILLUTLOP 26 /* invalid util opcode */
+#define STI_UNKNOWN 250 /* unknown error */
+#define STI_NOCFGPTR 251 /* no config ptr defined */
+#define STI_NOFLPTR 252 /* no flag ptr defined */
+#define STI_NOINPTR 253 /* no in ptr defined */
+#define STI_NOOUTPTR 254 /* no way you can get it */
+#define STI_NOLOCK 255 /* kernel dishonour graphics lock */
+
+/* colours */
+#define STI_COLOUR_BLACK 0
+#define STI_COLOUR_WHITE 1
+#define STI_COLOUR_RED 2
+#define STI_COLOUR_YELLOW 3
+#define STI_COLOUR_GREEN 4
+#define STI_COLOUR_CYAN 5
+#define STI_COLOUR_BLUE 6
+#define STI_COLOUR_MAGENTA 7
+
+ /* LSB high */
+struct sti_dd {
+ u_int32_t dd_type; /* 0x00 device type */
+#define STI_DEVTYPE1 1
+#define STI_DEVTYPE4 3
+ u_int8_t dd_unused;
+ u_int8_t dd_nmon; /* 0x05 number monitor rates */
+ u_int8_t dd_grrev; /* 0x06 global rom revision */
+ u_int8_t dd_lrrev; /* 0x07 local rom revision */
+ u_int8_t dd_grid[8]; /* 0x08 graphics id */
+ u_int32_t dd_fntaddr; /* 0x10 font start address */
+ u_int32_t dd_maxst; /* 0x14 max state storage */
+ u_int32_t dd_romend; /* 0x18 rom last address */
+ u_int32_t dd_reglst; /* 0x1c device region list */
+ u_int16_t dd_maxreent; /* 0x20 max reent storage */
+ u_int16_t dd_maxtimo; /* 0x22 max execution timeout .1 sec */
+ u_int32_t dd_montbl; /* 0x24 mon table address, array of
+ names num of dd_nmon */
+ u_int32_t dd_udaddr; /* 0x28 user data address */
+ u_int32_t dd_stimemreq; /* 0x2c sti memory request */
+ u_int32_t dd_udsize; /* 0x30 user data size */
+ u_int32_t dd_pwruse; /* 0x34 power usage */
+ u_int8_t dd_bussup; /* 0x36 bus support */
+#define STI_BUSSUPPORT_GSCINTL 0x01 /* supports pulling INTL for int */
+#define STI_BUSSUPPORT_GSC15X 0x02 /* supports GSC 1.5X */
+#define STI_BUSSUPPORT_GSC2X 0x04 /* supports GSC 2.X */
+#define STI_BUSSUPPORT_PCIIOEIM 0x08 /* will use directed int */
+#define STI_BUSSUPPORT_PCISTD 0x10 /* will use std PCI int */
+#define STI_BUSSUPPORT_ILOCK 0x20 /* supports implicit locking */
+#define STI_BUSSUPPORT_ROMMAP 0x40 /* rom is only in pci erom space */
+#define STI_BUSSUPPORT_2DECODE 0x80 /* single address decoder */
+ u_int8_t dd_ebussup; /* 0x37 extended bus support */
+#define STI_EBUSSUPPORT_DMA 0x01 /* supports dma */
+#define STI_EBUSSUPPORT_PIOLOCK 0x02 /* no implicit locking for dma */
+ u_int8_t dd_altcodet; /* 0x38 alternate code type */
+#define STI_ALTCODE_UNKNOWN 0x00
+#define STI_ALTCODE_PA64 0x01 /* alt code is in pa64 */
+ u_int8_t dd_eddst[3]; /* 0x39 extended DD struct */
+ u_int32_t dd_cfbaddr; /* 0x3c CFB address, location of
+ X11 driver to be used for
+ servers w/o accel */
+ u_int32_t dd_pacode[16]; /* 0x40 routines for pa-risc */
+ u_int32_t dd_altcode[16]; /* 0x80 routines for m68k/i386 */
+};
+
+/* after the last region there is one indirect list ptr */
+struct sti_region {
+ u_int offset :14; /* page offset dev io space relative */
+ u_int sys_only: 1; /* whether allow user access */
+ u_int cache : 1; /* map in cache */
+ u_int btlb : 1; /* should use BTLB if available */
+ u_int last : 1; /* last region in the list */
+ u_int length :14; /* size in pages */
+};
+
+struct sti_font {
+ u_int16_t first;
+ u_int16_t last;
+ u_int8_t width;
+ u_int8_t height;
+ u_int8_t type;
+#define STI_FONT_HPROMAN8 1
+#define STI_FONT_KANA8 2
+ u_int8_t bpc;
+ u_int32_t next;
+ u_int8_t uheight;
+ u_int8_t uoffset;
+ u_int8_t unused[2];
+};
+
+struct sti_fontcfg {
+ u_int16_t first;
+ u_int16_t last;
+ u_int8_t width;
+ u_int8_t height;
+ u_int8_t type;
+ u_int8_t bpc;
+ u_int8_t uheight;
+ u_int8_t uoffset;
+};
+
+typedef struct sti_ecfg {
+ u_int8_t current_monitor;
+ u_int8_t uf_boot;
+ u_int16_t power; /* power dissipation Watts */
+ u_int32_t freq_ref;
+ u_int32_t *addr; /* memory block of size dd_stimemreq */
+ void *future;
+} *sti_ecfg_t;
+
+typedef struct sti_cfg {
+ u_int32_t text_planes;
+ u_int16_t scr_width;
+ u_int16_t scr_height;
+ u_int16_t oscr_width;
+ u_int16_t oscr_height;
+ u_int16_t fb_width;
+ u_int16_t fb_height;
+ u_int32_t *regions[STI_REGION_MAX];
+ u_int32_t reent_level;
+ u_int32_t *save_addr;
+ sti_ecfg_t ext_cfg;
+} *sti_cfg_t;
+
+
+/* routine types */
+#define STI_DEP(n) \
+ typedef int (*sti_##n##_t) __P(( \
+ sti_##n##flags_t, sti_##n##in_t, sti_##n##out_t, sti_cfg_t));
+
+typedef struct sti_initflags {
+ u_int32_t flags;
+#define STI_INITF_WAIT 0x80000000
+#define STI_INITF_RESET 0x40000000
+#define STI_INITF_TEXT 0x20000000
+#define STI_INITF_NTEXT 0x10000000
+#define STI_INITF_CLEAR 0x08000000
+#define STI_INITF_CMB 0x04000000 /* non-text planes cmap black */
+#define STI_INITF_EBET 0x02000000 /* enable bus error timer */
+#define STI_INITF_EBETI 0x01000000 /* enable bus error timer interrupt */
+#define STI_INITF_PTS 0x00800000 /* preserve text settings */
+#define STI_INITF_PNTS 0x00400000 /* preserve non-text settings */
+#define STI_INITF_PBET 0x00200000 /* preserve BET settings */
+#define STI_INITF_PBETI 0x00100000 /* preserve BETI settings */
+#define STI_INITF_ICMT 0x00080000 /* init cmap for text planes */
+#define STI_INITF_SCMT 0x00040000 /* change current monitor type */
+#define STI_INITF_RIE 0x00020000 /* retain int enables */
+ void *future;
+} *sti_initflags_t;
+
+typedef struct sti_einitin {
+ u_int8_t mon_type;
+ u_int8_t pad;
+ u_int16_t inflight; /* possible on pci */
+ void *future;
+} *sti_einitin_t;
+
+typedef struct sti_initin {
+ u_int32_t text_planes; /* number of planes for text */
+ sti_einitin_t ext_in;
+} *sti_initin_t;
+
+typedef struct sti_initout {
+ int32_t errno;
+ u_int32_t text_planes; /* number of planes used for text */
+ void *future;
+} *sti_initout_t;
+
+STI_DEP(init);
+
+typedef struct sti_mgmtflags {
+ u_int32_t flags;
+#define STI_MGMTF_WAIT 0x80000000
+#define STI_MGMTF_SAVE 0x40000000
+#define STI_MGMTF_RALL 0x20000000 /* restore all display planes */
+ void *future;
+} *sti_mgmtflags_t;
+
+typedef struct sti_mgmtin {
+ void *addr;
+ void *future;
+} *sti_mgmtin_t;
+
+typedef struct sti_mgmtout {
+ int32_t errno;
+ void *future;
+} *sti_mgmtout_t;
+
+STI_DEP(mgmt);
+
+typedef struct sti_unpmvflags {
+ u_int32_t flags;
+#define STI_UNPMVF_WAIT 0x80000000
+#define STI_UNPMVF_NTXT 0x40000000 /* intp non-text planes */
+ void *future;
+} *sti_unpmvflags_t;
+
+typedef struct sti_unpmvin {
+ u_int32_t *font_addr; /* font */
+ u_int16_t index; /* character index in the font */
+ u_int8_t fg_colour;
+ u_int8_t bg_colour;
+ u_int16_t x, y;
+ void *future;
+} *sti_unpmvin_t;
+
+typedef struct sti_unpmvout {
+ u_int32_t errno;
+ void *future;
+} *sti_unpmvout_t;
+
+STI_DEP(unpmv);
+
+typedef struct sti_blkmvflags {
+ u_int32_t flags;
+#define STI_BLKMVF_WAIT 0x80000000
+#define STI_BLKMVF_COLR 0x40000000 /* change colour on move */
+#define STI_BLKMVF_CLR 0x20000000 /* clear on move */
+#define STI_BLKMVF_NTXT 0x10000000 /* move in non-text planes */
+ void *future;
+} *sti_blkmvflags_t;
+
+typedef struct sti_blkmvin {
+ u_int8_t fg_colour;
+ u_int8_t bg_colour;
+ u_int16_t srcx, srcy, dstx, dsty;
+ u_int16_t width, height;
+ void *future;
+} *sti_blkmvin_t;
+
+typedef struct sti_blkmvout {
+ u_int32_t errno;
+ void *future;
+} *sti_blkmvout_t;
+
+STI_DEP(blkmv);
+
+typedef struct sti_testflags {
+ u_int32_t flags;
+#define STI_TESTF_WAIT 0x80000000
+#define STI_TESTF_ETST 0x40000000
+ void *future;
+} *sti_testflags_t;
+
+typedef struct sti_testin {
+ void *future;
+} *sti_testin_t;
+
+typedef struct sti_testout {
+ u_int32_t errno;
+ u_int32_t result;
+ void *future;
+} *sti_testout_t;
+
+STI_DEP(test);
+
+typedef struct sti_exhdlflags {
+ u_int32_t flags;
+#define STI_EXHDLF_WAIT 0x80000000
+#define STI_EXHDLF_CINT 0x40000000 /* clear int */
+#define STI_EXHDLF_CBE 0x20000000 /* clear BE */
+#define STI_EXHDLF_PINT 0x10000000 /* preserve int */
+#define STI_EXHDLF_RINT 0x08000000 /* restore int */
+#define STI_EXHDLF_WEIM 0x04000000 /* write eim w/ sti_eexhdlin */
+#define STI_EXHDLF_REIM 0x02000000 /* read eim to sti_eexhdlout */
+#define STI_EXHDLF_GIE 0x01000000 /* global int enable */
+#define STI_EXHDLF_PGIE 0x00800000
+#define STI_EXHDLF_WIEM 0x00400000
+#define STI_EXHDLF_EIEM 0x00200000
+#define STI_EXHDLF_BIC 0x00100000 /* begin int cycle */
+#define STI_EXHDLF_EIC 0x00080000 /* end int cycle */
+#define STI_EXHDLF_RIE 0x00040000 /* reset do not clear int enables */
+ void *future;
+} *sti_exhdlflags_t;
+
+typedef struct sti_eexhdlin {
+ u_int32_t eim_addr;
+ u_int32_t eim_data;
+ u_int32_t iem; /* enable mask */
+ u_int32_t icm; /* clear mask */
+ void *future;
+} *sti_eexhdlin_t;
+
+typedef struct sti_exhdlint {
+ u_int32_t flags;
+#define STI_EXHDLINT_BET 0x80000000 /* bus error timer */
+#define STI_EXHDLINT_HW 0x40000000 /* high water */
+#define STI_EXHDLINT_LW 0x20000000 /* low water */
+#define STI_EXHDLINT_TM 0x10000000 /* texture map */
+#define STI_EXHDLINT_VB 0x08000000 /* vertical blank */
+#define STI_EXHDLINT_UDC 0x04000000 /* unbuffered dma complete */
+#define STI_EXHDLINT_BDC 0x02000000 /* buffered dma complete */
+#define STI_EXHDLINT_UDPC 0x01000000 /* unbuf priv dma complete */
+#define STI_EXHDLINT_BDPC 0x00800000 /* buffered priv dma complete */
+} *sti_exhdlint_t;
+
+typedef struct sti_exhdlin {
+ sti_exhdlint_t addr;
+ sti_eexhdlin_t ext;
+} *sti_exhdlin_t;
+
+typedef struct sti_eexhdlout {
+ u_int32_t eim_addr;
+ u_int32_t eim_data;
+ u_int32_t iem; /* enable mask */
+ u_int32_t icm; /* clear mask */
+ void *future;
+} *sti_eexhdlout_t;
+
+typedef struct sti_exhdlout {
+ u_int32_t errno;
+ u_int32_t flags;
+#define STI_EXHDLO_BE 0x80000000 /* BE was intercepted */
+#define STI_EXHDLO_IP 0x40000000 /* there is int pending */
+#define STI_EXHDLO_IE 0x20000000 /* global enable set */
+ sti_eexhdlout_t ext;
+} *sti_exhdlout_t;
+
+STI_DEP(exhdl);
+
+typedef struct sti_inqconfflags {
+ u_int32_t flags;
+#define STI_INQCONFF_WAIT 0x80000000
+ void *future;
+} *sti_inqconfflags_t;
+
+typedef struct sti_inqconfin {
+ void *future;
+} *sti_inqconfin_t;
+
+typedef struct sti_einqconfout {
+ u_int32_t crt_config[3];
+ u_int32_t crt_hw[3];
+ void *future;
+} *sti_einqconfout_t;
+
+typedef struct sti_inqconfout {
+ u_int32_t errno;
+ u_int16_t width, height, owidth, oheight, fbwidth, fbheight;
+ u_int32_t bpp; /* bits per pixel */
+ u_int32_t bppu; /* accessible bpp */
+ u_int32_t planes;
+ u_int8_t name[STI_DEVNAME_LEN];
+ u_int32_t attributes;
+ sti_einqconfout_t ext;
+} *sti_inqconfout_t;
+
+STI_DEP(inqconf);
+
+typedef struct sti_scmentflags {
+ u_int32_t flags;
+#define STI_SCMENTF_WAIT 0x80000000
+ void *future;
+} *sti_scmentflags_t;
+
+typedef struct sti_scmentin {
+ u_int32_t entry;
+ u_int32_t value;
+ void *future;
+} *sti_scmentin_t;
+
+typedef struct sti_scmentout {
+ u_int32_t errno;
+ void *future;
+} *sti_scmentout_t;
+
+STI_DEP(scment);
+
+typedef struct sti_dmacflags {
+ u_int32_t flags;
+#define STI_DMACF_WAIT 0x80000000
+#define STI_DMACF_PRIV 0x40000000 /* priv dma */
+#define STI_DMACF_DIS 0x20000000 /* disable */
+#define STI_DMACF_BUF 0x10000000 /* buffered */
+#define STI_DMACF_MRK 0x08000000 /* write a marker */
+#define STI_DMACF_ABRT 0x04000000 /* abort dma xfer */
+ void *future;
+} *sti_dmacflags_t;
+
+typedef struct sti_dmacin {
+ u_int32_t pa_upper;
+ u_int32_t pa_lower;
+ u_int32_t len;
+ u_int32_t mrk_data;
+ u_int32_t mrk_off;
+ void *future;
+} *sti_dmacin_t;
+
+typedef struct sti_dmacout {
+ u_int32_t errno;
+ void *future;
+} *sti_dmacout_t;
+
+STI_DEP(dmac);
+
+typedef struct sti_flowcflags {
+ u_int32_t flags;
+#define STI_FLOWCF_WAIT 0x80000000
+#define STI_FLOWCF_CHW 0x40000000 /* check high water */
+#define STI_FLOWCF_WHW 0x20000000 /* write high water */
+#define STI_FLOWCF_WLW 0x10000000 /* write low water */
+#define STI_FLOWCF_PCSE 0x08000000 /* preserve cse */
+#define STI_FLOWCF_CSE 0x04000000
+#define STI_FLOWCF_CSWF 0x02000000 /* cs write fine */
+#define STI_FLOWCF_CSWC 0x01000000 /* cs write coarse */
+#define STI_FLOWCF_CSWQ 0x00800000 /* cs write fifo */
+ void *future;
+} *sti_flowcflags_t;
+
+typedef struct sti_flowcin {
+ u_int32_t retry;
+ u_int32_t bufz;
+ u_int32_t hwcnt;
+ u_int32_t lwcnt;
+ u_int32_t csfv; /* cs fine value */
+ u_int32_t cscv; /* cs coarse value */
+ u_int32_t csqc; /* cs fifo count */
+ void *future;
+} *sti_flowcin_t;
+
+typedef struct sti_flowcout {
+ u_int32_t errno;
+ u_int32_t retry_result;
+ u_int32_t fifo_size;
+ void *future;
+} *sti_flowcout_t;
+
+STI_DEP(flowc);
+
+typedef struct sti_utimingflags {
+ u_int32_t flags;
+#define STI_UTIMF_WAIT 0x80000000
+#define STI_UTIMF_HKS 0x40000000 /* has kbuf_size */
+ void *future;
+} *sti_utimingflags_t;
+
+typedef struct sti_utimingin {
+ void *data;
+ void *kbuf;
+ void *future;
+} *sti_utimingin_t;
+
+typedef struct sti_utimingout {
+ u_int32_t errno;
+ u_int32_t kbuf_size; /* buffer required size */
+ void *future;
+} *sti_utimingout_t;
+
+STI_DEP(utiming);
+
+typedef struct sti_pmgrflags {
+ u_int32_t flags;
+#define STI_UTIMF_WAIT 0x80000000
+#define STI_UTIMOP_CLEANUP 0x00000000
+#define STI_UTIMOP_BAC 0x10000000
+#define STI_UTIMF_CRIT 0x04000000
+#define STI_UTIMF_BUFF 0x02000000
+#define STI_UTIMF_IBUFF 0x01000000
+ void *future;
+} *sti_pmgrflags_t;
+
+typedef struct sti_pmgrin {
+ u_int32_t reserved[4];
+ void *future;
+} *sti_pmgrin_t;
+
+typedef struct sti_pmgrout {
+ int32_t errno;
+ void *future;
+} *sti_pmgrout_t;
+
+STI_DEP(pmgr);
+
+typedef struct sti_utilflags {
+ u_int32_t flags;
+#define STI_UTILF_ROOT 0x80000000 /* was called as root */
+ void *future;
+} *sti_utilflags_t;
+
+typedef struct sti_utilin {
+ u_int32_t in_size;
+ u_int32_t out_size;
+ u_int8_t *buf;
+} *sti_utilin_t;
+
+typedef struct sti_utilout {
+ int32_t errno;
+ void *future;
+} *sti_utilout_t;
+
+STI_DEP(util);
+
+#endif /* _STI_H_ */
diff --git a/sys/dev/ic/stivar.h b/sys/dev/ic/stivar.h
new file mode 100644
index 00000000000..7a699d31d0d
--- /dev/null
+++ b/sys/dev/ic/stivar.h
@@ -0,0 +1,79 @@
+/* $OpenBSD: stivar.h,v 1.1 2000/05/30 19:39:38 mickey Exp $ */
+
+/*
+ * Copyright (c) 2000 Michael Shalayeff
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Michael Shalayeff.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _STIVAR_H_
+#define _STIVAR_H_
+
+
+struct sti_softc {
+ struct device sc_dev;
+ void *sc_ih;
+
+ u_int sc_flags;
+#define STI_TEXTMODE 0x0001
+#define STI_CLEARSCR 0x0002
+ int sc_devtype;
+
+ bus_space_tag_t iot, memt;
+ bus_space_handle_t ioh, romh, fbh;
+
+ struct sti_dd sc_dd; /* in word format */
+ struct sti_font *sc_fonts; /* in word format */
+ struct sti_cfg sc_cfg;
+ struct sti_ecfg sc_ecfg;
+ struct sti_fontcfg sc_fontcfg;
+
+ struct wsscreen_descr *sc_screens;
+ struct wsscreen_list sti_screenlist;
+
+ vaddr_t sc_code;
+
+ sti_init_t init;
+ sti_mgmt_t mgmt;
+ sti_unpmv_t unpmv;
+ sti_blkmv_t blkmv;
+ sti_test_t test;
+ sti_exhdl_t exhdl;
+ sti_inqconf_t inqconf;
+ sti_scment_t scment;
+ sti_dmac_t dmac;
+ sti_flowc_t flowc;
+ sti_utiming_t utiming;
+ sti_pmgr_t pmgr;
+ sti_util_t util;
+};
+
+void sti_attach_common __P((struct sti_softc *sc));
+int sti_intr __P((void *v));
+
+#endif /* _STIVAR_H_ */