Home | History | Annotate | Line # | Download | only in dev
zs_hb.c revision 1.24
      1  1.24  tsutsui /*	$NetBSD: zs_hb.c,v 1.24 2008/03/29 19:15:35 tsutsui Exp $	*/
      2   1.1   tsubai 
      3   1.1   tsubai /*-
      4   1.1   tsubai  * Copyright (c) 1996 The NetBSD Foundation, Inc.
      5   1.1   tsubai  * All rights reserved.
      6   1.1   tsubai  *
      7   1.1   tsubai  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1   tsubai  * by Gordon W. Ross.
      9   1.1   tsubai  *
     10   1.1   tsubai  * Redistribution and use in source and binary forms, with or without
     11   1.1   tsubai  * modification, are permitted provided that the following conditions
     12   1.1   tsubai  * are met:
     13   1.1   tsubai  * 1. Redistributions of source code must retain the above copyright
     14   1.1   tsubai  *    notice, this list of conditions and the following disclaimer.
     15   1.1   tsubai  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1   tsubai  *    notice, this list of conditions and the following disclaimer in the
     17   1.1   tsubai  *    documentation and/or other materials provided with the distribution.
     18   1.1   tsubai  * 3. All advertising materials mentioning features or use of this software
     19   1.1   tsubai  *    must display the following acknowledgement:
     20   1.1   tsubai  *        This product includes software developed by the NetBSD
     21   1.1   tsubai  *        Foundation, Inc. and its contributors.
     22   1.1   tsubai  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23   1.1   tsubai  *    contributors may be used to endorse or promote products derived
     24   1.1   tsubai  *    from this software without specific prior written permission.
     25   1.1   tsubai  *
     26   1.1   tsubai  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27   1.1   tsubai  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28   1.1   tsubai  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29   1.1   tsubai  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30   1.1   tsubai  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31   1.1   tsubai  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32   1.1   tsubai  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33   1.1   tsubai  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34   1.1   tsubai  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35   1.1   tsubai  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36   1.1   tsubai  * POSSIBILITY OF SUCH DAMAGE.
     37   1.1   tsubai  */
     38   1.1   tsubai 
     39   1.1   tsubai /*
     40   1.1   tsubai  * Zilog Z8530 Dual UART driver (machine-dependent part)
     41   1.1   tsubai  *
     42   1.1   tsubai  * Runs two serial lines per chip using slave drivers.
     43   1.1   tsubai  * Plain tty/async lines use the zs_async slave.
     44   1.1   tsubai  * Sun keyboard/mouse uses the zs_kbd/zs_ms slaves.
     45   1.1   tsubai  */
     46  1.17    lukem 
     47  1.17    lukem #include <sys/cdefs.h>
     48  1.24  tsutsui __KERNEL_RCSID(0, "$NetBSD: zs_hb.c,v 1.24 2008/03/29 19:15:35 tsutsui Exp $");
     49   1.1   tsubai 
     50   1.1   tsubai #include <sys/param.h>
     51   1.1   tsubai #include <sys/systm.h>
     52   1.1   tsubai #include <sys/device.h>
     53   1.1   tsubai #include <sys/tty.h>
     54   1.5  gehenna #include <sys/conf.h>
     55  1.23       ad #include <sys/cpu.h>
     56  1.23       ad #include <sys/intr.h>
     57   1.1   tsubai 
     58   1.1   tsubai #include <machine/adrsmap.h>
     59   1.1   tsubai #include <machine/z8530var.h>
     60   1.1   tsubai 
     61   1.1   tsubai #include <dev/cons.h>
     62   1.1   tsubai #include <dev/ic/z8530reg.h>
     63   1.1   tsubai 
     64  1.12  tsutsui #include <newsmips/dev/hbvar.h>
     65  1.12  tsutsui 
     66   1.1   tsubai #include "zsc.h"	/* NZSC */
     67   1.1   tsubai #define NZS NZSC
     68   1.1   tsubai 
     69   1.1   tsubai /* Make life easier for the initialized arrays here. */
     70   1.1   tsubai #if NZS < 2
     71   1.1   tsubai #undef  NZS
     72   1.1   tsubai #define NZS 2
     73   1.1   tsubai #endif
     74   1.1   tsubai 
     75   1.3   tsubai #define ZSCFLAG_EX	0x01	/* expansion board */
     76   1.3   tsubai 
     77   1.1   tsubai /*
     78   1.1   tsubai  * The news3400 provides a 4.9152 MHz clock to the ZS chips.
     79   1.1   tsubai  */
     80   1.3   tsubai #define PCLK	(9600 * 512)	/* PCLK pin input clock rate */
     81   1.3   tsubai #define PCLK_EX	(9600 * 384)
     82   1.1   tsubai 
     83   1.1   tsubai /*
     84   1.1   tsubai  * Define interrupt levels.
     85   1.1   tsubai  */
     86   1.1   tsubai #define ZSHARD_PRI 64
     87   1.1   tsubai 
     88   1.1   tsubai #define ZS_DELAY() {(void)*(volatile char *)INTEN1; delay(2);}
     89   1.1   tsubai 
     90   1.1   tsubai /* The layout of this is hardware-dependent (padding, order). */
     91   1.1   tsubai struct zschan {
     92  1.24  tsutsui 	volatile uint8_t zc_csr;	/* ctrl,status, and indirect access */
     93  1.24  tsutsui 	volatile uint8_t zc_data;	/* data */
     94   1.1   tsubai };
     95   1.1   tsubai struct zsdevice {
     96   1.1   tsubai 	/* Yes, they are backwards. */
     97   1.1   tsubai 	struct	zschan zs_chan_b;
     98   1.1   tsubai 	struct	zschan zs_chan_a;
     99   1.1   tsubai };
    100   1.1   tsubai 
    101   1.1   tsubai extern int zs_def_cflag;
    102   1.1   tsubai 
    103   1.1   tsubai static struct zsdevice *zsaddr[NZS];
    104   1.1   tsubai 
    105   1.1   tsubai /* Flags from cninit() */
    106   1.1   tsubai static int zs_hwflags[NZS][2];
    107   1.1   tsubai 
    108   1.1   tsubai /* Default speed for all channels */
    109   1.1   tsubai static int zs_defspeed = 9600;
    110   1.1   tsubai 
    111  1.24  tsutsui static uint8_t zs_init_reg[16] = {
    112   1.1   tsubai 	0,	/* 0: CMD (reset, etc.) */
    113   1.1   tsubai 	0,	/* 1: No interrupts yet. */
    114   1.1   tsubai 	ZSHARD_PRI,	/* IVECT */
    115   1.1   tsubai 	ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
    116   1.1   tsubai 	ZSWR4_CLK_X16 | ZSWR4_ONESB | ZSWR4_EVENP,
    117   1.1   tsubai 	ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
    118   1.1   tsubai 	0,	/* 6: TXSYNC/SYNCLO */
    119   1.1   tsubai 	0,	/* 7: RXSYNC/SYNCHI */
    120   1.1   tsubai 	0,	/* 8: alias for data port */
    121   1.1   tsubai 	ZSWR9_MASTER_IE,
    122   1.1   tsubai 	0,	/*10: Misc. TX/RX control bits */
    123   1.1   tsubai 	ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD,
    124   1.3   tsubai 	((PCLK/32)/9600)-2,	/*12: BAUDLO (default=9600) */
    125   1.1   tsubai 	0,			/*13: BAUDHI (default=9600) */
    126   1.1   tsubai 	ZSWR14_BAUD_ENA | ZSWR14_BAUD_FROM_PCLK,
    127   1.1   tsubai 	ZSWR15_BREAK_IE,
    128   1.1   tsubai };
    129   1.1   tsubai 
    130  1.18  tsutsui static struct zschan * zs_get_chan_addr(int, int);
    131  1.18  tsutsui static void zs_hb_delay(void);
    132  1.18  tsutsui static int zshard_hb(void *);
    133  1.18  tsutsui static int zs_getc(void *);
    134  1.18  tsutsui static void zs_putc(void *, int);
    135   1.1   tsubai 
    136   1.2   tsubai struct zschan *
    137  1.18  tsutsui zs_get_chan_addr(int zs_unit, int channel)
    138   1.1   tsubai {
    139   1.1   tsubai 	struct zsdevice *addr;
    140   1.1   tsubai 	struct zschan *zc;
    141   1.1   tsubai 
    142   1.1   tsubai 	if (zs_unit >= NZS)
    143   1.1   tsubai 		return NULL;
    144   1.1   tsubai 	addr = zsaddr[zs_unit];
    145   1.1   tsubai 	if (addr == NULL)
    146   1.1   tsubai 		return NULL;
    147   1.1   tsubai 	if (channel == 0) {
    148   1.1   tsubai 		zc = &addr->zs_chan_a;
    149   1.1   tsubai 	} else {
    150   1.1   tsubai 		zc = &addr->zs_chan_b;
    151   1.1   tsubai 	}
    152  1.18  tsutsui 	return zc;
    153   1.1   tsubai }
    154   1.1   tsubai 
    155  1.11  tsutsui static void
    156  1.18  tsutsui zs_hb_delay(void)
    157   1.1   tsubai {
    158  1.11  tsutsui 
    159   1.1   tsubai 	ZS_DELAY();
    160   1.1   tsubai }
    161   1.1   tsubai 
    162   1.1   tsubai /****************************************************************
    163   1.1   tsubai  * Autoconfig
    164   1.1   tsubai  ****************************************************************/
    165   1.1   tsubai 
    166   1.1   tsubai /* Definition of the driver for autoconfig. */
    167  1.24  tsutsui int zs_hb_match(device_t, cfdata_t, void *);
    168  1.24  tsutsui void zs_hb_attach(device_t, device_t, void *);
    169   1.1   tsubai 
    170  1.24  tsutsui CFATTACH_DECL_NEW(zsc_hb, sizeof(struct zsc_softc),
    171   1.7  thorpej     zs_hb_match, zs_hb_attach, NULL, NULL);
    172   1.1   tsubai 
    173   1.1   tsubai /*
    174   1.1   tsubai  * Is the zs chip present?
    175   1.1   tsubai  */
    176   1.1   tsubai int
    177  1.24  tsutsui zs_hb_match(device_t parent, cfdata_t cf, void *aux)
    178   1.1   tsubai {
    179  1.12  tsutsui 	struct hb_attach_args *ha = aux;
    180   1.1   tsubai 
    181  1.12  tsutsui 	if (strcmp(ha->ha_name, "zsc"))
    182   1.1   tsubai 		return 0;
    183   1.1   tsubai 
    184   1.1   tsubai 	/* This returns -1 on a fault (bus error). */
    185  1.12  tsutsui 	if (hb_badaddr((char *)ha->ha_addr, 1))
    186   1.1   tsubai 		return 0;
    187   1.1   tsubai 
    188   1.1   tsubai 	return 1;
    189   1.1   tsubai }
    190   1.1   tsubai 
    191   1.1   tsubai /*
    192   1.1   tsubai  * Attach a found zs.
    193   1.1   tsubai  *
    194   1.1   tsubai  * Match slave number to zs unit number, so that misconfiguration will
    195   1.1   tsubai  * not set up the keyboard as ttya, etc.
    196   1.1   tsubai  */
    197   1.1   tsubai void
    198  1.24  tsutsui zs_hb_attach(device_t parent, device_t self, void *aux)
    199   1.1   tsubai {
    200  1.24  tsutsui 	struct zsc_softc *zsc = device_private(self);
    201  1.12  tsutsui 	struct hb_attach_args *ha = aux;
    202   1.1   tsubai 	struct zsc_attach_args zsc_args;
    203   1.1   tsubai 	volatile struct zschan *zc;
    204   1.1   tsubai 	struct zs_chanstate *cs;
    205   1.1   tsubai 	int s, zs_unit, channel, intlevel;
    206   1.1   tsubai 	static int didintr;
    207   1.1   tsubai 
    208  1.24  tsutsui 	zsc->zsc_dev = self;
    209  1.24  tsutsui 	zs_unit = device_unit(self);
    210  1.12  tsutsui 	intlevel = ha->ha_level;
    211  1.12  tsutsui 	zsaddr[zs_unit] = (void *)ha->ha_addr;
    212   1.1   tsubai 
    213   1.1   tsubai 	if (intlevel == -1) {
    214   1.1   tsubai #if 0
    215  1.24  tsutsui 		aprint_error(": interrupt level not configured\n");
    216   1.1   tsubai 		return;
    217   1.1   tsubai #else
    218  1.24  tsutsui 		aprint_error(": interrupt level not configured; using");
    219   1.1   tsubai 		intlevel = 1;
    220   1.1   tsubai #endif
    221   1.1   tsubai 	}
    222   1.1   tsubai 
    223  1.24  tsutsui 	aprint_error(" level %d\n", intlevel);
    224   1.1   tsubai 
    225   1.1   tsubai 	zs_delay = zs_hb_delay;
    226   1.1   tsubai 
    227   1.1   tsubai 	/*
    228   1.1   tsubai 	 * Initialize software state for each channel.
    229   1.1   tsubai 	 */
    230   1.1   tsubai 	for (channel = 0; channel < 2; channel++) {
    231   1.1   tsubai 		zsc_args.channel = channel;
    232   1.1   tsubai 		zsc_args.hwflags = zs_hwflags[zs_unit][channel];
    233   1.1   tsubai 		cs = &zsc->zsc_cs_store[channel];
    234   1.1   tsubai 		zsc->zsc_cs[channel] = cs;
    235   1.1   tsubai 
    236  1.22       ad 		zs_lock_init(cs);
    237   1.1   tsubai 		cs->cs_channel = channel;
    238   1.1   tsubai 		cs->cs_private = NULL;
    239   1.1   tsubai 		cs->cs_ops = &zsops_null;
    240  1.24  tsutsui 		if ((device_cfdata(self)->cf_flags & ZSCFLAG_EX) == 0)
    241   1.3   tsubai 			cs->cs_brg_clk = PCLK / 16;
    242   1.1   tsubai 		else
    243   1.3   tsubai 			cs->cs_brg_clk = PCLK_EX / 16;
    244   1.1   tsubai 
    245   1.1   tsubai 		zc = zs_get_chan_addr(zs_unit, channel);
    246   1.1   tsubai 		cs->cs_reg_csr  = &zc->zc_csr;
    247   1.1   tsubai 		cs->cs_reg_data = &zc->zc_data;
    248   1.1   tsubai 
    249  1.18  tsutsui 		memcpy(cs->cs_creg, zs_init_reg, 16);
    250  1.18  tsutsui 		memcpy(cs->cs_preg, zs_init_reg, 16);
    251   1.1   tsubai 
    252   1.1   tsubai 		/* XXX: Get these from the EEPROM instead? */
    253   1.1   tsubai 		/* XXX: See the mvme167 code.  Better. */
    254   1.1   tsubai 		if (zsc_args.hwflags & ZS_HWFLAG_CONSOLE)
    255   1.1   tsubai 			cs->cs_defspeed = zs_get_speed(cs);
    256   1.1   tsubai 		else
    257   1.1   tsubai 			cs->cs_defspeed = zs_defspeed;
    258   1.1   tsubai 		cs->cs_defcflag = zs_def_cflag;
    259   1.1   tsubai 
    260   1.1   tsubai 		/* Make these correspond to cs_defcflag (-crtscts) */
    261   1.1   tsubai 		cs->cs_rr0_dcd = ZSRR0_DCD;
    262   1.1   tsubai 		cs->cs_rr0_cts = 0;
    263   1.1   tsubai 		cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS;
    264   1.1   tsubai 		cs->cs_wr5_rts = 0;
    265   1.1   tsubai 
    266   1.1   tsubai 		/*
    267   1.1   tsubai 		 * Clear the master interrupt enable.
    268   1.1   tsubai 		 * The INTENA is common to both channels,
    269   1.1   tsubai 		 * so just do it on the A channel.
    270   1.1   tsubai 		 */
    271   1.1   tsubai 		if (channel == 0) {
    272   1.1   tsubai 			zs_write_reg(cs, 9, 0);
    273   1.1   tsubai 		}
    274   1.1   tsubai 
    275   1.1   tsubai 		/*
    276   1.1   tsubai 		 * Look for a child driver for this channel.
    277   1.1   tsubai 		 * The child attach will setup the hardware.
    278   1.1   tsubai 		 */
    279   1.1   tsubai 		if (!config_found(self, (void *)&zsc_args, zs_print)) {
    280   1.1   tsubai 			/* No sub-driver.  Just reset it. */
    281  1.24  tsutsui 			uint8_t reset = (channel == 0) ?
    282  1.24  tsutsui 			    ZSWR9_A_RESET : ZSWR9_B_RESET;
    283   1.1   tsubai 			s = splhigh();
    284   1.1   tsubai 			zs_write_reg(cs, 9, reset);
    285   1.1   tsubai 			splx(s);
    286   1.1   tsubai 		}
    287   1.1   tsubai 	}
    288   1.1   tsubai 
    289   1.1   tsubai 	/*
    290   1.1   tsubai 	 * Now safe to install interrupt handlers.  Note the arguments
    291   1.1   tsubai 	 * to the interrupt handlers aren't used.  Note, we only do this
    292   1.1   tsubai 	 * once since both SCCs interrupt at the same level and vector.
    293   1.1   tsubai 	 */
    294   1.1   tsubai 	if (!didintr) {
    295   1.1   tsubai 		didintr = 1;
    296   1.1   tsubai 
    297  1.23       ad 		zsc->zsc_si = softint_establish(SOFTINT_SERIAL, zssoft, zsc);
    298  1.15  tsutsui 		hb_intr_establish(intlevel, INTST1_SCC, IPL_SERIAL,
    299  1.15  tsutsui 		    zshard_hb, NULL);
    300   1.1   tsubai 	}
    301   1.1   tsubai 	/* XXX; evcnt_attach() ? */
    302   1.1   tsubai 
    303   1.1   tsubai 	/*
    304   1.1   tsubai 	 * Set the master interrupt enable and interrupt vector.
    305   1.1   tsubai 	 * (common to both channels, do it on A)
    306   1.1   tsubai 	 */
    307   1.1   tsubai 	cs = zsc->zsc_cs[0];
    308   1.1   tsubai 	s = splhigh();
    309   1.1   tsubai 	/* interrupt vector */
    310   1.1   tsubai 	zs_write_reg(cs, 2, zs_init_reg[2]);
    311   1.1   tsubai 	/* master interrupt control (enable) */
    312   1.1   tsubai 	zs_write_reg(cs, 9, zs_init_reg[9]);
    313   1.1   tsubai 	splx(s);
    314   1.1   tsubai }
    315   1.1   tsubai 
    316   1.1   tsubai static int
    317  1.18  tsutsui zshard_hb(void *arg)
    318   1.1   tsubai {
    319  1.14  tsutsui 	int rv;
    320  1.14  tsutsui 
    321   1.1   tsubai 	(void) *(volatile u_char *)SCCVECT;
    322  1.14  tsutsui 	rv = zshard(arg);
    323  1.14  tsutsui 
    324  1.14  tsutsui 	/* XXX news3400 sometimes losts zs interrupt */
    325  1.14  tsutsui 	if (rv)
    326  1.14  tsutsui 		zshard(arg);
    327   1.1   tsubai 
    328  1.14  tsutsui 	return rv;
    329   1.1   tsubai }
    330   1.1   tsubai 
    331   1.1   tsubai /*
    332   1.1   tsubai  * Polled input char.
    333   1.1   tsubai  */
    334   1.1   tsubai int
    335  1.18  tsutsui zs_getc(void *arg)
    336   1.1   tsubai {
    337  1.11  tsutsui 	volatile struct zschan *zc = arg;
    338  1.11  tsutsui 	int s, c, rr0;
    339   1.1   tsubai 
    340   1.1   tsubai 	s = splhigh();
    341   1.1   tsubai 	/* Wait for a character to arrive. */
    342   1.1   tsubai 	do {
    343   1.1   tsubai 		rr0 = zc->zc_csr;
    344   1.1   tsubai 		ZS_DELAY();
    345   1.1   tsubai 	} while ((rr0 & ZSRR0_RX_READY) == 0);
    346   1.1   tsubai 
    347   1.1   tsubai 	c = zc->zc_data;
    348   1.1   tsubai 	ZS_DELAY();
    349   1.1   tsubai 	splx(s);
    350   1.1   tsubai 
    351   1.1   tsubai 	/*
    352   1.1   tsubai 	 * This is used by the kd driver to read scan codes,
    353   1.1   tsubai 	 * so don't translate '\r' ==> '\n' here...
    354   1.1   tsubai 	 */
    355  1.18  tsutsui 	return c;
    356   1.1   tsubai }
    357   1.1   tsubai 
    358   1.1   tsubai /*
    359   1.1   tsubai  * Polled output char.
    360   1.1   tsubai  */
    361   1.1   tsubai void
    362  1.18  tsutsui zs_putc(void *arg, int c)
    363   1.1   tsubai {
    364  1.11  tsutsui 	volatile struct zschan *zc = arg;
    365  1.11  tsutsui 	int s, rr0;
    366   1.1   tsubai 
    367   1.1   tsubai 	s = splhigh();
    368   1.1   tsubai 	/* Wait for transmitter to become ready. */
    369   1.1   tsubai 	do {
    370   1.1   tsubai 		rr0 = zc->zc_csr;
    371   1.1   tsubai 		ZS_DELAY();
    372   1.1   tsubai 	} while ((rr0 & ZSRR0_TX_READY) == 0);
    373   1.1   tsubai 
    374   1.1   tsubai 	zc->zc_data = c;
    375   1.1   tsubai 	ZS_DELAY();
    376   1.1   tsubai 	splx(s);
    377   1.1   tsubai }
    378   1.1   tsubai 
    379   1.1   tsubai /*****************************************************************/
    380   1.1   tsubai 
    381  1.18  tsutsui static void zscnprobe(struct consdev *);
    382  1.18  tsutsui static void zscninit(struct consdev *);
    383  1.18  tsutsui static int  zscngetc(dev_t);
    384  1.18  tsutsui static void zscnputc(dev_t, int);
    385   1.1   tsubai 
    386   1.1   tsubai struct consdev consdev_zs = {
    387   1.1   tsubai 	zscnprobe,
    388   1.1   tsubai 	zscninit,
    389   1.1   tsubai 	zscngetc,
    390   1.1   tsubai 	zscnputc,
    391  1.11  tsutsui 	nullcnpollc,
    392  1.11  tsutsui 	NULL,
    393  1.11  tsutsui 	NULL,
    394   1.4  thorpej 	NULL,
    395  1.11  tsutsui 	NODEV,
    396  1.11  tsutsui 	CN_DEAD
    397   1.1   tsubai };
    398   1.1   tsubai 
    399  1.11  tsutsui static void
    400  1.18  tsutsui zscnprobe(struct consdev *cn)
    401   1.1   tsubai {
    402   1.1   tsubai }
    403   1.1   tsubai 
    404  1.11  tsutsui static void
    405  1.18  tsutsui zscninit(struct consdev *cn)
    406   1.1   tsubai {
    407   1.5  gehenna 	extern const struct cdevsw zstty_cdevsw;
    408   1.5  gehenna 
    409   1.5  gehenna 	cn->cn_dev = makedev(cdevsw_lookup_major(&zstty_cdevsw), 0);
    410   1.1   tsubai 	cn->cn_pri = CN_REMOTE;
    411   1.1   tsubai 	zs_hwflags[0][0] = ZS_HWFLAG_CONSOLE;
    412   1.1   tsubai }
    413   1.1   tsubai 
    414  1.11  tsutsui static int
    415  1.18  tsutsui zscngetc(dev_t dev)
    416   1.1   tsubai {
    417  1.11  tsutsui 
    418   1.1   tsubai 	return zs_getc((void *)SCCPORT0A);
    419   1.1   tsubai }
    420   1.1   tsubai 
    421  1.11  tsutsui static void
    422  1.18  tsutsui zscnputc(dev_t dev, int c)
    423   1.1   tsubai {
    424  1.11  tsutsui 
    425   1.1   tsubai 	zs_putc((void *)SCCPORT0A, c);
    426   1.1   tsubai }
    427