aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2010-10-07 08:46:15 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:22:07 -0400
commit0a6a717ceff67f887b16783ce891f5dcf846f1fc (patch)
tree0c8ed32e970e9cbbb4cc64981cba9ae2694f6377 /drivers/usb
parent0a2b8a0d1101179fdebc974a7c72b514aede9d9d (diff)
USB: gadget: storage: reuse definitions from scsi.h header file
This commit changes storage_common.h, file_storage.c and f_mass_storage.c to use definitions of SCSI commands from scsi/scsi.h file instead of redefining the commands in storage_common.c. scsi/scsi.h header file was missing READ_FORMAT_CAPACITIES and READ_HEADER so this commit also add those to the header. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/f_mass_storage.c72
-rw-r--r--drivers/usb/gadget/file_storage.c74
-rw-r--r--drivers/usb/gadget/storage_common.c34
3 files changed, 75 insertions, 105 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 44e5ffed5c0..838286b1cd1 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -741,7 +741,7 @@ static int do_read(struct fsg_common *common)
741 741
742 /* Get the starting Logical Block Address and check that it's 742 /* Get the starting Logical Block Address and check that it's
743 * not too big */ 743 * not too big */
744 if (common->cmnd[0] == SC_READ_6) 744 if (common->cmnd[0] == READ_6)
745 lba = get_unaligned_be24(&common->cmnd[1]); 745 lba = get_unaligned_be24(&common->cmnd[1]);
746 else { 746 else {
747 lba = get_unaligned_be32(&common->cmnd[2]); 747 lba = get_unaligned_be32(&common->cmnd[2]);
@@ -879,7 +879,7 @@ static int do_write(struct fsg_common *common)
879 879
880 /* Get the starting Logical Block Address and check that it's 880 /* Get the starting Logical Block Address and check that it's
881 * not too big */ 881 * not too big */
882 if (common->cmnd[0] == SC_WRITE_6) 882 if (common->cmnd[0] == WRITE_6)
883 lba = get_unaligned_be24(&common->cmnd[1]); 883 lba = get_unaligned_be24(&common->cmnd[1]);
884 else { 884 else {
885 lba = get_unaligned_be32(&common->cmnd[2]); 885 lba = get_unaligned_be32(&common->cmnd[2]);
@@ -1186,7 +1186,7 @@ static int do_inquiry(struct fsg_common *common, struct fsg_buffhd *bh)
1186 return 36; 1186 return 36;
1187 } 1187 }
1188 1188
1189 buf[0] = curlun->cdrom ? TYPE_CDROM : TYPE_DISK; 1189 buf[0] = curlun->cdrom ? TYPE_ROM : TYPE_DISK;
1190 buf[1] = curlun->removable ? 0x80 : 0; 1190 buf[1] = curlun->removable ? 0x80 : 0;
1191 buf[2] = 2; /* ANSI SCSI level 2 */ 1191 buf[2] = 2; /* ANSI SCSI level 2 */
1192 buf[3] = 2; /* SCSI-2 INQUIRY data format */ 1192 buf[3] = 2; /* SCSI-2 INQUIRY data format */
@@ -1353,11 +1353,11 @@ static int do_mode_sense(struct fsg_common *common, struct fsg_buffhd *bh)
1353 * The only variable value is the WriteProtect bit. We will fill in 1353 * The only variable value is the WriteProtect bit. We will fill in
1354 * the mode data length later. */ 1354 * the mode data length later. */
1355 memset(buf, 0, 8); 1355 memset(buf, 0, 8);
1356 if (mscmnd == SC_MODE_SENSE_6) { 1356 if (mscmnd == MODE_SENSE) {
1357 buf[2] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */ 1357 buf[2] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */
1358 buf += 4; 1358 buf += 4;
1359 limit = 255; 1359 limit = 255;
1360 } else { /* SC_MODE_SENSE_10 */ 1360 } else { /* MODE_SENSE_10 */
1361 buf[3] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */ 1361 buf[3] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */
1362 buf += 8; 1362 buf += 8;
1363 limit = 65535; /* Should really be FSG_BUFLEN */ 1363 limit = 65535; /* Should really be FSG_BUFLEN */
@@ -1397,7 +1397,7 @@ static int do_mode_sense(struct fsg_common *common, struct fsg_buffhd *bh)
1397 } 1397 }
1398 1398
1399 /* Store the mode data length */ 1399 /* Store the mode data length */
1400 if (mscmnd == SC_MODE_SENSE_6) 1400 if (mscmnd == MODE_SENSE)
1401 buf0[0] = len - 1; 1401 buf0[0] = len - 1;
1402 else 1402 else
1403 put_unaligned_be16(len - 2, buf0); 1403 put_unaligned_be16(len - 2, buf0);
@@ -1886,7 +1886,7 @@ static int check_command(struct fsg_common *common, int cmnd_size,
1886 if (common->lun >= 0 && common->lun < common->nluns) { 1886 if (common->lun >= 0 && common->lun < common->nluns) {
1887 curlun = &common->luns[common->lun]; 1887 curlun = &common->luns[common->lun];
1888 common->curlun = curlun; 1888 common->curlun = curlun;
1889 if (common->cmnd[0] != SC_REQUEST_SENSE) { 1889 if (common->cmnd[0] != REQUEST_SENSE) {
1890 curlun->sense_data = SS_NO_SENSE; 1890 curlun->sense_data = SS_NO_SENSE;
1891 curlun->sense_data_info = 0; 1891 curlun->sense_data_info = 0;
1892 curlun->info_valid = 0; 1892 curlun->info_valid = 0;
@@ -1898,8 +1898,8 @@ static int check_command(struct fsg_common *common, int cmnd_size,
1898 1898
1899 /* INQUIRY and REQUEST SENSE commands are explicitly allowed 1899 /* INQUIRY and REQUEST SENSE commands are explicitly allowed
1900 * to use unsupported LUNs; all others may not. */ 1900 * to use unsupported LUNs; all others may not. */
1901 if (common->cmnd[0] != SC_INQUIRY && 1901 if (common->cmnd[0] != INQUIRY &&
1902 common->cmnd[0] != SC_REQUEST_SENSE) { 1902 common->cmnd[0] != REQUEST_SENSE) {
1903 DBG(common, "unsupported LUN %d\n", common->lun); 1903 DBG(common, "unsupported LUN %d\n", common->lun);
1904 return -EINVAL; 1904 return -EINVAL;
1905 } 1905 }
@@ -1908,8 +1908,8 @@ static int check_command(struct fsg_common *common, int cmnd_size,
1908 /* If a unit attention condition exists, only INQUIRY and 1908 /* If a unit attention condition exists, only INQUIRY and
1909 * REQUEST SENSE commands are allowed; anything else must fail. */ 1909 * REQUEST SENSE commands are allowed; anything else must fail. */
1910 if (curlun && curlun->unit_attention_data != SS_NO_SENSE && 1910 if (curlun && curlun->unit_attention_data != SS_NO_SENSE &&
1911 common->cmnd[0] != SC_INQUIRY && 1911 common->cmnd[0] != INQUIRY &&
1912 common->cmnd[0] != SC_REQUEST_SENSE) { 1912 common->cmnd[0] != REQUEST_SENSE) {
1913 curlun->sense_data = curlun->unit_attention_data; 1913 curlun->sense_data = curlun->unit_attention_data;
1914 curlun->unit_attention_data = SS_NO_SENSE; 1914 curlun->unit_attention_data = SS_NO_SENSE;
1915 return -EINVAL; 1915 return -EINVAL;
@@ -1960,7 +1960,7 @@ static int do_scsi_command(struct fsg_common *common)
1960 down_read(&common->filesem); /* We're using the backing file */ 1960 down_read(&common->filesem); /* We're using the backing file */
1961 switch (common->cmnd[0]) { 1961 switch (common->cmnd[0]) {
1962 1962
1963 case SC_INQUIRY: 1963 case INQUIRY:
1964 common->data_size_from_cmnd = common->cmnd[4]; 1964 common->data_size_from_cmnd = common->cmnd[4];
1965 reply = check_command(common, 6, DATA_DIR_TO_HOST, 1965 reply = check_command(common, 6, DATA_DIR_TO_HOST,
1966 (1<<4), 0, 1966 (1<<4), 0,
@@ -1969,7 +1969,7 @@ static int do_scsi_command(struct fsg_common *common)
1969 reply = do_inquiry(common, bh); 1969 reply = do_inquiry(common, bh);
1970 break; 1970 break;
1971 1971
1972 case SC_MODE_SELECT_6: 1972 case MODE_SELECT:
1973 common->data_size_from_cmnd = common->cmnd[4]; 1973 common->data_size_from_cmnd = common->cmnd[4];
1974 reply = check_command(common, 6, DATA_DIR_FROM_HOST, 1974 reply = check_command(common, 6, DATA_DIR_FROM_HOST,
1975 (1<<1) | (1<<4), 0, 1975 (1<<1) | (1<<4), 0,
@@ -1978,7 +1978,7 @@ static int do_scsi_command(struct fsg_common *common)
1978 reply = do_mode_select(common, bh); 1978 reply = do_mode_select(common, bh);
1979 break; 1979 break;
1980 1980
1981 case SC_MODE_SELECT_10: 1981 case MODE_SELECT_10:
1982 common->data_size_from_cmnd = 1982 common->data_size_from_cmnd =
1983 get_unaligned_be16(&common->cmnd[7]); 1983 get_unaligned_be16(&common->cmnd[7]);
1984 reply = check_command(common, 10, DATA_DIR_FROM_HOST, 1984 reply = check_command(common, 10, DATA_DIR_FROM_HOST,
@@ -1988,7 +1988,7 @@ static int do_scsi_command(struct fsg_common *common)
1988 reply = do_mode_select(common, bh); 1988 reply = do_mode_select(common, bh);
1989 break; 1989 break;
1990 1990
1991 case SC_MODE_SENSE_6: 1991 case MODE_SENSE:
1992 common->data_size_from_cmnd = common->cmnd[4]; 1992 common->data_size_from_cmnd = common->cmnd[4];
1993 reply = check_command(common, 6, DATA_DIR_TO_HOST, 1993 reply = check_command(common, 6, DATA_DIR_TO_HOST,
1994 (1<<1) | (1<<2) | (1<<4), 0, 1994 (1<<1) | (1<<2) | (1<<4), 0,
@@ -1997,7 +1997,7 @@ static int do_scsi_command(struct fsg_common *common)
1997 reply = do_mode_sense(common, bh); 1997 reply = do_mode_sense(common, bh);
1998 break; 1998 break;
1999 1999
2000 case SC_MODE_SENSE_10: 2000 case MODE_SENSE_10:
2001 common->data_size_from_cmnd = 2001 common->data_size_from_cmnd =
2002 get_unaligned_be16(&common->cmnd[7]); 2002 get_unaligned_be16(&common->cmnd[7]);
2003 reply = check_command(common, 10, DATA_DIR_TO_HOST, 2003 reply = check_command(common, 10, DATA_DIR_TO_HOST,
@@ -2007,7 +2007,7 @@ static int do_scsi_command(struct fsg_common *common)
2007 reply = do_mode_sense(common, bh); 2007 reply = do_mode_sense(common, bh);
2008 break; 2008 break;
2009 2009
2010 case SC_PREVENT_ALLOW_MEDIUM_REMOVAL: 2010 case ALLOW_MEDIUM_REMOVAL:
2011 common->data_size_from_cmnd = 0; 2011 common->data_size_from_cmnd = 0;
2012 reply = check_command(common, 6, DATA_DIR_NONE, 2012 reply = check_command(common, 6, DATA_DIR_NONE,
2013 (1<<4), 0, 2013 (1<<4), 0,
@@ -2016,7 +2016,7 @@ static int do_scsi_command(struct fsg_common *common)
2016 reply = do_prevent_allow(common); 2016 reply = do_prevent_allow(common);
2017 break; 2017 break;
2018 2018
2019 case SC_READ_6: 2019 case READ_6:
2020 i = common->cmnd[4]; 2020 i = common->cmnd[4];
2021 common->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; 2021 common->data_size_from_cmnd = (i == 0 ? 256 : i) << 9;
2022 reply = check_command(common, 6, DATA_DIR_TO_HOST, 2022 reply = check_command(common, 6, DATA_DIR_TO_HOST,
@@ -2026,7 +2026,7 @@ static int do_scsi_command(struct fsg_common *common)
2026 reply = do_read(common); 2026 reply = do_read(common);
2027 break; 2027 break;
2028 2028
2029 case SC_READ_10: 2029 case READ_10:
2030 common->data_size_from_cmnd = 2030 common->data_size_from_cmnd =
2031 get_unaligned_be16(&common->cmnd[7]) << 9; 2031 get_unaligned_be16(&common->cmnd[7]) << 9;
2032 reply = check_command(common, 10, DATA_DIR_TO_HOST, 2032 reply = check_command(common, 10, DATA_DIR_TO_HOST,
@@ -2036,7 +2036,7 @@ static int do_scsi_command(struct fsg_common *common)
2036 reply = do_read(common); 2036 reply = do_read(common);
2037 break; 2037 break;
2038 2038
2039 case SC_READ_12: 2039 case READ_12:
2040 common->data_size_from_cmnd = 2040 common->data_size_from_cmnd =
2041 get_unaligned_be32(&common->cmnd[6]) << 9; 2041 get_unaligned_be32(&common->cmnd[6]) << 9;
2042 reply = check_command(common, 12, DATA_DIR_TO_HOST, 2042 reply = check_command(common, 12, DATA_DIR_TO_HOST,
@@ -2046,7 +2046,7 @@ static int do_scsi_command(struct fsg_common *common)
2046 reply = do_read(common); 2046 reply = do_read(common);
2047 break; 2047 break;
2048 2048
2049 case SC_READ_CAPACITY: 2049 case READ_CAPACITY:
2050 common->data_size_from_cmnd = 8; 2050 common->data_size_from_cmnd = 8;
2051 reply = check_command(common, 10, DATA_DIR_TO_HOST, 2051 reply = check_command(common, 10, DATA_DIR_TO_HOST,
2052 (0xf<<2) | (1<<8), 1, 2052 (0xf<<2) | (1<<8), 1,
@@ -2055,7 +2055,7 @@ static int do_scsi_command(struct fsg_common *common)
2055 reply = do_read_capacity(common, bh); 2055 reply = do_read_capacity(common, bh);
2056 break; 2056 break;
2057 2057
2058 case SC_READ_HEADER: 2058 case READ_HEADER:
2059 if (!common->curlun || !common->curlun->cdrom) 2059 if (!common->curlun || !common->curlun->cdrom)
2060 goto unknown_cmnd; 2060 goto unknown_cmnd;
2061 common->data_size_from_cmnd = 2061 common->data_size_from_cmnd =
@@ -2067,7 +2067,7 @@ static int do_scsi_command(struct fsg_common *common)
2067 reply = do_read_header(common, bh); 2067 reply = do_read_header(common, bh);
2068 break; 2068 break;
2069 2069
2070 case SC_READ_TOC: 2070 case READ_TOC:
2071 if (!common->curlun || !common->curlun->cdrom) 2071 if (!common->curlun || !common->curlun->cdrom)
2072 goto unknown_cmnd; 2072 goto unknown_cmnd;
2073 common->data_size_from_cmnd = 2073 common->data_size_from_cmnd =
@@ -2079,7 +2079,7 @@ static int do_scsi_command(struct fsg_common *common)
2079 reply = do_read_toc(common, bh); 2079 reply = do_read_toc(common, bh);
2080 break; 2080 break;
2081 2081
2082 case SC_READ_FORMAT_CAPACITIES: 2082 case READ_FORMAT_CAPACITIES:
2083 common->data_size_from_cmnd = 2083 common->data_size_from_cmnd =
2084 get_unaligned_be16(&common->cmnd[7]); 2084 get_unaligned_be16(&common->cmnd[7]);
2085 reply = check_command(common, 10, DATA_DIR_TO_HOST, 2085 reply = check_command(common, 10, DATA_DIR_TO_HOST,
@@ -2089,7 +2089,7 @@ static int do_scsi_command(struct fsg_common *common)
2089 reply = do_read_format_capacities(common, bh); 2089 reply = do_read_format_capacities(common, bh);
2090 break; 2090 break;
2091 2091
2092 case SC_REQUEST_SENSE: 2092 case REQUEST_SENSE:
2093 common->data_size_from_cmnd = common->cmnd[4]; 2093 common->data_size_from_cmnd = common->cmnd[4];
2094 reply = check_command(common, 6, DATA_DIR_TO_HOST, 2094 reply = check_command(common, 6, DATA_DIR_TO_HOST,
2095 (1<<4), 0, 2095 (1<<4), 0,
@@ -2098,7 +2098,7 @@ static int do_scsi_command(struct fsg_common *common)
2098 reply = do_request_sense(common, bh); 2098 reply = do_request_sense(common, bh);
2099 break; 2099 break;
2100 2100
2101 case SC_START_STOP_UNIT: 2101 case START_STOP:
2102 common->data_size_from_cmnd = 0; 2102 common->data_size_from_cmnd = 0;
2103 reply = check_command(common, 6, DATA_DIR_NONE, 2103 reply = check_command(common, 6, DATA_DIR_NONE,
2104 (1<<1) | (1<<4), 0, 2104 (1<<1) | (1<<4), 0,
@@ -2107,7 +2107,7 @@ static int do_scsi_command(struct fsg_common *common)
2107 reply = do_start_stop(common); 2107 reply = do_start_stop(common);
2108 break; 2108 break;
2109 2109
2110 case SC_SYNCHRONIZE_CACHE: 2110 case SYNCHRONIZE_CACHE:
2111 common->data_size_from_cmnd = 0; 2111 common->data_size_from_cmnd = 0;
2112 reply = check_command(common, 10, DATA_DIR_NONE, 2112 reply = check_command(common, 10, DATA_DIR_NONE,
2113 (0xf<<2) | (3<<7), 1, 2113 (0xf<<2) | (3<<7), 1,
@@ -2116,7 +2116,7 @@ static int do_scsi_command(struct fsg_common *common)
2116 reply = do_synchronize_cache(common); 2116 reply = do_synchronize_cache(common);
2117 break; 2117 break;
2118 2118
2119 case SC_TEST_UNIT_READY: 2119 case TEST_UNIT_READY:
2120 common->data_size_from_cmnd = 0; 2120 common->data_size_from_cmnd = 0;
2121 reply = check_command(common, 6, DATA_DIR_NONE, 2121 reply = check_command(common, 6, DATA_DIR_NONE,
2122 0, 1, 2122 0, 1,
@@ -2125,7 +2125,7 @@ static int do_scsi_command(struct fsg_common *common)
2125 2125
2126 /* Although optional, this command is used by MS-Windows. We 2126 /* Although optional, this command is used by MS-Windows. We
2127 * support a minimal version: BytChk must be 0. */ 2127 * support a minimal version: BytChk must be 0. */
2128 case SC_VERIFY: 2128 case VERIFY:
2129 common->data_size_from_cmnd = 0; 2129 common->data_size_from_cmnd = 0;
2130 reply = check_command(common, 10, DATA_DIR_NONE, 2130 reply = check_command(common, 10, DATA_DIR_NONE,
2131 (1<<1) | (0xf<<2) | (3<<7), 1, 2131 (1<<1) | (0xf<<2) | (3<<7), 1,
@@ -2134,7 +2134,7 @@ static int do_scsi_command(struct fsg_common *common)
2134 reply = do_verify(common); 2134 reply = do_verify(common);
2135 break; 2135 break;
2136 2136
2137 case SC_WRITE_6: 2137 case WRITE_6:
2138 i = common->cmnd[4]; 2138 i = common->cmnd[4];
2139 common->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; 2139 common->data_size_from_cmnd = (i == 0 ? 256 : i) << 9;
2140 reply = check_command(common, 6, DATA_DIR_FROM_HOST, 2140 reply = check_command(common, 6, DATA_DIR_FROM_HOST,
@@ -2144,7 +2144,7 @@ static int do_scsi_command(struct fsg_common *common)
2144 reply = do_write(common); 2144 reply = do_write(common);
2145 break; 2145 break;
2146 2146
2147 case SC_WRITE_10: 2147 case WRITE_10:
2148 common->data_size_from_cmnd = 2148 common->data_size_from_cmnd =
2149 get_unaligned_be16(&common->cmnd[7]) << 9; 2149 get_unaligned_be16(&common->cmnd[7]) << 9;
2150 reply = check_command(common, 10, DATA_DIR_FROM_HOST, 2150 reply = check_command(common, 10, DATA_DIR_FROM_HOST,
@@ -2154,7 +2154,7 @@ static int do_scsi_command(struct fsg_common *common)
2154 reply = do_write(common); 2154 reply = do_write(common);
2155 break; 2155 break;
2156 2156
2157 case SC_WRITE_12: 2157 case WRITE_12:
2158 common->data_size_from_cmnd = 2158 common->data_size_from_cmnd =
2159 get_unaligned_be32(&common->cmnd[6]) << 9; 2159 get_unaligned_be32(&common->cmnd[6]) << 9;
2160 reply = check_command(common, 12, DATA_DIR_FROM_HOST, 2160 reply = check_command(common, 12, DATA_DIR_FROM_HOST,
@@ -2168,10 +2168,10 @@ static int do_scsi_command(struct fsg_common *common)
2168 * They don't mean much in this setting. It's left as an exercise 2168 * They don't mean much in this setting. It's left as an exercise
2169 * for anyone interested to implement RESERVE and RELEASE in terms 2169 * for anyone interested to implement RESERVE and RELEASE in terms
2170 * of Posix locks. */ 2170 * of Posix locks. */
2171 case SC_FORMAT_UNIT: 2171 case FORMAT_UNIT:
2172 case SC_RELEASE: 2172 case RELEASE:
2173 case SC_RESERVE: 2173 case RESERVE:
2174 case SC_SEND_DIAGNOSTIC: 2174 case SEND_DIAGNOSTIC:
2175 /* Fall through */ 2175 /* Fall through */
2176 2176
2177 default: 2177 default:
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index ce437f5dd67..d4fdf65fb92 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -783,7 +783,7 @@ static void received_cbi_adsc(struct fsg_dev *fsg, struct fsg_buffhd *bh)
783{ 783{
784 struct usb_request *req = fsg->ep0req; 784 struct usb_request *req = fsg->ep0req;
785 static u8 cbi_reset_cmnd[6] = { 785 static u8 cbi_reset_cmnd[6] = {
786 SC_SEND_DIAGNOSTIC, 4, 0xff, 0xff, 0xff, 0xff}; 786 SEND_DIAGNOSTIC, 4, 0xff, 0xff, 0xff, 0xff};
787 787
788 /* Error in command transfer? */ 788 /* Error in command transfer? */
789 if (req->status || req->length != req->actual || 789 if (req->status || req->length != req->actual ||
@@ -1135,7 +1135,7 @@ static int do_read(struct fsg_dev *fsg)
1135 1135
1136 /* Get the starting Logical Block Address and check that it's 1136 /* Get the starting Logical Block Address and check that it's
1137 * not too big */ 1137 * not too big */
1138 if (fsg->cmnd[0] == SC_READ_6) 1138 if (fsg->cmnd[0] == READ_6)
1139 lba = get_unaligned_be24(&fsg->cmnd[1]); 1139 lba = get_unaligned_be24(&fsg->cmnd[1]);
1140 else { 1140 else {
1141 lba = get_unaligned_be32(&fsg->cmnd[2]); 1141 lba = get_unaligned_be32(&fsg->cmnd[2]);
@@ -1270,7 +1270,7 @@ static int do_write(struct fsg_dev *fsg)
1270 1270
1271 /* Get the starting Logical Block Address and check that it's 1271 /* Get the starting Logical Block Address and check that it's
1272 * not too big */ 1272 * not too big */
1273 if (fsg->cmnd[0] == SC_WRITE_6) 1273 if (fsg->cmnd[0] == WRITE_6)
1274 lba = get_unaligned_be24(&fsg->cmnd[1]); 1274 lba = get_unaligned_be24(&fsg->cmnd[1]);
1275 else { 1275 else {
1276 lba = get_unaligned_be32(&fsg->cmnd[2]); 1276 lba = get_unaligned_be32(&fsg->cmnd[2]);
@@ -1578,7 +1578,7 @@ static int do_inquiry(struct fsg_dev *fsg, struct fsg_buffhd *bh)
1578 } 1578 }
1579 1579
1580 memset(buf, 0, 8); 1580 memset(buf, 0, 8);
1581 buf[0] = (mod_data.cdrom ? TYPE_CDROM : TYPE_DISK); 1581 buf[0] = (mod_data.cdrom ? TYPE_ROM : TYPE_DISK);
1582 if (mod_data.removable) 1582 if (mod_data.removable)
1583 buf[1] = 0x80; 1583 buf[1] = 0x80;
1584 buf[2] = 2; // ANSI SCSI level 2 1584 buf[2] = 2; // ANSI SCSI level 2
@@ -1747,11 +1747,11 @@ static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh)
1747 * The only variable value is the WriteProtect bit. We will fill in 1747 * The only variable value is the WriteProtect bit. We will fill in
1748 * the mode data length later. */ 1748 * the mode data length later. */
1749 memset(buf, 0, 8); 1749 memset(buf, 0, 8);
1750 if (mscmnd == SC_MODE_SENSE_6) { 1750 if (mscmnd == MODE_SENSE) {
1751 buf[2] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA 1751 buf[2] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA
1752 buf += 4; 1752 buf += 4;
1753 limit = 255; 1753 limit = 255;
1754 } else { // SC_MODE_SENSE_10 1754 } else { // MODE_SENSE_10
1755 buf[3] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA 1755 buf[3] = (curlun->ro ? 0x80 : 0x00); // WP, DPOFUA
1756 buf += 8; 1756 buf += 8;
1757 limit = 65535; // Should really be mod_data.buflen 1757 limit = 65535; // Should really be mod_data.buflen
@@ -1791,7 +1791,7 @@ static int do_mode_sense(struct fsg_dev *fsg, struct fsg_buffhd *bh)
1791 } 1791 }
1792 1792
1793 /* Store the mode data length */ 1793 /* Store the mode data length */
1794 if (mscmnd == SC_MODE_SENSE_6) 1794 if (mscmnd == MODE_SENSE)
1795 buf0[0] = len - 1; 1795 buf0[0] = len - 1;
1796 else 1796 else
1797 put_unaligned_be16(len - 2, buf0); 1797 put_unaligned_be16(len - 2, buf0);
@@ -2316,7 +2316,7 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size,
2316 /* Check the LUN */ 2316 /* Check the LUN */
2317 if (fsg->lun >= 0 && fsg->lun < fsg->nluns) { 2317 if (fsg->lun >= 0 && fsg->lun < fsg->nluns) {
2318 fsg->curlun = curlun = &fsg->luns[fsg->lun]; 2318 fsg->curlun = curlun = &fsg->luns[fsg->lun];
2319 if (fsg->cmnd[0] != SC_REQUEST_SENSE) { 2319 if (fsg->cmnd[0] != REQUEST_SENSE) {
2320 curlun->sense_data = SS_NO_SENSE; 2320 curlun->sense_data = SS_NO_SENSE;
2321 curlun->sense_data_info = 0; 2321 curlun->sense_data_info = 0;
2322 curlun->info_valid = 0; 2322 curlun->info_valid = 0;
@@ -2327,8 +2327,8 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size,
2327 2327
2328 /* INQUIRY and REQUEST SENSE commands are explicitly allowed 2328 /* INQUIRY and REQUEST SENSE commands are explicitly allowed
2329 * to use unsupported LUNs; all others may not. */ 2329 * to use unsupported LUNs; all others may not. */
2330 if (fsg->cmnd[0] != SC_INQUIRY && 2330 if (fsg->cmnd[0] != INQUIRY &&
2331 fsg->cmnd[0] != SC_REQUEST_SENSE) { 2331 fsg->cmnd[0] != REQUEST_SENSE) {
2332 DBG(fsg, "unsupported LUN %d\n", fsg->lun); 2332 DBG(fsg, "unsupported LUN %d\n", fsg->lun);
2333 return -EINVAL; 2333 return -EINVAL;
2334 } 2334 }
@@ -2337,8 +2337,8 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size,
2337 /* If a unit attention condition exists, only INQUIRY and 2337 /* If a unit attention condition exists, only INQUIRY and
2338 * REQUEST SENSE commands are allowed; anything else must fail. */ 2338 * REQUEST SENSE commands are allowed; anything else must fail. */
2339 if (curlun && curlun->unit_attention_data != SS_NO_SENSE && 2339 if (curlun && curlun->unit_attention_data != SS_NO_SENSE &&
2340 fsg->cmnd[0] != SC_INQUIRY && 2340 fsg->cmnd[0] != INQUIRY &&
2341 fsg->cmnd[0] != SC_REQUEST_SENSE) { 2341 fsg->cmnd[0] != REQUEST_SENSE) {
2342 curlun->sense_data = curlun->unit_attention_data; 2342 curlun->sense_data = curlun->unit_attention_data;
2343 curlun->unit_attention_data = SS_NO_SENSE; 2343 curlun->unit_attention_data = SS_NO_SENSE;
2344 return -EINVAL; 2344 return -EINVAL;
@@ -2388,7 +2388,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2388 down_read(&fsg->filesem); // We're using the backing file 2388 down_read(&fsg->filesem); // We're using the backing file
2389 switch (fsg->cmnd[0]) { 2389 switch (fsg->cmnd[0]) {
2390 2390
2391 case SC_INQUIRY: 2391 case INQUIRY:
2392 fsg->data_size_from_cmnd = fsg->cmnd[4]; 2392 fsg->data_size_from_cmnd = fsg->cmnd[4];
2393 if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, 2393 if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST,
2394 (1<<4), 0, 2394 (1<<4), 0,
@@ -2396,7 +2396,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2396 reply = do_inquiry(fsg, bh); 2396 reply = do_inquiry(fsg, bh);
2397 break; 2397 break;
2398 2398
2399 case SC_MODE_SELECT_6: 2399 case MODE_SELECT:
2400 fsg->data_size_from_cmnd = fsg->cmnd[4]; 2400 fsg->data_size_from_cmnd = fsg->cmnd[4];
2401 if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, 2401 if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST,
2402 (1<<1) | (1<<4), 0, 2402 (1<<1) | (1<<4), 0,
@@ -2404,7 +2404,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2404 reply = do_mode_select(fsg, bh); 2404 reply = do_mode_select(fsg, bh);
2405 break; 2405 break;
2406 2406
2407 case SC_MODE_SELECT_10: 2407 case MODE_SELECT_10:
2408 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); 2408 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]);
2409 if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, 2409 if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST,
2410 (1<<1) | (3<<7), 0, 2410 (1<<1) | (3<<7), 0,
@@ -2412,7 +2412,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2412 reply = do_mode_select(fsg, bh); 2412 reply = do_mode_select(fsg, bh);
2413 break; 2413 break;
2414 2414
2415 case SC_MODE_SENSE_6: 2415 case MODE_SENSE:
2416 fsg->data_size_from_cmnd = fsg->cmnd[4]; 2416 fsg->data_size_from_cmnd = fsg->cmnd[4];
2417 if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, 2417 if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST,
2418 (1<<1) | (1<<2) | (1<<4), 0, 2418 (1<<1) | (1<<2) | (1<<4), 0,
@@ -2420,7 +2420,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2420 reply = do_mode_sense(fsg, bh); 2420 reply = do_mode_sense(fsg, bh);
2421 break; 2421 break;
2422 2422
2423 case SC_MODE_SENSE_10: 2423 case MODE_SENSE_10:
2424 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); 2424 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]);
2425 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, 2425 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST,
2426 (1<<1) | (1<<2) | (3<<7), 0, 2426 (1<<1) | (1<<2) | (3<<7), 0,
@@ -2428,7 +2428,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2428 reply = do_mode_sense(fsg, bh); 2428 reply = do_mode_sense(fsg, bh);
2429 break; 2429 break;
2430 2430
2431 case SC_PREVENT_ALLOW_MEDIUM_REMOVAL: 2431 case ALLOW_MEDIUM_REMOVAL:
2432 fsg->data_size_from_cmnd = 0; 2432 fsg->data_size_from_cmnd = 0;
2433 if ((reply = check_command(fsg, 6, DATA_DIR_NONE, 2433 if ((reply = check_command(fsg, 6, DATA_DIR_NONE,
2434 (1<<4), 0, 2434 (1<<4), 0,
@@ -2436,7 +2436,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2436 reply = do_prevent_allow(fsg); 2436 reply = do_prevent_allow(fsg);
2437 break; 2437 break;
2438 2438
2439 case SC_READ_6: 2439 case READ_6:
2440 i = fsg->cmnd[4]; 2440 i = fsg->cmnd[4];
2441 fsg->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; 2441 fsg->data_size_from_cmnd = (i == 0 ? 256 : i) << 9;
2442 if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, 2442 if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST,
@@ -2445,7 +2445,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2445 reply = do_read(fsg); 2445 reply = do_read(fsg);
2446 break; 2446 break;
2447 2447
2448 case SC_READ_10: 2448 case READ_10:
2449 fsg->data_size_from_cmnd = 2449 fsg->data_size_from_cmnd =
2450 get_unaligned_be16(&fsg->cmnd[7]) << 9; 2450 get_unaligned_be16(&fsg->cmnd[7]) << 9;
2451 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, 2451 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST,
@@ -2454,7 +2454,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2454 reply = do_read(fsg); 2454 reply = do_read(fsg);
2455 break; 2455 break;
2456 2456
2457 case SC_READ_12: 2457 case READ_12:
2458 fsg->data_size_from_cmnd = 2458 fsg->data_size_from_cmnd =
2459 get_unaligned_be32(&fsg->cmnd[6]) << 9; 2459 get_unaligned_be32(&fsg->cmnd[6]) << 9;
2460 if ((reply = check_command(fsg, 12, DATA_DIR_TO_HOST, 2460 if ((reply = check_command(fsg, 12, DATA_DIR_TO_HOST,
@@ -2463,7 +2463,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2463 reply = do_read(fsg); 2463 reply = do_read(fsg);
2464 break; 2464 break;
2465 2465
2466 case SC_READ_CAPACITY: 2466 case READ_CAPACITY:
2467 fsg->data_size_from_cmnd = 8; 2467 fsg->data_size_from_cmnd = 8;
2468 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, 2468 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST,
2469 (0xf<<2) | (1<<8), 1, 2469 (0xf<<2) | (1<<8), 1,
@@ -2471,7 +2471,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2471 reply = do_read_capacity(fsg, bh); 2471 reply = do_read_capacity(fsg, bh);
2472 break; 2472 break;
2473 2473
2474 case SC_READ_HEADER: 2474 case READ_HEADER:
2475 if (!mod_data.cdrom) 2475 if (!mod_data.cdrom)
2476 goto unknown_cmnd; 2476 goto unknown_cmnd;
2477 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); 2477 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]);
@@ -2481,7 +2481,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2481 reply = do_read_header(fsg, bh); 2481 reply = do_read_header(fsg, bh);
2482 break; 2482 break;
2483 2483
2484 case SC_READ_TOC: 2484 case READ_TOC:
2485 if (!mod_data.cdrom) 2485 if (!mod_data.cdrom)
2486 goto unknown_cmnd; 2486 goto unknown_cmnd;
2487 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); 2487 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]);
@@ -2491,7 +2491,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2491 reply = do_read_toc(fsg, bh); 2491 reply = do_read_toc(fsg, bh);
2492 break; 2492 break;
2493 2493
2494 case SC_READ_FORMAT_CAPACITIES: 2494 case READ_FORMAT_CAPACITIES:
2495 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]); 2495 fsg->data_size_from_cmnd = get_unaligned_be16(&fsg->cmnd[7]);
2496 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST, 2496 if ((reply = check_command(fsg, 10, DATA_DIR_TO_HOST,
2497 (3<<7), 1, 2497 (3<<7), 1,
@@ -2499,7 +2499,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2499 reply = do_read_format_capacities(fsg, bh); 2499 reply = do_read_format_capacities(fsg, bh);
2500 break; 2500 break;
2501 2501
2502 case SC_REQUEST_SENSE: 2502 case REQUEST_SENSE:
2503 fsg->data_size_from_cmnd = fsg->cmnd[4]; 2503 fsg->data_size_from_cmnd = fsg->cmnd[4];
2504 if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST, 2504 if ((reply = check_command(fsg, 6, DATA_DIR_TO_HOST,
2505 (1<<4), 0, 2505 (1<<4), 0,
@@ -2507,7 +2507,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2507 reply = do_request_sense(fsg, bh); 2507 reply = do_request_sense(fsg, bh);
2508 break; 2508 break;
2509 2509
2510 case SC_START_STOP_UNIT: 2510 case START_STOP:
2511 fsg->data_size_from_cmnd = 0; 2511 fsg->data_size_from_cmnd = 0;
2512 if ((reply = check_command(fsg, 6, DATA_DIR_NONE, 2512 if ((reply = check_command(fsg, 6, DATA_DIR_NONE,
2513 (1<<1) | (1<<4), 0, 2513 (1<<1) | (1<<4), 0,
@@ -2515,7 +2515,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2515 reply = do_start_stop(fsg); 2515 reply = do_start_stop(fsg);
2516 break; 2516 break;
2517 2517
2518 case SC_SYNCHRONIZE_CACHE: 2518 case SYNCHRONIZE_CACHE:
2519 fsg->data_size_from_cmnd = 0; 2519 fsg->data_size_from_cmnd = 0;
2520 if ((reply = check_command(fsg, 10, DATA_DIR_NONE, 2520 if ((reply = check_command(fsg, 10, DATA_DIR_NONE,
2521 (0xf<<2) | (3<<7), 1, 2521 (0xf<<2) | (3<<7), 1,
@@ -2523,7 +2523,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2523 reply = do_synchronize_cache(fsg); 2523 reply = do_synchronize_cache(fsg);
2524 break; 2524 break;
2525 2525
2526 case SC_TEST_UNIT_READY: 2526 case TEST_UNIT_READY:
2527 fsg->data_size_from_cmnd = 0; 2527 fsg->data_size_from_cmnd = 0;
2528 reply = check_command(fsg, 6, DATA_DIR_NONE, 2528 reply = check_command(fsg, 6, DATA_DIR_NONE,
2529 0, 1, 2529 0, 1,
@@ -2532,7 +2532,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2532 2532
2533 /* Although optional, this command is used by MS-Windows. We 2533 /* Although optional, this command is used by MS-Windows. We
2534 * support a minimal version: BytChk must be 0. */ 2534 * support a minimal version: BytChk must be 0. */
2535 case SC_VERIFY: 2535 case VERIFY:
2536 fsg->data_size_from_cmnd = 0; 2536 fsg->data_size_from_cmnd = 0;
2537 if ((reply = check_command(fsg, 10, DATA_DIR_NONE, 2537 if ((reply = check_command(fsg, 10, DATA_DIR_NONE,
2538 (1<<1) | (0xf<<2) | (3<<7), 1, 2538 (1<<1) | (0xf<<2) | (3<<7), 1,
@@ -2540,7 +2540,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2540 reply = do_verify(fsg); 2540 reply = do_verify(fsg);
2541 break; 2541 break;
2542 2542
2543 case SC_WRITE_6: 2543 case WRITE_6:
2544 i = fsg->cmnd[4]; 2544 i = fsg->cmnd[4];
2545 fsg->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; 2545 fsg->data_size_from_cmnd = (i == 0 ? 256 : i) << 9;
2546 if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST, 2546 if ((reply = check_command(fsg, 6, DATA_DIR_FROM_HOST,
@@ -2549,7 +2549,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2549 reply = do_write(fsg); 2549 reply = do_write(fsg);
2550 break; 2550 break;
2551 2551
2552 case SC_WRITE_10: 2552 case WRITE_10:
2553 fsg->data_size_from_cmnd = 2553 fsg->data_size_from_cmnd =
2554 get_unaligned_be16(&fsg->cmnd[7]) << 9; 2554 get_unaligned_be16(&fsg->cmnd[7]) << 9;
2555 if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST, 2555 if ((reply = check_command(fsg, 10, DATA_DIR_FROM_HOST,
@@ -2558,7 +2558,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2558 reply = do_write(fsg); 2558 reply = do_write(fsg);
2559 break; 2559 break;
2560 2560
2561 case SC_WRITE_12: 2561 case WRITE_12:
2562 fsg->data_size_from_cmnd = 2562 fsg->data_size_from_cmnd =
2563 get_unaligned_be32(&fsg->cmnd[6]) << 9; 2563 get_unaligned_be32(&fsg->cmnd[6]) << 9;
2564 if ((reply = check_command(fsg, 12, DATA_DIR_FROM_HOST, 2564 if ((reply = check_command(fsg, 12, DATA_DIR_FROM_HOST,
@@ -2571,10 +2571,10 @@ static int do_scsi_command(struct fsg_dev *fsg)
2571 * They don't mean much in this setting. It's left as an exercise 2571 * They don't mean much in this setting. It's left as an exercise
2572 * for anyone interested to implement RESERVE and RELEASE in terms 2572 * for anyone interested to implement RESERVE and RELEASE in terms
2573 * of Posix locks. */ 2573 * of Posix locks. */
2574 case SC_FORMAT_UNIT: 2574 case FORMAT_UNIT:
2575 case SC_RELEASE: 2575 case RELEASE:
2576 case SC_RESERVE: 2576 case RESERVE:
2577 case SC_SEND_DIAGNOSTIC: 2577 case SEND_DIAGNOSTIC:
2578 // Fall through 2578 // Fall through
2579 2579
2580 default: 2580 default:
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index 0a7df3db71f..3b513bafaf2 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -53,8 +53,9 @@
53 */ 53 */
54 54
55 55
56#include <asm/unaligned.h>
57#include <linux/usb/storage.h> 56#include <linux/usb/storage.h>
57#include <scsi/scsi.h>
58#include <asm/unaligned.h>
58 59
59 60
60/* 61/*
@@ -153,10 +154,6 @@
153 154
154/*-------------------------------------------------------------------------*/ 155/*-------------------------------------------------------------------------*/
155 156
156/* SCSI device types */
157#define TYPE_DISK 0x00
158#define TYPE_CDROM 0x05
159
160/* Bulk-only data structures */ 157/* Bulk-only data structures */
161 158
162/* Command Block Wrapper */ 159/* Command Block Wrapper */
@@ -208,33 +205,6 @@ struct interrupt_data {
208/* Length of a SCSI Command Data Block */ 205/* Length of a SCSI Command Data Block */
209#define MAX_COMMAND_SIZE 16 206#define MAX_COMMAND_SIZE 16
210 207
211/* SCSI commands that we recognize */
212#define SC_FORMAT_UNIT 0x04
213#define SC_INQUIRY 0x12
214#define SC_MODE_SELECT_6 0x15
215#define SC_MODE_SELECT_10 0x55
216#define SC_MODE_SENSE_6 0x1a
217#define SC_MODE_SENSE_10 0x5a
218#define SC_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
219#define SC_READ_6 0x08
220#define SC_READ_10 0x28
221#define SC_READ_12 0xa8
222#define SC_READ_CAPACITY 0x25
223#define SC_READ_FORMAT_CAPACITIES 0x23
224#define SC_READ_HEADER 0x44
225#define SC_READ_TOC 0x43
226#define SC_RELEASE 0x17
227#define SC_REQUEST_SENSE 0x03
228#define SC_RESERVE 0x16
229#define SC_SEND_DIAGNOSTIC 0x1d
230#define SC_START_STOP_UNIT 0x1b
231#define SC_SYNCHRONIZE_CACHE 0x35
232#define SC_TEST_UNIT_READY 0x00
233#define SC_VERIFY 0x2f
234#define SC_WRITE_6 0x0a
235#define SC_WRITE_10 0x2a
236#define SC_WRITE_12 0xaa
237
238/* SCSI Sense Key/Additional Sense Code/ASC Qualifier values */ 208/* SCSI Sense Key/Additional Sense Code/ASC Qualifier values */
239#define SS_NO_SENSE 0 209#define SS_NO_SENSE 0
240#define SS_COMMUNICATION_FAILURE 0x040800 210#define SS_COMMUNICATION_FAILURE 0x040800