Add a driver for MNTMN VA2000.

Supports accelerated wsdisplay console and running X via wsfb driver.
This commit is contained in:
rkujawa 2016-10-03 14:26:02 +00:00
parent 150a47b73e
commit a1ee30a19f
7 changed files with 831 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.73 2011/12/15 14:25:12 phx Exp $ */
/* $NetBSD: conf.c,v 1.74 2016/10/03 14:26:02 rkujawa Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.73 2011/12/15 14:25:12 phx Exp $");
__KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.74 2016/10/03 14:26:02 rkujawa Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.73 2011/12/15 14:25:12 phx Exp $");
#include "ser.h"
#include "ite.h"
#include "amidisplaycc.h"
#include "mntva.h"
#include "wsdisplay.h"
/*
@ -51,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.73 2011/12/15 14:25:12 phx Exp $");
* known algorithm unless we see a pressing need otherwise.
*/
cons_decl(ser);
cons_decl(mntva);
cons_decl(grf);
cons_decl(amidisplaycc_);
cons_decl(ite);
@ -59,6 +61,9 @@ struct consdev constab[] = {
#if NSER > 0
cons_init(ser),
#endif
#if NMNTVA > 0
cons_init(mntva),
#endif
#if NWSDISPLAY > 0
{ dev_init(grf,cnprobe), dev_init(grf,cninit) },
#endif

View File

@ -1,4 +1,4 @@
# $NetBSD: WSCONS,v 1.69 2015/11/16 21:25:34 phx Exp $
# $NetBSD: WSCONS,v 1.70 2016/10/03 14:26:02 rkujawa Exp $
# GENERIC with wscons(4)
#
@ -45,6 +45,9 @@ no ite5 at grf5
no ite6 at grf6
no ite7 at grf7
mntva* at zbus? # MNTMN VA2000
#options MNTVA_CONSOLE
# PCI framebuffers
#genfb* at pci? # CyberVisionPPC/BlizzardVisionPPC only
voodoofb* at pci? # 3Dfx Voodoo 3 in G-REX
@ -59,3 +62,4 @@ wsdisplay* at wsemuldisplaydev? console ?
pseudo-device wsfont # wsfont(4) dynamic font loading support
pseudo-device wsmux # mouse & keyboard multiplexor

View File

@ -1,4 +1,4 @@
# $NetBSD: files.amiga,v 1.177 2015/03/04 19:10:20 mlelstv Exp $
# $NetBSD: files.amiga,v 1.178 2016/10/03 14:26:02 rkujawa Exp $
# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@ -20,6 +20,8 @@ defflag opt_amigacons.h RETINACONSOLE ULOWELLCONSOLE CL5426CONSOLE
defflag opt_amigacons.h CV64CONSOLE CV3DCONSOLE TSENGCONSOLE
defflag opt_amigacons.h SERCONSOLE
defflag opt_mntva.h MNTVA_CONSOLE
defflag opt_kfont.h KFONT_CONS_ISO8859_1
defflag opt_kfont.h KFONT_CONS_ISO8859_2
@ -218,6 +220,11 @@ attach grfcv3d at zbus
file arch/amiga/dev/grf_cv3d.c grfcv3d needs-flag
file arch/amiga/dev/ite_cv3d.c grfcv3d & ite
# MNT VA2000
device mntva: wsemuldisplaydev, rasops16, rasops32, vcons, videomode
attach mntva at zbus
file arch/amiga/dev/mntva.c mntva needs-flag
# device defined in sys/conf/files
# A2065, Ameristar, Ariadne ethernet cards
attach le at zbus with le_zbus: le24

623
sys/arch/amiga/dev/mntva.c Normal file
View File

@ -0,0 +1,623 @@
/* $NetBSD: mntva.c,v 1.1 2016/10/03 14:26:02 rkujawa Exp $ */
/*
* Copyright (c) 2012, 2016 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Lukas F. Hartmann.
* This code is derived from software contributed to The NetBSD Foundation
* by Radoslaw Kujawa.
*
* 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.
*
* 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 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 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/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mntva.c,v 1.1 2016/10/03 14:26:02 rkujawa Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/endian.h>
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/conf.h>
#include <dev/cons.h>
#include <amiga/amiga/device.h>
#include <amiga/amiga/isr.h>
#include <amiga/dev/zbusvar.h>
#include <amiga/dev/mntvavar.h>
#include <amiga/dev/mntvareg.h>
#include <dev/wsfb/genfbvar.h>
#include "opt_amigacons.h"
#include "opt_wsemul.h"
#include "opt_mntva.h"
#include "opt_wsfb.h"
#include "mntva.h"
/* #define MNTVA_DEBUG 1 */
static int mntva_match(device_t, cfdata_t, void *);
static void mntva_attach(device_t, device_t, void *);
static uint16_t mntva_reg_read(struct mntva_softc *sc, uint32_t reg);
static void mntva_reg_write(struct mntva_softc *sc, uint32_t reg, uint32_t val);
static bool mntva_mode_set(struct mntva_softc *sc);
static paddr_t mntva_mmap(void *v, void *vs, off_t offset, int prot);
static int mntva_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
struct lwp *l);
static void mntva_init_screen(void *cookie, struct vcons_screen *scr,
int existing, long *defattr);
static void mntva_init_palette(struct mntva_softc *sc);
/* blitter support */
static void mntva_rectfill(struct mntva_softc *sc, int x, int y, int wi,
int he, uint32_t color);
static void mntva_bitblt(struct mntva_softc *sc, int xs, int ys, int xd,
int yd, int wi, int he);
/* accelerated raster ops */
static void mntva_eraserows(void *cookie, int row, int nrows, long fillattr);
static void mntva_copyrows(void *cookie, int srcrow, int dstrow, int nrows);
static void mntva_copycols(void *cookie, int row, int srccol, int dstcol,
int ncols);
static void mntva_erasecols(void *cookie, int row, int startcol, int ncols,
long fillattr);
#if 0
static void mntva_cursor(void *cookie, int on, int row, int col);
#endif
/*
* XXX: these will be called by console handling code, shouldn't they be
* included from somewhere else?
*/
void mntvacninit(struct consdev *cd);
void mntvacnprobe(struct consdev *cd);
void mntvacnputc(dev_t cd, int ch);
int mntvacngetc(dev_t cd);
void mntvacnpollc(dev_t cd, int on);
CFATTACH_DECL_NEW(mntva, sizeof(struct mntva_softc),
mntva_match, mntva_attach, NULL, NULL);
struct wsdisplay_accessops mntva_accessops = {
mntva_ioctl,
mntva_mmap,
NULL, // alloc_screen
NULL, // free_screen
NULL, // show_screen
NULL, // load_font
NULL, // pollc
NULL // scroll
};
static int
mntva_match(device_t parent, cfdata_t match, void *aux)
{
struct zbus_args *zap = aux;
if (zap->manid == 0x6d6e && zap->prodid == 1) {
#ifdef MNTVA_DEBUG
/* XXX: this might not work during console init? */
aprint_normal("mntva_match... success!\n");
#endif /* MNTVA_DEBUG */
return 1;
}
return 0;
}
static void
mntva_attach(device_t parent, device_t self, void *aux)
{
struct mntva_softc *sc = device_private(self);
struct wsemuldisplaydev_attach_args ws_aa;
struct rasops_info *ri;
struct zbus_args *zap = aux;
long defattr;
sc->sc_isconsole = false;
/* this should come from "opt_mntva.h" auto generated by kernel conf system */
#ifdef MNTVA_CONSOLE
sc->sc_isconsole = true;
#endif /* MNTVA_CONSOLE */
printf(": MNTMN VA2000");
if(sc->sc_isconsole)
printf(" (console)");
printf("\n");
sc->sc_dev = self;
sc->sc_memsize = MNTVA_FB_SIZE;
sc->sc_bst.base = (bus_addr_t) zap->va;
sc->sc_bst.absm = &amiga_bus_stride_1;
sc->sc_iot = &sc->sc_bst;
if (bus_space_map(sc->sc_iot, MNTVA_OFF_FB, sc->sc_memsize + 0x1000,
BUS_SPACE_MAP_LINEAR, &sc->sc_fbh)) {
aprint_error_dev(sc->sc_dev, "mapping framebuffer failed\n");
return;
}
if (bus_space_map(sc->sc_iot, MNTVA_OFF_REG, MNTVA_REG_SIZE , 0,
&sc->sc_regh)) {
aprint_error_dev(sc->sc_dev, "mapping registers failed\n");
return;
}
sc->sc_regpa = (bus_addr_t) kvtop((void*) sc->sc_regh);
sc->sc_fbpa = (bus_addr_t) kvtop((void*) sc->sc_fbh);
/* print the physical and virt addresses for registers and fb */
aprint_normal_dev(sc->sc_dev,
"registers at pa/va 0x%08x/0x%08x, fb at pa/va 0x%08x/0x%08x\n",
(uint32_t) sc->sc_regpa,
(uint32_t) bus_space_vaddr(sc->sc_iot, sc->sc_regh),
(uint32_t) sc->sc_fbpa,
(uint32_t) bus_space_vaddr(sc->sc_iot, sc->sc_fbh));
sc->sc_width = 1280;
sc->sc_height = 720;
sc->sc_bpp = 16;
sc->sc_linebytes = 4096;
aprint_normal_dev(sc->sc_dev, "%zu kB framebuffer memory present\n",
sc->sc_memsize / 1024);
aprint_normal_dev(sc->sc_dev, "setting %dx%d %d bpp resolution\n",
sc->sc_width, sc->sc_height, sc->sc_bpp);
mntva_mode_set(sc);
sc->sc_defaultscreen_descr = (struct wsscreen_descr) {
"default", 0, 0, NULL, 8, 16,
WSSCREEN_WSCOLORS | WSSCREEN_HILIT, NULL };
sc->sc_screens[0] = &sc->sc_defaultscreen_descr;
sc->sc_screenlist = (struct wsscreen_list) { 1, sc->sc_screens };
sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
vcons_init(&sc->vd, sc, &sc->sc_defaultscreen_descr, &mntva_accessops);
sc->vd.init_screen = mntva_init_screen;
ri = &sc->sc_console_screen.scr_ri;
mntva_init_palette(sc);
if (sc->sc_isconsole) {
vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
&defattr);
sc->sc_console_screen.scr_flags = VCONS_SCREEN_IS_STATIC;
vcons_redraw_screen(&sc->sc_console_screen);
sc->sc_defaultscreen_descr.textops = &ri->ri_ops;
sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
wsdisplay_cnattach(&sc->sc_defaultscreen_descr, ri, 0, 0,
defattr);
vcons_replay_msgbuf(&sc->sc_console_screen);
} else {
if (sc->sc_console_screen.scr_ri.ri_rows == 0) {
vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
&defattr);
} else
(*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
}
ws_aa.console = sc->sc_isconsole;
ws_aa.scrdata = &sc->sc_screenlist;
ws_aa.accessops = &mntva_accessops;
ws_aa.accesscookie = &sc->vd;
config_found(sc->sc_dev, &ws_aa, wsemuldisplaydevprint);
}
static void
mntva_init_palette(struct mntva_softc *sc)
{
int i, j;
j = 0;
for (i=0; i<256; i++) {
mntva_reg_write(sc, 0x200+i*2, rasops_cmap[j]);
mntva_reg_write(sc, 0x400+i*2, rasops_cmap[j+1]);
mntva_reg_write(sc, 0x600+i*2, rasops_cmap[j+2]);
j+=3;
}
}
static void
mntva_init_screen(void *cookie, struct vcons_screen *scr, int existing,
long *defattr)
{
struct mntva_softc *sc = cookie;
struct rasops_info *ri = &scr->scr_ri;
wsfont_init();
ri->ri_depth = sc->sc_bpp;
ri->ri_width = sc->sc_width;
ri->ri_height = sc->sc_height;
ri->ri_stride = sc->sc_linebytes;
ri->ri_flg = 0;
/*ri->ri_flg = RI_BSWAP;*/
ri->ri_bits = (char *) bus_space_vaddr(sc->sc_iot, sc->sc_fbh);
#ifdef MNTVA_DEBUG
aprint_normal_dev(sc->sc_dev, "ri_bits: %p\n", ri->ri_bits);
#endif /* MNTVA_DEBUG */
scr->scr_flags = VCONS_SCREEN_IS_STATIC;
rasops_init(ri, 0, 0);
ri->ri_caps = WSSCREEN_WSCOLORS;
rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
sc->sc_width / ri->ri_font->fontwidth);
ri->ri_hw = scr;
ri->ri_ops.eraserows = mntva_eraserows;
ri->ri_ops.copyrows = mntva_copyrows;
ri->ri_ops.erasecols = mntva_erasecols;
ri->ri_ops.copycols = mntva_copycols;
#if 0
ri->ri_ops.cursor = mntva_cursor;
#endif
}
static bool
mntva_mode_set(struct mntva_softc *sc)
{
mntva_reg_write(sc, MNTVA_SCALEMODE, 0);
mntva_reg_write(sc, MNTVA_SCREENW, sc->sc_width);
mntva_reg_write(sc, MNTVA_SCREENH, sc->sc_height);
if (sc->sc_bpp == 8)
mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE8);
else if (sc->sc_bpp == 16)
mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE16);
else if (sc->sc_bpp == 32)
mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE32);
mntva_reg_write(sc, MNTVA_PANPTRHI, 0);
mntva_reg_write(sc, MNTVA_PANPTRLO, 0);
mntva_reg_write(sc, MNTVA_BLITTERBASEHI, 0);
mntva_reg_write(sc, MNTVA_BLITTERBASELO, 0);
/* XXX: should rectfill with bg color taken from wscons? */
mntva_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height, 0xffffffff);
return true;
}
static uint16_t
mntva_reg_read(struct mntva_softc *sc, uint32_t reg)
{
uint32_t rv;
rv = bus_space_read_2(sc->sc_iot, sc->sc_regh, reg);
return rv;
}
static void
mntva_reg_write(struct mntva_softc *sc, uint32_t reg, uint32_t val)
{
bus_space_write_2(sc->sc_iot, sc->sc_regh, reg, val);
}
static void
mntva_rectfill(struct mntva_softc *sc, int x, int y, int wi, int he,
uint32_t color)
{
mntva_reg_write(sc, MNTVA_BLITTERRGB, (uint16_t) color);
mntva_reg_write(sc, MNTVA_BLITTERX1, (uint16_t) x);
mntva_reg_write(sc, MNTVA_BLITTERY1, (uint16_t) y);
mntva_reg_write(sc, MNTVA_BLITTERX2, (uint16_t) x + wi - 1);
mntva_reg_write(sc, MNTVA_BLITTERY2, (uint16_t) y + he - 1);
mntva_reg_write(sc, MNTVA_BLITTER_ENABLE, MNTVA_BLITTER_FILL);
while(mntva_reg_read(sc, MNTVA_BLITTER_ENABLE)) {
/* busy wait */
}
}
static void
mntva_bitblt(struct mntva_softc *sc, int xs, int ys, int xd, int yd, int wi,
int he)
{
mntva_reg_write(sc, MNTVA_BLITTERX1, (uint16_t) xd);
mntva_reg_write(sc, MNTVA_BLITTERY1, (uint16_t) yd);
mntva_reg_write(sc, MNTVA_BLITTERX2, (uint16_t) xd + wi - 1);
mntva_reg_write(sc, MNTVA_BLITTERY2, (uint16_t) yd + he - 1);
mntva_reg_write(sc, MNTVA_BLITTERX3, (uint16_t) xs);
mntva_reg_write(sc, MNTVA_BLITTERY3, (uint16_t) ys);
mntva_reg_write(sc, MNTVA_BLITTERX4, (uint16_t) xs + wi - 1);
mntva_reg_write(sc, MNTVA_BLITTERY4, (uint16_t) ys + he - 1);
mntva_reg_write(sc, MNTVA_BLITTER_ENABLE, MNTVA_BLITTER_COPY);
while(mntva_reg_read(sc, MNTVA_BLITTER_ENABLE)) {
/* busy wait */
}
}
static void
mntva_copyrows(void *cookie, int srcrow, int dstrow, int nrows)
{
struct mntva_softc *sc;
struct rasops_info *ri;
struct vcons_screen *scr;
int x, ys, yd, wi, he;
ri = cookie;
scr = ri->ri_hw;
sc = scr->scr_cookie;
if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
x = ri->ri_xorigin;
ys = ri->ri_yorigin + ri->ri_font->fontheight * srcrow;
yd = ri->ri_yorigin + ri->ri_font->fontheight * dstrow;
wi = ri->ri_emuwidth;
he = ri->ri_font->fontheight * nrows;
mntva_bitblt(sc, x, ys, x, yd, wi, he);
}
}
static void
mntva_eraserows(void *cookie, int row, int nrows, long fillattr)
{
struct mntva_softc *sc;
struct rasops_info *ri;
struct vcons_screen *scr;
int x, y, wi, he, fg, bg, ul;
ri = cookie;
scr = ri->ri_hw;
sc = scr->scr_cookie;
if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
rasops_unpack_attr(fillattr, &fg, &bg, &ul);
if ((row == 0) && (nrows == ri->ri_rows))
mntva_rectfill(sc, 0, 0, ri->ri_width,
ri->ri_height, ri->ri_devcmap[bg]);
else {
x = ri->ri_xorigin;
y = ri->ri_yorigin + ri->ri_font->fontheight * row;
wi = ri->ri_emuwidth;
he = ri->ri_font->fontheight * nrows;
mntva_rectfill(sc, x, y, wi, he, ri->ri_devcmap[bg]);
}
}
}
static void
mntva_copycols(void *cookie, int row, int srccol, int dstcol, int ncols)
{
struct mntva_softc *sc;
struct rasops_info *ri;
struct vcons_screen *scr;
int xs, xd, y, w, h;
ri = cookie;
scr = ri->ri_hw;
sc = scr->scr_cookie;
if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
xs = ri->ri_xorigin + ri->ri_font->fontwidth * srccol;
xd = ri->ri_xorigin + ri->ri_font->fontwidth * dstcol;
y = ri->ri_yorigin + ri->ri_font->fontheight * row;
w = ri->ri_font->fontwidth * ncols;
h = ri->ri_font->fontheight;
mntva_bitblt(sc, xs, y, xd, y, w, h);
}
}
static void
mntva_erasecols(void *cookie, int row, int startcol, int ncols, long fillattr)
{
struct mntva_softc *sc;
struct rasops_info *ri;
struct vcons_screen *scr;
int x, y, w, h, fg, bg, ul;
ri = cookie;
scr = ri->ri_hw;
sc = scr->scr_cookie;
if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
x = ri->ri_xorigin + ri->ri_font->fontwidth * startcol;
y = ri->ri_yorigin + ri->ri_font->fontheight * row;
w = ri->ri_font->fontwidth * ncols;
h = ri->ri_font->fontheight;
rasops_unpack_attr(fillattr, &fg, &bg, &ul);
mntva_rectfill(sc, x, y, w, h, ri->ri_devcmap[bg & 0xf]);
}
}
static int
mntva_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
{
struct vcons_data *vd;
struct mntva_softc *sc;
struct wsdisplay_fbinfo *wsfbi;
struct vcons_screen *ms;
struct wsdisplayio_bus_id *busid;
vd = v;
sc = vd->cookie;
ms = vd->active;
switch (cmd) {
case WSDISPLAYIO_GTYPE:
*(u_int *) data = WSDISPLAY_TYPE_UNKNOWN;
return 0;
case WSDISPLAYIO_GET_BUSID:
busid = data;
busid->bus_type = WSDISPLAYIO_BUS_SOC;
return 0;
case WSDISPLAYIO_GINFO:
if (ms == NULL)
return ENODEV;
wsfbi = (void *) data;
wsfbi->height = ms->scr_ri.ri_height;
wsfbi->width = ms->scr_ri.ri_width;
wsfbi->depth = ms->scr_ri.ri_depth;
wsfbi->cmsize = 256;
return 0;
case WSDISPLAYIO_LINEBYTES:
*(u_int *) data = sc->sc_linebytes;
return 0;
case WSDISPLAYIO_SMODE:
{
int new_mode = *(int *) data;
if (new_mode != sc->sc_mode) {
sc->sc_mode = new_mode;
if (new_mode == WSDISPLAYIO_MODE_EMUL)
vcons_redraw_screen(ms);
}
return 0;
}
case WSDISPLAYIO_GET_FBINFO:
{
struct wsdisplayio_fbinfo *fbi = data;
struct rasops_info *ri;
int ret;
ri = &sc->vd.active->scr_ri;
ret = wsdisplayio_get_fbinfo(ri, fbi);
return ret;
}
}
return EPASSTHROUGH;
}
#if 0
static void
mntva_cursor(void *cookie, int on, int row, int col)
{
struct mntva_softc *sc;
struct rasops_info *ri;
struct vcons_screen *scr;
int x, y, wi, he;
ri = cookie;
scr = ri->ri_hw;
sc = scr->scr_cookie;
wi = ri->ri_font->fontwidth;
he = ri->ri_font->fontheight;
if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
x = ri->ri_ccol * wi + ri->ri_xorigin;
y = ri->ri_crow * he + ri->ri_yorigin;
if (ri->ri_flg & RI_CURSOR) {
mntva_bitblt(sc, x, y, x, y, wi, he);
ri->ri_flg &= ~RI_CURSOR;
}
ri->ri_crow = row;
ri->ri_ccol = col;
if (on) {
x = ri->ri_ccol * wi + ri->ri_xorigin;
y = ri->ri_crow * he + ri->ri_yorigin;
mntva_bitblt(sc, x, y, x, y, wi, he);
ri->ri_flg |= RI_CURSOR;
}
} else {
scr->scr_ri.ri_crow = row;
scr->scr_ri.ri_ccol = col;
scr->scr_ri.ri_flg &= ~RI_CURSOR;
}
}
#endif
static paddr_t
mntva_mmap(void *v, void *vs, off_t offset, int prot)
{
struct vcons_data *vd;
struct mntva_softc *sc;
paddr_t pa;
vd = v;
sc = vd->cookie;
if (offset >= 0 && offset < sc->sc_memsize) {
pa = bus_space_mmap(sc->sc_iot, sc->sc_fbpa, offset, prot,
BUS_SPACE_MAP_LINEAR);
return pa;
}
return -1;
}
void
mntvacninit(struct consdev *cd)
{
/*wsdisplay_preattach(sc->sc_defaultscreen, ri, 0, 0, defattr);*/
}
void
mntvacnprobe(struct consdev *cd)
{
/*
* This isn't exactly true, but cons.h does not define anything
* that would fit our case exactly.
*/
cd->cn_pri = CN_INTERNAL;
cd->cn_dev = NODEV; /* Filled later by wscons. */
}
/* ARGSUSED */
void
mntvacnputc(dev_t cd, int ch)
{
}
/* ARGSUSED */
int
mntvacngetc(dev_t cd)
{
return(0);
}
/* ARGSUSED */
void
mntvacnpollc(dev_t cd, int on)
{
}

View File

@ -0,0 +1,106 @@
/* $NetBSD: mntvareg.h,v 1.1 2016/10/03 14:26:02 rkujawa Exp $ */
/*
* Copyright (c) 2012, 2016 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Lukas F. Hartmann.
* This code is derived from software contributed to The NetBSD Foundation
* by Radoslaw Kujawa.
*
* 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.
*
* 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 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 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 MNTVA2000REG_H
#define MNTVA2000REG_H
/* address space */
#define MNTVA_OFF_REG 0x5f0000 /* memory mapped registers */
#define MNTVA_REG_SIZE 0xFF
#define MNTVA_OFF_FB 0x000000 /* frame buffer */
#define MNTVA_FB_SIZE 0x5f0000
/* registers */
#define MNTVA_SCALEMODE 0x04
#define MNTVA_SCALEMODE1X 0
#define MNTVA_SCALEMODE2X 1
#define MNTVA_SCALEMODE3X 2
#define MNTVA_SCALEMODE4X 3
#define MNTVA_SCREENW 0x06
#define MNTVA_SCREENH 0x08
#define MNTVA_BLITTERBASEHI 0x1C /* [23:16] */
#define MNTVA_BLITTERBASELO 0x1E /* [15:0] */
#define MNTVA_BLITTERX1 0x20
#define MNTVA_BLITTERY1 0x22
#define MNTVA_BLITTERX2 0x24
#define MNTVA_BLITTERY2 0x26
#define MNTVA_BLITTERRGB 0x28 /* filling for 16bit and 8bit modes */
#define MNTVA_BLITTER_ENABLE 0x2A
#define MNTVA_BLITTER_FILL __BIT(0) /* fill [x1,y1]-[x2,y2] */
#define MNTVA_BLITTER_COPY __BIT(1) /* copy [x3,y3]-[x4,y4] to
[x1,y1]-[x2,y2] */
#define MNTVA_BLITTERX3 0x2C
#define MNTVA_BLITTERY3 0x2E
#define MNTVA_BLITTERX4 0x30
#define MNTVA_BLITTERY4 0x32
#define MNTVA_BLITTERRGB32HI 0x34 /* filling for 24bit and 32bit modes */
#define MNTVA_BLITTERRGB32LO 0x36 /* filling for 24bit and 32bit modes */
#define MNTVA_COLORMODE 0x48
#define MNTVA_COLORMODE8 0
#define MNTVA_COLORMODE16 __BIT(0)
#define MNTVA_COLORMODE32 __BIT(1)
#define MNTVA_PANPTRHI 0x38 /* [23:16] */
#define MNTVA_PANPTRLO 0x3A /* [15:0] */
#define MNTVA_BLITTERX1 0x20
#define MNTVA_BLITTERY1 0x22
#define MNTVA_BLITTERX2 0x24
#define MNTVA_BLITTERY2 0x26
#define MNTVA_BLITTERRGB 0x28 /* filling for 16bit and 8bit modes */
#define MNTVA_BLITTER_ENABLE 0x2A
#define MNTVA_BLITTER_FILL __BIT(0) /* fill [x1,y1]-[x2,y2] */
#define MNTVA_BLITTER_COPY __BIT(1) /* copy [x3,y3]-[x4,y4] to
[x1,y1]-[x2,y2] */
#define MNTVA_BLITTERX3 0x2C
#define MNTVA_BLITTERY3 0x2E
#define MNTVA_BLITTERX4 0x30
#define MNTVA_BLITTERY4 0x32
#define MNTVA_BLITTERRGB32HI 0x34 /* filling for 24bit and 32bit modes */
#define MNTVA_BLITTERRGB32LO 0x36 /* filling for 24bit and 32bit modes */
#define MNTVA_COLORMODE 0x48
#define MNTVA_COLORMODE8 0
#define MNTVA_COLORMODE16 __BIT(0)
#define MNTVA_COLORMODE32 __BIT(1)
#define MNTVA_PANPTRHI 0x38 /* [23:16] */
#define MNTVA_PANPTRLO 0x3A /* [15:0] */
#endif /* MNTVA2000REG_H */

View File

@ -0,0 +1,76 @@
/* $NetBSD: mntvavar.h,v 1.1 2016/10/03 14:26:02 rkujawa Exp $ */
/*
* Copyright (c) 2012, 2016 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Lukas F. Hartmann.
* This code is derived from software contributed to The NetBSD Foundation
* by Radoslaw Kujawa.
*
* 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.
*
* 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 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 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 MNTVA2000VAR_H
#define MNTVA2000VAR_H
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wsfont/wsfont.h>
#include <dev/rasops/rasops.h>
#include <dev/wscons/wsdisplay_vconsvar.h>
struct mntva_softc
{
device_t sc_dev;
/* bus attachment, handles */
struct bus_space_tag sc_bst;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_regh;
bus_space_handle_t sc_fbh;
bus_addr_t sc_regpa;
bus_addr_t sc_fbpa;
size_t sc_memsize;
int sc_width, sc_height, sc_linebytes, sc_bpp;
int sc_mode;
uint32_t sc_bg;
struct vcons_screen sc_console_screen;
struct vcons_data vd;
struct wsscreen_descr sc_defaultscreen_descr;
const struct wsscreen_descr *sc_screens[1];
struct wsscreen_list sc_screenlist;
bool sc_isconsole;
u_char sc_cmap_red[256];
u_char sc_cmap_green[256];
u_char sc_cmap_blue[256];
};
#endif /* MNTVA2000VAR_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: zbus.c,v 1.73 2012/11/26 22:58:24 rkujawa Exp $ */
/* $NetBSD: zbus.c,v 1.74 2016/10/03 14:26:02 rkujawa Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.73 2012/11/26 22:58:24 rkujawa Exp $");
__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.74 2016/10/03 14:26:02 rkujawa Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -192,7 +192,9 @@ static const struct aconfdata aconftab[] = {
{ "hyper4+", 5001, 6}, /* Hypercom4+ */
{ "hyper3+", 5001, 7}, /* Hypercom3+ */
/* Matay Grzegorz Kraszewski */
{ "mppb", 44359, 1} /* Prometheus PCI bridge */
{ "mppb", 44359, 1}, /* Prometheus PCI bridge */
/* MNTMN */
{ "mntva", 28014, 1} /* MNTMN VA2000 */
};
static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata);
@ -226,6 +228,7 @@ static struct preconfdata preconftab[] = {
{2167, 3, 0}, /* Domino regs (proto 16M) */
{2181, 0, 0}, /* oMniBus mem or regs */
{8512, 67, 0} /* Cybervison 64/3D */ /* grf7 */
/* {28014, 1, 0} // MNTMN VA2000 */
};
static int npreconfent = sizeof(preconftab) / sizeof(struct preconfdata);