1 /* $NetBSD: consinit.c,v 1.2.2.3 2004/09/21 13:15:07 skrll Exp $ */
5 * Matthias Drochner. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.2.2.3 2004/09/21 13:15:07 skrll Exp $");
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/device.h>
37 #include <machine/bus.h>
39 #include <powerpc/ibm4xx/ibm405gp.h>
40 #include <powerpc/ibm4xx/dev/opbvar.h>
44 #include <sys/termios.h>
45 #include <dev/ic/comreg.h>
46 #include <dev/ic/comvar.h>
52 #define CONSDEVNAME "com"
57 #define CONADDR IBM405GP_UART0_BASE
60 #define CONSPEED B9600 /* */
61 // #define CONSPEED B115200 /* 9600 is too slow for my taste */
64 #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
66 int comcnmode
= CONMODE
;
71 #define KGDB_DEVNAME "com"
73 char kgdb_devname
[] = KGDB_DEVNAME
;
77 #define KGDB_DEVADDR UART1_BASE
79 int comkgdbaddr
= KGDB_DEVADDR
;
82 #define KGDB_DEVRATE CONSPEED
84 int comkgdbrate
= KGDB_DEVRATE
;
87 #define KGDB_DEVMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
89 int comkgdbmode
= KGDB_DEVMODE
;
97 * initialize the system console.
98 * XXX - shouldn't deal with this initted thing, but then,
99 * it shouldn't be called from initppc either.
104 static int initted
= 0;
114 /* We *know* the com-console attaches to opb */
115 tag
= opb_get_bus_space_tag();
117 if (comcnattach(tag
, CONADDR
, CONSPEED
, COM_FREQ
* 6,
118 COM_TYPE_NORMAL
, comcnmode
))
119 panic("can't init serial console @%x", CONADDR
);
123 panic("console device missing -- serial console not in kernel");
124 /* Of course, this is moot if there is no console... */
132 if(!strcmp(kgdb_devname
, "com")) {
133 bus_space_tag_t tag
= opb_get_bus_space_tag();
134 com_kgdb_attach(tag
, comkgdbaddr
, comkgdbrate
, COM_FREQ
* 6,
135 COM_TYPE_NORMAL
, comkgdbmode
);