drivers/scsi/qlogicpti.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qlogicpti.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qlogicpti.c- Extension
.c- Size
- 40976 bytes
- Lines
- 1476
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/delay.hlinux/types.hlinux/string.hlinux/gfp.hlinux/blkdev.hlinux/proc_fs.hlinux/stat.hlinux/init.hlinux/spinlock.hlinux/interrupt.hlinux/module.hlinux/jiffies.hlinux/dma-mapping.hlinux/of.hlinux/platform_device.hlinux/firmware.hlinux/pgtable.hasm/byteorder.hqlogicpti.hasm/dma.hasm/ptrace.hasm/oplib.hasm/io.hasm/irq.hscsi/scsi.hscsi/scsi_cmnd.hscsi/scsi_device.hscsi/scsi_eh.hscsi/scsi_tcq.hscsi/scsi_host.h
Detected Declarations
function qlogicpti_enable_irqsfunction qlogicpti_disable_irqsfunction set_sbus_cfg1function qlogicpti_mbox_commandfunction qlogicpti_set_hostdev_defaultsfunction qlogicpti_reset_hardwarefunction qlogicpti_load_firmwarefunction qlogicpti_verify_tmonfunction qpti_chain_addfunction qpti_chain_delfunction qpti_map_regsfunction qpti_register_irqfunction qpti_get_scsi_idfunction qpti_get_burstsfunction qpti_get_clockfunction qpti_map_queuesfunction marker_frobfunction cmd_frobfunction load_cmdfunction for_each_sgfunction for_each_sgfunction update_can_queuefunction qlogicpti_sdev_configurefunction handlerfunction DEF_SCSI_QCMDfunction qpti_intrfunction qlogicpti_abortfunction qlogicpti_resetfunction qpti_sbus_probefunction qpti_sbus_remove
Annotated Snippet
if (qpti->ultra) {
qpti->dev_param[i].synchronous_period = 12;
qpti->dev_param[i].synchronous_offset = 8;
} else {
qpti->dev_param[i].synchronous_period = 25;
qpti->dev_param[i].synchronous_offset = 12;
}
qpti->dev_param[i].device_enable = 1;
}
}
static int qlogicpti_reset_hardware(struct Scsi_Host *host)
{
struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata;
u_short param[6];
unsigned short risc_code_addr;
int loop_count, i;
unsigned long flags;
risc_code_addr = 0x1000; /* all load addresses are at 0x1000 */
spin_lock_irqsave(host->host_lock, flags);
sbus_writew(HCCTRL_PAUSE, qpti->qregs + HCCTRL);
/* Only reset the scsi bus if it is not free. */
if (sbus_readw(qpti->qregs + CPU_PCTRL) & CPU_PCTRL_BSY) {
sbus_writew(CPU_ORIDE_RMOD, qpti->qregs + CPU_ORIDE);
sbus_writew(CPU_CMD_BRESET, qpti->qregs + CPU_CMD);
udelay(400);
}
sbus_writew(SBUS_CTRL_RESET, qpti->qregs + SBUS_CTRL);
sbus_writew((DMA_CTRL_CCLEAR | DMA_CTRL_CIRQ), qpti->qregs + CMD_DMA_CTRL);
sbus_writew((DMA_CTRL_CCLEAR | DMA_CTRL_CIRQ), qpti->qregs + DATA_DMA_CTRL);
loop_count = DEFAULT_LOOP_COUNT;
while (--loop_count && ((sbus_readw(qpti->qregs + MBOX0) & 0xff) == 0x04))
udelay(20);
if (!loop_count)
printk(KERN_EMERG "qlogicpti%d: reset_hardware loop timeout\n",
qpti->qpti_id);
sbus_writew(HCCTRL_PAUSE, qpti->qregs + HCCTRL);
set_sbus_cfg1(qpti);
qlogicpti_enable_irqs(qpti);
if (sbus_readw(qpti->qregs + RISC_PSR) & RISC_PSR_ULTRA) {
qpti->ultra = 1;
sbus_writew((RISC_MTREG_P0ULTRA | RISC_MTREG_P1ULTRA),
qpti->qregs + RISC_MTREG);
} else {
qpti->ultra = 0;
sbus_writew((RISC_MTREG_P0DFLT | RISC_MTREG_P1DFLT),
qpti->qregs + RISC_MTREG);
}
/* reset adapter and per-device default values. */
/* do it after finding out whether we're ultra mode capable */
qlogicpti_set_hostdev_defaults(qpti);
/* Release the RISC processor. */
sbus_writew(HCCTRL_REL, qpti->qregs + HCCTRL);
/* Get RISC to start executing the firmware code. */
param[0] = MBOX_EXEC_FIRMWARE;
param[1] = risc_code_addr;
if (qlogicpti_mbox_command(qpti, param, 1)) {
printk(KERN_EMERG "qlogicpti%d: Cannot execute ISP firmware.\n",
qpti->qpti_id);
spin_unlock_irqrestore(host->host_lock, flags);
return 1;
}
/* Set initiator scsi ID. */
param[0] = MBOX_SET_INIT_SCSI_ID;
param[1] = qpti->host_param.initiator_scsi_id;
if (qlogicpti_mbox_command(qpti, param, 1) ||
(param[0] != MBOX_COMMAND_COMPLETE)) {
printk(KERN_EMERG "qlogicpti%d: Cannot set initiator SCSI ID.\n",
qpti->qpti_id);
spin_unlock_irqrestore(host->host_lock, flags);
return 1;
}
/* Initialize state of the queues, both hw and sw. */
qpti->req_in_ptr = qpti->res_out_ptr = 0;
param[0] = MBOX_INIT_RES_QUEUE;
param[1] = RES_QUEUE_LEN + 1;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/delay.h`, `linux/types.h`, `linux/string.h`, `linux/gfp.h`, `linux/blkdev.h`, `linux/proc_fs.h`, `linux/stat.h`.
- Detected declarations: `function qlogicpti_enable_irqs`, `function qlogicpti_disable_irqs`, `function set_sbus_cfg1`, `function qlogicpti_mbox_command`, `function qlogicpti_set_hostdev_defaults`, `function qlogicpti_reset_hardware`, `function qlogicpti_load_firmware`, `function qlogicpti_verify_tmon`, `function qpti_chain_add`, `function qpti_chain_del`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.