xref: /netbsd/sys/arch/sgimips/sgimips/console.c (revision bf9ec67e)
1 /*	$NetBSD: console.c,v 1.7 2002/03/13 13:12:29 simonb Exp $	*/
2 
3 /*
4  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
5  * All rights reserved.
6  *
7  * Author: Chris G. Demetriou
8  *
9  * Permission to use, copy, modify and distribute this software and
10  * its documentation is hereby granted, provided that both the copyright
11  * notice and this permission notice appear in all copies of the
12  * software, derivative works or modified versions, and any portions
13  * thereof, and that both notices appear in supporting documentation.
14  *
15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18  *
19  * Carnegie Mellon requests users of this software to return to
20  *
21  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
22  *  School of Computer Science
23  *  Carnegie Mellon University
24  *  Pittsburgh PA 15213-3890
25  *
26  * any improvements or extensions that they make and grant Carnegie the
27  * rights to redistribute these changes.
28  */
29 
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 
33 #include <dev/arcbios/arcbios.h>
34 #include <dev/arcbios/arcbiosvar.h>
35 
36 #include <dev/cons.h>
37 
38 #include "zsc.h"
39 
40 extern struct consdev zs_cn;
41 
42 void
43 consinit()
44 {
45 	char* consdev;
46 
47 	/* Ask ARCS what it is using for console output. */
48 	consdev = ARCBIOS->GetEnvironmentVariable("ConsoleOut");
49 	if (consdev == NULL) {
50 		printf("WARNING: ConsoleOut environment variable not set\n");
51 		goto force_arcs;
52 	}
53 
54 #if NZSC > 0
55 	/* XXX This is Indigo2/Indy-specific. */
56 	if (strlen(consdev) == 9 &&
57 	    strncmp(consdev, "serial", 6) == 0 &&
58 	    (consdev[7] == '0' || consdev[7] == '1')) {
59 		cn_tab = &zs_cn;
60 		(*cn_tab->cn_init)(cn_tab);
61 		return;
62 	}
63 #endif
64 
65  force_arcs:
66 	printf("Using ARCS for console I/O.\n");
67 }
68