]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
isci: remove redundant copies of IAF
authorDave Jiang <dave.jiang@intel.com>
Thu, 5 May 2011 01:08:35 +0000 (18:08 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 11:04:46 +0000 (04:04 -0700)
We need to remove the extra copies of identify address frame that's
being kept around. We only need the one copy that libsas is using.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[further cleanups]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/scsi/isci/core/scic_phy.h
drivers/scsi/isci/core/scic_sds_phy.c
drivers/scsi/isci/core/scic_sds_phy.h
drivers/scsi/isci/phy.h
drivers/scsi/isci/port.c

index 8fcd3a4c57445c9d2a8f4791ab32da3fdcb1d8e6..3f43e8d69c4f7d87449d10bf6e85f68adda6818a 100644 (file)
@@ -287,47 +287,4 @@ enum scic_phy_counter_id {
        SCIC_PHY_COUNTER_SN_DWORD_SYNC_ERROR
 };
 
-
-/**
- * scic_sas_phy_get_properties() - This method will enable the user to retrieve
- *    information specific to a SAS phy, such as: the received identify address
- *    frame, received phy capabilities, etc.
- * @phy: this parameter specifies the phy for which to retrieve properties.
- * @properties: This parameter specifies the properties structure into which to
- *    copy the requested information.
- *
- * This method returns an indication as to whether the SAS phy properties were
- * successfully retrieved. SCI_SUCCESS This value is returned if the SAS
- * properties are successfully retrieved. SCI_FAILURE This value is returned if
- * the SAS properties are not successfully retrieved (e.g. It's not a SAS Phy).
- */
-enum sci_status scic_sas_phy_get_properties(
-       struct scic_sds_phy *phy,
-       struct scic_sas_phy_properties *properties);
-
-/**
- * scic_sata_phy_get_properties() - This method will enable the user to
- *    retrieve information specific to a SATA phy, such as: the received
- *    signature FIS, if a port selector is present, etc.
- * @phy: this parameter specifies the phy for which to retrieve properties.
- * @properties: This parameter specifies the properties structure into which to
- *    copy the requested information.
- *
- * This method returns an indication as to whether the SATA phy properties were
- * successfully retrieved. SCI_SUCCESS This value is returned if the SATA
- * properties are successfully retrieved. SCI_FAILURE This value is returned if
- * the SATA properties are not successfully retrieved (e.g. It's not a SATA
- * Phy).
- */
-enum sci_status scic_sata_phy_get_properties(
-       struct scic_sds_phy *phy,
-       struct scic_sata_phy_properties *properties);
-
-
-
-
-
-
-
 #endif  /* _SCIC_PHY_H_ */
-
index bd2b3058770383e90ca584761318ee790444ba4d..4afdb422ab98e4070bd3ac6b3701b140179f270c 100644 (file)
@@ -436,8 +436,9 @@ void scic_sds_phy_get_attached_sas_address(struct scic_sds_phy *sci_phy,
                                           struct sci_sas_address *sas_address)
 {
        struct sas_identify_frame *iaf;
+       struct isci_phy *iphy = sci_phy->iphy;
 
-       iaf = &sci_phy->phy_type.sas_id_frame;
+       iaf = &iphy->frame_rcvd.iaf;
        memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE);
 }
 
@@ -458,13 +459,13 @@ void scic_sds_phy_get_attached_phy_protocols(
        protocols->u.all = 0;
 
        if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) {
+               struct isci_phy *iphy = sci_phy->iphy;
                struct sas_identify_frame *iaf;
 
-               iaf = &sci_phy->phy_type.sas_id_frame;
+               iaf = &iphy->frame_rcvd.iaf;
                memcpy(&protocols->u.all, &iaf->initiator_bits, 2);
-       } else if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) {
+       } else if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA)
                protocols->u.bits.stp_target = 1;
-       }
 }
 
 /*
@@ -549,49 +550,6 @@ enum sci_status scic_sds_phy_consume_power_handler(
        return sci_phy->state_handlers->consume_power_handler(sci_phy);
 }
 
-/*
- * *****************************************************************************
- * * SCIC PHY Public Methods
- * ***************************************************************************** */
-
-
-enum sci_status scic_sas_phy_get_properties(
-       struct scic_sds_phy *sci_phy,
-       struct scic_sas_phy_properties *properties)
-{
-       if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) {
-               memcpy(&properties->rcvd_iaf,
-                      &sci_phy->phy_type.sas_id_frame,
-                      sizeof(struct sas_identify_frame));
-
-               properties->rcvd_cap.all =
-                       readl(&sci_phy->link_layer_registers->receive_phycap);
-
-               return SCI_SUCCESS;
-       }
-
-       return SCI_FAILURE;
-}
-
-
-enum sci_status scic_sata_phy_get_properties(
-       struct scic_sds_phy *sci_phy,
-       struct scic_sata_phy_properties *properties)
-{
-       if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) {
-               memcpy(&properties->signature_fis,
-                      &sci_phy->phy_type.sata_sig_fis,
-                      sizeof(struct dev_to_host_fis));
-
-               /* / @todo add support for port selectors. */
-               properties->is_port_selector_present = false;
-
-               return SCI_SUCCESS;
-       }
-
-       return SCI_FAILURE;
-}
-
 /*
  * *****************************************************************************
  * * SCIC SDS PHY HELPER FUNCTIONS
@@ -1163,6 +1121,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler
        enum sci_status result;
        u32 *frame_words;
        struct sas_identify_frame *identify_frame;
+       struct isci_phy *iphy = sci_phy->iphy;
 
        result = scic_sds_unsolicited_frame_control_get_header(
                &(scic_sds_phy_get_controller(sci_phy)->uf_control),
@@ -1188,9 +1147,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler
                frame_words[4] = SCIC_SWAP_DWORD(frame_words[4]);
                frame_words[5] = SCIC_SWAP_DWORD(frame_words[5]);
 
-               memcpy(&sci_phy->phy_type.sas_id_frame,
-                       identify_frame,
-                       sizeof(struct sas_identify_frame));
+               memcpy(&iphy->frame_rcvd.iaf, identify_frame, sizeof(*identify_frame));
 
                if (identify_frame->smp_tport) {
                        /* We got the IAF for an expander PHY go to the final state since
@@ -1239,6 +1196,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle
        enum sci_status result;
        struct dev_to_host_fis *frame_header;
        u32 *fis_frame_data;
+       struct isci_phy *iphy = sci_phy->iphy;
 
        result = scic_sds_unsolicited_frame_control_get_header(
                &(scic_sds_phy_get_controller(sci_phy)->uf_control),
@@ -1255,10 +1213,9 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle
                        frame_index,
                        (void **)&fis_frame_data);
 
-               scic_sds_controller_copy_sata_response(
-                       &sci_phy->phy_type.sata_sig_fis,
-                       frame_header,
-                       fis_frame_data);
+               scic_sds_controller_copy_sata_response(&iphy->frame_rcvd.fis,
+                                                      frame_header,
+                                                      fis_frame_data);
 
                /* got IAF we can now go to the await spinup semaphore state */
                sci_base_state_machine_change_state(&sci_phy->starting_substate_machine,
@@ -2330,7 +2287,6 @@ static const struct sci_base_state scic_sds_phy_state_table[] = {
 void scic_sds_phy_construct(struct scic_sds_phy *sci_phy,
                            struct scic_sds_port *owning_port, u8 phy_index)
 {
-
        sci_base_state_machine_construct(&sci_phy->state_machine,
                                         sci_phy,
                                         scic_sds_phy_state_table,
@@ -2347,9 +2303,6 @@ void scic_sds_phy_construct(struct scic_sds_phy *sci_phy,
        sci_phy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN;
        sci_phy->sata_timeout_timer = NULL;
 
-       /* Clear out the identification buffer data */
-       memset(&sci_phy->phy_type, 0, sizeof(sci_phy->phy_type));
-
        /* Initialize the the substate machines */
        sci_base_state_machine_construct(&sci_phy->starting_substate_machine,
                                         sci_phy,
index 47b2194574a09d0ad721883f654faca2c37c5d4f..e91f28316c004bebbc5e6c115172d6fb67b614c3 100644 (file)
@@ -272,11 +272,6 @@ struct scic_sds_phy {
         */
        bool is_in_link_training;
 
-       union {
-               struct sas_identify_frame sas_id_frame;
-               struct dev_to_host_fis sata_sig_fis;
-       } phy_type;
-
        /**
         * This field contains a reference to the timer utilized in detecting
         * when a signature FIS timeout has occurred.  The signature FIS is the
index 3100fd87c788e5c8bc6cbabc6b82dd52f84dc705..d4c4975546e375068d5ed83063021dc507800afe 100644 (file)
  */
 
 struct isci_phy {
-
        struct scic_sds_phy *sci_phy_handle;
-
        struct asd_sas_phy sas_phy;
-       struct sas_identify_frame *frame;
        struct isci_port *isci_port;
        u8 sas_addr[SAS_ADDR_SIZE];
 
index 0a1577327d61b1ee18022e823b628d7ff4aafe04..96a2002dadea2e87775ec7fd4c2d17bd3623583a 100644 (file)
@@ -171,7 +171,6 @@ void isci_port_link_up(
        struct scic_port_properties properties;
        struct isci_phy *isci_phy = phy->iphy;
        struct isci_port *isci_port = port->iport;
-       enum sci_status call_status;
        unsigned long success = true;
 
        BUG_ON(isci_phy->isci_port != NULL);
@@ -191,21 +190,7 @@ void isci_port_link_up(
        if (properties.remote.protocols.u.bits.stp_target) {
                u64 attached_sas_address;
 
-               struct scic_sata_phy_properties sata_phy_properties;
-
                isci_phy->sas_phy.oob_mode = SATA_OOB_MODE;
-
-               /* Get a copy of the signature fis for libsas */
-               call_status = scic_sata_phy_get_properties(phy,
-                                                          &sata_phy_properties);
-
-               /*
-                * XXX I am concerned about this "assert". shouldn't we
-                * handle the return appropriately?
-                */
-               BUG_ON(call_status != SCI_SUCCESS);
-
-               isci_phy->frame_rcvd.fis = sata_phy_properties.signature_fis;
                isci_phy->sas_phy.frame_rcvd_size = sizeof(struct dev_to_host_fis);
 
                /*
@@ -225,24 +210,12 @@ void isci_port_link_up(
 
        } else if (properties.remote.protocols.u.bits.ssp_target ||
                   properties.remote.protocols.u.bits.smp_target) {
-
-               struct scic_sas_phy_properties sas_phy_properties;
-
                isci_phy->sas_phy.oob_mode = SAS_OOB_MODE;
-
-               /* Get a copy of the identify address frame for libsas */
-               call_status = scic_sas_phy_get_properties(phy,
-                                                         &sas_phy_properties);
-
-               BUG_ON(call_status != SCI_SUCCESS);
-
-               isci_phy->frame_rcvd.iaf = sas_phy_properties.rcvd_iaf;
                isci_phy->sas_phy.frame_rcvd_size = sizeof(struct sas_identify_frame);
 
                /* Copy the attached SAS address from the IAF */
                memcpy(isci_phy->sas_phy.attached_sas_addr,
                       isci_phy->frame_rcvd.iaf.sas_addr, SAS_ADDR_SIZE);
-
        } else {
                dev_err(&isci_host->pdev->dev, "%s: unkown target\n", __func__);
                success = false;