Lines Matching +full:3 +full:- +full:ring

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
17 * 3. Neither the name of the Emulex Corporation nor the names of its
34 * freebsd-drivers@emulex.com
64 rc = bus_dma_tag_create(bus_get_dma_tag(sc->dev), in oce_dma_alloc()
69 size, 1, size, 0, NULL, NULL, &dma->tag); in oce_dma_alloc()
72 rc = bus_dmamem_alloc(dma->tag, in oce_dma_alloc()
73 &dma->ptr, in oce_dma_alloc()
76 &dma->map); in oce_dma_alloc()
79 dma->paddr = 0; in oce_dma_alloc()
81 rc = bus_dmamap_load(dma->tag, in oce_dma_alloc()
82 dma->map, in oce_dma_alloc()
83 dma->ptr, in oce_dma_alloc()
86 &dma->paddr, flags | BUS_DMA_NOWAIT); in oce_dma_alloc()
87 if (dma->paddr == 0) in oce_dma_alloc()
105 if (dma->tag == NULL) in oce_dma_free()
108 if (dma->paddr != 0) { in oce_dma_free()
109 bus_dmamap_sync(dma->tag, dma->map, in oce_dma_free()
111 bus_dmamap_unload(dma->tag, dma->map); in oce_dma_free()
112 dma->paddr = 0; in oce_dma_free()
115 if (dma->ptr != NULL) { in oce_dma_free()
116 bus_dmamem_free(dma->tag, dma->ptr, dma->map); in oce_dma_free()
117 dma->ptr = NULL; in oce_dma_free()
120 bus_dma_tag_destroy(dma->tag); in oce_dma_free()
121 dma->tag = NULL; in oce_dma_free()
141 *paddr = segs->ds_addr; in oce_dma_map_addr()
145 * @brief Destroy a ring buffer
147 * @param ring ring buffer
151 oce_destroy_ring_buffer(POCE_SOFTC sc, oce_ring_buffer_t *ring) in oce_destroy_ring_buffer() argument
153 oce_dma_free(sc, &ring->dma); in oce_destroy_ring_buffer()
154 free(ring, M_DEVBUF); in oce_destroy_ring_buffer()
163 oce_ring_buffer_t *ring; in oce_create_ring_buffer() local
165 ring = malloc(sizeof(oce_ring_buffer_t), M_DEVBUF, M_NOWAIT | M_ZERO); in oce_create_ring_buffer()
166 if (ring == NULL) in oce_create_ring_buffer()
169 ring->item_size = item_size; in oce_create_ring_buffer()
170 ring->num_items = q_len; in oce_create_ring_buffer()
172 rc = bus_dma_tag_create(bus_get_dma_tag(sc->dev), in oce_create_ring_buffer()
177 size, 8, 4096, 0, NULL, NULL, &ring->dma.tag); in oce_create_ring_buffer()
181 rc = bus_dmamem_alloc(ring->dma.tag, in oce_create_ring_buffer()
182 &ring->dma.ptr, in oce_create_ring_buffer()
184 &ring->dma.map); in oce_create_ring_buffer()
188 bzero(ring->dma.ptr, size); in oce_create_ring_buffer()
189 bus_dmamap_sync(ring->dma.tag, ring->dma.map, in oce_create_ring_buffer()
191 ring->dma.paddr = 0; in oce_create_ring_buffer()
193 return ring; in oce_create_ring_buffer()
196 oce_dma_free(sc, &ring->dma); in oce_create_ring_buffer()
197 free(ring, M_DEVBUF); in oce_create_ring_buffer()
198 ring = NULL; in oce_create_ring_buffer()
209 * @brief Map ring buffer
223 if (nseg <= dpt->max_entries) { in oce_dma_map_ring()
225 dpt->paddrs[i].lo = ADDR_LO(segs[i].ds_addr); in oce_dma_map_ring()
226 dpt->paddrs[i].hi = ADDR_HI(segs[i].ds_addr); in oce_dma_map_ring()
228 dpt->num_entries = nseg; in oce_dma_map_ring()
234 * @brief Load bus dma map for a ring buffer
235 * @param ring ring buffer pointer
240 oce_page_list(oce_ring_buffer_t *ring, struct phys_addr *pa_list) in oce_page_list() argument
248 bus_dmamap_load(ring->dma.tag, in oce_page_list()
249 ring->dma.map, in oce_page_list()
250 ring->dma.ptr, in oce_page_list()
251 ring->item_size * ring->num_items, in oce_page_list()