drivers/scsi/qla2xxx/qla_attr.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_attr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_attr.c- Extension
.c- Size
- 91282 bytes
- Lines
- 3449
- 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.
- 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
qla_def.hqla_target.hlinux/kthread.hlinux/vmalloc.hlinux/slab.hlinux/delay.h
Detected Declarations
function qla2x00_sysfs_read_fw_dumpfunction qla2x00_sysfs_write_fw_dumpfunction qla2x00_sysfs_read_nvramfunction qla2x00_sysfs_write_nvramfunction qla2x00_sysfs_read_optromfunction qla2x00_sysfs_write_optromfunction qla2x00_sysfs_write_optrom_ctlfunction qla2x00_sysfs_read_vpdfunction qla2x00_sysfs_write_vpdfunction qla2x00_sysfs_read_sfpfunction qla2x00_sysfs_write_resetfunction qla2x00_issue_logofunction qla2x00_sysfs_read_xgmac_statsfunction qla2x00_sysfs_read_dcbx_tlvfunction qla2x00_alloc_sysfs_attrfunction qla2x00_free_sysfs_attrfunction qla2x00_fw_version_showfunction qla2x00_serial_num_showfunction qla2x00_isp_name_showfunction qla2x00_isp_id_showfunction qla2x00_model_name_showfunction qla2x00_model_desc_showfunction qla2x00_pci_info_showfunction qla2x00_link_state_showfunction qla2x00_zio_showfunction qla2x00_zio_storefunction qla2x00_zio_timer_showfunction qla2x00_zio_timer_storefunction qla_zio_threshold_showfunction qla_zio_threshold_storefunction qla2x00_beacon_showfunction qla2x00_beacon_storefunction qla2x00_beacon_config_showfunction qla2x00_beacon_config_storefunction qla2x00_optrom_bios_version_showfunction qla2x00_optrom_efi_version_showfunction qla2x00_optrom_fcode_version_showfunction qla2x00_optrom_fw_version_showfunction qla2x00_optrom_gold_fw_version_showfunction qla2x00_total_isp_aborts_showfunction qla24xx_84xx_fw_version_showfunction qla2x00_serdes_version_showfunction qla2x00_mpi_version_showfunction qla2x00_phy_version_showfunction qla2x00_flash_block_size_showfunction qla2x00_vlan_id_showfunction qla2x00_vn_port_mac_address_showfunction qla2x00_fabric_param_show
Annotated Snippet
if (off < ha->md_template_size) {
rval = memory_read_from_buffer(buf, count,
&off, ha->md_tmplt_hdr, ha->md_template_size);
} else {
off -= ha->md_template_size;
rval = memory_read_from_buffer(buf, count,
&off, ha->md_dump, ha->md_dump_size);
}
} else if (ha->mctp_dumped && ha->mctp_dump_reading) {
rval = memory_read_from_buffer(buf, count, &off, ha->mctp_dump,
MCTP_DUMP_SIZE);
} else if (ha->mpi_fw_dumped && ha->mpi_fw_dump_reading) {
rval = memory_read_from_buffer(buf, count, &off,
ha->mpi_fw_dump,
ha->mpi_fw_dump_len);
} else if (ha->fw_dump_reading) {
rval = memory_read_from_buffer(buf, count, &off, ha->fw_dump,
ha->fw_dump_len);
} else {
rval = 0;
}
mutex_unlock(&ha->optrom_mutex);
return rval;
}
static ssize_t
qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj,
const struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
struct qla_hw_data *ha = vha->hw;
int reading;
if (off != 0)
return (0);
reading = simple_strtol(buf, NULL, 10);
switch (reading) {
case 0:
if (!ha->fw_dump_reading)
break;
ql_log(ql_log_info, vha, 0x705d,
"Firmware dump cleared on (%ld).\n", vha->host_no);
if (IS_P3P_TYPE(ha)) {
qla82xx_md_free(vha);
qla82xx_md_prep(vha);
}
ha->fw_dump_reading = 0;
ha->fw_dumped = false;
break;
case 1:
if (ha->fw_dumped && !ha->fw_dump_reading) {
ha->fw_dump_reading = 1;
ql_log(ql_log_info, vha, 0x705e,
"Raw firmware dump ready for read on (%ld).\n",
vha->host_no);
}
break;
case 2:
qla2x00_alloc_fw_dump(vha);
break;
case 3:
if (IS_QLA82XX(ha)) {
qla82xx_idc_lock(ha);
qla82xx_set_reset_owner(vha);
qla82xx_idc_unlock(ha);
} else if (IS_QLA8044(ha)) {
qla8044_idc_lock(ha);
qla82xx_set_reset_owner(vha);
qla8044_idc_unlock(ha);
} else {
qla2x00_system_error(vha);
}
break;
case 4:
if (IS_P3P_TYPE(ha)) {
if (ha->md_tmplt_hdr)
ql_dbg(ql_dbg_user, vha, 0x705b,
"MiniDump supported with this firmware.\n");
else
ql_dbg(ql_dbg_user, vha, 0x709d,
"MiniDump not supported with this firmware.\n");
}
break;
case 5:
Annotation
- Immediate include surface: `qla_def.h`, `qla_target.h`, `linux/kthread.h`, `linux/vmalloc.h`, `linux/slab.h`, `linux/delay.h`.
- Detected declarations: `function qla2x00_sysfs_read_fw_dump`, `function qla2x00_sysfs_write_fw_dump`, `function qla2x00_sysfs_read_nvram`, `function qla2x00_sysfs_write_nvram`, `function qla2x00_sysfs_read_optrom`, `function qla2x00_sysfs_write_optrom`, `function qla2x00_sysfs_write_optrom_ctl`, `function qla2x00_sysfs_read_vpd`, `function qla2x00_sysfs_write_vpd`, `function qla2x00_sysfs_read_sfp`.
- 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.