diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ieee1394/sbp2.c | 45 | ||||
-rw-r--r-- | drivers/ieee1394/sbp2.h | 40 |
2 files changed, 17 insertions, 68 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index f0763b797238..372a7726063c 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -1740,28 +1740,15 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, | |||
1740 | command_orb->misc |= ORB_SET_SPEED(scsi_id->speed_code); | 1740 | command_orb->misc |= ORB_SET_SPEED(scsi_id->speed_code); |
1741 | command_orb->misc |= ORB_SET_NOTIFY(1); /* Notify us when complete */ | 1741 | command_orb->misc |= ORB_SET_NOTIFY(1); /* Notify us when complete */ |
1742 | 1742 | ||
1743 | /* | 1743 | if (dma_dir == DMA_NONE) |
1744 | * Get the direction of the transfer. If the direction is unknown, then use our | ||
1745 | * goofy table as a back-up. | ||
1746 | */ | ||
1747 | switch (dma_dir) { | ||
1748 | case DMA_NONE: | ||
1749 | orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER; | 1744 | orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER; |
1750 | break; | 1745 | else if (dma_dir == DMA_TO_DEVICE && scsi_request_bufflen) |
1751 | case DMA_TO_DEVICE: | ||
1752 | orb_direction = ORB_DIRECTION_WRITE_TO_MEDIA; | 1746 | orb_direction = ORB_DIRECTION_WRITE_TO_MEDIA; |
1753 | break; | 1747 | else if (dma_dir == DMA_FROM_DEVICE && scsi_request_bufflen) |
1754 | case DMA_FROM_DEVICE: | ||
1755 | orb_direction = ORB_DIRECTION_READ_FROM_MEDIA; | 1748 | orb_direction = ORB_DIRECTION_READ_FROM_MEDIA; |
1756 | break; | 1749 | else { |
1757 | case DMA_BIDIRECTIONAL: | 1750 | SBP2_WARN("Falling back to DMA_NONE"); |
1758 | default: | 1751 | orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER; |
1759 | SBP2_ERR("SCSI data transfer direction not specified. " | ||
1760 | "Update the SBP2 direction table in sbp2.h if " | ||
1761 | "necessary for your application"); | ||
1762 | __scsi_print_command(scsi_cmd); | ||
1763 | orb_direction = sbp2scsi_direction_table[*scsi_cmd]; | ||
1764 | break; | ||
1765 | } | 1752 | } |
1766 | 1753 | ||
1767 | /* | 1754 | /* |
@@ -1880,16 +1867,6 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, | |||
1880 | command_orb->misc |= ORB_SET_DATA_SIZE(scsi_request_bufflen); | 1867 | command_orb->misc |= ORB_SET_DATA_SIZE(scsi_request_bufflen); |
1881 | command_orb->misc |= ORB_SET_DIRECTION(orb_direction); | 1868 | command_orb->misc |= ORB_SET_DIRECTION(orb_direction); |
1882 | 1869 | ||
1883 | /* | ||
1884 | * Sanity, in case our direction table is not | ||
1885 | * up-to-date | ||
1886 | */ | ||
1887 | if (!scsi_request_bufflen) { | ||
1888 | command_orb->data_descriptor_hi = 0x0; | ||
1889 | command_orb->data_descriptor_lo = 0x0; | ||
1890 | command_orb->misc |= ORB_SET_DIRECTION(1); | ||
1891 | } | ||
1892 | |||
1893 | } else { | 1870 | } else { |
1894 | /* | 1871 | /* |
1895 | * Need to turn this into page tables, since the | 1872 | * Need to turn this into page tables, since the |
@@ -2371,6 +2348,16 @@ static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt, | |||
2371 | } | 2348 | } |
2372 | 2349 | ||
2373 | /* | 2350 | /* |
2351 | * Bidirectional commands are not yet implemented, | ||
2352 | * and unknown transfer direction not handled. | ||
2353 | */ | ||
2354 | if (SCpnt->sc_data_direction == DMA_BIDIRECTIONAL) { | ||
2355 | SBP2_ERR("Cannot handle DMA_BIDIRECTIONAL - rejecting command"); | ||
2356 | result = DID_ERROR << 16; | ||
2357 | goto done; | ||
2358 | } | ||
2359 | |||
2360 | /* | ||
2374 | * Try and send our SCSI command | 2361 | * Try and send our SCSI command |
2375 | */ | 2362 | */ |
2376 | if (sbp2_send_command(scsi_id, SCpnt, done)) { | 2363 | if (sbp2_send_command(scsi_id, SCpnt, done)) { |
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h index abc647bae5b1..8e227c52b72f 100644 --- a/drivers/ieee1394/sbp2.h +++ b/drivers/ieee1394/sbp2.h | |||
@@ -260,45 +260,7 @@ struct sbp2_status_block { | |||
260 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 | 260 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 |
261 | #define SBP2_MAX_UDS_PER_NODE 16 /* Maximum scsi devices per node */ | 261 | #define SBP2_MAX_UDS_PER_NODE 16 /* Maximum scsi devices per node */ |
262 | #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ | 262 | #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ |
263 | 263 | #define SBP2_MAX_CMDS 8 /* This should be safe */ | |
264 | /* | ||
265 | * SCSI direction table... | ||
266 | * (now used as a back-up in case the direction passed down from above is "unknown") | ||
267 | * | ||
268 | * DIN = IN data direction | ||
269 | * DOU = OUT data direction | ||
270 | * DNO = No data transfer | ||
271 | * DUN = Unknown data direction | ||
272 | * | ||
273 | * Opcode 0xec (Teac specific "opc execute") possibly should be DNO, | ||
274 | * but we'll change it when somebody reports a problem with this. | ||
275 | */ | ||
276 | #define DIN ORB_DIRECTION_READ_FROM_MEDIA | ||
277 | #define DOU ORB_DIRECTION_WRITE_TO_MEDIA | ||
278 | #define DNO ORB_DIRECTION_NO_DATA_TRANSFER | ||
279 | #define DUN DIN | ||
280 | |||
281 | static unchar sbp2scsi_direction_table[0x100] = { | ||
282 | DNO,DNO,DIN,DIN,DOU,DIN,DIN,DOU,DIN,DUN,DOU,DOU,DUN,DUN,DUN,DIN, | ||
283 | DNO,DIN,DIN,DOU,DIN,DOU,DNO,DNO,DOU,DNO,DIN,DNO,DIN,DOU,DNO,DUN, | ||
284 | DIN,DUN,DIN,DIN,DOU,DIN,DUN,DUN,DIN,DIN,DOU,DNO,DUN,DIN,DOU,DOU, | ||
285 | DOU,DOU,DOU,DNO,DIN,DNO,DNO,DIN,DOU,DOU,DOU,DOU,DIN,DOU,DIN,DOU, | ||
286 | DOU,DOU,DIN,DIN,DIN,DNO,DIN,DNO,DNO,DNO,DUN,DNO,DOU,DIN,DNO,DUN, | ||
287 | DUN,DIN,DIN,DNO,DNO,DOU,DUN,DUN,DNO,DIN,DIN,DNO,DIN,DOU,DUN,DUN, | ||
288 | DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, | ||
289 | DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, | ||
290 | DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, | ||
291 | DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, | ||
292 | DUN,DNO,DOU,DOU,DIN,DNO,DNO,DNO,DIN,DNO,DOU,DUN,DNO,DIN,DOU,DOU, | ||
293 | DOU,DOU,DOU,DNO,DUN,DIN,DOU,DIN,DIN,DIN,DNO,DNO,DNO,DIN,DIN,DUN, | ||
294 | DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, | ||
295 | DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, | ||
296 | DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DOU,DUN,DUN,DUN,DUN,DUN, | ||
297 | DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN | ||
298 | }; | ||
299 | |||
300 | /* This should be safe */ | ||
301 | #define SBP2_MAX_CMDS 8 | ||
302 | 264 | ||
303 | /* This is the two dma types we use for cmd_dma below */ | 265 | /* This is the two dma types we use for cmd_dma below */ |
304 | enum cmd_dma_types { | 266 | enum cmd_dma_types { |