consinit.c revision 1.1.6.2 1 1.1.6.2 ad /* $NetBSD: consinit.c,v 1.1.6.2 2007/01/12 01:00:47 ad Exp $ */
2 1.1.6.2 ad
3 1.1.6.2 ad /*
4 1.1.6.2 ad * Copyright (c) 2006 Jachym Holecek
5 1.1.6.2 ad * All rights reserved.
6 1.1.6.2 ad *
7 1.1.6.2 ad * Written for DFC Design, s.r.o.
8 1.1.6.2 ad *
9 1.1.6.2 ad * Redistribution and use in source and binary forms, with or without
10 1.1.6.2 ad * modification, are permitted provided that the following conditions
11 1.1.6.2 ad * are met:
12 1.1.6.2 ad *
13 1.1.6.2 ad * 1. Redistributions of source code must retain the above copyright
14 1.1.6.2 ad * notice, this list of conditions and the following disclaimer.
15 1.1.6.2 ad *
16 1.1.6.2 ad * 2. Redistributions in binary form must reproduce the above copyright
17 1.1.6.2 ad * notice, this list of conditions and the following disclaimer in the
18 1.1.6.2 ad * documentation and/or other materials provided with the distribution.
19 1.1.6.2 ad *
20 1.1.6.2 ad * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1.6.2 ad * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1.6.2 ad * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1.6.2 ad * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1.6.2 ad * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1.6.2 ad * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1.6.2 ad * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1.6.2 ad * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1.6.2 ad * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1.6.2 ad * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1.6.2 ad */
31 1.1.6.2 ad
32 1.1.6.2 ad #include "opt_cons.h"
33 1.1.6.2 ad #include "xlcom.h"
34 1.1.6.2 ad
35 1.1.6.2 ad #include <sys/cdefs.h>
36 1.1.6.2 ad __KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.1.6.2 2007/01/12 01:00:47 ad Exp $");
37 1.1.6.2 ad
38 1.1.6.2 ad #include <sys/param.h>
39 1.1.6.2 ad #include <sys/systm.h>
40 1.1.6.2 ad #include <sys/device.h>
41 1.1.6.2 ad
42 1.1.6.2 ad #include <machine/bus.h>
43 1.1.6.2 ad
44 1.1.6.2 ad #include <evbppc/virtex/virtex.h>
45 1.1.6.2 ad
46 1.1.6.2 ad #include <dev/cons.h>
47 1.1.6.2 ad
48 1.1.6.2 ad
49 1.1.6.2 ad #if NXLCOM > 0
50 1.1.6.2 ad extern struct consdev consdev_xlcom;
51 1.1.6.2 ad void xlcom_cninit(struct consdev *, bus_addr_t);
52 1.1.6.2 ad #endif
53 1.1.6.2 ad
54 1.1.6.2 ad struct consdev *cn_tab = NULL;
55 1.1.6.2 ad bus_space_tag_t consdev_iot;
56 1.1.6.2 ad bus_space_handle_t consdev_ioh;
57 1.1.6.2 ad
58 1.1.6.2 ad
59 1.1.6.2 ad /*
60 1.1.6.2 ad * Initialize the system console (hmm, as if anyone can see those panics).
61 1.1.6.2 ad */
62 1.1.6.2 ad void
63 1.1.6.2 ad consinit(void)
64 1.1.6.2 ad {
65 1.1.6.2 ad static int initted = 0;
66 1.1.6.2 ad
67 1.1.6.2 ad if (initted)
68 1.1.6.2 ad return;
69 1.1.6.2 ad
70 1.1.6.2 ad /* Pick MD knowledge about console. */
71 1.1.6.2 ad if (virtex_console_tag(CONS_NAME, &consdev_iot))
72 1.1.6.2 ad panic("No bus space for %s console", CONS_NAME);
73 1.1.6.2 ad
74 1.1.6.2 ad #if NXLCOM > 0
75 1.1.6.2 ad if (strncmp("xlcom", CONS_NAME, 5) == 0) {
76 1.1.6.2 ad cn_tab = &consdev_xlcom;
77 1.1.6.2 ad xlcom_cninit(cn_tab, CONS_ADDR);
78 1.1.6.2 ad
79 1.1.6.2 ad goto done;
80 1.1.6.2 ad }
81 1.1.6.2 ad #endif
82 1.1.6.2 ad
83 1.1.6.2 ad panic("No console"); /* XXX really panic? */
84 1.1.6.2 ad done:
85 1.1.6.2 ad initted = 1;
86 1.1.6.2 ad }
87