1 /* $NetBSD: consinit.c,v 1.1.20.1 2007/05/28 20:01:42 freza Exp $ */
4 * Copyright (c) 2006 Jachym Holecek
7 * Written for DFC Design, s.r.o.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #include <sys/cdefs.h>
36 __KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.1.20.1 2007/05/28 20:01:42 freza Exp $");
38 #include <sys/param.h>
39 #include <sys/systm.h>
40 #include <sys/device.h>
42 #include <machine/bus.h>
44 #include <evbppc/virtex/virtex.h>
50 extern struct consdev consdev_xlcom
;
51 void xlcom_cninit(struct consdev
*, bus_addr_t
);
53 void xlcom_kgdbinit(void);
57 struct consdev
*cn_tab
= NULL
;
58 bus_space_tag_t consdev_iot
;
59 bus_space_handle_t consdev_ioh
;
62 bus_space_tag_t kgdb_iot
;
63 bus_space_handle_t kgdb_ioh
;
68 * Initialize the system console (hmm, as if anyone can see those panics).
73 static int initted
= 0;
78 /* Pick MD knowledge about console. */
79 if (virtex_bus_space_tag(CONS_NAME
, &consdev_iot
))
80 panic("No bus space for %s console", CONS_NAME
);
83 if (virtex_bus_space_tag(KGDB_NAME
, &kgdb_iot
))
84 panic("No bus space for %s kgdb", KGDB_NAME
);
89 if (strncmp("xlcom", KGDB_NAME
, 5)) {
92 /* Overtake console device, we're higher priority. */
93 if (strcmp(KGDB_NAME
, CONS_NAME
) == 0 &&
94 KGDB_ADDR
== CONS_ADDR
)
98 if (strncmp("xlcom", CONS_NAME
, 5) == 0) {
99 cn_tab
= &consdev_xlcom
;
100 xlcom_cninit(cn_tab
, CONS_ADDR
);
106 panic("No console"); /* XXX really panic? */
108 /* If kgdb overtook console, cn_tab is NULL and dev/cons.c deals. */