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 15:46:48 -0500
commitedf1fb213e5df03983b91bb050bdd2914465a843 (patch)
tree644a412f1ee5e675932423b37ba18ec17fe8ec30 /drivers/ieee1394
parent35644090d82557d4ae5b4c75e29396406cc9d58a (diff)
ieee1394: sbp2: remove debug macros
No need to keep them in released sources. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/sbp2.c300
1 files changed, 20 insertions, 280 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index ecbb5ee500ab..6bd26a91111e 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -179,54 +179,9 @@ MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0"
179 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) 179 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
180 ", or a combination)"); 180 ", or a combination)");
181 181
182/*
183 * Debug levels, configured via kernel config, or enable here.
184 */
185
186#define CONFIG_IEEE1394_SBP2_DEBUG 0
187/* #define CONFIG_IEEE1394_SBP2_DEBUG_ORBS */
188/* #define CONFIG_IEEE1394_SBP2_DEBUG_DMA */
189/* #define CONFIG_IEEE1394_SBP2_DEBUG 1 */
190/* #define CONFIG_IEEE1394_SBP2_DEBUG 2 */
191/* #define CONFIG_IEEE1394_SBP2_PACKET_DUMP */
192
193#ifdef CONFIG_IEEE1394_SBP2_DEBUG_ORBS
194#define SBP2_ORB_DEBUG(fmt, args...) HPSB_ERR("sbp2(%s): "fmt, __FUNCTION__, ## args)
195static u32 global_outstanding_command_orbs = 0;
196#define outstanding_orb_incr global_outstanding_command_orbs++
197#define outstanding_orb_decr global_outstanding_command_orbs--
198#else
199#define SBP2_ORB_DEBUG(fmt, args...) do {} while (0)
200#define outstanding_orb_incr do {} while (0)
201#define outstanding_orb_decr do {} while (0)
202#endif
203
204#ifdef CONFIG_IEEE1394_SBP2_DEBUG_DMA
205#define SBP2_DMA_ALLOC(fmt, args...) \
206 HPSB_ERR("sbp2(%s)alloc(%d): "fmt, __FUNCTION__, \
207 ++global_outstanding_dmas, ## args)
208#define SBP2_DMA_FREE(fmt, args...) \
209 HPSB_ERR("sbp2(%s)free(%d): "fmt, __FUNCTION__, \
210 --global_outstanding_dmas, ## args)
211static u32 global_outstanding_dmas = 0;
212#else
213#define SBP2_DMA_ALLOC(fmt, args...) do {} while (0)
214#define SBP2_DMA_FREE(fmt, args...) do {} while (0)
215#endif
216 182
217#if CONFIG_IEEE1394_SBP2_DEBUG >= 2 183#define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args)
218#define SBP2_DEBUG(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) 184#define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args)
219#define SBP2_INFO(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args)
220#elif CONFIG_IEEE1394_SBP2_DEBUG == 1
221#define SBP2_DEBUG(fmt, args...) HPSB_DEBUG("sbp2: "fmt, ## args)
222#define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args)
223#else
224#define SBP2_DEBUG(fmt, args...) do {} while (0)
225#define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args)
226#endif
227
228#define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args)
229#define SBP2_DEBUG_ENTER() SBP2_DEBUG("%s", __FUNCTION__)
230 185
231/* 186/*
232 * Globals 187 * Globals
@@ -433,42 +388,6 @@ static inline void sbp2util_cpu_to_be32_buffer(void *buffer, int length)
433#define sbp2util_cpu_to_be32_buffer(x,y) do {} while (0) 388#define sbp2util_cpu_to_be32_buffer(x,y) do {} while (0)
434#endif 389#endif
435 390
436#ifdef CONFIG_IEEE1394_SBP2_PACKET_DUMP
437/*
438 * Debug packet dump routine. Length is in bytes.
439 */
440static void sbp2util_packet_dump(void *buffer, int length, char *dump_name,
441 u32 dump_phys_addr)
442{
443 int i;
444 unsigned char *dump = buffer;
445
446 if (!dump || !length || !dump_name)
447 return;
448
449 if (dump_phys_addr)
450 printk("[%s, 0x%x]", dump_name, dump_phys_addr);
451 else
452 printk("[%s]", dump_name);
453 for (i = 0; i < length; i++) {
454 if (i > 0x3f) {
455 printk("\n ...");
456 break;
457 }
458 if ((i & 0x3) == 0)
459 printk(" ");
460 if ((i & 0xf) == 0)
461 printk("\n ");
462 printk("%02x ", (int)dump[i]);
463 }
464 printk("\n");
465
466 return;
467}
468#else
469#define sbp2util_packet_dump(w,x,y,z) do {} while (0)
470#endif
471
472static DECLARE_WAIT_QUEUE_HEAD(access_wq); 391static DECLARE_WAIT_QUEUE_HEAD(access_wq);
473 392
474/* 393/*
@@ -587,13 +506,11 @@ static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_i
587 pci_map_single(hi->host->pdev, &command->command_orb, 506 pci_map_single(hi->host->pdev, &command->command_orb,
588 sizeof(struct sbp2_command_orb), 507 sizeof(struct sbp2_command_orb),
589 PCI_DMA_TODEVICE); 508 PCI_DMA_TODEVICE);
590 SBP2_DMA_ALLOC("single command orb DMA");
591 command->sge_dma = 509 command->sge_dma =
592 pci_map_single(hi->host->pdev, 510 pci_map_single(hi->host->pdev,
593 &command->scatter_gather_element, 511 &command->scatter_gather_element,
594 sizeof(command->scatter_gather_element), 512 sizeof(command->scatter_gather_element),
595 PCI_DMA_BIDIRECTIONAL); 513 PCI_DMA_BIDIRECTIONAL);
596 SBP2_DMA_ALLOC("scatter_gather_element");
597 INIT_LIST_HEAD(&command->list); 514 INIT_LIST_HEAD(&command->list);
598 list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); 515 list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed);
599 } 516 }
@@ -620,12 +537,9 @@ static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_
620 pci_unmap_single(host->pdev, command->command_orb_dma, 537 pci_unmap_single(host->pdev, command->command_orb_dma,
621 sizeof(struct sbp2_command_orb), 538 sizeof(struct sbp2_command_orb),
622 PCI_DMA_TODEVICE); 539 PCI_DMA_TODEVICE);
623 SBP2_DMA_FREE("single command orb DMA");
624 pci_unmap_single(host->pdev, command->sge_dma, 540 pci_unmap_single(host->pdev, command->sge_dma,
625 sizeof(command->scatter_gather_element), 541 sizeof(command->scatter_gather_element),
626 PCI_DMA_BIDIRECTIONAL); 542 PCI_DMA_BIDIRECTIONAL);
627 SBP2_DMA_FREE("scatter_gather_element");
628
629 kfree(command); 543 kfree(command);
630 } 544 }
631 } 545 }
@@ -653,9 +567,6 @@ static struct sbp2_command_info *sbp2util_find_command_for_orb(
653 } 567 }
654 } 568 }
655 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 569 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
656
657 SBP2_ORB_DEBUG("could not match command orb %x", (unsigned int)orb);
658
659 return NULL; 570 return NULL;
660} 571}
661 572
@@ -718,15 +629,13 @@ static void sbp2util_free_command_dma(struct sbp2_command_info *command)
718 host = scsi_id->ud->ne->host; 629 host = scsi_id->ud->ne->host;
719 630
720 if (command->cmd_dma) { 631 if (command->cmd_dma) {
721 if (command->dma_type == CMD_DMA_SINGLE) { 632 if (command->dma_type == CMD_DMA_SINGLE)
722 pci_unmap_single(host->pdev, command->cmd_dma, 633 pci_unmap_single(host->pdev, command->cmd_dma,
723 command->dma_size, command->dma_dir); 634 command->dma_size, command->dma_dir);
724 SBP2_DMA_FREE("single bulk"); 635 else if (command->dma_type == CMD_DMA_PAGE)
725 } else if (command->dma_type == CMD_DMA_PAGE) {
726 pci_unmap_page(host->pdev, command->cmd_dma, 636 pci_unmap_page(host->pdev, command->cmd_dma,
727 command->dma_size, command->dma_dir); 637 command->dma_size, command->dma_dir);
728 SBP2_DMA_FREE("single page"); 638 /* XXX: Check for CMD_DMA_NONE bug */
729 } /* XXX: Check for CMD_DMA_NONE bug */
730 command->dma_type = CMD_DMA_NONE; 639 command->dma_type = CMD_DMA_NONE;
731 command->cmd_dma = 0; 640 command->cmd_dma = 0;
732 } 641 }
@@ -734,7 +643,6 @@ static void sbp2util_free_command_dma(struct sbp2_command_info *command)
734 if (command->sge_buffer) { 643 if (command->sge_buffer) {
735 pci_unmap_sg(host->pdev, command->sge_buffer, 644 pci_unmap_sg(host->pdev, command->sge_buffer,
736 command->dma_size, command->dma_dir); 645 command->dma_size, command->dma_dir);
737 SBP2_DMA_FREE("scatter list");
738 command->sge_buffer = NULL; 646 command->sge_buffer = NULL;
739 } 647 }
740} 648}
@@ -769,8 +677,6 @@ static int sbp2_probe(struct device *dev)
769 struct unit_directory *ud; 677 struct unit_directory *ud;
770 struct scsi_id_instance_data *scsi_id; 678 struct scsi_id_instance_data *scsi_id;
771 679
772 SBP2_DEBUG_ENTER();
773
774 ud = container_of(dev, struct unit_directory, device); 680 ud = container_of(dev, struct unit_directory, device);
775 681
776 /* Don't probe UD's that have the LUN flag. We'll probe the LUN(s) 682 /* Don't probe UD's that have the LUN flag. We'll probe the LUN(s)
@@ -794,8 +700,6 @@ static int sbp2_remove(struct device *dev)
794 struct scsi_id_instance_data *scsi_id; 700 struct scsi_id_instance_data *scsi_id;
795 struct scsi_device *sdev; 701 struct scsi_device *sdev;
796 702
797 SBP2_DEBUG_ENTER();
798
799 ud = container_of(dev, struct unit_directory, device); 703 ud = container_of(dev, struct unit_directory, device);
800 scsi_id = ud->device.driver_data; 704 scsi_id = ud->device.driver_data;
801 if (!scsi_id) 705 if (!scsi_id)
@@ -827,8 +731,6 @@ static int sbp2_update(struct unit_directory *ud)
827{ 731{
828 struct scsi_id_instance_data *scsi_id = ud->device.driver_data; 732 struct scsi_id_instance_data *scsi_id = ud->device.driver_data;
829 733
830 SBP2_DEBUG_ENTER();
831
832 if (sbp2_reconnect_device(scsi_id)) { 734 if (sbp2_reconnect_device(scsi_id)) {
833 735
834 /* 736 /*
@@ -877,8 +779,6 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
877 struct Scsi_Host *scsi_host = NULL; 779 struct Scsi_Host *scsi_host = NULL;
878 struct scsi_id_instance_data *scsi_id = NULL; 780 struct scsi_id_instance_data *scsi_id = NULL;
879 781
880 SBP2_DEBUG_ENTER();
881
882 scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL); 782 scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL);
883 if (!scsi_id) { 783 if (!scsi_id) {
884 SBP2_ERR("failed to create scsi_id"); 784 SBP2_ERR("failed to create scsi_id");
@@ -906,7 +806,6 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
906 SBP2_ERR("failed to allocate hostinfo"); 806 SBP2_ERR("failed to allocate hostinfo");
907 goto failed_alloc; 807 goto failed_alloc;
908 } 808 }
909 SBP2_DEBUG("sbp2_alloc_device: allocated hostinfo");
910 hi->host = ud->ne->host; 809 hi->host = ud->ne->host;
911 INIT_LIST_HEAD(&hi->scsi_ids); 810 INIT_LIST_HEAD(&hi->scsi_ids);
912 811
@@ -997,8 +896,6 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
997 struct sbp2scsi_host_info *hi = scsi_id->hi; 896 struct sbp2scsi_host_info *hi = scsi_id->hi;
998 int error; 897 int error;
999 898
1000 SBP2_DEBUG_ENTER();
1001
1002 /* Login FIFO DMA */ 899 /* Login FIFO DMA */
1003 scsi_id->login_response = 900 scsi_id->login_response =
1004 pci_alloc_consistent(hi->host->pdev, 901 pci_alloc_consistent(hi->host->pdev,
@@ -1006,7 +903,6 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
1006 &scsi_id->login_response_dma); 903 &scsi_id->login_response_dma);
1007 if (!scsi_id->login_response) 904 if (!scsi_id->login_response)
1008 goto alloc_fail; 905 goto alloc_fail;
1009 SBP2_DMA_ALLOC("consistent DMA region for login FIFO");
1010 906
1011 /* Query logins ORB DMA */ 907 /* Query logins ORB DMA */
1012 scsi_id->query_logins_orb = 908 scsi_id->query_logins_orb =
@@ -1015,7 +911,6 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
1015 &scsi_id->query_logins_orb_dma); 911 &scsi_id->query_logins_orb_dma);
1016 if (!scsi_id->query_logins_orb) 912 if (!scsi_id->query_logins_orb)
1017 goto alloc_fail; 913 goto alloc_fail;
1018 SBP2_DMA_ALLOC("consistent DMA region for query logins ORB");
1019 914
1020 /* Query logins response DMA */ 915 /* Query logins response DMA */
1021 scsi_id->query_logins_response = 916 scsi_id->query_logins_response =
@@ -1024,7 +919,6 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
1024 &scsi_id->query_logins_response_dma); 919 &scsi_id->query_logins_response_dma);
1025 if (!scsi_id->query_logins_response) 920 if (!scsi_id->query_logins_response)
1026 goto alloc_fail; 921 goto alloc_fail;
1027 SBP2_DMA_ALLOC("consistent DMA region for query logins response");
1028 922
1029 /* Reconnect ORB DMA */ 923 /* Reconnect ORB DMA */
1030 scsi_id->reconnect_orb = 924 scsi_id->reconnect_orb =
@@ -1033,7 +927,6 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
1033 &scsi_id->reconnect_orb_dma); 927 &scsi_id->reconnect_orb_dma);
1034 if (!scsi_id->reconnect_orb) 928 if (!scsi_id->reconnect_orb)
1035 goto alloc_fail; 929 goto alloc_fail;
1036 SBP2_DMA_ALLOC("consistent DMA region for reconnect ORB");
1037 930
1038 /* Logout ORB DMA */ 931 /* Logout ORB DMA */
1039 scsi_id->logout_orb = 932 scsi_id->logout_orb =
@@ -1042,7 +935,6 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
1042 &scsi_id->logout_orb_dma); 935 &scsi_id->logout_orb_dma);
1043 if (!scsi_id->logout_orb) 936 if (!scsi_id->logout_orb)
1044 goto alloc_fail; 937 goto alloc_fail;
1045 SBP2_DMA_ALLOC("consistent DMA region for logout ORB");
1046 938
1047 /* Login ORB DMA */ 939 /* Login ORB DMA */
1048 scsi_id->login_orb = 940 scsi_id->login_orb =
@@ -1051,9 +943,6 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
1051 &scsi_id->login_orb_dma); 943 &scsi_id->login_orb_dma);
1052 if (!scsi_id->login_orb) 944 if (!scsi_id->login_orb)
1053 goto alloc_fail; 945 goto alloc_fail;
1054 SBP2_DMA_ALLOC("consistent DMA region for login ORB");
1055
1056 SBP2_DEBUG("New SBP-2 device inserted, SCSI ID = %x", scsi_id->ud->id);
1057 946
1058 /* 947 /*
1059 * Create our command orb pool 948 * Create our command orb pool
@@ -1123,8 +1012,6 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
1123{ 1012{
1124 struct sbp2scsi_host_info *hi; 1013 struct sbp2scsi_host_info *hi;
1125 1014
1126 SBP2_DEBUG_ENTER();
1127
1128 if (!scsi_id) 1015 if (!scsi_id)
1129 return; 1016 return;
1130 1017
@@ -1140,53 +1027,36 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
1140 1027
1141 list_del(&scsi_id->scsi_list); 1028 list_del(&scsi_id->scsi_list);
1142 1029
1143 if (scsi_id->login_response) { 1030 if (scsi_id->login_response)
1144 pci_free_consistent(hi->host->pdev, 1031 pci_free_consistent(hi->host->pdev,
1145 sizeof(struct sbp2_login_response), 1032 sizeof(struct sbp2_login_response),
1146 scsi_id->login_response, 1033 scsi_id->login_response,
1147 scsi_id->login_response_dma); 1034 scsi_id->login_response_dma);
1148 SBP2_DMA_FREE("single login FIFO"); 1035 if (scsi_id->login_orb)
1149 }
1150
1151 if (scsi_id->login_orb) {
1152 pci_free_consistent(hi->host->pdev, 1036 pci_free_consistent(hi->host->pdev,
1153 sizeof(struct sbp2_login_orb), 1037 sizeof(struct sbp2_login_orb),
1154 scsi_id->login_orb, 1038 scsi_id->login_orb,
1155 scsi_id->login_orb_dma); 1039 scsi_id->login_orb_dma);
1156 SBP2_DMA_FREE("single login ORB"); 1040 if (scsi_id->reconnect_orb)
1157 }
1158
1159 if (scsi_id->reconnect_orb) {
1160 pci_free_consistent(hi->host->pdev, 1041 pci_free_consistent(hi->host->pdev,
1161 sizeof(struct sbp2_reconnect_orb), 1042 sizeof(struct sbp2_reconnect_orb),
1162 scsi_id->reconnect_orb, 1043 scsi_id->reconnect_orb,
1163 scsi_id->reconnect_orb_dma); 1044 scsi_id->reconnect_orb_dma);
1164 SBP2_DMA_FREE("single reconnect orb"); 1045 if (scsi_id->logout_orb)
1165 }
1166
1167 if (scsi_id->logout_orb) {
1168 pci_free_consistent(hi->host->pdev, 1046 pci_free_consistent(hi->host->pdev,
1169 sizeof(struct sbp2_logout_orb), 1047 sizeof(struct sbp2_logout_orb),
1170 scsi_id->logout_orb, 1048 scsi_id->logout_orb,
1171 scsi_id->logout_orb_dma); 1049 scsi_id->logout_orb_dma);
1172 SBP2_DMA_FREE("single logout orb"); 1050 if (scsi_id->query_logins_orb)
1173 }
1174
1175 if (scsi_id->query_logins_orb) {
1176 pci_free_consistent(hi->host->pdev, 1051 pci_free_consistent(hi->host->pdev,
1177 sizeof(struct sbp2_query_logins_orb), 1052 sizeof(struct sbp2_query_logins_orb),
1178 scsi_id->query_logins_orb, 1053 scsi_id->query_logins_orb,
1179 scsi_id->query_logins_orb_dma); 1054 scsi_id->query_logins_orb_dma);
1180 SBP2_DMA_FREE("single query logins orb"); 1055 if (scsi_id->query_logins_response)
1181 }
1182
1183 if (scsi_id->query_logins_response) {
1184 pci_free_consistent(hi->host->pdev, 1056 pci_free_consistent(hi->host->pdev,
1185 sizeof(struct sbp2_query_logins_response), 1057 sizeof(struct sbp2_query_logins_response),
1186 scsi_id->query_logins_response, 1058 scsi_id->query_logins_response,
1187 scsi_id->query_logins_response_dma); 1059 scsi_id->query_logins_response_dma);
1188 SBP2_DMA_FREE("single query logins data");
1189 }
1190 1060
1191 if (scsi_id->status_fifo_addr != CSR1212_INVALID_ADDR_SPACE) 1061 if (scsi_id->status_fifo_addr != CSR1212_INVALID_ADDR_SPACE)
1192 hpsb_unregister_addrspace(&sbp2_highlevel, hi->host, 1062 hpsb_unregister_addrspace(&sbp2_highlevel, hi->host,
@@ -1197,8 +1067,6 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
1197 if (hi) 1067 if (hi)
1198 module_put(hi->host->driver->owner); 1068 module_put(hi->host->driver->owner);
1199 1069
1200 SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id);
1201
1202 kfree(scsi_id); 1070 kfree(scsi_id);
1203} 1071}
1204 1072
@@ -1216,8 +1084,6 @@ static int sbp2_handle_physdma_write(struct hpsb_host *host, int nodeid,
1216 * Manually put the data in the right place. 1084 * Manually put the data in the right place.
1217 */ 1085 */
1218 memcpy(bus_to_virt((u32) addr), data, length); 1086 memcpy(bus_to_virt((u32) addr), data, length);
1219 sbp2util_packet_dump(data, length, "sbp2 phys dma write by device",
1220 (u32) addr);
1221 return RCODE_COMPLETE; 1087 return RCODE_COMPLETE;
1222} 1088}
1223 1089
@@ -1234,8 +1100,6 @@ static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid,
1234 * Grab data from memory and send a read response. 1100 * Grab data from memory and send a read response.
1235 */ 1101 */
1236 memcpy(data, bus_to_virt((u32) addr), length); 1102 memcpy(data, bus_to_virt((u32) addr), length);
1237 sbp2util_packet_dump(data, length, "sbp2 phys dma read by device",
1238 (u32) addr);
1239 return RCODE_COMPLETE; 1103 return RCODE_COMPLETE;
1240} 1104}
1241#endif 1105#endif
@@ -1255,8 +1119,6 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1255 int max_logins; 1119 int max_logins;
1256 int active_logins; 1120 int active_logins;
1257 1121
1258 SBP2_DEBUG_ENTER();
1259
1260 scsi_id->query_logins_orb->reserved1 = 0x0; 1122 scsi_id->query_logins_orb->reserved1 = 0x0;
1261 scsi_id->query_logins_orb->reserved2 = 0x0; 1123 scsi_id->query_logins_orb->reserved2 = 0x0;
1262 1124
@@ -1277,9 +1139,6 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1277 1139
1278 sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb)); 1140 sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb));
1279 1141
1280 sbp2util_packet_dump(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb),
1281 "sbp2 query logins orb", scsi_id->query_logins_orb_dma);
1282
1283 memset(scsi_id->query_logins_response, 0, sizeof(struct sbp2_query_logins_response)); 1142 memset(scsi_id->query_logins_response, 0, sizeof(struct sbp2_query_logins_response));
1284 1143
1285 data[0] = ORB_SET_NODE_ID(hi->host->node_id); 1144 data[0] = ORB_SET_NODE_ID(hi->host->node_id);
@@ -1305,9 +1164,6 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
1305 1164
1306 sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_response, sizeof(struct sbp2_query_logins_response)); 1165 sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_response, sizeof(struct sbp2_query_logins_response));
1307 1166
1308 SBP2_DEBUG("length_max_logins = %x",
1309 (unsigned int)scsi_id->query_logins_response->length_max_logins);
1310
1311 max_logins = RESPONSE_GET_MAX_LOGINS(scsi_id->query_logins_response->length_max_logins); 1167 max_logins = RESPONSE_GET_MAX_LOGINS(scsi_id->query_logins_response->length_max_logins);
1312 SBP2_INFO("Maximum concurrent logins supported: %d", max_logins); 1168 SBP2_INFO("Maximum concurrent logins supported: %d", max_logins);
1313 1169
@@ -1330,12 +1186,8 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1330 struct sbp2scsi_host_info *hi = scsi_id->hi; 1186 struct sbp2scsi_host_info *hi = scsi_id->hi;
1331 quadlet_t data[2]; 1187 quadlet_t data[2];
1332 1188
1333 SBP2_DEBUG_ENTER(); 1189 if (!scsi_id->login_orb)
1334
1335 if (!scsi_id->login_orb) {
1336 SBP2_DEBUG("%s: login_orb not alloc'd!", __FUNCTION__);
1337 return -EIO; 1190 return -EIO;
1338 }
1339 1191
1340 if (!exclusive_login) { 1192 if (!exclusive_login) {
1341 if (sbp2_query_logins(scsi_id)) { 1193 if (sbp2_query_logins(scsi_id)) {
@@ -1367,9 +1219,6 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1367 1219
1368 sbp2util_cpu_to_be32_buffer(scsi_id->login_orb, sizeof(struct sbp2_login_orb)); 1220 sbp2util_cpu_to_be32_buffer(scsi_id->login_orb, sizeof(struct sbp2_login_orb));
1369 1221
1370 sbp2util_packet_dump(scsi_id->login_orb, sizeof(struct sbp2_login_orb),
1371 "sbp2 login orb", scsi_id->login_orb_dma);
1372
1373 memset(scsi_id->login_response, 0, sizeof(struct sbp2_login_response)); 1222 memset(scsi_id->login_response, 0, sizeof(struct sbp2_login_response));
1374 1223
1375 data[0] = ORB_SET_NODE_ID(hi->host->node_id); 1224 data[0] = ORB_SET_NODE_ID(hi->host->node_id);
@@ -1408,11 +1257,6 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
1408 /* 1257 /*
1409 * Grab our command block agent address from the login response. 1258 * Grab our command block agent address from the login response.
1410 */ 1259 */
1411 SBP2_DEBUG("command_block_agent_hi = %x",
1412 (unsigned int)scsi_id->login_response->command_block_agent_hi);
1413 SBP2_DEBUG("command_block_agent_lo = %x",
1414 (unsigned int)scsi_id->login_response->command_block_agent_lo);
1415
1416 scsi_id->sbp2_command_block_agent_addr = 1260 scsi_id->sbp2_command_block_agent_addr =
1417 ((u64)scsi_id->login_response->command_block_agent_hi) << 32; 1261 ((u64)scsi_id->login_response->command_block_agent_hi) << 32;
1418 scsi_id->sbp2_command_block_agent_addr |= ((u64)scsi_id->login_response->command_block_agent_lo); 1262 scsi_id->sbp2_command_block_agent_addr |= ((u64)scsi_id->login_response->command_block_agent_lo);
@@ -1432,8 +1276,6 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id)
1432 quadlet_t data[2]; 1276 quadlet_t data[2];
1433 int error; 1277 int error;
1434 1278
1435 SBP2_DEBUG_ENTER();
1436
1437 /* 1279 /*
1438 * Set-up logout ORB 1280 * Set-up logout ORB
1439 */ 1281 */
@@ -1459,9 +1301,6 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id)
1459 */ 1301 */
1460 sbp2util_cpu_to_be32_buffer(scsi_id->logout_orb, sizeof(struct sbp2_logout_orb)); 1302 sbp2util_cpu_to_be32_buffer(scsi_id->logout_orb, sizeof(struct sbp2_logout_orb));
1461 1303
1462 sbp2util_packet_dump(scsi_id->logout_orb, sizeof(struct sbp2_logout_orb),
1463 "sbp2 logout orb", scsi_id->logout_orb_dma);
1464
1465 /* 1304 /*
1466 * Ok, let's write to the target's management agent register 1305 * Ok, let's write to the target's management agent register
1467 */ 1306 */
@@ -1492,8 +1331,6 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id)
1492 quadlet_t data[2]; 1331 quadlet_t data[2];
1493 int error; 1332 int error;
1494 1333
1495 SBP2_DEBUG_ENTER();
1496
1497 /* 1334 /*
1498 * Set-up reconnect ORB 1335 * Set-up reconnect ORB
1499 */ 1336 */
@@ -1520,9 +1357,6 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id)
1520 */ 1357 */
1521 sbp2util_cpu_to_be32_buffer(scsi_id->reconnect_orb, sizeof(struct sbp2_reconnect_orb)); 1358 sbp2util_cpu_to_be32_buffer(scsi_id->reconnect_orb, sizeof(struct sbp2_reconnect_orb));
1522 1359
1523 sbp2util_packet_dump(scsi_id->reconnect_orb, sizeof(struct sbp2_reconnect_orb),
1524 "sbp2 reconnect orb", scsi_id->reconnect_orb_dma);
1525
1526 data[0] = ORB_SET_NODE_ID(hi->host->node_id); 1360 data[0] = ORB_SET_NODE_ID(hi->host->node_id);
1527 data[1] = scsi_id->reconnect_orb_dma; 1361 data[1] = scsi_id->reconnect_orb_dma;
1528 sbp2util_cpu_to_be32_buffer(data, 8); 1362 sbp2util_cpu_to_be32_buffer(data, 8);
@@ -1565,8 +1399,6 @@ static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id)
1565{ 1399{
1566 quadlet_t data; 1400 quadlet_t data;
1567 1401
1568 SBP2_DEBUG_ENTER();
1569
1570 data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE); 1402 data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE);
1571 if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) 1403 if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4))
1572 SBP2_ERR("%s error", __FUNCTION__); 1404 SBP2_ERR("%s error", __FUNCTION__);
@@ -1589,8 +1421,6 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1589 unsigned workarounds; 1421 unsigned workarounds;
1590 int i; 1422 int i;
1591 1423
1592 SBP2_DEBUG_ENTER();
1593
1594 management_agent_addr = 0x0; 1424 management_agent_addr = 0x0;
1595 command_set_spec_id = 0x0; 1425 command_set_spec_id = 0x0;
1596 command_set = 0x0; 1426 command_set = 0x0;
@@ -1601,32 +1431,25 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1601 csr1212_for_each_dir_entry(ud->ne->csr, kv, ud->ud_kv, dentry) { 1431 csr1212_for_each_dir_entry(ud->ne->csr, kv, ud->ud_kv, dentry) {
1602 switch (kv->key.id) { 1432 switch (kv->key.id) {
1603 case CSR1212_KV_ID_DEPENDENT_INFO: 1433 case CSR1212_KV_ID_DEPENDENT_INFO:
1604 if (kv->key.type == CSR1212_KV_TYPE_CSR_OFFSET) { 1434 if (kv->key.type == CSR1212_KV_TYPE_CSR_OFFSET)
1605 /* Save off the management agent address */ 1435 /* Save off the management agent address */
1606 management_agent_addr = 1436 management_agent_addr =
1607 CSR1212_REGISTER_SPACE_BASE + 1437 CSR1212_REGISTER_SPACE_BASE +
1608 (kv->value.csr_offset << 2); 1438 (kv->value.csr_offset << 2);
1609 1439
1610 SBP2_DEBUG("sbp2_management_agent_addr = %x", 1440 else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE)
1611 (unsigned int)management_agent_addr);
1612 } else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
1613 scsi_id->sbp2_lun = 1441 scsi_id->sbp2_lun =
1614 ORB_SET_LUN(kv->value.immediate); 1442 ORB_SET_LUN(kv->value.immediate);
1615 }
1616 break; 1443 break;
1617 1444
1618 case SBP2_COMMAND_SET_SPEC_ID_KEY: 1445 case SBP2_COMMAND_SET_SPEC_ID_KEY:
1619 /* Command spec organization */ 1446 /* Command spec organization */
1620 command_set_spec_id = kv->value.immediate; 1447 command_set_spec_id = kv->value.immediate;
1621 SBP2_DEBUG("sbp2_command_set_spec_id = %x",
1622 (unsigned int)command_set_spec_id);
1623 break; 1448 break;
1624 1449
1625 case SBP2_COMMAND_SET_KEY: 1450 case SBP2_COMMAND_SET_KEY:
1626 /* Command set used by sbp2 device */ 1451 /* Command set used by sbp2 device */
1627 command_set = kv->value.immediate; 1452 command_set = kv->value.immediate;
1628 SBP2_DEBUG("sbp2_command_set = %x",
1629 (unsigned int)command_set);
1630 break; 1453 break;
1631 1454
1632 case SBP2_UNIT_CHARACTERISTICS_KEY: 1455 case SBP2_UNIT_CHARACTERISTICS_KEY:
@@ -1635,15 +1458,11 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
1635 * that I'm not yet paying attention to) 1458 * that I'm not yet paying attention to)
1636 */ 1459 */
1637 unit_characteristics = kv->value.immediate; 1460 unit_characteristics = kv->value.immediate;
1638 SBP2_DEBUG("sbp2_unit_characteristics = %x",
1639 (unsigned int)unit_characteristics);
1640 break; 1461 break;
1641 1462
1642 case SBP2_FIRMWARE_REVISION_KEY: 1463 case SBP2_FIRMWARE_REVISION_KEY:
1643 /* Firmware revision */ 1464 /* Firmware revision */
1644 firmware_revision = kv->value.immediate; 1465 firmware_revision = kv->value.immediate;
1645 SBP2_DEBUG("sbp2_firmware_revision = %x",
1646 (unsigned int)firmware_revision);
1647 break; 1466 break;
1648 1467
1649 default: 1468 default:
@@ -1719,8 +1538,6 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
1719 struct sbp2scsi_host_info *hi = scsi_id->hi; 1538 struct sbp2scsi_host_info *hi = scsi_id->hi;
1720 u8 payload; 1539 u8 payload;
1721 1540
1722 SBP2_DEBUG_ENTER();
1723
1724 scsi_id->speed_code = 1541 scsi_id->speed_code =
1725 hi->host->speed[NODEID_TO_NODE(scsi_id->ne->nodeid)]; 1542 hi->host->speed[NODEID_TO_NODE(scsi_id->ne->nodeid)];
1726 1543
@@ -1761,8 +1578,6 @@ static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait)
1761 int retval; 1578 int retval;
1762 unsigned long flags; 1579 unsigned long flags;
1763 1580
1764 SBP2_DEBUG_ENTER();
1765
1766 cancel_delayed_work(&scsi_id->protocol_work); 1581 cancel_delayed_work(&scsi_id->protocol_work);
1767 if (wait) 1582 if (wait)
1768 flush_scheduled_work(); 1583 flush_scheduled_work();
@@ -1806,7 +1621,6 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1806 if ((scsi_use_sg == 1) && 1621 if ((scsi_use_sg == 1) &&
1807 (sgpnt[0].length <= SBP2_MAX_SG_ELEMENT_LENGTH)) { 1622 (sgpnt[0].length <= SBP2_MAX_SG_ELEMENT_LENGTH)) {
1808 1623
1809 SBP2_DEBUG("Only one s/g element");
1810 command->dma_size = sgpnt[0].length; 1624 command->dma_size = sgpnt[0].length;
1811 command->dma_type = CMD_DMA_PAGE; 1625 command->dma_type = CMD_DMA_PAGE;
1812 command->cmd_dma = pci_map_page(hi->host->pdev, 1626 command->cmd_dma = pci_map_page(hi->host->pdev,
@@ -1814,7 +1628,6 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1814 sgpnt[0].offset, 1628 sgpnt[0].offset,
1815 command->dma_size, 1629 command->dma_size,
1816 command->dma_dir); 1630 command->dma_dir);
1817 SBP2_DMA_ALLOC("single page scatter element");
1818 1631
1819 orb->data_descriptor_lo = command->cmd_dma; 1632 orb->data_descriptor_lo = command->cmd_dma;
1820 orb->misc |= ORB_SET_DATA_SIZE(command->dma_size); 1633 orb->misc |= ORB_SET_DATA_SIZE(command->dma_size);
@@ -1827,8 +1640,6 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1827 int i, count = pci_map_sg(hi->host->pdev, sgpnt, scsi_use_sg, 1640 int i, count = pci_map_sg(hi->host->pdev, sgpnt, scsi_use_sg,
1828 dma_dir); 1641 dma_dir);
1829 1642
1830 SBP2_DMA_ALLOC("scatter list");
1831
1832 command->dma_size = scsi_use_sg; 1643 command->dma_size = scsi_use_sg;
1833 command->sge_buffer = sgpnt; 1644 command->sge_buffer = sgpnt;
1834 1645
@@ -1862,10 +1673,6 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1862 /* Number of page table (s/g) elements */ 1673 /* Number of page table (s/g) elements */
1863 orb->misc |= ORB_SET_DATA_SIZE(sg_count); 1674 orb->misc |= ORB_SET_DATA_SIZE(sg_count);
1864 1675
1865 sbp2util_packet_dump(sg_element,
1866 (sizeof(struct sbp2_unrestricted_page_table)) * sg_count,
1867 "sbp2 s/g list", command->sge_dma);
1868
1869 /* Byte swap page tables if necessary */ 1676 /* Byte swap page tables if necessary */
1870 sbp2util_cpu_to_be32_buffer(sg_element, 1677 sbp2util_cpu_to_be32_buffer(sg_element,
1871 (sizeof(struct sbp2_unrestricted_page_table)) * 1678 (sizeof(struct sbp2_unrestricted_page_table)) *
@@ -1890,8 +1697,6 @@ static void sbp2_prep_command_orb_no_sg(struct sbp2_command_orb *orb,
1890 orb->data_descriptor_hi = ORB_SET_NODE_ID(hi->host->node_id); 1697 orb->data_descriptor_hi = ORB_SET_NODE_ID(hi->host->node_id);
1891 orb->misc |= ORB_SET_DIRECTION(orb_direction); 1698 orb->misc |= ORB_SET_DIRECTION(orb_direction);
1892 1699
1893 SBP2_DMA_ALLOC("single bulk");
1894
1895 /* 1700 /*
1896 * Handle case where we get a command w/o s/g enabled (but 1701 * Handle case where we get a command w/o s/g enabled (but
1897 * check for transfers larger than 64K) 1702 * check for transfers larger than 64K)
@@ -1941,10 +1746,6 @@ static void sbp2_prep_command_orb_no_sg(struct sbp2_command_orb *orb,
1941 /* Number of page table (s/g) elements */ 1746 /* Number of page table (s/g) elements */
1942 orb->misc |= ORB_SET_DATA_SIZE(sg_count); 1747 orb->misc |= ORB_SET_DATA_SIZE(sg_count);
1943 1748
1944 sbp2util_packet_dump(sg_element,
1945 (sizeof(struct sbp2_unrestricted_page_table)) * sg_count,
1946 "sbp2 s/g list", command->sge_dma);
1947
1948 /* Byte swap page tables if necessary */ 1749 /* Byte swap page tables if necessary */
1949 sbp2util_cpu_to_be32_buffer(sg_element, 1750 sbp2util_cpu_to_be32_buffer(sg_element,
1950 (sizeof(struct sbp2_unrestricted_page_table)) * 1751 (sizeof(struct sbp2_unrestricted_page_table)) *
@@ -1996,20 +1797,16 @@ static void sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
1996 1797
1997 /* Set-up our pagetable stuff */ 1798 /* Set-up our pagetable stuff */
1998 if (orb_direction == ORB_DIRECTION_NO_DATA_TRANSFER) { 1799 if (orb_direction == ORB_DIRECTION_NO_DATA_TRANSFER) {
1999 SBP2_DEBUG("No data transfer");
2000 command_orb->data_descriptor_hi = 0x0; 1800 command_orb->data_descriptor_hi = 0x0;
2001 command_orb->data_descriptor_lo = 0x0; 1801 command_orb->data_descriptor_lo = 0x0;
2002 command_orb->misc |= ORB_SET_DIRECTION(1); 1802 command_orb->misc |= ORB_SET_DIRECTION(1);
2003 } else if (scsi_use_sg) { 1803 } else if (scsi_use_sg)
2004 SBP2_DEBUG("Use scatter/gather");
2005 sbp2_prep_command_orb_sg(command_orb, hi, command, scsi_use_sg, 1804 sbp2_prep_command_orb_sg(command_orb, hi, command, scsi_use_sg,
2006 sgpnt, orb_direction, dma_dir); 1805 sgpnt, orb_direction, dma_dir);
2007 } else { 1806 else
2008 SBP2_DEBUG("No scatter/gather");
2009 sbp2_prep_command_orb_no_sg(command_orb, hi, command, sgpnt, 1807 sbp2_prep_command_orb_no_sg(command_orb, hi, command, sgpnt,
2010 orb_direction, scsi_request_bufflen, 1808 orb_direction, scsi_request_bufflen,
2011 scsi_request_buffer, dma_dir); 1809 scsi_request_buffer, dma_dir);
2012 }
2013 1810
2014 /* Byte swap command ORB if necessary */ 1811 /* Byte swap command ORB if necessary */
2015 sbp2util_cpu_to_be32_buffer(command_orb, sizeof(struct sbp2_command_orb)); 1812 sbp2util_cpu_to_be32_buffer(command_orb, sizeof(struct sbp2_command_orb));
@@ -2034,10 +1831,6 @@ static void sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
2034 size_t length; 1831 size_t length;
2035 unsigned long flags; 1832 unsigned long flags;
2036 1833
2037 outstanding_orb_incr;
2038 SBP2_ORB_DEBUG("sending command orb %p, total orbs = %x",
2039 command_orb, global_outstanding_command_orbs);
2040
2041 pci_dma_sync_single_for_device(hi->host->pdev, command->command_orb_dma, 1834 pci_dma_sync_single_for_device(hi->host->pdev, command->command_orb_dma,
2042 sizeof(struct sbp2_command_orb), 1835 sizeof(struct sbp2_command_orb),
2043 PCI_DMA_TODEVICE); 1836 PCI_DMA_TODEVICE);
@@ -2086,8 +1879,6 @@ static void sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
2086 scsi_id->last_orb_dma = command->command_orb_dma; 1879 scsi_id->last_orb_dma = command->command_orb_dma;
2087 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); 1880 spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
2088 1881
2089 SBP2_ORB_DEBUG("write to %s register, command orb %p",
2090 last_orb ? "DOORBELL" : "ORB_POINTER", command_orb);
2091 if (sbp2util_node_write_no_wait(scsi_id->ne, addr, data, length)) { 1882 if (sbp2util_node_write_no_wait(scsi_id->ne, addr, data, length)) {
2092 /* 1883 /*
2093 * sbp2util_node_write_no_wait failed. We certainly ran out 1884 * sbp2util_node_write_no_wait failed. We certainly ran out
@@ -2116,17 +1907,12 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
2116 unsigned int request_bufflen = SCpnt->request_bufflen; 1907 unsigned int request_bufflen = SCpnt->request_bufflen;
2117 struct sbp2_command_info *command; 1908 struct sbp2_command_info *command;
2118 1909
2119 SBP2_DEBUG_ENTER();
2120 SBP2_DEBUG("SCSI transfer size = %x", request_bufflen);
2121 SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg);
2122
2123 /* 1910 /*
2124 * Allocate a command orb and s/g structure 1911 * Allocate a command orb and s/g structure
2125 */ 1912 */
2126 command = sbp2util_allocate_command_orb(scsi_id, SCpnt, done); 1913 command = sbp2util_allocate_command_orb(scsi_id, SCpnt, done);
2127 if (!command) { 1914 if (!command)
2128 return -EIO; 1915 return -EIO;
2129 }
2130 1916
2131 /* 1917 /*
2132 * Now actually fill in the comamnd orb and sbp2 s/g list 1918 * Now actually fill in the comamnd orb and sbp2 s/g list
@@ -2135,9 +1921,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
2135 request_bufflen, SCpnt->request_buffer, 1921 request_bufflen, SCpnt->request_buffer,
2136 SCpnt->sc_data_direction); 1922 SCpnt->sc_data_direction);
2137 1923
2138 sbp2util_packet_dump(&command->command_orb, sizeof(struct sbp2_command_orb),
2139 "sbp2 command orb", command->command_orb_dma);
2140
2141 /* 1924 /*
2142 * Link up the orb, and ring the doorbell if needed 1925 * Link up the orb, and ring the doorbell if needed
2143 */ 1926 */
@@ -2151,8 +1934,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
2151 */ 1934 */
2152static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data) 1935static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data)
2153{ 1936{
2154 SBP2_DEBUG_ENTER();
2155
2156 /* 1937 /*
2157 * Ok, it's pretty ugly... ;-) 1938 * Ok, it's pretty ugly... ;-)
2158 */ 1939 */
@@ -2191,10 +1972,6 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
2191 struct sbp2_command_info *command; 1972 struct sbp2_command_info *command;
2192 unsigned long flags; 1973 unsigned long flags;
2193 1974
2194 SBP2_DEBUG_ENTER();
2195
2196 sbp2util_packet_dump(data, length, "sbp2 status write by device", (u32)addr);
2197
2198 if (unlikely(length < 8 || length > sizeof(struct sbp2_status_block))) { 1975 if (unlikely(length < 8 || length > sizeof(struct sbp2_status_block))) {
2199 SBP2_ERR("Wrong size of status block"); 1976 SBP2_ERR("Wrong size of status block");
2200 return RCODE_ADDRESS_ERROR; 1977 return RCODE_ADDRESS_ERROR;
@@ -2244,17 +2021,12 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
2244 command = sbp2util_find_command_for_orb(scsi_id, 2021 command = sbp2util_find_command_for_orb(scsi_id,
2245 sb->ORB_offset_lo); 2022 sb->ORB_offset_lo);
2246 if (command) { 2023 if (command) {
2247 SBP2_DEBUG("Found status for command ORB");
2248 pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma, 2024 pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma,
2249 sizeof(struct sbp2_command_orb), 2025 sizeof(struct sbp2_command_orb),
2250 PCI_DMA_TODEVICE); 2026 PCI_DMA_TODEVICE);
2251 pci_dma_sync_single_for_cpu(hi->host->pdev, command->sge_dma, 2027 pci_dma_sync_single_for_cpu(hi->host->pdev, command->sge_dma,
2252 sizeof(command->scatter_gather_element), 2028 sizeof(command->scatter_gather_element),
2253 PCI_DMA_BIDIRECTIONAL); 2029 PCI_DMA_BIDIRECTIONAL);
2254
2255 SBP2_ORB_DEBUG("matched command orb %p", &command->command_orb);
2256 outstanding_orb_decr;
2257
2258 /* 2030 /*
2259 * Matched status with command, now grab scsi command pointers 2031 * Matched status with command, now grab scsi command pointers
2260 * and check status. 2032 * and check status.
@@ -2283,21 +2055,15 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
2283 /* 2055 /*
2284 * See if the target stored any scsi status information. 2056 * See if the target stored any scsi status information.
2285 */ 2057 */
2286 if (STATUS_GET_LEN(h) > 1) { 2058 if (STATUS_GET_LEN(h) > 1)
2287 SBP2_DEBUG("CHECK CONDITION");
2288 scsi_status = sbp2_status_to_sense_data( 2059 scsi_status = sbp2_status_to_sense_data(
2289 (unchar *)sb, SCpnt->sense_buffer); 2060 (unchar *)sb, SCpnt->sense_buffer);
2290 }
2291 /* 2061 /*
2292 * Check to see if the dead bit is set. If so, we'll 2062 * Check to see if the dead bit is set. If so, we'll
2293 * have to initiate a fetch agent reset. 2063 * have to initiate a fetch agent reset.
2294 */ 2064 */
2295 if (STATUS_TEST_DEAD(h)) { 2065 if (STATUS_TEST_DEAD(h))
2296 SBP2_DEBUG("Dead bit set - "
2297 "initiating fetch agent reset");
2298 sbp2_agent_reset(scsi_id, 0); 2066 sbp2_agent_reset(scsi_id, 0);
2299 }
2300 SBP2_ORB_DEBUG("completing command orb %p", &command->command_orb);
2301 } 2067 }
2302 2068
2303 /* 2069 /*
@@ -2326,13 +2092,9 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
2326 } 2092 }
2327 } 2093 }
2328 2094
2329 if (SCpnt) { 2095 if (SCpnt)
2330 SBP2_DEBUG("Completing SCSI command");
2331 sbp2scsi_complete_command(scsi_id, scsi_status, SCpnt, 2096 sbp2scsi_complete_command(scsi_id, scsi_status, SCpnt,
2332 command->Current_done); 2097 command->Current_done);
2333 SBP2_ORB_DEBUG("command orb completed");
2334 }
2335
2336 return RCODE_COMPLETE; 2098 return RCODE_COMPLETE;
2337} 2099}
2338 2100
@@ -2352,11 +2114,6 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
2352 struct sbp2scsi_host_info *hi; 2114 struct sbp2scsi_host_info *hi;
2353 int result = DID_NO_CONNECT << 16; 2115 int result = DID_NO_CONNECT << 16;
2354 2116
2355 SBP2_DEBUG_ENTER();
2356#if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP)
2357 scsi_print_command(SCpnt);
2358#endif
2359
2360 if (!sbp2util_node_is_available(scsi_id)) 2117 if (!sbp2util_node_is_available(scsi_id))
2361 goto done; 2118 goto done;
2362 2119
@@ -2379,7 +2136,6 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
2379 * (autorequest sense) 2136 * (autorequest sense)
2380 */ 2137 */
2381 if (SCpnt->cmnd[0] == REQUEST_SENSE) { 2138 if (SCpnt->cmnd[0] == REQUEST_SENSE) {
2382 SBP2_DEBUG("REQUEST_SENSE");
2383 memcpy(SCpnt->request_buffer, SCpnt->sense_buffer, SCpnt->request_bufflen); 2139 memcpy(SCpnt->request_buffer, SCpnt->sense_buffer, SCpnt->request_bufflen);
2384 memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer)); 2140 memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer));
2385 sbp2scsi_complete_command(scsi_id, SBP2_SCSI_STATUS_GOOD, SCpnt, done); 2141 sbp2scsi_complete_command(scsi_id, SBP2_SCSI_STATUS_GOOD, SCpnt, done);
@@ -2433,11 +2189,8 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id
2433 struct sbp2_command_info *command; 2189 struct sbp2_command_info *command;
2434 unsigned long flags; 2190 unsigned long flags;
2435 2191
2436 SBP2_DEBUG_ENTER();
2437
2438 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 2192 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
2439 while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { 2193 while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) {
2440 SBP2_DEBUG("Found pending command to complete");
2441 lh = scsi_id->sbp2_command_orb_inuse.next; 2194 lh = scsi_id->sbp2_command_orb_inuse.next;
2442 command = list_entry(lh, struct sbp2_command_info, list); 2195 command = list_entry(lh, struct sbp2_command_info, list);
2443 pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma, 2196 pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma,
@@ -2466,8 +2219,6 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2466 u32 scsi_status, struct scsi_cmnd *SCpnt, 2219 u32 scsi_status, struct scsi_cmnd *SCpnt,
2467 void (*done)(struct scsi_cmnd *)) 2220 void (*done)(struct scsi_cmnd *))
2468{ 2221{
2469 SBP2_DEBUG_ENTER();
2470
2471 /* 2222 /*
2472 * Sanity 2223 * Sanity
2473 */ 2224 */
@@ -2490,12 +2241,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2490 break; 2241 break;
2491 2242
2492 case SBP2_SCSI_STATUS_CHECK_CONDITION: 2243 case SBP2_SCSI_STATUS_CHECK_CONDITION:
2493 SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION");
2494 SCpnt->result = CHECK_CONDITION << 1 | DID_OK << 16; 2244 SCpnt->result = CHECK_CONDITION << 1 | DID_OK << 16;
2495#if CONFIG_IEEE1394_SBP2_DEBUG >= 1
2496 scsi_print_command(SCpnt);
2497 scsi_print_sense(SBP2_DEVICE_NAME, SCpnt);
2498#endif
2499 break; 2245 break;
2500 2246
2501 case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: 2247 case SBP2_SCSI_STATUS_SELECTION_TIMEOUT:
@@ -2590,7 +2336,6 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
2590 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); 2336 spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
2591 command = sbp2util_find_command_for_SCpnt(scsi_id, SCpnt); 2337 command = sbp2util_find_command_for_SCpnt(scsi_id, SCpnt);
2592 if (command) { 2338 if (command) {
2593 SBP2_DEBUG("Found command to abort");
2594 pci_dma_sync_single_for_cpu(hi->host->pdev, 2339 pci_dma_sync_single_for_cpu(hi->host->pdev,
2595 command->command_orb_dma, 2340 command->command_orb_dma,
2596 sizeof(struct sbp2_command_orb), 2341 sizeof(struct sbp2_command_orb),
@@ -2660,8 +2405,6 @@ static int sbp2_module_init(void)
2660{ 2405{
2661 int ret; 2406 int ret;
2662 2407
2663 SBP2_DEBUG_ENTER();
2664
2665 /* Module load debug option to force one command at a time (serializing I/O) */ 2408 /* Module load debug option to force one command at a time (serializing I/O) */
2666 if (serialize_io) { 2409 if (serialize_io) {
2667 scsi_driver_template.can_queue = 1; 2410 scsi_driver_template.can_queue = 1;
@@ -2688,10 +2431,7 @@ static int sbp2_module_init(void)
2688 2431
2689static void __exit sbp2_module_exit(void) 2432static void __exit sbp2_module_exit(void)
2690{ 2433{
2691 SBP2_DEBUG_ENTER();
2692
2693 hpsb_unregister_protocol(&sbp2_driver); 2434 hpsb_unregister_protocol(&sbp2_driver);
2694
2695 hpsb_unregister_highlevel(&sbp2_highlevel); 2435 hpsb_unregister_highlevel(&sbp2_highlevel);
2696} 2436}
2697 2437