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

su.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/interrupt.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/serial.h>
#include <linux/serial_reg.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 <linux/sysrq.h>
#include <asm/system.h>
#include <asm/oplib.h>
#include <asm/io.h>
#include <asm/ebus.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
#include "sunserial.h"
#include "sunkbd.h"
#include "sunmouse.h"

Include dependency graph for su.c:

Go to the source code of this file.

Defines

#define SERIAL_PARANOIA_CHECK
#define CONFIG_SERIAL_NOPAUSE_IO
#define SERIAL_DO_RESTART
#define RS_ISR_PASS_LIMIT   256
#define IRQ_4M(n)   ((n)|0x20)
#define DBG_CNT(s)
#define BAUD_BASE   (1846200 / 16)
#define SU_PROPSIZE   128
#define WAKEUP_CHARS   256
#define NR_PORTS   4
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define serial_in(info, off)   su_inb(info, off)
#define serial_inp(info, off)   su_inb(info, off)
#define serial_out(info, off, val)   su_outb(info, off, val)
#define serial_outp(info, off, val)   su_outb(info, off, val)
#define RELEVANT_IFLAG(iflag)   (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))

Enumerations

enum  su_type { SU_PORT_NONE, SU_PORT_MS, SU_PORT_KBD, SU_PORT_PORT }

Functions

static DECLARE_TASK_QUEUE (tq_serial)
static void autoconfig (struct su_struct *info)
static void change_speed (struct su_struct *info, struct termios *old)
static void su_wait_until_sent (struct tty_struct *tty, int timeout)
static int serial_paranoia_check (struct su_struct *info, kdev_t device, const char *routine)
static unsigned int su_inb (struct su_struct *info, unsigned long offset)
static void su_outb (struct su_struct *info, unsigned long offset, int value)
static void su_stop (struct tty_struct *tty)
static void su_start (struct tty_struct *tty)
static __inline__ void su_sched_event (struct su_struct *info, int event)
static __inline__ void receive_kbd_ms_chars (struct su_struct *info, struct pt_regs *regs, int is_brk)
static __inline__ void receive_serial_chars (struct su_struct *info, int *status, struct pt_regs *regs)
static __inline__ void transmit_chars (struct su_struct *info, int *intr_done)
static __inline__ void check_modem_status (struct su_struct *info)
static void su_kbd_ms_interrupt (int irq, void *dev_id, struct pt_regs *regs)
static void su_serial_interrupt (int irq, void *dev_id, struct pt_regs *regs)
static void do_serial_bh (void)
static void do_softint (void *private_)
static int startup (struct su_struct *info)
static void shutdown (struct su_struct *info)
static __inline__ int su_get_baud_rate (struct su_struct *info)
static void su_put_char (struct tty_struct *tty, unsigned char ch)
static void su_put_char_kbd (unsigned char c)
static void su_change_mouse_baud (int baud)
static void su_flush_chars (struct tty_struct *tty)
static int su_write (struct tty_struct *tty, int from_user, const unsigned char *buf, int count)
static int su_write_room (struct tty_struct *tty)
static int su_chars_in_buffer (struct tty_struct *tty)
static void su_flush_buffer (struct tty_struct *tty)
static void su_send_xchar (struct tty_struct *tty, char ch)
static void su_throttle (struct tty_struct *tty)
static void su_unthrottle (struct tty_struct *tty)
static int get_serial_info (struct su_struct *info, struct serial_struct *retinfo)
static int get_lsr_info (struct su_struct *info, unsigned int *value)
static int get_modem_info (struct su_struct *info, unsigned int *value)
static int set_modem_info (struct su_struct *info, unsigned int cmd, unsigned int *value)
static void su_break (struct tty_struct *tty, int break_state)
static int su_ioctl (struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
static void su_set_termios (struct tty_struct *tty, struct termios *old_termios)
static void su_close (struct tty_struct *tty, struct file *filp)
static void su_hangup (struct tty_struct *tty)
static int block_til_ready (struct tty_struct *tty, struct file *filp, struct su_struct *info)
static int su_open (struct tty_struct *tty, struct file *filp)
static __inline__ int line_info (char *buf, struct su_struct *info)
int su_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data)
 __initfunc (static __inline__ void show_su_version(void))
 __initfunc (int su_serial_init(void))
 __initfunc (void su_probe_any(struct su_probe_scan *t, int sunode))
 __initfunc (int su_probe(unsigned long *memory_start))

Variables

static char * su_typev [] = { "???", "mouse", "kbd", "serial" }
static char * serial_name = "PCIO serial driver"
static char serial_version [16]
static struct tty_driver serial_driver callout_driver
static int serial_refcount
static struct serial_uart_config uart_config []
static struct su_struct su_table [NR_PORTS]
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
int su_num_ports = 0


Define Documentation

#define BAUD_BASE   (1846200 / 16)
 

Definition at line 87 of file su.c.

Referenced by __initfunc().

#define CONFIG_SERIAL_NOPAUSE_IO
 

Definition at line 15 of file su.c.

#define DBG_CNT s   ) 
 

Definition at line 42 of file su.c.

#define IRQ_4M n   )     ((n)|0x20)
 

Definition at line 32 of file su.c.

Referenced by autoconfig().

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

Definition at line 207 of file su.c.

#define NR_PORTS   4
 

Definition at line 199 of file su.c.

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

#define RS_ISR_PASS_LIMIT   256
 

Definition at line 26 of file su.c.

#define SERIAL_DO_RESTART
 

Definition at line 16 of file su.c.

#define serial_in info,
off   )     su_inb(info, off)
 

Definition at line 266 of file su.c.

Referenced by autoconfig(), block_til_ready(), check_modem_status(), get_lsr_info(), get_modem_info(), kgdb_init(), line_info(), receive_chars(), receive_chars_pio(), rs_interrupt_single(), rs_wait_until_sent(), shutdown(), startup(), su_kbd_ms_interrupt(), su_put_char_kbd(), su_serial_interrupt(), and transmit_chars_pio().

#define serial_inp info,
off   )     su_inb(info, off)
 

Definition at line 267 of file su.c.

Referenced by autoconfig(), block_til_ready(), change_speed(), detect_uart_irq(), elsa_interrupt(), elsa_interrupt_ipac(), mshutdown(), mstartup(), receive_chars(), receive_kbd_ms_chars(), receive_serial_chars(), rs_break(), rs_interrupt_elsa(), rs_interrupt_single(), rs_wait_until_sent(), shutdown(), startup(), su_break(), su_kbd_ms_interrupt(), su_serial_interrupt(), and su_wait_until_sent().

#define serial_out info,
off,
val   )     su_outb(info, off, val)
 

Definition at line 268 of file su.c.

Referenced by autoconfig(), block_til_ready(), change_speed(), check_modem_status(), esp_basic_init(), esp_break(), get_lsr_info(), get_modem_info(), kgdb_init(), receive_chars_dma(), rs_8xx_set_termios(), rs_8xx_throttle(), rs_8xx_unthrottle(), rs_break(), rs_close(), rs_flush_chars(), rs_interrupt_single(), rs_send_xchar(), rs_set_termios(), rs_start(), rs_stop(), rs_throttle(), rs_timer(), rs_unthrottle(), rs_wait_until_sent(), rs_write(), set_esp_config(), set_modem_info(), set_serial_info(), shutdown(), startup(), su_break(), su_close(), su_flush_chars(), su_send_xchar(), su_set_termios(), su_start(), su_stop(), su_throttle(), su_unthrottle(), su_write(), transmit_chars(), transmit_chars_dma(), transmit_chars_dma_done(), and transmit_chars_pio().

#define serial_outp info,
off,
val   )     su_outb(info, off, val)
 

Definition at line 269 of file su.c.

Referenced by autoconfig(), change_speed(), detect_uart_irq(), elsa_interrupt(), modem_write_cmd(), mshutdown(), mstartup(), rs_break(), shutdown(), startup(), transmit_chars(), and write_modem().

#define SERIAL_PARANOIA_CHECK
 

Definition at line 14 of file su.c.

#define SU_PROPSIZE   128
 

Definition at line 98 of file su.c.

Referenced by __initfunc().

#define WAKEUP_CHARS   256
 

Definition at line 174 of file su.c.


Enumeration Type Documentation

enum su_type
 

Enumeration values:
SU_PORT_NONE 
SU_PORT_MS 
SU_PORT_KBD 
SU_PORT_PORT 

Definition at line 95 of file su.c.


Function Documentation

__initfunc int   su_probe(unsigned long *memory_start)  ) 
 

Definition at line 2646 of file su.c.

References su_probe_scan::devices, ENODEV, su_struct::is_console, kbd_ops, su_probe_scan::kbnode, su_probe_scan::kbx, len, su_probe_scan::msnode, su_probe_scan::msx, su_struct::port_node, su_struct::port_type, printk, prom_finddevice(), prom_getchild(), prom_getproperty(), prom_root_node, prom_searchsiblings(), su_probe_scan::prop, sunserial_operations::rs_change_mouse_baud, rs_ops, su_change_mouse_baud(), SU_PORT_KBD, SU_PORT_MS, SU_PROPSIZE, sun_compute_shiftstate(), sun_getkeycode(), sun_getledstate(), sun_kbd_init(), sun_setkeycode(), sun_setledstate(), sunkbd_setinitfunc(), and sunserial_setinitfunc().

Here is the call graph for this function:

__initfunc void   su_probe_any(struct su_probe_scan *t, int sunode)  ) 
 

Definition at line 2612 of file su.c.

References su_struct::is_console, len, su_struct::port_node, su_struct::port_type, prom_getchild(), prom_getproperty(), prom_getsibling(), strncmp(), SU_PORT_KBD, SU_PORT_MS, SU_PORT_PORT, and SU_PROPSIZE.

Here is the call graph for this function:

__initfunc int   su_serial_init(void)  ) 
 

Definition at line 2471 of file su.c.

References __irq_itoa, autoconfig(), B9600, BAUD_BASE, su_struct::baud_base, tty_driver::break_ctl, async_icount::brk, termios::c_cflag, su_struct::callout_termios, su_struct::cflag, tty_driver::chars_in_buffer, CLOCAL, tty_driver::close, su_struct::close_delay, su_struct::closing_wait, CREAD, CS8, async_icount::cts, su_struct::custom_divisor, tq_struct::data, async_icount::dcd, do_serial_bh(), do_softint(), tty_driver::driver_name, async_icount::dsr, tty_driver::flags, tty_driver::flush_buffer, tty_driver::flush_chars, async_icount::frame, tty_driver::hangup, HUPCL, HZ, i, su_struct::icount, init_bh(), tty_driver::init_termios, tty_driver::ioctl, su_struct::irq, KERN_INFO, su_struct::line, tty_driver::magic, tty_driver::major, memset, tty_driver::minor_start, su_struct::name, tty_driver::name, tty_driver::num, tty_driver::open, async_icount::overrun, panic(), async_icount::parity, su_struct::port, PORT_UNKNOWN, printk, tty_driver::proc_entry, tty_driver::put_char, tty_driver::read_proc, tty_driver::refcount, async_icount::rng, tq_struct::routine, async_icount::rx, tty_driver::send_xchar, SERIAL_BH, serial_refcount, serial_table, SERIAL_TYPE_CALLOUT, SERIAL_TYPE_NORMAL, tty_driver::set_termios, tty_driver::start, tty_driver::stop, su_break(), su_chars_in_buffer(), su_close(), su_flush_buffer(), su_flush_chars(), su_hangup(), su_ioctl(), su_open(), su_put_char(), su_read_proc(), su_send_xchar(), su_set_termios(), su_start(), su_stop(), su_throttle(), su_unthrottle(), su_wait_until_sent(), su_write(), su_write_room(), tty_driver::subtype, tty_driver::table, tty_driver::termios, tty_driver::termios_locked, tty_driver::throttle, su_struct::tqueue, TTY_DRIVER_MAGIC, TTY_DRIVER_REAL_RAW, TTY_DRIVER_TYPE_SERIAL, TTY_MAJOR, tty_register_driver(), tty_std_termios, TTYAUX_MAJOR, async_icount::tx, su_struct::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:

__initfunc static __inline__ void   show_su_version(void)  ) 
 

Definition at line 2265 of file su.c.

References KERN_INFO, p, printk, revision, serial_name, serial_version, strchr, strcpy, and version.

static void autoconfig struct su_struct info  )  [static]
 

Definition at line 2285 of file su.c.

References __irq_itoa, linux_ebus_device::base_address, cli, dev, serial_uart_config::dfl_xmit_fifo_size, for_each_ebus, for_each_ebusdev, su_struct::irq, IRQ_4M, linux_ebus_device::irqs, su_struct::magic, su_struct::name, su_struct::port, PORT_16450, PORT_16550, PORT_16550A, PORT_16650, PORT_16650V2, PORT_16750, PORT_8250, su_struct::port_node, su_struct::port_type, PORT_UNKNOWN, printk, prom_apply_obio_ranges(), prom_getproperty(), linux_ebus_device::prom_node, prom_printf, request_region, restore_flags, save_flags, serial_in, serial_inp, SERIAL_MAGIC, serial_outp, sparc_alloc_io(), sprintf(), su_typev, su_struct::type, UART_EFR, UART_FCR, UART_FCR7_64BYTE, UART_FCR_CLEAR_RCVR, UART_FCR_CLEAR_XMIT, UART_FCR_ENABLE_FIFO, UART_IER, UART_IIR, UART_LCR, UART_LCR_DLAB, UART_MCR, UART_MCR_LOOP, UART_MSR, UART_RX, UART_SCR, x00, xBF, and su_struct::xmit_fifo_size.

Here is the call graph for this function:

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

Definition at line 1925 of file su.c.

References ASYNC_CALLOUT_ACTIVE, ASYNC_CLOSING, ASYNC_HUP_NOTIFY, ASYNC_INITIALIZED, ASYNC_NORMAL_ACTIVE, ASYNC_PGRP_LOCKOUT, ASYNC_SESSION_LOCKOUT, su_struct::blocked_open, CBAUD, cli, CLOCAL, su_struct::close_wait, su_struct::count, current, EAGAIN, EBUSY, ERESTARTSYS, su_struct::flags, interruptible_sleep_on(), su_struct::line, NULL, O_NONBLOCK, su_struct::open_wait, su_struct::pgrp, printk, restore_flags, save_flags, schedule(), serial_in, serial_inp, serial_out, SERIAL_TYPE_CALLOUT, su_struct::session, signal_pending, TASK_INTERRUPTIBLE, TASK_RUNNING, tty_hung_up_p(), UART_MCR, UART_MCR_DTR, UART_MCR_RTS, UART_MSR, and UART_MSR_DCD.

Here is the call graph for this function:

static void change_speed struct su_struct info,
struct termios old
[static]
 

Definition at line 959 of file su.c.

References ASYNC_CHECK_CD, ASYNC_CTS_FLOW, ASYNC_HARDPPS_CD, ASYNC_SPD_CUST, ASYNC_SPD_MASK, baud, termios::c_cflag, CBAUD, cli, CLOCAL, CMSPAR, CREAD, CRTSCTS, CS5, CS6, CS7, CS8, CSIZE, CSTOPB, serial_uart_config::flags, HZ, PARENB, PARODD, PORT_16750, restore_flags, save_flags, serial_out, serial_outp, su_get_baud_rate(), SU_PORT_PORT, tty_get_baud_rate(), UART_DLL, UART_DLM, UART_EFR, UART_EFR_CTS, UART_FCR, UART_FCR7_64BYTE, UART_FCR_ENABLE_FIFO, UART_FCR_TRIGGER_1, UART_FCR_TRIGGER_8, UART_IER, UART_IER_MSI, UART_LCR, UART_LCR_DLAB, UART_LCR_EPAR, UART_LCR_PARITY, UART_LCR_SPAR, UART_LSR_BI, UART_LSR_DR, UART_LSR_FE, UART_LSR_OE, UART_LSR_PE, UART_LSR_THRE, UART_STARTECH, UART_USE_FIFO, xBF, and xff.

Here is the call graph for this function:

static __inline__ void check_modem_status struct su_struct info  )  [static]
 

Definition at line 517 of file su.c.

References ASYNC_CALLOUT_ACTIVE, ASYNC_CALLOUT_NOHUP, ASYNC_CHECK_CD, ASYNC_CTS_FLOW, ASYNC_HARDPPS_CD, async_icount::cts, async_icount::dcd, su_struct::delta_msr_wait, async_icount::dsr, su_struct::flags, su_struct::icount, su_struct::IER, su_struct::line, su_struct::open_wait, printk, async_icount::rng, RS_EVENT_WRITE_WAKEUP, serial_in, serial_out, status, su_sched_event(), su_struct::tty, tty_hangup(), UART_IER, UART_IER_THRI, UART_MSR, UART_MSR_ANY_DELTA, UART_MSR_CTS, UART_MSR_DCD, UART_MSR_DCTS, UART_MSR_DDCD, UART_MSR_DDSR, and UART_MSR_TERI.

Here is the call graph for this function:

static DECLARE_TASK_QUEUE tq_serial   )  [static]
 

static void do_serial_bh void   )  [static]
 

Definition at line 678 of file su.c.

References run_task_queue().

Here is the call graph for this function:

static void do_softint void *  private_  )  [static]
 

Definition at line 683 of file su.c.

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

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

Definition at line 1459 of file su.c.

References cli, put_user, restore_flags, result, save_flags, serial_in, status, TIOCSER_TEMT, UART_LSR, and UART_LSR_TEMT.

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

Definition at line 1474 of file su.c.

References cli, su_struct::MCR, put_user, restore_flags, result, save_flags, serial_in, status, TIOCM_CAR, TIOCM_CTS, TIOCM_DSR, TIOCM_DTR, TIOCM_OUT1, TIOCM_OUT2, TIOCM_RNG, TIOCM_RTS, UART_MCR_DTR, UART_MCR_OUT1, UART_MCR_OUT2, UART_MCR_RTS, UART_MSR, UART_MSR_CTS, UART_MSR_DCD, UART_MSR_DSR, and UART_MSR_RI.

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

Definition at line 1421 of file su.c.

References su_struct::baud_base, su_struct::close_delay, su_struct::closing_wait, copy_to_user, su_struct::custom_divisor, EFAULT, su_struct::flags, su_struct::irq, su_struct::line, memset, su_struct::port, su_struct::type, and su_struct::xmit_fifo_size.

static __inline__ int line_info char *  buf,
struct su_struct info
[static]
 

Definition at line 2163 of file su.c.

References __irq_itoa, su_struct::baud_base, async_icount::brk, cli, async_icount::frame, su_struct::icount, su_struct::irq, su_struct::line, su_struct::MCR, async_icount::overrun, async_icount::parity, su_struct::port, PORT_UNKNOWN, su_struct::quot, restore_flags, ret, async_icount::rx, save_flags, serial_in, sprintf(), status, strcat, async_icount::tx, su_struct::type, UART_MCR, UART_MCR_DTR, UART_MCR_RTS, UART_MSR, UART_MSR_CTS, UART_MSR_DCD, UART_MSR_DSR, and UART_MSR_RI.

Here is the call graph for this function:

static __inline__ void receive_kbd_ms_chars struct su_struct info,
struct pt_regs regs,
int  is_brk
[static]
 

Definition at line 345 of file su.c.

References batten_down_hatches(), l1a_kbd_state::kbd_id, l1a_kbd_state::l1_down, l1a_state, su_struct::port_type, serial_inp, status, su_inb(), SU_PORT_KBD, sun_mouse_inbyte(), SUNKBD_A, sunkbd_inchar(), SUNKBD_L1, SUNKBD_RESET, SUNKBD_UP, UART_LSR, UART_LSR_DR, and UART_RX.

Referenced by su_kbd_ms_interrupt().

Here is the call graph for this function:

static __inline__ void receive_serial_chars struct su_struct info,
int *  status,
struct pt_regs regs
[static]
 

Definition at line 380 of file su.c.

References ASYNC_SAK, batten_down_hatches(), async_icount::brk, do_SAK(), async_icount::frame, ignored, async_icount::overrun, async_icount::parity, printk, async_icount::rx, serial_inp, tty, tty_flip_buffer_push, UART_LSR, UART_LSR_BI, UART_LSR_DR, UART_LSR_FE, UART_LSR_OE, UART_LSR_PE, and UART_RX.

Referenced by su_serial_interrupt().

Here is the call graph for this function:

static int serial_paranoia_check struct su_struct info,
kdev_t  device,
const char *  routine
[inline, static]
 

Definition at line 222 of file su.c.

References kdevname(), su_struct::magic, printk, and SERIAL_MAGIC.

Here is the call graph for this function:

static int set_modem_info struct su_struct info,
unsigned int  cmd,
unsigned int *  value
[static]
 

Definition at line 1498 of file su.c.

References cli, EINVAL, error, get_user, su_struct::MCR, restore_flags, save_flags, serial_out, TIOCM_DTR, TIOCM_OUT1, TIOCM_OUT2, TIOCM_RTS, TIOCMBIC, TIOCMBIS, TIOCMSET, UART_MCR, UART_MCR_DTR, UART_MCR_OUT1, UART_MCR_OUT2, and UART_MCR_RTS.

static void shutdown struct su_struct info  )  [static]
 

Definition at line 872 of file su.c.

References ASYNC_INITIALIZED, cli, su_struct::delta_msr_wait, serial_uart_config::flags, su_struct::flags, free_irq(), free_page, HUPCL, su_struct::IER, su_struct::irq, su_struct::MCR, PORT_16750, restore_flags, save_flags, serial_in, serial_inp, serial_out, serial_outp, set_bit, su_struct::tty, UART_EFR, UART_EFR_ECB, UART_FCR, UART_FCR_CLEAR_RCVR, UART_FCR_CLEAR_XMIT, UART_IER, UART_IERX_SLEEP, UART_LCR, UART_LCR_SBC, UART_MCR, UART_MCR_DTR, UART_MCR_OUT2, UART_MCR_RTS, UART_RX, UART_STARTECH, x00, xBF, and su_struct::xmit_buf.

Here is the call graph for this function:

static int startup struct su_struct info  )  [static]
 

Definition at line 711 of file su.c.

References