Lines Matching refs:lsfw
29 nvkm_acr_lsfw_del(struct nvkm_acr_lsfw *lsfw) in nvkm_acr_lsfw_del() argument
31 nvkm_blob_dtor(&lsfw->img); in nvkm_acr_lsfw_del()
32 kfree(lsfw->sigs); in nvkm_acr_lsfw_del()
33 nvkm_firmware_put(lsfw->sig); in nvkm_acr_lsfw_del()
34 list_del(&lsfw->head); in nvkm_acr_lsfw_del()
35 kfree(lsfw); in nvkm_acr_lsfw_del()
41 struct nvkm_acr_lsfw *lsfw, *lsft; in nvkm_acr_lsfw_del_all() local
42 list_for_each_entry_safe(lsfw, lsft, &acr->lsfw, head) { in nvkm_acr_lsfw_del_all()
43 nvkm_acr_lsfw_del(lsfw); in nvkm_acr_lsfw_del_all()
50 struct nvkm_acr_lsfw *lsfw; in nvkm_acr_lsfw_get() local
51 list_for_each_entry(lsfw, &acr->lsfw, head) { in nvkm_acr_lsfw_get()
52 if (lsfw->id == id) in nvkm_acr_lsfw_get()
53 return lsfw; in nvkm_acr_lsfw_get()
62 struct nvkm_acr_lsfw *lsfw; in nvkm_acr_lsfw_add() local
67 lsfw = nvkm_acr_lsfw_get(acr, id); in nvkm_acr_lsfw_add()
68 if (lsfw && lsfw->func) { in nvkm_acr_lsfw_add()
73 if (!lsfw) { in nvkm_acr_lsfw_add()
74 if (!(lsfw = kzalloc(sizeof(*lsfw), GFP_KERNEL))) in nvkm_acr_lsfw_add()
77 lsfw->id = id; in nvkm_acr_lsfw_add()
78 list_add_tail(&lsfw->head, &acr->lsfw); in nvkm_acr_lsfw_add()
81 lsfw->func = func; in nvkm_acr_lsfw_add()
82 lsfw->falcon = falcon; in nvkm_acr_lsfw_add()
83 return lsfw; in nvkm_acr_lsfw_add()
95 struct nvkm_acr_lsfw *lsfw; in nvkm_acr_lsfw_load_sig_image_desc_() local
98 if (IS_ERR((lsfw = nvkm_acr_lsfw_add(func, acr, falcon, id)))) in nvkm_acr_lsfw_load_sig_image_desc_()
99 return lsfw; in nvkm_acr_lsfw_load_sig_image_desc_()
101 ret = nvkm_firmware_load_name(subdev, path, "sig", ver, &lsfw->sig); in nvkm_acr_lsfw_load_sig_image_desc_()
105 ret = nvkm_firmware_load_blob(subdev, path, "image", ver, &lsfw->img); in nvkm_acr_lsfw_load_sig_image_desc_()
112 nvkm_acr_lsfw_del(lsfw); in nvkm_acr_lsfw_load_sig_image_desc_()
116 return lsfw; in nvkm_acr_lsfw_load_sig_image_desc_()
121 struct nvkm_acr_lsfw *lsfw) in nvkm_acr_lsfw_from_desc() argument
123 lsfw->bootloader_size = ALIGN(desc->bootloader_size, 256); in nvkm_acr_lsfw_from_desc()
124 lsfw->bootloader_imem_offset = desc->bootloader_imem_offset; in nvkm_acr_lsfw_from_desc()
126 lsfw->app_size = ALIGN(desc->app_size, 256); in nvkm_acr_lsfw_from_desc()
127 lsfw->app_start_offset = desc->app_start_offset; in nvkm_acr_lsfw_from_desc()
128 lsfw->app_imem_entry = desc->app_imem_entry; in nvkm_acr_lsfw_from_desc()
129 lsfw->app_resident_code_offset = desc->app_resident_code_offset; in nvkm_acr_lsfw_from_desc()
130 lsfw->app_resident_code_size = desc->app_resident_code_size; in nvkm_acr_lsfw_from_desc()
131 lsfw->app_resident_data_offset = desc->app_resident_data_offset; in nvkm_acr_lsfw_from_desc()
132 lsfw->app_resident_data_size = desc->app_resident_data_size; in nvkm_acr_lsfw_from_desc()
134 lsfw->ucode_size = ALIGN(lsfw->app_resident_data_offset, 256) + in nvkm_acr_lsfw_from_desc()
135 lsfw->bootloader_size; in nvkm_acr_lsfw_from_desc()
136 lsfw->data_size = lsfw->app_size + lsfw->bootloader_size - in nvkm_acr_lsfw_from_desc()
137 lsfw->ucode_size; in nvkm_acr_lsfw_from_desc()
148 struct nvkm_acr_lsfw *lsfw; in nvkm_acr_lsfw_load_sig_image_desc() local
150 lsfw = nvkm_acr_lsfw_load_sig_image_desc_(subdev, falcon, id, path, ver, in nvkm_acr_lsfw_load_sig_image_desc()
152 if (IS_ERR(lsfw)) in nvkm_acr_lsfw_load_sig_image_desc()
153 return PTR_ERR(lsfw); in nvkm_acr_lsfw_load_sig_image_desc()
155 nvkm_acr_lsfw_from_desc(&nvfw_ls_desc(subdev, fw->data)->head, lsfw); in nvkm_acr_lsfw_load_sig_image_desc()
168 struct nvkm_acr_lsfw *lsfw; in nvkm_acr_lsfw_load_sig_image_desc_v1() local
170 lsfw = nvkm_acr_lsfw_load_sig_image_desc_(subdev, falcon, id, path, ver, in nvkm_acr_lsfw_load_sig_image_desc_v1()
172 if (IS_ERR(lsfw)) in nvkm_acr_lsfw_load_sig_image_desc_v1()
173 return PTR_ERR(lsfw); in nvkm_acr_lsfw_load_sig_image_desc_v1()
175 nvkm_acr_lsfw_from_desc(&nvfw_ls_desc_v1(subdev, fw->data)->head, lsfw); in nvkm_acr_lsfw_load_sig_image_desc_v1()
188 struct nvkm_acr_lsfw *lsfw; in nvkm_acr_lsfw_load_sig_image_desc_v2() local
192 lsfw = nvkm_acr_lsfw_load_sig_image_desc_(subdev, falcon, id, path, ver, func, &fw); in nvkm_acr_lsfw_load_sig_image_desc_v2()
193 if (IS_ERR(lsfw)) in nvkm_acr_lsfw_load_sig_image_desc_v2()
194 return PTR_ERR(lsfw); in nvkm_acr_lsfw_load_sig_image_desc_v2()
198 lsfw->secure_bootloader = desc->secure_bootloader; in nvkm_acr_lsfw_load_sig_image_desc_v2()
199 lsfw->bootloader_size = ALIGN(desc->bootloader_size, 256); in nvkm_acr_lsfw_load_sig_image_desc_v2()
200 lsfw->bootloader_imem_offset = desc->bootloader_imem_offset; in nvkm_acr_lsfw_load_sig_image_desc_v2()
202 lsfw->app_size = ALIGN(desc->app_size, 256); in nvkm_acr_lsfw_load_sig_image_desc_v2()
203 lsfw->app_start_offset = desc->app_start_offset; in nvkm_acr_lsfw_load_sig_image_desc_v2()
204 lsfw->app_imem_entry = desc->app_imem_entry; in nvkm_acr_lsfw_load_sig_image_desc_v2()
205 lsfw->app_resident_code_offset = desc->app_resident_code_offset; in nvkm_acr_lsfw_load_sig_image_desc_v2()
206 lsfw->app_resident_code_size = desc->app_resident_code_size; in nvkm_acr_lsfw_load_sig_image_desc_v2()
207 lsfw->app_resident_data_offset = desc->app_resident_data_offset; in nvkm_acr_lsfw_load_sig_image_desc_v2()
208 lsfw->app_resident_data_size = desc->app_resident_data_size; in nvkm_acr_lsfw_load_sig_image_desc_v2()
209 lsfw->app_imem_offset = desc->app_imem_offset; in nvkm_acr_lsfw_load_sig_image_desc_v2()
210 lsfw->app_dmem_offset = desc->app_dmem_offset; in nvkm_acr_lsfw_load_sig_image_desc_v2()
212 lsfw->ucode_size = ALIGN(lsfw->app_resident_data_offset, 256) + lsfw->bootloader_size; in nvkm_acr_lsfw_load_sig_image_desc_v2()
213 lsfw->data_size = lsfw->app_size + lsfw->bootloader_size - lsfw->ucode_size; in nvkm_acr_lsfw_load_sig_image_desc_v2()
217 if (lsfw->secure_bootloader) { in nvkm_acr_lsfw_load_sig_image_desc_v2()
234 lsfw->fuse_ver = meta[0]; in nvkm_acr_lsfw_load_sig_image_desc_v2()
235 lsfw->engine_id = meta[1]; in nvkm_acr_lsfw_load_sig_image_desc_v2()
236 lsfw->ucode_id = meta[2]; in nvkm_acr_lsfw_load_sig_image_desc_v2()
237 lsfw->sig_size = hshdr->sig_prod_size / cnt; in nvkm_acr_lsfw_load_sig_image_desc_v2()
238 lsfw->sig_nr = cnt; in nvkm_acr_lsfw_load_sig_image_desc_v2()
239 lsfw->sigs = kmemdup(hsbl->data + hshdr->sig_prod_offset + sig, in nvkm_acr_lsfw_load_sig_image_desc_v2()
240 lsfw->sig_nr * lsfw->sig_size, GFP_KERNEL); in nvkm_acr_lsfw_load_sig_image_desc_v2()
242 if (!lsfw->sigs) in nvkm_acr_lsfw_load_sig_image_desc_v2()
257 struct nvkm_acr_lsfw *lsfw; in nvkm_acr_lsfw_load_bl_inst_data_sig() local
264 if (IS_ERR((lsfw = nvkm_acr_lsfw_add(func, acr, falcon, id)))) in nvkm_acr_lsfw_load_bl_inst_data_sig()
265 return PTR_ERR(lsfw); in nvkm_acr_lsfw_load_bl_inst_data_sig()
283 ret = nvkm_firmware_load_name(subdev, path, "sig", ver, &lsfw->sig); in nvkm_acr_lsfw_load_bl_inst_data_sig()
287 lsfw->bootloader_size = ALIGN(desc->code_size, 256); in nvkm_acr_lsfw_load_bl_inst_data_sig()
288 lsfw->bootloader_imem_offset = desc->start_tag << 8; in nvkm_acr_lsfw_load_bl_inst_data_sig()
290 lsfw->app_start_offset = lsfw->bootloader_size; in nvkm_acr_lsfw_load_bl_inst_data_sig()
291 lsfw->app_imem_entry = 0; in nvkm_acr_lsfw_load_bl_inst_data_sig()
292 lsfw->app_resident_code_offset = 0; in nvkm_acr_lsfw_load_bl_inst_data_sig()
293 lsfw->app_resident_code_size = ALIGN(inst->size, 256); in nvkm_acr_lsfw_load_bl_inst_data_sig()
294 lsfw->app_resident_data_offset = lsfw->app_resident_code_size; in nvkm_acr_lsfw_load_bl_inst_data_sig()
295 lsfw->app_resident_data_size = ALIGN(data->size, 256); in nvkm_acr_lsfw_load_bl_inst_data_sig()
296 lsfw->app_size = lsfw->app_resident_code_size + in nvkm_acr_lsfw_load_bl_inst_data_sig()
297 lsfw->app_resident_data_size; in nvkm_acr_lsfw_load_bl_inst_data_sig()
299 lsfw->img.size = lsfw->bootloader_size + lsfw->app_size; in nvkm_acr_lsfw_load_bl_inst_data_sig()
300 if (!(lsfw->img.data = kzalloc(lsfw->img.size, GFP_KERNEL))) { in nvkm_acr_lsfw_load_bl_inst_data_sig()
305 memcpy(lsfw->img.data, bldata, lsfw->bootloader_size); in nvkm_acr_lsfw_load_bl_inst_data_sig()
306 memcpy(lsfw->img.data + lsfw->app_start_offset + in nvkm_acr_lsfw_load_bl_inst_data_sig()
307 lsfw->app_resident_code_offset, inst->data, inst->size); in nvkm_acr_lsfw_load_bl_inst_data_sig()
308 memcpy(lsfw->img.data + lsfw->app_start_offset + in nvkm_acr_lsfw_load_bl_inst_data_sig()
309 lsfw->app_resident_data_offset, data->data, data->size); in nvkm_acr_lsfw_load_bl_inst_data_sig()
311 lsfw->ucode_size = ALIGN(lsfw->app_resident_data_offset, 256) + in nvkm_acr_lsfw_load_bl_inst_data_sig()
312 lsfw->bootloader_size; in nvkm_acr_lsfw_load_bl_inst_data_sig()
313 lsfw->data_size = lsfw->app_size + lsfw->bootloader_size - in nvkm_acr_lsfw_load_bl_inst_data_sig()
314 lsfw->ucode_size; in nvkm_acr_lsfw_load_bl_inst_data_sig()
318 nvkm_acr_lsfw_del(lsfw); in nvkm_acr_lsfw_load_bl_inst_data_sig()
335 struct nvkm_acr_lsfw *lsfw; in nvkm_acr_lsfw_load_bl_sig_net() local
349 if (IS_ERR((lsfw = nvkm_acr_lsfw_add(func, acr, falcon, id)))) in nvkm_acr_lsfw_load_bl_sig_net()
350 return PTR_ERR(lsfw); in nvkm_acr_lsfw_load_bl_sig_net()
359 ret = nvkm_firmware_load_name(subdev, path, "sig", ver, &lsfw->sig); in nvkm_acr_lsfw_load_bl_sig_net()
363 lsfw->bootloader_size = ALIGN(hdr->header_size, 256); in nvkm_acr_lsfw_load_bl_sig_net()
364 lsfw->bootloader_imem_offset = func->bl_entry; in nvkm_acr_lsfw_load_bl_sig_net()
366 lsfw->app_start_offset = lsfw->bootloader_size; in nvkm_acr_lsfw_load_bl_sig_net()
367 lsfw->app_imem_entry = 0; in nvkm_acr_lsfw_load_bl_sig_net()
368 lsfw->app_resident_code_offset = 0; in nvkm_acr_lsfw_load_bl_sig_net()
369 lsfw->app_resident_code_size = ALIGN(inst->size, 256); in nvkm_acr_lsfw_load_bl_sig_net()
370 lsfw->app_resident_data_offset = lsfw->app_resident_code_size; in nvkm_acr_lsfw_load_bl_sig_net()
371 lsfw->app_resident_data_size = ALIGN(data->size, 256); in nvkm_acr_lsfw_load_bl_sig_net()
372 lsfw->app_imem_offset = 0; in nvkm_acr_lsfw_load_bl_sig_net()
373 lsfw->app_dmem_offset = 0; in nvkm_acr_lsfw_load_bl_sig_net()
374 lsfw->app_size = lsfw->app_resident_code_size + lsfw->app_resident_data_size; in nvkm_acr_lsfw_load_bl_sig_net()
376 lsfw->img.size = lsfw->bootloader_size + lsfw->app_size; in nvkm_acr_lsfw_load_bl_sig_net()
377 if (!(lsfw->img.data = kzalloc(lsfw->img.size, GFP_KERNEL))) { in nvkm_acr_lsfw_load_bl_sig_net()
382 memcpy(lsfw->img.data, bldata, lsfw->bootloader_size); in nvkm_acr_lsfw_load_bl_sig_net()
383 memcpy(lsfw->img.data + lsfw->app_start_offset + in nvkm_acr_lsfw_load_bl_sig_net()
384 lsfw->app_resident_code_offset, inst->data, inst->size); in nvkm_acr_lsfw_load_bl_sig_net()
385 memcpy(lsfw->img.data + lsfw->app_start_offset + in nvkm_acr_lsfw_load_bl_sig_net()
386 lsfw->app_resident_data_offset, data->data, data->size); in nvkm_acr_lsfw_load_bl_sig_net()
388 lsfw->ucode_size = ALIGN(lsfw->app_resident_data_offset, 256) + in nvkm_acr_lsfw_load_bl_sig_net()
389 lsfw->bootloader_size; in nvkm_acr_lsfw_load_bl_sig_net()
390 lsfw->data_size = lsfw->app_size + lsfw->bootloader_size - in nvkm_acr_lsfw_load_bl_sig_net()
391 lsfw->ucode_size; in nvkm_acr_lsfw_load_bl_sig_net()
395 nvkm_acr_lsfw_del(lsfw); in nvkm_acr_lsfw_load_bl_sig_net()