xref: /netbsd-src/sys/arch/amiga/dev/mntva.c (revision 8450a7c42673d65e3b1f6560d3b6ecd317a6cbe8)
1 /*	$NetBSD: mntva.c,v 1.2 2016/10/23 18:40:52 phx Exp $	*/
2 
3 /*
4  * Copyright (c) 2012, 2016 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Lukas F. Hartmann.
9  * This code is derived from software contributed to The NetBSD Foundation
10  * by Radoslaw Kujawa.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *	notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *	notice, this list of conditions and the following disclaimer in the
19  *	documentation and/or other materials provided with the distribution.
20  *
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
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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
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
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD: mntva.c,v 1.2 2016/10/23 18:40:52 phx Exp $");
35 
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/kernel.h>
39 #include <sys/device.h>
40 #include <sys/endian.h>
41 #include <sys/bus.h>
42 #include <sys/cpu.h>
43 #include <sys/conf.h>
44 
45 #include <dev/cons.h>
46 
47 #include <amiga/amiga/device.h>
48 #include <amiga/amiga/isr.h>
49 
50 #include <amiga/dev/zbusvar.h>
51 #include <amiga/dev/mntvavar.h>
52 #include <amiga/dev/mntvareg.h>
53 #include <dev/wsfb/genfbvar.h>
54 
55 #include "opt_amigacons.h"
56 #include "opt_wsemul.h"
57 #include "opt_mntva.h"
58 #include "opt_wsfb.h"
59 
60 #include "mntva.h"
61 
62 /* #define MNTVA_DEBUG 1 */
63 
64 static int mntva_match(device_t, cfdata_t, void *);
65 static void mntva_attach(device_t, device_t, void *);
66 
67 static uint16_t mntva_reg_read(struct mntva_softc *sc, uint32_t reg);
68 static void mntva_reg_write(struct mntva_softc *sc, uint32_t reg, uint32_t val);
69 
70 static bool mntva_mode_set(struct mntva_softc *sc);
71 
72 static paddr_t mntva_mmap(void *v, void *vs, off_t offset, int prot);
73 static int mntva_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
74     struct lwp *l);
75 static void mntva_init_screen(void *cookie, struct vcons_screen *scr,
76     int existing, long *defattr);
77 static void mntva_init_palette(struct mntva_softc *sc);
78 /* blitter support */
79 static void mntva_rectfill(struct mntva_softc *sc, int x, int y, int wi,
80     int he, uint32_t color);
81 static void mntva_bitblt(struct mntva_softc *sc, int xs, int ys, int xd,
82     int yd, int wi, int he);
83 
84 /* accelerated raster ops */
85 static void mntva_eraserows(void *cookie, int row, int nrows, long fillattr);
86 static void mntva_copyrows(void *cookie, int srcrow, int dstrow, int nrows);
87 static void mntva_copycols(void *cookie, int row, int srccol, int dstcol,
88     int ncols);
89 static void mntva_erasecols(void *cookie, int row, int startcol, int ncols,
90     long fillattr);
91 #if 0
92 static void mntva_cursor(void *cookie, int on, int row, int col);
93 #endif
94 
95 /*
96  * XXX: these will be called by console handling code, shouldn't they be
97  * included from somewhere else?
98  */
99 void mntvacninit(struct consdev *cd);
100 void mntvacnprobe(struct consdev *cd);
101 void mntvacnputc(dev_t cd, int ch);
102 int mntvacngetc(dev_t cd);
103 void mntvacnpollc(dev_t cd, int on);
104 
105 CFATTACH_DECL_NEW(mntva, sizeof(struct mntva_softc),
106     mntva_match, mntva_attach, NULL, NULL);
107 
108 struct wsdisplay_accessops mntva_accessops = {
109 	mntva_ioctl,
110 	mntva_mmap,
111 	NULL,			// alloc_screen
112 	NULL,			// free_screen
113 	NULL,			// show_screen
114 	NULL,			// load_font
115 	NULL,			// pollc
116 	NULL			// scroll
117 };
118 
119 static int
120 mntva_match(device_t parent, cfdata_t match, void *aux)
121 {
122 	struct zbus_args *zap = aux;
123 
124 	if (zap->manid == 0x6d6e && zap->prodid == 1) {
125 #ifdef MNTVA_DEBUG
126 		/* XXX: this might not work during console init? */
127 		aprint_normal("mntva_match... success!\n");
128 #endif /* MNTVA_DEBUG */
129 		return 1;
130 	}
131 
132 	return 0;
133 }
134 
135 static void
136 mntva_attach(device_t parent, device_t self, void *aux)
137 {
138 	struct mntva_softc *sc = device_private(self);
139 	struct wsemuldisplaydev_attach_args ws_aa;
140 	struct rasops_info *ri;
141 	struct zbus_args *zap = aux;
142 	long defattr;
143 
144 	sc->sc_isconsole = false;
145 /* this should come from "opt_mntva.h" auto generated by kernel conf system */
146 #ifdef MNTVA_CONSOLE
147 	sc->sc_isconsole = true;
148 #endif /* MNTVA_CONSOLE */
149 
150 	printf(": MNTMN VA2000");
151 
152 	if(sc->sc_isconsole)
153 		printf(" (console)");
154 
155 	printf("\n");
156 
157 	sc->sc_dev = self;
158 	sc->sc_memsize = MNTVA_FB_SIZE;
159 
160 	sc->sc_bst.base = (bus_addr_t) zap->va;
161 	sc->sc_bst.absm = &amiga_bus_stride_1;
162 	sc->sc_iot = &sc->sc_bst;
163 
164 	if (bus_space_map(sc->sc_iot, MNTVA_OFF_FB, sc->sc_memsize + 0x1000,
165 	    BUS_SPACE_MAP_LINEAR, &sc->sc_fbh)) {
166 		aprint_error_dev(sc->sc_dev, "mapping framebuffer failed\n");
167 		return;
168 	}
169 	if (bus_space_map(sc->sc_iot, MNTVA_OFF_REG, MNTVA_REG_SIZE , 0,
170 	    &sc->sc_regh)) {
171 		aprint_error_dev(sc->sc_dev, "mapping registers failed\n");
172 		return;
173 	}
174 
175 	sc->sc_regpa = (bus_addr_t) kvtop((void*) sc->sc_regh);
176 	sc->sc_fbpa = (bus_addr_t) kvtop((void*) sc->sc_fbh);
177 
178 	/* print the physical and virt addresses for registers and fb */
179 	aprint_normal_dev(sc->sc_dev,
180 	    "registers at pa/va 0x%08x/0x%08x, fb at pa/va 0x%08x/0x%08x\n",
181 	    (uint32_t) sc->sc_regpa,
182 	    (uint32_t) bus_space_vaddr(sc->sc_iot, sc->sc_regh),
183 	    (uint32_t) sc->sc_fbpa,
184 	    (uint32_t) bus_space_vaddr(sc->sc_iot, sc->sc_fbh));
185 
186 	sc->sc_width = 1280;
187 	sc->sc_height = 720;
188 	sc->sc_bpp = 16;
189 	sc->sc_linebytes = 4096;
190 
191 	aprint_normal_dev(sc->sc_dev, "%zu kB framebuffer memory present\n",
192 	    sc->sc_memsize / 1024);
193 
194 	aprint_normal_dev(sc->sc_dev, "setting %dx%d %d bpp resolution\n",
195 	    sc->sc_width, sc->sc_height, sc->sc_bpp);
196 
197 	mntva_mode_set(sc);
198 
199 	sc->sc_defaultscreen_descr = (struct wsscreen_descr) {
200 	    "default", 0, 0, NULL, 8, 16,
201 	    WSSCREEN_WSCOLORS | WSSCREEN_HILIT, NULL };
202 	sc->sc_screens[0] = &sc->sc_defaultscreen_descr;
203 	sc->sc_screenlist = (struct wsscreen_list) { 1, sc->sc_screens };
204 	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
205 
206 	vcons_init(&sc->vd, sc, &sc->sc_defaultscreen_descr, &mntva_accessops);
207 	sc->vd.init_screen = mntva_init_screen;
208 
209 	ri = &sc->sc_console_screen.scr_ri;
210 
211 	mntva_init_palette(sc);
212 
213 	if (sc->sc_isconsole) {
214 		vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
215 				&defattr);
216 
217 		sc->sc_console_screen.scr_flags = VCONS_SCREEN_IS_STATIC;
218 		vcons_redraw_screen(&sc->sc_console_screen);
219 
220 		sc->sc_defaultscreen_descr.textops = &ri->ri_ops;
221 		sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
222 		sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
223 		sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
224 
225 		wsdisplay_cnattach(&sc->sc_defaultscreen_descr, ri, 0, 0,
226 				defattr);
227 		vcons_replay_msgbuf(&sc->sc_console_screen);
228 	} else {
229 		if (sc->sc_console_screen.scr_ri.ri_rows == 0) {
230 			vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
231 					&defattr);
232 		} else
233 			(*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
234 	}
235 
236 	ws_aa.console = sc->sc_isconsole;
237 	ws_aa.scrdata = &sc->sc_screenlist;
238 	ws_aa.accessops = &mntva_accessops;
239 	ws_aa.accesscookie = &sc->vd;
240 
241 	config_found(sc->sc_dev, &ws_aa, wsemuldisplaydevprint);
242 }
243 
244 static void
245 mntva_init_palette(struct mntva_softc *sc)
246 {
247 	int i, j;
248 
249 	j = 0;
250 	for (i=0; i<256; i++) {
251 		mntva_reg_write(sc, 0x200+i*2, rasops_cmap[j]);
252 		mntva_reg_write(sc, 0x400+i*2, rasops_cmap[j+1]);
253 		mntva_reg_write(sc, 0x600+i*2, rasops_cmap[j+2]);
254 		j+=3;
255 	}
256 }
257 
258 static void
259 mntva_init_screen(void *cookie, struct vcons_screen *scr, int existing,
260     long *defattr)
261 {
262 	struct mntva_softc *sc = cookie;
263 	struct rasops_info *ri = &scr->scr_ri;
264 
265 	wsfont_init();
266 
267 	ri->ri_depth = sc->sc_bpp;
268 	ri->ri_width = sc->sc_width;
269 	ri->ri_height = sc->sc_height;
270 	ri->ri_stride = sc->sc_linebytes;
271 	ri->ri_flg = 0;
272 
273 	/*ri->ri_flg = RI_BSWAP;*/
274 
275 	ri->ri_bits = (char *) bus_space_vaddr(sc->sc_iot, sc->sc_fbh);
276 #ifdef MNTVA_DEBUG
277 	aprint_normal_dev(sc->sc_dev, "ri_bits: %p\n", ri->ri_bits);
278 #endif /* MNTVA_DEBUG */
279 
280 	scr->scr_flags = VCONS_SCREEN_IS_STATIC;
281 
282 	rasops_init(ri, 0, 0);
283 	ri->ri_caps = WSSCREEN_WSCOLORS;
284 	rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
285 	    sc->sc_width / ri->ri_font->fontwidth);
286 
287 	ri->ri_hw = scr;
288 
289 	ri->ri_ops.eraserows = mntva_eraserows;
290 	ri->ri_ops.copyrows = mntva_copyrows;
291 	ri->ri_ops.erasecols = mntva_erasecols;
292 	ri->ri_ops.copycols = mntva_copycols;
293 #if 0
294 	ri->ri_ops.cursor = mntva_cursor;
295 #endif
296 }
297 
298 static bool
299 mntva_mode_set(struct mntva_softc *sc)
300 {
301 	mntva_reg_write(sc, MNTVA_SCALEMODE, 0);
302 	mntva_reg_write(sc, MNTVA_SCREENW, sc->sc_width);
303 	mntva_reg_write(sc, MNTVA_SCREENH, sc->sc_height);
304 
305 	if (sc->sc_bpp == 8)
306 		mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE8);
307 	else if (sc->sc_bpp == 16)
308 		mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE16);
309 	else if (sc->sc_bpp == 32)
310 		mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE32);
311 
312 	mntva_reg_write(sc, MNTVA_PANPTRHI, 0);
313 	mntva_reg_write(sc, MNTVA_PANPTRLO, 0);
314 	mntva_reg_write(sc, MNTVA_BLITTERBASEHI, 0);
315 	mntva_reg_write(sc, MNTVA_BLITTERBASELO, 0);
316 
317 	/* XXX: should rectfill with bg color taken from wscons? */
318 	mntva_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height, 0xffffffff);
319 
320 	return true;
321 }
322 
323 static uint16_t
324 mntva_reg_read(struct mntva_softc *sc, uint32_t reg)
325 {
326 	uint32_t rv;
327 	rv = bus_space_read_2(sc->sc_iot, sc->sc_regh, reg);
328 	return rv;
329 }
330 
331 static void
332 mntva_reg_write(struct mntva_softc *sc, uint32_t reg, uint32_t val)
333 {
334 	bus_space_write_2(sc->sc_iot, sc->sc_regh, reg, val);
335 }
336 
337 static void
338 mntva_rectfill(struct mntva_softc *sc, int x, int y, int wi, int he,
339     uint32_t color)
340 {
341 	mntva_reg_write(sc, MNTVA_BLITTERRGB, (uint16_t) color);
342 	mntva_reg_write(sc, MNTVA_BLITTERX1, (uint16_t) x);
343 	mntva_reg_write(sc, MNTVA_BLITTERY1, (uint16_t) y);
344 	mntva_reg_write(sc, MNTVA_BLITTERX2, (uint16_t) x + wi - 1);
345 	mntva_reg_write(sc, MNTVA_BLITTERY2, (uint16_t) y + he - 1);
346 	mntva_reg_write(sc, MNTVA_BLITTER_ENABLE, MNTVA_BLITTER_FILL);
347 
348 	while(mntva_reg_read(sc, MNTVA_BLITTER_ENABLE)) {
349 		/* busy wait */
350 	}
351 }
352 
353 static void
354 mntva_bitblt(struct mntva_softc *sc, int xs, int ys, int xd, int yd, int wi,
355     int he)
356 {
357 	mntva_reg_write(sc, MNTVA_BLITTERX1, (uint16_t) xd);
358 	mntva_reg_write(sc, MNTVA_BLITTERY1, (uint16_t) yd);
359 	mntva_reg_write(sc, MNTVA_BLITTERX2, (uint16_t) xd + wi - 1);
360 	mntva_reg_write(sc, MNTVA_BLITTERY2, (uint16_t) yd + he - 1);
361 	mntva_reg_write(sc, MNTVA_BLITTERX3, (uint16_t) xs);
362 	mntva_reg_write(sc, MNTVA_BLITTERY3, (uint16_t) ys);
363 	mntva_reg_write(sc, MNTVA_BLITTERX4, (uint16_t) xs + wi - 1);
364 	mntva_reg_write(sc, MNTVA_BLITTERY4, (uint16_t) ys + he - 1);
365 	mntva_reg_write(sc, MNTVA_BLITTER_ENABLE, MNTVA_BLITTER_COPY);
366 
367 	while(mntva_reg_read(sc, MNTVA_BLITTER_ENABLE)) {
368 		/* busy wait */
369 	}
370 }
371 
372 static void
373 mntva_copyrows(void *cookie, int srcrow, int dstrow, int nrows)
374 {
375 	struct mntva_softc *sc;
376 	struct rasops_info *ri;
377 	struct vcons_screen *scr;
378 	int x, ys, yd, wi, he;
379 
380 	ri = cookie;
381 	scr = ri->ri_hw;
382 	sc = scr->scr_cookie;
383 
384 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
385 		x = ri->ri_xorigin;
386 		ys = ri->ri_yorigin + ri->ri_font->fontheight * srcrow;
387 		yd = ri->ri_yorigin + ri->ri_font->fontheight * dstrow;
388 		wi = ri->ri_emuwidth;
389 		he = ri->ri_font->fontheight * nrows;
390 		mntva_bitblt(sc, x, ys, x, yd, wi, he);
391 	}
392 }
393 
394 static void
395 mntva_eraserows(void *cookie, int row, int nrows, long fillattr)
396 {
397 	struct mntva_softc *sc;
398 	struct rasops_info *ri;
399 	struct vcons_screen *scr;
400 	int x, y, wi, he, fg, bg, ul;
401 
402 	ri = cookie;
403 	scr = ri->ri_hw;
404 	sc = scr->scr_cookie;
405 
406 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
407 		rasops_unpack_attr(fillattr, &fg, &bg, &ul);
408 		if ((row == 0) && (nrows == ri->ri_rows))
409 			mntva_rectfill(sc, 0, 0, ri->ri_width,
410 			    ri->ri_height, ri->ri_devcmap[bg]);
411 		else {
412 			x = ri->ri_xorigin;
413 			y = ri->ri_yorigin + ri->ri_font->fontheight * row;
414 			wi = ri->ri_emuwidth;
415 			he = ri->ri_font->fontheight * nrows;
416 			mntva_rectfill(sc, x, y, wi, he, ri->ri_devcmap[bg]);
417 		}
418 	}
419 }
420 
421 static void
422 mntva_copycols(void *cookie, int row, int srccol, int dstcol, int ncols)
423 {
424 	struct mntva_softc *sc;
425 	struct rasops_info *ri;
426 	struct vcons_screen *scr;
427 	int xs, xd, y, w, h;
428 
429 	ri = cookie;
430 	scr = ri->ri_hw;
431 	sc = scr->scr_cookie;
432 
433 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
434 		xs = ri->ri_xorigin + ri->ri_font->fontwidth * srccol;
435 		xd = ri->ri_xorigin + ri->ri_font->fontwidth * dstcol;
436 		y = ri->ri_yorigin + ri->ri_font->fontheight * row;
437 		w = ri->ri_font->fontwidth * ncols;
438 		h = ri->ri_font->fontheight;
439 		mntva_bitblt(sc, xs, y, xd, y, w, h);
440 	}
441 
442 }
443 
444 static void
445 mntva_erasecols(void *cookie, int row, int startcol, int ncols, long fillattr)
446 {
447 	struct mntva_softc *sc;
448 	struct rasops_info *ri;
449 	struct vcons_screen *scr;
450 	int x, y, w, h, fg, bg, ul;
451 
452 	ri = cookie;
453 	scr = ri->ri_hw;
454 	sc = scr->scr_cookie;
455 
456 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
457 		x = ri->ri_xorigin + ri->ri_font->fontwidth * startcol;
458 		y = ri->ri_yorigin + ri->ri_font->fontheight * row;
459 		w = ri->ri_font->fontwidth * ncols;
460 		h = ri->ri_font->fontheight;
461 		rasops_unpack_attr(fillattr, &fg, &bg, &ul);
462 		mntva_rectfill(sc, x, y, w, h, ri->ri_devcmap[bg & 0xf]);
463 	}
464 }
465 
466 static int
467 mntva_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
468 {
469 	struct vcons_data *vd;
470 	struct mntva_softc *sc;
471 	struct wsdisplay_fbinfo *wsfbi;
472 	struct vcons_screen *ms;
473 	struct wsdisplayio_bus_id *busid;
474 
475 	vd = v;
476 	sc = vd->cookie;
477 	ms = vd->active;
478 
479 	switch (cmd) {
480 	case WSDISPLAYIO_GTYPE:
481 		*(u_int *) data = WSDISPLAY_TYPE_UNKNOWN;
482 		return 0;
483 
484 	case WSDISPLAYIO_GET_BUSID:
485 		busid = data;
486 		busid->bus_type = WSDISPLAYIO_BUS_SOC;
487 		return 0;
488 
489 	case WSDISPLAYIO_GINFO:
490 		if (ms == NULL)
491 			return ENODEV;
492 
493 		wsfbi = (void *) data;
494 		wsfbi->height = ms->scr_ri.ri_height;
495 		wsfbi->width = ms->scr_ri.ri_width;
496 		wsfbi->depth = ms->scr_ri.ri_depth;
497 		wsfbi->cmsize = 256;
498 		return 0;
499 
500 	case WSDISPLAYIO_LINEBYTES:
501 		*(u_int *) data = sc->sc_linebytes;
502 		return 0;
503 
504 	case WSDISPLAYIO_SMODE:
505 		{
506 			int new_mode = *(int *) data;
507 			if (new_mode != sc->sc_mode) {
508 				sc->sc_mode = new_mode;
509 				if (new_mode == WSDISPLAYIO_MODE_EMUL)
510 					vcons_redraw_screen(ms);
511 			}
512 			return 0;
513 		}
514 	case WSDISPLAYIO_GET_FBINFO:
515 		{
516 			struct wsdisplayio_fbinfo *fbi = data;
517 			struct rasops_info *ri;
518 			int ret;
519 
520 			ri = &sc->vd.active->scr_ri;
521 			ret = wsdisplayio_get_fbinfo(ri, fbi);
522 			return ret;
523 		}
524 	}
525 
526 	return EPASSTHROUGH;
527 }
528 
529 #if 0
530 static void
531 mntva_cursor(void *cookie, int on, int row, int col)
532 {
533 	struct mntva_softc *sc;
534 	struct rasops_info *ri;
535 	struct vcons_screen *scr;
536 	int x, y, wi, he;
537 
538 	ri = cookie;
539 	scr = ri->ri_hw;
540 	sc = scr->scr_cookie;
541 
542 	wi = ri->ri_font->fontwidth;
543 	he = ri->ri_font->fontheight;
544 
545 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
546 		x = ri->ri_ccol * wi + ri->ri_xorigin;
547 		y = ri->ri_crow * he + ri->ri_yorigin;
548 		if (ri->ri_flg & RI_CURSOR) {
549 			mntva_bitblt(sc, x, y, x, y, wi, he);
550 			ri->ri_flg &= ~RI_CURSOR;
551 		}
552 		ri->ri_crow = row;
553 		ri->ri_ccol = col;
554 		if (on) {
555 			x = ri->ri_ccol * wi + ri->ri_xorigin;
556 			y = ri->ri_crow * he + ri->ri_yorigin;
557 			mntva_bitblt(sc, x, y, x, y, wi, he);
558 			ri->ri_flg |= RI_CURSOR;
559 		}
560 	} else {
561 		scr->scr_ri.ri_crow = row;
562 		scr->scr_ri.ri_ccol = col;
563 		scr->scr_ri.ri_flg &= ~RI_CURSOR;
564 	}
565 }
566 #endif
567 
568 static paddr_t
569 mntva_mmap(void *v, void *vs, off_t offset, int prot)
570 {
571 	struct vcons_data *vd;
572 	struct mntva_softc *sc;
573 	paddr_t pa;
574 
575 	vd = v;
576 	sc = vd->cookie;
577 
578 	if (offset >= 0 && offset < sc->sc_memsize) {
579 		pa = bus_space_mmap(sc->sc_iot, sc->sc_fbpa, offset, prot,
580 			BUS_SPACE_MAP_LINEAR);
581 		return pa;
582 	}
583 
584 	return -1;
585 }
586 
587 void
588 mntvacninit(struct consdev *cd)
589 {
590 	/*wsdisplay_preattach(sc->sc_defaultscreen, ri, 0, 0, defattr);*/
591 }
592 
593 void
594 mntvacnprobe(struct consdev *cd)
595 {
596 #ifdef MNTVA_CONSOLE
597 	/*
598 	 * This isn't exactly true, but cons.h does not define anything
599 	 * that would fit our case exactly.
600 	 */
601 	cd->cn_pri = CN_INTERNAL;
602 
603 	cd->cn_dev = NODEV; /* Filled later by wscons. */
604 #endif /* MNTVA_CONSOLE */
605 }
606 
607 /* ARGSUSED */
608 void
609 mntvacnputc(dev_t cd, int ch)
610 {
611 }
612 
613 /* ARGSUSED */
614 int
615 mntvacngetc(dev_t cd)
616 {
617 	return(0);
618 }
619 
620 /* ARGSUSED */
621 void
622 mntvacnpollc(dev_t cd, int on)
623 {
624 }
625 
626