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