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