xref: /illumos-gate/usr/src/boot/i386/libi386/nullconsole.c (revision 22028508fd28d36ff74dc02c5774a8ba1f0db045)
1*22028508SToomas Soome /*
2*22028508SToomas Soome  * nullconsole.c
3*22028508SToomas Soome  *
4*22028508SToomas Soome  * Author: Doug Ambrisko <ambrisko@whistle.com>
5*22028508SToomas Soome  * Copyright (c) 2000 Whistle Communications, Inc.
6*22028508SToomas Soome  * All rights reserved.
7*22028508SToomas Soome  *
8*22028508SToomas Soome  * Subject to the following obligations and disclaimer of warranty, use and
9*22028508SToomas Soome  * redistribution of this software, in source or object code forms, with or
10*22028508SToomas Soome  * without modifications are expressly permitted by Whistle Communications;
11*22028508SToomas Soome  * provided, however, that:
12*22028508SToomas Soome  * 1. Any and all reproductions of the source or object code must include the
13*22028508SToomas Soome  *    copyright notice above and the following disclaimer of warranties; and
14*22028508SToomas Soome  * 2. No rights are granted, in any manner or form, to use Whistle
15*22028508SToomas Soome  *    Communications, Inc. trademarks, including the mark "WHISTLE
16*22028508SToomas Soome  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
17*22028508SToomas Soome  *    such appears in the above copyright notice or in the software.
18*22028508SToomas Soome  *
19*22028508SToomas Soome  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
20*22028508SToomas Soome  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
21*22028508SToomas Soome  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
22*22028508SToomas Soome  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
23*22028508SToomas Soome  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
24*22028508SToomas Soome  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
25*22028508SToomas Soome  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
26*22028508SToomas Soome  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
27*22028508SToomas Soome  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
28*22028508SToomas Soome  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
29*22028508SToomas Soome  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
30*22028508SToomas Soome  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
31*22028508SToomas Soome  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32*22028508SToomas Soome  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33*22028508SToomas Soome  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34*22028508SToomas Soome  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35*22028508SToomas Soome  * OF SUCH DAMAGE.
36*22028508SToomas Soome  */
37*22028508SToomas Soome 
38*22028508SToomas Soome #include <sys/cdefs.h>
39*22028508SToomas Soome 
40*22028508SToomas Soome #include <stand.h>
41*22028508SToomas Soome #include <bootstrap.h>
42*22028508SToomas Soome 
43*22028508SToomas Soome static void	nullc_probe(struct console *cp);
44*22028508SToomas Soome static int	nullc_init(struct console *, int arg);
45*22028508SToomas Soome static void	nullc_putchar(struct console *, int c);
46*22028508SToomas Soome static int	nullc_getchar(struct console *);
47*22028508SToomas Soome static int	nullc_ischar(struct console *);
48*22028508SToomas Soome static void	nullc_devinfo(struct console *);
49*22028508SToomas Soome 
50*22028508SToomas Soome struct console nullconsole = {
51*22028508SToomas Soome 	.c_name = "null",
52*22028508SToomas Soome 	.c_desc = "null port",
53*22028508SToomas Soome 	.c_flags = 0,
54*22028508SToomas Soome 	.c_probe = nullc_probe,
55*22028508SToomas Soome 	.c_init = nullc_init,
56*22028508SToomas Soome 	.c_out = nullc_putchar,
57*22028508SToomas Soome 	.c_in = nullc_getchar,
58*22028508SToomas Soome 	.c_ready = nullc_ischar,
59*22028508SToomas Soome 	.c_ioctl = NULL,
60*22028508SToomas Soome 	.c_devinfo = nullc_devinfo,
61*22028508SToomas Soome 	.c_private = NULL
62*22028508SToomas Soome };
63*22028508SToomas Soome 
64*22028508SToomas Soome static void
nullc_devinfo(struct console * cp __unused)65*22028508SToomas Soome nullc_devinfo(struct console *cp __unused)
66*22028508SToomas Soome {
67*22028508SToomas Soome 	printf("\tsoftware device");
68*22028508SToomas Soome }
69*22028508SToomas Soome 
70*22028508SToomas Soome static void
nullc_probe(struct console * cp)71*22028508SToomas Soome nullc_probe(struct console *cp)
72*22028508SToomas Soome {
73*22028508SToomas Soome 	cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
74*22028508SToomas Soome }
75*22028508SToomas Soome 
76*22028508SToomas Soome static int
nullc_init(struct console * cp __unused,int arg __unused)77*22028508SToomas Soome nullc_init(struct console *cp __unused, int arg __unused)
78*22028508SToomas Soome {
79*22028508SToomas Soome 	return(0);
80*22028508SToomas Soome }
81*22028508SToomas Soome 
82*22028508SToomas Soome static void
nullc_putchar(struct console * cp __unused,int c __unused)83*22028508SToomas Soome nullc_putchar(struct console *cp __unused, int c __unused)
84*22028508SToomas Soome {
85*22028508SToomas Soome }
86*22028508SToomas Soome 
87*22028508SToomas Soome static int
nullc_getchar(struct console * cp __unused)88*22028508SToomas Soome nullc_getchar(struct console *cp __unused)
89*22028508SToomas Soome {
90*22028508SToomas Soome 	return(-1);
91*22028508SToomas Soome }
92*22028508SToomas Soome 
93*22028508SToomas Soome static int
nullc_ischar(struct console * cp __unused)94*22028508SToomas Soome nullc_ischar(struct console *cp __unused)
95*22028508SToomas Soome {
96*22028508SToomas Soome 	return(0);
97*22028508SToomas Soome }
98