diff options
Diffstat (limited to 'drivers/ieee1394/sbp2.c')
-rw-r--r-- | drivers/ieee1394/sbp2.c | 151 |
1 files changed, 16 insertions, 135 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index ab82d6addd7f..2bae300aad46 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -1071,7 +1071,7 @@ static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, quadlet_ | |||
1071 | static __inline__ int sbp2_command_conversion_device_type(u8 device_type) | 1071 | static __inline__ int sbp2_command_conversion_device_type(u8 device_type) |
1072 | { | 1072 | { |
1073 | return (((device_type == TYPE_DISK) || | 1073 | return (((device_type == TYPE_DISK) || |
1074 | (device_type == TYPE_SDAD) || | 1074 | (device_type == TYPE_RBC) || |
1075 | (device_type == TYPE_ROM)) ? 1:0); | 1075 | (device_type == TYPE_ROM)) ? 1:0); |
1076 | } | 1076 | } |
1077 | 1077 | ||
@@ -2112,102 +2112,6 @@ 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; | ||
2211 | } | 2115 | } |
2212 | 2116 | ||
2213 | /* | 2117 | /* |
@@ -2248,7 +2152,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2248 | struct scsi_cmnd *SCpnt) | 2152 | struct scsi_cmnd *SCpnt) |
2249 | { | 2153 | { |
2250 | u8 *scsi_buf = SCpnt->request_buffer; | 2154 | u8 *scsi_buf = SCpnt->request_buffer; |
2251 | u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun); | ||
2252 | 2155 | ||
2253 | SBP2_DEBUG("sbp2_check_sbp2_response"); | 2156 | SBP2_DEBUG("sbp2_check_sbp2_response"); |
2254 | 2157 | ||
@@ -2273,14 +2176,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2273 | } | 2176 | } |
2274 | 2177 | ||
2275 | /* | 2178 | /* |
2276 | * Check for Simple Direct Access Device and change it to TYPE_DISK | ||
2277 | */ | ||
2278 | if ((scsi_buf[0] & 0x1f) == TYPE_SDAD) { | ||
2279 | SBP2_DEBUG("Changing TYPE_SDAD to TYPE_DISK"); | ||
2280 | scsi_buf[0] &= 0xe0; | ||
2281 | } | ||
2282 | |||
2283 | /* | ||
2284 | * Fix ansi revision and response data format | 2179 | * Fix ansi revision and response data format |
2285 | */ | 2180 | */ |
2286 | scsi_buf[2] |= 2; | 2181 | scsi_buf[2] |= 2; |
@@ -2288,27 +2183,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, | |||
2288 | 2183 | ||
2289 | break; | 2184 | break; |
2290 | 2185 | ||
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 | |||
2312 | default: | 2186 | default: |
2313 | break; | 2187 | break; |
2314 | } | 2188 | } |
@@ -2580,8 +2454,6 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2580 | u32 scsi_status, struct scsi_cmnd *SCpnt, | 2454 | u32 scsi_status, struct scsi_cmnd *SCpnt, |
2581 | void (*done)(struct scsi_cmnd *)) | 2455 | void (*done)(struct scsi_cmnd *)) |
2582 | { | 2456 | { |
2583 | unsigned long flags; | ||
2584 | |||
2585 | SBP2_DEBUG("sbp2scsi_complete_command"); | 2457 | SBP2_DEBUG("sbp2scsi_complete_command"); |
2586 | 2458 | ||
2587 | /* | 2459 | /* |
@@ -2680,18 +2552,15 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id, | |||
2680 | /* | 2552 | /* |
2681 | * Tell scsi stack that we're done with this command | 2553 | * Tell scsi stack that we're done with this command |
2682 | */ | 2554 | */ |
2683 | spin_lock_irqsave(scsi_id->scsi_host->host_lock,flags); | ||
2684 | done (SCpnt); | 2555 | done (SCpnt); |
2685 | spin_unlock_irqrestore(scsi_id->scsi_host->host_lock,flags); | ||
2686 | |||
2687 | return; | ||
2688 | } | 2556 | } |
2689 | 2557 | ||
2690 | 2558 | ||
2691 | static int sbp2scsi_slave_configure (struct scsi_device *sdev) | 2559 | static int sbp2scsi_slave_configure (struct scsi_device *sdev) |
2692 | { | 2560 | { |
2693 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); | 2561 | blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); |
2694 | 2562 | sdev->use_10_for_rw = 1; | |
2563 | sdev->use_10_for_ms = 1; | ||
2695 | return 0; | 2564 | return 0; |
2696 | } | 2565 | } |
2697 | 2566 | ||
@@ -2747,7 +2616,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt) | |||
2747 | /* | 2616 | /* |
2748 | * Called by scsi stack when something has really gone wrong. | 2617 | * Called by scsi stack when something has really gone wrong. |
2749 | */ | 2618 | */ |
2750 | static int sbp2scsi_reset(struct scsi_cmnd *SCpnt) | 2619 | static int __sbp2scsi_reset(struct scsi_cmnd *SCpnt) |
2751 | { | 2620 | { |
2752 | struct scsi_id_instance_data *scsi_id = | 2621 | struct scsi_id_instance_data *scsi_id = |
2753 | (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; | 2622 | (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; |
@@ -2762,6 +2631,18 @@ static int sbp2scsi_reset(struct scsi_cmnd *SCpnt) | |||
2762 | return(SUCCESS); | 2631 | return(SUCCESS); |
2763 | } | 2632 | } |
2764 | 2633 | ||
2634 | static int sbp2scsi_reset(struct scsi_cmnd *SCpnt) | ||
2635 | { | ||
2636 | unsigned long flags; | ||
2637 | int rc; | ||
2638 | |||
2639 | spin_lock_irqsave(SCpnt->device->host->host_lock, flags); | ||
2640 | rc = __sbp2scsi_reset(SCpnt); | ||
2641 | spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); | ||
2642 | |||
2643 | return rc; | ||
2644 | } | ||
2645 | |||
2765 | static const char *sbp2scsi_info (struct Scsi_Host *host) | 2646 | static const char *sbp2scsi_info (struct Scsi_Host *host) |
2766 | { | 2647 | { |
2767 | return "SCSI emulation for IEEE-1394 SBP-2 Devices"; | 2648 | return "SCSI emulation for IEEE-1394 SBP-2 Devices"; |