drivers/s390/char/sclp_cpi_sys.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/sclp_cpi_sys.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/sclp_cpi_sys.c- Extension
.c- Size
- 8700 bytes
- Lines
- 428
- Domain
- Driver Families
- Bucket
- drivers/s390
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/kernel.hlinux/init.hlinux/stat.hlinux/device.hlinux/string.hlinux/ctype.hlinux/kmod.hlinux/timer.hlinux/err.hlinux/slab.hlinux/completion.hlinux/export.hasm/ebcdic.hasm/sclp.hsclp.hsclp_rw.hsclp_cpi_sys.h
Detected Declarations
struct cpi_evbufstruct cpi_sccbfunction set_datafunction cpi_callbackfunction cpi_free_reqfunction cpi_reqfunction check_stringfunction set_stringfunction system_name_showfunction system_name_storefunction sysplex_name_showfunction sysplex_name_storefunction system_type_showfunction system_type_storefunction system_level_showfunction system_level_storefunction set_storefunction sclp_cpi_set_datafunction cpi_initexport sclp_cpi_set_data
Annotated Snippet
struct cpi_evbuf {
struct evbuf_header header;
u8 id_format;
u8 reserved0;
u8 system_type[CPI_LENGTH_NAME];
u64 reserved1;
u8 system_name[CPI_LENGTH_NAME];
u64 reserved2;
u64 system_level;
u64 reserved3;
u8 sysplex_name[CPI_LENGTH_NAME];
u8 reserved4[16];
} __attribute__((packed));
struct cpi_sccb {
struct sccb_header header;
struct cpi_evbuf cpi_evbuf;
} __attribute__((packed));
static struct sclp_register sclp_cpi_event = {
.send_mask = EVTYP_CTLPROGIDENT_MASK,
};
static char system_name[CPI_LENGTH_NAME + 1];
static char sysplex_name[CPI_LENGTH_NAME + 1];
static char system_type[CPI_LENGTH_NAME + 1];
static u64 system_level;
static void set_data(char *field, char *data)
{
memset(field, ' ', CPI_LENGTH_NAME);
memcpy(field, data, strlen(data));
sclp_ascebc_str(field, CPI_LENGTH_NAME);
}
static void cpi_callback(struct sclp_req *req, void *data)
{
struct completion *completion = data;
complete(completion);
}
static struct sclp_req *cpi_prepare_req(void)
{
struct sclp_req *req;
struct cpi_sccb *sccb;
struct cpi_evbuf *evb;
req = kzalloc_obj(struct sclp_req);
if (!req)
return ERR_PTR(-ENOMEM);
sccb = (struct cpi_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
if (!sccb) {
kfree(req);
return ERR_PTR(-ENOMEM);
}
/* setup SCCB for Control-Program Identification */
sccb->header.length = sizeof(struct cpi_sccb);
sccb->cpi_evbuf.header.length = sizeof(struct cpi_evbuf);
sccb->cpi_evbuf.header.type = EVTYP_CTLPROGIDENT;
evb = &sccb->cpi_evbuf;
/* set system type */
set_data(evb->system_type, system_type);
/* set system name */
set_data(evb->system_name, system_name);
/* set system level */
evb->system_level = system_level;
/* set sysplex name */
set_data(evb->sysplex_name, sysplex_name);
/* prepare request data structure presented to SCLP driver */
req->command = SCLP_CMDW_WRITE_EVENT_DATA;
req->sccb = sccb;
req->status = SCLP_REQ_FILLED;
req->callback = cpi_callback;
return req;
}
static void cpi_free_req(struct sclp_req *req)
{
free_page((unsigned long) req->sccb);
kfree(req);
}
static int cpi_req(void)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/stat.h`, `linux/device.h`, `linux/string.h`, `linux/ctype.h`, `linux/kmod.h`, `linux/timer.h`.
- Detected declarations: `struct cpi_evbuf`, `struct cpi_sccb`, `function set_data`, `function cpi_callback`, `function cpi_free_req`, `function cpi_req`, `function check_string`, `function set_string`, `function system_name_show`, `function system_name_store`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: integration 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.