Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/isci/isci_controller.c
Show First 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | int isci_controller_allocate_memory(struct ISCI_CONTROLLER *controller) | ||||
bus_addr_t physical_address; | bus_addr_t physical_address; | ||||
controller->mdl = sci_controller_get_memory_descriptor_list_handle( | controller->mdl = sci_controller_get_memory_descriptor_list_handle( | ||||
controller->scif_controller_handle); | controller->scif_controller_handle); | ||||
uncached_controller_memory->size = sci_mdl_decorator_get_memory_size( | uncached_controller_memory->size = sci_mdl_decorator_get_memory_size( | ||||
controller->mdl, SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS); | controller->mdl, SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS); | ||||
error = isci_allocate_dma_buffer(device, uncached_controller_memory); | error = isci_allocate_dma_buffer(device, controller, | ||||
uncached_controller_memory); | |||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
sci_mdl_decorator_assign_memory( controller->mdl, | sci_mdl_decorator_assign_memory( controller->mdl, | ||||
SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS, | SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS, | ||||
uncached_controller_memory->virtual_address, | uncached_controller_memory->virtual_address, | ||||
uncached_controller_memory->physical_address); | uncached_controller_memory->physical_address); | ||||
cached_controller_memory->size = sci_mdl_decorator_get_memory_size( | cached_controller_memory->size = sci_mdl_decorator_get_memory_size( | ||||
controller->mdl, | controller->mdl, | ||||
SCI_MDE_ATTRIBUTE_CACHEABLE | SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS | SCI_MDE_ATTRIBUTE_CACHEABLE | SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS | ||||
); | ); | ||||
error = isci_allocate_dma_buffer(device, cached_controller_memory); | error = isci_allocate_dma_buffer(device, controller, | ||||
cached_controller_memory); | |||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
sci_mdl_decorator_assign_memory(controller->mdl, | sci_mdl_decorator_assign_memory(controller->mdl, | ||||
SCI_MDE_ATTRIBUTE_CACHEABLE | SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS, | SCI_MDE_ATTRIBUTE_CACHEABLE | SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS, | ||||
cached_controller_memory->virtual_address, | cached_controller_memory->virtual_address, | ||||
cached_controller_memory->physical_address); | cached_controller_memory->physical_address); | ||||
request_memory->size = | request_memory->size = | ||||
controller->queue_depth * isci_io_request_get_object_size(); | controller->queue_depth * isci_io_request_get_object_size(); | ||||
error = isci_allocate_dma_buffer(device, request_memory); | error = isci_allocate_dma_buffer(device, controller, request_memory); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
/* For STP PIO testing, we want to ensure we can force multiple SGLs | /* For STP PIO testing, we want to ensure we can force multiple SGLs | ||||
* since this has been a problem area in SCIL. This tunable parameter | * since this has been a problem area in SCIL. This tunable parameter | ||||
* will allow us to force DMA segments to a smaller size, ensuring | * will allow us to force DMA segments to a smaller size, ensuring | ||||
* that even if a physically contiguous buffer is attached to this | * that even if a physically contiguous buffer is attached to this | ||||
* I/O, the DMA subsystem will pass us multiple segments in our DMA | * I/O, the DMA subsystem will pass us multiple segments in our DMA | ||||
* load callback. | * load callback. | ||||
*/ | */ | ||||
TUNABLE_INT_FETCH("hw.isci.max_segment_size", &max_segment_size); | TUNABLE_INT_FETCH("hw.isci.max_segment_size", &max_segment_size); | ||||
/* Create DMA tag for our I/O requests. Then we can create DMA maps based off | /* Create DMA tag for our I/O requests. Then we can create DMA maps based off | ||||
* of this tag and store them in each of our ISCI_IO_REQUEST objects. This | * of this tag and store them in each of our ISCI_IO_REQUEST objects. This | ||||
* will enable better performance than creating the DMA maps every time we get | * will enable better performance than creating the DMA maps every time we get | ||||
* an I/O. | * an I/O. | ||||
*/ | */ | ||||
status = bus_dma_tag_create(bus_get_dma_tag(device), 0x1, 0x0, | status = bus_dma_tag_create(bus_get_dma_tag(device), 0x1, 0x0, | ||||
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, | BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, | ||||
isci_io_request_get_max_io_size(), | isci_io_request_get_max_io_size(), | ||||
SCI_MAX_SCATTER_GATHER_ELEMENTS, max_segment_size, 0, NULL, NULL, | SCI_MAX_SCATTER_GATHER_ELEMENTS, max_segment_size, 0, | ||||
busdma_lock_mutex, &controller->lock, | |||||
&controller->buffer_dma_tag); | &controller->buffer_dma_tag); | ||||
sci_pool_initialize(controller->request_pool); | sci_pool_initialize(controller->request_pool); | ||||
virtual_address = request_memory->virtual_address; | virtual_address = request_memory->virtual_address; | ||||
physical_address = request_memory->physical_address; | physical_address = request_memory->physical_address; | ||||
for (int i = 0; i < controller->queue_depth; i++) { | for (int i = 0; i < controller->queue_depth; i++) { | ||||
▲ Show 20 Lines • Show All 351 Lines • Show Last 20 Lines |