drivers/scsi/wd33c93.c
Source file repositories/reference/linux-study-clean/drivers/scsi/wd33c93.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/wd33c93.c- Extension
.c- Size
- 65811 bytes
- Lines
- 2146
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/string.hlinux/delay.hlinux/init.hlinux/interrupt.hlinux/blkdev.hscsi/scsi.hscsi/scsi_cmnd.hscsi/scsi_device.hscsi/scsi_host.hasm/irq.hwd33c93.h
Detected Declarations
function read_wd33c93function read_wd33c93_countfunction read_aux_statfunction write_wd33c93function write_wd33c93_countfunction write_wd33c93_cmdfunction write_wd33c93_cdbfunction read_1_bytefunction round_periodfunction calc_sync_xferfunction calc_sync_msgfunction wd33c93_queuecommand_lckfunction scratchpadfunction wd33c93_executefunction DBfunction DBfunction Sincefunction wd33c93_intrfunction disconnectfunction DBfunction DBfunction DBfunction DBfunction DBfunction DBfunction DBfunction DBfunction wd33c93_host_resetfunction wd33c93_abortfunction wd33c93_setupfunction check_setup_argsfunction frequencyfunction calc_sx_tablefunction set_clk_freqfunction set_resyncfunction wd33c93_initfunction wd33c93_write_infofunction wd33c93_show_infoexport wd33c93_host_resetexport wd33c93_initexport wd33c93_abortexport wd33c93_queuecommandexport wd33c93_intrexport wd33c93_show_infoexport wd33c93_write_info
Annotated Snippet
if (scsi_pointer->phase == 0 && hostdata->no_dma == 0) {
if (hostdata->dma_setup(cmd,
(cmd->sc_data_direction == DMA_TO_DEVICE) ?
DATA_OUT_DIR : DATA_IN_DIR))
write_wd33c93_count(regs, 0); /* guarantee a DATA_PHASE interrupt */
else {
write_wd33c93_count(regs,
scsi_pointer->this_residual);
write_wd33c93(regs, WD_CONTROL,
CTRL_IDI | CTRL_EDI | hostdata->dma_mode);
hostdata->dma = D_DMA_RUNNING;
}
} else
write_wd33c93_count(regs, 0); /* guarantee a DATA_PHASE interrupt */
hostdata->state = S_RUNNING_LEVEL2;
write_wd33c93_cmd(regs, WD_CMD_SEL_ATN_XFER);
}
/*
* Since the SCSI bus can handle only 1 connection at a time,
* we get out of here now. If the selection fails, or when
* the command disconnects, we'll come back to this routine
* to search the input_Q again...
*/
DB(DB_EXECUTE,
printk("%s)EX-2 ", scsi_pointer->phase ? "d:" : ""))
}
static void
transfer_pio(const wd33c93_regs regs, uchar * buf, int cnt,
int data_in_dir, struct WD33C93_hostdata *hostdata)
{
uchar asr;
DB(DB_TRANSFER,
printk("(%p,%d,%s:", buf, cnt, data_in_dir ? "in" : "out"))
write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED);
write_wd33c93_count(regs, cnt);
write_wd33c93_cmd(regs, WD_CMD_TRANS_INFO);
if (data_in_dir) {
do {
asr = read_aux_stat(regs);
if (asr & ASR_DBR)
*buf++ = read_wd33c93(regs, WD_DATA);
} while (!(asr & ASR_INT));
} else {
do {
asr = read_aux_stat(regs);
if (asr & ASR_DBR)
write_wd33c93(regs, WD_DATA, *buf++);
} while (!(asr & ASR_INT));
}
/* Note: we are returning with the interrupt UN-cleared.
* Since (presumably) an entire I/O operation has
* completed, the bus phase is probably different, and
* the interrupt routine will discover this when it
* responds to the uncleared int.
*/
}
static void
transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd,
int data_in_dir)
{
struct scsi_pointer *scsi_pointer = WD33C93_scsi_pointer(cmd);
struct WD33C93_hostdata *hostdata;
unsigned long length;
hostdata = (struct WD33C93_hostdata *) cmd->device->host->hostdata;
/* Normally, you'd expect 'this_residual' to be non-zero here.
* In a series of scatter-gather transfers, however, this
* routine will usually be called with 'this_residual' equal
* to 0 and 'buffers_residual' non-zero. This means that a
* previous transfer completed, clearing 'this_residual', and
* now we need to setup the next scatter-gather buffer as the
* source or destination for THIS transfer.
*/
if (!scsi_pointer->this_residual && scsi_pointer->buffers_residual) {
scsi_pointer->buffer = sg_next(scsi_pointer->buffer);
--scsi_pointer->buffers_residual;
scsi_pointer->this_residual = scsi_pointer->buffer->length;
scsi_pointer->ptr = sg_virt(scsi_pointer->buffer);
}
if (!scsi_pointer->this_residual) /* avoid bogus setups */
Annotation
- Immediate include surface: `linux/module.h`, `linux/string.h`, `linux/delay.h`, `linux/init.h`, `linux/interrupt.h`, `linux/blkdev.h`, `scsi/scsi.h`, `scsi/scsi_cmnd.h`.
- Detected declarations: `function read_wd33c93`, `function read_wd33c93_count`, `function read_aux_stat`, `function write_wd33c93`, `function write_wd33c93_count`, `function write_wd33c93_cmd`, `function write_wd33c93_cdb`, `function read_1_byte`, `function round_period`, `function calc_sync_xfer`.
- Atlas domain: Driver Families / drivers/scsi.
- 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.