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