Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7b90fc3 authored by Dave Jiang's avatar Dave Jiang Committed by Dan Williams
Browse files

isci: fixup SAS iaf protocols data structure



Moved the actual data structure that's read from the phy register to phy
header.  Removed the parsing of identify address frame protocol bits as
that seemed not necessary and we can use existing information.

Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent f700ad43
Loading
Loading
Loading
Loading
+0 −27
Original line number Original line Diff line number Diff line
@@ -84,33 +84,6 @@ struct sci_sas_address {


};
};


/**
 * struct sci_sas_identify_address_frame_protocols - This structure depicts the
 *    contents of bytes 2 and 3 in 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_protocols {
	union {
		struct {
			u16 restricted1:1;
			u16 smp_initiator:1;
			u16 stp_initiator:1;
			u16 ssp_initiator:1;
			u16 reserved3:4;
			u16 restricted2:1;
			u16 smp_target:1;
			u16 stp_target:1;
			u16 ssp_target:1;
			u16 reserved4:4;
		} bits;

		u16 all;
	} u;

};

/**
/**
 * enum _SCI_SAS_TASK_ATTRIBUTE - This enumeration depicts the SAM/SAS
 * enum _SCI_SAS_TASK_ATTRIBUTE - This enumeration depicts the SAM/SAS
 *    specification defined task attribute values for a command information
 *    specification defined task attribute values for a command information
+20 −6
Original line number Original line Diff line number Diff line
@@ -103,6 +103,26 @@ struct scic_phy_cap {
	};
	};
}  __packed;
}  __packed;


/* this data structure reflects the link layer transmit identification reg */
struct scic_phy_proto {
	union {
		struct {
			u16 _r_a:1;
			u16 smp_iport:1;
			u16 stp_iport:1;
			u16 ssp_iport:1;
			u16 _r_b:4;
			u16 _r_c:1;
			u16 smp_tport:1;
			u16 stp_tport:1;
			u16 ssp_tport:1;
			u16 _r_d:4;
		};
		u16 all;
	};
} __packed;


/**
/**
 * struct scic_phy_properties - This structure defines the properties common to
 * struct scic_phy_properties - This structure defines the properties common to
 *    all phys that can be retrieved.
 *    all phys that can be retrieved.
@@ -123,17 +143,11 @@ struct scic_phy_properties {
	 */
	 */
	enum sas_linkrate negotiated_link_rate;
	enum sas_linkrate negotiated_link_rate;


	/**
	 * This field indicates the protocols supported by the phy.
	 */
	struct sci_sas_identify_address_frame_protocols protocols;

	/**
	/**
	 * This field specifies the index of the phy in relation to other
	 * This field specifies the index of the phy in relation to other
	 * phys within the controller.  This index is zero relative.
	 * phys within the controller.  This index is zero relative.
	 */
	 */
	u8 index;
	u8 index;

};
};


/**
/**
+2 −2
Original line number Original line Diff line number Diff line
@@ -57,6 +57,7 @@
#define _SCIC_PORT_H_
#define _SCIC_PORT_H_


#include "sci_status.h"
#include "sci_status.h"
#include "scic_phy.h"
#include "intel_sas.h"
#include "intel_sas.h"


struct scic_sds_port;
struct scic_sds_port;
@@ -72,8 +73,7 @@ enum scic_port_not_ready_reason_code {


struct scic_port_end_point_properties {
struct scic_port_end_point_properties {
	struct sci_sas_address sas_address;
	struct sci_sas_address sas_address;
	struct sci_sas_identify_address_frame_protocols protocols;
	struct scic_phy_proto protocols;

};
};


struct scic_port_properties {
struct scic_port_properties {
+3 −25
Original line number Original line Diff line number Diff line
@@ -442,37 +442,15 @@ void scic_sds_phy_get_attached_sas_address(struct scic_sds_phy *sci_phy,
	memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE);
	memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE);
}
}


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 scic_phy_proto *protocols)
	struct sci_sas_identify_address_frame_protocols *protocols)
{
{
	protocols->u.all =
	protocols->all =
		(u16)(readl(&sci_phy->
		(u16)(readl(&sci_phy->
			link_layer_registers->transmit_identification) &
			link_layer_registers->transmit_identification) &
				0x0000FFFF);
				0x0000FFFF);
}
}


void scic_sds_phy_get_attached_phy_protocols(
	struct scic_sds_phy *sci_phy,
	struct sci_sas_identify_address_frame_protocols *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 = &iphy->frame_rcvd.iaf;
		memcpy(&protocols->u.all, &iaf->initiator_bits, 2);
	} else if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA)
		protocols->u.bits.stp_target = 1;
}

/*
 * *****************************************************************************
 * * SCIC SDS PHY Handler Redirects
 * ***************************************************************************** */

/**
/**
 * This method will attempt to start the phy object. This request is only valid
 * This method will attempt to start the phy object. This request is only valid
 *    when the phy is in the stopped state
 *    when the phy is in the stopped state
+3 −6
Original line number Original line Diff line number Diff line
@@ -57,6 +57,7 @@
#define _SCIC_SDS_PHY_H_
#define _SCIC_SDS_PHY_H_


#include "intel_sas.h"
#include "intel_sas.h"
#include "scic_phy.h"
#include "scu_registers.h"
#include "scu_registers.h"
#include "sci_base_state_machine.h"
#include "sci_base_state_machine.h"
#include <scsi/libsas.h>
#include <scsi/libsas.h>
@@ -438,11 +439,7 @@ void scic_sds_phy_get_attached_sas_address(
	struct sci_sas_address *sas_address);
	struct sci_sas_address *sas_address);


void scic_sds_phy_get_protocols(
void scic_sds_phy_get_protocols(
	struct scic_sds_phy *this_phy,
	struct scic_sds_phy *sci_phy,
	struct sci_sas_identify_address_frame_protocols *protocols);
	struct scic_phy_proto *protocols);

void scic_sds_phy_get_attached_phy_protocols(
	struct scic_sds_phy *this_phy,
	struct sci_sas_identify_address_frame_protocols *protocols);


#endif /* _SCIC_SDS_PHY_H_ */
#endif /* _SCIC_SDS_PHY_H_ */
Loading