#undef DEBUG
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/math.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/tty.h>
#include <linux/serial_reg.h>
#include <linux/serial_core.h>
#include <linux/8250_pci.h>
#include <linux/bitops.h>
#include <linux/bitfield.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include "8250.h"
#include "8250_pcilib.h"
#define PCI_VENDOR_ID_SBSMODULARIO …
#define PCI_SUBVENDOR_ID_SBSMODULARIO …
#define PCI_DEVICE_ID_OCTPRO …
#define PCI_SUBDEVICE_ID_OCTPRO232 …
#define PCI_SUBDEVICE_ID_OCTPRO422 …
#define PCI_SUBDEVICE_ID_POCTAL232 …
#define PCI_SUBDEVICE_ID_POCTAL422 …
#define PCI_SUBDEVICE_ID_SIIG_DUAL_00 …
#define PCI_SUBDEVICE_ID_SIIG_DUAL_30 …
#define PCI_VENDOR_ID_ADVANTECH …
#define PCI_DEVICE_ID_INTEL_CE4100_UART …
#define PCI_DEVICE_ID_ADVANTECH_PCI1600 …
#define PCI_DEVICE_ID_ADVANTECH_PCI1600_1611 …
#define PCI_DEVICE_ID_ADVANTECH_PCI3620 …
#define PCI_DEVICE_ID_ADVANTECH_PCI3618 …
#define PCI_DEVICE_ID_ADVANTECH_PCIf618 …
#define PCI_DEVICE_ID_TITAN_200I …
#define PCI_DEVICE_ID_TITAN_400I …
#define PCI_DEVICE_ID_TITAN_800I …
#define PCI_DEVICE_ID_TITAN_800EH …
#define PCI_DEVICE_ID_TITAN_800EHB …
#define PCI_DEVICE_ID_TITAN_400EH …
#define PCI_DEVICE_ID_TITAN_100E …
#define PCI_DEVICE_ID_TITAN_200E …
#define PCI_DEVICE_ID_TITAN_400E …
#define PCI_DEVICE_ID_TITAN_800E …
#define PCI_DEVICE_ID_TITAN_200EI …
#define PCI_DEVICE_ID_TITAN_200EISI …
#define PCI_DEVICE_ID_TITAN_200V3 …
#define PCI_DEVICE_ID_TITAN_400V3 …
#define PCI_DEVICE_ID_TITAN_410V3 …
#define PCI_DEVICE_ID_TITAN_800V3 …
#define PCI_DEVICE_ID_TITAN_800V3B …
#define PCI_DEVICE_ID_OXSEMI_16PCI958 …
#define PCIE_DEVICE_ID_NEO_2_OX_IBM …
#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA …
#define PCI_DEVICE_ID_INTEL_PATSBURG_KT …
#define PCI_VENDOR_ID_WCH …
#define PCI_DEVICE_ID_WCH_CH352_2S …
#define PCI_DEVICE_ID_WCH_CH353_4S …
#define PCI_DEVICE_ID_WCH_CH353_2S1PF …
#define PCI_DEVICE_ID_WCH_CH353_1S1P …
#define PCI_DEVICE_ID_WCH_CH353_2S1P …
#define PCI_DEVICE_ID_WCH_CH355_4S …
#define PCI_VENDOR_ID_AGESTAR …
#define PCI_DEVICE_ID_AGESTAR_9375 …
#define PCI_DEVICE_ID_BROADCOM_TRUMANAGE …
#define PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800 …
#define PCIE_VENDOR_ID_WCH …
#define PCIE_DEVICE_ID_WCH_CH382_2S1P …
#define PCIE_DEVICE_ID_WCH_CH384_4S …
#define PCIE_DEVICE_ID_WCH_CH384_8S …
#define PCIE_DEVICE_ID_WCH_CH382_2S …
#define PCI_DEVICE_ID_MOXA_CP102E …
#define PCI_DEVICE_ID_MOXA_CP102EL …
#define PCI_DEVICE_ID_MOXA_CP102N …
#define PCI_DEVICE_ID_MOXA_CP104EL_A …
#define PCI_DEVICE_ID_MOXA_CP104N …
#define PCI_DEVICE_ID_MOXA_CP112N …
#define PCI_DEVICE_ID_MOXA_CP114EL …
#define PCI_DEVICE_ID_MOXA_CP114N …
#define PCI_DEVICE_ID_MOXA_CP116E_A_A …
#define PCI_DEVICE_ID_MOXA_CP116E_A_B …
#define PCI_DEVICE_ID_MOXA_CP118EL_A …
#define PCI_DEVICE_ID_MOXA_CP118E_A_I …
#define PCI_DEVICE_ID_MOXA_CP132EL …
#define PCI_DEVICE_ID_MOXA_CP132N …
#define PCI_DEVICE_ID_MOXA_CP134EL_A …
#define PCI_DEVICE_ID_MOXA_CP134N …
#define PCI_DEVICE_ID_MOXA_CP138E_A …
#define PCI_DEVICE_ID_MOXA_CP168EL_A …
#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 …
#define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 …
struct pci_serial_quirk { … };
struct f815xxa_data { … };
struct serial_private { … };
#define PCI_DEVICE_ID_HPE_PCI_SERIAL …
static const struct pci_device_id pci_use_msi[] = …;
static int pci_default_setup(struct serial_private*,
const struct pciserial_board*, struct uart_8250_port *, int);
static void moan_device(const char *str, struct pci_dev *dev)
{ … }
static int
setup_port(struct serial_private *priv, struct uart_8250_port *port,
u8 bar, unsigned int offset, int regshift)
{ … }
static int addidata_apci7800_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int
afavlab_setup(struct serial_private *priv, const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int pci_hp_diva_init(struct pci_dev *dev)
{ … }
static int
pci_hp_diva_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int pci_inteli960ni_init(struct pci_dev *dev)
{ … }
static int pci_plx9050_init(struct pci_dev *dev)
{ … }
static void pci_plx9050_exit(struct pci_dev *dev)
{ … }
#define NI8420_INT_ENABLE_REG …
#define NI8420_INT_ENABLE_BIT …
static void pci_ni8420_exit(struct pci_dev *dev)
{ … }
#define MITE_IOWBSR1 …
#define MITE_IOWCR1 …
#define MITE_LCIMR1 …
#define MITE_LCIMR2 …
#define MITE_LCIMR2_CLR_CPU_IE …
static void pci_ni8430_exit(struct pci_dev *dev)
{ … }
static int
sbs_setup(struct serial_private *priv, const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
#define OCT_REG_CR_OFF …
static int sbs_init(struct pci_dev *dev)
{ … }
static void sbs_exit(struct pci_dev *dev)
{ … }
#define PCI_DEVICE_ID_SIIG_1S_10x …
#define PCI_DEVICE_ID_SIIG_2S_10x …
static int pci_siig10x_init(struct pci_dev *dev)
{ … }
#define PCI_DEVICE_ID_SIIG_2S_20x …
#define PCI_DEVICE_ID_SIIG_2S1P_20x …
static int pci_siig20x_init(struct pci_dev *dev)
{ … }
static int pci_siig_init(struct pci_dev *dev)
{ … }
static int pci_siig_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static const unsigned short timedia_single_port[] = …;
static const unsigned short timedia_dual_port[] = …;
static const unsigned short timedia_quad_port[] = …;
static const unsigned short timedia_eight_port[] = …;
static const struct timedia_struct { … } timedia_data[] = …;
static int pci_timedia_probe(struct pci_dev *dev)
{ … }
static int pci_timedia_init(struct pci_dev *dev)
{ … }
static int
pci_timedia_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int
titan_400l_800l_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int pci_xircom_init(struct pci_dev *dev)
{ … }
static int pci_ni8420_init(struct pci_dev *dev)
{ … }
#define MITE_IOWBSR1_WSIZE …
#define MITE_IOWBSR1_WIN_OFFSET …
#define MITE_IOWBSR1_WENAB …
#define MITE_LCIMR1_IO_IE_0 …
#define MITE_LCIMR2_SET_CPU_IE …
#define MITE_IOWCR1_RAMSEL_MASK …
static int pci_ni8430_init(struct pci_dev *dev)
{ … }
#define NI8430_PORTCON …
#define NI8430_PORTCON_TXVR_ENABLE …
static int
pci_ni8430_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int pci_netmos_9900_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int pci_netmos_9900_numports(struct pci_dev *dev)
{ … }
static int pci_netmos_init(struct pci_dev *dev)
{ … }
#define ITE_887x_MISCR …
#define ITE_887x_INTCBAR …
#define ITE_887x_UARTBAR …
#define ITE_887x_PS0BAR …
#define ITE_887x_POSIO0 …
#define ITE_887x_IOSIZE …
#define ITE_887x_POSIO_IOSIZE_8 …
#define ITE_887x_POSIO_IOSIZE_32 …
#define ITE_887x_POSIO_SPEED …
#define ITE_887x_POSIO_ENABLE …
static const short inta_addr[] = …;
static int pci_ite887x_init(struct pci_dev *dev)
{ … }
static void pci_ite887x_exit(struct pci_dev *dev)
{ … }
#define PCI_VENDOR_ID_ENDRUN …
#define PCI_DEVICE_ID_ENDRUN_1588 …
static bool pci_oxsemi_tornado_p(struct pci_dev *dev)
{ … }
static int pci_oxsemi_tornado_init(struct pci_dev *dev)
{ … }
#define OXSEMI_TORNADO_TCR_MASK …
#define OXSEMI_TORNADO_CPR_MASK …
#define OXSEMI_TORNADO_CPR_MIN …
#define OXSEMI_TORNADO_CPR_DEF …
static unsigned int pci_oxsemi_tornado_get_divisor(struct uart_port *port,
unsigned int baud,
unsigned int *frac)
{ … }
static void pci_oxsemi_tornado_set_divisor(struct uart_port *port,
unsigned int baud,
unsigned int quot,
unsigned int quot_frac)
{ … }
static void pci_oxsemi_tornado_set_mctrl(struct uart_port *port,
unsigned int mctrl)
{ … }
static int pci_oxsemi_tornado_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *up, int idx)
{ … }
#define QPCR_TEST_FOR1 …
#define QPCR_TEST_GET1 …
#define QPCR_TEST_FOR2 …
#define QPCR_TEST_GET2 …
#define QPCR_TEST_FOR3 …
#define QPCR_TEST_GET3 …
#define QPCR_TEST_FOR4 …
#define QPCR_TEST_GET4 …
#define QOPR_CLOCK_X1 …
#define QOPR_CLOCK_X2 …
#define QOPR_CLOCK_X4 …
#define QOPR_CLOCK_X8 …
#define QOPR_CLOCK_RATE_MASK …
static struct pci_device_id quatech_cards[] = …;
static int pci_quatech_rqopr(struct uart_8250_port *port)
{ … }
static void pci_quatech_wqopr(struct uart_8250_port *port, u8 qopr)
{ … }
static int pci_quatech_rqmcr(struct uart_8250_port *port)
{ … }
static void pci_quatech_wqmcr(struct uart_8250_port *port, u8 qmcr)
{ … }
static int pci_quatech_has_qmcr(struct uart_8250_port *port)
{ … }
static int pci_quatech_test(struct uart_8250_port *port)
{ … }
static int pci_quatech_clock(struct uart_8250_port *port)
{ … }
static int pci_quatech_rs422(struct uart_8250_port *port)
{ … }
static int pci_quatech_init(struct pci_dev *dev)
{ … }
static int pci_quatech_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int pci_default_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int
ce4100_serial_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int
pci_omegapci_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int
pci_brcm_trumanage_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
#define FINTEK_RTS_CONTROL_BY_HW …
#define FINTEK_RTS_INVERT …
static int pci_fintek_rs485_config(struct uart_port *port, struct ktermios *termios,
struct serial_rs485 *rs485)
{ … }
static const struct serial_rs485 pci_fintek_rs485_supported = …;
static int pci_fintek_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int pci_fintek_init(struct pci_dev *dev)
{ … }
static void f815xxa_mem_serial_out(struct uart_port *p, int offset, int value)
{ … }
static int pci_fintek_f815xxa_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int pci_fintek_f815xxa_init(struct pci_dev *dev)
{ … }
static int skip_tx_en_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static void kt_handle_break(struct uart_port *p)
{ … }
static unsigned int kt_serial_in(struct uart_port *p, int offset)
{ … }
static int kt_serial_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int pci_eg20t_init(struct pci_dev *dev)
{ … }
static int
pci_wch_ch353_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int
pci_wch_ch355_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static int
pci_wch_ch38x_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
#define CH384_XINT_ENABLE_REG …
#define CH384_XINT_ENABLE_BIT …
static int pci_wch_ch38x_init(struct pci_dev *dev)
{ … }
static void pci_wch_ch38x_exit(struct pci_dev *dev)
{ … }
static int
pci_sunix_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
#define MOXA_PUART_GPIO_EN …
#define MOXA_PUART_GPIO_OUT …
#define MOXA_GPIO_PIN2 …
#define MOXA_RS232 …
#define MOXA_RS422 …
#define MOXA_RS485_4W …
#define MOXA_RS485_2W …
#define MOXA_UIR_OFFSET …
#define MOXA_EVEN_RS_MASK …
#define MOXA_ODD_RS_MASK …
enum { … };
static unsigned short moxa_get_nports(unsigned short device)
{ … }
static bool pci_moxa_is_mini_pcie(unsigned short device)
{ … }
static unsigned int pci_moxa_supported_rs(struct pci_dev *dev)
{ … }
static int pci_moxa_set_interface(const struct pci_dev *dev,
unsigned int port_idx,
u8 mode)
{ … }
static int pci_moxa_init(struct pci_dev *dev)
{ … }
static int
pci_moxa_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
{ … }
static struct pci_serial_quirk pci_serial_quirks[] = …;
static inline int quirk_id_matches(u32 quirk_id, u32 dev_id)
{ … }
static struct pci_serial_quirk *find_quirk(struct pci_dev *dev)
{ … }
enum pci_board_num_t { … };
static struct pciserial_board pci_boards[] = …;
#define REPORT_CONFIG(option) …
#define REPORT_8250_CONFIG(option) …
static const struct pci_device_id blacklist[] = …;
static int serial_pci_is_class_communication(struct pci_dev *dev)
{ … }
static int
serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
{ … }
static inline int
serial_pci_matches(const struct pciserial_board *board,
const struct pciserial_board *guessed)
{ … }
struct serial_private *
pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
{ … }
EXPORT_SYMBOL_GPL(…);
static void pciserial_detach_ports(struct serial_private *priv)
{ … }
void pciserial_remove_ports(struct serial_private *priv)
{ … }
EXPORT_SYMBOL_GPL(…);
void pciserial_suspend_ports(struct serial_private *priv)
{ … }
EXPORT_SYMBOL_GPL(…);
void pciserial_resume_ports(struct serial_private *priv)
{ … }
EXPORT_SYMBOL_GPL(…);
static int
pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
{ … }
static void pciserial_remove_one(struct pci_dev *dev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int pciserial_suspend_one(struct device *dev)
{ … }
static int pciserial_resume_one(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(pciserial_pm_ops, pciserial_suspend_one,
pciserial_resume_one);
static const struct pci_device_id serial_pci_tbl[] = …;
static pci_ers_result_t serial8250_io_error_detected(struct pci_dev *dev,
pci_channel_state_t state)
{ … }
static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
{ … }
static void serial8250_io_resume(struct pci_dev *dev)
{ … }
static const struct pci_error_handlers serial8250_err_handler = …;
static struct pci_driver serial_pci_driver = …;
module_pci_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_DEVICE_TABLE(pci, serial_pci_tbl);
MODULE_IMPORT_NS(…);