drivers/scsi/mpi3mr/mpi3mr_app.c
Source file repositories/reference/linux-study-clean/drivers/scsi/mpi3mr/mpi3mr_app.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/mpi3mr/mpi3mr_app.c- Extension
.c- Size
- 103243 bytes
- Lines
- 3487
- 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
mpi3mr.hlinux/bsg-lib.huapi/scsi/scsi_bsg_mpi3mr.h
Detected Declarations
function Copyrightfunction mpi3mr_alloc_diag_bufsfunction mpi3mr_issue_diag_buf_postfunction mpi3mr_post_diag_bufsfunction mpi3mr_issue_diag_buf_releasefunction mpi3mr_process_triggerfunction mpi3mr_global_triggerfunction mpi3mr_scsisense_triggerfunction mpi3mr_event_triggerfunction mpi3mr_reply_triggerfunction mpi3mr_get_num_triggerfunction mpi3mr_refresh_triggerfunction mpi3mr_release_diag_bufsfunction mpi3mr_set_trigger_data_in_hdbfunction mpi3mr_set_trigger_data_in_all_hdbfunction mpi3mr_hdbstatuschg_evt_thfunction mpi3mr_diag_buffer_for_typefunction mpi3mr_bsg_pel_abortfunction mpi3mr_bsg_refresh_hdb_triggersfunction mpi3mr_bsg_upload_hdbfunction mpi3mr_bsg_repost_hdbfunction mpi3mr_bsg_query_hdbfunction mpi3mr_enable_logdatafunction mpi3mr_get_logdatafunction mpi3mr_bsg_pel_enablefunction mpi3mr_get_all_tgt_infofunction mpi3mr_get_change_countfunction mpi3mr_bsg_adp_resetfunction mpi3mr_bsg_populate_adpinfofunction mpi3mr_bsg_process_drv_cmdsfunction mpi3mr_total_num_ioctl_sgesfunction mpi3mr_bsg_build_sglfunction mpi3mr_get_nvme_data_fmtfunction mpi3mr_build_nvme_sglfunction mpi3mr_build_nvme_prpfunction mpi3mr_map_data_buffer_dmafunction mpi3mr_bsg_process_mpt_cmdsfunction mpi3mr_app_save_logdata_thfunction mpi3mr_bsg_requestfunction mpi3mr_bsg_exitfunction mpi3mr_bsg_node_releasefunction mpi3mr_bsg_initfunction version_fw_showfunction fw_queue_depth_showfunction op_req_q_count_showfunction reply_queue_count_showfunction reply_qfull_count_showfunction logging_level_show
Annotated Snippet
if (device_add(bsg_dev)) {
ioc_err(mrioc, "%s: bsg device add failed\n",
dev_name(bsg_dev));
put_device(bsg_dev);
return;
}
q = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), &lim,
mpi3mr_bsg_request, NULL, 0);
if (IS_ERR(q)) {
ioc_err(mrioc, "%s: bsg registration failed\n",
dev_name(bsg_dev));
device_del(bsg_dev);
put_device(bsg_dev);
return;
}
mrioc->bsg_queue = q;
}
/**
* version_fw_show - SysFS callback for firmware version read
* @dev: class device
* @attr: Device attributes
* @buf: Buffer to copy
*
* Return: sysfs_emit() return after copying firmware version
*/
static ssize_t
version_fw_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct mpi3mr_ioc *mrioc = shost_priv(shost);
struct mpi3mr_compimg_ver *fwver = &mrioc->facts.fw_ver;
return sysfs_emit(buf, "%d.%d.%d.%d.%05d-%05d\n",
fwver->gen_major, fwver->gen_minor, fwver->ph_major,
fwver->ph_minor, fwver->cust_id, fwver->build_num);
}
static DEVICE_ATTR_RO(version_fw);
/**
* fw_queue_depth_show - SysFS callback for firmware max cmds
* @dev: class device
* @attr: Device attributes
* @buf: Buffer to copy
*
* Return: sysfs_emit() return after copying firmware max commands
*/
static ssize_t
fw_queue_depth_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct mpi3mr_ioc *mrioc = shost_priv(shost);
return sysfs_emit(buf, "%d\n", mrioc->facts.max_reqs);
}
static DEVICE_ATTR_RO(fw_queue_depth);
/**
* op_req_q_count_show - SysFS callback for request queue count
* @dev: class device
* @attr: Device attributes
* @buf: Buffer to copy
*
* Return: sysfs_emit() return after copying request queue count
*/
static ssize_t
op_req_q_count_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct mpi3mr_ioc *mrioc = shost_priv(shost);
return sysfs_emit(buf, "%d\n", mrioc->num_op_req_q);
}
static DEVICE_ATTR_RO(op_req_q_count);
/**
* reply_queue_count_show - SysFS callback for reply queue count
* @dev: class device
* @attr: Device attributes
* @buf: Buffer to copy
*
* Return: sysfs_emit() return after copying reply queue count
*/
static ssize_t
reply_queue_count_show(struct device *dev, struct device_attribute *attr,
Annotation
- Immediate include surface: `mpi3mr.h`, `linux/bsg-lib.h`, `uapi/scsi/scsi_bsg_mpi3mr.h`.
- Detected declarations: `function Copyright`, `function mpi3mr_alloc_diag_bufs`, `function mpi3mr_issue_diag_buf_post`, `function mpi3mr_post_diag_bufs`, `function mpi3mr_issue_diag_buf_release`, `function mpi3mr_process_trigger`, `function mpi3mr_global_trigger`, `function mpi3mr_scsisense_trigger`, `function mpi3mr_event_trigger`, `function mpi3mr_reply_trigger`.
- 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.