drivers/infiniband/hw/hfi1/chip.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/hfi1/chip.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/hfi1/chip.c- Extension
.c- Size
- 460479 bytes
- Lines
- 15445
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- 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
linux/pci.hlinux/delay.hlinux/interrupt.hlinux/module.hhfi.htrace.hmad.hpio.hsdma.heprom.hefivar.hplatform.haspm.haffinity.hdebugfs.hfault.hnetdev.h
Detected Declarations
struct flag_tablestruct err_reg_infostruct cntr_entrystruct lcb_datumstruct rsm_map_tablestruct rsm_rule_datafunction read_csrfunction write_csrfunction read_write_csrfunction dev_access_u32_csrfunction access_sde_err_cntfunction access_sde_int_cntfunction access_sde_idle_int_cntfunction access_sde_progress_int_cntfunction dev_access_u64_csrfunction dc_access_lcb_cntrfunction port_access_u32_csrfunction port_access_u64_csrfunction read_write_swfunction access_sw_link_dn_cntfunction access_sw_link_up_cntfunction access_sw_unknown_frame_cntfunction access_sw_xmit_discardsfunction access_xmit_constraint_errsfunction access_rcv_constraint_errsfunction get_all_cpu_totalfunction read_write_cpufunction access_sw_cpu_intrfunction access_sw_cpu_rcv_limitfunction access_sw_pio_waitfunction access_sw_pio_drainfunction access_sw_ctx0_seq_dropfunction access_sw_vtx_waitfunction access_sw_kmem_waitfunction access_sw_send_schedulefunction access_misc_pll_lock_fail_err_cntfunction access_misc_mbist_fail_err_cntfunction access_misc_invalid_eep_cmd_err_cntfunction access_misc_efuse_done_parity_err_cntfunction access_misc_efuse_write_err_cntfunction access_misc_efuse_read_bad_addr_err_cntfunction access_misc_efuse_csr_parity_err_cntfunction access_misc_fw_auth_failed_err_cntfunction access_misc_key_mismatch_err_cntfunction access_misc_sbus_write_failed_err_cntfunction access_misc_csr_write_bad_addr_err_cntfunction access_misc_csr_read_bad_addr_err_cntfunction access_misc_csr_parity_err_cnt
Annotated Snippet
struct flag_table {
u64 flag; /* the flag */
char *str; /* description string */
u16 extra; /* extra information */
u16 unused0;
u32 unused1;
};
/* str must be a string constant */
#define FLAG_ENTRY(str, extra, flag) {flag, str, extra}
#define FLAG_ENTRY0(str, flag) {flag, str, 0}
/* Send Error Consequences */
#define SEC_WRITE_DROPPED 0x1
#define SEC_PACKET_DROPPED 0x2
#define SEC_SC_HALTED 0x4 /* per-context only */
#define SEC_SPC_FREEZE 0x8 /* per-HFI only */
#define DEFAULT_KRCVQS 2
#define MIN_KERNEL_KCTXTS 2
#define FIRST_KERNEL_KCTXT 1
/*
* RSM instance allocation
* 0 - User Fecn Handling
* 1 - Deprecated
* 2 - AIP
* 3 - Verbs
*/
#define RSM_INS_FECN 0
#define RSM_INS_DEPRECATED 1
#define RSM_INS_AIP 2
#define RSM_INS_VERBS 3
/* Bit offset into the GUID which carries HFI id information */
#define GUID_HFI_INDEX_SHIFT 39
/* extract the emulation revision */
#define emulator_rev(dd) ((dd)->irev >> 8)
/* parallel and serial emulation versions are 3 and 4 respectively */
#define is_emulator_p(dd) ((((dd)->irev) & 0xf) == 3)
#define is_emulator_s(dd) ((((dd)->irev) & 0xf) == 4)
/* RSM fields for Verbs */
/* packet type */
#define IB_PACKET_TYPE 2ull
#define QW_SHIFT 6ull
/* QPN[7..1] */
#define QPN_WIDTH 7ull
/* LRH.BTH: QW 0, OFFSET 48 - for match */
#define LRH_BTH_QW 0ull
#define LRH_BTH_BIT_OFFSET 48ull
#define LRH_BTH_OFFSET(off) ((LRH_BTH_QW << QW_SHIFT) | (off))
#define LRH_BTH_MATCH_OFFSET LRH_BTH_OFFSET(LRH_BTH_BIT_OFFSET)
#define LRH_BTH_SELECT
#define LRH_BTH_MASK 3ull
#define LRH_BTH_VALUE 2ull
/* LRH.SC[3..0] QW 0, OFFSET 56 - for match */
#define LRH_SC_QW 0ull
#define LRH_SC_BIT_OFFSET 56ull
#define LRH_SC_OFFSET(off) ((LRH_SC_QW << QW_SHIFT) | (off))
#define LRH_SC_MATCH_OFFSET LRH_SC_OFFSET(LRH_SC_BIT_OFFSET)
#define LRH_SC_MASK 128ull
#define LRH_SC_VALUE 0ull
/* SC[n..0] QW 0, OFFSET 60 - for select */
#define LRH_SC_SELECT_OFFSET ((LRH_SC_QW << QW_SHIFT) | (60ull))
/* QPN[m+n:1] QW 1, OFFSET 1 */
#define QPN_SELECT_OFFSET ((1ull << QW_SHIFT) | (1ull))
/* RSM fields for AIP */
/* LRH.BTH above is reused for this rule */
/* BTH.DESTQP: QW 1, OFFSET 16 for match */
#define BTH_DESTQP_QW 1ull
#define BTH_DESTQP_BIT_OFFSET 16ull
#define BTH_DESTQP_OFFSET(off) ((BTH_DESTQP_QW << QW_SHIFT) | (off))
#define BTH_DESTQP_MATCH_OFFSET BTH_DESTQP_OFFSET(BTH_DESTQP_BIT_OFFSET)
#define BTH_DESTQP_MASK 0xFFull
#define BTH_DESTQP_VALUE 0x81ull
/* DETH.SQPN: QW 1 Offset 56 for select */
/* We use 8 most significant Soure QPN bits as entropy fpr AIP */
#define DETH_AIP_SQPN_QW 3ull
#define DETH_AIP_SQPN_BIT_OFFSET 56ull
#define DETH_AIP_SQPN_OFFSET(off) ((DETH_AIP_SQPN_QW << QW_SHIFT) | (off))
#define DETH_AIP_SQPN_SELECT_OFFSET \
Annotation
- Immediate include surface: `linux/pci.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/module.h`, `hfi.h`, `trace.h`, `mad.h`, `pio.h`.
- Detected declarations: `struct flag_table`, `struct err_reg_info`, `struct cntr_entry`, `struct lcb_datum`, `struct rsm_map_table`, `struct rsm_rule_data`, `function read_csr`, `function write_csr`, `function read_write_csr`, `function dev_access_u32_csr`.
- Atlas domain: Driver Families / drivers/infiniband.
- 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.