Mon Oct 3 14:26:02 2016 UTC ()
Add a driver for MNTMN VA2000.

Supports accelerated wsdisplay console and running X via wsfb driver.


(rkujawa)
diff -r1.73 -r1.74 src/sys/arch/amiga/amiga/conf.c
diff -r1.69 -r1.70 src/sys/arch/amiga/conf/WSCONS
diff -r1.177 -r1.178 src/sys/arch/amiga/conf/files.amiga
diff -r0 -r1.1 src/sys/arch/amiga/dev/mntva.c
diff -r0 -r1.1 src/sys/arch/amiga/dev/mntvareg.h
diff -r0 -r1.1 src/sys/arch/amiga/dev/mntvavar.h
diff -r1.73 -r1.74 src/sys/arch/amiga/dev/zbus.c

cvs diff -r1.73 -r1.74 src/sys/arch/amiga/amiga/conf.c (expand / switch to unified diff)

--- src/sys/arch/amiga/amiga/conf.c 2011/12/15 14:25:12 1.73
+++ src/sys/arch/amiga/amiga/conf.c 2016/10/03 14:26:02 1.74
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: conf.c,v 1.73 2011/12/15 14:25:12 phx Exp $ */ 1/* $NetBSD: conf.c,v 1.74 2016/10/03 14:26:02 rkujawa Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1991 The Regents of the University of California. 4 * Copyright (c) 1991 The Regents of the University of California.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -22,51 +22,56 @@ @@ -22,51 +22,56 @@
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 * 30 *
31 * @(#)conf.c 7.9 (Berkeley) 5/28/91 31 * @(#)conf.c 7.9 (Berkeley) 5/28/91
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.73 2011/12/15 14:25:12 phx Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.74 2016/10/03 14:26:02 rkujawa Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/conf.h> 38#include <sys/conf.h>
39 39
40#include <dev/cons.h> 40#include <dev/cons.h>
41 41
42#include "ser.h" 42#include "ser.h"
43#include "ite.h" 43#include "ite.h"
44#include "amidisplaycc.h" 44#include "amidisplaycc.h"
 45#include "mntva.h"
45#include "wsdisplay.h" 46#include "wsdisplay.h"
46 47
47/* 48/*
48 * This entire table could be autoconfig()ed but that would mean that 49 * This entire table could be autoconfig()ed but that would mean that
49 * the kernel's idea of the console would be out of sync with that of 50 * the kernel's idea of the console would be out of sync with that of
50 * the standalone boot. I think it best that they both use the same 51 * the standalone boot. I think it best that they both use the same
51 * known algorithm unless we see a pressing need otherwise. 52 * known algorithm unless we see a pressing need otherwise.
52 */ 53 */
53cons_decl(ser); 54cons_decl(ser);
 55cons_decl(mntva);
54cons_decl(grf); 56cons_decl(grf);
55cons_decl(amidisplaycc_); 57cons_decl(amidisplaycc_);
56cons_decl(ite); 58cons_decl(ite);
57 59
58struct consdev constab[] = { 60struct consdev constab[] = {
59#if NSER > 0 61#if NSER > 0
60 cons_init(ser), 62 cons_init(ser),
61#endif 63#endif
 64#if NMNTVA > 0
 65 cons_init(mntva),
 66#endif
62#if NWSDISPLAY > 0 67#if NWSDISPLAY > 0
63 { dev_init(grf,cnprobe), dev_init(grf,cninit) }, 68 { dev_init(grf,cnprobe), dev_init(grf,cninit) },
64#endif 69#endif
65#if NAMIDISPLAYCC > 0 70#if NAMIDISPLAYCC > 0
66 cons_init(amidisplaycc_), 71 cons_init(amidisplaycc_),
67#endif 72#endif
68#if NITE > 0 73#if NITE > 0
69 cons_init(ite), 74 cons_init(ite),
70#endif 75#endif
71 { 0 }, 76 { 0 },
72}; 77};

cvs diff -r1.69 -r1.70 src/sys/arch/amiga/conf/WSCONS (expand / switch to unified diff)

--- src/sys/arch/amiga/conf/WSCONS 2015/11/16 21:25:34 1.69
+++ src/sys/arch/amiga/conf/WSCONS 2016/10/03 14:26:02 1.70
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: WSCONS,v 1.69 2015/11/16 21:25:34 phx Exp $ 1# $NetBSD: WSCONS,v 1.70 2016/10/03 14:26:02 rkujawa Exp $
2 2
3# GENERIC with wscons(4) 3# GENERIC with wscons(4)
4# 4#
5include "arch/amiga/conf/GENERIC" 5include "arch/amiga/conf/GENERIC"
6 6
7# wscons(4)-aware interface to amiga custom chips. 7# wscons(4)-aware interface to amiga custom chips.
8# 8#
9options WSEMUL_VT100 9options WSEMUL_VT100
10options WSDISPLAY_COMPAT_USL # wsconscfg VT handling 10options WSDISPLAY_COMPAT_USL # wsconscfg VT handling
11options FONT_VT220L8x10 11options FONT_VT220L8x10
12options FONT_VT220ISO8x16 12options FONT_VT220ISO8x16
13 13
14wskbd0 at kbd0 console ? 14wskbd0 at kbd0 console ?
@@ -35,27 +35,31 @@ no grf2 at grfrh0 @@ -35,27 +35,31 @@ no grf2 at grfrh0
35no grf4 at grful0 35no grf4 at grful0
36no grf6 at grfet? 36no grf6 at grfet?
37 37
38# Disable ite(4) for all grf(4) drivers. 38# Disable ite(4) for all grf(4) drivers.
39no ite0 at grf0 39no ite0 at grf0
40no ite1 at grf1 40no ite1 at grf1
41no ite2 at grf2 41no ite2 at grf2
42no ite3 at grf3 42no ite3 at grf3
43no ite4 at grf4 43no ite4 at grf4
44no ite5 at grf5 44no ite5 at grf5
45no ite6 at grf6 45no ite6 at grf6
46no ite7 at grf7 46no ite7 at grf7
47 47
 48mntva* at zbus? # MNTMN VA2000
 49#options MNTVA_CONSOLE
 50
48# PCI framebuffers 51# PCI framebuffers
49#genfb* at pci? # CyberVisionPPC/BlizzardVisionPPC only 52#genfb* at pci? # CyberVisionPPC/BlizzardVisionPPC only
50voodoofb* at pci? # 3Dfx Voodoo 3 in G-REX  53voodoofb* at pci? # 3Dfx Voodoo 3 in G-REX
51#radeonfb* at pci? # untested 54#radeonfb* at pci? # untested
52 55
53# Console support for CyberVisionPPC, BlizzardVisionPPC and 3Dfx Voodoo 3 in  56# Console support for CyberVisionPPC, BlizzardVisionPPC and 3Dfx Voodoo 3 in
54# G-REX. 57# G-REX.
55#options P5PB_CONSOLE 58#options P5PB_CONSOLE
56 59
57wsdisplay0 at wsemuldisplaydev? console 1 60wsdisplay0 at wsemuldisplaydev? console 1
58wsdisplay* at wsemuldisplaydev? console ? 61wsdisplay* at wsemuldisplaydev? console ?
59 62
60pseudo-device wsfont # wsfont(4) dynamic font loading support 63pseudo-device wsfont # wsfont(4) dynamic font loading support
61pseudo-device wsmux # mouse & keyboard multiplexor 64pseudo-device wsmux # mouse & keyboard multiplexor
 65

cvs diff -r1.177 -r1.178 src/sys/arch/amiga/conf/files.amiga (expand / switch to unified diff)

--- src/sys/arch/amiga/conf/files.amiga 2015/03/04 19:10:20 1.177
+++ src/sys/arch/amiga/conf/files.amiga 2016/10/03 14:26:02 1.178
@@ -1,35 +1,37 @@ @@ -1,35 +1,37 @@
1# $NetBSD: files.amiga,v 1.177 2015/03/04 19:10:20 mlelstv Exp $ 1# $NetBSD: files.amiga,v 1.178 2016/10/03 14:26:02 rkujawa Exp $
2 2
3# maxpartitions must be first item in files.${ARCH}.newconf 3# maxpartitions must be first item in files.${ARCH}.newconf
4maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL! 4maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
5 5
6defflag opt_m060sp.h M060SP 6defflag opt_m060sp.h M060SP
7defflag PANICBUTTON # panic on kbd NMI if not DDB 7defflag PANICBUTTON # panic on kbd NMI if not DDB
8 8
9maxusers 2 8 64 9maxusers 2 8 64
10 10
11defflag opt_amigaccgrf.h GRF_NTSC 11defflag opt_amigaccgrf.h GRF_NTSC
12defflag opt_amigaccgrf.h GRF_PAL :GRF_NTSC # temporary workaround 12defflag opt_amigaccgrf.h GRF_PAL :GRF_NTSC # temporary workaround
13defflag opt_amigaccgrf.h GRF_ECS GRF_AGA 13defflag opt_amigaccgrf.h GRF_ECS GRF_AGA
14defflag opt_amigaccgrf.h GRF_A2024:GRF_ECS 14defflag opt_amigaccgrf.h GRF_A2024:GRF_ECS
15defflag opt_amigaccgrf.h GRF_AGA_VGA:GRF_AGA 15defflag opt_amigaccgrf.h GRF_AGA_VGA:GRF_AGA
16defflag opt_amigaccgrf.h GRF_SUPER72:GRF_AGA 16defflag opt_amigaccgrf.h GRF_SUPER72:GRF_AGA
17defflag opt_amigaccgrf.h USE_C_BFOPS 17defflag opt_amigaccgrf.h USE_C_BFOPS
18 18
19defflag opt_amigacons.h RETINACONSOLE ULOWELLCONSOLE CL5426CONSOLE 19defflag opt_amigacons.h RETINACONSOLE ULOWELLCONSOLE CL5426CONSOLE
20defflag opt_amigacons.h CV64CONSOLE CV3DCONSOLE TSENGCONSOLE 20defflag opt_amigacons.h CV64CONSOLE CV3DCONSOLE TSENGCONSOLE
21defflag opt_amigacons.h SERCONSOLE 21defflag opt_amigacons.h SERCONSOLE
22 22
 23defflag opt_mntva.h MNTVA_CONSOLE
 24
23defflag opt_kfont.h KFONT_CONS_ISO8859_1 25defflag opt_kfont.h KFONT_CONS_ISO8859_1
24defflag opt_kfont.h KFONT_CONS_ISO8859_2 26defflag opt_kfont.h KFONT_CONS_ISO8859_2
25 27
26defparam opt_retina.h RH_MEMCLK 28defparam opt_retina.h RH_MEMCLK
27defflag opt_retina.h RH_64BIT_SPRITE RH_HARDWARECURSOR 29defflag opt_retina.h RH_64BIT_SPRITE RH_HARDWARECURSOR
28defflag opt_retina.h RETINA_SPEED_HACK 30defflag opt_retina.h RETINA_SPEED_HACK
29 31
30defflag BB060STUPIDROM 32defflag BB060STUPIDROM
31defflag P5PPC68KBOARD 33defflag P5PPC68KBOARD
32defflag LEV6_DEFER 34defflag LEV6_DEFER
33defflag DEVRELOAD 35defflag DEVRELOAD
34 36
35defflag opt_p5pb.h P5PB_DEBUG P5PB_CONSOLE 37defflag opt_p5pb.h P5PB_DEBUG P5PB_CONSOLE
@@ -208,26 +210,31 @@ file arch/amiga/dev/ite_cv.c grfcv & it @@ -208,26 +210,31 @@ file arch/amiga/dev/ite_cv.c grfcv & it
208 210
209# Tseng grf (ite6 grf6) 211# Tseng grf (ite6 grf6)
210device grfet: grfbus 212device grfet: grfbus
211attach grfet at zbus 213attach grfet at zbus
212file arch/amiga/dev/grf_et.c grfet needs-flag 214file arch/amiga/dev/grf_et.c grfet needs-flag
213file arch/amiga/dev/ite_et.c grfet & ite 215file arch/amiga/dev/ite_et.c grfet & ite
214 216
215# CyberVison 64/3D grf (ite7 grf7) 217# CyberVison 64/3D grf (ite7 grf7)
216device grfcv3d: grfbus 218device grfcv3d: grfbus
217attach grfcv3d at zbus 219attach grfcv3d at zbus
218file arch/amiga/dev/grf_cv3d.c grfcv3d needs-flag 220file arch/amiga/dev/grf_cv3d.c grfcv3d needs-flag
219file arch/amiga/dev/ite_cv3d.c grfcv3d & ite 221file arch/amiga/dev/ite_cv3d.c grfcv3d & ite
220 222
 223# MNT VA2000
 224device mntva: wsemuldisplaydev, rasops16, rasops32, vcons, videomode
 225attach mntva at zbus
 226file arch/amiga/dev/mntva.c mntva needs-flag
 227
221# device defined in sys/conf/files 228# device defined in sys/conf/files
222# A2065, Ameristar, Ariadne ethernet cards 229# A2065, Ameristar, Ariadne ethernet cards
223attach le at zbus with le_zbus: le24 230attach le at zbus with le_zbus: le24
224file arch/amiga/dev/if_le.c le_zbus needs-flag 231file arch/amiga/dev/if_le.c le_zbus needs-flag
225 232
226# AriadneII ethernet card 233# AriadneII ethernet card
227# device defined in sys/conf/files 234# device defined in sys/conf/files
228attach ne at zbus with ne_zbus: rtl80x9 235attach ne at zbus with ne_zbus: rtl80x9
229file arch/amiga/dev/if_ne_zbus.c ne_zbus needs-flag 236file arch/amiga/dev/if_ne_zbus.c ne_zbus needs-flag
230 237
231# X-Surf 238# X-Surf
232define xsurfbus {} 239define xsurfbus {}
233 240

File Added: src/sys/arch/amiga/dev/mntva.c
/*	$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)
{
}


File Added: src/sys/arch/amiga/dev/mntvareg.h
/*	$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 */

File Added: src/sys/arch/amiga/dev/mntvavar.h
/*  $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 */

cvs diff -r1.73 -r1.74 src/sys/arch/amiga/dev/zbus.c (expand / switch to unified diff)

--- src/sys/arch/amiga/dev/zbus.c 2012/11/26 22:58:24 1.73
+++ src/sys/arch/amiga/dev/zbus.c 2016/10/03 14:26:02 1.74
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: zbus.c,v 1.73 2012/11/26 22:58:24 rkujawa Exp $ */ 1/* $NetBSD: zbus.c,v 1.74 2016/10/03 14:26:02 rkujawa Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1994 Christian E. Hopps 4 * Copyright (c) 1994 Christian E. Hopps
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.73 2012/11/26 22:58:24 rkujawa Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.74 2016/10/03 14:26:02 rkujawa Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/device.h> 37#include <sys/device.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/bus.h> 39#include <sys/bus.h>
40 40
41#include <machine/cpu.h> 41#include <machine/cpu.h>
42#include <machine/pte.h> 42#include <machine/pte.h>
43#include <amiga/amiga/cfdev.h> 43#include <amiga/amiga/cfdev.h>
44#include <amiga/amiga/device.h> 44#include <amiga/amiga/device.h>
45#include <amiga/dev/zbusvar.h> 45#include <amiga/dev/zbusvar.h>
46#include <amiga/dev/z3rambdvar.h> 46#include <amiga/dev/z3rambdvar.h>
47 47
@@ -182,27 +182,29 @@ static const struct aconfdata aconftab[] @@ -182,27 +182,29 @@ static const struct aconfdata aconftab[]
182 { "apssc", 8738, 35 }, /* Apollo '060 scsi */ 182 { "apssc", 8738, 35 }, /* Apollo '060 scsi */
183 /* KATO development */ 183 /* KATO development */
184 { "aumld", 2145, 128 }, /* Melody MPEG layer 2 audio board */ 184 { "aumld", 2145, 128 }, /* Melody MPEG layer 2 audio board */
185 /* Individual Computers Jens Schoenfeld */ 185 /* Individual Computers Jens Schoenfeld */
186 { "buddha", 4626, 0 }, 186 { "buddha", 4626, 0 },
187 { "xsurf", 4626, 23 }, /* X-Surf Ethernet */ 187 { "xsurf", 4626, 23 }, /* X-Surf Ethernet */
188 /* VMC Harald Frank */ 188 /* VMC Harald Frank */
189 { "blst", 5001, 1}, /* ISDN Blaster */ 189 { "blst", 5001, 1}, /* ISDN Blaster */
190 { "hyper4", 5001, 2}, /* Hypercom4-Zbus */ 190 { "hyper4", 5001, 2}, /* Hypercom4-Zbus */
191 { "hyper3Z", 5001, 3}, /* Hypercom3-Zbus */ 191 { "hyper3Z", 5001, 3}, /* Hypercom3-Zbus */
192 { "hyper4+", 5001, 6}, /* Hypercom4+ */ 192 { "hyper4+", 5001, 6}, /* Hypercom4+ */
193 { "hyper3+", 5001, 7}, /* Hypercom3+ */ 193 { "hyper3+", 5001, 7}, /* Hypercom3+ */
194 /* Matay Grzegorz Kraszewski */ 194 /* Matay Grzegorz Kraszewski */
195 { "mppb", 44359, 1} /* Prometheus PCI bridge */ 195 { "mppb", 44359, 1}, /* Prometheus PCI bridge */
 196 /* MNTMN */
 197 { "mntva", 28014, 1} /* MNTMN VA2000 */
196}; 198};
197static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata); 199static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata);
198 200
199/* 201/*
200 * Anything listed in this table is subject to pre-configuration, 202 * Anything listed in this table is subject to pre-configuration,
201 * if autoconf.c:config_console() calls amiga_config_found() on 203 * if autoconf.c:config_console() calls amiga_config_found() on
202 * the Zorro III device. 204 * the Zorro III device.
203 */ 205 */
204static struct preconfdata preconftab[] = { 206static struct preconfdata preconftab[] = {
205 {18260, 6, 0 }, /* Retina Z2 */ /* grf1 */ 207 {18260, 6, 0 }, /* Retina Z2 */ /* grf1 */
206 {18260, 16, 0}, /* Retina BLT Z3 */ /* grf2 */ 208 {18260, 16, 0}, /* Retina BLT Z3 */ /* grf2 */
207 {18260, 19, 0}, /* Altais */ 209 {18260, 19, 0}, /* Altais */
208 {2167, 11, 0}, /* PicassoII mem */ /* grf3 */ 210 {2167, 11, 0}, /* PicassoII mem */ /* grf3 */
@@ -216,26 +218,27 @@ static struct preconfdata preconftab[] = @@ -216,26 +218,27 @@ static struct preconfdata preconftab[] =
216 {2195, 5, 0}, /* Piccolo mem */ 218 {2195, 5, 0}, /* Piccolo mem */
217 {2195, 6, 0}, /* Piccolo regs */ 219 {2195, 6, 0}, /* Piccolo regs */
218 {2195, 10, 0}, /* Piccolo SD64 mem */ 220 {2195, 10, 0}, /* Piccolo SD64 mem */
219 {2195, 11, 0}, /* Piccolo SD64 regs */ 221 {2195, 11, 0}, /* Piccolo SD64 regs */
220 {1030, 0, 0}, /* Ulwl board */ /* grf4 */ 222 {1030, 0, 0}, /* Ulwl board */ /* grf4 */
221 {8512, 34, 0}, /* Cybervison 64 */ /* grf5 */ 223 {8512, 34, 0}, /* Cybervison 64 */ /* grf5 */
222 {2117, 3, 0}, /* Merlin mem */ /* grf6 */ 224 {2117, 3, 0}, /* Merlin mem */ /* grf6 */
223 {2117, 4, 0}, /* Merlin regs */ 225 {2117, 4, 0}, /* Merlin regs */
224 {2167, 1, 0}, /* Domino mem */ 226 {2167, 1, 0}, /* Domino mem */
225 {2167, 2, 0}, /* Domino regs */ 227 {2167, 2, 0}, /* Domino regs */
226 {2167, 3, 0}, /* Domino regs (proto 16M) */ 228 {2167, 3, 0}, /* Domino regs (proto 16M) */
227 {2181, 0, 0}, /* oMniBus mem or regs */ 229 {2181, 0, 0}, /* oMniBus mem or regs */
228 {8512, 67, 0} /* Cybervison 64/3D */ /* grf7 */ 230 {8512, 67, 0} /* Cybervison 64/3D */ /* grf7 */
 231/* {28014, 1, 0} // MNTMN VA2000 */
229}; 232};
230static int npreconfent = sizeof(preconftab) / sizeof(struct preconfdata); 233static int npreconfent = sizeof(preconftab) / sizeof(struct preconfdata);
231 234
232/* 235/*
233 * Quirks table. 236 * Quirks table.
234 */ 237 */
235#define ZORRO_QUIRK_NO_ZBUSMAP 1 /* Don't map VA=PA in zbusattach. */ 238#define ZORRO_QUIRK_NO_ZBUSMAP 1 /* Don't map VA=PA in zbusattach. */
236static struct quirksdata quirkstab[] = { 239static struct quirksdata quirkstab[] = {
237 {8512, 101, ZORRO_QUIRK_NO_ZBUSMAP} 240 {8512, 101, ZORRO_QUIRK_NO_ZBUSMAP}
238}; 241};
239static int nquirksent = sizeof(quirkstab) / sizeof(struct quirksdata); 242static int nquirksent = sizeof(quirkstab) / sizeof(struct quirksdata);
240 243
241void zbusattach(device_t, device_t, void *); 244void zbusattach(device_t, device_t, void *);