blob: 6e149c8ab83514af175ea8d03563b43893acc5d8 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Platform dependent support for HP simulator.
3 *
4 * Copyright (C) 1998, 1999, 2002 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com>
6 * Copyright (C) 1999 Vijay Chander <vijay@engr.sgi.com>
7 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/param.h>
12#include <linux/string.h>
13#include <linux/types.h>
14#include <linux/tty.h>
15#include <linux/kdev_t.h>
16#include <linux/console.h>
17
18#include <asm/delay.h>
19#include <asm/irq.h>
20#include <asm/pal.h>
21#include <asm/machvec.h>
22#include <asm/pgtable.h>
23#include <asm/sal.h>
24
25#include "hpsim_ssc.h"
26
27static int simcons_init (struct console *, char *);
28static void simcons_write (struct console *, const char *, unsigned);
29static struct tty_driver *simcons_console_device (struct console *, int *);
30
31struct console hpsim_cons = {
32 .name = "simcons",
33 .write = simcons_write,
34 .device = simcons_console_device,
35 .setup = simcons_init,
36 .flags = CON_PRINTBUFFER,
37 .index = -1,
38};
39
40static int
41simcons_init (struct console *cons, char *options)
42{
43 return 0;
44}
45
46static void
47simcons_write (struct console *cons, const char *buf, unsigned count)
48{
49 unsigned long ch;
50
51 while (count-- > 0) {
52 ch = *buf++;
53 ia64_ssc(ch, 0, 0, 0, SSC_PUTCHAR);
54 if (ch == '\n')
55 ia64_ssc('\r', 0, 0, 0, SSC_PUTCHAR);
56 }
57}
58
59static struct tty_driver *simcons_console_device (struct console *c, int *index)
60{
61 extern struct tty_driver *hp_simserial_driver;
62 *index = c->index;
63 return hp_simserial_driver;
64}