sbp2: delete sbp2scsi_direction_table DMA_BIDIRECTIONAL data direction may be handled properly by Linux in the future. For now, reject it instead to convert it to another direction. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 45 ++++++++++++++++----------------------------- drivers/ieee1394/sbp2.h | 40 +--------------------------------------- 2 files changed, 17 insertions(+), 68 deletions(-) diff -uprN -X linux/Documentation/dontdiff linux/drivers/ieee1394-13/sbp2.c linux/drivers/ieee1394/sbp2.c --- linux/drivers/ieee1394-13/sbp2.c 2005-12-10 23:37:15.000000000 +0100 +++ linux/drivers/ieee1394/sbp2.c 2005-12-10 23:51:06.000000000 +0100 @@ -1744,28 +1744,15 @@ static int sbp2_create_command_orb(struc command_orb->misc |= ORB_SET_SPEED(scsi_id->speed_code); command_orb->misc |= ORB_SET_NOTIFY(1); /* Notify us when complete */ - /* - * Get the direction of the transfer. If the direction is unknown, then use our - * goofy table as a back-up. - */ - switch (dma_dir) { - case DMA_NONE: + if (dma_dir == DMA_NONE) orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER; - break; - case DMA_TO_DEVICE: + else if (dma_dir == DMA_TO_DEVICE && scsi_request_bufflen) orb_direction = ORB_DIRECTION_WRITE_TO_MEDIA; - break; - case DMA_FROM_DEVICE: + else if (dma_dir == DMA_FROM_DEVICE && scsi_request_bufflen) orb_direction = ORB_DIRECTION_READ_FROM_MEDIA; - break; - case DMA_BIDIRECTIONAL: - default: - SBP2_ERR("SCSI data transfer direction not specified. " - "Update the SBP2 direction table in sbp2.h if " - "necessary for your application"); - __scsi_print_command(scsi_cmd); - orb_direction = sbp2scsi_direction_table[*scsi_cmd]; - break; + else { + SBP2_WARN("Falling back to DMA_NONE"); + orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER; } /* @@ -1884,16 +1871,6 @@ static int sbp2_create_command_orb(struc command_orb->misc |= ORB_SET_DATA_SIZE(scsi_request_bufflen); command_orb->misc |= ORB_SET_DIRECTION(orb_direction); - /* - * Sanity, in case our direction table is not - * up-to-date - */ - if (!scsi_request_bufflen) { - command_orb->data_descriptor_hi = 0x0; - command_orb->data_descriptor_lo = 0x0; - command_orb->misc |= ORB_SET_DIRECTION(1); - } - } else { /* * Need to turn this into page tables, since the @@ -2375,6 +2352,16 @@ static int sbp2scsi_queuecommand(struct } /* + * Bidirectional commands are not yet implemented, + * and unknown transfer direction not handled. + */ + if (SCpnt->sc_data_direction == DMA_BIDIRECTIONAL) { + SBP2_ERR("Cannot handle DMA_BIDIRECTIONAL - rejecting command"); + result = DID_ERROR << 16; + goto done; + } + + /* * Try and send our SCSI command */ if (sbp2_send_command(scsi_id, SCpnt, done)) { diff -uprN -X linux/Documentation/dontdiff linux/drivers/ieee1394-13/sbp2.h linux/drivers/ieee1394/sbp2.h --- linux/drivers/ieee1394-13/sbp2.h 2005-12-10 13:17:13.000000000 +0100 +++ linux/drivers/ieee1394/sbp2.h 2005-12-10 23:46:17.000000000 +0100 @@ -260,45 +260,7 @@ struct sbp2_status_block { #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 #define SBP2_MAX_UDS_PER_NODE 16 /* Maximum scsi devices per node */ #define SBP2_MAX_SECTORS 255 /* Max sectors supported */ - -/* - * SCSI direction table... - * (now used as a back-up in case the direction passed down from above is "unknown") - * - * DIN = IN data direction - * DOU = OUT data direction - * DNO = No data transfer - * DUN = Unknown data direction - * - * Opcode 0xec (Teac specific "opc execute") possibly should be DNO, - * but we'll change it when somebody reports a problem with this. - */ -#define DIN ORB_DIRECTION_READ_FROM_MEDIA -#define DOU ORB_DIRECTION_WRITE_TO_MEDIA -#define DNO ORB_DIRECTION_NO_DATA_TRANSFER -#define DUN DIN - -static unchar sbp2scsi_direction_table[0x100] = { - DNO,DNO,DIN,DIN,DOU,DIN,DIN,DOU,DIN,DUN,DOU,DOU,DUN,DUN,DUN,DIN, - DNO,DIN,DIN,DOU,DIN,DOU,DNO,DNO,DOU,DNO,DIN,DNO,DIN,DOU,DNO,DUN, - DIN,DUN,DIN,DIN,DOU,DIN,DUN,DUN,DIN,DIN,DOU,DNO,DUN,DIN,DOU,DOU, - DOU,DOU,DOU,DNO,DIN,DNO,DNO,DIN,DOU,DOU,DOU,DOU,DIN,DOU,DIN,DOU, - DOU,DOU,DIN,DIN,DIN,DNO,DIN,DNO,DNO,DNO,DUN,DNO,DOU,DIN,DNO,DUN, - DUN,DIN,DIN,DNO,DNO,DOU,DUN,DUN,DNO,DIN,DIN,DNO,DIN,DOU,DUN,DUN, - DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, - DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, - DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, - DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, - DUN,DNO,DOU,DOU,DIN,DNO,DNO,DNO,DIN,DNO,DOU,DUN,DNO,DIN,DOU,DOU, - DOU,DOU,DOU,DNO,DUN,DIN,DOU,DIN,DIN,DIN,DNO,DNO,DNO,DIN,DIN,DUN, - DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, - DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, - DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DOU,DUN,DUN,DUN,DUN,DUN, - DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN -}; - -/* This should be safe */ -#define SBP2_MAX_CMDS 8 +#define SBP2_MAX_CMDS 8 /* This should be safe */ /* This is the two dma types we use for cmd_dma below */ enum cmd_dma_types {