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 CirrusLogic GD542...
details: https://anonhg.NetBSD.org/src/rev/91a10356f49a
branches: trunk
changeset: 341674:91a10356f49a
user: phx <phx%NetBSD.org@localhost>
date: Mon Nov 16 21:25:34 2015 +0000
description:
wscons and Xorg support for CirrusLogic GD542x based boards (grf3).
diffstat:
sys/arch/amiga/conf/WSCONS | 4 +-
sys/arch/amiga/dev/grf_cl.c | 431 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 424 insertions(+), 11 deletions(-)
diffs (truncated from 557 to 300 lines):
diff -r 673a2db78638 -r 91a10356f49a sys/arch/amiga/conf/WSCONS
--- a/sys/arch/amiga/conf/WSCONS Mon Nov 16 21:24:06 2015 +0000
+++ b/sys/arch/amiga/conf/WSCONS Mon Nov 16 21:25:34 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: WSCONS,v 1.68 2015/11/13 16:04:07 phx Exp $
+# $NetBSD: WSCONS,v 1.69 2015/11/16 21:25:34 phx Exp $
# GENERIC with wscons(4)
#
@@ -27,13 +27,11 @@
no grfcc0 at mainbus0
no grfrt0 at zbus0
no grfrh0 at zbus0
-no grfcl* at zbus0
no grful0 at zbus0
no grfet* at zbus0
no grf0 at grfcc0
no grf1 at grfrt0
no grf2 at grfrh0
-no grf3 at grfcl?
no grf4 at grful0
no grf6 at grfet?
diff -r 673a2db78638 -r 91a10356f49a sys/arch/amiga/dev/grf_cl.c
--- a/sys/arch/amiga/dev/grf_cl.c Mon Nov 16 21:24:06 2015 +0000
+++ b/sys/arch/amiga/dev/grf_cl.c Mon Nov 16 21:25:34 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: grf_cl.c,v 1.49 2014/01/22 00:25:16 christos Exp $ */
+/* $NetBSD: grf_cl.c,v 1.50 2015/11/16 21:25:34 phx Exp $ */
/*
* Copyright (c) 1997 Klaus Burkert
@@ -36,10 +36,11 @@
#include "opt_amigacons.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cl.c,v 1.49 2014/01/22 00:25:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cl.c,v 1.50 2015/11/16 21:25:34 phx Exp $");
#include "grfcl.h"
#include "ite.h"
+#include "wsdisplay.h"
#if NGRFCL > 0
/*
@@ -81,6 +82,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
#include <amiga/dev/itevar.h>
#include <amiga/amiga/device.h>
#include <amiga/dev/grfioctl.h>
@@ -106,7 +113,8 @@
static int cl_setspriteinfo(struct grf_softc *, struct grf_spriteinfo *);
int cl_getspriteinfo(struct grf_softc *, struct grf_spriteinfo *);
static int cl_getspritemax(struct grf_softc *, struct grf_position *);
-int cl_blank(struct grf_softc *, int *);
+int cl_blank(struct grf_softc *, int);
+int cl_isblank(struct grf_softc *);
int cl_setmonitor(struct grf_softc *, struct grfvideo_mode *);
void cl_writesprpos(volatile char *, short, short);
void writeshifted(volatile char *, signed char, signed char);
@@ -120,6 +128,21 @@
int grfclmatch(device_t, cfdata_t, void *);
void cl_memset(unsigned char *, unsigned char, int);
+#if NWSDISPLAY > 0
+/* wsdisplay acessops, emulops */
+static int cl_wsioctl(void *, void *, u_long, void *, int, struct lwp *);
+static int cl_get_fbinfo(struct grf_softc *, struct wsdisplayio_fbinfo *);
+
+static void cl_wscursor(void *, int, int, int);
+static void cl_wsputchar(void *, int, int, u_int, long);
+static void cl_wscopycols(void *, int, int, int, int);
+static void cl_wserasecols(void *, int, int, int, long);
+static void cl_wscopyrows(void *, int, int, int);
+static void cl_wseraserows(void *, int, int, long);
+static int cl_wsallocattr(void *, int, int, int, long *);
+static int cl_wsmapchar(void *, int, unsigned int *);
+#endif /* NWSDISPLAY > 0 */
+
/* Graphics display definitions.
* These are filled by 'grfconfig' using GRFIOCSETMON.
*/
@@ -162,6 +185,7 @@
int cltype = 0; /* Picasso, Spectrum or Piccolo */
int cl_64bit = 0; /* PiccoloSD64 or PicassoIV */
unsigned char cl_pass_toggle; /* passthru status tracker */
+static int cl_blanked; /* true when video is currently blanked out */
/*
* because all 542x-boards have 2 configdev entries, one for
@@ -188,6 +212,41 @@
static unsigned char cl_imageptr[8 * 64], cl_maskptr[8 * 64];
static unsigned char cl_sprred[2], cl_sprgreen[2], cl_sprblue[2];
+#if NWSDISPLAY > 0
+static struct wsdisplay_accessops cl_accessops = {
+ .ioctl = cl_wsioctl,
+ .mmap = grf_wsmmap
+};
+
+static struct wsdisplay_emulops cl_textops = {
+ .cursor = cl_wscursor,
+ .mapchar = cl_wsmapchar,
+ .putchar = cl_wsputchar,
+ .copycols = cl_wscopycols,
+ .erasecols = cl_wserasecols,
+ .copyrows = cl_wscopyrows,
+ .eraserows = cl_wseraserows,
+ .allocattr = cl_wsallocattr
+};
+
+static struct wsscreen_descr cl_defaultscreen = {
+ .name = "default",
+ .textops = &cl_textops,
+ .fontwidth = 8,
+ .fontheight = CIRRUSFONTY,
+ .capabilities = WSSCREEN_HILIT | WSSCREEN_BLINK |
+ WSSCREEN_REVERSE | WSSCREEN_UNDERLINE
+};
+
+static const struct wsscreen_descr *cl_screens[] = {
+ &cl_defaultscreen,
+};
+
+static struct wsscreen_list cl_screenlist = {
+ sizeof(cl_screens) / sizeof(struct wsscreen_descr *), cl_screens
+};
+#endif /* NWSDISPLAY > 0 */
+
/* standard driver stuff */
CFATTACH_DECL_NEW(grfcl, sizeof(struct grf_softc),
grfclmatch, grfclattach, NULL, NULL);
@@ -377,13 +436,20 @@
/* wakeup the board */
cl_boardinit(gp);
+
#ifdef CL5426CONSOLE
+#if NWSDISPLAY > 0
+ gp->g_accessops = &cl_accessops;
+ gp->g_emulops = &cl_textops;
+ gp->g_defaultscr = &cl_defaultscreen;
+ gp->g_scrlist = &cl_screenlist;
+#else
#if NITE > 0
grfcl_iteinit(gp);
#endif
+#endif /* NWSDISPLAY > 0 */
(void) cl_load_mon(gp, &clconsole_mode);
#endif
-
}
/*
@@ -488,6 +554,7 @@
/* setup initial unchanging parameters */
+ cl_blanked = 1;
WSeq(ba, SEQ_ID_CLOCKING_MODE, 0x21); /* 8 dot - display off */
vgaw(ba, GREG_MISC_OUTPUT_W, 0xed); /* mem disable */
@@ -660,14 +727,24 @@
RegOnpass(ba);
vgaw(ba, SEQ_ADDRESS, SEQ_ID_CLOCKING_MODE);
vgaw(ba, SEQ_ADDRESS_W, vgar(ba, SEQ_ADDRESS_W) | 0x20);
+ cl_blanked = 1;
}
#endif
int
-cl_blank(struct grf_softc *gp, int *on)
+cl_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 ? 0x01 : 0x21);
+ cl_blanked = !on;
+ return 0;
+}
+
+int
+cl_isblank(struct grf_softc *gp)
+{
+
+ return cl_blanked;
}
/*
@@ -755,7 +832,7 @@
return (cl_setmonitor(gp, (struct grfvideo_mode *) data));
case GRFIOCBLANK:
- return (cl_blank(gp, (int *)data));
+ return (cl_blank(gp, *(int *)data));
}
return (EPASSTHROUGH);
@@ -1626,6 +1703,7 @@
}
WSeq(ba, SEQ_ID_CURSOR_ATTR, 0x14);
WSeq(ba, SEQ_ID_CLOCKING_MODE, 0x01);
+ cl_blanked = 0;
/* Pass-through */
@@ -1772,4 +1850,341 @@
delay(200000);
}
+#if NWSDISPLAY > 0
+static void
+cl_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);
+ }
+}
+
+static void
+cl_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
+cl_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;
+ src = gp->g_fbkva;
+
+ src += gp->g_rowoffset[row];
+ dst = src;
+ src += srccol;
+ dst += dstcol;
+ if (srccol < dstcol) {
+ /* need to copy backwards */
+ src += ncols;
+ dst += ncols;
Home |
Main Index |
Thread Index |
Old Index