Lines Matching full:zip
49 #define DRV_NAME "ThunderX-ZIP"
74 * Allocates new ZIP device structure
79 struct zip_device *zip = NULL; in zip_alloc_device() local
89 zip = devm_kzalloc(&pdev->dev, sizeof(*zip), GFP_KERNEL); in zip_alloc_device()
91 if (!zip) in zip_alloc_device()
94 zip_dev[idx] = zip; in zip_alloc_device()
95 zip->index = idx; in zip_alloc_device()
96 return zip; in zip_alloc_device()
100 * zip_get_device - Get ZIP device based on node id of cpu
103 * Return: Pointer to Zip device structure
110 zip_err("ZIP device not found for node id %d\n", node); in zip_get_device()
124 /* Initializes the ZIP h/w sub-system */
125 static int zip_init_hw(struct zip_device *zip) in zip_init_hw() argument
138 /* Enable the ZIP Engine(Core) Clock */ in zip_init_hw()
139 cmd_ctl.u_reg64 = zip_reg_read(zip->reg_base + ZIP_CMD_CTL); in zip_init_hw()
141 zip_reg_write(cmd_ctl.u_reg64 & 0xFF, (zip->reg_base + ZIP_CMD_CTL)); in zip_init_hw()
144 zip_reg_read(zip->reg_base + ZIP_CMD_CTL)); in zip_init_hw()
146 constants.u_reg64 = zip_reg_read(zip->reg_base + ZIP_CONSTANTS); in zip_init_hw()
147 zip->depth = constants.s.depth; in zip_init_hw()
148 zip->onfsize = constants.s.onfsize; in zip_init_hw()
149 zip->ctxsize = constants.s.ctxsize; in zip_init_hw()
152 zip->depth, zip->onfsize, zip->ctxsize); in zip_init_hw()
165 (zip->reg_base + ZIP_QUEX_SBUF_CTL(q))); in zip_init_hw()
168 zip_reg_read(zip->reg_base + ZIP_QUEX_SBUF_CTL(q))); in zip_init_hw()
172 memset(&zip->iq[q], 0x0, sizeof(struct zip_iq)); in zip_init_hw()
174 spin_lock_init(&zip->iq[q].lock); in zip_init_hw()
176 if (zip_cmd_qbuf_alloc(zip, q)) { in zip_init_hw()
179 zip_cmd_qbuf_free(zip, q); in zip_init_hw()
185 zip->iq[q].sw_tail = zip->iq[q].sw_head; in zip_init_hw()
186 zip->iq[q].hw_tail = zip->iq[q].sw_head; in zip_init_hw()
190 que_sbuf_addr.s.ptr = (__pa(zip->iq[q].sw_head) >> in zip_init_hw()
197 (zip->reg_base + ZIP_QUEX_SBUF_ADDR(q))); in zip_init_hw()
200 zip_reg_read(zip->reg_base + ZIP_QUEX_SBUF_ADDR(q))); in zip_init_hw()
203 zip->iq[q].sw_head, zip->iq[q].sw_tail, in zip_init_hw()
204 zip->iq[q].hw_tail); in zip_init_hw()
209 * Queue-to-ZIP core mapping in zip_init_hw()
211 * the ZIP core being disabled. in zip_init_hw()
217 zip_reg_write(que_ena.u_reg64, (zip->reg_base + ZIP_QUE_ENA)); in zip_init_hw()
220 zip_reg_read(zip->reg_base + ZIP_QUE_ENA)); in zip_init_hw()
224 /* Mapping each queue to two ZIP cores */ in zip_init_hw()
227 (zip->reg_base + ZIP_QUEX_MAP(q))); in zip_init_hw()
230 zip_reg_read(zip->reg_base + ZIP_QUEX_MAP(q))); in zip_init_hw()
236 zip_reg_write(que_pri.u_reg64, (zip->reg_base + ZIP_QUE_PRI)); in zip_init_hw()
238 zip_msg("QUE_PRI %016llx", zip_reg_read(zip->reg_base + ZIP_QUE_PRI)); in zip_init_hw()
243 static void zip_reset(struct zip_device *zip) in zip_reset() argument
248 cmd_ctl.s.reset = 1; /* Forces ZIP cores to do reset */ in zip_reset()
249 zip_reg_write(cmd_ctl.u_reg64, (zip->reg_base + ZIP_CMD_CTL)); in zip_reset()
255 struct zip_device *zip = NULL; in zip_probe() local
258 zip = zip_alloc_device(pdev); in zip_probe()
259 if (!zip) in zip_probe()
262 dev_info(dev, "Found ZIP device %d %x:%x on Node %d\n", zip->index, in zip_probe()
265 pci_set_drvdata(pdev, zip); in zip_probe()
266 zip->pdev = pdev; in zip_probe()
287 zip->reg_base = pci_ioremap_bar(pdev, PCI_CFG_ZIP_PF_BAR0); in zip_probe()
288 if (!zip->reg_base) { in zip_probe()
289 dev_err(dev, "ZIP: Cannot map BAR0 CSR memory space, aborting"); in zip_probe()
294 /* Initialize ZIP Hardware */ in zip_probe()
295 err = zip_init_hw(zip); in zip_probe()
302 zip_err("ZIP: Kernel Crypto Registration failed\n"); in zip_probe()
312 zip_reset(zip); in zip_probe()
315 if (zip->reg_base) in zip_probe()
316 iounmap(zip->reg_base); in zip_probe()
326 zip_dev[zip->index] = NULL; in zip_probe()
327 devm_kfree(dev, zip); in zip_probe()
334 struct zip_device *zip = pci_get_drvdata(pdev); in zip_remove() local
337 if (!zip) in zip_remove()
344 if (zip->reg_base) { in zip_remove()
345 zip_reset(zip); in zip_remove()
346 iounmap(zip->reg_base); in zip_remove()
357 zip_cmd_qbuf_free(zip, q); in zip_remove()
360 /* remove zip device from zip device list */ in zip_remove()
361 zip_dev[zip->index] = NULL; in zip_remove()
484 /* Displays ZIP device statistics */
492 struct zip_device *zip; in zip_stats_show() local
499 zip = zip_dev[index]; in zip_stats_show()
500 st = &zip->stats; in zip_stats_show()
504 val = zip_reg_read((zip->reg_base + in zip_stats_show()
514 seq_printf(s, " ZIP Device %d Stats\n" in zip_stats_show()
556 seq_printf(s, "Cleared stats for zip %d\n", index); in zip_clear_show()
591 " ZIP Device %d Registers\n" in zip_regs_show()
649 MODULE_DESCRIPTION("Cavium Inc ThunderX ZIP Driver");