Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

vacserial.c File Reference

#include <linux/config.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/serial.h>
#include <linux/major.h>
#include <linux/string.h>
#include <linux/fcntl.h>
#include <linux/ptrace.h>
#include <linux/ioport.h>
#include <linux/mm.h>
#include <linux/malloc.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
#include <asm/serial.h>
#include <asm/baget/baget.h>

Include dependency graph for vacserial.c:

Go to the source code of this file.

Defines

#define CONFIG_SERIAL_NOPAUSE_IO
#define SERIAL_DO_RESTART
#define CONFIG_SERIAL_SHARE_IRQ
#define RS_STROBE_TIME   (10*HZ)
#define RS_ISR_PASS_LIMIT   2
#define IRQ_T(info)   ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT)
#define SERIAL_INLINE
#define DBG_CNT(s)
#define QUAD_UART_SPEED
#define BAGET_VAC_UART_IRQ   0x35
#define _INLINE_   inline
#define WAKEUP_CHARS   256
#define VAC_UART_TYPE   1
#define NR_PORTS   (sizeof(rs_table)/sizeof(struct serial_state))
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define VAC_UART_MODE   0
#define VAC_UART_TX   1
#define VAC_UART_RX   2
#define VAC_UART_INT_MASK   3
#define VAC_UART_INT_STATUS   4
#define VAC_UART_REG_NR   5
#define VAC_INT_CTRL_UART_ENABLE   (VAC_INT_CTRL_TIMER_PIO10|VAC_INT_CTRL_UART_B_PIO7|VAC_INT_CTRL_UART_A_PIO7)
#define VAC_INT_CTRL_UART_DISABLE(info)
#define rs_interrupt_single   rs_interrupt
#define RELEVANT_IFLAG(iflag)   (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
#define SERIAL_OPT

Functions

static DECLARE_TASK_QUEUE (tq_serial)
static void autoconfig (struct serial_state *info)
static void change_speed (struct async_struct *info)
static void rs_wait_until_sent (struct tty_struct *tty, int timeout)
static int serial_paranoia_check (struct async_struct *info, kdev_t device, const char *routine)
static int uart_offset_map (unsigned long port, int reg_index)
static unsigned int serial_inw (struct async_struct *info, int offset)
static unsigned int serial_inp (struct async_struct *info, int offset)
static unsigned int serial_in (struct async_struct *info, int offset)
static void serial_outw (struct async_struct *info, int offset, int value)
static void serial_outp (struct async_struct *info, int offset, int value)
static void serial_out (struct async_struct *info, int offset, int value)
static void rs_stop (struct tty_struct *tty)
static void rs_start (struct tty_struct *tty)
static _INLINE_ void rs_sched_event (struct async_struct *info, int event)
static _INLINE_ void receive_chars (struct async_struct *info, int *status)
static _INLINE_ void transmit_chars (struct async_struct *info, int *intr_done)
static _INLINE_ void check_modem_status (struct async_struct *info)
static void intr_begin (struct async_struct *info)
static void intr_end (struct async_struct *info)
static void rs_interrupt (int irq, void *dev_id, struct pt_regs *regs)
static void do_serial_bh (void)
static void do_softint (void *private_)
static void figure_IRQ_timeout (int irq)
static int startup (struct async_struct *info)
static void shutdown (struct async_struct *info)
static unsigned short vac_uart_mode_fixup (unsigned short cval)
static void rs_put_char (struct tty_struct *tty, unsigned char ch)
static void rs_flush_chars (struct tty_struct *tty)
static int rs_write (struct tty_struct *tty, int from_user, const unsigned char *buf, int count)
static int rs_write_room (struct tty_struct *tty)
static int rs_chars_in_buffer (struct tty_struct *tty)
static void rs_flush_buffer (struct tty_struct *tty)
static void rs_send_xchar (struct tty_struct *tty, char ch)
static void rs_throttle (struct tty_struct *tty)
static void rs_unthrottle (struct tty_struct *tty)
static int get_serial_info (struct async_struct *info, struct serial_struct *retinfo)
static int set_serial_info (struct async_struct *info, struct serial_struct *new_info)
static int get_lsr_info (struct async_struct *info, unsigned int *value)
static int get_modem_info (struct async_struct *info, unsigned int *value)
static int set_modem_info (struct async_struct *info, unsigned int cmd, unsigned int *value)
static int do_autoconfig (struct async_struct *info)
static void rs_break (struct tty_struct *tty, int break_state)
static int rs_ioctl (struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
static void rs_set_termios (struct tty_struct *tty, struct termios *old_termios)
static void rs_close (struct tty_struct *tty, struct file *filp)
static void rs_hangup (struct tty_struct *tty)
static int block_til_ready (struct tty_struct *tty, struct file *filp, struct async_struct *info)
static int get_async_struct (int line, struct async_struct **ret_info)
static int rs_open (struct tty_struct *tty, struct file *filp)
static int line_info (char *buf, struct serial_state *state)
int rs_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data)
static _INLINE_ void show_serial_version (void)
int register_serial (struct serial_struct *req)
void unregister_serial (int line)
 EXPORT_SYMBOL (register_serial)
 EXPORT_SYMBOL (unregister_serial)
static void rs_timer (void)
 __initfunc (int rs_init(void))

Variables

static char * serial_name = "VAC Serial driver"
static char * serial_version = "4.26"
static struct tty_driver serial_driver callout_driver
static int serial_refcount
static struct async_structIRQ_ports [NR_IRQS]
static int IRQ_timeout [NR_IRQS]
static struct serial_uart_config uart_config []
static struct serial_state rs_table []
static struct tty_struct * serial_table [NR_PORTS]
static struct termiosserial_termios [NR_PORTS]
static struct termiosserial_termios_locked [NR_PORTS]
static unsigned char * tmp_buf
static struct semaphore tmp_buf_sem = MUTEX


Define Documentation

#define _INLINE_   inline
 

Definition at line 89 of file vacserial.c.

#define BAGET_VAC_UART_IRQ   0x35
 

Definition at line 73 of file vacserial.c.

#define CONFIG_SERIAL_NOPAUSE_IO
 

Definition at line 10 of file vacserial.c.

#define CONFIG_SERIAL_SHARE_IRQ
 

Definition at line 13 of file vacserial.c.

#define DBG_CNT s   ) 
 

Definition at line 33 of file vacserial.c.

Referenced by ip2_close(), rs_8xx_close(), rs_close(), and su_close().

#define IRQ_T info   )     ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT)
 

Definition at line 25 of file vacserial.c.

Referenced by mxser_initbrd(), shutdown(), and startup().

#define MIN a,
 )     ((a) < (b) ? (a) : (b))
 

Definition at line 147 of file vacserial.c.

#define NR_PORTS   (sizeof(rs_table)/sizeof(struct serial_state))
 

Definition at line 140 of file vacserial.c.

Referenced by __initfunc(), cd2401_tx_interrupt(), cy_open(), esp_open(), m68k_register_serial(), m68k_rs_init(), register_serial(), rs_8xx_open(), rs_8xx_read_proc(), rs_open(), rs_read_proc(), sab82532_open(), serial167_init(), serial_paranoia_check(), set_serial_info(), and uart_offset_map().

#define QUAD_UART_SPEED
 

Definition at line 36 of file vacserial.c.

#define RELEVANT_IFLAG iflag   )     (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
 

Referenced by edge_set_termios(), ir_set_termios(), ircomm_tty_set_termios(), mgsl_set_termios(), mxser_set_termios(), pl2303_set_termios(), rs_8xx_set_termios(), rs_set_termios(), sab82532_set_termios(), su_set_termios(), visor_set_termios(), and whiteheat_set_termios().

#define rs_interrupt_single   rs_interrupt
 

Definition at line 567 of file vacserial.c.

Referenced by rs_timer(), shutdown(), and startup().

#define RS_ISR_PASS_LIMIT   2
 

Definition at line 23 of file vacserial.c.

Referenced by rs_interrupt(), rs_interrupt_elsa(), rs_interrupt_single(), and su_serial_interrupt().

#define RS_STROBE_TIME   (10*HZ)
 

Definition at line 22 of file vacserial.c.

Referenced by rs_timer().

#define SERIAL_DO_RESTART
 

Definition at line 11 of file vacserial.c.

#define SERIAL_INLINE
 

Definition at line 27 of file vacserial.c.

#define SERIAL_OPT
 

#define VAC_INT_CTRL_UART_DISABLE info   ) 
 

Value:

Definition at line 476 of file vacserial.c.

Referenced by intr_end().

#define VAC_INT_CTRL_UART_ENABLE   (VAC_INT_CTRL_TIMER_PIO10|VAC_INT_CTRL_UART_B_PIO7|VAC_INT_CTRL_UART_A_PIO7)
 

Definition at line 473 of file vacserial.c.

Referenced by intr_end().

#define VAC_UART_INT_MASK   3
 

Definition at line 191 of file vacserial.c.

Referenced by autoconfig(), change_speed(), intr_begin(), intr_end(), rs_close(), rs_flush_chars(), rs_send_xchar(), rs_start(), rs_stop(), rs_timer(), rs_write(), shutdown(), startup(), and transmit_chars().

#define VAC_UART_INT_STATUS   4
 

Definition at line 192 of file vacserial.c.

Referenced by get_lsr_info(), receive_chars(), rs_interrupt(), rs_wait_until_sent(), and startup().

#define VAC_UART_MODE   0
 

Definition at line 188 of file vacserial.c.

Referenced by change_speed(), rs_break(), shutdown(), and startup().

#define VAC_UART_REG_NR   5
 

Definition at line 194 of file vacserial.c.

Referenced by uart_offset_map().

#define VAC_UART_RX   2
 

Definition at line 190 of file vacserial.c.

Referenced by autoconfig(), receive_chars(), and startup().

#define VAC_UART_TX   1
 

Definition at line 189 of file vacserial.c.

Referenced by transmit_chars().

#define VAC_UART_TYPE   1
 

Definition at line 126 of file vacserial.c.

Referenced by autoconfig().

#define WAKEUP_CHARS   256
 

Definition at line 101 of file vacserial.c.

Referenced by cd2401_tx_interrupt(), cyy_interrupt(), cyz_handle_tx(), hpdca_ser_interrupt(), isicom_tx(), mgsl_isr_transmit_data(), moxa_poll(), mxser_transmit_chars(), normal_poll(), rp_do_transmit(), rp_write(), ser_interrupt(), transmit_chars(), transmit_chars_dma(), and transmit_chars_pio().


Function Documentation

__initfunc int   rs_init(void)  ) 
 

Definition at line 2305 of file vacserial.c.

References ASYNC_BOOT_AUTOCONF, ASYNC_FOURPORT, autoconfig(), B9600, tty_driver::break_ctl, async_icount::brk, termios::c_cflag, serial_state::callout_termios, tty_driver::chars_in_buffer, check_region, CLOCAL, tty_driver::close, serial_state::close_delay, serial_state::closing_wait, CON_CONSDEV, CREAD, CS8, async_icount::cts, serial_state::custom_divisor, async_icount::dcd, do_serial_bh(), tty_driver::driver_name, async_icount::dsr, timer_struct::expires, serial_state::flags, tty_driver::flags, console::flags, tty_driver::flush_buffer, tty_driver::flush_chars, timer_struct::fn, async_icount::frame, tty_driver::hangup, HUPCL, HZ, i, serial_state::icount, console::index, init_bh(), tty_driver::init_termios, tty_driver::ioctl, serial_state::irq, irq_cannonicalize, IRQ_timeout, KERN_INFO, serial_state::line, serial_state::magic, tty_driver::magic, tty_driver::major, memset, tty_driver::minor_start, tty_driver::name, serial_state::normal_termios, NR_IRQS, NR_PORTS, tty_driver::num, tty_driver::open, async_icount::overrun, panic(), async_icount::parity, serial_state::port, PORT_UNKNOWN, printk, tty_driver::proc_entry, tty_driver::put_char, tty_driver::read_proc, tty_driver::refcount, async_icount::rng, rs_break(), rs_chars_in_buffer(), rs_close(), rs_flush_buffer(), rs_flush_chars(), rs_hangup(), rs_ioctl(), rs_open(), rs_put_char(), rs_read_proc(), rs_send_xchar(), rs_set_termios(), rs_start(), rs_stop(), rs_throttle(), rs_timer(), RS_TIMER, rs_unthrottle(), rs_wait_until_sent(), rs_write(), rs_write_room(), async_icount::rx, tty_driver::send_xchar, SERIAL_BH, serial_refcount, serial_table, SERIAL_TYPE_CALLOUT, SERIAL_TYPE_NORMAL, tty_driver::set_termios, show_serial_version(), SSTATE_MAGIC, tty_driver::start, state, tty_driver::stop, tty_driver::subtype, tty_driver::table, tty_driver::termios, tty_driver::termios_locked, tty_driver::throttle, timer_table, TTY_DRIVER_MAGIC, TTY_DRIVER_REAL_RAW, TTY_DRIVER_TYPE_SERIAL, TTY_MAJOR, tty_register_driver(), tty_std_termios, TTYAUX_MAJOR, async_icount::tx, serial_state::type, tty_driver::type, tty_driver::unthrottle, tty_driver::wait_until_sent, tty_driver::write, and tty_driver::write_room.

Here is the call graph for this function:

static void autoconfig struct serial_state info  )  [static]
 

Definition at line 2213 of file vacserial.c.

References cli, serial_uart_config::dfl_xmit_fifo_size, serial_state::flags, async_struct::flags, async_struct::magic, serial_state::port, async_struct::port, restore_flags, save_flags, serial_in, SERIAL_MAGIC, serial_outp, serial_state::type, VAC_UART_INT_MASK, VAC_UART_RX, VAC_UART_TYPE, and serial_state::xmit_fifo_size.

Referenced by __initfunc(), do_autoconfig(), m68k_register_serial(), and register_serial().

static int block_til_ready struct tty_struct *  tty,
struct file filp,
struct async_struct info
[static]
 

Definition at line 1821 of file vacserial.c.

References ASYNC_CALLOUT_ACTIVE, ASYNC_CLOSING, ASYNC_HUP_NOTIFY, ASYNC_INITIALIZED, ASYNC_NORMAL_ACTIVE, ASYNC_PGRP_LOCKOUT, ASYNC_SESSION_LOCKOUT, baget_printk(), async_struct::blocked_open, termios::c_cflag, cli, CLOCAL, async_struct::close_wait, serial_state::count, current, EAGAIN, EBUSY, ERESTARTSYS, async_struct::flags, interruptible_sleep_on(), async_struct::line, serial_state::line, serial_state::normal_termios, NULL, O_NONBLOCK, async_struct::open_wait, async_struct::pgrp, restore_flags, save_flags, schedule(), SERIAL_TYPE_CALLOUT, async_struct::session, signal_pending, async_struct::state, state, TASK_INTERRUPTIBLE, TASK_RUNNING, and tty_hung_up_p().

Referenced by aurora_open(), cy_open(), dz_open(), esp_open(), isicom_open(), mgsl_open(), pc_open(), rc_open(), rp_open(), rs_8xx_open(), rs_open(), sab82532_open(), su_open(), sx_open(), and zs_open().

Here is the call graph for this function:

static void change_speed struct async_struct info  )  [static]
 

Definition at line 882 of file vacserial.c.

References ASYNC_SPD_CUST, ASYNC_SPD_MASK, baud, serial_state::baud_base, cli, CREAD, CS5, CS6, CS7, CS8, CSIZE, serial_state::custom_divisor, async_struct::flags, HZ, PARENB, PARODD, async_struct::port, port, async_struct::quot, restore_flags, save_flags, serial_out, serial_outp, async_struct::state, async_struct::timeout, async_struct::tty, tty_get_baud_rate(), VAC_UART_INT_MASK, VAC_UART_MODE, VAC_UART_MODE_8BIT_CHAR, VAC_UART_MODE_BAUD, vac_uart_mode_fixup(), VAC_UART_MODE_PARITY_ENABLE, VAC_UART_MODE_PARITY_ODD, VAC_UART_STATUS_RX_BREAK_CHANGE, VAC_UART_STATUS_RX_ERR_FRAME, VAC_UART_STATUS_RX_ERR_OVERRUN, VAC_UART_STATUS_RX_ERR_PARITY, VAC_UART_STATUS_RX_READY, VAC_UART_STATUS_TX_EMPTY, and async_struct::xmit_fifo_size.

Referenced by aurora_set_serial_info(), dz_open(), dz_set_termios(), esp_open(), mstartup(), rc_set_serial_info(), rs_8xx_open(), rs_8xx_set_termios(), rs_open(), rs_set_termios(), sab82532_open(), sab82532_set_termios(), set_serial_info(), setup_scc(), startup(), su_change_mouse_baud(), su_open(), su_set_termios(), sx_set_serial_info(), zs_open(), and zs_set_termios().

Here is the call graph for this function:

static _INLINE_ void check_modem_status struct async_struct info  )  [static]
 

Definition at line 458 of file vacserial.c.

References async_struct::open_wait, RS_EVENT_WRITE_WAKEUP, and rs_sched_event().

Referenced by rs_8xx_interrupt(), rs_interrupt(), rs_interrupt_single(), ser_vbl_int(), and su_serial_interrupt().

Here is the call graph for this function:

static DECLARE_TASK_QUEUE tq_serial   )  [static]
 

static int do_autoconfig struct async_struct info  )  [static]
 

Definition at line 1428 of file vacserial.c.

References autoconfig(), CAP_SYS_ADMIN, capable, EBUSY, EPERM, shutdown(), and startup().

Referenced by rs_ioctl().

Here is the call graph for this function:

static void do_serial_bh void   )  [static]
 

Definition at line 585 of file vacserial.c.

References run_task_queue().

Referenced by __initfunc(), m68k_rs_init(), macserial_init(), and rs_init().

Here is the call graph for this function:

static void do_softint void *  private_  )  [static]
 

Definition at line 590 of file vacserial.c.

References async_struct::event, RS_EVENT_WRITE_WAKEUP, test_and_clear_bit, async_struct::tty, and tty.

Referenced by __initfunc(), aurora_init_drivers(), get_async_struct(), m68k_rs_init(), macserial_init(), post_fep_init(), rc_init_drivers(), rs_init(), serial167_init(), and sx_init_drivers().

EXPORT_SYMBOL unregister_serial   ) 
 

EXPORT_SYMBOL register_serial   ) 
 

static void figure_IRQ_timeout int  irq  )  [static]
 

Definition at line 621 of file vacserial.c.

References HZ, IRQ_timeout, and timeout.

Referenced by shutdown(), and startup().

static int get_async_struct int  line,
struct async_struct **  ret_info
[static]
 

Definition at line 1947 of file vacserial.c.

References serial_state::count, do_softint(), ENOMEM, serial_state::flags, serial_state::info, kfree_s(), kmalloc(), memset, serial_state::port, SERIAL_MAGIC, and serial_state::xmit_fifo_size.

Referenced by rs_8xx_open(), and rs_open().

Here is the call graph for this function:

static int get_lsr_info struct async_struct info,
unsigned int *  value
[static]
 

Definition at line 1390 of file vacserial.c.

References cli, put_user, restore_flags, result, save_flags, serial_inw(), status, TIOCSER_TEMT, VAC_UART_INT_STATUS, and VAC_UART_STATUS_TX_EMPTY.

Referenced by cy_ioctl(), dz_ioctl(), edge_ioctl(), rs_8xx_ioctl(), rs_ioctl(), sab82532_ioctl(), su_ioctl(), and zs_ioctl().

Here is the call graph for this function:

static int get_modem_info struct async_struct info,
unsigned int *  value
[static]
 

Definition at line 1404 of file vacserial.c.

References put_user, result, TIOCM_CAR, and TIOCM_DSR.

Referenced by cy_ioctl(), edge_ioctl(), mgsl_ioctl_common(), pl2303_ioctl(), rp_ioctl(), rs_8xx_ioctl(), rs_ioctl(), sab82532_ioctl(), su_ioctl(), and zs_ioctl().

static int get_serial_info struct async_struct info,
struct serial_struct retinfo
[static]
 

Definition at line 1239 of file vacserial.c.

References serial_state::baud_base, serial_state::close_delay, serial_state::closing_wait, copy_to_user, serial_state::custom_divisor, EFAULT, serial_state::flags, serial_state::hub6, serial_state::irq, serial_state::line, memset, serial_state::port, async_struct::state, state, serial_state::type, and serial_state::xmit_fifo_size.

Referenced by cy_ioctl(), dz_ioctl(), edge_ioctl(), ip2_ioctl(), ip2_ipl_ioctl(), rs_ioctl(), sab82532_ioctl(), su_ioctl(), and zs_ioctl().

static void intr_begin struct async_struct info  )  [static]
 

Definition at line 486 of file vacserial.c.

References serial_outw(), and VAC_UART_INT_MASK.

Referenced by rs_interrupt().

Here is the call graph for this function:

static void intr_end struct async_struct info  )  [static]
 

Definition at line 491 of file vacserial.c.

References async_struct::IER, serial_outw(), VAC_INT_CTRL, VAC_INT_CTRL_UART_DISABLE, VAC_INT_CTRL_UART_ENABLE, vac_outw, and VAC_UART_INT_MASK.

Referenced by rs_interrupt().

Here is the call graph for this function:

static int line_info char *  buf,
struct serial_state state
[inline, static]
 

Definition at line 2094 of file vacserial.c.

References serial_state::baud_base, async_icount::brk, serial_state::flags, async_struct::flags, async_icount::frame, serial_state::icount, serial_state::info, serial_state::irq, serial_state::line, async_struct::magic, async_icount::overrun, async_icount::parity, async_struct::port, serial_state::port, PORT_UNKNOWN, async_struct::quot, ret, async_icount::rx, SERIAL_MAGIC, sprintf(), async_struct::tty, async_icount::tx, and serial_state::type.

Referenced by mgsl_read_proc(), rs_8xx_read_proc(), rs_read_proc(), sab82532_read_proc(), and su_read_proc().

Here is the call graph for this function:

static _INLINE_ void receive_chars struct async_struct info,
int *  status
[static]
 

Definition at line 326 of file vacserial.c.

References ASYNC_SAK, baget_printk(), async_icount::brk, do_SAK(), async_struct::flags, async_icount::frame, serial_state::icount, async_struct::ignore_status_mask, ignored, async_icount::overrun, async_icount::parity, async_struct::read_status_mask, async_icount::rx, rx, serial_inw(), async_struct::state, async_struct::tty, tty, tty_flip_buffer_push, VAC_UART_INT_STATUS, VAC_UART_RX, VAC_UART_RX_DATA_MASK, VAC_UART_STATUS_RX_BREAK_CHANGE, VAC_UART_STATUS_RX_ERR_FRAME, VAC_UART_STATUS_RX_ERR_OVERRUN, VAC_UART_STATUS_RX_ERR_PARITY, and VAC_UART_STATUS_RX_READY.

Referenced by dz_interrupt(), mac_SCC_interrupt(), rs_8xx_interrupt(), rs_interrupt(), rs_interrupt_elsa(), rs_interrupt_single(), sab82532_interrupt(), and zs_interrupt().

Here is the call graph for this function:

int register_serial struct serial_struct req  ) 
 

Definition at line 2448 of file vacserial.c.

References autoconfig(), cli, count, serial_struct::flags,