1 /* $NetBSD: consinit.c,v 1.2 2003/06/14 17:01:11 thorpej 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/param.h> 40 #include <sys/systm.h> 41 42 #include <machine/explora.h> 43 #include <machine/bus.h> 44 45 #include "com.h" 46 #if NCOM > 0 47 #include <sys/termios.h> 48 #include <dev/ic/comreg.h> 49 #include <dev/ic/comvar.h> 50 #endif 51 52 #include "pckbc.h" 53 #if (NPCKBC > 0) 54 #include <dev/isa/isareg.h> 55 #include <dev/ic/i8042reg.h> 56 #include <dev/ic/pckbcvar.h> 57 #endif 58 #include "pckbd.h" 59 60 #include "opt_explora.h" 61 62 #ifndef COM_CONSOLE_SPEED 63 #define COM_CONSOLE_SPEED 9600 64 #endif 65 66 void 67 consinit(void) 68 { 69 bus_space_tag_t tag; 70 static int done = 0; 71 #ifndef COM_IS_CONSOLE 72 extern void fb_cnattach(bus_space_tag_t, bus_addr_t, void *); 73 #endif 74 75 if (done) 76 return; 77 78 done = 1; 79 80 #ifdef COM_IS_CONSOLE 81 tag = MAKE_BUS_TAG(BASE_COM); 82 comcnattach(tag, BASE_COM, COM_CONSOLE_SPEED, 83 COM_FREQ, COM_TYPE_NORMAL, 84 (TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8); 85 #else 86 /* Clear VRam */ 87 memset((void *)BASE_FB, 0, SIZE_FB); 88 89 tag = MAKE_BUS_TAG(BASE_FB); 90 fb_cnattach(tag, BASE_FB2, (void *)BASE_FB); 91 tag = MAKE_BUS_TAG(BASE_PCKBC); 92 pckbc_cnattach(tag, BASE_PCKBC, BASE_PCKBC2-BASE_PCKBC, PCKBC_KBD_SLOT); 93 #endif 94 } 95