drivers/scsi/qla4xxx/ql4_83xx.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla4xxx/ql4_83xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla4xxx/ql4_83xx.c- Extension
.c- Size
- 44290 bytes
- Lines
- 1585
- 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.
- 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/ratelimit.hql4_def.hql4_version.hql4_glbl.hql4_dbg.hql4_inline.h
Detected Declarations
struct device_infofunction Copyrightfunction qla4_83xx_wr_regfunction qla4_83xx_set_win_basefunction qla4_83xx_rd_reg_indirectfunction qla4_83xx_wr_reg_indirectfunction qla4_83xx_flash_lockfunction qla4_83xx_flash_unlockfunction qla4_83xx_flash_read_u32function qla4_83xx_lockless_flash_read_u32function qla4_83xx_rom_lock_recoveryfunction qla4_83xx_lock_recoveryfunction qla4_83xx_drv_lockfunction qla4_83xx_drv_unlockfunction qla4_83xx_set_idc_dontresetfunction qla4_83xx_clear_idc_dontresetfunction qla4_83xx_idc_dontresetfunction qla4_83xx_can_perform_resetfunction qla4_83xx_need_reset_handlerfunction qla4_83xx_get_idc_paramfunction qla4_83xx_dump_reset_seq_hdrfunction qla4_83xx_copy_bootloaderfunction qla4_83xx_check_cmd_peg_statusfunction qla4_83xx_poll_regfunction qla4_83xx_reset_seq_checksum_testfunction qla4_83xx_read_reset_templatefunction qla4_83xx_read_write_crb_regfunction qla4_83xx_rmw_crb_regfunction qla4_83xx_write_listfunction qla4_83xx_read_write_listfunction qla4_83xx_poll_listfunction qla4_83xx_poll_write_listfunction qla4_83xx_read_modify_writefunction qla4_83xx_pausefunction qla4_83xx_poll_read_listfunction qla4_83xx_seq_endfunction qla4_83xx_template_endfunction qla4_83xx_process_reset_templatefunction qla4_83xx_process_stop_seqfunction qla4_83xx_process_start_seqfunction qla4_83xx_process_init_seqfunction qla4_83xx_restartfunction qla4_83xx_start_firmwarefunction qla4_83xx_disable_iocb_intrsfunction qla4_83xx_disable_mbox_intrsfunction qla4_83xx_disable_intrsfunction qla4_83xx_enable_iocb_intrsfunction qla4_83xx_enable_mbox_intrs
Annotated Snippet
struct device_info {
int func_num;
int device_type;
int port_num;
};
int qla4_83xx_can_perform_reset(struct scsi_qla_host *ha)
{
uint32_t drv_active;
uint32_t dev_part, dev_part1, dev_part2;
int i;
struct device_info device_map[16];
int func_nibble;
int nibble;
int nic_present = 0;
int iscsi_present = 0;
int iscsi_func_low = 0;
/* Use the dev_partition register to determine the PCI function number
* and then check drv_active register to see which driver is loaded */
dev_part1 = qla4_83xx_rd_reg(ha,
ha->reg_tbl[QLA8XXX_CRB_DEV_PART_INFO]);
dev_part2 = qla4_83xx_rd_reg(ha, QLA83XX_CRB_DEV_PART_INFO2);
drv_active = qla4_83xx_rd_reg(ha, ha->reg_tbl[QLA8XXX_CRB_DRV_ACTIVE]);
/* Each function has 4 bits in dev_partition Info register,
* Lower 2 bits - device type, Upper 2 bits - physical port number */
dev_part = dev_part1;
for (i = nibble = 0; i <= 15; i++, nibble++) {
func_nibble = dev_part & (0xF << (nibble * 4));
func_nibble >>= (nibble * 4);
device_map[i].func_num = i;
device_map[i].device_type = func_nibble & 0x3;
device_map[i].port_num = func_nibble & 0xC;
if (device_map[i].device_type == NIC_CLASS) {
if (drv_active & (1 << device_map[i].func_num)) {
nic_present++;
break;
}
} else if (device_map[i].device_type == ISCSI_CLASS) {
if (drv_active & (1 << device_map[i].func_num)) {
if (!iscsi_present ||
iscsi_func_low > device_map[i].func_num)
iscsi_func_low = device_map[i].func_num;
iscsi_present++;
}
}
/* For function_num[8..15] get info from dev_part2 register */
if (nibble == 7) {
nibble = 0;
dev_part = dev_part2;
}
}
/* NIC, iSCSI and FCOE are the Reset owners based on order, NIC gets
* precedence over iSCSI and FCOE and iSCSI over FCOE, based on drivers
* present. */
if (!nic_present && (ha->func_num == iscsi_func_low)) {
DEBUG2(ql4_printk(KERN_INFO, ha,
"%s: can reset - NIC not present and lower iSCSI function is %d\n",
__func__, ha->func_num));
return 1;
}
return 0;
}
/**
* qla4_83xx_need_reset_handler - Code to start reset sequence
* @ha: pointer to adapter structure
*
* Note: IDC lock must be held upon entry
**/
void qla4_83xx_need_reset_handler(struct scsi_qla_host *ha)
{
uint32_t dev_state, drv_state, drv_active;
unsigned long reset_timeout, dev_init_timeout;
ql4_printk(KERN_INFO, ha, "%s: Performing ISP error recovery\n",
__func__);
if (!test_bit(AF_8XXX_RST_OWNER, &ha->flags)) {
DEBUG2(ql4_printk(KERN_INFO, ha, "%s: reset acknowledged\n",
__func__));
qla4_8xxx_set_rst_ready(ha);
/* Non-reset owners ACK Reset and wait for device INIT state
Annotation
- Immediate include surface: `linux/ratelimit.h`, `ql4_def.h`, `ql4_version.h`, `ql4_glbl.h`, `ql4_dbg.h`, `ql4_inline.h`.
- Detected declarations: `struct device_info`, `function Copyright`, `function qla4_83xx_wr_reg`, `function qla4_83xx_set_win_base`, `function qla4_83xx_rd_reg_indirect`, `function qla4_83xx_wr_reg_indirect`, `function qla4_83xx_flash_lock`, `function qla4_83xx_flash_unlock`, `function qla4_83xx_flash_read_u32`, `function qla4_83xx_lockless_flash_read_u32`.
- Atlas domain: Driver Families / drivers/scsi.
- 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.