blob: 4c88cc52d32078e125531482264aa48932ef883f [file] [log] [blame]
Krishna Prasad Bhat333edcc2021-11-26 06:52:27 +05301/* BPDT version 1.7 support */
2/* SPDX-License-Identifier: GPL-2.0-only */
3
4#include <sys/types.h>
5
6enum bpdt_entry_type {
7 SMIP = 0,
8 CSE_RBE = 1,
9 CSE_BUP = 2,
10 UCODE = 3,
11 IBB = 4,
12 S_BPDT = 5,
13 OBB = 6,
14 CSE_MAIN = 7,
15 ISH = 8,
16 CSE_IDLM = 9,
17 IFP_OVERRIDE = 10,
18 UTOK = 11,
19 UFS_PHY = 12,
20 UFS_GPP = 13,
21 PMC = 14,
22 IUNIT = 15,
23 NVM_CFG = 16,
24 UEP = 17,
25 OEM_KM = 20,
26 PAVP = 22,
27 IOM_FW = 23,
28 NPHY_FW = 24,
29 TBT_FW = 25,
30 ICC = 32,
31
32 MAX_SUBPARTS,
33};
34
35struct bpdt_header {
36 uint32_t signature; /* BPDT_SIGNATURE */
37 uint16_t descriptor_count;
38 uint8_t version; /* Layout 1.7 = 2 */
39 uint8_t flags;
40 uint32_t checksum;
41 uint32_t ifwi_version;
42 struct {
43 uint16_t major;
44 uint16_t minor;
45 uint16_t build;
46 uint16_t hotfix;
47 } fit_tool_version;
48} __packed;
49
50struct cse_layout {
51 uint8_t rom_bypass[16];
52 uint16_t size;
53 uint16_t redundancy;
54 uint32_t checksum;
55 uint32_t data_offset;
56 uint32_t data_size;
57 uint32_t bp1_offset;
58 uint32_t bp1_size;
59 uint32_t bp2_offset;
60 uint32_t bp2_size;
61 uint32_t bp3_offset;
62 uint32_t bp3_size;
63 uint32_t bp4_offset;
64 uint32_t bp4_size;
65 uint32_t bp5_offset;
66 uint32_t bp5_size;
67 uint32_t temp_base_addr;
68 uint32_t temp_base_size;
69 uint32_t flog_offset;
70 uint32_t flog_size;
71} __packed;
72
73struct bpdt_entry {
74 uint32_t type;
75 uint32_t offset;
76 uint32_t size;
77} __packed;
78
79struct subpart_hdr {
80 uint32_t signature; /* SUBPART_SIGNATURE */
81 uint32_t count;
82 uint8_t hdr_version; /* Header version = 2 */
83 uint8_t entry_version; /* Entry version = 1 */
84 uint8_t length;
85 uint8_t reserved;
86 uint8_t name[4];
87 uint32_t checksum;
88} __packed;
89
90struct subpart_entry {
91 uint8_t name[12];
92 uint32_t offset_bytes;
93 uint32_t length;
94 uint32_t rsvd2;
95} __packed;
96
97struct subpart_entry_manifest_header {
98 uint8_t reserved[36];
99 struct {
100 uint16_t major;
101 uint16_t minor;
102 uint16_t build;
103 uint16_t hotfix;
104 } binary_version;
105} __packed;