sbp2: Merge TYPE_RBC and 10byte removal patch from scsi maintainers. Added more cleanups to remove unused code. Signed-off-by: Ben Collins Signed-off-by: Stefan Richter --- sbp2.c | 151 ----------------------------------------------------------------- sbp2.h | 1 2 files changed, 2 insertions(+), 150 deletions(-) diff -uprN -X linux-2.6.14-git3/Documentation/dontdiff linux-2.6.14-git3/drivers/ieee1394+sbp2locking/sbp2.c linux-2.6.14-git3/drivers/ieee1394/sbp2.c --- linux-2.6.14-git3/drivers/ieee1394+sbp2locking/sbp2.c 2005-10-31 12:58:12.000000000 +0100 +++ linux-2.6.14-git3/drivers/ieee1394/sbp2.c 2005-10-31 13:07:33.000000000 +0100 @@ -1089,16 +1089,6 @@ static int sbp2_handle_physdma_read(stru **************************************/ /* - * This function determines if we should convert scsi commands for a particular sbp2 device type - */ -static __inline__ int sbp2_command_conversion_device_type(u8 device_type) -{ - return (((device_type == TYPE_DISK) || - (device_type == TYPE_RBC) || - (device_type == TYPE_ROM)) ? 1:0); -} - -/* * This function queries the device for the maximum concurrent logins it * supports. */ @@ -2106,11 +2096,6 @@ static int sbp2_send_command(struct scsi sbp2_create_command_orb(scsi_id, command, cmd, SCpnt->use_sg, request_bufflen, SCpnt->request_buffer, SCpnt->sc_data_direction); - /* - * Update our cdb if necessary (to handle sbp2 RBC command set - * differences). This is where the command set hacks go! =) - */ - sbp2_check_sbp2_command(scsi_id, command->command_orb.cdb); sbp2util_packet_dump(&command->command_orb, sizeof(struct sbp2_command_orb), "sbp2 command orb", command->command_orb_dma); @@ -2130,110 +2115,6 @@ static int sbp2_send_command(struct scsi /* - * This function deals with command set differences between Linux scsi - * command set and sbp2 RBC command set. - */ -static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd) -{ - unchar new_cmd[16]; - u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); - - SBP2_DEBUG("sbp2_check_sbp2_command"); - - switch (*cmd) { - - case READ_6: - - if (sbp2_command_conversion_device_type(device_type)) { - - SBP2_DEBUG("Convert READ_6 to READ_10"); - - /* - * Need to turn read_6 into read_10 - */ - new_cmd[0] = 0x28; - new_cmd[1] = (cmd[1] & 0xe0); - new_cmd[2] = 0x0; - new_cmd[3] = (cmd[1] & 0x1f); - new_cmd[4] = cmd[2]; - new_cmd[5] = cmd[3]; - new_cmd[6] = 0x0; - new_cmd[7] = 0x0; - new_cmd[8] = cmd[4]; - new_cmd[9] = cmd[5]; - - memcpy(cmd, new_cmd, 10); - - } - - break; - - case WRITE_6: - - if (sbp2_command_conversion_device_type(device_type)) { - - SBP2_DEBUG("Convert WRITE_6 to WRITE_10"); - - /* - * Need to turn write_6 into write_10 - */ - new_cmd[0] = 0x2a; - new_cmd[1] = (cmd[1] & 0xe0); - new_cmd[2] = 0x0; - new_cmd[3] = (cmd[1] & 0x1f); - new_cmd[4] = cmd[2]; - new_cmd[5] = cmd[3]; - new_cmd[6] = 0x0; - new_cmd[7] = 0x0; - new_cmd[8] = cmd[4]; - new_cmd[9] = cmd[5]; - - memcpy(cmd, new_cmd, 10); - - } - - break; - - case MODE_SENSE: - - if (sbp2_command_conversion_device_type(device_type)) { - - SBP2_DEBUG("Convert MODE_SENSE_6 to MODE_SENSE_10"); - - /* - * Need to turn mode_sense_6 into mode_sense_10 - */ - new_cmd[0] = 0x5a; - new_cmd[1] = cmd[1]; - new_cmd[2] = cmd[2]; - new_cmd[3] = 0x0; - new_cmd[4] = 0x0; - new_cmd[5] = 0x0; - new_cmd[6] = 0x0; - new_cmd[7] = 0x0; - new_cmd[8] = cmd[4]; - new_cmd[9] = cmd[5]; - - memcpy(cmd, new_cmd, 10); - - } - - break; - - case MODE_SELECT: - - /* - * TODO. Probably need to change mode select to 10 byte version - */ - - default: - break; - } - - return; -} - -/* * Translates SBP-2 status into SCSI sense data for check conditions */ static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data) @@ -2271,7 +2152,6 @@ static void sbp2_check_sbp2_response(str struct scsi_cmnd *SCpnt) { u8 *scsi_buf = SCpnt->request_buffer; - u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); SBP2_DEBUG("sbp2_check_sbp2_response"); @@ -2296,14 +2176,6 @@ static void sbp2_check_sbp2_response(str } /* - * Check for Simple Direct Access Device and change it to TYPE_DISK - */ - if ((scsi_buf[0] & 0x1f) == TYPE_RBC) { - SBP2_DEBUG("Changing TYPE_RBC to TYPE_DISK"); - scsi_buf[0] &= 0xe0; - } - - /* * Fix ansi revision and response data format */ scsi_buf[2] |= 2; @@ -2311,27 +2183,6 @@ static void sbp2_check_sbp2_response(str break; - case MODE_SENSE: - - if (sbp2_command_conversion_device_type(device_type)) { - - SBP2_DEBUG("Modify mode sense response (10 byte version)"); - - scsi_buf[0] = scsi_buf[1]; /* Mode data length */ - scsi_buf[1] = scsi_buf[2]; /* Medium type */ - scsi_buf[2] = scsi_buf[3]; /* Device specific parameter */ - scsi_buf[3] = scsi_buf[7]; /* Block descriptor length */ - memcpy(scsi_buf + 4, scsi_buf + 8, scsi_buf[0]); - } - - break; - - case MODE_SELECT: - - /* - * TODO. Probably need to change mode select to 10 byte version - */ - default: break; } @@ -2713,6 +2564,8 @@ static int sbp2scsi_slave_alloc(struct s static int sbp2scsi_slave_configure(struct scsi_device *sdev) { blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); + sdev->use_10_for_rw = 1; + sdev->use_10_for_ms = 1; return 0; } diff -uprN -X linux-2.6.14-git3/Documentation/dontdiff linux-2.6.14-git3/drivers/ieee1394+sbp2locking/sbp2.h linux-2.6.14-git3/drivers/ieee1394/sbp2.h --- linux-2.6.14-git3/drivers/ieee1394+sbp2locking/sbp2.h 2005-10-28 02:02:08.000000000 +0200 +++ linux-2.6.14-git3/drivers/ieee1394/sbp2.h 2005-10-31 13:07:33.000000000 +0100 @@ -469,7 +469,6 @@ static int sbp2_send_command(struct scsi struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)); static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data); -static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd); static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, struct scsi_cmnd *SCpnt); static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,