summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/gt/uc/intel_gsc_binary_headers.h
blob: 6d009a905269d0d85a5b52ebbd82aba083d6e7f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* SPDX-License-Identifier: MIT */
/*
 * Copyright © 2023 Intel Corporation
 */

#ifndef _INTEL_GSC_BINARY_HEADERS_H_
#define _INTEL_GSC_BINARY_HEADERS_H_

#include <linux/types.h>

struct intel_gsc_version {
	u16 major;
	u16 minor;
	u16 hotfix;
	u16 build;
} __packed;

struct intel_gsc_partition {
	u32 offset;
	u32 size;
} __packed;

struct intel_gsc_layout_pointers {
	u8 rom_bypass_vector[16];

	/* size of pointers layout not including ROM bypass vector */
	u16 size;

	/*
	 * bit0: Backup copy of layout pointers exist
	 * bits1-15: reserved
	 */
	u8 flags;

	u8 reserved;

	u32 crc32;

	struct intel_gsc_partition datap;
	struct intel_gsc_partition boot1;
	struct intel_gsc_partition boot2;
	struct intel_gsc_partition boot3;
	struct intel_gsc_partition boot4;
	struct intel_gsc_partition boot5;
	struct intel_gsc_partition temp_pages;
} __packed;

/* Boot partition structures */
struct intel_gsc_bpdt_header {
	u32 signature;
#define INTEL_GSC_BPDT_HEADER_SIGNATURE 0x000055AA

	u16 descriptor_count; /* num of entries after the header */

	u8 version;
	u8 configuration;

	u32 crc32;

	u32 build_version;
	struct intel_gsc_version tool_version;
} __packed;

struct intel_gsc_bpdt_entry {
	/*
	 * Bits 0-15: BPDT entry type
	 * Bits 16-17: reserved
	 * Bit 18: code sub-partition
	 * Bits 19-31: reserved
	 */
	u32 type;
#define INTEL_GSC_BPDT_ENTRY_TYPE_MASK GENMASK(15, 0)
#define INTEL_GSC_BPDT_ENTRY_TYPE_GSC_RBE 0x1

	u32 sub_partition_offset; /* from the base of the BPDT header */
	u32 sub_partition_size;
} __packed;

/* Code partition directory (CPD) structures */
struct intel_gsc_cpd_header_v2 {
	u32 header_marker;
#define INTEL_GSC_CPD_HEADER_MARKER 0x44504324

	u32 num_of_entries;
	u8 header_version;
	u8 entry_version;
	u8 header_length; /* in bytes */
	u8 flags;
	u32 partition_name;
	u32 crc32;
} __packed;

struct intel_gsc_cpd_entry {
	u8 name[12];

	/*
	 * Bits 0-24: offset from the beginning of the code partition
	 * Bit 25: huffman compressed
	 * Bits 26-31: reserved
	 */
	u32 offset;
#define INTEL_GSC_CPD_ENTRY_OFFSET_MASK GENMASK(24, 0)
#define INTEL_GSC_CPD_ENTRY_HUFFMAN_COMP BIT(25)

	/*
	 * Module/Item length, in bytes. For Huffman-compressed modules, this
	 * refers to the uncompressed size. For software-compressed modules,
	 * this refers to the compressed size.
	 */
	u32 length;

	u8 reserved[4];
} __packed;

struct intel_gsc_manifest_header {
	u32 header_type; /* 0x4 for manifest type */
	u32 header_length; /* in dwords */
	u32 header_version;
	u32 flags;
	u32 vendor;
	u32 date;
	u32 size; /* In dwords, size of entire manifest (header + extensions) */
	u32 header_id;
	u32 internal_data;
	struct intel_gsc_version fw_version;
	u32 security_version;
	struct intel_gsc_version meu_kit_version;
	u32 meu_manifest_version;
	u8 general_data[4];
	u8 reserved3[56];
	u32 modulus_size; /* in dwords */
	u32 exponent_size; /* in dwords */
} __packed;

#endif