void mic_dma_lib_uninit(struct mic_dma_ctx_t *dma_ctx) { int i; struct dma_channel *ch; #ifndef _MIC_SCIF_ struct pci_dev *pdev; #endif mic_dma_proc_uninit(dma_ctx); for (i = 0 ; i < MAX_NUM_DMA_CHAN; i++) { ch = &dma_ctx->dma_channels[i]; if (!ch->desc_ring) continue; drain_dma_intr(ch); /* Request the channel but don't free it. Errors are okay */ request_dma_channel(ch); #ifdef _MIC_SCIF_ // DMA now shares the IRQ handler with other system interrupts free_irq(i, ch); #endif mi_mic_dma_chan_destroy(ch, dma_ctx); #ifndef _MIC_SCIF_ micscif_pci_dev(dma_ctx->device_num, &pdev); mic_unmap_single(dma_ctx->device_num - 1, pdev, ch->desc_ring_phys, (DMA_DESC_RING_SIZE * sizeof(*ch->desc_ring)) + PAGE_SIZE); #endif kfree(ch->desc_ring_bak); ch->desc_ring_bak = NULL; ch->desc_ring = NULL; if (mic_hw_family(ch->dma_ctx->device_num) == FAMILY_KNC && mic_hw_stepping(dma_ctx->device_num) >= KNC_B0_STEP) { #ifndef _MIC_SCIF_ mic_unmap_single(dma_ctx->device_num - 1, pdev, ch->chan->dstat_wb_phys, sizeof(uint32_t)); #endif kfree(ch->chan->dstat_wb_loc); ch->chan->dstat_wb_loc = NULL; ch->chan->dstat_wb_phys = 0; } md_mic_dma_free_chan(&dma_ctx->dma_dev, ch->chan); } #ifndef MIC_IS_EMULATION /* Ensure that all waiters for DMA channels time out */ msleep(DMA_TO/HZ * 1000); #endif md_mic_dma_uninit(&dma_ctx->dma_dev); //pr_debug(PR_PREFIX "Uninitialized the dma channels\n"); }
static void __mic_dma_free(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle, struct dma_attrs *attrs) { struct scif_hw_dev *scdev = dev_get_drvdata(dev); struct mic_device *mdev = scdev_to_mdev(scdev); mic_unmap_single(mdev, dma_handle, size); kfree(vaddr); }
static void __mic_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { struct scif_hw_dev *scdev = dev_get_drvdata(dev); struct mic_device *mdev = scdev_to_mdev(scdev); mic_unmap_single(mdev, dma_addr, size); }