int efhw_keventq_ctor(struct efhw_nic *nic, int instance, struct efhw_keventq *evq, struct efhw_ev_handler *ev_handlers) { int rc; unsigned buf_bytes = evq->hw.capacity * sizeof(efhw_event_t); evq->instance = instance; evq->ev_handlers = ev_handlers; /* allocate an IObuffer for the eventq */ rc = efhw_nic_event_queue_alloc_iobuffer(nic, &evq->hw, evq->instance, buf_bytes); if (rc < 0) return rc; /* Zero the timer-value for this queue. AND Tell the nic about the event queue. */ efhw_nic_event_queue_enable(nic, evq->instance, evq->hw.capacity, evq->hw.buf_tbl_alloc.base, ev_handlers != NULL /* interrupting */, 1 /* dos protection enable*/); evq->lock = KEVQ_UNLOCKED; evq->evq_base = efhw_iopages_ptr(&evq->hw.iobuff); evq->evq_ptr = 0; evq->evq_mask = (evq->hw.capacity * sizeof(efhw_event_t)) - 1u; EFHW_TRACE("%s: [%d] base=%p end=%p", __FUNCTION__, evq->instance, evq->evq_base, evq->evq_base + buf_bytes); return 0; }
int efhw_keventq_ctor(struct efhw_nic *nic, int instance, struct efhw_keventq *evq, struct efhw_ev_handler *ev_handlers) { unsigned int page_order; int rc; dma_addr_t dma_addrs[EFHW_BUFFER_TABLE_BLOCK_SIZE]; unsigned buf_bytes = evq->hw.capacity * sizeof(efhw_event_t); EFHW_ASSERT(nic->devtype.arch == EFHW_ARCH_FALCON); EFHW_ASSERT(buf_bytes); page_order = get_order(buf_bytes); evq->instance = instance; evq->ev_handlers = ev_handlers; /* allocate an IObuffer for the eventq */ rc = efhw_nic_event_queue_alloc_iobuffer(nic, &evq->hw, evq->instance, dma_addrs, page_order); if (rc < 0) return rc; /* Zero the timer-value for this queue. AND Tell the nic about the event queue. */ efhw_nic_event_queue_enable(nic, evq->instance, evq->hw.capacity, evq->hw.bt_block->btb_vaddr >> EFHW_NIC_PAGE_SHIFT, dma_addrs, 1 << page_order, ev_handlers != NULL /* interrupting */, 1 /* dos protection enable*/, 0 /* not used on falcon */, 0 /* not used on falcon */, 0 /* not used on falcon */, NULL /* not used on falcon */, NULL /* not used on falcon */); evq->lock = KEVQ_UNLOCKED; evq->evq_base = efhw_iopages_ptr(&evq->hw.iobuff); evq->evq_ptr = 0; evq->evq_mask = (evq->hw.capacity * sizeof(efhw_event_t)) - 1u; EFHW_TRACE("%s: [%d] base=%p end=%p", __FUNCTION__, evq->instance, evq->evq_base, evq->evq_base + buf_bytes); return 0; }