Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/dev/ic Pull up following revision(s) (requested by ts...



details:   https://anonhg.NetBSD.org/src/rev/7b96e00aaa07
branches:  netbsd-9
changeset: 948679:7b96e00aaa07
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Dec 28 20:10:04 2020 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1162):

        sys/dev/ic/stivar.h: revision 1.11
        sys/dev/ic/sti.c: revision 1.23
        sys/dev/ic/sti.c: revision 1.24
        sys/dev/ic/sti.c: revision 1.25
        sys/arch/hp300/dev/sti_sgc.c: revision 1.4

Pull the latest OpenBSD sti(4) changes for bitmap framebuffer support.
- bitmap and colormap ops based on old HP ngle X11 driver:
  http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/ic/sti.c#rev1.76
  > Work-in-progress support for non-accelerated X11 on *some* sti(4)
  > frame buffers; based upon the old HP ngle X11 driver.
  > Currently limited to CRX (720/735/750), Timber (710, old 715),
  > Artist (712, 715) and EG (B-series), however the
  > colormap isn't set up correctly on Timber and EG yet.
  >
  > Joint work with Artem Falcon, now in good enough shape to be worked further
  > in the tree.
- misc other cosmetic changes to reduce diffs
No particular comments on port-hp300@ and port-hppa@:
 https://mail-index.netbsd.org/port-hp300/2020/12/19/msg000184.html
 https://mail-index.netbsd.org/port-hp300/2020/12/20/msg000185.html

The MD hp300 attachment for SGC CRX (A1659-66001) will be committed
separately.

Add bitmap access ops support for SGC CRX (A1659-66001) framebuffer.
Also modify existing 425e EVRX attachment to use updated MI sti(4) ops
more efficiently.

The Xorg server and mlterm-wscons (that support wsdisplay bitmap) work
fine on SGC hp425t.

No particular comments on port-hp300@ and port-hppa@:
 https://mail-index.netbsd.org/port-hp300/2020/12/19/msg000184.html
 https://mail-index.netbsd.org/port-hp300/2020/12/20/msg000185.html

Special thanks to Miod Vallat again, for contributing the SGC CRX
framebuffer with the SGC connector and flexible cable for HP9000/425t.

He also contributed DIO-II "Hyperion" monochrome framebuffer and
1 plane grayscale SGC GRX (A1924-66001), and I've confirmed hyper(4)
just works even with Xorg server.  I will try GRX as the next project.

Handle WSSCREEN_REVERSE properly.  Based on OpenBSD's sti(4).

Also remove WSSCREEN_UNDERLINE from capabilities that is not handled
by sti(4) ROM routines.

Tested on HP9000/425t with CRX.

Ignore WSDISPLAYIO_PUTCMAP in WSDISPLAYIO_MODE_EMUL, i.e. text mode.

The hardware palette settings are handled by the STI ROM in STI_TEXTMODE
and changing cmap could cause mangled text colors at least on CRX on 425t.

Updating CMAP in EMUL mode isn't expected anyway.

Fixes "red or invisible text" after exiting mlterm-wscons on A1659 CRX.

diffstat:

 sys/arch/hp300/dev/sti_sgc.c |  220 +++++----------
 sys/dev/ic/sti.c             |  578 +++++++++++++++++++++++++++++++++---------
 sys/dev/ic/stivar.h          |   21 +-
 3 files changed, 549 insertions(+), 270 deletions(-)

diffs (truncated from 1259 to 300 lines):

diff -r 0917ef945aa7 -r 7b96e00aaa07 sys/arch/hp300/dev/sti_sgc.c
--- a/sys/arch/hp300/dev/sti_sgc.c      Mon Dec 28 20:02:30 2020 +0000
+++ b/sys/arch/hp300/dev/sti_sgc.c      Mon Dec 28 20:10:04 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sti_sgc.c,v 1.2.34.1 2020/05/18 17:52:22 martin Exp $  */
+/*     $NetBSD: sti_sgc.c,v 1.2.34.2 2020/12/28 20:10:04 martin Exp $  */
 /*     $OpenBSD: sti_sgc.c,v 1.14 2007/05/26 00:36:03 krw Exp $        */
 
 /*
@@ -27,7 +27,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.2.34.1 2020/05/18 17:52:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.2.34.2 2020/12/28 20:10:04 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -49,33 +49,40 @@
        struct sti_softc sc_sti;
 
        paddr_t sc_bitmap;
-       bus_space_tag_t sc_bst;
-       bus_space_handle_t sc_ramdach;
 };
 
 /*
  * 425e EVRX specific hardware
  */
-#define STI_EVRX_RAMDACOFFSET  0x060000
-#define STI_EVRX_RAMDACSIZE    0x000800
+/*
+ * EVRX RAMDAC (Bt458) is found at offset 0x060000 from SGC bus PA and 
+ * offset 0x040000 length 0x1c0000 is mapped in MI sti via ROM region 2
+ */
+#define STI_EVRX_REGNO2OFFSET  0x020000
 #define STI_EVRX_FBOFFSET      0x200000
 
-#define EVRX_BT458_ADDR                (0x200 + 2)
-#define EVRX_BT458_CMAP                (0x204 + 2)
-#define EVRX_BT458_CTRL                (0x208 + 2)
-#define EVRX_BT458_OMAP                (0x20C + 2)
+#define EVRX_BT458_ADDR                (STI_EVRX_REGNO2OFFSET + 0x200 + 2)
+#define EVRX_BT458_CMAP                (STI_EVRX_REGNO2OFFSET + 0x204 + 2)
+#define EVRX_BT458_CTRL                (STI_EVRX_REGNO2OFFSET + 0x208 + 2)
+#define EVRX_BT458_OMAP                (STI_EVRX_REGNO2OFFSET + 0x20C + 2)
 
 /* from HP-UX /usr/lib/libddevrx.a */
-#define EVRX_MAGIC00           0x600
-#define EVRX_MAGIC04           0x604
-#define EVRX_MAGIC08           0x608
-#define EVRX_MAGIC0C           0x60c
-#define EVRX_MAGIC10           0x610
+#define EVRX_MAGIC00           (STI_EVRX_REGNO2OFFSET + 0x600)
+#define EVRX_MAGIC04           (STI_EVRX_REGNO2OFFSET + 0x604)
+#define EVRX_MAGIC08           (STI_EVRX_REGNO2OFFSET + 0x608)
+#define EVRX_MAGIC0C           (STI_EVRX_REGNO2OFFSET + 0x60c)
+#define EVRX_MAGIC10           (STI_EVRX_REGNO2OFFSET + 0x610)
 #define EVRX_MAGIC10_BSY       0x00010000
-#define EVRX_MAGIC18           0x618
-#define EVRX_MAGIC1C           0x61c
+#define EVRX_MAGIC18           (STI_EVRX_REGNO2OFFSET + 0x618)
+#define EVRX_MAGIC1C           (STI_EVRX_REGNO2OFFSET + 0x61c)
+
+/*
+ * HP A1659A CRX specific hardware
+ */
+#define STI_CRX_FBOFFSET       0x01000000
 
 static int sticonslot = -1;
+static struct bus_space_tag sticn_tag;
 static struct sti_rom sticn_rom;
 static struct sti_screen sticn_scr;
 static bus_addr_t sticn_bases[STI_REGION_MAX];
@@ -88,16 +95,16 @@
 CFATTACH_DECL_NEW(sti_sgc, sizeof(struct sti_sgc_softc),
     sti_sgc_match, sti_sgc_attach, NULL, NULL);
 
-/* 425e EVRX specific access functions */
-static int sti_evrx_setcmap(struct sti_sgc_softc *, struct wsdisplay_cmap *);
-static void sti_evrx_resetramdac(struct sti_sgc_softc *);
-static void sti_evrx_resetcmap(struct sti_sgc_softc *);
-static int sti_evrx_ioctl(void *, void *, u_long, void *, int, struct lwp *);
-static paddr_t sti_evrx_mmap(void *, void *, off_t, int);
+/* 425e EVRX/CRX specific access functions */
+static int sti_evrx_putcmap(struct sti_screen *, u_int, u_int);
+static void sti_evrx_resetramdac(struct sti_screen *);
+static void sti_evrx_resetcmap(struct sti_screen *);
+static void sti_evrx_setupfb(struct sti_screen *);
+static paddr_t sti_m68k_mmap(void *, void *, off_t, int);
 
-static const struct wsdisplay_accessops sti_evrx_accessops = {
-       sti_evrx_ioctl,
-       sti_evrx_mmap,
+static const struct wsdisplay_accessops sti_m68k_accessops = {
+       sti_ioctl,
+       sti_m68k_mmap,
        sti_alloc_screen,
        sti_free_screen,
        sti_show_screen,
@@ -126,6 +133,7 @@
        struct sti_softc *ssc = &sc->sc_sti;
        struct sgc_attach_args *saa = aux;
        struct sti_screen *scr;
+       bus_space_tag_t bst;
        bus_space_handle_t romh;
        bus_addr_t base;
        struct wsemuldisplaydev_attach_args waa;
@@ -135,6 +143,7 @@
        int i;
 
        ssc->sc_dev = self;
+       bst = saa->saa_iot;
        base = (bus_addr_t)sgc_slottopa(saa->saa_slot);
 
        if (saa->saa_slot == sticonslot) {
@@ -147,18 +156,18 @@
 
                sti_describe(ssc);
        } else {
-               if (bus_space_map(saa->saa_iot, base, PAGE_SIZE, 0, &romh)) {
+               if (bus_space_map(bst, base, PAGE_SIZE, 0, &romh)) {
                        aprint_error(": can't map ROM");
                        return;
                }
                /*
                 * Compute real PROM size
                 */
-               romend = sti_rom_size(saa->saa_iot, romh);
+               romend = sti_rom_size(bst, romh);
 
-               bus_space_unmap(saa->saa_iot, romh, PAGE_SIZE);
+               bus_space_unmap(bst, romh, PAGE_SIZE);
 
-               if (bus_space_map(saa->saa_iot, base, romend, 0, &romh)) {
+               if (bus_space_map(bst, base, romend, 0, &romh)) {
                        aprint_error(": can't map frame buffer");
                        return;
                }
@@ -167,7 +176,7 @@
                for (i = 0; i < STI_REGION_MAX; i++)
                        ssc->bases[i] = base;
 
-               if (sti_attach_common(ssc, saa->saa_iot, saa->saa_iot, romh,
+               if (sti_attach_common(ssc, bst, bst, romh,
                    STI_CODEBASE_ALT) != 0)
                        return;
        }
@@ -185,29 +194,21 @@
                 */
                sc->sc_bitmap = base + STI_EVRX_FBOFFSET;
 
-               /*
-                * Bt458 RAMDAC can be accessed at offset +0x60200 and
-                * unknown control registers are around +0x60600.
-                */
-               sc->sc_bst = saa->saa_iot;
-               if (bus_space_map(sc->sc_bst, base + STI_EVRX_RAMDACOFFSET,
-                   STI_EVRX_RAMDACSIZE, 0, &sc->sc_ramdach)) {
-                       aprint_error_dev(self, "can't map RAMDAC\n");
-                       return;
-               }
-
                aprint_normal_dev(self, "Enable mmap support\n");
 
                /*
                 * initialize Bt458 RAMDAC and preserve initial color map
                 */
-               sti_evrx_resetramdac(sc);
-               sti_evrx_resetcmap(sc);
+               sti_evrx_resetramdac(scr);
+               sti_evrx_resetcmap(scr);
+
+               scr->setupfb = sti_evrx_setupfb;
+               scr->putcmap = sti_evrx_putcmap;
 
                scr->scr_wsmode = WSDISPLAYIO_MODE_EMUL;
                waa.console = ssc->sc_flags & STI_CONSOLE ? 1 : 0;
                waa.scrdata = &scr->scr_screenlist;
-               waa.accessops = &sti_evrx_accessops;
+               waa.accessops = &sti_m68k_accessops;
                waa.accesscookie = scr;
 
                config_found(ssc->sc_dev, &waa, wsemuldisplaydevprint);
@@ -216,9 +217,20 @@
        case STI_DD_CRX:
                /*
                 * HP A1659A CRX on some 425t variants.
-                * Not investigated yet; needs to check HP-UX libddgcrx.a etc.
+                * bitmap memory can be accessed at offset +0x1000000.
                 */
-               /* FALLTHROUGH */
+               sc->sc_bitmap = base + STI_CRX_FBOFFSET;
+
+               aprint_normal_dev(self, "Enable mmap support\n");
+
+               scr->scr_wsmode = WSDISPLAYIO_MODE_EMUL;
+               waa.console = ssc->sc_flags & STI_CONSOLE ? 1 : 0;
+               waa.scrdata = &scr->scr_screenlist;
+               waa.accessops = &sti_m68k_accessops;
+               waa.accesscookie = scr;
+
+               config_found(ssc->sc_dev, &waa, wsemuldisplaydevprint);
+               break;
        default:
                /*
                 * Unsupported variants.
@@ -256,34 +268,12 @@
 }
 
 static int
-sti_evrx_setcmap(struct sti_sgc_softc *sc, struct wsdisplay_cmap *p)
+sti_evrx_putcmap(struct sti_screen *scr, u_int index, u_int count)
 {
-       struct sti_softc *ssc = &sc->sc_sti;
-       struct sti_screen *scr = ssc->sc_scr;
-       bus_space_tag_t bst = sc->sc_bst;
-       bus_space_handle_t bsh = sc->sc_ramdach;
-       uint8_t r[STI_NCMAP], g[STI_NCMAP], b[STI_NCMAP];
-       u_int index, count;
-       int i, error;
-
-       index = p->index;
-       count = p->count;
-       if (index >= STI_NCMAP || count > STI_NCMAP - index)
-               return EINVAL;
-
-       error = copyin(p->red, &r[index], count);
-       if (error)
-               return error;
-       error = copyin(p->green, &g[index], count);
-       if (error)
-               return error;
-       error = copyin(p->blue, &b[index], count);
-       if (error)
-               return error;
-
-       memcpy(&scr->scr_rcmap[index], &r[index], count);
-       memcpy(&scr->scr_gcmap[index], &g[index], count);
-       memcpy(&scr->scr_bcmap[index], &b[index], count);
+       struct sti_rom *rom = scr->scr_rom;
+       bus_space_tag_t bst = rom->memt;
+       bus_space_handle_t bsh = rom->regh[2];
+       int i;
 
        /* magic setup from HP-UX */
        bus_space_write_4(bst, bsh, EVRX_MAGIC08, 0x00000001);
@@ -302,10 +292,11 @@
 }
 
 static void
-sti_evrx_resetramdac(struct sti_sgc_softc *sc)
+sti_evrx_resetramdac(struct sti_screen *scr)
 {
-       bus_space_tag_t bst = sc->sc_bst;
-       bus_space_handle_t bsh = sc->sc_ramdach;
+       struct sti_rom *rom = scr->scr_rom;
+       bus_space_tag_t bst = rom->memt;
+       bus_space_handle_t bsh = rom->regh[2];
 #if 0
        int i;
 #endif
@@ -351,12 +342,11 @@
 }
 
 static void
-sti_evrx_resetcmap(struct sti_sgc_softc *sc)
+sti_evrx_resetcmap(struct sti_screen *scr)
 {
-       struct sti_softc *ssc = &sc->sc_sti;
-       struct sti_screen *scr = ssc->sc_scr;
-       bus_space_tag_t bst = sc->sc_bst;
-       bus_space_handle_t bsh = sc->sc_ramdach;
+       struct sti_rom *rom = scr->scr_rom;
+       bus_space_tag_t bst = rom->memt;
+       bus_space_handle_t bsh = rom->regh[2];
        int i;
 
        /* magic setup from HP-UX */
@@ -376,68 +366,16 @@
        }
 }
 
-static int
-sti_evrx_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
-    struct lwp *l)
+static void
+sti_evrx_setupfb(struct sti_screen *scr)
 {
-       struct sti_screen *scr = (struct sti_screen *)v;
-       struct sti_rom *rom = scr->scr_rom;
-       struct sti_softc *ssc = rom->rom_softc;
-       struct sti_sgc_softc *sc = device_private(ssc->sc_dev);
-       struct wsdisplay_fbinfo *wdf;
-       struct wsdisplay_cmap *cmapp;
-       u_int idx, count;
-       int error, new_mode;
-
-       switch (cmd) {
-       case WSDISPLAYIO_GINFO:



Home | Main Index | Thread Index | Old Index