Commit 4b7ebd05 authored by Dave Jiang's avatar Dave Jiang Committed by Dan Williams

isci: Convert SAS identify address frame to Linux Native format

Convert struct sci_sas_identify_address_frame to struct sas_identify_frame
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent e76d6180
...@@ -111,35 +111,6 @@ struct sci_sas_identify_address_frame_protocols { ...@@ -111,35 +111,6 @@ struct sci_sas_identify_address_frame_protocols {
}; };
/**
* struct sci_sas_identify_address_frame - This structure depicts the contents
* of the SAS IDENTIFY ADDRESS FRAME (IAF).
*
* For specific information on each of these individual fields please reference
* the SAS specification Link layer section on address frames.
*/
struct sci_sas_identify_address_frame {
u16 address_frame_type:4;
u16 device_type:3;
u16 reserved1:1;
u16 reason:4;
u16 reserved2:4;
struct sci_sas_identify_address_frame_protocols protocols;
struct sci_sas_address device_name;
struct sci_sas_address sas_address;
u32 phy_identifier:8;
u32 break_reply_capable:1;
u32 requested_in_zpsds:1;
u32 in_zpsds_persistent:1;
u32 reserved5:21;
u32 reserved6[4];
};
/** /**
* struct sas_capabilities - This structure depicts the various SAS * struct sas_capabilities - This structure depicts the various SAS
* capabilities supported by the directly attached target device. For * capabilities supported by the directly attached target device. For
......
...@@ -119,7 +119,7 @@ struct scic_sas_phy_properties { ...@@ -119,7 +119,7 @@ struct scic_sas_phy_properties {
* This field delineates the Identify Address Frame received * This field delineates the Identify Address Frame received
* from the remote end point. * from the remote end point.
*/ */
struct sci_sas_identify_address_frame received_iaf; struct sas_identify_frame rcvd_iaf;
/** /**
* This field delineates the Phy capabilities structure received * This field delineates the Phy capabilities structure received
......
...@@ -411,15 +411,7 @@ static void scic_sds_phy_suspend( ...@@ -411,15 +411,7 @@ static void scic_sds_phy_suspend(
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);
} }
/** void scic_sds_phy_resume(struct scic_sds_phy *sci_phy)
*
* @sci_phy: The phy object to resume.
*
* This function will perform the register reads/writes required to resume the
* SCU hardware protocol engine. none
*/
void scic_sds_phy_resume(
struct scic_sds_phy *sci_phy)
{ {
u32 scu_sas_pcfg_value; u32 scu_sas_pcfg_value;
...@@ -430,47 +422,22 @@ void scic_sds_phy_resume( ...@@ -430,47 +422,22 @@ void scic_sds_phy_resume(
&sci_phy->link_layer_registers->phy_configuration); &sci_phy->link_layer_registers->phy_configuration);
} }
/** void scic_sds_phy_get_sas_address(struct scic_sds_phy *sci_phy,
* This method returns the local sas address assigned to this phy.
* @sci_phy: This parameter specifies the phy for which to retrieve the local
* SAS address.
* @sas_address: This parameter specifies the location into which to copy the
* local SAS address.
*
*/
void scic_sds_phy_get_sas_address(
struct scic_sds_phy *sci_phy,
struct sci_sas_address *sas_address) struct sci_sas_address *sas_address)
{ {
sas_address->high = readl(&sci_phy->link_layer_registers->source_sas_address_high); sas_address->high = readl(&sci_phy->link_layer_registers->source_sas_address_high);
sas_address->low = readl(&sci_phy->link_layer_registers->source_sas_address_low); sas_address->low = readl(&sci_phy->link_layer_registers->source_sas_address_low);
} }
/** void scic_sds_phy_get_attached_sas_address(struct scic_sds_phy *sci_phy,
* This method returns the remote end-point (i.e. attached) sas address
* assigned to this phy.
* @sci_phy: This parameter specifies the phy for which to retrieve the remote
* end-point SAS address.
* @sas_address: This parameter specifies the location into which to copy the
* remote end-point SAS address.
*
*/
void scic_sds_phy_get_attached_sas_address(
struct scic_sds_phy *sci_phy,
struct sci_sas_address *sas_address) struct sci_sas_address *sas_address)
{ {
sas_address->high struct sas_identify_frame *iaf;
= sci_phy->phy_type.sas.identify_address_frame_buffer.sas_address.high;
sas_address->low iaf = &sci_phy->phy_type.sas.identify_address_frame_buffer;
= sci_phy->phy_type.sas.identify_address_frame_buffer.sas_address.low; memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE);
} }
/**
* This method returns the supported protocols assigned to this phy
* @sci_phy:
*
*
*/
void scic_sds_phy_get_protocols( void scic_sds_phy_get_protocols(
struct scic_sds_phy *sci_phy, struct scic_sds_phy *sci_phy,
struct sci_sas_identify_address_frame_protocols *protocols) struct sci_sas_identify_address_frame_protocols *protocols)
...@@ -481,17 +448,6 @@ void scic_sds_phy_get_protocols( ...@@ -481,17 +448,6 @@ void scic_sds_phy_get_protocols(
0x0000FFFF); 0x0000FFFF);
} }
/**
*
* @sci_phy: The parameter is the phy object for which the attached phy
* protcols are to be returned.
*
* This method returns the supported protocols for the attached phy. If this
* is a SAS phy the protocols are returned from the identify address frame. If
* this is a SATA phy then protocols are made up and the target phy is an STP
* target phy. The caller will get the entire set of bits for the protocol
* value.
*/
void scic_sds_phy_get_attached_phy_protocols( void scic_sds_phy_get_attached_phy_protocols(
struct scic_sds_phy *sci_phy, struct scic_sds_phy *sci_phy,
struct sci_sas_identify_address_frame_protocols *protocols) struct sci_sas_identify_address_frame_protocols *protocols)
...@@ -499,8 +455,10 @@ void scic_sds_phy_get_attached_phy_protocols( ...@@ -499,8 +455,10 @@ void scic_sds_phy_get_attached_phy_protocols(
protocols->u.all = 0; protocols->u.all = 0;
if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) {
protocols->u.all = struct sas_identify_frame *iaf;
sci_phy->phy_type.sas.identify_address_frame_buffer.protocols.u.all;
iaf = &sci_phy->phy_type.sas.identify_address_frame_buffer;
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; protocols->u.bits.stp_target = 1;
} }
...@@ -599,11 +557,9 @@ enum sci_status scic_sas_phy_get_properties( ...@@ -599,11 +557,9 @@ enum sci_status scic_sas_phy_get_properties(
struct scic_sas_phy_properties *properties) struct scic_sas_phy_properties *properties)
{ {
if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) {
memcpy( memcpy(&properties->rcvd_iaf,
&properties->received_iaf,
&sci_phy->phy_type.sas.identify_address_frame_buffer, &sci_phy->phy_type.sas.identify_address_frame_buffer,
sizeof(struct sci_sas_identify_address_frame) sizeof(struct sas_identify_frame));
);
properties->received_capabilities.u.all = properties->received_capabilities.u.all =
readl(&sci_phy->link_layer_registers->receive_phycap); readl(&sci_phy->link_layer_registers->receive_phycap);
...@@ -1203,7 +1159,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler ...@@ -1203,7 +1159,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler
{ {
enum sci_status result; enum sci_status result;
u32 *frame_words; u32 *frame_words;
struct sci_sas_identify_address_frame *identify_frame; struct sas_identify_frame *identify_frame;
result = scic_sds_unsolicited_frame_control_get_header( result = scic_sds_unsolicited_frame_control_get_header(
&(scic_sds_phy_get_controller(sci_phy)->uf_control), &(scic_sds_phy_get_controller(sci_phy)->uf_control),
...@@ -1215,9 +1171,9 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler ...@@ -1215,9 +1171,9 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler
} }
frame_words[0] = SCIC_SWAP_DWORD(frame_words[0]); frame_words[0] = SCIC_SWAP_DWORD(frame_words[0]);
identify_frame = (struct sci_sas_identify_address_frame *)frame_words; identify_frame = (struct sas_identify_frame *)frame_words;
if (identify_frame->address_frame_type == 0) { if (identify_frame->frame_type == 0) {
u32 state; u32 state;
/* Byte swap the rest of the frame so we can make /* Byte swap the rest of the frame so we can make
...@@ -1231,9 +1187,9 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler ...@@ -1231,9 +1187,9 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler
memcpy(&sci_phy->phy_type.sas.identify_address_frame_buffer, memcpy(&sci_phy->phy_type.sas.identify_address_frame_buffer,
identify_frame, identify_frame,
sizeof(struct sci_sas_identify_address_frame)); sizeof(struct sas_identify_frame));
if (identify_frame->protocols.u.bits.smp_target) { if (identify_frame->smp_tport) {
/* We got the IAF for an expander PHY go to the final state since /* We got the IAF for an expander PHY go to the final state since
* there are no power requirements for expander phys. * there are no power requirements for expander phys.
*/ */
......
...@@ -274,7 +274,7 @@ struct scic_sds_phy { ...@@ -274,7 +274,7 @@ struct scic_sds_phy {
union { union {
struct { struct {
struct sci_sas_identify_address_frame identify_address_frame_buffer; struct sas_identify_frame identify_address_frame_buffer;
} sas; } sas;
......
...@@ -80,7 +80,7 @@ struct isci_phy { ...@@ -80,7 +80,7 @@ struct isci_phy {
u8 sas_addr[SAS_ADDR_SIZE]; u8 sas_addr[SAS_ADDR_SIZE];
union { union {
u8 aif[sizeof(struct sci_sas_identify_address_frame)]; struct sas_identify_frame iaf;
struct dev_to_host_fis fis; struct dev_to_host_fis fis;
} frame_rcvd; } frame_rcvd;
}; };
......
...@@ -236,18 +236,12 @@ void isci_port_link_up( ...@@ -236,18 +236,12 @@ void isci_port_link_up(
BUG_ON(call_status != SCI_SUCCESS); BUG_ON(call_status != SCI_SUCCESS);
memcpy(isci_phy->frame_rcvd.aif, isci_phy->frame_rcvd.iaf = sas_phy_properties.rcvd_iaf;
&(sas_phy_properties.received_iaf), isci_phy->sas_phy.frame_rcvd_size = sizeof(struct sas_identify_frame);
sizeof(struct sci_sas_identify_address_frame));
isci_phy->sas_phy.frame_rcvd_size
= sizeof(struct sci_sas_identify_address_frame);
/* Copy the attached SAS address from the IAF */ /* Copy the attached SAS address from the IAF */
memcpy(isci_phy->sas_phy.attached_sas_addr, memcpy(isci_phy->sas_phy.attached_sas_addr,
((struct sas_identify_frame *) isci_phy->frame_rcvd.iaf.sas_addr, SAS_ADDR_SIZE);
(&isci_phy->frame_rcvd.aif))->sas_addr,
SAS_ADDR_SIZE);
} else { } else {
dev_err(&isci_host->pdev->dev, "%s: unkown target\n", __func__); dev_err(&isci_host->pdev->dev, "%s: unkown target\n", __func__);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment