Lines Matching +full:mem +full:- +full:array
1 /* SPDX-License-Identifier: BSD-3-Clause */
49 * iavf_dmamap_cb - DMA mapping callback function
51 * @segs: the segments array
52 * @nseg: number of segments in the array
63 *(bus_addr_t *) arg = segs->ds_addr; in iavf_dmamap_cb()
68 * iavf_allocate_virt_mem - Allocate virtual memory
70 * @mem: structure describing the memory allocation
78 iavf_allocate_virt_mem(struct iavf_hw *hw __unused, struct iavf_virt_mem *mem, in iavf_allocate_virt_mem() argument
81 mem->va = malloc(size, M_IAVF, M_NOWAIT | M_ZERO); in iavf_allocate_virt_mem()
82 return(mem->va == NULL); in iavf_allocate_virt_mem()
86 * iavf_free_virt_mem - Free virtual memory
88 * @mem: structure describing the memory to free
95 iavf_free_virt_mem(struct iavf_hw *hw __unused, struct iavf_virt_mem *mem) in iavf_free_virt_mem() argument
97 free(mem->va, M_IAVF); in iavf_free_virt_mem()
98 mem->va = NULL; in iavf_free_virt_mem()
104 * iavf_allocate_dma_mem - Allocate DMA memory
106 * @mem: structure describing the memory allocation
117 iavf_allocate_dma_mem(struct iavf_hw *hw, struct iavf_dma_mem *mem, in iavf_allocate_dma_mem() argument
120 device_t dev = ((struct iavf_osdep *)hw->back)->dev; in iavf_allocate_dma_mem()
135 &mem->tag); in iavf_allocate_dma_mem()
142 err = bus_dmamem_alloc(mem->tag, (void **)&mem->va, in iavf_allocate_dma_mem()
143 BUS_DMA_NOWAIT | BUS_DMA_ZERO, &mem->map); in iavf_allocate_dma_mem()
150 err = bus_dmamap_load(mem->tag, mem->map, mem->va, in iavf_allocate_dma_mem()
153 &mem->pa, in iavf_allocate_dma_mem()
161 mem->nseg = 1; in iavf_allocate_dma_mem()
162 mem->size = size; in iavf_allocate_dma_mem()
163 bus_dmamap_sync(mem->tag, mem->map, in iavf_allocate_dma_mem()
167 bus_dmamem_free(mem->tag, mem->va, mem->map); in iavf_allocate_dma_mem()
169 bus_dma_tag_destroy(mem->tag); in iavf_allocate_dma_mem()
171 mem->map = NULL; in iavf_allocate_dma_mem()
172 mem->tag = NULL; in iavf_allocate_dma_mem()
177 * iavf_free_dma_mem - Free DMA memory allocation
179 * @mem: pointer to memory structure previously allocated
186 iavf_free_dma_mem(struct iavf_hw *hw __unused, struct iavf_dma_mem *mem) in iavf_free_dma_mem() argument
188 bus_dmamap_sync(mem->tag, mem->map, in iavf_free_dma_mem()
190 bus_dmamap_unload(mem->tag, mem->map); in iavf_free_dma_mem()
191 bus_dmamem_free(mem->tag, mem->va, mem->map); in iavf_free_dma_mem()
192 bus_dma_tag_destroy(mem->tag); in iavf_free_dma_mem()
197 * iavf_init_spinlock - Initialize a spinlock
210 mtx_init(&lock->mutex, "mutex", in iavf_init_spinlock()
215 * iavf_acquire_spinlock - Acquire a spin lock
223 mtx_lock(&lock->mutex); in iavf_acquire_spinlock()
227 * iavf_release_spinlock - Release a spin lock
235 mtx_unlock(&lock->mutex); in iavf_release_spinlock()
239 * iavf_destroy_spinlock - Destroy a spin lock
251 if (mtx_initialized(&lock->mutex)) in iavf_destroy_spinlock()
252 mtx_destroy(&lock->mutex); in iavf_destroy_spinlock()
256 * iavf_debug_shared - Log a debug message if enabled
261 * Checks if the mask is enabled in the hw->debug_mask. If so, prints
270 if (!(mask & ((struct iavf_hw *)hw)->debug_mask)) in iavf_debug_shared()
273 dev = ((struct iavf_osdep *)hw->back)->dev; in iavf_debug_shared()
275 /* Re-implement device_printf() */ in iavf_debug_shared()
283 * iavf_read_pci_cfg - Read a PCI config register
297 value = pci_read_config(((struct iavf_osdep *)hw->back)->dev, in iavf_read_pci_cfg()
304 * iavf_write_pci_cfg - Write a PCI config register
315 pci_write_config(((struct iavf_osdep *)hw->back)->dev, in iavf_write_pci_cfg()
322 * iavf_rd32 - Read a 32bit hardware register value
333 struct iavf_osdep *osdep = (struct iavf_osdep *)hw->back; in iavf_rd32()
335 KASSERT(reg < osdep->mem_bus_space_size, in iavf_rd32()
337 (uintmax_t)reg, (uintmax_t)osdep->mem_bus_space_size)); in iavf_rd32()
339 return (bus_space_read_4(osdep->mem_bus_space_tag, in iavf_rd32()
340 osdep->mem_bus_space_handle, reg)); in iavf_rd32()
344 * iavf_wr32 - Write a 32bit hardware register
354 struct iavf_osdep *osdep = (struct iavf_osdep *)hw->back; in iavf_wr32()
356 KASSERT(reg < osdep->mem_bus_space_size, in iavf_wr32()
358 (uintmax_t)reg, (uintmax_t)osdep->mem_bus_space_size)); in iavf_wr32()
360 bus_space_write_4(osdep->mem_bus_space_tag, in iavf_wr32()
361 osdep->mem_bus_space_handle, reg, val); in iavf_wr32()
365 * iavf_flush - Flush register writes
374 struct iavf_osdep *osdep = (struct iavf_osdep *)hw->back; in iavf_flush()
376 rd32(hw, osdep->flush_reg); in iavf_flush()
380 * iavf_debug_core - Debug printf for core driver code
399 /* Re-implement device_printf() */ in iavf_debug_core()