Deleted Added
full compact
ofw_console.c (109921) ofw_console.c (110509)
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

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

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#ifndef lint
27static const char rcsid[] =
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

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

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#ifndef lint
27static const char rcsid[] =
28 "$FreeBSD: head/sys/dev/ofw/ofw_console.c 109921 2003-01-27 04:42:17Z jake $";
28 "$FreeBSD: head/sys/dev/ofw/ofw_console.c 110509 2003-02-07 16:20:09Z harti $";
29#endif /* not lint */
30
29#endif /* not lint */
30
31#include "opt_ddb.h"
32#include "opt_comconsole.h"
33
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/systm.h>
34#include <sys/types.h>
35#include <sys/conf.h>
36#include <sys/cons.h>
37#include <sys/consio.h>
38#include <sys/tty.h>
39
40#include <dev/ofw/openfirm.h>
41
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/systm.h>
37#include <sys/types.h>
38#include <sys/conf.h>
39#include <sys/cons.h>
40#include <sys/consio.h>
41#include <sys/tty.h>
42
43#include <dev/ofw/openfirm.h>
44
45#include <ddb/ddb.h>
46
42#define OFW_POLL_HZ 4
43
44static d_open_t ofw_dev_open;
45static d_close_t ofw_dev_close;
46static d_ioctl_t ofw_dev_ioctl;
47
48#define CDEV_MAJOR 97
49

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

63 /* flags */ 0,
64};
65
66static struct tty *ofw_tp = NULL;
67static int polltime;
68static struct callout_handle ofw_timeouthandle
69 = CALLOUT_HANDLE_INITIALIZER(&ofw_timeouthandle);
70
47#define OFW_POLL_HZ 4
48
49static d_open_t ofw_dev_open;
50static d_close_t ofw_dev_close;
51static d_ioctl_t ofw_dev_ioctl;
52
53#define CDEV_MAJOR 97
54

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

68 /* flags */ 0,
69};
70
71static struct tty *ofw_tp = NULL;
72static int polltime;
73static struct callout_handle ofw_timeouthandle
74 = CALLOUT_HANDLE_INITIALIZER(&ofw_timeouthandle);
75
76#if defined(DDB) && defined(ALT_BREAK_TO_DEBUGGER)
77static int alt_break_state;
78#endif
79
71static void ofw_tty_start(struct tty *);
72static int ofw_tty_param(struct tty *, struct termios *);
73static void ofw_tty_stop(struct tty *, int);
74static void ofw_timeout(void *);
75
76static cn_probe_t ofw_cons_probe;
77static cn_init_t ofw_cons_init;
78static cn_getc_t ofw_cons_getc;

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

291 ch = '\0';
292
293 while ((l = OF_read(stdin, &ch, 1)) != 1) {
294 if (l != -2 && l != 0) {
295 return (-1);
296 }
297 }
298
80static void ofw_tty_start(struct tty *);
81static int ofw_tty_param(struct tty *, struct termios *);
82static void ofw_tty_stop(struct tty *, int);
83static void ofw_timeout(void *);
84
85static cn_probe_t ofw_cons_probe;
86static cn_init_t ofw_cons_init;
87static cn_getc_t ofw_cons_getc;

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

300 ch = '\0';
301
302 while ((l = OF_read(stdin, &ch, 1)) != 1) {
303 if (l != -2 && l != 0) {
304 return (-1);
305 }
306 }
307
308#if defined(DDB) && defined(ALT_BREAK_TO_DEBUGGER)
309 if (db_alt_break(ch, &alt_break_state))
310 breakpoint();
311#endif
312
299 return (ch);
300}
301
302static int
303ofw_cons_checkc(dev_t dev)
304{
305 unsigned char ch;
306
307 if (OF_read(stdin, &ch, 1) > 0) {
313 return (ch);
314}
315
316static int
317ofw_cons_checkc(dev_t dev)
318{
319 unsigned char ch;
320
321 if (OF_read(stdin, &ch, 1) > 0) {
322#if defined(DDB) && defined(ALT_BREAK_TO_DEBUGGER)
323 if (db_alt_break(ch, &alt_break_state))
324 breakpoint();
325#endif
308 return (ch);
309 }
310
311 return (-1);
312}
313
314static void
315ofw_cons_putc(dev_t dev, int c)
316{
317 char cbuf;
318
319 if (c == '\n') {
320 cbuf = '\r';
321 OF_write(stdout, &cbuf, 1);
322 }
323
324 cbuf = c;
325 OF_write(stdout, &cbuf, 1);
326}
326 return (ch);
327 }
328
329 return (-1);
330}
331
332static void
333ofw_cons_putc(dev_t dev, int c)
334{
335 char cbuf;
336
337 if (c == '\n') {
338 cbuf = '\r';
339 OF_write(stdout, &cbuf, 1);
340 }
341
342 cbuf = c;
343 OF_write(stdout, &cbuf, 1);
344}