Lines Matching +full:dma +full:- +full:mem

1 /*-
2 * Copyright 2016-2023 Microchip Technology, Inc. and/or its subsidiaries.
32 * DMA map load callback function
65 * DMA mem resource allocation wrapper function
75 ASSERT(dma_mem->align >= 4); in os_dma_mem_alloc()
77 /* DMA memory needed - allocate it */ in os_dma_mem_alloc()
79 softs->os_specific.pqi_parent_dmat, /* parent */ in os_dma_mem_alloc()
80 dma_mem->align, 0, /* algnmnt, boundary */ in os_dma_mem_alloc()
84 dma_mem->size, /* maxsize */ in os_dma_mem_alloc()
86 dma_mem->size, /* maxsegsize */ in os_dma_mem_alloc()
89 &dma_mem->dma_tag)) != 0 ) { in os_dma_mem_alloc()
90 DBG_ERR("can't allocate DMA tag with error = 0x%x\n", ret); in os_dma_mem_alloc()
94 if (!dma_mem->dma_tag) { in os_dma_mem_alloc()
95 DBG_ERR("dma tag is NULL\n"); in os_dma_mem_alloc()
100 if ((ret = bus_dmamem_alloc(dma_mem->dma_tag, (void **)&dma_mem->virt_addr, in os_dma_mem_alloc()
101 BUS_DMA_NOWAIT, &dma_mem->dma_map)) != 0) { in os_dma_mem_alloc()
102 DBG_ERR("can't allocate DMA memory for required object \ in os_dma_mem_alloc()
107 if((ret = bus_dmamap_load(dma_mem->dma_tag, dma_mem->dma_map, in os_dma_mem_alloc()
108 dma_mem->virt_addr, dma_mem->size, in os_dma_mem_alloc()
109 os_dma_map, &dma_mem->dma_addr, 0)) != 0) { in os_dma_mem_alloc()
110 DBG_ERR("can't load DMA memory for required \ in os_dma_mem_alloc()
115 memset(dma_mem->virt_addr, 0, dma_mem->size); in os_dma_mem_alloc()
123 if(dma_mem->virt_addr) in os_dma_mem_alloc()
124 bus_dmamem_free(dma_mem->dma_tag, dma_mem->virt_addr, in os_dma_mem_alloc()
125 dma_mem->dma_map); in os_dma_mem_alloc()
127 if(dma_mem->dma_tag) in os_dma_mem_alloc()
128 bus_dma_tag_destroy(dma_mem->dma_tag); in os_dma_mem_alloc()
138 * DMA mem resource deallocation wrapper function
145 if(dma_mem->dma_addr) { in os_dma_mem_free()
146 bus_dmamap_unload(dma_mem->dma_tag, dma_mem->dma_map); in os_dma_mem_free()
147 dma_mem->dma_addr = 0; in os_dma_mem_free()
150 if(dma_mem->virt_addr) { in os_dma_mem_free()
151 bus_dmamem_free(dma_mem->dma_tag, dma_mem->virt_addr, in os_dma_mem_free()
152 dma_mem->dma_map); in os_dma_mem_free()
153 dma_mem->virt_addr = NULL; in os_dma_mem_free()
156 if(dma_mem->dma_tag) { in os_dma_mem_free()
157 bus_dma_tag_destroy(dma_mem->dma_tag); in os_dma_mem_free()
158 dma_mem->dma_tag = NULL; in os_dma_mem_free()
166 * Mem resource allocation wrapper function
184 * Mem resource deallocation wrapper function
197 * dma/bus resource deallocation wrapper function
202 if(softs->os_specific.pqi_parent_dmat) in os_resource_free()
203 bus_dma_tag_destroy(softs->os_specific.pqi_parent_dmat); in os_resource_free()
205 if (softs->os_specific.pqi_regs_res0 != NULL) in os_resource_free()
206 bus_release_resource(softs->os_specific.pqi_dev, in os_resource_free()
208 softs->os_specific.pqi_regs_rid0, in os_resource_free()
209 softs->os_specific.pqi_regs_res0); in os_resource_free()