aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Collins <bcollins@debian.org>2005-11-07 06:31:24 -0500
committerJody McIntyre <scjody@modernduck.com>2005-11-07 06:31:24 -0500
commit365c786f0be44ee92e018773cb0bc4b19080b6aa (patch)
treebd1364ceb901bfbdc6b1158dc1633b35a57d0899 /drivers
parent7945619794314414a5c44df11fca4d3f2a3389cf (diff)
sbp2: Merge TYPE_RBC and 10byte removal patch from scsi maintainers.
Added more cleanups to remove unused code. Signed-off-by: Ben Collins <bcollins@debian.org> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ieee1394/sbp2.c151
-rw-r--r--drivers/ieee1394/sbp2.h1
2 files changed, 2 insertions, 150 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index f7e18ccc5c0a..d53c8cfe6610 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -1089,16 +1089,6 @@ static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, quadlet_
1089 **************************************/ 1089 **************************************/
1090 1090
1091/* 1091/*
1092 * This function determines if we should convert scsi commands for a particular sbp2 device type
1093 */
1094static __inline__ int sbp2_command_conversion_device_type(u8 device_type)
1095{
1096 return (((device_type == TYPE_DISK) ||
1097 (device_type == TYPE_RBC) ||
1098 (device_type == TYPE_ROM)) ? 1:0);
1099}
1100
1101/*
1102 * This function queries the device for the maximum concurrent logins it 1092 * This function queries the device for the maximum concurrent logins it
1103 * supports. 1093 * supports.
1104 */ 1094 */
@@ -2106,11 +2096,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
2106 sbp2_create_command_orb(scsi_id, command, cmd, SCpnt->use_sg, 2096 sbp2_create_command_orb(scsi_id, command, cmd, SCpnt->use_sg,
2107 request_bufflen, SCpnt->request_buffer, 2097 request_bufflen, SCpnt->request_buffer,
2108 SCpnt->sc_data_direction); 2098 SCpnt->sc_data_direction);
2109 /*
2110 * Update our cdb if necessary (to handle sbp2 RBC command set
2111 * differences). This is where the command set hacks go! =)
2112 */
2113 sbp2_check_sbp2_command(scsi_id, command->command_orb.cdb);
2114 2099
2115 sbp2util_packet_dump(&command->command_orb, sizeof(struct sbp2_command_orb), 2100 sbp2util_packet_dump(&command->command_orb, sizeof(struct sbp2_command_orb),
2116 "sbp2 command orb", command->command_orb_dma); 2101 "sbp2 command orb", command->command_orb_dma);
@@ -2130,110 +2115,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
2130 2115
2131 2116
2132/* 2117/*
2133 * This function deals with command set differences between Linux scsi
2134 * command set and sbp2 RBC command set.
2135 */
2136static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd)
2137{
2138 unchar new_cmd[16];
2139 u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun);
2140
2141 SBP2_DEBUG("sbp2_check_sbp2_command");
2142
2143 switch (*cmd) {
2144
2145 case READ_6:
2146
2147 if (sbp2_command_conversion_device_type(device_type)) {
2148
2149 SBP2_DEBUG("Convert READ_6 to READ_10");
2150
2151 /*
2152 * Need to turn read_6 into read_10
2153 */
2154 new_cmd[0] = 0x28;
2155 new_cmd[1] = (cmd[1] & 0xe0);
2156 new_cmd[2] = 0x0;
2157 new_cmd[3] = (cmd[1] & 0x1f);
2158 new_cmd[4] = cmd[2];
2159 new_cmd[5] = cmd[3];
2160 new_cmd[6] = 0x0;
2161 new_cmd[7] = 0x0;
2162 new_cmd[8] = cmd[4];
2163 new_cmd[9] = cmd[5];
2164
2165 memcpy(cmd, new_cmd, 10);
2166
2167 }
2168
2169 break;
2170
2171 case WRITE_6:
2172
2173 if (sbp2_command_conversion_device_type(device_type)) {
2174
2175 SBP2_DEBUG("Convert WRITE_6 to WRITE_10");
2176
2177 /*
2178 * Need to turn write_6 into write_10
2179 */
2180 new_cmd[0] = 0x2a;
2181 new_cmd[1] = (cmd[1] & 0xe0);
2182 new_cmd[2] = 0x0;
2183 new_cmd[3] = (cmd[1] & 0x1f);
2184 new_cmd[4] = cmd[2];
2185 new_cmd[5] = cmd[3];
2186 new_cmd[6] = 0x0;
2187 new_cmd[7] = 0x0;
2188 new_cmd[8] = cmd[4];
2189 new_cmd[9] = cmd[5];
2190
2191 memcpy(cmd, new_cmd, 10);
2192
2193 }
2194
2195 break;
2196
2197 case MODE_SENSE:
2198
2199 if (sbp2_command_conversion_device_type(device_type)) {
2200
2201 SBP2_DEBUG("Convert MODE_SENSE_6 to MODE_SENSE_10");
2202
2203 /*
2204 * Need to turn mode_sense_6 into mode_sense_10
2205 */
2206 new_cmd[0] = 0x5a;
2207 new_cmd[1] = cmd[1];
2208 new_cmd[2] = cmd[2];
2209 new_cmd[3] = 0x0;
2210 new_cmd[4] = 0x0;
2211 new_cmd[5] = 0x0;
2212 new_cmd[6] = 0x0;
2213 new_cmd[7] = 0x0;
2214 new_cmd[8] = cmd[4];
2215 new_cmd[9] = cmd[5];
2216
2217 memcpy(cmd, new_cmd, 10);
2218
2219 }
2220
2221 break;
2222
2223 case MODE_SELECT:
2224
2225 /*
2226 * TODO. Probably need to change mode select to 10 byte version
2227 */
2228
2229 default:
2230 break;
2231 }
2232
2233 return;
2234}
2235
2236/*
2237 * Translates SBP-2 status into SCSI sense data for check conditions 2118 * Translates SBP-2 status into SCSI sense data for check conditions
2238 */ 2119 */
2239static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data) 2120static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data)
@@ -2271,7 +2152,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2271 struct scsi_cmnd *SCpnt) 2152 struct scsi_cmnd *SCpnt)
2272{ 2153{
2273 u8 *scsi_buf = SCpnt->request_buffer; 2154 u8 *scsi_buf = SCpnt->request_buffer;
2274 u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun);
2275 2155
2276 SBP2_DEBUG("sbp2_check_sbp2_response"); 2156 SBP2_DEBUG("sbp2_check_sbp2_response");
2277 2157
@@ -2296,14 +2176,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2296 } 2176 }
2297 2177
2298 /* 2178 /*
2299 * Check for Simple Direct Access Device and change it to TYPE_DISK
2300 */
2301 if ((scsi_buf[0] & 0x1f) == TYPE_RBC) {
2302 SBP2_DEBUG("Changing TYPE_RBC to TYPE_DISK");
2303 scsi_buf[0] &= 0xe0;
2304 }
2305
2306 /*
2307 * Fix ansi revision and response data format 2179 * Fix ansi revision and response data format
2308 */ 2180 */
2309 scsi_buf[2] |= 2; 2181 scsi_buf[2] |= 2;
@@ -2311,27 +2183,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2311 2183
2312 break; 2184 break;
2313 2185
2314 case MODE_SENSE:
2315
2316 if (sbp2_command_conversion_device_type(device_type)) {
2317
2318 SBP2_DEBUG("Modify mode sense response (10 byte version)");
2319
2320 scsi_buf[0] = scsi_buf[1]; /* Mode data length */
2321 scsi_buf[1] = scsi_buf[2]; /* Medium type */
2322 scsi_buf[2] = scsi_buf[3]; /* Device specific parameter */
2323 scsi_buf[3] = scsi_buf[7]; /* Block descriptor length */
2324 memcpy(scsi_buf + 4, scsi_buf + 8, scsi_buf[0]);
2325 }
2326
2327 break;
2328
2329 case MODE_SELECT:
2330
2331 /*
2332 * TODO. Probably need to change mode select to 10 byte version
2333 */
2334
2335 default: 2186 default:
2336 break; 2187 break;
2337 } 2188 }
@@ -2713,6 +2564,8 @@ static int sbp2scsi_slave_alloc(struct scsi_device *sdev)
2713static int sbp2scsi_slave_configure(struct scsi_device *sdev) 2564static int sbp2scsi_slave_configure(struct scsi_device *sdev)
2714{ 2565{
2715 blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); 2566 blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
2567 sdev->use_10_for_rw = 1;
2568 sdev->use_10_for_ms = 1;
2716 return 0; 2569 return 0;
2717} 2570}
2718 2571
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h
index cd425be74841..cb111d751143 100644
--- a/drivers/ieee1394/sbp2.h
+++ b/drivers/ieee1394/sbp2.h
@@ -469,7 +469,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
469 struct scsi_cmnd *SCpnt, 469 struct scsi_cmnd *SCpnt,
470 void (*done)(struct scsi_cmnd *)); 470 void (*done)(struct scsi_cmnd *));
471static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data); 471static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data);
472static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd);
473static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, 472static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
474 struct scsi_cmnd *SCpnt); 473 struct scsi_cmnd *SCpnt);
475static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id, 474static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,