diff options
author | Ben Collins <bcollins@debian.org> | 2005-07-09 20:01:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-10 15:23:23 -0400 |
commit | 1934b8b6561ee7804b0a671b48cf642fcd936b2c (patch) | |
tree | 25c975176441aceedd2faae515121374f6f75750 /drivers/ieee1394/sbp2.c | |
parent | f179bc77d09b9087bfc559d0368bba350342ac76 (diff) |
[PATCH] Sync up ieee-1394
Lots of this patch is trivial code cleanups (static vars were being
intialized to 0, etc).
There's also some fixes for ISO transmits (max buffer handling).
Aswell, we have a few fixes to disable IRM capabilites correctly. We've
also disabled, by default some generally unused EXPORT symbols for the
sake of cleanliness in the kernel. However, instead of removing them
completely, we felt it necessary to have a config option that allowed
them to be enabled for the many projects outside of the main kernel tree
that use our API for driver development.
The primary reason for this patch is to revert a MODE6->MODE10 RBC
conversion patch from the SCSI maintainers. The new conversions handled
directly in the scsi layer do not seem to work for SBP2. This patch
reverts to our old working code so that users can enjoy using Firewire
disks and dvd drives again.
We are working with the SCSI maintainers to resolve this issue outside
of the main kernel tree. We'll merge the patch once the SCSI layer's
handling of the MODE10 conversion is working for us.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/ieee1394/sbp2.c')
-rw-r--r-- | drivers/ieee1394/sbp2.c | 135 |
1 files changed, 130 insertions, 5 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 32368f3428ec..fe3e1703fa61 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -81,7 +81,7 @@ | |||
81 | #include "sbp2.h" | 81 | #include "sbp2.h" |
82 | 82 | ||
83 | static char version[] __devinitdata = | 83 | static char version[] __devinitdata = |
84 | "$Rev: 1219 $ Ben Collins <bcollins@debian.org>"; | 84 | "$Rev: 1306 $ Ben Collins <bcollins@debian.org>"; |
85 | 85 | ||
86 | /* | 86 | /* |
87 | * Module load parameter definitions | 87 | * Module load parameter definitions |
@@ -104,7 +104,7 @@ MODULE_PARM_DESC(max_speed, "Force max speed (3 = 800mb, 2 = 400mb default, 1 = | |||
104 | * down to us at a time (debugging). This might be necessary for very | 104 | * down to us at a time (debugging). This might be necessary for very |
105 | * badly behaved sbp2 devices. | 105 | * badly behaved sbp2 devices. |
106 | */ | 106 | */ |
107 | static int serialize_io = 0; | 107 | static int serialize_io; |
108 | module_param(serialize_io, int, 0444); | 108 | module_param(serialize_io, int, 0444); |
109 | MODULE_PARM_DESC(serialize_io, "Serialize all I/O coming down from the scsi drivers (default = 0)"); | 109 | MODULE_PARM_DESC(serialize_io, "Serialize all I/O coming down from the scsi drivers (default = 0)"); |
110 | 110 | ||
@@ -145,7 +145,7 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)" | |||
145 | * please submit the logged sbp2_firmware_revision value of this device to | 145 | * please submit the logged sbp2_firmware_revision value of this device to |
146 | * the linux1394-devel mailing list. | 146 | * the linux1394-devel mailing list. |
147 | */ | 147 | */ |
148 | static int force_inquiry_hack = 0; | 148 | static int force_inquiry_hack; |
149 | module_param(force_inquiry_hack, int, 0444); | 149 | module_param(force_inquiry_hack, int, 0444); |
150 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); | 150 | MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); |
151 | 151 | ||
@@ -2112,6 +2112,102 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, | |||
2112 | */ | 2112 | */ |
2113 | static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd) | 2113 | static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd) |
2114 | { | 2114 | { |
2115 | unchar new_cmd[16]; | ||
2116 | u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); | ||
2117 | |||
2118 | SBP2_DEBUG("sbp2_check_sbp2_command"); | ||
2119 | |||
2120 | switch (*cmd) { | ||
2121 | |||
2122 | case READ_6: | ||
2123 | |||
2124 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2125 | |||
2126 | SBP2_DEBUG("Convert READ_6 to READ_10"); | ||
2127 | |||
2128 | /* | ||
2129 | * Need to turn read_6 into read_10 | ||
2130 | */ | ||
2131 | new_cmd[0] = 0x28; | ||
2132 | new_cmd[1] = (cmd[1] & 0xe0); | ||
2133 | new_cmd[2] = 0x0; | ||
2134 | new_cmd[3] = (cmd[1] & 0x1f); | ||
2135 | new_cmd[4] = cmd[2]; | ||
2136 | new_cmd[5] = cmd[3]; | ||
2137 | new_cmd[6] = 0x0; | ||
2138 | new_cmd[7] = 0x0; | ||
2139 | new_cmd[8] = cmd[4]; | ||
2140 | new_cmd[9] = cmd[5]; | ||
2141 | |||
2142 | memcpy(cmd, new_cmd, 10); | ||
2143 | |||
2144 | } | ||
2145 | |||
2146 | break; | ||
2147 | |||
2148 | case WRITE_6: | ||
2149 | |||
2150 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2151 | |||
2152 | SBP2_DEBUG("Convert WRITE_6 to WRITE_10"); | ||
2153 | |||
2154 | /* | ||
2155 | * Need to turn write_6 into write_10 | ||
2156 | */ | ||
2157 | new_cmd[0] = 0x2a; | ||
2158 | new_cmd[1] = (cmd[1] & 0xe0); | ||
2159 | new_cmd[2] = 0x0; | ||
2160 | new_cmd[3] = (cmd[1] & 0x1f); | ||
2161 | new_cmd[4] = cmd[2]; | ||
2162 | new_cmd[5] = cmd[3]; | ||
2163 | new_cmd[6] = 0x0; | ||
2164 | new_cmd[7] = 0x0; | ||
2165 | new_cmd[8] = cmd[4]; | ||
2166 | new_cmd[9] = cmd[5]; | ||
2167 | |||
2168 | memcpy(cmd, new_cmd, 10); | ||
2169 | |||
2170 | } | ||
2171 | |||
2172 | break; | ||
2173 | |||
2174 | case MODE_SENSE: | ||
2175 | |||
2176 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2177 | |||
2178 | SBP2_DEBUG("Convert MODE_SENSE_6 to MODE_SENSE_10"); | ||
2179 | |||
2180 | /* | ||
2181 | * Need to turn mode_sense_6 into mode_sense_10 | ||
2182 | */ | ||
2183 | new_cmd[0] = 0x5a; | ||
2184 | new_cmd[1] = cmd[1]; | ||
2185 | new_cmd[2] = cmd[2]; | ||
2186 | new_cmd[3] = 0x0; | ||
2187 | new_cmd[4] = 0x0; | ||
2188 | new_cmd[5] = 0x0; | ||
2189 | new_cmd[6] = 0x0; | ||
2190 | new_cmd[7] = 0x0; | ||
2191 | new_cmd[8] = cmd[4]; | ||
2192 | new_cmd[9] = cmd[5]; | ||
2193 | |||
2194 | memcpy(cmd, new_cmd, 10); | ||
2195 | |||
2196 | } | ||
2197 | |||
2198 | break; | ||
2199 | |||
2200 | case MODE_SELECT: | ||
2201 | |||
2202 | /* | ||
2203 | * TODO. Probably need to change mode select to 10 byte version | ||
2204 | */ | ||
2205 | |||
2206 | default: | ||
2207 | break; | ||
2208 | } | ||
2209 | |||
2210 | return; | ||
2115 | } | 2211 | } |
2116 | 2212 | ||
2117 | /* | 2213 | /* |
@@ -2152,6 +2248,7 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2152 | struct scsi_cmnd *SCpnt) | 2248 | struct scsi_cmnd *SCpnt) |
2153 | { | 2249 | { |
2154 | u8 *scsi_buf = SCpnt->request_buffer; | 2250 | u8 *scsi_buf = SCpnt->request_buffer; |
2251 | u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); | ||
2155 | 2252 | ||
2156 | SBP2_DEBUG("sbp2_check_sbp2_response"); | 2253 | SBP2_DEBUG("sbp2_check_sbp2_response"); |
2157 | 2254 | ||
@@ -2176,6 +2273,14 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2176 | } | 2273 | } |
2177 | 2274 | ||
2178 | /* | 2275 | /* |
2276 | * Check for Simple Direct Access Device and change it to TYPE_DISK | ||
2277 | */ | ||
2278 | if ((scsi_buf[0] & 0x1f) == TYPE_RBC) { | ||
2279 | SBP2_DEBUG("Changing TYPE_RBC to TYPE_DISK"); | ||
2280 | scsi_buf[0] &= 0xe0; | ||
2281 | } | ||
2282 | |||
2283 | /* | ||
2179 | * Fix ansi revision and response data format | 2284 | * Fix ansi revision and response data format |
2180 | */ | 2285 | */ |
2181 | scsi_buf[2] |= 2; | 2286 | scsi_buf[2] |= 2; |
@@ -2183,6 +2288,27 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2183 | 2288 | ||
2184 | break; | 2289 | break; |
2185 | 2290 | ||
2291 | case MODE_SENSE: | ||
2292 | |||
2293 | if (sbp2_command_conversion_device_type(device_type)) { | ||
2294 | |||
2295 | SBP2_DEBUG("Modify mode sense response (10 byte version)"); | ||
2296 | |||
2297 | scsi_buf[0] = scsi_buf[1]; /* Mode data length */ | ||
2298 | scsi_buf[1] = scsi_buf[2]; /* Medium type */ | ||
2299 | scsi_buf[2] = scsi_buf[3]; /* Device specific parameter */ | ||
2300 | scsi_buf[3] = scsi_buf[7]; /* Block descriptor length */ | ||
2301 | memcpy(scsi_buf + 4, scsi_buf + 8, scsi_buf[0]); | ||
2302 | } | ||
2303 | |||
2304 | break; | ||
2305 | |||
2306 | case MODE_SELECT: | ||
2307 | |||
2308 | /* | ||
2309 | * TODO. Probably need to change mode select to 10 byte version | ||
2310 | */ | ||
2311 | |||
2186 | default: | 2312 | default: |
2187 | break; | 2313 | break; |
2188 | } | 2314 | } |
@@ -2559,8 +2685,7 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2559 | static int sbp2scsi_slave_configure (struct scsi_device *sdev) | 2685 | static int sbp2scsi_slave_configure (struct scsi_device *sdev) |
2560 | { | 2686 | { |
2561 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); | 2687 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); |
2562 | sdev->use_10_for_rw = 1; | 2688 | |
2563 | sdev->use_10_for_ms = 1; | ||
2564 | return 0; | 2689 | return 0; |
2565 | } | 2690 | } |
2566 | 2691 | ||