diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ieee1394/sbp2.c | 110 |
1 files changed, 33 insertions, 77 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index eb7106b8fd0a..2c765ca5aa50 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -214,6 +214,7 @@ static u32 global_outstanding_dmas = 0; | |||
214 | #endif | 214 | #endif |
215 | 215 | ||
216 | #define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) | 216 | #define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) |
217 | #define SBP2_DEBUG_ENTER() SBP2_DEBUG("%s", __FUNCTION__) | ||
217 | 218 | ||
218 | /* | 219 | /* |
219 | * Globals | 220 | * Globals |
@@ -535,7 +536,7 @@ static struct sbp2_command_info *sbp2util_allocate_command_orb( | |||
535 | command->Current_SCpnt = Current_SCpnt; | 536 | command->Current_SCpnt = Current_SCpnt; |
536 | list_add_tail(&command->list, &scsi_id->sbp2_command_orb_inuse); | 537 | list_add_tail(&command->list, &scsi_id->sbp2_command_orb_inuse); |
537 | } else { | 538 | } else { |
538 | SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!"); | 539 | SBP2_ERR("%s: no orbs available", __FUNCTION__); |
539 | } | 540 | } |
540 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); | 541 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); |
541 | return command; | 542 | return command; |
@@ -549,7 +550,7 @@ static void sbp2util_free_command_dma(struct sbp2_command_info *command) | |||
549 | struct hpsb_host *host; | 550 | struct hpsb_host *host; |
550 | 551 | ||
551 | if (!scsi_id) { | 552 | if (!scsi_id) { |
552 | printk(KERN_ERR "%s: scsi_id == NULL\n", __FUNCTION__); | 553 | SBP2_ERR("%s: scsi_id == NULL", __FUNCTION__); |
553 | return; | 554 | return; |
554 | } | 555 | } |
555 | 556 | ||
@@ -610,7 +611,7 @@ static int sbp2_probe(struct device *dev) | |||
610 | struct unit_directory *ud; | 611 | struct unit_directory *ud; |
611 | struct scsi_id_instance_data *scsi_id; | 612 | struct scsi_id_instance_data *scsi_id; |
612 | 613 | ||
613 | SBP2_DEBUG("sbp2_probe"); | 614 | SBP2_DEBUG_ENTER(); |
614 | 615 | ||
615 | ud = container_of(dev, struct unit_directory, device); | 616 | ud = container_of(dev, struct unit_directory, device); |
616 | 617 | ||
@@ -635,7 +636,7 @@ static int sbp2_remove(struct device *dev) | |||
635 | struct scsi_id_instance_data *scsi_id; | 636 | struct scsi_id_instance_data *scsi_id; |
636 | struct scsi_device *sdev; | 637 | struct scsi_device *sdev; |
637 | 638 | ||
638 | SBP2_DEBUG("sbp2_remove"); | 639 | SBP2_DEBUG_ENTER(); |
639 | 640 | ||
640 | ud = container_of(dev, struct unit_directory, device); | 641 | ud = container_of(dev, struct unit_directory, device); |
641 | scsi_id = ud->device.driver_data; | 642 | scsi_id = ud->device.driver_data; |
@@ -667,7 +668,7 @@ static int sbp2_update(struct unit_directory *ud) | |||
667 | { | 668 | { |
668 | struct scsi_id_instance_data *scsi_id = ud->device.driver_data; | 669 | struct scsi_id_instance_data *scsi_id = ud->device.driver_data; |
669 | 670 | ||
670 | SBP2_DEBUG("sbp2_update"); | 671 | SBP2_DEBUG_ENTER(); |
671 | 672 | ||
672 | if (sbp2_reconnect_device(scsi_id)) { | 673 | if (sbp2_reconnect_device(scsi_id)) { |
673 | 674 | ||
@@ -715,7 +716,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud | |||
715 | struct Scsi_Host *scsi_host = NULL; | 716 | struct Scsi_Host *scsi_host = NULL; |
716 | struct scsi_id_instance_data *scsi_id = NULL; | 717 | struct scsi_id_instance_data *scsi_id = NULL; |
717 | 718 | ||
718 | SBP2_DEBUG("sbp2_alloc_device"); | 719 | SBP2_DEBUG_ENTER(); |
719 | 720 | ||
720 | scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL); | 721 | scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL); |
721 | if (!scsi_id) { | 722 | if (!scsi_id) { |
@@ -826,7 +827,7 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id) | |||
826 | struct sbp2scsi_host_info *hi = scsi_id->hi; | 827 | struct sbp2scsi_host_info *hi = scsi_id->hi; |
827 | int error; | 828 | int error; |
828 | 829 | ||
829 | SBP2_DEBUG("sbp2_start_device"); | 830 | SBP2_DEBUG_ENTER(); |
830 | 831 | ||
831 | /* Login FIFO DMA */ | 832 | /* Login FIFO DMA */ |
832 | scsi_id->login_response = | 833 | scsi_id->login_response = |
@@ -901,7 +902,6 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id) | |||
901 | * allows someone else to login instead. One second makes sense. */ | 902 | * allows someone else to login instead. One second makes sense. */ |
902 | msleep_interruptible(1000); | 903 | msleep_interruptible(1000); |
903 | if (signal_pending(current)) { | 904 | if (signal_pending(current)) { |
904 | SBP2_WARN("aborting sbp2_start_device due to event"); | ||
905 | sbp2_remove_device(scsi_id); | 905 | sbp2_remove_device(scsi_id); |
906 | return -EINTR; | 906 | return -EINTR; |
907 | } | 907 | } |
@@ -954,7 +954,7 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id) | |||
954 | { | 954 | { |
955 | struct sbp2scsi_host_info *hi; | 955 | struct sbp2scsi_host_info *hi; |
956 | 956 | ||
957 | SBP2_DEBUG("sbp2_remove_device"); | 957 | SBP2_DEBUG_ENTER(); |
958 | 958 | ||
959 | if (!scsi_id) | 959 | if (!scsi_id) |
960 | return; | 960 | return; |
@@ -1086,23 +1086,20 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id) | |||
1086 | int max_logins; | 1086 | int max_logins; |
1087 | int active_logins; | 1087 | int active_logins; |
1088 | 1088 | ||
1089 | SBP2_DEBUG("sbp2_query_logins"); | 1089 | SBP2_DEBUG_ENTER(); |
1090 | 1090 | ||
1091 | scsi_id->query_logins_orb->reserved1 = 0x0; | 1091 | scsi_id->query_logins_orb->reserved1 = 0x0; |
1092 | scsi_id->query_logins_orb->reserved2 = 0x0; | 1092 | scsi_id->query_logins_orb->reserved2 = 0x0; |
1093 | 1093 | ||
1094 | scsi_id->query_logins_orb->query_response_lo = scsi_id->query_logins_response_dma; | 1094 | scsi_id->query_logins_orb->query_response_lo = scsi_id->query_logins_response_dma; |
1095 | scsi_id->query_logins_orb->query_response_hi = ORB_SET_NODE_ID(hi->host->node_id); | 1095 | scsi_id->query_logins_orb->query_response_hi = ORB_SET_NODE_ID(hi->host->node_id); |
1096 | SBP2_DEBUG("sbp2_query_logins: query_response_hi/lo initialized"); | ||
1097 | 1096 | ||
1098 | scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST); | 1097 | scsi_id->query_logins_orb->lun_misc = ORB_SET_FUNCTION(SBP2_QUERY_LOGINS_REQUEST); |
1099 | scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1); | 1098 | scsi_id->query_logins_orb->lun_misc |= ORB_SET_NOTIFY(1); |
1100 | scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); | 1099 | scsi_id->query_logins_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); |
1101 | SBP2_DEBUG("sbp2_query_logins: lun_misc initialized"); | ||
1102 | 1100 | ||
1103 | scsi_id->query_logins_orb->reserved_resp_length = | 1101 | scsi_id->query_logins_orb->reserved_resp_length = |
1104 | ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response)); | 1102 | ORB_SET_QUERY_LOGINS_RESP_LENGTH(sizeof(struct sbp2_query_logins_response)); |
1105 | SBP2_DEBUG("sbp2_query_logins: reserved_resp_length initialized"); | ||
1106 | 1103 | ||
1107 | scsi_id->query_logins_orb->status_fifo_hi = | 1104 | scsi_id->query_logins_orb->status_fifo_hi = |
1108 | ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); | 1105 | ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); |
@@ -1111,25 +1108,19 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id) | |||
1111 | 1108 | ||
1112 | sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb)); | 1109 | sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb)); |
1113 | 1110 | ||
1114 | SBP2_DEBUG("sbp2_query_logins: orb byte-swapped"); | ||
1115 | |||
1116 | sbp2util_packet_dump(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb), | 1111 | sbp2util_packet_dump(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb), |
1117 | "sbp2 query logins orb", scsi_id->query_logins_orb_dma); | 1112 | "sbp2 query logins orb", scsi_id->query_logins_orb_dma); |
1118 | 1113 | ||
1119 | memset(scsi_id->query_logins_response, 0, sizeof(struct sbp2_query_logins_response)); | 1114 | memset(scsi_id->query_logins_response, 0, sizeof(struct sbp2_query_logins_response)); |
1120 | memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); | 1115 | memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); |
1121 | 1116 | ||
1122 | SBP2_DEBUG("sbp2_query_logins: query_logins_response/status FIFO memset"); | ||
1123 | |||
1124 | data[0] = ORB_SET_NODE_ID(hi->host->node_id); | 1117 | data[0] = ORB_SET_NODE_ID(hi->host->node_id); |
1125 | data[1] = scsi_id->query_logins_orb_dma; | 1118 | data[1] = scsi_id->query_logins_orb_dma; |
1126 | sbp2util_cpu_to_be32_buffer(data, 8); | 1119 | sbp2util_cpu_to_be32_buffer(data, 8); |
1127 | 1120 | ||
1128 | atomic_set(&scsi_id->sbp2_login_complete, 0); | 1121 | atomic_set(&scsi_id->sbp2_login_complete, 0); |
1129 | 1122 | ||
1130 | SBP2_DEBUG("sbp2_query_logins: prepared to write"); | ||
1131 | hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); | 1123 | hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); |
1132 | SBP2_DEBUG("sbp2_query_logins: written"); | ||
1133 | 1124 | ||
1134 | if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 2*HZ)) { | 1125 | if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 2*HZ)) { |
1135 | SBP2_INFO("Error querying logins to SBP-2 device - timed out"); | 1126 | SBP2_INFO("Error querying logins to SBP-2 device - timed out"); |
@@ -1178,10 +1169,10 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) | |||
1178 | struct sbp2scsi_host_info *hi = scsi_id->hi; | 1169 | struct sbp2scsi_host_info *hi = scsi_id->hi; |
1179 | quadlet_t data[2]; | 1170 | quadlet_t data[2]; |
1180 | 1171 | ||
1181 | SBP2_DEBUG("sbp2_login_device"); | 1172 | SBP2_DEBUG_ENTER(); |
1182 | 1173 | ||
1183 | if (!scsi_id->login_orb) { | 1174 | if (!scsi_id->login_orb) { |
1184 | SBP2_DEBUG("sbp2_login_device: login_orb not alloc'd!"); | 1175 | SBP2_DEBUG("%s: login_orb not alloc'd!", __FUNCTION__); |
1185 | return -EIO; | 1176 | return -EIO; |
1186 | } | 1177 | } |
1187 | 1178 | ||
@@ -1195,59 +1186,39 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id) | |||
1195 | /* Set-up login ORB, assume no password */ | 1186 | /* Set-up login ORB, assume no password */ |
1196 | scsi_id->login_orb->password_hi = 0; | 1187 | scsi_id->login_orb->password_hi = 0; |
1197 | scsi_id->login_orb->password_lo = 0; | 1188 | scsi_id->login_orb->password_lo = 0; |
1198 | SBP2_DEBUG("sbp2_login_device: password_hi/lo initialized"); | ||
1199 | 1189 | ||
1200 | scsi_id->login_orb->login_response_lo = scsi_id->login_response_dma; | 1190 | scsi_id->login_orb->login_response_lo = scsi_id->login_response_dma; |
1201 | scsi_id->login_orb->login_response_hi = ORB_SET_NODE_ID(hi->host->node_id); | 1191 | scsi_id->login_orb->login_response_hi = ORB_SET_NODE_ID(hi->host->node_id); |
1202 | SBP2_DEBUG("sbp2_login_device: login_response_hi/lo initialized"); | ||
1203 | 1192 | ||
1204 | scsi_id->login_orb->lun_misc = ORB_SET_FUNCTION(SBP2_LOGIN_REQUEST); | 1193 | scsi_id->login_orb->lun_misc = ORB_SET_FUNCTION(SBP2_LOGIN_REQUEST); |
1205 | scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */ | 1194 | scsi_id->login_orb->lun_misc |= ORB_SET_RECONNECT(0); /* One second reconnect time */ |
1206 | scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */ | 1195 | scsi_id->login_orb->lun_misc |= ORB_SET_EXCLUSIVE(exclusive_login); /* Exclusive access to device */ |
1207 | scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */ | 1196 | scsi_id->login_orb->lun_misc |= ORB_SET_NOTIFY(1); /* Notify us of login complete */ |
1208 | scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); | 1197 | scsi_id->login_orb->lun_misc |= ORB_SET_LUN(scsi_id->sbp2_lun); |
1209 | SBP2_DEBUG("sbp2_login_device: lun_misc initialized"); | ||
1210 | 1198 | ||
1211 | scsi_id->login_orb->passwd_resp_lengths = | 1199 | scsi_id->login_orb->passwd_resp_lengths = |
1212 | ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response)); | 1200 | ORB_SET_LOGIN_RESP_LENGTH(sizeof(struct sbp2_login_response)); |
1213 | SBP2_DEBUG("sbp2_login_device: passwd_resp_lengths initialized"); | ||
1214 | 1201 | ||
1215 | scsi_id->login_orb->status_fifo_hi = | 1202 | scsi_id->login_orb->status_fifo_hi = |
1216 | ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); | 1203 | ORB_SET_STATUS_FIFO_HI(scsi_id->status_fifo_addr, hi->host->node_id); |
1217 | scsi_id->login_orb->status_fifo_lo = | 1204 | scsi_id->login_orb->status_fifo_lo = |
1218 | ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr); | 1205 | ORB_SET_STATUS_FIFO_LO(scsi_id->status_fifo_addr); |
1219 | 1206 | ||
1220 | /* | ||
1221 | * Byte swap ORB if necessary | ||
1222 | */ | ||
1223 | sbp2util_cpu_to_be32_buffer(scsi_id->login_orb, sizeof(struct sbp2_login_orb)); | 1207 | sbp2util_cpu_to_be32_buffer(scsi_id->login_orb, sizeof(struct sbp2_login_orb)); |
1224 | 1208 | ||
1225 | SBP2_DEBUG("sbp2_login_device: orb byte-swapped"); | ||
1226 | |||
1227 | sbp2util_packet_dump(scsi_id->login_orb, sizeof(struct sbp2_login_orb), | 1209 | sbp2util_packet_dump(scsi_id->login_orb, sizeof(struct sbp2_login_orb), |
1228 | "sbp2 login orb", scsi_id->login_orb_dma); | 1210 | "sbp2 login orb", scsi_id->login_orb_dma); |
1229 | 1211 | ||
1230 | /* | ||
1231 | * Initialize login response and status fifo | ||
1232 | */ | ||
1233 | memset(scsi_id->login_response, 0, sizeof(struct sbp2_login_response)); | 1212 | memset(scsi_id->login_response, 0, sizeof(struct sbp2_login_response)); |
1234 | memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); | 1213 | memset(&scsi_id->status_block, 0, sizeof(struct sbp2_status_block)); |
1235 | 1214 | ||
1236 | SBP2_DEBUG("sbp2_login_device: login_response/status FIFO memset"); | ||
1237 | |||
1238 | /* | ||
1239 | * Ok, let's write to the target's management agent register | ||
1240 | */ | ||
1241 | data[0] = ORB_SET_NODE_ID(hi->host->node_id); | 1215 | data[0] = ORB_SET_NODE_ID(hi->host->node_id); |
1242 | data[1] = scsi_id->login_orb_dma; | 1216 | data[1] = scsi_id->login_orb_dma; |
1243 | sbp2util_cpu_to_be32_buffer(data, 8); | 1217 | sbp2util_cpu_to_be32_buffer(data, 8); |
1244 | 1218 | ||
1245 | atomic_set(&scsi_id->sbp2_login_complete, 0); | 1219 | atomic_set(&scsi_id->sbp2_login_complete, 0); |
1246 | 1220 | ||
1247 | SBP2_DEBUG("sbp2_login_device: prepared to write to %08x", | ||
1248 | (unsigned int)scsi_id->sbp2_management_agent_addr); | ||
1249 | hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); | 1221 | hpsb_node_write(scsi_id->ne, scsi_id->sbp2_management_agent_addr, data, 8); |
1250 | SBP2_DEBUG("sbp2_login_device: written"); | ||
1251 | 1222 | ||
1252 | /* | 1223 | /* |
1253 | * Wait for login status (up to 20 seconds)... | 1224 | * Wait for login status (up to 20 seconds)... |
@@ -1311,7 +1282,7 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id) | |||
1311 | quadlet_t data[2]; | 1282 | quadlet_t data[2]; |
1312 | int error; | 1283 | int error; |
1313 | 1284 | ||
1314 | SBP2_DEBUG("sbp2_logout_device"); | 1285 | SBP2_DEBUG_ENTER(); |
1315 | 1286 | ||
1316 | /* | 1287 | /* |
1317 | * Set-up logout ORB | 1288 | * Set-up logout ORB |
@@ -1375,7 +1346,7 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id) | |||
1375 | quadlet_t data[2]; | 1346 | quadlet_t data[2]; |
1376 | int error; | 1347 | int error; |
1377 | 1348 | ||
1378 | SBP2_DEBUG("sbp2_reconnect_device"); | 1349 | SBP2_DEBUG_ENTER(); |
1379 | 1350 | ||
1380 | /* | 1351 | /* |
1381 | * Set-up reconnect ORB | 1352 | * Set-up reconnect ORB |
@@ -1466,17 +1437,11 @@ static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id) | |||
1466 | { | 1437 | { |
1467 | quadlet_t data; | 1438 | quadlet_t data; |
1468 | 1439 | ||
1469 | SBP2_DEBUG("sbp2_set_busy_timeout"); | 1440 | SBP2_DEBUG_ENTER(); |
1470 | 1441 | ||
1471 | /* | ||
1472 | * Ok, let's write to the target's busy timeout register | ||
1473 | */ | ||
1474 | data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE); | 1442 | data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE); |
1475 | 1443 | if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) | |
1476 | if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) { | 1444 | SBP2_ERR("%s error", __FUNCTION__); |
1477 | SBP2_ERR("sbp2_set_busy_timeout error"); | ||
1478 | } | ||
1479 | |||
1480 | return 0; | 1445 | return 0; |
1481 | } | 1446 | } |
1482 | 1447 | ||
@@ -1495,7 +1460,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, | |||
1495 | firmware_revision, workarounds; | 1460 | firmware_revision, workarounds; |
1496 | int i; | 1461 | int i; |
1497 | 1462 | ||
1498 | SBP2_DEBUG("sbp2_parse_unit_directory"); | 1463 | SBP2_DEBUG_ENTER(); |
1499 | 1464 | ||
1500 | management_agent_addr = 0x0; | 1465 | management_agent_addr = 0x0; |
1501 | command_set_spec_id = 0x0; | 1466 | command_set_spec_id = 0x0; |
@@ -1628,7 +1593,7 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id) | |||
1628 | { | 1593 | { |
1629 | struct sbp2scsi_host_info *hi = scsi_id->hi; | 1594 | struct sbp2scsi_host_info *hi = scsi_id->hi; |
1630 | 1595 | ||
1631 | SBP2_DEBUG("sbp2_max_speed_and_size"); | 1596 | SBP2_DEBUG_ENTER(); |
1632 | 1597 | ||
1633 | /* Initial setting comes from the hosts speed map */ | 1598 | /* Initial setting comes from the hosts speed map */ |
1634 | scsi_id->speed_code = | 1599 | scsi_id->speed_code = |
@@ -1665,11 +1630,8 @@ static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait) | |||
1665 | u64 addr; | 1630 | u64 addr; |
1666 | int retval; | 1631 | int retval; |
1667 | 1632 | ||
1668 | SBP2_DEBUG("sbp2_agent_reset"); | 1633 | SBP2_DEBUG_ENTER(); |
1669 | 1634 | ||
1670 | /* | ||
1671 | * Ok, let's write to the target's management agent register | ||
1672 | */ | ||
1673 | data = ntohl(SBP2_AGENT_RESET_DATA); | 1635 | data = ntohl(SBP2_AGENT_RESET_DATA); |
1674 | addr = scsi_id->sbp2_command_block_agent_addr + SBP2_AGENT_RESET_OFFSET; | 1636 | addr = scsi_id->sbp2_command_block_agent_addr + SBP2_AGENT_RESET_OFFSET; |
1675 | 1637 | ||
@@ -2017,11 +1979,7 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, | |||
2017 | unsigned int request_bufflen = SCpnt->request_bufflen; | 1979 | unsigned int request_bufflen = SCpnt->request_bufflen; |
2018 | struct sbp2_command_info *command; | 1980 | struct sbp2_command_info *command; |
2019 | 1981 | ||
2020 | SBP2_DEBUG("sbp2_send_command"); | 1982 | SBP2_DEBUG_ENTER(); |
2021 | #if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP) | ||
2022 | printk("[scsi command]\n "); | ||
2023 | scsi_print_command(SCpnt); | ||
2024 | #endif | ||
2025 | SBP2_DEBUG("SCSI transfer size = %x", request_bufflen); | 1983 | SBP2_DEBUG("SCSI transfer size = %x", request_bufflen); |
2026 | SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg); | 1984 | SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg); |
2027 | 1985 | ||
@@ -2061,7 +2019,7 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, | |||
2061 | */ | 2019 | */ |
2062 | static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data) | 2020 | static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data) |
2063 | { | 2021 | { |
2064 | SBP2_DEBUG("sbp2_status_to_sense_data"); | 2022 | SBP2_DEBUG_ENTER(); |
2065 | 2023 | ||
2066 | /* | 2024 | /* |
2067 | * Ok, it's pretty ugly... ;-) | 2025 | * Ok, it's pretty ugly... ;-) |
@@ -2095,7 +2053,7 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2095 | { | 2053 | { |
2096 | u8 *scsi_buf = SCpnt->request_buffer; | 2054 | u8 *scsi_buf = SCpnt->request_buffer; |
2097 | 2055 | ||
2098 | SBP2_DEBUG("sbp2_check_sbp2_response"); | 2056 | SBP2_DEBUG_ENTER(); |
2099 | 2057 | ||
2100 | if (SCpnt->cmnd[0] == INQUIRY && (SCpnt->cmnd[1] & 3) == 0) { | 2058 | if (SCpnt->cmnd[0] == INQUIRY && (SCpnt->cmnd[1] & 3) == 0) { |
2101 | /* | 2059 | /* |
@@ -2126,7 +2084,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest | |||
2126 | struct sbp2_command_info *command; | 2084 | struct sbp2_command_info *command; |
2127 | unsigned long flags; | 2085 | unsigned long flags; |
2128 | 2086 | ||
2129 | SBP2_DEBUG("sbp2_handle_status_write"); | 2087 | SBP2_DEBUG_ENTER(); |
2130 | 2088 | ||
2131 | sbp2util_packet_dump(data, length, "sbp2 status write by device", (u32)addr); | 2089 | sbp2util_packet_dump(data, length, "sbp2 status write by device", (u32)addr); |
2132 | 2090 | ||
@@ -2273,7 +2231,10 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt, | |||
2273 | struct sbp2scsi_host_info *hi; | 2231 | struct sbp2scsi_host_info *hi; |
2274 | int result = DID_NO_CONNECT << 16; | 2232 | int result = DID_NO_CONNECT << 16; |
2275 | 2233 | ||
2276 | SBP2_DEBUG("sbp2scsi_queuecommand"); | 2234 | SBP2_DEBUG_ENTER(); |
2235 | #if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP) | ||
2236 | scsi_print_command(SCpnt); | ||
2237 | #endif | ||
2277 | 2238 | ||
2278 | if (!sbp2util_node_is_available(scsi_id)) | 2239 | if (!sbp2util_node_is_available(scsi_id)) |
2279 | goto done; | 2240 | goto done; |
@@ -2351,7 +2312,7 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id | |||
2351 | struct sbp2_command_info *command; | 2312 | struct sbp2_command_info *command; |
2352 | unsigned long flags; | 2313 | unsigned long flags; |
2353 | 2314 | ||
2354 | SBP2_DEBUG("sbp2scsi_complete_all_commands"); | 2315 | SBP2_DEBUG_ENTER(); |
2355 | 2316 | ||
2356 | spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); | 2317 | spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); |
2357 | while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { | 2318 | while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { |
@@ -2384,7 +2345,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2384 | u32 scsi_status, struct scsi_cmnd *SCpnt, | 2345 | u32 scsi_status, struct scsi_cmnd *SCpnt, |
2385 | void (*done)(struct scsi_cmnd *)) | 2346 | void (*done)(struct scsi_cmnd *)) |
2386 | { | 2347 | { |
2387 | SBP2_DEBUG("sbp2scsi_complete_command"); | 2348 | SBP2_DEBUG_ENTER(); |
2388 | 2349 | ||
2389 | /* | 2350 | /* |
2390 | * Sanity | 2351 | * Sanity |
@@ -2421,15 +2382,10 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2421 | case SBP2_SCSI_STATUS_CHECK_CONDITION: | 2382 | case SBP2_SCSI_STATUS_CHECK_CONDITION: |
2422 | SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION"); | 2383 | SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION"); |
2423 | SCpnt->result = CHECK_CONDITION << 1 | DID_OK << 16; | 2384 | SCpnt->result = CHECK_CONDITION << 1 | DID_OK << 16; |
2424 | |||
2425 | /* | ||
2426 | * Debug stuff | ||
2427 | */ | ||
2428 | #if CONFIG_IEEE1394_SBP2_DEBUG >= 1 | 2385 | #if CONFIG_IEEE1394_SBP2_DEBUG >= 1 |
2429 | scsi_print_command(SCpnt); | 2386 | scsi_print_command(SCpnt); |
2430 | scsi_print_sense("bh", SCpnt); | 2387 | scsi_print_sense(SBP2_DEVICE_NAME, SCpnt); |
2431 | #endif | 2388 | #endif |
2432 | |||
2433 | break; | 2389 | break; |
2434 | 2390 | ||
2435 | case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: | 2391 | case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: |
@@ -2639,7 +2595,7 @@ static int sbp2_module_init(void) | |||
2639 | { | 2595 | { |
2640 | int ret; | 2596 | int ret; |
2641 | 2597 | ||
2642 | SBP2_DEBUG("sbp2_module_init"); | 2598 | SBP2_DEBUG_ENTER(); |
2643 | 2599 | ||
2644 | /* Module load debug option to force one command at a time (serializing I/O) */ | 2600 | /* Module load debug option to force one command at a time (serializing I/O) */ |
2645 | if (serialize_io) { | 2601 | if (serialize_io) { |
@@ -2667,7 +2623,7 @@ static int sbp2_module_init(void) | |||
2667 | 2623 | ||
2668 | static void __exit sbp2_module_exit(void) | 2624 | static void __exit sbp2_module_exit(void) |
2669 | { | 2625 | { |
2670 | SBP2_DEBUG("sbp2_module_exit"); | 2626 | SBP2_DEBUG_ENTER(); |
2671 | 2627 | ||
2672 | hpsb_unregister_protocol(&sbp2_driver); | 2628 | hpsb_unregister_protocol(&sbp2_driver); |
2673 | 2629 | ||