drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c- Extension
.c- Size
- 41770 bytes
- Lines
- 1387
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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/bitfield.hlinux/firmware.hlinux/highmem.hdrm/drm_cache.hdrm/drm_print.hgem/i915_gem_lmem.hgt/intel_gt.hgt/intel_gt_print.hintel_gsc_binary_headers.hintel_gsc_fw.hintel_uc_fw.hintel_uc_fw_abi.hi915_drv.hi915_reg.h
Detected Declarations
struct fw_blobs_by_typefunction ____uc_fw_to_gtfunction intel_uc_fw_change_statusfunction __uc_fw_auto_selectfunction validate_fw_table_typefunction __uc_fw_user_overridefunction intel_uc_fw_version_from_gsc_manifestfunction intel_uc_fw_init_earlyfunction uc_unpack_css_versionfunction guc_read_css_infofunction numberfunction __check_ccs_headerfunction check_gsc_manifestfunction check_ccs_headerfunction is_ver_8bitfunction guc_check_version_rangefunction check_fw_headerfunction try_firmware_loadfunction check_mtl_huc_guc_compatibilityfunction intel_uc_check_file_versionfunction intel_uc_fw_fetchfunction uc_fw_ggtt_offsetfunction uc_fw_bind_ggttfunction uc_fw_unbind_ggttfunction uc_fw_xferfunction intel_uc_fw_mark_load_failedfunction intel_uc_fw_uploadfunction uc_fw_need_rsa_in_memoryfunction uc_fw_rsa_data_createfunction uc_fw_rsa_data_destroyfunction intel_uc_fw_initfunction intel_uc_fw_finifunction intel_uc_fw_resume_mappingfunction intel_uc_fw_cleanup_fetchfunction intel_uc_fw_copy_rsafunction for_each_sgt_pagefunction for_each_sgt_daddrfunction intel_uc_fw_dump
Annotated Snippet
struct fw_blobs_by_type {
const struct uc_fw_platform_requirement *blobs;
u32 count;
};
static const struct uc_fw_platform_requirement blobs_guc[] = {
INTEL_GUC_FIRMWARE_DEFS(MAKE_FW_LIST, GUC_FW_BLOB, GUC_FW_BLOB_MMP)
};
static const struct uc_fw_platform_requirement blobs_huc[] = {
INTEL_HUC_FIRMWARE_DEFS(MAKE_FW_LIST, HUC_FW_BLOB, HUC_FW_BLOB_MMP, HUC_FW_BLOB_GSC)
};
static const struct uc_fw_platform_requirement blobs_gsc[] = {
INTEL_GSC_FIRMWARE_DEFS(MAKE_FW_LIST, GSC_FW_BLOB)
};
static const struct fw_blobs_by_type blobs_all[INTEL_UC_FW_NUM_TYPES] = {
[INTEL_UC_FW_TYPE_GUC] = { blobs_guc, ARRAY_SIZE(blobs_guc) },
[INTEL_UC_FW_TYPE_HUC] = { blobs_huc, ARRAY_SIZE(blobs_huc) },
[INTEL_UC_FW_TYPE_GSC] = { blobs_gsc, ARRAY_SIZE(blobs_gsc) },
};
static void
__uc_fw_auto_select(struct drm_i915_private *i915, struct intel_uc_fw *uc_fw)
{
const struct uc_fw_platform_requirement *fw_blobs;
enum intel_platform p = INTEL_INFO(i915)->platform;
u32 fw_count;
u8 rev = INTEL_REVID(i915);
int i;
bool found;
/*
* The only difference between the ADL GuC FWs is the HWConfig support.
* ADL-N does not support HWConfig, so we should use the same binary as
* ADL-S, otherwise the GuC might attempt to fetch a config table that
* does not exist.
*/
if (IS_ALDERLAKE_P_N(i915))
p = INTEL_ALDERLAKE_S;
GEM_BUG_ON(uc_fw->type >= ARRAY_SIZE(blobs_all));
fw_blobs = blobs_all[uc_fw->type].blobs;
fw_count = blobs_all[uc_fw->type].count;
found = false;
for (i = 0; i < fw_count && p <= fw_blobs[i].p; i++) {
const struct uc_fw_blob *blob = &fw_blobs[i].blob;
if (p != fw_blobs[i].p)
continue;
if (rev < fw_blobs[i].rev)
continue;
if (uc_fw->file_selected.path) {
/*
* Continuing an earlier search after a found blob failed to load.
* Once the previously chosen path has been found, clear it out
* and let the search continue from there.
*/
if (uc_fw->file_selected.path == blob->path)
uc_fw->file_selected.path = NULL;
continue;
}
uc_fw->file_selected.path = blob->path;
uc_fw->file_wanted.path = blob->path;
uc_fw->file_wanted.ver.major = blob->major;
uc_fw->file_wanted.ver.minor = blob->minor;
uc_fw->file_wanted.ver.patch = blob->patch;
uc_fw->has_gsc_headers = blob->has_gsc_headers;
found = true;
break;
}
if (!found && uc_fw->file_selected.path) {
/* Failed to find a match for the last attempt?! */
uc_fw->file_selected.path = NULL;
}
}
static bool validate_fw_table_type(struct drm_i915_private *i915, enum intel_uc_fw_type type)
{
const struct uc_fw_platform_requirement *fw_blobs;
u32 fw_count;
int i, j;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/firmware.h`, `linux/highmem.h`, `drm/drm_cache.h`, `drm/drm_print.h`, `gem/i915_gem_lmem.h`, `gt/intel_gt.h`, `gt/intel_gt_print.h`.
- Detected declarations: `struct fw_blobs_by_type`, `function ____uc_fw_to_gt`, `function intel_uc_fw_change_status`, `function __uc_fw_auto_select`, `function validate_fw_table_type`, `function __uc_fw_user_override`, `function intel_uc_fw_version_from_gsc_manifest`, `function intel_uc_fw_init_early`, `function uc_unpack_css_version`, `function guc_read_css_info`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.