2 * Simulated Serial Driver (fake serial)
4 * This driver is mostly used for bringup purposes and will go away.
5 * It has a strong dependency on the system console. All outputs
6 * are rerouted to the same facility as the one used by printk which, in our
7 * case means sys_sim.c console (goes via the simulator). The code hereafter
8 * is completely leveraged from the serial.c driver.
10 * Copyright (C) 1999-2000, 2002-2003 Hewlett-Packard Co
11 * Stephane Eranian <eranian@hpl.hp.com>
12 * David Mosberger-Tang <davidm@hpl.hp.com>
14 * 02/04/00 D. Mosberger Merged in serial.c bug fixes in rs_close().
15 * 02/25/00 D. Mosberger Synced up with 2.3.99pre-5 version of serial.c.
16 * 07/30/02 D. Mosberger Replace sti()/cli() with explicit spinlocks & local irq masking
19 #include <linux/config.h>
20 #include <linux/init.h>
21 #include <linux/errno.h>
22 #include <linux/sched.h>
23 #include <linux/tty.h>
24 #include <linux/tty_flip.h>
25 #include <linux/major.h>
26 #include <linux/fcntl.h>
28 #include <linux/slab.h>
29 #include <linux/console.h>
30 #include <linux/module.h>
31 #include <linux/serial.h>
32 #include <linux/serialP.h>
33 #include <linux/sysrq.h>
36 #include <asm/hw_irq.h>
37 #include <asm/uaccess.h>
40 # include <linux/kdb.h>
43 #undef SIMSERIAL_DEBUG /* define this to get some debug information */
45 #define KEYBOARD_INTR 3 /* must match with simulator! */
47 #define NR_PORTS 1 /* only one port for now */
48 #define SERIAL_INLINE 1
51 #define _INLINE_ inline
54 #define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT)
56 #define SSC_GETCHAR 21
58 extern long ia64_ssc (long, long, long, long, int);
59 extern void ia64_ssc_connect_irq (long intr, long irq);
61 static char *serial_name = "SimSerial driver";
62 static char *serial_version = "0.6";
65 * This has been extracted from asm/serial.h. We need one eventually but
66 * I don't know exactly what we're going to put in it so just fake one
69 #define BASE_BAUD ( 1843200 / 16 )
71 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
74 * Most of the values here are meaningless to this particular driver.
75 * However some values must be preserved for the code (leveraged from serial.c
78 * type must not be UNKNOWN
79 * So I picked arbitrary (guess from where?) values instead
81 static struct serial_state rs_table[NR_PORTS]={
82 /* UART CLK PORT IRQ FLAGS */
83 { 0, BASE_BAUD, 0x3F8, 0, STD_COM_FLAGS,0,PORT_16550 } /* ttyS0 */
87 * Just for the fun of it !
89 static struct serial_uart_config uart_config[] = {
94 { "16550A", 16, UART_CLEAR_FIFO | UART_USE_FIFO },
96 { "ST16650", 1, UART_CLEAR_FIFO | UART_STARTECH },
97 { "ST16650V2", 32, UART_CLEAR_FIFO | UART_USE_FIFO |
99 { "TI16750", 64, UART_CLEAR_FIFO | UART_USE_FIFO},
103 struct tty_driver *hp_simserial_driver;
105 static struct async_struct *IRQ_ports[NR_IRQS];
107 static struct console *console;
109 static unsigned char *tmp_buf;
110 static DECLARE_MUTEX(tmp_buf_sem);
112 extern struct console *console_drivers; /* from kernel/printk.c */
115 * ------------------------------------------------------------
116 * rs_stop() and rs_start()
118 * This routines are called before setting or resetting tty->stopped.
119 * They enable or disable transmitter interrupts, as necessary.
120 * ------------------------------------------------------------
122 static void rs_stop(struct tty_struct *tty)
124 #ifdef SIMSERIAL_DEBUG
125 printk("rs_stop: tty->stopped=%d tty->hw_stopped=%d tty->flow_stopped=%d\n",
126 tty->stopped, tty->hw_stopped, tty->flow_stopped);
131 static void rs_start(struct tty_struct *tty)
133 #ifdef SIMSERIAL_DEBUG
134 printk("rs_start: tty->stopped=%d tty->hw_stopped=%d tty->flow_stopped=%d\n",
135 tty->stopped, tty->hw_stopped, tty->flow_stopped);
139 static void receive_chars(struct tty_struct *tty, struct pt_regs *regs)
142 static unsigned char seen_esc = 0;
144 while ( (ch = ia64_ssc(0, 0, 0, 0, SSC_GETCHAR)) ) {
145 if ( ch == 27 && seen_esc == 0 ) {
149 if ( seen_esc==1 && ch == 'O' ) {
152 } else if ( seen_esc == 2 ) {
153 if ( ch == 'P' ) /* F1 */
155 #ifdef CONFIG_MAGIC_SYSRQ
156 if ( ch == 'S' ) { /* F4 */
158 ch = ia64_ssc(0, 0, 0, 0,
161 handle_sysrq(ch, regs, NULL);
169 if (tty->flip.count >= TTY_FLIPBUF_SIZE) break;
171 *tty->flip.char_buf_ptr = ch;
173 *tty->flip.flag_buf_ptr = 0;
175 tty->flip.flag_buf_ptr++;
176 tty->flip.char_buf_ptr++;
179 tty_flip_buffer_push(tty);
183 * This is the serial driver's interrupt routine for a single port
185 static irqreturn_t rs_interrupt_single(int irq, void *dev_id, struct pt_regs * regs)
187 struct async_struct * info;
190 * I don't know exactly why they don't use the dev_id opaque data
191 * pointer instead of this extra lookup table
193 info = IRQ_ports[irq];
194 if (!info || !info->tty) {
195 printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info);
199 * pretty simple in our case, because we only get interrupts
202 receive_chars(info->tty, regs);
207 * -------------------------------------------------------------------
208 * Here ends the serial interrupt routines.
209 * -------------------------------------------------------------------
214 * not really used in our situation so keep them commented out for now
216 static DECLARE_TASK_QUEUE(tq_serial); /* used to be at the top of the file */
217 static void do_serial_bh(void)
219 run_task_queue(&tq_serial);
220 printk(KERN_ERR "do_serial_bh: called\n");
224 static void do_softint(void *private_)
226 printk(KERN_ERR "simserial: do_softint called\n");
229 static void rs_put_char(struct tty_struct *tty, unsigned char ch)
231 struct async_struct *info = (struct async_struct *)tty->driver_data;
234 if (!tty || !info->xmit.buf) return;
236 local_irq_save(flags);
237 if (CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) == 0) {
238 local_irq_restore(flags);
241 info->xmit.buf[info->xmit.head] = ch;
242 info->xmit.head = (info->xmit.head + 1) & (SERIAL_XMIT_SIZE-1);
243 local_irq_restore(flags);
246 static _INLINE_ void transmit_chars(struct async_struct *info, int *intr_done)
252 local_irq_save(flags);
255 char c = info->x_char;
257 console->write(console, &c, 1);
259 info->state->icount.tx++;
265 if (info->xmit.head == info->xmit.tail || info->tty->stopped || info->tty->hw_stopped) {
266 #ifdef SIMSERIAL_DEBUG
267 printk("transmit_chars: head=%d, tail=%d, stopped=%d\n",
268 info->xmit.head, info->xmit.tail, info->tty->stopped);
273 * We removed the loop and try to do it in to chunks. We need
274 * 2 operations maximum because it's a ring buffer.
276 * First from current to tail if possible.
277 * Then from the beginning of the buffer until necessary
280 count = min(CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE),
281 SERIAL_XMIT_SIZE - info->xmit.tail);
282 console->write(console, info->xmit.buf+info->xmit.tail, count);
284 info->xmit.tail = (info->xmit.tail+count) & (SERIAL_XMIT_SIZE-1);
287 * We have more at the beginning of the buffer
289 count = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
291 console->write(console, info->xmit.buf, count);
292 info->xmit.tail += count;
295 local_irq_restore(flags);
298 static void rs_flush_chars(struct tty_struct *tty)
300 struct async_struct *info = (struct async_struct *)tty->driver_data;
302 if (info->xmit.head == info->xmit.tail || tty->stopped || tty->hw_stopped ||
306 transmit_chars(info, NULL);
310 static int rs_write(struct tty_struct * tty,
311 const unsigned char *buf, int count)
314 struct async_struct *info = (struct async_struct *)tty->driver_data;
317 if (!tty || !info->xmit.buf || !tmp_buf) return 0;
319 local_irq_save(flags);
321 c = CIRC_SPACE_TO_END(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
327 memcpy(info->xmit.buf + info->xmit.head, buf, c);
328 info->xmit.head = ((info->xmit.head + c) &
329 (SERIAL_XMIT_SIZE-1));
334 local_irq_restore(flags);
336 * Hey, we transmit directly from here in our case
338 if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE)
339 && !tty->stopped && !tty->hw_stopped) {
340 transmit_chars(info, NULL);
345 static int rs_write_room(struct tty_struct *tty)
347 struct async_struct *info = (struct async_struct *)tty->driver_data;
349 return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
352 static int rs_chars_in_buffer(struct tty_struct *tty)
354 struct async_struct *info = (struct async_struct *)tty->driver_data;
356 return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
359 static void rs_flush_buffer(struct tty_struct *tty)
361 struct async_struct *info = (struct async_struct *)tty->driver_data;
364 local_irq_save(flags);
365 info->xmit.head = info->xmit.tail = 0;
366 local_irq_restore(flags);
368 wake_up_interruptible(&tty->write_wait);
370 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
371 tty->ldisc.write_wakeup)
372 (tty->ldisc.write_wakeup)(tty);
376 * This function is used to send a high-priority XON/XOFF character to
379 static void rs_send_xchar(struct tty_struct *tty, char ch)
381 struct async_struct *info = (struct async_struct *)tty->driver_data;
386 * I guess we could call console->write() directly but
387 * let's do that for now.
389 transmit_chars(info, NULL);
394 * ------------------------------------------------------------
397 * This routine is called by the upper-layer tty layer to signal that
398 * incoming characters should be throttled.
399 * ------------------------------------------------------------
401 static void rs_throttle(struct tty_struct * tty)
403 if (I_IXOFF(tty)) rs_send_xchar(tty, STOP_CHAR(tty));
405 printk(KERN_INFO "simrs_throttle called\n");
408 static void rs_unthrottle(struct tty_struct * tty)
410 struct async_struct *info = (struct async_struct *)tty->driver_data;
416 rs_send_xchar(tty, START_CHAR(tty));
418 printk(KERN_INFO "simrs_unthrottle called\n");
422 * rs_break() --- routine which turns the break handling on or off
424 static void rs_break(struct tty_struct *tty, int break_state)
428 static int rs_ioctl(struct tty_struct *tty, struct file * file,
429 unsigned int cmd, unsigned long arg)
431 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
432 (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
433 (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
434 if (tty->flags & (1 << TTY_IO_ERROR))
440 printk(KERN_INFO "rs_ioctl: TIOCMGET called\n");
445 printk(KERN_INFO "rs_ioctl: TIOCMBIS/BIC/SET called\n");
448 printk(KERN_INFO "simrs_ioctl TIOCGSERIAL called\n");
451 printk(KERN_INFO "simrs_ioctl TIOCSSERIAL called\n");
454 printk(KERN_INFO "rs_ioctl: TIOCSERCONFIG called\n");
457 case TIOCSERGETLSR: /* Get line status register */
458 printk(KERN_INFO "rs_ioctl: TIOCSERGETLSR called\n");
462 printk(KERN_INFO "rs_ioctl: TIOCSERGSTRUCT called\n");
464 if (copy_to_user((struct async_struct *) arg,
465 info, sizeof(struct async_struct)))
471 * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change
472 * - mask passed in arg for lines of interest
473 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
474 * Caller should use TIOCGICOUNT to see which one it was
477 printk(KERN_INFO "rs_ioctl: TIOCMIWAIT: called\n");
480 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
481 * Return: write counters to the user passed counter struct
482 * NB: both 1->0 and 0->1 transitions are counted except for
483 * RI where only 0->1 is counted.
486 printk(KERN_INFO "rs_ioctl: TIOCGICOUNT called\n");
491 /* "setserial -W" is called in Debian boot */
492 printk (KERN_INFO "TIOCSER?WILD ioctl obsolete, ignored.\n");
501 #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
503 static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
505 unsigned int cflag = tty->termios->c_cflag;
507 if ( (cflag == old_termios->c_cflag)
508 && ( RELEVANT_IFLAG(tty->termios->c_iflag)
509 == RELEVANT_IFLAG(old_termios->c_iflag)))
513 /* Handle turning off CRTSCTS */
514 if ((old_termios->c_cflag & CRTSCTS) &&
515 !(tty->termios->c_cflag & CRTSCTS)) {
521 * This routine will shutdown a serial port; interrupts are disabled, and
522 * DTR is dropped if the hangup on close termio flag is on.
524 static void shutdown(struct async_struct * info)
527 struct serial_state *state;
530 if (!(info->flags & ASYNC_INITIALIZED)) return;
534 #ifdef SIMSERIAL_DEBUG
535 printk("Shutting down serial port %d (irq %d)....", info->line,
539 local_irq_save(flags);
542 * First unlink the serial port from the IRQ chain...
545 info->next_port->prev_port = info->prev_port;
547 info->prev_port->next_port = info->next_port;
549 IRQ_ports[state->irq] = info->next_port;
552 * Free the IRQ, if necessary
554 if (state->irq && (!IRQ_ports[state->irq] ||
555 !IRQ_ports[state->irq]->next_port)) {
556 if (IRQ_ports[state->irq]) {
557 free_irq(state->irq, NULL);
558 retval = request_irq(state->irq, rs_interrupt_single,
559 IRQ_T(info), "serial", NULL);
562 printk(KERN_ERR "serial shutdown: request_irq: error %d"
563 " Couldn't reacquire IRQ.\n", retval);
565 free_irq(state->irq, NULL);
568 if (info->xmit.buf) {
569 free_page((unsigned long) info->xmit.buf);
573 if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags);
575 info->flags &= ~ASYNC_INITIALIZED;
577 local_irq_restore(flags);
581 * ------------------------------------------------------------
584 * This routine is called when the serial port gets closed. First, we
585 * wait for the last remaining data to be sent. Then, we unlink its
586 * async structure from the interrupt chain if necessary, and we free
587 * that IRQ if nothing is left in the chain.
588 * ------------------------------------------------------------
590 static void rs_close(struct tty_struct *tty, struct file * filp)
592 struct async_struct * info = (struct async_struct *)tty->driver_data;
593 struct serial_state *state;
600 local_irq_save(flags);
601 if (tty_hung_up_p(filp)) {
602 #ifdef SIMSERIAL_DEBUG
603 printk("rs_close: hung_up\n");
605 local_irq_restore(flags);
608 #ifdef SIMSERIAL_DEBUG
609 printk("rs_close ttys%d, count = %d\n", info->line, state->count);
611 if ((tty->count == 1) && (state->count != 1)) {
613 * Uh, oh. tty->count is 1, which means that the tty
614 * structure will be freed. state->count should always
615 * be one in these conditions. If it's greater than
616 * one, we've got real problems, since it means the
617 * serial port won't be shutdown.
619 printk(KERN_ERR "rs_close: bad serial port count; tty->count is 1, "
620 "state->count is %d\n", state->count);
623 if (--state->count < 0) {
624 printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n",
625 info->line, state->count);
629 local_irq_restore(flags);
632 info->flags |= ASYNC_CLOSING;
633 local_irq_restore(flags);
636 * Now we wait for the transmit buffer to clear; and we notify
637 * the line discipline to only process XON/XOFF characters.
640 if (tty->driver->flush_buffer) tty->driver->flush_buffer(tty);
641 if (tty->ldisc.flush_buffer) tty->ldisc.flush_buffer(tty);
644 if (info->blocked_open) {
645 if (info->close_delay) {
646 current->state = TASK_INTERRUPTIBLE;
647 schedule_timeout(info->close_delay);
649 wake_up_interruptible(&info->open_wait);
651 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
652 wake_up_interruptible(&info->close_wait);
656 * rs_wait_until_sent() --- wait until the transmitter is empty
658 static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
664 * rs_hangup() --- called by tty_hangup() when a hangup is signaled.
666 static void rs_hangup(struct tty_struct *tty)
668 struct async_struct * info = (struct async_struct *)tty->driver_data;
669 struct serial_state *state = info->state;
671 #ifdef SIMSERIAL_DEBUG
672 printk("rs_hangup: called\n");
677 rs_flush_buffer(tty);
678 if (info->flags & ASYNC_CLOSING)
684 info->flags &= ~ASYNC_NORMAL_ACTIVE;
686 wake_up_interruptible(&info->open_wait);
690 static int get_async_struct(int line, struct async_struct **ret_info)
692 struct async_struct *info;
693 struct serial_state *sstate;
695 sstate = rs_table + line;
698 *ret_info = sstate->info;
701 info = kmalloc(sizeof(struct async_struct), GFP_KERNEL);
706 memset(info, 0, sizeof(struct async_struct));
707 init_waitqueue_head(&info->open_wait);
708 init_waitqueue_head(&info->close_wait);
709 init_waitqueue_head(&info->delta_msr_wait);
710 info->magic = SERIAL_MAGIC;
711 info->port = sstate->port;
712 info->flags = sstate->flags;
713 info->xmit_fifo_size = sstate->xmit_fifo_size;
715 INIT_WORK(&info->work, do_softint, info);
716 info->state = sstate;
719 *ret_info = sstate->info;
722 *ret_info = sstate->info = info;
727 startup(struct async_struct *info)
731 irqreturn_t (*handler)(int, void *, struct pt_regs *);
732 struct serial_state *state= info->state;
735 page = get_zeroed_page(GFP_KERNEL);
739 local_irq_save(flags);
741 if (info->flags & ASYNC_INITIALIZED) {
746 if (!state->port || !state->type) {
747 if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags);
754 info->xmit.buf = (unsigned char *) page;
756 #ifdef SIMSERIAL_DEBUG
757 printk("startup: ttys%d (irq %d)...", info->line, state->irq);
761 * Allocate the IRQ if necessary
763 if (state->irq && (!IRQ_ports[state->irq] ||
764 !IRQ_ports[state->irq]->next_port)) {
765 if (IRQ_ports[state->irq]) {
769 handler = rs_interrupt_single;
771 retval = request_irq(state->irq, handler, IRQ_T(info), "simserial", NULL);
773 if (capable(CAP_SYS_ADMIN)) {
775 set_bit(TTY_IO_ERROR,
784 * Insert serial port into IRQ chain.
787 info->next_port = IRQ_ports[state->irq];
789 info->next_port->prev_port = info;
790 IRQ_ports[state->irq] = info;
792 if (info->tty) clear_bit(TTY_IO_ERROR, &info->tty->flags);
794 info->xmit.head = info->xmit.tail = 0;
798 * Set up serial timers...
800 timer_table[RS_TIMER].expires = jiffies + 2*HZ/100;
801 timer_active |= 1 << RS_TIMER;
805 * Set up the tty->alt_speed kludge
808 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
809 info->tty->alt_speed = 57600;
810 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
811 info->tty->alt_speed = 115200;
812 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
813 info->tty->alt_speed = 230400;
814 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
815 info->tty->alt_speed = 460800;
818 info->flags |= ASYNC_INITIALIZED;
819 local_irq_restore(flags);
823 local_irq_restore(flags);
829 * This routine is called whenever a serial port is opened. It
830 * enables interrupts for a serial port, linking in its async structure into
831 * the IRQ chain. It also performs the serial-specific
832 * initialization for the tty structure.
834 static int rs_open(struct tty_struct *tty, struct file * filp)
836 struct async_struct *info;
841 if ((line < 0) || (line >= NR_PORTS))
843 retval = get_async_struct(line, &info);
846 tty->driver_data = info;
849 #ifdef SIMSERIAL_DEBUG
850 printk("rs_open %s, count = %d\n", tty->name, info->state->count);
852 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
855 page = get_zeroed_page(GFP_KERNEL);
861 tmp_buf = (unsigned char *) page;
865 * If the port is the middle of closing, bail out now
867 if (tty_hung_up_p(filp) ||
868 (info->flags & ASYNC_CLOSING)) {
869 if (info->flags & ASYNC_CLOSING)
870 interruptible_sleep_on(&info->close_wait);
871 #ifdef SERIAL_DO_RESTART
872 return ((info->flags & ASYNC_HUP_NOTIFY) ?
873 -EAGAIN : -ERESTARTSYS);
880 * Start up serial port
882 retval = startup(info);
888 * figure out which console to use (should be one already)
890 console = console_drivers;
892 if ((console->flags & CON_ENABLED) && console->write) break;
893 console = console->next;
896 #ifdef SIMSERIAL_DEBUG
897 printk("rs_open ttys%d successful\n", info->line);
903 * /proc fs routines....
906 static inline int line_info(char *buf, struct serial_state *state)
908 return sprintf(buf, "%d: uart:%s port:%lX irq:%d\n",
909 state->line, uart_config[state->type].name,
910 state->port, state->irq);
913 static int rs_read_proc(char *page, char **start, off_t off, int count,
914 int *eof, void *data)
919 len += sprintf(page, "simserinfo:1.0 driver:%s\n", serial_version);
920 for (i = 0; i < NR_PORTS && len < 4000; i++) {
921 l = line_info(page + len, &rs_table[i]);
923 if (len+begin > off+count)
925 if (len+begin < off) {
932 if (off >= len+begin)
934 *start = page + (begin-off);
935 return ((count < begin+len-off) ? count : begin+len-off);
939 * ---------------------------------------------------------------------
940 * rs_init() and friends
942 * rs_init() is called at boot-time to initialize the serial driver.
943 * ---------------------------------------------------------------------
947 * This routine prints out the appropriate serial driver version
948 * number, and identifies which options were configured into this
951 static inline void show_serial_version(void)
953 printk(KERN_INFO "%s version %s with", serial_name, serial_version);
954 printk(KERN_INFO " no serial options enabled\n");
957 static struct tty_operations hp_ops = {
961 .put_char = rs_put_char,
962 .flush_chars = rs_flush_chars,
963 .write_room = rs_write_room,
964 .chars_in_buffer = rs_chars_in_buffer,
965 .flush_buffer = rs_flush_buffer,
967 .throttle = rs_throttle,
968 .unthrottle = rs_unthrottle,
969 .send_xchar = rs_send_xchar,
970 .set_termios = rs_set_termios,
974 .break_ctl = rs_break,
975 .wait_until_sent = rs_wait_until_sent,
976 .read_proc = rs_read_proc,
980 * The serial driver boot-time initialization code!
986 struct serial_state *state;
988 if (!ia64_platform_is("hpsim"))
991 hp_simserial_driver = alloc_tty_driver(1);
992 if (!hp_simserial_driver)
995 show_serial_version();
997 /* Initialize the tty_driver structure */
999 hp_simserial_driver->owner = THIS_MODULE;
1000 hp_simserial_driver->driver_name = "simserial";
1001 hp_simserial_driver->name = "ttyS";
1002 hp_simserial_driver->major = TTY_MAJOR;
1003 hp_simserial_driver->minor_start = 64;
1004 hp_simserial_driver->type = TTY_DRIVER_TYPE_SERIAL;
1005 hp_simserial_driver->subtype = SERIAL_TYPE_NORMAL;
1006 hp_simserial_driver->init_termios = tty_std_termios;
1007 hp_simserial_driver->init_termios.c_cflag =
1008 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1009 hp_simserial_driver->flags = TTY_DRIVER_REAL_RAW;
1010 tty_set_operations(hp_simserial_driver, &hp_ops);
1013 * Let's have a little bit of fun !
1015 for (i = 0, state = rs_table; i < NR_PORTS; i++,state++) {
1017 if (state->type == PORT_UNKNOWN) continue;
1020 if ((rc = assign_irq_vector(AUTO_ASSIGN)) < 0)
1021 panic("%s: out of interrupt vectors!\n",
1024 ia64_ssc_connect_irq(KEYBOARD_INTR, state->irq);
1027 printk(KERN_INFO "ttyS%d at 0x%04lx (irq = %d) is a %s\n",
1029 state->port, state->irq,
1030 uart_config[state->type].name);
1033 if (tty_register_driver(hp_simserial_driver))
1034 panic("Couldn't register simserial driver\n");
1040 __initcall(simrs_init);