Home | History | Annotate | Line # | Download | only in explora
consinit.c revision 1.3
      1 /*	$NetBSD: consinit.c,v 1.3 2003/07/15 01:37:36 lukem 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.3 2003/07/15 01:37:36 lukem 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 "opt_explora.h"
     64 
     65 #ifndef COM_CONSOLE_SPEED
     66 #define COM_CONSOLE_SPEED	9600
     67 #endif
     68 
     69 void
     70 consinit(void)
     71 {
     72 	bus_space_tag_t tag;
     73 	static int done = 0;
     74 #ifndef COM_IS_CONSOLE
     75 	extern void fb_cnattach(bus_space_tag_t, bus_addr_t, void *);
     76 #endif
     77 
     78 	if (done)
     79 		return;
     80 
     81 	done = 1;
     82 
     83 #ifdef COM_IS_CONSOLE
     84 	tag = MAKE_BUS_TAG(BASE_COM);
     85 	comcnattach(tag, BASE_COM, COM_CONSOLE_SPEED,
     86 	    COM_FREQ, COM_TYPE_NORMAL,
     87 	    (TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8);
     88 #else
     89 	/* Clear VRam */
     90 	memset((void *)BASE_FB, 0, SIZE_FB);
     91 
     92 	tag = MAKE_BUS_TAG(BASE_FB);
     93 	fb_cnattach(tag, BASE_FB2, (void *)BASE_FB);
     94 	tag = MAKE_BUS_TAG(BASE_PCKBC);
     95 	pckbc_cnattach(tag, BASE_PCKBC, BASE_PCKBC2-BASE_PCKBC, PCKBC_KBD_SLOT);
     96 #endif
     97 }
     98