Lines Matching full:handle
167 static void qat_uclo_wr_sram_by_words(struct icp_qat_fw_loader_handle *handle, in qat_uclo_wr_sram_by_words() argument
176 SRAM_WRITE(handle, addr, outval); in qat_uclo_wr_sram_by_words()
183 static void qat_uclo_wr_umem_by_words(struct icp_qat_fw_loader_handle *handle, in qat_uclo_wr_umem_by_words() argument
195 qat_hal_wr_umem(handle, ae, addr++, 1, &outval); in qat_uclo_wr_umem_by_words()
201 static void qat_uclo_batch_wr_umem(struct icp_qat_fw_loader_handle *handle, in qat_uclo_batch_wr_umem() argument
218 qat_uclo_wr_umem_by_words(handle, ae, addr, value, size); in qat_uclo_batch_wr_umem()
224 qat_uclo_cleanup_batch_init_list(struct icp_qat_fw_loader_handle *handle, in qat_uclo_cleanup_batch_init_list() argument
260 static int qat_uclo_fetch_initmem_ae(struct icp_qat_fw_loader_handle *handle, in qat_uclo_fetch_initmem_ae() argument
264 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_fetch_initmem_ae()
292 *handle, struct icp_qat_uof_initmem in qat_uclo_create_batch_init_list()
345 static int qat_uclo_init_lmem_seg(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_lmem_seg() argument
348 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_lmem_seg()
351 if (qat_uclo_fetch_initmem_ae(handle, init_mem, in qat_uclo_init_lmem_seg()
354 if (qat_uclo_create_batch_init_list(handle, init_mem, ae, in qat_uclo_init_lmem_seg()
360 static int qat_uclo_init_umem_seg(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_umem_seg() argument
363 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_umem_seg()
367 if (qat_uclo_fetch_initmem_ae(handle, init_mem, ustore_size, &ae)) in qat_uclo_init_umem_seg()
369 if (qat_uclo_create_batch_init_list(handle, init_mem, ae, in qat_uclo_init_umem_seg()
384 static int qat_uclo_init_ae_memory(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_ae_memory() argument
389 if (qat_uclo_init_lmem_seg(handle, init_mem)) in qat_uclo_init_ae_memory()
393 if (qat_uclo_init_umem_seg(handle, init_mem)) in qat_uclo_init_ae_memory()
404 static int qat_uclo_init_ustore(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_ustore() argument
413 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_ustore()
426 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_init_ustore()
432 qat_hal_wr_uwords(handle, (unsigned char)ae, 0, in qat_uclo_init_ustore()
434 qat_hal_wr_uwords(handle, (unsigned char)ae, patt_pos, in qat_uclo_init_ustore()
442 static int qat_uclo_init_memory(struct icp_qat_fw_loader_handle *handle) in qat_uclo_init_memory() argument
445 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_memory()
450 if (qat_uclo_init_ae_memory(handle, initmem)) in qat_uclo_init_memory()
459 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_init_memory()
460 if (qat_hal_batch_wr_lm(handle, ae, in qat_uclo_init_memory()
465 qat_uclo_cleanup_batch_init_list(handle, in qat_uclo_init_memory()
467 qat_uclo_batch_wr_umem(handle, ae, in qat_uclo_init_memory()
469 qat_uclo_cleanup_batch_init_list(handle, in qat_uclo_init_memory()
685 static int qat_uclo_map_ae(struct icp_qat_fw_loader_handle *handle, int max_ae) in qat_uclo_map_ae() argument
689 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_map_ae()
693 (unsigned long *)&handle->hal_handle->ae_mask)) in qat_uclo_map_ae()
750 qat_uclo_get_dev_type(struct icp_qat_fw_loader_handle *handle) in qat_uclo_get_dev_type() argument
752 switch (handle->pci_dev->device) { in qat_uclo_get_dev_type()
761 handle->pci_dev->device); in qat_uclo_get_dev_type()
785 static int qat_uclo_init_reg(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_reg() argument
797 return qat_hal_init_gpr(handle, ae, ctx_mask, reg_type, in qat_uclo_init_reg()
809 return qat_hal_init_rd_xfer(handle, ae, ctx_mask, reg_type, in qat_uclo_init_reg()
817 return qat_hal_init_wr_xfer(handle, ae, ctx_mask, reg_type, in qat_uclo_init_reg()
820 return qat_hal_init_nn(handle, ae, ctx_mask, reg_addr, value); in qat_uclo_init_reg()
828 static int qat_uclo_init_reg_sym(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_reg_sym() argument
849 qat_uclo_init_reg(handle, ae, ctx_mask, in qat_uclo_init_reg_sym()
862 qat_uclo_init_reg(handle, ae, in qat_uclo_init_reg_sym()
883 static int qat_uclo_init_globals(struct icp_qat_fw_loader_handle *handle) in qat_uclo_init_globals() argument
885 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_globals()
891 if (qat_uclo_init_memory(handle)) { in qat_uclo_init_globals()
896 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_init_globals()
900 if (qat_uclo_init_reg_sym(handle, ae, in qat_uclo_init_globals()
910 static int qat_uclo_set_ae_mode(struct icp_qat_fw_loader_handle *handle) in qat_uclo_set_ae_mode() argument
915 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_set_ae_mode()
917 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_set_ae_mode()
919 (unsigned long *)&handle->hal_handle->ae_mask)) in qat_uclo_set_ae_mode()
927 if (qat_hal_set_ae_ctx_mode(handle, ae, in qat_uclo_set_ae_mode()
934 if (qat_hal_set_ae_nn_mode(handle, ae, nn_mode)) { in qat_uclo_set_ae_mode()
938 if (qat_hal_set_ae_lm_mode(handle, ae, ICP_LMEM0, in qat_uclo_set_ae_mode()
944 if (qat_hal_set_ae_lm_mode(handle, ae, ICP_LMEM1, in qat_uclo_set_ae_mode()
955 static void qat_uclo_init_uword_num(struct icp_qat_fw_loader_handle *handle) in qat_uclo_init_uword_num() argument
957 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_uword_num()
968 static int qat_uclo_parse_uof_obj(struct icp_qat_fw_loader_handle *handle) in qat_uclo_parse_uof_obj() argument
970 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_parse_uof_obj()
977 obj_handle->prod_type = qat_uclo_get_dev_type(handle); in qat_uclo_parse_uof_obj()
979 (PID_MINOR_REV & handle->hal_handle->revision_id); in qat_uclo_parse_uof_obj()
1000 if (qat_uclo_map_ae(handle, handle->hal_handle->ae_max_num)) { in qat_uclo_parse_uof_obj()
1004 qat_uclo_init_uword_num(handle); in qat_uclo_parse_uof_obj()
1007 if (qat_uclo_set_ae_mode(handle)) in qat_uclo_parse_uof_obj()
1018 static int qat_uclo_map_suof_file_hdr(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_suof_file_hdr() argument
1024 struct icp_qat_suof_handle *suof_handle = handle->sobj_handle; in qat_uclo_map_suof_file_hdr()
1089 static int qat_uclo_check_simg_compat(struct icp_qat_fw_loader_handle *handle, in qat_uclo_check_simg_compat() argument
1095 prod_type = qat_uclo_get_dev_type(handle); in qat_uclo_check_simg_compat()
1098 (PID_MINOR_REV & handle->hal_handle->revision_id); in qat_uclo_check_simg_compat()
1113 static void qat_uclo_del_suof(struct icp_qat_fw_loader_handle *handle) in qat_uclo_del_suof() argument
1115 struct icp_qat_suof_handle *sobj_handle = handle->sobj_handle; in qat_uclo_del_suof()
1119 kfree(handle->sobj_handle); in qat_uclo_del_suof()
1120 handle->sobj_handle = NULL; in qat_uclo_del_suof()
1138 static int qat_uclo_map_suof(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_suof() argument
1142 struct icp_qat_suof_handle *suof_handle = handle->sobj_handle; in qat_uclo_map_suof()
1155 ret = qat_uclo_map_suof_file_hdr(handle, suof_ptr, suof_size); in qat_uclo_map_suof()
1174 qat_uclo_map_simg(handle->sobj_handle, &suof_img_hdr[i], in qat_uclo_map_suof()
1176 ret = qat_uclo_check_simg_compat(handle, in qat_uclo_map_suof()
1191 static int qat_uclo_auth_fw(struct icp_qat_fw_loader_handle *handle, in qat_uclo_auth_fw() argument
1199 SET_CAP_CSR(handle, FCU_DRAM_ADDR_HI, (bus_addr >> BITS_IN_DWORD)); in qat_uclo_auth_fw()
1200 SET_CAP_CSR(handle, FCU_DRAM_ADDR_LO, bus_addr); in qat_uclo_auth_fw()
1201 SET_CAP_CSR(handle, FCU_CONTROL, FCU_CTRL_CMD_AUTH); in qat_uclo_auth_fw()
1205 fcu_sts = GET_CAP_CSR(handle, FCU_STATUS); in qat_uclo_auth_fw()
1218 static int qat_uclo_simg_alloc(struct icp_qat_fw_loader_handle *handle, in qat_uclo_simg_alloc() argument
1225 vptr = dma_alloc_coherent(&handle->pci_dev->dev, in qat_uclo_simg_alloc()
1235 static void qat_uclo_simg_free(struct icp_qat_fw_loader_handle *handle, in qat_uclo_simg_free() argument
1238 dma_free_coherent(&handle->pci_dev->dev, in qat_uclo_simg_free()
1245 static void qat_uclo_ummap_auth_fw(struct icp_qat_fw_loader_handle *handle, in qat_uclo_ummap_auth_fw() argument
1255 qat_uclo_simg_free(handle, &dram_desc); in qat_uclo_ummap_auth_fw()
1258 static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_auth_fw() argument
1276 if (qat_uclo_simg_alloc(handle, &img_desc, length)) { in qat_uclo_map_auth_fw()
1364 static int qat_uclo_load_fw(struct icp_qat_fw_loader_handle *handle, in qat_uclo_load_fw() argument
1377 for (i = 0; i < handle->hal_handle->ae_max_num; i++) { in qat_uclo_load_fw()
1382 if (qat_hal_check_ae_active(handle, i)) { in qat_uclo_load_fw()
1386 SET_CAP_CSR(handle, FCU_CONTROL, in qat_uclo_load_fw()
1391 fcu_sts = GET_CAP_CSR(handle, FCU_STATUS); in qat_uclo_load_fw()
1405 static int qat_uclo_map_suof_obj(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_suof_obj() argument
1413 handle->sobj_handle = suof_handle; in qat_uclo_map_suof_obj()
1414 if (qat_uclo_map_suof(handle, addr_ptr, mem_size)) { in qat_uclo_map_suof_obj()
1415 qat_uclo_del_suof(handle); in qat_uclo_map_suof_obj()
1422 int qat_uclo_wr_mimage(struct icp_qat_fw_loader_handle *handle, in qat_uclo_wr_mimage() argument
1428 if (handle->fw_auth) { in qat_uclo_wr_mimage()
1429 if (!qat_uclo_map_auth_fw(handle, addr_ptr, mem_size, &desc)) in qat_uclo_wr_mimage()
1430 status = qat_uclo_auth_fw(handle, desc); in qat_uclo_wr_mimage()
1431 qat_uclo_ummap_auth_fw(handle, &desc); in qat_uclo_wr_mimage()
1433 if (handle->pci_dev->device == ADF_C3XXX_PCI_DEVICE_ID) { in qat_uclo_wr_mimage()
1437 qat_uclo_wr_sram_by_words(handle, 0, addr_ptr, mem_size); in qat_uclo_wr_mimage()
1442 static int qat_uclo_map_uof_obj(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_uof_obj() argument
1463 handle->obj_handle = objhdl; in qat_uclo_map_uof_obj()
1464 if (qat_uclo_parse_uof_obj(handle)) in qat_uclo_map_uof_obj()
1469 handle->obj_handle = NULL; in qat_uclo_map_uof_obj()
1478 int qat_uclo_map_obj(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_obj() argument
1482 (sizeof(handle->hal_handle->ae_mask) * 8)); in qat_uclo_map_obj()
1484 if (!handle || !addr_ptr || mem_size < 24) in qat_uclo_map_obj()
1487 return (handle->fw_auth) ? in qat_uclo_map_obj()
1488 qat_uclo_map_suof_obj(handle, addr_ptr, mem_size) : in qat_uclo_map_obj()
1489 qat_uclo_map_uof_obj(handle, addr_ptr, mem_size); in qat_uclo_map_obj()
1492 void qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle) in qat_uclo_del_uof_obj() argument
1494 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_del_uof_obj()
1497 if (handle->sobj_handle) in qat_uclo_del_uof_obj()
1498 qat_uclo_del_suof(handle); in qat_uclo_del_uof_obj()
1506 for (a = 0; a < handle->hal_handle->ae_max_num; a++) in qat_uclo_del_uof_obj()
1512 handle->obj_handle = NULL; in qat_uclo_del_uof_obj()
1544 static void qat_uclo_wr_uimage_raw_page(struct icp_qat_fw_loader_handle *handle, in qat_uclo_wr_uimage_raw_page() argument
1549 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_wr_uimage_raw_page()
1573 qat_hal_wr_uwords(handle, (unsigned char)ae, in qat_uclo_wr_uimage_raw_page()
1583 static void qat_uclo_wr_uimage_page(struct icp_qat_fw_loader_handle *handle, in qat_uclo_wr_uimage_page() argument
1586 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_wr_uimage_page()
1598 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_wr_uimage_page()
1612 qat_uclo_wr_uimage_raw_page(handle, page->encap_page, ae); in qat_uclo_wr_uimage_page()
1618 qat_hal_set_live_ctx(handle, (unsigned char)ae, in qat_uclo_wr_uimage_page()
1620 qat_hal_set_pc(handle, (unsigned char)ae, image->ctx_assigned, in qat_uclo_wr_uimage_page()
1625 static int qat_uclo_wr_suof_img(struct icp_qat_fw_loader_handle *handle) in qat_uclo_wr_suof_img() argument
1629 struct icp_qat_suof_handle *sobj_handle = handle->sobj_handle; in qat_uclo_wr_suof_img()
1633 if (qat_uclo_map_auth_fw(handle, in qat_uclo_wr_suof_img()
1639 if (qat_uclo_auth_fw(handle, desc)) in qat_uclo_wr_suof_img()
1641 if (qat_uclo_load_fw(handle, desc)) in qat_uclo_wr_suof_img()
1643 qat_uclo_ummap_auth_fw(handle, &desc); in qat_uclo_wr_suof_img()
1647 qat_uclo_ummap_auth_fw(handle, &desc); in qat_uclo_wr_suof_img()
1651 static int qat_uclo_wr_uof_img(struct icp_qat_fw_loader_handle *handle) in qat_uclo_wr_uof_img() argument
1653 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_wr_uof_img()
1656 if (qat_uclo_init_globals(handle)) in qat_uclo_wr_uof_img()
1661 if (qat_uclo_init_ustore(handle, &obj_handle->ae_uimage[i])) in qat_uclo_wr_uof_img()
1663 qat_uclo_wr_uimage_page(handle, in qat_uclo_wr_uof_img()
1669 int qat_uclo_wr_all_uimage(struct icp_qat_fw_loader_handle *handle) in qat_uclo_wr_all_uimage() argument
1671 return (handle->fw_auth) ? qat_uclo_wr_suof_img(handle) : in qat_uclo_wr_all_uimage()
1672 qat_uclo_wr_uof_img(handle); in qat_uclo_wr_all_uimage()