zs.c revision 1.52 1 1.52 mycroft /* $NetBSD: zs.c,v 1.52 1997/11/02 08:05:11 mycroft Exp $ */
2 1.18 deraadt
3 1.50 gwr /*-
4 1.50 gwr * Copyright (c) 1996 The NetBSD Foundation, Inc.
5 1.50 gwr * All rights reserved.
6 1.1 deraadt *
7 1.50 gwr * This code is derived from software contributed to The NetBSD Foundation
8 1.50 gwr * by Gordon W. Ross.
9 1.1 deraadt *
10 1.1 deraadt * Redistribution and use in source and binary forms, with or without
11 1.1 deraadt * modification, are permitted provided that the following conditions
12 1.1 deraadt * are met:
13 1.1 deraadt * 1. Redistributions of source code must retain the above copyright
14 1.1 deraadt * notice, this list of conditions and the following disclaimer.
15 1.1 deraadt * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 deraadt * notice, this list of conditions and the following disclaimer in the
17 1.1 deraadt * documentation and/or other materials provided with the distribution.
18 1.1 deraadt * 3. All advertising materials mentioning features or use of this software
19 1.1 deraadt * must display the following acknowledgement:
20 1.50 gwr * This product includes software developed by the NetBSD
21 1.50 gwr * Foundation, Inc. and its contributors.
22 1.50 gwr * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.50 gwr * contributors may be used to endorse or promote products derived
24 1.50 gwr * from this software without specific prior written permission.
25 1.50 gwr *
26 1.50 gwr * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.50 gwr * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.50 gwr * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.50 gwr * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.50 gwr * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.50 gwr * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.50 gwr * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.50 gwr * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.50 gwr * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.50 gwr * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.50 gwr * POSSIBILITY OF SUCH DAMAGE.
37 1.1 deraadt */
38 1.1 deraadt
39 1.1 deraadt /*
40 1.50 gwr * Zilog Z8530 Dual UART driver (machine-dependent part)
41 1.50 gwr *
42 1.50 gwr * Runs two serial lines per chip using slave drivers.
43 1.50 gwr * Plain tty/async lines use the zs_async slave.
44 1.50 gwr * Sun keyboard/mouse uses the zs_kbd/zs_ms slaves.
45 1.1 deraadt */
46 1.38 mrg
47 1.1 deraadt #include <sys/param.h>
48 1.34 christos #include <sys/systm.h>
49 1.50 gwr #include <sys/conf.h>
50 1.1 deraadt #include <sys/device.h>
51 1.1 deraadt #include <sys/file.h>
52 1.1 deraadt #include <sys/ioctl.h>
53 1.50 gwr #include <sys/kernel.h>
54 1.50 gwr #include <sys/proc.h>
55 1.1 deraadt #include <sys/tty.h>
56 1.1 deraadt #include <sys/time.h>
57 1.1 deraadt #include <sys/syslog.h>
58 1.1 deraadt
59 1.1 deraadt #include <machine/autoconf.h>
60 1.50 gwr #include <machine/bsd_openprom.h>
61 1.37 christos #include <machine/conf.h>
62 1.1 deraadt #include <machine/cpu.h>
63 1.50 gwr #include <machine/eeprom.h>
64 1.50 gwr #include <machine/psl.h>
65 1.50 gwr #include <machine/z8530var.h>
66 1.50 gwr
67 1.50 gwr #include <dev/cons.h>
68 1.50 gwr #include <dev/ic/z8530reg.h>
69 1.1 deraadt
70 1.1 deraadt #include <sparc/sparc/vaddrs.h>
71 1.1 deraadt #include <sparc/sparc/auxreg.h>
72 1.50 gwr #include <sparc/dev/cons.h>
73 1.50 gwr
74 1.50 gwr #include "kbd.h" /* NKBD */
75 1.50 gwr #include "zs.h" /* NZS */
76 1.1 deraadt
77 1.50 gwr /* Make life easier for the initialized arrays here. */
78 1.50 gwr #if NZS < 3
79 1.50 gwr #undef NZS
80 1.50 gwr #define NZS 3
81 1.1 deraadt #endif
82 1.1 deraadt
83 1.50 gwr /*
84 1.50 gwr * Some warts needed by z8530tty.c -
85 1.50 gwr * The default parity REALLY needs to be the same as the PROM uses,
86 1.50 gwr * or you can not see messages done with printf during boot-up...
87 1.50 gwr */
88 1.50 gwr int zs_def_cflag = (CREAD | CS8 | HUPCL);
89 1.50 gwr int zs_major = 12;
90 1.1 deraadt
91 1.50 gwr /*
92 1.50 gwr * The Sun provides a 4.9152 MHz clock to the ZS chips.
93 1.50 gwr */
94 1.50 gwr #define PCLK (9600 * 512) /* PCLK pin input clock rate */
95 1.1 deraadt
96 1.1 deraadt /*
97 1.1 deraadt * Select software interrupt bit based on TTY ipl.
98 1.1 deraadt */
99 1.1 deraadt #if PIL_TTY == 1
100 1.1 deraadt # define IE_ZSSOFT IE_L1
101 1.1 deraadt #elif PIL_TTY == 4
102 1.1 deraadt # define IE_ZSSOFT IE_L4
103 1.1 deraadt #elif PIL_TTY == 6
104 1.1 deraadt # define IE_ZSSOFT IE_L6
105 1.1 deraadt #else
106 1.1 deraadt # error "no suitable software interrupt bit"
107 1.1 deraadt #endif
108 1.1 deraadt
109 1.50 gwr #define ZS_DELAY() (CPU_ISSUN4C ? (0) : delay(2))
110 1.1 deraadt
111 1.50 gwr /* The layout of this is hardware-dependent (padding, order). */
112 1.50 gwr struct zschan {
113 1.50 gwr volatile u_char zc_csr; /* ctrl,status, and indirect access */
114 1.50 gwr u_char zc_xxx0;
115 1.50 gwr volatile u_char zc_data; /* data */
116 1.50 gwr u_char zc_xxx1;
117 1.35 thorpej };
118 1.50 gwr struct zsdevice {
119 1.50 gwr /* Yes, they are backwards. */
120 1.50 gwr struct zschan zs_chan_b;
121 1.50 gwr struct zschan zs_chan_a;
122 1.35 thorpej };
123 1.1 deraadt
124 1.50 gwr /* Saved PROM mappings */
125 1.50 gwr static struct zsdevice *zsaddr[NZS];
126 1.1 deraadt
127 1.50 gwr /* Flags from cninit() */
128 1.50 gwr static int zs_hwflags[NZS][2];
129 1.1 deraadt
130 1.50 gwr /* Default speed for each channel */
131 1.50 gwr static int zs_defspeed[NZS][2] = {
132 1.50 gwr { 9600, /* ttya */
133 1.50 gwr 9600 }, /* ttyb */
134 1.50 gwr { 1200, /* keyboard */
135 1.50 gwr 1200 }, /* mouse */
136 1.50 gwr { 9600, /* ttyc */
137 1.50 gwr 9600 }, /* ttyd */
138 1.50 gwr };
139 1.1 deraadt
140 1.50 gwr static u_char zs_init_reg[16] = {
141 1.50 gwr 0, /* 0: CMD (reset, etc.) */
142 1.50 gwr 0, /* 1: No interrupts yet. */
143 1.50 gwr 0, /* 2: IVECT */
144 1.50 gwr ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
145 1.50 gwr ZSWR4_CLK_X16 | ZSWR4_ONESB | ZSWR4_EVENP,
146 1.50 gwr ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
147 1.50 gwr 0, /* 6: TXSYNC/SYNCLO */
148 1.50 gwr 0, /* 7: RXSYNC/SYNCHI */
149 1.50 gwr 0, /* 8: alias for data port */
150 1.50 gwr ZSWR9_MASTER_IE | ZSWR9_NO_VECTOR,
151 1.50 gwr 0, /*10: Misc. TX/RX control bits */
152 1.50 gwr ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD,
153 1.50 gwr 14, /*12: BAUDLO (default=9600) */
154 1.50 gwr 0, /*13: BAUDHI (default=9600) */
155 1.50 gwr ZSWR14_BAUD_ENA | ZSWR14_BAUD_FROM_PCLK,
156 1.50 gwr ZSWR15_BREAK_IE | ZSWR15_DCD_IE,
157 1.50 gwr };
158 1.1 deraadt
159 1.50 gwr struct zschan *
160 1.50 gwr zs_get_chan_addr(zs_unit, channel)
161 1.50 gwr int zs_unit, channel;
162 1.50 gwr {
163 1.50 gwr struct zsdevice *addr;
164 1.50 gwr struct zschan *zc;
165 1.50 gwr
166 1.50 gwr if (zs_unit >= NZS)
167 1.50 gwr return NULL;
168 1.50 gwr addr = zsaddr[zs_unit];
169 1.50 gwr if (addr == NULL)
170 1.50 gwr addr = zsaddr[zs_unit] = findzs(zs_unit);
171 1.50 gwr if (addr == NULL)
172 1.50 gwr return NULL;
173 1.50 gwr if (channel == 0) {
174 1.50 gwr zc = &addr->zs_chan_a;
175 1.50 gwr } else {
176 1.50 gwr zc = &addr->zs_chan_b;
177 1.50 gwr }
178 1.50 gwr return (zc);
179 1.50 gwr }
180 1.34 christos
181 1.34 christos
182 1.50 gwr /****************************************************************
183 1.50 gwr * Autoconfig
184 1.50 gwr ****************************************************************/
185 1.1 deraadt
186 1.50 gwr /* Definition of the driver for autoconfig. */
187 1.50 gwr static int zs_match __P((struct device *, struct cfdata *, void *));
188 1.50 gwr static void zs_attach __P((struct device *, struct device *, void *));
189 1.50 gwr static int zs_print __P((void *, const char *name));
190 1.1 deraadt
191 1.50 gwr struct cfattach zs_ca = {
192 1.50 gwr sizeof(struct zsc_softc), zs_match, zs_attach
193 1.50 gwr };
194 1.1 deraadt
195 1.50 gwr struct cfdriver zs_cd = {
196 1.50 gwr NULL, "zs", DV_DULL
197 1.50 gwr };
198 1.34 christos
199 1.50 gwr /* Interrupt handlers. */
200 1.50 gwr static int zshard __P((void *));
201 1.50 gwr static int zssoft __P((void *));
202 1.50 gwr static struct intrhand levelhard = { zshard };
203 1.50 gwr static struct intrhand levelsoft = { zssoft };
204 1.12 deraadt
205 1.50 gwr static int zs_get_speed __P((struct zs_chanstate *));
206 1.12 deraadt
207 1.12 deraadt
208 1.1 deraadt /*
209 1.50 gwr * Is the zs chip present?
210 1.1 deraadt */
211 1.1 deraadt static int
212 1.50 gwr zs_match(parent, cf, aux)
213 1.16 deraadt struct device *parent;
214 1.45 pk struct cfdata *cf;
215 1.45 pk void *aux;
216 1.1 deraadt {
217 1.13 deraadt struct confargs *ca = aux;
218 1.13 deraadt struct romaux *ra = &ca->ca_ra;
219 1.1 deraadt
220 1.14 deraadt if (strcmp(cf->cf_driver->cd_name, ra->ra_name))
221 1.14 deraadt return (0);
222 1.33 pk if ((ca->ca_bustype == BUS_MAIN && !CPU_ISSUN4) ||
223 1.33 pk (ca->ca_bustype == BUS_OBIO && CPU_ISSUN4M))
224 1.14 deraadt return (getpropint(ra->ra_node, "slave", -2) == cf->cf_unit);
225 1.15 deraadt ra->ra_len = NBPG;
226 1.15 deraadt return (probeget(ra->ra_vaddr, 1) != -1);
227 1.1 deraadt }
228 1.1 deraadt
229 1.1 deraadt /*
230 1.1 deraadt * Attach a found zs.
231 1.1 deraadt *
232 1.1 deraadt * USE ROM PROPERTIES port-a-ignore-cd AND port-b-ignore-cd FOR
233 1.1 deraadt * SOFT CARRIER, AND keyboard PROPERTY FOR KEYBOARD/MOUSE?
234 1.1 deraadt */
235 1.1 deraadt static void
236 1.50 gwr zs_attach(parent, self, aux)
237 1.16 deraadt struct device *parent;
238 1.50 gwr struct device *self;
239 1.16 deraadt void *aux;
240 1.1 deraadt {
241 1.50 gwr struct zsc_softc *zsc = (void *) self;
242 1.50 gwr struct confargs *ca = aux;
243 1.50 gwr struct romaux *ra = &ca->ca_ra;
244 1.50 gwr struct zsc_attach_args zsc_args;
245 1.50 gwr volatile struct zschan *zc;
246 1.50 gwr struct zs_chanstate *cs;
247 1.50 gwr int pri, s, zs_unit, channel;
248 1.1 deraadt static int didintr, prevpri;
249 1.1 deraadt
250 1.50 gwr zs_unit = zsc->zsc_dev.dv_unit;
251 1.50 gwr
252 1.50 gwr /* Use the mapping setup by the Sun PROM. */
253 1.50 gwr if (zsaddr[zs_unit] == NULL)
254 1.50 gwr zsaddr[zs_unit] = findzs(zs_unit);
255 1.50 gwr
256 1.14 deraadt if (ca->ca_bustype==BUS_MAIN)
257 1.50 gwr if ((void*)zsaddr[zs_unit] != ra->ra_vaddr)
258 1.14 deraadt panic("zsattach");
259 1.1 deraadt if (ra->ra_nintr != 1) {
260 1.44 christos printf(": expected 1 interrupt, got %d\n", ra->ra_nintr);
261 1.1 deraadt return;
262 1.1 deraadt }
263 1.1 deraadt pri = ra->ra_intr[0].int_pri;
264 1.44 christos printf(" pri %d, softpri %d\n", pri, PIL_TTY);
265 1.50 gwr
266 1.50 gwr /*
267 1.50 gwr * Initialize software state for each channel.
268 1.50 gwr */
269 1.50 gwr for (channel = 0; channel < 2; channel++) {
270 1.50 gwr zsc_args.channel = channel;
271 1.50 gwr zsc_args.hwflags = zs_hwflags[zs_unit][channel];
272 1.50 gwr cs = &zsc->zsc_cs_store[channel];
273 1.50 gwr zsc->zsc_cs[channel] = cs;
274 1.50 gwr
275 1.50 gwr cs->cs_channel = channel;
276 1.50 gwr cs->cs_private = NULL;
277 1.50 gwr cs->cs_ops = &zsops_null;
278 1.50 gwr cs->cs_brg_clk = PCLK / 16;
279 1.50 gwr
280 1.50 gwr zc = zs_get_chan_addr(zs_unit, channel);
281 1.50 gwr cs->cs_reg_csr = &zc->zc_csr;
282 1.50 gwr cs->cs_reg_data = &zc->zc_data;
283 1.50 gwr
284 1.50 gwr bcopy(zs_init_reg, cs->cs_creg, 16);
285 1.50 gwr bcopy(zs_init_reg, cs->cs_preg, 16);
286 1.50 gwr
287 1.50 gwr /* XXX: Get these from the PROM properties! */
288 1.50 gwr /* XXX: See the mvme167 code. Better. */
289 1.50 gwr if (zsc_args.hwflags & ZS_HWFLAG_CONSOLE)
290 1.50 gwr cs->cs_defspeed = zs_get_speed(cs);
291 1.50 gwr else
292 1.50 gwr cs->cs_defspeed = zs_defspeed[zs_unit][channel];
293 1.50 gwr cs->cs_defcflag = zs_def_cflag;
294 1.50 gwr
295 1.50 gwr /* Make these correspond to cs_defcflag (-crtscts) */
296 1.50 gwr cs->cs_rr0_dcd = ZSRR0_DCD;
297 1.50 gwr cs->cs_rr0_cts = 0;
298 1.50 gwr cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS;
299 1.50 gwr cs->cs_wr5_rts = 0;
300 1.50 gwr
301 1.50 gwr /*
302 1.50 gwr * Clear the master interrupt enable.
303 1.50 gwr * The INTENA is common to both channels,
304 1.50 gwr * so just do it on the A channel.
305 1.50 gwr */
306 1.50 gwr if (channel == 0) {
307 1.50 gwr zs_write_reg(cs, 9, 0);
308 1.50 gwr }
309 1.50 gwr
310 1.50 gwr /*
311 1.50 gwr * Look for a child driver for this channel.
312 1.50 gwr * The child attach will setup the hardware.
313 1.50 gwr */
314 1.50 gwr if (!config_found(self, (void *)&zsc_args, zs_print)) {
315 1.50 gwr /* No sub-driver. Just reset it. */
316 1.50 gwr u_char reset = (channel == 0) ?
317 1.50 gwr ZSWR9_A_RESET : ZSWR9_B_RESET;
318 1.50 gwr s = splhigh();
319 1.50 gwr zs_write_reg(cs, 9, reset);
320 1.50 gwr splx(s);
321 1.50 gwr }
322 1.50 gwr }
323 1.50 gwr
324 1.50 gwr /*
325 1.50 gwr * Now safe to install interrupt handlers. Note the arguments
326 1.50 gwr * to the interrupt handlers aren't used. Note, we only do this
327 1.50 gwr * once since both SCCs interrupt at the same level and vector.
328 1.50 gwr */
329 1.1 deraadt if (!didintr) {
330 1.1 deraadt didintr = 1;
331 1.1 deraadt prevpri = pri;
332 1.1 deraadt intr_establish(pri, &levelhard);
333 1.1 deraadt intr_establish(PIL_TTY, &levelsoft);
334 1.1 deraadt } else if (pri != prevpri)
335 1.1 deraadt panic("broken zs interrupt scheme");
336 1.50 gwr evcnt_attach(&zsc->zsc_dev, "intr", &zsc->zsc_intrcnt);
337 1.1 deraadt
338 1.1 deraadt /*
339 1.50 gwr * Set the master interrupt enable and interrupt vector.
340 1.50 gwr * (common to both channels, do it on A)
341 1.1 deraadt */
342 1.50 gwr cs = zsc->zsc_cs[0];
343 1.1 deraadt s = splhigh();
344 1.50 gwr /* interrupt vector */
345 1.50 gwr zs_write_reg(cs, 2, zs_init_reg[2]);
346 1.50 gwr /* master interrupt control (enable) */
347 1.50 gwr zs_write_reg(cs, 9, zs_init_reg[9]);
348 1.50 gwr splx(s);
349 1.50 gwr
350 1.50 gwr #if 0
351 1.47 pk /*
352 1.50 gwr * XXX: L1A hack - We would like to be able to break into
353 1.50 gwr * the debugger during the rest of autoconfiguration, so
354 1.50 gwr * lower interrupts just enough to let zs interrupts in.
355 1.50 gwr * This is done after both zs devices are attached.
356 1.50 gwr */
357 1.50 gwr if (zs_unit == 1) {
358 1.50 gwr printf("zs1: enabling zs interrupts\n");
359 1.50 gwr (void)splfd(); /* XXX: splzs - 1 */
360 1.47 pk }
361 1.50 gwr #endif
362 1.1 deraadt }
363 1.1 deraadt
364 1.50 gwr static int
365 1.50 gwr zs_print(aux, name)
366 1.50 gwr void *aux;
367 1.50 gwr const char *name;
368 1.1 deraadt {
369 1.50 gwr struct zsc_attach_args *args = aux;
370 1.1 deraadt
371 1.50 gwr if (name != NULL)
372 1.50 gwr printf("%s: ", name);
373 1.1 deraadt
374 1.50 gwr if (args->channel != -1)
375 1.50 gwr printf(" channel %d", args->channel);
376 1.1 deraadt
377 1.50 gwr return UNCONF;
378 1.1 deraadt }
379 1.1 deraadt
380 1.50 gwr static volatile int zssoftpending;
381 1.1 deraadt
382 1.1 deraadt /*
383 1.50 gwr * Our ZS chips all share a common, autovectored interrupt,
384 1.50 gwr * so we have to look at all of them on each interrupt.
385 1.1 deraadt */
386 1.1 deraadt static int
387 1.50 gwr zshard(arg)
388 1.50 gwr void *arg;
389 1.1 deraadt {
390 1.50 gwr register struct zsc_softc *zsc;
391 1.50 gwr register int unit, rr3, rval, softreq;
392 1.1 deraadt
393 1.50 gwr rval = softreq = 0;
394 1.50 gwr for (unit = 0; unit < zs_cd.cd_ndevs; unit++) {
395 1.50 gwr zsc = zs_cd.cd_devs[unit];
396 1.50 gwr if (zsc == NULL)
397 1.50 gwr continue;
398 1.50 gwr rr3 = zsc_intr_hard(zsc);
399 1.50 gwr /* Count up the interrupts. */
400 1.50 gwr if (rr3) {
401 1.50 gwr rval |= rr3;
402 1.50 gwr zsc->zsc_intrcnt.ev_count++;
403 1.50 gwr }
404 1.50 gwr softreq |= zsc->zsc_cs[0]->cs_softreq;
405 1.50 gwr softreq |= zsc->zsc_cs[1]->cs_softreq;
406 1.50 gwr }
407 1.1 deraadt
408 1.50 gwr /* We are at splzs here, so no need to lock. */
409 1.50 gwr if (softreq && (zssoftpending == 0)) {
410 1.50 gwr zssoftpending = IE_ZSSOFT;
411 1.50 gwr #if defined(SUN4M)
412 1.50 gwr if (CPU_ISSUN4M)
413 1.50 gwr raise(0, PIL_TTY);
414 1.50 gwr else
415 1.50 gwr #endif
416 1.50 gwr ienab_bis(IE_ZSSOFT);
417 1.50 gwr }
418 1.50 gwr return (rval);
419 1.1 deraadt }
420 1.1 deraadt
421 1.1 deraadt /*
422 1.50 gwr * Similar scheme as for zshard (look at all of them)
423 1.1 deraadt */
424 1.50 gwr static int
425 1.50 gwr zssoft(arg)
426 1.50 gwr void *arg;
427 1.1 deraadt {
428 1.50 gwr register struct zsc_softc *zsc;
429 1.50 gwr register int s, unit;
430 1.1 deraadt
431 1.50 gwr /* This is not the only ISR on this IPL. */
432 1.50 gwr if (zssoftpending == 0)
433 1.50 gwr return (0);
434 1.1 deraadt
435 1.50 gwr /*
436 1.50 gwr * The soft intr. bit will be set by zshard only if
437 1.50 gwr * the variable zssoftpending is zero. The order of
438 1.50 gwr * these next two statements prevents our clearing
439 1.50 gwr * the soft intr bit just after zshard has set it.
440 1.50 gwr */
441 1.50 gwr /* ienab_bic(IE_ZSSOFT); */
442 1.50 gwr zssoftpending = 0;
443 1.1 deraadt
444 1.50 gwr /* Make sure we call the tty layer at spltty. */
445 1.1 deraadt s = spltty();
446 1.50 gwr for (unit = 0; unit < zs_cd.cd_ndevs; unit++) {
447 1.50 gwr zsc = zs_cd.cd_devs[unit];
448 1.50 gwr if (zsc == NULL)
449 1.50 gwr continue;
450 1.50 gwr (void) zsc_intr_soft(zsc);
451 1.1 deraadt }
452 1.1 deraadt splx(s);
453 1.50 gwr return (1);
454 1.1 deraadt }
455 1.1 deraadt
456 1.50 gwr
457 1.1 deraadt /*
458 1.50 gwr * Compute the current baud rate given a ZS channel.
459 1.1 deraadt */
460 1.50 gwr static int
461 1.50 gwr zs_get_speed(cs)
462 1.50 gwr struct zs_chanstate *cs;
463 1.50 gwr {
464 1.50 gwr int tconst;
465 1.50 gwr
466 1.50 gwr tconst = zs_read_reg(cs, 12);
467 1.50 gwr tconst |= zs_read_reg(cs, 13) << 8;
468 1.50 gwr return (TCONST_TO_BPS(cs->cs_brg_clk, tconst));
469 1.1 deraadt }
470 1.1 deraadt
471 1.1 deraadt /*
472 1.50 gwr * MD functions for setting the baud rate and control modes.
473 1.1 deraadt */
474 1.1 deraadt int
475 1.50 gwr zs_set_speed(cs, bps)
476 1.50 gwr struct zs_chanstate *cs;
477 1.50 gwr int bps; /* bits per second */
478 1.1 deraadt {
479 1.50 gwr int tconst, real_bps;
480 1.50 gwr
481 1.50 gwr if (bps == 0)
482 1.50 gwr return (0);
483 1.1 deraadt
484 1.50 gwr #ifdef DIAGNOSTIC
485 1.50 gwr if (cs->cs_brg_clk == 0)
486 1.50 gwr panic("zs_set_speed");
487 1.50 gwr #endif
488 1.50 gwr
489 1.50 gwr tconst = BPS_TO_TCONST(cs->cs_brg_clk, bps);
490 1.50 gwr if (tconst < 0)
491 1.50 gwr return (EINVAL);
492 1.28 pk
493 1.50 gwr /* Convert back to make sure we can do it. */
494 1.50 gwr real_bps = TCONST_TO_BPS(cs->cs_brg_clk, tconst);
495 1.1 deraadt
496 1.50 gwr /* XXX - Allow some tolerance here? */
497 1.50 gwr if (real_bps != bps)
498 1.50 gwr return (EINVAL);
499 1.28 pk
500 1.50 gwr cs->cs_preg[12] = tconst;
501 1.50 gwr cs->cs_preg[13] = tconst >> 8;
502 1.1 deraadt
503 1.50 gwr /* Caller will stuff the pending registers. */
504 1.50 gwr return (0);
505 1.28 pk }
506 1.28 pk
507 1.50 gwr int
508 1.50 gwr zs_set_modes(cs, cflag)
509 1.50 gwr struct zs_chanstate *cs;
510 1.50 gwr int cflag; /* bits per second */
511 1.28 pk {
512 1.50 gwr int s;
513 1.28 pk
514 1.50 gwr /*
515 1.50 gwr * Output hardware flow control on the chip is horrendous:
516 1.50 gwr * if carrier detect drops, the receiver is disabled, and if
517 1.50 gwr * CTS drops, the transmitter is stoped IN MID CHARACTER!
518 1.50 gwr * Therefore, NEVER set the HFC bit, and instead use the
519 1.50 gwr * status interrupt to detect CTS changes.
520 1.50 gwr */
521 1.50 gwr s = splzs();
522 1.52 mycroft if ((cflag & (CLOCAL | MDMBUF)) != 0)
523 1.50 gwr cs->cs_rr0_dcd = 0;
524 1.52 mycroft else
525 1.50 gwr cs->cs_rr0_dcd = ZSRR0_DCD;
526 1.52 mycroft if ((cflag & CRTSCTS) != 0) {
527 1.50 gwr cs->cs_wr5_dtr = ZSWR5_DTR;
528 1.50 gwr cs->cs_wr5_rts = ZSWR5_RTS;
529 1.50 gwr cs->cs_rr0_cts = ZSRR0_CTS;
530 1.52 mycroft } else if ((cflag & MDMBUF) != 0) {
531 1.52 mycroft cs->cs_wr5_dtr = 0;
532 1.52 mycroft cs->cs_wr5_rts = ZSWR5_DTR;
533 1.52 mycroft cs->cs_rr0_cts = ZSRR0_DCD;
534 1.50 gwr } else {
535 1.50 gwr cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS;
536 1.50 gwr cs->cs_wr5_rts = 0;
537 1.50 gwr cs->cs_rr0_cts = 0;
538 1.50 gwr }
539 1.50 gwr splx(s);
540 1.28 pk
541 1.50 gwr /* Caller will stuff the pending registers. */
542 1.50 gwr return (0);
543 1.38 mrg }
544 1.28 pk
545 1.1 deraadt
546 1.1 deraadt /*
547 1.50 gwr * Read or write the chip with suitable delays.
548 1.1 deraadt */
549 1.50 gwr
550 1.50 gwr u_char
551 1.50 gwr zs_read_reg(cs, reg)
552 1.50 gwr struct zs_chanstate *cs;
553 1.50 gwr u_char reg;
554 1.1 deraadt {
555 1.50 gwr u_char val;
556 1.14 deraadt
557 1.50 gwr *cs->cs_reg_csr = reg;
558 1.50 gwr ZS_DELAY();
559 1.50 gwr val = *cs->cs_reg_csr;
560 1.50 gwr ZS_DELAY();
561 1.50 gwr return val;
562 1.1 deraadt }
563 1.1 deraadt
564 1.50 gwr void
565 1.50 gwr zs_write_reg(cs, reg, val)
566 1.50 gwr struct zs_chanstate *cs;
567 1.50 gwr u_char reg, val;
568 1.1 deraadt {
569 1.50 gwr *cs->cs_reg_csr = reg;
570 1.14 deraadt ZS_DELAY();
571 1.50 gwr *cs->cs_reg_csr = val;
572 1.14 deraadt ZS_DELAY();
573 1.50 gwr }
574 1.1 deraadt
575 1.50 gwr u_char zs_read_csr(cs)
576 1.50 gwr struct zs_chanstate *cs;
577 1.50 gwr {
578 1.50 gwr register u_char val;
579 1.1 deraadt
580 1.50 gwr val = *cs->cs_reg_csr;
581 1.14 deraadt ZS_DELAY();
582 1.50 gwr return val;
583 1.1 deraadt }
584 1.1 deraadt
585 1.50 gwr void zs_write_csr(cs, val)
586 1.50 gwr struct zs_chanstate *cs;
587 1.50 gwr u_char val;
588 1.50 gwr {
589 1.50 gwr *cs->cs_reg_csr = val;
590 1.14 deraadt ZS_DELAY();
591 1.1 deraadt }
592 1.1 deraadt
593 1.50 gwr u_char zs_read_data(cs)
594 1.50 gwr struct zs_chanstate *cs;
595 1.1 deraadt {
596 1.50 gwr register u_char val;
597 1.1 deraadt
598 1.50 gwr val = *cs->cs_reg_data;
599 1.29 pk ZS_DELAY();
600 1.50 gwr return val;
601 1.50 gwr }
602 1.50 gwr
603 1.50 gwr void zs_write_data(cs, val)
604 1.50 gwr struct zs_chanstate *cs;
605 1.50 gwr u_char val;
606 1.50 gwr {
607 1.50 gwr *cs->cs_reg_data = val;
608 1.14 deraadt ZS_DELAY();
609 1.1 deraadt }
610 1.1 deraadt
611 1.50 gwr /****************************************************************
612 1.50 gwr * Console support functions (Sun specific!)
613 1.50 gwr * Note: this code is allowed to know about the layout of
614 1.50 gwr * the chip registers, and uses that to keep things simple.
615 1.50 gwr * XXX - I think I like the mvme167 code better. -gwr
616 1.50 gwr ****************************************************************/
617 1.50 gwr
618 1.50 gwr extern void Debugger __P((void));
619 1.50 gwr void *zs_conschan;
620 1.50 gwr
621 1.50 gwr /*
622 1.50 gwr * Handle user request to enter kernel debugger.
623 1.50 gwr */
624 1.34 christos void
625 1.50 gwr zs_abort(cs)
626 1.50 gwr struct zs_chanstate *cs;
627 1.1 deraadt {
628 1.50 gwr register volatile struct zschan *zc = zs_conschan;
629 1.50 gwr int rr0;
630 1.50 gwr
631 1.50 gwr /* Wait for end of break to avoid PROM abort. */
632 1.50 gwr /* XXX - Limit the wait? */
633 1.50 gwr do {
634 1.50 gwr rr0 = zc->zc_csr;
635 1.50 gwr ZS_DELAY();
636 1.50 gwr } while (rr0 & ZSRR0_BREAK);
637 1.1 deraadt
638 1.49 pk #if defined(KGDB)
639 1.50 gwr zskgdb(cs);
640 1.49 pk #elif defined(DDB)
641 1.5 pk Debugger();
642 1.5 pk #else
643 1.44 christos printf("stopping on keyboard abort\n");
644 1.1 deraadt callrom();
645 1.5 pk #endif
646 1.1 deraadt }
647 1.1 deraadt
648 1.1 deraadt /*
649 1.50 gwr * Polled input char.
650 1.1 deraadt */
651 1.50 gwr int
652 1.50 gwr zs_getc(arg)
653 1.50 gwr void *arg;
654 1.1 deraadt {
655 1.50 gwr register volatile struct zschan *zc = arg;
656 1.50 gwr register int s, c, rr0;
657 1.1 deraadt
658 1.50 gwr s = splhigh();
659 1.50 gwr /* Wait for a character to arrive. */
660 1.50 gwr do {
661 1.50 gwr rr0 = zc->zc_csr;
662 1.50 gwr ZS_DELAY();
663 1.50 gwr } while ((rr0 & ZSRR0_RX_READY) == 0);
664 1.1 deraadt
665 1.50 gwr c = zc->zc_data;
666 1.50 gwr ZS_DELAY();
667 1.50 gwr splx(s);
668 1.1 deraadt
669 1.50 gwr /*
670 1.50 gwr * This is used by the kd driver to read scan codes,
671 1.50 gwr * so don't translate '\r' ==> '\n' here...
672 1.50 gwr */
673 1.50 gwr return (c);
674 1.1 deraadt }
675 1.1 deraadt
676 1.1 deraadt /*
677 1.50 gwr * Polled output char.
678 1.1 deraadt */
679 1.50 gwr void
680 1.50 gwr zs_putc(arg, c)
681 1.16 deraadt void *arg;
682 1.50 gwr int c;
683 1.1 deraadt {
684 1.50 gwr register volatile struct zschan *zc = arg;
685 1.50 gwr register int s, rr0;
686 1.1 deraadt
687 1.50 gwr s = splhigh();
688 1.50 gwr /* Wait for transmitter to become ready. */
689 1.50 gwr do {
690 1.50 gwr rr0 = zc->zc_csr;
691 1.50 gwr ZS_DELAY();
692 1.50 gwr } while ((rr0 & ZSRR0_TX_READY) == 0);
693 1.21 deraadt
694 1.50 gwr zc->zc_data = c;
695 1.50 gwr ZS_DELAY();
696 1.50 gwr splx(s);
697 1.50 gwr }
698 1.21 deraadt
699 1.50 gwr /*****************************************************************/
700 1.21 deraadt
701 1.50 gwr static void zscninit __P((struct consdev *));
702 1.50 gwr static int zscngetc __P((dev_t));
703 1.50 gwr static void zscnputc __P((dev_t, int));
704 1.1 deraadt
705 1.1 deraadt /*
706 1.50 gwr * Console table shared by ttya, ttyb
707 1.1 deraadt */
708 1.50 gwr struct consdev consdev_tty = {
709 1.50 gwr nullcnprobe,
710 1.50 gwr zscninit,
711 1.50 gwr zscngetc,
712 1.50 gwr zscnputc,
713 1.50 gwr nullcnpollc,
714 1.50 gwr };
715 1.50 gwr
716 1.1 deraadt static void
717 1.50 gwr zscninit(cn)
718 1.50 gwr struct consdev *cn;
719 1.1 deraadt {
720 1.1 deraadt }
721 1.1 deraadt
722 1.1 deraadt /*
723 1.50 gwr * Polled console input putchar.
724 1.1 deraadt */
725 1.50 gwr static int
726 1.50 gwr zscngetc(dev)
727 1.50 gwr dev_t dev;
728 1.50 gwr {
729 1.50 gwr return (zs_getc(zs_conschan));
730 1.1 deraadt }
731 1.1 deraadt
732 1.1 deraadt /*
733 1.50 gwr * Polled console output putchar.
734 1.1 deraadt */
735 1.50 gwr static void
736 1.50 gwr zscnputc(dev, c)
737 1.50 gwr dev_t dev;
738 1.50 gwr int c;
739 1.50 gwr {
740 1.50 gwr zs_putc(zs_conschan, c);
741 1.50 gwr }
742 1.1 deraadt
743 1.50 gwr /*****************************************************************/
744 1.1 deraadt
745 1.50 gwr static void prom_cninit __P((struct consdev *));
746 1.50 gwr static int prom_cngetc __P((dev_t));
747 1.50 gwr static void prom_cnputc __P((dev_t, int));
748 1.1 deraadt
749 1.50 gwr /*
750 1.50 gwr * The console is set to this one initially,
751 1.50 gwr * which lets us use the PROM until consinit()
752 1.50 gwr * is called to select a real console.
753 1.50 gwr */
754 1.50 gwr struct consdev consdev_prom = {
755 1.50 gwr nullcnprobe,
756 1.50 gwr prom_cninit,
757 1.50 gwr prom_cngetc,
758 1.50 gwr prom_cnputc,
759 1.50 gwr nullcnpollc,
760 1.50 gwr };
761 1.1 deraadt
762 1.1 deraadt /*
763 1.50 gwr * The console table pointer is statically initialized
764 1.50 gwr * to point to the PROM (output only) table, so that
765 1.50 gwr * early calls to printf will work.
766 1.1 deraadt */
767 1.50 gwr struct consdev *cn_tab = &consdev_prom;
768 1.50 gwr
769 1.50 gwr void
770 1.50 gwr nullcnprobe(cn)
771 1.50 gwr struct consdev *cn;
772 1.1 deraadt {
773 1.1 deraadt }
774 1.1 deraadt
775 1.1 deraadt static void
776 1.50 gwr prom_cninit(cn)
777 1.50 gwr struct consdev *cn;
778 1.1 deraadt {
779 1.1 deraadt }
780 1.1 deraadt
781 1.1 deraadt /*
782 1.50 gwr * PROM console input putchar.
783 1.50 gwr * (dummy - this is output only)
784 1.1 deraadt */
785 1.1 deraadt static int
786 1.50 gwr prom_cngetc(dev)
787 1.50 gwr dev_t dev;
788 1.1 deraadt {
789 1.50 gwr return (0);
790 1.1 deraadt }
791 1.1 deraadt
792 1.1 deraadt /*
793 1.50 gwr * PROM console output putchar.
794 1.1 deraadt */
795 1.1 deraadt static void
796 1.50 gwr prom_cnputc(dev, c)
797 1.50 gwr dev_t dev;
798 1.16 deraadt int c;
799 1.1 deraadt {
800 1.50 gwr char c0 = (c & 0x7f);
801 1.1 deraadt
802 1.50 gwr if (promvec->pv_romvec_vers > 2)
803 1.50 gwr (*promvec->pv_v2devops.v2_write)
804 1.50 gwr (*promvec->pv_v2bootargs.v2_fd1, &c0, 1);
805 1.50 gwr else
806 1.50 gwr (*promvec->pv_putchar)(c);
807 1.1 deraadt }
808 1.1 deraadt
809 1.50 gwr /*****************************************************************/
810 1.50 gwr
811 1.50 gwr extern struct consdev consdev_kd;
812 1.50 gwr
813 1.50 gwr static char *prom_inSrc_name[] = {
814 1.50 gwr "keyboard/display",
815 1.50 gwr "ttya", "ttyb",
816 1.50 gwr "ttyc", "ttyd" };
817 1.50 gwr
818 1.1 deraadt /*
819 1.50 gwr * This function replaces sys/dev/cninit.c
820 1.50 gwr * Determine which device is the console using
821 1.50 gwr * the PROM "input source" and "output sink".
822 1.1 deraadt */
823 1.1 deraadt void
824 1.50 gwr consinit()
825 1.1 deraadt {
826 1.50 gwr struct zschan *zc;
827 1.50 gwr struct consdev *cn;
828 1.50 gwr int channel, zs_unit, zstty_unit;
829 1.50 gwr int inSource, outSink;
830 1.50 gwr
831 1.50 gwr if (promvec->pv_romvec_vers > 2) {
832 1.50 gwr /* We need to probe the PROM device tree */
833 1.50 gwr register int node,fd;
834 1.50 gwr char buffer[128];
835 1.50 gwr register struct nodeops *no;
836 1.50 gwr register struct v2devops *op;
837 1.50 gwr register char *cp;
838 1.50 gwr extern int fbnode;
839 1.50 gwr
840 1.50 gwr inSource = outSink = -1;
841 1.50 gwr no = promvec->pv_nodeops;
842 1.50 gwr op = &promvec->pv_v2devops;
843 1.50 gwr
844 1.50 gwr node = findroot();
845 1.50 gwr if (no->no_proplen(node, "stdin-path") >= sizeof(buffer)) {
846 1.50 gwr printf("consinit: increase buffer size and recompile\n");
847 1.50 gwr goto setup_output;
848 1.50 gwr }
849 1.50 gwr /* XXX: fix above */
850 1.50 gwr
851 1.50 gwr no->no_getprop(node, "stdin-path",buffer);
852 1.50 gwr
853 1.50 gwr /*
854 1.50 gwr * Open an "instance" of this device.
855 1.50 gwr * You'd think it would be appropriate to call v2_close()
856 1.50 gwr * on the handle when we're done with it. But that seems
857 1.50 gwr * to cause the device to shut down somehow; for the moment,
858 1.50 gwr * we simply leave it open...
859 1.50 gwr */
860 1.50 gwr if ((fd = op->v2_open(buffer)) == 0 ||
861 1.50 gwr (node = op->v2_fd_phandle(fd)) == 0) {
862 1.50 gwr printf("consinit: bogus stdin path %s.\n",buffer);
863 1.50 gwr goto setup_output;
864 1.50 gwr }
865 1.50 gwr if (no->no_proplen(node,"keyboard") >= 0) {
866 1.50 gwr inSource = PROMDEV_KBD;
867 1.50 gwr goto setup_output;
868 1.50 gwr }
869 1.50 gwr if (strcmp(getpropstring(node,"device_type"),"serial") != 0) {
870 1.50 gwr /* not a serial, not keyboard. what is it?!? */
871 1.50 gwr inSource = -1;
872 1.50 gwr goto setup_output;
873 1.50 gwr }
874 1.50 gwr /*
875 1.50 gwr * At this point we assume the device path is in the form
876 1.50 gwr * ....device@x,y:a for ttya and ...device@x,y:b for ttyb.
877 1.50 gwr * If it isn't, we defer to the ROM
878 1.50 gwr */
879 1.50 gwr cp = buffer;
880 1.50 gwr while (*cp)
881 1.50 gwr cp++;
882 1.50 gwr cp -= 2;
883 1.50 gwr #ifdef DEBUG
884 1.50 gwr if (cp < buffer)
885 1.50 gwr panic("consinit: bad stdin path %s",buffer);
886 1.50 gwr #endif
887 1.50 gwr /* XXX: only allows tty's a->z, assumes PROMDEV_TTYx contig */
888 1.50 gwr if (cp[0]==':' && cp[1] >= 'a' && cp[1] <= 'z')
889 1.50 gwr inSource = PROMDEV_TTYA + (cp[1] - 'a');
890 1.50 gwr /* else use rom */
891 1.50 gwr setup_output:
892 1.50 gwr node = findroot();
893 1.50 gwr if (no->no_proplen(node, "stdout-path") >= sizeof(buffer)) {
894 1.50 gwr printf("consinit: increase buffer size and recompile\n");
895 1.50 gwr goto setup_console;
896 1.50 gwr }
897 1.50 gwr /* XXX: fix above */
898 1.50 gwr
899 1.50 gwr no->no_getprop(node, "stdout-path", buffer);
900 1.50 gwr
901 1.50 gwr if ((fd = op->v2_open(buffer)) == 0 ||
902 1.50 gwr (node = op->v2_fd_phandle(fd)) == 0) {
903 1.50 gwr printf("consinit: bogus stdout path %s.\n",buffer);
904 1.50 gwr goto setup_output;
905 1.50 gwr }
906 1.50 gwr if (strcmp(getpropstring(node,"device_type"),"display") == 0) {
907 1.50 gwr /* frame buffer output */
908 1.50 gwr outSink = PROMDEV_SCREEN;
909 1.50 gwr fbnode = node;
910 1.50 gwr } else if (strcmp(getpropstring(node,"device_type"), "serial")
911 1.50 gwr != 0) {
912 1.50 gwr /* not screen, not serial. Whatzit? */
913 1.50 gwr outSink = -1;
914 1.50 gwr } else { /* serial console. which? */
915 1.50 gwr /*
916 1.50 gwr * At this point we assume the device path is in the
917 1.50 gwr * form:
918 1.50 gwr * ....device@x,y:a for ttya, etc.
919 1.50 gwr * If it isn't, we defer to the ROM
920 1.50 gwr */
921 1.50 gwr cp = buffer;
922 1.50 gwr while (*cp)
923 1.50 gwr cp++;
924 1.50 gwr cp -= 2;
925 1.50 gwr #ifdef DEBUG
926 1.50 gwr if (cp < buffer)
927 1.50 gwr panic("consinit: bad stdout path %s",buffer);
928 1.50 gwr #endif
929 1.50 gwr /* XXX: only allows tty's a->z, assumes PROMDEV_TTYx contig */
930 1.50 gwr if (cp[0]==':' && cp[1] >= 'a' && cp[1] <= 'z')
931 1.50 gwr outSink = PROMDEV_TTYA + (cp[1] - 'a');
932 1.50 gwr else outSink = -1;
933 1.50 gwr }
934 1.50 gwr } else {
935 1.50 gwr inSource = *promvec->pv_stdin;
936 1.50 gwr outSink = *promvec->pv_stdout;
937 1.50 gwr }
938 1.50 gwr
939 1.50 gwr setup_console:
940 1.50 gwr
941 1.50 gwr if (inSource != outSink) {
942 1.50 gwr printf("cninit: mismatched PROM output selector\n");
943 1.50 gwr }
944 1.50 gwr
945 1.50 gwr switch (inSource) {
946 1.50 gwr default:
947 1.50 gwr printf("cninit: invalid inSource=%d\n", inSource);
948 1.50 gwr callrom();
949 1.50 gwr inSource = PROMDEV_KBD;
950 1.50 gwr /* fall through */
951 1.50 gwr
952 1.50 gwr case 0: /* keyboard/display */
953 1.50 gwr #if NKBD > 0
954 1.51 gwr zs_unit = 1; /* XXX - config info! */
955 1.50 gwr channel = 0;
956 1.50 gwr cn = &consdev_kd;
957 1.50 gwr /* Set cn_dev, cn_pri in kd.c */
958 1.50 gwr break;
959 1.50 gwr #else /* NKBD */
960 1.50 gwr printf("cninit: kdb/display not configured\n");
961 1.50 gwr callrom();
962 1.50 gwr inSource = PROMDEV_TTYA;
963 1.50 gwr /* fall through */
964 1.50 gwr #endif /* NKBD */
965 1.50 gwr
966 1.50 gwr case PROMDEV_TTYA:
967 1.50 gwr case PROMDEV_TTYB:
968 1.50 gwr zstty_unit = inSource - PROMDEV_TTYA;
969 1.51 gwr zs_unit = 0; /* XXX - config info! */
970 1.50 gwr channel = zstty_unit & 1;
971 1.50 gwr cn = &consdev_tty;
972 1.50 gwr cn->cn_dev = makedev(zs_major, zstty_unit);
973 1.50 gwr cn->cn_pri = CN_REMOTE;
974 1.50 gwr break;
975 1.50 gwr
976 1.50 gwr }
977 1.50 gwr /* Now that inSource has been validated, print it. */
978 1.50 gwr printf("console is %s\n", prom_inSrc_name[inSource]);
979 1.1 deraadt
980 1.50 gwr zc = zs_get_chan_addr(zs_unit, channel);
981 1.50 gwr if (zc == NULL) {
982 1.50 gwr printf("cninit: zs not mapped.\n");
983 1.1 deraadt return;
984 1.1 deraadt }
985 1.50 gwr zs_conschan = zc;
986 1.50 gwr zs_hwflags[zs_unit][channel] = ZS_HWFLAG_CONSOLE;
987 1.50 gwr cn_tab = cn;
988 1.50 gwr (*cn->cn_init)(cn);
989 1.50 gwr #ifdef KGDB
990 1.50 gwr zs_kgdb_init();
991 1.50 gwr #endif
992 1.1 deraadt }
993