Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/isci/isci.c
Show First 20 Lines • Show All 402 Lines • ▼ Show 20 Lines | isci_allocate_dma_buffer_callback(void *arg, bus_dma_segment_t *seg, | ||||
if (nseg != 1 || error != 0) | if (nseg != 1 || error != 0) | ||||
isci_log_message(0, "ISCI", | isci_log_message(0, "ISCI", | ||||
"Failed to allocate physically contiguous memory!\n"); | "Failed to allocate physically contiguous memory!\n"); | ||||
else | else | ||||
memory->physical_address = seg->ds_addr; | memory->physical_address = seg->ds_addr; | ||||
} | } | ||||
int | int | ||||
isci_allocate_dma_buffer(device_t device, struct ISCI_MEMORY *memory) | isci_allocate_dma_buffer(device_t device, struct ISCI_CONTROLLER *controller, | ||||
struct ISCI_MEMORY *memory) | |||||
{ | { | ||||
uint32_t status; | uint32_t status; | ||||
status = bus_dma_tag_create(bus_get_dma_tag(device), | status = bus_dma_tag_create(bus_get_dma_tag(device), | ||||
0x40 /* cacheline alignment */, 0x0, BUS_SPACE_MAXADDR, | 0x40 /* cacheline alignment */, 0x0, BUS_SPACE_MAXADDR, | ||||
BUS_SPACE_MAXADDR, NULL, NULL, memory->size, | BUS_SPACE_MAXADDR, NULL, NULL, memory->size, | ||||
0x1 /* we want physically contiguous */, | 0x1 /* we want physically contiguous */, | ||||
memory->size, 0, NULL, NULL, &memory->dma_tag); | memory->size, 0, busdma_lock_mutex, &controller->lock, | ||||
&memory->dma_tag); | |||||
if(status == ENOMEM) { | if(status == ENOMEM) { | ||||
isci_log_message(0, "ISCI", "bus_dma_tag_create failed\n"); | isci_log_message(0, "ISCI", "bus_dma_tag_create failed\n"); | ||||
return (status); | return (status); | ||||
} | } | ||||
status = bus_dmamem_alloc(memory->dma_tag, | status = bus_dmamem_alloc(memory->dma_tag, | ||||
(void **)&memory->virtual_address, BUS_DMA_ZERO, &memory->dma_map); | (void **)&memory->virtual_address, BUS_DMA_ZERO, &memory->dma_map); | ||||
▲ Show 20 Lines • Show All 251 Lines • Show Last 20 Lines |