drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c- Extension
.c- Size
- 17653 bytes
- Lines
- 611
- Domain
- Driver Families
- Bucket
- drivers/crypto
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/iopoll.hasm/div64.hadf_accel_devices.hadf_cfg_services.hadf_common_drv.hadf_fw_config.hadf_gen4_hw_data.hadf_gen4_pm.hicp_qat_fw_comp.hicp_qat_hw_20_comp.h
Detected Declarations
function adf_gen4_get_accel_maskfunction adf_gen4_get_num_accelsfunction adf_gen4_get_num_aesfunction adf_gen4_get_misc_bar_idfunction adf_gen4_get_etr_bar_idfunction adf_gen4_get_sram_bar_idfunction adf_gen4_get_skufunction adf_gen4_get_arb_infofunction adf_gen4_get_admin_infofunction adf_gen4_get_heartbeat_clockfunction adf_gen4_enable_error_correctionfunction adf_gen4_enable_intsfunction adf_gen4_init_devicefunction adf_gen4_set_ssm_wdtimerfunction adf_gen4_set_msix_default_rttablefunction adf_pfvf_comms_disabledfunction reset_ring_pairfunction adf_gen4_ring_pair_resetfunction is_single_servicefunction adf_gen4_services_supportedfunction adf_gen4_init_thd2arb_mapfunction adf_gen4_get_ring_to_svc_mapfunction adf_gen4_bank_quiesce_coal_timerfunction drain_bankfunction adf_gen4_bank_drain_finishfunction adf_gen4_bank_drain_startfunction adf_gen4_build_comp_blockfunction adf_gen4_build_decomp_blockfunction adf_gen4_init_dc_opsfunction adf_gen4_init_num_svc_aesfunction adf_gen4_get_svc_slice_cntexport adf_gen4_get_accel_maskexport adf_gen4_get_num_accelsexport adf_gen4_get_num_aesexport adf_gen4_get_misc_bar_idexport adf_gen4_get_etr_bar_idexport adf_gen4_get_sram_bar_idexport adf_gen4_get_skuexport adf_gen4_get_arb_infoexport adf_gen4_get_admin_infoexport adf_gen4_get_heartbeat_clockexport adf_gen4_enable_error_correctionexport adf_gen4_enable_intsexport adf_gen4_init_deviceexport adf_gen4_set_ssm_wdtimerexport adf_gen4_set_msix_default_rttableexport adf_pfvf_comms_disabledexport adf_gen4_ring_pair_reset
Annotated Snippet
switch (hw_data->uof_get_obj_type(accel_dev, i)) {
case ADF_FW_SYM_OBJ:
rps[rp_group] = SYM;
break;
case ADF_FW_ASYM_OBJ:
rps[rp_group] = ASYM;
break;
case ADF_FW_DC_OBJ:
rps[rp_group] = COMP;
break;
default:
rps[rp_group] = 0;
break;
}
}
set_mask:
ring_to_svc_map = rps[RP_GROUP_0] << ADF_CFG_SERV_RING_PAIR_0_SHIFT |
rps[RP_GROUP_1] << ADF_CFG_SERV_RING_PAIR_1_SHIFT |
rps[RP_GROUP_0] << ADF_CFG_SERV_RING_PAIR_2_SHIFT |
rps[RP_GROUP_1] << ADF_CFG_SERV_RING_PAIR_3_SHIFT;
return ring_to_svc_map;
}
EXPORT_SYMBOL_GPL(adf_gen4_get_ring_to_svc_map);
/*
* adf_gen4_bank_quiesce_coal_timer() - quiesce bank coalesced interrupt timer
* @accel_dev: Pointer to the device structure
* @bank_idx: Offset to the bank within this device
* @timeout_ms: Timeout in milliseconds for the operation
*
* This function tries to quiesce the coalesced interrupt timer of a bank if
* it has been enabled and triggered.
*
* Returns 0 on success, error code otherwise
*
*/
int adf_gen4_bank_quiesce_coal_timer(struct adf_accel_dev *accel_dev,
u32 bank_idx, int timeout_ms)
{
struct adf_hw_device_data *hw_data = GET_HW_DATA(accel_dev);
struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(accel_dev);
void __iomem *csr_misc = adf_get_pmisc_base(accel_dev);
void __iomem *csr_etr = adf_get_etr_base(accel_dev);
u32 int_col_ctl, int_col_mask, int_col_en;
u32 e_stat, intsrc;
u64 wait_us;
int ret;
if (timeout_ms < 0)
return -EINVAL;
int_col_ctl = csr_ops->read_csr_int_col_ctl(csr_etr, bank_idx);
int_col_mask = csr_ops->get_int_col_ctl_enable_mask();
if (!(int_col_ctl & int_col_mask))
return 0;
int_col_en = csr_ops->read_csr_int_col_en(csr_etr, bank_idx);
int_col_en &= BIT(ADF_WQM_CSR_RP_IDX_RX);
e_stat = csr_ops->read_csr_e_stat(csr_etr, bank_idx);
if (!(~e_stat & int_col_en))
return 0;
wait_us = 2 * ((int_col_ctl & ~int_col_mask) << 8) * USEC_PER_SEC;
do_div(wait_us, hw_data->clock_frequency);
wait_us = min(wait_us, (u64)timeout_ms * USEC_PER_MSEC);
dev_dbg(&GET_DEV(accel_dev),
"wait for bank %d - coalesced timer expires in %llu us (max=%u ms estat=0x%x intcolen=0x%x)\n",
bank_idx, wait_us, timeout_ms, e_stat, int_col_en);
ret = read_poll_timeout(ADF_CSR_RD, intsrc, intsrc,
ADF_COALESCED_POLL_DELAY_US, wait_us, true,
csr_misc, ADF_WQM_CSR_RPINTSOU(bank_idx));
if (ret)
dev_warn(&GET_DEV(accel_dev),
"coalesced timer for bank %d expired (%llu us)\n",
bank_idx, wait_us);
return ret;
}
EXPORT_SYMBOL_GPL(adf_gen4_bank_quiesce_coal_timer);
static int drain_bank(void __iomem *csr, u32 bank_number, int timeout_us)
{
u32 status;
ADF_CSR_WR(csr, ADF_WQM_CSR_RPRESETCTL(bank_number),
ADF_WQM_CSR_RPRESETCTL_DRAIN);
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/iopoll.h`, `asm/div64.h`, `adf_accel_devices.h`, `adf_cfg_services.h`, `adf_common_drv.h`, `adf_fw_config.h`, `adf_gen4_hw_data.h`.
- Detected declarations: `function adf_gen4_get_accel_mask`, `function adf_gen4_get_num_accels`, `function adf_gen4_get_num_aes`, `function adf_gen4_get_misc_bar_id`, `function adf_gen4_get_etr_bar_id`, `function adf_gen4_get_sram_bar_id`, `function adf_gen4_get_sku`, `function adf_gen4_get_arb_info`, `function adf_gen4_get_admin_info`, `function adf_gen4_get_heartbeat_clock`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: integration 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.