consinit.c revision 1.4 1 /* $NetBSD: consinit.c,v 1.4 2003/07/25 11:44:19 scw Exp $ */
2
3 /*-
4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Juergen Hannken-Illjes.
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 #include <sys/cdefs.h>
40 __KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.4 2003/07/25 11:44:19 scw Exp $");
41
42 #include <sys/param.h>
43 #include <sys/systm.h>
44
45 #include <machine/explora.h>
46 #include <machine/bus.h>
47
48 #include "com.h"
49 #if NCOM > 0
50 #include <sys/termios.h>
51 #include <dev/ic/comreg.h>
52 #include <dev/ic/comvar.h>
53 #endif
54
55 #include "pckbc.h"
56 #if (NPCKBC > 0)
57 #include <dev/isa/isareg.h>
58 #include <dev/ic/i8042reg.h>
59 #include <dev/ic/pckbcvar.h>
60 #endif
61 #include "pckbd.h"
62
63 #include <evbppc/explora/dev/elbvar.h>
64
65 #include "opt_explora.h"
66
67 #ifndef COM_CONSOLE_SPEED
68 #define COM_CONSOLE_SPEED 9600
69 #endif
70
71 void
72 consinit(void)
73 {
74 bus_space_tag_t tag;
75 static int done = 0;
76 #ifndef COM_IS_CONSOLE
77 extern void fb_cnattach(bus_space_tag_t, bus_addr_t, void *);
78 #endif
79
80 if (done)
81 return;
82
83 done = 1;
84
85 #ifdef COM_IS_CONSOLE
86 tag = elb_get_bus_space_tag(BASE_COM);
87 comcnattach(tag, BASE_COM, COM_CONSOLE_SPEED,
88 COM_FREQ, COM_TYPE_NORMAL,
89 (TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8);
90 #else
91 /* Clear VRam */
92 memset((void *)BASE_FB, 0, SIZE_FB);
93
94 tag = elb_get_bus_space_tag(BASE_FB);
95 fb_cnattach(tag, BASE_FB2, (void *)BASE_FB);
96 tag = elb_get_bus_space_tag(BASE_PCKBC);
97 pckbc_cnattach(tag, BASE_PCKBC, BASE_PCKBC2-BASE_PCKBC, PCKBC_KBD_SLOT);
98 #endif
99 }
100