Commit 7392d275 authored by Dave Jiang's avatar Dave Jiang Committed by Dan Williams

isci: Removing deprecated functions

Removed all callbacks in the deprecated.c. Core will call the appropriate
functions directly.
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent a1914059
...@@ -8,7 +8,7 @@ EXTRA_CFLAGS += -DDISABLE_ATAPI ...@@ -8,7 +8,7 @@ EXTRA_CFLAGS += -DDISABLE_ATAPI
EXTRA_CFLAGS += -Idrivers/scsi/isci/core/ -Idrivers/scsi/isci/ EXTRA_CFLAGS += -Idrivers/scsi/isci/core/ -Idrivers/scsi/isci/
obj-$(CONFIG_SCSI_ISCI) += isci.o obj-$(CONFIG_SCSI_ISCI) += isci.o
isci-objs := init.o phy.o request.o sata.o \ isci-objs := init.o phy.o request.o sata.o \
remote_device.o port.o timers.o deprecated.o \ remote_device.o port.o timers.o \
host.o task.o events.o \ host.o task.o events.o \
core/scic_sds_controller.o \ core/scic_sds_controller.o \
core/scic_sds_remote_device.o \ core/scic_sds_remote_device.o \
......
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
#include "scic_sds_port.h" #include "scic_sds_port.h"
#include "scic_sds_remote_device.h" #include "scic_sds_remote_device.h"
#include "scic_sds_request.h" #include "scic_sds_request.h"
#include "scic_user_callback.h"
#include "sci_environment.h" #include "sci_environment.h"
#include "sci_util.h" #include "sci_util.h"
#include "scu_completion_codes.h" #include "scu_completion_codes.h"
...@@ -594,7 +593,7 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic) ...@@ -594,7 +593,7 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic)
/* Clear DFX Status registers */ /* Clear DFX Status registers */
scu_afe_register_write(scic, afe_dfx_master_control0, 0x0081000f); scu_afe_register_write(scic, afe_dfx_master_control0, 0x0081000f);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
/* Configure bias currents to normal */ /* Configure bias currents to normal */
if (is_a0()) if (is_a0())
...@@ -602,7 +601,7 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic) ...@@ -602,7 +601,7 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic)
else else
scu_afe_register_write(scic, afe_bias_control, 0x00005A00); scu_afe_register_write(scic, afe_bias_control, 0x00005A00);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
/* Enable PLL */ /* Enable PLL */
if (is_b0()) if (is_b0())
...@@ -610,35 +609,35 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic) ...@@ -610,35 +609,35 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic)
else else
scu_afe_register_write(scic, afe_pll_control0, 0x80040908); scu_afe_register_write(scic, afe_pll_control0, 0x80040908);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
/* Wait for the PLL to lock */ /* Wait for the PLL to lock */
do { do {
afe_status = scu_afe_register_read( afe_status = scu_afe_register_read(
scic, afe_common_block_status); scic, afe_common_block_status);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
} while ((afe_status & 0x00001000) == 0); } while ((afe_status & 0x00001000) == 0);
if (is_b0()) { if (is_b0()) {
/* Shorten SAS SNW lock time (RxLock timer value from 76 us to 50 us) */ /* Shorten SAS SNW lock time (RxLock timer value from 76 us to 50 us) */
scu_afe_register_write(scic, afe_pmsn_master_control0, 0x7bcc96ad); scu_afe_register_write(scic, afe_pmsn_master_control0, 0x7bcc96ad);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
} }
for (phy_id = 0; phy_id < SCI_MAX_PHYS; phy_id++) { for (phy_id = 0; phy_id < SCI_MAX_PHYS; phy_id++) {
if (is_b0()) { if (is_b0()) {
/* Configure transmitter SSC parameters */ /* Configure transmitter SSC parameters */
scu_afe_txreg_write(scic, phy_id, afe_tx_ssc_control, 0x00030000); scu_afe_txreg_write(scic, phy_id, afe_tx_ssc_control, 0x00030000);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
} else { } else {
/* /*
* All defaults, except the Receive Word Alignament/Comma Detect * All defaults, except the Receive Word Alignament/Comma Detect
* Enable....(0xe800) */ * Enable....(0xe800) */
scu_afe_txreg_write(scic, phy_id, afe_xcvr_control0, 0x00004512); scu_afe_txreg_write(scic, phy_id, afe_xcvr_control0, 0x00004512);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
scu_afe_txreg_write(scic, phy_id, afe_xcvr_control1, 0x0050100F); scu_afe_txreg_write(scic, phy_id, afe_xcvr_control1, 0x0050100F);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
} }
/* /*
...@@ -651,26 +650,26 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic) ...@@ -651,26 +650,26 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic)
else { else {
/* Power down TX and RX (PWRDNTX and PWRDNRX) */ /* Power down TX and RX (PWRDNTX and PWRDNRX) */
scu_afe_txreg_write(scic, phy_id, afe_channel_control, 0x000003d7); scu_afe_txreg_write(scic, phy_id, afe_channel_control, 0x000003d7);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
/* /*
* Power up TX and RX out from power down (PWRDNTX and PWRDNRX) * Power up TX and RX out from power down (PWRDNTX and PWRDNRX)
* & increase TX int & ext bias 20%....(0xe85c) */ * & increase TX int & ext bias 20%....(0xe85c) */
scu_afe_txreg_write(scic, phy_id, afe_channel_control, 0x000003d4); scu_afe_txreg_write(scic, phy_id, afe_channel_control, 0x000003d4);
} }
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
if (is_a0() || is_a2()) { if (is_a0() || is_a2()) {
/* Enable TX equalization (0xe824) */ /* Enable TX equalization (0xe824) */
scu_afe_txreg_write(scic, phy_id, afe_tx_control, 0x00040000); scu_afe_txreg_write(scic, phy_id, afe_tx_control, 0x00040000);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
} }
/* /*
* RDPI=0x0(RX Power On), RXOOBDETPDNC=0x0, TPD=0x0(TX Power On), * RDPI=0x0(RX Power On), RXOOBDETPDNC=0x0, TPD=0x0(TX Power On),
* RDD=0x0(RX Detect Enabled) ....(0xe800) */ * RDD=0x0(RX Detect Enabled) ....(0xe800) */
scu_afe_txreg_write(scic, phy_id, afe_xcvr_control0, 0x00004100); scu_afe_txreg_write(scic, phy_id, afe_xcvr_control0, 0x00004100);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
/* Leave DFE/FFE on */ /* Leave DFE/FFE on */
if (is_a0()) if (is_a0())
...@@ -679,28 +678,28 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic) ...@@ -679,28 +678,28 @@ void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic)
scu_afe_txreg_write(scic, phy_id, afe_rx_ssc_control0, 0x3F11103F); scu_afe_txreg_write(scic, phy_id, afe_rx_ssc_control0, 0x3F11103F);
else { else {
scu_afe_txreg_write(scic, phy_id, afe_rx_ssc_control0, 0x3F11103F); scu_afe_txreg_write(scic, phy_id, afe_rx_ssc_control0, 0x3F11103F);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
/* Enable TX equalization (0xe824) */ /* Enable TX equalization (0xe824) */
scu_afe_txreg_write(scic, phy_id, afe_tx_control, 0x00040000); scu_afe_txreg_write(scic, phy_id, afe_tx_control, 0x00040000);
} }
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control0, 0x000E7C03); scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control0, 0x000E7C03);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control1, 0x000E7C03); scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control1, 0x000E7C03);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control2, 0x000E7C03); scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control2, 0x000E7C03);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control3, 0x000E7C03); scu_afe_txreg_write(scic, phy_id, afe_tx_amp_control3, 0x000E7C03);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
} }
/* Transfer control to the PEs */ /* Transfer control to the PEs */
scu_afe_register_write(scic, afe_dfx_master_control0, 0x00010f00); scu_afe_register_write(scic, afe_dfx_master_control0, 0x00010f00);
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY); udelay(AFE_REGISTER_WRITE_DELAY);
} }
/* /*
...@@ -2446,7 +2445,7 @@ void scic_sds_controller_reset_hardware( ...@@ -2446,7 +2445,7 @@ void scic_sds_controller_reset_hardware(
SMU_SMUSRCR_WRITE(scic, 0xFFFFFFFF); SMU_SMUSRCR_WRITE(scic, 0xFFFFFFFF);
/* Delay for 1ms to before clearing the CQP and UFQPR. */ /* Delay for 1ms to before clearing the CQP and UFQPR. */
scic_cb_stall_execution(1000); udelay(1000);
/* The write to the CQGR clears the CQP */ /* The write to the CQGR clears the CQP */
SMU_CQGR_WRITE(scic, 0x00000000); SMU_CQGR_WRITE(scic, 0x00000000);
...@@ -2840,7 +2839,7 @@ static enum sci_status scic_sds_controller_reset_state_initialize_handler( ...@@ -2840,7 +2839,7 @@ static enum sci_status scic_sds_controller_reset_state_initialize_handler(
while (terminate_loop-- && (result != SCI_SUCCESS)) { while (terminate_loop-- && (result != SCI_SUCCESS)) {
/* Loop until the hardware reports success */ /* Loop until the hardware reports success */
scic_cb_stall_execution(SCU_CONTEXT_RAM_INIT_STALL_TIME); udelay(SCU_CONTEXT_RAM_INIT_STALL_TIME);
status = SMU_SMUCSR_READ(this_controller); status = SMU_SMUCSR_READ(this_controller);
if ((status & SCU_RAM_INIT_COMPLETED) == SCU_RAM_INIT_COMPLETED) { if ((status & SCU_RAM_INIT_COMPLETED) == SCU_RAM_INIT_COMPLETED) {
......
...@@ -63,7 +63,6 @@ ...@@ -63,7 +63,6 @@
#include "scic_sds_phy_registers.h" #include "scic_sds_phy_registers.h"
#include "scic_sds_port.h" #include "scic_sds_port.h"
#include "scic_sds_remote_node_context.h" #include "scic_sds_remote_node_context.h"
#include "scic_user_callback.h"
#include "sci_environment.h" #include "sci_environment.h"
#include "sci_util.h" #include "sci_util.h"
#include "scu_event_codes.h" #include "scu_event_codes.h"
......
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
#include "scic_sds_remote_device.h" #include "scic_sds_remote_device.h"
#include "scic_sds_remote_node_context.h" #include "scic_sds_remote_node_context.h"
#include "scic_sds_request.h" #include "scic_sds_request.h"
#include "scic_user_callback.h"
#include "sci_environment.h" #include "sci_environment.h"
......
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
#include "scic_sds_remote_device.h" #include "scic_sds_remote_device.h"
#include "scic_sds_remote_node_context.h" #include "scic_sds_remote_node_context.h"
#include "scic_sds_request.h" #include "scic_sds_request.h"
#include "scic_user_callback.h"
#include "sci_environment.h" #include "sci_environment.h"
#include "sci_util.h" #include "sci_util.h"
#include "scu_event_codes.h" #include "scu_event_codes.h"
......
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
#include "scic_sds_smp_request.h" #include "scic_sds_smp_request.h"
#include "scic_sds_stp_request.h" #include "scic_sds_stp_request.h"
#include "scic_sds_unsolicited_frame_control.h" #include "scic_sds_unsolicited_frame_control.h"
#include "scic_user_callback.h"
#include "sci_environment.h" #include "sci_environment.h"
#include "sci_util.h" #include "sci_util.h"
#include "scu_completion_codes.h" #include "scu_completion_codes.h"
...@@ -413,25 +412,26 @@ static void scic_sds_ssp_io_request_assign_buffers( ...@@ -413,25 +412,26 @@ static void scic_sds_ssp_io_request_assign_buffers(
* *
*/ */
static void scic_sds_io_request_build_ssp_command_iu( static void scic_sds_io_request_build_ssp_command_iu(
struct scic_sds_request *this_request) struct scic_sds_request *sds_request)
{ {
struct sci_ssp_command_iu *command_frame; struct sci_ssp_command_iu *command_frame;
void *os_handle;
u32 cdb_length; u32 cdb_length;
u32 *cdb_buffer; u32 *cdb_buffer;
struct isci_request *isci_request =
(struct isci_request *)sci_object_get_association(sds_request);
command_frame = command_frame =
(struct sci_ssp_command_iu *)this_request->command_buffer; (struct sci_ssp_command_iu *)sds_request->command_buffer;
os_handle = scic_sds_request_get_user_request(this_request);
command_frame->lun_upper = 0; command_frame->lun_upper = 0;
command_frame->lun_lower = scic_cb_ssp_io_request_get_lun(os_handle); command_frame->lun_lower =
isci_request_ssp_io_request_get_lun(isci_request);
((u32 *)command_frame)[2] = 0; ((u32 *)command_frame)[2] = 0;
cdb_length = scic_cb_ssp_io_request_get_cdb_length(os_handle); cdb_length = isci_request_ssp_io_request_get_cdb_length(isci_request);
cdb_buffer = (u32 *)scic_cb_ssp_io_request_get_cdb_address(os_handle); cdb_buffer = (u32 *)isci_request_ssp_io_request_get_cdb_address(
isci_request);
if (cdb_length > 16) { if (cdb_length > 16) {
command_frame->additional_cdb_length = cdb_length - 16; command_frame->additional_cdb_length = cdb_length - 16;
...@@ -446,9 +446,9 @@ static void scic_sds_io_request_build_ssp_command_iu( ...@@ -446,9 +446,9 @@ static void scic_sds_io_request_build_ssp_command_iu(
command_frame->enable_first_burst = 0; command_frame->enable_first_burst = 0;
command_frame->task_priority = command_frame->task_priority =
scic_cb_ssp_io_request_get_command_priority(os_handle); isci_request_ssp_io_request_get_command_priority(isci_request);
command_frame->task_attribute = command_frame->task_attribute =
scic_cb_ssp_io_request_get_task_attribute(os_handle); isci_request_ssp_io_request_get_task_attribute(isci_request);
} }
...@@ -458,25 +458,26 @@ static void scic_sds_io_request_build_ssp_command_iu( ...@@ -458,25 +458,26 @@ static void scic_sds_io_request_build_ssp_command_iu(
* *
*/ */
static void scic_sds_task_request_build_ssp_task_iu( static void scic_sds_task_request_build_ssp_task_iu(
struct scic_sds_request *this_request) struct scic_sds_request *sds_request)
{ {
struct sci_ssp_task_iu *command_frame; struct sci_ssp_task_iu *command_frame;
void *os_handle; struct isci_request *isci_request =
(struct isci_request *)sci_object_get_association(sds_request);
command_frame = command_frame =
(struct sci_ssp_task_iu *)this_request->command_buffer; (struct sci_ssp_task_iu *)sds_request->command_buffer;
os_handle = scic_sds_request_get_user_request(this_request);
command_frame->lun_upper = 0; command_frame->lun_upper = 0;
command_frame->lun_lower = scic_cb_ssp_task_request_get_lun(os_handle); command_frame->lun_lower = isci_request_ssp_io_request_get_lun(
isci_request);
((u32 *)command_frame)[2] = 0; ((u32 *)command_frame)[2] = 0;
command_frame->task_function = command_frame->task_function =
scic_cb_ssp_task_request_get_function(os_handle); isci_task_ssp_request_get_function(isci_request);
command_frame->task_tag = command_frame->task_tag =
scic_cb_ssp_task_request_get_io_tag_to_manage(os_handle); isci_task_ssp_request_get_io_tag_to_manage(
isci_request);
} }
...@@ -899,18 +900,15 @@ enum sci_status scic_task_request_construct( ...@@ -899,18 +900,15 @@ enum sci_status scic_task_request_construct(
enum sci_status scic_io_request_construct_basic_ssp( enum sci_status scic_io_request_construct_basic_ssp(
struct scic_sds_request *sci_req) struct scic_sds_request *sci_req)
{ {
void *os_handle; struct isci_request *isci_request =
(struct isci_request *)sci_object_get_association(sci_req);
sci_req->protocol = SCIC_SSP_PROTOCOL; sci_req->protocol = SCIC_SSP_PROTOCOL;
os_handle = scic_sds_request_get_user_request(sci_req);
scu_ssp_io_request_construct_task_context( scu_ssp_io_request_construct_task_context(
sci_req, sci_req,
scic_cb_io_request_get_data_direction(os_handle), isci_request_io_request_get_data_direction(isci_request),
scic_cb_io_request_get_transfer_length(os_handle) isci_request_io_request_get_transfer_length(isci_request));
);
scic_sds_io_request_build_ssp_command_iu(sci_req); scic_sds_io_request_build_ssp_command_iu(sci_req);
...@@ -941,7 +939,8 @@ enum sci_status scic_task_request_construct_ssp( ...@@ -941,7 +939,8 @@ enum sci_status scic_task_request_construct_ssp(
} }
enum sci_status scic_io_request_construct_basic_sata(struct scic_sds_request *sci_req) enum sci_status scic_io_request_construct_basic_sata(
struct scic_sds_request *sci_req)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_stp_request *stp_req; struct scic_sds_stp_request *stp_req;
...@@ -949,15 +948,18 @@ enum sci_status scic_io_request_construct_basic_sata(struct scic_sds_request *sc ...@@ -949,15 +948,18 @@ enum sci_status scic_io_request_construct_basic_sata(struct scic_sds_request *sc
u32 len; u32 len;
enum dma_data_direction dir; enum dma_data_direction dir;
bool copy = false; bool copy = false;
struct isci_request *isci_request =
(struct isci_request *)sci_object_get_association(sci_req);
struct sas_task *task = isci_request_access_task(isci_request);
stp_req = container_of(sci_req, typeof(*stp_req), parent); stp_req = container_of(sci_req, typeof(*stp_req), parent);
sci_req->protocol = SCIC_STP_PROTOCOL; sci_req->protocol = SCIC_STP_PROTOCOL;
len = scic_cb_io_request_get_transfer_length(sci_req->user_request); len = isci_request_io_request_get_transfer_length(isci_request);
dir = scic_cb_io_request_get_data_direction(sci_req->user_request); dir = isci_request_io_request_get_data_direction(isci_request);
proto = scic_cb_request_get_sat_protocol(sci_req->user_request); proto = isci_sata_get_sat_protocol(isci_request);
copy = scic_cb_io_request_do_copy_rx_frames(stp_req->parent.user_request); 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, proto, len, dir, copy);
...@@ -975,7 +977,11 @@ enum sci_status scic_task_request_construct_sata( ...@@ -975,7 +977,11 @@ 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;
u8 sat_protocol = scic_cb_request_get_sat_protocol(sci_req->user_request); u8 sat_protocol;
struct isci_request *isci_request =
(struct isci_request *)sci_object_get_association(sci_req);
sat_protocol = isci_sata_get_sat_protocol(isci_request);
switch (sat_protocol) { switch (sat_protocol) {
case SAT_PROTOCOL_ATA_HARD_RESET: case SAT_PROTOCOL_ATA_HARD_RESET:
...@@ -1172,27 +1178,28 @@ enum sci_status scic_sds_io_request_frame_handler( ...@@ -1172,27 +1178,28 @@ enum sci_status scic_sds_io_request_frame_handler(
* the response data. * the response data.
* *
*/ */
void scic_sds_io_request_copy_response( void scic_sds_io_request_copy_response(struct scic_sds_request *sds_request)
struct scic_sds_request *this_request)
{ {
void *response_buffer; void *response_buffer;
u32 user_response_length; u32 user_response_length;
u32 core_response_length; u32 core_response_length;
struct sci_ssp_response_iu *ssp_response; struct sci_ssp_response_iu *ssp_response;
struct isci_request *isci_request =
(struct isci_request *)sci_object_get_association(sds_request);
ssp_response = (struct sci_ssp_response_iu *)this_request->response_buffer; ssp_response =
(struct sci_ssp_response_iu *)sds_request->response_buffer;
response_buffer = scic_cb_ssp_task_request_get_response_data_address( response_buffer =
this_request->user_request isci_task_ssp_request_get_response_data_address(
); isci_request);
user_response_length = scic_cb_ssp_task_request_get_response_data_length( user_response_length =
this_request->user_request isci_task_ssp_request_get_response_data_length(
); isci_request);
core_response_length = sci_ssp_get_response_data_length( core_response_length = sci_ssp_get_response_data_length(
ssp_response->response_data_length ssp_response->response_data_length);
);
user_response_length = min(user_response_length, core_response_length); user_response_length = min(user_response_length, core_response_length);
......
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
#include "scic_sds_port.h" #include "scic_sds_port.h"
#include "scic_sds_remote_device.h" #include "scic_sds_remote_device.h"
#include "scic_sds_request.h" #include "scic_sds_request.h"
#include "scic_user_callback.h"
#include "sci_environment.h" #include "sci_environment.h"
#include "sci_util.h" #include "sci_util.h"
#include "scu_event_codes.h" #include "scu_event_codes.h"
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#include "scic_sds_port.h" #include "scic_sds_port.h"
#include "scic_sds_remote_device.h" #include "scic_sds_remote_device.h"
#include "scic_sds_request.h" #include "scic_sds_request.h"
#include "scic_user_callback.h"
#include "sci_environment.h" #include "sci_environment.h"
#include "sci_util.h" #include "sci_util.h"
#include "scu_event_codes.h" #include "scu_event_codes.h"
...@@ -217,52 +216,56 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h ...@@ -217,52 +216,56 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h
* @device: * @device:
* @request: * @request:
* *
* If this is a softreset we may want to have a different substate. enum sci_status * If this is a softreset we may want to have a different substate.
* enum sci_status
*/ */
static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_handler( static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_handler(
struct sci_base_remote_device *device, struct sci_base_remote_device *base_device,
struct sci_base_request *request) struct sci_base_request *base_request)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device; struct scic_sds_remote_device *device =
struct scic_sds_request *io_request = (struct scic_sds_request *)request; (struct scic_sds_remote_device *)&base_device->parent;
struct scic_sds_request *sds_request =
(struct scic_sds_request *)&base_request->parent;
struct isci_request *isci_request =
(struct isci_request *)sci_object_get_association(sds_request);
/* Will the port allow the io request to start? */ /* Will the port allow the io request to start? */
status = this_device->owning_port->state_handlers->start_io_handler( status = device->owning_port->state_handlers->start_io_handler(
this_device->owning_port, device->owning_port,
this_device, device,
io_request sds_request);
);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = status =
scic_sds_remote_node_context_start_io(this_device->rnc, io_request); scic_sds_remote_node_context_start_io(device->rnc,
sds_request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS)
status = io_request->state_handlers->parent.start_handler(request); status =
} sds_request->state_handlers->
parent.start_handler(base_request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
if ( if (isci_sata_get_sat_protocol(isci_request) ==
scic_cb_request_get_sat_protocol(io_request->user_request) SAT_PROTOCOL_FPDMA)
== SAT_PROTOCOL_FPDMA
) {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->ready_substate_machine, &device->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
); else {
} else { device->working_request = sds_request;
this_device->working_request = io_request;
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->ready_substate_machine, &device->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
);
} }
} }
scic_sds_remote_device_start_request(this_device, io_request, status); scic_sds_remote_device_start_request(device,
sds_request,
status);
} }
return status; return status;
...@@ -304,35 +307,38 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_event_hand ...@@ -304,35 +307,38 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_event_hand
* ***************************************************************************** */ * ***************************************************************************** */
static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler( static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler(
struct sci_base_remote_device *device, struct sci_base_remote_device *base_device,
struct sci_base_request *request) struct sci_base_request *base_request)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device; struct scic_sds_remote_device *device =
struct scic_sds_request *io_request = (struct scic_sds_request *)request; (struct scic_sds_remote_device *)&base_device->parent;
struct scic_sds_request *sds_request =
if ( (struct scic_sds_request *)&base_request->parent;
scic_cb_request_get_sat_protocol(io_request->user_request) struct isci_request *isci_request =
== SAT_PROTOCOL_FPDMA (struct isci_request *)sci_object_get_association(sds_request);
) {
status = this_device->owning_port->state_handlers->start_io_handler( if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) {
this_device->owning_port, status = device->owning_port->state_handlers->start_io_handler(
this_device, device->owning_port,
io_request device,
); sds_request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = scic_sds_remote_node_context_start_io(this_device->rnc, io_request); status = scic_sds_remote_node_context_start_io(
device->rnc,
sds_request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS)
status = io_request->state_handlers->parent.start_handler(request); status = sds_request->state_handlers->
} parent.start_handler(base_request);
scic_sds_remote_device_start_request(this_device, io_request, status); scic_sds_remote_device_start_request(device,
sds_request,
status);
} }
} else { } else
status = SCI_FAILURE_INVALID_STATE; status = SCI_FAILURE_INVALID_STATE;
}
return status; return status;
} }
......
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include "scic_sds_stp_pio_request.h" #include "scic_sds_stp_pio_request.h"
#include "scic_sds_stp_request.h" #include "scic_sds_stp_request.h"
#include "scic_sds_unsolicited_frame_control.h" #include "scic_sds_unsolicited_frame_control.h"
#include "scic_user_callback.h"
#include "sci_environment.h" #include "sci_environment.h"
#include "sci_util.h" #include "sci_util.h"
#include "scu_completion_codes.h" #include "scu_completion_codes.h"
......
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
#include "scic_sds_unsolicited_frame_control.h" #include "scic_sds_unsolicited_frame_control.h"
#include "scu_registers.h" #include "scu_registers.h"
#include "scic_sds_controller.h" #include "scic_sds_controller.h"
#include "scic_user_callback.h"
#include "sci_util.h" #include "sci_util.h"
#include "sci_environment.h" #include "sci_environment.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 _SCIC_USER_CALLBACK_H_
#define _SCIC_USER_CALLBACK_H_
/**
* This file contains all of the interface methods/macros that must be
* implemented by an SCI Core user.
*
*
*/
#include "sci_status.h"
#include "scic_io_request.h"
struct scic_sds_request;
struct scic_sds_phy;
struct scic_sds_port;
struct scic_sds_remote_device;
struct scic_sds_controller;
/**
* scic_cb_stall_execution() - This method is called when the core requires the
* OS driver to stall execution. This method is utilized during
* initialization or non-performance paths only.
* @microseconds: This parameter specifies the number of microseconds for which
* to stall. The operating system driver is allowed to round this value up
* where necessary.
*
* none.
*/
void scic_cb_stall_execution(
u32 microseconds);
#ifndef SCI_GET_PHYSICAL_ADDRESS_OPTIMIZATION_ENABLED
/**
* scic_cb_io_request_get_physical_address() - This callback method asks the
* user to provide the physical address for the supplied virtual address
* when building an io request object.
* @controller: This parameter is the core controller object handle.
* @io_request: This parameter is the io request object handle for which the
* physical address is being requested.
* @virtual_address: This paramter is the virtual address which is to be
* returned as a physical address.
* @physical_address: The physical address for the supplied virtual address.
*
* None.
*/
void scic_cb_io_request_get_physical_address(
struct scic_sds_controller *controller,
struct scic_sds_request *io_request,
void *virtual_address,
dma_addr_t *physical_address);
#endif /* SCI_GET_PHYSICAL_ADDRESS_OPTIMIZATION_ENABLED */
/**
* scic_cb_io_request_get_transfer_length() - This callback method asks the
* user to provide the number of bytes to be transfered as part of this
* request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the number of payload data bytes to be transfered for
* this IO request.
*/
u32 scic_cb_io_request_get_transfer_length(
void *scic_user_io_request);
/**
* scic_cb_io_request_get_data_direction() - This callback method asks the user
* to provide the data direction for this request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
*/
enum dma_data_direction scic_cb_io_request_get_data_direction(void *req);
#ifndef SCI_SGL_OPTIMIZATION_ENABLED
/**
* scic_cb_io_request_get_next_sge() - This callback method asks the user to
* provide the address to where the next Scatter-Gather Element is located.
* Details regarding usage: - Regarding the first SGE: the user should
* initialize an index, or a pointer, prior to construction of the request
* that will reference the very first scatter-gather element. This is
* important since this method is called for every scatter-gather element,
* including the first element. - Regarding the last SGE: the user should
* return NULL from this method when this method is called and the SGL has
* exhausted all elements.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
* @current_sge_address: This parameter specifies the address for the current
* SGE (i.e. the one that has just processed).
* @next_sge: An address specifying the location for the next scatter gather
* element to be processed.
*
* None
*/
void scic_cb_io_request_get_next_sge(
void *scic_user_io_request,
void *current_sge_address,
void **next_sge);
#endif /* SCI_SGL_OPTIMIZATION_ENABLED */
/**
* scic_cb_sge_get_address_field() - This callback method asks the user to
* provide the contents of the "address" field in the Scatter-Gather Element.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
* @sge_address: This parameter specifies the address for the SGE from which to
* retrieve the address field.
*
* A physical address specifying the contents of the SGE's address field.
*/
dma_addr_t scic_cb_sge_get_address_field(
void *scic_user_io_request,
void *sge_address);
/**
* scic_cb_sge_get_length_field() - This callback method asks the user to
* provide the contents of the "length" field in the Scatter-Gather Element.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
* @sge_address: This parameter specifies the address for the SGE from which to
* retrieve the address field.
*
* This method returns the length field specified inside the SGE referenced by
* the sge_address parameter.
*/
u32 scic_cb_sge_get_length_field(
void *scic_user_io_request,
void *sge_address);
/**
* scic_cb_ssp_io_request_get_cdb_address() - This callback method asks the
* user to provide the address for the command descriptor block (CDB)
* associated with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the virtual address of the CDB.
*/
void *scic_cb_ssp_io_request_get_cdb_address(
void *scic_user_io_request);
/**
* scic_cb_ssp_io_request_get_cdb_length() - This callback method asks the user
* to provide the length of the command descriptor block (CDB) associated
* with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the length of the CDB.
*/
u32 scic_cb_ssp_io_request_get_cdb_length(
void *scic_user_io_request);
/**
* scic_cb_ssp_io_request_get_lun() - This callback method asks the user to
* provide the Logical Unit (LUN) associated with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* The contents of the value returned from this callback are defined by the
* protocol standard (e.g. T10 SAS specification). Please refer to the
* transport command information unit description in the associated standard.
* This method returns the LUN associated with this request. This should be u64?
*/
u32 scic_cb_ssp_io_request_get_lun(
void *scic_user_io_request);
/**
* scic_cb_ssp_io_request_get_task_attribute() - This callback method asks the
* user to provide the task attribute associated with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* The contents of the value returned from this callback are defined by the
* protocol standard (e.g. T10 SAS specification). Please refer to the
* transport command information unit description in the associated standard.
* This method returns the task attribute associated with this IO request.
*/
u32 scic_cb_ssp_io_request_get_task_attribute(
void *scic_user_io_request);
/**
* scic_cb_ssp_io_request_get_command_priority() - This callback method asks
* the user to provide the command priority associated with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* The contents of the value returned from this callback are defined by the
* protocol standard (e.g. T10 SAS specification). Please refer to the
* transport command information unit description in the associated standard.
* This method returns the command priority associated with this IO request.
*/
u32 scic_cb_ssp_io_request_get_command_priority(
void *scic_user_io_request);
/**
* scic_cb_io_request_do_copy_rx_frames() - This callback method asks the user
* if the received RX frame data is to be copied to the SGL or should be
* stored by the SCI core to be retrieved later with the
* scic_io_request_get_rx_frame().
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns true if the SCI core should copy the received frame data
* to the SGL location or false if the SCI user wants to retrieve the frame
* data at a later time.
*/
bool scic_cb_io_request_do_copy_rx_frames(
void *scic_user_io_request);
/**
* scic_cb_request_get_sat_protocol() - This callback method asks the user to
* return the SAT protocol definition for this IO request. This method is
* only called by the SCI core if the request type constructed is SATA.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns one of the sat.h defined protocols for the given io
* request.
*/
u8 scic_cb_request_get_sat_protocol(
void *scic_user_io_request);
/**
* scic_cb_ssp_task_request_get_lun() - This method returns the Logical Unit to
* be utilized for this task management request.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* The contents of the value returned from this callback are defined by the
* protocol standard (e.g. T10 SAS specification). Please refer to the
* transport task information unit description in the associated standard. This
* method returns the LUN associated with this request. This should be u64?
*/
u32 scic_cb_ssp_task_request_get_lun(
void *scic_user_task_request);
/**
* scic_cb_ssp_task_request_get_function() - This method returns the task
* management function to be utilized for this task request.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* The contents of the value returned from this callback are defined by the
* protocol standard (e.g. T10 SAS specification). Please refer to the
* transport task information unit description in the associated standard. This
* method returns an unsigned byte representing the task management function to
* be performed.
*/
u8 scic_cb_ssp_task_request_get_function(
void *scic_user_task_request);
/**
* scic_cb_ssp_task_request_get_io_tag_to_manage() - This method returns the
* task management IO tag to be managed. Depending upon the task management
* function the value returned from this method may be ignored.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns an unsigned 16-bit word depicting the IO tag to be
* managed.
*/
u16 scic_cb_ssp_task_request_get_io_tag_to_manage(
void *scic_user_task_request);
/**
* scic_cb_ssp_task_request_get_response_data_address() - This callback method
* asks the user to provide the virtual address of the response data buffer
* for the supplied IO request.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the virtual address for the response data buffer
* associated with this IO request.
*/
void *scic_cb_ssp_task_request_get_response_data_address(
void *scic_user_task_request);
/**
* scic_cb_ssp_task_request_get_response_data_length() - This callback method
* asks the user to provide the length of the response data buffer for the
* supplied IO request.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the length of the response buffer data associated with
* this IO request.
*/
u32 scic_cb_ssp_task_request_get_response_data_length(
void *scic_user_task_request);
/**
* scic_cb_pci_get_bar() - In this method the user must return the base address
* register (BAR) value for the supplied base address register number.
* @controller: The controller for which to retrieve the bar number.
* @bar_number: This parameter depicts the BAR index/number to be read.
*
* Return a pointer value indicating the contents of the BAR. NULL indicates an
* invalid BAR index/number was specified. All other values indicate a valid
* VIRTUAL address from the BAR.
*/
void *scic_cb_pci_get_bar(
struct scic_sds_controller *controller,
u16 bar_number);
/**
* scic_cb_get_virtual_address() - This callback method asks the user to
* provide the virtual address for the supplied physical address.
* @controller: This parameter is the core controller object handle.
* @physical_address: This parameter is the physical address which is to be
* returned as a virtual address.
*
* The method returns the virtual address for the supplied physical address.
*/
void *scic_cb_get_virtual_address(
struct scic_sds_controller *controller,
dma_addr_t physical_address);
#if !defined(DISABLE_ATAPI)
/**
* scic_cb_stp_packet_io_request_get_cdb_address() - This user callback gets
* from stp packet io's user request the CDB address.
* @scic_user_io_request:
*
* The cdb adress.
*/
void *scic_cb_stp_packet_io_request_get_cdb_address(
void *scic_user_io_request);
/**
* scic_cb_stp_packet_io_request_get_cdb_length() - This user callback gets
* from stp packet io's user request the CDB length.
* @scic_user_io_request:
*
* The cdb length.
*/
u32 scic_cb_stp_packet_io_request_get_cdb_length(
void *scic_user_io_request);
#else /* !defined(DISABLE_ATAPI) */
#define scic_cb_stp_packet_io_request_get_cdb_address(scic_user_io_request) NULL
#define scic_cb_stp_packet_io_request_get_cdb_length(scic_user_io_request) 0
#endif /* !defined(DISABLE_ATAPI) */
#endif /* _SCIC_USER_CALLBACK_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.
*/
/**
* This file contains isci module object implementation.
*
*
*/
#include "isci.h"
#include "request.h"
#include "sata.h"
#include "task.h"
/**
* scic_cb_stall_execution() - This method is called when the core requires the
* OS driver to stall execution. This method is utilized during
* initialization or non-performance paths only.
* @microseconds: This parameter specifies the number of microseconds for which
* to stall. The operating system driver is allowed to round this value up
* where necessary.
*
* none.
*/
void scic_cb_stall_execution(
u32 microseconds)
{
udelay(microseconds);
}
/**
* scic_cb_io_request_get_physical_address() - This callback method asks the
* user to provide the physical address for the supplied virtual address
* when building an io request object.
* @controller: This parameter is the core controller object handle.
* @io_request: This parameter is the io request object handle for which the
* physical address is being requested.
*
*
*/
void scic_cb_io_request_get_physical_address(
struct scic_sds_controller *controller,
struct scic_sds_request *io_request,
void *virtual_address,
dma_addr_t *physical_address)
{
struct isci_request *request =
(struct isci_request *)sci_object_get_association(io_request);
char *requested_address = (char *)virtual_address;
char *base_address = (char *)request;
BUG_ON(requested_address < base_address);
BUG_ON((requested_address - base_address) >=
request->request_alloc_size);
*physical_address = request->request_daddr +
(requested_address - base_address);
}
/**
* scic_cb_io_request_get_transfer_length() - This callback method asks the
* user to provide the number of bytes to be transfered as part of this
* request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the number of payload data bytes to be transfered for
* this IO request.
*/
u32 scic_cb_io_request_get_transfer_length(
void *scic_user_io_request)
{
return isci_request_io_request_get_transfer_length(
scic_user_io_request
);
}
/**
* scic_cb_io_request_get_data_direction() - This callback method asks the user
* to provide the data direction for this request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*/
enum dma_data_direction scic_cb_io_request_get_data_direction(void *req)
{
return isci_request_io_request_get_data_direction(req);
}
/**
* scic_cb_io_request_get_next_sge() - This callback method asks the user to
* provide the address to where the next Scatter-Gather Element is located.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
* @current_sge_address: This parameter specifies the address for the current
* SGE (i.e. the one that has just processed).
*
* An address specifying the location for the next scatter gather element to be
* processed.
*/
void scic_cb_io_request_get_next_sge(
void *scic_user_io_request,
void *current_sge_address,
void **next_sge)
{
*next_sge = isci_request_io_request_get_next_sge(
scic_user_io_request,
current_sge_address
);
}
/**
* scic_cb_sge_get_address_field() - This callback method asks the user to
* provide the contents of the "address" field in the Scatter-Gather Element.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
* @sge_address: This parameter specifies the address for the SGE from which to
* retrieve the address field.
*
* A physical address specifying the contents of the SGE's address field.
*/
dma_addr_t scic_cb_sge_get_address_field(
void *scic_user_io_request,
void *sge_address)
{
return isci_request_sge_get_address_field(
scic_user_io_request,
sge_address
);
}
/**
* scic_cb_sge_get_length_field() - This callback method asks the user to
* provide the contents of the "length" field in the Scatter-Gather Element.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
* @sge_address: This parameter specifies the address for the SGE from which to
* retrieve the address field.
*
* This method returns the length field specified inside the SGE referenced by
* the sge_address parameter.
*/
u32 scic_cb_sge_get_length_field(
void *scic_user_io_request,
void *sge_address)
{
return isci_request_sge_get_length_field(
scic_user_io_request,
sge_address
);
}
/**
* scic_cb_ssp_io_request_get_cdb_address() - This callback method asks the
* user to provide the address for the command descriptor block (CDB)
* associated with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the virtual address of the CDB.
*/
void *scic_cb_ssp_io_request_get_cdb_address(
void *scic_user_io_request)
{
return isci_request_ssp_io_request_get_cdb_address(
scic_user_io_request
);
}
/**
* scic_cb_ssp_io_request_get_cdb_length() - This callback method asks the user
* to provide the length of the command descriptor block (CDB) associated
* with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the length of the CDB.
*/
u32 scic_cb_ssp_io_request_get_cdb_length(
void *scic_user_io_request)
{
return isci_request_ssp_io_request_get_cdb_length(
scic_user_io_request
);
}
/**
* scic_cb_ssp_io_request_get_lun() - This callback method asks the user to
* provide the Logical Unit (LUN) associated with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the LUN associated with this request. This should be u64?
*/
u32 scic_cb_ssp_io_request_get_lun(
void *scic_user_io_request)
{
return isci_request_ssp_io_request_get_lun(scic_user_io_request);
}
/**
* scic_cb_ssp_io_request_get_task_attribute() - This callback method asks the
* user to provide the task attribute associated with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the task attribute associated with this IO request.
*/
u32 scic_cb_ssp_io_request_get_task_attribute(
void *scic_user_io_request)
{
return isci_request_ssp_io_request_get_task_attribute(
scic_user_io_request
);
}
/**
* scic_cb_ssp_io_request_get_command_priority() - This callback method asks
* the user to provide the command priority associated with this IO request.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the command priority associated with this IO request.
*/
u32 scic_cb_ssp_io_request_get_command_priority(
void *scic_user_io_request)
{
return isci_request_ssp_io_request_get_command_priority(
scic_user_io_request
);
}
/**
* scic_cb_ssp_task_request_get_lun() - This method returns the Logical Unit to
* be utilized for this task management request.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the LUN associated with this request. This should be u64?
*/
u32 scic_cb_ssp_task_request_get_lun(
void *scic_user_task_request)
{
return isci_task_ssp_request_get_lun(
(struct isci_request *)scic_user_task_request
);
}
/**
* scic_cb_ssp_task_request_get_function() - This method returns the task
* management function to be utilized for this task request.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns an unsigned byte representing the task management
* function to be performed.
*/
u8 scic_cb_ssp_task_request_get_function(
void *scic_user_task_request)
{
return isci_task_ssp_request_get_function(
(struct isci_request *)scic_user_task_request
);
}
/**
* scic_cb_ssp_task_request_get_io_tag_to_manage() - This method returns the
* task management IO tag to be managed. Depending upon the task management
* function the value returned from this method may be ignored.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns an unsigned 16-bit word depicting the IO tag to be
* managed.
*/
u16 scic_cb_ssp_task_request_get_io_tag_to_manage(
void *scic_user_task_request)
{
return isci_task_ssp_request_get_io_tag_to_manage(
(struct isci_request *)scic_user_task_request
);
}
/**
* scic_cb_ssp_task_request_get_response_data_address() - This callback method
* asks the user to provide the virtual address of the response data buffer
* for the supplied IO request.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the virtual address for the response data buffer
* associated with this IO request.
*/
void *scic_cb_ssp_task_request_get_response_data_address(
void *scic_user_task_request)
{
return isci_task_ssp_request_get_response_data_address(
(struct isci_request *)scic_user_task_request
);
}
/**
* scic_cb_ssp_task_request_get_response_data_length() - This callback method
* asks the user to provide the length of the response data buffer for the
* supplied IO request.
* @scic_user_task_request: This parameter points to the user's task request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns the length of the response buffer data associated with
* this IO request.
*/
u32 scic_cb_ssp_task_request_get_response_data_length(
void *scic_user_task_request)
{
return isci_task_ssp_request_get_response_data_length(
(struct isci_request *)scic_user_task_request
);
}
#if !defined(DISABLE_ATAPI)
/**
* scic_cb_stp_packet_io_request_get_cdb_address() - This user callback asks
* the user to provide stp packet io's the CDB address.
* @scic_user_io_request:
*
* The packet IO's cdb adress.
*/
void *scic_cb_stp_packet_io_request_get_cdb_address(
void *scic_user_io_request)
{
return isci_request_stp_packet_io_request_get_cdb_address(
scic_user_io_request
);
}
/**
* scic_cb_stp_packet_io_request_get_cdb_length() - This user callback asks the
* user to provide stp packet io's the CDB length.
* @scic_user_io_request:
*
* The packet IO's cdb length.
*/
u32 scic_cb_stp_packet_io_request_get_cdb_length(
void *scic_user_io_request)
{
return isci_request_stp_packet_io_request_get_cdb_length(
scic_user_io_request
);
}
#endif /* #if !defined(DISABLE_ATAPI) */
/**
* scic_cb_io_request_do_copy_rx_frames() - This callback method asks the user
* if the received RX frame data is to be copied to the SGL or should be
* stored by the SCI core to be retrieved later with the
* scic_io_request_get_rx_frame().
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns true if the SCI core should copy the received frame data
* to the SGL location or false if the SCI user wants to retrieve the frame
* data at a later time.
*/
bool scic_cb_io_request_do_copy_rx_frames(
void *scic_user_io_request)
{
struct sas_task *task
= isci_request_access_task(
(struct isci_request *)scic_user_io_request
);
return (task->data_dir == DMA_NONE) ? false : true;
}
/**
* scic_cb_get_virtual_address() - This callback method asks the user to
* provide the virtual address for the supplied physical address.
* @controller: This parameter is the core controller object handle.
* @physical_address: This parameter is the physical address which is to be
* returned as a virtual address.
*
* The method returns the virtual address for the supplied physical address.
*/
void *scic_cb_get_virtual_address(
struct scic_sds_controller *controller,
dma_addr_t physical_address)
{
void *virt_addr = (void *)phys_to_virt(physical_address);
return virt_addr;
}
/**
* scic_cb_request_get_sat_protocol() - This callback method asks the user to
* return the SAT protocol definition for this IO request. This method is
* only called by the SCI core if the request type constructed is SATA.
* @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary
* information for this callback.
*
* This method returns one of the sat.h defined protocols for the given io
* request.
*/
u8 scic_cb_request_get_sat_protocol(
void *scic_user_io_request)
{
return isci_sata_get_sat_protocol(
(struct isci_request *)scic_user_io_request
);
}
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
/*#include "task.h"*/ /*#include "task.h"*/
#include "timers.h" #include "timers.h"
#include "remote_device.h" #include "remote_device.h"
#include "scic_user_callback.h"
#define DRV_NAME "isci" #define DRV_NAME "isci"
#define SCI_PCI_BAR_COUNT 2 #define SCI_PCI_BAR_COUNT 2
......
...@@ -86,6 +86,8 @@ ...@@ -86,6 +86,8 @@
#include "sci_status.h" #include "sci_status.h"
#include "request.h" #include "request.h"
#include "events.h" #include "events.h"
#include "task.h"
#include "sata.h"
extern struct kmem_cache *isci_kmem_cache; extern struct kmem_cache *isci_kmem_cache;
extern struct isci_firmware *isci_firmware; extern struct isci_firmware *isci_firmware;
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
#if !defined(_ISCI_REMOTE_DEVICE_H_) #if !defined(_ISCI_REMOTE_DEVICE_H_)
#define _ISCI_REMOTE_DEVICE_H_ #define _ISCI_REMOTE_DEVICE_H_
#include "scic_user_callback.h"
struct isci_host; struct isci_host;
struct scic_sds_remote_device; struct scic_sds_remote_device;
......
...@@ -324,7 +324,7 @@ int isci_task_send_lu_reset_sata( ...@@ -324,7 +324,7 @@ int isci_task_send_lu_reset_sata(
/* Leave SRST high for a bit. */ /* Leave SRST high for a bit. */
#define ISCI_SRST_ASSERT_DELAY 100 /* usecs */ #define ISCI_SRST_ASSERT_DELAY 100 /* usecs */
scic_cb_stall_execution(ISCI_SRST_ASSERT_DELAY); udelay(ISCI_SRST_ASSERT_DELAY);
/* Deassert SRST. */ /* Deassert SRST. */
isci_task_build_tmf(&tmf, isci_device, isci_tmf_sata_srst_low, isci_task_build_tmf(&tmf, isci_device, isci_tmf_sata_srst_low,
......
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