Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 3 | * redistributing this file, you may do so under either license. |
| 4 | * |
| 5 | * GPL LICENSE SUMMARY |
| 6 | * |
| 7 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of version 2 of the GNU General Public License as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
| 21 | * The full GNU General Public License is included in this distribution |
| 22 | * in the file called LICENSE.GPL. |
| 23 | * |
| 24 | * BSD LICENSE |
| 25 | * |
| 26 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. |
| 27 | * All rights reserved. |
| 28 | * |
| 29 | * Redistribution and use in source and binary forms, with or without |
| 30 | * modification, are permitted provided that the following conditions |
| 31 | * are met: |
| 32 | * |
| 33 | * * Redistributions of source code must retain the above copyright |
| 34 | * notice, this list of conditions and the following disclaimer. |
| 35 | * * Redistributions in binary form must reproduce the above copyright |
| 36 | * notice, this list of conditions and the following disclaimer in |
| 37 | * the documentation and/or other materials provided with the |
| 38 | * distribution. |
| 39 | * * Neither the name of Intel Corporation nor the names of its |
| 40 | * contributors may be used to endorse or promote products derived |
| 41 | * from this software without specific prior written permission. |
| 42 | * |
| 43 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 44 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 45 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 46 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 47 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 48 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 49 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 50 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 51 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 52 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 54 | */ |
| 55 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 56 | #ifndef _ISCI_REMOTE_DEVICE_H_ |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 57 | #define _ISCI_REMOTE_DEVICE_H_ |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 58 | #include <scsi/libsas.h> |
| 59 | #include "sci_status.h" |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 60 | #include "scu_remote_node_context.h" |
| 61 | #include "remote_node_context.h" |
| 62 | #include "port.h" |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 63 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 64 | enum scic_remote_device_not_ready_reason_code { |
| 65 | SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED, |
| 66 | SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED, |
| 67 | SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED, |
| 68 | SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED, |
| 69 | SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED, |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 70 | SCIC_REMOTE_DEVICE_NOT_READY_REASON_CODE_MAX |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | struct scic_sds_remote_device { |
| 74 | /** |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 75 | * This field contains the information for the base remote device state |
| 76 | * machine. |
| 77 | */ |
| 78 | struct sci_base_state_machine state_machine; |
| 79 | |
| 80 | /** |
| 81 | * This field is the programmed device port width. This value is |
| 82 | * written to the RCN data structure to tell the SCU how many open |
| 83 | * connections this device can have. |
| 84 | */ |
| 85 | u32 device_port_width; |
| 86 | |
| 87 | /** |
| 88 | * This field is the programmed connection rate for this remote device. It is |
| 89 | * used to program the TC with the maximum allowed connection rate. |
| 90 | */ |
| 91 | enum sas_linkrate connection_rate; |
| 92 | |
| 93 | /** |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 94 | * This filed is assinged the value of true if the device is directly |
| 95 | * attached to the port. |
| 96 | */ |
| 97 | bool is_direct_attached; |
| 98 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 99 | /** |
| 100 | * This filed contains a pointer back to the port to which this device |
| 101 | * is assigned. |
| 102 | */ |
| 103 | struct scic_sds_port *owning_port; |
| 104 | |
| 105 | /** |
| 106 | * This field contains the SCU silicon remote node context specific |
| 107 | * information. |
| 108 | */ |
| 109 | struct scic_sds_remote_node_context rnc; |
| 110 | |
| 111 | /** |
| 112 | * This field contains the stated request count for the remote device. The |
| 113 | * device can not reach the SCI_BASE_REMOTE_DEVICE_STATE_STOPPED until all |
| 114 | * requests are complete and the rnc_posted value is false. |
| 115 | */ |
| 116 | u32 started_request_count; |
| 117 | |
| 118 | /** |
| 119 | * This field contains a pointer to the working request object. It is only |
| 120 | * used only for SATA requests since the unsolicited frames we get from the |
| 121 | * hardware have no Tag value to look up the io request object. |
| 122 | */ |
| 123 | struct scic_sds_request *working_request; |
| 124 | |
| 125 | /** |
| 126 | * This field contains the reason for the remote device going not_ready. It is |
| 127 | * assigned in the state handlers and used in the state transition. |
| 128 | */ |
| 129 | u32 not_ready_reason; |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 130 | }; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 131 | |
| 132 | struct isci_remote_device { |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 133 | enum isci_status status; |
Dan Williams | 6ad31fe | 2011-03-04 12:10:29 -0800 | [diff] [blame] | 134 | #define IDEV_START_PENDING 0 |
| 135 | #define IDEV_STOP_PENDING 1 |
Dan Williams | d9c3739 | 2011-03-03 17:59:32 -0800 | [diff] [blame] | 136 | #define IDEV_ALLOCATED 2 |
Dan Williams | d06b487 | 2011-05-02 13:59:25 -0700 | [diff] [blame^] | 137 | #define IDEV_EH 3 |
Dan Williams | 6ad31fe | 2011-03-04 12:10:29 -0800 | [diff] [blame] | 138 | unsigned long flags; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 139 | struct isci_port *isci_port; |
| 140 | struct domain_device *domain_dev; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 141 | struct list_head node; |
| 142 | struct list_head reqs_in_process; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 143 | spinlock_t state_lock; |
Dan Williams | 57f20f4 | 2011-04-21 18:14:45 -0700 | [diff] [blame] | 144 | struct scic_sds_remote_device sci; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 145 | }; |
| 146 | |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 147 | #define ISCI_REMOTE_DEVICE_START_TIMEOUT 5000 |
| 148 | |
Dan Williams | 6ad31fe | 2011-03-04 12:10:29 -0800 | [diff] [blame] | 149 | enum sci_status isci_remote_device_stop(struct isci_host *ihost, |
| 150 | struct isci_remote_device *idev); |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 151 | void isci_remote_device_nuke_requests(struct isci_host *ihost, |
| 152 | struct isci_remote_device *idev); |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 153 | void isci_remote_device_gone(struct domain_device *domain_dev); |
| 154 | int isci_remote_device_found(struct domain_device *domain_dev); |
| 155 | bool isci_device_is_reset_pending(struct isci_host *ihost, |
| 156 | struct isci_remote_device *idev); |
| 157 | void isci_device_clear_reset_pending(struct isci_host *ihost, |
| 158 | struct isci_remote_device *idev); |
| 159 | void isci_remote_device_change_state(struct isci_remote_device *idev, |
| 160 | enum isci_status status); |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 161 | /** |
| 162 | * scic_remote_device_stop() - This method will stop both transmission and |
| 163 | * reception of link activity for the supplied remote device. This method |
| 164 | * disables normal IO requests from flowing through to the remote device. |
| 165 | * @remote_device: This parameter specifies the device to be stopped. |
| 166 | * @timeout: This parameter specifies the number of milliseconds in which the |
| 167 | * stop operation should complete. |
| 168 | * |
| 169 | * An indication of whether the device was successfully stopped. SCI_SUCCESS |
| 170 | * This value is returned if the transmission and reception for the device was |
| 171 | * successfully stopped. |
| 172 | */ |
| 173 | enum sci_status scic_remote_device_stop( |
| 174 | struct scic_sds_remote_device *remote_device, |
| 175 | u32 timeout); |
| 176 | |
| 177 | /** |
| 178 | * scic_remote_device_reset() - This method will reset the device making it |
| 179 | * ready for operation. This method must be called anytime the device is |
| 180 | * reset either through a SMP phy control or a port hard reset request. |
| 181 | * @remote_device: This parameter specifies the device to be reset. |
| 182 | * |
| 183 | * This method does not actually cause the device hardware to be reset. This |
| 184 | * method resets the software object so that it will be operational after a |
| 185 | * device hardware reset completes. An indication of whether the device reset |
| 186 | * was accepted. SCI_SUCCESS This value is returned if the device reset is |
| 187 | * started. |
| 188 | */ |
| 189 | enum sci_status scic_remote_device_reset( |
| 190 | struct scic_sds_remote_device *remote_device); |
| 191 | |
| 192 | /** |
| 193 | * scic_remote_device_reset_complete() - This method informs the device object |
| 194 | * that the reset operation is complete and the device can resume operation |
| 195 | * again. |
| 196 | * @remote_device: This parameter specifies the device which is to be informed |
| 197 | * of the reset complete operation. |
| 198 | * |
| 199 | * An indication that the device is resuming operation. SCI_SUCCESS the device |
| 200 | * is resuming operation. |
| 201 | */ |
| 202 | enum sci_status scic_remote_device_reset_complete( |
| 203 | struct scic_sds_remote_device *remote_device); |
| 204 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 205 | #define scic_remote_device_is_atapi(device_handle) false |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 206 | |
| 207 | /** |
| 208 | * enum scic_sds_remote_device_states - This enumeration depicts all the states |
| 209 | * for the common remote device state machine. |
| 210 | * |
| 211 | * |
| 212 | */ |
| 213 | enum scic_sds_remote_device_states { |
| 214 | /** |
| 215 | * Simply the initial state for the base remote device state machine. |
| 216 | */ |
| 217 | SCI_BASE_REMOTE_DEVICE_STATE_INITIAL, |
| 218 | |
| 219 | /** |
| 220 | * This state indicates that the remote device has successfully been |
| 221 | * stopped. In this state no new IO operations are permitted. |
| 222 | * This state is entered from the INITIAL state. |
| 223 | * This state is entered from the STOPPING state. |
| 224 | */ |
| 225 | SCI_BASE_REMOTE_DEVICE_STATE_STOPPED, |
| 226 | |
| 227 | /** |
| 228 | * This state indicates the the remote device is in the process of |
| 229 | * becoming ready (i.e. starting). In this state no new IO operations |
| 230 | * are permitted. |
| 231 | * This state is entered from the STOPPED state. |
| 232 | */ |
| 233 | SCI_BASE_REMOTE_DEVICE_STATE_STARTING, |
| 234 | |
| 235 | /** |
| 236 | * This state indicates the remote device is now ready. Thus, the user |
| 237 | * is able to perform IO operations on the remote device. |
| 238 | * This state is entered from the STARTING state. |
| 239 | */ |
| 240 | SCI_BASE_REMOTE_DEVICE_STATE_READY, |
| 241 | |
| 242 | /** |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 243 | * This is the idle substate for the stp remote device. When there are no |
| 244 | * active IO for the device it is is in this state. |
| 245 | */ |
| 246 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE, |
| 247 | |
| 248 | /** |
| 249 | * This is the command state for for the STP remote device. This state is |
| 250 | * entered when the device is processing a non-NCQ command. The device object |
| 251 | * will fail any new start IO requests until this command is complete. |
| 252 | */ |
| 253 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD, |
| 254 | |
| 255 | /** |
| 256 | * This is the NCQ state for the STP remote device. This state is entered |
| 257 | * when the device is processing an NCQ reuqest. It will remain in this state |
| 258 | * so long as there is one or more NCQ requests being processed. |
| 259 | */ |
| 260 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ, |
| 261 | |
| 262 | /** |
| 263 | * This is the NCQ error state for the STP remote device. This state is |
| 264 | * entered when an SDB error FIS is received by the device object while in the |
| 265 | * NCQ state. The device object will only accept a READ LOG command while in |
| 266 | * this state. |
| 267 | */ |
| 268 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR, |
| 269 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 270 | /** |
| 271 | * This is the READY substate indicates the device is waiting for the RESET task |
| 272 | * coming to be recovered from certain hardware specific error. |
| 273 | */ |
| 274 | SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET, |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 275 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 276 | /** |
| 277 | * This is the ready operational substate for the remote device. This is the |
| 278 | * normal operational state for a remote device. |
| 279 | */ |
| 280 | SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE, |
| 281 | |
| 282 | /** |
| 283 | * This is the suspended state for the remote device. This is the state that |
| 284 | * the device is placed in when a RNC suspend is received by the SCU hardware. |
| 285 | */ |
| 286 | SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD, |
Dan Williams | ab2e8f7 | 2011-04-27 16:32:45 -0700 | [diff] [blame] | 287 | |
| 288 | /** |
| 289 | * This state indicates that the remote device is in the process of |
| 290 | * stopping. In this state no new IO operations are permitted, but |
| 291 | * existing IO operations are allowed to complete. |
| 292 | * This state is entered from the READY state. |
| 293 | * This state is entered from the FAILED state. |
| 294 | */ |
| 295 | SCI_BASE_REMOTE_DEVICE_STATE_STOPPING, |
| 296 | |
| 297 | /** |
| 298 | * This state indicates that the remote device has failed. |
| 299 | * In this state no new IO operations are permitted. |
| 300 | * This state is entered from the INITIALIZING state. |
| 301 | * This state is entered from the READY state. |
| 302 | */ |
| 303 | SCI_BASE_REMOTE_DEVICE_STATE_FAILED, |
| 304 | |
| 305 | /** |
| 306 | * This state indicates the device is being reset. |
| 307 | * In this state no new IO operations are permitted. |
| 308 | * This state is entered from the READY state. |
| 309 | */ |
| 310 | SCI_BASE_REMOTE_DEVICE_STATE_RESETTING, |
| 311 | |
| 312 | /** |
| 313 | * Simply the final state for the base remote device state machine. |
| 314 | */ |
| 315 | SCI_BASE_REMOTE_DEVICE_STATE_FINAL, |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 316 | }; |
| 317 | |
| 318 | static inline struct scic_sds_remote_device *rnc_to_dev(struct scic_sds_remote_node_context *rnc) |
| 319 | { |
| 320 | struct scic_sds_remote_device *sci_dev; |
| 321 | |
| 322 | sci_dev = container_of(rnc, typeof(*sci_dev), rnc); |
| 323 | |
| 324 | return sci_dev; |
| 325 | } |
| 326 | |
Maciej Patelczyk | 5d937e9 | 2011-04-28 22:06:21 +0000 | [diff] [blame] | 327 | static inline struct isci_remote_device *sci_dev_to_idev(struct scic_sds_remote_device *sci_dev) |
Dan Williams | a1a113b | 2011-04-21 18:44:45 -0700 | [diff] [blame] | 328 | { |
| 329 | struct isci_remote_device *idev = container_of(sci_dev, typeof(*idev), sci); |
| 330 | |
Maciej Patelczyk | 5d937e9 | 2011-04-28 22:06:21 +0000 | [diff] [blame] | 331 | return idev; |
| 332 | } |
| 333 | |
| 334 | static inline struct domain_device *sci_dev_to_domain(struct scic_sds_remote_device *sci_dev) |
| 335 | { |
| 336 | return sci_dev_to_idev(sci_dev)->domain_dev; |
Dan Williams | a1a113b | 2011-04-21 18:44:45 -0700 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | static inline bool dev_is_expander(struct domain_device *dev) |
| 340 | { |
| 341 | return dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV; |
| 342 | } |
| 343 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 344 | /** |
| 345 | * scic_sds_remote_device_increment_request_count() - |
| 346 | * |
| 347 | * This macro incrments the request count for this device |
| 348 | */ |
| 349 | #define scic_sds_remote_device_increment_request_count(sci_dev) \ |
| 350 | ((sci_dev)->started_request_count++) |
| 351 | |
| 352 | /** |
| 353 | * scic_sds_remote_device_decrement_request_count() - |
| 354 | * |
| 355 | * This macro decrements the request count for this device. This count will |
| 356 | * never decrment past 0. |
| 357 | */ |
| 358 | #define scic_sds_remote_device_decrement_request_count(sci_dev) \ |
| 359 | ((sci_dev)->started_request_count > 0 ? \ |
| 360 | (sci_dev)->started_request_count-- : 0) |
| 361 | |
| 362 | /** |
| 363 | * scic_sds_remote_device_get_request_count() - |
| 364 | * |
| 365 | * This is a helper macro to return the current device request count. |
| 366 | */ |
| 367 | #define scic_sds_remote_device_get_request_count(sci_dev) \ |
| 368 | ((sci_dev)->started_request_count) |
| 369 | |
| 370 | /** |
| 371 | * scic_sds_remote_device_get_port() - |
| 372 | * |
| 373 | * This macro returns the owning port of this remote device obejct. |
| 374 | */ |
| 375 | #define scic_sds_remote_device_get_port(sci_dev) \ |
| 376 | ((sci_dev)->owning_port) |
| 377 | |
| 378 | /** |
| 379 | * scic_sds_remote_device_get_controller() - |
| 380 | * |
| 381 | * This macro returns the controller object that contains this device object |
| 382 | */ |
| 383 | #define scic_sds_remote_device_get_controller(sci_dev) \ |
| 384 | scic_sds_port_get_controller(scic_sds_remote_device_get_port(sci_dev)) |
| 385 | |
| 386 | /** |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 387 | * scic_sds_remote_device_get_port() - |
| 388 | * |
| 389 | * This macro returns the owning port of this device |
| 390 | */ |
| 391 | #define scic_sds_remote_device_get_port(sci_dev) \ |
| 392 | ((sci_dev)->owning_port) |
| 393 | |
| 394 | /** |
| 395 | * scic_sds_remote_device_get_sequence() - |
| 396 | * |
| 397 | * This macro returns the remote device sequence value |
| 398 | */ |
| 399 | #define scic_sds_remote_device_get_sequence(sci_dev) \ |
| 400 | (\ |
| 401 | scic_sds_remote_device_get_controller(sci_dev)-> \ |
| 402 | remote_device_sequence[(sci_dev)->rnc.remote_node_index] \ |
| 403 | ) |
| 404 | |
| 405 | /** |
| 406 | * scic_sds_remote_device_get_controller_peg() - |
| 407 | * |
| 408 | * This macro returns the controllers protocol engine group |
| 409 | */ |
| 410 | #define scic_sds_remote_device_get_controller_peg(sci_dev) \ |
| 411 | (\ |
| 412 | scic_sds_controller_get_protocol_engine_group(\ |
| 413 | scic_sds_port_get_controller(\ |
| 414 | scic_sds_remote_device_get_port(sci_dev) \ |
| 415 | ) \ |
| 416 | ) \ |
| 417 | ) |
| 418 | |
| 419 | /** |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 420 | * scic_sds_remote_device_get_index() - |
| 421 | * |
| 422 | * This macro returns the remote node index for this device object |
| 423 | */ |
| 424 | #define scic_sds_remote_device_get_index(sci_dev) \ |
| 425 | ((sci_dev)->rnc.remote_node_index) |
| 426 | |
| 427 | /** |
| 428 | * scic_sds_remote_device_build_command_context() - |
| 429 | * |
| 430 | * This macro builds a remote device context for the SCU post request operation |
| 431 | */ |
| 432 | #define scic_sds_remote_device_build_command_context(device, command) \ |
| 433 | ((command) \ |
| 434 | | (scic_sds_remote_device_get_controller_peg((device)) << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) \ |
Dan Williams | 1f4fa1f | 2011-04-26 11:44:06 -0700 | [diff] [blame] | 435 | | ((device)->owning_port->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) \ |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 436 | | (scic_sds_remote_device_get_index((device))) \ |
| 437 | ) |
| 438 | |
| 439 | /** |
| 440 | * scic_sds_remote_device_set_working_request() - |
| 441 | * |
| 442 | * This macro makes the working request assingment for the remote device |
| 443 | * object. To clear the working request use this macro with a NULL request |
| 444 | * object. |
| 445 | */ |
| 446 | #define scic_sds_remote_device_set_working_request(device, request) \ |
| 447 | ((device)->working_request = (request)) |
| 448 | |
| 449 | enum sci_status scic_sds_remote_device_frame_handler( |
| 450 | struct scic_sds_remote_device *sci_dev, |
| 451 | u32 frame_index); |
| 452 | |
| 453 | enum sci_status scic_sds_remote_device_event_handler( |
| 454 | struct scic_sds_remote_device *sci_dev, |
| 455 | u32 event_code); |
| 456 | |
| 457 | enum sci_status scic_sds_remote_device_start_io( |
| 458 | struct scic_sds_controller *controller, |
| 459 | struct scic_sds_remote_device *sci_dev, |
| 460 | struct scic_sds_request *io_request); |
| 461 | |
Dan Williams | ab2e8f7 | 2011-04-27 16:32:45 -0700 | [diff] [blame] | 462 | enum sci_status scic_sds_remote_device_start_task( |
| 463 | struct scic_sds_controller *controller, |
| 464 | struct scic_sds_remote_device *sci_dev, |
| 465 | struct scic_sds_request *io_request); |
| 466 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 467 | enum sci_status scic_sds_remote_device_complete_io( |
| 468 | struct scic_sds_controller *controller, |
| 469 | struct scic_sds_remote_device *sci_dev, |
| 470 | struct scic_sds_request *io_request); |
| 471 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 472 | enum sci_status scic_sds_remote_device_suspend( |
| 473 | struct scic_sds_remote_device *sci_dev, |
| 474 | u32 suspend_type); |
| 475 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 476 | void scic_sds_remote_device_post_request( |
| 477 | struct scic_sds_remote_device *sci_dev, |
| 478 | u32 request); |
| 479 | |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 480 | #define scic_sds_remote_device_is_atapi(sci_dev) false |
Dan Williams | 88f3b62 | 2011-04-22 19:18:03 -0700 | [diff] [blame] | 481 | |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 482 | #endif /* !defined(_ISCI_REMOTE_DEVICE_H_) */ |