drivers/s390/char/sclp.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/sclp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/sclp.c- Extension
.c- Size
- 36366 bytes
- Lines
- 1318
- Domain
- Driver Families
- Bucket
- drivers/s390
- 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.
- 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/kernel_stat.hlinux/export.hlinux/module.hlinux/err.hlinux/panic_notifier.hlinux/spinlock.hlinux/interrupt.hlinux/timer.hlinux/reboot.hlinux/jiffies.hlinux/init.hlinux/platform_device.hasm/types.hasm/irq.hasm/debug.hsclp.h
Detected Declarations
struct sclp_trace_entrystruct sclp_statechangebuffunction sclp_tracefunction no_zeroes_lenfunction sclp_trace_binfunction abbrev_lenfunction sclp_trace_sccbfunction sclp_trace_evbuffunction sclp_trace_reqfunction sclp_trace_registerfunction sclp_setup_console_pagesfunction sclp_setup_console_dropfunction __sclp_queue_read_reqfunction __sclp_set_request_timerfunction sclp_request_timeout_restartfunction sclp_request_timeout_normalfunction sclp_request_timeoutfunction __sclp_req_queue_find_next_timeoutfunction list_for_each_entryfunction sclp_req_queue_timeoutfunction sclp_service_call_tracefunction __sclp_start_requestfunction sclp_process_queuefunction __sclp_can_add_requestfunction sclp_add_requestfunction sclp_dispatch_evbufsfunction list_for_eachfunction sclp_read_cbfunction __sclp_make_read_reqfunction __sclp_find_reqfunction list_for_eachfunction ok_responsefunction sclp_interrupt_handlerfunction sclp_tod_from_jiffiesfunction sclp_sync_waitfunction sclp_dispatch_state_changefunction list_for_eachfunction sclp_state_change_cbfunction __sclp_get_maskfunction sclp_registerfunction sclp_unregisterfunction sclp_remove_processedfunction __sclp_make_init_reqfunction sclp_init_maskfunction sclp_deactivatefunction sclp_reactivatefunction sclp_check_handlerfunction sclp_check_timeout
Annotated Snippet
static ssize_t con_pages_show(struct device_driver *dev, char *buf)
{
return sysfs_emit(buf, "%i\n", sclp_console_pages);
}
static DRIVER_ATTR_RO(con_pages);
static ssize_t con_drop_store(struct device_driver *dev, const char *buf, size_t count)
{
int rc;
rc = kstrtobool(buf, &sclp_console_drop);
return rc ?: count;
}
static ssize_t con_drop_show(struct device_driver *dev, char *buf)
{
return sysfs_emit(buf, "%i\n", sclp_console_drop);
}
static DRIVER_ATTR_RW(con_drop);
static ssize_t con_full_show(struct device_driver *dev, char *buf)
{
return sysfs_emit(buf, "%lu\n", sclp_console_full);
}
static DRIVER_ATTR_RO(con_full);
static struct attribute *sclp_drv_attrs[] = {
&driver_attr_con_pages.attr,
&driver_attr_con_drop.attr,
&driver_attr_con_full.attr,
NULL,
};
static struct attribute_group sclp_drv_attr_group = {
.attrs = sclp_drv_attrs,
};
static const struct attribute_group *sclp_drv_attr_groups[] = {
&sclp_drv_attr_group,
NULL,
};
static struct platform_driver sclp_pdrv = {
.driver = {
.name = "sclp",
.groups = sclp_drv_attr_groups,
},
};
/* Initialize SCLP driver. Return zero if driver is operational, non-zero
* otherwise. */
int sclp_init(void)
{
unsigned long flags;
int rc = 0;
spin_lock_irqsave(&sclp_lock, flags);
/* Check for previous or running initialization */
if (sclp_init_state != sclp_init_state_uninitialized)
goto fail_unlock;
sclp_init_state = sclp_init_state_initializing;
sclp_read_sccb = (void *) __get_free_page(GFP_ATOMIC | GFP_DMA);
sclp_init_sccb = (void *) __get_free_page(GFP_ATOMIC | GFP_DMA);
BUG_ON(!sclp_read_sccb || !sclp_init_sccb);
/* Set up variables */
list_add(&sclp_state_change_event.list, &sclp_reg_list);
timer_setup(&sclp_request_timer, NULL, 0);
timer_setup(&sclp_queue_timer, sclp_req_queue_timeout, 0);
/* Check interface */
spin_unlock_irqrestore(&sclp_lock, flags);
rc = sclp_check_interface();
spin_lock_irqsave(&sclp_lock, flags);
if (rc)
goto fail_init_state_uninitialized;
/* Register reboot handler */
rc = register_reboot_notifier(&sclp_reboot_notifier);
if (rc)
goto fail_init_state_uninitialized;
/* Register interrupt handler */
rc = register_external_irq(EXT_IRQ_SERVICE_SIG, sclp_interrupt_handler);
if (rc)
goto fail_unregister_reboot_notifier;
sclp_init_state = sclp_init_state_initialized;
spin_unlock_irqrestore(&sclp_lock, flags);
/* Enable service-signal external interruption - needs to happen with
* IRQs enabled. */
irq_subclass_register(IRQ_SUBCLASS_SERVICE_SIGNAL);
sclp_init_mask(1);
return 0;
Annotation
- Immediate include surface: `linux/kernel_stat.h`, `linux/export.h`, `linux/module.h`, `linux/err.h`, `linux/panic_notifier.h`, `linux/spinlock.h`, `linux/interrupt.h`, `linux/timer.h`.
- Detected declarations: `struct sclp_trace_entry`, `struct sclp_statechangebuf`, `function sclp_trace`, `function no_zeroes_len`, `function sclp_trace_bin`, `function abbrev_len`, `function sclp_trace_sccb`, `function sclp_trace_evbuf`, `function sclp_trace_req`, `function sclp_trace_register`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: pattern 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.