1 /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
2 /* Copyright (c) 2023 Imagination Technologies Ltd. */
7 #include <linux/bits.h>
8 #include <linux/sizes.h>
9 #include <linux/types.h>
12 * Firmware binary block unit in bytes.
13 * Raw data stored in FW binary will be aligned to this size.
15 #define FW_BLOCK_SIZE SZ_4K
17 /* Maximum number of entries in firmware layout table. */
18 #define PVR_FW_INFO_MAX_NUM_ENTRIES 8
20 enum pvr_fw_section_id {
38 enum pvr_fw_section_type {
47 * FW binary format with FW info attached:
59 * | Device info | FILE_SIZE - 4K - device_info_size
61 * | FW info header | FILE_SIZE - 4K
70 #define PVR_FW_INFO_VERSION 3
72 #define PVR_FW_FLAGS_OPEN_SOURCE BIT(0)
74 /** struct pvr_fw_info_header - Firmware header */
75 struct pvr_fw_info_header {
76 /** @info_version: FW info header version. */
78 /** @header_len: Header length. */
80 /** @layout_entry_num: Number of entries in the layout table. */
82 /** @layout_entry_size: Size of an entry in the layout table. */
83 u32 layout_entry_size;
84 /** @bvnc: GPU ID supported by firmware. */
86 /** @fw_page_size: Page size of processor on which firmware executes. */
88 /** @flags: Compatibility flags. */
90 /** @fw_version_major: Firmware major version number. */
92 /** @fw_version_minor: Firmware minor version number. */
94 /** @fw_version_build: Firmware build number. */
96 /** @device_info_size: Size of device info structure. */
98 /** @padding: Padding. */
103 * struct pvr_fw_layout_entry - Entry in firmware layout table, describing a
104 * section of the firmware image
106 struct pvr_fw_layout_entry {
107 /** @id: Section ID. */
108 enum pvr_fw_section_id id;
109 /** @type: Section type. */
110 enum pvr_fw_section_type type;
111 /** @base_addr: Base address of section in FW address space. */
113 /** @max_size: Maximum size of section, in bytes. */
115 /** @alloc_size: Allocation size of section, in bytes. */
117 /** @alloc_offset: Allocation offset of section. */
122 * struct pvr_fw_device_info_header - Device information header.
124 struct pvr_fw_device_info_header {
125 /** @brn_mask_size: BRN mask size (in u64s). */
127 /** @ern_mask_size: ERN mask size (in u64s). */
129 /** @feature_mask_size: Feature mask size (in u64s). */
130 u64 feature_mask_size;
131 /** @feature_param_size: Feature parameter size (in u64s). */
132 u64 feature_param_size;
135 #endif /* PVR_FW_INFO_H */