drivers/s390/char/sclp_early_core.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/sclp_early_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/sclp_early_core.c- Extension
.c- Size
- 10536 bytes
- Lines
- 402
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hasm/processor.hasm/lowcore.hasm/ctlreg.hasm/ebcdic.hasm/irq.hasm/sections.hasm/physmem_info.hasm/facility.hasm/machine.hsclp.hsclp_rw.h
Detected Declarations
struct write_sccbstruct vt220_sccbfunction sclp_early_wait_irqfunction sclp_early_cmdfunction sclp_early_print_lmfunction sclp_early_print_vt220function sclp_early_set_event_maskfunction sclp_early_con_check_linemodefunction sclp_early_con_check_vt220function sclp_early_setupfunction sclp_early_set_bufferfunction consolefunction sclp_early_printkfunction sclp_emergency_printkfunction sclp_early_read_infofunction sclp_early_get_infofunction sclp_early_get_memsizefunction sclp_early_get_hsa_sizefunction sclp_early_detect_machine_featuresfunction add_physmem_online_range
Annotated Snippet
struct write_sccb {
struct sccb_header header;
struct msg_buf msg;
} __packed;
/* Output multi-line text using SCLP Message interface. */
static void sclp_early_print_lm(const char *str, unsigned int len)
{
unsigned char *ptr, *end, ch;
unsigned int count, offset;
struct write_sccb *sccb;
struct msg_buf *msg;
struct mdb *mdb;
struct mto *mto;
struct go *go;
sccb = (struct write_sccb *) sclp_early_sccb;
end = (unsigned char *) sccb + EARLY_SCCB_SIZE - 1;
memset(sccb, 0, sizeof(*sccb));
ptr = (unsigned char *) &sccb->msg.mdb.mto;
offset = 0;
do {
for (count = sizeof(*mto); offset < len; count++) {
ch = str[offset++];
if ((ch == 0x0a) || (ptr + count > end))
break;
ptr[count] = _ascebc[ch];
}
mto = (struct mto *) ptr;
memset(mto, 0, sizeof(*mto));
mto->length = count;
mto->type = 4;
mto->line_type_flags = LNTPFLGS_ENDTEXT;
ptr += count;
} while ((offset < len) && (ptr + sizeof(*mto) <= end));
len = ptr - (unsigned char *) sccb;
sccb->header.length = len - offsetof(struct write_sccb, header);
msg = &sccb->msg;
msg->header.type = EVTYP_MSG;
msg->header.length = len - offsetof(struct write_sccb, msg.header);
mdb = &msg->mdb;
mdb->header.type = 1;
mdb->header.tag = 0xD4C4C240;
mdb->header.revision_code = 1;
mdb->header.length = len - offsetof(struct write_sccb, msg.mdb.header);
go = &mdb->go;
go->length = sizeof(*go);
go->type = 1;
sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_DATA, sccb);
}
struct vt220_sccb {
struct sccb_header header;
struct {
struct evbuf_header header;
char data[];
} msg;
} __packed;
/* Output multi-line text using SCLP VT220 interface. */
static void sclp_early_print_vt220(const char *str, unsigned int len)
{
struct vt220_sccb *sccb;
sccb = (struct vt220_sccb *) sclp_early_sccb;
if (sizeof(*sccb) + len >= EARLY_SCCB_SIZE)
len = EARLY_SCCB_SIZE - sizeof(*sccb);
memset(sccb, 0, sizeof(*sccb));
memcpy(&sccb->msg.data, str, len);
sccb->header.length = sizeof(*sccb) + len;
sccb->msg.header.length = sizeof(sccb->msg) + len;
sccb->msg.header.type = EVTYP_VT220MSG;
sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_DATA, sccb);
}
int sclp_early_set_event_mask(struct init_sccb *sccb,
sccb_mask_t receive_mask,
sccb_mask_t send_mask)
{
retry:
memset(sccb, 0, sizeof(*sccb));
sccb->header.length = sizeof(*sccb);
if (sclp_mask_compat_mode)
sccb->mask_length = SCLP_MASK_SIZE_COMPAT;
else
sccb->mask_length = sizeof(sccb_mask_t);
sccb_set_recv_mask(sccb, receive_mask);
sccb_set_send_mask(sccb, send_mask);
if (sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_MASK, sccb))
return -EIO;
Annotation
- Immediate include surface: `linux/kernel.h`, `asm/processor.h`, `asm/lowcore.h`, `asm/ctlreg.h`, `asm/ebcdic.h`, `asm/irq.h`, `asm/sections.h`, `asm/physmem_info.h`.
- Detected declarations: `struct write_sccb`, `struct vt220_sccb`, `function sclp_early_wait_irq`, `function sclp_early_cmd`, `function sclp_early_print_lm`, `function sclp_early_print_vt220`, `function sclp_early_set_event_mask`, `function sclp_early_con_check_linemode`, `function sclp_early_con_check_vt220`, `function sclp_early_setup`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: source implementation candidate.
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.