1/* $NetBSD: mntva.c,v 1.5 2021/08/07 16:18:41 thorpej 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.5 2021/08/07 16:18:41 thorpej 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 64static int mntva_match(device_t, cfdata_t, void *); 65static void mntva_attach(device_t, device_t, void *); 66 67static uint16_t mntva_reg_read(struct mntva_softc *sc, uint32_t reg); 68static void mntva_reg_write(struct mntva_softc *sc, uint32_t reg, uint32_t val); 69 70static bool mntva_mode_set(struct mntva_softc *sc); 71 72static paddr_t mntva_mmap(void *v, void *vs, off_t offset, int prot); 73static int mntva_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, 74 struct lwp *l); 75static void mntva_init_screen(void *cookie, struct vcons_screen *scr, 76 int existing, long *defattr); 77static void mntva_init_palette(struct mntva_softc *sc); 78/* blitter support */ 79static void mntva_rectfill(struct mntva_softc *sc, int x, int y, int wi, 80 int he, uint32_t color); 81static 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 */ 85static void mntva_eraserows(void *cookie, int row, int nrows, long fillattr); 86static void mntva_copyrows(void *cookie, int srcrow, int dstrow, int nrows); 87static void mntva_copycols(void *cookie, int row, int srccol, int dstcol, 88 int ncols); 89static void mntva_erasecols(void *cookie, int row, int startcol, int ncols, 90 long fillattr); 91#if 0 92static 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 */ 99void mntvacninit(struct consdev *cd); 100void mntvacnprobe(struct consdev *cd); 101void mntvacnputc(dev_t cd, int ch); 102int mntvacngetc(dev_t cd); 103void mntvacnpollc(dev_t cd, int on); 104 105CFATTACH_DECL_NEW(mntva, sizeof(struct mntva_softc), 106 mntva_match, mntva_attach, NULL, NULL); 107 108struct 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 119static int 120mntva_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 135static void 136mntva_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(": MNT 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_REG, MNTVA_REG_SIZE , 0, 165 &sc->sc_regh)) { 166 aprint_error_dev(sc->sc_dev, "mapping registers failed\n"); 167 return; 168 } 169 if (bus_space_map(sc->sc_iot, MNTVA_OFF_FB, sc->sc_memsize, 170 BUS_SPACE_MAP_LINEAR, &sc->sc_fbh)) { 171 aprint_error_dev(sc->sc_dev, "mapping framebuffer 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, CFARGS_NONE); 242} 243 244static void 245mntva_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 258static void 259mntva_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 298static bool 299mntva_mode_set(struct mntva_softc *sc) 300{ 301 mntva_reg_write(sc, MNTVA_CAPTURE_MODE, 0); 302 303 mntva_reg_write(sc, MNTVA_H_SYNC_START, 1390); 304 mntva_reg_write(sc, MNTVA_H_SYNC_END, 1430); 305 mntva_reg_write(sc, MNTVA_H_MAX, 1650); 306 mntva_reg_write(sc, MNTVA_V_SYNC_START, 725); 307 mntva_reg_write(sc, MNTVA_V_SYNC_END, 730); 308 mntva_reg_write(sc, MNTVA_V_MAX, 750); 309 mntva_reg_write(sc, MNTVA_PIXEL_CLK_SEL, MNTVA_CLK_75MHZ); 310 311 mntva_reg_write(sc, MNTVA_SCALEMODE, 0); 312 mntva_reg_write(sc, MNTVA_SCREENW, sc->sc_width); 313 mntva_reg_write(sc, MNTVA_SCREENH, sc->sc_height); 314 mntva_reg_write(sc, MNTVA_ROW_PITCH, 2048); 315 mntva_reg_write(sc, MNTVA_ROW_PITCH_SHIFT, 11); 316 mntva_reg_write(sc, MNTVA_BLITTER_ROW_PITCH, 2048); 317 mntva_reg_write(sc, MNTVA_BLITTER_ROW_PITCH_SHIFT, 11); 318 mntva_reg_write(sc, MNTVA_MARGIN_X, 8); 319 mntva_reg_write(sc, MNTVA_SAFE_X, 0x50); 320 321 if (sc->sc_bpp == 8) 322 mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE8); 323 else if (sc->sc_bpp == 16) 324 mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE16); 325 else if (sc->sc_bpp == 32) 326 mntva_reg_write(sc, MNTVA_COLORMODE, MNTVA_COLORMODE32); 327 328 mntva_reg_write(sc, MNTVA_PANPTRHI, 0); 329 mntva_reg_write(sc, MNTVA_PANPTRLO, 0); 330 mntva_reg_write(sc, MNTVA_BLITTERBASEHI, 0); 331 mntva_reg_write(sc, MNTVA_BLITTERBASELO, 0); 332 333 return true; 334} 335 336static uint16_t 337mntva_reg_read(struct mntva_softc *sc, uint32_t reg) 338{ 339 uint32_t rv; 340 rv = bus_space_read_2(sc->sc_iot, sc->sc_regh, reg); 341 return rv; 342} 343 344static void 345mntva_reg_write(struct mntva_softc *sc, uint32_t reg, uint32_t val) 346{ 347 bus_space_write_2(sc->sc_iot, sc->sc_regh, reg, val); 348} 349 350static void 351mntva_rectfill(struct mntva_softc *sc, int x, int y, int wi, int he, 352 uint32_t color) 353{ 354 mntva_reg_write(sc, MNTVA_BLITTERRGB, (uint16_t) color); 355 mntva_reg_write(sc, MNTVA_BLITTERX1, (uint16_t) x); 356 mntva_reg_write(sc, MNTVA_BLITTERY1, (uint16_t) y); 357 mntva_reg_write(sc, MNTVA_BLITTERX2, (uint16_t) x + wi - 1); 358 mntva_reg_write(sc, MNTVA_BLITTERY2, (uint16_t) y + he - 1); 359 mntva_reg_write(sc, MNTVA_BLITTER_ENABLE, MNTVA_BLITTER_FILL); 360 361 while(mntva_reg_read(sc, MNTVA_BLITTER_ENABLE)) { 362 /* busy wait */ 363 } 364} 365 366static void 367mntva_bitblt(struct mntva_softc *sc, int xs, int ys, int xd, int yd, int wi, 368 int he) 369{ 370 mntva_reg_write(sc, MNTVA_BLITTERX1, (uint16_t) xd); 371 mntva_reg_write(sc, MNTVA_BLITTERY1, (uint16_t) yd); 372 mntva_reg_write(sc, MNTVA_BLITTERX2, (uint16_t) xd + wi - 1); 373 mntva_reg_write(sc, MNTVA_BLITTERY2, (uint16_t) yd + he - 1); 374 mntva_reg_write(sc, MNTVA_BLITTERX3, (uint16_t) xs); 375 mntva_reg_write(sc, MNTVA_BLITTERY3, (uint16_t) ys); 376 mntva_reg_write(sc, MNTVA_BLITTERX4, (uint16_t) xs + wi - 1); 377 mntva_reg_write(sc, MNTVA_BLITTERY4, (uint16_t) ys + he - 1); 378 mntva_reg_write(sc, MNTVA_BLITTER_ENABLE, MNTVA_BLITTER_COPY); 379 380 while(mntva_reg_read(sc, MNTVA_BLITTER_ENABLE)) { 381 /* busy wait */ 382 } 383} 384 385static void 386mntva_copyrows(void *cookie, int srcrow, int dstrow, int nrows) 387{ 388 struct mntva_softc *sc; 389 struct rasops_info *ri; 390 struct vcons_screen *scr; 391 int x, ys, yd, wi, he; 392 393 ri = cookie; 394 scr = ri->ri_hw; 395 sc = scr->scr_cookie; 396 397 if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) { 398 x = ri->ri_xorigin; 399 ys = ri->ri_yorigin + ri->ri_font->fontheight * srcrow; 400 yd = ri->ri_yorigin + ri->ri_font->fontheight * dstrow; 401 wi = ri->ri_emuwidth; 402 he = ri->ri_font->fontheight * nrows; 403 mntva_bitblt(sc, x, ys, x, yd, wi, he); 404 } 405} 406 407static void 408mntva_eraserows(void *cookie, int row, int nrows, long fillattr) 409{ 410 struct mntva_softc *sc; 411 struct rasops_info *ri; 412 struct vcons_screen *scr; 413 int x, y, wi, he, fg, bg, ul; 414 415 ri = cookie; 416 scr = ri->ri_hw; 417 sc = scr->scr_cookie; 418 419 if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) { 420 rasops_unpack_attr(fillattr, &fg, &bg, &ul); 421 if ((row == 0) && (nrows == ri->ri_rows)) 422 mntva_rectfill(sc, 0, 0, ri->ri_width, 423 ri->ri_height, ri->ri_devcmap[bg]); 424 else { 425 x = ri->ri_xorigin; 426 y = ri->ri_yorigin + ri->ri_font->fontheight * row; 427 wi = ri->ri_emuwidth; 428 he = ri->ri_font->fontheight * nrows; 429 mntva_rectfill(sc, x, y, wi, he, ri->ri_devcmap[bg]); 430 } 431 } 432} 433 434static void 435mntva_copycols(void *cookie, int row, int srccol, int dstcol, int ncols) 436{ 437 struct mntva_softc *sc; 438 struct rasops_info *ri; 439 struct vcons_screen *scr; 440 int xs, xd, y, w, h; 441 442 ri = cookie; 443 scr = ri->ri_hw; 444 sc = scr->scr_cookie; 445 446 if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) { 447 xs = ri->ri_xorigin + ri->ri_font->fontwidth * srccol; 448 xd = ri->ri_xorigin + ri->ri_font->fontwidth * dstcol; 449 y = ri->ri_yorigin + ri->ri_font->fontheight * row; 450 w = ri->ri_font->fontwidth * ncols; 451 h = ri->ri_font->fontheight; 452 mntva_bitblt(sc, xs, y, xd, y, w, h); 453 } 454 455} 456 457static void 458mntva_erasecols(void *cookie, int row, int startcol, int ncols, long fillattr) 459{ 460 struct mntva_softc *sc; 461 struct rasops_info *ri; 462 struct vcons_screen *scr; 463 int x, y, w, h, fg, bg, ul; 464 465 ri = cookie; 466 scr = ri->ri_hw; 467 sc = scr->scr_cookie; 468 469 if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) { 470 x = ri->ri_xorigin + ri->ri_font->fontwidth * startcol; 471 y = ri->ri_yorigin + ri->ri_font->fontheight * row; 472 w = ri->ri_font->fontwidth * ncols; 473 h = ri->ri_font->fontheight; 474 rasops_unpack_attr(fillattr, &fg, &bg, &ul); 475 mntva_rectfill(sc, x, y, w, h, ri->ri_devcmap[bg & 0xf]); 476 } 477} 478 479static int 480mntva_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l) 481{ 482 struct vcons_data *vd; 483 struct mntva_softc *sc; 484 struct wsdisplay_fbinfo *wsfbi; 485 struct vcons_screen *ms; 486 struct wsdisplayio_bus_id *busid; 487 488 vd = v; 489 sc = vd->cookie; 490 ms = vd->active; 491 492 switch (cmd) { 493 case WSDISPLAYIO_GTYPE: 494 *(u_int *) data = WSDISPLAY_TYPE_UNKNOWN; 495 return 0; 496 497 case WSDISPLAYIO_GET_BUSID: 498 busid = data; 499 busid->bus_type = WSDISPLAYIO_BUS_SOC; 500 return 0; 501 502 case WSDISPLAYIO_GINFO: 503 if (ms == NULL) 504 return ENODEV; 505 506 wsfbi = (void *) data; 507 wsfbi->height = ms->scr_ri.ri_height; 508 wsfbi->width = ms->scr_ri.ri_width; 509 wsfbi->depth = ms->scr_ri.ri_depth; 510 wsfbi->cmsize = 256; 511 return 0; 512 513 case WSDISPLAYIO_LINEBYTES: 514 *(u_int *) data = sc->sc_linebytes; 515 return 0; 516 517 case WSDISPLAYIO_SMODE: 518 { 519 int new_mode = *(int *) data; 520 if (new_mode != sc->sc_mode) { 521 sc->sc_mode = new_mode; 522 if (new_mode == WSDISPLAYIO_MODE_EMUL) 523 vcons_redraw_screen(ms); 524 } 525 return 0; 526 } 527 case WSDISPLAYIO_GET_FBINFO: 528 { 529 struct wsdisplayio_fbinfo *fbi = data; 530 struct rasops_info *ri; 531 int ret; 532 533 ri = &sc->vd.active->scr_ri; 534 ret = wsdisplayio_get_fbinfo(ri, fbi); 535 return ret; 536 } 537 } 538 539 return EPASSTHROUGH; 540} 541 542#if 0 543static void 544mntva_cursor(void *cookie, int on, int row, int col) 545{ 546 struct mntva_softc *sc; 547 struct rasops_info *ri; 548 struct vcons_screen *scr; 549 int x, y, wi, he; 550 551 ri = cookie; 552 scr = ri->ri_hw; 553 sc = scr->scr_cookie; 554 555 wi = ri->ri_font->fontwidth; 556 he = ri->ri_font->fontheight; 557 558 if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) { 559 x = ri->ri_ccol * wi + ri->ri_xorigin; 560 y = ri->ri_crow * he + ri->ri_yorigin; 561 if (ri->ri_flg & RI_CURSOR) { 562 mntva_bitblt(sc, x, y, x, y, wi, he); 563 ri->ri_flg &= ~RI_CURSOR; 564 } 565 ri->ri_crow = row; 566 ri->ri_ccol = col; 567 if (on) { 568 x = ri->ri_ccol * wi + ri->ri_xorigin; 569 y = ri->ri_crow * he + ri->ri_yorigin; 570 mntva_bitblt(sc, x, y, x, y, wi, he); 571 ri->ri_flg |= RI_CURSOR; 572 } 573 } else { 574 scr->scr_ri.ri_crow = row; 575 scr->scr_ri.ri_ccol = col; 576 scr->scr_ri.ri_flg &= ~RI_CURSOR; 577 } 578} 579#endif 580 581static paddr_t 582mntva_mmap(void *v, void *vs, off_t offset, int prot) 583{ 584 struct vcons_data *vd; 585 struct mntva_softc *sc; 586 paddr_t pa; 587 588 vd = v; 589 sc = vd->cookie; 590 591 if (offset >= 0 && offset < sc->sc_memsize) { 592 pa = bus_space_mmap(sc->sc_iot, sc->sc_fbpa, offset, prot, 593 BUS_SPACE_MAP_LINEAR); 594 return pa; 595 } 596 597 return -1; 598} 599 600void 601mntvacninit(struct consdev *cd) 602{ 603 /*wsdisplay_preattach(sc->sc_defaultscreen, ri, 0, 0, defattr);*/ 604} 605 606void 607mntvacnprobe(struct consdev *cd) 608{ 609#ifdef MNTVA_CONSOLE 610 /* 611 * This isn't exactly true, but cons.h does not define anything 612 * that would fit our case exactly. 613 */ 614 cd->cn_pri = CN_INTERNAL; 615 616 cd->cn_dev = NODEV; /* Filled later by wscons. */ 617#endif /* MNTVA_CONSOLE */ 618} 619 620/* ARGSUSED */ 621void 622mntvacnputc(dev_t cd, int ch) 623{ 624} 625 626/* ARGSUSED */ 627int 628mntvacngetc(dev_t cd) 629{ 630 return(0); 631} 632 633/* ARGSUSED */ 634void 635mntvacnpollc(dev_t cd, int on) 636{ 637} 638 639