Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amiga wscons and Xorg support for Tseng ET4000/W32 ...



details:   https://anonhg.NetBSD.org/src/rev/1517119f3c45
branches:  trunk
changeset: 348726:1517119f3c45
user:      phx <phx%NetBSD.org@localhost>
date:      Fri Nov 04 18:06:08 2016 +0000

description:
wscons and Xorg support for Tseng ET4000/W32 based boards (grf6).

diffstat:

 sys/arch/amiga/conf/WSCONS  |    4 +-
 sys/arch/amiga/dev/grf_et.c |  471 +++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 444 insertions(+), 31 deletions(-)

diffs (truncated from 567 to 300 lines):

diff -r 0cd6f2d17a19 -r 1517119f3c45 sys/arch/amiga/conf/WSCONS
--- a/sys/arch/amiga/conf/WSCONS        Fri Nov 04 16:35:32 2016 +0000
+++ b/sys/arch/amiga/conf/WSCONS        Fri Nov 04 18:06:08 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: WSCONS,v 1.70 2016/10/03 14:26:02 rkujawa Exp $
+# $NetBSD: WSCONS,v 1.71 2016/11/04 18:06:08 phx Exp $
 
 # GENERIC with wscons(4)
 #
@@ -28,12 +28,10 @@
 no grfrt0      at zbus0
 no grfrh0      at zbus0
 no grful0      at zbus0
-no grfet*      at zbus0
 no grf0                at grfcc0
 no grf1                at grfrt0
 no grf2                at grfrh0
 no grf4                at grful0
-no grf6                at grfet?
 
 # Disable ite(4) for all grf(4) drivers.
 no ite0                at grf0
diff -r 0cd6f2d17a19 -r 1517119f3c45 sys/arch/amiga/dev/grf_et.c
--- a/sys/arch/amiga/dev/grf_et.c       Fri Nov 04 16:35:32 2016 +0000
+++ b/sys/arch/amiga/dev/grf_et.c       Fri Nov 04 18:06:08 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: grf_et.c,v 1.32 2014/01/22 00:25:16 christos Exp $ */
+/*     $NetBSD: grf_et.c,v 1.33 2016/11/04 18:06:08 phx Exp $ */
 
 /*
  * Copyright (c) 1997 Klaus Burkert
@@ -37,10 +37,11 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_et.c,v 1.32 2014/01/22 00:25:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_et.c,v 1.33 2016/11/04 18:06:08 phx Exp $");
 
 #include "grfet.h"
 #include "ite.h"
+#include "wsdisplay.h"
 #if NGRFET > 0
 
 /*
@@ -72,6 +73,12 @@
 
 #include <machine/cpu.h>
 #include <dev/cons.h>
+#if NWSDISPLAY > 0
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/rasops/rasops.h>
+#include <dev/wscons/wsdisplay_vconsvar.h>
+#endif
 #ifdef TSENGCONSOLE
 #include <amiga/dev/itevar.h>
 #endif
@@ -81,34 +88,50 @@
 #include <amiga/dev/grf_etreg.h>
 #include <amiga/dev/zbusvar.h>
 
-int    et_mondefok(struct grfvideo_mode *gv);
-void   et_boardinit(struct grf_softc *gp);
-static void et_CompFQ(u_int fq, u_char *num, u_char *denom);
-int    et_getvmode(struct grf_softc *gp, struct grfvideo_mode *vm);
-int    et_setvmode(struct grf_softc *gp, unsigned int mode);
-int    et_toggle(struct grf_softc *gp, unsigned short);
-int    et_getcmap(struct grf_softc *gfp, struct grf_colormap *cmap);
-int    et_putcmap(struct grf_softc *gfp, struct grf_colormap *cmap);
+int    et_mondefok(struct grfvideo_mode *);
+void   et_boardinit(struct grf_softc *);
+static void et_CompFQ(u_int fq, u_char *, u_char *);
+int    et_getvmode(struct grf_softc *, struct grfvideo_mode *);
+int    et_setvmode(struct grf_softc *, unsigned int);
+int    et_toggle(struct grf_softc *, unsigned short);
+int    et_getcmap(struct grf_softc *, struct grf_colormap *);
+int    et_putcmap(struct grf_softc *, struct grf_colormap *);
 #ifndef TSENGCONSOLE
-void   et_off(struct grf_softc *gp);
+void   et_off(struct grf_softc *);
 #endif
-void   et_inittextmode(struct grf_softc *gp);
-int    et_ioctl(register struct grf_softc *gp, u_long cmd, void *data);
-int    et_getmousepos(struct grf_softc *gp, struct grf_position *data);
-void   et_writesprpos(volatile char *ba, short x, short y);
-int    et_setmousepos(struct grf_softc *gp, struct grf_position *data);
-static int et_setspriteinfo(struct grf_softc *gp, struct grf_spriteinfo *data);
-int    et_getspriteinfo(struct grf_softc *gp, struct grf_spriteinfo *data);
-static int et_getspritemax(struct grf_softc *gp, struct grf_position *data);
-int    et_setmonitor(struct grf_softc *gp, struct grfvideo_mode *gv);
-int    et_blank(struct grf_softc *gp, int *on);
-static int et_getControllerType(struct grf_softc *gp);
-static int et_getDACType(struct grf_softc *gp);
+void   et_inittextmode(struct grf_softc *);
+int    et_ioctl(register struct grf_softc *, u_long cmd, void *);
+int    et_getmousepos(struct grf_softc *, struct grf_position *);
+void   et_writesprpos(volatile char *ba, short, short);
+int    et_setmousepos(struct grf_softc *, struct grf_position *);
+static int et_setspriteinfo(struct grf_softc *, struct grf_spriteinfo *);
+int    et_getspriteinfo(struct grf_softc *, struct grf_spriteinfo *);
+static int et_getspritemax(struct grf_softc *, struct grf_position *);
+int    et_setmonitor(struct grf_softc *, struct grfvideo_mode *);
+int    et_blank(struct grf_softc *, int);
+int    et_isblank(struct grf_softc *);
+static int et_getControllerType(struct grf_softc *);
+static int et_getDACType(struct grf_softc *);
 
 int    grfetmatch(device_t, cfdata_t, void *);
 void   grfetattach(device_t, device_t, void *);
 int    grfetprint(void *, const char *);
-void   et_memset(volatile unsigned char *d, unsigned char c, int l);
+void   et_memset(volatile unsigned char *, unsigned char, int);
+
+#if NWSDISPLAY > 0
+/* wsdisplay acessops, emulops */
+static int     et_wsioctl(void *, void *, u_long, void *, int, struct lwp *);
+static int     et_get_fbinfo(struct grf_softc *, struct wsdisplayio_fbinfo *);
+
+static void    et_wscursor(void *, int, int, int);
+static void    et_wsputchar(void *, int, int, u_int, long);
+static void    et_wscopycols(void *, int, int, int, int);
+static void    et_wserasecols(void *, int, int, int, long);
+static void    et_wscopyrows(void *, int, int, int);
+static void    et_wseraserows(void *, int, int, long);
+static int     et_wsallocattr(void *, int, int, int, long *);
+static int     et_wsmapchar(void *, int, unsigned int *);
+#endif  /* NWSDISPLAY > 0 */
 
 /*
  * Graphics display definitions.
@@ -179,6 +202,41 @@
 static unsigned char et_imageptr[8 * 64], et_maskptr[8 * 64];
 static unsigned char et_sprred[2], et_sprgreen[2], et_sprblue[2];
 
+#if NWSDISPLAY > 0
+static struct wsdisplay_accessops et_accessops = {
+       .ioctl          = et_wsioctl,
+       .mmap           = grf_wsmmap
+};
+
+static struct wsdisplay_emulops et_textops = {
+       .cursor         = et_wscursor,
+       .mapchar        = et_wsmapchar,
+       .putchar        = et_wsputchar,
+       .copycols       = et_wscopycols,
+       .erasecols      = et_wserasecols,
+       .copyrows       = et_wscopyrows,
+       .eraserows      = et_wseraserows,
+       .allocattr      = et_wsallocattr
+};
+
+static struct wsscreen_descr et_defaultscreen = {
+       .name           = "default",
+       .textops        = &et_textops,
+       .fontwidth      = 8,
+       .fontheight     = TSENGFONTY,
+       .capabilities   = WSSCREEN_HILIT | WSSCREEN_BLINK |
+                         WSSCREEN_REVERSE | WSSCREEN_UNDERLINE
+};
+
+static const struct wsscreen_descr *et_screens[] = {
+       &et_defaultscreen,
+};
+
+static struct wsscreen_list et_screenlist = {
+       sizeof(et_screens) / sizeof(struct wsscreen_descr *), et_screens
+};
+#endif  /* NWSDISPLAY > 0 */
+
 /* standard driver stuff */
 CFATTACH_DECL_NEW(grfet, sizeof(struct grf_softc),
     grfetmatch, grfetattach, NULL, NULL);
@@ -312,9 +370,16 @@
                et_boardinit(gp);
 
 #ifdef TSENGCONSOLE
+#if NWSDISPLAY > 0
+               gp->g_accessops = &et_accessops;
+               gp->g_emulops = &et_textops;
+               gp->g_defaultscr = &et_defaultscreen;
+               gp->g_scrlist = &et_screenlist;
+#else
 #if NITE > 0
                grfet_iteinit(gp);
 #endif
+#endif  /* NWSDISPLAY > 0 */
                (void) et_load_mon(gp, &etconsole_mode);
 #endif
        }
@@ -621,10 +686,21 @@
 
 
 int
-et_blank(struct grf_softc *gp, int *on)
+et_blank(struct grf_softc *gp, int on)
 {
-       WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, *on > 0 ? 0x01 : 0x21);
-       return(0);
+
+       WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, on > 0 ? 0x01 : 0x21);
+       return 0;
+}
+
+
+int
+et_isblank(struct grf_softc *gp)
+{
+       int r;
+
+       r = RSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE);
+       return (r & 0x20) != 0;
 }
 
 
@@ -715,7 +791,7 @@
                return (et_setmonitor(gp, (struct grfvideo_mode *) data));
 
            case GRFIOCBLANK:
-               return (et_blank(gp, (int *)data));
+               return (et_blank(gp, *(int *)data));
        }
        return (EPASSTHROUGH);
 }
@@ -1598,4 +1674,343 @@
        return (SIERRA11483);
 }
 
+
+#if NWSDISPLAY > 0
+static void
+et_wscursor(void *c, int on, int row, int col) 
+{
+       struct rasops_info *ri;
+       struct vcons_screen *scr;
+       struct grf_softc *gp;
+       volatile void *ba;
+       int offs;
+
+       ri = c;
+       scr = ri->ri_hw;
+       gp = scr->scr_cookie;
+       ba = gp->g_regkva;
+
+       if ((ri->ri_flg & RI_CURSOR) && !on) {
+               /* cursor was visible, but we want to remove it */
+               /*WCrt(ba, CRT_ID_CURSOR_START, | 0x20);*/
+               ri->ri_flg &= ~RI_CURSOR;
+       }
+
+       ri->ri_crow = row;
+       ri->ri_ccol = col;
+
+       if (on) {
+               /* move cursor to new location */
+               if (!(ri->ri_flg & RI_CURSOR)) {
+                       /*WCrt(ba, CRT_ID_CURSOR_START, | 0x20);*/
+                       ri->ri_flg |= RI_CURSOR;
+               }
+               offs = gp->g_rowoffset[row] + col;
+               WCrt(ba, CRT_ID_CURSOR_LOC_LOW, offs & 0xff);
+               WCrt(ba, CRT_ID_CURSOR_LOC_HIGH, (offs >> 8) & 0xff);
+               WCrt(ba, CRT_ID_EXT_START, (offs >> (16-2)) & 0x0c);
+       }
+}
+
+static void
+et_wsputchar(void *c, int row, int col, u_int ch, long attr)
+{
+       struct rasops_info *ri;
+       struct vcons_screen *scr;
+       struct grf_softc *gp;
+       volatile unsigned char *ba, *cp;
+
+       ri = c;
+       scr = ri->ri_hw;
+       gp = scr->scr_cookie;
+       ba = gp->g_regkva;
+       cp = gp->g_fbkva;
+
+       cp += gp->g_rowoffset[row] + col;
+       SetTextPlane(ba, 0x00);
+       *cp = ch;
+       SetTextPlane(ba, 0x01);
+       *cp = attr;
+}
+
+static void     
+et_wscopycols(void *c, int row, int srccol, int dstcol, int ncols) 
+{
+       volatile unsigned char *ba, *dst, *src;
+       struct rasops_info *ri;
+       struct vcons_screen *scr;
+       struct grf_softc *gp;
+       int i;
+
+       KASSERT(ncols > 0);
+       ri = c;
+       scr = ri->ri_hw;
+       gp = scr->scr_cookie;
+       ba = gp->g_regkva;



Home | Main Index | Thread Index | Old Index