xref: /linux/drivers/gpu/drm/i915/gt/uc/intel_gsc_binary_headers.h (revision cdd5b5a9761fd66d17586e4f4ba6588c70e640ea)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 
6 #ifndef _INTEL_GSC_BINARY_HEADERS_H_
7 #define _INTEL_GSC_BINARY_HEADERS_H_
8 
9 #include <linux/types.h>
10 
11 struct intel_gsc_version {
12 	u16 major;
13 	u16 minor;
14 	u16 hotfix;
15 	u16 build;
16 } __packed;
17 
18 struct intel_gsc_partition {
19 	u32 offset;
20 	u32 size;
21 } __packed;
22 
23 struct intel_gsc_layout_pointers {
24 	u8 rom_bypass_vector[16];
25 
26 	/* size of pointers layout not including ROM bypass vector */
27 	u16 size;
28 
29 	/*
30 	 * bit0: Backup copy of layout pointers exist
31 	 * bits1-15: reserved
32 	 */
33 	u8 flags;
34 
35 	u8 reserved;
36 
37 	u32 crc32;
38 
39 	struct intel_gsc_partition datap;
40 	struct intel_gsc_partition boot1;
41 	struct intel_gsc_partition boot2;
42 	struct intel_gsc_partition boot3;
43 	struct intel_gsc_partition boot4;
44 	struct intel_gsc_partition boot5;
45 	struct intel_gsc_partition temp_pages;
46 } __packed;
47 
48 /* Boot partition structures */
49 struct intel_gsc_bpdt_header {
50 	u32 signature;
51 #define INTEL_GSC_BPDT_HEADER_SIGNATURE 0x000055AA
52 
53 	u16 descriptor_count; /* num of entries after the header */
54 
55 	u8 version;
56 	u8 configuration;
57 
58 	u32 crc32;
59 
60 	u32 build_version;
61 	struct intel_gsc_version tool_version;
62 } __packed;
63 
64 struct intel_gsc_bpdt_entry {
65 	/*
66 	 * Bits 0-15: BPDT entry type
67 	 * Bits 16-17: reserved
68 	 * Bit 18: code sub-partition
69 	 * Bits 19-31: reserved
70 	 */
71 	u32 type;
72 #define INTEL_GSC_BPDT_ENTRY_TYPE_MASK GENMASK(15, 0)
73 #define INTEL_GSC_BPDT_ENTRY_TYPE_GSC_RBE 0x1
74 
75 	u32 sub_partition_offset; /* from the base of the BPDT header */
76 	u32 sub_partition_size;
77 } __packed;
78 
79 /* Code partition directory (CPD) structures */
80 struct intel_gsc_cpd_header_v2 {
81 	u32 header_marker;
82 #define INTEL_GSC_CPD_HEADER_MARKER 0x44504324
83 
84 	u32 num_of_entries;
85 	u8 header_version;
86 	u8 entry_version;
87 	u8 header_length; /* in bytes */
88 	u8 flags;
89 	u32 partition_name;
90 	u32 crc32;
91 } __packed;
92 
93 struct intel_gsc_cpd_entry {
94 	u8 name[12];
95 
96 	/*
97 	 * Bits 0-24: offset from the beginning of the code partition
98 	 * Bit 25: huffman compressed
99 	 * Bits 26-31: reserved
100 	 */
101 	u32 offset;
102 #define INTEL_GSC_CPD_ENTRY_OFFSET_MASK GENMASK(24, 0)
103 #define INTEL_GSC_CPD_ENTRY_HUFFMAN_COMP BIT(25)
104 
105 	/*
106 	 * Module/Item length, in bytes. For Huffman-compressed modules, this
107 	 * refers to the uncompressed size. For software-compressed modules,
108 	 * this refers to the compressed size.
109 	 */
110 	u32 length;
111 
112 	u8 reserved[4];
113 } __packed;
114 
115 struct intel_gsc_manifest_header {
116 	u32 header_type; /* 0x4 for manifest type */
117 	u32 header_length; /* in dwords */
118 	u32 header_version;
119 	u32 flags;
120 	u32 vendor;
121 	u32 date;
122 	u32 size; /* In dwords, size of entire manifest (header + extensions) */
123 	u32 header_id;
124 	u32 internal_data;
125 	struct intel_gsc_version fw_version;
126 	u32 security_version;
127 	struct intel_gsc_version meu_kit_version;
128 	u32 meu_manifest_version;
129 	u8 general_data[4];
130 	u8 reserved3[56];
131 	u32 modulus_size; /* in dwords */
132 	u32 exponent_size; /* in dwords */
133 } __packed;
134 
135 #endif
136