Lines Matching +full:hw +full:- +full:device +full:- +full:address

1 /* SPDX-License-Identifier: BSD-3-Clause */
49 * iavf_dmamap_cb - DMA mapping callback function
50 * @arg: pointer to return the segment address
55 * Callback used by the bus DMA code to obtain the segment address.
63 *(bus_addr_t *) arg = segs->ds_addr; in iavf_dmamap_cb()
68 * iavf_allocate_virt_mem - Allocate virtual memory
69 * @hw: hardware structure
78 iavf_allocate_virt_mem(struct iavf_hw *hw __unused, struct iavf_virt_mem *mem, in iavf_allocate_virt_mem()
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
87 * @hw: hardware structure
95 iavf_free_virt_mem(struct iavf_hw *hw __unused, struct iavf_virt_mem *mem) in iavf_free_virt_mem()
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
105 * @hw: hardware structure
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
178 * @hw: hardware structure
186 iavf_free_dma_mem(struct iavf_hw *hw __unused, struct iavf_dma_mem *mem) in iavf_free_dma_mem()
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
257 * @hw: device hardware structure
261 * Checks if the mask is enabled in the hw->debug_mask. If so, prints
265 iavf_debug_shared(struct iavf_hw *hw, uint64_t mask, char *fmt, ...) in iavf_debug_shared() argument
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
284 * @hw: device hardware structure
293 iavf_read_pci_cfg(struct iavf_hw *hw, u32 reg) in iavf_read_pci_cfg() argument
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
305 * @hw: device hardware structure
313 iavf_write_pci_cfg(struct iavf_hw *hw, u32 reg, u16 value) in iavf_write_pci_cfg() argument
315 pci_write_config(((struct iavf_osdep *)hw->back)->dev, in iavf_write_pci_cfg()
322 * iavf_rd32 - Read a 32bit hardware register value
323 * @hw: the private hardware structure
324 * @reg: register address to read
331 iavf_rd32(struct iavf_hw *hw, uint32_t reg) in iavf_rd32() argument
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
345 * @hw: the private hardware structure
346 * @reg: the register address to write to
349 * Write the specified 32bit value to a register address in BAR0.
352 iavf_wr32(struct iavf_hw *hw, uint32_t reg, uint32_t val) in iavf_wr32() argument
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
366 * @hw: private hardware structure
372 iavf_flush(struct iavf_hw *hw) in iavf_flush() argument
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
388 * log messages at run time by toggling the enabled_mask in the device
399 /* Re-implement device_printf() */ in iavf_debug_core()