drivers/scsi/elx/efct/efct_hw.c
Source file repositories/reference/linux-study-clean/drivers/scsi/elx/efct/efct_hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/elx/efct/efct_hw.c- Extension
.c- Size
- 88289 bytes
- Lines
- 3581
- 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
efct_driver.hefct_hw.hefct_unsol.h
Detected Declarations
struct efct_hw_link_stat_cb_argstruct efct_hw_host_stat_cb_argstruct efct_hw_fw_wr_cb_argstruct efct_mbox_rqst_ctxstruct efct_hw_async_call_ctxfunction efct_hw_link_event_initfunction efct_hw_read_max_dump_sizefunction __efct_read_topology_cbfunction efct_hw_cb_linkfunction efct_hw_setupfunction efct_logfcfifunction efct_hw_init_free_iofunction efct_hw_iotype_is_originatorfunction efct_hw_io_restore_sglfunction efct_hw_wq_process_iofunction efct_hw_setup_iofunction efct_hw_init_prereg_iofunction efct_hw_init_iofunction efct_hw_config_set_fdt_xfer_hintfunction efct_hw_config_rqfunction efct_hw_config_mrqfunction efct_hw_queue_hash_addfunction efct_hw_config_sli_port_health_checkfunction efct_hw_initfunction efct_hw_parse_filterfunction efct_get_wwnnfunction efct_get_wwpnfunction efct_hw_rx_buffer_allocfunction efct_hw_rx_buffer_freefunction efct_hw_rx_allocatefunction efct_hw_rx_postfunction efct_hw_rx_freefunction efct_hw_cmd_submit_pendingfunction efct_hw_commandfunction statefunction completionfunction efct_hw_command_processfunction efct_hw_mq_processfunction efct_hw_command_cancelfunction efct_hw_command_processfunction efct_mbox_rsp_cbfunction efct_issue_mbox_rqstfunction _efct_hw_io_allocfunction efct_hw_io_allocfunction efct_hw_io_free_move_correct_listfunction efct_hw_io_free_commonfunction efct_hw_io_free_internalfunction efct_hw_io_free
Annotated Snippet
struct efct_hw_link_stat_cb_arg {
void (*cb)(int status, u32 num_counters,
struct efct_hw_link_stat_counts *counters, void *arg);
void *arg;
};
struct efct_hw_host_stat_cb_arg {
void (*cb)(int status, u32 num_counters,
struct efct_hw_host_stat_counts *counters, void *arg);
void *arg;
};
struct efct_hw_fw_wr_cb_arg {
void (*cb)(int status, u32 bytes_written, u32 change_status, void *arg);
void *arg;
};
struct efct_mbox_rqst_ctx {
int (*callback)(struct efc *efc, int status, u8 *mqe, void *arg);
void *arg;
};
static int
efct_hw_link_event_init(struct efct_hw *hw)
{
hw->link.status = SLI4_LINK_STATUS_MAX;
hw->link.topology = SLI4_LINK_TOPO_NONE;
hw->link.medium = SLI4_LINK_MEDIUM_MAX;
hw->link.speed = 0;
hw->link.loop_map = NULL;
hw->link.fc_id = U32_MAX;
return 0;
}
static int
efct_hw_read_max_dump_size(struct efct_hw *hw)
{
u8 buf[SLI4_BMBX_SIZE];
struct efct *efct = hw->os;
int rc = 0;
struct sli4_rsp_cmn_set_dump_location *rsp;
/* attempt to detemine the dump size for function 0 only. */
if (PCI_FUNC(efct->pci->devfn) != 0)
return rc;
if (sli_cmd_common_set_dump_location(&hw->sli, buf, 1, 0, NULL, 0))
return -EIO;
rsp = (struct sli4_rsp_cmn_set_dump_location *)
(buf + offsetof(struct sli4_cmd_sli_config, payload.embed));
rc = efct_hw_command(hw, buf, EFCT_CMD_POLL, NULL, NULL);
if (rc != 0) {
efc_log_debug(hw->os, "set dump location cmd failed\n");
return rc;
}
hw->dump_size =
le32_to_cpu(rsp->buffer_length_dword) & SLI4_CMN_SET_DUMP_BUFFER_LEN;
efc_log_debug(hw->os, "Dump size %x\n", hw->dump_size);
return rc;
}
static int
__efct_read_topology_cb(struct efct_hw *hw, int status, u8 *mqe, void *arg)
{
struct sli4_cmd_read_topology *read_topo =
(struct sli4_cmd_read_topology *)mqe;
u8 speed;
struct efc_domain_record drec = {0};
struct efct *efct = hw->os;
if (status || le16_to_cpu(read_topo->hdr.status)) {
efc_log_debug(hw->os, "bad status cqe=%#x mqe=%#x\n", status,
le16_to_cpu(read_topo->hdr.status));
return -EIO;
}
switch (le32_to_cpu(read_topo->dw2_attentype) &
SLI4_READTOPO_ATTEN_TYPE) {
case SLI4_READ_TOPOLOGY_LINK_UP:
hw->link.status = SLI4_LINK_STATUS_UP;
break;
case SLI4_READ_TOPOLOGY_LINK_DOWN:
hw->link.status = SLI4_LINK_STATUS_DOWN;
break;
Annotation
- Immediate include surface: `efct_driver.h`, `efct_hw.h`, `efct_unsol.h`.
- Detected declarations: `struct efct_hw_link_stat_cb_arg`, `struct efct_hw_host_stat_cb_arg`, `struct efct_hw_fw_wr_cb_arg`, `struct efct_mbox_rqst_ctx`, `struct efct_hw_async_call_ctx`, `function efct_hw_link_event_init`, `function efct_hw_read_max_dump_size`, `function __efct_read_topology_cb`, `function efct_hw_cb_link`, `function efct_hw_setup`.
- 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.