consinit.c revision 1.1 1 /* $NetBSD: consinit.c,v 1.1 2006/12/02 22:18:47 freza Exp $ */
2
3 /*
4 * Copyright (c) 2006 Jachym Holecek
5 * All rights reserved.
6 *
7 * Written for DFC Design, s.r.o.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
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.
19 *
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.
30 */
31
32 #include "opt_cons.h"
33 #include "xlcom.h"
34
35 #include <sys/cdefs.h>
36 __KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.1 2006/12/02 22:18:47 freza Exp $");
37
38 #include <sys/param.h>
39 #include <sys/systm.h>
40 #include <sys/device.h>
41
42 #include <machine/bus.h>
43
44 #include <evbppc/virtex/virtex.h>
45
46 #include <dev/cons.h>
47
48
49 #if NXLCOM > 0
50 extern struct consdev consdev_xlcom;
51 void xlcom_cninit(struct consdev *, bus_addr_t);
52 #endif
53
54 struct consdev *cn_tab = NULL;
55 bus_space_tag_t consdev_iot;
56 bus_space_handle_t consdev_ioh;
57
58
59 /*
60 * Initialize the system console (hmm, as if anyone can see those panics).
61 */
62 void
63 consinit(void)
64 {
65 static int initted = 0;
66
67 if (initted)
68 return;
69
70 /* Pick MD knowledge about console. */
71 if (virtex_console_tag(CONS_NAME, &consdev_iot))
72 panic("No bus space for %s console", CONS_NAME);
73
74 #if NXLCOM > 0
75 if (strncmp("xlcom", CONS_NAME, 5) == 0) {
76 cn_tab = &consdev_xlcom;
77 xlcom_cninit(cn_tab, CONS_ADDR);
78
79 goto done;
80 }
81 #endif
82
83 panic("No console"); /* XXX really panic? */
84 done:
85 initted = 1;
86 }
87