Lines Matching full:handle

124 static void qat_uclo_wr_sram_by_words(struct icp_qat_fw_loader_handle *handle,  in qat_uclo_wr_sram_by_words()  argument
133 SRAM_WRITE(handle, addr, outval); in qat_uclo_wr_sram_by_words()
140 static void qat_uclo_wr_umem_by_words(struct icp_qat_fw_loader_handle *handle, in qat_uclo_wr_umem_by_words() argument
152 qat_hal_wr_umem(handle, ae, addr++, 1, &outval); in qat_uclo_wr_umem_by_words()
158 static void qat_uclo_batch_wr_umem(struct icp_qat_fw_loader_handle *handle, in qat_uclo_batch_wr_umem() argument
175 qat_uclo_wr_umem_by_words(handle, ae, addr, value, size); in qat_uclo_batch_wr_umem()
181 qat_uclo_cleanup_batch_init_list(struct icp_qat_fw_loader_handle *handle, in qat_uclo_cleanup_batch_init_list() argument
217 static int qat_uclo_fetch_initmem_ae(struct icp_qat_fw_loader_handle *handle, in qat_uclo_fetch_initmem_ae() argument
221 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_fetch_initmem_ae()
249 *handle, struct icp_qat_uof_initmem in qat_uclo_create_batch_init_list()
307 static int qat_uclo_init_lmem_seg(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_lmem_seg() argument
310 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_lmem_seg()
313 if (qat_uclo_fetch_initmem_ae(handle, init_mem, in qat_uclo_init_lmem_seg()
316 if (qat_uclo_create_batch_init_list(handle, init_mem, ae, in qat_uclo_init_lmem_seg()
322 static int qat_uclo_init_umem_seg(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_umem_seg() argument
325 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_umem_seg()
329 if (qat_uclo_fetch_initmem_ae(handle, init_mem, ustore_size, &ae)) in qat_uclo_init_umem_seg()
331 if (qat_uclo_create_batch_init_list(handle, init_mem, ae, in qat_uclo_init_umem_seg()
346 static int qat_uclo_init_ae_memory(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_ae_memory() argument
351 if (qat_uclo_init_lmem_seg(handle, init_mem)) in qat_uclo_init_ae_memory()
355 if (qat_uclo_init_umem_seg(handle, init_mem)) in qat_uclo_init_ae_memory()
366 static int qat_uclo_init_ustore(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_ustore() argument
375 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_ustore()
388 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_init_ustore()
394 qat_hal_wr_uwords(handle, (unsigned char)ae, 0, in qat_uclo_init_ustore()
396 qat_hal_wr_uwords(handle, (unsigned char)ae, patt_pos, in qat_uclo_init_ustore()
404 static int qat_uclo_init_memory(struct icp_qat_fw_loader_handle *handle) in qat_uclo_init_memory() argument
407 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_memory()
412 if (qat_uclo_init_ae_memory(handle, initmem)) in qat_uclo_init_memory()
421 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_init_memory()
422 if (qat_hal_batch_wr_lm(handle, ae, in qat_uclo_init_memory()
427 qat_uclo_cleanup_batch_init_list(handle, in qat_uclo_init_memory()
429 qat_uclo_batch_wr_umem(handle, ae, in qat_uclo_init_memory()
431 qat_uclo_cleanup_batch_init_list(handle, in qat_uclo_init_memory()
647 static int qat_uclo_map_ae(struct icp_qat_fw_loader_handle *handle, int max_ae) in qat_uclo_map_ae() argument
651 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_map_ae()
655 (unsigned long *)&handle->hal_handle->ae_mask)) in qat_uclo_map_ae()
712 qat_uclo_get_dev_type(struct icp_qat_fw_loader_handle *handle) in qat_uclo_get_dev_type() argument
714 switch (handle->pci_dev->device) { in qat_uclo_get_dev_type()
723 handle->pci_dev->device); in qat_uclo_get_dev_type()
747 static int qat_uclo_init_reg(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_reg() argument
759 return qat_hal_init_gpr(handle, ae, ctx_mask, reg_type, in qat_uclo_init_reg()
771 return qat_hal_init_rd_xfer(handle, ae, ctx_mask, reg_type, in qat_uclo_init_reg()
779 return qat_hal_init_wr_xfer(handle, ae, ctx_mask, reg_type, in qat_uclo_init_reg()
782 return qat_hal_init_nn(handle, ae, ctx_mask, reg_addr, value); in qat_uclo_init_reg()
790 static int qat_uclo_init_reg_sym(struct icp_qat_fw_loader_handle *handle, in qat_uclo_init_reg_sym() argument
811 qat_uclo_init_reg(handle, ae, ctx_mask, in qat_uclo_init_reg_sym()
824 qat_uclo_init_reg(handle, ae, in qat_uclo_init_reg_sym()
845 static int qat_uclo_init_globals(struct icp_qat_fw_loader_handle *handle) in qat_uclo_init_globals() argument
847 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_globals()
853 if (qat_uclo_init_memory(handle)) { in qat_uclo_init_globals()
858 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_init_globals()
862 if (qat_uclo_init_reg_sym(handle, ae, in qat_uclo_init_globals()
872 static int qat_uclo_set_ae_mode(struct icp_qat_fw_loader_handle *handle) in qat_uclo_set_ae_mode() argument
877 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_set_ae_mode()
879 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_set_ae_mode()
881 (unsigned long *)&handle->hal_handle->ae_mask)) in qat_uclo_set_ae_mode()
889 if (qat_hal_set_ae_ctx_mode(handle, ae, in qat_uclo_set_ae_mode()
896 if (qat_hal_set_ae_nn_mode(handle, ae, nn_mode)) { in qat_uclo_set_ae_mode()
900 if (qat_hal_set_ae_lm_mode(handle, ae, ICP_LMEM0, in qat_uclo_set_ae_mode()
906 if (qat_hal_set_ae_lm_mode(handle, ae, ICP_LMEM1, in qat_uclo_set_ae_mode()
917 static void qat_uclo_init_uword_num(struct icp_qat_fw_loader_handle *handle) in qat_uclo_init_uword_num() argument
919 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_init_uword_num()
930 static int qat_uclo_parse_uof_obj(struct icp_qat_fw_loader_handle *handle) in qat_uclo_parse_uof_obj() argument
932 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_parse_uof_obj()
939 obj_handle->prod_type = qat_uclo_get_dev_type(handle); in qat_uclo_parse_uof_obj()
941 (PID_MINOR_REV & handle->hal_handle->revision_id); in qat_uclo_parse_uof_obj()
962 if (qat_uclo_map_ae(handle, handle->hal_handle->ae_max_num)) { in qat_uclo_parse_uof_obj()
966 qat_uclo_init_uword_num(handle); in qat_uclo_parse_uof_obj()
969 if (qat_uclo_set_ae_mode(handle)) in qat_uclo_parse_uof_obj()
980 static int qat_uclo_map_suof_file_hdr(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_suof_file_hdr() argument
986 struct icp_qat_suof_handle *suof_handle = handle->sobj_handle; in qat_uclo_map_suof_file_hdr()
1051 static int qat_uclo_check_simg_compat(struct icp_qat_fw_loader_handle *handle, in qat_uclo_check_simg_compat() argument
1057 prod_type = qat_uclo_get_dev_type(handle); in qat_uclo_check_simg_compat()
1060 (PID_MINOR_REV & handle->hal_handle->revision_id); in qat_uclo_check_simg_compat()
1075 static void qat_uclo_del_suof(struct icp_qat_fw_loader_handle *handle) in qat_uclo_del_suof() argument
1077 struct icp_qat_suof_handle *sobj_handle = handle->sobj_handle; in qat_uclo_del_suof()
1081 kfree(handle->sobj_handle); in qat_uclo_del_suof()
1082 handle->sobj_handle = NULL; in qat_uclo_del_suof()
1100 static int qat_uclo_map_suof(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_suof() argument
1104 struct icp_qat_suof_handle *suof_handle = handle->sobj_handle; in qat_uclo_map_suof()
1117 ret = qat_uclo_map_suof_file_hdr(handle, suof_ptr, suof_size); in qat_uclo_map_suof()
1136 qat_uclo_map_simg(handle->sobj_handle, &suof_img_hdr[i], in qat_uclo_map_suof()
1138 ret = qat_uclo_check_simg_compat(handle, in qat_uclo_map_suof()
1153 static int qat_uclo_auth_fw(struct icp_qat_fw_loader_handle *handle, in qat_uclo_auth_fw() argument
1161 SET_CAP_CSR(handle, FCU_DRAM_ADDR_HI, (bus_addr >> BITS_IN_DWORD)); in qat_uclo_auth_fw()
1162 SET_CAP_CSR(handle, FCU_DRAM_ADDR_LO, bus_addr); in qat_uclo_auth_fw()
1163 SET_CAP_CSR(handle, FCU_CONTROL, FCU_CTRL_CMD_AUTH); in qat_uclo_auth_fw()
1167 fcu_sts = GET_CAP_CSR(handle, FCU_STATUS); in qat_uclo_auth_fw()
1180 static int qat_uclo_simg_alloc(struct icp_qat_fw_loader_handle *handle, in qat_uclo_simg_alloc() argument
1187 vptr = dma_alloc_coherent(&handle->pci_dev->dev, in qat_uclo_simg_alloc()
1197 static void qat_uclo_simg_free(struct icp_qat_fw_loader_handle *handle, in qat_uclo_simg_free() argument
1200 dma_free_coherent(&handle->pci_dev->dev, in qat_uclo_simg_free()
1207 static void qat_uclo_ummap_auth_fw(struct icp_qat_fw_loader_handle *handle, in qat_uclo_ummap_auth_fw() argument
1217 qat_uclo_simg_free(handle, &dram_desc); in qat_uclo_ummap_auth_fw()
1220 static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_auth_fw() argument
1238 if (qat_uclo_simg_alloc(handle, &img_desc, length)) { in qat_uclo_map_auth_fw()
1326 static int qat_uclo_load_fw(struct icp_qat_fw_loader_handle *handle, in qat_uclo_load_fw() argument
1339 for (i = 0; i < handle->hal_handle->ae_max_num; i++) { in qat_uclo_load_fw()
1344 if (qat_hal_check_ae_active(handle, i)) { in qat_uclo_load_fw()
1348 SET_CAP_CSR(handle, FCU_CONTROL, in qat_uclo_load_fw()
1353 fcu_sts = GET_CAP_CSR(handle, FCU_STATUS); in qat_uclo_load_fw()
1367 static int qat_uclo_map_suof_obj(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_suof_obj() argument
1375 handle->sobj_handle = suof_handle; in qat_uclo_map_suof_obj()
1376 if (qat_uclo_map_suof(handle, addr_ptr, mem_size)) { in qat_uclo_map_suof_obj()
1377 qat_uclo_del_suof(handle); in qat_uclo_map_suof_obj()
1384 int qat_uclo_wr_mimage(struct icp_qat_fw_loader_handle *handle, in qat_uclo_wr_mimage() argument
1390 if (handle->fw_auth) { in qat_uclo_wr_mimage()
1391 if (!qat_uclo_map_auth_fw(handle, addr_ptr, mem_size, &desc)) in qat_uclo_wr_mimage()
1392 status = qat_uclo_auth_fw(handle, desc); in qat_uclo_wr_mimage()
1393 qat_uclo_ummap_auth_fw(handle, &desc); in qat_uclo_wr_mimage()
1395 if (handle->pci_dev->device == PCI_DEVICE_ID_INTEL_QAT_C3XXX) { in qat_uclo_wr_mimage()
1399 qat_uclo_wr_sram_by_words(handle, 0, addr_ptr, mem_size); in qat_uclo_wr_mimage()
1404 static int qat_uclo_map_uof_obj(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_uof_obj() argument
1425 handle->obj_handle = objhdl; in qat_uclo_map_uof_obj()
1426 if (qat_uclo_parse_uof_obj(handle)) in qat_uclo_map_uof_obj()
1431 handle->obj_handle = NULL; in qat_uclo_map_uof_obj()
1440 int qat_uclo_map_obj(struct icp_qat_fw_loader_handle *handle, in qat_uclo_map_obj() argument
1444 (sizeof(handle->hal_handle->ae_mask) * 8)); in qat_uclo_map_obj()
1446 if (!handle || !addr_ptr || mem_size < 24) in qat_uclo_map_obj()
1449 return (handle->fw_auth) ? in qat_uclo_map_obj()
1450 qat_uclo_map_suof_obj(handle, addr_ptr, mem_size) : in qat_uclo_map_obj()
1451 qat_uclo_map_uof_obj(handle, addr_ptr, mem_size); in qat_uclo_map_obj()
1454 void qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle) in qat_uclo_del_uof_obj() argument
1456 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_del_uof_obj()
1459 if (handle->sobj_handle) in qat_uclo_del_uof_obj()
1460 qat_uclo_del_suof(handle); in qat_uclo_del_uof_obj()
1468 for (a = 0; a < handle->hal_handle->ae_max_num; a++) in qat_uclo_del_uof_obj()
1474 handle->obj_handle = NULL; in qat_uclo_del_uof_obj()
1506 static void qat_uclo_wr_uimage_raw_page(struct icp_qat_fw_loader_handle *handle, in qat_uclo_wr_uimage_raw_page() argument
1511 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_wr_uimage_raw_page()
1535 qat_hal_wr_uwords(handle, (unsigned char)ae, in qat_uclo_wr_uimage_raw_page()
1545 static void qat_uclo_wr_uimage_page(struct icp_qat_fw_loader_handle *handle, in qat_uclo_wr_uimage_page() argument
1548 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_wr_uimage_page()
1560 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { in qat_uclo_wr_uimage_page()
1574 qat_uclo_wr_uimage_raw_page(handle, page->encap_page, ae); in qat_uclo_wr_uimage_page()
1580 qat_hal_set_live_ctx(handle, (unsigned char)ae, in qat_uclo_wr_uimage_page()
1582 qat_hal_set_pc(handle, (unsigned char)ae, image->ctx_assigned, in qat_uclo_wr_uimage_page()
1587 static int qat_uclo_wr_suof_img(struct icp_qat_fw_loader_handle *handle) in qat_uclo_wr_suof_img() argument
1591 struct icp_qat_suof_handle *sobj_handle = handle->sobj_handle; in qat_uclo_wr_suof_img()
1595 if (qat_uclo_map_auth_fw(handle, in qat_uclo_wr_suof_img()
1601 if (qat_uclo_auth_fw(handle, desc)) in qat_uclo_wr_suof_img()
1603 if (qat_uclo_load_fw(handle, desc)) in qat_uclo_wr_suof_img()
1605 qat_uclo_ummap_auth_fw(handle, &desc); in qat_uclo_wr_suof_img()
1609 qat_uclo_ummap_auth_fw(handle, &desc); in qat_uclo_wr_suof_img()
1613 static int qat_uclo_wr_uof_img(struct icp_qat_fw_loader_handle *handle) in qat_uclo_wr_uof_img() argument
1615 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; in qat_uclo_wr_uof_img()
1618 if (qat_uclo_init_globals(handle)) in qat_uclo_wr_uof_img()
1623 if (qat_uclo_init_ustore(handle, &obj_handle->ae_uimage[i])) in qat_uclo_wr_uof_img()
1625 qat_uclo_wr_uimage_page(handle, in qat_uclo_wr_uof_img()
1631 int qat_uclo_wr_all_uimage(struct icp_qat_fw_loader_handle *handle) in qat_uclo_wr_all_uimage() argument
1633 return (handle->fw_auth) ? qat_uclo_wr_suof_img(handle) : in qat_uclo_wr_all_uimage()
1634 qat_uclo_wr_uof_img(handle); in qat_uclo_wr_all_uimage()