aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-01 15:42:19 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-01 15:42:19 -0400
commitd8881cdab5e1810b0a03b480ed16c1e761e68257 (patch)
tree2f75a727f64af91dc8c1805dc4e9a31cc0d52bcd /drivers/usb/storage
parent4fe70410d9a219dabb47328effccae7e7f2a6e26 (diff)
isd200: make it 'struct hd_driveid'-free
* Factor out debug dump of id from isd200_get_inquiry_data() to isd200_dump_driveid(). * Change id field in struct isd200_info from 'struct hd_driveid *id' to 'u16 *id' and update driver accordingly. * Include <linux/ata.h> directly instead of through <linux/hdreg.h>. While at it: * Use ata_id_u32() and ata_id_has_lba() macros. There should be no functional changes caused by this patch. Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/isd200.c211
1 files changed, 66 insertions, 145 deletions
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 882c57b399f7..241eb35a15a0 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -46,6 +46,7 @@
46#include <linux/errno.h> 46#include <linux/errno.h>
47#include <linux/module.h> 47#include <linux/module.h>
48#include <linux/slab.h> 48#include <linux/slab.h>
49#include <linux/ata.h>
49#include <linux/hdreg.h> 50#include <linux/hdreg.h>
50#include <linux/scatterlist.h> 51#include <linux/scatterlist.h>
51 52
@@ -328,7 +329,7 @@ struct isd200_config {
328 329
329struct isd200_info { 330struct isd200_info {
330 struct inquiry_data InquiryData; 331 struct inquiry_data InquiryData;
331 struct hd_driveid *id; 332 u16 *id;
332 struct isd200_config ConfigData; 333 struct isd200_config ConfigData;
333 unsigned char *RegsBuf; 334 unsigned char *RegsBuf;
334 unsigned char ATARegs[8]; 335 unsigned char ATARegs[8];
@@ -556,7 +557,7 @@ static int isd200_action( struct us_data *us, int action,
556 ata.generic.RegisterSelect = REG_COMMAND; 557 ata.generic.RegisterSelect = REG_COMMAND;
557 ata.write.CommandByte = WIN_IDENTIFY; 558 ata.write.CommandByte = WIN_IDENTIFY;
558 isd200_set_srb(info, DMA_FROM_DEVICE, info->id, 559 isd200_set_srb(info, DMA_FROM_DEVICE, info->id,
559 sizeof(struct hd_driveid)); 560 ATA_ID_WORDS * 2);
560 break; 561 break;
561 562
562 default: 563 default:
@@ -1053,103 +1054,50 @@ static int isd200_manual_enum(struct us_data *us)
1053 return(retStatus); 1054 return(retStatus);
1054} 1055}
1055 1056
1056static void isd200_fix_driveid (struct hd_driveid *id) 1057static void isd200_fix_driveid(u16 *id)
1057{ 1058{
1058#ifndef __LITTLE_ENDIAN 1059#ifndef __LITTLE_ENDIAN
1059# ifdef __BIG_ENDIAN 1060# ifdef __BIG_ENDIAN
1060 int i; 1061 int i;
1061 u16 *stringcast; 1062
1062 1063 for (i = 0; i < ATA_ID_WORDS; i++)
1063 id->config = __le16_to_cpu(id->config); 1064 id[i] = __le16_to_cpu(id[i]);
1064 id->cyls = __le16_to_cpu(id->cyls);
1065 id->reserved2 = __le16_to_cpu(id->reserved2);
1066 id->heads = __le16_to_cpu(id->heads);
1067 id->track_bytes = __le16_to_cpu(id->track_bytes);
1068 id->sector_bytes = __le16_to_cpu(id->sector_bytes);
1069 id->sectors = __le16_to_cpu(id->sectors);
1070 id->vendor0 = __le16_to_cpu(id->vendor0);
1071 id->vendor1 = __le16_to_cpu(id->vendor1);
1072 id->vendor2 = __le16_to_cpu(id->vendor2);
1073 stringcast = (u16 *)&id->serial_no[0];
1074 for (i = 0; i < (20/2); i++)
1075 stringcast[i] = __le16_to_cpu(stringcast[i]);
1076 id->buf_type = __le16_to_cpu(id->buf_type);
1077 id->buf_size = __le16_to_cpu(id->buf_size);
1078 id->ecc_bytes = __le16_to_cpu(id->ecc_bytes);
1079 stringcast = (u16 *)&id->fw_rev[0];
1080 for (i = 0; i < (8/2); i++)
1081 stringcast[i] = __le16_to_cpu(stringcast[i]);
1082 stringcast = (u16 *)&id->model[0];
1083 for (i = 0; i < (40/2); i++)
1084 stringcast[i] = __le16_to_cpu(stringcast[i]);
1085 id->dword_io = __le16_to_cpu(id->dword_io);
1086 id->reserved50 = __le16_to_cpu(id->reserved50);
1087 id->field_valid = __le16_to_cpu(id->field_valid);
1088 id->cur_cyls = __le16_to_cpu(id->cur_cyls);
1089 id->cur_heads = __le16_to_cpu(id->cur_heads);
1090 id->cur_sectors = __le16_to_cpu(id->cur_sectors);
1091 id->cur_capacity0 = __le16_to_cpu(id->cur_capacity0);
1092 id->cur_capacity1 = __le16_to_cpu(id->cur_capacity1);
1093 id->lba_capacity = __le32_to_cpu(id->lba_capacity);
1094 id->dma_1word = __le16_to_cpu(id->dma_1word);
1095 id->dma_mword = __le16_to_cpu(id->dma_mword);
1096 id->eide_pio_modes = __le16_to_cpu(id->eide_pio_modes);
1097 id->eide_dma_min = __le16_to_cpu(id->eide_dma_min);
1098 id->eide_dma_time = __le16_to_cpu(id->eide_dma_time);
1099 id->eide_pio = __le16_to_cpu(id->eide_pio);
1100 id->eide_pio_iordy = __le16_to_cpu(id->eide_pio_iordy);
1101 for (i = 0; i < 2; ++i)
1102 id->words69_70[i] = __le16_to_cpu(id->words69_70[i]);
1103 for (i = 0; i < 4; ++i)
1104 id->words71_74[i] = __le16_to_cpu(id->words71_74[i]);
1105 id->queue_depth = __le16_to_cpu(id->queue_depth);
1106 for (i = 0; i < 4; ++i)
1107 id->words76_79[i] = __le16_to_cpu(id->words76_79[i]);
1108 id->major_rev_num = __le16_to_cpu(id->major_rev_num);
1109 id->minor_rev_num = __le16_to_cpu(id->minor_rev_num);
1110 id->command_set_1 = __le16_to_cpu(id->command_set_1);
1111 id->command_set_2 = __le16_to_cpu(id->command_set_2);
1112 id->cfsse = __le16_to_cpu(id->cfsse);
1113 id->cfs_enable_1 = __le16_to_cpu(id->cfs_enable_1);
1114 id->cfs_enable_2 = __le16_to_cpu(id->cfs_enable_2);
1115 id->csf_default = __le16_to_cpu(id->csf_default);
1116 id->dma_ultra = __le16_to_cpu(id->dma_ultra);
1117 id->trseuc = __le16_to_cpu(id->trseuc);
1118 id->trsEuc = __le16_to_cpu(id->trsEuc);
1119 id->CurAPMvalues = __le16_to_cpu(id->CurAPMvalues);
1120 id->mprc = __le16_to_cpu(id->mprc);
1121 id->hw_config = __le16_to_cpu(id->hw_config);
1122 id->acoustic = __le16_to_cpu(id->acoustic);
1123 id->msrqs = __le16_to_cpu(id->msrqs);
1124 id->sxfert = __le16_to_cpu(id->sxfert);
1125 id->sal = __le16_to_cpu(id->sal);
1126 id->spg = __le32_to_cpu(id->spg);
1127 id->lba_capacity_2 = __le64_to_cpu(id->lba_capacity_2);
1128 for (i = 0; i < 22; i++)
1129 id->words104_125[i] = __le16_to_cpu(id->words104_125[i]);
1130 id->last_lun = __le16_to_cpu(id->last_lun);
1131 id->word127 = __le16_to_cpu(id->word127);
1132 id->dlf = __le16_to_cpu(id->dlf);
1133 id->csfo = __le16_to_cpu(id->csfo);
1134 for (i = 0; i < 26; i++)
1135 id->words130_155[i] = __le16_to_cpu(id->words130_155[i]);
1136 id->word156 = __le16_to_cpu(id->word156);
1137 for (i = 0; i < 3; i++)
1138 id->words157_159[i] = __le16_to_cpu(id->words157_159[i]);
1139 id->cfa_power = __le16_to_cpu(id->cfa_power);
1140 for (i = 0; i < 14; i++)
1141 id->words161_175[i] = __le16_to_cpu(id->words161_175[i]);
1142 for (i = 0; i < 31; i++)
1143 id->words176_205[i] = __le16_to_cpu(id->words176_205[i]);
1144 for (i = 0; i < 48; i++)
1145 id->words206_254[i] = __le16_to_cpu(id->words206_254[i]);
1146 id->integrity_word = __le16_to_cpu(id->integrity_word);
1147# else 1065# else
1148# error "Please fix <asm/byteorder.h>" 1066# error "Please fix <asm/byteorder.h>"
1149# endif 1067# endif
1150#endif 1068#endif
1151} 1069}
1152 1070
1071static void isd200_dump_driveid(u16 *id)
1072{
1073 US_DEBUGP(" Identify Data Structure:\n");
1074 US_DEBUGP(" config = 0x%x\n", id[ATA_ID_CONFIG]);
1075 US_DEBUGP(" cyls = 0x%x\n", id[ATA_ID_CYLS]);
1076 US_DEBUGP(" heads = 0x%x\n", id[ATA_ID_HEADS]);
1077 US_DEBUGP(" track_bytes = 0x%x\n", id[4]);
1078 US_DEBUGP(" sector_bytes = 0x%x\n", id[5]);
1079 US_DEBUGP(" sectors = 0x%x\n", id[ATA_ID_SECTORS]);
1080 US_DEBUGP(" serial_no[0] = 0x%x\n", *(char *)&id[ATA_ID_SERNO]);
1081 US_DEBUGP(" buf_type = 0x%x\n", id[20]);
1082 US_DEBUGP(" buf_size = 0x%x\n", id[ATA_ID_BUF_SIZE]);
1083 US_DEBUGP(" ecc_bytes = 0x%x\n", id[22]);
1084 US_DEBUGP(" fw_rev[0] = 0x%x\n", *(char *)&id[ATA_ID_FW_REV]);
1085 US_DEBUGP(" model[0] = 0x%x\n", *(char *)&id[ATA_ID_PROD]);
1086 US_DEBUGP(" max_multsect = 0x%x\n", id[ATA_ID_MAX_MULTSECT] & 0xff);
1087 US_DEBUGP(" dword_io = 0x%x\n", id[ATA_ID_DWORD_IO]);
1088 US_DEBUGP(" capability = 0x%x\n", id[ATA_ID_CAPABILITY] >> 8);
1089 US_DEBUGP(" tPIO = 0x%x\n", id[ATA_ID_OLD_PIO_MODES] >> 8);
1090 US_DEBUGP(" tDMA = 0x%x\n", id[ATA_ID_OLD_DMA_MODES] >> 8);
1091 US_DEBUGP(" field_valid = 0x%x\n", id[ATA_ID_FIELD_VALID]);
1092 US_DEBUGP(" cur_cyls = 0x%x\n", id[ATA_ID_CUR_CYLS]);
1093 US_DEBUGP(" cur_heads = 0x%x\n", id[ATA_ID_CUR_HEADS]);
1094 US_DEBUGP(" cur_sectors = 0x%x\n", id[ATA_ID_CUR_SECTORS]);
1095 US_DEBUGP(" cur_capacity = 0x%x\n", ata_id_u32(id, 57));
1096 US_DEBUGP(" multsect = 0x%x\n", id[ATA_ID_MULTSECT] & 0xff);
1097 US_DEBUGP(" lba_capacity = 0x%x\n", ata_id_u32(id, ATA_ID_LBA_CAPACITY));
1098 US_DEBUGP(" command_set_1 = 0x%x\n", id[ATA_ID_COMMAND_SET_1]);
1099 US_DEBUGP(" command_set_2 = 0x%x\n", id[ATA_ID_COMMAND_SET_2]);
1100}
1153 1101
1154/************************************************************************** 1102/**************************************************************************
1155 * isd200_get_inquiry_data 1103 * isd200_get_inquiry_data
@@ -1163,7 +1111,7 @@ static int isd200_get_inquiry_data( struct us_data *us )
1163{ 1111{
1164 struct isd200_info *info = (struct isd200_info *)us->extra; 1112 struct isd200_info *info = (struct isd200_info *)us->extra;
1165 int retStatus = ISD200_GOOD; 1113 int retStatus = ISD200_GOOD;
1166 struct hd_driveid *id = info->id; 1114 u16 *id = info->id;
1167 1115
1168 US_DEBUGP("Entering isd200_get_inquiry_data\n"); 1116 US_DEBUGP("Entering isd200_get_inquiry_data\n");
1169 1117
@@ -1180,8 +1128,7 @@ static int isd200_get_inquiry_data( struct us_data *us )
1180 /* this must be an ATA device */ 1128 /* this must be an ATA device */
1181 /* perform an ATA Command Identify */ 1129 /* perform an ATA Command Identify */
1182 transferStatus = isd200_action( us, ACTION_IDENTIFY, 1130 transferStatus = isd200_action( us, ACTION_IDENTIFY,
1183 id, 1131 id, ATA_ID_WORDS * 2);
1184 sizeof(struct hd_driveid) );
1185 if (transferStatus != ISD200_TRANSPORT_GOOD) { 1132 if (transferStatus != ISD200_TRANSPORT_GOOD) {
1186 /* Error issuing ATA Command Identify */ 1133 /* Error issuing ATA Command Identify */
1187 US_DEBUGP(" Error issuing ATA Command Identify\n"); 1134 US_DEBUGP(" Error issuing ATA Command Identify\n");
@@ -1191,35 +1138,9 @@ static int isd200_get_inquiry_data( struct us_data *us )
1191 int i; 1138 int i;
1192 __be16 *src; 1139 __be16 *src;
1193 __u16 *dest; 1140 __u16 *dest;
1194 isd200_fix_driveid(id);
1195 1141
1196 US_DEBUGP(" Identify Data Structure:\n"); 1142 isd200_fix_driveid(id);
1197 US_DEBUGP(" config = 0x%x\n", id->config); 1143 isd200_dump_driveid(id);
1198 US_DEBUGP(" cyls = 0x%x\n", id->cyls);
1199 US_DEBUGP(" heads = 0x%x\n", id->heads);
1200 US_DEBUGP(" track_bytes = 0x%x\n", id->track_bytes);
1201 US_DEBUGP(" sector_bytes = 0x%x\n", id->sector_bytes);
1202 US_DEBUGP(" sectors = 0x%x\n", id->sectors);
1203 US_DEBUGP(" serial_no[0] = 0x%x\n", id->serial_no[0]);
1204 US_DEBUGP(" buf_type = 0x%x\n", id->buf_type);
1205 US_DEBUGP(" buf_size = 0x%x\n", id->buf_size);
1206 US_DEBUGP(" ecc_bytes = 0x%x\n", id->ecc_bytes);
1207 US_DEBUGP(" fw_rev[0] = 0x%x\n", id->fw_rev[0]);
1208 US_DEBUGP(" model[0] = 0x%x\n", id->model[0]);
1209 US_DEBUGP(" max_multsect = 0x%x\n", id->max_multsect);
1210 US_DEBUGP(" dword_io = 0x%x\n", id->dword_io);
1211 US_DEBUGP(" capability = 0x%x\n", id->capability);
1212 US_DEBUGP(" tPIO = 0x%x\n", id->tPIO);
1213 US_DEBUGP(" tDMA = 0x%x\n", id->tDMA);
1214 US_DEBUGP(" field_valid = 0x%x\n", id->field_valid);
1215 US_DEBUGP(" cur_cyls = 0x%x\n", id->cur_cyls);
1216 US_DEBUGP(" cur_heads = 0x%x\n", id->cur_heads);
1217 US_DEBUGP(" cur_sectors = 0x%x\n", id->cur_sectors);
1218 US_DEBUGP(" cur_capacity = 0x%x\n", (id->cur_capacity1 << 16) + id->cur_capacity0 );
1219 US_DEBUGP(" multsect = 0x%x\n", id->multsect);
1220 US_DEBUGP(" lba_capacity = 0x%x\n", id->lba_capacity);
1221 US_DEBUGP(" command_set_1 = 0x%x\n", id->command_set_1);
1222 US_DEBUGP(" command_set_2 = 0x%x\n", id->command_set_2);
1223 1144
1224 memset(&info->InquiryData, 0, sizeof(info->InquiryData)); 1145 memset(&info->InquiryData, 0, sizeof(info->InquiryData));
1225 1146
@@ -1229,30 +1150,30 @@ static int isd200_get_inquiry_data( struct us_data *us )
1229 /* The length must be at least 36 (5 + 31) */ 1150 /* The length must be at least 36 (5 + 31) */
1230 info->InquiryData.AdditionalLength = 0x1F; 1151 info->InquiryData.AdditionalLength = 0x1F;
1231 1152
1232 if (id->command_set_1 & COMMANDSET_MEDIA_STATUS) { 1153 if (id[ATA_ID_COMMAND_SET_1] & COMMANDSET_MEDIA_STATUS) {
1233 /* set the removable bit */ 1154 /* set the removable bit */
1234 info->InquiryData.DeviceTypeModifier = DEVICE_REMOVABLE; 1155 info->InquiryData.DeviceTypeModifier = DEVICE_REMOVABLE;
1235 info->DeviceFlags |= DF_REMOVABLE_MEDIA; 1156 info->DeviceFlags |= DF_REMOVABLE_MEDIA;
1236 } 1157 }
1237 1158
1238 /* Fill in vendor identification fields */ 1159 /* Fill in vendor identification fields */
1239 src = (__be16*)id->model; 1160 src = (__be16 *)&id[ATA_ID_PROD];
1240 dest = (__u16*)info->InquiryData.VendorId; 1161 dest = (__u16*)info->InquiryData.VendorId;
1241 for (i=0;i<4;i++) 1162 for (i=0;i<4;i++)
1242 dest[i] = be16_to_cpu(src[i]); 1163 dest[i] = be16_to_cpu(src[i]);
1243 1164
1244 src = (__be16*)(id->model+8); 1165 src = (__be16 *)&id[ATA_ID_PROD + 8/2];
1245 dest = (__u16*)info->InquiryData.ProductId; 1166 dest = (__u16*)info->InquiryData.ProductId;
1246 for (i=0;i<8;i++) 1167 for (i=0;i<8;i++)
1247 dest[i] = be16_to_cpu(src[i]); 1168 dest[i] = be16_to_cpu(src[i]);
1248 1169
1249 src = (__be16*)id->fw_rev; 1170 src = (__be16 *)&id[ATA_ID_FW_REV];
1250 dest = (__u16*)info->InquiryData.ProductRevisionLevel; 1171 dest = (__u16*)info->InquiryData.ProductRevisionLevel;
1251 for (i=0;i<2;i++) 1172 for (i=0;i<2;i++)
1252 dest[i] = be16_to_cpu(src[i]); 1173 dest[i] = be16_to_cpu(src[i]);
1253 1174
1254 /* determine if it supports Media Status Notification */ 1175 /* determine if it supports Media Status Notification */
1255 if (id->command_set_2 & COMMANDSET_MEDIA_STATUS) { 1176 if (id[ATA_ID_COMMAND_SET_2] & COMMANDSET_MEDIA_STATUS) {
1256 US_DEBUGP(" Device supports Media Status Notification\n"); 1177 US_DEBUGP(" Device supports Media Status Notification\n");
1257 1178
1258 /* Indicate that it is enabled, even though it is not 1179 /* Indicate that it is enabled, even though it is not
@@ -1301,7 +1222,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1301 union ata_cdb * ataCdb) 1222 union ata_cdb * ataCdb)
1302{ 1223{
1303 struct isd200_info *info = (struct isd200_info *)us->extra; 1224 struct isd200_info *info = (struct isd200_info *)us->extra;
1304 struct hd_driveid *id = info->id; 1225 u16 *id = info->id;
1305 int sendToTransport = 1; 1226 int sendToTransport = 1;
1306 unsigned char sectnum, head; 1227 unsigned char sectnum, head;
1307 unsigned short cylinder; 1228 unsigned short cylinder;
@@ -1369,13 +1290,12 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1369 1290
1370 US_DEBUGP(" ATA OUT - SCSIOP_READ_CAPACITY\n"); 1291 US_DEBUGP(" ATA OUT - SCSIOP_READ_CAPACITY\n");
1371 1292
1372 if (id->capability & CAPABILITY_LBA ) { 1293 if (ata_id_has_lba(id))
1373 capacity = id->lba_capacity - 1; 1294 capacity = ata_id_u32(id, ATA_ID_LBA_CAPACITY) - 1;
1374 } else { 1295 else
1375 capacity = (id->heads * 1296 capacity = (id[ATA_ID_HEADS] * id[ATA_ID_CYLS] *
1376 id->cyls * 1297 id[ATA_ID_SECTORS]) - 1;
1377 id->sectors) - 1; 1298
1378 }
1379 readCapacityData.LogicalBlockAddress = cpu_to_be32(capacity); 1299 readCapacityData.LogicalBlockAddress = cpu_to_be32(capacity);
1380 readCapacityData.BytesPerBlock = cpu_to_be32(0x200); 1300 readCapacityData.BytesPerBlock = cpu_to_be32(0x200);
1381 1301
@@ -1392,16 +1312,16 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1392 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]); 1312 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]);
1393 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8]; 1313 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8];
1394 1314
1395 if (id->capability & CAPABILITY_LBA) { 1315 if (ata_id_has_lba(id)) {
1396 sectnum = (unsigned char)(lba); 1316 sectnum = (unsigned char)(lba);
1397 cylinder = (unsigned short)(lba>>8); 1317 cylinder = (unsigned short)(lba>>8);
1398 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F); 1318 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F);
1399 } else { 1319 } else {
1400 sectnum = (unsigned char)((lba % id->sectors) + 1); 1320 sectnum = (u8)((lba % id[ATA_ID_SECTORS]) + 1);
1401 cylinder = (unsigned short)(lba / (id->sectors * 1321 cylinder = (u16)(lba / (id[ATA_ID_SECTORS] *
1402 id->heads)); 1322 id[ATA_ID_HEADS]));
1403 head = (unsigned char)((lba / id->sectors) % 1323 head = (u8)((lba / id[ATA_ID_SECTORS]) %
1404 id->heads); 1324 id[ATA_ID_HEADS]);
1405 } 1325 }
1406 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; 1326 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
1407 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; 1327 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
@@ -1424,14 +1344,16 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1424 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]); 1344 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]);
1425 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8]; 1345 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8];
1426 1346
1427 if (id->capability & CAPABILITY_LBA) { 1347 if (ata_id_has_lba(id)) {
1428 sectnum = (unsigned char)(lba); 1348 sectnum = (unsigned char)(lba);
1429 cylinder = (unsigned short)(lba>>8); 1349 cylinder = (unsigned short)(lba>>8);
1430 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F); 1350 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F);
1431 } else { 1351 } else {
1432 sectnum = (unsigned char)((lba % id->sectors) + 1); 1352 sectnum = (u8)((lba % id[ATA_ID_SECTORS]) + 1);
1433 cylinder = (unsigned short)(lba / (id->sectors * id->heads)); 1353 cylinder = (u16)(lba / (id[ATA_ID_SECTORS] *
1434 head = (unsigned char)((lba / id->sectors) % id->heads); 1354 id[ATA_ID_HEADS]));
1355 head = (u8)((lba / id[ATA_ID_SECTORS]) %
1356 id[ATA_ID_HEADS]);
1435 } 1357 }
1436 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; 1358 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
1437 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; 1359 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
@@ -1539,8 +1461,7 @@ static int isd200_init_info(struct us_data *us)
1539 if (!info) 1461 if (!info)
1540 retStatus = ISD200_ERROR; 1462 retStatus = ISD200_ERROR;
1541 else { 1463 else {
1542 info->id = (struct hd_driveid *) 1464 info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL);
1543 kzalloc(sizeof(struct hd_driveid), GFP_KERNEL);
1544 info->RegsBuf = (unsigned char *) 1465 info->RegsBuf = (unsigned char *)
1545 kmalloc(sizeof(info->ATARegs), GFP_KERNEL); 1466 kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
1546 info->srb.sense_buffer = 1467 info->srb.sense_buffer =