drivers/tty/synclink_gt.c
Source file repositories/reference/linux-study-clean/drivers/tty/synclink_gt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/synclink_gt.c- Extension
.c- Size
- 130425 bytes
- Lines
- 5039
- Domain
- Driver Families
- Bucket
- drivers/tty
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/errno.hlinux/signal.hlinux/sched.hlinux/timer.hlinux/interrupt.hlinux/pci.hlinux/tty.hlinux/tty_flip.hlinux/serial.hlinux/major.hlinux/string.hlinux/fcntl.hlinux/ptrace.hlinux/ioport.hlinux/mm.hlinux/seq_file.hlinux/slab.hlinux/netdevice.hlinux/vmalloc.hlinux/init.hlinux/delay.hlinux/ioctl.hlinux/termios.hlinux/bitops.hlinux/workqueue.hlinux/hdlc.hlinux/synclink.hasm/io.hasm/irq.hasm/dma.hasm/types.h
Detected Declarations
struct cond_waitstruct slgt_descstruct _input_signal_eventsstruct slgt_infofunction trace_blockfunction dump_tbufsfunction dump_rbufsfunction sanity_checkfunction ldisc_receive_buffunction openfunction closefunction hangupfunction set_termiosfunction update_tx_timerfunction writefunction put_charfunction send_xcharfunction wait_until_sentfunction write_roomfunction flush_charsfunction flush_bufferfunction throttlefunction releasefunction ioctlfunction get_icountfunction get_params32function set_params32function slgt_compat_ioctlfunction line_infofunction synclink_gt_proc_showfunction chars_in_bufferfunction datafunction datafunction set_breakfunction sequencefunction hdlcdev_xmitfunction hdlcdev_openfunction hdlcdev_closefunction hdlcdev_ioctlfunction hdlcdev_tx_timeoutfunction hdlcdev_tx_donefunction hdlcdev_rxfunction hdlcdev_initfunction hdlcdev_exitfunction rx_asyncfunction bh_actionfunction bh_handlerfunction bh_transmit
Annotated Snippet
static struct pci_driver pci_driver = {
.name = "synclink_gt",
.id_table = pci_table,
.probe = init_one,
.remove = remove_one,
};
static bool pci_registered;
/*
* module configuration and status
*/
static struct slgt_info *slgt_device_list;
static int slgt_device_count;
static int ttymajor;
static int debug_level;
static int maxframe[MAX_DEVICES];
module_param(ttymajor, int, 0);
module_param(debug_level, int, 0);
module_param_array(maxframe, int, NULL, 0);
MODULE_PARM_DESC(ttymajor, "TTY major device number override: 0=auto assigned");
MODULE_PARM_DESC(debug_level, "Debug syslog output: 0=disabled, 1 to 5=increasing detail");
MODULE_PARM_DESC(maxframe, "Maximum frame size used by device (4096 to 65535)");
/*
* tty support and callbacks
*/
static struct tty_driver *serial_driver;
static void wait_until_sent(struct tty_struct *tty, int timeout);
static void flush_buffer(struct tty_struct *tty);
static void tx_release(struct tty_struct *tty);
/*
* generic HDLC support
*/
#define dev_to_port(D) (dev_to_hdlc(D)->priv)
/*
* device specific structures, macros and functions
*/
#define SLGT_MAX_PORTS 4
#define SLGT_REG_SIZE 256
/*
* conditional wait facility
*/
struct cond_wait {
struct cond_wait *next;
wait_queue_head_t q;
wait_queue_entry_t wait;
unsigned int data;
};
static void flush_cond_wait(struct cond_wait **head);
/*
* DMA buffer descriptor and access macros
*/
struct slgt_desc
{
__le16 count;
__le16 status;
__le32 pbuf; /* physical address of data buffer */
__le32 next; /* physical address of next descriptor */
/* driver book keeping */
char *buf; /* virtual address of data buffer */
unsigned int pdesc; /* physical address of this descriptor */
dma_addr_t buf_dma_addr;
unsigned short buf_count;
};
#define set_desc_buffer(a,b) (a).pbuf = cpu_to_le32((unsigned int)(b))
#define set_desc_next(a,b) (a).next = cpu_to_le32((unsigned int)(b))
#define set_desc_count(a,b)(a).count = cpu_to_le16((unsigned short)(b))
#define set_desc_eof(a,b) (a).status = cpu_to_le16((b) ? (le16_to_cpu((a).status) | BIT0) : (le16_to_cpu((a).status) & ~BIT0))
#define set_desc_status(a, b) (a).status = cpu_to_le16((unsigned short)(b))
#define desc_count(a) (le16_to_cpu((a).count))
#define desc_status(a) (le16_to_cpu((a).status))
#define desc_complete(a) (le16_to_cpu((a).status) & BIT15)
#define desc_eof(a) (le16_to_cpu((a).status) & BIT2)
#define desc_crc_error(a) (le16_to_cpu((a).status) & BIT1)
#define desc_abort(a) (le16_to_cpu((a).status) & BIT0)
#define desc_residue(a) ((le16_to_cpu((a).status) & 0x38) >> 3)
Annotation
- Immediate include surface: `linux/module.h`, `linux/errno.h`, `linux/signal.h`, `linux/sched.h`, `linux/timer.h`, `linux/interrupt.h`, `linux/pci.h`, `linux/tty.h`.
- Detected declarations: `struct cond_wait`, `struct slgt_desc`, `struct _input_signal_events`, `struct slgt_info`, `function trace_block`, `function dump_tbufs`, `function dump_rbufs`, `function sanity_check`, `function ldisc_receive_buf`, `function open`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.