Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / evbppc / virtex / consinit.c
blob04bd40869c5ac56e34d074814bf3cf4ca0238327
1 /* $NetBSD: consinit.c,v 1.1.20.1 2007/05/28 20:01:42 freza Exp $ */
3 /*
4 * Copyright (c) 2006 Jachym Holecek
5 * All rights reserved.
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
11 * are met:
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.
32 #include "opt_cons.h"
33 #include "xlcom.h"
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>
46 #include <dev/cons.h>
49 #if NXLCOM > 0
50 extern struct consdev consdev_xlcom;
51 void xlcom_cninit(struct consdev *, bus_addr_t);
52 #if defined(KGDB)
53 void xlcom_kgdbinit(void);
54 #endif
55 #endif
57 struct consdev *cn_tab = NULL;
58 bus_space_tag_t consdev_iot;
59 bus_space_handle_t consdev_ioh;
61 #if defined(KGDB)
62 bus_space_tag_t kgdb_iot;
63 bus_space_handle_t kgdb_ioh;
64 #endif
68 * Initialize the system console (hmm, as if anyone can see those panics).
70 void
71 consinit(void)
73 static int initted = 0;
75 if (initted)
76 return;
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);
82 #if defined(KGDB)
83 if (virtex_bus_space_tag(KGDB_NAME, &kgdb_iot))
84 panic("No bus space for %s kgdb", KGDB_NAME);
85 #endif
87 #if NXLCOM > 0
88 #if defined(KGDB)
89 if (strncmp("xlcom", KGDB_NAME, 5)) {
90 xlcom_kgdbinit();
92 /* Overtake console device, we're higher priority. */
93 if (strcmp(KGDB_NAME, CONS_NAME) == 0 &&
94 KGDB_ADDR == CONS_ADDR)
95 goto done;
97 #endif
98 if (strncmp("xlcom", CONS_NAME, 5) == 0) {
99 cn_tab = &consdev_xlcom;
100 xlcom_cninit(cn_tab, CONS_ADDR);
102 goto done;
104 #endif
106 panic("No console"); /* XXX really panic? */
107 done:
108 /* If kgdb overtook console, cn_tab is NULL and dev/cons.c deals. */
109 initted = 1;