drivers/gpu/drm/panthor/panthor_fw.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panthor/panthor_fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panthor/panthor_fw.c- Extension
.c- Size
- 44229 bytes
- Lines
- 1531
- 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.
- 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
asm/arch_timer.hlinux/clk.hlinux/dma-mapping.hlinux/firmware.hlinux/iopoll.hlinux/iosys-map.hlinux/mutex.hlinux/platform_device.hlinux/pm_runtime.hdrm/drm_drv.hdrm/drm_managed.hdrm/drm_print.hpanthor_device.hpanthor_fw.hpanthor_fw_regs.hpanthor_gem.hpanthor_gpu.hpanthor_hw.hpanthor_mmu.hpanthor_sched.hpanthor_trace.h
Detected Declarations
struct panthor_fw_binary_hdrstruct panthor_fw_binary_section_entry_hdrstruct panthor_fw_build_info_hdrstruct panthor_fw_binary_iterstruct panthor_fw_sectionstruct panthor_fw_ifacestruct panthor_fwenum panthor_fw_binary_entry_typefunction panthor_fw_get_glb_ifacefunction panthor_fw_get_csg_ifacefunction panthor_fw_get_cs_ifacefunction panthor_fw_has_glb_statefunction panthor_fw_has_64bit_ep_reqfunction panthor_fw_csg_endpoint_req_getfunction panthor_fw_csg_endpoint_req_setfunction panthor_fw_csg_endpoint_req_updatefunction panthor_fw_conv_timeoutfunction panthor_fw_binary_iter_readfunction panthor_fw_binary_sub_iter_initfunction panthor_fw_init_section_memfunction panthor_fw_alloc_queue_iface_memfunction panthor_fw_alloc_suspend_buf_memfunction panthor_fw_load_section_entryfunction panthor_fw_read_build_infofunction panthor_reload_fw_sectionsfunction list_for_each_entryfunction panthor_fw_load_entryfunction panthor_fw_loadfunction iface_fw_to_cpu_addrfunction panthor_init_cs_ifacefunction compare_csgfunction panthor_init_csg_ifacefunction panthor_get_instr_featuresfunction panthor_fw_init_ifacesfunction panthor_fw_init_global_ifacefunction panthor_job_irq_handlerfunction panthor_fw_startfunction panthor_fw_stopfunction panthor_fw_mcu_haltedfunction panthor_fw_halt_mcufunction panthor_fw_wait_mcu_haltedfunction panthor_fw_mcu_set_activefunction panthor_fw_pre_resetfunction panthor_fw_post_resetfunction panthor_fw_unplugfunction panthor_fw_wait_acksfunction panthor_fw_glb_wait_acksfunction panthor_fw_csg_wait_acks
Annotated Snippet
struct panthor_fw_binary_hdr {
/** @magic: Magic value to check binary validity. */
u32 magic;
#define CSF_FW_BINARY_HEADER_MAGIC 0xc3f13a6e
/** @minor: Minor FW version. */
u8 minor;
/** @major: Major FW version. */
u8 major;
#define CSF_FW_BINARY_HEADER_MAJOR_MAX 0
/** @padding1: MBZ. */
u16 padding1;
/** @version_hash: FW version hash. */
u32 version_hash;
/** @padding2: MBZ. */
u32 padding2;
/** @size: FW binary size. */
u32 size;
};
/**
* enum panthor_fw_binary_entry_type - Firmware binary entry type
*/
enum panthor_fw_binary_entry_type {
/** @CSF_FW_BINARY_ENTRY_TYPE_IFACE: Host <-> FW interface. */
CSF_FW_BINARY_ENTRY_TYPE_IFACE = 0,
/** @CSF_FW_BINARY_ENTRY_TYPE_CONFIG: FW config. */
CSF_FW_BINARY_ENTRY_TYPE_CONFIG = 1,
/** @CSF_FW_BINARY_ENTRY_TYPE_FUTF_TEST: Unit-tests. */
CSF_FW_BINARY_ENTRY_TYPE_FUTF_TEST = 2,
/** @CSF_FW_BINARY_ENTRY_TYPE_TRACE_BUFFER: Trace buffer interface. */
CSF_FW_BINARY_ENTRY_TYPE_TRACE_BUFFER = 3,
/** @CSF_FW_BINARY_ENTRY_TYPE_TIMELINE_METADATA: Timeline metadata interface. */
CSF_FW_BINARY_ENTRY_TYPE_TIMELINE_METADATA = 4,
/**
* @CSF_FW_BINARY_ENTRY_TYPE_BUILD_INFO_METADATA: Metadata about how
* the FW binary was built.
*/
CSF_FW_BINARY_ENTRY_TYPE_BUILD_INFO_METADATA = 6
};
#define CSF_FW_BINARY_ENTRY_TYPE(ehdr) ((ehdr) & 0xff)
#define CSF_FW_BINARY_ENTRY_SIZE(ehdr) (((ehdr) >> 8) & 0xff)
#define CSF_FW_BINARY_ENTRY_UPDATE BIT(30)
#define CSF_FW_BINARY_ENTRY_OPTIONAL BIT(31)
#define CSF_FW_BINARY_IFACE_ENTRY_RD BIT(0)
#define CSF_FW_BINARY_IFACE_ENTRY_WR BIT(1)
#define CSF_FW_BINARY_IFACE_ENTRY_EX BIT(2)
#define CSF_FW_BINARY_IFACE_ENTRY_CACHE_MODE_NONE (0 << 3)
#define CSF_FW_BINARY_IFACE_ENTRY_CACHE_MODE_CACHED (1 << 3)
#define CSF_FW_BINARY_IFACE_ENTRY_CACHE_MODE_UNCACHED_COHERENT (2 << 3)
#define CSF_FW_BINARY_IFACE_ENTRY_CACHE_MODE_CACHED_COHERENT (3 << 3)
#define CSF_FW_BINARY_IFACE_ENTRY_CACHE_MODE_MASK GENMASK(4, 3)
#define CSF_FW_BINARY_IFACE_ENTRY_PROT BIT(5)
#define CSF_FW_BINARY_IFACE_ENTRY_SHARED BIT(30)
#define CSF_FW_BINARY_IFACE_ENTRY_ZERO BIT(31)
#define CSF_FW_BINARY_IFACE_ENTRY_SUPPORTED_FLAGS \
(CSF_FW_BINARY_IFACE_ENTRY_RD | \
CSF_FW_BINARY_IFACE_ENTRY_WR | \
CSF_FW_BINARY_IFACE_ENTRY_EX | \
CSF_FW_BINARY_IFACE_ENTRY_CACHE_MODE_MASK | \
CSF_FW_BINARY_IFACE_ENTRY_PROT | \
CSF_FW_BINARY_IFACE_ENTRY_SHARED | \
CSF_FW_BINARY_IFACE_ENTRY_ZERO)
/**
* struct panthor_fw_binary_section_entry_hdr - Describes a section of FW binary
*/
struct panthor_fw_binary_section_entry_hdr {
/** @flags: Section flags. */
u32 flags;
/** @va: MCU virtual range to map this binary section to. */
struct {
/** @start: Start address. */
u32 start;
/** @end: End address. */
Annotation
- Immediate include surface: `asm/arch_timer.h`, `linux/clk.h`, `linux/dma-mapping.h`, `linux/firmware.h`, `linux/iopoll.h`, `linux/iosys-map.h`, `linux/mutex.h`, `linux/platform_device.h`.
- Detected declarations: `struct panthor_fw_binary_hdr`, `struct panthor_fw_binary_section_entry_hdr`, `struct panthor_fw_build_info_hdr`, `struct panthor_fw_binary_iter`, `struct panthor_fw_section`, `struct panthor_fw_iface`, `struct panthor_fw`, `enum panthor_fw_binary_entry_type`, `function panthor_fw_get_glb_iface`, `function panthor_fw_get_csg_iface`.
- 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.