isci: Converting smp_response to Linux native smp_resp
Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
2ec53eb4d5
commit
d20930a2b3
|
@ -198,184 +198,6 @@ struct sci_ssp_frame_header {
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* struct smp_response_header - This structure depicts the contents of the SAS
|
||||
* SMP DISCOVER RESPONSE frame. For specific information on each of these
|
||||
* individual fields please reference the SAS specification Link layer
|
||||
* section on address frames.
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct smp_response_header {
|
||||
u8 smp_frame_type; /* byte 0 */
|
||||
u8 function; /* byte 1 */
|
||||
u8 function_result; /* byte 2 */
|
||||
u8 response_length; /* byte 3 */
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* struct smp_response_report_general - This structure depicts the SMP Report
|
||||
* General for expander devices. It adheres to the SAS-2.1 specification.
|
||||
*
|
||||
* For specific information on each of these individual fields please reference
|
||||
* the SAS specification Application layer section on SMP.
|
||||
*/
|
||||
struct smp_response_report_general {
|
||||
u16 expander_change_count; /* byte 4-5 */
|
||||
u16 expander_route_indexes; /* byte 6-7 */
|
||||
|
||||
u32 reserved_byte8:7; /* byte 8 bit 0-6 */
|
||||
u32 long_response:1; /* byte 8 bit 7 */
|
||||
|
||||
u32 number_of_phys:8; /* byte 9 */
|
||||
|
||||
u32 configurable_route_table:1; /* byte 10 */
|
||||
u32 configuring:1;
|
||||
u32 configures_others:1;
|
||||
u32 open_reject_retry_supported:1;
|
||||
u32 stp_continue_awt:1;
|
||||
u32 self_configuring:1;
|
||||
u32 zone_configuring:1;
|
||||
u32 table_to_table_supported:1;
|
||||
|
||||
u32 reserved_byte11:8; /* byte 11 */
|
||||
|
||||
u32 enclosure_logical_identifier_high; /* byte 12-15 */
|
||||
u32 enclosure_logical_identifier_low; /* byte 16-19 */
|
||||
|
||||
u32 reserved_byte20_23;
|
||||
u32 reserved_byte24_27;
|
||||
|
||||
};
|
||||
|
||||
struct smp_response_report_general_long {
|
||||
struct smp_response_report_general sas1_1;
|
||||
|
||||
struct {
|
||||
u16 reserved1;
|
||||
u16 stp_bus_inactivity_time_limit;
|
||||
u16 stp_max_connect_time_limit;
|
||||
u16 stp_smp_i_t_nexus_loss_time;
|
||||
|
||||
u32 zoning_enabled:1;
|
||||
u32 zoning_supported:1;
|
||||
u32 physicaL_presence_asserted:1;
|
||||
u32 zone_locked:1;
|
||||
u32 reserved2:1;
|
||||
u32 num_zone_groups:3;
|
||||
u32 saving_zoning_enabled_supported:3;
|
||||
u32 saving_zone_perms_table_supported:1;
|
||||
u32 saving_zone_phy_info_supported:1;
|
||||
u32 saving_zone_manager_password_supported:1;
|
||||
u32 saving:1;
|
||||
u32 reserved3:1;
|
||||
u32 max_number_routed_sas_addresses:16;
|
||||
|
||||
struct sci_sas_address active_zone_manager_sas_address;
|
||||
|
||||
u16 zone_lock_inactivity_time_limit;
|
||||
u16 reserved4;
|
||||
|
||||
u8 reserved5;
|
||||
u8 first_enclosure_connector_element_index;
|
||||
u8 number_of_enclosure_connector_element_indices;
|
||||
u8 reserved6;
|
||||
|
||||
u32 reserved7:7;
|
||||
u32 reduced_functionality:1;
|
||||
u32 time_to_reduce_functionality:8;
|
||||
u32 initial_time_to_reduce_functionality:8;
|
||||
u8 max_reduced_functionality_time;
|
||||
|
||||
u16 last_self_config_status_descriptor_index;
|
||||
u16 max_number_of_stored_self_config_status_descriptors;
|
||||
|
||||
u16 last_phy_event_list_descriptor_index;
|
||||
u16 max_number_of_stored_phy_event_list_descriptors;
|
||||
} sas2;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* struct smp_response_report_manufacturer_information - This structure depicts
|
||||
* the SMP report manufacturer information for expander devices. It adheres
|
||||
* to the SAS-2.1 specification.
|
||||
*
|
||||
* For specific information on each of these individual fields please reference
|
||||
* the SAS specification Application layer section on SMP.
|
||||
*/
|
||||
struct smp_response_report_manufacturer_information {
|
||||
u32 expander_change_count:16; /* bytes 4-5 */
|
||||
u32 reserved1:16;
|
||||
|
||||
u32 sas1_1_format:1;
|
||||
u32 reserved2:31;
|
||||
|
||||
u8 vendor_id[8];
|
||||
u8 product_id[16];
|
||||
u8 product_revision_level[4];
|
||||
u8 component_vendor_id[8];
|
||||
u8 component_id[2];
|
||||
u8 component_revision_level;
|
||||
u8 reserved3;
|
||||
u8 vendor_specific[8];
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* struct smp_response_report_phy_sata - This structure depicts the contents of
|
||||
* the SAS SMP REPORT PHY SATA frame. For specific information on each of
|
||||
* these individual fields please reference the SAS specification Link layer
|
||||
* section on address frames.
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct smp_response_report_phy_sata {
|
||||
u32 ignored_byte_4_7; /* bytes 4-7 */
|
||||
|
||||
u32 affiliations_valid:1;
|
||||
u32 affiliations_supported:1;
|
||||
u32 reserved_byte11:6; /* byte 11 */
|
||||
u32 ignored_byte10:8; /* byte 10 */
|
||||
u32 phy_identifier:8; /* byte 9 */
|
||||
u32 reserved_byte_8:8; /* byte 8 */
|
||||
|
||||
u32 reserved_12_15;
|
||||
u32 stp_sas_address[2];
|
||||
u8 device_to_host_fis[20];
|
||||
u32 reserved_44_47;
|
||||
u32 affiliated_stp_initiator_sas_address[2];
|
||||
|
||||
};
|
||||
|
||||
#define SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH 1016
|
||||
struct smp_response_vendor_specific {
|
||||
u8 response_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
|
||||
};
|
||||
|
||||
union smp_response_body {
|
||||
struct smp_response_report_general report_general;
|
||||
struct smp_response_report_manufacturer_information report_manufacturer_information;
|
||||
struct smp_response_report_phy_sata report_phy_sata;
|
||||
struct smp_response_vendor_specific vendor_specific_response;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct smp_response - This structure simply unionizes the existing response
|
||||
* structures into a common response type.
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct smp_response {
|
||||
struct smp_response_header header;
|
||||
|
||||
union smp_response_body response;
|
||||
|
||||
};
|
||||
|
||||
#define SMP_FRAME_TYPE_REQUEST 0x40
|
||||
#define SMP_FRAME_TYPE_RESPONSE 0x41
|
||||
|
||||
#define PHY_OPERATION_NOP 0x00
|
||||
#define PHY_OPERATION_LINK_RESET 0x01
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <scsi/sas.h>
|
||||
#include "sas.h"
|
||||
#include "intel_sas.h"
|
||||
#include "sci_base_state_machine.h"
|
||||
|
@ -79,7 +80,7 @@ u32 scic_sds_smp_request_get_object_size(void)
|
|||
{
|
||||
return sizeof(struct scic_sds_request)
|
||||
+ sizeof(struct smp_req)
|
||||
+ sizeof(struct smp_response)
|
||||
+ sizeof(struct smp_resp)
|
||||
+ sizeof(struct scu_task_context)
|
||||
+ SMP_CACHE_BYTES;
|
||||
}
|
||||
|
@ -111,7 +112,7 @@ u32 scic_sds_smp_request_get_object_size(void)
|
|||
#define scic_sds_smp_request_get_task_context_buffer(memory) \
|
||||
((struct scu_task_context *)(\
|
||||
((char *)(scic_sds_smp_request_get_response_buffer(memory))) \
|
||||
+ sizeof(struct smp_response) \
|
||||
+ sizeof(struct smp_resp) \
|
||||
))
|
||||
|
||||
|
||||
|
@ -271,8 +272,8 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req,
|
|||
task_context->response_iu_lower = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method processes an unsolicited frame while the SMP request is waiting
|
||||
/*
|
||||
* This function processes an unsolicited frame while the SMP request is waiting
|
||||
* for a response frame. It will copy the response data, release the
|
||||
* unsolicited frame, and transition the request to the
|
||||
* SCI_BASE_REQUEST_STATE_COMPLETED state.
|
||||
|
@ -281,63 +282,52 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req,
|
|||
* @frame_index: This parameter indicates the unsolicited frame index that
|
||||
* should contain the response.
|
||||
*
|
||||
* This method returns an indication of whether the response frame was handled
|
||||
* This function returns an indication of whether the response frame was handled
|
||||
* successfully or not. SCI_SUCCESS Currently this value is always returned and
|
||||
* indicates successful processing of the TC response.
|
||||
*/
|
||||
static enum sci_status scic_sds_smp_request_await_response_frame_handler(
|
||||
struct scic_sds_request *sci_req,
|
||||
u32 frame_index)
|
||||
static enum sci_status
|
||||
scic_sds_smp_request_await_response_frame_handler(
|
||||
struct scic_sds_request *sci_req,
|
||||
u32 frame_index)
|
||||
{
|
||||
enum sci_status status;
|
||||
void *frame_header;
|
||||
struct smp_response_header *rsp_hdr;
|
||||
u8 *user_smp_buffer = sci_req->response_buffer;
|
||||
struct smp_resp *rsp_hdr;
|
||||
u8 *usr_smp_buf = sci_req->response_buffer;
|
||||
|
||||
status = scic_sds_unsolicited_frame_control_get_header(
|
||||
&(scic_sds_request_get_controller(sci_req)->uf_control),
|
||||
frame_index,
|
||||
&frame_header
|
||||
);
|
||||
&frame_header);
|
||||
|
||||
/* byte swap the header. */
|
||||
scic_word_copy_with_swap(
|
||||
(u32 *)user_smp_buffer,
|
||||
frame_header,
|
||||
sizeof(struct smp_response_header) / sizeof(u32)
|
||||
);
|
||||
rsp_hdr = (struct smp_response_header *)user_smp_buffer;
|
||||
scic_word_copy_with_swap((u32 *)usr_smp_buf,
|
||||
frame_header,
|
||||
SMP_RESP_HDR_SZ / sizeof(u32));
|
||||
|
||||
if (rsp_hdr->smp_frame_type == SMP_FRAME_TYPE_RESPONSE) {
|
||||
void *smp_response_buffer;
|
||||
rsp_hdr = (struct smp_resp *)usr_smp_buf;
|
||||
|
||||
if (rsp_hdr->frame_type == SMP_RESPONSE) {
|
||||
void *smp_resp;
|
||||
|
||||
status = scic_sds_unsolicited_frame_control_get_buffer(
|
||||
&(scic_sds_request_get_controller(sci_req)->uf_control),
|
||||
frame_index,
|
||||
&smp_response_buffer
|
||||
);
|
||||
&smp_resp);
|
||||
|
||||
scic_word_copy_with_swap(
|
||||
(u32 *)(user_smp_buffer + sizeof(struct smp_response_header)),
|
||||
smp_response_buffer,
|
||||
sizeof(union smp_response_body) / sizeof(u32)
|
||||
);
|
||||
/*
|
||||
* Don't need to copy to user space. User instead will refer to
|
||||
* core request's response buffer. */
|
||||
|
||||
/*
|
||||
* copy the smp response to framework smp request's response buffer.
|
||||
* scic_sds_smp_request_copy_response(sci_req); */
|
||||
(u32 *)(usr_smp_buf + SMP_RESP_HDR_SZ),
|
||||
smp_resp,
|
||||
(sizeof(struct smp_req) - SMP_RESP_HDR_SZ) /
|
||||
sizeof(u32));
|
||||
|
||||
scic_sds_request_set_status(
|
||||
sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
|
||||
);
|
||||
sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS);
|
||||
|
||||
sci_base_state_machine_change_state(
|
||||
&sci_req->started_substate_machine,
|
||||
SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION
|
||||
);
|
||||
SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION);
|
||||
} else {
|
||||
/* This was not a response frame why did it get forwarded? */
|
||||
dev_err(scic_to_dev(sci_req->owning_controller),
|
||||
|
@ -346,23 +336,20 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler(
|
|||
__func__,
|
||||
sci_req,
|
||||
frame_index,
|
||||
rsp_hdr->smp_frame_type);
|
||||
rsp_hdr->frame_type);
|
||||
|
||||
scic_sds_request_set_status(
|
||||
sci_req,
|
||||
SCU_TASK_DONE_SMP_FRM_TYPE_ERR,
|
||||
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
|
||||
);
|
||||
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR);
|
||||
|
||||
sci_base_state_machine_change_state(
|
||||
&sci_req->state_machine,
|
||||
SCI_BASE_REQUEST_STATE_COMPLETED
|
||||
);
|
||||
SCI_BASE_REQUEST_STATE_COMPLETED);
|
||||
}
|
||||
|
||||
scic_sds_controller_release_frame(
|
||||
sci_req->owning_controller, frame_index
|
||||
);
|
||||
scic_sds_controller_release_frame(sci_req->owning_controller,
|
||||
frame_index);
|
||||
|
||||
return SCI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -213,4 +213,6 @@ struct smp_req {
|
|||
};
|
||||
} __packed;
|
||||
|
||||
#define SMP_RESP_HDR_SZ 4
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue