diff options
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r-- | drivers/firewire/fw-sbp2.c | 150 |
1 files changed, 70 insertions, 80 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 62b4e47d0cc0..2a999373863e 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -153,6 +153,7 @@ struct sbp2_target { | |||
153 | struct list_head lu_list; | 153 | struct list_head lu_list; |
154 | 154 | ||
155 | u64 management_agent_address; | 155 | u64 management_agent_address; |
156 | u64 guid; | ||
156 | int directory_id; | 157 | int directory_id; |
157 | int node_id; | 158 | int node_id; |
158 | int address_high; | 159 | int address_high; |
@@ -173,10 +174,8 @@ struct sbp2_target { | |||
173 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ | 174 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ |
174 | #define SBP2_ORB_NULL 0x80000000 | 175 | #define SBP2_ORB_NULL 0x80000000 |
175 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 | 176 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 |
176 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ | 177 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ |
177 | 178 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ | |
178 | #define SBP2_DIRECTION_TO_MEDIA 0x0 | ||
179 | #define SBP2_DIRECTION_FROM_MEDIA 0x1 | ||
180 | 179 | ||
181 | /* Unit directory keys */ | 180 | /* Unit directory keys */ |
182 | #define SBP2_CSR_UNIT_CHARACTERISTICS 0x3a | 181 | #define SBP2_CSR_UNIT_CHARACTERISTICS 0x3a |
@@ -224,8 +223,8 @@ struct sbp2_status { | |||
224 | }; | 223 | }; |
225 | 224 | ||
226 | struct sbp2_pointer { | 225 | struct sbp2_pointer { |
227 | u32 high; | 226 | __be32 high; |
228 | u32 low; | 227 | __be32 low; |
229 | }; | 228 | }; |
230 | 229 | ||
231 | struct sbp2_orb { | 230 | struct sbp2_orb { |
@@ -253,8 +252,8 @@ struct sbp2_management_orb { | |||
253 | struct { | 252 | struct { |
254 | struct sbp2_pointer password; | 253 | struct sbp2_pointer password; |
255 | struct sbp2_pointer response; | 254 | struct sbp2_pointer response; |
256 | u32 misc; | 255 | __be32 misc; |
257 | u32 length; | 256 | __be32 length; |
258 | struct sbp2_pointer status_fifo; | 257 | struct sbp2_pointer status_fifo; |
259 | } request; | 258 | } request; |
260 | __be32 response[4]; | 259 | __be32 response[4]; |
@@ -263,20 +262,17 @@ struct sbp2_management_orb { | |||
263 | struct sbp2_status status; | 262 | struct sbp2_status status; |
264 | }; | 263 | }; |
265 | 264 | ||
266 | #define LOGIN_RESPONSE_GET_LOGIN_ID(v) ((v).misc & 0xffff) | ||
267 | #define LOGIN_RESPONSE_GET_LENGTH(v) (((v).misc >> 16) & 0xffff) | ||
268 | |||
269 | struct sbp2_login_response { | 265 | struct sbp2_login_response { |
270 | u32 misc; | 266 | __be32 misc; |
271 | struct sbp2_pointer command_block_agent; | 267 | struct sbp2_pointer command_block_agent; |
272 | u32 reconnect_hold; | 268 | __be32 reconnect_hold; |
273 | }; | 269 | }; |
274 | #define COMMAND_ORB_DATA_SIZE(v) ((v)) | 270 | #define COMMAND_ORB_DATA_SIZE(v) ((v)) |
275 | #define COMMAND_ORB_PAGE_SIZE(v) ((v) << 16) | 271 | #define COMMAND_ORB_PAGE_SIZE(v) ((v) << 16) |
276 | #define COMMAND_ORB_PAGE_TABLE_PRESENT ((1) << 19) | 272 | #define COMMAND_ORB_PAGE_TABLE_PRESENT ((1) << 19) |
277 | #define COMMAND_ORB_MAX_PAYLOAD(v) ((v) << 20) | 273 | #define COMMAND_ORB_MAX_PAYLOAD(v) ((v) << 20) |
278 | #define COMMAND_ORB_SPEED(v) ((v) << 24) | 274 | #define COMMAND_ORB_SPEED(v) ((v) << 24) |
279 | #define COMMAND_ORB_DIRECTION(v) ((v) << 27) | 275 | #define COMMAND_ORB_DIRECTION ((1) << 27) |
280 | #define COMMAND_ORB_REQUEST_FORMAT(v) ((v) << 29) | 276 | #define COMMAND_ORB_REQUEST_FORMAT(v) ((v) << 29) |
281 | #define COMMAND_ORB_NOTIFY ((1) << 31) | 277 | #define COMMAND_ORB_NOTIFY ((1) << 31) |
282 | 278 | ||
@@ -285,7 +281,7 @@ struct sbp2_command_orb { | |||
285 | struct { | 281 | struct { |
286 | struct sbp2_pointer next; | 282 | struct sbp2_pointer next; |
287 | struct sbp2_pointer data_descriptor; | 283 | struct sbp2_pointer data_descriptor; |
288 | u32 misc; | 284 | __be32 misc; |
289 | u8 command_block[12]; | 285 | u8 command_block[12]; |
290 | } request; | 286 | } request; |
291 | struct scsi_cmnd *cmd; | 287 | struct scsi_cmnd *cmd; |
@@ -459,8 +455,7 @@ sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu, | |||
459 | unsigned long flags; | 455 | unsigned long flags; |
460 | 456 | ||
461 | orb->pointer.high = 0; | 457 | orb->pointer.high = 0; |
462 | orb->pointer.low = orb->request_bus; | 458 | orb->pointer.low = cpu_to_be32(orb->request_bus); |
463 | fw_memcpy_to_be32(&orb->pointer, &orb->pointer, sizeof(orb->pointer)); | ||
464 | 459 | ||
465 | spin_lock_irqsave(&device->card->lock, flags); | 460 | spin_lock_irqsave(&device->card->lock, flags); |
466 | list_add_tail(&orb->link, &lu->orb_list); | 461 | list_add_tail(&orb->link, &lu->orb_list); |
@@ -536,31 +531,31 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, | |||
536 | if (dma_mapping_error(orb->response_bus)) | 531 | if (dma_mapping_error(orb->response_bus)) |
537 | goto fail_mapping_response; | 532 | goto fail_mapping_response; |
538 | 533 | ||
539 | orb->request.response.high = 0; | 534 | orb->request.response.high = 0; |
540 | orb->request.response.low = orb->response_bus; | 535 | orb->request.response.low = cpu_to_be32(orb->response_bus); |
541 | 536 | ||
542 | orb->request.misc = | 537 | orb->request.misc = cpu_to_be32( |
543 | MANAGEMENT_ORB_NOTIFY | | 538 | MANAGEMENT_ORB_NOTIFY | |
544 | MANAGEMENT_ORB_FUNCTION(function) | | 539 | MANAGEMENT_ORB_FUNCTION(function) | |
545 | MANAGEMENT_ORB_LUN(lun_or_login_id); | 540 | MANAGEMENT_ORB_LUN(lun_or_login_id)); |
546 | orb->request.length = | 541 | orb->request.length = cpu_to_be32( |
547 | MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof(orb->response)); | 542 | MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof(orb->response))); |
548 | 543 | ||
549 | orb->request.status_fifo.high = lu->address_handler.offset >> 32; | 544 | orb->request.status_fifo.high = |
550 | orb->request.status_fifo.low = lu->address_handler.offset; | 545 | cpu_to_be32(lu->address_handler.offset >> 32); |
546 | orb->request.status_fifo.low = | ||
547 | cpu_to_be32(lu->address_handler.offset); | ||
551 | 548 | ||
552 | if (function == SBP2_LOGIN_REQUEST) { | 549 | if (function == SBP2_LOGIN_REQUEST) { |
553 | /* Ask for 2^2 == 4 seconds reconnect grace period */ | 550 | /* Ask for 2^2 == 4 seconds reconnect grace period */ |
554 | orb->request.misc |= | 551 | orb->request.misc |= cpu_to_be32( |
555 | MANAGEMENT_ORB_RECONNECT(2) | | 552 | MANAGEMENT_ORB_RECONNECT(2) | |
556 | MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login); | 553 | MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login)); |
557 | timeout = lu->tgt->mgt_orb_timeout; | 554 | timeout = lu->tgt->mgt_orb_timeout; |
558 | } else { | 555 | } else { |
559 | timeout = SBP2_ORB_TIMEOUT; | 556 | timeout = SBP2_ORB_TIMEOUT; |
560 | } | 557 | } |
561 | 558 | ||
562 | fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request)); | ||
563 | |||
564 | init_completion(&orb->done); | 559 | init_completion(&orb->done); |
565 | orb->base.callback = complete_management_orb; | 560 | orb->base.callback = complete_management_orb; |
566 | 561 | ||
@@ -605,8 +600,7 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, | |||
605 | sizeof(orb->response), DMA_FROM_DEVICE); | 600 | sizeof(orb->response), DMA_FROM_DEVICE); |
606 | fail_mapping_response: | 601 | fail_mapping_response: |
607 | if (response) | 602 | if (response) |
608 | fw_memcpy_from_be32(response, | 603 | memcpy(response, orb->response, sizeof(orb->response)); |
609 | orb->response, sizeof(orb->response)); | ||
610 | kref_put(&orb->base.kref, free_orb); | 604 | kref_put(&orb->base.kref, free_orb); |
611 | 605 | ||
612 | return retval; | 606 | return retval; |
@@ -701,10 +695,8 @@ static void sbp2_conditionally_block(struct sbp2_logical_unit *lu) | |||
701 | if (!tgt->dont_block && !lu->blocked && | 695 | if (!tgt->dont_block && !lu->blocked && |
702 | lu->generation != card->generation) { | 696 | lu->generation != card->generation) { |
703 | lu->blocked = true; | 697 | lu->blocked = true; |
704 | if (++tgt->blocked == 1) { | 698 | if (++tgt->blocked == 1) |
705 | scsi_block_requests(shost); | 699 | scsi_block_requests(shost); |
706 | fw_notify("blocked %s\n", lu->tgt->bus_id); | ||
707 | } | ||
708 | } | 700 | } |
709 | spin_unlock_irqrestore(&card->lock, flags); | 701 | spin_unlock_irqrestore(&card->lock, flags); |
710 | } | 702 | } |
@@ -731,10 +723,8 @@ static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu) | |||
731 | } | 723 | } |
732 | spin_unlock_irqrestore(&card->lock, flags); | 724 | spin_unlock_irqrestore(&card->lock, flags); |
733 | 725 | ||
734 | if (unblock) { | 726 | if (unblock) |
735 | scsi_unblock_requests(shost); | 727 | scsi_unblock_requests(shost); |
736 | fw_notify("unblocked %s\n", lu->tgt->bus_id); | ||
737 | } | ||
738 | } | 728 | } |
739 | 729 | ||
740 | /* | 730 | /* |
@@ -796,7 +786,7 @@ static void sbp2_release_target(struct kref *kref) | |||
796 | scsi_remove_host(shost); | 786 | scsi_remove_host(shost); |
797 | fw_notify("released %s\n", tgt->bus_id); | 787 | fw_notify("released %s\n", tgt->bus_id); |
798 | 788 | ||
799 | put_device(&tgt->unit->device); | 789 | fw_unit_put(tgt->unit); |
800 | scsi_host_put(shost); | 790 | scsi_host_put(shost); |
801 | fw_device_put(device); | 791 | fw_device_put(device); |
802 | } | 792 | } |
@@ -825,6 +815,22 @@ complete_set_busy_timeout(struct fw_card *card, int rcode, | |||
825 | complete(done); | 815 | complete(done); |
826 | } | 816 | } |
827 | 817 | ||
818 | /* | ||
819 | * Write retransmit retry values into the BUSY_TIMEOUT register. | ||
820 | * - The single-phase retry protocol is supported by all SBP-2 devices, but the | ||
821 | * default retry_limit value is 0 (i.e. never retry transmission). We write a | ||
822 | * saner value after logging into the device. | ||
823 | * - The dual-phase retry protocol is optional to implement, and if not | ||
824 | * supported, writes to the dual-phase portion of the register will be | ||
825 | * ignored. We try to write the original 1394-1995 default here. | ||
826 | * - In the case of devices that are also SBP-3-compliant, all writes are | ||
827 | * ignored, as the register is read-only, but contains single-phase retry of | ||
828 | * 15, which is what we're trying to set for all SBP-2 device anyway, so this | ||
829 | * write attempt is safe and yields more consistent behavior for all devices. | ||
830 | * | ||
831 | * See section 8.3.2.3.5 of the 1394-1995 spec, section 6.2 of the SBP-2 spec, | ||
832 | * and section 6.4 of the SBP-3 spec for further details. | ||
833 | */ | ||
828 | static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu) | 834 | static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu) |
829 | { | 835 | { |
830 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); | 836 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); |
@@ -832,8 +838,7 @@ static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu) | |||
832 | struct fw_transaction t; | 838 | struct fw_transaction t; |
833 | static __be32 busy_timeout; | 839 | static __be32 busy_timeout; |
834 | 840 | ||
835 | /* FIXME: we should try to set dual-phase cycle_limit too */ | 841 | busy_timeout = cpu_to_be32(SBP2_CYCLE_LIMIT | SBP2_RETRY_LIMIT); |
836 | busy_timeout = cpu_to_be32(SBP2_RETRY_LIMIT); | ||
837 | 842 | ||
838 | fw_send_request(device->card, &t, TCODE_WRITE_QUADLET_REQUEST, | 843 | fw_send_request(device->card, &t, TCODE_WRITE_QUADLET_REQUEST, |
839 | lu->tgt->node_id, lu->generation, device->max_speed, | 844 | lu->tgt->node_id, lu->generation, device->max_speed, |
@@ -885,11 +890,10 @@ static void sbp2_login(struct work_struct *work) | |||
885 | tgt->address_high = local_node_id << 16; | 890 | tgt->address_high = local_node_id << 16; |
886 | sbp2_set_generation(lu, generation); | 891 | sbp2_set_generation(lu, generation); |
887 | 892 | ||
888 | /* Get command block agent offset and login id. */ | ||
889 | lu->command_block_agent_address = | 893 | lu->command_block_agent_address = |
890 | ((u64) (response.command_block_agent.high & 0xffff) << 32) | | 894 | ((u64)(be32_to_cpu(response.command_block_agent.high) & 0xffff) |
891 | response.command_block_agent.low; | 895 | << 32) | be32_to_cpu(response.command_block_agent.low); |
892 | lu->login_id = LOGIN_RESPONSE_GET_LOGIN_ID(response); | 896 | lu->login_id = be32_to_cpu(response.misc) & 0xffff; |
893 | 897 | ||
894 | fw_notify("%s: logged in to LUN %04x (%d retries)\n", | 898 | fw_notify("%s: logged in to LUN %04x (%d retries)\n", |
895 | tgt->bus_id, lu->lun, lu->retries); | 899 | tgt->bus_id, lu->lun, lu->retries); |
@@ -1111,6 +1115,7 @@ static int sbp2_probe(struct device *dev) | |||
1111 | kref_init(&tgt->kref); | 1115 | kref_init(&tgt->kref); |
1112 | INIT_LIST_HEAD(&tgt->lu_list); | 1116 | INIT_LIST_HEAD(&tgt->lu_list); |
1113 | tgt->bus_id = unit->device.bus_id; | 1117 | tgt->bus_id = unit->device.bus_id; |
1118 | tgt->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4]; | ||
1114 | 1119 | ||
1115 | if (fw_device_enable_phys_dma(device) < 0) | 1120 | if (fw_device_enable_phys_dma(device) < 0) |
1116 | goto fail_shost_put; | 1121 | goto fail_shost_put; |
@@ -1119,6 +1124,7 @@ static int sbp2_probe(struct device *dev) | |||
1119 | goto fail_shost_put; | 1124 | goto fail_shost_put; |
1120 | 1125 | ||
1121 | fw_device_get(device); | 1126 | fw_device_get(device); |
1127 | fw_unit_get(unit); | ||
1122 | 1128 | ||
1123 | /* Initialize to values that won't match anything in our table. */ | 1129 | /* Initialize to values that won't match anything in our table. */ |
1124 | firmware_revision = 0xff000000; | 1130 | firmware_revision = 0xff000000; |
@@ -1134,8 +1140,6 @@ static int sbp2_probe(struct device *dev) | |||
1134 | 1140 | ||
1135 | sbp2_init_workarounds(tgt, model, firmware_revision); | 1141 | sbp2_init_workarounds(tgt, model, firmware_revision); |
1136 | 1142 | ||
1137 | get_device(&unit->device); | ||
1138 | |||
1139 | /* Do the login in a workqueue so we can easily reschedule retries. */ | 1143 | /* Do the login in a workqueue so we can easily reschedule retries. */ |
1140 | list_for_each_entry(lu, &tgt->lu_list, link) | 1144 | list_for_each_entry(lu, &tgt->lu_list, link) |
1141 | sbp2_queue_work(lu, 0); | 1145 | sbp2_queue_work(lu, 0); |
@@ -1367,9 +1371,12 @@ sbp2_map_scatterlist(struct sbp2_command_orb *orb, struct fw_device *device, | |||
1367 | * tables. | 1371 | * tables. |
1368 | */ | 1372 | */ |
1369 | if (count == 1 && sg_dma_len(sg) < SBP2_MAX_SG_ELEMENT_LENGTH) { | 1373 | if (count == 1 && sg_dma_len(sg) < SBP2_MAX_SG_ELEMENT_LENGTH) { |
1370 | orb->request.data_descriptor.high = lu->tgt->address_high; | 1374 | orb->request.data_descriptor.high = |
1371 | orb->request.data_descriptor.low = sg_dma_address(sg); | 1375 | cpu_to_be32(lu->tgt->address_high); |
1372 | orb->request.misc |= COMMAND_ORB_DATA_SIZE(sg_dma_len(sg)); | 1376 | orb->request.data_descriptor.low = |
1377 | cpu_to_be32(sg_dma_address(sg)); | ||
1378 | orb->request.misc |= | ||
1379 | cpu_to_be32(COMMAND_ORB_DATA_SIZE(sg_dma_len(sg))); | ||
1373 | return 0; | 1380 | return 0; |
1374 | } | 1381 | } |
1375 | 1382 | ||
@@ -1390,16 +1397,14 @@ sbp2_map_scatterlist(struct sbp2_command_orb *orb, struct fw_device *device, | |||
1390 | goto fail_page_table; | 1397 | goto fail_page_table; |
1391 | } | 1398 | } |
1392 | l = min(sg_len, SBP2_MAX_SG_ELEMENT_LENGTH); | 1399 | l = min(sg_len, SBP2_MAX_SG_ELEMENT_LENGTH); |
1393 | orb->page_table[j].low = sg_addr; | 1400 | orb->page_table[j].low = cpu_to_be32(sg_addr); |
1394 | orb->page_table[j].high = (l << 16); | 1401 | orb->page_table[j].high = cpu_to_be32(l << 16); |
1395 | sg_addr += l; | 1402 | sg_addr += l; |
1396 | sg_len -= l; | 1403 | sg_len -= l; |
1397 | j++; | 1404 | j++; |
1398 | } | 1405 | } |
1399 | } | 1406 | } |
1400 | 1407 | ||
1401 | fw_memcpy_to_be32(orb->page_table, orb->page_table, | ||
1402 | sizeof(orb->page_table[0]) * j); | ||
1403 | orb->page_table_bus = | 1408 | orb->page_table_bus = |
1404 | dma_map_single(device->card->device, orb->page_table, | 1409 | dma_map_single(device->card->device, orb->page_table, |
1405 | sizeof(orb->page_table), DMA_TO_DEVICE); | 1410 | sizeof(orb->page_table), DMA_TO_DEVICE); |
@@ -1413,11 +1418,10 @@ sbp2_map_scatterlist(struct sbp2_command_orb *orb, struct fw_device *device, | |||
1413 | * initiator (i.e. us), but data_descriptor can refer to data | 1418 | * initiator (i.e. us), but data_descriptor can refer to data |
1414 | * on other nodes so we need to put our ID in descriptor.high. | 1419 | * on other nodes so we need to put our ID in descriptor.high. |
1415 | */ | 1420 | */ |
1416 | orb->request.data_descriptor.high = lu->tgt->address_high; | 1421 | orb->request.data_descriptor.high = cpu_to_be32(lu->tgt->address_high); |
1417 | orb->request.data_descriptor.low = orb->page_table_bus; | 1422 | orb->request.data_descriptor.low = cpu_to_be32(orb->page_table_bus); |
1418 | orb->request.misc |= | 1423 | orb->request.misc |= cpu_to_be32(COMMAND_ORB_PAGE_TABLE_PRESENT | |
1419 | COMMAND_ORB_PAGE_TABLE_PRESENT | | 1424 | COMMAND_ORB_DATA_SIZE(j)); |
1420 | COMMAND_ORB_DATA_SIZE(j); | ||
1421 | 1425 | ||
1422 | return 0; | 1426 | return 0; |
1423 | 1427 | ||
@@ -1463,8 +1467,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
1463 | orb->done = done; | 1467 | orb->done = done; |
1464 | orb->cmd = cmd; | 1468 | orb->cmd = cmd; |
1465 | 1469 | ||
1466 | orb->request.next.high = SBP2_ORB_NULL; | 1470 | orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL); |
1467 | orb->request.next.low = 0x0; | ||
1468 | /* | 1471 | /* |
1469 | * At speed 100 we can do 512 bytes per packet, at speed 200, | 1472 | * At speed 100 we can do 512 bytes per packet, at speed 200, |
1470 | * 1024 bytes per packet etc. The SBP-2 max_payload field | 1473 | * 1024 bytes per packet etc. The SBP-2 max_payload field |
@@ -1473,25 +1476,17 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
1473 | */ | 1476 | */ |
1474 | max_payload = min(device->max_speed + 7, | 1477 | max_payload = min(device->max_speed + 7, |
1475 | device->card->max_receive - 1); | 1478 | device->card->max_receive - 1); |
1476 | orb->request.misc = | 1479 | orb->request.misc = cpu_to_be32( |
1477 | COMMAND_ORB_MAX_PAYLOAD(max_payload) | | 1480 | COMMAND_ORB_MAX_PAYLOAD(max_payload) | |
1478 | COMMAND_ORB_SPEED(device->max_speed) | | 1481 | COMMAND_ORB_SPEED(device->max_speed) | |
1479 | COMMAND_ORB_NOTIFY; | 1482 | COMMAND_ORB_NOTIFY); |
1480 | 1483 | ||
1481 | if (cmd->sc_data_direction == DMA_FROM_DEVICE) | 1484 | if (cmd->sc_data_direction == DMA_FROM_DEVICE) |
1482 | orb->request.misc |= | 1485 | orb->request.misc |= cpu_to_be32(COMMAND_ORB_DIRECTION); |
1483 | COMMAND_ORB_DIRECTION(SBP2_DIRECTION_FROM_MEDIA); | ||
1484 | else if (cmd->sc_data_direction == DMA_TO_DEVICE) | ||
1485 | orb->request.misc |= | ||
1486 | COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA); | ||
1487 | 1486 | ||
1488 | if (scsi_sg_count(cmd) && sbp2_map_scatterlist(orb, device, lu) < 0) | 1487 | if (scsi_sg_count(cmd) && sbp2_map_scatterlist(orb, device, lu) < 0) |
1489 | goto out; | 1488 | goto out; |
1490 | 1489 | ||
1491 | fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request)); | ||
1492 | |||
1493 | memset(orb->request.command_block, | ||
1494 | 0, sizeof(orb->request.command_block)); | ||
1495 | memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd)); | 1490 | memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd)); |
1496 | 1491 | ||
1497 | orb->base.callback = complete_command_orb; | 1492 | orb->base.callback = complete_command_orb; |
@@ -1519,11 +1514,8 @@ static int sbp2_scsi_slave_alloc(struct scsi_device *sdev) | |||
1519 | 1514 | ||
1520 | sdev->allow_restart = 1; | 1515 | sdev->allow_restart = 1; |
1521 | 1516 | ||
1522 | /* | 1517 | /* SBP-2 requires quadlet alignment of the data buffers. */ |
1523 | * Update the dma alignment (minimum alignment requirements for | 1518 | blk_queue_update_dma_alignment(sdev->request_queue, 4 - 1); |
1524 | * start and end of DMA transfers) to be a sector | ||
1525 | */ | ||
1526 | blk_queue_update_dma_alignment(sdev->request_queue, 511); | ||
1527 | 1519 | ||
1528 | if (lu->tgt->workarounds & SBP2_WORKAROUND_INQUIRY_36) | 1520 | if (lu->tgt->workarounds & SBP2_WORKAROUND_INQUIRY_36) |
1529 | sdev->inquiry_len = 36; | 1521 | sdev->inquiry_len = 36; |
@@ -1581,16 +1573,14 @@ sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_attribute *attr, | |||
1581 | { | 1573 | { |
1582 | struct scsi_device *sdev = to_scsi_device(dev); | 1574 | struct scsi_device *sdev = to_scsi_device(dev); |
1583 | struct sbp2_logical_unit *lu; | 1575 | struct sbp2_logical_unit *lu; |
1584 | struct fw_device *device; | ||
1585 | 1576 | ||
1586 | if (!sdev) | 1577 | if (!sdev) |
1587 | return 0; | 1578 | return 0; |
1588 | 1579 | ||
1589 | lu = sdev->hostdata; | 1580 | lu = sdev->hostdata; |
1590 | device = fw_device(lu->tgt->unit->device.parent); | ||
1591 | 1581 | ||
1592 | return sprintf(buf, "%08x%08x:%06x:%04x\n", | 1582 | return sprintf(buf, "%016llx:%06x:%04x\n", |
1593 | device->config_rom[3], device->config_rom[4], | 1583 | (unsigned long long)lu->tgt->guid, |
1594 | lu->tgt->directory_id, lu->lun); | 1584 | lu->tgt->directory_id, lu->lun); |
1595 | } | 1585 | } |
1596 | 1586 | ||