From: Dave Jiang Date: Wed, 4 May 2011 22:02:02 +0000 (-0700) Subject: isci: Convert SATA fis data structures to Linux native X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f2f300806fe186a6c45020a444667755edcce672;p=linux-beck.git isci: Convert SATA fis data structures to Linux native Converting of sata_fis_reg_d2h to dev_to_host_fis Converting of sata_fis_reg_h2d to host_to_dev_fis Signed-off-by: Dave Jiang Signed-off-by: Dan Williams --- diff --git a/drivers/scsi/isci/core/intel_sata.h b/drivers/scsi/isci/core/intel_sata.h index 47390d54064d..977354d7b843 100644 --- a/drivers/scsi/isci/core/intel_sata.h +++ b/drivers/scsi/isci/core/intel_sata.h @@ -101,62 +101,6 @@ struct sata_fis_header { u32 error:8; }; - -/** - * struct sata_fis_reg_h2d - This is the definition for a SATA Host to Device - * Register FIS. - * - * - */ -struct sata_fis_reg_h2d { - u32 fis_type:8; /* word 0 */ - u32 pm_port:4; - u32 reserved0:3; - u32 command_flag:1; - u32 command:8; - u32 features:8; - u32 lba_low:8; /* word 1 */ - u32 lba_mid:8; - u32 lba_high:8; - u32 device:8; - u32 lba_low_exp:8; /* word 2 */ - u32 lba_mid_exp:8; - u32 lba_high_exp:8; - u32 features_exp:8; - u32 sector_count:8; /* word 3 */ - u32 sector_count_exp:8; - u32 reserved1:8; - u32 control:8; - u32 reserved2; /* word 4 */ -}; - -/** - * struct sata_fis_reg_d2h - SATA Device To Host FIS - * - * - */ -struct sata_fis_reg_d2h { - u32 fis_type:8; /* word 0 */ - u32 pm_port:4; - u32 reserved0:2; - u32 irq:1; - u32 reserved1:1; - u32 status:8; - u32 error:8; - u8 lba_low; /* word 1 */ - u8 lba_mid; - u8 lba_high; - u8 device; - u8 lba_low_exp; /* word 2 */ - u8 lba_mid_exp; - u8 lba_high_exp; - u8 reserved; - u8 sector_count; /* word 3 */ - u8 sector_count_exp; - u16 reserved2; - u32 reserved3; -}; - /** * * diff --git a/drivers/scsi/isci/core/scic_phy.h b/drivers/scsi/isci/core/scic_phy.h index 784c5b5c105b..6fe39ccedf0b 100644 --- a/drivers/scsi/isci/core/scic_phy.h +++ b/drivers/scsi/isci/core/scic_phy.h @@ -64,11 +64,11 @@ */ +#include +#include #include "sci_status.h" - #include "intel_sata.h" #include "intel_sas.h" -#include struct scic_sds_phy; struct scic_sds_port; @@ -141,7 +141,7 @@ struct scic_sata_phy_properties { * This field delineates the signature FIS received from the * attached target. */ - struct sata_fis_reg_d2h signature_fis; + struct dev_to_host_fis signature_fis; /** * This field specifies to the user if a port selector is connected diff --git a/drivers/scsi/isci/core/scic_sds_controller.c b/drivers/scsi/isci/core/scic_sds_controller.c index d7c37dc64ac4..0b76fc75996f 100644 --- a/drivers/scsi/isci/core/scic_sds_controller.c +++ b/drivers/scsi/isci/core/scic_sds_controller.c @@ -54,6 +54,7 @@ */ #include +#include #include "scic_controller.h" #include "scic_phy.h" #include "scic_port.h" @@ -1754,17 +1755,11 @@ void scic_sds_controller_copy_sata_response( void *frame_header, void *frame_buffer) { - memcpy( - response_buffer, - frame_header, - sizeof(u32) - ); + memcpy(response_buffer, frame_header, sizeof(u32)); - memcpy( - (char *)((char *)response_buffer + sizeof(u32)), - frame_buffer, - sizeof(struct sata_fis_reg_d2h) - sizeof(u32) - ); + memcpy(response_buffer + sizeof(u32), + frame_buffer, + sizeof(struct dev_to_host_fis) - sizeof(u32)); } /** diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c index c935c0482470..1b35b1ac1f8d 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.c +++ b/drivers/scsi/isci/core/scic_sds_phy.c @@ -53,6 +53,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include "intel_ata.h" #include "intel_sata.h" #include "sci_base_state.h" @@ -620,11 +621,9 @@ enum sci_status scic_sata_phy_get_properties( struct scic_sata_phy_properties *properties) { if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { - memcpy( - &properties->signature_fis, - &sci_phy->phy_type.sata.signature_fis_buffer, - sizeof(struct sata_fis_reg_d2h) - ); + memcpy(&properties->signature_fis, + &sci_phy->phy_type.sata.signature_fis_buffer, + sizeof(struct dev_to_host_fis)); /* / @todo add support for port selectors. */ properties->is_port_selector_present = false; diff --git a/drivers/scsi/isci/core/scic_sds_phy.h b/drivers/scsi/isci/core/scic_sds_phy.h index fca95c1c027a..c9fa2071f9b2 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.h +++ b/drivers/scsi/isci/core/scic_sds_phy.h @@ -280,7 +280,7 @@ struct scic_sds_phy { } sas; struct { - struct sata_fis_reg_d2h signature_fis_buffer; + struct dev_to_host_fis signature_fis_buffer; } sata; diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c index ffc16072d1da..13067659a8c6 100644 --- a/drivers/scsi/isci/core/scic_sds_request.c +++ b/drivers/scsi/isci/core/scic_sds_request.c @@ -53,7 +53,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +#include #include "intel_sas.h" #include "intel_sata.h" #include "intel_sat.h" @@ -1742,7 +1742,7 @@ enum sci_status scic_io_request_construct(struct scic_sds_controller *scic, scic_sds_ssp_io_request_assign_buffers(sci_req); } else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { scic_sds_stp_request_assign_buffers(sci_req); - memset(sci_req->command_buffer, 0, sizeof(struct sata_fis_reg_h2d)); + memset(sci_req->command_buffer, 0, sizeof(struct host_to_dev_fis)); } else if (dev_is_expander(dev)) { scic_sds_smp_request_assign_buffers(sci_req); memset(sci_req->command_buffer, 0, sizeof(struct smp_request)); diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.c b/drivers/scsi/isci/core/scic_sds_stp_request.c index 8c980235ea41..1cd111c42ede 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.c +++ b/drivers/scsi/isci/core/scic_sds_stp_request.c @@ -79,7 +79,7 @@ * request memory */ #define scic_sds_stp_request_get_h2d_reg_buffer(memory) \ - ((struct sata_fis_reg_h2d *)(\ + ((struct host_to_dev_fis *)(\ ((char *)(memory)) + sizeof(struct scic_sds_stp_request) \ )) @@ -90,9 +90,9 @@ * request memory */ #define scic_sds_stp_request_get_response_buffer(memory) \ - ((struct sata_fis_reg_d2h *)(\ + ((struct dev_to_host_fis *)(\ ((char *)(scic_sds_stp_request_get_h2d_reg_buffer(memory))) \ - + sizeof(struct sata_fis_reg_h2d) \ + + sizeof(struct host_to_dev_fis) \ )) /** @@ -127,8 +127,8 @@ u32 scic_sds_stp_request_get_object_size(void) { return sizeof(struct scic_sds_stp_request) - + sizeof(struct sata_fis_reg_h2d) - + sizeof(struct sata_fis_reg_d2h) + + sizeof(struct host_to_dev_fis) + + sizeof(struct dev_to_host_fis) + sizeof(struct scu_task_context) + SMP_CACHE_BYTES + sizeof(struct scu_sgl_element_pair) * SCU_MAX_SGL_ELEMENT_PAIRS; @@ -205,7 +205,7 @@ static void scu_sata_reqeust_construct_task_context( task_context->task_phase = 0x01; task_context->ssp_command_iu_length = - (sizeof(struct sata_fis_reg_h2d) - sizeof(u32)) / sizeof(u32); + (sizeof(struct host_to_dev_fis) - sizeof(u32)) / sizeof(u32); /* Set the first word of the H2D REG FIS */ task_context->type.words[0] = *(u32 *)sds_request->command_buffer; @@ -354,7 +354,8 @@ static void scu_stp_raw_request_construct_task_context( task_context->priority = SCU_TASK_PRIORITY_NORMAL; task_context->task_type = SCU_TASK_TYPE_SATA_RAW_FRAME; task_context->type.stp.fis_type = SATA_FIS_TYPE_REGH2D; - task_context->transfer_length_bytes = sizeof(struct sata_fis_reg_h2d) - sizeof(u32); + task_context->transfer_length_bytes = + sizeof(struct host_to_dev_fis) - sizeof(u32); } void scic_stp_io_request_set_ncq_tag( @@ -1749,7 +1750,7 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet { struct scic_sds_request *sci_req = object; struct scu_task_context *task_context; - struct sata_fis_reg_h2d *h2d_fis; + struct host_to_dev_fis *h2d_fis; enum sci_status status; /* Clear the SRST bit */ diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.h b/drivers/scsi/isci/core/scic_sds_stp_request.h index 6724c1d759df..807bc4eeb821 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.h +++ b/drivers/scsi/isci/core/scic_sds_stp_request.h @@ -69,7 +69,7 @@ struct scic_sds_stp_request { struct scic_sds_request parent; - struct sata_fis_reg_d2h d2h_reg_fis; + struct dev_to_host_fis d2h_reg_fis; union { u32 ncq; diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h index 44b727f1c455..3fe1a8a13169 100644 --- a/drivers/scsi/isci/phy.h +++ b/drivers/scsi/isci/phy.h @@ -59,6 +59,7 @@ #include "port.h" #include "host.h" +#include #include @@ -79,10 +80,8 @@ struct isci_phy { u8 sas_addr[SAS_ADDR_SIZE]; union { - u8 aif[sizeof(struct sci_sas_identify_address_frame)]; - u8 fis[sizeof(struct sata_fis_reg_d2h)]; - + struct dev_to_host_fis fis; } frame_rcvd; }; diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index 30d6ad895ccf..5b38f2f963e0 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c @@ -205,11 +205,8 @@ void isci_port_link_up( */ BUG_ON(call_status != SCI_SUCCESS); - memcpy(isci_phy->frame_rcvd.fis, - &sata_phy_properties.signature_fis, - sizeof(struct sata_fis_reg_d2h)); - - isci_phy->sas_phy.frame_rcvd_size = sizeof(struct sata_fis_reg_d2h); + isci_phy->frame_rcvd.fis = sata_phy_properties.signature_fis; + isci_phy->sas_phy.frame_rcvd_size = sizeof(struct dev_to_host_fis); /* * For direct-attached SATA devices, the SCI core will diff --git a/drivers/scsi/isci/sata.c b/drivers/scsi/isci/sata.c index 53ce0c281bee..08374505832e 100644 --- a/drivers/scsi/isci/sata.c +++ b/drivers/scsi/isci/sata.c @@ -53,6 +53,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include "isci.h" #include "remote_device.h" #include "scic_io_request.h" @@ -142,11 +143,10 @@ void isci_sata_set_ncq_tag( * * none. */ -void isci_request_process_stp_response( - struct sas_task *task, - void *response_buffer) +void isci_request_process_stp_response(struct sas_task *task, + void *response_buffer) { - struct sata_fis_reg_d2h *d2h_reg_fis = (struct sata_fis_reg_d2h *)response_buffer; + struct dev_to_host_fis *d2h_reg_fis = response_buffer; struct task_status_struct *ts = &task->task_status; struct ata_task_resp *resp = (void *)&ts->buf[0]; diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index 95f386723212..f9a1c41a5ce8 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c @@ -1452,10 +1452,8 @@ void isci_task_request_complete( memcpy(&tmf->resp.d2h_fis, scic_stp_io_request_get_d2h_reg_address( - request->sci_request_handle - ), - sizeof(struct sata_fis_reg_d2h) - ); + request->sci_request_handle), + sizeof(struct dev_to_host_fis)); } /* Manage the timer if it is still running. */