diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-01-23 16:53:22 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-01-23 16:53:22 +0000 |
commit | c9029b1288d19d03daaa0122f369a66ca5a3ea50 (patch) | |
tree | 537e9b4c278534644bfccda71dbacec1c905f845 /sys | |
parent | e1b475c44e3ea78de9c4936b6ca33526af430278 (diff) |
Two sti(4) changes necessary for hp300:
- specify which microcode bank (pa or m68k) to use at attachment time.
- compensate for broken 8.02 m68k code which reports wrong frame buffer
offset.
ok mickey@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hppa/dev/sti_sgc.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/sti.c | 68 | ||||
-rw-r--r-- | sys/dev/ic/stireg.h | 9 | ||||
-rw-r--r-- | sys/dev/ic/stivar.h | 4 |
4 files changed, 56 insertions, 29 deletions
diff --git a/sys/arch/hppa/dev/sti_sgc.c b/sys/arch/hppa/dev/sti_sgc.c index 99e955e6d29..171731f129e 100644 --- a/sys/arch/hppa/dev/sti_sgc.c +++ b/sys/arch/hppa/dev/sti_sgc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sti_sgc.c,v 1.24 2004/09/15 20:11:28 mickey Exp $ */ +/* $OpenBSD: sti_sgc.c,v 1.25 2005/01/23 16:53:19 miod Exp $ */ /* * Copyright (c) 2000-2003 Michael Shalayeff @@ -230,5 +230,5 @@ sti_sgc_attach(parent, self, aux) if (ca->ca_hpa == (hppa_hpa_t)PAGE0->mem_cons.pz_hpa) sc->sc_flags |= STI_CONSOLE; - sti_attach_common(sc); + sti_attach_common(sc, STI_CODEBASE_PA); } diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c index c31b0544e56..f46ba58b8a2 100644 --- a/sys/dev/ic/sti.c +++ b/sys/dev/ic/sti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sti.c,v 1.38 2005/01/05 23:04:25 miod Exp $ */ +/* $OpenBSD: sti.c,v 1.39 2005/01/23 16:53:21 miod Exp $ */ /* * Copyright (c) 2000-2003 Michael Shalayeff @@ -121,8 +121,9 @@ int sti_fetchfonts(struct sti_softc *sc, struct sti_inqconfout *cfg, void sti_attach_deferred(void *); void -sti_attach_common(sc) +sti_attach_common(sc, codebase) struct sti_softc *sc; + u_int codebase; { struct sti_inqconfout cfg; struct sti_einqconfout ecfg; @@ -130,6 +131,7 @@ sti_attach_common(sc) struct sti_dd *dd; struct sti_cfg *cc; int error, size, i; + int geometry_kluge = 0; sc->sc_devtype = bus_space_read_1(sc->memt, sc->romh, 3); @@ -170,25 +172,30 @@ sti_attach_common(sc) dd->dd_eddst[2]= bus_space_read_1(sc->memt, sc->romh, 0xdf); dd->dd_cfbaddr = parseword(0xe0) & ~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 */ + codebase <<= 2; + dd->dd_pacode[0x0] = parseword(codebase + 0x000) & ~3; + dd->dd_pacode[0x1] = parseword(codebase + 0x010) & ~3; + dd->dd_pacode[0x2] = parseword(codebase + 0x020) & ~3; + dd->dd_pacode[0x3] = parseword(codebase + 0x030) & ~3; + dd->dd_pacode[0x4] = parseword(codebase + 0x040) & ~3; + dd->dd_pacode[0x5] = parseword(codebase + 0x050) & ~3; + dd->dd_pacode[0x6] = parseword(codebase + 0x060) & ~3; + dd->dd_pacode[0x7] = parseword(codebase + 0x070) & ~3; + dd->dd_pacode[0x8] = parseword(codebase + 0x080) & ~3; + dd->dd_pacode[0x9] = parseword(codebase + 0x090) & ~3; + dd->dd_pacode[0xa] = parseword(codebase + 0x0a0) & ~3; + dd->dd_pacode[0xb] = parseword(codebase + 0x0b0) & ~3; + dd->dd_pacode[0xc] = parseword(codebase + 0x0c0) & ~3; + dd->dd_pacode[0xd] = parseword(codebase + 0x0d0) & ~3; + dd->dd_pacode[0xe] = parseword(codebase + 0x0e0) & ~3; + dd->dd_pacode[0xf] = parseword(codebase + 0x0f0) & ~3; + } else { /* STI_DEVTYPE4 */ bus_space_read_region_4(sc->memt, sc->romh, 0, (u_int32_t *)dd, sizeof(*dd) / 4); + /* fix pacode... */ + bus_space_read_region_4(sc->memt, sc->romh, codebase, + (u_int32_t *)dd->dd_pacode, sizeof(dd->dd_pacode) / 4); + } #ifdef STIDEBUG printf("dd:\n" @@ -330,6 +337,22 @@ sti_attach_common(sc) return; } + /* + * Older (rev 8.02) boards report wrong offset values, + * similar to the displayable area size, at least in m68k mode. + * Attempt to detect this and adjust here. + */ + if (cfg.owidth == cfg.width && + cfg.oheight == cfg.height) + geometry_kluge = 1; + + if (geometry_kluge) { + sc->sc_cfg.oscr_width = cfg.owidth = + cfg.fbwidth - cfg.width; + sc->sc_cfg.oscr_height = cfg.oheight = + cfg.fbheight - cfg.height; + } + if ((error = sti_init(sc, STI_TEXTMODE))) { printf(": can not initialize (%d)\n", error); return; @@ -897,8 +920,7 @@ sti_copyrows(v, srcrow, dstrow, nrows) struct sti_softc *sc = v; struct sti_font *fp = &sc->sc_curfont; - sti_bmove(sc, sc->sc_cfg.oscr_width, srcrow * fp->height, - sc->sc_cfg.oscr_width, dstrow * fp->height, + sti_bmove(sc, 0, srcrow * fp->height, 0, dstrow * fp->height, nrows * fp->height, sc->sc_cfg.scr_width, bmf_copy); } @@ -911,8 +933,7 @@ sti_eraserows(v, srcrow, nrows, attr) struct sti_softc *sc = v; struct sti_font *fp = &sc->sc_curfont; - sti_bmove(sc, sc->sc_cfg.oscr_width, srcrow * fp->height, - sc->sc_cfg.oscr_width, srcrow * fp->height, + sti_bmove(sc, 0, srcrow * fp->height, 0, srcrow * fp->height, nrows * fp->height, sc->sc_cfg.scr_width, bmf_clear); } @@ -928,4 +949,3 @@ sti_alloc_attr(v, fg, bg, flags, pattr) return 0; } - diff --git a/sys/dev/ic/stireg.h b/sys/dev/ic/stireg.h index f1b14289950..efe9979b2d3 100644 --- a/sys/dev/ic/stireg.h +++ b/sys/dev/ic/stireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stireg.h,v 1.8 2003/08/19 02:52:38 mickey Exp $ */ +/* $OpenBSD: stireg.h,v 1.9 2005/01/23 16:53:21 miod Exp $ */ /* * Copyright (c) 2000 Michael Shalayeff @@ -54,6 +54,13 @@ #define STI_END 13 #define STI_CODECNT 16 +#define STI_CODEBASE_MAIN 0x40 +#define STI_CODEBASE_ALT 0x80 + +#define STI_CODEBASE_PA STI_CODEBASE_MAIN +#define STI_CODEBASE_M68K STI_CODEBASE_ALT +#define STI_CODEBASE_PA64 STI_CODEBASE_ALT + /* sti returns */ #define STI_OK 0 #define STI_FAIL -1 diff --git a/sys/dev/ic/stivar.h b/sys/dev/ic/stivar.h index dff06edbc5a..ddf9ec2223b 100644 --- a/sys/dev/ic/stivar.h +++ b/sys/dev/ic/stivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stivar.h,v 1.15 2003/12/16 06:07:13 mickey Exp $ */ +/* $OpenBSD: stivar.h,v 1.16 2005/01/23 16:53:21 miod Exp $ */ /* * Copyright (c) 2000-2003 Michael Shalayeff @@ -74,7 +74,7 @@ struct sti_softc { sti_util_t util; }; -void sti_attach_common(struct sti_softc *sc); +void sti_attach_common(struct sti_softc *sc, u_int codebase); int sti_intr(void *v); #endif /* _IC_STIVAR_H_ */ |