Commit e76d6180 authored by Dave Jiang's avatar Dave Jiang Committed by Dan Williams

isci: Convert ATA defines to Linux native defines

* Removing all intel_sata and intel_ata defines
* Removing the usage of SAT_PROTOCOL_*. We can get everything from sas_task
* Moved SATA FIS types to local sas.h. These defines will have to go
  into include/scsi/sas.h eventually.
* Added offsets for SATA FIS header in order to grab the values
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent f2f30080
This diff is collapsed.
...@@ -62,8 +62,7 @@ ...@@ -62,8 +62,7 @@
* *
* *
*/ */
#include <linux/kernel.h>
#include "intel_sata.h"
#include "intel_scsi.h" #include "intel_scsi.h"
/** /**
......
/*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* BSD LICENSE
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SATA_H_
#define _SATA_H_
#include <linux/types.h>
/**
* This file defines all of the SATA releated constants, enumerations, and
* types. Please note that this file does not necessarily contain an
* exhaustive list of all contants and commands.
*
*
*/
/**
*
*
* SATA FIS Types These constants depict the various SATA FIS types devined in
* the serial ATA specification.
*/
#define SATA_FIS_TYPE_REGH2D 0x27
#define SATA_FIS_TYPE_REGD2H 0x34
#define SATA_FIS_TYPE_SETDEVBITS 0xA1
#define SATA_FIS_TYPE_DMA_ACTIVATE 0x39
#define SATA_FIS_TYPE_DMA_SETUP 0x41
#define SATA_FIS_TYPE_BIST_ACTIVATE 0x58
#define SATA_FIS_TYPE_PIO_SETUP 0x5F
#define SATA_FIS_TYPE_DATA 0x46
#define SATA_REGISTER_FIS_SIZE 0x20
/**
* struct sata_fis_header - This is the common definition for a SATA FIS Header
* word. A different header word is defined for any FIS type that does not
* use the standard header.
*
*
*/
struct sata_fis_header {
u32 fis_type:8; /* word 0 */
u32 pm_port:4;
u32 reserved:1;
u32 direction_flag:1; /* direction */
u32 interrupt_flag:1;
u32 command_flag:1; /* command, auto_activate, or notification */
u32 status:8;
u32 error:8;
};
/**
*
*
* Status field bit definitions
*/
#define SATA_FIS_STATUS_DEVBITS_MASK (0x77)
/**
* struct sata_fis_set_dev_bits - SATA Set Device Bits FIS
*
*
*/
struct sata_fis_set_dev_bits {
u32 fis_type:8; /* word 0 */
u32 pm_port:4;
u32 reserved0:2;
u32 irq:1;
u32 notification:1;
u32 status_low:4;
u32 status_high:4;
u32 error:8;
u32 s_active; /* word 1 */
};
/**
* struct sata_fis_dma_activate - SATA DMA Activate FIS
*
*
*/
struct sata_fis_dma_activate {
u32 fis_type:8; /* word 0 */
u32 pm_port:4;
u32 reserved0:24;
};
/**
*
*
* The lower 5 bits in the DMA Buffer ID Low field of the DMA Setup are used to
* communicate the command tag.
*/
#define SATA_DMA_SETUP_TAG_ENABLE 0x1F
#define SATA_DMA_SETUP_AUTO_ACT_ENABLE 0x80
/**
* struct sata_fis_dma_setup - SATA DMA Setup FIS
*
*
*/
struct sata_fis_dma_setup {
u32 fis_type:8; /* word 0 */
u32 pm_port:4;
u32 reserved_00:1;
u32 direction:1;
u32 irq:1;
u32 auto_activate:1;
u32 reserved_01:16;
u32 dma_buffer_id_low; /* word 1 */
u32 dma_buffer_id_high; /* word 2 */
u32 reserved0; /* word 3 */
u32 dma_buffer_offset; /* word 4 */
u32 dma_transfer_count; /* word 5 */
u32 reserved1; /* word 6 */
};
/**
* struct sata_fis_bist_activate - SATA BIST Activate FIS
*
*
*/
struct sata_fis_bist_activate {
u32 fis_type:8; /* word 0 */
u32 reserved0:8;
u32 pattern_definition:8;
u32 reserved1:8;
u32 data1; /* word 1 */
u32 data2; /* word 1 */
};
/*
* SATA PIO Setup FIS
*/
struct sata_fis_pio_setup {
u32 fis_type:8; /* word 0 */
u32 pm_port:4;
u32 reserved_00:1;
u32 direction:1;
u32 irq:1;
u32 reserved_01:1;
u32 status:8;
u32 error: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 reserved:8;
u32 sector_count:8; /* word 3 */
u32 sector_count_exp:8;
u32 reserved1:8;
u32 ending_status:8;
u32 transfter_count:16; /* word 4 */
u32 reserved3:16;
};
/**
* struct sata_fis_data - SATA Data FIS
*
*
*/
struct sata_fis_data {
u32 fis_type:8; /* word 0 */
u32 pm_port:4;
u32 reserved0:24;
u8 data[4]; /* word 1 */
};
#endif /* _SATA_H_ */
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include <scsi/sas.h> #include <scsi/sas.h>
#include <scsi/libsas.h> #include <scsi/libsas.h>
#include "sci_status.h" #include "sci_status.h"
#include "intel_sata.h"
#include "intel_sas.h" #include "intel_sas.h"
struct scic_sds_phy; struct scic_sds_phy;
......
...@@ -54,8 +54,7 @@ ...@@ -54,8 +54,7 @@
*/ */
#include <scsi/sas.h> #include <scsi/sas.h>
#include "intel_ata.h" #include "sas.h"
#include "intel_sata.h"
#include "sci_base_state.h" #include "sci_base_state.h"
#include "sci_base_state_machine.h" #include "sci_base_state_machine.h"
#include "scic_phy.h" #include "scic_phy.h"
...@@ -1279,23 +1278,19 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle ...@@ -1279,23 +1278,19 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle
u32 frame_index) u32 frame_index)
{ {
enum sci_status result; enum sci_status result;
u32 *frame_words; struct dev_to_host_fis *frame_header;
struct sata_fis_header *fis_frame_header;
u32 *fis_frame_data; u32 *fis_frame_data;
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),
frame_index, frame_index,
(void **)&frame_words); (void **)&frame_header);
if (result != SCI_SUCCESS) { if (result != SCI_SUCCESS)
return result; return result;
}
fis_frame_header = (struct sata_fis_header *)frame_words;
if ((fis_frame_header->fis_type == SATA_FIS_TYPE_REGD2H) && if ((frame_header->fis_type == FIS_REGD2H) &&
!(fis_frame_header->status & ATA_STATUS_REG_BSY_BIT)) { !(frame_header->status & ATA_BUSY)) {
scic_sds_unsolicited_frame_control_get_buffer( scic_sds_unsolicited_frame_control_get_buffer(
&(scic_sds_phy_get_controller(sci_phy)->uf_control), &(scic_sds_phy_get_controller(sci_phy)->uf_control),
frame_index, frame_index,
...@@ -1303,10 +1298,10 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle ...@@ -1303,10 +1298,10 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle
scic_sds_controller_copy_sata_response( scic_sds_controller_copy_sata_response(
&sci_phy->phy_type.sata.signature_fis_buffer, &sci_phy->phy_type.sata.signature_fis_buffer,
frame_words, frame_header,
fis_frame_data); fis_frame_data);
/* We got the IAF we can now go to the await spinup semaphore state */ /* got IAF we can now go to the await spinup semaphore state */
sci_base_state_machine_change_state(&sci_phy->starting_substate_machine, sci_base_state_machine_change_state(&sci_phy->starting_substate_machine,
SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL); SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL);
...@@ -1318,7 +1313,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle ...@@ -1318,7 +1313,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle
__func__, __func__,
frame_index); frame_index);
/* Regardless of the result release this frame since we are done with it */ /* Regardless of the result we are done with this frame with it */
scic_sds_controller_release_frame(scic_sds_phy_get_controller(sci_phy), scic_sds_controller_release_frame(scic_sds_phy_get_controller(sci_phy),
frame_index); frame_index);
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#ifndef _SCIC_SDS_PHY_H_ #ifndef _SCIC_SDS_PHY_H_
#define _SCIC_SDS_PHY_H_ #define _SCIC_SDS_PHY_H_
#include "intel_sata.h"
#include "intel_sas.h" #include "intel_sas.h"
#include "scu_registers.h" #include "scu_registers.h"
#include "sci_base_state_machine.h" #include "sci_base_state_machine.h"
......
...@@ -55,8 +55,6 @@ ...@@ -55,8 +55,6 @@
#include <scsi/sas.h> #include <scsi/sas.h>
#include "intel_sas.h" #include "intel_sas.h"
#include "intel_sata.h"
#include "intel_sat.h"
#include "scic_controller.h" #include "scic_controller.h"
#include "scic_io_request.h" #include "scic_io_request.h"
#include "scic_sds_controller.h" #include "scic_sds_controller.h"
...@@ -631,51 +629,55 @@ static void scu_ssp_task_request_construct_task_context( ...@@ -631,51 +629,55 @@ static void scu_ssp_task_request_construct_task_context(
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_io_request_construct_sata(struct scic_sds_request *sci_req, static enum sci_status
u8 proto, u32 len, scic_io_request_construct_sata(struct scic_sds_request *sci_req,
enum dma_data_direction dir, u32 len,
bool copy) enum dma_data_direction dir,
bool copy)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
struct isci_request *ireq = sci_req->ireq;
struct sas_task *task = isci_request_access_task(ireq);
/* check for management protocols */
if (ireq->ttype == tmf_task) {
struct isci_tmf *tmf = isci_request_access_tmf(ireq);
if (tmf->tmf_code == isci_tmf_sata_srst_high ||
tmf->tmf_code == isci_tmf_sata_srst_low)
return scic_sds_stp_soft_reset_request_construct(sci_req);
else {
dev_err(scic_to_dev(sci_req->owning_controller),
"%s: Request 0x%p received un-handled SAT "
"management protocol 0x%x.\n",
__func__, sci_req, tmf->tmf_code);
return SCI_FAILURE;
}
}
switch (proto) { if (!sas_protocol_ata(task->task_proto)) {
case SAT_PROTOCOL_PIO_DATA_IN: dev_err(scic_to_dev(sci_req->owning_controller),
case SAT_PROTOCOL_PIO_DATA_OUT: "%s: Non-ATA protocol in SATA path: 0x%x\n",
status = scic_sds_stp_pio_request_construct(sci_req, proto, copy); __func__,
break; task->task_proto);
return SCI_FAILURE;
case SAT_PROTOCOL_UDMA_DATA_IN:
case SAT_PROTOCOL_UDMA_DATA_OUT:
status = scic_sds_stp_udma_request_construct(sci_req, len, dir);
break;
case SAT_PROTOCOL_ATA_HARD_RESET: }
case SAT_PROTOCOL_SOFT_RESET:
status = scic_sds_stp_soft_reset_request_construct(sci_req);
break;
case SAT_PROTOCOL_NON_DATA: /* non data */
status = scic_sds_stp_non_data_request_construct(sci_req); if (task->data_dir == DMA_NONE)
break; return scic_sds_stp_non_data_request_construct(sci_req);
case SAT_PROTOCOL_FPDMA: /* NCQ */
status = scic_sds_stp_ncq_request_construct(sci_req, len, dir); if (task->ata_task.use_ncq)
break; return scic_sds_stp_ncq_request_construct(sci_req, len, dir);
case SAT_PROTOCOL_DMA_QUEUED: /* DMA */
case SAT_PROTOCOL_DMA: if (task->ata_task.dma_xfer)
case SAT_PROTOCOL_DEVICE_DIAGNOSTIC: return scic_sds_stp_udma_request_construct(sci_req, len, dir);
case SAT_PROTOCOL_DEVICE_RESET: else /* PIO */
case SAT_PROTOCOL_RETURN_RESPONSE_INFO: return scic_sds_stp_pio_request_construct(sci_req, copy);
default:
dev_err(scic_to_dev(sci_req->owning_controller),
"%s: SCIC IO Request 0x%p received un-handled "
"SAT Protocl %d.\n",
__func__, sci_req, proto);
status = SCI_FAILURE;
break;
}
return status; return status;
} }
...@@ -735,7 +737,6 @@ enum sci_status scic_io_request_construct_basic_sata( ...@@ -735,7 +737,6 @@ enum sci_status scic_io_request_construct_basic_sata(
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_stp_request *stp_req; struct scic_sds_stp_request *stp_req;
u8 proto;
u32 len; u32 len;
enum dma_data_direction dir; enum dma_data_direction dir;
bool copy = false; bool copy = false;
...@@ -748,10 +749,9 @@ enum sci_status scic_io_request_construct_basic_sata( ...@@ -748,10 +749,9 @@ enum sci_status scic_io_request_construct_basic_sata(
len = isci_request_io_request_get_transfer_length(isci_request); len = isci_request_io_request_get_transfer_length(isci_request);
dir = isci_request_io_request_get_data_direction(isci_request); dir = isci_request_io_request_get_data_direction(isci_request);
proto = isci_sata_get_sat_protocol(isci_request);
copy = (task->data_dir == DMA_NONE) ? false : true; copy = (task->data_dir == DMA_NONE) ? false : true;
status = scic_io_request_construct_sata(sci_req, proto, len, dir, copy); status = scic_io_request_construct_sata(sci_req, len, dir, copy);
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
sci_base_state_machine_change_state(&sci_req->state_machine, sci_base_state_machine_change_state(&sci_req->state_machine,
...@@ -764,33 +764,30 @@ enum sci_status scic_io_request_construct_basic_sata( ...@@ -764,33 +764,30 @@ enum sci_status scic_io_request_construct_basic_sata(
enum sci_status scic_task_request_construct_sata( enum sci_status scic_task_request_construct_sata(
struct scic_sds_request *sci_req) struct scic_sds_request *sci_req)
{ {
enum sci_status status; enum sci_status status = SCI_SUCCESS;
u8 sat_protocol; struct isci_request *ireq = sci_req->ireq;
struct isci_request *isci_request = sci_req->ireq;
sat_protocol = isci_sata_get_sat_protocol(isci_request);
switch (sat_protocol) { /* check for management protocols */
case SAT_PROTOCOL_ATA_HARD_RESET: if (ireq->ttype == tmf_task) {
case SAT_PROTOCOL_SOFT_RESET: struct isci_tmf *tmf = isci_request_access_tmf(ireq);
status = scic_sds_stp_soft_reset_request_construct(sci_req);
break;
default: if (tmf->tmf_code == isci_tmf_sata_srst_high ||
dev_err(scic_to_dev(sci_req->owning_controller), tmf->tmf_code == isci_tmf_sata_srst_low) {
"%s: SCIC IO Request 0x%p received un-handled SAT " status = scic_sds_stp_soft_reset_request_construct(sci_req);
"Protocl %d.\n", } else {
__func__, dev_err(scic_to_dev(sci_req->owning_controller),
sci_req, "%s: Request 0x%p received un-handled SAT "
sat_protocol); "Protocol 0x%x.\n",
__func__, sci_req, tmf->tmf_code);
status = SCI_FAILURE; return SCI_FAILURE;
break; }
} }
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
sci_base_state_machine_change_state(&sci_req->state_machine, sci_base_state_machine_change_state(
SCI_BASE_REQUEST_STATE_CONSTRUCTED); &sci_req->state_machine,
SCI_BASE_REQUEST_STATE_CONSTRUCTED);
return status; return status;
} }
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#define _SCIC_SDS_STP_REQUEST_T_ #define _SCIC_SDS_STP_REQUEST_T_
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include "intel_sata.h" #include <scsi/sas.h>
#include "scic_sds_request.h" #include "scic_sds_request.h"
/** /**
...@@ -111,11 +111,6 @@ struct scic_sds_stp_request { ...@@ -111,11 +111,6 @@ struct scic_sds_stp_request {
*/ */
u8 ending_error; u8 ending_error;
/**
* Protocol Type. This is filled in by core during IO Request construction type.
*/
u8 sat_protocol;
struct scic_sds_request_pio_sgl { struct scic_sds_request_pio_sgl {
struct scu_sgl_element_pair *sgl_pair; struct scu_sgl_element_pair *sgl_pair;
u8 sgl_set; u8 sgl_set;
...@@ -173,7 +168,6 @@ u32 scic_sds_stp_request_get_object_size(void); ...@@ -173,7 +168,6 @@ u32 scic_sds_stp_request_get_object_size(void);
enum sci_status scic_sds_stp_pio_request_construct( enum sci_status scic_sds_stp_pio_request_construct(
struct scic_sds_request *scic_io_request, struct scic_sds_request *scic_io_request,
u8 sat_protocol,
bool copy_rx_frame); bool copy_rx_frame);
enum sci_status scic_sds_stp_udma_request_construct( enum sci_status scic_sds_stp_udma_request_construct(
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "intel_sas.h" #include "intel_sas.h"
#include "intel_ata.h" #include "sas.h"
#include "isci.h" #include "isci.h"
#include "port.h" #include "port.h"
#include "remote_device.h" #include "remote_device.h"
...@@ -327,7 +327,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi ...@@ -327,7 +327,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi
break; break;
} }
case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: { case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: {
struct sata_fis_header *hdr; struct dev_to_host_fis *hdr;
status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control,
frame_index, frame_index,
...@@ -335,14 +335,14 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi ...@@ -335,14 +335,14 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
return status; return status;
if (hdr->fis_type == SATA_FIS_TYPE_SETDEVBITS && if (hdr->fis_type == FIS_SETDEVBITS &&
(hdr->status & ATA_STATUS_REG_ERROR_BIT)) { (hdr->status & ATA_ERR)) {
sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED;
/* TODO Check sactive and complete associated IO if any. */ /* TODO Check sactive and complete associated IO if any. */
sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR); sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR);
} else if (hdr->fis_type == SATA_FIS_TYPE_REGD2H && } else if (hdr->fis_type == FIS_REGD2H &&
(hdr->status & ATA_STATUS_REG_ERROR_BIT)) { (hdr->status & ATA_ERR)) {
/* /*
* Some devices return D2H FIS when an NCQ error is detected. * Some devices return D2H FIS when an NCQ error is detected.
* Treat this like an SDB error FIS ready reason. * Treat this like an SDB error FIS ready reason.
...@@ -469,6 +469,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic ...@@ -469,6 +469,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
struct sci_base_state_machine *sm = &sci_dev->state_machine; struct sci_base_state_machine *sm = &sci_dev->state_machine;
enum scic_sds_remote_device_states state = sm->current_state_id; enum scic_sds_remote_device_states state = sm->current_state_id;
struct scic_sds_port *sci_port = sci_dev->owning_port; struct scic_sds_port *sci_port = sci_dev->owning_port;
struct isci_request *ireq = sci_req->ireq;
enum sci_status status; enum sci_status status;
switch (state) { switch (state) {
...@@ -510,6 +511,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic ...@@ -510,6 +511,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
* substate. * substate.
*/ */
enum scic_sds_remote_device_states new_state; enum scic_sds_remote_device_states new_state;
struct sas_task *task = isci_request_access_task(ireq);
status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); status = scic_sds_port_start_io(sci_port, sci_dev, sci_req);
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
...@@ -523,7 +525,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic ...@@ -523,7 +525,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
break; break;
if (isci_sata_get_sat_protocol(sci_req->ireq) == SAT_PROTOCOL_FPDMA) if (task->ata_task.use_ncq)
new_state = SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ; new_state = SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ;
else { else {
sci_dev->working_request = sci_req; sci_dev->working_request = sci_req;
...@@ -532,8 +534,10 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic ...@@ -532,8 +534,10 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
sci_base_state_machine_change_state(sm, new_state); sci_base_state_machine_change_state(sm, new_state);
break; break;
} }
case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: {
if (isci_sata_get_sat_protocol(sci_req->ireq) == SAT_PROTOCOL_FPDMA) { struct sas_task *task = isci_request_access_task(ireq);
if (task->ata_task.use_ncq) {
status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); status = scic_sds_port_start_io(sci_port, sci_dev, sci_req);
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
return status; return status;
...@@ -546,6 +550,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic ...@@ -546,6 +550,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
} else } else
return SCI_FAILURE_INVALID_STATE; return SCI_FAILURE_INVALID_STATE;
break; break;
}
case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET:
return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE:
......
...@@ -53,43 +53,20 @@ ...@@ -53,43 +53,20 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _SAT_H_ #ifndef _SCI_SAS_H_
#define _SAT_H_ #define _SCI_SAS_H_
/*
/** * SATA FIS Types These constants depict the various SATA FIS types devined in
* This file contains constants and constructs defined in the SCSI to ATA * the serial ATA specification.
* Translation (SAT) T10 standard. For more information please refer to * XXX: This needs to go into <scsi/sas.h>
* www.t10.org.
*
*
*/
/**
*
*
* SAT_PROTOCOLS These constants indicate the various protocol values that can
* be supported in a SAT translator.
*/ */
#define SAT_PROTOCOL_ATA_HARD_RESET 0 #define FIS_REGH2D 0x27
#define SAT_PROTOCOL_SOFT_RESET 1 #define FIS_REGD2H 0x34
#define SAT_PROTOCOL_NON_DATA 3 #define FIS_SETDEVBITS 0xA1
#define SAT_PROTOCOL_PIO_DATA_IN 4 #define FIS_DMA_ACTIVATE 0x39
#define SAT_PROTOCOL_PIO_DATA_OUT 5 #define FIS_DMA_SETUP 0x41
#define SAT_PROTOCOL_DMA 6 #define FIS_BIST_ACTIVATE 0x58
#define SAT_PROTOCOL_DMA_QUEUED 7 #define FIS_PIO_SETUP 0x5F
#define SAT_PROTOCOL_DEVICE_DIAGNOSTIC 8 #define FIS_DATA 0x46
#define SAT_PROTOCOL_DEVICE_RESET 9
#define SAT_PROTOCOL_UDMA_DATA_IN 10
#define SAT_PROTOCOL_UDMA_DATA_OUT 11
#define SAT_PROTOCOL_FPDMA 12
#define SAT_PROTOCOL_RETURN_RESPONSE_INFO 15
#define SAT_PROTOCOL_PACKET 0x10
#define SAT_PROTOCOL_PACKET_NON_DATA (SAT_PROTOCOL_PACKET | 0x0)
#define SAT_PROTOCOL_PACKET_DMA_DATA_IN (SAT_PROTOCOL_PACKET | 0x1)
#define SAT_PROTOCOL_PACKET_DMA_DATA_OUT (SAT_PROTOCOL_PACKET | 0x2)
#define SAT_PROTOCOL_PACKET_PIO_DATA_IN (SAT_PROTOCOL_PACKET | 0x3)
#define SAT_PROTOCOL_PACKET_PIO_DATA_OUT (SAT_PROTOCOL_PACKET | 0x4)
#endif /* _SAT_H_ */
#endif
...@@ -61,11 +61,6 @@ ...@@ -61,11 +61,6 @@
#include "task.h" #include "task.h"
#include "request.h" #include "request.h"
#include "sata.h" #include "sata.h"
#include "intel_sat.h"
#include "intel_ata.h"
static u8 isci_sata_get_management_task_protocol(struct isci_tmf *tmf);
/** /**
* isci_sata_task_to_fis_copy() - This function gets the host_to_dev_fis from * isci_sata_task_to_fis_copy() - This function gets the host_to_dev_fis from
...@@ -158,7 +153,7 @@ void isci_request_process_stp_response(struct sas_task *task, ...@@ -158,7 +153,7 @@ void isci_request_process_stp_response(struct sas_task *task,
* If the device fault bit is set in the status register, then * If the device fault bit is set in the status register, then
* set the sense data and return. * set the sense data and return.
*/ */
if (d2h_reg_fis->status & ATA_STATUS_REG_DEVICE_FAULT_BIT) if (d2h_reg_fis->status & ATA_DF)
ts->stat = SAS_PROTO_RESPONSE; ts->stat = SAS_PROTO_RESPONSE;
else else
ts->stat = SAM_STAT_GOOD; ts->stat = SAM_STAT_GOOD;
...@@ -166,74 +161,6 @@ void isci_request_process_stp_response(struct sas_task *task, ...@@ -166,74 +161,6 @@ void isci_request_process_stp_response(struct sas_task *task,
ts->resp = SAS_TASK_COMPLETE; ts->resp = SAS_TASK_COMPLETE;
} }
/**
* isci_sata_get_sat_protocol() - retrieve the sat protocol for the request
* @isci_request: ata request
*
* Note: temporary implementation until expert mode removes the callback
*
*/
u8 isci_sata_get_sat_protocol(struct isci_request *isci_request)
{
struct sas_task *task;
struct domain_device *dev;
dev_dbg(&isci_request->isci_host->pdev->dev,
"%s: isci_request = %p, ttype = %d\n",
__func__, isci_request, isci_request->ttype);
if (tmf_task == isci_request->ttype) {
struct isci_tmf *tmf = isci_request_access_tmf(isci_request);
return isci_sata_get_management_task_protocol(tmf);
}
task = isci_request_access_task(isci_request);
dev = task->dev;
if (!sas_protocol_ata(task->task_proto)) {
WARN(1, "unhandled task protocol\n");
return SAT_PROTOCOL_NON_DATA;
}
if (task->data_dir == DMA_NONE)
return SAT_PROTOCOL_NON_DATA;
/* the "_IN" protocol types are equivalent to their "_OUT"
* analogs as far as the core is concerned
*/
if (dev->sata_dev.command_set == ATAPI_COMMAND_SET) {
if (task->ata_task.dma_xfer)
return SAT_PROTOCOL_PACKET_DMA_DATA_IN;
else
return SAT_PROTOCOL_PACKET_PIO_DATA_IN;
}
if (task->ata_task.use_ncq)
return SAT_PROTOCOL_FPDMA;
if (task->ata_task.dma_xfer)
return SAT_PROTOCOL_UDMA_DATA_IN;
else
return SAT_PROTOCOL_PIO_DATA_IN;
}
static u8 isci_sata_get_management_task_protocol(
struct isci_tmf *tmf)
{
u8 ret = 0;
pr_warn("tmf = %p, func = %d\n", tmf, tmf->tmf_code);
if ((tmf->tmf_code == isci_tmf_sata_srst_high) ||
(tmf->tmf_code == isci_tmf_sata_srst_low)) {
pr_warn("%s: tmf->tmf_code == TMF_LU_RESET\n", __func__);
ret = SAT_PROTOCOL_SOFT_RESET;
}
return ret;
}
enum sci_status isci_sata_management_task_request_build( enum sci_status isci_sata_management_task_request_build(
struct isci_request *isci_request) struct isci_request *isci_request)
{ {
......
...@@ -53,10 +53,6 @@ ...@@ -53,10 +53,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "intel_sat.h"
struct host_to_dev_fis *isci_sata_task_to_fis_copy( struct host_to_dev_fis *isci_sata_task_to_fis_copy(
struct sas_task *task); struct sas_task *task);
......
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