aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2006-11-02 15:16:08 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2006-12-07 16:51:53 -0500
commitca0c7453995d3696034435820522e2a60bd59bfc (patch)
tree76a831c8f70d65b7f1d710538a6cd5a71277acae /drivers/ieee1394
parent5796aa7b11a6ba9d28a523fc82dddbc96c1a175e (diff)
ieee1394: sbp2: clean up sbp2_ namespace
Prepend sbp2*_ to anything globally defined in sbp2.c except for some macros. Strip sbp2_ from names of struct members. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/sbp2.c237
-rw-r--r--drivers/ieee1394/sbp2.h28
2 files changed, 132 insertions, 133 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 96a743d9b5d5..6737af26c860 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -98,8 +98,8 @@
98 * (probably due to PCI latency/throughput issues with the part). You can 98 * (probably due to PCI latency/throughput issues with the part). You can
99 * bump down the speed if you are running into problems. 99 * bump down the speed if you are running into problems.
100 */ 100 */
101static int max_speed = IEEE1394_SPEED_MAX; 101static int sbp2_max_speed = IEEE1394_SPEED_MAX;
102module_param(max_speed, int, 0644); 102module_param_named(max_speed, sbp2_max_speed, int, 0644);
103MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb, 1 = 200mb, 0 = 100mb)"); 103MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb, 1 = 200mb, 0 = 100mb)");
104 104
105/* 105/*
@@ -109,9 +109,10 @@ MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb, 1 = 200mb, 0
109 * 109 *
110 * TODO: Make this configurable per device. 110 * TODO: Make this configurable per device.
111 */ 111 */
112static int serialize_io = 1; 112static int sbp2_serialize_io = 1;
113module_param(serialize_io, int, 0444); 113module_param_named(serialize_io, sbp2_serialize_io, int, 0444);
114MODULE_PARM_DESC(serialize_io, "Serialize I/O coming from scsi drivers (default = 1, faster = 0)"); 114MODULE_PARM_DESC(serialize_io, "Serialize I/O coming from scsi drivers "
115 "(default = 1, faster = 0)");
115 116
116/* 117/*
117 * Bump up max_sectors if you'd like to support very large sized 118 * Bump up max_sectors if you'd like to support very large sized
@@ -121,10 +122,10 @@ MODULE_PARM_DESC(serialize_io, "Serialize I/O coming from scsi drivers (default
121 * the Oxsemi sbp2 chipsets have no problems supporting very large 122 * the Oxsemi sbp2 chipsets have no problems supporting very large
122 * transfer sizes. 123 * transfer sizes.
123 */ 124 */
124static int max_sectors = SBP2_MAX_SECTORS; 125static int sbp2_max_sectors = SBP2_MAX_SECTORS;
125module_param(max_sectors, int, 0444); 126module_param_named(max_sectors, sbp2_max_sectors, int, 0444);
126MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = " 127MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported "
127 __stringify(SBP2_MAX_SECTORS) ")"); 128 "(default = " __stringify(SBP2_MAX_SECTORS) ")");
128 129
129/* 130/*
130 * Exclusive login to sbp2 device? In most cases, the sbp2 driver should 131 * Exclusive login to sbp2 device? In most cases, the sbp2 driver should
@@ -139,9 +140,10 @@ MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = "
139 * concurrent logins. Depending on firmware, four or two concurrent logins 140 * concurrent logins. Depending on firmware, four or two concurrent logins
140 * are possible on OXFW911 and newer Oxsemi bridges. 141 * are possible on OXFW911 and newer Oxsemi bridges.
141 */ 142 */
142static int exclusive_login = 1; 143static int sbp2_exclusive_login = 1;
143module_param(exclusive_login, int, 0644); 144module_param_named(exclusive_login, sbp2_exclusive_login, int, 0644);
144MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)"); 145MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device "
146 "(default = 1)");
145 147
146/* 148/*
147 * If any of the following workarounds is required for your device to work, 149 * If any of the following workarounds is required for your device to work,
@@ -279,7 +281,7 @@ static struct device_attribute *sbp2_sysfs_sdev_attrs[] = {
279 NULL 281 NULL
280}; 282};
281 283
282static struct scsi_host_template scsi_driver_template = { 284static struct scsi_host_template sbp2_shost_template = {
283 .module = THIS_MODULE, 285 .module = THIS_MODULE,
284 .name = "SBP-2 IEEE-1394", 286 .name = "SBP-2 IEEE-1394",
285 .proc_name = SBP2_DEVICE_NAME, 287 .proc_name = SBP2_DEVICE_NAME,
@@ -388,7 +390,7 @@ static inline void sbp2util_cpu_to_be32_buffer(void *buffer, int length)
388#define sbp2util_cpu_to_be32_buffer(x,y) do {} while (0) 390#define sbp2util_cpu_to_be32_buffer(x,y) do {} while (0)
389#endif 391#endif
390 392
391static DECLARE_WAIT_QUEUE_HEAD(access_wq); 393static DECLARE_WAIT_QUEUE_HEAD(sbp2_access_wq);
392 394
393/* 395/*
394 * Waits for completion of an SBP-2 access request. 396 * Waits for completion of an SBP-2 access request.
@@ -397,9 +399,10 @@ static DECLARE_WAIT_QUEUE_HEAD(access_wq);
397static int sbp2util_access_timeout(struct scsi_id_instance_data *scsi_id, 399static int sbp2util_access_timeout(struct scsi_id_instance_data *scsi_id,
398 int timeout) 400 int timeout)
399{ 401{
400 long leftover = wait_event_interruptible_timeout( 402 long leftover;
401 access_wq, scsi_id->access_complete, timeout);
402 403
404 leftover = wait_event_interruptible_timeout(
405 sbp2_access_wq, scsi_id->access_complete, timeout);
403 scsi_id->access_complete = 0; 406 scsi_id->access_complete = 0;
404 return leftover <= 0; 407 return leftover <= 0;
405} 408}
@@ -449,7 +452,7 @@ static void sbp2util_notify_fetch_agent(struct scsi_id_instance_data *scsi_id,
449 return; 452 return;
450 453
451 if (hpsb_node_write(scsi_id->ne, 454 if (hpsb_node_write(scsi_id->ne,
452 scsi_id->sbp2_command_block_agent_addr + offset, 455 scsi_id->command_block_agent_addr + offset,
453 data, len)) 456 data, len))
454 SBP2_ERR("sbp2util_notify_fetch_agent failed."); 457 SBP2_ERR("sbp2util_notify_fetch_agent failed.");
455 /* 458 /*
@@ -478,18 +481,18 @@ static void sbp2util_write_doorbell(struct work_struct *work)
478 481
479static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_id) 482static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_id)
480{ 483{
481 struct sbp2scsi_host_info *hi = scsi_id->hi; 484 struct sbp2_fwhost_info *hi = scsi_id->hi;
482 int i; 485 int i;
483 unsigned long flags, orbs; 486 unsigned long flags, orbs;
484 struct sbp2_command_info *command; 487 struct sbp2_command_info *command;
485 488
486 orbs = serialize_io ? 2 : SBP2_MAX_CMDS; 489 orbs = sbp2_serialize_io ? 2 : SBP2_MAX_CMDS;
487 490
488 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 491 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
489 for (i = 0; i < orbs; i++) { 492 for (i = 0; i < orbs; i++) {
490 command = kzalloc(sizeof(*command), GFP_ATOMIC); 493 command = kzalloc(sizeof(*command), GFP_ATOMIC);
491 if (!command) { 494 if (!command) {
492 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, 495 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock,
493 flags); 496 flags);
494 return -ENOMEM; 497 return -ENOMEM;
495 } 498 }
@@ -503,9 +506,9 @@ static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_i
503 sizeof(command->scatter_gather_element), 506 sizeof(command->scatter_gather_element),
504 PCI_DMA_BIDIRECTIONAL); 507 PCI_DMA_BIDIRECTIONAL);
505 INIT_LIST_HEAD(&command->list); 508 INIT_LIST_HEAD(&command->list);
506 list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); 509 list_add_tail(&command->list, &scsi_id->cmd_orb_completed);
507 } 510 }
508 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 511 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
509 return 0; 512 return 0;
510} 513}
511 514
@@ -516,9 +519,9 @@ static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_
516 struct sbp2_command_info *command; 519 struct sbp2_command_info *command;
517 unsigned long flags; 520 unsigned long flags;
518 521
519 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 522 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
520 if (!list_empty(&scsi_id->sbp2_command_orb_completed)) { 523 if (!list_empty(&scsi_id->cmd_orb_completed)) {
521 list_for_each_safe(lh, next, &scsi_id->sbp2_command_orb_completed) { 524 list_for_each_safe(lh, next, &scsi_id->cmd_orb_completed) {
522 command = list_entry(lh, struct sbp2_command_info, list); 525 command = list_entry(lh, struct sbp2_command_info, list);
523 pci_unmap_single(host->pdev, command->command_orb_dma, 526 pci_unmap_single(host->pdev, command->command_orb_dma,
524 sizeof(struct sbp2_command_orb), 527 sizeof(struct sbp2_command_orb),
@@ -529,7 +532,7 @@ static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_
529 kfree(command); 532 kfree(command);
530 } 533 }
531 } 534 }
532 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 535 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
533 return; 536 return;
534} 537}
535 538
@@ -543,31 +546,31 @@ static struct sbp2_command_info *sbp2util_find_command_for_orb(
543 struct sbp2_command_info *command; 546 struct sbp2_command_info *command;
544 unsigned long flags; 547 unsigned long flags;
545 548
546 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 549 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
547 if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { 550 if (!list_empty(&scsi_id->cmd_orb_inuse)) {
548 list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) { 551 list_for_each_entry(command, &scsi_id->cmd_orb_inuse, list) {
549 if (command->command_orb_dma == orb) { 552 if (command->command_orb_dma == orb) {
550 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 553 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
551 return command; 554 return command;
552 } 555 }
553 } 556 }
554 } 557 }
555 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 558 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
556 return NULL; 559 return NULL;
557} 560}
558 561
559/* 562/*
560 * Finds the sbp2_command for a given outstanding SCpnt. 563 * Finds the sbp2_command for a given outstanding SCpnt.
561 * Only looks at the in-use list. 564 * Only looks at the in-use list.
562 * Must be called with scsi_id->sbp2_command_orb_lock held. 565 * Must be called with scsi_id->cmd_orb_lock held.
563 */ 566 */
564static struct sbp2_command_info *sbp2util_find_command_for_SCpnt( 567static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(
565 struct scsi_id_instance_data *scsi_id, void *SCpnt) 568 struct scsi_id_instance_data *scsi_id, void *SCpnt)
566{ 569{
567 struct sbp2_command_info *command; 570 struct sbp2_command_info *command;
568 571
569 if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) 572 if (!list_empty(&scsi_id->cmd_orb_inuse))
570 list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) 573 list_for_each_entry(command, &scsi_id->cmd_orb_inuse, list)
571 if (command->Current_SCpnt == SCpnt) 574 if (command->Current_SCpnt == SCpnt)
572 return command; 575 return command;
573 return NULL; 576 return NULL;
@@ -582,18 +585,18 @@ static struct sbp2_command_info *sbp2util_allocate_command_orb(
582 struct sbp2_command_info *command = NULL; 585 struct sbp2_command_info *command = NULL;
583 unsigned long flags; 586 unsigned long flags;
584 587
585 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 588 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
586 if (!list_empty(&scsi_id->sbp2_command_orb_completed)) { 589 if (!list_empty(&scsi_id->cmd_orb_completed)) {
587 lh = scsi_id->sbp2_command_orb_completed.next; 590 lh = scsi_id->cmd_orb_completed.next;
588 list_del(lh); 591 list_del(lh);
589 command = list_entry(lh, struct sbp2_command_info, list); 592 command = list_entry(lh, struct sbp2_command_info, list);
590 command->Current_done = Current_done; 593 command->Current_done = Current_done;
591 command->Current_SCpnt = Current_SCpnt; 594 command->Current_SCpnt = Current_SCpnt;
592 list_add_tail(&command->list, &scsi_id->sbp2_command_orb_inuse); 595 list_add_tail(&command->list, &scsi_id->cmd_orb_inuse);
593 } else { 596 } else {
594 SBP2_ERR("%s: no orbs available", __FUNCTION__); 597 SBP2_ERR("%s: no orbs available", __FUNCTION__);
595 } 598 }
596 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 599 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
597 return command; 600 return command;
598} 601}
599 602
@@ -631,7 +634,7 @@ static void sbp2util_free_command_dma(struct sbp2_command_info *command)
631 634
632/* 635/*
633 * This function moves a command to the completed orb list. 636 * This function moves a command to the completed orb list.
634 * Must be called with scsi_id->sbp2_command_orb_lock held. 637 * Must be called with scsi_id->cmd_orb_lock held.
635 */ 638 */
636static void sbp2util_mark_command_completed( 639static void sbp2util_mark_command_completed(
637 struct scsi_id_instance_data *scsi_id, 640 struct scsi_id_instance_data *scsi_id,
@@ -639,7 +642,7 @@ static void sbp2util_mark_command_completed(
639{ 642{
640 list_del(&command->list); 643 list_del(&command->list);
641 sbp2util_free_command_dma(command); 644 sbp2util_free_command_dma(command);
642 list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); 645 list_add_tail(&command->list, &scsi_id->cmd_orb_completed);
643} 646}
644 647
645/* 648/*
@@ -746,7 +749,7 @@ static int sbp2_update(struct unit_directory *ud)
746 749
747static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud) 750static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud)
748{ 751{
749 struct sbp2scsi_host_info *hi; 752 struct sbp2_fwhost_info *hi;
750 struct Scsi_Host *scsi_host = NULL; 753 struct Scsi_Host *scsi_host = NULL;
751 struct scsi_id_instance_data *scsi_id = NULL; 754 struct scsi_id_instance_data *scsi_id = NULL;
752 755
@@ -761,10 +764,10 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
761 scsi_id->speed_code = IEEE1394_SPEED_100; 764 scsi_id->speed_code = IEEE1394_SPEED_100;
762 scsi_id->max_payload_size = sbp2_speedto_max_payload[IEEE1394_SPEED_100]; 765 scsi_id->max_payload_size = sbp2_speedto_max_payload[IEEE1394_SPEED_100];
763 scsi_id->status_fifo_addr = CSR1212_INVALID_ADDR_SPACE; 766 scsi_id->status_fifo_addr = CSR1212_INVALID_ADDR_SPACE;
764 INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_inuse); 767 INIT_LIST_HEAD(&scsi_id->cmd_orb_inuse);
765 INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed); 768 INIT_LIST_HEAD(&scsi_id->cmd_orb_completed);
766 INIT_LIST_HEAD(&scsi_id->scsi_list); 769 INIT_LIST_HEAD(&scsi_id->scsi_list);
767 spin_lock_init(&scsi_id->sbp2_command_orb_lock); 770 spin_lock_init(&scsi_id->cmd_orb_lock);
768 atomic_set(&scsi_id->state, SBP2LU_STATE_RUNNING); 771 atomic_set(&scsi_id->state, SBP2LU_STATE_RUNNING);
769 INIT_WORK(&scsi_id->protocol_work, NULL); 772 INIT_WORK(&scsi_id->protocol_work, NULL);
770 773
@@ -819,7 +822,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
819 goto failed_alloc; 822 goto failed_alloc;
820 } 823 }
821 824
822 scsi_host = scsi_host_alloc(&scsi_driver_template, 825 scsi_host = scsi_host_alloc(&sbp2_shost_template,
823 sizeof(unsigned long)); 826 sizeof(unsigned long));
824 if (!scsi_host) { 827 if (!scsi_host) {
825 SBP2_ERR("failed to register scsi host"); 828 SBP2_ERR("failed to register scsi host");
@@ -843,7 +846,7 @@ failed_alloc:
843 846
844static void sbp2_host_reset(struct hpsb_host *host) 847static void sbp2_host_reset(struct hpsb_host *host)
845{ 848{
846 struct sbp2scsi_host_info *hi; 849 struct sbp2_fwhost_info *hi;
847 struct scsi_id_instance_data *scsi_id; 850 struct scsi_id_instance_data *scsi_id;
848 851
849 hi = hpsb_get_hostinfo(&sbp2_highlevel, host); 852 hi = hpsb_get_hostinfo(&sbp2_highlevel, host);
@@ -859,7 +862,7 @@ static void sbp2_host_reset(struct hpsb_host *host)
859 862
860static int sbp2_start_device(struct scsi_id_instance_data *scsi_id) 863static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
861{ 864{
862 struct sbp2scsi_host_info *hi = scsi_id->hi; 865 struct sbp2_fwhost_info *hi = scsi_id->hi;
863 int error; 866 int error;
864 867
865 scsi_id->login_response = 868 scsi_id->login_response =
@@ -944,7 +947,7 @@ alloc_fail:
944 947
945static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id) 948static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
946{ 949{
947 struct sbp2scsi_host_info *hi; 950 struct sbp2_fwhost_info *hi;
948 951
949 if (!scsi_id) 952 if (!scsi_id)
950 return; 953 return;
@@ -1035,7 +1038,7 @@ static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid,
1035 1038
1036static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id) 1039static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1037{ 1040{
1038 struct sbp2scsi_host_info *hi = scsi_id->hi; 1041 struct sbp2_fwhost_info *hi = scsi_id->hi;
1039 quadlet_t data[2]; 1042 quadlet_t data[2];
1040 int max_logins; 1043 int max_logins;
1041 int active_logins; 1044 int active_logins;
@@ -1048,7 +1051,7 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1048 1051
1049 scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST); 1052 scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST);
1050 scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1); 1053 scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1);
1051 scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); 1054 scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->lun);
1052 1055
1053 scsi_id->query_logins_orb->reserved_resp_length = 1056 scsi_id->query_logins_orb->reserved_resp_length =
1054 ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response)); 1057 ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response));
@@ -1066,7 +1069,7 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1066 data[1] = scsi_id->query_logins_orb_dma; 1069 data[1] = scsi_id->query_logins_orb_dma;
1067 sbp2util_cpu_to_be32_buffer(data, 8); 1070 sbp2util_cpu_to_be32_buffer(data, 8);
1068 1071
1069 hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); 1072 hpsb_node_write(scsi_id->ne, scsi_id->management_agent_addr, data, 8);
1070 1073
1071 if (sbp2util_access_timeout(scsi_id, 2*HZ)) { 1074 if (sbp2util_access_timeout(scsi_id, 2*HZ)) {
1072 SBP2_INFO("Error querying logins to SBP-2 device - timed out"); 1075 SBP2_INFO("Error querying logins to SBP-2 device - timed out");
@@ -1100,17 +1103,15 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1100 1103
1101static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) 1104static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1102{ 1105{
1103 struct sbp2scsi_host_info *hi = scsi_id->hi; 1106 struct sbp2_fwhost_info *hi = scsi_id->hi;
1104 quadlet_t data[2]; 1107 quadlet_t data[2];
1105 1108
1106 if (!scsi_id->login_orb) 1109 if (!scsi_id->login_orb)
1107 return -EIO; 1110 return -EIO;
1108 1111
1109 if (!exclusive_login) { 1112 if (!sbp2_exclusive_login && sbp2_query_logins(scsi_id)) {
1110 if (sbp2_query_logins(scsi_id)) { 1113 SBP2_INFO("Device does not support any more concurrent logins");
1111 SBP2_INFO("Device does not support any more concurrent logins"); 1114 return -EIO;
1112 return -EIO;
1113 }
1114 } 1115 }
1115 1116
1116 /* assume no password */ 1117 /* assume no password */
@@ -1123,9 +1124,9 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1123 1124
1124 /* one second reconnect time */ 1125 /* one second reconnect time */
1125 scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); 1126 scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0);
1126 scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); 1127 scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(sbp2_exclusive_login);
1127 scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); 1128 scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1);
1128 scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); 1129 scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->lun);
1129 1130
1130 scsi_id->login_orb->passwd_resp_lengths = 1131 scsi_id->login_orb->passwd_resp_lengths =
1131 ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response)); 1132 ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response));
@@ -1143,7 +1144,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1143 data[1] = scsi_id->login_orb_dma; 1144 data[1] = scsi_id->login_orb_dma;
1144 sbp2util_cpu_to_be32_buffer(data, 8); 1145 sbp2util_cpu_to_be32_buffer(data, 8);
1145 1146
1146 hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); 1147 hpsb_node_write(scsi_id->ne, scsi_id->management_agent_addr, data, 8);
1147 1148
1148 /* wait up to 20 seconds for login status */ 1149 /* wait up to 20 seconds for login status */
1149 if (sbp2util_access_timeout(scsi_id, 20*HZ)) { 1150 if (sbp2util_access_timeout(scsi_id, 20*HZ)) {
@@ -1163,10 +1164,10 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1163 } 1164 }
1164 1165
1165 sbp2util_cpu_to_be32_buffer(scsi_id->login_response, sizeof(struct sbp2_login_response)); 1166 sbp2util_cpu_to_be32_buffer(scsi_id->login_response, sizeof(struct sbp2_login_response));
1166 scsi_id->sbp2_command_block_agent_addr = 1167 scsi_id->command_block_agent_addr =
1167 ((u64)scsi_id->login_response->command_block_agent_hi) << 32; 1168 ((u64)scsi_id->login_response->command_block_agent_hi) << 32;
1168 scsi_id->sbp2_command_block_agent_addr |= ((u64)scsi_id->login_response->command_block_agent_lo); 1169 scsi_id->command_block_agent_addr |= ((u64)scsi_id->login_response->command_block_agent_lo);
1169 scsi_id->sbp2_command_block_agent_addr &= 0x0000ffffffffffffULL; 1170 scsi_id->command_block_agent_addr &= 0x0000ffffffffffffULL;
1170 1171
1171 SBP2_INFO("Logged into SBP-2 device"); 1172 SBP2_INFO("Logged into SBP-2 device");
1172 return 0; 1173 return 0;
@@ -1174,7 +1175,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1174 1175
1175static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id) 1176static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id)
1176{ 1177{
1177 struct sbp2scsi_host_info *hi = scsi_id->hi; 1178 struct sbp2_fwhost_info *hi = scsi_id->hi;
1178 quadlet_t data[2]; 1179 quadlet_t data[2];
1179 int error; 1180 int error;
1180 1181
@@ -1200,7 +1201,7 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id)
1200 sbp2util_cpu_to_be32_buffer(data, 8); 1201 sbp2util_cpu_to_be32_buffer(data, 8);
1201 1202
1202 error = hpsb_node_write(scsi_id->ne, 1203 error = hpsb_node_write(scsi_id->ne,
1203 scsi_id->sbp2_management_agent_addr, data, 8); 1204 scsi_id->management_agent_addr, data, 8);
1204 if (error) 1205 if (error)
1205 return error; 1206 return error;
1206 1207
@@ -1214,7 +1215,7 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id)
1214 1215
1215static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id) 1216static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id)
1216{ 1217{
1217 struct sbp2scsi_host_info *hi = scsi_id->hi; 1218 struct sbp2_fwhost_info *hi = scsi_id->hi;
1218 quadlet_t data[2]; 1219 quadlet_t data[2];
1219 int error; 1220 int error;
1220 1221
@@ -1241,7 +1242,7 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id)
1241 sbp2util_cpu_to_be32_buffer(data, 8); 1242 sbp2util_cpu_to_be32_buffer(data, 8);
1242 1243
1243 error = hpsb_node_write(scsi_id->ne, 1244 error = hpsb_node_write(scsi_id->ne,
1244 scsi_id->sbp2_management_agent_addr, data, 8); 1245 scsi_id->management_agent_addr, data, 8);
1245 if (error) 1246 if (error)
1246 return error; 1247 return error;
1247 1248
@@ -1306,7 +1307,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1306 (kv->value.csr_offset << 2); 1307 (kv->value.csr_offset << 2);
1307 1308
1308 else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) 1309 else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE)
1309 scsi_id->sbp2_lun = 1310 scsi_id->lun =
1310 ORB_SET_LUN(kv->value.immediate); 1311 ORB_SET_LUN(kv->value.immediate);
1311 break; 1312 break;
1312 1313
@@ -1363,12 +1364,12 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1363 /* We would need one SCSI host template for each target to adjust 1364 /* We would need one SCSI host template for each target to adjust
1364 * max_sectors on the fly, therefore warn only. */ 1365 * max_sectors on the fly, therefore warn only. */
1365 if (workarounds & SBP2_WORKAROUND_128K_MAX_TRANS && 1366 if (workarounds & SBP2_WORKAROUND_128K_MAX_TRANS &&
1366 (max_sectors * 512) > (128 * 1024)) 1367 (sbp2_max_sectors * 512) > (128 * 1024))
1367 SBP2_INFO("Node " NODE_BUS_FMT ": Bridge only supports 128KB " 1368 SBP2_INFO("Node " NODE_BUS_FMT ": Bridge only supports 128KB "
1368 "max transfer size. WARNING: Current max_sectors " 1369 "max transfer size. WARNING: Current max_sectors "
1369 "setting is larger than 128KB (%d sectors)", 1370 "setting is larger than 128KB (%d sectors)",
1370 NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid), 1371 NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid),
1371 max_sectors); 1372 sbp2_max_sectors);
1372 1373
1373 /* If this is a logical unit directory entry, process the parent 1374 /* If this is a logical unit directory entry, process the parent
1374 * to get the values. */ 1375 * to get the values. */
@@ -1377,14 +1378,14 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1377 container_of(ud->device.parent, struct unit_directory, device); 1378 container_of(ud->device.parent, struct unit_directory, device);
1378 sbp2_parse_unit_directory(scsi_id, parent_ud); 1379 sbp2_parse_unit_directory(scsi_id, parent_ud);
1379 } else { 1380 } else {
1380 scsi_id->sbp2_management_agent_addr = management_agent_addr; 1381 scsi_id->management_agent_addr = management_agent_addr;
1381 scsi_id->sbp2_command_set_spec_id = command_set_spec_id; 1382 scsi_id->command_set_spec_id = command_set_spec_id;
1382 scsi_id->sbp2_command_set = command_set; 1383 scsi_id->command_set = command_set;
1383 scsi_id->sbp2_unit_characteristics = unit_characteristics; 1384 scsi_id->unit_characteristics = unit_characteristics;
1384 scsi_id->sbp2_firmware_revision = firmware_revision; 1385 scsi_id->firmware_revision = firmware_revision;
1385 scsi_id->workarounds = workarounds; 1386 scsi_id->workarounds = workarounds;
1386 if (ud->flags & UNIT_DIRECTORY_HAS_LUN) 1387 if (ud->flags & UNIT_DIRECTORY_HAS_LUN)
1387 scsi_id->sbp2_lun = ORB_SET_LUN(ud->lun); 1388 scsi_id->lun = ORB_SET_LUN(ud->lun);
1388 } 1389 }
1389} 1390}
1390 1391
@@ -1401,15 +1402,16 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1401 */ 1402 */
1402static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id) 1403static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
1403{ 1404{
1404 struct sbp2scsi_host_info *hi = scsi_id->hi; 1405 struct sbp2_fwhost_info *hi = scsi_id->hi;
1405 u8 payload; 1406 u8 payload;
1406 1407
1407 scsi_id->speed_code = 1408 scsi_id->speed_code =
1408 hi->host->speed[NODEID_TO_NODE(scsi_id->ne->nodeid)]; 1409 hi->host->speed[NODEID_TO_NODE(scsi_id->ne->nodeid)];
1409 1410
1410 if (scsi_id->speed_code > max_speed) { 1411 if (scsi_id->speed_code > sbp2_max_speed) {
1411 scsi_id->speed_code = max_speed; 1412 scsi_id->speed_code = sbp2_max_speed;
1412 SBP2_INFO("Reducing speed to %s", hpsb_speedto_str[max_speed]); 1413 SBP2_INFO("Reducing speed to %s",
1414 hpsb_speedto_str[sbp2_max_speed]);
1413 } 1415 }
1414 1416
1415 /* Payload size is the lesser of what our speed supports and what 1417 /* Payload size is the lesser of what our speed supports and what
@@ -1445,7 +1447,7 @@ static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait)
1445 flush_scheduled_work(); 1447 flush_scheduled_work();
1446 1448
1447 data = ntohl(SBP2_AGENT_RESET_DATA); 1449 data = ntohl(SBP2_AGENT_RESET_DATA);
1448 addr = scsi_id->sbp2_command_block_agent_addr + SBP2_AGENT_RESET_OFFSET; 1450 addr = scsi_id->command_block_agent_addr + SBP2_AGENT_RESET_OFFSET;
1449 1451
1450 if (wait) 1452 if (wait)
1451 retval = hpsb_node_write(scsi_id->ne, addr, &data, 4); 1453 retval = hpsb_node_write(scsi_id->ne, addr, &data, 4);
@@ -1458,15 +1460,15 @@ static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait)
1458 } 1460 }
1459 1461
1460 /* make sure that the ORB_POINTER is written on next command */ 1462 /* make sure that the ORB_POINTER is written on next command */
1461 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 1463 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
1462 scsi_id->last_orb = NULL; 1464 scsi_id->last_orb = NULL;
1463 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 1465 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
1464 1466
1465 return 0; 1467 return 0;
1466} 1468}
1467 1469
1468static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb, 1470static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1469 struct sbp2scsi_host_info *hi, 1471 struct sbp2_fwhost_info *hi,
1470 struct sbp2_command_info *command, 1472 struct sbp2_command_info *command,
1471 unsigned int scsi_use_sg, 1473 unsigned int scsi_use_sg,
1472 struct scatterlist *sgpnt, 1474 struct scatterlist *sgpnt,
@@ -1537,7 +1539,7 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1537} 1539}
1538 1540
1539static void sbp2_prep_command_orb_no_sg(struct sbp2_command_orb *orb, 1541static void sbp2_prep_command_orb_no_sg(struct sbp2_command_orb *orb,
1540 struct sbp2scsi_host_info *hi, 1542 struct sbp2_fwhost_info *hi,
1541 struct sbp2_command_info *command, 1543 struct sbp2_command_info *command,
1542 struct scatterlist *sgpnt, 1544 struct scatterlist *sgpnt,
1543 u32 orb_direction, 1545 u32 orb_direction,
@@ -1606,7 +1608,7 @@ static void sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
1606 void *scsi_request_buffer, 1608 void *scsi_request_buffer,
1607 enum dma_data_direction dma_dir) 1609 enum dma_data_direction dma_dir)
1608{ 1610{
1609 struct sbp2scsi_host_info *hi = scsi_id->hi; 1611 struct sbp2_fwhost_info *hi = scsi_id->hi;
1610 struct scatterlist *sgpnt = (struct scatterlist *)scsi_request_buffer; 1612 struct scatterlist *sgpnt = (struct scatterlist *)scsi_request_buffer;
1611 struct sbp2_command_orb *command_orb = &command->command_orb; 1613 struct sbp2_command_orb *command_orb = &command->command_orb;
1612 u32 orb_direction; 1614 u32 orb_direction;
@@ -1658,11 +1660,11 @@ static void sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
1658static void sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id, 1660static void sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
1659 struct sbp2_command_info *command) 1661 struct sbp2_command_info *command)
1660{ 1662{
1661 struct sbp2scsi_host_info *hi = scsi_id->hi; 1663 struct sbp2_fwhost_info *hi = scsi_id->hi;
1662 struct sbp2_command_orb *command_orb = &command->command_orb; 1664 struct sbp2_command_orb *command_orb = &command->command_orb;
1663 struct sbp2_command_orb *last_orb; 1665 struct sbp2_command_orb *last_orb;
1664 dma_addr_t last_orb_dma; 1666 dma_addr_t last_orb_dma;
1665 u64 addr = scsi_id->sbp2_command_block_agent_addr; 1667 u64 addr = scsi_id->command_block_agent_addr;
1666 quadlet_t data[2]; 1668 quadlet_t data[2];
1667 size_t length; 1669 size_t length;
1668 unsigned long flags; 1670 unsigned long flags;
@@ -1675,7 +1677,7 @@ static void sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
1675 PCI_DMA_BIDIRECTIONAL); 1677 PCI_DMA_BIDIRECTIONAL);
1676 1678
1677 /* check to see if there are any previous orbs to use */ 1679 /* check to see if there are any previous orbs to use */
1678 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 1680 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
1679 last_orb = scsi_id->last_orb; 1681 last_orb = scsi_id->last_orb;
1680 last_orb_dma = scsi_id->last_orb_dma; 1682 last_orb_dma = scsi_id->last_orb_dma;
1681 if (!last_orb) { 1683 if (!last_orb) {
@@ -1712,7 +1714,7 @@ static void sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
1712 } 1714 }
1713 scsi_id->last_orb = command_orb; 1715 scsi_id->last_orb = command_orb;
1714 scsi_id->last_orb_dma = command->command_orb_dma; 1716 scsi_id->last_orb_dma = command->command_orb_dma;
1715 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 1717 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
1716 1718
1717 if (sbp2util_node_write_no_wait(scsi_id->ne, addr, data, length)) { 1719 if (sbp2util_node_write_no_wait(scsi_id->ne, addr, data, length)) {
1718 /* 1720 /*
@@ -1782,7 +1784,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
1782 int destid, quadlet_t *data, u64 addr, 1784 int destid, quadlet_t *data, u64 addr,
1783 size_t length, u16 fl) 1785 size_t length, u16 fl)
1784{ 1786{
1785 struct sbp2scsi_host_info *hi; 1787 struct sbp2_fwhost_info *hi;
1786 struct scsi_id_instance_data *scsi_id = NULL, *scsi_id_tmp; 1788 struct scsi_id_instance_data *scsi_id = NULL, *scsi_id_tmp;
1787 struct scsi_cmnd *SCpnt = NULL; 1789 struct scsi_cmnd *SCpnt = NULL;
1788 struct sbp2_status_block *sb; 1790 struct sbp2_status_block *sb;
@@ -1845,9 +1847,9 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
1845 * not be reused until status for a subsequent ORB is received. 1847 * not be reused until status for a subsequent ORB is received.
1846 */ 1848 */
1847 SCpnt = command->Current_SCpnt; 1849 SCpnt = command->Current_SCpnt;
1848 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 1850 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
1849 sbp2util_mark_command_completed(scsi_id, command); 1851 sbp2util_mark_command_completed(scsi_id, command);
1850 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 1852 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
1851 1853
1852 if (SCpnt) { 1854 if (SCpnt) {
1853 u32 h = sb->ORB_offset_hi_misc; 1855 u32 h = sb->ORB_offset_hi_misc;
@@ -1876,10 +1878,10 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
1876 * last_orb so that next time we write directly to the 1878 * last_orb so that next time we write directly to the
1877 * ORB_POINTER register. That way the fetch agent does not need 1879 * ORB_POINTER register. That way the fetch agent does not need
1878 * to refetch the next_ORB. */ 1880 * to refetch the next_ORB. */
1879 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 1881 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
1880 if (list_empty(&scsi_id->sbp2_command_orb_inuse)) 1882 if (list_empty(&scsi_id->cmd_orb_inuse))
1881 scsi_id->last_orb = NULL; 1883 scsi_id->last_orb = NULL;
1882 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 1884 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
1883 1885
1884 } else { 1886 } else {
1885 /* It's probably status after a management request. */ 1887 /* It's probably status after a management request. */
@@ -1888,7 +1890,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
1888 (sb->ORB_offset_lo == scsi_id->query_logins_orb_dma) || 1890 (sb->ORB_offset_lo == scsi_id->query_logins_orb_dma) ||
1889 (sb->ORB_offset_lo == scsi_id->logout_orb_dma)) { 1891 (sb->ORB_offset_lo == scsi_id->logout_orb_dma)) {
1890 scsi_id->access_complete = 1; 1892 scsi_id->access_complete = 1;
1891 wake_up_interruptible(&access_wq); 1893 wake_up_interruptible(&sbp2_access_wq);
1892 } 1894 }
1893 } 1895 }
1894 1896
@@ -1907,7 +1909,7 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
1907{ 1909{
1908 struct scsi_id_instance_data *scsi_id = 1910 struct scsi_id_instance_data *scsi_id =
1909 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; 1911 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
1910 struct sbp2scsi_host_info *hi; 1912 struct sbp2_fwhost_info *hi;
1911 int result = DID_NO_CONNECT << 16; 1913 int result = DID_NO_CONNECT << 16;
1912 1914
1913 if (unlikely(!sbp2util_node_is_available(scsi_id))) 1915 if (unlikely(!sbp2util_node_is_available(scsi_id)))
@@ -1916,7 +1918,7 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
1916 hi = scsi_id->hi; 1918 hi = scsi_id->hi;
1917 1919
1918 if (unlikely(!hi)) { 1920 if (unlikely(!hi)) {
1919 SBP2_ERR("sbp2scsi_host_info is NULL - this is bad!"); 1921 SBP2_ERR("sbp2_fwhost_info is NULL - this is bad!");
1920 goto done; 1922 goto done;
1921 } 1923 }
1922 1924
@@ -1964,14 +1966,14 @@ done:
1964static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id, 1966static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id,
1965 u32 status) 1967 u32 status)
1966{ 1968{
1967 struct sbp2scsi_host_info *hi = scsi_id->hi; 1969 struct sbp2_fwhost_info *hi = scsi_id->hi;
1968 struct list_head *lh; 1970 struct list_head *lh;
1969 struct sbp2_command_info *command; 1971 struct sbp2_command_info *command;
1970 unsigned long flags; 1972 unsigned long flags;
1971 1973
1972 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 1974 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
1973 while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { 1975 while (!list_empty(&scsi_id->cmd_orb_inuse)) {
1974 lh = scsi_id->sbp2_command_orb_inuse.next; 1976 lh = scsi_id->cmd_orb_inuse.next;
1975 command = list_entry(lh, struct sbp2_command_info, list); 1977 command = list_entry(lh, struct sbp2_command_info, list);
1976 pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma, 1978 pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma,
1977 sizeof(struct sbp2_command_orb), 1979 sizeof(struct sbp2_command_orb),
@@ -1985,7 +1987,7 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id
1985 command->Current_done(command->Current_SCpnt); 1987 command->Current_done(command->Current_SCpnt);
1986 } 1988 }
1987 } 1989 }
1988 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 1990 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
1989 1991
1990 return; 1992 return;
1991} 1993}
@@ -2090,7 +2092,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
2090{ 2092{
2091 struct scsi_id_instance_data *scsi_id = 2093 struct scsi_id_instance_data *scsi_id =
2092 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; 2094 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
2093 struct sbp2scsi_host_info *hi = scsi_id->hi; 2095 struct sbp2_fwhost_info *hi = scsi_id->hi;
2094 struct sbp2_command_info *command; 2096 struct sbp2_command_info *command;
2095 unsigned long flags; 2097 unsigned long flags;
2096 2098
@@ -2101,7 +2103,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
2101 sbp2_agent_reset(scsi_id, 1); 2103 sbp2_agent_reset(scsi_id, 1);
2102 2104
2103 /* Return a matching command structure to the free pool. */ 2105 /* Return a matching command structure to the free pool. */
2104 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 2106 spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
2105 command = sbp2util_find_command_for_SCpnt(scsi_id, SCpnt); 2107 command = sbp2util_find_command_for_SCpnt(scsi_id, SCpnt);
2106 if (command) { 2108 if (command) {
2107 pci_dma_sync_single_for_cpu(hi->host->pdev, 2109 pci_dma_sync_single_for_cpu(hi->host->pdev,
@@ -2118,7 +2120,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
2118 command->Current_done(command->Current_SCpnt); 2120 command->Current_done(command->Current_SCpnt);
2119 } 2121 }
2120 } 2122 }
2121 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 2123 spin_unlock_irqrestore(&scsi_id->cmd_orb_lock, flags);
2122 2124
2123 sbp2scsi_complete_all_commands(scsi_id, DID_BUS_BUSY); 2125 sbp2scsi_complete_all_commands(scsi_id, DID_BUS_BUSY);
2124 } 2126 }
@@ -2150,7 +2152,6 @@ static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev,
2150{ 2152{
2151 struct scsi_device *sdev; 2153 struct scsi_device *sdev;
2152 struct scsi_id_instance_data *scsi_id; 2154 struct scsi_id_instance_data *scsi_id;
2153 int lun;
2154 2155
2155 if (!(sdev = to_scsi_device(dev))) 2156 if (!(sdev = to_scsi_device(dev)))
2156 return 0; 2157 return 0;
@@ -2158,10 +2159,8 @@ static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev,
2158 if (!(scsi_id = (struct scsi_id_instance_data *)sdev->host->hostdata[0])) 2159 if (!(scsi_id = (struct scsi_id_instance_data *)sdev->host->hostdata[0]))
2159 return 0; 2160 return 0;
2160 2161
2161 lun = ORB_SET_LUN(scsi_id->sbp2_lun);
2162
2163 return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)scsi_id->ne->guid, 2162 return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)scsi_id->ne->guid,
2164 scsi_id->ud->id, lun); 2163 scsi_id->ud->id, ORB_SET_LUN(scsi_id->lun));
2165} 2164}
2166 2165
2167MODULE_AUTHOR("Ben Collins <bcollins@debian.org>"); 2166MODULE_AUTHOR("Ben Collins <bcollins@debian.org>");
@@ -2173,15 +2172,15 @@ static int sbp2_module_init(void)
2173{ 2172{
2174 int ret; 2173 int ret;
2175 2174
2176 if (serialize_io) { 2175 if (sbp2_serialize_io) {
2177 scsi_driver_template.can_queue = 1; 2176 sbp2_shost_template.can_queue = 1;
2178 scsi_driver_template.cmd_per_lun = 1; 2177 sbp2_shost_template.cmd_per_lun = 1;
2179 } 2178 }
2180 2179
2181 if (sbp2_default_workarounds & SBP2_WORKAROUND_128K_MAX_TRANS && 2180 if (sbp2_default_workarounds & SBP2_WORKAROUND_128K_MAX_TRANS &&
2182 (max_sectors * 512) > (128 * 1024)) 2181 (sbp2_max_sectors * 512) > (128 * 1024))
2183 max_sectors = 128 * 1024 / 512; 2182 sbp2_max_sectors = 128 * 1024 / 512;
2184 scsi_driver_template.max_sectors = max_sectors; 2183 sbp2_shost_template.max_sectors = sbp2_max_sectors;
2185 2184
2186 hpsb_register_highlevel(&sbp2_highlevel); 2185 hpsb_register_highlevel(&sbp2_highlevel);
2187 ret = hpsb_register_protocol(&sbp2_driver); 2186 ret = hpsb_register_protocol(&sbp2_driver);
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h
index d1dbc0d63177..6c1f8ff1c59e 100644
--- a/drivers/ieee1394/sbp2.h
+++ b/drivers/ieee1394/sbp2.h
@@ -241,7 +241,7 @@ struct sbp2_status_block {
241 * Representations of commands and devices 241 * Representations of commands and devices
242 */ 242 */
243 243
244enum cmd_dma_types { 244enum sbp2_dma_types {
245 CMD_DMA_NONE, 245 CMD_DMA_NONE,
246 CMD_DMA_PAGE, 246 CMD_DMA_PAGE,
247 CMD_DMA_SINGLE 247 CMD_DMA_SINGLE
@@ -260,13 +260,13 @@ struct sbp2_command_info {
260 dma_addr_t sge_dma ____cacheline_aligned; 260 dma_addr_t sge_dma ____cacheline_aligned;
261 void *sge_buffer; 261 void *sge_buffer;
262 dma_addr_t cmd_dma; 262 dma_addr_t cmd_dma;
263 enum cmd_dma_types dma_type; 263 enum sbp2_dma_types dma_type;
264 unsigned long dma_size; 264 unsigned long dma_size;
265 int dma_dir; 265 int dma_dir;
266}; 266};
267 267
268/* Per FireWire host */ 268/* Per FireWire host */
269struct sbp2scsi_host_info { 269struct sbp2_fwhost_info {
270 struct hpsb_host *host; 270 struct hpsb_host *host;
271 struct list_head scsi_ids; 271 struct list_head scsi_ids;
272}; 272};
@@ -291,17 +291,17 @@ struct scsi_id_instance_data {
291 struct sbp2_status_block status_block; 291 struct sbp2_status_block status_block;
292 292
293 /* How to talk to the unit */ 293 /* How to talk to the unit */
294 u64 sbp2_management_agent_addr; 294 u64 management_agent_addr;
295 u64 sbp2_command_block_agent_addr; 295 u64 command_block_agent_addr;
296 u32 speed_code; 296 u32 speed_code;
297 u32 max_payload_size; 297 u32 max_payload_size;
298 298
299 /* Pulled from the device's unit directory */ 299 /* Pulled from the device's unit directory */
300 u32 sbp2_command_set_spec_id; 300 u32 command_set_spec_id;
301 u32 sbp2_command_set; 301 u32 command_set;
302 u32 sbp2_unit_characteristics; 302 u32 unit_characteristics;
303 u32 sbp2_lun; 303 u32 firmware_revision;
304 u32 sbp2_firmware_revision; 304 u16 lun;
305 305
306 /* Address for the unit to write status blocks to */ 306 /* Address for the unit to write status blocks to */
307 u64 status_fifo_addr; 307 u64 status_fifo_addr;
@@ -310,12 +310,12 @@ struct scsi_id_instance_data {
310 int access_complete:1; 310 int access_complete:1;
311 311
312 /* Pool of command ORBs for this logical unit */ 312 /* Pool of command ORBs for this logical unit */
313 spinlock_t sbp2_command_orb_lock; 313 spinlock_t cmd_orb_lock;
314 struct list_head sbp2_command_orb_inuse; 314 struct list_head cmd_orb_inuse;
315 struct list_head sbp2_command_orb_completed; 315 struct list_head cmd_orb_completed;
316 316
317 /* Backlink to FireWire host; list of units attached to the host */ 317 /* Backlink to FireWire host; list of units attached to the host */
318 struct sbp2scsi_host_info *hi; 318 struct sbp2_fwhost_info *hi;
319 struct list_head scsi_list; 319 struct list_head scsi_list;
320 320
321 /* IEEE 1394 core's device representations */ 321 /* IEEE 1394 core's device representations */