1223695Sdfr/*-
2223695Sdfr * Copyright (c) 2011 Google, Inc.
3223695Sdfr * All rights reserved.
4223695Sdfr *
5223695Sdfr * Redistribution and use in source and binary forms, with or without
6223695Sdfr * modification, are permitted provided that the following conditions
7223695Sdfr * are met:
8223695Sdfr * 1. Redistributions of source code must retain the above copyright
9223695Sdfr *    notice, this list of conditions and the following disclaimer.
10223695Sdfr * 2. Redistributions in binary form must reproduce the above copyright
11223695Sdfr *    notice, this list of conditions and the following disclaimer in the
12223695Sdfr *    documentation and/or other materials provided with the distribution.
13223695Sdfr *
14223695Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15223695Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16223695Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17223695Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18223695Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19223695Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20223695Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21223695Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22223695Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23223695Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24223695Sdfr * SUCH DAMAGE.
25223695Sdfr */
26223695Sdfr
27223695Sdfr#include <sys/cdefs.h>
28223695Sdfr__FBSDID("$FreeBSD$");
29223695Sdfr
30223695Sdfr#include <stand.h>
31223695Sdfr#include "bootstrap.h"
32223695Sdfr#include "libuserboot.h"
33223695Sdfr
34223695Sdfrint console;
35223695Sdfr
36223695Sdfrstatic void userboot_cons_probe(struct console *cp);
37223695Sdfrstatic int userboot_cons_init(int);
38223695Sdfrstatic void userboot_cons_putchar(int);
39223695Sdfrstatic int userboot_cons_getchar(void);
40223695Sdfrstatic int userboot_cons_poll(void);
41223695Sdfr
42223695Sdfrstruct console userboot_console = {
43223695Sdfr	"userboot",
44223695Sdfr	"userboot",
45223695Sdfr	0,
46223695Sdfr	userboot_cons_probe,
47223695Sdfr	userboot_cons_init,
48223695Sdfr	userboot_cons_putchar,
49223695Sdfr	userboot_cons_getchar,
50223695Sdfr	userboot_cons_poll,
51223695Sdfr};
52223695Sdfr
53223695Sdfrstatic void
54223695Sdfruserboot_cons_probe(struct console *cp)
55223695Sdfr{
56223695Sdfr
57223695Sdfr	cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
58223695Sdfr}
59223695Sdfr
60223695Sdfrstatic int
61223695Sdfruserboot_cons_init(int arg)
62223695Sdfr{
63223695Sdfr
64223695Sdfr	return (0);
65223695Sdfr}
66223695Sdfr
67223695Sdfrstatic void
68223695Sdfruserboot_cons_putchar(int c)
69223695Sdfr{
70223695Sdfr
71223695Sdfr        CALLBACK(putc, c);
72223695Sdfr}
73223695Sdfr
74223695Sdfrstatic int
75223695Sdfruserboot_cons_getchar()
76223695Sdfr{
77223695Sdfr
78223695Sdfr	return (CALLBACK(getc));
79223695Sdfr}
80223695Sdfr
81223695Sdfrstatic int
82223695Sdfruserboot_cons_poll()
83223695Sdfr{
84223695Sdfr
85223695Sdfr	return (CALLBACK(poll));
86223695Sdfr}
87