scic_sds_remote_device.h revision 230557
1230557Sjimharris/*- 2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license. When using or 3230557Sjimharris * redistributing this file, you may do so under either license. 4230557Sjimharris * 5230557Sjimharris * GPL LICENSE SUMMARY 6230557Sjimharris * 7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8230557Sjimharris * 9230557Sjimharris * This program is free software; you can redistribute it and/or modify 10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as 11230557Sjimharris * published by the Free Software Foundation. 12230557Sjimharris * 13230557Sjimharris * This program is distributed in the hope that it will be useful, but 14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of 15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16230557Sjimharris * General Public License for more details. 17230557Sjimharris * 18230557Sjimharris * You should have received a copy of the GNU General Public License 19230557Sjimharris * along with this program; if not, write to the Free Software 20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21230557Sjimharris * The full GNU General Public License is included in this distribution 22230557Sjimharris * in the file called LICENSE.GPL. 23230557Sjimharris * 24230557Sjimharris * BSD LICENSE 25230557Sjimharris * 26230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27230557Sjimharris * All rights reserved. 28230557Sjimharris * 29230557Sjimharris * Redistribution and use in source and binary forms, with or without 30230557Sjimharris * modification, are permitted provided that the following conditions 31230557Sjimharris * are met: 32230557Sjimharris * 33230557Sjimharris * * Redistributions of source code must retain the above copyright 34230557Sjimharris * notice, this list of conditions and the following disclaimer. 35230557Sjimharris * * Redistributions in binary form must reproduce the above copyright 36230557Sjimharris * notice, this list of conditions and the following disclaimer in 37230557Sjimharris * the documentation and/or other materials provided with the 38230557Sjimharris * distribution. 39230557Sjimharris * 40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51230557Sjimharris * 52230557Sjimharris * $FreeBSD$ 53230557Sjimharris */ 54230557Sjimharris#ifndef _SCIC_SDS_REMOTE_DEVICE_H_ 55230557Sjimharris#define _SCIC_SDS_REMOTE_DEVICE_H_ 56230557Sjimharris 57230557Sjimharris/** 58230557Sjimharris * @file 59230557Sjimharris * 60230557Sjimharris * @brief This file contains the structures, constants, and prototypes for the 61230557Sjimharris * SCIC_SDS_REMOTE_DEVICE object. 62230557Sjimharris */ 63230557Sjimharris 64230557Sjimharris#ifdef __cplusplus 65230557Sjimharrisextern "C" { 66230557Sjimharris#endif // __cplusplus 67230557Sjimharris 68230557Sjimharris#include <dev/isci/scil/intel_sas.h> 69230557Sjimharris#include <dev/isci/scil/sci_base_remote_device.h> 70230557Sjimharris#include <dev/isci/scil/sci_base_request.h> 71230557Sjimharris#include <dev/isci/scil/sci_base_state_machine_logger.h> 72230557Sjimharris#include <dev/isci/scil/scu_remote_node_context.h> 73230557Sjimharris#include <dev/isci/scil/scic_sds_remote_node_context.h> 74230557Sjimharris 75230557Sjimharrisstruct SCIC_SDS_CONTROLLER; 76230557Sjimharrisstruct SCIC_SDS_PORT; 77230557Sjimharrisstruct SCIC_SDS_REQUEST; 78230557Sjimharrisstruct SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER; 79230557Sjimharris 80230557Sjimharris/** 81230557Sjimharris * @enum SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATES 82230557Sjimharris * 83230557Sjimharris * This is the enumeration of the ready substates for the 84230557Sjimharris * SCIC_SDS_REMOTE_DEVICE. 85230557Sjimharris */ 86230557Sjimharrisenum SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATES 87230557Sjimharris{ 88230557Sjimharris /** 89230557Sjimharris * This is the initial state for the remote device ready substate. 90230557Sjimharris */ 91230557Sjimharris SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_INITIAL, 92230557Sjimharris 93230557Sjimharris /** 94230557Sjimharris * This is the ready operational substate for the remote device. This is the 95230557Sjimharris * normal operational state for a remote device. 96230557Sjimharris */ 97230557Sjimharris SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_OPERATIONAL, 98230557Sjimharris 99230557Sjimharris /** 100230557Sjimharris * This is the suspended state for the remote device. This is the state that 101230557Sjimharris * the device is placed in when a RNC suspend is received by the SCU hardware. 102230557Sjimharris */ 103230557Sjimharris SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_SUSPENDED, 104230557Sjimharris 105230557Sjimharris /** 106230557Sjimharris * This is the final state that the device is placed in before a change to the 107230557Sjimharris * base state machine. 108230557Sjimharris */ 109230557Sjimharris SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_FINAL, 110230557Sjimharris 111230557Sjimharris SCIC_SDS_SSP_REMOTE_DEVICE_READY_MAX_SUBSTATES 112230557Sjimharris}; 113230557Sjimharris 114230557Sjimharris/** 115230557Sjimharris * @enum SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATES 116230557Sjimharris * 117230557Sjimharris * This is the enumeration for the SCIC_SDS_REMOTE_DEVICE ready substates for 118230557Sjimharris * the STP remote device. 119230557Sjimharris */ 120230557Sjimharrisenum SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATES 121230557Sjimharris{ 122230557Sjimharris /** 123230557Sjimharris * This is the idle substate for the stp remote device. When there are no 124230557Sjimharris * active IO for the device it is is in this state. 125230557Sjimharris */ 126230557Sjimharris SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE, 127230557Sjimharris 128230557Sjimharris /** 129230557Sjimharris * This is the command state for for the STP remote device. This state is 130230557Sjimharris * entered when the device is processing a non-NCQ command. The device object 131230557Sjimharris * will fail any new start IO requests until this command is complete. 132230557Sjimharris */ 133230557Sjimharris SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD, 134230557Sjimharris 135230557Sjimharris /** 136230557Sjimharris * This is the NCQ state for the STP remote device. This state is entered 137230557Sjimharris * when the device is processing an NCQ reuqest. It will remain in this state 138230557Sjimharris * so long as there is one or more NCQ requests being processed. 139230557Sjimharris */ 140230557Sjimharris SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ, 141230557Sjimharris 142230557Sjimharris /** 143230557Sjimharris * This is the NCQ error state for the STP remote device. This state is 144230557Sjimharris * entered when an SDB error FIS is received by the device object while in the 145230557Sjimharris * NCQ state. The device object will only accept a READ LOG command while in 146230557Sjimharris * this state. 147230557Sjimharris */ 148230557Sjimharris SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR, 149230557Sjimharris 150230557Sjimharris#if !defined(DISABLE_ATAPI) 151230557Sjimharris /** 152230557Sjimharris * This is the ATAPI error state for the STP ATAPI remote device. This state is 153230557Sjimharris * entered when ATAPI device sends error status FIS without data while the device 154230557Sjimharris * object is in CMD state. A suspension event is expected in this state. The device 155230557Sjimharris * object will resume right away. 156230557Sjimharris */ 157230557Sjimharris SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR, 158230557Sjimharris#endif 159230557Sjimharris 160230557Sjimharris /** 161230557Sjimharris * This is the READY substate indicates the device is waiting for the RESET task 162230557Sjimharris * coming to be recovered from certain hardware specific error. 163230557Sjimharris */ 164230557Sjimharris SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET, 165230557Sjimharris 166230557Sjimharris SCIC_SDS_STP_REMOTE_DEVICE_READY_MAX_SUBSTATES 167230557Sjimharris}; 168230557Sjimharris 169230557Sjimharris 170230557Sjimharris/** 171230557Sjimharris * @enum SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATES 172230557Sjimharris * 173230557Sjimharris * This is the enumeration of the ready substates for the SMP REMOTE DEVICE. 174230557Sjimharris */ 175230557Sjimharris 176230557Sjimharrisenum SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATES 177230557Sjimharris{ 178230557Sjimharris /** 179230557Sjimharris * This is the ready operational substate for the remote device. This is the 180230557Sjimharris * normal operational state for a remote device. 181230557Sjimharris */ 182230557Sjimharris SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE, 183230557Sjimharris 184230557Sjimharris /** 185230557Sjimharris * This is the suspended state for the remote device. This is the state that 186230557Sjimharris * the device is placed in when a RNC suspend is received by the SCU hardware. 187230557Sjimharris */ 188230557Sjimharris SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD, 189230557Sjimharris 190230557Sjimharris SCIC_SDS_SMP_REMOTE_DEVICE_READY_MAX_SUBSTATES 191230557Sjimharris}; 192230557Sjimharris 193230557Sjimharris 194230557Sjimharris 195230557Sjimharris 196230557Sjimharris/** 197230557Sjimharris * @struct SCIC_SDS_REMOTE_DEVICE 198230557Sjimharris * 199230557Sjimharris * @brief This structure contains the data for an SCU implementation of 200230557Sjimharris * the SCU Core device data. 201230557Sjimharris */ 202230557Sjimharristypedef struct SCIC_SDS_REMOTE_DEVICE 203230557Sjimharris{ 204230557Sjimharris /** 205230557Sjimharris * This field is the common base for all remote device objects. 206230557Sjimharris */ 207230557Sjimharris SCI_BASE_REMOTE_DEVICE_T parent; 208230557Sjimharris 209230557Sjimharris /** 210230557Sjimharris * This field is the programmed device port width. This value is written to 211230557Sjimharris * the RCN data structure to tell the SCU how many open connections this 212230557Sjimharris * device can have. 213230557Sjimharris */ 214230557Sjimharris U32 device_port_width; 215230557Sjimharris 216230557Sjimharris /** 217230557Sjimharris * This field is the programmed connection rate for this remote device. It is 218230557Sjimharris * used to program the TC with the maximum allowed connection rate. 219230557Sjimharris */ 220230557Sjimharris SCI_SAS_LINK_RATE connection_rate; 221230557Sjimharris 222230557Sjimharris /** 223230557Sjimharris * This field contains the allowed target protocols for this remote device. 224230557Sjimharris */ 225230557Sjimharris SMP_DISCOVER_RESPONSE_PROTOCOLS_T target_protocols; 226230557Sjimharris 227230557Sjimharris /** 228230557Sjimharris * This field contains the device SAS address. 229230557Sjimharris */ 230230557Sjimharris SCI_SAS_ADDRESS_T device_address; 231230557Sjimharris 232230557Sjimharris /** 233230557Sjimharris * This filed is assinged the value of TRUE if the device is directly attached 234230557Sjimharris * to the port. 235230557Sjimharris */ 236230557Sjimharris BOOL is_direct_attached; 237230557Sjimharris 238230557Sjimharris#if !defined(DISABLE_ATAPI) 239230557Sjimharris /** 240230557Sjimharris * This filed is assinged the value of TRUE if the device is an ATAPI device. 241230557Sjimharris */ 242230557Sjimharris BOOL is_atapi; 243230557Sjimharris#endif 244230557Sjimharris 245230557Sjimharris /** 246230557Sjimharris * This filed contains a pointer back to the port to which this device is 247230557Sjimharris * assigned. 248230557Sjimharris */ 249230557Sjimharris struct SCIC_SDS_PORT *owning_port; 250230557Sjimharris 251230557Sjimharris /** 252230557Sjimharris * This field contains the SCU silicon remote node context specific 253230557Sjimharris * information. 254230557Sjimharris */ 255230557Sjimharris struct SCIC_SDS_REMOTE_NODE_CONTEXT * rnc; 256230557Sjimharris 257230557Sjimharris /** 258230557Sjimharris * This field contains the stated request count for the remote device. The 259230557Sjimharris * device can not reach the SCI_BASE_REMOTE_DEVICE_STATE_STOPPED until all 260230557Sjimharris * requests are complete and the rnc_posted value is FALSE. 261230557Sjimharris */ 262230557Sjimharris U32 started_request_count; 263230557Sjimharris 264230557Sjimharris /** 265230557Sjimharris * This field contains a pointer to the working request object. It is only 266230557Sjimharris * used only for SATA requests since the unsolicited frames we get from the 267230557Sjimharris * hardware have no Tag value to look up the io request object. 268230557Sjimharris */ 269230557Sjimharris struct SCIC_SDS_REQUEST * working_request; 270230557Sjimharris 271230557Sjimharris /** 272230557Sjimharris * This field contains the reason for the remote device going not_ready. It is 273230557Sjimharris * assigned in the state handlers and used in the state transition. 274230557Sjimharris */ 275230557Sjimharris U32 not_ready_reason; 276230557Sjimharris 277230557Sjimharris /** 278230557Sjimharris * This field is TRUE if this remote device has an initialzied ready substate 279230557Sjimharris * machine. SSP devices do not have a ready substate machine and STP devices 280230557Sjimharris * have a ready substate machine. 281230557Sjimharris */ 282230557Sjimharris BOOL has_ready_substate_machine; 283230557Sjimharris 284230557Sjimharris /** 285230557Sjimharris * This field contains the state machine for the ready substate machine for 286230557Sjimharris * this SCIC_SDS_REMOTE_DEVICE object. 287230557Sjimharris */ 288230557Sjimharris SCI_BASE_STATE_MACHINE_T ready_substate_machine; 289230557Sjimharris 290230557Sjimharris /** 291230557Sjimharris * This field maintains the set of state handlers for the remote device 292230557Sjimharris * object. These are changed each time the remote device enters a new state. 293230557Sjimharris */ 294230557Sjimharris struct SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER *state_handlers; 295230557Sjimharris 296230557Sjimharris #ifdef SCI_LOGGING 297230557Sjimharris /** 298230557Sjimharris * This field conatins the ready substate machine logger. The logger will 299230557Sjimharris * emit a message each time the ready substate machine changes state. 300230557Sjimharris */ 301230557Sjimharris SCI_BASE_STATE_MACHINE_LOGGER_T ready_substate_machine_logger; 302230557Sjimharris #endif 303230557Sjimharris 304230557Sjimharris} SCIC_SDS_REMOTE_DEVICE_T; 305230557Sjimharris 306230557Sjimharris 307230557Sjimharristypedef SCI_STATUS (*SCIC_SDS_REMOTE_DEVICE_HANDLER_T)( 308230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device); 309230557Sjimharris 310230557Sjimharristypedef SCI_STATUS (*SCIC_SDS_REMOTE_DEVICE_SUSPEND_HANDLER_T)( 311230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 312230557Sjimharris U32 suspend_type); 313230557Sjimharris 314230557Sjimharristypedef SCI_STATUS (*SCIC_SDS_REMOTE_DEVICE_RESUME_HANDLER_T)( 315230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device); 316230557Sjimharris 317230557Sjimharristypedef SCI_STATUS (*SCIC_SDS_REMOTE_DEVICE_FRAME_HANDLER_T)( 318230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 319230557Sjimharris U32 frame_index); 320230557Sjimharris 321230557Sjimharristypedef SCI_STATUS (*SCIC_SDS_REMOTE_DEVICE_EVENT_HANDLER_T)( 322230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 323230557Sjimharris U32 event_code); 324230557Sjimharris 325230557Sjimharristypedef void (*SCIC_SDS_REMOTE_DEVICE_READY_NOT_READY_HANDLER_T)( 326230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device); 327230557Sjimharris 328230557Sjimharris/** 329230557Sjimharris * @struct SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER 330230557Sjimharris * @brief This structure conains the state handlers that are needed to 331230557Sjimharris * process requests for the SCU remote device objects. 332230557Sjimharris */ 333230557Sjimharristypedef struct SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER 334230557Sjimharris{ 335230557Sjimharris SCI_BASE_REMOTE_DEVICE_STATE_HANDLER_T parent; 336230557Sjimharris 337230557Sjimharris SCIC_SDS_REMOTE_DEVICE_SUSPEND_HANDLER_T suspend_handler; 338230557Sjimharris SCIC_SDS_REMOTE_DEVICE_RESUME_HANDLER_T resume_handler; 339230557Sjimharris 340230557Sjimharris SCIC_SDS_REMOTE_DEVICE_EVENT_HANDLER_T event_handler; 341230557Sjimharris SCIC_SDS_REMOTE_DEVICE_FRAME_HANDLER_T frame_handler; 342230557Sjimharris 343230557Sjimharris} SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER_T; 344230557Sjimharris 345230557Sjimharris 346230557Sjimharrisextern SCI_BASE_STATE_T scic_sds_remote_device_state_table[]; 347230557Sjimharrisextern SCI_BASE_STATE_T scic_sds_ssp_remote_device_ready_substate_table[]; 348230557Sjimharrisextern SCI_BASE_STATE_T scic_sds_stp_remote_device_ready_substate_table[]; 349230557Sjimharrisextern SCI_BASE_STATE_T scic_sds_smp_remote_device_ready_substate_table[]; 350230557Sjimharris 351230557Sjimharrisextern SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER_T 352230557Sjimharris scic_sds_remote_device_state_handler_table[]; 353230557Sjimharrisextern SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER_T 354230557Sjimharris scic_sds_ssp_remote_device_ready_substate_handler_table[]; 355230557Sjimharrisextern SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER_T 356230557Sjimharris scic_sds_stp_remote_device_ready_substate_handler_table[]; 357230557Sjimharrisextern SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER_T 358230557Sjimharris scic_sds_smp_remote_device_ready_substate_handler_table[]; 359230557Sjimharris 360230557Sjimharris/** 361230557Sjimharris * This macro incrments the request count for this device 362230557Sjimharris */ 363230557Sjimharris#define scic_sds_remote_device_increment_request_count(this_device) \ 364230557Sjimharris ((this_device)->started_request_count++) 365230557Sjimharris 366230557Sjimharris/** 367230557Sjimharris * This macro decrements the request count for this device. This count 368230557Sjimharris * will never decrment past 0. 369230557Sjimharris */ 370230557Sjimharris#define scic_sds_remote_device_decrement_request_count(this_device) \ 371230557Sjimharris ((this_device)->started_request_count > 0 ? \ 372230557Sjimharris (this_device)->started_request_count-- : 0) 373230557Sjimharris 374230557Sjimharris/** 375230557Sjimharris * This is a helper macro to return the current device request count. 376230557Sjimharris */ 377230557Sjimharris#define scic_sds_remote_device_get_request_count(this_device) \ 378230557Sjimharris ((this_device)->started_request_count) 379230557Sjimharris 380230557Sjimharris/** 381230557Sjimharris * This macro returns the owning port of this remote device obejct. 382230557Sjimharris */ 383230557Sjimharris#define scic_sds_remote_device_get_port(this_device) \ 384230557Sjimharris ((this_device)->owning_port) 385230557Sjimharris 386230557Sjimharris/** 387230557Sjimharris * This macro returns the controller object that contains this device 388230557Sjimharris * object 389230557Sjimharris */ 390230557Sjimharris#define scic_sds_remote_device_get_controller(this_device) \ 391230557Sjimharris scic_sds_port_get_controller(scic_sds_remote_device_get_port(this_device)) 392230557Sjimharris 393230557Sjimharris/** 394230557Sjimharris * This macro sets the remote device state handlers pointer and is set on 395230557Sjimharris * entry to each device state. 396230557Sjimharris */ 397230557Sjimharris#define scic_sds_remote_device_set_state_handlers(this_device, handlers) \ 398230557Sjimharris ((this_device)->state_handlers = (handlers)) 399230557Sjimharris 400230557Sjimharris/** 401230557Sjimharris * This macro returns the base sate machine object for the remote device. 402230557Sjimharris */ 403230557Sjimharris#define scic_sds_remote_device_get_base_state_machine(this_device) \ 404230557Sjimharris (&(this_device)->parent.state_machine) 405230557Sjimharris 406230557Sjimharris/** 407230557Sjimharris * This macro returns the remote device ready substate machine 408230557Sjimharris */ 409230557Sjimharris#define scic_sds_remote_device_get_ready_substate_machine(this_device) \ 410230557Sjimharris (&(this_device)->ready_substate_machine) 411230557Sjimharris 412230557Sjimharris/** 413230557Sjimharris * This macro returns the owning port of this device 414230557Sjimharris */ 415230557Sjimharris#define scic_sds_remote_device_get_port(this_device) \ 416230557Sjimharris ((this_device)->owning_port) 417230557Sjimharris 418230557Sjimharris/** 419230557Sjimharris * This macro returns the remote device sequence value 420230557Sjimharris */ 421230557Sjimharris#define scic_sds_remote_device_get_sequence(this_device) \ 422230557Sjimharris ( \ 423230557Sjimharris scic_sds_remote_device_get_controller(this_device)->\ 424230557Sjimharris remote_device_sequence[(this_device)->rnc->remote_node_index] \ 425230557Sjimharris ) 426230557Sjimharris 427230557Sjimharris/** 428230557Sjimharris * This macro returns the controllers protocol engine group 429230557Sjimharris */ 430230557Sjimharris#define scic_sds_remote_device_get_controller_peg(this_device) \ 431230557Sjimharris ( \ 432230557Sjimharris scic_sds_controller_get_protocol_engine_group( \ 433230557Sjimharris scic_sds_port_get_controller( \ 434230557Sjimharris scic_sds_remote_device_get_port(this_device) \ 435230557Sjimharris ) \ 436230557Sjimharris ) \ 437230557Sjimharris ) 438230557Sjimharris 439230557Sjimharris/** 440230557Sjimharris * This macro returns the port index for the devices owning port 441230557Sjimharris */ 442230557Sjimharris#define scic_sds_remote_device_get_port_index(this_device) \ 443230557Sjimharris (scic_sds_port_get_index(scic_sds_remote_device_get_port(this_device))) 444230557Sjimharris 445230557Sjimharris/** 446230557Sjimharris * This macro returns the remote node index for this device object 447230557Sjimharris */ 448230557Sjimharris#define scic_sds_remote_device_get_index(this_device) \ 449230557Sjimharris ((this_device)->rnc->remote_node_index) 450230557Sjimharris 451230557Sjimharris/** 452230557Sjimharris * This macro builds a remote device context for the SCU post request 453230557Sjimharris * operation 454230557Sjimharris */ 455230557Sjimharris#define scic_sds_remote_device_build_command_context(device, command) \ 456230557Sjimharris ( (command) \ 457230557Sjimharris | ((U32)(scic_sds_remote_device_get_controller_peg((device))) << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT)\ 458230557Sjimharris | ((U32)(scic_sds_remote_device_get_port_index((device))) << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) \ 459230557Sjimharris | (scic_sds_remote_device_get_index((device))) \ 460230557Sjimharris ) 461230557Sjimharris 462230557Sjimharris/** 463230557Sjimharris * This macro makes the working request assingment for the remote device 464230557Sjimharris * object. To clear the working request use this macro with a NULL request 465230557Sjimharris * object. 466230557Sjimharris */ 467230557Sjimharris#define scic_sds_remote_device_set_working_request(device, request) \ 468230557Sjimharris ((device)->working_request = (request)) 469230557Sjimharris 470230557Sjimharris// --------------------------------------------------------------------------- 471230557Sjimharris 472230557SjimharrisU32 scic_sds_remote_device_get_min_timer_count(void); 473230557Sjimharris 474230557SjimharrisU32 scic_sds_remote_device_get_max_timer_count(void); 475230557Sjimharris 476230557SjimharrisSCI_STATUS scic_sds_remote_device_frame_handler( 477230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 478230557Sjimharris U32 frame_index 479230557Sjimharris); 480230557Sjimharris 481230557SjimharrisSCI_STATUS scic_sds_remote_device_event_handler( 482230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 483230557Sjimharris U32 event_code 484230557Sjimharris); 485230557Sjimharris 486230557SjimharrisSCI_STATUS scic_sds_remote_device_start_io( 487230557Sjimharris struct SCIC_SDS_CONTROLLER *controller, 488230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 489230557Sjimharris struct SCIC_SDS_REQUEST *io_request 490230557Sjimharris); 491230557Sjimharris 492230557SjimharrisSCI_STATUS scic_sds_remote_device_complete_io( 493230557Sjimharris struct SCIC_SDS_CONTROLLER *controller, 494230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 495230557Sjimharris struct SCIC_SDS_REQUEST *io_request 496230557Sjimharris); 497230557Sjimharris 498230557SjimharrisSCI_STATUS scic_sds_remote_device_resume( 499230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device 500230557Sjimharris); 501230557Sjimharris 502230557SjimharrisSCI_STATUS scic_sds_remote_device_suspend( 503230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 504230557Sjimharris U32 suspend_type 505230557Sjimharris); 506230557Sjimharris 507230557SjimharrisSCI_STATUS scic_sds_remote_device_start_task( 508230557Sjimharris struct SCIC_SDS_CONTROLLER *controller, 509230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 510230557Sjimharris struct SCIC_SDS_REQUEST *io_request 511230557Sjimharris); 512230557Sjimharris 513230557Sjimharrisvoid scic_sds_remote_device_post_request( 514230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T * this_device, 515230557Sjimharris U32 request 516230557Sjimharris); 517230557Sjimharris 518230557Sjimharris#if !defined(DISABLE_ATAPI) 519230557SjimharrisBOOL scic_sds_remote_device_is_atapi( 520230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device 521230557Sjimharris); 522230557Sjimharris#else // !defined(DISABLE_ATAPI) 523230557Sjimharris#define scic_sds_remote_device_is_atapi(this_device) FALSE 524230557Sjimharris#endif // !defined(DISABLE_ATAPI) 525230557Sjimharris 526230557Sjimharris// --------------------------------------------------------------------------- 527230557Sjimharris 528230557Sjimharris#ifdef SCI_LOGGING 529230557Sjimharrisvoid scic_sds_remote_device_initialize_state_logging( 530230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device 531230557Sjimharris); 532230557Sjimharris 533230557Sjimharrisvoid scic_sds_remote_device_deinitialize_state_logging( 534230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device 535230557Sjimharris); 536230557Sjimharris#else // SCI_LOGGING 537230557Sjimharris#define scic_sds_remote_device_initialize_state_logging(x) 538230557Sjimharris#define scic_sds_remote_device_deinitialize_state_logging(x) 539230557Sjimharris#endif // SCI_LOGGING 540230557Sjimharris 541230557Sjimharris// --------------------------------------------------------------------------- 542230557Sjimharris 543230557Sjimharrisvoid scic_sds_remote_device_start_request( 544230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T * this_device, 545230557Sjimharris struct SCIC_SDS_REQUEST * the_request, 546230557Sjimharris SCI_STATUS status 547230557Sjimharris); 548230557Sjimharris 549230557Sjimharrisvoid scic_sds_remote_device_continue_request( 550230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T * this_device 551230557Sjimharris); 552230557Sjimharris 553230557SjimharrisSCI_STATUS scic_sds_remote_device_default_start_handler( 554230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *this_device 555230557Sjimharris); 556230557Sjimharris 557230557SjimharrisSCI_STATUS scic_sds_remote_device_default_stop_handler( 558230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *this_device 559230557Sjimharris); 560230557Sjimharris 561230557SjimharrisSCI_STATUS scic_sds_remote_device_default_fail_handler( 562230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *this_device 563230557Sjimharris); 564230557Sjimharris 565230557SjimharrisSCI_STATUS scic_sds_remote_device_default_destruct_handler( 566230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *this_device 567230557Sjimharris); 568230557Sjimharris 569230557SjimharrisSCI_STATUS scic_sds_remote_device_default_reset_handler( 570230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *device 571230557Sjimharris); 572230557Sjimharris 573230557SjimharrisSCI_STATUS scic_sds_remote_device_default_reset_complete_handler( 574230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *device 575230557Sjimharris); 576230557Sjimharris 577230557SjimharrisSCI_STATUS scic_sds_remote_device_default_start_request_handler( 578230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *device, 579230557Sjimharris SCI_BASE_REQUEST_T *request 580230557Sjimharris); 581230557Sjimharris 582230557SjimharrisSCI_STATUS scic_sds_remote_device_default_complete_request_handler( 583230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *device, 584230557Sjimharris SCI_BASE_REQUEST_T *request 585230557Sjimharris); 586230557Sjimharris 587230557SjimharrisSCI_STATUS scic_sds_remote_device_default_continue_request_handler( 588230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *device, 589230557Sjimharris SCI_BASE_REQUEST_T *request 590230557Sjimharris); 591230557Sjimharris 592230557SjimharrisSCI_STATUS scic_sds_remote_device_default_suspend_handler( 593230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 594230557Sjimharris U32 suspend_type 595230557Sjimharris); 596230557Sjimharris 597230557SjimharrisSCI_STATUS scic_sds_remote_device_default_resume_handler( 598230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device 599230557Sjimharris); 600230557Sjimharris 601230557SjimharrisSCI_STATUS scic_sds_remote_device_default_event_handler( 602230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 603230557Sjimharris U32 event_code 604230557Sjimharris); 605230557Sjimharris 606230557SjimharrisSCI_STATUS scic_sds_remote_device_default_frame_handler( 607230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 608230557Sjimharris U32 frame_index 609230557Sjimharris); 610230557Sjimharris 611230557Sjimharris// --------------------------------------------------------------------------- 612230557Sjimharris 613230557SjimharrisSCI_STATUS scic_sds_remote_device_ready_state_stop_handler( 614230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *device 615230557Sjimharris); 616230557Sjimharris 617230557SjimharrisSCI_STATUS scic_sds_remote_device_ready_state_reset_handler( 618230557Sjimharris SCI_BASE_REMOTE_DEVICE_T *device 619230557Sjimharris); 620230557Sjimharris 621230557SjimharrisSCI_STATUS scic_sds_remote_device_general_frame_handler( 622230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 623230557Sjimharris U32 frame_index 624230557Sjimharris); 625230557Sjimharris 626230557SjimharrisSCI_STATUS scic_sds_remote_device_general_event_handler( 627230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device, 628230557Sjimharris U32 event_code 629230557Sjimharris); 630230557Sjimharris 631230557SjimharrisSCI_STATUS scic_sds_ssp_remote_device_ready_suspended_substate_resume_handler( 632230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T *this_device 633230557Sjimharris); 634230557Sjimharris 635230557Sjimharris// --------------------------------------------------------------------------- 636230557Sjimharris 637230557Sjimharrisvoid scic_sds_remote_device_get_info_from_smp_discover_response( 638230557Sjimharris SCIC_SDS_REMOTE_DEVICE_T * this_device, 639230557Sjimharris SMP_RESPONSE_DISCOVER_T * discover_response 640230557Sjimharris); 641230557Sjimharris 642230557Sjimharris#ifdef __cplusplus 643230557Sjimharris} 644230557Sjimharris#endif // __cplusplus 645230557Sjimharris 646230557Sjimharris#endif // _SCIC_SDS_REMOTE_DEVICE_H_ 647