Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/liquidio/base/lio_request_manager.c
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | error = bus_dma_tag_create(bus_get_dma_tag(oct->device), /* parent */ | ||||
NULL, /* lockfuncarg */ | NULL, /* lockfuncarg */ | ||||
&iq->txtag); | &iq->txtag); | ||||
if (error) { | if (error) { | ||||
lio_dev_err(oct, "Cannot allocate memory for instr queue %d\n", | lio_dev_err(oct, "Cannot allocate memory for instr queue %d\n", | ||||
iq_no); | iq_no); | ||||
return (1); | return (1); | ||||
} | } | ||||
iq->base_addr = lio_dma_alloc(q_size, &iq->base_addr_dma); | iq->base_addr = lio_dma_alloc(q_size, (vm_paddr_t *)&iq->base_addr_dma); | ||||
if (!iq->base_addr) { | if (!iq->base_addr) { | ||||
lio_dev_err(oct, "Cannot allocate memory for instr queue %d\n", | lio_dev_err(oct, "Cannot allocate memory for instr queue %d\n", | ||||
iq_no); | iq_no); | ||||
return (1); | return (1); | ||||
} | } | ||||
iq->max_count = num_descs; | iq->max_count = num_descs; | ||||
/* | /* | ||||
* Initialize a list to holds requests that have been posted to | * Initialize a list to holds requests that have been posted to | ||||
* Octeon but has yet to be fetched by octeon | * Octeon but has yet to be fetched by octeon | ||||
*/ | */ | ||||
iq->request_list = malloc(sizeof(*iq->request_list) * num_descs, | iq->request_list = malloc(sizeof(*iq->request_list) * num_descs, | ||||
M_DEVBUF, M_NOWAIT | M_ZERO); | M_DEVBUF, M_NOWAIT | M_ZERO); | ||||
if (iq->request_list == NULL) { | if (iq->request_list == NULL) { | ||||
lio_dev_err(oct, "Alloc failed for IQ[%d] nr free list\n", | lio_dev_err(oct, "Alloc failed for IQ[%d] nr free list\n", | ||||
iq_no); | iq_no); | ||||
return (1); | return (1); | ||||
} | } | ||||
lio_dev_dbg(oct, "IQ[%d]: base: %p basedma: %lx count: %d\n", | lio_dev_dbg(oct, "IQ[%d]: base: %p basedma: %llx count: %d\n", | ||||
iq_no, iq->base_addr, iq->base_addr_dma, iq->max_count); | iq_no, iq->base_addr, LIO_CAST64(iq->base_addr_dma), | ||||
iq->max_count); | |||||
/* Create the descriptor buffer dma maps */ | /* Create the descriptor buffer dma maps */ | ||||
request_buf = iq->request_list; | request_buf = iq->request_list; | ||||
for (i = 0; i < num_descs; i++, request_buf++) { | for (i = 0; i < num_descs; i++, request_buf++) { | ||||
error = bus_dmamap_create(iq->txtag, 0, &request_buf->map); | error = bus_dmamap_create(iq->txtag, 0, &request_buf->map); | ||||
if (error) { | if (error) { | ||||
lio_dev_err(oct, "Unable to create TX DMA map\n"); | lio_dev_err(oct, "Unable to create TX DMA map\n"); | ||||
return (1); | return (1); | ||||
▲ Show 20 Lines • Show All 600 Lines • ▼ Show 20 Lines | lio_setup_sc_buffer_pool(struct octeon_device *oct) | ||||
int i; | int i; | ||||
STAILQ_INIT(&oct->sc_buf_pool.head); | STAILQ_INIT(&oct->sc_buf_pool.head); | ||||
mtx_init(&oct->sc_buf_pool.lock, "sc_pool_lock", NULL, MTX_DEF); | mtx_init(&oct->sc_buf_pool.lock, "sc_pool_lock", NULL, MTX_DEF); | ||||
atomic_store_rel_int(&oct->sc_buf_pool.alloc_buf_count, 0); | atomic_store_rel_int(&oct->sc_buf_pool.alloc_buf_count, 0); | ||||
for (i = 0; i < LIO_MAX_SOFT_COMMAND_BUFFERS; i++) { | for (i = 0; i < LIO_MAX_SOFT_COMMAND_BUFFERS; i++) { | ||||
sc = (struct lio_soft_command *) | sc = (struct lio_soft_command *) | ||||
lio_dma_alloc(LIO_SOFT_COMMAND_BUFFER_SIZE, &dma_addr); | lio_dma_alloc(LIO_SOFT_COMMAND_BUFFER_SIZE, (vm_paddr_t *)&dma_addr); | ||||
if (sc == NULL) { | if (sc == NULL) { | ||||
lio_free_sc_buffer_pool(oct); | lio_free_sc_buffer_pool(oct); | ||||
return (1); | return (1); | ||||
} | } | ||||
sc->dma_addr = dma_addr; | sc->dma_addr = dma_addr; | ||||
sc->size = LIO_SOFT_COMMAND_BUFFER_SIZE; | sc->size = LIO_SOFT_COMMAND_BUFFER_SIZE; | ||||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |