1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVFW_LS_H__
3 #define __NVFW_LS_H__
4 #include <core/os.h>
5 struct nvkm_subdev;
6 
7 struct nvfw_ls_desc_head {
8 	u32 descriptor_size;
9 	u32 image_size;
10 	u32 tools_version;
11 	u32 app_version;
12 	char date[64];
13 	u32 bootloader_start_offset;
14 	u32 bootloader_size;
15 	u32 bootloader_imem_offset;
16 	u32 bootloader_entry_point;
17 	u32 app_start_offset;
18 	u32 app_size;
19 	u32 app_imem_offset;
20 	u32 app_imem_entry;
21 	u32 app_dmem_offset;
22 	u32 app_resident_code_offset;
23 	u32 app_resident_code_size;
24 	u32 app_resident_data_offset;
25 	u32 app_resident_data_size;
26 };
27 
28 struct nvfw_ls_desc {
29 	struct nvfw_ls_desc_head head;
30 	u32 nb_overlays;
31 	struct {
32 		u32 start;
33 		u32 size;
34 	} load_ovl[64];
35 	u32 compressed;
36 };
37 
38 const struct nvfw_ls_desc *nvfw_ls_desc(struct nvkm_subdev *, const void *);
39 
40 struct nvfw_ls_desc_v1 {
41 	struct nvfw_ls_desc_head head;
42 	u32 nb_imem_overlays;
43 	u32 nb_dmem_overlays;
44 	struct {
45 		u32 start;
46 		u32 size;
47 	} load_ovl[64];
48 	u32 compressed;
49 };
50 
51 const struct nvfw_ls_desc_v1 *
52 nvfw_ls_desc_v1(struct nvkm_subdev *, const void *);
53 
54 struct nvfw_ls_desc_v2 {
55 	u32 descriptor_size;
56 	u32 image_size;
57 	u32 tools_version;
58 	u32 app_version;
59 	char date[64];
60 	u32 secure_bootloader;
61 	u32 bootloader_start_offset;
62 	u32 bootloader_size;
63 	u32 bootloader_imem_offset;
64 	u32 bootloader_entry_point;
65 	u32 app_start_offset;
66 	u32 app_size;
67 	u32 app_imem_offset;
68 	u32 app_imem_entry;
69 	u32 app_dmem_offset;
70 	u32 app_resident_code_offset;
71 	u32 app_resident_code_size;
72 	u32 app_resident_data_offset;
73 	u32 app_resident_data_size;
74 	u32 nb_imem_overlays;
75 	u32 nb_dmem_overlays;
76 	struct {
77 		u32 start;
78 		u32 size;
79 	} load_ovl[64];
80 };
81 
82 const struct nvfw_ls_desc_v2 *nvfw_ls_desc_v2(struct nvkm_subdev *, const void *);
83 
84 struct nvfw_ls_hsbl_bin_hdr {
85 	u32 bin_magic;
86 	u32 bin_ver;
87 	u32 bin_size;
88 	u32 header_offset;
89 };
90 
91 const struct nvfw_ls_hsbl_bin_hdr *nvfw_ls_hsbl_bin_hdr(struct nvkm_subdev *, const void *);
92 
93 struct nvfw_ls_hsbl_hdr {
94 	u32 sig_prod_offset;
95 	u32 sig_prod_size;
96 	u32 patch_loc;
97 	u32 patch_sig;
98 	u32 meta_data_offset;
99 	u32 meta_data_size;
100 	u32 num_sig;
101 };
102 
103 const struct nvfw_ls_hsbl_hdr *nvfw_ls_hsbl_hdr(struct nvkm_subdev *, const void *);
104 #endif
105