drivers/infiniband/hw/hfi1/firmware.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/hfi1/firmware.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/hfi1/firmware.c- Extension
.c- Size
- 63704 bytes
- Lines
- 2254
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hlinux/mutex.hlinux/delay.hlinux/crc32.hhfi.htrace.h
Detected Declarations
struct css_headerstruct firmware_filestruct augmented_firmware_filestruct firmware_detailsenum fw_statefunction __read_8051_datafunction read_8051_datafunction write_8051function invalid_headerfunction verify_css_headerfunction payload_checkfunction obtain_one_firmwarefunction dispose_one_firmwarefunction __obtain_firmwarefunction request_firmwarefunction worksfunction dispose_firmwarefunction retry_firmwarefunction write_rsa_datafunction write_streamed_rsa_datafunction run_rsafunction load_security_variablesfunction get_firmware_statefunction wait_fm_readyfunction load_8051_firmwarefunction sbus_requestfunction sbus_readfunction turn_off_spicosfunction fabric_serdes_resetfunction sbus_request_slowfunction load_fabric_serdes_firmwarefunction load_sbus_firmwarefunction load_pcie_serdes_firmwarefunction set_serdes_broadcastfunction acquire_hw_mutexfunction release_hw_mutexfunction resource_maskfunction fail_mutex_acquire_messagefunction __acquire_chip_resourcefunction acquire_chip_resourcefunction release_chip_resourcefunction check_chip_resourcefunction clear_chip_resourcesfunction init_chip_resourcesfunction finish_chip_resourcesfunction set_sbus_fast_modefunction clear_sbus_fast_modefunction SBUS_COUNTER
Annotated Snippet
struct css_header {
u32 module_type;
u32 header_len;
u32 header_version;
u32 module_id;
u32 module_vendor;
u32 date; /* BCD yyyymmdd */
u32 size; /* in DWORDs */
u32 key_size; /* in DWORDs */
u32 modulus_size; /* in DWORDs */
u32 exponent_size; /* in DWORDs */
u32 reserved[22];
};
/* expected field values */
#define CSS_MODULE_TYPE 0x00000006
#define CSS_HEADER_LEN 0x000000a1
#define CSS_HEADER_VERSION 0x00010000
#define CSS_MODULE_VENDOR 0x00008086
#define KEY_SIZE 256
#define MU_SIZE 8
#define EXPONENT_SIZE 4
/* size of platform configuration partition */
#define MAX_PLATFORM_CONFIG_FILE_SIZE 4096
/* size of file of plaform configuration encoded in format version 4 */
#define PLATFORM_CONFIG_FORMAT_4_FILE_SIZE 528
/* the file itself */
struct firmware_file {
struct css_header css_header;
u8 modulus[KEY_SIZE];
u8 exponent[EXPONENT_SIZE];
u8 signature[KEY_SIZE];
u8 firmware[];
};
struct augmented_firmware_file {
struct css_header css_header;
u8 modulus[KEY_SIZE];
u8 exponent[EXPONENT_SIZE];
u8 signature[KEY_SIZE];
u8 r2[KEY_SIZE];
u8 mu[MU_SIZE];
u8 firmware[];
};
/* augmented file size difference */
#define AUGMENT_SIZE (sizeof(struct augmented_firmware_file) - \
sizeof(struct firmware_file))
struct firmware_details {
/* Linux core piece */
const struct firmware *fw;
struct css_header *css_header;
u8 *firmware_ptr; /* pointer to binary data */
u32 firmware_len; /* length in bytes */
u8 *modulus; /* pointer to the modulus */
u8 *exponent; /* pointer to the exponent */
u8 *signature; /* pointer to the signature */
u8 *r2; /* pointer to r2 */
u8 *mu; /* pointer to mu */
struct augmented_firmware_file dummy_header;
};
/*
* The mutex protects fw_state, fw_err, and all of the firmware_details
* variables.
*/
static DEFINE_MUTEX(fw_mutex);
enum fw_state {
FW_EMPTY,
FW_TRY,
FW_FINAL,
FW_ERR
};
static enum fw_state fw_state = FW_EMPTY;
static int fw_err;
static struct firmware_details fw_8051;
static struct firmware_details fw_fabric;
static struct firmware_details fw_pcie;
static struct firmware_details fw_sbus;
/* flags for turn_off_spicos() */
#define SPICO_SBUS 0x1
#define SPICO_FABRIC 0x2
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/mutex.h`, `linux/delay.h`, `linux/crc32.h`, `hfi.h`, `trace.h`.
- Detected declarations: `struct css_header`, `struct firmware_file`, `struct augmented_firmware_file`, `struct firmware_details`, `enum fw_state`, `function __read_8051_data`, `function read_8051_data`, `function write_8051`, `function invalid_header`, `function verify_css_header`.
- 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.
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.