aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/remote_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/isci/remote_device.c')
-rw-r--r--drivers/scsi/isci/remote_device.c300
1 files changed, 150 insertions, 150 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index 9043b458c999..8c752abb4331 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -68,7 +68,7 @@
68 * @isci_host: This parameter specifies the isci host object. 68 * @isci_host: This parameter specifies the isci host object.
69 * @isci_device: This parameter specifies the remote device 69 * @isci_device: This parameter specifies the remote device
70 * 70 *
71 * scic_lock is held on entrance to this function. 71 * sci_lock is held on entrance to this function.
72 */ 72 */
73static void isci_remote_device_not_ready(struct isci_host *ihost, 73static void isci_remote_device_not_ready(struct isci_host *ihost,
74 struct isci_remote_device *idev, u32 reason) 74 struct isci_remote_device *idev, u32 reason)
@@ -92,7 +92,7 @@ static void isci_remote_device_not_ready(struct isci_host *ihost,
92 "%s: isci_device = %p request = %p\n", 92 "%s: isci_device = %p request = %p\n",
93 __func__, idev, ireq); 93 __func__, idev, ireq);
94 94
95 scic_controller_terminate_request(ihost, 95 sci_controller_terminate_request(ihost,
96 idev, 96 idev,
97 ireq); 97 ireq);
98 } 98 }
@@ -133,7 +133,7 @@ static void rnc_destruct_done(void *_dev)
133 sci_change_state(&idev->sm, SCI_DEV_STOPPED); 133 sci_change_state(&idev->sm, SCI_DEV_STOPPED);
134} 134}
135 135
136static enum sci_status scic_sds_remote_device_terminate_requests(struct isci_remote_device *idev) 136static enum sci_status sci_remote_device_terminate_requests(struct isci_remote_device *idev)
137{ 137{
138 struct isci_host *ihost = idev->owning_port->owning_controller; 138 struct isci_host *ihost = idev->owning_port->owning_controller;
139 enum sci_status status = SCI_SUCCESS; 139 enum sci_status status = SCI_SUCCESS;
@@ -147,7 +147,7 @@ static enum sci_status scic_sds_remote_device_terminate_requests(struct isci_rem
147 ireq->target_device != idev) 147 ireq->target_device != idev)
148 continue; 148 continue;
149 149
150 s = scic_controller_terminate_request(ihost, idev, ireq); 150 s = sci_controller_terminate_request(ihost, idev, ireq);
151 if (s != SCI_SUCCESS) 151 if (s != SCI_SUCCESS)
152 status = s; 152 status = s;
153 } 153 }
@@ -155,11 +155,11 @@ static enum sci_status scic_sds_remote_device_terminate_requests(struct isci_rem
155 return status; 155 return status;
156} 156}
157 157
158enum sci_status scic_remote_device_stop(struct isci_remote_device *idev, 158enum sci_status sci_remote_device_stop(struct isci_remote_device *idev,
159 u32 timeout) 159 u32 timeout)
160{ 160{
161 struct sci_base_state_machine *sm = &idev->sm; 161 struct sci_base_state_machine *sm = &idev->sm;
162 enum scic_sds_remote_device_states state = sm->current_state_id; 162 enum sci_remote_device_states state = sm->current_state_id;
163 163
164 switch (state) { 164 switch (state) {
165 case SCI_DEV_INITIAL: 165 case SCI_DEV_INITIAL:
@@ -174,7 +174,7 @@ enum sci_status scic_remote_device_stop(struct isci_remote_device *idev,
174 case SCI_DEV_STARTING: 174 case SCI_DEV_STARTING:
175 /* device not started so there had better be no requests */ 175 /* device not started so there had better be no requests */
176 BUG_ON(idev->started_request_count != 0); 176 BUG_ON(idev->started_request_count != 0);
177 scic_sds_remote_node_context_destruct(&idev->rnc, 177 sci_remote_node_context_destruct(&idev->rnc,
178 rnc_destruct_done, idev); 178 rnc_destruct_done, idev);
179 /* Transition to the stopping state and wait for the 179 /* Transition to the stopping state and wait for the
180 * remote node to complete being posted and invalidated. 180 * remote node to complete being posted and invalidated.
@@ -191,28 +191,28 @@ enum sci_status scic_remote_device_stop(struct isci_remote_device *idev,
191 case SCI_SMP_DEV_CMD: 191 case SCI_SMP_DEV_CMD:
192 sci_change_state(sm, SCI_DEV_STOPPING); 192 sci_change_state(sm, SCI_DEV_STOPPING);
193 if (idev->started_request_count == 0) { 193 if (idev->started_request_count == 0) {
194 scic_sds_remote_node_context_destruct(&idev->rnc, 194 sci_remote_node_context_destruct(&idev->rnc,
195 rnc_destruct_done, idev); 195 rnc_destruct_done, idev);
196 return SCI_SUCCESS; 196 return SCI_SUCCESS;
197 } else 197 } else
198 return scic_sds_remote_device_terminate_requests(idev); 198 return sci_remote_device_terminate_requests(idev);
199 break; 199 break;
200 case SCI_DEV_STOPPING: 200 case SCI_DEV_STOPPING:
201 /* All requests should have been terminated, but if there is an 201 /* All requests should have been terminated, but if there is an
202 * attempt to stop a device already in the stopping state, then 202 * attempt to stop a device already in the stopping state, then
203 * try again to terminate. 203 * try again to terminate.
204 */ 204 */
205 return scic_sds_remote_device_terminate_requests(idev); 205 return sci_remote_device_terminate_requests(idev);
206 case SCI_DEV_RESETTING: 206 case SCI_DEV_RESETTING:
207 sci_change_state(sm, SCI_DEV_STOPPING); 207 sci_change_state(sm, SCI_DEV_STOPPING);
208 return SCI_SUCCESS; 208 return SCI_SUCCESS;
209 } 209 }
210} 210}
211 211
212enum sci_status scic_remote_device_reset(struct isci_remote_device *idev) 212enum sci_status sci_remote_device_reset(struct isci_remote_device *idev)
213{ 213{
214 struct sci_base_state_machine *sm = &idev->sm; 214 struct sci_base_state_machine *sm = &idev->sm;
215 enum scic_sds_remote_device_states state = sm->current_state_id; 215 enum sci_remote_device_states state = sm->current_state_id;
216 216
217 switch (state) { 217 switch (state) {
218 case SCI_DEV_INITIAL: 218 case SCI_DEV_INITIAL:
@@ -239,10 +239,10 @@ enum sci_status scic_remote_device_reset(struct isci_remote_device *idev)
239 } 239 }
240} 240}
241 241
242enum sci_status scic_remote_device_reset_complete(struct isci_remote_device *idev) 242enum sci_status sci_remote_device_reset_complete(struct isci_remote_device *idev)
243{ 243{
244 struct sci_base_state_machine *sm = &idev->sm; 244 struct sci_base_state_machine *sm = &idev->sm;
245 enum scic_sds_remote_device_states state = sm->current_state_id; 245 enum sci_remote_device_states state = sm->current_state_id;
246 246
247 if (state != SCI_DEV_RESETTING) { 247 if (state != SCI_DEV_RESETTING) {
248 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", 248 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n",
@@ -254,11 +254,11 @@ enum sci_status scic_remote_device_reset_complete(struct isci_remote_device *ide
254 return SCI_SUCCESS; 254 return SCI_SUCCESS;
255} 255}
256 256
257enum sci_status scic_sds_remote_device_suspend(struct isci_remote_device *idev, 257enum sci_status sci_remote_device_suspend(struct isci_remote_device *idev,
258 u32 suspend_type) 258 u32 suspend_type)
259{ 259{
260 struct sci_base_state_machine *sm = &idev->sm; 260 struct sci_base_state_machine *sm = &idev->sm;
261 enum scic_sds_remote_device_states state = sm->current_state_id; 261 enum sci_remote_device_states state = sm->current_state_id;
262 262
263 if (state != SCI_STP_DEV_CMD) { 263 if (state != SCI_STP_DEV_CMD) {
264 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", 264 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n",
@@ -266,15 +266,15 @@ enum sci_status scic_sds_remote_device_suspend(struct isci_remote_device *idev,
266 return SCI_FAILURE_INVALID_STATE; 266 return SCI_FAILURE_INVALID_STATE;
267 } 267 }
268 268
269 return scic_sds_remote_node_context_suspend(&idev->rnc, 269 return sci_remote_node_context_suspend(&idev->rnc,
270 suspend_type, NULL, NULL); 270 suspend_type, NULL, NULL);
271} 271}
272 272
273enum sci_status scic_sds_remote_device_frame_handler(struct isci_remote_device *idev, 273enum sci_status sci_remote_device_frame_handler(struct isci_remote_device *idev,
274 u32 frame_index) 274 u32 frame_index)
275{ 275{
276 struct sci_base_state_machine *sm = &idev->sm; 276 struct sci_base_state_machine *sm = &idev->sm;
277 enum scic_sds_remote_device_states state = sm->current_state_id; 277 enum sci_remote_device_states state = sm->current_state_id;
278 struct isci_host *ihost = idev->owning_port->owning_controller; 278 struct isci_host *ihost = idev->owning_port->owning_controller;
279 enum sci_status status; 279 enum sci_status status;
280 280
@@ -289,7 +289,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct isci_remote_device *
289 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", 289 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n",
290 __func__, state); 290 __func__, state);
291 /* Return the frame back to the controller */ 291 /* Return the frame back to the controller */
292 scic_sds_controller_release_frame(ihost, frame_index); 292 sci_controller_release_frame(ihost, frame_index);
293 return SCI_FAILURE_INVALID_STATE; 293 return SCI_FAILURE_INVALID_STATE;
294 case SCI_DEV_READY: 294 case SCI_DEV_READY:
295 case SCI_STP_DEV_NCQ_ERROR: 295 case SCI_STP_DEV_NCQ_ERROR:
@@ -302,7 +302,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct isci_remote_device *
302 void *frame_header; 302 void *frame_header;
303 ssize_t word_cnt; 303 ssize_t word_cnt;
304 304
305 status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 305 status = sci_unsolicited_frame_control_get_header(&ihost->uf_control,
306 frame_index, 306 frame_index,
307 &frame_header); 307 &frame_header);
308 if (status != SCI_SUCCESS) 308 if (status != SCI_SUCCESS)
@@ -311,22 +311,22 @@ enum sci_status scic_sds_remote_device_frame_handler(struct isci_remote_device *
311 word_cnt = sizeof(hdr) / sizeof(u32); 311 word_cnt = sizeof(hdr) / sizeof(u32);
312 sci_swab32_cpy(&hdr, frame_header, word_cnt); 312 sci_swab32_cpy(&hdr, frame_header, word_cnt);
313 313
314 ireq = scic_request_by_tag(ihost, be16_to_cpu(hdr.tag)); 314 ireq = sci_request_by_tag(ihost, be16_to_cpu(hdr.tag));
315 if (ireq && ireq->target_device == idev) { 315 if (ireq && ireq->target_device == idev) {
316 /* The IO request is now in charge of releasing the frame */ 316 /* The IO request is now in charge of releasing the frame */
317 status = scic_sds_io_request_frame_handler(ireq, frame_index); 317 status = sci_io_request_frame_handler(ireq, frame_index);
318 } else { 318 } else {
319 /* We could not map this tag to a valid IO 319 /* We could not map this tag to a valid IO
320 * request Just toss the frame and continue 320 * request Just toss the frame and continue
321 */ 321 */
322 scic_sds_controller_release_frame(ihost, frame_index); 322 sci_controller_release_frame(ihost, frame_index);
323 } 323 }
324 break; 324 break;
325 } 325 }
326 case SCI_STP_DEV_NCQ: { 326 case SCI_STP_DEV_NCQ: {
327 struct dev_to_host_fis *hdr; 327 struct dev_to_host_fis *hdr;
328 328
329 status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 329 status = sci_unsolicited_frame_control_get_header(&ihost->uf_control,
330 frame_index, 330 frame_index,
331 (void **)&hdr); 331 (void **)&hdr);
332 if (status != SCI_SUCCESS) 332 if (status != SCI_SUCCESS)
@@ -349,7 +349,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct isci_remote_device *
349 } else 349 } else
350 status = SCI_FAILURE; 350 status = SCI_FAILURE;
351 351
352 scic_sds_controller_release_frame(ihost, frame_index); 352 sci_controller_release_frame(ihost, frame_index);
353 break; 353 break;
354 } 354 }
355 case SCI_STP_DEV_CMD: 355 case SCI_STP_DEV_CMD:
@@ -358,7 +358,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct isci_remote_device *
358 * in this state. All unsolicited frames are forwarded to the io request 358 * in this state. All unsolicited frames are forwarded to the io request
359 * object. 359 * object.
360 */ 360 */
361 status = scic_sds_io_request_frame_handler(idev->working_request, frame_index); 361 status = sci_io_request_frame_handler(idev->working_request, frame_index);
362 break; 362 break;
363 } 363 }
364 364
@@ -369,7 +369,7 @@ static bool is_remote_device_ready(struct isci_remote_device *idev)
369{ 369{
370 370
371 struct sci_base_state_machine *sm = &idev->sm; 371 struct sci_base_state_machine *sm = &idev->sm;
372 enum scic_sds_remote_device_states state = sm->current_state_id; 372 enum sci_remote_device_states state = sm->current_state_id;
373 373
374 switch (state) { 374 switch (state) {
375 case SCI_DEV_READY: 375 case SCI_DEV_READY:
@@ -386,25 +386,25 @@ static bool is_remote_device_ready(struct isci_remote_device *idev)
386 } 386 }
387} 387}
388 388
389enum sci_status scic_sds_remote_device_event_handler(struct isci_remote_device *idev, 389enum sci_status sci_remote_device_event_handler(struct isci_remote_device *idev,
390 u32 event_code) 390 u32 event_code)
391{ 391{
392 struct sci_base_state_machine *sm = &idev->sm; 392 struct sci_base_state_machine *sm = &idev->sm;
393 enum scic_sds_remote_device_states state = sm->current_state_id; 393 enum sci_remote_device_states state = sm->current_state_id;
394 enum sci_status status; 394 enum sci_status status;
395 395
396 switch (scu_get_event_type(event_code)) { 396 switch (scu_get_event_type(event_code)) {
397 case SCU_EVENT_TYPE_RNC_OPS_MISC: 397 case SCU_EVENT_TYPE_RNC_OPS_MISC:
398 case SCU_EVENT_TYPE_RNC_SUSPEND_TX: 398 case SCU_EVENT_TYPE_RNC_SUSPEND_TX:
399 case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX: 399 case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX:
400 status = scic_sds_remote_node_context_event_handler(&idev->rnc, event_code); 400 status = sci_remote_node_context_event_handler(&idev->rnc, event_code);
401 break; 401 break;
402 case SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT: 402 case SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT:
403 if (scu_get_event_code(event_code) == SCU_EVENT_IT_NEXUS_TIMEOUT) { 403 if (scu_get_event_code(event_code) == SCU_EVENT_IT_NEXUS_TIMEOUT) {
404 status = SCI_SUCCESS; 404 status = SCI_SUCCESS;
405 405
406 /* Suspend the associated RNC */ 406 /* Suspend the associated RNC */
407 scic_sds_remote_node_context_suspend(&idev->rnc, 407 sci_remote_node_context_suspend(&idev->rnc,
408 SCI_SOFTWARE_SUSPENSION, 408 SCI_SOFTWARE_SUSPENSION,
409 NULL, NULL); 409 NULL, NULL);
410 410
@@ -439,13 +439,13 @@ enum sci_status scic_sds_remote_device_event_handler(struct isci_remote_device *
439 */ 439 */
440 if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX || 440 if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX ||
441 scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX) 441 scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX)
442 status = scic_sds_remote_node_context_resume(&idev->rnc, NULL, NULL); 442 status = sci_remote_node_context_resume(&idev->rnc, NULL, NULL);
443 } 443 }
444 444
445 return status; 445 return status;
446} 446}
447 447
448static void scic_sds_remote_device_start_request(struct isci_remote_device *idev, 448static void sci_remote_device_start_request(struct isci_remote_device *idev,
449 struct isci_request *ireq, 449 struct isci_request *ireq,
450 enum sci_status status) 450 enum sci_status status)
451{ 451{
@@ -453,19 +453,19 @@ static void scic_sds_remote_device_start_request(struct isci_remote_device *idev
453 453
454 /* cleanup requests that failed after starting on the port */ 454 /* cleanup requests that failed after starting on the port */
455 if (status != SCI_SUCCESS) 455 if (status != SCI_SUCCESS)
456 scic_sds_port_complete_io(iport, idev, ireq); 456 sci_port_complete_io(iport, idev, ireq);
457 else { 457 else {
458 kref_get(&idev->kref); 458 kref_get(&idev->kref);
459 scic_sds_remote_device_increment_request_count(idev); 459 sci_remote_device_increment_request_count(idev);
460 } 460 }
461} 461}
462 462
463enum sci_status scic_sds_remote_device_start_io(struct isci_host *ihost, 463enum sci_status sci_remote_device_start_io(struct isci_host *ihost,
464 struct isci_remote_device *idev, 464 struct isci_remote_device *idev,
465 struct isci_request *ireq) 465 struct isci_request *ireq)
466{ 466{
467 struct sci_base_state_machine *sm = &idev->sm; 467 struct sci_base_state_machine *sm = &idev->sm;
468 enum scic_sds_remote_device_states state = sm->current_state_id; 468 enum sci_remote_device_states state = sm->current_state_id;
469 struct isci_port *iport = idev->owning_port; 469 struct isci_port *iport = idev->owning_port;
470 enum sci_status status; 470 enum sci_status status;
471 471
@@ -488,15 +488,15 @@ enum sci_status scic_sds_remote_device_start_io(struct isci_host *ihost,
488 * successful it will start the request for the port object then 488 * successful it will start the request for the port object then
489 * increment its own request count. 489 * increment its own request count.
490 */ 490 */
491 status = scic_sds_port_start_io(iport, idev, ireq); 491 status = sci_port_start_io(iport, idev, ireq);
492 if (status != SCI_SUCCESS) 492 if (status != SCI_SUCCESS)
493 return status; 493 return status;
494 494
495 status = scic_sds_remote_node_context_start_io(&idev->rnc, ireq); 495 status = sci_remote_node_context_start_io(&idev->rnc, ireq);
496 if (status != SCI_SUCCESS) 496 if (status != SCI_SUCCESS)
497 break; 497 break;
498 498
499 status = scic_sds_request_start(ireq); 499 status = sci_request_start(ireq);
500 break; 500 break;
501 case SCI_STP_DEV_IDLE: { 501 case SCI_STP_DEV_IDLE: {
502 /* handle the start io operation for a sata device that is in 502 /* handle the start io operation for a sata device that is in
@@ -507,18 +507,18 @@ enum sci_status scic_sds_remote_device_start_io(struct isci_host *ihost,
507 * If this is a softreset we may want to have a different 507 * If this is a softreset we may want to have a different
508 * substate. 508 * substate.
509 */ 509 */
510 enum scic_sds_remote_device_states new_state; 510 enum sci_remote_device_states new_state;
511 struct sas_task *task = isci_request_access_task(ireq); 511 struct sas_task *task = isci_request_access_task(ireq);
512 512
513 status = scic_sds_port_start_io(iport, idev, ireq); 513 status = sci_port_start_io(iport, idev, ireq);
514 if (status != SCI_SUCCESS) 514 if (status != SCI_SUCCESS)
515 return status; 515 return status;
516 516
517 status = scic_sds_remote_node_context_start_io(&idev->rnc, ireq); 517 status = sci_remote_node_context_start_io(&idev->rnc, ireq);
518 if (status != SCI_SUCCESS) 518 if (status != SCI_SUCCESS)
519 break; 519 break;
520 520
521 status = scic_sds_request_start(ireq); 521 status = sci_request_start(ireq);
522 if (status != SCI_SUCCESS) 522 if (status != SCI_SUCCESS)
523 break; 523 break;
524 524
@@ -535,15 +535,15 @@ enum sci_status scic_sds_remote_device_start_io(struct isci_host *ihost,
535 struct sas_task *task = isci_request_access_task(ireq); 535 struct sas_task *task = isci_request_access_task(ireq);
536 536
537 if (task->ata_task.use_ncq) { 537 if (task->ata_task.use_ncq) {
538 status = scic_sds_port_start_io(iport, idev, ireq); 538 status = sci_port_start_io(iport, idev, ireq);
539 if (status != SCI_SUCCESS) 539 if (status != SCI_SUCCESS)
540 return status; 540 return status;
541 541
542 status = scic_sds_remote_node_context_start_io(&idev->rnc, ireq); 542 status = sci_remote_node_context_start_io(&idev->rnc, ireq);
543 if (status != SCI_SUCCESS) 543 if (status != SCI_SUCCESS)
544 break; 544 break;
545 545
546 status = scic_sds_request_start(ireq); 546 status = sci_request_start(ireq);
547 } else 547 } else
548 return SCI_FAILURE_INVALID_STATE; 548 return SCI_FAILURE_INVALID_STATE;
549 break; 549 break;
@@ -551,15 +551,15 @@ enum sci_status scic_sds_remote_device_start_io(struct isci_host *ihost,
551 case SCI_STP_DEV_AWAIT_RESET: 551 case SCI_STP_DEV_AWAIT_RESET:
552 return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; 552 return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
553 case SCI_SMP_DEV_IDLE: 553 case SCI_SMP_DEV_IDLE:
554 status = scic_sds_port_start_io(iport, idev, ireq); 554 status = sci_port_start_io(iport, idev, ireq);
555 if (status != SCI_SUCCESS) 555 if (status != SCI_SUCCESS)
556 return status; 556 return status;
557 557
558 status = scic_sds_remote_node_context_start_io(&idev->rnc, ireq); 558 status = sci_remote_node_context_start_io(&idev->rnc, ireq);
559 if (status != SCI_SUCCESS) 559 if (status != SCI_SUCCESS)
560 break; 560 break;
561 561
562 status = scic_sds_request_start(ireq); 562 status = sci_request_start(ireq);
563 if (status != SCI_SUCCESS) 563 if (status != SCI_SUCCESS)
564 break; 564 break;
565 565
@@ -574,7 +574,7 @@ enum sci_status scic_sds_remote_device_start_io(struct isci_host *ihost,
574 return SCI_FAILURE_INVALID_STATE; 574 return SCI_FAILURE_INVALID_STATE;
575 } 575 }
576 576
577 scic_sds_remote_device_start_request(idev, ireq, status); 577 sci_remote_device_start_request(idev, ireq, status);
578 return status; 578 return status;
579} 579}
580 580
@@ -584,24 +584,24 @@ static enum sci_status common_complete_io(struct isci_port *iport,
584{ 584{
585 enum sci_status status; 585 enum sci_status status;
586 586
587 status = scic_sds_request_complete(ireq); 587 status = sci_request_complete(ireq);
588 if (status != SCI_SUCCESS) 588 if (status != SCI_SUCCESS)
589 return status; 589 return status;
590 590
591 status = scic_sds_port_complete_io(iport, idev, ireq); 591 status = sci_port_complete_io(iport, idev, ireq);
592 if (status != SCI_SUCCESS) 592 if (status != SCI_SUCCESS)
593 return status; 593 return status;
594 594
595 scic_sds_remote_device_decrement_request_count(idev); 595 sci_remote_device_decrement_request_count(idev);
596 return status; 596 return status;
597} 597}
598 598
599enum sci_status scic_sds_remote_device_complete_io(struct isci_host *ihost, 599enum sci_status sci_remote_device_complete_io(struct isci_host *ihost,
600 struct isci_remote_device *idev, 600 struct isci_remote_device *idev,
601 struct isci_request *ireq) 601 struct isci_request *ireq)
602{ 602{
603 struct sci_base_state_machine *sm = &idev->sm; 603 struct sci_base_state_machine *sm = &idev->sm;
604 enum scic_sds_remote_device_states state = sm->current_state_id; 604 enum sci_remote_device_states state = sm->current_state_id;
605 struct isci_port *iport = idev->owning_port; 605 struct isci_port *iport = idev->owning_port;
606 enum sci_status status; 606 enum sci_status status;
607 607
@@ -636,7 +636,7 @@ enum sci_status scic_sds_remote_device_complete_io(struct isci_host *ihost,
636 * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". 636 * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE".
637 */ 637 */
638 sci_change_state(sm, SCI_STP_DEV_AWAIT_RESET); 638 sci_change_state(sm, SCI_STP_DEV_AWAIT_RESET);
639 } else if (scic_sds_remote_device_get_request_count(idev) == 0) 639 } else if (sci_remote_device_get_request_count(idev) == 0)
640 sci_change_state(sm, SCI_STP_DEV_IDLE); 640 sci_change_state(sm, SCI_STP_DEV_IDLE);
641 break; 641 break;
642 case SCI_SMP_DEV_CMD: 642 case SCI_SMP_DEV_CMD:
@@ -650,8 +650,8 @@ enum sci_status scic_sds_remote_device_complete_io(struct isci_host *ihost,
650 if (status != SCI_SUCCESS) 650 if (status != SCI_SUCCESS)
651 break; 651 break;
652 652
653 if (scic_sds_remote_device_get_request_count(idev) == 0) 653 if (sci_remote_device_get_request_count(idev) == 0)
654 scic_sds_remote_node_context_destruct(&idev->rnc, 654 sci_remote_node_context_destruct(&idev->rnc,
655 rnc_destruct_done, 655 rnc_destruct_done,
656 idev); 656 idev);
657 break; 657 break;
@@ -668,21 +668,21 @@ enum sci_status scic_sds_remote_device_complete_io(struct isci_host *ihost,
668 return status; 668 return status;
669} 669}
670 670
671static void scic_sds_remote_device_continue_request(void *dev) 671static void sci_remote_device_continue_request(void *dev)
672{ 672{
673 struct isci_remote_device *idev = dev; 673 struct isci_remote_device *idev = dev;
674 674
675 /* we need to check if this request is still valid to continue. */ 675 /* we need to check if this request is still valid to continue. */
676 if (idev->working_request) 676 if (idev->working_request)
677 scic_controller_continue_io(idev->working_request); 677 sci_controller_continue_io(idev->working_request);
678} 678}
679 679
680enum sci_status scic_sds_remote_device_start_task(struct isci_host *ihost, 680enum sci_status sci_remote_device_start_task(struct isci_host *ihost,
681 struct isci_remote_device *idev, 681 struct isci_remote_device *idev,
682 struct isci_request *ireq) 682 struct isci_request *ireq)
683{ 683{
684 struct sci_base_state_machine *sm = &idev->sm; 684 struct sci_base_state_machine *sm = &idev->sm;
685 enum scic_sds_remote_device_states state = sm->current_state_id; 685 enum sci_remote_device_states state = sm->current_state_id;
686 struct isci_port *iport = idev->owning_port; 686 struct isci_port *iport = idev->owning_port;
687 enum sci_status status; 687 enum sci_status status;
688 688
@@ -705,15 +705,15 @@ enum sci_status scic_sds_remote_device_start_task(struct isci_host *ihost,
705 case SCI_STP_DEV_NCQ: 705 case SCI_STP_DEV_NCQ:
706 case SCI_STP_DEV_NCQ_ERROR: 706 case SCI_STP_DEV_NCQ_ERROR:
707 case SCI_STP_DEV_AWAIT_RESET: 707 case SCI_STP_DEV_AWAIT_RESET:
708 status = scic_sds_port_start_io(iport, idev, ireq); 708 status = sci_port_start_io(iport, idev, ireq);
709 if (status != SCI_SUCCESS) 709 if (status != SCI_SUCCESS)
710 return status; 710 return status;
711 711
712 status = scic_sds_remote_node_context_start_task(&idev->rnc, ireq); 712 status = sci_remote_node_context_start_task(&idev->rnc, ireq);
713 if (status != SCI_SUCCESS) 713 if (status != SCI_SUCCESS)
714 goto out; 714 goto out;
715 715
716 status = scic_sds_request_start(ireq); 716 status = sci_request_start(ireq);
717 if (status != SCI_SUCCESS) 717 if (status != SCI_SUCCESS)
718 goto out; 718 goto out;
719 719
@@ -731,32 +731,32 @@ enum sci_status scic_sds_remote_device_start_task(struct isci_host *ihost,
731 * the correct action when the remote node context is suspended 731 * the correct action when the remote node context is suspended
732 * and later resumed. 732 * and later resumed.
733 */ 733 */
734 scic_sds_remote_node_context_suspend(&idev->rnc, 734 sci_remote_node_context_suspend(&idev->rnc,
735 SCI_SOFTWARE_SUSPENSION, NULL, NULL); 735 SCI_SOFTWARE_SUSPENSION, NULL, NULL);
736 scic_sds_remote_node_context_resume(&idev->rnc, 736 sci_remote_node_context_resume(&idev->rnc,
737 scic_sds_remote_device_continue_request, 737 sci_remote_device_continue_request,
738 idev); 738 idev);
739 739
740 out: 740 out:
741 scic_sds_remote_device_start_request(idev, ireq, status); 741 sci_remote_device_start_request(idev, ireq, status);
742 /* We need to let the controller start request handler know that 742 /* We need to let the controller start request handler know that
743 * it can't post TC yet. We will provide a callback function to 743 * it can't post TC yet. We will provide a callback function to
744 * post TC when RNC gets resumed. 744 * post TC when RNC gets resumed.
745 */ 745 */
746 return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS; 746 return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS;
747 case SCI_DEV_READY: 747 case SCI_DEV_READY:
748 status = scic_sds_port_start_io(iport, idev, ireq); 748 status = sci_port_start_io(iport, idev, ireq);
749 if (status != SCI_SUCCESS) 749 if (status != SCI_SUCCESS)
750 return status; 750 return status;
751 751
752 status = scic_sds_remote_node_context_start_task(&idev->rnc, ireq); 752 status = sci_remote_node_context_start_task(&idev->rnc, ireq);
753 if (status != SCI_SUCCESS) 753 if (status != SCI_SUCCESS)
754 break; 754 break;
755 755
756 status = scic_sds_request_start(ireq); 756 status = sci_request_start(ireq);
757 break; 757 break;
758 } 758 }
759 scic_sds_remote_device_start_request(idev, ireq, status); 759 sci_remote_device_start_request(idev, ireq, status);
760 760
761 return status; 761 return status;
762} 762}
@@ -769,16 +769,16 @@ enum sci_status scic_sds_remote_device_start_task(struct isci_host *ihost,
769 * This method takes the request and bulids an appropriate SCU context for the 769 * This method takes the request and bulids an appropriate SCU context for the
770 * request and then requests the controller to post the request. none 770 * request and then requests the controller to post the request. none
771 */ 771 */
772void scic_sds_remote_device_post_request( 772void sci_remote_device_post_request(
773 struct isci_remote_device *idev, 773 struct isci_remote_device *idev,
774 u32 request) 774 u32 request)
775{ 775{
776 u32 context; 776 u32 context;
777 777
778 context = scic_sds_remote_device_build_command_context(idev, request); 778 context = sci_remote_device_build_command_context(idev, request);
779 779
780 scic_sds_controller_post_request( 780 sci_controller_post_request(
781 scic_sds_remote_device_get_controller(idev), 781 sci_remote_device_get_controller(idev),
782 context 782 context
783 ); 783 );
784} 784}
@@ -798,7 +798,7 @@ static void remote_device_resume_done(void *_dev)
798 sci_change_state(&idev->sm, SCI_DEV_READY); 798 sci_change_state(&idev->sm, SCI_DEV_READY);
799} 799}
800 800
801static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *_dev) 801static void sci_stp_remote_device_ready_idle_substate_resume_complete_handler(void *_dev)
802{ 802{
803 struct isci_remote_device *idev = _dev; 803 struct isci_remote_device *idev = _dev;
804 struct isci_host *ihost = idev->owning_port->owning_controller; 804 struct isci_host *ihost = idev->owning_port->owning_controller;
@@ -810,7 +810,7 @@ static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handl
810 isci_remote_device_ready(ihost, idev); 810 isci_remote_device_ready(ihost, idev);
811} 811}
812 812
813static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_machine *sm) 813static void sci_remote_device_initial_state_enter(struct sci_base_state_machine *sm)
814{ 814{
815 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 815 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
816 816
@@ -819,7 +819,7 @@ static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_mac
819} 819}
820 820
821/** 821/**
822 * scic_remote_device_destruct() - free remote node context and destruct 822 * sci_remote_device_destruct() - free remote node context and destruct
823 * @remote_device: This parameter specifies the remote device to be destructed. 823 * @remote_device: This parameter specifies the remote device to be destructed.
824 * 824 *
825 * Remote device objects are a limited resource. As such, they must be 825 * Remote device objects are a limited resource. As such, they must be
@@ -831,10 +831,10 @@ static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_mac
831 * device isn't valid (e.g. it's already been destoryed, the handle isn't 831 * device isn't valid (e.g. it's already been destoryed, the handle isn't
832 * valid, etc.). 832 * valid, etc.).
833 */ 833 */
834static enum sci_status scic_remote_device_destruct(struct isci_remote_device *idev) 834static enum sci_status sci_remote_device_destruct(struct isci_remote_device *idev)
835{ 835{
836 struct sci_base_state_machine *sm = &idev->sm; 836 struct sci_base_state_machine *sm = &idev->sm;
837 enum scic_sds_remote_device_states state = sm->current_state_id; 837 enum sci_remote_device_states state = sm->current_state_id;
838 struct isci_host *ihost; 838 struct isci_host *ihost;
839 839
840 if (state != SCI_DEV_STOPPED) { 840 if (state != SCI_DEV_STOPPED) {
@@ -844,7 +844,7 @@ static enum sci_status scic_remote_device_destruct(struct isci_remote_device *id
844 } 844 }
845 845
846 ihost = idev->owning_port->owning_controller; 846 ihost = idev->owning_port->owning_controller;
847 scic_sds_controller_free_remote_node_context(ihost, idev, 847 sci_controller_free_remote_node_context(ihost, idev,
848 idev->rnc.remote_node_index); 848 idev->rnc.remote_node_index);
849 idev->rnc.remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX; 849 idev->rnc.remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX;
850 sci_change_state(sm, SCI_DEV_FINAL); 850 sci_change_state(sm, SCI_DEV_FINAL);
@@ -869,12 +869,12 @@ static void isci_remote_device_deconstruct(struct isci_host *ihost, struct isci_
869 * io requests in process */ 869 * io requests in process */
870 BUG_ON(!list_empty(&idev->reqs_in_process)); 870 BUG_ON(!list_empty(&idev->reqs_in_process));
871 871
872 scic_remote_device_destruct(idev); 872 sci_remote_device_destruct(idev);
873 list_del_init(&idev->node); 873 list_del_init(&idev->node);
874 isci_put_device(idev); 874 isci_put_device(idev);
875} 875}
876 876
877static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_machine *sm) 877static void sci_remote_device_stopped_state_enter(struct sci_base_state_machine *sm)
878{ 878{
879 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 879 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
880 struct isci_host *ihost = idev->owning_port->owning_controller; 880 struct isci_host *ihost = idev->owning_port->owning_controller;
@@ -887,19 +887,19 @@ static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_mac
887 if (prev_state == SCI_DEV_STOPPING) 887 if (prev_state == SCI_DEV_STOPPING)
888 isci_remote_device_deconstruct(ihost, idev); 888 isci_remote_device_deconstruct(ihost, idev);
889 889
890 scic_sds_controller_remote_device_stopped(ihost, idev); 890 sci_controller_remote_device_stopped(ihost, idev);
891} 891}
892 892
893static void scic_sds_remote_device_starting_state_enter(struct sci_base_state_machine *sm) 893static void sci_remote_device_starting_state_enter(struct sci_base_state_machine *sm)
894{ 894{
895 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 895 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
896 struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 896 struct isci_host *ihost = sci_remote_device_get_controller(idev);
897 897
898 isci_remote_device_not_ready(ihost, idev, 898 isci_remote_device_not_ready(ihost, idev,
899 SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED); 899 SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED);
900} 900}
901 901
902static void scic_sds_remote_device_ready_state_enter(struct sci_base_state_machine *sm) 902static void sci_remote_device_ready_state_enter(struct sci_base_state_machine *sm)
903{ 903{
904 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 904 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
905 struct isci_host *ihost = idev->owning_port->owning_controller; 905 struct isci_host *ihost = idev->owning_port->owning_controller;
@@ -913,7 +913,7 @@ static void scic_sds_remote_device_ready_state_enter(struct sci_base_state_machi
913 isci_remote_device_ready(ihost, idev); 913 isci_remote_device_ready(ihost, idev);
914} 914}
915 915
916static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machine *sm) 916static void sci_remote_device_ready_state_exit(struct sci_base_state_machine *sm)
917{ 917{
918 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 918 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
919 struct domain_device *dev = idev->domain_dev; 919 struct domain_device *dev = idev->domain_dev;
@@ -926,42 +926,42 @@ static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machin
926 } 926 }
927} 927}
928 928
929static void scic_sds_remote_device_resetting_state_enter(struct sci_base_state_machine *sm) 929static void sci_remote_device_resetting_state_enter(struct sci_base_state_machine *sm)
930{ 930{
931 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 931 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
932 932
933 scic_sds_remote_node_context_suspend( 933 sci_remote_node_context_suspend(
934 &idev->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL); 934 &idev->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL);
935} 935}
936 936
937static void scic_sds_remote_device_resetting_state_exit(struct sci_base_state_machine *sm) 937static void sci_remote_device_resetting_state_exit(struct sci_base_state_machine *sm)
938{ 938{
939 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 939 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
940 940
941 scic_sds_remote_node_context_resume(&idev->rnc, NULL, NULL); 941 sci_remote_node_context_resume(&idev->rnc, NULL, NULL);
942} 942}
943 943
944static void scic_sds_stp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) 944static void sci_stp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm)
945{ 945{
946 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 946 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
947 947
948 idev->working_request = NULL; 948 idev->working_request = NULL;
949 if (scic_sds_remote_node_context_is_ready(&idev->rnc)) { 949 if (sci_remote_node_context_is_ready(&idev->rnc)) {
950 /* 950 /*
951 * Since the RNC is ready, it's alright to finish completion 951 * Since the RNC is ready, it's alright to finish completion
952 * processing (e.g. signal the remote device is ready). */ 952 * processing (e.g. signal the remote device is ready). */
953 scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(idev); 953 sci_stp_remote_device_ready_idle_substate_resume_complete_handler(idev);
954 } else { 954 } else {
955 scic_sds_remote_node_context_resume(&idev->rnc, 955 sci_remote_node_context_resume(&idev->rnc,
956 scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler, 956 sci_stp_remote_device_ready_idle_substate_resume_complete_handler,
957 idev); 957 idev);
958 } 958 }
959} 959}
960 960
961static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) 961static void sci_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm)
962{ 962{
963 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 963 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
964 struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 964 struct isci_host *ihost = sci_remote_device_get_controller(idev);
965 965
966 BUG_ON(idev->working_request == NULL); 966 BUG_ON(idev->working_request == NULL);
967 967
@@ -969,28 +969,28 @@ static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_
969 SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED); 969 SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED);
970} 970}
971 971
972static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm) 972static void sci_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm)
973{ 973{
974 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 974 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
975 struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 975 struct isci_host *ihost = sci_remote_device_get_controller(idev);
976 976
977 if (idev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED) 977 if (idev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED)
978 isci_remote_device_not_ready(ihost, idev, 978 isci_remote_device_not_ready(ihost, idev,
979 idev->not_ready_reason); 979 idev->not_ready_reason);
980} 980}
981 981
982static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) 982static void sci_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm)
983{ 983{
984 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 984 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
985 struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 985 struct isci_host *ihost = sci_remote_device_get_controller(idev);
986 986
987 isci_remote_device_ready(ihost, idev); 987 isci_remote_device_ready(ihost, idev);
988} 988}
989 989
990static void scic_sds_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) 990static void sci_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm)
991{ 991{
992 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 992 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
993 struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 993 struct isci_host *ihost = sci_remote_device_get_controller(idev);
994 994
995 BUG_ON(idev->working_request == NULL); 995 BUG_ON(idev->working_request == NULL);
996 996
@@ -998,83 +998,83 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(struct sci_base_
998 SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED); 998 SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED);
999} 999}
1000 1000
1001static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_state_machine *sm) 1001static void sci_smp_remote_device_ready_cmd_substate_exit(struct sci_base_state_machine *sm)
1002{ 1002{
1003 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 1003 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm);
1004 1004
1005 idev->working_request = NULL; 1005 idev->working_request = NULL;
1006} 1006}
1007 1007
1008static const struct sci_base_state scic_sds_remote_device_state_table[] = { 1008static const struct sci_base_state sci_remote_device_state_table[] = {
1009 [SCI_DEV_INITIAL] = { 1009 [SCI_DEV_INITIAL] = {
1010 .enter_state = scic_sds_remote_device_initial_state_enter, 1010 .enter_state = sci_remote_device_initial_state_enter,
1011 }, 1011 },
1012 [SCI_DEV_STOPPED] = { 1012 [SCI_DEV_STOPPED] = {
1013 .enter_state = scic_sds_remote_device_stopped_state_enter, 1013 .enter_state = sci_remote_device_stopped_state_enter,
1014 }, 1014 },
1015 [SCI_DEV_STARTING] = { 1015 [SCI_DEV_STARTING] = {
1016 .enter_state = scic_sds_remote_device_starting_state_enter, 1016 .enter_state = sci_remote_device_starting_state_enter,
1017 }, 1017 },
1018 [SCI_DEV_READY] = { 1018 [SCI_DEV_READY] = {
1019 .enter_state = scic_sds_remote_device_ready_state_enter, 1019 .enter_state = sci_remote_device_ready_state_enter,
1020 .exit_state = scic_sds_remote_device_ready_state_exit 1020 .exit_state = sci_remote_device_ready_state_exit
1021 }, 1021 },
1022 [SCI_STP_DEV_IDLE] = { 1022 [SCI_STP_DEV_IDLE] = {
1023 .enter_state = scic_sds_stp_remote_device_ready_idle_substate_enter, 1023 .enter_state = sci_stp_remote_device_ready_idle_substate_enter,
1024 }, 1024 },
1025 [SCI_STP_DEV_CMD] = { 1025 [SCI_STP_DEV_CMD] = {
1026 .enter_state = scic_sds_stp_remote_device_ready_cmd_substate_enter, 1026 .enter_state = sci_stp_remote_device_ready_cmd_substate_enter,
1027 }, 1027 },
1028 [SCI_STP_DEV_NCQ] = { }, 1028 [SCI_STP_DEV_NCQ] = { },
1029 [SCI_STP_DEV_NCQ_ERROR] = { 1029 [SCI_STP_DEV_NCQ_ERROR] = {
1030 .enter_state = scic_sds_stp_remote_device_ready_ncq_error_substate_enter, 1030 .enter_state = sci_stp_remote_device_ready_ncq_error_substate_enter,
1031 }, 1031 },
1032 [SCI_STP_DEV_AWAIT_RESET] = { }, 1032 [SCI_STP_DEV_AWAIT_RESET] = { },
1033 [SCI_SMP_DEV_IDLE] = { 1033 [SCI_SMP_DEV_IDLE] = {
1034 .enter_state = scic_sds_smp_remote_device_ready_idle_substate_enter, 1034 .enter_state = sci_smp_remote_device_ready_idle_substate_enter,
1035 }, 1035 },
1036 [SCI_SMP_DEV_CMD] = { 1036 [SCI_SMP_DEV_CMD] = {
1037 .enter_state = scic_sds_smp_remote_device_ready_cmd_substate_enter, 1037 .enter_state = sci_smp_remote_device_ready_cmd_substate_enter,
1038 .exit_state = scic_sds_smp_remote_device_ready_cmd_substate_exit, 1038 .exit_state = sci_smp_remote_device_ready_cmd_substate_exit,
1039 }, 1039 },
1040 [SCI_DEV_STOPPING] = { }, 1040 [SCI_DEV_STOPPING] = { },
1041 [SCI_DEV_FAILED] = { }, 1041 [SCI_DEV_FAILED] = { },
1042 [SCI_DEV_RESETTING] = { 1042 [SCI_DEV_RESETTING] = {
1043 .enter_state = scic_sds_remote_device_resetting_state_enter, 1043 .enter_state = sci_remote_device_resetting_state_enter,
1044 .exit_state = scic_sds_remote_device_resetting_state_exit 1044 .exit_state = sci_remote_device_resetting_state_exit
1045 }, 1045 },
1046 [SCI_DEV_FINAL] = { }, 1046 [SCI_DEV_FINAL] = { },
1047}; 1047};
1048 1048
1049/** 1049/**
1050 * scic_remote_device_construct() - common construction 1050 * sci_remote_device_construct() - common construction
1051 * @sci_port: SAS/SATA port through which this device is accessed. 1051 * @sci_port: SAS/SATA port through which this device is accessed.
1052 * @sci_dev: remote device to construct 1052 * @sci_dev: remote device to construct
1053 * 1053 *
1054 * This routine just performs benign initialization and does not 1054 * This routine just performs benign initialization and does not
1055 * allocate the remote_node_context which is left to 1055 * allocate the remote_node_context which is left to
1056 * scic_remote_device_[de]a_construct(). scic_remote_device_destruct() 1056 * sci_remote_device_[de]a_construct(). sci_remote_device_destruct()
1057 * frees the remote_node_context(s) for the device. 1057 * frees the remote_node_context(s) for the device.
1058 */ 1058 */
1059static void scic_remote_device_construct(struct isci_port *iport, 1059static void sci_remote_device_construct(struct isci_port *iport,
1060 struct isci_remote_device *idev) 1060 struct isci_remote_device *idev)
1061{ 1061{
1062 idev->owning_port = iport; 1062 idev->owning_port = iport;
1063 idev->started_request_count = 0; 1063 idev->started_request_count = 0;
1064 1064
1065 sci_init_sm(&idev->sm, scic_sds_remote_device_state_table, SCI_DEV_INITIAL); 1065 sci_init_sm(&idev->sm, sci_remote_device_state_table, SCI_DEV_INITIAL);
1066 1066
1067 scic_sds_remote_node_context_construct(&idev->rnc, 1067 sci_remote_node_context_construct(&idev->rnc,
1068 SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); 1068 SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);
1069} 1069}
1070 1070
1071/** 1071/**
1072 * scic_remote_device_da_construct() - construct direct attached device. 1072 * sci_remote_device_da_construct() - construct direct attached device.
1073 * 1073 *
1074 * The information (e.g. IAF, Signature FIS, etc.) necessary to build 1074 * The information (e.g. IAF, Signature FIS, etc.) necessary to build
1075 * the device is known to the SCI Core since it is contained in the 1075 * the device is known to the SCI Core since it is contained in the
1076 * scic_phy object. Remote node context(s) is/are a global resource 1076 * sci_phy object. Remote node context(s) is/are a global resource
1077 * allocated by this routine, freed by scic_remote_device_destruct(). 1077 * allocated by this routine, freed by sci_remote_device_destruct().
1078 * 1078 *
1079 * Returns: 1079 * Returns:
1080 * SCI_FAILURE_DEVICE_EXISTS - device has already been constructed. 1080 * SCI_FAILURE_DEVICE_EXISTS - device has already been constructed.
@@ -1082,20 +1082,20 @@ static void scic_remote_device_construct(struct isci_port *iport,
1082 * sata-only controller instance. 1082 * sata-only controller instance.
1083 * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. 1083 * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted.
1084 */ 1084 */
1085static enum sci_status scic_remote_device_da_construct(struct isci_port *iport, 1085static enum sci_status sci_remote_device_da_construct(struct isci_port *iport,
1086 struct isci_remote_device *idev) 1086 struct isci_remote_device *idev)
1087{ 1087{
1088 enum sci_status status; 1088 enum sci_status status;
1089 struct domain_device *dev = idev->domain_dev; 1089 struct domain_device *dev = idev->domain_dev;
1090 1090
1091 scic_remote_device_construct(iport, idev); 1091 sci_remote_device_construct(iport, idev);
1092 1092
1093 /* 1093 /*
1094 * This information is request to determine how many remote node context 1094 * This information is request to determine how many remote node context
1095 * entries will be needed to store the remote node. 1095 * entries will be needed to store the remote node.
1096 */ 1096 */
1097 idev->is_direct_attached = true; 1097 idev->is_direct_attached = true;
1098 status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller, 1098 status = sci_controller_allocate_remote_node_context(iport->owning_controller,
1099 idev, 1099 idev,
1100 &idev->rnc.remote_node_index); 1100 &idev->rnc.remote_node_index);
1101 1101
@@ -1108,7 +1108,7 @@ static enum sci_status scic_remote_device_da_construct(struct isci_port *iport,
1108 else 1108 else
1109 return SCI_FAILURE_UNSUPPORTED_PROTOCOL; 1109 return SCI_FAILURE_UNSUPPORTED_PROTOCOL;
1110 1110
1111 idev->connection_rate = scic_sds_port_get_max_allowed_speed(iport); 1111 idev->connection_rate = sci_port_get_max_allowed_speed(iport);
1112 1112
1113 /* / @todo Should I assign the port width by reading all of the phys on the port? */ 1113 /* / @todo Should I assign the port width by reading all of the phys on the port? */
1114 idev->device_port_width = 1; 1114 idev->device_port_width = 1;
@@ -1117,10 +1117,10 @@ static enum sci_status scic_remote_device_da_construct(struct isci_port *iport,
1117} 1117}
1118 1118
1119/** 1119/**
1120 * scic_remote_device_ea_construct() - construct expander attached device 1120 * sci_remote_device_ea_construct() - construct expander attached device
1121 * 1121 *
1122 * Remote node context(s) is/are a global resource allocated by this 1122 * Remote node context(s) is/are a global resource allocated by this
1123 * routine, freed by scic_remote_device_destruct(). 1123 * routine, freed by sci_remote_device_destruct().
1124 * 1124 *
1125 * Returns: 1125 * Returns:
1126 * SCI_FAILURE_DEVICE_EXISTS - device has already been constructed. 1126 * SCI_FAILURE_DEVICE_EXISTS - device has already been constructed.
@@ -1128,15 +1128,15 @@ static enum sci_status scic_remote_device_da_construct(struct isci_port *iport,
1128 * sata-only controller instance. 1128 * sata-only controller instance.
1129 * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. 1129 * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted.
1130 */ 1130 */
1131static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport, 1131static enum sci_status sci_remote_device_ea_construct(struct isci_port *iport,
1132 struct isci_remote_device *idev) 1132 struct isci_remote_device *idev)
1133{ 1133{
1134 struct domain_device *dev = idev->domain_dev; 1134 struct domain_device *dev = idev->domain_dev;
1135 enum sci_status status; 1135 enum sci_status status;
1136 1136
1137 scic_remote_device_construct(iport, idev); 1137 sci_remote_device_construct(iport, idev);
1138 1138
1139 status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller, 1139 status = sci_controller_allocate_remote_node_context(iport->owning_controller,
1140 idev, 1140 idev,
1141 &idev->rnc.remote_node_index); 1141 &idev->rnc.remote_node_index);
1142 if (status != SCI_SUCCESS) 1142 if (status != SCI_SUCCESS)
@@ -1155,7 +1155,7 @@ static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport,
1155 * connection the logical link rate is that same as the 1155 * connection the logical link rate is that same as the
1156 * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay 1156 * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay
1157 * one another, so this code works for both situations. */ 1157 * one another, so this code works for both situations. */
1158 idev->connection_rate = min_t(u16, scic_sds_port_get_max_allowed_speed(iport), 1158 idev->connection_rate = min_t(u16, sci_port_get_max_allowed_speed(iport),
1159 dev->linkrate); 1159 dev->linkrate);
1160 1160
1161 /* / @todo Should I assign the port width by reading all of the phys on the port? */ 1161 /* / @todo Should I assign the port width by reading all of the phys on the port? */
@@ -1165,7 +1165,7 @@ static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport,
1165} 1165}
1166 1166
1167/** 1167/**
1168 * scic_remote_device_start() - This method will start the supplied remote 1168 * sci_remote_device_start() - This method will start the supplied remote
1169 * device. This method enables normal IO requests to flow through to the 1169 * device. This method enables normal IO requests to flow through to the
1170 * remote device. 1170 * remote device.
1171 * @remote_device: This parameter specifies the device to be started. 1171 * @remote_device: This parameter specifies the device to be started.
@@ -1177,11 +1177,11 @@ static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport,
1177 * SCI_FAILURE_INVALID_PHY This value is returned if the user attempts to start 1177 * SCI_FAILURE_INVALID_PHY This value is returned if the user attempts to start
1178 * the device when there have been no phys added to it. 1178 * the device when there have been no phys added to it.
1179 */ 1179 */
1180static enum sci_status scic_remote_device_start(struct isci_remote_device *idev, 1180static enum sci_status sci_remote_device_start(struct isci_remote_device *idev,
1181 u32 timeout) 1181 u32 timeout)
1182{ 1182{
1183 struct sci_base_state_machine *sm = &idev->sm; 1183 struct sci_base_state_machine *sm = &idev->sm;
1184 enum scic_sds_remote_device_states state = sm->current_state_id; 1184 enum sci_remote_device_states state = sm->current_state_id;
1185 enum sci_status status; 1185 enum sci_status status;
1186 1186
1187 if (state != SCI_DEV_STOPPED) { 1187 if (state != SCI_DEV_STOPPED) {
@@ -1190,7 +1190,7 @@ static enum sci_status scic_remote_device_start(struct isci_remote_device *idev,
1190 return SCI_FAILURE_INVALID_STATE; 1190 return SCI_FAILURE_INVALID_STATE;
1191 } 1191 }
1192 1192
1193 status = scic_sds_remote_node_context_resume(&idev->rnc, 1193 status = sci_remote_node_context_resume(&idev->rnc,
1194 remote_device_resume_done, 1194 remote_device_resume_done,
1195 idev); 1195 idev);
1196 if (status != SCI_SUCCESS) 1196 if (status != SCI_SUCCESS)
@@ -1209,9 +1209,9 @@ static enum sci_status isci_remote_device_construct(struct isci_port *iport,
1209 enum sci_status status; 1209 enum sci_status status;
1210 1210
1211 if (dev->parent && dev_is_expander(dev->parent)) 1211 if (dev->parent && dev_is_expander(dev->parent))
1212 status = scic_remote_device_ea_construct(iport, idev); 1212 status = sci_remote_device_ea_construct(iport, idev);
1213 else 1213 else
1214 status = scic_remote_device_da_construct(iport, idev); 1214 status = sci_remote_device_da_construct(iport, idev);
1215 1215
1216 if (status != SCI_SUCCESS) { 1216 if (status != SCI_SUCCESS) {
1217 dev_dbg(&ihost->pdev->dev, "%s: construct failed: %d\n", 1217 dev_dbg(&ihost->pdev->dev, "%s: construct failed: %d\n",
@@ -1221,7 +1221,7 @@ static enum sci_status isci_remote_device_construct(struct isci_port *iport,
1221 } 1221 }
1222 1222
1223 /* start the device. */ 1223 /* start the device. */
1224 status = scic_remote_device_start(idev, ISCI_REMOTE_DEVICE_START_TIMEOUT); 1224 status = sci_remote_device_start(idev, ISCI_REMOTE_DEVICE_START_TIMEOUT);
1225 1225
1226 if (status != SCI_SUCCESS) 1226 if (status != SCI_SUCCESS)
1227 dev_warn(&ihost->pdev->dev, "remote device start failed: %d\n", 1227 dev_warn(&ihost->pdev->dev, "remote device start failed: %d\n",
@@ -1322,7 +1322,7 @@ enum sci_status isci_remote_device_stop(struct isci_host *ihost, struct isci_rem
1322 set_bit(IDEV_STOP_PENDING, &idev->flags); 1322 set_bit(IDEV_STOP_PENDING, &idev->flags);
1323 1323
1324 spin_lock_irqsave(&ihost->scic_lock, flags); 1324 spin_lock_irqsave(&ihost->scic_lock, flags);
1325 status = scic_remote_device_stop(idev, 50); 1325 status = sci_remote_device_stop(idev, 50);
1326 spin_unlock_irqrestore(&ihost->scic_lock, flags); 1326 spin_unlock_irqrestore(&ihost->scic_lock, flags);
1327 1327
1328 /* Wait for the stop complete callback. */ 1328 /* Wait for the stop complete callback. */