drivers/s390/char/tape_3490.c
Source file repositories/reference/linux-study-clean/drivers/s390/char/tape_3490.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/char/tape_3490.c- Extension
.c- Size
- 22668 bytes
- Lines
- 826
- 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.
- 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/export.hlinux/module.hlinux/init.hlinux/bio.hlinux/workqueue.hlinux/slab.htape.htape_std.h
Detected Declarations
struct tape_3490_block_idstruct tape_3490_workfunction __tape_3490_medium_sensefunction tape_3490_medium_sensefunction tape_3490_medium_sense_asyncfunction tape_3490_work_handlerfunction tape_3490_schedule_workfunction tape_3490_donefunction tape_3490_erp_failedfunction tape_3490_erp_succeededfunction tape_3490_erp_retryfunction tape_3490_unsolicited_irqfunction tape_3490_erp_bugfunction tape_3490_erp_overrunfunction tape_3490_erp_sequencefunction tape_3490_unit_checkfunction tape_3490_irqfunction tape_3490_setup_devicefunction tape_3490_cleanup_devicefunction tape_3490_mttellfunction tape_3490_mtseekfunction tape_3490_onlinefunction tape_3490_initfunction tape_3490_exitexport TAPE_DBF_AREA
Annotated Snippet
struct tape_3490_block_id {
unsigned int unused : 10;
unsigned int block : 22;
};
/*
* Medium sense for 3490 tapes. There is no 'real' medium sense call.
* So we just do a normal sense.
*/
static void __tape_3490_medium_sense(struct tape_request *request)
{
struct tape_device *device = request->device;
unsigned char *sense;
if (request->rc == 0) {
sense = request->cpdata;
/*
* This isn't quite correct. But since INTERVENTION_REQUIRED
* means that the drive is 'neither ready nor on-line' it is
* only slightly inaccurate to say there is no tape loaded if
* the drive isn't online...
*/
if (sense[0] & SENSE_INTERVENTION_REQUIRED)
tape_med_state_set(device, MS_UNLOADED);
else
tape_med_state_set(device, MS_LOADED);
if (sense[1] & SENSE_WRITE_PROTECT)
device->tape_generic_status |= GMT_WR_PROT(~0);
else
device->tape_generic_status &= ~GMT_WR_PROT(~0);
} else
DBF_EVENT(4, "tape_3490: medium sense failed with rc=%d\n",
request->rc);
tape_free_request(request);
}
static int tape_3490_medium_sense(struct tape_device *device)
{
struct tape_request *request;
int rc;
request = tape_alloc_request(1, 32);
if (IS_ERR(request)) {
DBF_EXCEPTION(6, "MSEN fail\n");
return PTR_ERR(request);
}
request->op = TO_MSEN;
tape_ccw_end(request->cpaddr, SENSE, 32, request->cpdata);
rc = tape_do_io_interruptible(device, request);
__tape_3490_medium_sense(request);
return rc;
}
static void tape_3490_medium_sense_async(struct tape_device *device)
{
struct tape_request *request;
request = tape_alloc_request(1, 32);
if (IS_ERR(request)) {
DBF_EXCEPTION(6, "MSEN fail\n");
return;
}
request->op = TO_MSEN;
tape_ccw_end(request->cpaddr, SENSE, 32, request->cpdata);
request->callback = (void *) __tape_3490_medium_sense;
request->callback_data = NULL;
tape_do_io_async(device, request);
}
struct tape_3490_work {
struct tape_device *device;
enum tape_op op;
struct work_struct work;
};
/*
* These functions are currently used only to schedule a medium_sense for
* later execution. This is because we get an interrupt whenever a medium
* is inserted but cannot call tape_do_io* from an interrupt context.
* Maybe that's useful for other actions we want to start from the
* interrupt handler.
* Note: the work handler is called by the system work queue. The tape
* commands started by the handler need to be asynchrounous, otherwise
* a deadlock can occur e.g. in case of a deferred cc=1 (see __tape_do_irq).
*/
static void
Annotation
- Immediate include surface: `linux/export.h`, `linux/module.h`, `linux/init.h`, `linux/bio.h`, `linux/workqueue.h`, `linux/slab.h`, `tape.h`, `tape_std.h`.
- Detected declarations: `struct tape_3490_block_id`, `struct tape_3490_work`, `function __tape_3490_medium_sense`, `function tape_3490_medium_sense`, `function tape_3490_medium_sense_async`, `function tape_3490_work_handler`, `function tape_3490_schedule_work`, `function tape_3490_done`, `function tape_3490_erp_failed`, `function tape_3490_erp_succeeded`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: integration 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.