drivers/s390/char/sclp_vt220.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/sclp_vt220.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/sclp_vt220.c- Extension
.c- Size
- 22289 bytes
- Lines
- 846
- Domain
- Driver Families
- Bucket
- drivers/s390
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/spinlock.hlinux/panic_notifier.hlinux/list.hlinux/wait.hlinux/timer.hlinux/kernel.hlinux/sysrq.hlinux/tty.hlinux/tty_driver.hlinux/tty_flip.hlinux/errno.hlinux/mm.hlinux/major.hlinux/console.hlinux/kdev_t.hlinux/interrupt.hlinux/init.hlinux/reboot.hlinux/slab.hlinux/uaccess.hsclp.hctrlchar.h
Detected Declarations
struct sclp_vt220_requeststruct sclp_vt220_sccbfunction sclp_vt220_process_queuefunction sclp_vt220_callbackfunction __sclp_vt220_emitfunction sclp_vt220_emit_currentfunction sclp_vt220_initialize_pagefunction sclp_vt220_space_leftfunction sclp_vt220_chars_storedfunction sclp_vt220_add_msgfunction sclp_vt220_timeoutfunction sclp_vt220_drop_bufferfunction __sclp_vt220_writefunction sclp_vt220_writefunction sclp_vt220_reset_sessionfunction sclp_vt220_handle_inputfunction sclp_vt220_reset_sessionfunction sclp_vt220_receiver_fnfunction sclp_vt220_openfunction sclp_vt220_closefunction flush_charsfunction put_charfunction sclp_vt220_write_roomfunction sclp_vt220_chars_in_bufferfunction sclp_vt220_flush_bufferfunction __sclp_vt220_free_pagesfunction list_for_each_safefunction __sclp_vt220_cleanupfunction __sclp_vt220_initfunction sclp_vt220_tty_initfunction sclp_vt220_con_writefunction sclp_vt220_con_devicefunction sclp_vt220_notifyfunction sclp_vt220_con_init
Annotated Snippet
struct sclp_vt220_request {
struct list_head list;
struct sclp_req sclp_req;
int retry_count;
};
/* VT220 SCCB */
struct sclp_vt220_sccb {
struct sccb_header header;
struct evbuf_header evbuf;
};
#define SCLP_VT220_MAX_CHARS_PER_BUFFER (PAGE_SIZE - \
sizeof(struct sclp_vt220_request) - \
sizeof(struct sclp_vt220_sccb))
/* Structures and data needed to register tty driver */
static struct tty_driver *sclp_vt220_driver;
static struct tty_port sclp_vt220_port;
/* Lock to protect internal data from concurrent access */
static DEFINE_SPINLOCK(sclp_vt220_lock);
/* List of empty pages to be used as write request buffers */
static LIST_HEAD(sclp_vt220_empty);
/* List of pending requests */
static LIST_HEAD(sclp_vt220_outqueue);
/* Flag that output queue is currently running */
static int sclp_vt220_queue_running;
/* Timer used for delaying write requests to merge subsequent messages into
* a single buffer */
static struct timer_list sclp_vt220_timer;
/* Pointer to current request buffer which has been partially filled but not
* yet sent */
static struct sclp_vt220_request *sclp_vt220_current_request;
/* Counter controlling core driver initialization. */
static int __initdata sclp_vt220_init_count;
/* Flag indicating that sclp_vt220_current_request should really
* have been already queued but wasn't because the SCLP was processing
* another buffer */
static int sclp_vt220_flush_later;
static void sclp_vt220_receiver_fn(struct evbuf_header *evbuf);
static int __sclp_vt220_emit(struct sclp_vt220_request *request);
static void sclp_vt220_emit_current(void);
/* Registration structure for SCLP output event buffers */
static struct sclp_register sclp_vt220_register = {
.send_mask = EVTYP_VT220MSG_MASK,
};
/* Registration structure for SCLP input event buffers */
static struct sclp_register sclp_vt220_register_input = {
.receive_mask = EVTYP_VT220MSG_MASK,
.receiver_fn = sclp_vt220_receiver_fn,
};
/*
* Put provided request buffer back into queue and check emit pending
* buffers if necessary.
*/
static void
sclp_vt220_process_queue(struct sclp_vt220_request *request)
{
unsigned long flags;
void *page;
do {
/* Put buffer back to list of empty buffers */
page = request->sclp_req.sccb;
spin_lock_irqsave(&sclp_vt220_lock, flags);
/* Move request from outqueue to empty queue */
list_del(&request->list);
list_add_tail((struct list_head *) page, &sclp_vt220_empty);
/* Check if there is a pending buffer on the out queue. */
request = NULL;
if (!list_empty(&sclp_vt220_outqueue))
request = list_entry(sclp_vt220_outqueue.next,
struct sclp_vt220_request, list);
if (!request) {
sclp_vt220_queue_running = 0;
spin_unlock_irqrestore(&sclp_vt220_lock, flags);
Annotation
- Immediate include surface: `linux/module.h`, `linux/spinlock.h`, `linux/panic_notifier.h`, `linux/list.h`, `linux/wait.h`, `linux/timer.h`, `linux/kernel.h`, `linux/sysrq.h`.
- Detected declarations: `struct sclp_vt220_request`, `struct sclp_vt220_sccb`, `function sclp_vt220_process_queue`, `function sclp_vt220_callback`, `function __sclp_vt220_emit`, `function sclp_vt220_emit_current`, `function sclp_vt220_initialize_page`, `function sclp_vt220_space_left`, `function sclp_vt220_chars_stored`, `function sclp_vt220_add_msg`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.