pvr.c revision 1.27 1 /* $NetBSD: pvr.c,v 1.27 2010/05/15 08:53:27 tsutsui 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.27 2010/05/15 08:53:27 tsutsui 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_GETCMAP:
336 case WSDISPLAYIO_PUTCMAP:
337 return EPASSTHROUGH; /* XXX Colormap */
338
339 case WSDISPLAYIO_SVIDEO:
340 switch (*(u_int *)data) {
341 case WSDISPLAYIO_VIDEO_OFF:
342 if (!dc->dc_blanked) {
343 dc->dc_blanked = 1;
344 PVR_REG_WRITE(dc, PVRREG_DIWMODE,
345 PVR_REG_READ(dc, PVRREG_DIWMODE) &
346 ~DIWMODE_DE);
347 }
348 break;
349 case WSDISPLAYIO_VIDEO_ON:
350 if (dc->dc_blanked) {
351 dc->dc_blanked = 0;
352 PVR_REG_WRITE(dc, PVRREG_DIWMODE,
353 PVR_REG_READ(dc, PVRREG_DIWMODE) |
354 DIWMODE_DE);
355 }
356 break;
357 default:
358 return EPASSTHROUGH; /* XXX */
359 }
360 return 0;
361
362 case WSDISPLAYIO_GVIDEO:
363 *(u_int *)data = dc->dc_blanked ?
364 WSDISPLAYIO_VIDEO_OFF : WSDISPLAYIO_VIDEO_ON;
365 return 0;
366
367 case WSDISPLAYIO_GCURPOS:
368 case WSDISPLAYIO_SCURPOS:
369 case WSDISPLAYIO_GCURMAX:
370 case WSDISPLAYIO_GCURSOR:
371 case WSDISPLAYIO_SCURSOR:
372 return EPASSTHROUGH; /* XXX */
373 }
374
375 return EPASSTHROUGH;
376 }
377
378 paddr_t
379 pvrmmap(void *v, void *vs, off_t offset, int prot)
380 {
381
382 /*
383 * XXX This should be easy to support -- just need to define
384 * XXX offsets for the contol regs, etc.
385 */
386
387 struct pvr_softc *sc = v;
388 struct fb_devconfig *dc = sc->sc_dc;
389 paddr_t addr;
390
391 if (offset >= 0 &&
392 offset < sh3_round_page(dc->dc_rowbytes * dc->dc_ht))
393 addr = sh3_btop(dc->dc_paddr + offset);
394 else
395 addr = (-1); /* XXX bogus */
396
397 return addr;
398 }
399
400 int
401 pvr_alloc_screen(void *v, const struct wsscreen_descr *type,
402 void **cookiep, int *curxp, int *curyp, long *attrp)
403 {
404 struct pvr_softc *sc = v;
405 long defattr;
406
407 if (sc->nscreens > 0)
408 return ENOMEM;
409
410 *cookiep = &sc->sc_dc->rinfo; /* one and only for now */
411 *curxp = 0;
412 *curyp = 0;
413 (*sc->sc_dc->rinfo.ri_ops.allocattr)(&sc->sc_dc->rinfo, 0, 0, 0,
414 &defattr);
415 *attrp = defattr;
416 sc->nscreens++;
417 return 0;
418 }
419
420 void
421 pvr_free_screen(void *v, void *cookie)
422 {
423 struct pvr_softc *sc = v;
424
425 if (sc->sc_dc == &pvr_console_dc)
426 panic("pvr_free_screen: console");
427
428 sc->nscreens--;
429 }
430
431 int
432 pvr_show_screen(void *v, void *cookie, int waitok,
433 void (*cb)(void *, int, int), void *cbarg)
434 {
435
436 return 0;
437 }
438
439 static void
440 pvr_check_cable(struct fb_devconfig *dc)
441 {
442 volatile uint32_t *porta =
443 (volatile uint32_t *)0xff80002c;
444 uint16_t v;
445
446 /* PORT8 and PORT9 is input */
447 *porta = (*porta & ~0xf0000) | 0xa0000;
448
449 /* Read PORT8 and PORT9 */
450 v = ((*(volatile uint16_t *)(porta + 1)) >> 8) & 3;
451
452 if ((v & 2) == 0)
453 dc->dc_dispflags |= PVR_VGAMODE|PVR_RGBMODE;
454 else if ((v & 1) == 0)
455 dc->dc_dispflags |= PVR_RGBMODE;
456 }
457
458 static void
459 pvr_check_tvsys(struct fb_devconfig *dc)
460 {
461
462 /* XXX should use flashmem device when one exists */
463 dc->dc_tvsystem = (*(volatile uint8_t *)0xa021a004) & 3;
464 }
465
466 void
467 pvrinit(struct fb_devconfig *dc)
468 {
469 int display_lines_per_field;
470 int v_absolute_size;
471 int h_absolute_size;
472 int vborder_start, vborder_stop;
473 int hborder_start, hborder_stop;
474 int modulo = 1, voffset, hoffset;
475
476 pvr_check_cable(dc);
477 pvr_check_tvsys(dc);
478
479 PVR_REG_WRITE(dc, 8, 0); /* reset */
480 PVR_REG_WRITE(dc, PVRREG_BRDCOLR, 0); /* black border */
481
482 if (dc->dc_dispflags & PVR_VGAMODE) {
483 v_absolute_size = 524;
484 h_absolute_size = 857;
485
486 display_lines_per_field = 480;
487 hoffset = 164;
488 voffset = 36;
489
490 hborder_start = 126;
491 hborder_stop = 837;
492
493 vborder_start = 40;
494 vborder_stop = 444; /* XXX */
495
496 /* 31kHz, RGB565 */
497 PVR_REG_WRITE(dc, PVRREG_DIWMODE,
498 DIWMODE_C | DIWMODE_COL_RGB565);
499
500 /* video output */
501 PVR_REG_WRITE(dc, PVRREG_SYNCCONF, SYNCCONF_VO);
502 } else {
503 if (dc->dc_tvsystem & 1) {
504 /* 50 Hz PAL */
505 v_absolute_size = 624;
506 h_absolute_size = 863;
507
508 display_lines_per_field = 240;
509 hoffset = 174;
510 voffset = 18;
511
512 hborder_start = 116;
513 hborder_stop = 843;
514
515 vborder_start = 44;
516 vborder_stop = 536; /* XXX */
517 } else {
518 /* 60 Hz NTSC */
519 v_absolute_size = 524;
520 h_absolute_size = 857;
521
522 display_lines_per_field = 240;
523 hoffset = 170;
524 voffset = 28;
525
526 hborder_start = 126;
527 hborder_stop = 837;
528
529 vborder_start = 18;
530 vborder_stop = 506; /* XXX */
531 }
532
533 modulo += 640 * 2 / 4; /* interlace -> skip every other line */
534
535 /* 15kHz, RGB565 */
536 PVR_REG_WRITE(dc, PVRREG_DIWMODE,
537 DIWMODE_COL_RGB565);
538
539 /* video output, PAL/NTSC, interlace */
540 PVR_REG_WRITE(dc, PVRREG_SYNCCONF,
541 SYNCCONF_VO | SYNCCONF_I | SYNCCONF_BC(dc->dc_tvsystem));
542 }
543
544 /* video base address, long field */
545 PVR_REG_WRITE(dc, PVRREG_DIWADDRL, 0);
546
547 /* video base address, short field */
548 PVR_REG_WRITE(dc, PVRREG_DIWADDRS, 640 * 2);
549
550 /* video size */
551 PVR_REG_WRITE(dc, PVRREG_DIWSIZE, DIWSIZE_MODULO(modulo) |
552 DIWSIZE_LPF(display_lines_per_field - 1) |
553 DIWSIZE_DPL(640 * 2 / 4 - 1));
554
555 PVR_REG_WRITE(dc, PVRREG_DIWVSTRT, /* V start */
556 DIWVSTRT_V1(voffset) | DIWVSTRT_V2(voffset));
557 PVR_REG_WRITE(dc, PVRREG_BRDVERT, /* V border */
558 BRDVERT_START(vborder_start) | BRDVERT_STOP(vborder_stop));
559 PVR_REG_WRITE(dc, PVRREG_DIWHSTRT, hoffset); /* H start */
560 PVR_REG_WRITE(dc, PVRREG_SYNCSIZE, /* HV counter */
561 SYNCSIZE_V(v_absolute_size) | SYNCSIZE_H(h_absolute_size));
562 PVR_REG_WRITE(dc, PVRREG_BRDHORZ, /* H border */
563 BRDHORZ_START(hborder_start) | BRDHORZ_STOP(hborder_stop));
564 PVR_REG_WRITE(dc, PVRREG_DIWCONF, DIWCONF_MAGIC);
565
566 /* RGB / composite */
567 *(volatile uint32_t *)
568 SH3_PHYS_TO_P2SEG(0x00702c00) =
569 ((dc->dc_dispflags & PVR_RGBMODE) ? 0 : 3) << 8;
570
571 /* display on */
572 PVR_REG_WRITE(dc, PVRREG_DIWMODE,
573 PVR_REG_READ(dc, PVRREG_DIWMODE) | DIWMODE_DE);
574 }
575
576 /* Console support. */
577
578 void pvrcnprobe(struct consdev *);
579 void pvrcninit(struct consdev *);
580
581 void
582 pvrcninit(struct consdev *cndev)
583 {
584 struct fb_devconfig *dcp = &pvr_console_dc;
585 long defattr;
586
587 pvr_getdevconfig(dcp);
588 (*dcp->rinfo.ri_ops.allocattr)(&dcp->rinfo, 0, 0, 0, &defattr);
589 wsdisplay_cnattach(&pvr_stdscreen, &dcp->rinfo, 0, 0, defattr);
590
591 pvr_is_console = 1;
592
593 cn_tab->cn_pri = CN_INTERNAL;
594
595 #if NMKBD > 0
596 mkbd_cnattach(); /* connect keyboard and screen together */
597 #endif
598 }
599
600 void
601 pvrcnprobe(struct consdev *cndev)
602 {
603 #if NWSDISPLAY > 0
604 int maj, unit;
605 extern const struct cdevsw wsdisplay_cdevsw;
606 #endif
607 cndev->cn_dev = NODEV;
608 cndev->cn_pri = CN_NORMAL;
609
610 #if NWSDISPLAY > 0
611 unit = 0;
612 maj = cdevsw_lookup_major(&wsdisplay_cdevsw);
613 if (maj != -1) {
614 cndev->cn_pri = CN_INTERNAL;
615 cndev->cn_dev = makedev(maj, unit);
616 }
617 #endif
618 }
619