drivers/scsi/smartpqi/smartpqi_sis.c
Source file repositories/reference/linux-study-clean/drivers/scsi/smartpqi/smartpqi_sis.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/smartpqi/smartpqi_sis.c- Extension
.c- Size
- 15440 bytes
- Lines
- 563
- 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.
- 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/delay.hlinux/pci.hscsi/scsi_device.hlinux/unaligned.hsmartpqi.hsmartpqi_sis.h
Detected Declarations
struct sis_base_structstruct sis_sync_cmd_paramsenum sis_fw_triage_statusenum sis_ctrl_logging_statusfunction sis_wait_for_ctrl_ready_with_timeoutfunction sis_wait_for_ctrl_readyfunction sis_wait_for_ctrl_ready_resumefunction sis_is_firmware_runningfunction sis_is_kernel_upfunction sis_get_product_idfunction sis_send_sync_cmdfunction sis_get_ctrl_propertiesfunction sis_get_pqi_capabilitiesfunction sis_init_base_struct_addrfunction sis_wait_for_doorbell_bit_to_clearfunction sis_set_doorbell_bitfunction sis_enable_msixfunction sis_enable_intxfunction sis_shutdown_ctrlfunction sis_pqi_reset_quiescefunction sis_reenable_sis_modefunction sis_write_driver_scratchfunction sis_read_driver_scratchfunction sis_read_firmware_triage_statusfunction sis_is_ctrl_logging_supportedfunction sis_notify_kdumpfunction sis_read_ctrl_logging_statusfunction sis_soft_resetfunction sis_wait_for_fw_triage_completionfunction sis_wait_for_ctrl_logging_completionfunction sis_verify_structures
Annotated Snippet
struct sis_base_struct {
__le32 revision; /* revision of this structure */
__le32 flags; /* reserved */
__le32 error_buffer_paddr_low; /* lower 32 bits of physical memory */
/* buffer for PQI error response */
/* data */
__le32 error_buffer_paddr_high; /* upper 32 bits of physical */
/* memory buffer for PQI */
/* error response data */
__le32 error_buffer_element_length; /* length of each PQI error */
/* response buffer element */
/* in bytes */
__le32 error_buffer_num_elements; /* total number of PQI error */
/* response buffers available */
};
#pragma pack()
unsigned int sis_ctrl_ready_timeout_secs = SIS_CTRL_READY_TIMEOUT_SECS;
static int sis_wait_for_ctrl_ready_with_timeout(struct pqi_ctrl_info *ctrl_info,
unsigned int timeout_secs)
{
unsigned long timeout;
u32 status;
timeout = (timeout_secs * HZ) + jiffies;
while (1) {
status = readl(&ctrl_info->registers->sis_firmware_status);
if (status != ~0) {
if (status & SIS_CTRL_KERNEL_PANIC) {
dev_err(&ctrl_info->pci_dev->dev,
"controller is offline: status code 0x%x\n",
readl(
&ctrl_info->registers->sis_mailbox[7]));
return -ENODEV;
}
if (status & SIS_CTRL_KERNEL_UP)
break;
}
if (time_after(jiffies, timeout)) {
dev_err(&ctrl_info->pci_dev->dev,
"controller not ready after %u seconds\n",
timeout_secs);
return -ETIMEDOUT;
}
msleep(SIS_CTRL_READY_POLL_INTERVAL_MSECS);
}
return 0;
}
int sis_wait_for_ctrl_ready(struct pqi_ctrl_info *ctrl_info)
{
return sis_wait_for_ctrl_ready_with_timeout(ctrl_info,
sis_ctrl_ready_timeout_secs);
}
int sis_wait_for_ctrl_ready_resume(struct pqi_ctrl_info *ctrl_info)
{
return sis_wait_for_ctrl_ready_with_timeout(ctrl_info,
SIS_CTRL_READY_RESUME_TIMEOUT_SECS);
}
bool sis_is_firmware_running(struct pqi_ctrl_info *ctrl_info)
{
bool running;
u32 status;
status = readl(&ctrl_info->registers->sis_firmware_status);
if (status != ~0 && (status & SIS_CTRL_KERNEL_PANIC))
running = false;
else
running = true;
if (!running)
dev_err(&ctrl_info->pci_dev->dev,
"controller is offline: status code 0x%x\n",
readl(&ctrl_info->registers->sis_mailbox[7]));
return running;
}
bool sis_is_kernel_up(struct pqi_ctrl_info *ctrl_info)
{
return readl(&ctrl_info->registers->sis_firmware_status) &
SIS_CTRL_KERNEL_UP;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/delay.h`, `linux/pci.h`, `scsi/scsi_device.h`, `linux/unaligned.h`, `smartpqi.h`, `smartpqi_sis.h`.
- Detected declarations: `struct sis_base_struct`, `struct sis_sync_cmd_params`, `enum sis_fw_triage_status`, `enum sis_ctrl_logging_status`, `function sis_wait_for_ctrl_ready_with_timeout`, `function sis_wait_for_ctrl_ready`, `function sis_wait_for_ctrl_ready_resume`, `function sis_is_firmware_running`, `function sis_is_kernel_up`, `function sis_get_product_id`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
- 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.