1 /* $NetBSD: pvr.c,v 1.40 2025/11/24 13:28:58 thorpej Exp $ */ 2 3 /*- 4 * Copyright (c) 2001 Marcus Comstedt. 5 * Copyright (c) 2001 Jason R. Thorpe. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of The NetBSD Foundation nor the names of its 17 * contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 34 35 __KERNEL_RCSID(0, "$NetBSD: pvr.c,v 1.40 2025/11/24 13:28:58 thorpej Exp $"); 36 37 #include <sys/param.h> 38 #include <sys/systm.h> 39 #include <sys/kernel.h> 40 #include <sys/device.h> 41 #include <sys/malloc.h> 42 #include <sys/buf.h> 43 #include <sys/ioctl.h> 44 #include <sys/bus.h> 45 46 #include <machine/vmparam.h> 47 #include <machine/cpu.h> 48 49 #include <dev/cons.h> 50 51 #include <dev/wscons/wsconsio.h> 52 #include <dev/wscons/wsdisplayvar.h> 53 54 #include <dev/wscons/wscons_callbacks.h> 55 56 #include <dev/rasops/rasops.h> 57 #include <dev/wsfont/wsfont.h> 58 59 #include <dreamcast/dev/pvrvar.h> 60 #include <dreamcast/dev/maple/mkbdvar.h> 61 62 #include "mkbd.h" 63 64 #define PVRREG_FBSTART 0x05000000 65 #define PVRREG_REGSTART 0x005f8000 66 67 #define PVRREG_BRDCOLR 0x40 68 #define BRDCOLR_BLUE(x) ((x) << 0) 69 #define BRDCOLR_GREEN(x) ((x) << 8) 70 #define BRDCOLR_RED(x) ((x) << 16) 71 72 #define PVRREG_DIWMODE 0x44 73 #define DIWMODE_DE (1U << 0) /* display enable */ 74 #define DIWMODE_SD (1U << 1) /* scan double enable */ 75 #define DIWMODE_COL(x) ((x) << 2) 76 #define DIWMODE_COL_RGB555 DIWMODE_COL(0) /* RGB555, 16-bit */ 77 #define DIWMODE_COL_RGB565 DIWMODE_COL(1) /* RGB565, 16-bit */ 78 #define DIWMODE_COL_RGB888 DIWMODE_COL(2) /* RGB888, 24-bit */ 79 #define DIWMODE_COL_ARGB888 DIWMODE_COL(3) /* RGB888, 32-bit */ 80 #define DIWMODE_C (1U << 23) /* 2x clock enable (VGA) */ 81 82 #define PVRREG_DIWADDRL 0x50 83 84 #define PVRREG_DIWADDRS 0x54 85 86 #define PVRREG_DIWSIZE 0x5c 87 #define DIWSIZE_DPL(x) ((x) << 0) /* pixel data per line */ 88 #define DIWSIZE_LPF(x) ((x) << 10) /* lines per field */ 89 #define DIWSIZE_MODULO(x) ((x) << 20) /* words to skip + 1 */ 90 91 #define PVRREG_RASEVTPOS 0xcc 92 #define RASEVTPOS_BOTTOM(x) ((x) << 0) 93 #define RASEVTPOS_TOP(x) ((x) << 16) 94 95 #define PVRREG_SYNCCONF 0xd0 96 #define SYNCCONF_VP (1U << 0) /* V-sync polarity */ 97 #define SYNCCONF_HP (1U << 1) /* H-sync polarity */ 98 #define SYNCCONF_I (1U << 4) /* interlace */ 99 #define SYNCCONF_BC(x) (1U << 6) /* broadcast standard */ 100 #define SYNCCONF_VO (1U << 8) /* video output enable */ 101 102 #define PVRREG_BRDHORZ 0xd4 103 #define BRDHORZ_STOP(x) ((x) << 0) 104 #define BRDHORZ_START(x) ((x) << 16) 105 106 #define PVRREG_SYNCSIZE 0xd8 107 #define SYNCSIZE_H(x) ((x) << 0) 108 #define SYNCSIZE_V(x) ((x) << 16) 109 110 #define PVRREG_BRDVERT 0xdc 111 #define BRDVERT_STOP(x) ((x) << 0) 112 #define BRDVERT_START(x) ((x) << 16) 113 114 #define PVRREG_DIWCONF 0xe8 115 #define DIWCONF_LR (1U << 8) /* low-res */ 116 #define DIWCONF_MAGIC (22 << 16) 117 118 #define PVRREG_DIWHSTRT 0xec 119 120 #define PVRREG_DIWVSTRT 0xf0 121 #define DIWVSTRT_V1(x) ((x) << 0) 122 #define DIWVSTRT_V2(x) ((x) << 16) 123 124 #define PVR_REG_READ(dc, reg) \ 125 ((volatile uint32_t *)(dc)->dc_regvaddr)[(reg) >> 2] 126 #define PVR_REG_WRITE(dc, reg, val) \ 127 ((volatile uint32_t *)(dc)->dc_regvaddr)[(reg) >> 2] = (val) 128 129 struct fb_devconfig { 130 vaddr_t dc_vaddr; /* framebuffer virtual address */ 131 vaddr_t dc_paddr; /* framebuffer physical address */ 132 vaddr_t dc_regvaddr; /* registers virtual address */ 133 vaddr_t dc_regpaddr; /* registers physical address */ 134 int dc_wid; /* width of frame buffer */ 135 int dc_ht; /* height of frame buffer */ 136 int dc_depth; /* depth, bits per pixel */ 137 int dc_rowbytes; /* bytes in a FB scan line */ 138 vaddr_t dc_videobase; /* base of flat frame buffer */ 139 int dc_blanked; /* currently has video disabled */ 140 int dc_dispflags; /* display flags */ 141 int dc_tvsystem; /* TV broadcast system */ 142 143 struct rasops_info dc_rinfo; 144 145 char dc_wsscrname[32]; 146 struct wsscreen_descr dc_wsscrdescr; 147 }; 148 149 #define PVR_RGBMODE 0x01 /* RGB or composite */ 150 #define PVR_VGAMODE 0x02 /* VGA */ 151 152 struct pvr_softc { 153 device_t sc_dev; 154 struct fb_devconfig *sc_dc; /* device configuration */ 155 int sc_nscreens; 156 const struct wsscreen_descr *sc_scrdescs[1]; 157 struct wsscreen_list sc_scrlist; 158 }; 159 160 static int pvr_match(device_t, cfdata_t, void *); 161 static void pvr_attach(device_t, device_t, void *); 162 163 CFATTACH_DECL_NEW(pvr, sizeof(struct pvr_softc), 164 pvr_match, pvr_attach, NULL, NULL); 165 166 static void pvr_getdevconfig(struct fb_devconfig *); 167 168 static struct fb_devconfig pvr_console_dc; 169 170 static int pvrioctl(void *, void *, u_long, void *, int, struct lwp *); 171 static paddr_t pvrmmap(void *, void *, off_t, int); 172 173 static int pvr_alloc_screen(void *, const struct wsscreen_descr *, 174 void **, int *, int *, long *); 175 static void pvr_free_screen(void *, void *); 176 static int pvr_show_screen(void *, void *, int, 177 void (*)(void *, int, int), void *); 178 179 static const struct wsdisplay_accessops pvr_accessops = { 180 pvrioctl, 181 pvrmmap, 182 pvr_alloc_screen, 183 pvr_free_screen, 184 pvr_show_screen, 185 NULL, /* load_font */ 186 }; 187 188 static void pvrinit(struct fb_devconfig *); 189 190 int pvr_is_console; 191 192 int 193 pvr_match(device_t parent, cfdata_t cf, void *aux) 194 { 195 196 return 1; 197 } 198 199 void 200 pvr_getdevconfig(struct fb_devconfig *dc) 201 { 202 int i, cookie; 203 204 dc->dc_paddr = PVRREG_FBSTART; 205 dc->dc_vaddr = SH3_PHYS_TO_P2SEG(dc->dc_paddr); 206 207 dc->dc_regpaddr = PVRREG_REGSTART; 208 dc->dc_regvaddr = SH3_PHYS_TO_P2SEG(dc->dc_regpaddr); 209 210 dc->dc_wid = 640; 211 dc->dc_ht = 480; 212 dc->dc_depth = 16; 213 dc->dc_rowbytes = dc->dc_wid * (dc->dc_depth / 8); 214 dc->dc_videobase = dc->dc_vaddr; 215 dc->dc_blanked = 0; 216 dc->dc_dispflags = 0; 217 218 /* Clear the screen. */ 219 for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(uint32_t)) 220 *(uint32_t *)(dc->dc_videobase + i) = 0x0; 221 222 /* Initialize the device. */ 223 pvrinit(dc); 224 225 dc->dc_rinfo.ri_flg = 0; 226 if (dc == &pvr_console_dc) 227 dc->dc_rinfo.ri_flg |= RI_NO_AUTO; 228 dc->dc_rinfo.ri_depth = dc->dc_depth; 229 dc->dc_rinfo.ri_bits = (void *) dc->dc_videobase; 230 dc->dc_rinfo.ri_width = dc->dc_wid; 231 dc->dc_rinfo.ri_height = dc->dc_ht; 232 dc->dc_rinfo.ri_stride = dc->dc_rowbytes; 233 234 wsfont_init(); 235 /* prefer 8 pixel wide font */ 236 cookie = wsfont_find(NULL, 8, 0, 0, WSDISPLAY_FONTORDER_L2R, 237 WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP); 238 if (cookie <= 0) 239 cookie = wsfont_find(NULL, 0, 0, 0, WSDISPLAY_FONTORDER_L2R, 240 WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP); 241 if (cookie <= 0) { 242 printf("pvr: font table is empty\n"); 243 return; 244 } 245 246 if (wsfont_lock(cookie, &dc->dc_rinfo.ri_font)) { 247 printf("pvr: unable to lock font\n"); 248 return; 249 } 250 dc->dc_rinfo.ri_wsfcookie = cookie; 251 252 rasops_init(&dc->dc_rinfo, 500, 500); 253 254 dc->dc_wsscrdescr.name = dc->dc_wsscrname; 255 dc->dc_wsscrdescr.ncols = dc->dc_rinfo.ri_cols; 256 dc->dc_wsscrdescr.nrows = dc->dc_rinfo.ri_rows; 257 dc->dc_wsscrdescr.textops = &dc->dc_rinfo.ri_ops; 258 dc->dc_wsscrdescr.capabilities = dc->dc_rinfo.ri_caps; 259 260 snprintf(dc->dc_wsscrname, sizeof(dc->dc_wsscrname), "%dx%d", 261 dc->dc_wsscrdescr.ncols, dc->dc_wsscrdescr.nrows); 262 } 263 264 void 265 pvr_attach(device_t parent, device_t self, void *aux) 266 { 267 struct pvr_softc *sc = device_private(self); 268 struct wsemuldisplaydev_attach_args waa; 269 int console; 270 static const char *tvsystem_name[4] = 271 { "NTSC", "PAL", "PAL-M", "PAL-N" }; 272 273 sc->sc_dev = self; 274 console = pvr_is_console; 275 if (console) { 276 sc->sc_dc = &pvr_console_dc; 277 sc->sc_dc->dc_rinfo.ri_flg &= ~RI_NO_AUTO; 278 sc->sc_nscreens = 1; 279 } else { 280 sc->sc_dc = malloc(sizeof(struct fb_devconfig), M_DEVBUF, 281 M_WAITOK | M_ZERO); 282 pvr_getdevconfig(sc->sc_dc); 283 } 284 printf(": %d x %d, %dbpp, %s, %s\n", sc->sc_dc->dc_wid, 285 sc->sc_dc->dc_ht, sc->sc_dc->dc_depth, 286 (sc->sc_dc->dc_dispflags & PVR_VGAMODE) ? "VGA" : 287 tvsystem_name[sc->sc_dc->dc_tvsystem], 288 (sc->sc_dc->dc_dispflags & PVR_RGBMODE) ? "RGB" : "composite"); 289 290 /* XXX Colormap initialization? */ 291 292 sc->sc_scrdescs[0] = &sc->sc_dc->dc_wsscrdescr; 293 sc->sc_scrlist.nscreens = 1; 294 sc->sc_scrlist.screens = sc->sc_scrdescs; 295 296 waa.console = console; 297 waa.scrdata = &sc->sc_scrlist; 298 waa.accessops = &pvr_accessops; 299 waa.accesscookie = sc; 300 301 (void) config_found(self, &waa, wsemuldisplaydevprint, CFARGS_NONE); 302 } 303 304 int 305 pvrioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l) 306 { 307 struct pvr_softc *sc = v; 308 struct fb_devconfig *dc = sc->sc_dc; 309 310 switch (cmd) { 311 case WSDISPLAYIO_GTYPE: 312 *(u_int *)data = WSDISPLAY_TYPE_DCPVR; 313 return 0; 314 315 case WSDISPLAYIO_GINFO: 316 #define wsd_fbip ((struct wsdisplay_fbinfo *)data) 317 wsd_fbip->height = sc->sc_dc->dc_ht; 318 wsd_fbip->width = sc->sc_dc->dc_wid; 319 wsd_fbip->depth = sc->sc_dc->dc_depth; 320 wsd_fbip->cmsize = 0; /* XXX Colormap */ 321 #undef wsd_fbip 322 return 0; 323 324 case WSDISPLAYIO_LINEBYTES: 325 *(u_int *)data = sc->sc_dc->dc_rinfo.ri_stride; 326 return 0; 327 328 case WSDISPLAYIO_GETCMAP: 329 case WSDISPLAYIO_PUTCMAP: 330 return EPASSTHROUGH; /* XXX Colormap */ 331 332 case WSDISPLAYIO_SVIDEO: 333 switch (*(u_int *)data) { 334 case WSDISPLAYIO_VIDEO_OFF: 335 if (!dc->dc_blanked) { 336 dc->dc_blanked = 1; 337 PVR_REG_WRITE(dc, PVRREG_DIWMODE, 338 PVR_REG_READ(dc, PVRREG_DIWMODE) & 339 ~DIWMODE_DE); 340 } 341 break; 342 case WSDISPLAYIO_VIDEO_ON: 343 if (dc->dc_blanked) { 344 dc->dc_blanked = 0; 345 PVR_REG_WRITE(dc, PVRREG_DIWMODE, 346 PVR_REG_READ(dc, PVRREG_DIWMODE) | 347 DIWMODE_DE); 348 } 349 break; 350 default: 351 return EPASSTHROUGH; /* XXX */ 352 } 353 return 0; 354 355 case WSDISPLAYIO_GVIDEO: 356 *(u_int *)data = dc->dc_blanked ? 357 WSDISPLAYIO_VIDEO_OFF : WSDISPLAYIO_VIDEO_ON; 358 return 0; 359 360 case WSDISPLAYIO_GCURPOS: 361 case WSDISPLAYIO_SCURPOS: 362 case WSDISPLAYIO_GCURMAX: 363 case WSDISPLAYIO_GCURSOR: 364 case WSDISPLAYIO_SCURSOR: 365 return EPASSTHROUGH; /* XXX */ 366 } 367 368 return EPASSTHROUGH; 369 } 370 371 paddr_t 372 pvrmmap(void *v, void *vs, off_t offset, int prot) 373 { 374 375 /* 376 * XXX This should be easy to support -- just need to define 377 * XXX offsets for the control regs, etc. 378 */ 379 380 struct pvr_softc *sc = v; 381 struct fb_devconfig *dc = sc->sc_dc; 382 paddr_t addr; 383 384 if (offset >= 0 && 385 offset < sh3_round_page(dc->dc_rowbytes * dc->dc_ht)) 386 addr = sh3_btop(dc->dc_paddr + offset); 387 else 388 addr = (-1); /* XXX bogus */ 389 390 return addr; 391 } 392 393 int 394 pvr_alloc_screen(void *v, const struct wsscreen_descr *type, 395 void **cookiep, int *curxp, int *curyp, long *attrp) 396 { 397 struct pvr_softc *sc = v; 398 long defattr; 399 400 if (sc->sc_nscreens > 0) 401 return ENOMEM; 402 403 *cookiep = &sc->sc_dc->dc_rinfo; /* one and only for now */ 404 *curxp = 0; 405 *curyp = 0; 406 (*sc->sc_dc->dc_rinfo.ri_ops.allocattr)(&sc->sc_dc->dc_rinfo, 0, 0, 0, 407 &defattr); 408 *attrp = defattr; 409 sc->sc_nscreens++; 410 return 0; 411 } 412 413 void 414 pvr_free_screen(void *v, void *cookie) 415 { 416 struct pvr_softc *sc = v; 417 418 if (sc->sc_dc == &pvr_console_dc) 419 panic("pvr_free_screen: console"); 420 421 sc->sc_nscreens--; 422 } 423 424 int 425 pvr_show_screen(void *v, void *cookie, int waitok, 426 void (*cb)(void *, int, int), void *cbarg) 427 { 428 429 return 0; 430 } 431 432 static void 433 pvr_check_cable(struct fb_devconfig *dc) 434 { 435 volatile uint32_t *porta = 436 (volatile uint32_t *)0xff80002c; 437 uint16_t v; 438 439 /* PORT8 and PORT9 is input */ 440 *porta = (*porta & ~0xf0000) | 0xa0000; 441 442 /* Read PORT8 and PORT9 */ 443 v = ((*(volatile uint16_t *)(porta + 1)) >> 8) & 3; 444 445 if ((v & 2) == 0) 446 dc->dc_dispflags |= PVR_VGAMODE|PVR_RGBMODE; 447 else if ((v & 1) == 0) 448 dc->dc_dispflags |= PVR_RGBMODE; 449 } 450 451 static void 452 pvr_check_tvsys(struct fb_devconfig *dc) 453 { 454 455 /* XXX should use flashmem device when one exists */ 456 dc->dc_tvsystem = (*(volatile uint8_t *)0xa021a004) & 3; 457 } 458 459 void 460 pvrinit(struct fb_devconfig *dc) 461 { 462 int display_lines_per_field; 463 int v_absolute_size; 464 int h_absolute_size; 465 int vborder_start, vborder_stop; 466 int hborder_start, hborder_stop; 467 int modulo = 1, voffset, hoffset; 468 469 pvr_check_cable(dc); 470 pvr_check_tvsys(dc); 471 472 PVR_REG_WRITE(dc, 8, 0); /* reset */ 473 PVR_REG_WRITE(dc, PVRREG_BRDCOLR, 0); /* black border */ 474 475 if (dc->dc_dispflags & PVR_VGAMODE) { 476 v_absolute_size = 524; 477 h_absolute_size = 857; 478 479 display_lines_per_field = 480; 480 hoffset = 164; 481 voffset = 36; 482 483 hborder_start = 126; 484 hborder_stop = 837; 485 486 vborder_start = 40; 487 vborder_stop = 444; /* XXX */ 488 489 /* 31kHz, RGB565 */ 490 PVR_REG_WRITE(dc, PVRREG_DIWMODE, 491 DIWMODE_C | DIWMODE_COL_RGB565); 492 493 /* video output */ 494 PVR_REG_WRITE(dc, PVRREG_SYNCCONF, SYNCCONF_VO); 495 } else { 496 if (dc->dc_tvsystem & 1) { 497 /* 50 Hz PAL */ 498 v_absolute_size = 624; 499 h_absolute_size = 863; 500 501 display_lines_per_field = 240; 502 hoffset = 174; 503 voffset = 18; 504 505 hborder_start = 116; 506 hborder_stop = 843; 507 508 vborder_start = 44; 509 vborder_stop = 536; /* XXX */ 510 } else { 511 /* 60 Hz NTSC */ 512 v_absolute_size = 524; 513 h_absolute_size = 857; 514 515 display_lines_per_field = 240; 516 hoffset = 170; 517 voffset = 28; 518 519 hborder_start = 126; 520 hborder_stop = 837; 521 522 vborder_start = 18; 523 vborder_stop = 506; /* XXX */ 524 } 525 526 modulo += 640 * 2 / 4; /* interlace -> skip every other line */ 527 528 /* 15kHz, RGB565 */ 529 PVR_REG_WRITE(dc, PVRREG_DIWMODE, 530 DIWMODE_COL_RGB565); 531 532 /* video output, PAL/NTSC, interlace */ 533 PVR_REG_WRITE(dc, PVRREG_SYNCCONF, 534 SYNCCONF_VO | SYNCCONF_I | SYNCCONF_BC(dc->dc_tvsystem)); 535 } 536 537 /* video base address, long field */ 538 PVR_REG_WRITE(dc, PVRREG_DIWADDRL, 0); 539 540 /* video base address, short field */ 541 PVR_REG_WRITE(dc, PVRREG_DIWADDRS, 640 * 2); 542 543 /* video size */ 544 PVR_REG_WRITE(dc, PVRREG_DIWSIZE, DIWSIZE_MODULO(modulo) | 545 DIWSIZE_LPF(display_lines_per_field - 1) | 546 DIWSIZE_DPL(640 * 2 / 4 - 1)); 547 548 PVR_REG_WRITE(dc, PVRREG_DIWVSTRT, /* V start */ 549 DIWVSTRT_V1(voffset) | DIWVSTRT_V2(voffset)); 550 PVR_REG_WRITE(dc, PVRREG_BRDVERT, /* V border */ 551 BRDVERT_START(vborder_start) | BRDVERT_STOP(vborder_stop)); 552 PVR_REG_WRITE(dc, PVRREG_DIWHSTRT, hoffset); /* H start */ 553 PVR_REG_WRITE(dc, PVRREG_SYNCSIZE, /* HV counter */ 554 SYNCSIZE_V(v_absolute_size) | SYNCSIZE_H(h_absolute_size)); 555 PVR_REG_WRITE(dc, PVRREG_BRDHORZ, /* H border */ 556 BRDHORZ_START(hborder_start) | BRDHORZ_STOP(hborder_stop)); 557 PVR_REG_WRITE(dc, PVRREG_DIWCONF, DIWCONF_MAGIC); 558 559 /* RGB / composite */ 560 *(volatile uint32_t *) 561 SH3_PHYS_TO_P2SEG(0x00702c00) = 562 ((dc->dc_dispflags & PVR_RGBMODE) ? 0 : 3) << 8; 563 564 /* display on */ 565 PVR_REG_WRITE(dc, PVRREG_DIWMODE, 566 PVR_REG_READ(dc, PVRREG_DIWMODE) | DIWMODE_DE); 567 } 568 569 /* Console support. */ 570 571 void 572 pvrcninit(struct consdev *cndev) 573 { 574 struct fb_devconfig *dcp = &pvr_console_dc; 575 long defattr; 576 577 pvr_getdevconfig(dcp); 578 (*dcp->dc_rinfo.ri_ops.allocattr)(&dcp->dc_rinfo, 0, 0, 0, &defattr); 579 wsdisplay_cnattach(&dcp->dc_wsscrdescr, &dcp->dc_rinfo, 0, 0, defattr); 580 581 pvr_is_console = 1; 582 583 cn_tab->cn_pri = CN_INTERNAL; 584 585 #if NMKBD > 0 586 mkbd_cnattach(); /* connect keyboard and screen together */ 587 #endif 588 } 589 590 void 591 pvrcnprobe(struct consdev *cndev) 592 { 593 #if NWSDISPLAY > 0 594 int maj, unit; 595 extern const struct cdevsw wsdisplay_cdevsw; 596 #endif 597 cndev->cn_dev = NODEV; 598 cndev->cn_pri = CN_NORMAL; 599 600 #if NWSDISPLAY > 0 601 unit = 0; 602 maj = cdevsw_lookup_major(&wsdisplay_cdevsw); 603 if (maj != -1) { 604 cndev->cn_pri = CN_INTERNAL; 605 cndev->cn_dev = makedev(maj, unit); 606 } 607 #endif 608 } 609