Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

isci: unify isci_host and scic_sds_controller

Remove the distinction between these two implementations and unify on
isci_host (local instances named ihost). Hmmm, we had two
'oem_parameters' instances, one was unused... nice.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

+806 -985
+489 -511
drivers/scsi/isci/host.c
··· 181 181 } 182 182 183 183 static bool scic_sds_controller_completion_queue_has_entries( 184 - struct scic_sds_controller *scic) 184 + struct isci_host *ihost) 185 185 { 186 - u32 get_value = scic->completion_queue_get; 186 + u32 get_value = ihost->completion_queue_get; 187 187 u32 get_index = get_value & SMU_COMPLETION_QUEUE_GET_POINTER_MASK; 188 188 189 189 if (NORMALIZE_GET_POINTER_CYCLE_BIT(get_value) == 190 - COMPLETION_QUEUE_CYCLE_BIT(scic->completion_queue[get_index])) 190 + COMPLETION_QUEUE_CYCLE_BIT(ihost->completion_queue[get_index])) 191 191 return true; 192 192 193 193 return false; 194 194 } 195 195 196 - static bool scic_sds_controller_isr(struct scic_sds_controller *scic) 196 + static bool scic_sds_controller_isr(struct isci_host *ihost) 197 197 { 198 - if (scic_sds_controller_completion_queue_has_entries(scic)) { 198 + if (scic_sds_controller_completion_queue_has_entries(ihost)) { 199 199 return true; 200 200 } else { 201 201 /* 202 202 * we have a spurious interrupt it could be that we have already 203 203 * emptied the completion queue from a previous interrupt */ 204 - writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status); 204 + writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status); 205 205 206 206 /* 207 207 * There is a race in the hardware that could cause us not to be notified 208 208 * of an interrupt completion if we do not take this step. We will mask 209 209 * then unmask the interrupts so if there is another interrupt pending 210 210 * the clearing of the interrupt source we get the next interrupt message. */ 211 - writel(0xFF000000, &scic->smu_registers->interrupt_mask); 212 - writel(0, &scic->smu_registers->interrupt_mask); 211 + writel(0xFF000000, &ihost->smu_registers->interrupt_mask); 212 + writel(0, &ihost->smu_registers->interrupt_mask); 213 213 } 214 214 215 215 return false; ··· 219 219 { 220 220 struct isci_host *ihost = data; 221 221 222 - if (scic_sds_controller_isr(&ihost->sci)) 222 + if (scic_sds_controller_isr(ihost)) 223 223 tasklet_schedule(&ihost->completion_tasklet); 224 224 225 225 return IRQ_HANDLED; 226 226 } 227 227 228 - static bool scic_sds_controller_error_isr(struct scic_sds_controller *scic) 228 + static bool scic_sds_controller_error_isr(struct isci_host *ihost) 229 229 { 230 230 u32 interrupt_status; 231 231 232 232 interrupt_status = 233 - readl(&scic->smu_registers->interrupt_status); 233 + readl(&ihost->smu_registers->interrupt_status); 234 234 interrupt_status &= (SMU_ISR_QUEUE_ERROR | SMU_ISR_QUEUE_SUSPEND); 235 235 236 236 if (interrupt_status != 0) { ··· 246 246 * then unmask the error interrupts so if there was another interrupt 247 247 * pending we will be notified. 248 248 * Could we write the value of (SMU_ISR_QUEUE_ERROR | SMU_ISR_QUEUE_SUSPEND)? */ 249 - writel(0xff, &scic->smu_registers->interrupt_mask); 250 - writel(0, &scic->smu_registers->interrupt_mask); 249 + writel(0xff, &ihost->smu_registers->interrupt_mask); 250 + writel(0, &ihost->smu_registers->interrupt_mask); 251 251 252 252 return false; 253 253 } 254 254 255 - static void scic_sds_controller_task_completion(struct scic_sds_controller *scic, 255 + static void scic_sds_controller_task_completion(struct isci_host *ihost, 256 256 u32 completion_entry) 257 257 { 258 258 u32 index = SCU_GET_COMPLETION_INDEX(completion_entry); 259 - struct isci_host *ihost = scic_to_ihost(scic); 260 259 struct isci_request *ireq = ihost->reqs[index]; 261 260 262 261 /* Make sure that we really want to process this IO request */ 263 262 if (test_bit(IREQ_ACTIVE, &ireq->flags) && 264 263 ireq->io_tag != SCI_CONTROLLER_INVALID_IO_TAG && 265 - ISCI_TAG_SEQ(ireq->io_tag) == scic->io_request_sequence[index]) 264 + ISCI_TAG_SEQ(ireq->io_tag) == ihost->io_request_sequence[index]) 266 265 /* Yep this is a valid io request pass it along to the io request handler */ 267 266 scic_sds_io_request_tc_completion(ireq, completion_entry); 268 267 } 269 268 270 - static void scic_sds_controller_sdma_completion(struct scic_sds_controller *scic, 269 + static void scic_sds_controller_sdma_completion(struct isci_host *ihost, 271 270 u32 completion_entry) 272 271 { 273 272 u32 index; ··· 278 279 switch (scu_get_command_request_type(completion_entry)) { 279 280 case SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC: 280 281 case SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_TC: 281 - ireq = scic_to_ihost(scic)->reqs[index]; 282 - dev_warn(scic_to_dev(scic), "%s: %x for io request %p\n", 282 + ireq = ihost->reqs[index]; 283 + dev_warn(&ihost->pdev->dev, "%s: %x for io request %p\n", 283 284 __func__, completion_entry, ireq); 284 285 /* @todo For a post TC operation we need to fail the IO 285 286 * request ··· 288 289 case SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC: 289 290 case SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC: 290 291 case SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC: 291 - idev = scic->device_table[index]; 292 - dev_warn(scic_to_dev(scic), "%s: %x for device %p\n", 292 + idev = ihost->device_table[index]; 293 + dev_warn(&ihost->pdev->dev, "%s: %x for device %p\n", 293 294 __func__, completion_entry, idev); 294 295 /* @todo For a port RNC operation we need to fail the 295 296 * device 296 297 */ 297 298 break; 298 299 default: 299 - dev_warn(scic_to_dev(scic), "%s: unknown completion type %x\n", 300 + dev_warn(&ihost->pdev->dev, "%s: unknown completion type %x\n", 300 301 __func__, completion_entry); 301 302 break; 302 303 } 303 304 } 304 305 305 - static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *scic, 306 + static void scic_sds_controller_unsolicited_frame(struct isci_host *ihost, 306 307 u32 completion_entry) 307 308 { 308 309 u32 index; 309 310 u32 frame_index; 310 311 311 - struct isci_host *ihost = scic_to_ihost(scic); 312 312 struct scu_unsolicited_frame_header *frame_header; 313 313 struct isci_phy *iphy; 314 314 struct isci_remote_device *idev; ··· 316 318 317 319 frame_index = SCU_GET_FRAME_INDEX(completion_entry); 318 320 319 - frame_header = scic->uf_control.buffers.array[frame_index].header; 320 - scic->uf_control.buffers.array[frame_index].state = UNSOLICITED_FRAME_IN_USE; 321 + frame_header = ihost->uf_control.buffers.array[frame_index].header; 322 + ihost->uf_control.buffers.array[frame_index].state = UNSOLICITED_FRAME_IN_USE; 321 323 322 324 if (SCU_GET_FRAME_ERROR(completion_entry)) { 323 325 /* 324 326 * / @todo If the IAF frame or SIGNATURE FIS frame has an error will 325 327 * / this cause a problem? We expect the phy initialization will 326 328 * / fail if there is an error in the frame. */ 327 - scic_sds_controller_release_frame(scic, frame_index); 329 + scic_sds_controller_release_frame(ihost, frame_index); 328 330 return; 329 331 } 330 332 ··· 345 347 iphy = &ihost->phys[index]; 346 348 result = scic_sds_phy_frame_handler(iphy, frame_index); 347 349 } else { 348 - if (index < scic->remote_node_entries) 349 - idev = scic->device_table[index]; 350 + if (index < ihost->remote_node_entries) 351 + idev = ihost->device_table[index]; 350 352 else 351 353 idev = NULL; 352 354 353 355 if (idev != NULL) 354 356 result = scic_sds_remote_device_frame_handler(idev, frame_index); 355 357 else 356 - scic_sds_controller_release_frame(scic, frame_index); 358 + scic_sds_controller_release_frame(ihost, frame_index); 357 359 } 358 360 } 359 361 ··· 364 366 } 365 367 } 366 368 367 - static void scic_sds_controller_event_completion(struct scic_sds_controller *scic, 369 + static void scic_sds_controller_event_completion(struct isci_host *ihost, 368 370 u32 completion_entry) 369 371 { 370 - struct isci_host *ihost = scic_to_ihost(scic); 371 372 struct isci_remote_device *idev; 372 373 struct isci_request *ireq; 373 374 struct isci_phy *iphy; ··· 377 380 switch (scu_get_event_type(completion_entry)) { 378 381 case SCU_EVENT_TYPE_SMU_COMMAND_ERROR: 379 382 /* / @todo The driver did something wrong and we need to fix the condtion. */ 380 - dev_err(scic_to_dev(scic), 383 + dev_err(&ihost->pdev->dev, 381 384 "%s: SCIC Controller 0x%p received SMU command error " 382 385 "0x%x\n", 383 386 __func__, 384 - scic, 387 + ihost, 385 388 completion_entry); 386 389 break; 387 390 ··· 391 394 /* 392 395 * / @todo This is a hardware failure and its likely that we want to 393 396 * / reset the controller. */ 394 - dev_err(scic_to_dev(scic), 397 + dev_err(&ihost->pdev->dev, 395 398 "%s: SCIC Controller 0x%p received fatal controller " 396 399 "event 0x%x\n", 397 400 __func__, 398 - scic, 401 + ihost, 399 402 completion_entry); 400 403 break; 401 404 ··· 412 415 if (ireq != NULL) 413 416 scic_sds_io_request_event_handler(ireq, completion_entry); 414 417 else 415 - dev_warn(scic_to_dev(scic), 418 + dev_warn(&ihost->pdev->dev, 416 419 "%s: SCIC Controller 0x%p received " 417 420 "event 0x%x for io request object " 418 421 "that doesnt exist.\n", 419 422 __func__, 420 - scic, 423 + ihost, 421 424 completion_entry); 422 425 423 426 break; 424 427 425 428 case SCU_EVENT_SPECIFIC_IT_NEXUS_TIMEOUT: 426 - idev = scic->device_table[index]; 429 + idev = ihost->device_table[index]; 427 430 if (idev != NULL) 428 431 scic_sds_remote_device_event_handler(idev, completion_entry); 429 432 else 430 - dev_warn(scic_to_dev(scic), 433 + dev_warn(&ihost->pdev->dev, 431 434 "%s: SCIC Controller 0x%p received " 432 435 "event 0x%x for remote device object " 433 436 "that doesnt exist.\n", 434 437 __func__, 435 - scic, 438 + ihost, 436 439 completion_entry); 437 440 438 441 break; ··· 456 459 case SCU_EVENT_TYPE_RNC_SUSPEND_TX: 457 460 case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX: 458 461 case SCU_EVENT_TYPE_RNC_OPS_MISC: 459 - if (index < scic->remote_node_entries) { 460 - idev = scic->device_table[index]; 462 + if (index < ihost->remote_node_entries) { 463 + idev = ihost->device_table[index]; 461 464 462 465 if (idev != NULL) 463 466 scic_sds_remote_device_event_handler(idev, completion_entry); 464 467 } else 465 - dev_err(scic_to_dev(scic), 468 + dev_err(&ihost->pdev->dev, 466 469 "%s: SCIC Controller 0x%p received event 0x%x " 467 470 "for remote device object 0x%0x that doesnt " 468 471 "exist.\n", 469 472 __func__, 470 - scic, 473 + ihost, 471 474 completion_entry, 472 475 index); 473 476 474 477 break; 475 478 476 479 default: 477 - dev_warn(scic_to_dev(scic), 480 + dev_warn(&ihost->pdev->dev, 478 481 "%s: SCIC Controller received unknown event code %x\n", 479 482 __func__, 480 483 completion_entry); ··· 482 485 } 483 486 } 484 487 485 - static void scic_sds_controller_process_completions(struct scic_sds_controller *scic) 488 + static void scic_sds_controller_process_completions(struct isci_host *ihost) 486 489 { 487 490 u32 completion_count = 0; 488 491 u32 completion_entry; ··· 491 494 u32 event_get; 492 495 u32 event_cycle; 493 496 494 - dev_dbg(scic_to_dev(scic), 497 + dev_dbg(&ihost->pdev->dev, 495 498 "%s: completion queue begining get:0x%08x\n", 496 499 __func__, 497 - scic->completion_queue_get); 500 + ihost->completion_queue_get); 498 501 499 502 /* Get the component parts of the completion queue */ 500 - get_index = NORMALIZE_GET_POINTER(scic->completion_queue_get); 501 - get_cycle = SMU_CQGR_CYCLE_BIT & scic->completion_queue_get; 503 + get_index = NORMALIZE_GET_POINTER(ihost->completion_queue_get); 504 + get_cycle = SMU_CQGR_CYCLE_BIT & ihost->completion_queue_get; 502 505 503 - event_get = NORMALIZE_EVENT_POINTER(scic->completion_queue_get); 504 - event_cycle = SMU_CQGR_EVENT_CYCLE_BIT & scic->completion_queue_get; 506 + event_get = NORMALIZE_EVENT_POINTER(ihost->completion_queue_get); 507 + event_cycle = SMU_CQGR_EVENT_CYCLE_BIT & ihost->completion_queue_get; 505 508 506 509 while ( 507 510 NORMALIZE_GET_POINTER_CYCLE_BIT(get_cycle) 508 - == COMPLETION_QUEUE_CYCLE_BIT(scic->completion_queue[get_index]) 511 + == COMPLETION_QUEUE_CYCLE_BIT(ihost->completion_queue[get_index]) 509 512 ) { 510 513 completion_count++; 511 514 512 - completion_entry = scic->completion_queue[get_index]; 515 + completion_entry = ihost->completion_queue[get_index]; 513 516 514 517 /* increment the get pointer and check for rollover to toggle the cycle bit */ 515 518 get_cycle ^= ((get_index+1) & SCU_MAX_COMPLETION_QUEUE_ENTRIES) << 516 519 (SMU_COMPLETION_QUEUE_GET_CYCLE_BIT_SHIFT - SCU_MAX_COMPLETION_QUEUE_SHIFT); 517 520 get_index = (get_index+1) & (SCU_MAX_COMPLETION_QUEUE_ENTRIES-1); 518 521 519 - dev_dbg(scic_to_dev(scic), 522 + dev_dbg(&ihost->pdev->dev, 520 523 "%s: completion queue entry:0x%08x\n", 521 524 __func__, 522 525 completion_entry); 523 526 524 527 switch (SCU_GET_COMPLETION_TYPE(completion_entry)) { 525 528 case SCU_COMPLETION_TYPE_TASK: 526 - scic_sds_controller_task_completion(scic, completion_entry); 529 + scic_sds_controller_task_completion(ihost, completion_entry); 527 530 break; 528 531 529 532 case SCU_COMPLETION_TYPE_SDMA: 530 - scic_sds_controller_sdma_completion(scic, completion_entry); 533 + scic_sds_controller_sdma_completion(ihost, completion_entry); 531 534 break; 532 535 533 536 case SCU_COMPLETION_TYPE_UFI: 534 - scic_sds_controller_unsolicited_frame(scic, completion_entry); 537 + scic_sds_controller_unsolicited_frame(ihost, completion_entry); 535 538 break; 536 539 537 540 case SCU_COMPLETION_TYPE_EVENT: ··· 540 543 (SMU_COMPLETION_QUEUE_GET_EVENT_CYCLE_BIT_SHIFT - SCU_MAX_EVENTS_SHIFT); 541 544 event_get = (event_get+1) & (SCU_MAX_EVENTS-1); 542 545 543 - scic_sds_controller_event_completion(scic, completion_entry); 546 + scic_sds_controller_event_completion(ihost, completion_entry); 544 547 break; 545 548 } 546 549 default: 547 - dev_warn(scic_to_dev(scic), 550 + dev_warn(&ihost->pdev->dev, 548 551 "%s: SCIC Controller received unknown " 549 552 "completion type %x\n", 550 553 __func__, ··· 555 558 556 559 /* Update the get register if we completed one or more entries */ 557 560 if (completion_count > 0) { 558 - scic->completion_queue_get = 561 + ihost->completion_queue_get = 559 562 SMU_CQGR_GEN_BIT(ENABLE) | 560 563 SMU_CQGR_GEN_BIT(EVENT_ENABLE) | 561 564 event_cycle | ··· 563 566 get_cycle | 564 567 SMU_CQGR_GEN_VAL(POINTER, get_index); 565 568 566 - writel(scic->completion_queue_get, 567 - &scic->smu_registers->completion_queue_get); 569 + writel(ihost->completion_queue_get, 570 + &ihost->smu_registers->completion_queue_get); 568 571 569 572 } 570 573 571 - dev_dbg(scic_to_dev(scic), 574 + dev_dbg(&ihost->pdev->dev, 572 575 "%s: completion queue ending get:0x%08x\n", 573 576 __func__, 574 - scic->completion_queue_get); 577 + ihost->completion_queue_get); 575 578 576 579 } 577 580 578 - static void scic_sds_controller_error_handler(struct scic_sds_controller *scic) 581 + static void scic_sds_controller_error_handler(struct isci_host *ihost) 579 582 { 580 583 u32 interrupt_status; 581 584 582 585 interrupt_status = 583 - readl(&scic->smu_registers->interrupt_status); 586 + readl(&ihost->smu_registers->interrupt_status); 584 587 585 588 if ((interrupt_status & SMU_ISR_QUEUE_SUSPEND) && 586 - scic_sds_controller_completion_queue_has_entries(scic)) { 589 + scic_sds_controller_completion_queue_has_entries(ihost)) { 587 590 588 - scic_sds_controller_process_completions(scic); 589 - writel(SMU_ISR_QUEUE_SUSPEND, &scic->smu_registers->interrupt_status); 591 + scic_sds_controller_process_completions(ihost); 592 + writel(SMU_ISR_QUEUE_SUSPEND, &ihost->smu_registers->interrupt_status); 590 593 } else { 591 - dev_err(scic_to_dev(scic), "%s: status: %#x\n", __func__, 594 + dev_err(&ihost->pdev->dev, "%s: status: %#x\n", __func__, 592 595 interrupt_status); 593 596 594 - sci_change_state(&scic->sm, SCIC_FAILED); 597 + sci_change_state(&ihost->sm, SCIC_FAILED); 595 598 596 599 return; 597 600 } ··· 599 602 /* If we dont process any completions I am not sure that we want to do this. 600 603 * We are in the middle of a hardware fault and should probably be reset. 601 604 */ 602 - writel(0, &scic->smu_registers->interrupt_mask); 605 + writel(0, &ihost->smu_registers->interrupt_mask); 603 606 } 604 607 605 608 irqreturn_t isci_intx_isr(int vec, void *data) 606 609 { 607 610 irqreturn_t ret = IRQ_NONE; 608 611 struct isci_host *ihost = data; 609 - struct scic_sds_controller *scic = &ihost->sci; 610 612 611 - if (scic_sds_controller_isr(scic)) { 612 - writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status); 613 + if (scic_sds_controller_isr(ihost)) { 614 + writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status); 613 615 tasklet_schedule(&ihost->completion_tasklet); 614 616 ret = IRQ_HANDLED; 615 - } else if (scic_sds_controller_error_isr(scic)) { 617 + } else if (scic_sds_controller_error_isr(ihost)) { 616 618 spin_lock(&ihost->scic_lock); 617 - scic_sds_controller_error_handler(scic); 619 + scic_sds_controller_error_handler(ihost); 618 620 spin_unlock(&ihost->scic_lock); 619 621 ret = IRQ_HANDLED; 620 622 } ··· 625 629 { 626 630 struct isci_host *ihost = data; 627 631 628 - if (scic_sds_controller_error_isr(&ihost->sci)) 629 - scic_sds_controller_error_handler(&ihost->sci); 632 + if (scic_sds_controller_error_isr(ihost)) 633 + scic_sds_controller_error_handler(ihost); 630 634 631 635 return IRQ_HANDLED; 632 636 } ··· 681 685 * This method returns the number of milliseconds for the suggested start 682 686 * operation timeout. 683 687 */ 684 - static u32 scic_controller_get_suggested_start_timeout( 685 - struct scic_sds_controller *sc) 688 + static u32 scic_controller_get_suggested_start_timeout(struct isci_host *ihost) 686 689 { 687 690 /* Validate the user supplied parameters. */ 688 - if (sc == NULL) 691 + if (!ihost) 689 692 return 0; 690 693 691 694 /* ··· 706 711 + ((SCI_MAX_PHYS - 1) * SCIC_SDS_CONTROLLER_POWER_CONTROL_INTERVAL); 707 712 } 708 713 709 - static void scic_controller_enable_interrupts( 710 - struct scic_sds_controller *scic) 714 + static void scic_controller_enable_interrupts(struct isci_host *ihost) 711 715 { 712 - BUG_ON(scic->smu_registers == NULL); 713 - writel(0, &scic->smu_registers->interrupt_mask); 716 + BUG_ON(ihost->smu_registers == NULL); 717 + writel(0, &ihost->smu_registers->interrupt_mask); 714 718 } 715 719 716 - void scic_controller_disable_interrupts( 717 - struct scic_sds_controller *scic) 720 + void scic_controller_disable_interrupts(struct isci_host *ihost) 718 721 { 719 - BUG_ON(scic->smu_registers == NULL); 720 - writel(0xffffffff, &scic->smu_registers->interrupt_mask); 722 + BUG_ON(ihost->smu_registers == NULL); 723 + writel(0xffffffff, &ihost->smu_registers->interrupt_mask); 721 724 } 722 725 723 - static void scic_sds_controller_enable_port_task_scheduler( 724 - struct scic_sds_controller *scic) 726 + static void scic_sds_controller_enable_port_task_scheduler(struct isci_host *ihost) 725 727 { 726 728 u32 port_task_scheduler_value; 727 729 728 730 port_task_scheduler_value = 729 - readl(&scic->scu_registers->peg0.ptsg.control); 731 + readl(&ihost->scu_registers->peg0.ptsg.control); 730 732 port_task_scheduler_value |= 731 733 (SCU_PTSGCR_GEN_BIT(ETM_ENABLE) | 732 734 SCU_PTSGCR_GEN_BIT(PTSG_ENABLE)); 733 735 writel(port_task_scheduler_value, 734 - &scic->scu_registers->peg0.ptsg.control); 736 + &ihost->scu_registers->peg0.ptsg.control); 735 737 } 736 738 737 - static void scic_sds_controller_assign_task_entries(struct scic_sds_controller *scic) 739 + static void scic_sds_controller_assign_task_entries(struct isci_host *ihost) 738 740 { 739 741 u32 task_assignment; 740 742 ··· 741 749 */ 742 750 743 751 task_assignment = 744 - readl(&scic->smu_registers->task_context_assignment[0]); 752 + readl(&ihost->smu_registers->task_context_assignment[0]); 745 753 746 754 task_assignment |= (SMU_TCA_GEN_VAL(STARTING, 0)) | 747 - (SMU_TCA_GEN_VAL(ENDING, scic->task_context_entries - 1)) | 755 + (SMU_TCA_GEN_VAL(ENDING, ihost->task_context_entries - 1)) | 748 756 (SMU_TCA_GEN_BIT(RANGE_CHECK_ENABLE)); 749 757 750 758 writel(task_assignment, 751 - &scic->smu_registers->task_context_assignment[0]); 759 + &ihost->smu_registers->task_context_assignment[0]); 752 760 753 761 } 754 762 755 - static void scic_sds_controller_initialize_completion_queue(struct scic_sds_controller *scic) 763 + static void scic_sds_controller_initialize_completion_queue(struct isci_host *ihost) 756 764 { 757 765 u32 index; 758 766 u32 completion_queue_control_value; 759 767 u32 completion_queue_get_value; 760 768 u32 completion_queue_put_value; 761 769 762 - scic->completion_queue_get = 0; 770 + ihost->completion_queue_get = 0; 763 771 764 772 completion_queue_control_value = 765 773 (SMU_CQC_QUEUE_LIMIT_SET(SCU_MAX_COMPLETION_QUEUE_ENTRIES - 1) | 766 774 SMU_CQC_EVENT_LIMIT_SET(SCU_MAX_EVENTS - 1)); 767 775 768 776 writel(completion_queue_control_value, 769 - &scic->smu_registers->completion_queue_control); 777 + &ihost->smu_registers->completion_queue_control); 770 778 771 779 772 780 /* Set the completion queue get pointer and enable the queue */ ··· 778 786 ); 779 787 780 788 writel(completion_queue_get_value, 781 - &scic->smu_registers->completion_queue_get); 789 + &ihost->smu_registers->completion_queue_get); 782 790 783 791 /* Set the completion queue put pointer */ 784 792 completion_queue_put_value = ( ··· 787 795 ); 788 796 789 797 writel(completion_queue_put_value, 790 - &scic->smu_registers->completion_queue_put); 798 + &ihost->smu_registers->completion_queue_put); 791 799 792 800 /* Initialize the cycle bit of the completion queue entries */ 793 801 for (index = 0; index < SCU_MAX_COMPLETION_QUEUE_ENTRIES; index++) { ··· 795 803 * If get.cycle_bit != completion_queue.cycle_bit 796 804 * its not a valid completion queue entry 797 805 * so at system start all entries are invalid */ 798 - scic->completion_queue[index] = 0x80000000; 806 + ihost->completion_queue[index] = 0x80000000; 799 807 } 800 808 } 801 809 802 - static void scic_sds_controller_initialize_unsolicited_frame_queue(struct scic_sds_controller *scic) 810 + static void scic_sds_controller_initialize_unsolicited_frame_queue(struct isci_host *ihost) 803 811 { 804 812 u32 frame_queue_control_value; 805 813 u32 frame_queue_get_value; ··· 810 818 SCU_UFQC_GEN_VAL(QUEUE_SIZE, SCU_MAX_UNSOLICITED_FRAMES); 811 819 812 820 writel(frame_queue_control_value, 813 - &scic->scu_registers->sdma.unsolicited_frame_queue_control); 821 + &ihost->scu_registers->sdma.unsolicited_frame_queue_control); 814 822 815 823 /* Setup the get pointer for the unsolicited frame queue */ 816 824 frame_queue_get_value = ( ··· 819 827 ); 820 828 821 829 writel(frame_queue_get_value, 822 - &scic->scu_registers->sdma.unsolicited_frame_get_pointer); 830 + &ihost->scu_registers->sdma.unsolicited_frame_get_pointer); 823 831 /* Setup the put pointer for the unsolicited frame queue */ 824 832 frame_queue_put_value = SCU_UFQPP_GEN_VAL(POINTER, 0); 825 833 writel(frame_queue_put_value, 826 - &scic->scu_registers->sdma.unsolicited_frame_put_pointer); 834 + &ihost->scu_registers->sdma.unsolicited_frame_put_pointer); 827 835 } 828 836 829 837 /** ··· 838 846 * none. 839 847 */ 840 848 static void scic_sds_controller_transition_to_ready( 841 - struct scic_sds_controller *scic, 849 + struct isci_host *ihost, 842 850 enum sci_status status) 843 851 { 844 - struct isci_host *ihost = scic_to_ihost(scic); 845 852 846 - if (scic->sm.current_state_id == SCIC_STARTING) { 853 + if (ihost->sm.current_state_id == SCIC_STARTING) { 847 854 /* 848 855 * We move into the ready state, because some of the phys/ports 849 856 * may be up and operational. 850 857 */ 851 - sci_change_state(&scic->sm, SCIC_READY); 858 + sci_change_state(&ihost->sm, SCIC_READY); 852 859 853 860 isci_host_start_complete(ihost, status); 854 861 } ··· 883 892 * controller to the READY state and inform the user 884 893 * (scic_cb_controller_start_complete()). 885 894 */ 886 - static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_controller *scic) 895 + static enum sci_status scic_sds_controller_start_next_phy(struct isci_host *ihost) 887 896 { 888 - struct isci_host *ihost = scic_to_ihost(scic); 889 - struct scic_sds_oem_params *oem = &scic->oem_parameters.sds1; 897 + struct scic_sds_oem_params *oem = &ihost->oem_parameters.sds1; 890 898 struct isci_phy *iphy; 891 899 enum sci_status status; 892 900 893 901 status = SCI_SUCCESS; 894 902 895 - if (scic->phy_startup_timer_pending) 903 + if (ihost->phy_startup_timer_pending) 896 904 return status; 897 905 898 - if (scic->next_phy_to_start >= SCI_MAX_PHYS) { 906 + if (ihost->next_phy_to_start >= SCI_MAX_PHYS) { 899 907 bool is_controller_start_complete = true; 900 908 u32 state; 901 909 u8 index; ··· 924 934 * The controller has successfully finished the start process. 925 935 * Inform the SCI Core user and transition to the READY state. */ 926 936 if (is_controller_start_complete == true) { 927 - scic_sds_controller_transition_to_ready(scic, SCI_SUCCESS); 928 - sci_del_timer(&scic->phy_timer); 929 - scic->phy_startup_timer_pending = false; 937 + scic_sds_controller_transition_to_ready(ihost, SCI_SUCCESS); 938 + sci_del_timer(&ihost->phy_timer); 939 + ihost->phy_startup_timer_pending = false; 930 940 } 931 941 } else { 932 - iphy = &ihost->phys[scic->next_phy_to_start]; 942 + iphy = &ihost->phys[ihost->next_phy_to_start]; 933 943 934 944 if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { 935 945 if (phy_get_non_dummy_port(iphy) == NULL) { 936 - scic->next_phy_to_start++; 946 + ihost->next_phy_to_start++; 937 947 938 948 /* Caution recursion ahead be forwarned 939 949 * ··· 944 954 * incorrectly for the PORT or it was never 945 955 * assigned to a PORT 946 956 */ 947 - return scic_sds_controller_start_next_phy(scic); 957 + return scic_sds_controller_start_next_phy(ihost); 948 958 } 949 959 } 950 960 951 961 status = scic_sds_phy_start(iphy); 952 962 953 963 if (status == SCI_SUCCESS) { 954 - sci_mod_timer(&scic->phy_timer, 964 + sci_mod_timer(&ihost->phy_timer, 955 965 SCIC_SDS_CONTROLLER_PHY_START_TIMEOUT); 956 - scic->phy_startup_timer_pending = true; 966 + ihost->phy_startup_timer_pending = true; 957 967 } else { 958 - dev_warn(scic_to_dev(scic), 968 + dev_warn(&ihost->pdev->dev, 959 969 "%s: Controller stop operation failed " 960 970 "to stop phy %d because of status " 961 971 "%d.\n", 962 972 __func__, 963 - ihost->phys[scic->next_phy_to_start].phy_index, 973 + ihost->phys[ihost->next_phy_to_start].phy_index, 964 974 status); 965 975 } 966 976 967 - scic->next_phy_to_start++; 977 + ihost->next_phy_to_start++; 968 978 } 969 979 970 980 return status; ··· 973 983 static void phy_startup_timeout(unsigned long data) 974 984 { 975 985 struct sci_timer *tmr = (struct sci_timer *)data; 976 - struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), phy_timer); 977 - struct isci_host *ihost = scic_to_ihost(scic); 986 + struct isci_host *ihost = container_of(tmr, typeof(*ihost), phy_timer); 978 987 unsigned long flags; 979 988 enum sci_status status; 980 989 ··· 982 993 if (tmr->cancel) 983 994 goto done; 984 995 985 - scic->phy_startup_timer_pending = false; 996 + ihost->phy_startup_timer_pending = false; 986 997 987 998 do { 988 - status = scic_sds_controller_start_next_phy(scic); 999 + status = scic_sds_controller_start_next_phy(ihost); 989 1000 } while (status != SCI_SUCCESS); 990 1001 991 1002 done: ··· 997 1008 return CIRC_CNT(ihost->tci_head, ihost->tci_tail, SCI_MAX_IO_REQUESTS); 998 1009 } 999 1010 1000 - static enum sci_status scic_controller_start(struct scic_sds_controller *scic, 1011 + static enum sci_status scic_controller_start(struct isci_host *ihost, 1001 1012 u32 timeout) 1002 1013 { 1003 - struct isci_host *ihost = scic_to_ihost(scic); 1004 1014 enum sci_status result; 1005 1015 u16 index; 1006 1016 1007 - if (scic->sm.current_state_id != SCIC_INITIALIZED) { 1008 - dev_warn(scic_to_dev(scic), 1017 + if (ihost->sm.current_state_id != SCIC_INITIALIZED) { 1018 + dev_warn(&ihost->pdev->dev, 1009 1019 "SCIC Controller start operation requested in " 1010 1020 "invalid state\n"); 1011 1021 return SCI_FAILURE_INVALID_STATE; ··· 1014 1026 BUILD_BUG_ON(SCI_MAX_IO_REQUESTS > 1 << sizeof(ihost->tci_pool[0]) * 8); 1015 1027 ihost->tci_head = 0; 1016 1028 ihost->tci_tail = 0; 1017 - for (index = 0; index < scic->task_context_entries; index++) 1029 + for (index = 0; index < ihost->task_context_entries; index++) 1018 1030 isci_tci_free(ihost, index); 1019 1031 1020 1032 /* Build the RNi free pool */ 1021 1033 scic_sds_remote_node_table_initialize( 1022 - &scic->available_remote_nodes, 1023 - scic->remote_node_entries); 1034 + &ihost->available_remote_nodes, 1035 + ihost->remote_node_entries); 1024 1036 1025 1037 /* 1026 1038 * Before anything else lets make sure we will not be 1027 1039 * interrupted by the hardware. 1028 1040 */ 1029 - scic_controller_disable_interrupts(scic); 1041 + scic_controller_disable_interrupts(ihost); 1030 1042 1031 1043 /* Enable the port task scheduler */ 1032 - scic_sds_controller_enable_port_task_scheduler(scic); 1044 + scic_sds_controller_enable_port_task_scheduler(ihost); 1033 1045 1034 - /* Assign all the task entries to scic physical function */ 1035 - scic_sds_controller_assign_task_entries(scic); 1046 + /* Assign all the task entries to ihost physical function */ 1047 + scic_sds_controller_assign_task_entries(ihost); 1036 1048 1037 1049 /* Now initialize the completion queue */ 1038 - scic_sds_controller_initialize_completion_queue(scic); 1050 + scic_sds_controller_initialize_completion_queue(ihost); 1039 1051 1040 1052 /* Initialize the unsolicited frame queue for use */ 1041 - scic_sds_controller_initialize_unsolicited_frame_queue(scic); 1053 + scic_sds_controller_initialize_unsolicited_frame_queue(ihost); 1042 1054 1043 1055 /* Start all of the ports on this controller */ 1044 - for (index = 0; index < scic->logical_port_entries; index++) { 1056 + for (index = 0; index < ihost->logical_port_entries; index++) { 1045 1057 struct isci_port *iport = &ihost->ports[index]; 1046 1058 1047 1059 result = scic_sds_port_start(iport); ··· 1049 1061 return result; 1050 1062 } 1051 1063 1052 - scic_sds_controller_start_next_phy(scic); 1064 + scic_sds_controller_start_next_phy(ihost); 1053 1065 1054 - sci_mod_timer(&scic->timer, timeout); 1066 + sci_mod_timer(&ihost->timer, timeout); 1055 1067 1056 - sci_change_state(&scic->sm, SCIC_STARTING); 1068 + sci_change_state(&ihost->sm, SCIC_STARTING); 1057 1069 1058 1070 return SCI_SUCCESS; 1059 1071 } ··· 1061 1073 void isci_host_scan_start(struct Scsi_Host *shost) 1062 1074 { 1063 1075 struct isci_host *ihost = SHOST_TO_SAS_HA(shost)->lldd_ha; 1064 - unsigned long tmo = scic_controller_get_suggested_start_timeout(&ihost->sci); 1076 + unsigned long tmo = scic_controller_get_suggested_start_timeout(ihost); 1065 1077 1066 1078 set_bit(IHOST_START_PENDING, &ihost->flags); 1067 1079 1068 1080 spin_lock_irq(&ihost->scic_lock); 1069 - scic_controller_start(&ihost->sci, tmo); 1070 - scic_controller_enable_interrupts(&ihost->sci); 1081 + scic_controller_start(ihost, tmo); 1082 + scic_controller_enable_interrupts(ihost); 1071 1083 spin_unlock_irq(&ihost->scic_lock); 1072 1084 } 1073 1085 1074 1086 static void isci_host_stop_complete(struct isci_host *ihost, enum sci_status completion_status) 1075 1087 { 1076 1088 isci_host_change_state(ihost, isci_stopped); 1077 - scic_controller_disable_interrupts(&ihost->sci); 1089 + scic_controller_disable_interrupts(ihost); 1078 1090 clear_bit(IHOST_STOP_PENDING, &ihost->flags); 1079 1091 wake_up(&ihost->eventq); 1080 1092 } 1081 1093 1082 - static void scic_sds_controller_completion_handler(struct scic_sds_controller *scic) 1094 + static void scic_sds_controller_completion_handler(struct isci_host *ihost) 1083 1095 { 1084 1096 /* Empty out the completion queue */ 1085 - if (scic_sds_controller_completion_queue_has_entries(scic)) 1086 - scic_sds_controller_process_completions(scic); 1097 + if (scic_sds_controller_completion_queue_has_entries(ihost)) 1098 + scic_sds_controller_process_completions(ihost); 1087 1099 1088 1100 /* Clear the interrupt and enable all interrupts again */ 1089 - writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status); 1101 + writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status); 1090 1102 /* Could we write the value of SMU_ISR_COMPLETION? */ 1091 - writel(0xFF000000, &scic->smu_registers->interrupt_mask); 1092 - writel(0, &scic->smu_registers->interrupt_mask); 1103 + writel(0xFF000000, &ihost->smu_registers->interrupt_mask); 1104 + writel(0, &ihost->smu_registers->interrupt_mask); 1093 1105 } 1094 1106 1095 1107 /** ··· 1102 1114 */ 1103 1115 static void isci_host_completion_routine(unsigned long data) 1104 1116 { 1105 - struct isci_host *isci_host = (struct isci_host *)data; 1117 + struct isci_host *ihost = (struct isci_host *)data; 1106 1118 struct list_head completed_request_list; 1107 1119 struct list_head errored_request_list; 1108 1120 struct list_head *current_position; ··· 1114 1126 INIT_LIST_HEAD(&completed_request_list); 1115 1127 INIT_LIST_HEAD(&errored_request_list); 1116 1128 1117 - spin_lock_irq(&isci_host->scic_lock); 1129 + spin_lock_irq(&ihost->scic_lock); 1118 1130 1119 - scic_sds_controller_completion_handler(&isci_host->sci); 1131 + scic_sds_controller_completion_handler(ihost); 1120 1132 1121 1133 /* Take the lists of completed I/Os from the host. */ 1122 1134 1123 - list_splice_init(&isci_host->requests_to_complete, 1135 + list_splice_init(&ihost->requests_to_complete, 1124 1136 &completed_request_list); 1125 1137 1126 1138 /* Take the list of errored I/Os from the host. */ 1127 - list_splice_init(&isci_host->requests_to_errorback, 1139 + list_splice_init(&ihost->requests_to_errorback, 1128 1140 &errored_request_list); 1129 1141 1130 - spin_unlock_irq(&isci_host->scic_lock); 1142 + spin_unlock_irq(&ihost->scic_lock); 1131 1143 1132 1144 /* Process any completions in the lists. */ 1133 1145 list_for_each_safe(current_position, next_position, ··· 1138 1150 task = isci_request_access_task(request); 1139 1151 1140 1152 /* Normal notification (task_done) */ 1141 - dev_dbg(&isci_host->pdev->dev, 1153 + dev_dbg(&ihost->pdev->dev, 1142 1154 "%s: Normal - request/task = %p/%p\n", 1143 1155 __func__, 1144 1156 request, ··· 1157 1169 } 1158 1170 } 1159 1171 1160 - spin_lock_irq(&isci_host->scic_lock); 1161 - isci_free_tag(isci_host, request->io_tag); 1162 - spin_unlock_irq(&isci_host->scic_lock); 1172 + spin_lock_irq(&ihost->scic_lock); 1173 + isci_free_tag(ihost, request->io_tag); 1174 + spin_unlock_irq(&ihost->scic_lock); 1163 1175 } 1164 1176 list_for_each_entry_safe(request, next_request, &errored_request_list, 1165 1177 completed_node) { ··· 1167 1179 task = isci_request_access_task(request); 1168 1180 1169 1181 /* Use sas_task_abort */ 1170 - dev_warn(&isci_host->pdev->dev, 1182 + dev_warn(&ihost->pdev->dev, 1171 1183 "%s: Error - request/task = %p/%p\n", 1172 1184 __func__, 1173 1185 request, ··· 1190 1202 * it. 1191 1203 */ 1192 1204 1193 - spin_lock_irq(&isci_host->scic_lock); 1205 + spin_lock_irq(&ihost->scic_lock); 1194 1206 /* Remove the request from the remote device's list 1195 1207 * of pending requests. 1196 1208 */ 1197 1209 list_del_init(&request->dev_node); 1198 - isci_free_tag(isci_host, request->io_tag); 1199 - spin_unlock_irq(&isci_host->scic_lock); 1210 + isci_free_tag(ihost, request->io_tag); 1211 + spin_unlock_irq(&ihost->scic_lock); 1200 1212 } 1201 1213 } 1202 1214 ··· 1220 1232 * controller is already in the STOPPED state. SCI_FAILURE_INVALID_STATE if the 1221 1233 * controller is not either in the STARTED or STOPPED states. 1222 1234 */ 1223 - static enum sci_status scic_controller_stop(struct scic_sds_controller *scic, 1235 + static enum sci_status scic_controller_stop(struct isci_host *ihost, 1224 1236 u32 timeout) 1225 1237 { 1226 - if (scic->sm.current_state_id != SCIC_READY) { 1227 - dev_warn(scic_to_dev(scic), 1238 + if (ihost->sm.current_state_id != SCIC_READY) { 1239 + dev_warn(&ihost->pdev->dev, 1228 1240 "SCIC Controller stop operation requested in " 1229 1241 "invalid state\n"); 1230 1242 return SCI_FAILURE_INVALID_STATE; 1231 1243 } 1232 1244 1233 - sci_mod_timer(&scic->timer, timeout); 1234 - sci_change_state(&scic->sm, SCIC_STOPPING); 1245 + sci_mod_timer(&ihost->timer, timeout); 1246 + sci_change_state(&ihost->sm, SCIC_STOPPING); 1235 1247 return SCI_SUCCESS; 1236 1248 } 1237 1249 ··· 1247 1259 * SCI_SUCCESS if the reset operation successfully started. SCI_FATAL_ERROR if 1248 1260 * the controller reset operation is unable to complete. 1249 1261 */ 1250 - static enum sci_status scic_controller_reset(struct scic_sds_controller *scic) 1262 + static enum sci_status scic_controller_reset(struct isci_host *ihost) 1251 1263 { 1252 - switch (scic->sm.current_state_id) { 1264 + switch (ihost->sm.current_state_id) { 1253 1265 case SCIC_RESET: 1254 1266 case SCIC_READY: 1255 1267 case SCIC_STOPPED: ··· 1258 1270 * The reset operation is not a graceful cleanup, just 1259 1271 * perform the state transition. 1260 1272 */ 1261 - sci_change_state(&scic->sm, SCIC_RESETTING); 1273 + sci_change_state(&ihost->sm, SCIC_RESETTING); 1262 1274 return SCI_SUCCESS; 1263 1275 default: 1264 - dev_warn(scic_to_dev(scic), 1276 + dev_warn(&ihost->pdev->dev, 1265 1277 "SCIC Controller reset operation requested in " 1266 1278 "invalid state\n"); 1267 1279 return SCI_FAILURE_INVALID_STATE; ··· 1286 1298 set_bit(IHOST_STOP_PENDING, &ihost->flags); 1287 1299 1288 1300 spin_lock_irq(&ihost->scic_lock); 1289 - scic_controller_stop(&ihost->sci, SCIC_CONTROLLER_STOP_TIMEOUT); 1301 + scic_controller_stop(ihost, SCIC_CONTROLLER_STOP_TIMEOUT); 1290 1302 spin_unlock_irq(&ihost->scic_lock); 1291 1303 1292 1304 wait_for_stop(ihost); 1293 - scic_controller_reset(&ihost->sci); 1305 + scic_controller_reset(ihost); 1294 1306 1295 1307 /* Cancel any/all outstanding port timers */ 1296 - for (i = 0; i < ihost->sci.logical_port_entries; i++) { 1308 + for (i = 0; i < ihost->logical_port_entries; i++) { 1297 1309 struct isci_port *iport = &ihost->ports[i]; 1298 1310 del_timer_sync(&iport->timer.timer); 1299 1311 } ··· 1304 1316 del_timer_sync(&iphy->sata_timer.timer); 1305 1317 } 1306 1318 1307 - del_timer_sync(&ihost->sci.port_agent.timer.timer); 1319 + del_timer_sync(&ihost->port_agent.timer.timer); 1308 1320 1309 - del_timer_sync(&ihost->sci.power_control.timer.timer); 1321 + del_timer_sync(&ihost->power_control.timer.timer); 1310 1322 1311 - del_timer_sync(&ihost->sci.timer.timer); 1323 + del_timer_sync(&ihost->timer.timer); 1312 1324 1313 - del_timer_sync(&ihost->sci.phy_timer.timer); 1325 + del_timer_sync(&ihost->phy_timer.timer); 1314 1326 } 1315 1327 1316 1328 static void __iomem *scu_base(struct isci_host *isci_host) ··· 1357 1369 1358 1370 static void scic_sds_controller_initial_state_enter(struct sci_base_state_machine *sm) 1359 1371 { 1360 - struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); 1372 + struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); 1361 1373 1362 - sci_change_state(&scic->sm, SCIC_RESET); 1374 + sci_change_state(&ihost->sm, SCIC_RESET); 1363 1375 } 1364 1376 1365 1377 static inline void scic_sds_controller_starting_state_exit(struct sci_base_state_machine *sm) 1366 1378 { 1367 - struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); 1379 + struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); 1368 1380 1369 - sci_del_timer(&scic->timer); 1381 + sci_del_timer(&ihost->timer); 1370 1382 } 1371 1383 1372 1384 #define INTERRUPT_COALESCE_TIMEOUT_BASE_RANGE_LOWER_BOUND_NS 853 ··· 1393 1405 * SCI_SUCCESS The user successfully updated the interrutp coalescence. 1394 1406 * SCI_FAILURE_INVALID_PARAMETER_VALUE The user input value is out of range. 1395 1407 */ 1396 - static enum sci_status scic_controller_set_interrupt_coalescence( 1397 - struct scic_sds_controller *scic_controller, 1398 - u32 coalesce_number, 1399 - u32 coalesce_timeout) 1408 + static enum sci_status 1409 + scic_controller_set_interrupt_coalescence(struct isci_host *ihost, 1410 + u32 coalesce_number, 1411 + u32 coalesce_timeout) 1400 1412 { 1401 1413 u8 timeout_encode = 0; 1402 1414 u32 min = 0; ··· 1479 1491 1480 1492 writel(SMU_ICC_GEN_VAL(NUMBER, coalesce_number) | 1481 1493 SMU_ICC_GEN_VAL(TIMER, timeout_encode), 1482 - &scic_controller->smu_registers->interrupt_coalesce_control); 1494 + &ihost->smu_registers->interrupt_coalesce_control); 1483 1495 1484 1496 1485 - scic_controller->interrupt_coalesce_number = (u16)coalesce_number; 1486 - scic_controller->interrupt_coalesce_timeout = coalesce_timeout / 100; 1497 + ihost->interrupt_coalesce_number = (u16)coalesce_number; 1498 + ihost->interrupt_coalesce_timeout = coalesce_timeout / 100; 1487 1499 1488 1500 return SCI_SUCCESS; 1489 1501 } ··· 1491 1503 1492 1504 static void scic_sds_controller_ready_state_enter(struct sci_base_state_machine *sm) 1493 1505 { 1494 - struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); 1506 + struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); 1495 1507 1496 1508 /* set the default interrupt coalescence number and timeout value. */ 1497 - scic_controller_set_interrupt_coalescence(scic, 0x10, 250); 1509 + scic_controller_set_interrupt_coalescence(ihost, 0x10, 250); 1498 1510 } 1499 1511 1500 1512 static void scic_sds_controller_ready_state_exit(struct sci_base_state_machine *sm) 1501 1513 { 1502 - struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); 1514 + struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); 1503 1515 1504 1516 /* disable interrupt coalescence. */ 1505 - scic_controller_set_interrupt_coalescence(scic, 0, 0); 1517 + scic_controller_set_interrupt_coalescence(ihost, 0, 0); 1506 1518 } 1507 1519 1508 - static enum sci_status scic_sds_controller_stop_phys(struct scic_sds_controller *scic) 1520 + static enum sci_status scic_sds_controller_stop_phys(struct isci_host *ihost) 1509 1521 { 1510 1522 u32 index; 1511 1523 enum sci_status status; 1512 1524 enum sci_status phy_status; 1513 - struct isci_host *ihost = scic_to_ihost(scic); 1514 1525 1515 1526 status = SCI_SUCCESS; 1516 1527 ··· 1520 1533 phy_status != SCI_FAILURE_INVALID_STATE) { 1521 1534 status = SCI_FAILURE; 1522 1535 1523 - dev_warn(scic_to_dev(scic), 1536 + dev_warn(&ihost->pdev->dev, 1524 1537 "%s: Controller stop operation failed to stop " 1525 1538 "phy %d because of status %d.\n", 1526 1539 __func__, ··· 1531 1544 return status; 1532 1545 } 1533 1546 1534 - static enum sci_status scic_sds_controller_stop_ports(struct scic_sds_controller *scic) 1547 + static enum sci_status scic_sds_controller_stop_ports(struct isci_host *ihost) 1535 1548 { 1536 1549 u32 index; 1537 1550 enum sci_status port_status; 1538 1551 enum sci_status status = SCI_SUCCESS; 1539 - struct isci_host *ihost = scic_to_ihost(scic); 1540 1552 1541 - for (index = 0; index < scic->logical_port_entries; index++) { 1553 + for (index = 0; index < ihost->logical_port_entries; index++) { 1542 1554 struct isci_port *iport = &ihost->ports[index]; 1543 1555 1544 1556 port_status = scic_sds_port_stop(iport); ··· 1546 1560 (port_status != SCI_FAILURE_INVALID_STATE)) { 1547 1561 status = SCI_FAILURE; 1548 1562 1549 - dev_warn(scic_to_dev(scic), 1563 + dev_warn(&ihost->pdev->dev, 1550 1564 "%s: Controller stop operation failed to " 1551 1565 "stop port %d because of status %d.\n", 1552 1566 __func__, ··· 1558 1572 return status; 1559 1573 } 1560 1574 1561 - static enum sci_status scic_sds_controller_stop_devices(struct scic_sds_controller *scic) 1575 + static enum sci_status scic_sds_controller_stop_devices(struct isci_host *ihost) 1562 1576 { 1563 1577 u32 index; 1564 1578 enum sci_status status; ··· 1566 1580 1567 1581 status = SCI_SUCCESS; 1568 1582 1569 - for (index = 0; index < scic->remote_node_entries; index++) { 1570 - if (scic->device_table[index] != NULL) { 1583 + for (index = 0; index < ihost->remote_node_entries; index++) { 1584 + if (ihost->device_table[index] != NULL) { 1571 1585 /* / @todo What timeout value do we want to provide to this request? */ 1572 - device_status = scic_remote_device_stop(scic->device_table[index], 0); 1586 + device_status = scic_remote_device_stop(ihost->device_table[index], 0); 1573 1587 1574 1588 if ((device_status != SCI_SUCCESS) && 1575 1589 (device_status != SCI_FAILURE_INVALID_STATE)) { 1576 - dev_warn(scic_to_dev(scic), 1590 + dev_warn(&ihost->pdev->dev, 1577 1591 "%s: Controller stop operation failed " 1578 1592 "to stop device 0x%p because of " 1579 1593 "status %d.\n", 1580 1594 __func__, 1581 - scic->device_table[index], device_status); 1595 + ihost->device_table[index], device_status); 1582 1596 } 1583 1597 } 1584 1598 } ··· 1588 1602 1589 1603 static void scic_sds_controller_stopping_state_enter(struct sci_base_state_machine *sm) 1590 1604 { 1591 - struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); 1605 + struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); 1592 1606 1593 1607 /* Stop all of the components for this controller */ 1594 - scic_sds_controller_stop_phys(scic); 1595 - scic_sds_controller_stop_ports(scic); 1596 - scic_sds_controller_stop_devices(scic); 1608 + scic_sds_controller_stop_phys(ihost); 1609 + scic_sds_controller_stop_ports(ihost); 1610 + scic_sds_controller_stop_devices(ihost); 1597 1611 } 1598 1612 1599 1613 static void scic_sds_controller_stopping_state_exit(struct sci_base_state_machine *sm) 1600 1614 { 1601 - struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); 1615 + struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); 1602 1616 1603 - sci_del_timer(&scic->timer); 1617 + sci_del_timer(&ihost->timer); 1604 1618 } 1605 1619 1606 1620 ··· 1609 1623 * 1610 1624 * This method will reset the controller hardware. 1611 1625 */ 1612 - static void scic_sds_controller_reset_hardware(struct scic_sds_controller *scic) 1626 + static void scic_sds_controller_reset_hardware(struct isci_host *ihost) 1613 1627 { 1614 1628 /* Disable interrupts so we dont take any spurious interrupts */ 1615 - scic_controller_disable_interrupts(scic); 1629 + scic_controller_disable_interrupts(ihost); 1616 1630 1617 1631 /* Reset the SCU */ 1618 - writel(0xFFFFFFFF, &scic->smu_registers->soft_reset_control); 1632 + writel(0xFFFFFFFF, &ihost->smu_registers->soft_reset_control); 1619 1633 1620 1634 /* Delay for 1ms to before clearing the CQP and UFQPR. */ 1621 1635 udelay(1000); 1622 1636 1623 1637 /* The write to the CQGR clears the CQP */ 1624 - writel(0x00000000, &scic->smu_registers->completion_queue_get); 1638 + writel(0x00000000, &ihost->smu_registers->completion_queue_get); 1625 1639 1626 1640 /* The write to the UFQGP clears the UFQPR */ 1627 - writel(0, &scic->scu_registers->sdma.unsolicited_frame_get_pointer); 1641 + writel(0, &ihost->scu_registers->sdma.unsolicited_frame_get_pointer); 1628 1642 } 1629 1643 1630 1644 static void scic_sds_controller_resetting_state_enter(struct sci_base_state_machine *sm) 1631 1645 { 1632 - struct scic_sds_controller *scic = container_of(sm, typeof(*scic), sm); 1646 + struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); 1633 1647 1634 - scic_sds_controller_reset_hardware(scic); 1635 - sci_change_state(&scic->sm, SCIC_RESET); 1648 + scic_sds_controller_reset_hardware(ihost); 1649 + sci_change_state(&ihost->sm, SCIC_RESET); 1636 1650 } 1637 1651 1638 1652 static const struct sci_base_state scic_sds_controller_state_table[] = { ··· 1660 1674 [SCIC_FAILED] = {} 1661 1675 }; 1662 1676 1663 - static void scic_sds_controller_set_default_config_parameters(struct scic_sds_controller *scic) 1677 + static void scic_sds_controller_set_default_config_parameters(struct isci_host *ihost) 1664 1678 { 1665 1679 /* these defaults are overridden by the platform / firmware */ 1666 - struct isci_host *ihost = scic_to_ihost(scic); 1667 1680 u16 index; 1668 1681 1669 1682 /* Default to APC mode. */ 1670 - scic->oem_parameters.sds1.controller.mode_type = SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE; 1683 + ihost->oem_parameters.sds1.controller.mode_type = SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE; 1671 1684 1672 1685 /* Default to APC mode. */ 1673 - scic->oem_parameters.sds1.controller.max_concurrent_dev_spin_up = 1; 1686 + ihost->oem_parameters.sds1.controller.max_concurrent_dev_spin_up = 1; 1674 1687 1675 1688 /* Default to no SSC operation. */ 1676 - scic->oem_parameters.sds1.controller.do_enable_ssc = false; 1689 + ihost->oem_parameters.sds1.controller.do_enable_ssc = false; 1677 1690 1678 1691 /* Initialize all of the port parameter information to narrow ports. */ 1679 1692 for (index = 0; index < SCI_MAX_PORTS; index++) { 1680 - scic->oem_parameters.sds1.ports[index].phy_mask = 0; 1693 + ihost->oem_parameters.sds1.ports[index].phy_mask = 0; 1681 1694 } 1682 1695 1683 1696 /* Initialize all of the phy parameter information. */ 1684 1697 for (index = 0; index < SCI_MAX_PHYS; index++) { 1685 1698 /* Default to 6G (i.e. Gen 3) for now. */ 1686 - scic->user_parameters.sds1.phys[index].max_speed_generation = 3; 1699 + ihost->user_parameters.sds1.phys[index].max_speed_generation = 3; 1687 1700 1688 1701 /* the frequencies cannot be 0 */ 1689 - scic->user_parameters.sds1.phys[index].align_insertion_frequency = 0x7f; 1690 - scic->user_parameters.sds1.phys[index].in_connection_align_insertion_frequency = 0xff; 1691 - scic->user_parameters.sds1.phys[index].notify_enable_spin_up_insertion_frequency = 0x33; 1702 + ihost->user_parameters.sds1.phys[index].align_insertion_frequency = 0x7f; 1703 + ihost->user_parameters.sds1.phys[index].in_connection_align_insertion_frequency = 0xff; 1704 + ihost->user_parameters.sds1.phys[index].notify_enable_spin_up_insertion_frequency = 0x33; 1692 1705 1693 1706 /* 1694 1707 * Previous Vitesse based expanders had a arbitration issue that 1695 1708 * is worked around by having the upper 32-bits of SAS address 1696 1709 * with a value greater then the Vitesse company identifier. 1697 1710 * Hence, usage of 0x5FCFFFFF. */ 1698 - scic->oem_parameters.sds1.phys[index].sas_address.low = 0x1 + ihost->id; 1699 - scic->oem_parameters.sds1.phys[index].sas_address.high = 0x5FCFFFFF; 1711 + ihost->oem_parameters.sds1.phys[index].sas_address.low = 0x1 + ihost->id; 1712 + ihost->oem_parameters.sds1.phys[index].sas_address.high = 0x5FCFFFFF; 1700 1713 } 1701 1714 1702 - scic->user_parameters.sds1.stp_inactivity_timeout = 5; 1703 - scic->user_parameters.sds1.ssp_inactivity_timeout = 5; 1704 - scic->user_parameters.sds1.stp_max_occupancy_timeout = 5; 1705 - scic->user_parameters.sds1.ssp_max_occupancy_timeout = 20; 1706 - scic->user_parameters.sds1.no_outbound_task_timeout = 20; 1715 + ihost->user_parameters.sds1.stp_inactivity_timeout = 5; 1716 + ihost->user_parameters.sds1.ssp_inactivity_timeout = 5; 1717 + ihost->user_parameters.sds1.stp_max_occupancy_timeout = 5; 1718 + ihost->user_parameters.sds1.ssp_max_occupancy_timeout = 20; 1719 + ihost->user_parameters.sds1.no_outbound_task_timeout = 20; 1707 1720 } 1708 1721 1709 1722 static void controller_timeout(unsigned long data) 1710 1723 { 1711 1724 struct sci_timer *tmr = (struct sci_timer *)data; 1712 - struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), timer); 1713 - struct isci_host *ihost = scic_to_ihost(scic); 1714 - struct sci_base_state_machine *sm = &scic->sm; 1725 + struct isci_host *ihost = container_of(tmr, typeof(*ihost), timer); 1726 + struct sci_base_state_machine *sm = &ihost->sm; 1715 1727 unsigned long flags; 1716 1728 1717 1729 spin_lock_irqsave(&ihost->scic_lock, flags); ··· 1718 1734 goto done; 1719 1735 1720 1736 if (sm->current_state_id == SCIC_STARTING) 1721 - scic_sds_controller_transition_to_ready(scic, SCI_FAILURE_TIMEOUT); 1737 + scic_sds_controller_transition_to_ready(ihost, SCI_FAILURE_TIMEOUT); 1722 1738 else if (sm->current_state_id == SCIC_STOPPING) { 1723 1739 sci_change_state(sm, SCIC_FAILED); 1724 1740 isci_host_stop_complete(ihost, SCI_FAILURE_TIMEOUT); 1725 1741 } else /* / @todo Now what do we want to do in this case? */ 1726 - dev_err(scic_to_dev(scic), 1742 + dev_err(&ihost->pdev->dev, 1727 1743 "%s: Controller timer fired when controller was not " 1728 1744 "in a state being timed.\n", 1729 1745 __func__); ··· 1748 1764 * SCI_FAILURE_UNSUPPORTED_INIT_DATA_VERSION This value is returned if the 1749 1765 * controller does not support the supplied initialization data version. 1750 1766 */ 1751 - static enum sci_status scic_controller_construct(struct scic_sds_controller *scic, 1767 + static enum sci_status scic_controller_construct(struct isci_host *ihost, 1752 1768 void __iomem *scu_base, 1753 1769 void __iomem *smu_base) 1754 1770 { 1755 - struct isci_host *ihost = scic_to_ihost(scic); 1756 1771 u8 i; 1757 1772 1758 - sci_init_sm(&scic->sm, scic_sds_controller_state_table, SCIC_INITIAL); 1773 + sci_init_sm(&ihost->sm, scic_sds_controller_state_table, SCIC_INITIAL); 1759 1774 1760 - scic->scu_registers = scu_base; 1761 - scic->smu_registers = smu_base; 1775 + ihost->scu_registers = scu_base; 1776 + ihost->smu_registers = smu_base; 1762 1777 1763 - scic_sds_port_configuration_agent_construct(&scic->port_agent); 1778 + scic_sds_port_configuration_agent_construct(&ihost->port_agent); 1764 1779 1765 1780 /* Construct the ports for this controller */ 1766 1781 for (i = 0; i < SCI_MAX_PORTS; i++) 1767 - scic_sds_port_construct(&ihost->ports[i], i, scic); 1768 - scic_sds_port_construct(&ihost->ports[i], SCIC_SDS_DUMMY_PORT, scic); 1782 + scic_sds_port_construct(&ihost->ports[i], i, ihost); 1783 + scic_sds_port_construct(&ihost->ports[i], SCIC_SDS_DUMMY_PORT, ihost); 1769 1784 1770 1785 /* Construct the phys for this controller */ 1771 1786 for (i = 0; i < SCI_MAX_PHYS; i++) { ··· 1773 1790 &ihost->ports[SCI_MAX_PORTS], i); 1774 1791 } 1775 1792 1776 - scic->invalid_phy_mask = 0; 1793 + ihost->invalid_phy_mask = 0; 1777 1794 1778 - sci_init_timer(&scic->timer, controller_timeout); 1795 + sci_init_timer(&ihost->timer, controller_timeout); 1779 1796 1780 1797 /* Initialize the User and OEM parameters to default values. */ 1781 - scic_sds_controller_set_default_config_parameters(scic); 1798 + scic_sds_controller_set_default_config_parameters(ihost); 1782 1799 1783 - return scic_controller_reset(scic); 1800 + return scic_controller_reset(ihost); 1784 1801 } 1785 1802 1786 1803 int scic_oem_parameters_validate(struct scic_sds_oem_params *oem) ··· 1817 1834 return 0; 1818 1835 } 1819 1836 1820 - static enum sci_status scic_oem_parameters_set(struct scic_sds_controller *scic, 1837 + static enum sci_status scic_oem_parameters_set(struct isci_host *ihost, 1821 1838 union scic_oem_parameters *scic_parms) 1822 1839 { 1823 - u32 state = scic->sm.current_state_id; 1840 + u32 state = ihost->sm.current_state_id; 1824 1841 1825 1842 if (state == SCIC_RESET || 1826 1843 state == SCIC_INITIALIZING || ··· 1828 1845 1829 1846 if (scic_oem_parameters_validate(&scic_parms->sds1)) 1830 1847 return SCI_FAILURE_INVALID_PARAMETER_VALUE; 1831 - scic->oem_parameters.sds1 = scic_parms->sds1; 1848 + ihost->oem_parameters.sds1 = scic_parms->sds1; 1832 1849 1833 1850 return SCI_SUCCESS; 1834 1851 } ··· 1837 1854 } 1838 1855 1839 1856 void scic_oem_parameters_get( 1840 - struct scic_sds_controller *scic, 1857 + struct isci_host *ihost, 1841 1858 union scic_oem_parameters *scic_parms) 1842 1859 { 1843 - memcpy(scic_parms, (&scic->oem_parameters), sizeof(*scic_parms)); 1860 + memcpy(scic_parms, (&ihost->oem_parameters), sizeof(*scic_parms)); 1844 1861 } 1845 1862 1846 1863 static void power_control_timeout(unsigned long data) 1847 1864 { 1848 1865 struct sci_timer *tmr = (struct sci_timer *)data; 1849 - struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), power_control.timer); 1850 - struct isci_host *ihost = scic_to_ihost(scic); 1866 + struct isci_host *ihost = container_of(tmr, typeof(*ihost), power_control.timer); 1851 1867 struct isci_phy *iphy; 1852 1868 unsigned long flags; 1853 1869 u8 i; ··· 1856 1874 if (tmr->cancel) 1857 1875 goto done; 1858 1876 1859 - scic->power_control.phys_granted_power = 0; 1877 + ihost->power_control.phys_granted_power = 0; 1860 1878 1861 - if (scic->power_control.phys_waiting == 0) { 1862 - scic->power_control.timer_started = false; 1879 + if (ihost->power_control.phys_waiting == 0) { 1880 + ihost->power_control.timer_started = false; 1863 1881 goto done; 1864 1882 } 1865 1883 1866 1884 for (i = 0; i < SCI_MAX_PHYS; i++) { 1867 1885 1868 - if (scic->power_control.phys_waiting == 0) 1886 + if (ihost->power_control.phys_waiting == 0) 1869 1887 break; 1870 1888 1871 - iphy = scic->power_control.requesters[i]; 1889 + iphy = ihost->power_control.requesters[i]; 1872 1890 if (iphy == NULL) 1873 1891 continue; 1874 1892 1875 - if (scic->power_control.phys_granted_power >= 1876 - scic->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) 1893 + if (ihost->power_control.phys_granted_power >= 1894 + ihost->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) 1877 1895 break; 1878 1896 1879 - scic->power_control.requesters[i] = NULL; 1880 - scic->power_control.phys_waiting--; 1881 - scic->power_control.phys_granted_power++; 1897 + ihost->power_control.requesters[i] = NULL; 1898 + ihost->power_control.phys_waiting--; 1899 + ihost->power_control.phys_granted_power++; 1882 1900 scic_sds_phy_consume_power_handler(iphy); 1883 1901 } 1884 1902 ··· 1887 1905 * timer in case another phy becomes ready. 1888 1906 */ 1889 1907 sci_mod_timer(tmr, SCIC_SDS_CONTROLLER_POWER_CONTROL_INTERVAL); 1890 - scic->power_control.timer_started = true; 1908 + ihost->power_control.timer_started = true; 1891 1909 1892 1910 done: 1893 1911 spin_unlock_irqrestore(&ihost->scic_lock, flags); ··· 1900 1918 * 1901 1919 */ 1902 1920 void scic_sds_controller_power_control_queue_insert( 1903 - struct scic_sds_controller *scic, 1921 + struct isci_host *ihost, 1904 1922 struct isci_phy *iphy) 1905 1923 { 1906 1924 BUG_ON(iphy == NULL); 1907 1925 1908 - if (scic->power_control.phys_granted_power < 1909 - scic->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) { 1910 - scic->power_control.phys_granted_power++; 1926 + if (ihost->power_control.phys_granted_power < 1927 + ihost->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) { 1928 + ihost->power_control.phys_granted_power++; 1911 1929 scic_sds_phy_consume_power_handler(iphy); 1912 1930 1913 1931 /* 1914 1932 * stop and start the power_control timer. When the timer fires, the 1915 1933 * no_of_phys_granted_power will be set to 0 1916 1934 */ 1917 - if (scic->power_control.timer_started) 1918 - sci_del_timer(&scic->power_control.timer); 1935 + if (ihost->power_control.timer_started) 1936 + sci_del_timer(&ihost->power_control.timer); 1919 1937 1920 - sci_mod_timer(&scic->power_control.timer, 1938 + sci_mod_timer(&ihost->power_control.timer, 1921 1939 SCIC_SDS_CONTROLLER_POWER_CONTROL_INTERVAL); 1922 - scic->power_control.timer_started = true; 1940 + ihost->power_control.timer_started = true; 1923 1941 1924 1942 } else { 1925 1943 /* Add the phy in the waiting list */ 1926 - scic->power_control.requesters[iphy->phy_index] = iphy; 1927 - scic->power_control.phys_waiting++; 1944 + ihost->power_control.requesters[iphy->phy_index] = iphy; 1945 + ihost->power_control.phys_waiting++; 1928 1946 } 1929 1947 } 1930 1948 ··· 1935 1953 * 1936 1954 */ 1937 1955 void scic_sds_controller_power_control_queue_remove( 1938 - struct scic_sds_controller *scic, 1956 + struct isci_host *ihost, 1939 1957 struct isci_phy *iphy) 1940 1958 { 1941 1959 BUG_ON(iphy == NULL); 1942 1960 1943 - if (scic->power_control.requesters[iphy->phy_index] != NULL) { 1944 - scic->power_control.phys_waiting--; 1961 + if (ihost->power_control.requesters[iphy->phy_index] != NULL) { 1962 + ihost->power_control.phys_waiting--; 1945 1963 } 1946 1964 1947 - scic->power_control.requesters[iphy->phy_index] = NULL; 1965 + ihost->power_control.requesters[iphy->phy_index] = NULL; 1948 1966 } 1949 1967 1950 1968 #define AFE_REGISTER_WRITE_DELAY 10 ··· 1952 1970 /* Initialize the AFE for this phy index. We need to read the AFE setup from 1953 1971 * the OEM parameters 1954 1972 */ 1955 - static void scic_sds_controller_afe_initialization(struct scic_sds_controller *scic) 1973 + static void scic_sds_controller_afe_initialization(struct isci_host *ihost) 1956 1974 { 1957 - const struct scic_sds_oem_params *oem = &scic->oem_parameters.sds1; 1975 + const struct scic_sds_oem_params *oem = &ihost->oem_parameters.sds1; 1958 1976 u32 afe_status; 1959 1977 u32 phy_id; 1960 1978 1961 1979 /* Clear DFX Status registers */ 1962 - writel(0x0081000f, &scic->scu_registers->afe.afe_dfx_master_control0); 1980 + writel(0x0081000f, &ihost->scu_registers->afe.afe_dfx_master_control0); 1963 1981 udelay(AFE_REGISTER_WRITE_DELAY); 1964 1982 1965 1983 if (is_b0()) { 1966 1984 /* PM Rx Equalization Save, PM SPhy Rx Acknowledgement 1967 1985 * Timer, PM Stagger Timer */ 1968 - writel(0x0007BFFF, &scic->scu_registers->afe.afe_pmsn_master_control2); 1986 + writel(0x0007BFFF, &ihost->scu_registers->afe.afe_pmsn_master_control2); 1969 1987 udelay(AFE_REGISTER_WRITE_DELAY); 1970 1988 } 1971 1989 1972 1990 /* Configure bias currents to normal */ 1973 1991 if (is_a0()) 1974 - writel(0x00005500, &scic->scu_registers->afe.afe_bias_control); 1992 + writel(0x00005500, &ihost->scu_registers->afe.afe_bias_control); 1975 1993 else if (is_a2()) 1976 - writel(0x00005A00, &scic->scu_registers->afe.afe_bias_control); 1994 + writel(0x00005A00, &ihost->scu_registers->afe.afe_bias_control); 1977 1995 else if (is_b0() || is_c0()) 1978 - writel(0x00005F00, &scic->scu_registers->afe.afe_bias_control); 1996 + writel(0x00005F00, &ihost->scu_registers->afe.afe_bias_control); 1979 1997 1980 1998 udelay(AFE_REGISTER_WRITE_DELAY); 1981 1999 1982 2000 /* Enable PLL */ 1983 2001 if (is_b0() || is_c0()) 1984 - writel(0x80040A08, &scic->scu_registers->afe.afe_pll_control0); 2002 + writel(0x80040A08, &ihost->scu_registers->afe.afe_pll_control0); 1985 2003 else 1986 - writel(0x80040908, &scic->scu_registers->afe.afe_pll_control0); 2004 + writel(0x80040908, &ihost->scu_registers->afe.afe_pll_control0); 1987 2005 1988 2006 udelay(AFE_REGISTER_WRITE_DELAY); 1989 2007 1990 2008 /* Wait for the PLL to lock */ 1991 2009 do { 1992 - afe_status = readl(&scic->scu_registers->afe.afe_common_block_status); 2010 + afe_status = readl(&ihost->scu_registers->afe.afe_common_block_status); 1993 2011 udelay(AFE_REGISTER_WRITE_DELAY); 1994 2012 } while ((afe_status & 0x00001000) == 0); 1995 2013 1996 2014 if (is_a0() || is_a2()) { 1997 2015 /* Shorten SAS SNW lock time (RxLock timer value from 76 us to 50 us) */ 1998 - writel(0x7bcc96ad, &scic->scu_registers->afe.afe_pmsn_master_control0); 2016 + writel(0x7bcc96ad, &ihost->scu_registers->afe.afe_pmsn_master_control0); 1999 2017 udelay(AFE_REGISTER_WRITE_DELAY); 2000 2018 } 2001 2019 ··· 2004 2022 2005 2023 if (is_b0()) { 2006 2024 /* Configure transmitter SSC parameters */ 2007 - writel(0x00030000, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); 2025 + writel(0x00030000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); 2008 2026 udelay(AFE_REGISTER_WRITE_DELAY); 2009 2027 } else if (is_c0()) { 2010 2028 /* Configure transmitter SSC parameters */ 2011 - writel(0x0003000, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); 2029 + writel(0x0003000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); 2012 2030 udelay(AFE_REGISTER_WRITE_DELAY); 2013 2031 2014 2032 /* 2015 2033 * All defaults, except the Receive Word Alignament/Comma Detect 2016 2034 * Enable....(0xe800) */ 2017 - writel(0x00004500, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); 2035 + writel(0x00004500, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); 2018 2036 udelay(AFE_REGISTER_WRITE_DELAY); 2019 2037 } else { 2020 2038 /* 2021 2039 * All defaults, except the Receive Word Alignament/Comma Detect 2022 2040 * Enable....(0xe800) */ 2023 - writel(0x00004512, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); 2041 + writel(0x00004512, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); 2024 2042 udelay(AFE_REGISTER_WRITE_DELAY); 2025 2043 2026 - writel(0x0050100F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control1); 2044 + writel(0x0050100F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control1); 2027 2045 udelay(AFE_REGISTER_WRITE_DELAY); 2028 2046 } 2029 2047 ··· 2031 2049 * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) 2032 2050 * & increase TX int & ext bias 20%....(0xe85c) */ 2033 2051 if (is_a0()) 2034 - writel(0x000003D4, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2052 + writel(0x000003D4, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2035 2053 else if (is_a2()) 2036 - writel(0x000003F0, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2054 + writel(0x000003F0, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2037 2055 else if (is_b0()) { 2038 2056 /* Power down TX and RX (PWRDNTX and PWRDNRX) */ 2039 - writel(0x000003D7, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2057 + writel(0x000003D7, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2040 2058 udelay(AFE_REGISTER_WRITE_DELAY); 2041 2059 2042 2060 /* 2043 2061 * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) 2044 2062 * & increase TX int & ext bias 20%....(0xe85c) */ 2045 - writel(0x000003D4, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2063 + writel(0x000003D4, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2046 2064 } else { 2047 - writel(0x000001E7, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2065 + writel(0x000001E7, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2048 2066 udelay(AFE_REGISTER_WRITE_DELAY); 2049 2067 2050 2068 /* 2051 2069 * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) 2052 2070 * & increase TX int & ext bias 20%....(0xe85c) */ 2053 - writel(0x000001E4, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2071 + writel(0x000001E4, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2054 2072 } 2055 2073 udelay(AFE_REGISTER_WRITE_DELAY); 2056 2074 2057 2075 if (is_a0() || is_a2()) { 2058 2076 /* Enable TX equalization (0xe824) */ 2059 - writel(0x00040000, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); 2077 + writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); 2060 2078 udelay(AFE_REGISTER_WRITE_DELAY); 2061 2079 } 2062 2080 2063 2081 /* 2064 2082 * RDPI=0x0(RX Power On), RXOOBDETPDNC=0x0, TPD=0x0(TX Power On), 2065 2083 * RDD=0x0(RX Detect Enabled) ....(0xe800) */ 2066 - writel(0x00004100, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); 2084 + writel(0x00004100, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); 2067 2085 udelay(AFE_REGISTER_WRITE_DELAY); 2068 2086 2069 2087 /* Leave DFE/FFE on */ 2070 2088 if (is_a0()) 2071 - writel(0x3F09983F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2089 + writel(0x3F09983F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2072 2090 else if (is_a2()) 2073 - writel(0x3F11103F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2091 + writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2074 2092 else if (is_b0()) { 2075 - writel(0x3F11103F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2093 + writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2076 2094 udelay(AFE_REGISTER_WRITE_DELAY); 2077 2095 /* Enable TX equalization (0xe824) */ 2078 - writel(0x00040000, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); 2096 + writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); 2079 2097 } else { 2080 - writel(0x0140DF0F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control1); 2098 + writel(0x0140DF0F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control1); 2081 2099 udelay(AFE_REGISTER_WRITE_DELAY); 2082 2100 2083 - writel(0x3F6F103F, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2101 + writel(0x3F6F103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2084 2102 udelay(AFE_REGISTER_WRITE_DELAY); 2085 2103 2086 2104 /* Enable TX equalization (0xe824) */ 2087 - writel(0x00040000, &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); 2105 + writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); 2088 2106 } 2089 2107 2090 2108 udelay(AFE_REGISTER_WRITE_DELAY); 2091 2109 2092 2110 writel(oem_phy->afe_tx_amp_control0, 2093 - &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control0); 2111 + &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control0); 2094 2112 udelay(AFE_REGISTER_WRITE_DELAY); 2095 2113 2096 2114 writel(oem_phy->afe_tx_amp_control1, 2097 - &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control1); 2115 + &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control1); 2098 2116 udelay(AFE_REGISTER_WRITE_DELAY); 2099 2117 2100 2118 writel(oem_phy->afe_tx_amp_control2, 2101 - &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control2); 2119 + &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control2); 2102 2120 udelay(AFE_REGISTER_WRITE_DELAY); 2103 2121 2104 2122 writel(oem_phy->afe_tx_amp_control3, 2105 - &scic->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control3); 2123 + &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control3); 2106 2124 udelay(AFE_REGISTER_WRITE_DELAY); 2107 2125 } 2108 2126 2109 2127 /* Transfer control to the PEs */ 2110 - writel(0x00010f00, &scic->scu_registers->afe.afe_dfx_master_control0); 2128 + writel(0x00010f00, &ihost->scu_registers->afe.afe_dfx_master_control0); 2111 2129 udelay(AFE_REGISTER_WRITE_DELAY); 2112 2130 } 2113 2131 2114 - static void scic_sds_controller_initialize_power_control(struct scic_sds_controller *scic) 2132 + static void scic_sds_controller_initialize_power_control(struct isci_host *ihost) 2115 2133 { 2116 - sci_init_timer(&scic->power_control.timer, power_control_timeout); 2134 + sci_init_timer(&ihost->power_control.timer, power_control_timeout); 2117 2135 2118 - memset(scic->power_control.requesters, 0, 2119 - sizeof(scic->power_control.requesters)); 2136 + memset(ihost->power_control.requesters, 0, 2137 + sizeof(ihost->power_control.requesters)); 2120 2138 2121 - scic->power_control.phys_waiting = 0; 2122 - scic->power_control.phys_granted_power = 0; 2139 + ihost->power_control.phys_waiting = 0; 2140 + ihost->power_control.phys_granted_power = 0; 2123 2141 } 2124 2142 2125 - static enum sci_status scic_controller_initialize(struct scic_sds_controller *scic) 2143 + static enum sci_status scic_controller_initialize(struct isci_host *ihost) 2126 2144 { 2127 - struct sci_base_state_machine *sm = &scic->sm; 2128 - struct isci_host *ihost = scic_to_ihost(scic); 2145 + struct sci_base_state_machine *sm = &ihost->sm; 2129 2146 enum sci_status result = SCI_FAILURE; 2130 2147 unsigned long i, state, val; 2131 2148 2132 - if (scic->sm.current_state_id != SCIC_RESET) { 2133 - dev_warn(scic_to_dev(scic), 2149 + if (ihost->sm.current_state_id != SCIC_RESET) { 2150 + dev_warn(&ihost->pdev->dev, 2134 2151 "SCIC Controller initialize operation requested " 2135 2152 "in invalid state\n"); 2136 2153 return SCI_FAILURE_INVALID_STATE; ··· 2137 2156 2138 2157 sci_change_state(sm, SCIC_INITIALIZING); 2139 2158 2140 - sci_init_timer(&scic->phy_timer, phy_startup_timeout); 2159 + sci_init_timer(&ihost->phy_timer, phy_startup_timeout); 2141 2160 2142 - scic->next_phy_to_start = 0; 2143 - scic->phy_startup_timer_pending = false; 2161 + ihost->next_phy_to_start = 0; 2162 + ihost->phy_startup_timer_pending = false; 2144 2163 2145 - scic_sds_controller_initialize_power_control(scic); 2164 + scic_sds_controller_initialize_power_control(ihost); 2146 2165 2147 2166 /* 2148 2167 * There is nothing to do here for B0 since we do not have to 2149 2168 * program the AFE registers. 2150 2169 * / @todo The AFE settings are supposed to be correct for the B0 but 2151 2170 * / presently they seem to be wrong. */ 2152 - scic_sds_controller_afe_initialization(scic); 2171 + scic_sds_controller_afe_initialization(ihost); 2153 2172 2154 2173 2155 2174 /* Take the hardware out of reset */ 2156 - writel(0, &scic->smu_registers->soft_reset_control); 2175 + writel(0, &ihost->smu_registers->soft_reset_control); 2157 2176 2158 2177 /* 2159 2178 * / @todo Provide meaningfull error code for hardware failure ··· 2163 2182 2164 2183 /* Loop until the hardware reports success */ 2165 2184 udelay(SCU_CONTEXT_RAM_INIT_STALL_TIME); 2166 - status = readl(&scic->smu_registers->control_status); 2185 + status = readl(&ihost->smu_registers->control_status); 2167 2186 2168 2187 if ((status & SCU_RAM_INIT_COMPLETED) == SCU_RAM_INIT_COMPLETED) 2169 2188 break; ··· 2174 2193 /* 2175 2194 * Determine what are the actaul device capacities that the 2176 2195 * hardware will support */ 2177 - val = readl(&scic->smu_registers->device_context_capacity); 2196 + val = readl(&ihost->smu_registers->device_context_capacity); 2178 2197 2179 2198 /* Record the smaller of the two capacity values */ 2180 - scic->logical_port_entries = min(smu_max_ports(val), SCI_MAX_PORTS); 2181 - scic->task_context_entries = min(smu_max_task_contexts(val), SCI_MAX_IO_REQUESTS); 2182 - scic->remote_node_entries = min(smu_max_rncs(val), SCI_MAX_REMOTE_DEVICES); 2199 + ihost->logical_port_entries = min(smu_max_ports(val), SCI_MAX_PORTS); 2200 + ihost->task_context_entries = min(smu_max_task_contexts(val), SCI_MAX_IO_REQUESTS); 2201 + ihost->remote_node_entries = min(smu_max_rncs(val), SCI_MAX_REMOTE_DEVICES); 2183 2202 2184 2203 /* 2185 2204 * Make all PEs that are unassigned match up with the 2186 2205 * logical ports 2187 2206 */ 2188 - for (i = 0; i < scic->logical_port_entries; i++) { 2207 + for (i = 0; i < ihost->logical_port_entries; i++) { 2189 2208 struct scu_port_task_scheduler_group_registers __iomem 2190 - *ptsg = &scic->scu_registers->peg0.ptsg; 2209 + *ptsg = &ihost->scu_registers->peg0.ptsg; 2191 2210 2192 2211 writel(i, &ptsg->protocol_engine[i]); 2193 2212 } 2194 2213 2195 2214 /* Initialize hardware PCI Relaxed ordering in DMA engines */ 2196 - val = readl(&scic->scu_registers->sdma.pdma_configuration); 2215 + val = readl(&ihost->scu_registers->sdma.pdma_configuration); 2197 2216 val |= SCU_PDMACR_GEN_BIT(PCI_RELAXED_ORDERING_ENABLE); 2198 - writel(val, &scic->scu_registers->sdma.pdma_configuration); 2217 + writel(val, &ihost->scu_registers->sdma.pdma_configuration); 2199 2218 2200 - val = readl(&scic->scu_registers->sdma.cdma_configuration); 2219 + val = readl(&ihost->scu_registers->sdma.cdma_configuration); 2201 2220 val |= SCU_CDMACR_GEN_BIT(PCI_RELAXED_ORDERING_ENABLE); 2202 - writel(val, &scic->scu_registers->sdma.cdma_configuration); 2221 + writel(val, &ihost->scu_registers->sdma.cdma_configuration); 2203 2222 2204 2223 /* 2205 2224 * Initialize the PHYs before the PORTs because the PHY registers ··· 2207 2226 */ 2208 2227 for (i = 0; i < SCI_MAX_PHYS; i++) { 2209 2228 result = scic_sds_phy_initialize(&ihost->phys[i], 2210 - &scic->scu_registers->peg0.pe[i].tl, 2211 - &scic->scu_registers->peg0.pe[i].ll); 2229 + &ihost->scu_registers->peg0.pe[i].tl, 2230 + &ihost->scu_registers->peg0.pe[i].ll); 2212 2231 if (result != SCI_SUCCESS) 2213 2232 goto out; 2214 2233 } 2215 2234 2216 - for (i = 0; i < scic->logical_port_entries; i++) { 2235 + for (i = 0; i < ihost->logical_port_entries; i++) { 2217 2236 result = scic_sds_port_initialize(&ihost->ports[i], 2218 - &scic->scu_registers->peg0.ptsg.port[i], 2219 - &scic->scu_registers->peg0.ptsg.protocol_engine, 2220 - &scic->scu_registers->peg0.viit[i]); 2237 + &ihost->scu_registers->peg0.ptsg.port[i], 2238 + &ihost->scu_registers->peg0.ptsg.protocol_engine, 2239 + &ihost->scu_registers->peg0.viit[i]); 2221 2240 2222 2241 if (result != SCI_SUCCESS) 2223 2242 goto out; 2224 2243 } 2225 2244 2226 - result = scic_sds_port_configuration_agent_initialize(scic, &scic->port_agent); 2245 + result = scic_sds_port_configuration_agent_initialize(ihost, &ihost->port_agent); 2227 2246 2228 2247 out: 2229 2248 /* Advance the controller state machine */ ··· 2237 2256 } 2238 2257 2239 2258 static enum sci_status scic_user_parameters_set( 2240 - struct scic_sds_controller *scic, 2259 + struct isci_host *ihost, 2241 2260 union scic_user_parameters *scic_parms) 2242 2261 { 2243 - u32 state = scic->sm.current_state_id; 2262 + u32 state = ihost->sm.current_state_id; 2244 2263 2245 2264 if (state == SCIC_RESET || 2246 2265 state == SCIC_INITIALIZING || ··· 2282 2301 (scic_parms->sds1.no_outbound_task_timeout == 0)) 2283 2302 return SCI_FAILURE_INVALID_PARAMETER_VALUE; 2284 2303 2285 - memcpy(&scic->user_parameters, scic_parms, sizeof(*scic_parms)); 2304 + memcpy(&ihost->user_parameters, scic_parms, sizeof(*scic_parms)); 2286 2305 2287 2306 return SCI_SUCCESS; 2288 2307 } ··· 2290 2309 return SCI_FAILURE_INVALID_STATE; 2291 2310 } 2292 2311 2293 - static int scic_controller_mem_init(struct scic_sds_controller *scic) 2312 + static int scic_controller_mem_init(struct isci_host *ihost) 2294 2313 { 2295 - struct device *dev = scic_to_dev(scic); 2314 + struct device *dev = &ihost->pdev->dev; 2296 2315 dma_addr_t dma; 2297 2316 size_t size; 2298 2317 int err; 2299 2318 2300 2319 size = SCU_MAX_COMPLETION_QUEUE_ENTRIES * sizeof(u32); 2301 - scic->completion_queue = dmam_alloc_coherent(dev, size, &dma, GFP_KERNEL); 2302 - if (!scic->completion_queue) 2320 + ihost->completion_queue = dmam_alloc_coherent(dev, size, &dma, GFP_KERNEL); 2321 + if (!ihost->completion_queue) 2303 2322 return -ENOMEM; 2304 2323 2305 - writel(lower_32_bits(dma), &scic->smu_registers->completion_queue_lower); 2306 - writel(upper_32_bits(dma), &scic->smu_registers->completion_queue_upper); 2324 + writel(lower_32_bits(dma), &ihost->smu_registers->completion_queue_lower); 2325 + writel(upper_32_bits(dma), &ihost->smu_registers->completion_queue_upper); 2307 2326 2308 - size = scic->remote_node_entries * sizeof(union scu_remote_node_context); 2309 - scic->remote_node_context_table = dmam_alloc_coherent(dev, size, &dma, 2327 + size = ihost->remote_node_entries * sizeof(union scu_remote_node_context); 2328 + ihost->remote_node_context_table = dmam_alloc_coherent(dev, size, &dma, 2310 2329 GFP_KERNEL); 2311 - if (!scic->remote_node_context_table) 2330 + if (!ihost->remote_node_context_table) 2312 2331 return -ENOMEM; 2313 2332 2314 - writel(lower_32_bits(dma), &scic->smu_registers->remote_node_context_lower); 2315 - writel(upper_32_bits(dma), &scic->smu_registers->remote_node_context_upper); 2333 + writel(lower_32_bits(dma), &ihost->smu_registers->remote_node_context_lower); 2334 + writel(upper_32_bits(dma), &ihost->smu_registers->remote_node_context_upper); 2316 2335 2317 - size = scic->task_context_entries * sizeof(struct scu_task_context), 2318 - scic->task_context_table = dmam_alloc_coherent(dev, size, &dma, GFP_KERNEL); 2319 - if (!scic->task_context_table) 2336 + size = ihost->task_context_entries * sizeof(struct scu_task_context), 2337 + ihost->task_context_table = dmam_alloc_coherent(dev, size, &dma, GFP_KERNEL); 2338 + if (!ihost->task_context_table) 2320 2339 return -ENOMEM; 2321 2340 2322 - scic->task_context_dma = dma; 2323 - writel(lower_32_bits(dma), &scic->smu_registers->host_task_table_lower); 2324 - writel(upper_32_bits(dma), &scic->smu_registers->host_task_table_upper); 2341 + ihost->task_context_dma = dma; 2342 + writel(lower_32_bits(dma), &ihost->smu_registers->host_task_table_lower); 2343 + writel(upper_32_bits(dma), &ihost->smu_registers->host_task_table_upper); 2325 2344 2326 - err = scic_sds_unsolicited_frame_control_construct(scic); 2345 + err = scic_sds_unsolicited_frame_control_construct(ihost); 2327 2346 if (err) 2328 2347 return err; 2329 2348 ··· 2331 2350 * Inform the silicon as to the location of the UF headers and 2332 2351 * address table. 2333 2352 */ 2334 - writel(lower_32_bits(scic->uf_control.headers.physical_address), 2335 - &scic->scu_registers->sdma.uf_header_base_address_lower); 2336 - writel(upper_32_bits(scic->uf_control.headers.physical_address), 2337 - &scic->scu_registers->sdma.uf_header_base_address_upper); 2353 + writel(lower_32_bits(ihost->uf_control.headers.physical_address), 2354 + &ihost->scu_registers->sdma.uf_header_base_address_lower); 2355 + writel(upper_32_bits(ihost->uf_control.headers.physical_address), 2356 + &ihost->scu_registers->sdma.uf_header_base_address_upper); 2338 2357 2339 - writel(lower_32_bits(scic->uf_control.address_table.physical_address), 2340 - &scic->scu_registers->sdma.uf_address_table_lower); 2341 - writel(upper_32_bits(scic->uf_control.address_table.physical_address), 2342 - &scic->scu_registers->sdma.uf_address_table_upper); 2358 + writel(lower_32_bits(ihost->uf_control.address_table.physical_address), 2359 + &ihost->scu_registers->sdma.uf_address_table_lower); 2360 + writel(upper_32_bits(ihost->uf_control.address_table.physical_address), 2361 + &ihost->scu_registers->sdma.uf_address_table_upper); 2343 2362 2344 2363 return 0; 2345 2364 } 2346 2365 2347 - int isci_host_init(struct isci_host *isci_host) 2366 + int isci_host_init(struct isci_host *ihost) 2348 2367 { 2349 2368 int err = 0, i; 2350 2369 enum sci_status status; 2351 2370 union scic_oem_parameters oem; 2352 2371 union scic_user_parameters scic_user_params; 2353 - struct isci_pci_info *pci_info = to_pci_info(isci_host->pdev); 2372 + struct isci_pci_info *pci_info = to_pci_info(ihost->pdev); 2354 2373 2355 - spin_lock_init(&isci_host->state_lock); 2356 - spin_lock_init(&isci_host->scic_lock); 2357 - init_waitqueue_head(&isci_host->eventq); 2374 + spin_lock_init(&ihost->state_lock); 2375 + spin_lock_init(&ihost->scic_lock); 2376 + init_waitqueue_head(&ihost->eventq); 2358 2377 2359 - isci_host_change_state(isci_host, isci_starting); 2378 + isci_host_change_state(ihost, isci_starting); 2360 2379 2361 - status = scic_controller_construct(&isci_host->sci, scu_base(isci_host), 2362 - smu_base(isci_host)); 2380 + status = scic_controller_construct(ihost, scu_base(ihost), 2381 + smu_base(ihost)); 2363 2382 2364 2383 if (status != SCI_SUCCESS) { 2365 - dev_err(&isci_host->pdev->dev, 2384 + dev_err(&ihost->pdev->dev, 2366 2385 "%s: scic_controller_construct failed - status = %x\n", 2367 2386 __func__, 2368 2387 status); 2369 2388 return -ENODEV; 2370 2389 } 2371 2390 2372 - isci_host->sas_ha.dev = &isci_host->pdev->dev; 2373 - isci_host->sas_ha.lldd_ha = isci_host; 2391 + ihost->sas_ha.dev = &ihost->pdev->dev; 2392 + ihost->sas_ha.lldd_ha = ihost; 2374 2393 2375 2394 /* 2376 2395 * grab initial values stored in the controller object for OEM and USER 2377 2396 * parameters 2378 2397 */ 2379 - isci_user_parameters_get(isci_host, &scic_user_params); 2380 - status = scic_user_parameters_set(&isci_host->sci, 2398 + isci_user_parameters_get(ihost, &scic_user_params); 2399 + status = scic_user_parameters_set(ihost, 2381 2400 &scic_user_params); 2382 2401 if (status != SCI_SUCCESS) { 2383 - dev_warn(&isci_host->pdev->dev, 2402 + dev_warn(&ihost->pdev->dev, 2384 2403 "%s: scic_user_parameters_set failed\n", 2385 2404 __func__); 2386 2405 return -ENODEV; 2387 2406 } 2388 2407 2389 - scic_oem_parameters_get(&isci_host->sci, &oem); 2408 + scic_oem_parameters_get(ihost, &oem); 2390 2409 2391 2410 /* grab any OEM parameters specified in orom */ 2392 2411 if (pci_info->orom) { 2393 2412 status = isci_parse_oem_parameters(&oem, 2394 2413 pci_info->orom, 2395 - isci_host->id); 2414 + ihost->id); 2396 2415 if (status != SCI_SUCCESS) { 2397 - dev_warn(&isci_host->pdev->dev, 2416 + dev_warn(&ihost->pdev->dev, 2398 2417 "parsing firmware oem parameters failed\n"); 2399 2418 return -EINVAL; 2400 2419 } 2401 2420 } 2402 2421 2403 - status = scic_oem_parameters_set(&isci_host->sci, &oem); 2422 + status = scic_oem_parameters_set(ihost, &oem); 2404 2423 if (status != SCI_SUCCESS) { 2405 - dev_warn(&isci_host->pdev->dev, 2424 + dev_warn(&ihost->pdev->dev, 2406 2425 "%s: scic_oem_parameters_set failed\n", 2407 2426 __func__); 2408 2427 return -ENODEV; 2409 2428 } 2410 2429 2411 - tasklet_init(&isci_host->completion_tasklet, 2412 - isci_host_completion_routine, (unsigned long)isci_host); 2430 + tasklet_init(&ihost->completion_tasklet, 2431 + isci_host_completion_routine, (unsigned long)ihost); 2413 2432 2414 - INIT_LIST_HEAD(&isci_host->requests_to_complete); 2415 - INIT_LIST_HEAD(&isci_host->requests_to_errorback); 2433 + INIT_LIST_HEAD(&ihost->requests_to_complete); 2434 + INIT_LIST_HEAD(&ihost->requests_to_errorback); 2416 2435 2417 - spin_lock_irq(&isci_host->scic_lock); 2418 - status = scic_controller_initialize(&isci_host->sci); 2419 - spin_unlock_irq(&isci_host->scic_lock); 2436 + spin_lock_irq(&ihost->scic_lock); 2437 + status = scic_controller_initialize(ihost); 2438 + spin_unlock_irq(&ihost->scic_lock); 2420 2439 if (status != SCI_SUCCESS) { 2421 - dev_warn(&isci_host->pdev->dev, 2440 + dev_warn(&ihost->pdev->dev, 2422 2441 "%s: scic_controller_initialize failed -" 2423 2442 " status = 0x%x\n", 2424 2443 __func__, status); 2425 2444 return -ENODEV; 2426 2445 } 2427 2446 2428 - err = scic_controller_mem_init(&isci_host->sci); 2447 + err = scic_controller_mem_init(ihost); 2429 2448 if (err) 2430 2449 return err; 2431 2450 2432 2451 for (i = 0; i < SCI_MAX_PORTS; i++) 2433 - isci_port_init(&isci_host->ports[i], isci_host, i); 2452 + isci_port_init(&ihost->ports[i], ihost, i); 2434 2453 2435 2454 for (i = 0; i < SCI_MAX_PHYS; i++) 2436 - isci_phy_init(&isci_host->phys[i], isci_host, i); 2455 + isci_phy_init(&ihost->phys[i], ihost, i); 2437 2456 2438 2457 for (i = 0; i < SCI_MAX_REMOTE_DEVICES; i++) { 2439 - struct isci_remote_device *idev = &isci_host->devices[i]; 2458 + struct isci_remote_device *idev = &ihost->devices[i]; 2440 2459 2441 2460 INIT_LIST_HEAD(&idev->reqs_in_process); 2442 2461 INIT_LIST_HEAD(&idev->node); ··· 2446 2465 struct isci_request *ireq; 2447 2466 dma_addr_t dma; 2448 2467 2449 - ireq = dmam_alloc_coherent(&isci_host->pdev->dev, 2468 + ireq = dmam_alloc_coherent(&ihost->pdev->dev, 2450 2469 sizeof(struct isci_request), &dma, 2451 2470 GFP_KERNEL); 2452 2471 if (!ireq) 2453 2472 return -ENOMEM; 2454 2473 2455 - ireq->tc = &isci_host->sci.task_context_table[i]; 2456 - ireq->owning_controller = &isci_host->sci; 2474 + ireq->tc = &ihost->task_context_table[i]; 2475 + ireq->owning_controller = ihost; 2457 2476 spin_lock_init(&ireq->state_lock); 2458 2477 ireq->request_daddr = dma; 2459 - ireq->isci_host = isci_host; 2460 - 2461 - isci_host->reqs[i] = ireq; 2478 + ireq->isci_host = ihost; 2479 + ihost->reqs[i] = ireq; 2462 2480 } 2463 2481 2464 2482 return 0; 2465 2483 } 2466 2484 2467 - void scic_sds_controller_link_up(struct scic_sds_controller *scic, 2485 + void scic_sds_controller_link_up(struct isci_host *ihost, 2468 2486 struct isci_port *iport, struct isci_phy *iphy) 2469 2487 { 2470 - switch (scic->sm.current_state_id) { 2488 + switch (ihost->sm.current_state_id) { 2471 2489 case SCIC_STARTING: 2472 - sci_del_timer(&scic->phy_timer); 2473 - scic->phy_startup_timer_pending = false; 2474 - scic->port_agent.link_up_handler(scic, &scic->port_agent, 2490 + sci_del_timer(&ihost->phy_timer); 2491 + ihost->phy_startup_timer_pending = false; 2492 + ihost->port_agent.link_up_handler(ihost, &ihost->port_agent, 2475 2493 iport, iphy); 2476 - scic_sds_controller_start_next_phy(scic); 2494 + scic_sds_controller_start_next_phy(ihost); 2477 2495 break; 2478 2496 case SCIC_READY: 2479 - scic->port_agent.link_up_handler(scic, &scic->port_agent, 2497 + ihost->port_agent.link_up_handler(ihost, &ihost->port_agent, 2480 2498 iport, iphy); 2481 2499 break; 2482 2500 default: 2483 - dev_dbg(scic_to_dev(scic), 2501 + dev_dbg(&ihost->pdev->dev, 2484 2502 "%s: SCIC Controller linkup event from phy %d in " 2485 2503 "unexpected state %d\n", __func__, iphy->phy_index, 2486 - scic->sm.current_state_id); 2504 + ihost->sm.current_state_id); 2487 2505 } 2488 2506 } 2489 2507 2490 - void scic_sds_controller_link_down(struct scic_sds_controller *scic, 2508 + void scic_sds_controller_link_down(struct isci_host *ihost, 2491 2509 struct isci_port *iport, struct isci_phy *iphy) 2492 2510 { 2493 - switch (scic->sm.current_state_id) { 2511 + switch (ihost->sm.current_state_id) { 2494 2512 case SCIC_STARTING: 2495 2513 case SCIC_READY: 2496 - scic->port_agent.link_down_handler(scic, &scic->port_agent, 2514 + ihost->port_agent.link_down_handler(ihost, &ihost->port_agent, 2497 2515 iport, iphy); 2498 2516 break; 2499 2517 default: 2500 - dev_dbg(scic_to_dev(scic), 2518 + dev_dbg(&ihost->pdev->dev, 2501 2519 "%s: SCIC Controller linkdown event from phy %d in " 2502 2520 "unexpected state %d\n", 2503 2521 __func__, 2504 2522 iphy->phy_index, 2505 - scic->sm.current_state_id); 2523 + ihost->sm.current_state_id); 2506 2524 } 2507 2525 } 2508 2526 ··· 2510 2530 * controller are still in the stopping state. 2511 2531 * 2512 2532 */ 2513 - static bool scic_sds_controller_has_remote_devices_stopping( 2514 - struct scic_sds_controller *controller) 2533 + static bool scic_sds_controller_has_remote_devices_stopping(struct isci_host *ihost) 2515 2534 { 2516 2535 u32 index; 2517 2536 2518 - for (index = 0; index < controller->remote_node_entries; index++) { 2519 - if ((controller->device_table[index] != NULL) && 2520 - (controller->device_table[index]->sm.current_state_id == SCI_DEV_STOPPING)) 2537 + for (index = 0; index < ihost->remote_node_entries; index++) { 2538 + if ((ihost->device_table[index] != NULL) && 2539 + (ihost->device_table[index]->sm.current_state_id == SCI_DEV_STOPPING)) 2521 2540 return true; 2522 2541 } 2523 2542 ··· 2527 2548 * This method is called by the remote device to inform the controller 2528 2549 * object that the remote device has stopped. 2529 2550 */ 2530 - void scic_sds_controller_remote_device_stopped(struct scic_sds_controller *scic, 2551 + void scic_sds_controller_remote_device_stopped(struct isci_host *ihost, 2531 2552 struct isci_remote_device *idev) 2532 2553 { 2533 - if (scic->sm.current_state_id != SCIC_STOPPING) { 2534 - dev_dbg(scic_to_dev(scic), 2554 + if (ihost->sm.current_state_id != SCIC_STOPPING) { 2555 + dev_dbg(&ihost->pdev->dev, 2535 2556 "SCIC Controller 0x%p remote device stopped event " 2536 2557 "from device 0x%p in unexpected state %d\n", 2537 - scic, idev, 2538 - scic->sm.current_state_id); 2558 + ihost, idev, 2559 + ihost->sm.current_state_id); 2539 2560 return; 2540 2561 } 2541 2562 2542 - if (!scic_sds_controller_has_remote_devices_stopping(scic)) { 2543 - sci_change_state(&scic->sm, SCIC_STOPPED); 2563 + if (!scic_sds_controller_has_remote_devices_stopping(ihost)) { 2564 + sci_change_state(&ihost->sm, SCIC_STOPPED); 2544 2565 } 2545 2566 } 2546 2567 ··· 2552 2573 * 2553 2574 */ 2554 2575 void scic_sds_controller_post_request( 2555 - struct scic_sds_controller *scic, 2576 + struct isci_host *ihost, 2556 2577 u32 request) 2557 2578 { 2558 - dev_dbg(scic_to_dev(scic), 2579 + dev_dbg(&ihost->pdev->dev, 2559 2580 "%s: SCIC Controller 0x%p post request 0x%08x\n", 2560 2581 __func__, 2561 - scic, 2582 + ihost, 2562 2583 request); 2563 2584 2564 - writel(request, &scic->smu_registers->post_context_port); 2585 + writel(request, &ihost->smu_registers->post_context_port); 2565 2586 } 2566 2587 2567 - struct isci_request *scic_request_by_tag(struct scic_sds_controller *scic, u16 io_tag) 2588 + struct isci_request *scic_request_by_tag(struct isci_host *ihost, u16 io_tag) 2568 2589 { 2569 2590 u16 task_index; 2570 2591 u16 task_sequence; 2571 2592 2572 2593 task_index = ISCI_TAG_TCI(io_tag); 2573 2594 2574 - if (task_index < scic->task_context_entries) { 2575 - struct isci_request *ireq = scic_to_ihost(scic)->reqs[task_index]; 2595 + if (task_index < ihost->task_context_entries) { 2596 + struct isci_request *ireq = ihost->reqs[task_index]; 2576 2597 2577 2598 if (test_bit(IREQ_ACTIVE, &ireq->flags)) { 2578 2599 task_sequence = ISCI_TAG_SEQ(io_tag); 2579 2600 2580 - if (task_sequence == scic->io_request_sequence[task_index]) 2601 + if (task_sequence == ihost->io_request_sequence[task_index]) 2581 2602 return ireq; 2582 2603 } 2583 2604 } ··· 2600 2621 * node index available. 2601 2622 */ 2602 2623 enum sci_status scic_sds_controller_allocate_remote_node_context( 2603 - struct scic_sds_controller *scic, 2624 + struct isci_host *ihost, 2604 2625 struct isci_remote_device *idev, 2605 2626 u16 *node_id) 2606 2627 { ··· 2608 2629 u32 remote_node_count = scic_sds_remote_device_node_count(idev); 2609 2630 2610 2631 node_index = scic_sds_remote_node_table_allocate_remote_node( 2611 - &scic->available_remote_nodes, remote_node_count 2632 + &ihost->available_remote_nodes, remote_node_count 2612 2633 ); 2613 2634 2614 2635 if (node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) { 2615 - scic->device_table[node_index] = idev; 2636 + ihost->device_table[node_index] = idev; 2616 2637 2617 2638 *node_id = node_index; 2618 2639 ··· 2632 2653 * 2633 2654 */ 2634 2655 void scic_sds_controller_free_remote_node_context( 2635 - struct scic_sds_controller *scic, 2656 + struct isci_host *ihost, 2636 2657 struct isci_remote_device *idev, 2637 2658 u16 node_id) 2638 2659 { 2639 2660 u32 remote_node_count = scic_sds_remote_device_node_count(idev); 2640 2661 2641 - if (scic->device_table[node_id] == idev) { 2642 - scic->device_table[node_id] = NULL; 2662 + if (ihost->device_table[node_id] == idev) { 2663 + ihost->device_table[node_id] = NULL; 2643 2664 2644 2665 scic_sds_remote_node_table_release_remote_node_index( 2645 - &scic->available_remote_nodes, remote_node_count, node_id 2666 + &ihost->available_remote_nodes, remote_node_count, node_id 2646 2667 ); 2647 2668 } 2648 2669 } ··· 2656 2677 * union scu_remote_node_context* 2657 2678 */ 2658 2679 union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer( 2659 - struct scic_sds_controller *scic, 2680 + struct isci_host *ihost, 2660 2681 u16 node_id 2661 2682 ) { 2662 2683 if ( 2663 - (node_id < scic->remote_node_entries) 2664 - && (scic->device_table[node_id] != NULL) 2684 + (node_id < ihost->remote_node_entries) 2685 + && (ihost->device_table[node_id] != NULL) 2665 2686 ) { 2666 - return &scic->remote_node_context_table[node_id]; 2687 + return &ihost->remote_node_context_table[node_id]; 2667 2688 } 2668 2689 2669 2690 return NULL; ··· 2701 2722 * 2702 2723 */ 2703 2724 void scic_sds_controller_release_frame( 2704 - struct scic_sds_controller *scic, 2725 + struct isci_host *ihost, 2705 2726 u32 frame_index) 2706 2727 { 2707 2728 if (scic_sds_unsolicited_frame_control_release_frame( 2708 - &scic->uf_control, frame_index) == true) 2709 - writel(scic->uf_control.get, 2710 - &scic->scu_registers->sdma.unsolicited_frame_get_pointer); 2729 + &ihost->uf_control, frame_index) == true) 2730 + writel(ihost->uf_control.get, 2731 + &ihost->scu_registers->sdma.unsolicited_frame_get_pointer); 2711 2732 } 2712 2733 2713 2734 void isci_tci_free(struct isci_host *ihost, u16 tci) ··· 2736 2757 { 2737 2758 if (isci_tci_space(ihost)) { 2738 2759 u16 tci = isci_tci_alloc(ihost); 2739 - u8 seq = ihost->sci.io_request_sequence[tci]; 2760 + u8 seq = ihost->io_request_sequence[tci]; 2740 2761 2741 2762 return ISCI_TAG(seq, tci); 2742 2763 } ··· 2746 2767 2747 2768 enum sci_status isci_free_tag(struct isci_host *ihost, u16 io_tag) 2748 2769 { 2749 - struct scic_sds_controller *scic = &ihost->sci; 2750 2770 u16 tci = ISCI_TAG_TCI(io_tag); 2751 2771 u16 seq = ISCI_TAG_SEQ(io_tag); 2752 2772 ··· 2753 2775 if (isci_tci_active(ihost) == 0) 2754 2776 return SCI_FAILURE_INVALID_IO_TAG; 2755 2777 2756 - if (seq == scic->io_request_sequence[tci]) { 2757 - scic->io_request_sequence[tci] = (seq+1) & (SCI_MAX_SEQ-1); 2778 + if (seq == ihost->io_request_sequence[tci]) { 2779 + ihost->io_request_sequence[tci] = (seq+1) & (SCI_MAX_SEQ-1); 2758 2780 2759 2781 isci_tci_free(ihost, tci); 2760 2782 ··· 2775 2797 * @io_tag: This parameter specifies a previously allocated IO tag that the 2776 2798 * user desires to be utilized for this request. 2777 2799 */ 2778 - enum sci_status scic_controller_start_io(struct scic_sds_controller *scic, 2800 + enum sci_status scic_controller_start_io(struct isci_host *ihost, 2779 2801 struct isci_remote_device *idev, 2780 2802 struct isci_request *ireq) 2781 2803 { 2782 2804 enum sci_status status; 2783 2805 2784 - if (scic->sm.current_state_id != SCIC_READY) { 2785 - dev_warn(scic_to_dev(scic), "invalid state to start I/O"); 2806 + if (ihost->sm.current_state_id != SCIC_READY) { 2807 + dev_warn(&ihost->pdev->dev, "invalid state to start I/O"); 2786 2808 return SCI_FAILURE_INVALID_STATE; 2787 2809 } 2788 2810 2789 - status = scic_sds_remote_device_start_io(scic, idev, ireq); 2811 + status = scic_sds_remote_device_start_io(ihost, idev, ireq); 2790 2812 if (status != SCI_SUCCESS) 2791 2813 return status; 2792 2814 2793 2815 set_bit(IREQ_ACTIVE, &ireq->flags); 2794 - scic_sds_controller_post_request(scic, scic_sds_request_get_post_context(ireq)); 2816 + scic_sds_controller_post_request(ihost, scic_sds_request_get_post_context(ireq)); 2795 2817 return SCI_SUCCESS; 2796 2818 } 2797 2819 ··· 2812 2834 * for the request. Determine the failure situations and return values. 2813 2835 */ 2814 2836 enum sci_status scic_controller_terminate_request( 2815 - struct scic_sds_controller *scic, 2837 + struct isci_host *ihost, 2816 2838 struct isci_remote_device *idev, 2817 2839 struct isci_request *ireq) 2818 2840 { 2819 2841 enum sci_status status; 2820 2842 2821 - if (scic->sm.current_state_id != SCIC_READY) { 2822 - dev_warn(scic_to_dev(scic), 2843 + if (ihost->sm.current_state_id != SCIC_READY) { 2844 + dev_warn(&ihost->pdev->dev, 2823 2845 "invalid state to terminate request\n"); 2824 2846 return SCI_FAILURE_INVALID_STATE; 2825 2847 } ··· 2832 2854 * Utilize the original post context command and or in the POST_TC_ABORT 2833 2855 * request sub-type. 2834 2856 */ 2835 - scic_sds_controller_post_request(scic, 2857 + scic_sds_controller_post_request(ihost, 2836 2858 scic_sds_request_get_post_context(ireq) | 2837 2859 SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT); 2838 2860 return SCI_SUCCESS; ··· 2850 2872 * @io_request: the handle to the io request object to complete. 2851 2873 */ 2852 2874 enum sci_status scic_controller_complete_io( 2853 - struct scic_sds_controller *scic, 2875 + struct isci_host *ihost, 2854 2876 struct isci_remote_device *idev, 2855 2877 struct isci_request *ireq) 2856 2878 { 2857 2879 enum sci_status status; 2858 2880 u16 index; 2859 2881 2860 - switch (scic->sm.current_state_id) { 2882 + switch (ihost->sm.current_state_id) { 2861 2883 case SCIC_STOPPING: 2862 2884 /* XXX: Implement this function */ 2863 2885 return SCI_FAILURE; 2864 2886 case SCIC_READY: 2865 - status = scic_sds_remote_device_complete_io(scic, idev, ireq); 2887 + status = scic_sds_remote_device_complete_io(ihost, idev, ireq); 2866 2888 if (status != SCI_SUCCESS) 2867 2889 return status; 2868 2890 ··· 2870 2892 clear_bit(IREQ_ACTIVE, &ireq->flags); 2871 2893 return SCI_SUCCESS; 2872 2894 default: 2873 - dev_warn(scic_to_dev(scic), "invalid state to complete I/O"); 2895 + dev_warn(&ihost->pdev->dev, "invalid state to complete I/O"); 2874 2896 return SCI_FAILURE_INVALID_STATE; 2875 2897 } 2876 2898 ··· 2878 2900 2879 2901 enum sci_status scic_controller_continue_io(struct isci_request *ireq) 2880 2902 { 2881 - struct scic_sds_controller *scic = ireq->owning_controller; 2903 + struct isci_host *ihost = ireq->owning_controller; 2882 2904 2883 - if (scic->sm.current_state_id != SCIC_READY) { 2884 - dev_warn(scic_to_dev(scic), "invalid state to continue I/O"); 2905 + if (ihost->sm.current_state_id != SCIC_READY) { 2906 + dev_warn(&ihost->pdev->dev, "invalid state to continue I/O"); 2885 2907 return SCI_FAILURE_INVALID_STATE; 2886 2908 } 2887 2909 2888 2910 set_bit(IREQ_ACTIVE, &ireq->flags); 2889 - scic_sds_controller_post_request(scic, scic_sds_request_get_post_context(ireq)); 2911 + scic_sds_controller_post_request(ihost, scic_sds_request_get_post_context(ireq)); 2890 2912 return SCI_SUCCESS; 2891 2913 } 2892 2914 ··· 2900 2922 * @task_request: the handle to the task request object to start. 2901 2923 */ 2902 2924 enum sci_task_status scic_controller_start_task( 2903 - struct scic_sds_controller *scic, 2925 + struct isci_host *ihost, 2904 2926 struct isci_remote_device *idev, 2905 2927 struct isci_request *ireq) 2906 2928 { 2907 2929 enum sci_status status; 2908 2930 2909 - if (scic->sm.current_state_id != SCIC_READY) { 2910 - dev_warn(scic_to_dev(scic), 2931 + if (ihost->sm.current_state_id != SCIC_READY) { 2932 + dev_warn(&ihost->pdev->dev, 2911 2933 "%s: SCIC Controller starting task from invalid " 2912 2934 "state\n", 2913 2935 __func__); 2914 2936 return SCI_TASK_FAILURE_INVALID_STATE; 2915 2937 } 2916 2938 2917 - status = scic_sds_remote_device_start_task(scic, idev, ireq); 2939 + status = scic_sds_remote_device_start_task(ihost, idev, ireq); 2918 2940 switch (status) { 2919 2941 case SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS: 2920 2942 set_bit(IREQ_ACTIVE, &ireq->flags); ··· 2928 2950 case SCI_SUCCESS: 2929 2951 set_bit(IREQ_ACTIVE, &ireq->flags); 2930 2952 2931 - scic_sds_controller_post_request(scic, 2953 + scic_sds_controller_post_request(ihost, 2932 2954 scic_sds_request_get_post_context(ireq)); 2933 2955 break; 2934 2956 default:
+46 -164
drivers/scsi/isci/host.h
··· 106 106 }; 107 107 108 108 struct scic_sds_port_configuration_agent; 109 - typedef void (*port_config_fn)(struct scic_sds_controller *, 109 + typedef void (*port_config_fn)(struct isci_host *, 110 110 struct scic_sds_port_configuration_agent *, 111 111 struct isci_port *, struct isci_phy *); 112 112 ··· 124 124 }; 125 125 126 126 /** 127 - * struct scic_sds_controller - 128 - * 129 - * This structure represents the SCU controller object. 127 + * isci_host - primary host/controller object 128 + * @timer: timeout start/stop operations 129 + * @device_table: rni (hw remote node index) to remote device lookup table 130 + * @available_remote_nodes: rni allocator 131 + * @power_control: manage device spin up 132 + * @io_request_sequence: generation number for tci's (task contexts) 133 + * @task_context_table: hw task context table 134 + * @remote_node_context_table: hw remote node context table 135 + * @completion_queue: hw-producer driver-consumer communication ring 136 + * @completion_queue_get: tracks the driver 'head' of the ring to notify hw 137 + * @logical_port_entries: min({driver|silicon}-supported-port-count) 138 + * @remote_node_entries: min({driver|silicon}-supported-node-count) 139 + * @task_context_entries: min({driver|silicon}-supported-task-count) 140 + * @phy_timer: phy startup timer 141 + * @invalid_phy_mask: if an invalid_link_up notification is reported a bit for 142 + * the phy index is set so further notifications are not 143 + * made. Once the phy reports link up and is made part of a 144 + * port then this bit is cleared. 145 + 130 146 */ 131 - struct scic_sds_controller { 132 - /** 133 - * This field contains the information for the base controller state 134 - * machine. 135 - */ 147 + struct isci_host { 136 148 struct sci_base_state_machine sm; 137 - 138 - /** 139 - * Timer for controller start/stop operations. 140 - */ 149 + /* XXX can we time this externally */ 141 150 struct sci_timer timer; 142 - 143 - /** 144 - * This field contains the user parameters to be utilized for this 145 - * core controller object. 146 - */ 151 + /* XXX drop reference module params directly */ 147 152 union scic_user_parameters user_parameters; 148 - 149 - /** 150 - * This field contains the OEM parameters to be utilized for this 151 - * core controller object. 152 - */ 153 + /* XXX no need to be a union */ 153 154 union scic_oem_parameters oem_parameters; 154 - 155 - /** 156 - * This field contains the port configuration agent for this controller. 157 - */ 158 155 struct scic_sds_port_configuration_agent port_agent; 159 - 160 - /** 161 - * This field is the array of device objects that are currently constructed 162 - * for this controller object. This table is used as a fast lookup of device 163 - * objects that need to handle device completion notifications from the 164 - * hardware. The table is RNi based. 165 - */ 166 156 struct isci_remote_device *device_table[SCI_MAX_REMOTE_DEVICES]; 167 - 168 - /** 169 - * This field is the free RNi data structure 170 - */ 171 157 struct scic_remote_node_table available_remote_nodes; 172 - 173 - /** 174 - * This filed is the struct scic_power_control data used to controll when direct 175 - * attached devices can consume power. 176 - */ 177 158 struct scic_power_control power_control; 178 - 179 - /* sequence number per tci */ 180 159 u8 io_request_sequence[SCI_MAX_IO_REQUESTS]; 181 - 182 - /** 183 - * This field is a pointer to the memory allocated by the driver for the task 184 - * context table. This data is shared between the hardware and software. 185 - */ 186 160 struct scu_task_context *task_context_table; 187 161 dma_addr_t task_context_dma; 188 - 189 - /** 190 - * This field is a pointer to the memory allocated by the driver for the 191 - * remote node context table. This table is shared between the hardware and 192 - * software. 193 - */ 194 162 union scu_remote_node_context *remote_node_context_table; 195 - 196 - /** 197 - * This field is a pointer to the completion queue. This memory is 198 - * written to by the hardware and read by the software. 199 - */ 200 163 u32 *completion_queue; 201 - 202 - /** 203 - * This field is the software copy of the completion queue get pointer. The 204 - * controller object writes this value to the hardware after processing the 205 - * completion entries. 206 - */ 207 164 u32 completion_queue_get; 208 - 209 - /** 210 - * This field is the minimum of the number of hardware supported port entries 211 - * and the software requested port entries. 212 - */ 213 165 u32 logical_port_entries; 214 - 215 - /** 216 - * This field is the minimum number of devices supported by the hardware and 217 - * the number of devices requested by the software. 218 - */ 219 166 u32 remote_node_entries; 220 - 221 - /** 222 - * This field is the minimum number of IO requests supported by the hardware 223 - * and the number of IO requests requested by the software. 224 - */ 225 167 u32 task_context_entries; 226 - 227 - /** 228 - * This object contains all of the unsolicited frame specific 229 - * data utilized by the core controller. 230 - */ 231 168 struct scic_sds_unsolicited_frame_control uf_control; 232 169 233 - /* Phy Startup Data */ 234 - /** 235 - * Timer for controller phy request startup. On controller start the 236 - * controller will start each PHY individually in order of phy index. 237 - */ 170 + /* phy startup */ 238 171 struct sci_timer phy_timer; 239 - 240 - /** 241 - * This field is set when the phy_timer is running and is cleared when 242 - * the phy_timer is stopped. 243 - */ 172 + /* XXX kill */ 244 173 bool phy_startup_timer_pending; 245 - 246 - /** 247 - * This field is the index of the next phy start. It is initialized to 0 and 248 - * increments for each phy index that is started. 249 - */ 250 174 u32 next_phy_to_start; 251 - 252 - /** 253 - * This field controlls the invalid link up notifications to the SCI_USER. If 254 - * an invalid_link_up notification is reported a bit for the PHY index is set 255 - * so further notifications are not made. Once the PHY object reports link up 256 - * and is made part of a port then this bit for the PHY index is cleared. 257 - */ 258 175 u8 invalid_phy_mask; 259 176 260 - /* 261 - * This field saves the current interrupt coalescing number of the controller. 262 - */ 177 + /* TODO attempt dynamic interrupt coalescing scheme */ 263 178 u16 interrupt_coalesce_number; 264 - 265 - /* 266 - * This field saves the current interrupt coalescing timeout value in microseconds. 267 - */ 268 179 u32 interrupt_coalesce_timeout; 269 - 270 - /** 271 - * This field is a pointer to the memory mapped register space for the 272 - * struct smu_registers. 273 - */ 274 180 struct smu_registers __iomem *smu_registers; 275 - 276 - /** 277 - * This field is a pointer to the memory mapped register space for the 278 - * struct scu_registers. 279 - */ 280 181 struct scu_registers __iomem *scu_registers; 281 182 282 - }; 283 - 284 - struct isci_host { 285 - struct scic_sds_controller sci; 286 183 u16 tci_head; 287 184 u16 tci_tail; 288 185 u16 tci_pool[SCI_MAX_IO_REQUESTS]; 289 - 290 - union scic_oem_parameters oem_parameters; 291 186 292 187 int id; /* unique within a given pci device */ 293 188 struct isci_phy phys[SCI_MAX_PHYS]; ··· 359 464 return dev->port->ha->lldd_ha; 360 465 } 361 466 362 - static inline struct isci_host *scic_to_ihost(struct scic_sds_controller *scic) 363 - { 364 - /* XXX delete after merging scic_sds_contoller and isci_host */ 365 - struct isci_host *ihost = container_of(scic, typeof(*ihost), sci); 366 - 367 - return ihost; 368 - } 369 - 370 467 /** 371 468 * scic_sds_controller_get_protocol_engine_group() - 372 469 * ··· 404 517 */ 405 518 #define scic_sds_controller_clear_invalid_phy(controller, phy) \ 406 519 ((controller)->invalid_phy_mask &= ~(1 << (phy)->phy_index)) 407 - 408 - static inline struct device *scic_to_dev(struct scic_sds_controller *scic) 409 - { 410 - return &scic_to_ihost(scic)->pdev->dev; 411 - } 412 520 413 521 static inline struct device *sciphy_to_dev(struct isci_phy *iphy) 414 522 { ··· 460 578 return isci_si_rev > ISCI_SI_REVB0; 461 579 } 462 580 463 - void scic_sds_controller_post_request(struct scic_sds_controller *scic, 581 + void scic_sds_controller_post_request(struct isci_host *ihost, 464 582 u32 request); 465 - void scic_sds_controller_release_frame(struct scic_sds_controller *scic, 583 + void scic_sds_controller_release_frame(struct isci_host *ihost, 466 584 u32 frame_index); 467 585 void scic_sds_controller_copy_sata_response(void *response_buffer, 468 586 void *frame_header, 469 587 void *frame_buffer); 470 - enum sci_status scic_sds_controller_allocate_remote_node_context(struct scic_sds_controller *scic, 588 + enum sci_status scic_sds_controller_allocate_remote_node_context(struct isci_host *ihost, 471 589 struct isci_remote_device *idev, 472 590 u16 *node_id); 473 591 void scic_sds_controller_free_remote_node_context( 474 - struct scic_sds_controller *scic, 592 + struct isci_host *ihost, 475 593 struct isci_remote_device *idev, 476 594 u16 node_id); 477 595 union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer( 478 - struct scic_sds_controller *scic, 596 + struct isci_host *ihost, 479 597 u16 node_id); 480 598 481 - struct isci_request *scic_request_by_tag(struct scic_sds_controller *scic, 599 + struct isci_request *scic_request_by_tag(struct isci_host *ihost, 482 600 u16 io_tag); 483 601 484 602 void scic_sds_controller_power_control_queue_insert( 485 - struct scic_sds_controller *scic, 603 + struct isci_host *ihost, 486 604 struct isci_phy *iphy); 487 605 488 606 void scic_sds_controller_power_control_queue_remove( 489 - struct scic_sds_controller *scic, 607 + struct isci_host *ihost, 490 608 struct isci_phy *iphy); 491 609 492 610 void scic_sds_controller_link_up( 493 - struct scic_sds_controller *scic, 611 + struct isci_host *ihost, 494 612 struct isci_port *iport, 495 613 struct isci_phy *iphy); 496 614 497 615 void scic_sds_controller_link_down( 498 - struct scic_sds_controller *scic, 616 + struct isci_host *ihost, 499 617 struct isci_port *iport, 500 618 struct isci_phy *iphy); 501 619 502 620 void scic_sds_controller_remote_device_stopped( 503 - struct scic_sds_controller *scic, 621 + struct isci_host *ihost, 504 622 struct isci_remote_device *idev); 505 623 506 624 void scic_sds_controller_copy_task_context( 507 - struct scic_sds_controller *scic, 625 + struct isci_host *ihost, 508 626 struct isci_request *ireq); 509 627 510 - void scic_sds_controller_register_setup(struct scic_sds_controller *scic); 628 + void scic_sds_controller_register_setup(struct isci_host *ihost); 511 629 512 630 enum sci_status scic_controller_continue_io(struct isci_request *ireq); 513 631 int isci_host_scan_finished(struct Scsi_Host *, unsigned long); ··· 537 655 enum sci_status); 538 656 539 657 void scic_controller_disable_interrupts( 540 - struct scic_sds_controller *scic); 658 + struct isci_host *ihost); 541 659 542 660 enum sci_status scic_controller_start_io( 543 - struct scic_sds_controller *scic, 661 + struct isci_host *ihost, 544 662 struct isci_remote_device *idev, 545 663 struct isci_request *ireq); 546 664 547 665 enum sci_task_status scic_controller_start_task( 548 - struct scic_sds_controller *scic, 666 + struct isci_host *ihost, 549 667 struct isci_remote_device *idev, 550 668 struct isci_request *ireq); 551 669 552 670 enum sci_status scic_controller_terminate_request( 553 - struct scic_sds_controller *scic, 671 + struct isci_host *ihost, 554 672 struct isci_remote_device *idev, 555 673 struct isci_request *ireq); 556 674 557 675 enum sci_status scic_controller_complete_io( 558 - struct scic_sds_controller *scic, 676 + struct isci_host *ihost, 559 677 struct isci_remote_device *idev, 560 678 struct isci_request *ireq); 561 679 ··· 563 681 struct scic_sds_port_configuration_agent *port_agent); 564 682 565 683 enum sci_status scic_sds_port_configuration_agent_initialize( 566 - struct scic_sds_controller *controller, 684 + struct isci_host *ihost, 567 685 struct scic_sds_port_configuration_agent *port_agent); 568 686 #endif
+5 -5
drivers/scsi/isci/init.c
··· 548 548 549 549 static void __devexit isci_pci_remove(struct pci_dev *pdev) 550 550 { 551 - struct isci_host *isci_host; 551 + struct isci_host *ihost; 552 552 int i; 553 553 554 - for_each_isci_host(i, isci_host, pdev) { 555 - isci_unregister(isci_host); 556 - isci_host_deinit(isci_host); 557 - scic_controller_disable_interrupts(&isci_host->sci); 554 + for_each_isci_host(i, ihost, pdev) { 555 + isci_unregister(ihost); 556 + isci_host_deinit(ihost); 557 + scic_controller_disable_interrupts(ihost); 558 558 } 559 559 } 560 560
+20 -20
drivers/scsi/isci/phy.c
··· 112 112 scic_sds_phy_link_layer_initialization(struct isci_phy *iphy, 113 113 struct scu_link_layer_registers __iomem *link_layer_registers) 114 114 { 115 - struct scic_sds_controller *scic = 115 + struct isci_host *ihost = 116 116 iphy->owning_port->owning_controller; 117 117 int phy_idx = iphy->phy_index; 118 118 struct sci_phy_user_params *phy_user = 119 - &scic->user_parameters.sds1.phys[phy_idx]; 119 + &ihost->user_parameters.sds1.phys[phy_idx]; 120 120 struct sci_phy_oem_params *phy_oem = 121 - &scic->oem_parameters.sds1.phys[phy_idx]; 121 + &ihost->oem_parameters.sds1.phys[phy_idx]; 122 122 u32 phy_configuration; 123 123 struct scic_phy_cap phy_cap; 124 124 u32 parity_check = 0; ··· 169 169 phy_cap.gen3_no_ssc = 1; 170 170 phy_cap.gen2_no_ssc = 1; 171 171 phy_cap.gen1_no_ssc = 1; 172 - if (scic->oem_parameters.sds1.controller.do_enable_ssc == true) { 172 + if (ihost->oem_parameters.sds1.controller.do_enable_ssc == true) { 173 173 phy_cap.gen3_ssc = 1; 174 174 phy_cap.gen2_ssc = 1; 175 175 phy_cap.gen1_ssc = 1; ··· 216 216 &iphy->link_layer_registers->afe_lookup_table_control); 217 217 218 218 llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT, 219 - (u8)scic->user_parameters.sds1.no_outbound_task_timeout); 219 + (u8)ihost->user_parameters.sds1.no_outbound_task_timeout); 220 220 221 221 switch(phy_user->max_speed_generation) { 222 222 case SCIC_SDS_PARM_GEN3_SPEED: ··· 255 255 { 256 256 struct sci_timer *tmr = (struct sci_timer *)data; 257 257 struct isci_phy *iphy = container_of(tmr, typeof(*iphy), sata_timer); 258 - struct isci_host *ihost = scic_to_ihost(iphy->owning_port->owning_controller); 258 + struct isci_host *ihost = iphy->owning_port->owning_controller; 259 259 unsigned long flags; 260 260 261 261 spin_lock_irqsave(&ihost->scic_lock, flags); ··· 890 890 u32 frame_index) 891 891 { 892 892 enum scic_sds_phy_states state = iphy->sm.current_state_id; 893 - struct scic_sds_controller *scic = iphy->owning_port->owning_controller; 893 + struct isci_host *ihost = iphy->owning_port->owning_controller; 894 894 enum sci_status result; 895 895 unsigned long flags; 896 896 ··· 899 899 u32 *frame_words; 900 900 struct sas_identify_frame iaf; 901 901 902 - result = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 902 + result = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 903 903 frame_index, 904 904 (void **)&frame_words); 905 905 ··· 933 933 "unexpected frame id %x\n", 934 934 __func__, frame_index); 935 935 936 - scic_sds_controller_release_frame(scic, frame_index); 936 + scic_sds_controller_release_frame(ihost, frame_index); 937 937 return result; 938 938 } 939 939 case SCI_PHY_SUB_AWAIT_SIG_FIS_UF: { ··· 950 950 951 951 if ((frame_header->fis_type == FIS_REGD2H) && 952 952 !(frame_header->status & ATA_BUSY)) { 953 - scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, 953 + scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, 954 954 frame_index, 955 955 (void **)&fis_frame_data); 956 956 ··· 971 971 __func__, frame_index); 972 972 973 973 /* Regardless of the result we are done with this frame with it */ 974 - scic_sds_controller_release_frame(scic, frame_index); 974 + scic_sds_controller_release_frame(ihost, frame_index); 975 975 976 976 return result; 977 977 } ··· 994 994 static void scic_sds_phy_starting_await_sas_power_substate_enter(struct sci_base_state_machine *sm) 995 995 { 996 996 struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); 997 - struct scic_sds_controller *scic = iphy->owning_port->owning_controller; 997 + struct isci_host *ihost = iphy->owning_port->owning_controller; 998 998 999 - scic_sds_controller_power_control_queue_insert(scic, iphy); 999 + scic_sds_controller_power_control_queue_insert(ihost, iphy); 1000 1000 } 1001 1001 1002 1002 static void scic_sds_phy_starting_await_sas_power_substate_exit(struct sci_base_state_machine *sm) 1003 1003 { 1004 1004 struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); 1005 - struct scic_sds_controller *scic = iphy->owning_port->owning_controller; 1005 + struct isci_host *ihost = iphy->owning_port->owning_controller; 1006 1006 1007 - scic_sds_controller_power_control_queue_remove(scic, iphy); 1007 + scic_sds_controller_power_control_queue_remove(ihost, iphy); 1008 1008 } 1009 1009 1010 1010 static void scic_sds_phy_starting_await_sata_power_substate_enter(struct sci_base_state_machine *sm) 1011 1011 { 1012 1012 struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); 1013 - struct scic_sds_controller *scic = iphy->owning_port->owning_controller; 1013 + struct isci_host *ihost = iphy->owning_port->owning_controller; 1014 1014 1015 - scic_sds_controller_power_control_queue_insert(scic, iphy); 1015 + scic_sds_controller_power_control_queue_insert(ihost, iphy); 1016 1016 } 1017 1017 1018 1018 static void scic_sds_phy_starting_await_sata_power_substate_exit(struct sci_base_state_machine *sm) 1019 1019 { 1020 1020 struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); 1021 - struct scic_sds_controller *scic = iphy->owning_port->owning_controller; 1021 + struct isci_host *ihost = iphy->owning_port->owning_controller; 1022 1022 1023 - scic_sds_controller_power_control_queue_remove(scic, iphy); 1023 + scic_sds_controller_power_control_queue_remove(ihost, iphy); 1024 1024 } 1025 1025 1026 1026 static void scic_sds_phy_starting_await_sata_phy_substate_enter(struct sci_base_state_machine *sm) ··· 1313 1313 u64 sci_sas_addr; 1314 1314 __be64 sas_addr; 1315 1315 1316 - scic_oem_parameters_get(&ihost->sci, &oem); 1316 + scic_oem_parameters_get(ihost, &oem); 1317 1317 sci_sas_addr = oem.sds1.phys[index].sas_address.high; 1318 1318 sci_sas_addr <<= 32; 1319 1319 sci_sas_addr |= oem.sds1.phys[index].sas_address.low;
+40 -49
drivers/scsi/isci/port.c
··· 365 365 "%s: isci_port = %p\n", __func__, isci_port); 366 366 } 367 367 368 - static void isci_port_stop_complete(struct scic_sds_controller *scic, 368 + static void isci_port_stop_complete(struct isci_host *ihost, 369 369 struct isci_port *iport, 370 370 enum sci_status completion_status) 371 371 { 372 - dev_dbg(&scic_to_ihost(scic)->pdev->dev, "Port stop complete\n"); 372 + dev_dbg(&ihost->pdev->dev, "Port stop complete\n"); 373 373 } 374 374 375 375 /** ··· 541 541 /* Make sure that this phy is part of this port */ 542 542 if (iport->phy_table[iphy->phy_index] == iphy && 543 543 phy_get_non_dummy_port(iphy) == iport) { 544 - struct scic_sds_controller *scic = iport->owning_controller; 545 - struct isci_host *ihost = scic_to_ihost(scic); 544 + struct isci_host *ihost = iport->owning_controller; 546 545 547 546 /* Yep it is assigned to this port so remove it */ 548 547 scic_sds_phy_set_port(iphy, &ihost->ports[SCI_MAX_PORTS]); ··· 653 654 */ 654 655 static void scic_sds_port_construct_dummy_task(struct isci_port *iport, u16 tag) 655 656 { 656 - struct scic_sds_controller *scic = iport->owning_controller; 657 + struct isci_host *ihost = iport->owning_controller; 657 658 struct scu_task_context *task_context; 658 659 659 - task_context = &scic->task_context_table[ISCI_TAG_TCI(tag)]; 660 + task_context = &ihost->task_context_table[ISCI_TAG_TCI(tag)]; 660 661 memset(task_context, 0, sizeof(struct scu_task_context)); 661 662 662 663 task_context->initiator_request = 1; ··· 673 674 674 675 static void scic_sds_port_destroy_dummy_resources(struct isci_port *iport) 675 676 { 676 - struct scic_sds_controller *scic = iport->owning_controller; 677 + struct isci_host *ihost = iport->owning_controller; 677 678 678 679 if (iport->reserved_tag != SCI_CONTROLLER_INVALID_IO_TAG) 679 - isci_free_tag(scic_to_ihost(scic), iport->reserved_tag); 680 + isci_free_tag(ihost, iport->reserved_tag); 680 681 681 682 if (iport->reserved_rni != SCU_DUMMY_INDEX) 682 - scic_sds_remote_node_table_release_remote_node_index(&scic->available_remote_nodes, 683 + scic_sds_remote_node_table_release_remote_node_index(&ihost->available_remote_nodes, 683 684 1, iport->reserved_rni); 684 685 685 686 iport->reserved_rni = SCU_DUMMY_INDEX; ··· 748 749 struct isci_phy *iphy, 749 750 bool do_notify_user) 750 751 { 751 - struct scic_sds_controller *scic = iport->owning_controller; 752 - struct isci_host *ihost = scic_to_ihost(scic); 752 + struct isci_host *ihost = iport->owning_controller; 753 753 754 754 if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) 755 755 scic_sds_phy_resume(iphy); 756 756 757 757 iport->active_phy_mask |= 1 << iphy->phy_index; 758 758 759 - scic_sds_controller_clear_invalid_phy(scic, iphy); 759 + scic_sds_controller_clear_invalid_phy(ihost, iphy); 760 760 761 761 if (do_notify_user == true) 762 762 isci_port_link_up(ihost, iport, iphy); ··· 765 767 struct isci_phy *iphy, 766 768 bool do_notify_user) 767 769 { 768 - struct scic_sds_controller *scic = scic_sds_port_get_controller(iport); 769 - struct isci_host *ihost = scic_to_ihost(scic); 770 + struct isci_host *ihost = scic_sds_port_get_controller(iport); 770 771 771 772 iport->active_phy_mask &= ~(1 << iphy->phy_index); 772 773 ··· 790 793 static void scic_sds_port_invalid_link_up(struct isci_port *iport, 791 794 struct isci_phy *iphy) 792 795 { 793 - struct scic_sds_controller *scic = iport->owning_controller; 796 + struct isci_host *ihost = iport->owning_controller; 794 797 795 798 /* 796 799 * Check to see if we have alreay reported this link as bad and if 797 800 * not go ahead and tell the SCI_USER that we have discovered an 798 801 * invalid link. 799 802 */ 800 - if ((scic->invalid_phy_mask & (1 << iphy->phy_index)) == 0) { 801 - scic_sds_controller_set_invalid_phy(scic, iphy); 802 - dev_warn(&scic_to_ihost(scic)->pdev->dev, "Invalid link up!\n"); 803 + if ((ihost->invalid_phy_mask & (1 << iphy->phy_index)) == 0) { 804 + scic_sds_controller_set_invalid_phy(ihost, iphy); 805 + dev_warn(&ihost->pdev->dev, "Invalid link up!\n"); 803 806 } 804 807 } 805 808 ··· 928 931 { 929 932 struct sci_timer *tmr = (struct sci_timer *)data; 930 933 struct isci_port *iport = container_of(tmr, typeof(*iport), timer); 931 - struct isci_host *ihost = scic_to_ihost(iport->owning_controller); 934 + struct isci_host *ihost = iport->owning_controller; 932 935 unsigned long flags; 933 936 u32 current_state; 934 937 ··· 1038 1041 */ 1039 1042 static void scic_sds_port_post_dummy_request(struct isci_port *iport) 1040 1043 { 1041 - struct scic_sds_controller *scic = iport->owning_controller; 1044 + struct isci_host *ihost = iport->owning_controller; 1042 1045 u16 tag = iport->reserved_tag; 1043 1046 struct scu_task_context *tc; 1044 1047 u32 command; 1045 1048 1046 - tc = &scic->task_context_table[ISCI_TAG_TCI(tag)]; 1049 + tc = &ihost->task_context_table[ISCI_TAG_TCI(tag)]; 1047 1050 tc->abort = 0; 1048 1051 1049 1052 command = SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | 1050 1053 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | 1051 1054 ISCI_TAG_TCI(tag); 1052 1055 1053 - scic_sds_controller_post_request(scic, command); 1056 + scic_sds_controller_post_request(ihost, command); 1054 1057 } 1055 1058 1056 1059 /** ··· 1062 1065 */ 1063 1066 static void scic_sds_port_abort_dummy_request(struct isci_port *iport) 1064 1067 { 1065 - struct scic_sds_controller *scic = iport->owning_controller; 1068 + struct isci_host *ihost = iport->owning_controller; 1066 1069 u16 tag = iport->reserved_tag; 1067 1070 struct scu_task_context *tc; 1068 1071 u32 command; 1069 1072 1070 - tc = &scic->task_context_table[ISCI_TAG_TCI(tag)]; 1073 + tc = &ihost->task_context_table[ISCI_TAG_TCI(tag)]; 1071 1074 tc->abort = 1; 1072 1075 1073 1076 command = SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT | 1074 1077 iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | 1075 1078 ISCI_TAG_TCI(tag); 1076 1079 1077 - scic_sds_controller_post_request(scic, command); 1080 + scic_sds_controller_post_request(ihost, command); 1078 1081 } 1079 1082 1080 1083 /** ··· 1112 1115 { 1113 1116 u32 index; 1114 1117 struct isci_port *iport = container_of(sm, typeof(*iport), sm); 1115 - struct scic_sds_controller *scic = iport->owning_controller; 1116 - struct isci_host *ihost = scic_to_ihost(scic); 1118 + struct isci_host *ihost = iport->owning_controller; 1117 1119 1118 1120 isci_port_ready(ihost, iport); 1119 1121 ··· 1137 1141 1138 1142 static void scic_sds_port_invalidate_dummy_remote_node(struct isci_port *iport) 1139 1143 { 1140 - struct scic_sds_controller *scic = iport->owning_controller; 1144 + struct isci_host *ihost = iport->owning_controller; 1141 1145 u8 phys_index = iport->physical_port_index; 1142 1146 union scu_remote_node_context *rnc; 1143 1147 u16 rni = iport->reserved_rni; 1144 1148 u32 command; 1145 1149 1146 - rnc = &scic->remote_node_context_table[rni]; 1150 + rnc = &ihost->remote_node_context_table[rni]; 1147 1151 1148 1152 rnc->ssp.is_valid = false; 1149 1153 ··· 1151 1155 * controller and give it ample time to act before posting the rnc 1152 1156 * invalidate 1153 1157 */ 1154 - readl(&scic->smu_registers->interrupt_status); /* flush */ 1158 + readl(&ihost->smu_registers->interrupt_status); /* flush */ 1155 1159 udelay(10); 1156 1160 1157 1161 command = SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE | 1158 1162 phys_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | rni; 1159 1163 1160 - scic_sds_controller_post_request(scic, command); 1164 + scic_sds_controller_post_request(ihost, command); 1161 1165 } 1162 1166 1163 1167 /** ··· 1171 1175 static void scic_sds_port_ready_substate_operational_exit(struct sci_base_state_machine *sm) 1172 1176 { 1173 1177 struct isci_port *iport = container_of(sm, typeof(*iport), sm); 1174 - struct scic_sds_controller *scic = iport->owning_controller; 1175 - struct isci_host *ihost = scic_to_ihost(scic); 1178 + struct isci_host *ihost = iport->owning_controller; 1176 1179 1177 1180 /* 1178 1181 * Kill the dummy task for this port if it has not yet posted ··· 1189 1194 static void scic_sds_port_ready_substate_configuring_enter(struct sci_base_state_machine *sm) 1190 1195 { 1191 1196 struct isci_port *iport = container_of(sm, typeof(*iport), sm); 1192 - struct scic_sds_controller *scic = iport->owning_controller; 1193 - struct isci_host *ihost = scic_to_ihost(scic); 1197 + struct isci_host *ihost = iport->owning_controller; 1194 1198 1195 1199 if (iport->active_phy_mask == 0) { 1196 1200 isci_port_not_ready(ihost, iport); ··· 1212 1218 1213 1219 enum sci_status scic_sds_port_start(struct isci_port *iport) 1214 1220 { 1215 - struct scic_sds_controller *scic = iport->owning_controller; 1221 + struct isci_host *ihost = iport->owning_controller; 1216 1222 enum sci_status status = SCI_SUCCESS; 1217 1223 enum scic_sds_port_states state; 1218 1224 u32 phy_mask; ··· 1235 1241 1236 1242 if (iport->reserved_rni == SCU_DUMMY_INDEX) { 1237 1243 u16 rni = scic_sds_remote_node_table_allocate_remote_node( 1238 - &scic->available_remote_nodes, 1); 1244 + &ihost->available_remote_nodes, 1); 1239 1245 1240 1246 if (rni != SCU_DUMMY_INDEX) 1241 1247 scic_sds_port_construct_dummy_rnc(iport, rni); ··· 1245 1251 } 1246 1252 1247 1253 if (iport->reserved_tag == SCI_CONTROLLER_INVALID_IO_TAG) { 1248 - struct isci_host *ihost = scic_to_ihost(scic); 1249 1254 u16 tag; 1250 1255 1251 1256 tag = isci_alloc_tag(ihost); ··· 1627 1634 1628 1635 static void scic_sds_port_post_dummy_remote_node(struct isci_port *iport) 1629 1636 { 1630 - struct scic_sds_controller *scic = iport->owning_controller; 1637 + struct isci_host *ihost = iport->owning_controller; 1631 1638 u8 phys_index = iport->physical_port_index; 1632 1639 union scu_remote_node_context *rnc; 1633 1640 u16 rni = iport->reserved_rni; 1634 1641 u32 command; 1635 1642 1636 - rnc = &scic->remote_node_context_table[rni]; 1643 + rnc = &ihost->remote_node_context_table[rni]; 1637 1644 rnc->ssp.is_valid = true; 1638 1645 1639 1646 command = SCU_CONTEXT_COMMAND_POST_RNC_32 | 1640 1647 phys_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | rni; 1641 1648 1642 - scic_sds_controller_post_request(scic, command); 1649 + scic_sds_controller_post_request(ihost, command); 1643 1650 1644 1651 /* ensure hardware has seen the post rnc command and give it 1645 1652 * ample time to act before sending the suspend 1646 1653 */ 1647 - readl(&scic->smu_registers->interrupt_status); /* flush */ 1654 + readl(&ihost->smu_registers->interrupt_status); /* flush */ 1648 1655 udelay(10); 1649 1656 1650 1657 command = SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX_RX | 1651 1658 phys_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | rni; 1652 1659 1653 - scic_sds_controller_post_request(scic, command); 1660 + scic_sds_controller_post_request(ihost, command); 1654 1661 } 1655 1662 1656 1663 static void scic_sds_port_stopped_state_enter(struct sci_base_state_machine *sm) ··· 1677 1684 static void scic_sds_port_ready_state_enter(struct sci_base_state_machine *sm) 1678 1685 { 1679 1686 struct isci_port *iport = container_of(sm, typeof(*iport), sm); 1680 - struct scic_sds_controller *scic = iport->owning_controller; 1681 - struct isci_host *ihost = scic_to_ihost(scic); 1687 + struct isci_host *ihost = iport->owning_controller; 1682 1688 u32 prev_state; 1683 1689 1684 1690 prev_state = iport->sm.previous_state_id; ··· 1750 1758 }; 1751 1759 1752 1760 void scic_sds_port_construct(struct isci_port *iport, u8 index, 1753 - struct scic_sds_controller *scic) 1761 + struct isci_host *ihost) 1754 1762 { 1755 1763 sci_init_sm(&iport->sm, scic_sds_port_state_table, SCI_PORT_STOPPED); 1756 1764 ··· 1759 1767 iport->active_phy_mask = 0; 1760 1768 iport->ready_exit = false; 1761 1769 1762 - iport->owning_controller = scic; 1770 + iport->owning_controller = ihost; 1763 1771 1764 1772 iport->started_request_count = 0; 1765 1773 iport->assigned_device_count = 0; ··· 1802 1810 struct isci_port *iport, 1803 1811 struct isci_phy *iphy) 1804 1812 { 1805 - struct scic_sds_controller *scic = iport->owning_controller; 1806 - struct isci_host *ihost = scic_to_ihost(scic); 1813 + struct isci_host *ihost = iport->owning_controller; 1807 1814 1808 1815 /* notify the user. */ 1809 1816 isci_port_bc_change_received(ihost, iport, iphy);
+2 -2
drivers/scsi/isci/port.h
··· 115 115 u32 assigned_device_count; 116 116 u32 not_ready_reason; 117 117 struct isci_phy *phy_table[SCI_MAX_PHYS]; 118 - struct scic_sds_controller *owning_controller; 118 + struct isci_host *owning_controller; 119 119 struct sci_timer timer; 120 120 struct scu_port_task_scheduler_registers __iomem *port_task_scheduler_registers; 121 121 /* XXX rework: only one register, no need to replicate per-port */ ··· 243 243 void scic_sds_port_construct( 244 244 struct isci_port *iport, 245 245 u8 port_index, 246 - struct scic_sds_controller *scic); 246 + struct isci_host *ihost); 247 247 248 248 enum sci_status scic_sds_port_initialize( 249 249 struct isci_port *iport,
+30 -52
drivers/scsi/isci/port_config.c
··· 113 113 * NULL if there is no matching port for the phy. 114 114 */ 115 115 static struct isci_port *scic_sds_port_configuration_agent_find_port( 116 - struct scic_sds_controller *scic, 116 + struct isci_host *ihost, 117 117 struct isci_phy *iphy) 118 118 { 119 119 u8 i; ··· 130 130 scic_sds_phy_get_sas_address(iphy, &phy_sas_address); 131 131 scic_sds_phy_get_attached_sas_address(iphy, &phy_attached_device_address); 132 132 133 - for (i = 0; i < scic->logical_port_entries; i++) { 134 - struct isci_host *ihost = scic_to_ihost(scic); 133 + for (i = 0; i < ihost->logical_port_entries; i++) { 135 134 struct isci_port *iport = &ihost->ports[i]; 136 135 137 136 scic_sds_port_get_sas_address(iport, &port_sas_address); ··· 157 158 * the port configuration is not valid for this port configuration agent. 158 159 */ 159 160 static enum sci_status scic_sds_port_configuration_agent_validate_ports( 160 - struct scic_sds_controller *controller, 161 + struct isci_host *ihost, 161 162 struct scic_sds_port_configuration_agent *port_agent) 162 163 { 163 - struct isci_host *ihost = scic_to_ihost(controller); 164 164 struct sci_sas_address first_address; 165 165 struct sci_sas_address second_address; 166 166 ··· 237 239 * Manual port configuration agent routines 238 240 * ****************************************************************************** */ 239 241 240 - /** 241 - * 242 - * 243 - * This routine will verify that all of the phys in the same port are using the 244 - * same SAS address. 245 - */ 246 - static enum sci_status scic_sds_mpc_agent_validate_phy_configuration( 247 - struct scic_sds_controller *controller, 248 - struct scic_sds_port_configuration_agent *port_agent) 242 + /* verify all of the phys in the same port are using the same SAS address */ 243 + static enum sci_status 244 + scic_sds_mpc_agent_validate_phy_configuration(struct isci_host *ihost, 245 + struct scic_sds_port_configuration_agent *port_agent) 249 246 { 250 - struct isci_host *ihost = scic_to_ihost(controller); 251 247 u32 phy_mask; 252 248 u32 assigned_phy_mask; 253 249 struct sci_sas_address sas_address; ··· 254 262 sas_address.low = 0; 255 263 256 264 for (port_index = 0; port_index < SCI_MAX_PORTS; port_index++) { 257 - phy_mask = controller->oem_parameters.sds1.ports[port_index].phy_mask; 265 + phy_mask = ihost->oem_parameters.sds1.ports[port_index].phy_mask; 258 266 259 267 if (!phy_mask) 260 268 continue; ··· 316 324 phy_index++; 317 325 } 318 326 319 - return scic_sds_port_configuration_agent_validate_ports(controller, port_agent); 327 + return scic_sds_port_configuration_agent_validate_ports(ihost, port_agent); 320 328 } 321 329 322 330 static void mpc_agent_timeout(unsigned long data) ··· 324 332 u8 index; 325 333 struct sci_timer *tmr = (struct sci_timer *)data; 326 334 struct scic_sds_port_configuration_agent *port_agent; 327 - struct scic_sds_controller *scic; 328 335 struct isci_host *ihost; 329 336 unsigned long flags; 330 337 u16 configure_phy_mask; 331 338 332 339 port_agent = container_of(tmr, typeof(*port_agent), timer); 333 - scic = container_of(port_agent, typeof(*scic), port_agent); 334 - ihost = scic_to_ihost(scic); 340 + ihost = container_of(port_agent, typeof(*ihost), port_agent); 335 341 336 342 spin_lock_irqsave(&ihost->scic_lock, flags); 337 343 ··· 345 355 struct isci_phy *iphy = &ihost->phys[index]; 346 356 347 357 if (configure_phy_mask & (1 << index)) { 348 - port_agent->link_up_handler(scic, port_agent, 358 + port_agent->link_up_handler(ihost, port_agent, 349 359 phy_get_non_dummy_port(iphy), 350 360 iphy); 351 361 } ··· 355 365 spin_unlock_irqrestore(&ihost->scic_lock, flags); 356 366 } 357 367 358 - static void scic_sds_mpc_agent_link_up(struct scic_sds_controller *controller, 368 + static void scic_sds_mpc_agent_link_up(struct isci_host *ihost, 359 369 struct scic_sds_port_configuration_agent *port_agent, 360 370 struct isci_port *iport, 361 371 struct isci_phy *iphy) ··· 391 401 * link down notification from a phy that has no assocoated port? 392 402 */ 393 403 static void scic_sds_mpc_agent_link_down( 394 - struct scic_sds_controller *scic, 404 + struct isci_host *ihost, 395 405 struct scic_sds_port_configuration_agent *port_agent, 396 406 struct isci_port *iport, 397 407 struct isci_phy *iphy) ··· 428 438 } 429 439 } 430 440 431 - /* 432 - * ****************************************************************************** 433 - * Automatic port configuration agent routines 434 - * ****************************************************************************** */ 435 - 436 - /** 437 - * 438 - * 439 - * This routine will verify that the phys are assigned a valid SAS address for 440 - * automatic port configuration mode. 441 + /* verify phys are assigned a valid SAS address for automatic port 442 + * configuration mode. 441 443 */ 442 - static enum sci_status scic_sds_apc_agent_validate_phy_configuration( 443 - struct scic_sds_controller *controller, 444 - struct scic_sds_port_configuration_agent *port_agent) 444 + static enum sci_status 445 + scic_sds_apc_agent_validate_phy_configuration(struct isci_host *ihost, 446 + struct scic_sds_port_configuration_agent *port_agent) 445 447 { 446 448 u8 phy_index; 447 449 u8 port_index; 448 450 struct sci_sas_address sas_address; 449 451 struct sci_sas_address phy_assigned_address; 450 - struct isci_host *ihost = scic_to_ihost(controller); 451 452 452 453 phy_index = 0; 453 454 ··· 465 484 } 466 485 } 467 486 468 - return scic_sds_port_configuration_agent_validate_ports(controller, port_agent); 487 + return scic_sds_port_configuration_agent_validate_ports(ihost, port_agent); 469 488 } 470 489 471 - static void scic_sds_apc_agent_configure_ports(struct scic_sds_controller *controller, 490 + static void scic_sds_apc_agent_configure_ports(struct isci_host *ihost, 472 491 struct scic_sds_port_configuration_agent *port_agent, 473 492 struct isci_phy *iphy, 474 493 bool start_timer) ··· 477 496 enum sci_status status; 478 497 struct isci_port *iport; 479 498 enum SCIC_SDS_APC_ACTIVITY apc_activity = SCIC_SDS_APC_SKIP_PHY; 480 - struct isci_host *ihost = scic_to_ihost(controller); 481 499 482 - iport = scic_sds_port_configuration_agent_find_port(controller, iphy); 500 + iport = scic_sds_port_configuration_agent_find_port(ihost, iphy); 483 501 484 502 if (iport) { 485 503 if (scic_sds_port_is_valid_phy_assignment(iport, iphy->phy_index)) ··· 599 619 * notifications. Is it possible to get a link down notification from a phy 600 620 * that has no assocoated port? 601 621 */ 602 - static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic, 622 + static void scic_sds_apc_agent_link_up(struct isci_host *ihost, 603 623 struct scic_sds_port_configuration_agent *port_agent, 604 624 struct isci_port *iport, 605 625 struct isci_phy *iphy) ··· 609 629 if (!iport) { 610 630 /* the phy is not the part of this port */ 611 631 port_agent->phy_ready_mask |= 1 << phy_index; 612 - scic_sds_apc_agent_configure_ports(scic, port_agent, iphy, true); 632 + scic_sds_apc_agent_configure_ports(ihost, port_agent, iphy, true); 613 633 } else { 614 634 /* the phy is already the part of the port */ 615 635 u32 port_state = iport->sm.current_state_id; ··· 638 658 * port? 639 659 */ 640 660 static void scic_sds_apc_agent_link_down( 641 - struct scic_sds_controller *controller, 661 + struct isci_host *ihost, 642 662 struct scic_sds_port_configuration_agent *port_agent, 643 663 struct isci_port *iport, 644 664 struct isci_phy *iphy) ··· 663 683 u32 index; 664 684 struct sci_timer *tmr = (struct sci_timer *)data; 665 685 struct scic_sds_port_configuration_agent *port_agent; 666 - struct scic_sds_controller *scic; 667 686 struct isci_host *ihost; 668 687 unsigned long flags; 669 688 u16 configure_phy_mask; 670 689 671 690 port_agent = container_of(tmr, typeof(*port_agent), timer); 672 - scic = container_of(port_agent, typeof(*scic), port_agent); 673 - ihost = scic_to_ihost(scic); 691 + ihost = container_of(port_agent, typeof(*ihost), port_agent); 674 692 675 693 spin_lock_irqsave(&ihost->scic_lock, flags); 676 694 ··· 686 708 if ((configure_phy_mask & (1 << index)) == 0) 687 709 continue; 688 710 689 - scic_sds_apc_agent_configure_ports(scic, port_agent, 711 + scic_sds_apc_agent_configure_ports(ihost, port_agent, 690 712 &ihost->phys[index], false); 691 713 } 692 714 ··· 726 748 } 727 749 728 750 enum sci_status scic_sds_port_configuration_agent_initialize( 729 - struct scic_sds_controller *scic, 751 + struct isci_host *ihost, 730 752 struct scic_sds_port_configuration_agent *port_agent) 731 753 { 732 754 enum sci_status status; 733 755 enum scic_port_configuration_mode mode; 734 756 735 - mode = scic->oem_parameters.sds1.controller.mode_type; 757 + mode = ihost->oem_parameters.sds1.controller.mode_type; 736 758 737 759 if (mode == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { 738 760 status = scic_sds_mpc_agent_validate_phy_configuration( 739 - scic, port_agent); 761 + ihost, port_agent); 740 762 741 763 port_agent->link_up_handler = scic_sds_mpc_agent_link_up; 742 764 port_agent->link_down_handler = scic_sds_mpc_agent_link_down; ··· 744 766 sci_init_timer(&port_agent->timer, mpc_agent_timeout); 745 767 } else { 746 768 status = scic_sds_apc_agent_validate_phy_configuration( 747 - scic, port_agent); 769 + ihost, port_agent); 748 770 749 771 port_agent->link_up_handler = scic_sds_apc_agent_link_up; 750 772 port_agent->link_down_handler = scic_sds_apc_agent_link_down;
+1 -1
drivers/scsi/isci/probe_roms.h
··· 165 165 int scic_oem_parameters_validate(struct scic_sds_oem_params *oem); 166 166 167 167 union scic_oem_parameters; 168 - void scic_oem_parameters_get(struct scic_sds_controller *scic, 168 + void scic_oem_parameters_get(struct isci_host *ihost, 169 169 union scic_oem_parameters *oem); 170 170 171 171 struct isci_orom;
+37 -39
drivers/scsi/isci/remote_device.c
··· 62 62 #include "task.h" 63 63 64 64 /** 65 - * isci_remote_device_not_ready() - This function is called by the scic when 65 + * isci_remote_device_not_ready() - This function is called by the ihost when 66 66 * the remote device is not ready. We mark the isci device as ready (not 67 67 * "ready_for_io") and signal the waiting proccess. 68 68 * @isci_host: This parameter specifies the isci host object. ··· 92 92 "%s: isci_device = %p request = %p\n", 93 93 __func__, idev, ireq); 94 94 95 - scic_controller_terminate_request(&ihost->sci, 95 + scic_controller_terminate_request(ihost, 96 96 idev, 97 97 ireq); 98 98 } ··· 104 104 } 105 105 106 106 /** 107 - * isci_remote_device_ready() - This function is called by the scic when the 107 + * isci_remote_device_ready() - This function is called by the ihost when the 108 108 * remote device is ready. We mark the isci device as ready and signal the 109 109 * waiting proccess. 110 110 * @ihost: our valid isci_host ··· 135 135 136 136 static enum sci_status scic_sds_remote_device_terminate_requests(struct isci_remote_device *idev) 137 137 { 138 - struct scic_sds_controller *scic = idev->owning_port->owning_controller; 139 - struct isci_host *ihost = scic_to_ihost(scic); 138 + struct isci_host *ihost = idev->owning_port->owning_controller; 140 139 enum sci_status status = SCI_SUCCESS; 141 140 u32 i; 142 141 ··· 147 148 ireq->target_device != idev) 148 149 continue; 149 150 150 - s = scic_controller_terminate_request(scic, idev, ireq); 151 + s = scic_controller_terminate_request(ihost, idev, ireq); 151 152 if (s != SCI_SUCCESS) 152 153 status = s; 153 154 } ··· 275 276 { 276 277 struct sci_base_state_machine *sm = &idev->sm; 277 278 enum scic_sds_remote_device_states state = sm->current_state_id; 278 - struct scic_sds_controller *scic = idev->owning_port->owning_controller; 279 + struct isci_host *ihost = idev->owning_port->owning_controller; 279 280 enum sci_status status; 280 281 281 282 switch (state) { ··· 289 290 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", 290 291 __func__, state); 291 292 /* Return the frame back to the controller */ 292 - scic_sds_controller_release_frame(scic, frame_index); 293 + scic_sds_controller_release_frame(ihost, frame_index); 293 294 return SCI_FAILURE_INVALID_STATE; 294 295 case SCI_DEV_READY: 295 296 case SCI_STP_DEV_NCQ_ERROR: ··· 302 303 void *frame_header; 303 304 ssize_t word_cnt; 304 305 305 - status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 306 + status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 306 307 frame_index, 307 308 &frame_header); 308 309 if (status != SCI_SUCCESS) ··· 311 312 word_cnt = sizeof(hdr) / sizeof(u32); 312 313 sci_swab32_cpy(&hdr, frame_header, word_cnt); 313 314 314 - ireq = scic_request_by_tag(scic, be16_to_cpu(hdr.tag)); 315 + ireq = scic_request_by_tag(ihost, be16_to_cpu(hdr.tag)); 315 316 if (ireq && ireq->target_device == idev) { 316 317 /* The IO request is now in charge of releasing the frame */ 317 318 status = scic_sds_io_request_frame_handler(ireq, frame_index); ··· 319 320 /* We could not map this tag to a valid IO 320 321 * request Just toss the frame and continue 321 322 */ 322 - scic_sds_controller_release_frame(scic, frame_index); 323 + scic_sds_controller_release_frame(ihost, frame_index); 323 324 } 324 325 break; 325 326 } 326 327 case SCI_STP_DEV_NCQ: { 327 328 struct dev_to_host_fis *hdr; 328 329 329 - status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 330 + status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 330 331 frame_index, 331 332 (void **)&hdr); 332 333 if (status != SCI_SUCCESS) ··· 349 350 } else 350 351 status = SCI_FAILURE; 351 352 352 - scic_sds_controller_release_frame(scic, frame_index); 353 + scic_sds_controller_release_frame(ihost, frame_index); 353 354 break; 354 355 } 355 356 case SCI_STP_DEV_CMD: ··· 460 461 } 461 462 } 462 463 463 - enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic, 464 + enum sci_status scic_sds_remote_device_start_io(struct isci_host *ihost, 464 465 struct isci_remote_device *idev, 465 466 struct isci_request *ireq) 466 467 { ··· 596 597 return status; 597 598 } 598 599 599 - enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *scic, 600 + enum sci_status scic_sds_remote_device_complete_io(struct isci_host *ihost, 600 601 struct isci_remote_device *idev, 601 602 struct isci_request *ireq) 602 603 { ··· 677 678 scic_controller_continue_io(idev->working_request); 678 679 } 679 680 680 - enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *scic, 681 + enum sci_status scic_sds_remote_device_start_task(struct isci_host *ihost, 681 682 struct isci_remote_device *idev, 682 683 struct isci_request *ireq) 683 684 { ··· 801 802 static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *_dev) 802 803 { 803 804 struct isci_remote_device *idev = _dev; 804 - struct scic_sds_controller *scic = idev->owning_port->owning_controller; 805 + struct isci_host *ihost = idev->owning_port->owning_controller; 805 806 806 807 /* For NCQ operation we do not issue a isci_remote_device_not_ready(). 807 808 * As a result, avoid sending the ready notification. 808 809 */ 809 810 if (idev->sm.previous_state_id != SCI_STP_DEV_NCQ) 810 - isci_remote_device_ready(scic_to_ihost(scic), idev); 811 + isci_remote_device_ready(ihost, idev); 811 812 } 812 813 813 814 static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_machine *sm) ··· 835 836 { 836 837 struct sci_base_state_machine *sm = &idev->sm; 837 838 enum scic_sds_remote_device_states state = sm->current_state_id; 838 - struct scic_sds_controller *scic; 839 + struct isci_host *ihost; 839 840 840 841 if (state != SCI_DEV_STOPPED) { 841 842 dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", ··· 843 844 return SCI_FAILURE_INVALID_STATE; 844 845 } 845 846 846 - scic = idev->owning_port->owning_controller; 847 - scic_sds_controller_free_remote_node_context(scic, idev, 847 + ihost = idev->owning_port->owning_controller; 848 + scic_sds_controller_free_remote_node_context(ihost, idev, 848 849 idev->rnc.remote_node_index); 849 850 idev->rnc.remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX; 850 851 sci_change_state(sm, SCI_DEV_FINAL); ··· 877 878 static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_machine *sm) 878 879 { 879 880 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 880 - struct scic_sds_controller *scic = idev->owning_port->owning_controller; 881 + struct isci_host *ihost = idev->owning_port->owning_controller; 881 882 u32 prev_state; 882 883 883 884 /* If we are entering from the stopping state let the SCI User know that ··· 885 886 */ 886 887 prev_state = idev->sm.previous_state_id; 887 888 if (prev_state == SCI_DEV_STOPPING) 888 - isci_remote_device_deconstruct(scic_to_ihost(scic), idev); 889 + isci_remote_device_deconstruct(ihost, idev); 889 890 890 - scic_sds_controller_remote_device_stopped(scic, idev); 891 + scic_sds_controller_remote_device_stopped(ihost, idev); 891 892 } 892 893 893 894 static void scic_sds_remote_device_starting_state_enter(struct sci_base_state_machine *sm) 894 895 { 895 896 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 896 - struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); 897 - struct isci_host *ihost = scic_to_ihost(scic); 897 + struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 898 898 899 899 isci_remote_device_not_ready(ihost, idev, 900 900 SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED); ··· 902 904 static void scic_sds_remote_device_ready_state_enter(struct sci_base_state_machine *sm) 903 905 { 904 906 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 905 - struct scic_sds_controller *scic = idev->owning_port->owning_controller; 907 + struct isci_host *ihost = idev->owning_port->owning_controller; 906 908 struct domain_device *dev = idev->domain_dev; 907 909 908 910 if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_SATA)) { ··· 910 912 } else if (dev_is_expander(dev)) { 911 913 sci_change_state(&idev->sm, SCI_SMP_DEV_IDLE); 912 914 } else 913 - isci_remote_device_ready(scic_to_ihost(scic), idev); 915 + isci_remote_device_ready(ihost, idev); 914 916 } 915 917 916 918 static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machine *sm) ··· 919 921 struct domain_device *dev = idev->domain_dev; 920 922 921 923 if (dev->dev_type == SAS_END_DEV) { 922 - struct scic_sds_controller *scic = idev->owning_port->owning_controller; 924 + struct isci_host *ihost = idev->owning_port->owning_controller; 923 925 924 - isci_remote_device_not_ready(scic_to_ihost(scic), idev, 926 + isci_remote_device_not_ready(ihost, idev, 925 927 SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED); 926 928 } 927 929 } ··· 961 963 static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) 962 964 { 963 965 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 964 - struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); 966 + struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 965 967 966 968 BUG_ON(idev->working_request == NULL); 967 969 968 - isci_remote_device_not_ready(scic_to_ihost(scic), idev, 970 + isci_remote_device_not_ready(ihost, idev, 969 971 SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED); 970 972 } 971 973 972 974 static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm) 973 975 { 974 976 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 975 - struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); 977 + struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 976 978 977 979 if (idev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED) 978 - isci_remote_device_not_ready(scic_to_ihost(scic), idev, 980 + isci_remote_device_not_ready(ihost, idev, 979 981 idev->not_ready_reason); 980 982 } 981 983 982 984 static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) 983 985 { 984 986 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 985 - struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); 987 + struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 986 988 987 - isci_remote_device_ready(scic_to_ihost(scic), idev); 989 + isci_remote_device_ready(ihost, idev); 988 990 } 989 991 990 992 static void scic_sds_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) 991 993 { 992 994 struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); 993 - struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); 995 + struct isci_host *ihost = scic_sds_remote_device_get_controller(idev); 994 996 995 997 BUG_ON(idev->working_request == NULL); 996 998 997 - isci_remote_device_not_ready(scic_to_ihost(scic), idev, 999 + isci_remote_device_not_ready(ihost, idev, 998 1000 SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED); 999 1001 } 1000 1002 ··· 1301 1303 * @isci_host: This parameter specifies the isci host object. 1302 1304 * @isci_device: This parameter specifies the remote device. 1303 1305 * 1304 - * The status of the scic request to stop. 1306 + * The status of the ihost request to stop. 1305 1307 */ 1306 1308 enum sci_status isci_remote_device_stop(struct isci_host *ihost, struct isci_remote_device *idev) 1307 1309 {
+3 -3
drivers/scsi/isci/remote_device.h
··· 402 402 u32 event_code); 403 403 404 404 enum sci_status scic_sds_remote_device_start_io( 405 - struct scic_sds_controller *controller, 405 + struct isci_host *ihost, 406 406 struct isci_remote_device *idev, 407 407 struct isci_request *ireq); 408 408 409 409 enum sci_status scic_sds_remote_device_start_task( 410 - struct scic_sds_controller *controller, 410 + struct isci_host *ihost, 411 411 struct isci_remote_device *idev, 412 412 struct isci_request *ireq); 413 413 414 414 enum sci_status scic_sds_remote_device_complete_io( 415 - struct scic_sds_controller *controller, 415 + struct isci_host *ihost, 416 416 struct isci_remote_device *idev, 417 417 struct isci_request *ireq); 418 418
+7 -7
drivers/scsi/isci/remote_node_context.c
··· 107 107 struct domain_device *dev = idev->domain_dev; 108 108 int rni = sci_rnc->remote_node_index; 109 109 union scu_remote_node_context *rnc; 110 - struct scic_sds_controller *scic; 110 + struct isci_host *ihost; 111 111 __le64 sas_addr; 112 112 113 - scic = scic_sds_remote_device_get_controller(idev); 114 - rnc = scic_sds_controller_get_remote_node_context_buffer(scic, rni); 113 + ihost = scic_sds_remote_device_get_controller(idev); 114 + rnc = scic_sds_controller_get_remote_node_context_buffer(ihost, rni); 115 115 116 116 memset(rnc, 0, sizeof(union scu_remote_node_context) 117 117 * scic_sds_remote_device_node_count(idev)); ··· 135 135 136 136 if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { 137 137 rnc->ssp.connection_occupancy_timeout = 138 - scic->user_parameters.sds1.stp_max_occupancy_timeout; 138 + ihost->user_parameters.sds1.stp_max_occupancy_timeout; 139 139 rnc->ssp.connection_inactivity_timeout = 140 - scic->user_parameters.sds1.stp_inactivity_timeout; 140 + ihost->user_parameters.sds1.stp_inactivity_timeout; 141 141 } else { 142 142 rnc->ssp.connection_occupancy_timeout = 143 - scic->user_parameters.sds1.ssp_max_occupancy_timeout; 143 + ihost->user_parameters.sds1.ssp_max_occupancy_timeout; 144 144 rnc->ssp.connection_inactivity_timeout = 145 - scic->user_parameters.sds1.ssp_inactivity_timeout; 145 + ihost->user_parameters.sds1.ssp_inactivity_timeout; 146 146 } 147 147 148 148 rnc->ssp.initial_arbitration_wait_time = 0;
+98 -102
drivers/scsi/isci/request.c
··· 74 74 return &ireq->sg_table[idx - 2]; 75 75 } 76 76 77 - static dma_addr_t to_sgl_element_pair_dma(struct scic_sds_controller *scic, 77 + static dma_addr_t to_sgl_element_pair_dma(struct isci_host *ihost, 78 78 struct isci_request *ireq, u32 idx) 79 79 { 80 80 u32 offset; 81 81 82 82 if (idx == 0) { 83 83 offset = (void *) &ireq->tc->sgl_pair_ab - 84 - (void *) &scic->task_context_table[0]; 85 - return scic->task_context_dma + offset; 84 + (void *) &ihost->task_context_table[0]; 85 + return ihost->task_context_dma + offset; 86 86 } else if (idx == 1) { 87 87 offset = (void *) &ireq->tc->sgl_pair_cd - 88 - (void *) &scic->task_context_table[0]; 89 - return scic->task_context_dma + offset; 88 + (void *) &ihost->task_context_table[0]; 89 + return ihost->task_context_dma + offset; 90 90 } 91 91 92 92 return scic_io_request_get_dma_addr(ireq, &ireq->sg_table[idx - 2]); ··· 102 102 103 103 static void scic_sds_request_build_sgl(struct isci_request *ireq) 104 104 { 105 - struct isci_host *isci_host = ireq->isci_host; 106 - struct scic_sds_controller *scic = &isci_host->sci; 105 + struct isci_host *ihost = ireq->isci_host; 107 106 struct sas_task *task = isci_request_access_task(ireq); 108 107 struct scatterlist *sg = NULL; 109 108 dma_addr_t dma_addr; ··· 124 125 memset(&scu_sg->B, 0, sizeof(scu_sg->B)); 125 126 126 127 if (prev_sg) { 127 - dma_addr = to_sgl_element_pair_dma(scic, 128 + dma_addr = to_sgl_element_pair_dma(ihost, 128 129 ireq, 129 130 sg_idx); 130 131 ··· 140 141 } else { /* handle when no sg */ 141 142 scu_sg = to_sgl_element_pair(ireq, sg_idx); 142 143 143 - dma_addr = dma_map_single(&isci_host->pdev->dev, 144 + dma_addr = dma_map_single(&ihost->pdev->dev, 144 145 task->scatter, 145 146 task->total_xfer_len, 146 147 task->data_dir); ··· 507 508 scu_stp_raw_request_construct_task_context(ireq); 508 509 return SCI_SUCCESS; 509 510 } else { 510 - dev_err(scic_to_dev(ireq->owning_controller), 511 + dev_err(&ireq->owning_controller->pdev->dev, 511 512 "%s: Request 0x%p received un-handled SAT " 512 513 "management protocol 0x%x.\n", 513 514 __func__, ireq, tmf->tmf_code); ··· 517 518 } 518 519 519 520 if (!sas_protocol_ata(task->task_proto)) { 520 - dev_err(scic_to_dev(ireq->owning_controller), 521 + dev_err(&ireq->owning_controller->pdev->dev, 521 522 "%s: Non-ATA protocol in SATA path: 0x%x\n", 522 523 __func__, 523 524 task->task_proto); ··· 615 616 tmf->tmf_code == isci_tmf_sata_srst_low) { 616 617 scu_stp_raw_request_construct_task_context(ireq); 617 618 } else { 618 - dev_err(scic_to_dev(ireq->owning_controller), 619 + dev_err(&ireq->owning_controller->pdev->dev, 619 620 "%s: Request 0x%p received un-handled SAT " 620 621 "Protocol 0x%x.\n", 621 622 __func__, ireq, tmf->tmf_code); ··· 638 639 #define SCU_TASK_CONTEXT_SRAM 0x200000 639 640 static u32 sci_req_tx_bytes(struct isci_request *ireq) 640 641 { 641 - struct scic_sds_controller *scic = ireq->owning_controller; 642 + struct isci_host *ihost = ireq->owning_controller; 642 643 u32 ret_val = 0; 643 644 644 - if (readl(&scic->smu_registers->address_modifier) == 0) { 645 - void __iomem *scu_reg_base = scic->scu_registers; 645 + if (readl(&ihost->smu_registers->address_modifier) == 0) { 646 + void __iomem *scu_reg_base = ihost->scu_registers; 646 647 647 648 /* get the bytes of data from the Address == BAR1 + 20002Ch + (256*TCi) where 648 649 * BAR1 is the scu_registers ··· 662 663 { 663 664 enum sci_base_request_states state; 664 665 struct scu_task_context *tc = ireq->tc; 665 - struct scic_sds_controller *scic = ireq->owning_controller; 666 + struct isci_host *ihost = ireq->owning_controller; 666 667 667 668 state = ireq->sm.current_state_id; 668 669 if (state != SCI_REQ_CONSTRUCTED) { 669 - dev_warn(scic_to_dev(scic), 670 + dev_warn(&ihost->pdev->dev, 670 671 "%s: SCIC IO Request requested to start while in wrong " 671 672 "state %d\n", __func__, state); 672 673 return SCI_FAILURE_INVALID_STATE; ··· 748 749 return SCI_SUCCESS; 749 750 case SCI_REQ_COMPLETED: 750 751 default: 751 - dev_warn(scic_to_dev(ireq->owning_controller), 752 + dev_warn(&ireq->owning_controller->pdev->dev, 752 753 "%s: SCIC IO Request requested to abort while in wrong " 753 754 "state %d\n", 754 755 __func__, ··· 762 763 enum sci_status scic_sds_request_complete(struct isci_request *ireq) 763 764 { 764 765 enum sci_base_request_states state; 765 - struct scic_sds_controller *scic = ireq->owning_controller; 766 + struct isci_host *ihost = ireq->owning_controller; 766 767 767 768 state = ireq->sm.current_state_id; 768 769 if (WARN_ONCE(state != SCI_REQ_COMPLETED, ··· 770 771 return SCI_FAILURE_INVALID_STATE; 771 772 772 773 if (ireq->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) 773 - scic_sds_controller_release_frame(scic, 774 + scic_sds_controller_release_frame(ihost, 774 775 ireq->saved_rx_frame_index); 775 776 776 777 /* XXX can we just stop the machine and remove the 'final' state? */ ··· 782 783 u32 event_code) 783 784 { 784 785 enum sci_base_request_states state; 785 - struct scic_sds_controller *scic = ireq->owning_controller; 786 + struct isci_host *ihost = ireq->owning_controller; 786 787 787 788 state = ireq->sm.current_state_id; 788 789 789 790 if (state != SCI_REQ_STP_PIO_DATA_IN) { 790 - dev_warn(scic_to_dev(scic), "%s: (%x) in wrong state %d\n", 791 + dev_warn(&ihost->pdev->dev, "%s: (%x) in wrong state %d\n", 791 792 __func__, event_code, state); 792 793 793 794 return SCI_FAILURE_INVALID_STATE; ··· 801 802 sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); 802 803 return SCI_SUCCESS; 803 804 default: 804 - dev_err(scic_to_dev(scic), 805 + dev_err(&ihost->pdev->dev, 805 806 "%s: pio request unexpected event %#x\n", 806 807 __func__, event_code); 807 808 ··· 1023 1024 * There is a potential for receiving multiple task responses if 1024 1025 * we decide to send the task IU again. 1025 1026 */ 1026 - dev_warn(scic_to_dev(ireq->owning_controller), 1027 + dev_warn(&ireq->owning_controller->pdev->dev, 1027 1028 "%s: TaskRequest:0x%p CompletionCode:%x - " 1028 1029 "ACK/NAK timeout\n", __func__, ireq, 1029 1030 completion_code); ··· 1072 1073 * response within 2 ms. This causes our hardware break 1073 1074 * the connection and set TC completion with one of 1074 1075 * these SMP_XXX_XX_ERR status. For these type of error, 1075 - * we ask scic user to retry the request. 1076 + * we ask ihost user to retry the request. 1076 1077 */ 1077 1078 scic_sds_request_set_status(ireq, SCU_TASK_DONE_SMP_RESP_TO_ERR, 1078 1079 SCI_FAILURE_RETRY_REQUIRED); ··· 1450 1451 static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct isci_request *ireq, 1451 1452 u32 frame_index) 1452 1453 { 1453 - struct scic_sds_controller *scic = ireq->owning_controller; 1454 + struct isci_host *ihost = ireq->owning_controller; 1454 1455 struct dev_to_host_fis *frame_header; 1455 1456 enum sci_status status; 1456 1457 u32 *frame_buffer; 1457 1458 1458 - status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 1459 + status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 1459 1460 frame_index, 1460 1461 (void **)&frame_header); 1461 1462 1462 1463 if ((status == SCI_SUCCESS) && 1463 1464 (frame_header->fis_type == FIS_REGD2H)) { 1464 - scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, 1465 + scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, 1465 1466 frame_index, 1466 1467 (void **)&frame_buffer); 1467 1468 ··· 1470 1471 frame_buffer); 1471 1472 } 1472 1473 1473 - scic_sds_controller_release_frame(scic, frame_index); 1474 + scic_sds_controller_release_frame(ihost, frame_index); 1474 1475 1475 1476 return status; 1476 1477 } ··· 1479 1480 scic_sds_io_request_frame_handler(struct isci_request *ireq, 1480 1481 u32 frame_index) 1481 1482 { 1482 - struct scic_sds_controller *scic = ireq->owning_controller; 1483 + struct isci_host *ihost = ireq->owning_controller; 1483 1484 struct isci_stp_request *stp_req = &ireq->stp.req; 1484 1485 enum sci_base_request_states state; 1485 1486 enum sci_status status; ··· 1491 1492 struct ssp_frame_hdr ssp_hdr; 1492 1493 void *frame_header; 1493 1494 1494 - scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 1495 + scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 1495 1496 frame_index, 1496 1497 &frame_header); 1497 1498 ··· 1502 1503 struct ssp_response_iu *resp_iu; 1503 1504 ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32); 1504 1505 1505 - scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, 1506 + scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, 1506 1507 frame_index, 1507 1508 (void **)&resp_iu); 1508 1509 ··· 1521 1522 SCI_SUCCESS); 1522 1523 } else { 1523 1524 /* not a response frame, why did it get forwarded? */ 1524 - dev_err(scic_to_dev(scic), 1525 + dev_err(&ihost->pdev->dev, 1525 1526 "%s: SCIC IO Request 0x%p received unexpected " 1526 1527 "frame %d type 0x%02x\n", __func__, ireq, 1527 1528 frame_index, ssp_hdr.frame_type); ··· 1531 1532 * In any case we are done with this frame buffer return it to 1532 1533 * the controller 1533 1534 */ 1534 - scic_sds_controller_release_frame(scic, frame_index); 1535 + scic_sds_controller_release_frame(ihost, frame_index); 1535 1536 1536 1537 return SCI_SUCCESS; 1537 1538 } ··· 1539 1540 case SCI_REQ_TASK_WAIT_TC_RESP: 1540 1541 scic_sds_io_request_copy_response(ireq); 1541 1542 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); 1542 - scic_sds_controller_release_frame(scic,frame_index); 1543 + scic_sds_controller_release_frame(ihost,frame_index); 1543 1544 return SCI_SUCCESS; 1544 1545 1545 1546 case SCI_REQ_SMP_WAIT_RESP: { 1546 1547 struct smp_resp *rsp_hdr = &ireq->smp.rsp; 1547 1548 void *frame_header; 1548 1549 1549 - scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 1550 + scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 1550 1551 frame_index, 1551 1552 &frame_header); 1552 1553 ··· 1557 1558 if (rsp_hdr->frame_type == SMP_RESPONSE) { 1558 1559 void *smp_resp; 1559 1560 1560 - scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, 1561 + scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, 1561 1562 frame_index, 1562 1563 &smp_resp); 1563 1564 ··· 1576 1577 * This was not a response frame why did it get 1577 1578 * forwarded? 1578 1579 */ 1579 - dev_err(scic_to_dev(scic), 1580 + dev_err(&ihost->pdev->dev, 1580 1581 "%s: SCIC SMP Request 0x%p received unexpected " 1581 1582 "frame %d type 0x%02x\n", 1582 1583 __func__, ··· 1591 1592 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); 1592 1593 } 1593 1594 1594 - scic_sds_controller_release_frame(scic, frame_index); 1595 + scic_sds_controller_release_frame(ihost, frame_index); 1595 1596 1596 1597 return SCI_SUCCESS; 1597 1598 } ··· 1618 1619 struct dev_to_host_fis *frame_header; 1619 1620 u32 *frame_buffer; 1620 1621 1621 - status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 1622 + status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 1622 1623 frame_index, 1623 1624 (void **)&frame_header); 1624 1625 1625 1626 if (status != SCI_SUCCESS) { 1626 - dev_err(scic_to_dev(scic), 1627 + dev_err(&ihost->pdev->dev, 1627 1628 "%s: SCIC IO Request 0x%p could not get frame " 1628 1629 "header for frame index %d, status %x\n", 1629 1630 __func__, ··· 1636 1637 1637 1638 switch (frame_header->fis_type) { 1638 1639 case FIS_REGD2H: 1639 - scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, 1640 + scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, 1640 1641 frame_index, 1641 1642 (void **)&frame_buffer); 1642 1643 ··· 1650 1651 break; 1651 1652 1652 1653 default: 1653 - dev_warn(scic_to_dev(scic), 1654 + dev_warn(&ihost->pdev->dev, 1654 1655 "%s: IO Request:0x%p Frame Id:%d protocol " 1655 1656 "violation occurred\n", __func__, stp_req, 1656 1657 frame_index); ··· 1663 1664 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); 1664 1665 1665 1666 /* Frame has been decoded return it to the controller */ 1666 - scic_sds_controller_release_frame(scic, frame_index); 1667 + scic_sds_controller_release_frame(ihost, frame_index); 1667 1668 1668 1669 return status; 1669 1670 } ··· 1673 1674 struct dev_to_host_fis *frame_header; 1674 1675 u32 *frame_buffer; 1675 1676 1676 - status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 1677 + status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 1677 1678 frame_index, 1678 1679 (void **)&frame_header); 1679 1680 1680 1681 if (status != SCI_SUCCESS) { 1681 - dev_err(scic_to_dev(scic), 1682 + dev_err(&ihost->pdev->dev, 1682 1683 "%s: SCIC IO Request 0x%p could not get frame " 1683 1684 "header for frame index %d, status %x\n", 1684 1685 __func__, stp_req, frame_index, status); ··· 1688 1689 switch (frame_header->fis_type) { 1689 1690 case FIS_PIO_SETUP: 1690 1691 /* Get from the frame buffer the PIO Setup Data */ 1691 - scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, 1692 + scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, 1692 1693 frame_index, 1693 1694 (void **)&frame_buffer); 1694 1695 ··· 1735 1736 * FIS when it is still busy? Do nothing since 1736 1737 * we are still in the right state. 1737 1738 */ 1738 - dev_dbg(scic_to_dev(scic), 1739 + dev_dbg(&ihost->pdev->dev, 1739 1740 "%s: SCIC PIO Request 0x%p received " 1740 1741 "D2H Register FIS with BSY status " 1741 1742 "0x%x\n", ··· 1745 1746 break; 1746 1747 } 1747 1748 1748 - scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, 1749 + scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, 1749 1750 frame_index, 1750 1751 (void **)&frame_buffer); 1751 1752 ··· 1766 1767 } 1767 1768 1768 1769 /* Frame is decoded return it to the controller */ 1769 - scic_sds_controller_release_frame(scic, frame_index); 1770 + scic_sds_controller_release_frame(ihost, frame_index); 1770 1771 1771 1772 return status; 1772 1773 } ··· 1775 1776 struct dev_to_host_fis *frame_header; 1776 1777 struct sata_fis_data *frame_buffer; 1777 1778 1778 - status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 1779 + status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 1779 1780 frame_index, 1780 1781 (void **)&frame_header); 1781 1782 1782 1783 if (status != SCI_SUCCESS) { 1783 - dev_err(scic_to_dev(scic), 1784 + dev_err(&ihost->pdev->dev, 1784 1785 "%s: SCIC IO Request 0x%p could not get frame " 1785 1786 "header for frame index %d, status %x\n", 1786 1787 __func__, ··· 1791 1792 } 1792 1793 1793 1794 if (frame_header->fis_type != FIS_DATA) { 1794 - dev_err(scic_to_dev(scic), 1795 + dev_err(&ihost->pdev->dev, 1795 1796 "%s: SCIC PIO Request 0x%p received frame %d " 1796 1797 "with fis type 0x%02x when expecting a data " 1797 1798 "fis.\n", ··· 1807 1808 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); 1808 1809 1809 1810 /* Frame is decoded return it to the controller */ 1810 - scic_sds_controller_release_frame(scic, frame_index); 1811 + scic_sds_controller_release_frame(ihost, frame_index); 1811 1812 return status; 1812 1813 } 1813 1814 ··· 1815 1816 ireq->saved_rx_frame_index = frame_index; 1816 1817 stp_req->pio_len = 0; 1817 1818 } else { 1818 - scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, 1819 + scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, 1819 1820 frame_index, 1820 1821 (void **)&frame_buffer); 1821 1822 ··· 1823 1824 (u8 *)frame_buffer); 1824 1825 1825 1826 /* Frame is decoded return it to the controller */ 1826 - scic_sds_controller_release_frame(scic, frame_index); 1827 + scic_sds_controller_release_frame(ihost, frame_index); 1827 1828 } 1828 1829 1829 1830 /* Check for the end of the transfer, are there more ··· 1848 1849 struct dev_to_host_fis *frame_header; 1849 1850 u32 *frame_buffer; 1850 1851 1851 - status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 1852 + status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, 1852 1853 frame_index, 1853 1854 (void **)&frame_header); 1854 1855 if (status != SCI_SUCCESS) { 1855 - dev_err(scic_to_dev(scic), 1856 + dev_err(&ihost->pdev->dev, 1856 1857 "%s: SCIC IO Request 0x%p could not get frame " 1857 1858 "header for frame index %d, status %x\n", 1858 1859 __func__, ··· 1864 1865 1865 1866 switch (frame_header->fis_type) { 1866 1867 case FIS_REGD2H: 1867 - scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, 1868 + scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, 1868 1869 frame_index, 1869 1870 (void **)&frame_buffer); 1870 1871 ··· 1879 1880 break; 1880 1881 1881 1882 default: 1882 - dev_warn(scic_to_dev(scic), 1883 + dev_warn(&ihost->pdev->dev, 1883 1884 "%s: IO Request:0x%p Frame Id:%d protocol " 1884 1885 "violation occurred\n", 1885 1886 __func__, ··· 1895 1896 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); 1896 1897 1897 1898 /* Frame has been decoded return it to the controller */ 1898 - scic_sds_controller_release_frame(scic, frame_index); 1899 + scic_sds_controller_release_frame(ihost, frame_index); 1899 1900 1900 1901 return status; 1901 1902 } ··· 1904 1905 * TODO: Is it even possible to get an unsolicited frame in the 1905 1906 * aborting state? 1906 1907 */ 1907 - scic_sds_controller_release_frame(scic, frame_index); 1908 + scic_sds_controller_release_frame(ihost, frame_index); 1908 1909 return SCI_SUCCESS; 1909 1910 1910 1911 default: 1911 - dev_warn(scic_to_dev(scic), 1912 + dev_warn(&ihost->pdev->dev, 1912 1913 "%s: SCIC IO Request given unexpected frame %x while " 1913 1914 "in state %d\n", 1914 1915 __func__, 1915 1916 frame_index, 1916 1917 state); 1917 1918 1918 - scic_sds_controller_release_frame(scic, frame_index); 1919 + scic_sds_controller_release_frame(ihost, frame_index); 1919 1920 return SCI_FAILURE_INVALID_STATE; 1920 1921 } 1921 1922 } ··· 2041 2042 u32 completion_code) 2042 2043 { 2043 2044 enum sci_base_request_states state; 2044 - struct scic_sds_controller *scic = ireq->owning_controller; 2045 + struct isci_host *ihost = ireq->owning_controller; 2045 2046 2046 2047 state = ireq->sm.current_state_id; 2047 2048 ··· 2088 2089 completion_code); 2089 2090 2090 2091 default: 2091 - dev_warn(scic_to_dev(scic), 2092 + dev_warn(&ihost->pdev->dev, 2092 2093 "%s: SCIC IO Request given task completion " 2093 2094 "notification %x while in wrong state %d\n", 2094 2095 __func__, ··· 2479 2480 } 2480 2481 } 2481 2482 2482 - static void isci_request_io_request_complete(struct isci_host *isci_host, 2483 + static void isci_request_io_request_complete(struct isci_host *ihost, 2483 2484 struct isci_request *request, 2484 2485 enum sci_io_status completion_status) 2485 2486 { ··· 2494 2495 enum isci_completion_selection complete_to_host 2495 2496 = isci_perform_normal_io_completion; 2496 2497 2497 - dev_dbg(&isci_host->pdev->dev, 2498 + dev_dbg(&ihost->pdev->dev, 2498 2499 "%s: request = %p, task = %p,\n" 2499 2500 "task->data_dir = %d completion_status = 0x%x\n", 2500 2501 __func__, ··· 2615 2616 switch (completion_status) { 2616 2617 2617 2618 case SCI_IO_FAILURE_RESPONSE_VALID: 2618 - dev_dbg(&isci_host->pdev->dev, 2619 + dev_dbg(&ihost->pdev->dev, 2619 2620 "%s: SCI_IO_FAILURE_RESPONSE_VALID (%p/%p)\n", 2620 2621 __func__, 2621 2622 request, ··· 2630 2631 /* crack the iu response buffer. */ 2631 2632 resp_iu = &request->ssp.rsp; 2632 2633 isci_request_process_response_iu(task, resp_iu, 2633 - &isci_host->pdev->dev); 2634 + &ihost->pdev->dev); 2634 2635 2635 2636 } else if (SAS_PROTOCOL_SMP == task->task_proto) { 2636 2637 2637 - dev_err(&isci_host->pdev->dev, 2638 + dev_err(&ihost->pdev->dev, 2638 2639 "%s: SCI_IO_FAILURE_RESPONSE_VALID: " 2639 2640 "SAS_PROTOCOL_SMP protocol\n", 2640 2641 __func__); 2641 2642 2642 2643 } else 2643 - dev_err(&isci_host->pdev->dev, 2644 + dev_err(&ihost->pdev->dev, 2644 2645 "%s: unknown protocol\n", __func__); 2645 2646 2646 2647 /* use the task status set in the task struct by the ··· 2661 2662 if (task->task_proto == SAS_PROTOCOL_SMP) { 2662 2663 void *rsp = &request->smp.rsp; 2663 2664 2664 - dev_dbg(&isci_host->pdev->dev, 2665 + dev_dbg(&ihost->pdev->dev, 2665 2666 "%s: SMP protocol completion\n", 2666 2667 __func__); 2667 2668 ··· 2686 2687 if (task->task_status.residual != 0) 2687 2688 status = SAS_DATA_UNDERRUN; 2688 2689 2689 - dev_dbg(&isci_host->pdev->dev, 2690 + dev_dbg(&ihost->pdev->dev, 2690 2691 "%s: SCI_IO_SUCCESS_IO_DONE_EARLY %d\n", 2691 2692 __func__, 2692 2693 status); 2693 2694 2694 2695 } else 2695 - dev_dbg(&isci_host->pdev->dev, 2696 + dev_dbg(&ihost->pdev->dev, 2696 2697 "%s: SCI_IO_SUCCESS\n", 2697 2698 __func__); 2698 2699 2699 2700 break; 2700 2701 2701 2702 case SCI_IO_FAILURE_TERMINATED: 2702 - dev_dbg(&isci_host->pdev->dev, 2703 + dev_dbg(&ihost->pdev->dev, 2703 2704 "%s: SCI_IO_FAILURE_TERMINATED (%p/%p)\n", 2704 2705 __func__, 2705 2706 request, ··· 2767 2768 2768 2769 default: 2769 2770 /* Catch any otherwise unhandled error codes here. */ 2770 - dev_warn(&isci_host->pdev->dev, 2771 + dev_warn(&ihost->pdev->dev, 2771 2772 "%s: invalid completion code: 0x%x - " 2772 2773 "isci_request = %p\n", 2773 2774 __func__, completion_status, request); ··· 2801 2802 break; 2802 2803 if (task->num_scatter == 0) 2803 2804 /* 0 indicates a single dma address */ 2804 - dma_unmap_single(&isci_host->pdev->dev, 2805 + dma_unmap_single(&ihost->pdev->dev, 2805 2806 request->zero_scatter_daddr, 2806 2807 task->total_xfer_len, task->data_dir); 2807 2808 else /* unmap the sgl dma addresses */ 2808 - dma_unmap_sg(&isci_host->pdev->dev, task->scatter, 2809 + dma_unmap_sg(&ihost->pdev->dev, task->scatter, 2809 2810 request->num_sg_entries, task->data_dir); 2810 2811 break; 2811 2812 case SAS_PROTOCOL_SMP: { ··· 2813 2814 struct smp_req *smp_req; 2814 2815 void *kaddr; 2815 2816 2816 - dma_unmap_sg(&isci_host->pdev->dev, sg, 1, DMA_TO_DEVICE); 2817 + dma_unmap_sg(&ihost->pdev->dev, sg, 1, DMA_TO_DEVICE); 2817 2818 2818 2819 /* need to swab it back in case the command buffer is re-used */ 2819 2820 kaddr = kmap_atomic(sg_page(sg), KM_IRQ0); ··· 2827 2828 } 2828 2829 2829 2830 /* Put the completed request on the correct list */ 2830 - isci_task_save_for_upper_layer_completion(isci_host, request, response, 2831 + isci_task_save_for_upper_layer_completion(ihost, request, response, 2831 2832 status, complete_to_host 2832 2833 ); 2833 2834 2834 2835 /* complete the io request to the core. */ 2835 - scic_controller_complete_io(&isci_host->sci, 2836 - request->target_device, 2837 - request); 2836 + scic_controller_complete_io(ihost, request->target_device, request); 2838 2837 isci_put_device(idev); 2839 2838 2840 2839 /* set terminated handle so it cannot be completed or ··· 2882 2885 static void scic_sds_request_completed_state_enter(struct sci_base_state_machine *sm) 2883 2886 { 2884 2887 struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); 2885 - struct scic_sds_controller *scic = ireq->owning_controller; 2886 - struct isci_host *ihost = scic_to_ihost(scic); 2888 + struct isci_host *ihost = ireq->owning_controller; 2887 2889 2888 2890 /* Tell the SCI_USER that the IO request is complete */ 2889 2891 if (!test_bit(IREQ_TMF, &ireq->flags)) ··· 2981 2985 }; 2982 2986 2983 2987 static void 2984 - scic_sds_general_request_construct(struct scic_sds_controller *scic, 2988 + scic_sds_general_request_construct(struct isci_host *ihost, 2985 2989 struct isci_remote_device *idev, 2986 2990 struct isci_request *ireq) 2987 2991 { ··· 2997 3001 } 2998 3002 2999 3003 static enum sci_status 3000 - scic_io_request_construct(struct scic_sds_controller *scic, 3004 + scic_io_request_construct(struct isci_host *ihost, 3001 3005 struct isci_remote_device *idev, 3002 3006 struct isci_request *ireq) 3003 3007 { ··· 3005 3009 enum sci_status status = SCI_SUCCESS; 3006 3010 3007 3011 /* Build the common part of the request */ 3008 - scic_sds_general_request_construct(scic, idev, ireq); 3012 + scic_sds_general_request_construct(ihost, idev, ireq); 3009 3013 3010 3014 if (idev->rnc.remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) 3011 3015 return SCI_FAILURE_INVALID_REMOTE_DEVICE; ··· 3024 3028 return status; 3025 3029 } 3026 3030 3027 - enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, 3031 + enum sci_status scic_task_request_construct(struct isci_host *ihost, 3028 3032 struct isci_remote_device *idev, 3029 3033 u16 io_tag, struct isci_request *ireq) 3030 3034 { ··· 3032 3036 enum sci_status status = SCI_SUCCESS; 3033 3037 3034 3038 /* Build the common part of the request */ 3035 - scic_sds_general_request_construct(scic, idev, ireq); 3039 + scic_sds_general_request_construct(ihost, idev, ireq); 3036 3040 3037 3041 if (dev->dev_type == SAS_END_DEV || 3038 3042 dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { ··· 3152 3156 task_context->initiator_request = 1; 3153 3157 task_context->connection_rate = idev->connection_rate; 3154 3158 task_context->protocol_engine_index = 3155 - scic_sds_controller_get_protocol_engine_group(scic); 3159 + scic_sds_controller_get_protocol_engine_group(ihost); 3156 3160 task_context->logical_port_index = scic_sds_port_get_index(iport); 3157 3161 task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SMP; 3158 3162 task_context->abort = 0; ··· 3195 3199 task_context->task_phase = 0; 3196 3200 3197 3201 ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | 3198 - (scic_sds_controller_get_protocol_engine_group(scic) << 3202 + (scic_sds_controller_get_protocol_engine_group(ihost) << 3199 3203 SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | 3200 3204 (scic_sds_port_get_index(iport) << 3201 3205 SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | ··· 3241 3245 3242 3246 /** 3243 3247 * isci_io_request_build() - This function builds the io request object. 3244 - * @isci_host: This parameter specifies the ISCI host object 3248 + * @ihost: This parameter specifies the ISCI host object 3245 3249 * @request: This parameter points to the isci_request object allocated in the 3246 3250 * request construct function. 3247 3251 * @sci_device: This parameter is the handle for the sci core's remote device ··· 3249 3253 * 3250 3254 * SCI_SUCCESS on successfull completion, or specific failure code. 3251 3255 */ 3252 - static enum sci_status isci_io_request_build(struct isci_host *isci_host, 3256 + static enum sci_status isci_io_request_build(struct isci_host *ihost, 3253 3257 struct isci_request *request, 3254 3258 struct isci_remote_device *idev) 3255 3259 { 3256 3260 enum sci_status status = SCI_SUCCESS; 3257 3261 struct sas_task *task = isci_request_access_task(request); 3258 3262 3259 - dev_dbg(&isci_host->pdev->dev, 3263 + dev_dbg(&ihost->pdev->dev, 3260 3264 "%s: idev = 0x%p; request = %p, " 3261 3265 "num_scatter = %d\n", 3262 3266 __func__, ··· 3273 3277 !(SAS_PROTOCOL_SMP & task->task_proto)) { 3274 3278 3275 3279 request->num_sg_entries = dma_map_sg( 3276 - &isci_host->pdev->dev, 3280 + &ihost->pdev->dev, 3277 3281 task->scatter, 3278 3282 task->num_scatter, 3279 3283 task->data_dir ··· 3283 3287 return SCI_FAILURE_INSUFFICIENT_RESOURCES; 3284 3288 } 3285 3289 3286 - status = scic_io_request_construct(&isci_host->sci, idev, request); 3290 + status = scic_io_request_construct(ihost, idev, request); 3287 3291 3288 3292 if (status != SCI_SUCCESS) { 3289 - dev_warn(&isci_host->pdev->dev, 3293 + dev_warn(&ihost->pdev->dev, 3290 3294 "%s: failed request construct\n", 3291 3295 __func__); 3292 3296 return SCI_FAILURE; ··· 3305 3309 status = isci_request_stp_request_construct(request); 3306 3310 break; 3307 3311 default: 3308 - dev_warn(&isci_host->pdev->dev, 3312 + dev_warn(&ihost->pdev->dev, 3309 3313 "%s: unknown protocol\n", __func__); 3310 3314 return SCI_FAILURE; 3311 3315 } ··· 3388 3392 * request was built that way (ie. 3389 3393 * ireq->is_task_management_request is false). 3390 3394 */ 3391 - status = scic_controller_start_task(&ihost->sci, 3395 + status = scic_controller_start_task(ihost, 3392 3396 idev, 3393 3397 ireq); 3394 3398 } else { ··· 3396 3400 } 3397 3401 } else { 3398 3402 /* send the request, let the core assign the IO TAG. */ 3399 - status = scic_controller_start_io(&ihost->sci, idev, 3403 + status = scic_controller_start_io(ihost, idev, 3400 3404 ireq); 3401 3405 } 3402 3406
+2 -2
drivers/scsi/isci/request.h
··· 145 145 */ 146 146 struct completion *io_request_completion; 147 147 struct sci_base_state_machine sm; 148 - struct scic_sds_controller *owning_controller; 148 + struct isci_host *owning_controller; 149 149 struct isci_remote_device *target_device; 150 150 u16 io_tag; 151 151 enum sci_request_protocol protocol; ··· 500 500 void isci_terminate_pending_requests(struct isci_host *ihost, 501 501 struct isci_remote_device *idev); 502 502 enum sci_status 503 - scic_task_request_construct(struct scic_sds_controller *scic, 503 + scic_task_request_construct(struct isci_host *ihost, 504 504 struct isci_remote_device *idev, 505 505 u16 io_tag, 506 506 struct isci_request *ireq);
+21 -23
drivers/scsi/isci/task.c
··· 257 257 return NULL; 258 258 259 259 /* let the core do it's construct. */ 260 - status = scic_task_request_construct(&ihost->sci, idev, tag, 260 + status = scic_task_request_construct(ihost, idev, tag, 261 261 ireq); 262 262 263 263 if (status != SCI_SUCCESS) { ··· 332 332 spin_lock_irqsave(&ihost->scic_lock, flags); 333 333 334 334 /* start the TMF io. */ 335 - status = scic_controller_start_task(&ihost->sci, idev, ireq); 335 + status = scic_controller_start_task(ihost, idev, ireq); 336 336 337 337 if (status != SCI_TASK_SUCCESS) { 338 338 dev_warn(&ihost->pdev->dev, ··· 364 364 if (tmf->cb_state_func != NULL) 365 365 tmf->cb_state_func(isci_tmf_timed_out, tmf, tmf->cb_data); 366 366 367 - scic_controller_terminate_request(&ihost->sci, 367 + scic_controller_terminate_request(ihost, 368 368 idev, 369 369 ireq); 370 370 ··· 514 514 * request, and wait for it to complete. This function must only be called 515 515 * from a thread that can wait. Note that the request is terminated and 516 516 * completed (back to the host, if started there). 517 - * @isci_host: This SCU. 517 + * @ihost: This SCU. 518 518 * @idev: The target. 519 519 * @isci_request: The I/O request to be terminated. 520 520 * 521 521 */ 522 - static void isci_terminate_request_core( 523 - struct isci_host *isci_host, 524 - struct isci_remote_device *idev, 525 - struct isci_request *isci_request) 522 + static void isci_terminate_request_core(struct isci_host *ihost, 523 + struct isci_remote_device *idev, 524 + struct isci_request *isci_request) 526 525 { 527 526 enum sci_status status = SCI_SUCCESS; 528 527 bool was_terminated = false; ··· 532 533 struct completion *io_request_completion; 533 534 struct sas_task *task; 534 535 535 - dev_dbg(&isci_host->pdev->dev, 536 + dev_dbg(&ihost->pdev->dev, 536 537 "%s: device = %p; request = %p\n", 537 538 __func__, idev, isci_request); 538 539 539 - spin_lock_irqsave(&isci_host->scic_lock, flags); 540 + spin_lock_irqsave(&ihost->scic_lock, flags); 540 541 541 542 io_request_completion = isci_request->io_request_completion; 542 543 ··· 556 557 if (!test_bit(IREQ_TERMINATED, &isci_request->flags)) { 557 558 was_terminated = true; 558 559 needs_cleanup_handling = true; 559 - status = scic_controller_terminate_request( 560 - &isci_host->sci, 561 - idev, 562 - isci_request); 560 + status = scic_controller_terminate_request(ihost, 561 + idev, 562 + isci_request); 563 563 } 564 - spin_unlock_irqrestore(&isci_host->scic_lock, flags); 564 + spin_unlock_irqrestore(&ihost->scic_lock, flags); 565 565 566 566 /* 567 567 * The only time the request to terminate will ··· 568 570 * being aborted. 569 571 */ 570 572 if (status != SCI_SUCCESS) { 571 - dev_err(&isci_host->pdev->dev, 573 + dev_err(&ihost->pdev->dev, 572 574 "%s: scic_controller_terminate_request" 573 575 " returned = 0x%x\n", 574 576 __func__, status); ··· 577 579 578 580 } else { 579 581 if (was_terminated) { 580 - dev_dbg(&isci_host->pdev->dev, 582 + dev_dbg(&ihost->pdev->dev, 581 583 "%s: before completion wait (%p/%p)\n", 582 584 __func__, isci_request, io_request_completion); 583 585 ··· 591 593 if (!termination_completed) { 592 594 593 595 /* The request to terminate has timed out. */ 594 - spin_lock_irqsave(&isci_host->scic_lock, 596 + spin_lock_irqsave(&ihost->scic_lock, 595 597 flags); 596 598 597 599 /* Check for state changes. */ ··· 621 623 } else 622 624 termination_completed = 1; 623 625 624 - spin_unlock_irqrestore(&isci_host->scic_lock, 626 + spin_unlock_irqrestore(&ihost->scic_lock, 625 627 flags); 626 628 627 629 if (!termination_completed) { 628 630 629 - dev_err(&isci_host->pdev->dev, 631 + dev_err(&ihost->pdev->dev, 630 632 "%s: *** Timeout waiting for " 631 633 "termination(%p/%p)\n", 632 634 __func__, io_request_completion, ··· 640 642 } 641 643 } 642 644 if (termination_completed) 643 - dev_dbg(&isci_host->pdev->dev, 645 + dev_dbg(&ihost->pdev->dev, 644 646 "%s: after completion wait (%p/%p)\n", 645 647 __func__, isci_request, io_request_completion); 646 648 } ··· 676 678 } 677 679 if (needs_cleanup_handling) 678 680 isci_request_cleanup_completed_loiterer( 679 - isci_host, idev, isci_request, task); 681 + ihost, idev, isci_request, task); 680 682 } 681 683 } 682 684 ··· 1251 1253 /* PRINT_TMF( ((struct isci_tmf *)request->task)); */ 1252 1254 tmf_complete = tmf->complete; 1253 1255 1254 - scic_controller_complete_io(&ihost->sci, ireq->target_device, ireq); 1256 + scic_controller_complete_io(ihost, ireq->target_device, ireq); 1255 1257 /* set the 'terminated' flag handle to make sure it cannot be terminated 1256 1258 * or completed again. 1257 1259 */
+3 -3
drivers/scsi/isci/unsolicited_frame_control.c
··· 57 57 #include "unsolicited_frame_control.h" 58 58 #include "registers.h" 59 59 60 - int scic_sds_unsolicited_frame_control_construct(struct scic_sds_controller *scic) 60 + int scic_sds_unsolicited_frame_control_construct(struct isci_host *ihost) 61 61 { 62 - struct scic_sds_unsolicited_frame_control *uf_control = &scic->uf_control; 62 + struct scic_sds_unsolicited_frame_control *uf_control = &ihost->uf_control; 63 63 struct scic_sds_unsolicited_frame *uf; 64 64 u32 buf_len, header_len, i; 65 65 dma_addr_t dma; ··· 79 79 * memory descriptor entry. The headers and address table will be 80 80 * placed after the buffers. 81 81 */ 82 - virt = dmam_alloc_coherent(scic_to_dev(scic), size, &dma, GFP_KERNEL); 82 + virt = dmam_alloc_coherent(&ihost->pdev->dev, size, &dma, GFP_KERNEL); 83 83 if (!virt) 84 84 return -ENOMEM; 85 85
+2 -2
drivers/scsi/isci/unsolicited_frame_control.h
··· 214 214 215 215 }; 216 216 217 - struct scic_sds_controller; 217 + struct isci_host; 218 218 219 - int scic_sds_unsolicited_frame_control_construct(struct scic_sds_controller *scic); 219 + int scic_sds_unsolicited_frame_control_construct(struct isci_host *ihost); 220 220 221 221 enum sci_status scic_sds_unsolicited_frame_control_get_header( 222 222 struct scic_sds_unsolicited_frame_control *uf_control,