isci: simplify dma coherent allocation
Subsystems (2)
RFC PATCH 1/1 isci: simplify dma coherent allocation
Remove the insane infrastructure for preallocating coheren DMA regions, and just allocate the memory where needed. This also gets rid of the aligment adjustments given that Documentation/DMA-API-HOWTO.txt sais:
"The cpu return address and the DMA bus master address are both
guaranteed to be aligned to the smallest PAGE_SIZE order which is greater than or equal to the requested size. This invariant exists (for example) to guarantee that if you allocate a chunk which is smaller than or equal to 64 kilobytes, the extent of the buffer you receive will not cross a 64K boundary."
drivers/scsi/isci/core/sci_base_memory_descriptor_list.c deleted +0 -159
@@ -1,159 +0,0 @@ -/* -* This file is provided under a dual BSD/GPLv2 license. When using or -* redistributing this file, you may do so under either license. -* -* GPL LICENSE SUMMARY -* -* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. -* The full GNU General Public License is included in this distribution -* in the file called LICENSE.GPL. -* -* BSD LICENSE -* -* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** -* This file contains the base implementation for the memory descriptor list. -* This is currently comprised of MDL iterator methods. -* -* -*/ - -#include "sci_environment.h" -#include "sci_base_memory_descriptor_list.h" - -/* -* ****************************************************************************** -* * P U B L I C M E T H O D S -* ****************************************************************************** */ - -void sci_mdl_first_entry ( -struct sci_base_memory_descriptor_list *base_mdl) -{ - base_mdl->next_index =0 ; - -/* -* If this MDL is managing another MDL, then recursively rewind that MDL -* object as well. */ -if (base_mdl->next_mdl !=NULL ) -sci_mdl_first_entry (base_mdl->next_mdl); -} - - -void sci_mdl_next_entry ( -struct sci_base_memory_descriptor_list *base_mdl) -{ -/* -* If there is at least one more entry left in the array, then change -* the next pointer to it. */ -if (base_mdl->next_index < base_mdl->length) - base_mdl->next_index++; -else if (base_mdl->next_index == base_mdl->length) { -/* -* This MDL has exhausted it's set of entries. If this MDL is managing -* another MDL, then start iterating through that MDL. */ -if (base_mdl->next_mdl !=NULL ) -sci_mdl_next_entry (base_mdl->next_mdl); - } -} - - -struct sci_physical_memory_descriptor *sci_mdl_get_current_entry ( -struct sci_base_memory_descriptor_list *base_mdl) -{ -if (base_mdl->next_index < base_mdl->length) -return &base_mdl->mde_array[base_mdl->next_index]; -else if (base_mdl->next_index == base_mdl->length) { -/* -* This MDL has exhausted it's set of entries. If this MDL is managing -* another MDL, then return it's current entry. */ -if (base_mdl->next_mdl !=NULL ) -return sci_mdl_get_current_entry (base_mdl->next_mdl); - } - -return NULL ; -} - -/* -* ****************************************************************************** -* * P R O T E C T E D M E T H O D S -* ****************************************************************************** */ - -void sci_base_mdl_construct ( -struct sci_base_memory_descriptor_list *mdl, -struct sci_physical_memory_descriptor *mde_array, -u32 mde_array_length, -struct sci_base_memory_descriptor_list *next_mdl) -{ - mdl->length = mde_array_length; - mdl->mde_array = mde_array; - mdl->next_index =0 ; - mdl->next_mdl = next_mdl; -} - -/* --------------------------------------------------------------------------- */ - -bool sci_base_mde_is_valid ( -struct sci_physical_memory_descriptor *mde, -u32 alignment, -u32 size, -u16 attributes) -{ -/* Only need the lower 32 bits to ensure alignment is met. */ -u32 physical_address =lower_32_bits (mde->physical_address); - -if ( - ((((unsigned long )mde->virtual_address) & (alignment -1 )) !=0 ) - || ((physical_address & (alignment -1 )) !=0 ) - || (mde->constant_memory_alignment != alignment) - || (mde->constant_memory_size != size) - || (mde->virtual_address ==NULL ) - || (mde->constant_memory_attributes != attributes) - ) { -return false; - } - -return true; -} -
drivers/scsi/isci/core/sci_memory_descriptor_list.h deleted +0 -168
168 lines not on this page · raw message
drivers/scsi/isci/host.c +0 -97
115 lines not on this page · raw message
drivers/scsi/isci/core/sci_base_memory_descriptor_list.h deleted +0 -153
153 lines not on this page · raw message
drivers/scsi/isci/core/scic_sds_controller.c +87 -211
352 lines not on this page · raw message
drivers/scsi/isci/host.h +0 -9
@@ -75,14 +75,6 @@#define ISCI_CAN_QUEUE_VAL 250/* < SCI_MAX_IO_REQUESTS ? */ #define SCIC_CONTROLLER_STOP_TIMEOUT 5000 -struct coherent_memory_info { -struct list_head node; -dma_addr_t dma_handle; -void *vaddr; -size_t size; -struct sci_physical_memory_descriptor *mde; -}; -struct isci_host {struct scic_sds_controller *core_controller;union scic_oem_parameters oem_parameters;
@@ -114,7 +106,6 @@ struct isci_host {wait_queue_head_t eventq;struct Scsi_Host *shost;struct tasklet_struct completion_tasklet; -struct list_head mdl_struct_list;struct list_head requests_to_complete;struct list_head requests_to_errorback;spinlock_t scic_lock;
drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.c +27 -40
109 lines not on this page · raw message
drivers/scsi/isci/core/scic_sds_unsolicited_frame_control.h +3 -20
@@ -64,7 +64,6 @@#define _SCIC_SDS_UNSOLICITED_FRAME_CONTROL_H_#include "scu_unsolicited_frame.h" -#include "sci_memory_descriptor_list.h" #include "scu_constants.h" #include "sci_status.h"
@@ -248,14 +247,10 @@ struct scic_sds_unsolicited_frame_contro }; -void scic_sds_unsolicited_frame_control_set_address_table_count ( -struct scic_sds_unsolicited_frame_control *uf_control); -struct scic_sds_controller ; -void scic_sds_unsolicited_frame_control_construct ( -struct scic_sds_unsolicited_frame_control *uf_control, -struct sci_physical_memory_descriptor *mde, -struct scic_sds_controller *this_controller); + +enum sci_status scic_sds_unsolicited_frame_control_construct ( +struct scic_sds_controller *scic); enum sci_status scic_sds_unsolicited_frame_control_get_header( struct scic_sds_unsolicited_frame_control *uf_control,
@@ -271,16 +266,4 @@ bool scic_sds_unsolicited_frame_control_struct scic_sds_unsolicited_frame_control *uf_control, u32 frame_index); -/** -* scic_sds_unsolicited_frame_control_get_mde_size() - -* -* This macro simply calculates the size of the memory descriptor entry that -* relates to unsolicited frames and the surrounding silicon memory required to -* utilize it. -*/ -#define scic_sds_unsolicited_frame_control_get_mde_size (uf_control) \ - (((uf_control).buffers.count * SCU_UNSOLICITED_FRAME_BUFFER_SIZE) \ - + ((uf_control).address_table.count * sizeof(dma_addr_t)) \ - + ((uf_control).buffers.count * sizeof(struct scu_unsolicited_frame_header))) -#endif /* _SCIC_SDS_UNSOLICITED_FRAME_CONTROL_H_ */
drivers/scsi/isci/Makefile +0 -1
@@ -25,6 +25,5 @@ isci-objs := init.o phy.o request.o sata core/scic_sds_smp_remote_device.o \ core/scic_sds_remote_node_table.o \ core/scic_sds_unsolicited_frame_control.o \ - core/sci_base_memory_descriptor_list.o \ core/sci_base_state_machine.o \ core/sci_util.o
drivers/scsi/isci/core/scic_sds_controller.h +0 -49
75 lines not on this page · raw message