1/* Driver for Datafab USB Compact Flash reader
2 *
3 * $Id: datafab.c,v 1.1.1.1 2007/08/03 18:53:02 Exp $
4 *
5 * datafab driver v0.1:
6 *
7 * First release
8 *
9 * Current development and maintenance by:
10 *   (c) 2000 Jimmie Mayfield (mayfield+datafab@sackheads.org)
11 *
12 *   Many thanks to Robert Baruch for the SanDisk SmartMedia reader driver
13 *   which I used as a template for this driver.
14 *
15 *   Some bugfixes and scatter-gather code by Gregory P. Smith
16 *   (greg-usb@electricrain.com)
17 *
18 *   Fix for media change by Joerg Schneider (js@joergschneider.com)
19 *
20 * Other contributors:
21 *   (c) 2002 Alan Stern <stern@rowland.org>
22 *
23 * This program is free software; you can redistribute it and/or modify it
24 * under the terms of the GNU General Public License as published by the
25 * Free Software Foundation; either version 2, or (at your option) any
26 * later version.
27 *
28 * This program is distributed in the hope that it will be useful, but
29 * WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
31 * General Public License for more details.
32 *
33 * You should have received a copy of the GNU General Public License along
34 * with this program; if not, write to the Free Software Foundation, Inc.,
35 * 675 Mass Ave, Cambridge, MA 02139, USA.
36 */
37
38/*
39 * This driver attempts to support USB CompactFlash reader/writer devices
40 * based on Datafab USB-to-ATA chips.  It was specifically developed for the
41 * Datafab MDCFE-B USB CompactFlash reader but has since been found to work
42 * with a variety of Datafab-based devices from a number of manufacturers.
43 * I've received a report of this driver working with a Datafab-based
44 * SmartMedia device though please be aware that I'm personally unable to
45 * test SmartMedia support.
46 *
47 * This driver supports reading and writing.  If you're truly paranoid,
48 * however, you can force the driver into a write-protected state by setting
49 * the WP enable bits in datafab_handle_mode_sense().  See the comments
50 * in that routine.
51 */
52
53#include <linux/errno.h>
54#include <linux/slab.h>
55
56#include <scsi/scsi.h>
57#include <scsi/scsi_cmnd.h>
58
59#include "usb.h"
60#include "transport.h"
61#include "protocol.h"
62#include "debug.h"
63#include "datafab.h"
64
65static int datafab_determine_lun(struct us_data *us,
66				 struct datafab_info *info);
67
68
69static inline int
70datafab_bulk_read(struct us_data *us, unsigned char *data, unsigned int len) {
71	if (len == 0)
72		return USB_STOR_XFER_GOOD;
73
74	US_DEBUGP("datafab_bulk_read:  len = %d\n", len);
75	return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
76			data, len, NULL);
77}
78
79
80static inline int
81datafab_bulk_write(struct us_data *us, unsigned char *data, unsigned int len) {
82	if (len == 0)
83		return USB_STOR_XFER_GOOD;
84
85	US_DEBUGP("datafab_bulk_write:  len = %d\n", len);
86	return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
87			data, len, NULL);
88}
89
90
91static int datafab_read_data(struct us_data *us,
92			     struct datafab_info *info,
93			     u32 sector,
94			     u32 sectors)
95{
96	unsigned char *command = us->iobuf;
97	unsigned char *buffer;
98	unsigned char  thistime;
99	unsigned int totallen, alloclen;
100	int len, result;
101	unsigned int sg_idx = 0, sg_offset = 0;
102
103	// we're working in LBA mode.  according to the ATA spec,
104	// we can support up to 28-bit addressing.  I don't know if Datafab
105	// supports beyond 24-bit addressing.  It's kind of hard to test
106	// since it requires > 8GB CF card.
107	//
108	if (sectors > 0x0FFFFFFF)
109		return USB_STOR_TRANSPORT_ERROR;
110
111	if (info->lun == -1) {
112		result = datafab_determine_lun(us, info);
113		if (result != USB_STOR_TRANSPORT_GOOD)
114			return result;
115	}
116
117	totallen = sectors * info->ssize;
118
119	// Since we don't read more than 64 KB at a time, we have to create
120	// a bounce buffer and move the data a piece at a time between the
121	// bounce buffer and the actual transfer buffer.
122
123	alloclen = min(totallen, 65536u);
124	buffer = kmalloc(alloclen, GFP_NOIO);
125	if (buffer == NULL)
126		return USB_STOR_TRANSPORT_ERROR;
127
128	do {
129		// loop, never allocate or transfer more than 64k at once
130		// (min(128k, 255*info->ssize) is the real limit)
131
132		len = min(totallen, alloclen);
133		thistime = (len / info->ssize) & 0xff;
134
135		command[0] = 0;
136		command[1] = thistime;
137		command[2] = sector & 0xFF;
138		command[3] = (sector >> 8) & 0xFF;
139		command[4] = (sector >> 16) & 0xFF;
140
141		command[5] = 0xE0 + (info->lun << 4);
142		command[5] |= (sector >> 24) & 0x0F;
143		command[6] = 0x20;
144		command[7] = 0x01;
145
146		// send the read command
147		result = datafab_bulk_write(us, command, 8);
148		if (result != USB_STOR_XFER_GOOD)
149			goto leave;
150
151		// read the result
152		result = datafab_bulk_read(us, buffer, len);
153		if (result != USB_STOR_XFER_GOOD)
154			goto leave;
155
156		// Store the data in the transfer buffer
157		usb_stor_access_xfer_buf(buffer, len, us->srb,
158				 &sg_idx, &sg_offset, TO_XFER_BUF);
159
160		sector += thistime;
161		totallen -= len;
162	} while (totallen > 0);
163
164	kfree(buffer);
165	return USB_STOR_TRANSPORT_GOOD;
166
167 leave:
168	kfree(buffer);
169	return USB_STOR_TRANSPORT_ERROR;
170}
171
172
173static int datafab_write_data(struct us_data *us,
174			      struct datafab_info *info,
175			      u32 sector,
176			      u32 sectors)
177{
178	unsigned char *command = us->iobuf;
179	unsigned char *reply = us->iobuf;
180	unsigned char *buffer;
181	unsigned char thistime;
182	unsigned int totallen, alloclen;
183	int len, result;
184	unsigned int sg_idx = 0, sg_offset = 0;
185
186	// we're working in LBA mode.  according to the ATA spec,
187	// we can support up to 28-bit addressing.  I don't know if Datafab
188	// supports beyond 24-bit addressing.  It's kind of hard to test
189	// since it requires > 8GB CF card.
190	//
191	if (sectors > 0x0FFFFFFF)
192		return USB_STOR_TRANSPORT_ERROR;
193
194	if (info->lun == -1) {
195		result = datafab_determine_lun(us, info);
196		if (result != USB_STOR_TRANSPORT_GOOD)
197			return result;
198	}
199
200	totallen = sectors * info->ssize;
201
202	// Since we don't write more than 64 KB at a time, we have to create
203	// a bounce buffer and move the data a piece at a time between the
204	// bounce buffer and the actual transfer buffer.
205
206	alloclen = min(totallen, 65536u);
207	buffer = kmalloc(alloclen, GFP_NOIO);
208	if (buffer == NULL)
209		return USB_STOR_TRANSPORT_ERROR;
210
211	do {
212		// loop, never allocate or transfer more than 64k at once
213		// (min(128k, 255*info->ssize) is the real limit)
214
215		len = min(totallen, alloclen);
216		thistime = (len / info->ssize) & 0xff;
217
218		// Get the data from the transfer buffer
219		usb_stor_access_xfer_buf(buffer, len, us->srb,
220				&sg_idx, &sg_offset, FROM_XFER_BUF);
221
222		command[0] = 0;
223		command[1] = thistime;
224		command[2] = sector & 0xFF;
225		command[3] = (sector >> 8) & 0xFF;
226		command[4] = (sector >> 16) & 0xFF;
227
228		command[5] = 0xE0 + (info->lun << 4);
229		command[5] |= (sector >> 24) & 0x0F;
230		command[6] = 0x30;
231		command[7] = 0x02;
232
233		// send the command
234		result = datafab_bulk_write(us, command, 8);
235		if (result != USB_STOR_XFER_GOOD)
236			goto leave;
237
238		// send the data
239		result = datafab_bulk_write(us, buffer, len);
240		if (result != USB_STOR_XFER_GOOD)
241			goto leave;
242
243		// read the result
244		result = datafab_bulk_read(us, reply, 2);
245		if (result != USB_STOR_XFER_GOOD)
246			goto leave;
247
248		if (reply[0] != 0x50 && reply[1] != 0) {
249			US_DEBUGP("datafab_write_data:  Gah! "
250				  "write return code: %02x %02x\n",
251				  reply[0], reply[1]);
252			result = USB_STOR_TRANSPORT_ERROR;
253			goto leave;
254		}
255
256		sector += thistime;
257		totallen -= len;
258	} while (totallen > 0);
259
260	kfree(buffer);
261	return USB_STOR_TRANSPORT_GOOD;
262
263 leave:
264	kfree(buffer);
265	return USB_STOR_TRANSPORT_ERROR;
266}
267
268
269static int datafab_determine_lun(struct us_data *us,
270				 struct datafab_info *info)
271{
272	// Dual-slot readers can be thought of as dual-LUN devices.
273	// We need to determine which card slot is being used.
274	// We'll send an IDENTIFY DEVICE command and see which LUN responds...
275	//
276	// There might be a better way of doing this?
277
278	static unsigned char scommand[8] = { 0, 1, 0, 0, 0, 0xa0, 0xec, 1 };
279	unsigned char *command = us->iobuf;
280	unsigned char *buf;
281	int count = 0, rc;
282
283	if (!us || !info)
284		return USB_STOR_TRANSPORT_ERROR;
285
286	memcpy(command, scommand, 8);
287	buf = kmalloc(512, GFP_NOIO);
288	if (!buf)
289		return USB_STOR_TRANSPORT_ERROR;
290
291	US_DEBUGP("datafab_determine_lun:  locating...\n");
292
293	// we'll try 3 times before giving up...
294	//
295	while (count++ < 3) {
296		command[5] = 0xa0;
297
298		rc = datafab_bulk_write(us, command, 8);
299		if (rc != USB_STOR_XFER_GOOD) {
300			rc = USB_STOR_TRANSPORT_ERROR;
301			goto leave;
302		}
303
304		rc = datafab_bulk_read(us, buf, 512);
305		if (rc == USB_STOR_XFER_GOOD) {
306			info->lun = 0;
307			rc = USB_STOR_TRANSPORT_GOOD;
308			goto leave;
309		}
310
311		command[5] = 0xb0;
312
313		rc = datafab_bulk_write(us, command, 8);
314		if (rc != USB_STOR_XFER_GOOD) {
315			rc = USB_STOR_TRANSPORT_ERROR;
316			goto leave;
317		}
318
319		rc = datafab_bulk_read(us, buf, 512);
320		if (rc == USB_STOR_XFER_GOOD) {
321			info->lun = 1;
322			rc = USB_STOR_TRANSPORT_GOOD;
323			goto leave;
324		}
325
326		msleep(20);
327	}
328
329	rc = USB_STOR_TRANSPORT_ERROR;
330
331 leave:
332	kfree(buf);
333	return rc;
334}
335
336static int datafab_id_device(struct us_data *us,
337			     struct datafab_info *info)
338{
339	// this is a variation of the ATA "IDENTIFY DEVICE" command...according
340	// to the ATA spec, 'Sector Count' isn't used but the Windows driver
341	// sets this bit so we do too...
342	//
343	static unsigned char scommand[8] = { 0, 1, 0, 0, 0, 0xa0, 0xec, 1 };
344	unsigned char *command = us->iobuf;
345	unsigned char *reply;
346	int rc;
347
348	if (!us || !info)
349		return USB_STOR_TRANSPORT_ERROR;
350
351	if (info->lun == -1) {
352		rc = datafab_determine_lun(us, info);
353		if (rc != USB_STOR_TRANSPORT_GOOD)
354			return rc;
355	}
356
357	memcpy(command, scommand, 8);
358	reply = kmalloc(512, GFP_NOIO);
359	if (!reply)
360		return USB_STOR_TRANSPORT_ERROR;
361
362	command[5] += (info->lun << 4);
363
364	rc = datafab_bulk_write(us, command, 8);
365	if (rc != USB_STOR_XFER_GOOD) {
366		rc = USB_STOR_TRANSPORT_ERROR;
367		goto leave;
368	}
369
370	// we'll go ahead and extract the media capacity while we're here...
371	//
372	rc = datafab_bulk_read(us, reply, 512);
373	if (rc == USB_STOR_XFER_GOOD) {
374		// capacity is at word offset 57-58
375		//
376		info->sectors = ((u32)(reply[117]) << 24) |
377				((u32)(reply[116]) << 16) |
378				((u32)(reply[115]) <<  8) |
379				((u32)(reply[114])      );
380		rc = USB_STOR_TRANSPORT_GOOD;
381		goto leave;
382	}
383
384	rc = USB_STOR_TRANSPORT_ERROR;
385
386 leave:
387	kfree(reply);
388	return rc;
389}
390
391
392static int datafab_handle_mode_sense(struct us_data *us,
393				     struct scsi_cmnd * srb,
394				     int sense_6)
395{
396	static unsigned char rw_err_page[12] = {
397		0x1, 0xA, 0x21, 1, 0, 0, 0, 0, 1, 0, 0, 0
398	};
399	static unsigned char cache_page[12] = {
400		0x8, 0xA, 0x1, 0, 0, 0, 0, 0, 0, 0, 0, 0
401	};
402	static unsigned char rbac_page[12] = {
403		0x1B, 0xA, 0, 0x81, 0, 0, 0, 0, 0, 0, 0, 0
404	};
405	static unsigned char timer_page[8] = {
406		0x1C, 0x6, 0, 0, 0, 0
407	};
408	unsigned char pc, page_code;
409	unsigned int i = 0;
410	struct datafab_info *info = (struct datafab_info *) (us->extra);
411	unsigned char *ptr = us->iobuf;
412
413	// most of this stuff is just a hack to get things working.  the
414	// datafab reader doesn't present a SCSI interface so we
415	// fudge the SCSI commands...
416	//
417
418	pc = srb->cmnd[2] >> 6;
419	page_code = srb->cmnd[2] & 0x3F;
420
421	switch (pc) {
422	   case 0x0:
423		US_DEBUGP("datafab_handle_mode_sense:  Current values\n");
424		break;
425	   case 0x1:
426		US_DEBUGP("datafab_handle_mode_sense:  Changeable values\n");
427		break;
428	   case 0x2:
429		US_DEBUGP("datafab_handle_mode_sense:  Default values\n");
430		break;
431	   case 0x3:
432		US_DEBUGP("datafab_handle_mode_sense:  Saves values\n");
433		break;
434	}
435
436	memset(ptr, 0, 8);
437	if (sense_6) {
438		ptr[2] = 0x00;		// WP enable: 0x80
439		i = 4;
440	} else {
441		ptr[3] = 0x00;		// WP enable: 0x80
442		i = 8;
443	}
444
445	switch (page_code) {
446	   default:
447		// vendor-specific mode
448		info->sense_key = 0x05;
449		info->sense_asc = 0x24;
450		info->sense_ascq = 0x00;
451		return USB_STOR_TRANSPORT_FAILED;
452
453	   case 0x1:
454		memcpy(ptr + i, rw_err_page, sizeof(rw_err_page));
455		i += sizeof(rw_err_page);
456		break;
457
458	   case 0x8:
459		memcpy(ptr + i, cache_page, sizeof(cache_page));
460		i += sizeof(cache_page);
461		break;
462
463	   case 0x1B:
464		memcpy(ptr + i, rbac_page, sizeof(rbac_page));
465		i += sizeof(rbac_page);
466		break;
467
468	   case 0x1C:
469		memcpy(ptr + i, timer_page, sizeof(timer_page));
470		i += sizeof(timer_page);
471		break;
472
473	   case 0x3F:		// retrieve all pages
474		memcpy(ptr + i, timer_page, sizeof(timer_page));
475		i += sizeof(timer_page);
476		memcpy(ptr + i, rbac_page, sizeof(rbac_page));
477		i += sizeof(rbac_page);
478		memcpy(ptr + i, cache_page, sizeof(cache_page));
479		i += sizeof(cache_page);
480		memcpy(ptr + i, rw_err_page, sizeof(rw_err_page));
481		i += sizeof(rw_err_page);
482		break;
483	}
484
485	if (sense_6)
486		ptr[0] = i - 1;
487	else
488		((__be16 *) ptr)[0] = cpu_to_be16(i - 2);
489	usb_stor_set_xfer_buf(ptr, i, srb);
490
491	return USB_STOR_TRANSPORT_GOOD;
492}
493
494static void datafab_info_destructor(void *extra)
495{
496	// this routine is a placeholder...
497	// currently, we don't allocate any extra memory so we're okay
498}
499
500
501// Transport for the Datafab MDCFE-B
502//
503int datafab_transport(struct scsi_cmnd * srb, struct us_data *us)
504{
505	struct datafab_info *info;
506	int rc;
507	unsigned long block, blocks;
508	unsigned char *ptr = us->iobuf;
509	static unsigned char inquiry_reply[8] = {
510		0x00, 0x80, 0x00, 0x01, 0x1F, 0x00, 0x00, 0x00
511	};
512
513	if (!us->extra) {
514		us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO);
515		if (!us->extra) {
516			US_DEBUGP("datafab_transport:  Gah! "
517				  "Can't allocate storage for Datafab info struct!\n");
518			return USB_STOR_TRANSPORT_ERROR;
519		}
520		us->extra_destructor = datafab_info_destructor;
521  		((struct datafab_info *)us->extra)->lun = -1;
522	}
523
524	info = (struct datafab_info *) (us->extra);
525
526	if (srb->cmnd[0] == INQUIRY) {
527		US_DEBUGP("datafab_transport:  INQUIRY.  Returning bogus response");
528		memcpy(ptr, inquiry_reply, sizeof(inquiry_reply));
529		fill_inquiry_response(us, ptr, 36);
530		return USB_STOR_TRANSPORT_GOOD;
531	}
532
533	if (srb->cmnd[0] == READ_CAPACITY) {
534		info->ssize = 0x200;  // hard coded 512 byte sectors as per ATA spec
535		rc = datafab_id_device(us, info);
536		if (rc != USB_STOR_TRANSPORT_GOOD)
537			return rc;
538
539		US_DEBUGP("datafab_transport:  READ_CAPACITY:  %ld sectors, %ld bytes per sector\n",
540			  info->sectors, info->ssize);
541
542		// build the reply
543		// we need the last sector, not the number of sectors
544		((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1);
545		((__be32 *) ptr)[1] = cpu_to_be32(info->ssize);
546		usb_stor_set_xfer_buf(ptr, 8, srb);
547
548		return USB_STOR_TRANSPORT_GOOD;
549	}
550
551	if (srb->cmnd[0] == MODE_SELECT_10) {
552		US_DEBUGP("datafab_transport:  Gah! MODE_SELECT_10.\n");
553		return USB_STOR_TRANSPORT_ERROR;
554	}
555
556	// don't bother implementing READ_6 or WRITE_6.
557	//
558	if (srb->cmnd[0] == READ_10) {
559		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
560			((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
561
562		blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
563
564		US_DEBUGP("datafab_transport:  READ_10: read block 0x%04lx  count %ld\n", block, blocks);
565		return datafab_read_data(us, info, block, blocks);
566	}
567
568	if (srb->cmnd[0] == READ_12) {
569		// we'll probably never see a READ_12 but we'll do it anyway...
570		//
571		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
572			((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
573
574		blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
575			 ((u32)(srb->cmnd[8]) <<  8) | ((u32)(srb->cmnd[9]));
576
577		US_DEBUGP("datafab_transport:  READ_12: read block 0x%04lx  count %ld\n", block, blocks);
578		return datafab_read_data(us, info, block, blocks);
579	}
580
581	if (srb->cmnd[0] == WRITE_10) {
582		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
583			((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
584
585		blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
586
587		US_DEBUGP("datafab_transport:  WRITE_10: write block 0x%04lx  count %ld\n", block, blocks);
588		return datafab_write_data(us, info, block, blocks);
589	}
590
591	if (srb->cmnd[0] == WRITE_12) {
592		// we'll probably never see a WRITE_12 but we'll do it anyway...
593		//
594		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
595			((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
596
597		blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
598			 ((u32)(srb->cmnd[8]) <<  8) | ((u32)(srb->cmnd[9]));
599
600		US_DEBUGP("datafab_transport:  WRITE_12: write block 0x%04lx  count %ld\n", block, blocks);
601		return datafab_write_data(us, info, block, blocks);
602	}
603
604	if (srb->cmnd[0] == TEST_UNIT_READY) {
605		US_DEBUGP("datafab_transport:  TEST_UNIT_READY.\n");
606		return datafab_id_device(us, info);
607	}
608
609	if (srb->cmnd[0] == REQUEST_SENSE) {
610		US_DEBUGP("datafab_transport:  REQUEST_SENSE.  Returning faked response\n");
611
612		// this response is pretty bogus right now.  eventually if necessary
613		// we can set the correct sense data.  so far though it hasn't been
614		// necessary
615		//
616		memset(ptr, 0, 18);
617		ptr[0] = 0xF0;
618		ptr[2] = info->sense_key;
619		ptr[7] = 11;
620		ptr[12] = info->sense_asc;
621		ptr[13] = info->sense_ascq;
622		usb_stor_set_xfer_buf(ptr, 18, srb);
623
624		return USB_STOR_TRANSPORT_GOOD;
625	}
626
627	if (srb->cmnd[0] == MODE_SENSE) {
628		US_DEBUGP("datafab_transport:  MODE_SENSE_6 detected\n");
629		return datafab_handle_mode_sense(us, srb, 1);
630	}
631
632	if (srb->cmnd[0] == MODE_SENSE_10) {
633		US_DEBUGP("datafab_transport:  MODE_SENSE_10 detected\n");
634		return datafab_handle_mode_sense(us, srb, 0);
635	}
636
637	if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
638		// sure.  whatever.  not like we can stop the user from
639		// popping the media out of the device (no locking doors, etc)
640		//
641		return USB_STOR_TRANSPORT_GOOD;
642	}
643
644	if (srb->cmnd[0] == START_STOP) {
645		/* this is used by sd.c'check_scsidisk_media_change to detect
646		   media change */
647		US_DEBUGP("datafab_transport:  START_STOP.\n");
648		/* the first datafab_id_device after a media change returns
649		   an error (determined experimentally) */
650		rc = datafab_id_device(us, info);
651		if (rc == USB_STOR_TRANSPORT_GOOD) {
652			info->sense_key = NO_SENSE;
653			srb->result = SUCCESS;
654		} else {
655			info->sense_key = UNIT_ATTENTION;
656			srb->result = SAM_STAT_CHECK_CONDITION;
657		}
658		return rc;
659	}
660
661	US_DEBUGP("datafab_transport:  Gah! Unknown command: %d (0x%x)\n",
662		  srb->cmnd[0], srb->cmnd[0]);
663	info->sense_key = 0x05;
664	info->sense_asc = 0x20;
665	info->sense_ascq = 0x00;
666	return USB_STOR_TRANSPORT_FAILED;
667}
668