From: James S. <jsi...@us...> - 2002-03-14 20:02:14
|
Update of /cvsroot/linuxconsole/ruby/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv5099/linux/include/linux Modified Files: serial_core.h Log Message: Synced to 2.5.4 Index: serial_core.h =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/include/linux/serial_core.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- serial_core.h 25 Dec 2001 06:50:51 -0000 1.11 +++ serial_core.h 14 Mar 2002 20:02:07 -0000 1.12 @@ -41,7 +41,9 @@ /* * ARM specific type numbers. These are not currently guaranteed - * to be implemented, and will change in the future. + * to be implemented, and will change in the future. These are + * separate so any additions to the old serial.c that occur before + * we are merged can be easily merged here. */ #define PORT_AMBA 32 #define PORT_CLPS711X 33 @@ -65,19 +67,21 @@ * done on the physical hardware. */ struct uart_ops { - u_int (*tx_empty)(struct uart_port *); - void (*set_mctrl)(struct uart_port *, u_int mctrl); - u_int (*get_mctrl)(struct uart_port *); - void (*stop_tx)(struct uart_port *, u_int from_tty); - void (*start_tx)(struct uart_port *, u_int nonempty, u_int from_tty); - void (*stop_rx)(struct uart_port *); - void (*enable_ms)(struct uart_port *); - void (*break_ctl)(struct uart_port *, int ctl); - int (*startup)(struct uart_port *, struct uart_info *); - void (*shutdown)(struct uart_port *, struct uart_info *); - void (*change_speed)(struct uart_port *, u_int cflag, u_int iflag, u_int quot); - void (*pm)(struct uart_port *, u_int state, u_int oldstate); - int (*set_wake)(struct uart_port *, u_int state); + unsigned int (*tx_empty)(struct uart_port *); + void (*set_mctrl)(struct uart_port *, unsigned int mctrl); + unsigned int (*get_mctrl)(struct uart_port *); + void (*stop_tx)(struct uart_port *, unsigned int tty_stop); + void (*start_tx)(struct uart_port *, unsigned int tty_start); + void (*stop_rx)(struct uart_port *); + void (*enable_ms)(struct uart_port *); + void (*break_ctl)(struct uart_port *, int ctl); + int (*startup)(struct uart_port *); + void (*shutdown)(struct uart_port *); + void (*change_speed)(struct uart_port *, unsigned int cflag, + unsigned int iflag, unsigned int quot); + void (*pm)(struct uart_port *, unsigned int state, + unsigned int oldstate); + int (*set_wake)(struct uart_port *, unsigned int state); /* * Return a string describing the type of the port @@ -88,16 +92,16 @@ * Release IO and memory resources used by the port. * This includes iounmap if necessary. */ - void (*release_port)(struct uart_port *); + void (*release_port)(struct uart_port *); /* * Request IO and memory resources used by the port. * This includes iomapping the port if necessary. */ - int (*request_port)(struct uart_port *); - void (*config_port)(struct uart_port *, int); - int (*verify_port)(struct uart_port *, struct serial_struct *); - int (*ioctl)(struct uart_port *, u_int, u_long); + int (*request_port)(struct uart_port *); + void (*config_port)(struct uart_port *, int); + int (*verify_port)(struct uart_port *, struct serial_struct *); + int (*ioctl)(struct uart_port *, unsigned int, unsigned long); }; #define UART_CONFIG_TYPE (1 << 0) @@ -118,26 +122,34 @@ }; struct uart_port { - u_int iobase; /* in/out[bwl] */ - void *membase; /* read/write[bwl] */ - u_int irq; - u_int uartclk; - u_char fifosize; /* tx fifo size */ - u_char x_char; - u_char regshift; /* reg offset shift */ - u_char iotype; /* io access style */ - u_int read_status_mask; - u_int ignore_status_mask; - u_int flags; - u_int type; /* port type */ + spinlock_t lock; /* port lock */ + unsigned int iobase; /* in/out[bwl] */ + char *membase; /* read/write[bwl] */ + unsigned int irq; /* irq number */ + unsigned int uartclk; /* base uart clock */ + unsigned char fifosize; /* tx fifo size */ + unsigned char x_char; /* xon/xoff char */ + unsigned char regshift; /* reg offset shift */ + unsigned char iotype; /* io access style */ + unsigned int read_status_mask; /* driver specific */ + unsigned int ignore_status_mask; /* driver specific */ + struct uart_info *info; /* pointer to parent info */ + struct uart_icount icount; /* statistics */ + + struct console *cons; /* struct console, if any */ +#ifdef CONFIG_SERIAL_CORE_CONSOLE + unsigned long sysrq; /* sysrq timeout */ +#endif + + unsigned int flags; + unsigned int mctrl; /* current modem ctrl settings */ + unsigned int timeout; /* character-based timeout */ + unsigned int type; /* port type */ struct uart_ops *ops; - struct uart_icount icount; - struct circ_buf xmit; - struct console *cons; /* need this to handle cons */ - u_int line; - u_long mapbase; /* for ioremap */ - u_char hub6; /* this should be in the 8250 driver */ - u_char unused[3]; + unsigned int line; /* port index */ + unsigned long mapbase; /* for ioremap */ + unsigned char hub6; /* this should be in the 8250 driver */ + unsigned char unused[3]; }; /* @@ -146,9 +158,9 @@ * within. */ struct uart_state { - u_int close_delay; - u_int closing_wait; - u_int custom_divisor; + unsigned int close_delay; + unsigned int closing_wait; + unsigned int custom_divisor; struct termios normal_termios; struct termios callout_termios; @@ -156,7 +168,6 @@ struct uart_info *info; struct uart_port *port; - struct semaphore count_sem; /* this protects 'count' */ #ifdef CONFIG_PM struct pm_dev *pm; #endif @@ -170,16 +181,30 @@ * stuff here. */ struct uart_info { - spinlock_t lock; struct uart_port *port; + struct uart_ops *ops; struct uart_state *state; struct tty_struct *tty; - u_int flags; + struct circ_buf xmit; + unsigned int flags; - u_int event; - u_int timeout; - u_int mctrl; - u_int driver_priv; +/* + * These are the flags that specific to info->flags, and reflect our + * internal state. They can not be accessed via port->flags. Use + * the UIF_* to refer to them. Low level drivers should not change + * these. + */ +#define UIF_INITIALIZED ASYNC_INITIALIZED +#define UIF_CALLOUT_ACTIVE ASYNC_CALLOUT_ACTIVE +#define UIF_NORMAL_ACTIVE ASYNC_NORMAL_ACTIVE +#define UIF_CLOSING ASYNC_CLOSING +#define UIF_CTS_FLOW ASYNC_CTS_FLOW +#define UIF_CHECK_CD ASYNC_CHECK_CD + + unsigned char *tmpbuf; + struct semaphore tmpbuf_sem; + + unsigned long event; int blocked_open; pid_t session; pid_t pgrp; @@ -187,20 +212,7 @@ struct tasklet_struct tlet; wait_queue_head_t open_wait; - wait_queue_head_t close_wait; wait_queue_head_t delta_msr_wait; - - /* - * List if uarts on the same IRQ line. - */ - struct uart_info *next_info; -/* - * This is placed at the end since it may not be present. - * Do not place any new members after here. - */ -#if defined(CONFIG_SERIAL_CORE_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) - u_long sysrq; /* available for driver use */ -#endif }; /* number of characters left in xmit buffer before we ask for more */ @@ -212,6 +224,7 @@ struct uart_driver { struct module *owner; + const char *driver_name; int normal_major; const char *normal_name; struct tty_driver *normal_driver; @@ -221,15 +234,15 @@ int minor; int nr; struct console *cons; - - /* This is obsolete */ - struct uart_port *port; /* array of port information */ - - /* These are private */ - struct uart_state *state; /* driver should pass NULL */ + + /* this is obsolete */ + struct uart_port *port; /* array of port information */ + + /* these are private */ + struct uart_state *state; /* driver should pass NULL */ }; -void uart_event(struct uart_info *info, int event); +void uart_event(struct uart_port *port, int event); struct uart_port *uart_get_console(struct uart_port *ports, int nr, struct console *c); void uart_parse_options(char *options, int *baud, int *parity, int *bits, @@ -243,38 +256,53 @@ int uart_add_one_port(struct uart_driver *reg, struct uart_port *port); int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); +#define uart_circ_empty(circ) ((circ)->head == (circ)->tail) +#define uart_circ_clear(circ) ((circ)->head = (circ)->tail = 0) + +#define uart_circ_chars_pending(circ) \ + (CIRC_CNT((circ)->head, (circ)->tail, UART_XMIT_SIZE)) + +#define uart_circ_chars_free(circ) \ + (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE)) + +#define uart_tx_stopped(port) \ + ((port)->info->tty->stopped || (port)->info->tty->hw_stopped) + /* * The following are helper functions for the low level drivers. */ #ifdef SUPPORT_SYSRQ static inline int -__uart_handle_sysrq_char(struct uart_info *info, unsigned int ch, - struct pt_regs *regs) +uart_handle_sysrq_char(struct uart_port *port, unsigned int ch, + struct pt_regs *regs) { - if (info->sysrq) { - if (ch && time_before(jiffies, info->sysrq)) { + if (port->sysrq) { + if (ch && time_before(jiffies, port->sysrq)) { handle_sysrq(ch, regs, NULL, NULL); - info->sysrq = 0; + port->sysrq = 0; return 1; } - info->sysrq = 0; + port->sysrq = 0; } return 0; } +#else +#define uart_handle_sysrq_char(port,ch,regs) (0) #endif /* * We do the SysRQ and SAK checking like this... */ -static inline int __uart_handle_break(struct uart_info *info, struct console *con) +static inline int uart_handle_break(struct uart_port *port) { + struct uart_info *info = port->info; #ifdef SUPPORT_SYSRQ - if (info->port->line == con->index) { - if (!info->sysrq) { - info->sysrq = jiffies + HZ*5; + if (port->cons && port->cons->index == port->line) { + if (!port->sysrq) { + port->sysrq = jiffies + HZ*5; return 1; } - info->sysrq = 0; + port->sysrq = 0; } #endif if (info->flags & ASYNC_SAK) @@ -282,23 +310,15 @@ return 0; } -#ifdef SUPPORT_SYSRQ -#define uart_handle_break(info,con) __uart_handle_break(info,con) -#define uart_handle_sysrq_char(info,ch,regs) __uart_handle_sysrq_char(info,ch,regs) -#else -#define uart_handle_break(info,con) __uart_handle_break(info,NULL) -#define uart_handle_sysrq_char(info,ch,regs) (0) -#endif - /** * uart_handle_dcd_change - handle a change of carrier detect state - * @info: uart_info structure for the open port + * @port: uart_port structure for the open port * @status: new carrier detect status, nonzero if active */ static inline void -uart_handle_dcd_change(struct uart_info *info, unsigned int status) +uart_handle_dcd_change(struct uart_port *port, unsigned int status) { - struct uart_port *port = info->port; + struct uart_info *info = port->info; port->icount.dcd++; @@ -307,10 +327,10 @@ hardpps(); #endif - if (info->flags & ASYNC_CHECK_CD) { + if (info->flags & UIF_CHECK_CD) { if (status) wake_up_interruptible(&info->open_wait); - else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) && + else if (!((info->flags & UIF_CALLOUT_ACTIVE) && (info->flags & ASYNC_CALLOUT_NOHUP))) { if (info->tty) tty_hangup(info->tty); @@ -320,33 +340,38 @@ /** * uart_handle_cts_change - handle a change of clear-to-send state - * @info: uart_info structure for the open port + * @port: uart_port structure for the open port * @status: new clear to send status, nonzero if active */ static inline void -uart_handle_cts_change(struct uart_info *info, unsigned int status) +uart_handle_cts_change(struct uart_port *port, unsigned int status) { - struct uart_port *port = info->port; - unsigned long flags; + struct uart_info *info = port->info; + struct tty_struct *tty = info->tty; port->icount.cts++; - if (info->flags & ASYNC_CTS_FLOW) { - spin_lock_irqsave(&info->lock, flags); - if (info->tty->hw_stopped) { + if (info->flags & UIF_CTS_FLOW) { + if (tty->hw_stopped) { if (status) { - info->tty->hw_stopped = 0; - port->ops->start_tx(port, 1, 0); - uart_event(info, EVT_WRITE_WAKEUP); + tty->hw_stopped = 0; + port->ops->start_tx(port, 0); + uart_event(port, EVT_WRITE_WAKEUP); } } else { if (!status) { - info->tty->hw_stopped = 1; + tty->hw_stopped = 1; port->ops->stop_tx(port, 0); } } - spin_unlock_irqrestore(&info->lock, flags); } } + +/* + * UART_ENABLE_MS - determine if port should enable modem status irqs + */ +#define UART_ENABLE_MS(port,cflag) ((port)->flags & ASYNC_HARDPPS_CD || \ + (cflag) & CRTSCTS || \ + !(cflag) & CLOCAL) #endif |