drivers/scsi/smartpqi/smartpqi_init.c
Source file repositories/reference/linux-study-clean/drivers/scsi/smartpqi/smartpqi_init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/smartpqi/smartpqi_init.c- Extension
.c- Size
- 315787 bytes
- Lines
- 11225
- 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/module.hlinux/kernel.hlinux/pci.hlinux/delay.hlinux/interrupt.hlinux/sched.hlinux/rtc.hlinux/bcd.hlinux/reboot.hlinux/cciss_ioctl.hlinux/crash_dump.hlinux/string.hscsi/scsi_host.hscsi/scsi_cmnd.hscsi/scsi_device.hscsi/scsi_eh.hscsi/scsi_transport_sas.hlinux/unaligned.hsmartpqi.hsmartpqi_sis.h
Detected Declarations
struct pqi_cmd_privstruct bmic_sense_feature_bufferstruct bmic_host_wellness_driver_versionstruct bmic_host_wellness_timestruct ciss_error_infostruct pqi_config_table_section_infostruct pqi_firmware_featureenum pqi_lockup_actionenum pqi_find_resultfunction pqi_scsi_donefunction pqi_disable_write_samefunction pqi_scsi3addr_equalfunction pqi_is_logical_devicefunction pqi_is_external_raid_addrfunction pqi_ctrl_offlinefunction pqi_check_ctrl_healthfunction pqi_is_hba_lunidfunction pqi_get_ctrl_modefunction pqi_save_ctrl_modefunction pqi_is_fw_triage_supportedfunction pqi_save_fw_triage_settingfunction pqi_ctrl_block_scanfunction pqi_ctrl_unblock_scanfunction pqi_ctrl_scan_blockedfunction pqi_ctrl_block_device_resetfunction pqi_ctrl_unblock_device_resetfunction pqi_scsi_block_requestsfunction pqi_scsi_unblock_requestsfunction pqi_ctrl_busyfunction pqi_ctrl_unbusyfunction pqi_ctrl_blockedfunction pqi_ctrl_block_requestsfunction pqi_ctrl_unblock_requestsfunction pqi_wait_if_ctrl_blockedfunction pqi_ctrl_wait_until_quiescedfunction pqi_device_offlinefunction pqi_ctrl_ofa_startfunction pqi_ctrl_ofa_donefunction pqi_wait_until_ofa_finishedfunction pqi_ofa_in_progressfunction pqi_device_remove_startfunction pqi_device_in_removefunction pqi_device_reset_startfunction pqi_device_reset_donefunction pqi_device_in_resetfunction pqi_event_type_to_event_indexfunction pqi_is_supported_eventfunction pqi_schedule_rescan_worker_with_delay
Annotated Snippet
static struct pci_driver pqi_pci_driver = {
.name = DRIVER_NAME_SHORT,
.id_table = pqi_pci_id_table,
.probe = pqi_pci_probe,
.remove = pqi_pci_remove,
.shutdown = pqi_shutdown,
#if defined(CONFIG_PM)
.driver = {
.pm = &pqi_pm_ops
},
#endif
};
static int __init pqi_init(void)
{
int rc;
pr_info(DRIVER_NAME "\n");
pqi_verify_structures();
sis_verify_structures();
pqi_sas_transport_template = sas_attach_transport(&pqi_sas_transport_functions);
if (!pqi_sas_transport_template)
return -ENODEV;
pqi_process_module_params();
rc = pci_register_driver(&pqi_pci_driver);
if (rc)
sas_release_transport(pqi_sas_transport_template);
return rc;
}
static void __exit pqi_cleanup(void)
{
pci_unregister_driver(&pqi_pci_driver);
sas_release_transport(pqi_sas_transport_template);
}
module_init(pqi_init);
module_exit(pqi_cleanup);
static void pqi_verify_structures(void)
{
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
sis_host_to_ctrl_doorbell) != 0x20);
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
sis_interrupt_mask) != 0x34);
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
sis_ctrl_to_host_doorbell) != 0x9c);
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
sis_ctrl_to_host_doorbell_clear) != 0xa0);
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
sis_driver_scratch) != 0xb0);
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
sis_product_identifier) != 0xb4);
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
sis_firmware_status) != 0xbc);
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
sis_ctrl_shutdown_reason_code) != 0xcc);
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
sis_mailbox) != 0x1000);
BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
pqi_registers) != 0x4000);
BUILD_BUG_ON(offsetof(struct pqi_iu_header,
iu_type) != 0x0);
BUILD_BUG_ON(offsetof(struct pqi_iu_header,
iu_length) != 0x2);
BUILD_BUG_ON(offsetof(struct pqi_iu_header,
response_queue_id) != 0x4);
BUILD_BUG_ON(offsetof(struct pqi_iu_header,
driver_flags) != 0x6);
BUILD_BUG_ON(sizeof(struct pqi_iu_header) != 0x8);
BUILD_BUG_ON(offsetof(struct pqi_aio_error_info,
status) != 0x0);
BUILD_BUG_ON(offsetof(struct pqi_aio_error_info,
service_response) != 0x1);
BUILD_BUG_ON(offsetof(struct pqi_aio_error_info,
data_present) != 0x2);
BUILD_BUG_ON(offsetof(struct pqi_aio_error_info,
reserved) != 0x3);
BUILD_BUG_ON(offsetof(struct pqi_aio_error_info,
residual_count) != 0x4);
BUILD_BUG_ON(offsetof(struct pqi_aio_error_info,
data_length) != 0x8);
BUILD_BUG_ON(offsetof(struct pqi_aio_error_info,
reserved1) != 0xa);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/pci.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/sched.h`, `linux/rtc.h`, `linux/bcd.h`.
- Detected declarations: `struct pqi_cmd_priv`, `struct bmic_sense_feature_buffer`, `struct bmic_host_wellness_driver_version`, `struct bmic_host_wellness_time`, `struct ciss_error_info`, `struct pqi_config_table_section_info`, `struct pqi_firmware_feature`, `enum pqi_lockup_action`, `enum pqi_find_result`, `function pqi_scsi_done`.
- 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.