drivers/scsi/pmcraid.c
Source file repositories/reference/linux-study-clean/drivers/scsi/pmcraid.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/pmcraid.c- Extension
.c- Size
- 154970 bytes
- Lines
- 5442
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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
linux/fs.hlinux/init.hlinux/types.hlinux/errno.hlinux/kernel.hlinux/ioport.hlinux/delay.hlinux/pci.hlinux/wait.hlinux/spinlock.hlinux/sched.hlinux/interrupt.hlinux/blkdev.hlinux/firmware.hlinux/module.hlinux/moduleparam.hlinux/hdreg.hlinux/io.hlinux/slab.hasm/irq.hasm/processor.hlinux/libata.hlinux/mutex.hlinux/ktime.hscsi/scsi.hscsi/scsi_host.hscsi/scsi_device.hscsi/scsi_tcq.hscsi/scsi_eh.hscsi/scsi_cmnd.hscsi/scsicam.hpmcraid.h
Detected Declarations
function pmcraid_sdev_initfunction scannedfunction pmcraid_sdev_destroyfunction pmcraid_change_queue_depthfunction pmcraid_init_cmdblkfunction pmcraid_reinit_cmdblkfunction pmcraid_return_cmdfunction pmcraid_read_interruptsfunction pmcraid_disable_interruptsfunction pmcraid_enable_interruptsfunction pmcraid_clr_trans_opfunction pmcraid_reset_typefunction pmcraid_bist_donefunction pmcraid_start_bistfunction pmcraid_reset_alert_donefunction pmcraid_reset_alertfunction pmcraid_timeout_handlerfunction pmcraid_internal_donefunction sofunction pmcraid_reinit_cfgtable_donefunction pmcraid_erp_donefunction _pmcraid_fire_commandfunction pmcraid_send_cmdfunction pmcraid_ioa_shutdown_donefunction pmcraid_ioa_shutdownfunction pmcraid_get_fwversion_donefunction pmcraid_get_fwversionfunction pmcraid_identify_hrrqfunction pmcraid_send_hcam_cmdfunction pmcraid_send_hcamfunction pmcraid_prepare_cancel_cmdfunction pmcraid_cancel_hcamfunction pmcraid_cancel_ccnfunction pmcraid_cancel_ldnfunction pmcraid_expose_resourcefunction pmcraid_netlink_initfunction pmcraid_netlink_releasefunction pmcraid_notify_aenfunction pmcraid_notify_ccnfunction pmcraid_notify_ldnfunction pmcraid_notify_ioastatefunction pmcraid_handle_config_changefunction pmcraid_ioasc_loggerfunction pmcraid_handle_error_logfunction pmcraid_process_ccnfunction atomic_readfunction pmcraid_process_ldnfunction atomic_read
Annotated Snippet
static const struct file_operations pmcraid_fops = {
.owner = THIS_MODULE,
.open = pmcraid_chr_open,
.fasync = pmcraid_chr_fasync,
.unlocked_ioctl = pmcraid_chr_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.llseek = noop_llseek,
};
/**
* pmcraid_show_log_level - Display adapter's error logging level
* @dev: class device struct
* @attr: unused
* @buf: buffer
*
* Return value:
* number of bytes printed to buffer
*/
static ssize_t pmcraid_show_log_level(
struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct pmcraid_instance *pinstance =
(struct pmcraid_instance *)shost->hostdata;
return snprintf(buf, PAGE_SIZE, "%d\n", pinstance->current_log_level);
}
/**
* pmcraid_store_log_level - Change the adapter's error logging level
* @dev: class device struct
* @attr: unused
* @buf: buffer
* @count: not used
*
* Return value:
* number of bytes printed to buffer
*/
static ssize_t pmcraid_store_log_level(
struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count
)
{
struct Scsi_Host *shost;
struct pmcraid_instance *pinstance;
u8 val;
if (kstrtou8(buf, 10, &val))
return -EINVAL;
/* log-level should be from 0 to 2 */
if (val > 2)
return -EINVAL;
shost = class_to_shost(dev);
pinstance = (struct pmcraid_instance *)shost->hostdata;
pinstance->current_log_level = val;
return strlen(buf);
}
static struct device_attribute pmcraid_log_level_attr = {
.attr = {
.name = "log_level",
.mode = S_IRUGO | S_IWUSR,
},
.show = pmcraid_show_log_level,
.store = pmcraid_store_log_level,
};
/**
* pmcraid_show_drv_version - Display driver version
* @dev: class device struct
* @attr: unused
* @buf: buffer
*
* Return value:
* number of bytes printed to buffer
*/
static ssize_t pmcraid_show_drv_version(
struct device *dev,
struct device_attribute *attr,
char *buf
)
{
Annotation
- Immediate include surface: `linux/fs.h`, `linux/init.h`, `linux/types.h`, `linux/errno.h`, `linux/kernel.h`, `linux/ioport.h`, `linux/delay.h`, `linux/pci.h`.
- Detected declarations: `function pmcraid_sdev_init`, `function scanned`, `function pmcraid_sdev_destroy`, `function pmcraid_change_queue_depth`, `function pmcraid_init_cmdblk`, `function pmcraid_reinit_cmdblk`, `function pmcraid_return_cmd`, `function pmcraid_read_interrupts`, `function pmcraid_disable_interrupts`, `function pmcraid_enable_interrupts`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.