diff options
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/acr/acr_flcnbl.h | 135 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/acr/acr_lsfm.h | 239 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/acr/acr_objflcn.h | 82 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/acr/acr_objlsfm.h | 76 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h | 94 |
5 files changed, 626 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/acr/acr_flcnbl.h b/drivers/gpu/nvgpu/include/nvgpu/acr/acr_flcnbl.h new file mode 100644 index 00000000..00b72d3e --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/acr/acr_flcnbl.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | #ifndef __ACR_FLCNBL_H__ | ||
14 | #define __ACR_FLCNBL_H__ | ||
15 | |||
16 | #include <nvgpu/flcnif_cmn.h> | ||
17 | |||
18 | #ifndef __NVGPU_ACR_H__ | ||
19 | #warning "acr_flcnbl.h not included from nvgpu_acr.h!" \ | ||
20 | "Include nvgpu_acr.h instead of acr_xxx.h to get access to ACR interfaces" | ||
21 | #endif | ||
22 | |||
23 | /* | ||
24 | * Structure used by the boot-loader to load the rest of the code. This has | ||
25 | * to be filled by NVGPU and copied into DMEM at offset provided in the | ||
26 | * hsflcn_bl_desc.bl_desc_dmem_load_off. | ||
27 | */ | ||
28 | struct flcn_bl_dmem_desc { | ||
29 | u32 reserved[4]; /*Should be the first element..*/ | ||
30 | u32 signature[4]; /*Should be the first element..*/ | ||
31 | u32 ctx_dma; | ||
32 | u32 code_dma_base; | ||
33 | u32 non_sec_code_off; | ||
34 | u32 non_sec_code_size; | ||
35 | u32 sec_code_off; | ||
36 | u32 sec_code_size; | ||
37 | u32 code_entry_point; | ||
38 | u32 data_dma_base; | ||
39 | u32 data_size; | ||
40 | u32 code_dma_base1; | ||
41 | u32 data_dma_base1; | ||
42 | }; | ||
43 | |||
44 | struct flcn_bl_dmem_desc_v1 { | ||
45 | u32 reserved[4]; /*Should be the first element..*/ | ||
46 | u32 signature[4]; /*Should be the first element..*/ | ||
47 | u32 ctx_dma; | ||
48 | struct falc_u64 code_dma_base; | ||
49 | u32 non_sec_code_off; | ||
50 | u32 non_sec_code_size; | ||
51 | u32 sec_code_off; | ||
52 | u32 sec_code_size; | ||
53 | u32 code_entry_point; | ||
54 | struct falc_u64 data_dma_base; | ||
55 | u32 data_size; | ||
56 | u32 argc; | ||
57 | u32 argv; | ||
58 | }; | ||
59 | |||
60 | /* | ||
61 | * The header used by NVGPU to figure out code and data sections of bootloader | ||
62 | * | ||
63 | * bl_code_off - Offset of code section in the image | ||
64 | * bl_code_size - Size of code section in the image | ||
65 | * bl_data_off - Offset of data section in the image | ||
66 | * bl_data_size - Size of data section in the image | ||
67 | */ | ||
68 | struct flcn_bl_img_hdr { | ||
69 | u32 bl_code_off; | ||
70 | u32 bl_code_size; | ||
71 | u32 bl_data_off; | ||
72 | u32 bl_data_size; | ||
73 | }; | ||
74 | |||
75 | /* | ||
76 | * The descriptor used by NVGPU to figure out the requirements of bootloader | ||
77 | * | ||
78 | * bl_start_tag - Starting tag of bootloader | ||
79 | * bl_desc_dmem_load_off - Dmem offset where _def_rm_flcn_bl_dmem_desc | ||
80 | * to be loaded | ||
81 | * bl_img_hdr - Description of the image | ||
82 | */ | ||
83 | struct hsflcn_bl_desc { | ||
84 | u32 bl_start_tag; | ||
85 | u32 bl_desc_dmem_load_off; | ||
86 | struct flcn_bl_img_hdr bl_img_hdr; | ||
87 | }; | ||
88 | |||
89 | /* | ||
90 | * Legacy structure used by the current PMU/DPU bootloader. | ||
91 | */ | ||
92 | struct loader_config { | ||
93 | u32 dma_idx; | ||
94 | u32 code_dma_base; /* upper 32-bits of 40-bit dma address */ | ||
95 | u32 code_size_total; | ||
96 | u32 code_size_to_load; | ||
97 | u32 code_entry_point; | ||
98 | u32 data_dma_base; /* upper 32-bits of 40-bit dma address */ | ||
99 | u32 data_size; /* initialized data of the application */ | ||
100 | u32 overlay_dma_base; /* upper 32-bits of the 40-bit dma address */ | ||
101 | u32 argc; | ||
102 | u32 argv; | ||
103 | u16 code_dma_base1; /* upper 7 bits of 47-bit dma address */ | ||
104 | u16 data_dma_base1; /* upper 7 bits of 47-bit dma address */ | ||
105 | u16 overlay_dma_base1; /* upper 7 bits of the 47-bit dma address */ | ||
106 | }; | ||
107 | |||
108 | struct loader_config_v1 { | ||
109 | u32 reserved; | ||
110 | u32 dma_idx; | ||
111 | struct falc_u64 code_dma_base; | ||
112 | u32 code_size_total; | ||
113 | u32 code_size_to_load; | ||
114 | u32 code_entry_point; | ||
115 | struct falc_u64 data_dma_base; | ||
116 | u32 data_size; | ||
117 | struct falc_u64 overlay_dma_base; | ||
118 | u32 argc; | ||
119 | u32 argv; | ||
120 | }; | ||
121 | |||
122 | /* | ||
123 | * Union of all supported structures used by bootloaders. | ||
124 | */ | ||
125 | union flcn_bl_generic_desc { | ||
126 | struct flcn_bl_dmem_desc bl_dmem_desc; | ||
127 | struct loader_config loader_cfg; | ||
128 | }; | ||
129 | |||
130 | union flcn_bl_generic_desc_v1 { | ||
131 | struct flcn_bl_dmem_desc_v1 bl_dmem_desc_v1; | ||
132 | struct loader_config_v1 loader_cfg_v1; | ||
133 | }; | ||
134 | |||
135 | #endif /* __ACR_FLCNBL_H__ */ | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/acr/acr_lsfm.h b/drivers/gpu/nvgpu/include/nvgpu/acr/acr_lsfm.h new file mode 100644 index 00000000..89edcefa --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/acr/acr_lsfm.h | |||
@@ -0,0 +1,239 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | #ifndef __ACR_LSFM_H__ | ||
14 | #define __ACR_LSFM_H__ | ||
15 | |||
16 | #ifndef __NVGPU_ACR_H__ | ||
17 | #warning "acr_lsfm.h not included from nvgpu_acr.h!" \ | ||
18 | "Include nvgpu_acr.h instead of acr_xxx.h to get access to ACR interfaces" | ||
19 | #endif | ||
20 | |||
21 | /* | ||
22 | * Falcon Id Defines | ||
23 | * Defines a common Light Secure Falcon identifier. | ||
24 | */ | ||
25 | #define LSF_FALCON_ID_PMU (0) | ||
26 | #define LSF_FALCON_ID_RESERVED (1) | ||
27 | #define LSF_FALCON_ID_FECS (2) | ||
28 | #define LSF_FALCON_ID_GPCCS (3) | ||
29 | #define LSF_FALCON_ID_END (11) | ||
30 | #define LSF_FALCON_ID_INVALID (0xFFFFFFFF) | ||
31 | |||
32 | /* | ||
33 | * Light Secure Falcon Ucode Description Defines | ||
34 | * This structure is prelim and may change as the ucode signing flow evolves. | ||
35 | */ | ||
36 | struct lsf_ucode_desc { | ||
37 | u8 prd_keys[2][16]; | ||
38 | u8 dbg_keys[2][16]; | ||
39 | u32 b_prd_present; | ||
40 | u32 b_dbg_present; | ||
41 | u32 falcon_id; | ||
42 | }; | ||
43 | |||
44 | struct lsf_ucode_desc_v1 { | ||
45 | u8 prd_keys[2][16]; | ||
46 | u8 dbg_keys[2][16]; | ||
47 | u32 b_prd_present; | ||
48 | u32 b_dbg_present; | ||
49 | u32 falcon_id; | ||
50 | u32 bsupports_versioning; | ||
51 | u32 version; | ||
52 | u32 dep_map_count; | ||
53 | u8 dep_map[LSF_FALCON_ID_END * 2 * 4]; | ||
54 | u8 kdf[16]; | ||
55 | }; | ||
56 | |||
57 | /* | ||
58 | * Light Secure WPR Header | ||
59 | * Defines state allowing Light Secure Falcon bootstrapping. | ||
60 | */ | ||
61 | struct lsf_wpr_header { | ||
62 | u32 falcon_id; | ||
63 | u32 lsb_offset; | ||
64 | u32 bootstrap_owner; | ||
65 | u32 lazy_bootstrap; | ||
66 | u32 status; | ||
67 | }; | ||
68 | |||
69 | struct lsf_wpr_header_v1 { | ||
70 | u32 falcon_id; | ||
71 | u32 lsb_offset; | ||
72 | u32 bootstrap_owner; | ||
73 | u32 lazy_bootstrap; | ||
74 | u32 bin_version; | ||
75 | u32 status; | ||
76 | }; | ||
77 | /* | ||
78 | * Bootstrap Owner Defines | ||
79 | */ | ||
80 | #define LSF_BOOTSTRAP_OWNER_DEFAULT (LSF_FALCON_ID_PMU) | ||
81 | |||
82 | /* | ||
83 | * Image Status Defines | ||
84 | */ | ||
85 | #define LSF_IMAGE_STATUS_NONE (0) | ||
86 | #define LSF_IMAGE_STATUS_COPY (1) | ||
87 | #define LSF_IMAGE_STATUS_VALIDATION_CODE_FAILED (2) | ||
88 | #define LSF_IMAGE_STATUS_VALIDATION_DATA_FAILED (3) | ||
89 | #define LSF_IMAGE_STATUS_VALIDATION_DONE (4) | ||
90 | #define LSF_IMAGE_STATUS_VALIDATION_SKIPPED (5) | ||
91 | #define LSF_IMAGE_STATUS_BOOTSTRAP_READY (6) | ||
92 | |||
93 | /*Light Secure Bootstrap header related defines*/ | ||
94 | #define NV_FLCN_ACR_LSF_FLAG_LOAD_CODE_AT_0_FALSE 0 | ||
95 | #define NV_FLCN_ACR_LSF_FLAG_LOAD_CODE_AT_0_TRUE 1 | ||
96 | #define NV_FLCN_ACR_LSF_FLAG_DMACTL_REQ_CTX_FALSE 0 | ||
97 | #define NV_FLCN_ACR_LSF_FLAG_DMACTL_REQ_CTX_TRUE 4 | ||
98 | #define NV_FLCN_ACR_LSF_FLAG_FORCE_PRIV_LOAD_TRUE 8 | ||
99 | #define NV_FLCN_ACR_LSF_FLAG_FORCE_PRIV_LOAD_FALSE 0 | ||
100 | |||
101 | /* | ||
102 | * Light Secure Bootstrap Header | ||
103 | * Defines state allowing Light Secure Falcon bootstrapping. | ||
104 | */ | ||
105 | struct lsf_lsb_header { | ||
106 | struct lsf_ucode_desc signature; | ||
107 | u32 ucode_off; | ||
108 | u32 ucode_size; | ||
109 | u32 data_size; | ||
110 | u32 bl_code_size; | ||
111 | u32 bl_imem_off; | ||
112 | u32 bl_data_off; | ||
113 | u32 bl_data_size; | ||
114 | u32 app_code_off; | ||
115 | u32 app_code_size; | ||
116 | u32 app_data_off; | ||
117 | u32 app_data_size; | ||
118 | u32 flags; | ||
119 | }; | ||
120 | |||
121 | struct lsf_lsb_header_v1 { | ||
122 | struct lsf_ucode_desc_v1 signature; | ||
123 | u32 ucode_off; | ||
124 | u32 ucode_size; | ||
125 | u32 data_size; | ||
126 | u32 bl_code_size; | ||
127 | u32 bl_imem_off; | ||
128 | u32 bl_data_off; | ||
129 | u32 bl_data_size; | ||
130 | u32 app_code_off; | ||
131 | u32 app_code_size; | ||
132 | u32 app_data_off; | ||
133 | u32 app_data_size; | ||
134 | u32 flags; | ||
135 | }; | ||
136 | |||
137 | /* | ||
138 | * Light Secure WPR Content Alignments | ||
139 | */ | ||
140 | #define LSF_LSB_HEADER_ALIGNMENT 256 | ||
141 | #define LSF_BL_DATA_ALIGNMENT 256 | ||
142 | #define LSF_BL_DATA_SIZE_ALIGNMENT 256 | ||
143 | #define LSF_BL_CODE_SIZE_ALIGNMENT 256 | ||
144 | |||
145 | #define LSF_UCODE_DATA_ALIGNMENT 4096 | ||
146 | |||
147 | /* | ||
148 | * Supporting maximum of 2 regions. | ||
149 | * This is needed to pre-allocate space in DMEM | ||
150 | */ | ||
151 | #define NVGPU_FLCN_ACR_MAX_REGIONS (2) | ||
152 | #define LSF_BOOTSTRAP_OWNER_RESERVED_DMEM_SIZE (0x200) | ||
153 | |||
154 | /* | ||
155 | * start_addr - Starting address of region | ||
156 | * end_addr - Ending address of region | ||
157 | * region_id - Region ID | ||
158 | * read_mask - Read Mask | ||
159 | * write_mask - WriteMask | ||
160 | * client_mask - Bit map of all clients currently using this region | ||
161 | */ | ||
162 | struct flcn_acr_region_prop { | ||
163 | u32 start_addr; | ||
164 | u32 end_addr; | ||
165 | u32 region_id; | ||
166 | u32 read_mask; | ||
167 | u32 write_mask; | ||
168 | u32 client_mask; | ||
169 | }; | ||
170 | |||
171 | struct flcn_acr_region_prop_v1 { | ||
172 | u32 start_addr; | ||
173 | u32 end_addr; | ||
174 | u32 region_id; | ||
175 | u32 read_mask; | ||
176 | u32 write_mask; | ||
177 | u32 client_mask; | ||
178 | u32 shadowmMem_startaddress; | ||
179 | }; | ||
180 | |||
181 | /* | ||
182 | * no_regions - Number of regions used. | ||
183 | * region_props - Region properties | ||
184 | */ | ||
185 | struct flcn_acr_regions { | ||
186 | u32 no_regions; | ||
187 | struct flcn_acr_region_prop region_props[NVGPU_FLCN_ACR_MAX_REGIONS]; | ||
188 | }; | ||
189 | |||
190 | struct flcn_acr_regions_v1 { | ||
191 | u32 no_regions; | ||
192 | struct flcn_acr_region_prop_v1 region_props[NVGPU_FLCN_ACR_MAX_REGIONS]; | ||
193 | }; | ||
194 | /* | ||
195 | * reserved_dmem-When the bootstrap owner has done bootstrapping other falcons, | ||
196 | * and need to switch into LS mode, it needs to have its own | ||
197 | * actual DMEM image copied into DMEM as part of LS setup. If | ||
198 | * ACR desc is at location 0, it will definitely get overwritten | ||
199 | * causing data corruption. Hence we are reserving 0x200 bytes | ||
200 | * to give room for any loading data. NOTE: This has to be the | ||
201 | * first member always | ||
202 | * signature - Signature of ACR ucode. | ||
203 | * wpr_region_id - Region ID holding the WPR header and its details | ||
204 | * wpr_offset - Offset from the WPR region holding the wpr header | ||
205 | * regions - Region descriptors | ||
206 | * nonwpr_ucode_blob_start -stores non-WPR start where kernel stores ucode blob | ||
207 | * nonwpr_ucode_blob_end -stores non-WPR end where kernel stores ucode blob | ||
208 | */ | ||
209 | struct flcn_acr_desc { | ||
210 | union { | ||
211 | u32 reserved_dmem[(LSF_BOOTSTRAP_OWNER_RESERVED_DMEM_SIZE/4)]; | ||
212 | u32 signatures[4]; | ||
213 | } ucode_reserved_space; | ||
214 | /*Always 1st*/ | ||
215 | u32 wpr_region_id; | ||
216 | u32 wpr_offset; | ||
217 | u32 mmu_mem_range; | ||
218 | struct flcn_acr_regions regions; | ||
219 | u32 nonwpr_ucode_blob_size; | ||
220 | u64 nonwpr_ucode_blob_start; | ||
221 | }; | ||
222 | |||
223 | struct flcn_acr_desc_v1 { | ||
224 | union { | ||
225 | u32 reserved_dmem[(LSF_BOOTSTRAP_OWNER_RESERVED_DMEM_SIZE/4)]; | ||
226 | } ucode_reserved_space; | ||
227 | u32 signatures[4]; | ||
228 | /*Always 1st*/ | ||
229 | u32 wpr_region_id; | ||
230 | u32 wpr_offset; | ||
231 | u32 mmu_mem_range; | ||
232 | struct flcn_acr_regions_v1 regions; | ||
233 | u32 nonwpr_ucode_blob_size; | ||
234 | u64 nonwpr_ucode_blob_start; | ||
235 | u32 dummy[4]; /* ACR_BSI_VPR_DESC */ | ||
236 | }; | ||
237 | |||
238 | |||
239 | #endif /* __ACR_LSFM_H__ */ | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/acr/acr_objflcn.h b/drivers/gpu/nvgpu/include/nvgpu/acr/acr_objflcn.h new file mode 100644 index 00000000..0f2f66d6 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/acr/acr_objflcn.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | #ifndef __ACR_OBJFLCN_H__ | ||
14 | #define __ACR_OBJFLCN_H__ | ||
15 | |||
16 | #ifndef __NVGPU_ACR_H__ | ||
17 | #warning "acr_objflcn.h not included from nvgpu_acr.h!" \ | ||
18 | "Include nvgpu_acr.h instead of acr_xxx.h to get access to ACR interfaces" | ||
19 | #endif | ||
20 | |||
21 | struct flcn_ucode_img { | ||
22 | u32 *header; /* only some falcons have header */ | ||
23 | u32 *data; | ||
24 | struct pmu_ucode_desc *desc; /* only some falcons have descriptor */ | ||
25 | u32 data_size; | ||
26 | void *fw_ver; /* CTRL_GPU_GET_FIRMWARE_VERSION_PARAMS struct */ | ||
27 | u8 load_entire_os_data; /* load the whole osData section at boot time.*/ | ||
28 | /* NULL if not a light secure falcon.*/ | ||
29 | struct lsf_ucode_desc *lsf_desc; | ||
30 | /* True if there a resources to freed by the client. */ | ||
31 | u8 free_res_allocs; | ||
32 | u32 flcn_inst; | ||
33 | }; | ||
34 | |||
35 | struct flcn_ucode_img_v1 { | ||
36 | u32 *header; | ||
37 | u32 *data; | ||
38 | struct pmu_ucode_desc_v1 *desc; | ||
39 | u32 data_size; | ||
40 | void *fw_ver; | ||
41 | u8 load_entire_os_data; | ||
42 | struct lsf_ucode_desc_v1 *lsf_desc; | ||
43 | u8 free_res_allocs; | ||
44 | u32 flcn_inst; | ||
45 | }; | ||
46 | |||
47 | /* | ||
48 | * Falcon UCODE header index. | ||
49 | */ | ||
50 | #define FLCN_NL_UCODE_HDR_OS_CODE_OFF_IND (0) | ||
51 | #define FLCN_NL_UCODE_HDR_OS_CODE_SIZE_IND (1) | ||
52 | #define FLCN_NL_UCODE_HDR_OS_DATA_OFF_IND (2) | ||
53 | #define FLCN_NL_UCODE_HDR_OS_DATA_SIZE_IND (3) | ||
54 | #define FLCN_NL_UCODE_HDR_NUM_APPS_IND (4) | ||
55 | |||
56 | /* | ||
57 | * There are total N number of Apps with code and offset defined in UCODE header | ||
58 | * This macro provides the CODE and DATA offset and size of Ath application. | ||
59 | */ | ||
60 | #define FLCN_NL_UCODE_HDR_APP_CODE_START_IND (5) | ||
61 | #define FLCN_NL_UCODE_HDR_APP_CODE_OFF_IND(N, A) \ | ||
62 | (FLCN_NL_UCODE_HDR_APP_CODE_START_IND + (A*2)) | ||
63 | #define FLCN_NL_UCODE_HDR_APP_CODE_SIZE_IND(N, A) \ | ||
64 | (FLCN_NL_UCODE_HDR_APP_CODE_START_IND + (A*2) + 1) | ||
65 | #define FLCN_NL_UCODE_HDR_APP_CODE_END_IND(N) \ | ||
66 | (FLCN_NL_UCODE_HDR_APP_CODE_START_IND + (N*2) - 1) | ||
67 | |||
68 | #define FLCN_NL_UCODE_HDR_APP_DATA_START_IND(N) \ | ||
69 | (FLCN_NL_UCODE_HDR_APP_CODE_END_IND(N) + 1) | ||
70 | #define FLCN_NL_UCODE_HDR_APP_DATA_OFF_IND(N, A) \ | ||
71 | (FLCN_NL_UCODE_HDR_APP_DATA_START_IND(N) + (A*2)) | ||
72 | #define FLCN_NL_UCODE_HDR_APP_DATA_SIZE_IND(N, A) \ | ||
73 | (FLCN_NL_UCODE_HDR_APP_DATA_START_IND(N) + (A*2) + 1) | ||
74 | #define FLCN_NL_UCODE_HDR_APP_DATA_END_IND(N) \ | ||
75 | (FLCN_NL_UCODE_HDR_APP_DATA_START_IND(N) + (N*2) - 1) | ||
76 | |||
77 | #define FLCN_NL_UCODE_HDR_OS_OVL_OFF_IND(N) \ | ||
78 | (FLCN_NL_UCODE_HDR_APP_DATA_END_IND(N) + 1) | ||
79 | #define FLCN_NL_UCODE_HDR_OS_OVL_SIZE_IND(N) \ | ||
80 | (FLCN_NL_UCODE_HDR_APP_DATA_END_IND(N) + 2) | ||
81 | |||
82 | #endif /* __ACR_OBJFLCN_H__ */ | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/acr/acr_objlsfm.h b/drivers/gpu/nvgpu/include/nvgpu/acr/acr_objlsfm.h new file mode 100644 index 00000000..a7ea5bba --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/acr/acr_objlsfm.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | #ifndef __ACR_OBJLSFM_H__ | ||
14 | #define __ACR_OBJLSFM_H__ | ||
15 | |||
16 | #ifndef __NVGPU_ACR_H__ | ||
17 | #warning "acr_objlsfm.h not included from nvgpu_acr.h!" \ | ||
18 | "Include nvgpu_acr.h instead of acr_xxx.h to get access to ACR interfaces" | ||
19 | #endif | ||
20 | |||
21 | #include "acr_flcnbl.h" | ||
22 | #include "acr_objflcn.h" | ||
23 | |||
24 | /* | ||
25 | * LSFM Managed Ucode Image | ||
26 | * next : Next image the list, NULL if last. | ||
27 | * wpr_header : WPR header for this ucode image | ||
28 | * lsb_header : LSB header for this ucode image | ||
29 | * bl_gen_desc : Bootloader generic desc structure for this ucode image | ||
30 | * bl_gen_desc_size : Sizeof bootloader desc structure for this ucode image | ||
31 | * full_ucode_size : Surface size required for final ucode image | ||
32 | * ucode_img : Ucode image info | ||
33 | */ | ||
34 | struct lsfm_managed_ucode_img { | ||
35 | struct lsfm_managed_ucode_img *next; | ||
36 | struct lsf_wpr_header wpr_header; | ||
37 | struct lsf_lsb_header lsb_header; | ||
38 | union flcn_bl_generic_desc bl_gen_desc; | ||
39 | u32 bl_gen_desc_size; | ||
40 | u32 full_ucode_size; | ||
41 | struct flcn_ucode_img ucode_img; | ||
42 | }; | ||
43 | |||
44 | struct lsfm_managed_ucode_img_v2 { | ||
45 | struct lsfm_managed_ucode_img_v2 *next; | ||
46 | struct lsf_wpr_header_v1 wpr_header; | ||
47 | struct lsf_lsb_header_v1 lsb_header; | ||
48 | union flcn_bl_generic_desc_v1 bl_gen_desc; | ||
49 | u32 bl_gen_desc_size; | ||
50 | u32 full_ucode_size; | ||
51 | struct flcn_ucode_img_v1 ucode_img; | ||
52 | }; | ||
53 | |||
54 | /* | ||
55 | * Defines the structure used to contain all generic information related to | ||
56 | * the LSFM. | ||
57 | * Contains the Light Secure Falcon Manager (LSFM) feature related data. | ||
58 | */ | ||
59 | struct ls_flcn_mgr { | ||
60 | u16 managed_flcn_cnt; | ||
61 | u32 wpr_size; | ||
62 | u32 disable_mask; | ||
63 | struct lsfm_managed_ucode_img *ucode_img_list; | ||
64 | void *wpr_client_req_state;/*PACR_CLIENT_REQUEST_STATE originally*/ | ||
65 | }; | ||
66 | |||
67 | struct ls_flcn_mgr_v1 { | ||
68 | u16 managed_flcn_cnt; | ||
69 | u32 wpr_size; | ||
70 | u32 disable_mask; | ||
71 | struct lsfm_managed_ucode_img_v2 *ucode_img_list; | ||
72 | void *wpr_client_req_state;/*PACR_CLIENT_REQUEST_STATE originally*/ | ||
73 | }; | ||
74 | |||
75 | |||
76 | #endif /* __ACR_OBJLSFM_H__ */ | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h b/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h new file mode 100644 index 00000000..f207c9ab --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | |||
14 | #ifndef __NVGPU_ACR_H__ | ||
15 | #define __NVGPU_ACR_H__ | ||
16 | |||
17 | #include "gk20a/mm_gk20a.h" | ||
18 | |||
19 | #include "acr_lsfm.h" | ||
20 | #include "acr_flcnbl.h" | ||
21 | #include "acr_objlsfm.h" | ||
22 | #include "acr_objflcn.h" | ||
23 | |||
24 | #define MAX_SUPPORTED_LSFM 3 /*PMU, FECS, GPCCS*/ | ||
25 | |||
26 | #define ACR_COMPLETION_TIMEOUT_MS 10000 /*in msec */ | ||
27 | |||
28 | #define PMU_SECURE_MODE (0x1) | ||
29 | #define PMU_LSFM_MANAGED (0x2) | ||
30 | |||
31 | struct bin_hdr { | ||
32 | /* 0x10de */ | ||
33 | u32 bin_magic; | ||
34 | /* versioning of bin format */ | ||
35 | u32 bin_ver; | ||
36 | /* Entire image size including this header */ | ||
37 | u32 bin_size; | ||
38 | /* | ||
39 | * Header offset of executable binary metadata, | ||
40 | * start @ offset- 0x100 * | ||
41 | */ | ||
42 | u32 header_offset; | ||
43 | /* | ||
44 | * Start of executable binary data, start @ | ||
45 | * offset- 0x200 | ||
46 | */ | ||
47 | u32 data_offset; | ||
48 | /* Size of executable binary */ | ||
49 | u32 data_size; | ||
50 | }; | ||
51 | |||
52 | struct acr_fw_header { | ||
53 | u32 sig_dbg_offset; | ||
54 | u32 sig_dbg_size; | ||
55 | u32 sig_prod_offset; | ||
56 | u32 sig_prod_size; | ||
57 | u32 patch_loc; | ||
58 | u32 patch_sig; | ||
59 | u32 hdr_offset; /* This header points to acr_ucode_header_t210_load */ | ||
60 | u32 hdr_size; /* Size of above header */ | ||
61 | }; | ||
62 | |||
63 | struct wpr_carveout_info { | ||
64 | u64 wpr_base; | ||
65 | u64 nonwpr_base; | ||
66 | u64 size; | ||
67 | }; | ||
68 | |||
69 | struct acr_desc { | ||
70 | struct mem_desc ucode_blob; | ||
71 | struct mem_desc wpr_dummy; | ||
72 | struct bin_hdr *bl_bin_hdr; | ||
73 | struct hsflcn_bl_desc *pmu_hsbl_desc; | ||
74 | struct bin_hdr *hsbin_hdr; | ||
75 | struct acr_fw_header *fw_hdr; | ||
76 | u32 pmu_args; | ||
77 | const struct firmware *acr_fw; | ||
78 | union{ | ||
79 | struct flcn_acr_desc *acr_dmem_desc; | ||
80 | struct flcn_acr_desc_v1 *acr_dmem_desc_v1; | ||
81 | }; | ||
82 | struct mem_desc acr_ucode; | ||
83 | const struct firmware *hsbl_fw; | ||
84 | struct mem_desc hsbl_ucode; | ||
85 | union { | ||
86 | struct flcn_bl_dmem_desc bl_dmem_desc; | ||
87 | struct flcn_bl_dmem_desc_v1 bl_dmem_desc_v1; | ||
88 | }; | ||
89 | const struct firmware *pmu_fw; | ||
90 | const struct firmware *pmu_desc; | ||
91 | u32 capabilities; | ||
92 | }; | ||
93 | |||
94 | #endif /*__NVGPU_ACR_H__*/ | ||