Deleted Added
sdiff udiff text old ( 130585 ) new ( 131016 )
full compact
1/*
2 * Copyright (C) 2001 Benno Rice.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_console.c 130585 2004-06-16 09:47:26Z phk $");
28
29#include "opt_ddb.h"
30#include "opt_comconsole.h"
31
32#include <sys/param.h>
33#include <sys/kernel.h>
34#include <sys/systm.h>
35#include <sys/types.h>
36#include <sys/conf.h>
37#include <sys/cons.h>
38#include <sys/consio.h>
39#include <sys/tty.h>
40
41#include <dev/ofw/openfirm.h>
42
43#include <ddb/ddb.h>
44
45#define OFW_POLL_HZ 4
46
47static d_open_t ofw_dev_open;
48static d_close_t ofw_dev_close;
49
50static struct cdevsw ofw_cdevsw = {
51 .d_version = D_VERSION,
52 .d_open = ofw_dev_open,
53 .d_close = ofw_dev_close,

--- 66 unchanged lines hidden (view full) ---

120 tp->t_stop = ofw_tty_stop;
121 tp->t_dev = dev;
122
123 if ((tp->t_state & TS_ISOPEN) == 0) {
124 tp->t_state |= TS_CARR_ON;
125 ttychars(tp);
126 tp->t_iflag = TTYDEF_IFLAG;
127 tp->t_oflag = TTYDEF_OFLAG;
128 tp->t_cflag = TTYDEF_CFLAG|CLOCAL;
129 tp->t_lflag = TTYDEF_LFLAG;
130 tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
131 ttsetwater(tp);
132
133 setuptimeout = 1;
134 } else if ((tp->t_state & TS_XCLUDE) && suser(td)) {
135 return (EBUSY);
136 }
137
138 error = ttyld_open(tp, dev);
139
140 if (error == 0 && setuptimeout) {
141 polltime = hz / OFW_POLL_HZ;
142 if (polltime < 1) {
143 polltime = 1;
144 }
145
146 ofw_timeouthandle = timeout(ofw_timeout, tp, polltime);
147 }
148
149 return (error);

--- 7 unchanged lines hidden (view full) ---

157
158 unit = minor(dev);
159 tp = ofw_tp;
160
161 if (unit != 0) {
162 return (ENXIO);
163 }
164
165 ttyld_close(tp, flag);
166 ttyclose(tp);
167
168 return (0);
169}
170
171
172static int
173ofw_tty_param(struct tty *tp, struct termios *t)
174{
175
176 return (0);
177}
178
179static void
180ofw_tty_start(struct tty *tp)
181{
182
183 if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) {
184 ttwwakeup(tp);
185 return;
186 }
187
188 tp->t_state |= TS_BUSY;
189 while (tp->t_outq.c_cc != 0) {
190 ofw_cons_putc(NULL, getc(&tp->t_outq));
191 }
192 tp->t_state &= ~TS_BUSY;
193
194 ttwwakeup(tp);
195}
196
197static void
198ofw_tty_stop(struct tty *tp, int flag)
199{

--- 108 unchanged lines hidden ---