isci: Convert SATA fis data structures to Linux native
authorDave Jiang <dave.jiang@intel.com>
Wed, 4 May 2011 22:02:02 +0000 (15:02 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 11:04:45 +0000 (04:04 -0700)
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 <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
12 files changed:
drivers/scsi/isci/core/intel_sata.h
drivers/scsi/isci/core/scic_phy.h
drivers/scsi/isci/core/scic_sds_controller.c
drivers/scsi/isci/core/scic_sds_phy.c
drivers/scsi/isci/core/scic_sds_phy.h
drivers/scsi/isci/core/scic_sds_request.c
drivers/scsi/isci/core/scic_sds_stp_request.c
drivers/scsi/isci/core/scic_sds_stp_request.h
drivers/scsi/isci/phy.h
drivers/scsi/isci/port.c
drivers/scsi/isci/sata.c
drivers/scsi/isci/task.c

index 47390d54064da9e37528f02bd434da7ba038165b..977354d7b8436a26c661b7b1c7b8bf63b4974af1 100644 (file)
@@ -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;
-};
-
 /**
  *
  *
index 784c5b5c105bcdb4f4705e720cdaef2e1bc036b7..6fe39ccedf0b92d4843eef32b9793a9fea8069e4 100644 (file)
  */
 
 
+#include <scsi/sas.h>
+#include <scsi/libsas.h>
 #include "sci_status.h"
-
 #include "intel_sata.h"
 #include "intel_sas.h"
-#include <scsi/libsas.h>
 
 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
index d7c37dc64ac471b0ed827ddee8c745f01d6b539d..0b76fc75996f6325ac66192dcad94e038e62e41c 100644 (file)
@@ -54,6 +54,7 @@
  */
 
 #include <linux/device.h>
+#include <scsi/sas.h>
 #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));
 }
 
 /**
index c935c0482470ee022eb2d660fc6e1165e798ab98..1b35b1ac1f8d9f73d7188140878cb7e08e2b5940 100644 (file)
@@ -53,6 +53,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <scsi/sas.h>
 #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;
index fca95c1c027aba6d2e4f96480a450f2dd95c3fbe..c9fa2071f9b21da124b1ce22bc031dae510f5bcf 100644 (file)
@@ -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;
 
index ffc16072d1da92f64acfd1d7bce0ed58dce3df6c..13067659a8c6b89dca289b9105eeab0ac14bca38 100644 (file)
@@ -53,7 +53,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
+#include <scsi/sas.h>
 #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));
index 8c980235ea41cfe0ec589df55097b5c459ab211c..1cd111c42edefa20d23c4e7497cc33767caba4d6 100644 (file)
@@ -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) \
                 ))
 
 /**
 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 */
index 6724c1d759df8f97cef2c79f0718bfbaf78dc0a5..807bc4eeb8211e643052a8655f735307625b6fba 100644 (file)
@@ -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;
index 44b727f1c4552b3ce2a3889f3ef69c5039afeb89..3fe1a8a13169d7c830f477d7d2882bb82710736e 100644 (file)
@@ -59,6 +59,7 @@
 
 #include "port.h"
 #include "host.h"
+#include <scsi/sas.h>
 #include <scsi/libsas.h>
 
 
@@ -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;
 };
 
index 30d6ad895ccf4542c89790a1721f6ee45644034d..5b38f2f963e09575f45dfa05fc26774d7898c9ea 100644 (file)
@@ -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
index 53ce0c281beec7ea49773582df155a770d4bc3a7..08374505832e0311e587b168928250d12e6ade95 100644 (file)
@@ -53,6 +53,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <scsi/sas.h>
 #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];
 
index 95f38672321207b7ece42b6dab2c7118a1e92412..f9a1c41a5ce8bf5e27df81e08db3694120b47766 100644 (file)
@@ -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. */