1 /* $NetBSD: zs.c,v 1.18 2003/01/28 12:35:35 pk Exp $ */ 2 3 /*- 4 * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Gordon W. Ross and Wayne Knowles 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39 /* 40 * Zilog Z8530 Dual UART driver (machine-dependent part) 41 * 42 * Runs two serial lines per chip using slave drivers. 43 * Plain tty/async lines use the zs_async slave. 44 */ 45 46 #include "opt_ddb.h" 47 #include "opt_kgdb.h" 48 49 #include <sys/param.h> 50 #include <sys/systm.h> 51 #include <sys/conf.h> 52 #include <sys/device.h> 53 #include <sys/file.h> 54 #include <sys/ioctl.h> 55 #include <sys/kernel.h> 56 #include <sys/proc.h> 57 #include <sys/tty.h> 58 #include <sys/time.h> 59 #include <sys/syslog.h> 60 61 #include <machine/cpu.h> 62 #include <machine/intr.h> 63 #include <machine/autoconf.h> 64 #include <machine/z8530var.h> 65 66 #include <dev/cons.h> 67 #include <dev/ic/z8530reg.h> 68 69 #include <sgimips/hpc/hpcvar.h> 70 #include <sgimips/hpc/hpcreg.h> 71 72 #include <dev/arcbios/arcbios.h> 73 #include <dev/arcbios/arcbiosvar.h> 74 75 /* 76 * Some warts needed by z8530tty.c - 77 * The default parity REALLY needs to be the same as the PROM uses, 78 * or you can not see messages done with printf during boot-up... 79 */ 80 int zs_def_cflag = (CREAD | CS8 | HUPCL); 81 82 #define PCLK 3672000 /* PCLK pin input clock rate */ 83 84 #ifndef ZS_DEFSPEED 85 #define ZS_DEFSPEED 9600 86 #endif 87 88 /* 89 * Define interrupt levels. 90 */ 91 #define ZSHARD_PRI 64 92 93 /* SGI shouldn't need ZS_DELAY() as recovery time is done in hardware? */ 94 #define ZS_DELAY() delay(3) 95 96 /* The layout of this is hardware-dependent (padding, order). */ 97 struct zschan { 98 u_char pad1[3]; 99 volatile u_char zc_csr; /* ctrl,status, and indirect access */ 100 u_char pad2[3]; 101 volatile u_char zc_data; /* data */ 102 }; 103 104 struct zsdevice { 105 struct zschan zs_chan_b; 106 struct zschan zs_chan_a; 107 }; 108 109 /* Return the byte offset of element within a structure */ 110 #define OFFSET(struct_def, el) ((size_t)&((struct_def *)0)->el) 111 112 #define ZS_CHAN_A OFFSET(struct zsdevice, zs_chan_a) 113 #define ZS_CHAN_B OFFSET(struct zsdevice, zs_chan_b) 114 #define ZS_REG_CSR 0 115 #define ZS_REG_DATA 1 116 static int zs_chan_offset[] = {ZS_CHAN_A, ZS_CHAN_B}; 117 118 static void zscnprobe __P((struct consdev *)); 119 static void zscninit __P((struct consdev *)); 120 static int zscngetc __P((dev_t)); 121 static void zscnputc __P((dev_t, int)); 122 static void zscnpollc __P((dev_t, int)); 123 124 static int cons_port; 125 126 struct consdev zs_cn = { 127 zscnprobe, 128 zscninit, 129 zscngetc, 130 zscnputc, 131 zscnpollc 132 }; 133 134 /* Flags from cninit() */ 135 static int zs_consunit = -1; 136 static int zs_conschan = -1; 137 138 /* Default speed for all channels */ 139 static int zs_defspeed = ZS_DEFSPEED; 140 static volatile int zssoftpending; 141 142 static u_char zs_init_reg[16] = { 143 0, /* 0: CMD (reset, etc.) */ 144 0, /* 1: No interrupts yet. */ 145 ZSHARD_PRI, /* 2: IVECT */ 146 ZSWR3_RX_8 | ZSWR3_RX_ENABLE, 147 ZSWR4_CLK_X16 | ZSWR4_ONESB, 148 ZSWR5_TX_8 | ZSWR5_TX_ENABLE, 149 0, /* 6: TXSYNC/SYNCLO */ 150 0, /* 7: RXSYNC/SYNCHI */ 151 0, /* 8: alias for data port */ 152 ZSWR9_MASTER_IE, 153 0, /*10: Misc. TX/RX control bits */ 154 ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD | ZSWR11_TRXC_OUT_ENA, 155 BPS_TO_TCONST(PCLK/16, ZS_DEFSPEED), /*12: BAUDLO (default=9600) */ 156 0, /*13: BAUDHI (default=9600) */ 157 ZSWR14_BAUD_ENA, 158 ZSWR15_BREAK_IE, 159 }; 160 161 162 /**************************************************************** 163 * Autoconfig 164 ****************************************************************/ 165 166 /* Definition of the driver for autoconfig. */ 167 static int zs_hpc_match __P((struct device *, struct cfdata *, void *)); 168 static void zs_hpc_attach __P((struct device *, struct device *, void *)); 169 static int zs_print __P((void *, const char *name)); 170 171 CFATTACH_DECL(zsc_hpc, sizeof(struct zsc_softc), 172 zs_hpc_match, zs_hpc_attach, NULL, NULL); 173 174 extern struct cfdriver zsc_cd; 175 176 static int zshard __P((void *)); 177 void zssoft __P((void *)); 178 static int zs_get_speed __P((struct zs_chanstate *)); 179 struct zschan *zs_get_chan_addr (int zs_unit, int channel); 180 int zs_getc __P((void *)); 181 void zs_putc __P((void *, int)); 182 183 /* 184 * Is the zs chip present? 185 */ 186 static int 187 zs_hpc_match(parent, cf, aux) 188 struct device *parent; 189 struct cfdata *cf; 190 void *aux; 191 { 192 struct hpc_attach_args *ha = aux; 193 194 if (strcmp(ha->ha_name, cf->cf_name) == 0) 195 return (1); 196 197 return (0); 198 } 199 200 /* 201 * Attach a found zs. 202 * 203 * Match slave number to zs unit number, so that misconfiguration will 204 * not set up the keyboard as ttya, etc. 205 */ 206 static void 207 zs_hpc_attach(parent, self, aux) 208 struct device *parent; 209 struct device *self; 210 void *aux; 211 { 212 struct zsc_softc *zsc = (void *) self; 213 struct hpc_attach_args *haa = aux; 214 struct zsc_attach_args zsc_args; 215 struct zs_chanstate *cs; 216 struct zs_channel *ch; 217 int zs_unit, channel, err, s; 218 char *promconsdev; 219 220 promconsdev = ARCBIOS->GetEnvironmentVariable("ConsoleOut"); 221 222 zsc->zsc_bustag = haa->ha_st; 223 if ((err = bus_space_subregion(haa->ha_st, haa->ha_sh, 224 haa->ha_devoff, 0x10, 225 &zsc->zsc_base)) != 0) { 226 printf(": unable to map 85c30 registers, error = %d\n", err); 227 return; 228 } 229 230 zs_unit = zsc->zsc_dev.dv_unit; 231 printf("\n"); 232 233 /* 234 * Initialize software state for each channel. 235 * 236 * Done in reverse order of channels since the first serial port 237 * is actually attached to the *second* channel, and vice versa. 238 * Doing it this way should force a 'zstty*' to attach zstty0 to 239 * channel 1 and zstty1 to channel 0. They couldn't have wired 240 * it up in a more sensible fashion, could they? 241 */ 242 for (channel = 1; channel >= 0; channel--) { 243 zsc_args.channel = channel; 244 ch = &zsc->zsc_cs_store[channel]; 245 cs = zsc->zsc_cs[channel] = (struct zs_chanstate *)ch; 246 247 simple_lock_init(&cs->cs_lock); 248 cs->cs_reg_csr = NULL; 249 cs->cs_reg_data = NULL; 250 cs->cs_channel = channel; 251 cs->cs_private = NULL; 252 cs->cs_ops = &zsops_null; 253 cs->cs_brg_clk = PCLK / 16; 254 255 if (bus_space_subregion(zsc->zsc_bustag, zsc->zsc_base, 256 zs_chan_offset[channel], 257 sizeof(struct zschan), 258 &ch->cs_regs) != 0) { 259 printf(": cannot map regs\n"); 260 return; 261 } 262 ch->cs_bustag = zsc->zsc_bustag; 263 264 memcpy(cs->cs_creg, zs_init_reg, 16); 265 memcpy(cs->cs_preg, zs_init_reg, 16); 266 267 zsc_args.hwflags = 0; 268 zsc_args.consdev = NULL; 269 270 if (zs_consunit == -1 && zs_conschan == -1) { 271 /* 272 * If this channel is being used by the PROM console, 273 * pass the generic zs driver a 'no reset' flag so the 274 * channel gets left in the appropriate state after 275 * attach. 276 * 277 * Note: the channel mappings are swapped. 278 */ 279 if (promconsdev != NULL && 280 strlen(promconsdev) == 9 && 281 strncmp(promconsdev, "serial", 6) == 0 && 282 (promconsdev[7] == '0' || promconsdev[7] == '1')) { 283 if (promconsdev[7] == '1' && channel == 0) 284 zsc_args.hwflags |= ZS_HWFLAG_NORESET; 285 else if (promconsdev[7] == '0' && channel == 1) 286 zsc_args.hwflags |= ZS_HWFLAG_NORESET; 287 } 288 } 289 290 /* If console, don't stomp speed, let zstty know */ 291 if (zs_unit == zs_consunit && channel == zs_conschan) { 292 zsc_args.consdev = &zs_cn; 293 zsc_args.hwflags = ZS_HWFLAG_CONSOLE; 294 295 cs->cs_defspeed = zs_get_speed(cs); 296 } else 297 cs->cs_defspeed = zs_defspeed; 298 299 cs->cs_defcflag = zs_def_cflag; 300 301 /* Make these correspond to cs_defcflag (-crtscts) */ 302 cs->cs_rr0_dcd = ZSRR0_DCD; 303 cs->cs_rr0_cts = 0; 304 cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS; 305 cs->cs_wr5_rts = 0; 306 307 /* 308 * Clear the master interrupt enable. 309 * The INTENA is common to both channels, 310 * so just do it on the A channel. 311 */ 312 if (channel == 0) { 313 zs_write_reg(cs, 9, 0); 314 } 315 /* 316 * Look for a child driver for this channel. 317 * The child attach will setup the hardware. 318 */ 319 if (!config_found(self, (void *)&zsc_args, zs_print)) { 320 /* No sub-driver. Just reset it. */ 321 u_char reset = (channel == 0) ? 322 ZSWR9_A_RESET : ZSWR9_B_RESET; 323 324 s = splhigh(); 325 zs_write_reg(cs, 9, reset); 326 splx(s); 327 } 328 } 329 330 331 zsc->sc_si = softintr_establish(IPL_SOFTSERIAL, zssoft, zsc); 332 cpu_intr_establish(haa->ha_irq, IPL_TTY, zshard, NULL); 333 334 evcnt_attach_dynamic(&zsc->zsc_intrcnt, EVCNT_TYPE_INTR, NULL, 335 self->dv_xname, "intr"); 336 337 /* 338 * Set the master interrupt enable and interrupt vector. 339 * (common to both channels, do it on A) 340 */ 341 cs = zsc->zsc_cs[0]; 342 s = splhigh(); 343 /* interrupt vector */ 344 zs_write_reg(cs, 2, zs_init_reg[2]); 345 /* master interrupt control (enable) */ 346 zs_write_reg(cs, 9, zs_init_reg[9]); 347 splx(s); 348 } 349 350 static int 351 zs_print(aux, name) 352 void *aux; 353 const char *name; 354 { 355 struct zsc_attach_args *args = aux; 356 357 if (name != NULL) 358 aprint_normal("%s: ", name); 359 360 if (args->channel != -1) 361 aprint_normal(" channel %d", args->channel); 362 363 return UNCONF; 364 } 365 366 /* 367 * Our ZS chips all share a common, autovectored interrupt, 368 * so we have to look at all of them on each interrupt. 369 */ 370 static int 371 zshard(arg) 372 void *arg; 373 { 374 register struct zsc_softc *zsc; 375 register int rr3, unit, rval, softreq; 376 377 rval = 0; 378 for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) { 379 zsc = zsc_cd.cd_devs[unit]; 380 if (zsc == NULL) 381 continue; 382 383 zsc->zsc_intrcnt.ev_count++; 384 while ((rr3 = zsc_intr_hard(zsc))) { 385 rval |= rr3; 386 } 387 388 softreq = zsc->zsc_cs[0]->cs_softreq; 389 softreq |= zsc->zsc_cs[1]->cs_softreq; 390 if (softreq && (zssoftpending == 0)) { 391 zssoftpending = 1; 392 softintr_schedule(zsc->sc_si); 393 } 394 } 395 return rval; 396 } 397 398 /* 399 * Similar scheme as for zshard (look at all of them) 400 */ 401 void 402 zssoft(arg) 403 void *arg; 404 { 405 register struct zsc_softc *zsc; 406 register int s, unit; 407 408 /* This is not the only ISR on this IPL. */ 409 if (zssoftpending == 0) 410 return; 411 412 /* 413 * The soft intr. bit will be set by zshard only if 414 * the variable zssoftpending is zero. The order of 415 * these next two statements prevents our clearing 416 * the soft intr bit just after zshard has set it. 417 */ 418 /*isr_soft_clear(ZSSOFT_PRI);*/ 419 zssoftpending = 0; 420 421 /* Make sure we call the tty layer at spltty. */ 422 s = spltty(); 423 for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) { 424 zsc = zsc_cd.cd_devs[unit]; 425 if (zsc == NULL) 426 continue; 427 (void) zsc_intr_soft(zsc); 428 } 429 splx(s); 430 return; 431 } 432 433 434 /* 435 * Compute the current baud rate given a ZS channel. 436 */ 437 static int 438 zs_get_speed(cs) 439 struct zs_chanstate *cs; 440 { 441 int tconst; 442 443 tconst = zs_read_reg(cs, 12); 444 tconst |= zs_read_reg(cs, 13) << 8; 445 return (TCONST_TO_BPS(cs->cs_brg_clk, tconst)); 446 } 447 448 /* 449 * MD functions for setting the baud rate and control modes. 450 */ 451 int 452 zs_set_speed(cs, bps) 453 struct zs_chanstate *cs; 454 int bps; /* bits per second */ 455 { 456 int tconst, real_bps; 457 458 #if 0 459 while (!(zs_read_csr(cs) & ZSRR0_TX_READY)) 460 {/*nop*/} 461 #endif 462 /* Wait for transmit buffer to empty */ 463 if (bps == 0) { 464 return (0); 465 } 466 467 #ifdef DIAGNOSTIC 468 if (cs->cs_brg_clk == 0) 469 panic("zs_set_speed"); 470 #endif 471 472 tconst = BPS_TO_TCONST(cs->cs_brg_clk, bps); 473 if (tconst < 0) 474 return (EINVAL); 475 476 /* Convert back to make sure we can do it. */ 477 real_bps = TCONST_TO_BPS(cs->cs_brg_clk, tconst); 478 479 /* XXX - Allow some tolerance here? */ 480 #if 0 481 if (real_bps != bps) 482 return (EINVAL); 483 #endif 484 485 cs->cs_preg[12] = tconst; 486 cs->cs_preg[13] = tconst >> 8; 487 488 /* Caller will stuff the pending registers. */ 489 return (0); 490 } 491 492 int 493 zs_set_modes(cs, cflag) 494 struct zs_chanstate *cs; 495 int cflag; /* bits per second */ 496 { 497 int s; 498 499 /* 500 * Output hardware flow control on the chip is horrendous: 501 * if carrier detect drops, the receiver is disabled, and if 502 * CTS drops, the transmitter is stoped IN MID CHARACTER! 503 * Therefore, NEVER set the HFC bit, and instead use the 504 * status interrupt to detect CTS changes. 505 */ 506 s = splzs(); 507 cs->cs_rr0_pps = 0; 508 if ((cflag & (CLOCAL | MDMBUF)) != 0) { 509 cs->cs_rr0_dcd = 0; 510 if ((cflag & MDMBUF) == 0) 511 cs->cs_rr0_pps = ZSRR0_DCD; 512 } else 513 cs->cs_rr0_dcd = ZSRR0_DCD; 514 if ((cflag & CRTSCTS) != 0) { 515 cs->cs_wr5_dtr = ZSWR5_DTR; 516 cs->cs_wr5_rts = ZSWR5_RTS; 517 cs->cs_rr0_cts = ZSRR0_CTS; 518 } else if ((cflag & MDMBUF) != 0) { 519 cs->cs_wr5_dtr = 0; 520 cs->cs_wr5_rts = ZSWR5_DTR; 521 cs->cs_rr0_cts = ZSRR0_DCD; 522 } else { 523 cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS; 524 cs->cs_wr5_rts = 0; 525 cs->cs_rr0_cts = 0; 526 } 527 splx(s); 528 529 /* Caller will stuff the pending registers. */ 530 return (0); 531 } 532 533 534 /* 535 * Read or write the chip with suitable delays. 536 */ 537 538 u_char 539 zs_read_reg(cs, reg) 540 struct zs_chanstate *cs; 541 u_char reg; 542 { 543 u_char val; 544 struct zs_channel *zsc = (struct zs_channel *)cs; 545 546 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR, reg); 547 ZS_DELAY(); 548 val = bus_space_read_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR); 549 ZS_DELAY(); 550 return val; 551 } 552 553 void 554 zs_write_reg(cs, reg, val) 555 struct zs_chanstate *cs; 556 u_char reg, val; 557 { 558 struct zs_channel *zsc = (struct zs_channel *)cs; 559 560 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR, reg); 561 ZS_DELAY(); 562 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR, val); 563 ZS_DELAY(); 564 } 565 566 u_char 567 zs_read_csr(cs) 568 struct zs_chanstate *cs; 569 { 570 struct zs_channel *zsc = (struct zs_channel *)cs; 571 register u_char val; 572 573 val = bus_space_read_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR); 574 ZS_DELAY(); 575 return val; 576 } 577 578 void 579 zs_write_csr(cs, val) 580 struct zs_chanstate *cs; 581 u_char val; 582 { 583 struct zs_channel *zsc = (struct zs_channel *)cs; 584 585 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR, val); 586 ZS_DELAY(); 587 } 588 589 u_char 590 zs_read_data(cs) 591 struct zs_chanstate *cs; 592 { 593 struct zs_channel *zsc = (struct zs_channel *)cs; 594 register u_char val; 595 596 val = bus_space_read_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_DATA); 597 ZS_DELAY(); 598 return val; 599 } 600 601 void 602 zs_write_data(cs, val) 603 struct zs_chanstate *cs; 604 u_char val; 605 { 606 struct zs_channel *zsc = (struct zs_channel *)cs; 607 608 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_DATA, val); 609 ZS_DELAY(); 610 } 611 612 void 613 zs_abort(cs) 614 struct zs_chanstate *cs; 615 { 616 #if defined(KGDB) 617 zskgdb(cs); 618 #elif defined(DDB) 619 Debugger(); 620 #endif 621 } 622 623 624 /*********************************************************/ 625 /* Polled character I/O functions for console and KGDB */ 626 /*********************************************************/ 627 628 struct zschan * 629 zs_get_chan_addr(zs_unit, channel) 630 int zs_unit, channel; 631 { 632 static int dumped_addr = 0; 633 struct zsdevice *addr; 634 struct zschan *zc; 635 636 addr = (struct zsdevice *) MIPS_PHYS_TO_KSEG1(0x1fbd9830); 637 638 if (channel == 0) { 639 zc = &addr->zs_chan_b; 640 } else { 641 zc = &addr->zs_chan_a; 642 } 643 644 if (dumped_addr == 0) { 645 dumped_addr++; 646 printf("zs channel %d had address %p\n", channel, zc); 647 } 648 649 return (zc); 650 } 651 652 int 653 zs_getc(arg) 654 void *arg; 655 { 656 register volatile struct zschan *zc = arg; 657 register int s, c, rr0; 658 659 s = splzs(); 660 /* Wait for a character to arrive. */ 661 do { 662 rr0 = zc->zc_csr; 663 ZS_DELAY(); 664 } while ((rr0 & ZSRR0_RX_READY) == 0); 665 666 c = zc->zc_data; 667 ZS_DELAY(); 668 splx(s); 669 670 return (c); 671 } 672 673 /* 674 * Polled output char. 675 */ 676 void 677 zs_putc(arg, c) 678 void *arg; 679 int c; 680 { 681 register volatile struct zschan *zc = arg; 682 register int s, rr0; 683 684 s = splzs(); 685 /* Wait for transmitter to become ready. */ 686 do { 687 rr0 = zc->zc_csr; 688 ZS_DELAY(); 689 } while ((rr0 & ZSRR0_TX_READY) == 0); 690 691 zc->zc_data = c; 692 wbflush(); 693 ZS_DELAY(); 694 splx(s); 695 } 696 697 /***************************************************************/ 698 void 699 zscnprobe(cn) 700 struct consdev *cn; 701 { 702 } 703 704 void 705 zscninit(cn) 706 struct consdev *cn; 707 { 708 extern const struct cdevsw zstty_cdevsw; 709 char* consdev; 710 711 if ((consdev = ARCBIOS->GetEnvironmentVariable("ConsoleOut")) == NULL) 712 panic("zscninit without valid ARCS ConsoleOut setting!"); 713 714 if (strlen(consdev) != 9 || 715 strncmp(consdev, "serial", 6) != 0) 716 panic("zscninit with ARCS console not set to serial!"); 717 718 cons_port = consdev[7] - '0'; 719 720 cn->cn_dev = makedev(cdevsw_lookup_major(&zstty_cdevsw), cons_port); 721 cn->cn_pri = CN_REMOTE; 722 723 /* Mark this unit as the console */ 724 zs_consunit = 0; 725 726 /* SGI hardware wires serial port 1 to channel B, port 2 to A */ 727 if (cons_port == 0) 728 zs_conschan = 1; 729 else 730 zs_conschan = 0; 731 } 732 733 int 734 zscngetc(dev) 735 dev_t dev; 736 { 737 struct zschan *zs; 738 739 zs = zs_get_chan_addr(0, cons_port); 740 return zs_getc(zs); 741 } 742 743 void 744 zscnputc(dev, c) 745 dev_t dev; 746 int c; 747 { 748 struct zschan *zs; 749 750 zs = zs_get_chan_addr(0, cons_port); 751 zs_putc(zs, c); 752 } 753 754 void 755 zscnpollc(dev, on) 756 dev_t dev; 757 int on; 758 { 759 } 760