aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/sbp2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/sbp2.c')
-rw-r--r--drivers/ieee1394/sbp2.c154
1 files changed, 18 insertions, 136 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 00c7b958361a..2bae300aad46 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -745,7 +745,8 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
745 list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids); 745 list_add_tail(&scsi_id->scsi_list, &hi->scsi_ids);
746 746
747 /* Register our host with the SCSI stack. */ 747 /* Register our host with the SCSI stack. */
748 scsi_host = scsi_host_alloc(&scsi_driver_template, 0); 748 scsi_host = scsi_host_alloc(&scsi_driver_template,
749 sizeof (unsigned long));
749 if (!scsi_host) { 750 if (!scsi_host) {
750 SBP2_ERR("failed to register scsi host"); 751 SBP2_ERR("failed to register scsi host");
751 goto failed_alloc; 752 goto failed_alloc;
@@ -1070,7 +1071,7 @@ static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, quadlet_
1070static __inline__ int sbp2_command_conversion_device_type(u8 device_type) 1071static __inline__ int sbp2_command_conversion_device_type(u8 device_type)
1071{ 1072{
1072 return (((device_type == TYPE_DISK) || 1073 return (((device_type == TYPE_DISK) ||
1073 (device_type == TYPE_SDAD) || 1074 (device_type == TYPE_RBC) ||
1074 (device_type == TYPE_ROM)) ? 1:0); 1075 (device_type == TYPE_ROM)) ? 1:0);
1075} 1076}
1076 1077
@@ -2111,102 +2112,6 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
2111 */ 2112 */
2112static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd) 2113static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd)
2113{ 2114{
2114 unchar new_cmd[16];
2115 u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun);
2116
2117 SBP2_DEBUG("sbp2_check_sbp2_command");
2118
2119 switch (*cmd) {
2120
2121 case READ_6:
2122
2123 if (sbp2_command_conversion_device_type(device_type)) {
2124
2125 SBP2_DEBUG("Convert READ_6 to READ_10");
2126
2127 /*
2128 * Need to turn read_6 into read_10
2129 */
2130 new_cmd[0] = 0x28;
2131 new_cmd[1] = (cmd[1] & 0xe0);
2132 new_cmd[2] = 0x0;
2133 new_cmd[3] = (cmd[1] & 0x1f);
2134 new_cmd[4] = cmd[2];
2135 new_cmd[5] = cmd[3];
2136 new_cmd[6] = 0x0;
2137 new_cmd[7] = 0x0;
2138 new_cmd[8] = cmd[4];
2139 new_cmd[9] = cmd[5];
2140
2141 memcpy(cmd, new_cmd, 10);
2142
2143 }
2144
2145 break;
2146
2147 case WRITE_6:
2148
2149 if (sbp2_command_conversion_device_type(device_type)) {
2150
2151 SBP2_DEBUG("Convert WRITE_6 to WRITE_10");
2152
2153 /*
2154 * Need to turn write_6 into write_10
2155 */
2156 new_cmd[0] = 0x2a;
2157 new_cmd[1] = (cmd[1] & 0xe0);
2158 new_cmd[2] = 0x0;
2159 new_cmd[3] = (cmd[1] & 0x1f);
2160 new_cmd[4] = cmd[2];
2161 new_cmd[5] = cmd[3];
2162 new_cmd[6] = 0x0;
2163 new_cmd[7] = 0x0;
2164 new_cmd[8] = cmd[4];
2165 new_cmd[9] = cmd[5];
2166
2167 memcpy(cmd, new_cmd, 10);
2168
2169 }
2170
2171 break;
2172
2173 case MODE_SENSE:
2174
2175 if (sbp2_command_conversion_device_type(device_type)) {
2176
2177 SBP2_DEBUG("Convert MODE_SENSE_6 to MODE_SENSE_10");
2178
2179 /*
2180 * Need to turn mode_sense_6 into mode_sense_10
2181 */
2182 new_cmd[0] = 0x5a;
2183 new_cmd[1] = cmd[1];
2184 new_cmd[2] = cmd[2];
2185 new_cmd[3] = 0x0;
2186 new_cmd[4] = 0x0;
2187 new_cmd[5] = 0x0;
2188 new_cmd[6] = 0x0;
2189 new_cmd[7] = 0x0;
2190 new_cmd[8] = cmd[4];
2191 new_cmd[9] = cmd[5];
2192
2193 memcpy(cmd, new_cmd, 10);
2194
2195 }
2196
2197 break;
2198
2199 case MODE_SELECT:
2200
2201 /*
2202 * TODO. Probably need to change mode select to 10 byte version
2203 */
2204
2205 default:
2206 break;
2207 }
2208
2209 return;
2210} 2115}
2211 2116
2212/* 2117/*
@@ -2247,7 +2152,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2247 struct scsi_cmnd *SCpnt) 2152 struct scsi_cmnd *SCpnt)
2248{ 2153{
2249 u8 *scsi_buf = SCpnt->request_buffer; 2154 u8 *scsi_buf = SCpnt->request_buffer;
2250 u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun);
2251 2155
2252 SBP2_DEBUG("sbp2_check_sbp2_response"); 2156 SBP2_DEBUG("sbp2_check_sbp2_response");
2253 2157
@@ -2272,14 +2176,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2272 } 2176 }
2273 2177
2274 /* 2178 /*
2275 * Check for Simple Direct Access Device and change it to TYPE_DISK
2276 */
2277 if ((scsi_buf[0] & 0x1f) == TYPE_SDAD) {
2278 SBP2_DEBUG("Changing TYPE_SDAD to TYPE_DISK");
2279 scsi_buf[0] &= 0xe0;
2280 }
2281
2282 /*
2283 * Fix ansi revision and response data format 2179 * Fix ansi revision and response data format
2284 */ 2180 */
2285 scsi_buf[2] |= 2; 2181 scsi_buf[2] |= 2;
@@ -2287,27 +2183,6 @@ static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
2287 2183
2288 break; 2184 break;
2289 2185
2290 case MODE_SENSE:
2291
2292 if (sbp2_command_conversion_device_type(device_type)) {
2293
2294 SBP2_DEBUG("Modify mode sense response (10 byte version)");
2295
2296 scsi_buf[0] = scsi_buf[1]; /* Mode data length */
2297 scsi_buf[1] = scsi_buf[2]; /* Medium type */
2298 scsi_buf[2] = scsi_buf[3]; /* Device specific parameter */
2299 scsi_buf[3] = scsi_buf[7]; /* Block descriptor length */
2300 memcpy(scsi_buf + 4, scsi_buf + 8, scsi_buf[0]);
2301 }
2302
2303 break;
2304
2305 case MODE_SELECT:
2306
2307 /*
2308 * TODO. Probably need to change mode select to 10 byte version
2309 */
2310
2311 default: 2186 default:
2312 break; 2187 break;
2313 } 2188 }
@@ -2579,8 +2454,6 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2579 u32 scsi_status, struct scsi_cmnd *SCpnt, 2454 u32 scsi_status, struct scsi_cmnd *SCpnt,
2580 void (*done)(struct scsi_cmnd *)) 2455 void (*done)(struct scsi_cmnd *))
2581{ 2456{
2582 unsigned long flags;
2583
2584 SBP2_DEBUG("sbp2scsi_complete_command"); 2457 SBP2_DEBUG("sbp2scsi_complete_command");
2585 2458
2586 /* 2459 /*
@@ -2679,18 +2552,15 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
2679 /* 2552 /*
2680 * Tell scsi stack that we're done with this command 2553 * Tell scsi stack that we're done with this command
2681 */ 2554 */
2682 spin_lock_irqsave(scsi_id->scsi_host->host_lock,flags);
2683 done (SCpnt); 2555 done (SCpnt);
2684 spin_unlock_irqrestore(scsi_id->scsi_host->host_lock,flags);
2685
2686 return;
2687} 2556}
2688 2557
2689 2558
2690static int sbp2scsi_slave_configure (struct scsi_device *sdev) 2559static int sbp2scsi_slave_configure (struct scsi_device *sdev)
2691{ 2560{
2692 blk_queue_dma_alignment(sdev->request_queue, (512 - 1)); 2561 blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
2693 2562 sdev->use_10_for_rw = 1;
2563 sdev->use_10_for_ms = 1;
2694 return 0; 2564 return 0;
2695} 2565}
2696 2566
@@ -2746,7 +2616,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
2746/* 2616/*
2747 * Called by scsi stack when something has really gone wrong. 2617 * Called by scsi stack when something has really gone wrong.
2748 */ 2618 */
2749static int sbp2scsi_reset(struct scsi_cmnd *SCpnt) 2619static int __sbp2scsi_reset(struct scsi_cmnd *SCpnt)
2750{ 2620{
2751 struct scsi_id_instance_data *scsi_id = 2621 struct scsi_id_instance_data *scsi_id =
2752 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0]; 2622 (struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
@@ -2761,6 +2631,18 @@ static int sbp2scsi_reset(struct scsi_cmnd *SCpnt)
2761 return(SUCCESS); 2631 return(SUCCESS);
2762} 2632}
2763 2633
2634static 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
2764static const char *sbp2scsi_info (struct Scsi_Host *host) 2646static const char *sbp2scsi_info (struct Scsi_Host *host)
2765{ 2647{
2766 return "SCSI emulation for IEEE-1394 SBP-2 Devices"; 2648 return "SCSI emulation for IEEE-1394 SBP-2 Devices";