1 /* $NetBSD: smg.c,v 1.46 2007/10/17 19:58:01 garbled Exp $ */ 2 /* 3 * Copyright (c) 1998 Ludd, University of Lule}, Sweden. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This product includes software developed at Ludd, University of 17 * Lule}, Sweden and its contributors. 18 * 4. The name of the author may not be used to endorse or promote products 19 * derived from this software without specific prior written permission 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: smg.c,v 1.46 2007/10/17 19:58:01 garbled Exp $"); 35 36 #include <sys/param.h> 37 #include <sys/device.h> 38 #include <sys/systm.h> 39 #include <sys/callout.h> 40 #include <sys/time.h> 41 #include <sys/malloc.h> 42 #include <sys/conf.h> 43 #include <sys/kernel.h> 44 45 #include <machine/vsbus.h> 46 #include <machine/sid.h> 47 #include <machine/cpu.h> 48 #include <machine/ka420.h> 49 50 #include <dev/cons.h> 51 52 #include <dev/dec/dzreg.h> 53 #include <dev/dec/dzvar.h> 54 #include <dev/dec/dzkbdvar.h> 55 56 #include <dev/wscons/wsdisplayvar.h> 57 #include <dev/wscons/wsconsio.h> 58 #include <dev/wscons/wscons_callbacks.h> 59 #include <dev/wsfont/wsfont.h> 60 61 #include "dzkbd.h" 62 #include "opt_wsfont.h" 63 64 /* Screen hardware defs */ 65 #define SM_COLS 128 /* char width of screen */ 66 #define SM_ROWS 57 /* rows of char on screen */ 67 #define SM_CHEIGHT 15 /* lines a char consists of */ 68 #define SM_NEXTROW (SM_COLS * SM_CHEIGHT) 69 #define SM_YWIDTH 864 70 #define SM_XWIDTH 1024 71 72 /* Cursor register definitions */ 73 #define CUR_CMD 0 74 #define CUR_XPOS 4 75 #define CUR_YPOS 8 76 #define CUR_XMIN_1 12 77 #define CUR_XMAX_1 16 78 #define CUR_YMIN_1 20 79 #define CUR_YMAX_1 24 80 #define CUR_XMIN_2 28 81 #define CUR_XMAX_2 32 82 #define CUR_YMIN_2 36 83 #define CUR_YMAX_2 40 84 #define CUR_LOAD 44 85 86 #define CUR_CMD_TEST 0x8000 87 #define CUR_CMD_HSHI 0x4000 88 #define CUR_CMD_VBHI 0x2000 89 #define CUR_CMD_LODSA 0x1000 90 #define CUR_CMD_FORG2 0x0800 91 #define CUR_CMD_ENRG2 0x0400 92 #define CUR_CMD_FORG1 0x0200 93 #define CUR_CMD_ENRG1 0x0100 94 #define CUR_CMD_XHWID 0x0080 95 #define CUR_CMD_XHCL1 0x0040 96 #define CUR_CMD_XHCLP 0x0020 97 #define CUR_CMD_XHAIR 0x0010 98 #define CUR_CMD_FOPB 0x0008 99 #define CUR_CMD_ENPB 0x0004 100 #define CUR_CMD_FOPA 0x0002 101 #define CUR_CMD_ENPA 0x0001 102 103 #define CUR_XBIAS 216 /* Add to cursor position */ 104 #define CUR_YBIAS 33 105 106 #define WRITECUR(addr, val) *(volatile short *)(curaddr + (addr)) = (val) 107 static char *curaddr; 108 static short curcmd, curx, cury, hotX, hotY; 109 static int bgmask, fgmask; 110 111 static int smg_match(struct device *, struct cfdata *, void *); 112 static void smg_attach(struct device *, struct device *, void *); 113 114 struct smg_softc { 115 struct device ss_dev; 116 }; 117 118 CFATTACH_DECL(smg, sizeof(struct smg_softc), 119 smg_match, smg_attach, NULL, NULL); 120 121 static void smg_cursor(void *, int, int, int); 122 static int smg_mapchar(void *, int, unsigned int *); 123 static void smg_putchar(void *, int, int, u_int, long); 124 static void smg_copycols(void *, int, int, int,int); 125 static void smg_erasecols(void *, int, int, int, long); 126 static void smg_copyrows(void *, int, int, int); 127 static void smg_eraserows(void *, int, int, long); 128 static int smg_allocattr(void *, int, int, int, long *); 129 130 const struct wsdisplay_emulops smg_emulops = { 131 smg_cursor, 132 smg_mapchar, 133 smg_putchar, 134 smg_copycols, 135 smg_erasecols, 136 smg_copyrows, 137 smg_eraserows, 138 smg_allocattr 139 }; 140 141 const struct wsscreen_descr smg_stdscreen = { 142 "128x57", SM_COLS, SM_ROWS, 143 &smg_emulops, 144 8, SM_CHEIGHT, 145 WSSCREEN_UNDERLINE|WSSCREEN_REVERSE, 146 }; 147 148 const struct wsscreen_descr *_smg_scrlist[] = { 149 &smg_stdscreen, 150 }; 151 152 const struct wsscreen_list smg_screenlist = { 153 sizeof(_smg_scrlist) / sizeof(struct wsscreen_descr *), 154 _smg_scrlist, 155 }; 156 157 static char *sm_addr; 158 159 static u_char *qf; 160 161 #define QCHAR(c) (c < 32 ? 32 : (c > 127 ? c - 66 : c - 32)) 162 #define QFONT(c,line) qf[QCHAR(c) * 15 + line] 163 #define SM_ADDR(row, col, line) \ 164 sm_addr[col + (row * SM_CHEIGHT * SM_COLS) + line * SM_COLS] 165 166 167 static int smg_ioctl(void *, void *, u_long, void *, int, struct lwp *); 168 static paddr_t smg_mmap(void *, void *, off_t, int); 169 static int smg_alloc_screen(void *, const struct wsscreen_descr *, 170 void **, int *, int *, long *); 171 static void smg_free_screen(void *, void *); 172 static int smg_show_screen(void *, void *, int, 173 void (*) (void *, int, int), void *); 174 static void smg_crsr_blink(void *); 175 176 const struct wsdisplay_accessops smg_accessops = { 177 smg_ioctl, 178 smg_mmap, 179 smg_alloc_screen, 180 smg_free_screen, 181 smg_show_screen, 182 0 /* load_font */ 183 }; 184 185 struct smg_screen { 186 int ss_curx; 187 int ss_cury; 188 u_char ss_image[SM_ROWS][SM_COLS]; /* Image of current screen */ 189 u_char ss_attr[SM_ROWS][SM_COLS]; /* Reversed etc... */ 190 }; 191 192 static struct smg_screen smg_conscreen; 193 static struct smg_screen *curscr; 194 195 static callout_t smg_cursor_ch; 196 197 int 198 smg_match(struct device *parent, struct cfdata *match, void *aux) 199 { 200 struct vsbus_attach_args *va = aux; 201 volatile short *ccmd; 202 volatile short *cfgtst; 203 short tmp, tmp2; 204 205 if (vax_boardtype == VAX_BTYP_49 || vax_boardtype == VAX_BTYP_53) 206 return 0; 207 208 ccmd = (short *)va->va_addr; 209 cfgtst = (short *)vax_map_physmem(VS_CFGTST, 1); 210 /* 211 * Try to find the cursor chip by testing the flip-flop. 212 * If nonexistent, no glass tty. 213 */ 214 ccmd[0] = CUR_CMD_HSHI|CUR_CMD_FOPB; 215 DELAY(300000); 216 tmp = cfgtst[0]; 217 ccmd[0] = CUR_CMD_TEST|CUR_CMD_HSHI; 218 DELAY(300000); 219 tmp2 = cfgtst[0]; 220 vax_unmap_physmem((vaddr_t)cfgtst, 1); 221 222 if (tmp2 != tmp) 223 return 20; /* Using periodic interrupt */ 224 else 225 return 0; 226 } 227 228 void 229 smg_attach(struct device *parent, struct device *self, void *aux) 230 { 231 struct wsemuldisplaydev_attach_args aa; 232 struct wsdisplay_font *console_font; 233 int fcookie; 234 235 printf("\n"); 236 sm_addr = (void *)vax_map_physmem(SMADDR, (SMSIZE/VAX_NBPG)); 237 curaddr = (void *)vax_map_physmem(KA420_CUR_BASE, 1); 238 if (sm_addr == 0) { 239 printf("%s: Couldn't alloc graphics memory.\n", self->dv_xname); 240 return; 241 } 242 if (curscr == NULL) 243 callout_init(&smg_cursor_ch, 0); 244 curscr = &smg_conscreen; 245 aa.console = (vax_confdata & (KA420_CFG_L3CON|KA420_CFG_MULTU)) == 0; 246 247 aa.scrdata = &smg_screenlist; 248 aa.accessops = &smg_accessops; 249 callout_reset(&smg_cursor_ch, hz / 2, smg_crsr_blink, NULL); 250 curcmd = CUR_CMD_HSHI; 251 WRITECUR(CUR_CMD, curcmd); 252 if ((fcookie = wsfont_find(NULL, 8, 15, 0, 253 WSDISPLAY_FONTORDER_R2L, WSDISPLAY_FONTORDER_L2R)) < 0) 254 { 255 printf("%s: could not find 8x15 font\n", self->dv_xname); 256 return; 257 } 258 if (wsfont_lock(fcookie, &console_font) != 0) { 259 printf("%s: could not lock 8x15 font\n", self->dv_xname); 260 return; 261 } 262 qf = console_font->data; 263 264 config_found(self, &aa, wsemuldisplaydevprint); 265 } 266 267 static u_char *cursor; 268 static int cur_on; 269 270 static void 271 smg_crsr_blink(void *arg) 272 { 273 if (cur_on) 274 *cursor ^= 255; 275 callout_reset(&smg_cursor_ch, hz / 2, smg_crsr_blink, NULL); 276 } 277 278 void 279 smg_cursor(void *id, int on, int row, int col) 280 { 281 struct smg_screen *ss = id; 282 283 if (ss == curscr) { 284 SM_ADDR(ss->ss_cury, ss->ss_curx, 14) = 285 QFONT(ss->ss_image[ss->ss_cury][ss->ss_curx], 14); 286 cursor = &SM_ADDR(row, col, 14); 287 if ((cur_on = on)) 288 *cursor ^= 255; 289 } 290 ss->ss_curx = col; 291 ss->ss_cury = row; 292 } 293 294 int 295 smg_mapchar(void *id, int uni, unsigned int *index) 296 { 297 if (uni < 256) { 298 *index = uni; 299 return (5); 300 } 301 *index = ' '; 302 return (0); 303 } 304 305 static void 306 smg_putchar(void *id, int row, int col, u_int c, long attr) 307 { 308 struct smg_screen *ss = id; 309 int i; 310 311 c &= 0xff; 312 313 ss->ss_image[row][col] = c; 314 ss->ss_attr[row][col] = attr; 315 if (ss != curscr) 316 return; 317 for (i = 0; i < 15; i++) { 318 unsigned char ch = QFONT(c, i); 319 320 SM_ADDR(row, col, i) = (attr & WSATTR_REVERSE ? ~ch : ch); 321 322 } 323 if (attr & WSATTR_UNDERLINE) 324 SM_ADDR(row, col, 14) ^= SM_ADDR(row, col, 14); 325 } 326 327 /* 328 * copies columns inside a row. 329 */ 330 static void 331 smg_copycols(void *id, int row, int srccol, int dstcol, int ncols) 332 { 333 struct smg_screen *ss = id; 334 int i; 335 336 bcopy(&ss->ss_image[row][srccol], &ss->ss_image[row][dstcol], ncols); 337 bcopy(&ss->ss_attr[row][srccol], &ss->ss_attr[row][dstcol], ncols); 338 if (ss != curscr) 339 return; 340 for (i = 0; i < SM_CHEIGHT; i++) 341 bcopy(&SM_ADDR(row,srccol, i), &SM_ADDR(row, dstcol, i),ncols); 342 } 343 344 /* 345 * Erases a bunch of chars inside one row. 346 */ 347 static void 348 smg_erasecols(void *id, int row, int startcol, int ncols, long fillattr) 349 { 350 struct smg_screen *ss = id; 351 int i; 352 353 bzero(&ss->ss_image[row][startcol], ncols); 354 bzero(&ss->ss_attr[row][startcol], ncols); 355 if (ss != curscr) 356 return; 357 for (i = 0; i < SM_CHEIGHT; i++) 358 bzero(&SM_ADDR(row, startcol, i), ncols); 359 } 360 361 static void 362 smg_copyrows(void *id, int srcrow, int dstrow, int nrows) 363 { 364 struct smg_screen *ss = id; 365 int frows; 366 367 bcopy(&ss->ss_image[srcrow][0], &ss->ss_image[dstrow][0], 368 nrows * SM_COLS); 369 bcopy(&ss->ss_attr[srcrow][0], &ss->ss_attr[dstrow][0], 370 nrows * SM_COLS); 371 if (ss != curscr) 372 return; 373 if (nrows > 25) { 374 frows = nrows >> 1; 375 if (srcrow > dstrow) { 376 bcopy(&sm_addr[(srcrow * SM_NEXTROW)], 377 &sm_addr[(dstrow * SM_NEXTROW)], 378 frows * SM_NEXTROW); 379 bcopy(&sm_addr[((srcrow + frows) * SM_NEXTROW)], 380 &sm_addr[((dstrow + frows) * SM_NEXTROW)], 381 (nrows - frows) * SM_NEXTROW); 382 } else { 383 bcopy(&sm_addr[((srcrow + frows) * SM_NEXTROW)], 384 &sm_addr[((dstrow + frows) * SM_NEXTROW)], 385 (nrows - frows) * SM_NEXTROW); 386 bcopy(&sm_addr[(srcrow * SM_NEXTROW)], 387 &sm_addr[(dstrow * SM_NEXTROW)], 388 frows * SM_NEXTROW); 389 } 390 } else 391 bcopy(&sm_addr[(srcrow * SM_NEXTROW)], 392 &sm_addr[(dstrow * SM_NEXTROW)], nrows * SM_NEXTROW); 393 } 394 395 static void 396 smg_eraserows(void *id, int startrow, int nrows, long fillattr) 397 { 398 struct smg_screen *ss = id; 399 int frows; 400 401 bzero(&ss->ss_image[startrow][0], nrows * SM_COLS); 402 bzero(&ss->ss_attr[startrow][0], nrows * SM_COLS); 403 if (ss != curscr) 404 return; 405 if (nrows > 25) { 406 frows = nrows >> 1; 407 bzero(&sm_addr[(startrow * SM_NEXTROW)], frows * SM_NEXTROW); 408 bzero(&sm_addr[((startrow + frows) * SM_NEXTROW)], 409 (nrows - frows) * SM_NEXTROW); 410 } else 411 bzero(&sm_addr[(startrow * SM_NEXTROW)], nrows * SM_NEXTROW); 412 } 413 414 static int 415 smg_allocattr(void *id, int fg, int bg, int flags, long *attrp) 416 { 417 *attrp = flags; 418 return 0; 419 } 420 421 static void 422 setcursor(struct wsdisplay_cursor *v) 423 { 424 u_short red, green, blue; 425 u_int32_t curfg[16], curmask[16]; 426 int i; 427 428 /* Enable cursor */ 429 if (v->which & WSDISPLAY_CURSOR_DOCUR) { 430 if (v->enable) 431 curcmd |= CUR_CMD_ENPB|CUR_CMD_ENPA; 432 else 433 curcmd &= ~(CUR_CMD_ENPB|CUR_CMD_ENPA); 434 WRITECUR(CUR_CMD, curcmd); 435 } 436 if (v->which & WSDISPLAY_CURSOR_DOHOT) { 437 hotX = v->hot.x; 438 hotY = v->hot.y; 439 } 440 if (v->which & WSDISPLAY_CURSOR_DOCMAP) { 441 /* First background */ 442 red = fusword(v->cmap.red); 443 green = fusword(v->cmap.green); 444 blue = fusword(v->cmap.blue); 445 bgmask = (((30L * red + 59L * green + 11L * blue) >> 8) >= 446 (((1<<8)-1)*50)) ? ~0 : 0; 447 red = fusword(v->cmap.red+2); 448 green = fusword(v->cmap.green+2); 449 blue = fusword(v->cmap.blue+2); 450 fgmask = (((30L * red + 59L * green + 11L * blue) >> 8) >= 451 (((1<<8)-1)*50)) ? ~0 : 0; 452 } 453 if (v->which & WSDISPLAY_CURSOR_DOSHAPE) { 454 WRITECUR(CUR_CMD, curcmd | CUR_CMD_LODSA); 455 copyin(v->image, curfg, sizeof(curfg)); 456 copyin(v->mask, curmask, sizeof(curmask)); 457 for (i = 0; i < sizeof(curfg)/sizeof(curfg[0]); i++) { 458 WRITECUR(CUR_LOAD, ((u_int16_t)curfg[i] & fgmask) | 459 (((u_int16_t)curmask[i] & (u_int16_t)~curfg[i]) 460 & bgmask)); 461 } 462 for (i = 0; i < sizeof(curmask)/sizeof(curmask[0]); i++) { 463 WRITECUR(CUR_LOAD, (u_int16_t)curmask[i]); 464 } 465 WRITECUR(CUR_CMD, curcmd); 466 } 467 } 468 469 int 470 smg_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l) 471 { 472 struct wsdisplay_fbinfo *fb = (void *)data; 473 static short curc; 474 475 switch (cmd) { 476 case WSDISPLAYIO_GTYPE: 477 *(u_int *)data = WSDISPLAY_TYPE_VAX_MONO; 478 break; 479 480 case WSDISPLAYIO_GINFO: 481 fb->height = SM_YWIDTH; 482 fb->width = SM_XWIDTH; 483 fb->depth = 1; 484 fb->cmsize = 2; 485 break; 486 487 case WSDISPLAYIO_SVIDEO: 488 if (*(u_int *)data == WSDISPLAYIO_VIDEO_ON) { 489 curcmd = curc; 490 } else { 491 curc = curcmd; 492 curcmd &= ~(CUR_CMD_FOPA|CUR_CMD_ENPA); 493 curcmd |= CUR_CMD_FOPB; 494 } 495 WRITECUR(CUR_CMD, curcmd); 496 break; 497 498 case WSDISPLAYIO_GVIDEO: 499 *(u_int *)data = (curcmd & CUR_CMD_FOPB ? 500 WSDISPLAYIO_VIDEO_OFF : WSDISPLAYIO_VIDEO_ON); 501 break; 502 503 case WSDISPLAYIO_SCURSOR: 504 setcursor((struct wsdisplay_cursor *)data); 505 break; 506 507 case WSDISPLAYIO_SCURPOS: 508 curx = ((struct wsdisplay_curpos *)data)->x; 509 cury = ((struct wsdisplay_curpos *)data)->y; 510 WRITECUR(CUR_XPOS, curx + CUR_XBIAS); 511 WRITECUR(CUR_YPOS, cury + CUR_YBIAS); 512 break; 513 514 case WSDISPLAYIO_GCURPOS: 515 ((struct wsdisplay_curpos *)data)->x = curx; 516 ((struct wsdisplay_curpos *)data)->y = cury; 517 break; 518 519 case WSDISPLAYIO_GCURMAX: 520 ((struct wsdisplay_curpos *)data)->x = 16; 521 ((struct wsdisplay_curpos *)data)->y = 16; 522 break; 523 524 default: 525 return EPASSTHROUGH; 526 } 527 return 0; 528 } 529 530 static paddr_t 531 smg_mmap(void *v, void *vs, off_t offset, int prot) 532 { 533 if (offset >= SMSIZE || offset < 0) 534 return -1; 535 return (SMADDR + offset) >> PGSHIFT; 536 } 537 538 int 539 smg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, 540 int *curxp, int *curyp, long *defattrp) 541 { 542 *cookiep = malloc(sizeof(struct smg_screen), M_DEVBUF, M_WAITOK); 543 bzero(*cookiep, sizeof(struct smg_screen)); 544 *curxp = *curyp = *defattrp = 0; 545 return 0; 546 } 547 548 void 549 smg_free_screen(void *v, void *cookie) 550 { 551 } 552 553 int 554 smg_show_screen(void *v, void *cookie, int waitok, 555 void (*cb)(void *, int, int), void *cbarg) 556 { 557 struct smg_screen *ss = cookie; 558 int row, col, line; 559 560 if (ss == curscr) 561 return (0); 562 563 for (row = 0; row < SM_ROWS; row++) 564 for (line = 0; line < SM_CHEIGHT; line++) { 565 for (col = 0; col < SM_COLS; col++) { 566 u_char s, c = ss->ss_image[row][col]; 567 568 if (c < 32) 569 c = 32; 570 s = QFONT(c, line); 571 if (ss->ss_attr[row][col] & WSATTR_REVERSE) 572 s ^= 255; 573 SM_ADDR(row, col, line) = s; 574 if (ss->ss_attr[row][col] & WSATTR_UNDERLINE) 575 SM_ADDR(row, col, line) = 255; 576 } 577 } 578 cursor = &sm_addr[(ss->ss_cury * SM_CHEIGHT * SM_COLS) + ss->ss_curx + 579 ((SM_CHEIGHT - 1) * SM_COLS)]; 580 curscr = ss; 581 return (0); 582 } 583 584 cons_decl(smg); 585 586 void 587 smgcninit(cndev) 588 struct consdev *cndev; 589 { 590 int fcookie; 591 struct wsdisplay_font *console_font; 592 extern void lkccninit(struct consdev *); 593 extern int lkccngetc(dev_t); 594 extern int dz_vsbus_lk201_cnattach __P((int)); 595 /* Clear screen */ 596 memset(sm_addr, 0, 128*864); 597 598 callout_init(&smg_cursor_ch, 0); 599 600 curscr = &smg_conscreen; 601 wsdisplay_cnattach(&smg_stdscreen, &smg_conscreen, 0, 0, 0); 602 cn_tab->cn_pri = CN_INTERNAL; 603 if ((fcookie = wsfont_find(NULL, 8, 15, 0, 604 WSDISPLAY_FONTORDER_R2L, WSDISPLAY_FONTORDER_L2R)) < 0) 605 { 606 printf("smg: could not find 8x15 font\n"); 607 return; 608 } 609 if (wsfont_lock(fcookie, &console_font) != 0) { 610 printf("smg: could not lock 8x15 font\n"); 611 return; 612 } 613 qf = console_font->data; 614 615 #if NDZKBD > 0 616 dzkbd_cnattach(0); /* Connect keyboard and screen together */ 617 #endif 618 } 619 620 /* 621 * Called very early to setup the glass tty as console. 622 * Because it's called before the VM system is inited, virtual memory 623 * for the framebuffer can be stolen directly without disturbing anything. 624 */ 625 void 626 smgcnprobe(cndev) 627 struct consdev *cndev; 628 { 629 extern vaddr_t virtual_avail; 630 extern const struct cdevsw wsdisplay_cdevsw; 631 632 switch (vax_boardtype) { 633 case VAX_BTYP_410: 634 case VAX_BTYP_420: 635 case VAX_BTYP_43: 636 if ((vax_confdata & KA420_CFG_L3CON) || 637 (vax_confdata & KA420_CFG_MULTU)) 638 break; /* doesn't use graphics console */ 639 sm_addr = (void *)virtual_avail; 640 virtual_avail += SMSIZE; 641 ioaccess((vaddr_t)sm_addr, SMADDR, (SMSIZE/VAX_NBPG)); 642 cndev->cn_pri = CN_INTERNAL; 643 cndev->cn_dev = makedev(cdevsw_lookup_major(&wsdisplay_cdevsw), 644 0); 645 break; 646 647 default: 648 break; 649 } 650 } 651