drivers/crypto/intel/qat/qat_c3xxx/adf_c3xxx_hw_data.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_c3xxx/adf_c3xxx_hw_data.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_c3xxx/adf_c3xxx_hw_data.c- Extension
.c- Size
- 4972 bytes
- Lines
- 168
- Domain
- Driver Families
- Bucket
- drivers/crypto
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
adf_accel_devices.hadf_admin.hadf_clock.hadf_common_drv.hadf_gen2_config.hadf_gen2_hw_csr_data.hadf_gen2_hw_data.hadf_gen2_pfvf.hadf_c3xxx_hw_data.hadf_heartbeat.hicp_qat_hw.h
Detected Declarations
function get_accel_maskfunction get_ae_maskfunction get_ts_clockfunction measure_clockfunction get_misc_bar_idfunction get_etr_bar_idfunction get_sram_bar_idfunction get_skufunction configure_iov_threadsfunction adf_init_hw_data_c3xxxfunction adf_clean_hw_data_c3xxx
Annotated Snippet
// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
/* Copyright(c) 2014 - 2021 Intel Corporation */
#include <adf_accel_devices.h>
#include <adf_admin.h>
#include <adf_clock.h>
#include <adf_common_drv.h>
#include <adf_gen2_config.h>
#include <adf_gen2_hw_csr_data.h>
#include <adf_gen2_hw_data.h>
#include <adf_gen2_pfvf.h>
#include "adf_c3xxx_hw_data.h"
#include "adf_heartbeat.h"
#include "icp_qat_hw.h"
/* Worker thread to service arbiter mappings */
static const u32 thrd_to_arb_map[ADF_C3XXX_MAX_ACCELENGINES] = {
0x12222AAA, 0x11222AAA, 0x12222AAA,
0x11222AAA, 0x12222AAA, 0x11222AAA
};
static struct adf_hw_device_class c3xxx_class = {
.name = ADF_C3XXX_DEVICE_NAME,
.type = DEV_C3XXX,
};
static u32 get_accel_mask(struct adf_hw_device_data *self)
{
u32 fuses = self->fuses[ADF_FUSECTL0];
u32 straps = self->straps;
u32 accel;
accel = ~(fuses | straps) >> ADF_C3XXX_ACCELERATORS_REG_OFFSET;
accel &= ADF_C3XXX_ACCELERATORS_MASK;
return accel;
}
static u32 get_ae_mask(struct adf_hw_device_data *self)
{
u32 fuses = self->fuses[ADF_FUSECTL0];
u32 straps = self->straps;
unsigned long disabled;
u32 ae_disable;
int accel;
/* If an accel is disabled, then disable the corresponding two AEs */
disabled = ~get_accel_mask(self) & ADF_C3XXX_ACCELERATORS_MASK;
ae_disable = BIT(1) | BIT(0);
for_each_set_bit(accel, &disabled, ADF_C3XXX_MAX_ACCELERATORS)
straps |= ae_disable << (accel << 1);
return ~(fuses | straps) & ADF_C3XXX_ACCELENGINES_MASK;
}
static u32 get_ts_clock(struct adf_hw_device_data *self)
{
/*
* Timestamp update interval is 16 AE clock ticks for c3xxx.
*/
return self->clock_frequency / 16;
}
static int measure_clock(struct adf_accel_dev *accel_dev)
{
u32 frequency;
int ret;
ret = adf_dev_measure_clock(accel_dev, &frequency, ADF_C3XXX_MIN_AE_FREQ,
ADF_C3XXX_MAX_AE_FREQ);
if (ret)
return ret;
accel_dev->hw_device->clock_frequency = frequency;
return 0;
}
static u32 get_misc_bar_id(struct adf_hw_device_data *self)
{
return ADF_C3XXX_PMISC_BAR;
}
static u32 get_etr_bar_id(struct adf_hw_device_data *self)
{
return ADF_C3XXX_ETR_BAR;
}
static u32 get_sram_bar_id(struct adf_hw_device_data *self)
{
return ADF_C3XXX_SRAM_BAR;
}
Annotation
- Immediate include surface: `adf_accel_devices.h`, `adf_admin.h`, `adf_clock.h`, `adf_common_drv.h`, `adf_gen2_config.h`, `adf_gen2_hw_csr_data.h`, `adf_gen2_hw_data.h`, `adf_gen2_pfvf.h`.
- Detected declarations: `function get_accel_mask`, `function get_ae_mask`, `function get_ts_clock`, `function measure_clock`, `function get_misc_bar_id`, `function get_etr_bar_id`, `function get_sram_bar_id`, `function get_sku`, `function configure_iov_threads`, `function adf_init_hw_data_c3xxx`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
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.