#include <linux/module.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/slab.h>
#include <linux/sched/signal.h>
#include <linux/init.h>
#include <linux/console.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/device.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/sysrq.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/math64.h>
#include <linux/security.h>
#include <linux/irq.h>
#include <linux/uaccess.h>
#include "serial_base.h"
static DEFINE_MUTEX(port_mutex);
static struct lock_class_key port_lock_key;
#define HIGH_BITS_OFFSET …
#define RS485_MAX_RTS_DELAY …
static void uart_change_pm(struct uart_state *state,
enum uart_pm_state pm_state);
static void uart_port_shutdown(struct tty_port *port);
static int uart_dcd_enabled(struct uart_port *uport)
{ … }
static inline struct uart_port *uart_port_ref(struct uart_state *state)
{ … }
static inline void uart_port_deref(struct uart_port *uport)
{ … }
#define uart_port_lock(state, flags) …
#define uart_port_unlock(uport, flags) …
static inline struct uart_port *uart_port_check(struct uart_state *state)
{ … }
void uart_write_wakeup(struct uart_port *port)
{ … }
EXPORT_SYMBOL(…);
static void uart_stop(struct tty_struct *tty)
{ … }
static void __uart_start(struct uart_state *state)
{ … }
static void uart_start(struct tty_struct *tty)
{ … }
static void
uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)
{ … }
#define uart_set_mctrl(port, set) …
#define uart_clear_mctrl(port, clear) …
static void uart_port_dtr_rts(struct uart_port *uport, bool active)
{ … }
static void uart_change_line_settings(struct tty_struct *tty, struct uart_state *state,
const struct ktermios *old_termios)
{ … }
static int uart_alloc_xmit_buf(struct tty_port *port)
{ … }
static void uart_free_xmit_buf(struct tty_port *port)
{ … }
static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
bool init_hw)
{ … }
static int uart_startup(struct tty_struct *tty, struct uart_state *state,
bool init_hw)
{ … }
static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
{ … }
void
uart_update_timeout(struct uart_port *port, unsigned int cflag,
unsigned int baud)
{ … }
EXPORT_SYMBOL(…);
unsigned int
uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
const struct ktermios *old, unsigned int min, unsigned int max)
{ … }
EXPORT_SYMBOL(…);
unsigned int
uart_get_divisor(struct uart_port *port, unsigned int baud)
{ … }
EXPORT_SYMBOL(…);
static int uart_put_char(struct tty_struct *tty, u8 c)
{ … }
static void uart_flush_chars(struct tty_struct *tty)
{ … }
static ssize_t uart_write(struct tty_struct *tty, const u8 *buf, size_t count)
{ … }
static unsigned int uart_write_room(struct tty_struct *tty)
{ … }
static unsigned int uart_chars_in_buffer(struct tty_struct *tty)
{ … }
static void uart_flush_buffer(struct tty_struct *tty)
{ … }
void uart_xchar_out(struct uart_port *uport, int offset)
{ … }
EXPORT_SYMBOL_GPL(…);
static void uart_send_xchar(struct tty_struct *tty, u8 ch)
{ … }
static void uart_throttle(struct tty_struct *tty)
{ … }
static void uart_unthrottle(struct tty_struct *tty)
{ … }
static int uart_get_info(struct tty_port *port, struct serial_struct *retinfo)
{ … }
static int uart_get_info_user(struct tty_struct *tty,
struct serial_struct *ss)
{ … }
static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
struct uart_state *state,
struct serial_struct *new_info)
{ … }
static int uart_set_info_user(struct tty_struct *tty, struct serial_struct *ss)
{ … }
static int uart_get_lsr_info(struct tty_struct *tty,
struct uart_state *state, unsigned int __user *value)
{ … }
static int uart_tiocmget(struct tty_struct *tty)
{ … }
static int
uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
{ … }
static int uart_break_ctl(struct tty_struct *tty, int break_state)
{ … }
static int uart_do_autoconfig(struct tty_struct *tty, struct uart_state *state)
{ … }
static void uart_enable_ms(struct uart_port *uport)
{ … }
static int uart_wait_modem_status(struct uart_state *state, unsigned long arg)
{ … }
static int uart_get_icount(struct tty_struct *tty,
struct serial_icounter_struct *icount)
{ … }
#define SER_RS485_LEGACY_FLAGS …
static int uart_check_rs485_flags(struct uart_port *port, struct serial_rs485 *rs485)
{ … }
static void uart_sanitize_serial_rs485_delays(struct uart_port *port,
struct serial_rs485 *rs485)
{ … }
static void uart_sanitize_serial_rs485(struct uart_port *port, struct serial_rs485 *rs485)
{ … }
static void uart_set_rs485_termination(struct uart_port *port,
const struct serial_rs485 *rs485)
{ … }
static void uart_set_rs485_rx_during_tx(struct uart_port *port,
const struct serial_rs485 *rs485)
{ … }
static int uart_rs485_config(struct uart_port *port)
{ … }
static int uart_get_rs485_config(struct uart_port *port,
struct serial_rs485 __user *rs485)
{ … }
static int uart_set_rs485_config(struct tty_struct *tty, struct uart_port *port,
struct serial_rs485 __user *rs485_user)
{ … }
static int uart_get_iso7816_config(struct uart_port *port,
struct serial_iso7816 __user *iso7816)
{ … }
static int uart_set_iso7816_config(struct uart_port *port,
struct serial_iso7816 __user *iso7816_user)
{ … }
static int
uart_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
{ … }
static void uart_set_ldisc(struct tty_struct *tty)
{ … }
static void uart_set_termios(struct tty_struct *tty,
const struct ktermios *old_termios)
{ … }
static void uart_close(struct tty_struct *tty, struct file *filp)
{ … }
static void uart_tty_port_shutdown(struct tty_port *port)
{ … }
static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
{ … }
static void uart_hangup(struct tty_struct *tty)
{ … }
static void uart_port_shutdown(struct tty_port *port)
{ … }
static bool uart_carrier_raised(struct tty_port *port)
{ … }
static void uart_dtr_rts(struct tty_port *port, bool active)
{ … }
static int uart_install(struct tty_driver *driver, struct tty_struct *tty)
{ … }
static int uart_open(struct tty_struct *tty, struct file *filp)
{ … }
static int uart_port_activate(struct tty_port *port, struct tty_struct *tty)
{ … }
static const char *uart_type(struct uart_port *port)
{ … }
#ifdef CONFIG_PROC_FS
static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i)
{ … }
static int uart_proc_show(struct seq_file *m, void *v)
{ … }
#endif
static void uart_port_spin_lock_init(struct uart_port *port)
{ … }
#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL)
void uart_console_write(struct uart_port *port, const char *s,
unsigned int count,
void (*putchar)(struct uart_port *, unsigned char))
{ … }
EXPORT_SYMBOL_GPL(…);
struct uart_port * __init
uart_get_console(struct uart_port *ports, int nr, struct console *co)
{ … }
int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
char **options)
{ … }
EXPORT_SYMBOL_GPL(…);
void
uart_parse_options(const char *options, int *baud, int *parity,
int *bits, int *flow)
{ … }
EXPORT_SYMBOL_GPL(…);
int
uart_set_options(struct uart_port *port, struct console *co,
int baud, int parity, int bits, int flow)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
static void uart_change_pm(struct uart_state *state,
enum uart_pm_state pm_state)
{ … }
struct uart_match { … };
static int serial_match_port(struct device *dev, void *data)
{ … }
int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
{ … }
EXPORT_SYMBOL(…);
int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
{ … }
EXPORT_SYMBOL(…);
static inline void
uart_report_port(struct uart_driver *drv, struct uart_port *port)
{ … }
static void
uart_configure_port(struct uart_driver *drv, struct uart_state *state,
struct uart_port *port)
{ … }
#ifdef CONFIG_CONSOLE_POLL
static int uart_poll_init(struct tty_driver *driver, int line, char *options)
{ … }
static int uart_poll_get_char(struct tty_driver *driver, int line)
{ … }
static void uart_poll_put_char(struct tty_driver *driver, int line, char ch)
{ … }
#endif
static const struct tty_operations uart_ops = …;
static const struct tty_port_operations uart_port_ops = …;
int uart_register_driver(struct uart_driver *drv)
{ … }
EXPORT_SYMBOL(…);
void uart_unregister_driver(struct uart_driver *drv)
{ … }
EXPORT_SYMBOL(…);
struct tty_driver *uart_console_device(struct console *co, int *index)
{ … }
EXPORT_SYMBOL_GPL(…);
static ssize_t uartclk_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t type_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t line_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t port_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t irq_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t flags_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t xmit_fifo_size_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t close_delay_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t closing_wait_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t custom_divisor_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t io_type_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t iomem_base_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t iomem_reg_shift_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t console_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t console_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RO(uartclk);
static DEVICE_ATTR_RO(type);
static DEVICE_ATTR_RO(line);
static DEVICE_ATTR_RO(port);
static DEVICE_ATTR_RO(irq);
static DEVICE_ATTR_RO(flags);
static DEVICE_ATTR_RO(xmit_fifo_size);
static DEVICE_ATTR_RO(close_delay);
static DEVICE_ATTR_RO(closing_wait);
static DEVICE_ATTR_RO(custom_divisor);
static DEVICE_ATTR_RO(io_type);
static DEVICE_ATTR_RO(iomem_base);
static DEVICE_ATTR_RO(iomem_reg_shift);
static DEVICE_ATTR_RW(console);
static struct attribute *tty_dev_attrs[] = …;
static const struct attribute_group tty_dev_attr_group = …;
static int serial_core_add_one_port(struct uart_driver *drv, struct uart_port *uport)
{ … }
static void serial_core_remove_one_port(struct uart_driver *drv,
struct uart_port *uport)
{ … }
bool uart_match_port(const struct uart_port *port1,
const struct uart_port *port2)
{ … }
EXPORT_SYMBOL(…);
static struct serial_ctrl_device *
serial_core_get_ctrl_dev(struct serial_port_device *port_dev)
{ … }
static struct serial_ctrl_device *serial_core_ctrl_find(struct uart_driver *drv,
struct device *phys_dev,
int ctrl_id)
{ … }
static struct serial_ctrl_device *serial_core_ctrl_device_add(struct uart_port *port)
{ … }
static int serial_core_port_device_add(struct serial_ctrl_device *ctrl_dev,
struct uart_port *port)
{ … }
int serial_core_register_port(struct uart_driver *drv, struct uart_port *port)
{ … }
void serial_core_unregister_port(struct uart_driver *drv, struct uart_port *port)
{ … }
void uart_handle_dcd_change(struct uart_port *uport, bool active)
{ … }
EXPORT_SYMBOL_GPL(…);
void uart_handle_cts_change(struct uart_port *uport, bool active)
{ … }
EXPORT_SYMBOL_GPL(…);
void uart_insert_char(struct uart_port *port, unsigned int status,
unsigned int overrun, u8 ch, u8 flag)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_MAGIC_SYSRQ_SERIAL
static const u8 sysrq_toggle_seq[] = …;
static void uart_sysrq_on(struct work_struct *w)
{ … }
static DECLARE_WORK(sysrq_enable_work, uart_sysrq_on);
bool uart_try_toggle_sysrq(struct uart_port *port, u8 ch)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
int uart_get_rs485_mode(struct uart_port *port)
{ … }
EXPORT_SYMBOL_GPL(…);
static_assert(…);
static_assert(…);
static_assert(…);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;