drivers/s390/char/sclp_sdias.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/sclp_sdias.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/sclp_sdias.c- Extension
.c- Size
- 6694 bytes
- Lines
- 277
- 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/completion.hlinux/sched.hasm/sclp.hasm/debug.hasm/ipl.hsclp_sdias.hsclp.hsclp_rw.h
Detected Declarations
function completedfunction sdias_callbackfunction sdias_sclp_sendfunction blocksfunction storagefunction sclp_sdias_register_checkfunction sclp_sdias_init_syncfunction sclp_sdias_init_asyncfunction sclp_sdias_init
Annotated Snippet
if (rc) {
/* not initiated, wait some time and retry */
set_current_state(TASK_INTERRUPTIBLE);
TRACE("add request failed: rc = %i\n",rc);
schedule_timeout(msecs_to_jiffies(500));
continue;
}
/* initiated, wait for completion of service call */
wait_for_completion(&evbuf_accepted);
if (req->status == SCLP_REQ_FAILED) {
TRACE("sclp request failed\n");
continue;
}
/* if not accepted, retry */
if (!(sccb->evbuf.hdr.flags & 0x80)) {
TRACE("sclp request failed: flags=%x\n",
sccb->evbuf.hdr.flags);
continue;
}
/*
* for the sync interface the response is in the initial sccb
*/
if (!sclp_sdias_register.receiver_fn) {
memcpy(&sdias_evbuf, &sccb->evbuf, sizeof(sdias_evbuf));
TRACE("sync request done\n");
return 0;
}
/* otherwise we wait for completion */
wait_for_completion(&evbuf_done);
TRACE("request done\n");
return 0;
}
return -EIO;
}
/*
* Get number of blocks (4K) available in the HSA
*/
int sclp_sdias_blk_count(void)
{
struct sdias_sccb *sccb = sclp_sdias_sccb;
struct sclp_req request;
int rc;
mutex_lock(&sdias_mutex);
memset(sccb, 0, sizeof(*sccb));
memset(&request, 0, sizeof(request));
sccb->hdr.length = sizeof(*sccb);
sccb->evbuf.hdr.length = sizeof(struct sdias_evbuf);
sccb->evbuf.hdr.type = EVTYP_SDIAS;
sccb->evbuf.event_qual = SDIAS_EQ_SIZE;
sccb->evbuf.data_id = SDIAS_DI_FCP_DUMP;
sccb->evbuf.event_id = 4712;
sccb->evbuf.dbs = 1;
request.sccb = sccb;
request.command = SCLP_CMDW_WRITE_EVENT_DATA;
request.status = SCLP_REQ_FILLED;
request.callback = sdias_callback;
rc = sdias_sclp_send(&request);
if (rc) {
pr_err("sclp_send failed for get_nr_blocks\n");
goto out;
}
if (sccb->hdr.response_code != 0x0020) {
TRACE("send failed: %x\n", sccb->hdr.response_code);
rc = -EIO;
goto out;
}
switch (sdias_evbuf.event_status) {
case 0:
rc = sdias_evbuf.blk_cnt;
break;
default:
pr_err("SCLP error: %x\n", sdias_evbuf.event_status);
rc = -EIO;
goto out;
}
TRACE("%i blocks\n", rc);
out:
mutex_unlock(&sdias_mutex);
return rc;
}
/*
* Copy from HSA to absolute storage (not reentrant):
Annotation
- Immediate include surface: `linux/completion.h`, `linux/sched.h`, `asm/sclp.h`, `asm/debug.h`, `asm/ipl.h`, `sclp_sdias.h`, `sclp.h`, `sclp_rw.h`.
- Detected declarations: `function completed`, `function sdias_callback`, `function sdias_sclp_send`, `function blocks`, `function storage`, `function sclp_sdias_register_check`, `function sclp_sdias_init_sync`, `function sclp_sdias_init_async`, `function sclp_sdias_init`.
- 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.