Lines Matching +full:function +full:- +full:off

1 /*-
51 return pci_read_config(os->dev, reg, 4); in ocs_config_read32()
57 return pci_read_config(os->dev, reg, 2); in ocs_config_read16()
63 return pci_read_config(os->dev, reg, 1); in ocs_config_read8()
69 return pci_write_config(os->dev, reg, val, 1); in ocs_config_write8()
75 return pci_write_config(os->dev, reg, val, 2); in ocs_config_write16()
81 return pci_write_config(os->dev, reg, val, 4); in ocs_config_write32()
89 * PCI BARs which form a logical address. For example, a 64-bit address uses
94 * @param off Offset from the base address of the Register Set
99 ocs_reg_read32(ocs_t *ocs, uint32_t rset, uint32_t off) in ocs_reg_read32() argument
103 reg = &ocs->reg[rset]; in ocs_reg_read32()
105 return bus_space_read_4(reg->btag, reg->bhandle, off); in ocs_reg_read32()
113 * PCI BARs which form a logical address. For example, a 64-bit address uses
118 * @param off Offset from the base address of the Register Set
123 ocs_reg_read16(ocs_t *ocs, uint32_t rset, uint32_t off) in ocs_reg_read16() argument
127 reg = &ocs->reg[rset]; in ocs_reg_read16()
129 return bus_space_read_2(reg->btag, reg->bhandle, off); in ocs_reg_read16()
137 * PCI BARs which form a logical address. For example, a 64-bit address uses
142 * @param off Offset from the base address of the Register Set
147 ocs_reg_read8(ocs_t *ocs, uint32_t rset, uint32_t off) in ocs_reg_read8() argument
151 reg = &ocs->reg[rset]; in ocs_reg_read8()
153 return bus_space_read_1(reg->btag, reg->bhandle, off); in ocs_reg_read8()
161 * PCI BARs which form a logical address. For example, a 64-bit address uses
166 * @param off Offset from the base address of the Register Set
172 ocs_reg_write32(ocs_t *ocs, uint32_t rset, uint32_t off, uint32_t val) in ocs_reg_write32() argument
176 reg = &ocs->reg[rset]; in ocs_reg_write32()
178 return bus_space_write_4(reg->btag, reg->bhandle, off, val); in ocs_reg_write32()
183 * @brief Write a 16-bit PCI register
186 * PCI BARs which form a logical address. For example, a 64-bit address uses
191 * @param off Offset from the base address of the Register Set
197 ocs_reg_write16(ocs_t *ocs, uint32_t rset, uint32_t off, uint16_t val) in ocs_reg_write16() argument
201 reg = &ocs->reg[rset]; in ocs_reg_write16()
203 return bus_space_write_2(reg->btag, reg->bhandle, off, val); in ocs_reg_write16()
208 * @brief Write a 8-bit PCI register
211 * PCI BARs which form a logical address. For example, a 64-bit address uses
216 * @param off Offset from the base address of the Register Set
222 ocs_reg_write8(ocs_t *ocs, uint32_t rset, uint32_t off, uint8_t val) in ocs_reg_write8() argument
226 reg = &ocs->reg[rset]; in ocs_reg_write8()
228 return bus_space_write_1(reg->btag, reg->bhandle, off, val); in ocs_reg_write8()
284 * @brief Callback function provided to bus_dmamap_load
286 * Function loads the physical / bus address into the DMA descriptor. The caller
301 dma->phys = 0; in ocs_dma_load()
303 dma->phys = seg->ds_addr; in ocs_dma_load()
314 * @return 0 if memory is de-allocated, -1 otherwise
322 device_printf(ocs->dev, "%s: bad parameter(s) dma=%p\n", __func__, dma); in ocs_dma_free()
323 return -1; in ocs_dma_free()
326 if (dma->size == 0) { in ocs_dma_free()
330 if (dma->map) { in ocs_dma_free()
331 bus_dmamap_sync(dma->tag, dma->map, BUS_DMASYNC_POSTREAD | in ocs_dma_free()
333 bus_dmamap_unload(dma->tag, dma->map); in ocs_dma_free()
336 if (dma->virt) { in ocs_dma_free()
337 bus_dmamem_free(dma->tag, dma->virt, dma->map); in ocs_dma_free()
338 bus_dmamap_destroy(dma->tag, dma->map); in ocs_dma_free()
340 bus_dma_tag_destroy(dma->tag); in ocs_dma_free()
364 device_printf(ocs->dev, "%s bad parameter(s) dma=%p size=%zd\n", in ocs_dma_alloc()
372 if (bus_dma_tag_create(ocs->dmat, align, 0, BUS_SPACE_MAXADDR, in ocs_dma_alloc()
374 size, 1, size, 0, NULL, NULL, &dma->tag)) { in ocs_dma_alloc()
375 device_printf(ocs->dev, "DMA tag allocation failed\n"); in ocs_dma_alloc()
379 dma->size = size; in ocs_dma_alloc()
382 if (bus_dmamem_alloc(dma->tag, &dma->virt, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, in ocs_dma_alloc()
383 &dma->map)) { in ocs_dma_alloc()
384 device_printf(ocs->dev, "DMA memory allocation failed s=%zd a=%zd\n", size, align); in ocs_dma_alloc()
389 dma->alloc = dma->virt; in ocs_dma_alloc()
392 if (bus_dmamap_load(dma->tag, dma->map, dma->virt, dma->size, ocs_dma_load, in ocs_dma_alloc()
394 device_printf(ocs->dev, "DMA memory load failed\n"); in ocs_dma_alloc()
400 if (0 == dma->phys) { in ocs_dma_alloc()
401 device_printf(ocs->dev, "ocs_dma_load failed\n"); in ocs_dma_alloc()
418 * - BUS_DMASYNC_PREWRITE
419 * - BUS_DMASYNC_POSTREAD
424 bus_dmamap_sync(dma->tag, dma->map, flags); in ocs_dma_sync()
431 return -1; in ocs_dma_copy_in()
433 return -1; in ocs_dma_copy_in()
436 if (buffer_length > dma->size) in ocs_dma_copy_in()
437 buffer_length = dma->size; in ocs_dma_copy_in()
438 ocs_memcpy(dma->virt, buffer, buffer_length); in ocs_dma_copy_in()
439 dma->len = buffer_length; in ocs_dma_copy_in()
447 return -1; in ocs_dma_copy_out()
449 return -1; in ocs_dma_copy_out()
452 if (buffer_length > dma->len) in ocs_dma_copy_out()
453 buffer_length = dma->len; in ocs_dma_copy_out()
454 ocs_memcpy(buffer, dma->virt, buffer_length); in ocs_dma_copy_out()
471 ocs_vsnprintf(lock->name, MAX_LOCK_DESC_LEN, name, ap); in ocs_lock_init()
474 mtx_init(&lock->lock, lock->name, NULL, MTX_DEF); in ocs_lock_init()
511 * @return bit position or -1 if map is full
516 int32_t position = -1; in ocs_bitmap_find()
520 if (-1 != position) { in ocs_bitmap_find()
534 * @return bit position or -1
542 return -1; in ocs_bitmap_search()
576 p += snprintf(p, sizeof(buf) - (p - buf), "%s: ", DRV_NAME); in _ocs_log()
577 p += snprintf(p, sizeof(buf) - (p - buf), "%s:", func_name); in _ocs_log()
578 p += snprintf(p, sizeof(buf) - (p - buf), "%i:", line); in _ocs_log()
579 …p += snprintf(p, sizeof(buf) - (p - buf), "%s:", (ocs != NULL) ? device_get_nameunit(ocs->dev) : "… in _ocs_log()
580 p += vsnprintf(p, sizeof(buf) - (p - buf), fmt, ap); in _ocs_log()
588 * @brief Common thread call function
590 …* This is the common function called whenever a thread instantiated by ocs_thread_create() is star…
591 …* It captures the return value from the actual thread function and stashes it in the thread object…
604 thread->retval = (*thread->fctn)(thread->arg); in ocs_thread_call_fctn()
605 ocs_free(NULL, thread->name, ocs_strlen(thread->name+1)); in ocs_thread_call_fctn()
617 * @param fctn function for thread to be begin executing
619 * @param arg application specific argument passed to thread function
633 thread->fctn = fctn; in ocs_thread_create()
634 thread->name = ocs_strdup(name); in ocs_thread_create()
635 if (thread->name == NULL) { in ocs_thread_create()
636 thread->name = "unknown"; in ocs_thread_create()
638 thread->arg = arg; in ocs_thread_create()
640 ocs_atomic_set(&thread->terminate, 0); in ocs_thread_create()
642 …rc = kthread_add(ocs_thread_call_fctn, thread, NULL, &thread->tcb, (start == OCS_THREAD_CREATE) ? … in ocs_thread_create()
661 thread_lock(thread->tcb); in ocs_thread_start()
662 sched_add(thread->tcb, SRQ_BORING); in ocs_thread_start()
678 return mythread->arg; in ocs_thread_get_arg()
695 ocs_atomic_set(&thread->terminate, 1); in ocs_thread_terminate()
703 * function would be used by a thread to see if it should terminate.
705 * @return returns non-zero if a stop has been requested
710 return ocs_atomic_read(&thread->terminate); in ocs_thread_terminate_requested()
716 * After a thread has terminated, it's return value may be retrieved with this function.
720 * @return return value from thread function
726 return thread->retval; in ocs_thread_get_retval()
755 return -1; in ocs_thread_setcpu()
770 ocs_vsnprintf(sem->name, sizeof(sem->name), name, ap); in ocs_sem_init()
773 sema_init(&sem->sem, val, sem->name); in ocs_sem_init()
781 * This function is called at the beginning of an ioctl function
784 * BSD handles this for us - arg is already in kernel space,
788 * @param arg The argument passed to the ioctl function
803 * This function is called at the end of ioctl processing to
809 * @param arg The argument passed to the ioctl function
825 * This function is called in the event of an error in ioctl
886 *bus = pci_get_bus(ocs->dev); in ocs_get_bus_dev_func()
887 *dev = pci_get_slot(ocs->dev); in ocs_get_bus_dev_func()
888 *func= pci_get_function(ocs->dev); in ocs_get_bus_dev_func()
894 * This function populates the ocs_cpuinfo_t buffer with CPU information
904 cpuinfo->num_cpus = mp_ncpus; in ocs_get_cpuinfo()
924 if (callout_pending(&timer->callout)) { in __ocs_callout()
929 if (!callout_active(&timer->callout)) { in __ocs_callout()
934 callout_deactivate(&timer->callout); in __ocs_callout()
936 if (timer->func) { in __ocs_callout()
937 timer->func(timer->data); in __ocs_callout()
949 return -1; in ocs_setup_timer()
952 if (!mtx_initialized(&timer->lock)) { in ocs_setup_timer()
953 mtx_init(&timer->lock, "ocs_timer", NULL, MTX_DEF); in ocs_setup_timer()
956 callout_init_mtx(&timer->callout, &timer->lock, 0); in ocs_setup_timer()
958 timer->func = func; in ocs_setup_timer()
959 timer->data = data; in ocs_setup_timer()
970 mtx_lock(&timer->lock); in ocs_setup_timer()
971 callout_reset(&timer->callout, hz, __ocs_callout, timer); in ocs_setup_timer()
972 mtx_unlock(&timer->lock); in ocs_setup_timer()
985 return -1; in ocs_mod_timer()
997 mtx_lock(&timer->lock); in ocs_mod_timer()
998 callout_reset(&timer->callout, hz, __ocs_callout, timer); in ocs_mod_timer()
999 mtx_unlock(&timer->lock); in ocs_mod_timer()
1007 return callout_active(&timer->callout); in ocs_timer_pending()
1014 mtx_lock(&timer->lock); in ocs_del_timer()
1015 callout_stop(&timer->callout); in ocs_del_timer()
1016 mtx_unlock(&timer->lock); in ocs_del_timer()
1041 ocs_save_ddump_all(OCS_DDUMP_FLAGS_WQES|OCS_DDUMP_FLAGS_CQES|OCS_DDUMP_FLAGS_MQES, -1, TRUE); in _ocs_assert()