aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-floppy.c67
1 files changed, 24 insertions, 43 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index faf22d716f80..973f5f6c815e 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -195,32 +195,6 @@ enum {
195#define IDEFLOPPY_ERROR_GENERAL 101 195#define IDEFLOPPY_ERROR_GENERAL 101
196 196
197/* 197/*
198 * The following is used to format the general configuration word of the
199 * ATAPI IDENTIFY DEVICE command.
200 */
201struct idefloppy_id_gcw {
202#if defined(__LITTLE_ENDIAN_BITFIELD)
203 unsigned packet_size :2; /* Packet Size */
204 unsigned reserved234 :3; /* Reserved */
205 unsigned drq_type :2; /* Command packet DRQ type */
206 unsigned removable :1; /* Removable media */
207 unsigned device_type :5; /* Device type */
208 unsigned reserved13 :1; /* Reserved */
209 unsigned protocol :2; /* Protocol type */
210#elif defined(__BIG_ENDIAN_BITFIELD)
211 unsigned protocol :2; /* Protocol type */
212 unsigned reserved13 :1; /* Reserved */
213 unsigned device_type :5; /* Device type */
214 unsigned removable :1; /* Removable media */
215 unsigned drq_type :2; /* Command packet DRQ type */
216 unsigned reserved234 :3; /* Reserved */
217 unsigned packet_size :2; /* Packet Size */
218#else
219#error "Bitfield endianness not defined! Check your byteorder.h"
220#endif
221};
222
223/*
224 * Pages of the SELECT SENSE / MODE SENSE packet commands. 198 * Pages of the SELECT SENSE / MODE SENSE packet commands.
225 * See SFF-8070i spec. 199 * See SFF-8070i spec.
226 */ 200 */
@@ -1271,33 +1245,39 @@ static sector_t idefloppy_capacity(ide_drive_t *drive)
1271 */ 1245 */
1272static int idefloppy_identify_device(ide_drive_t *drive, struct hd_driveid *id) 1246static int idefloppy_identify_device(ide_drive_t *drive, struct hd_driveid *id)
1273{ 1247{
1274 struct idefloppy_id_gcw gcw; 1248 u8 gcw[2];
1249 u8 device_type, protocol, removable, drq_type, packet_size;
1275 1250
1276 *((u16 *) &gcw) = id->config; 1251 *((u16 *) &gcw) = id->config;
1277 1252
1253 device_type = gcw[1] & 0x1F;
1254 removable = (gcw[0] & 0x80) >> 7;
1255 protocol = (gcw[1] & 0xC0) >> 6;
1256 drq_type = (gcw[0] & 0x60) >> 5;
1257 packet_size = gcw[0] & 0x03;
1258
1278#ifdef CONFIG_PPC 1259#ifdef CONFIG_PPC
1279 /* kludge for Apple PowerBook internal zip */ 1260 /* kludge for Apple PowerBook internal zip */
1280 if ((gcw.device_type == 5) && 1261 if (device_type == 5 &&
1281 !strstr(id->model, "CD-ROM") && 1262 !strstr(id->model, "CD-ROM") && strstr(id->model, "ZIP"))
1282 strstr(id->model, "ZIP")) 1263 device_type = 0;
1283 gcw.device_type = 0;
1284#endif 1264#endif
1285 1265
1286 if (gcw.protocol != 2) 1266 if (protocol != 2)
1287 printk(KERN_ERR "ide-floppy: Protocol (0x%02x) is not ATAPI\n", 1267 printk(KERN_ERR "ide-floppy: Protocol (0x%02x) is not ATAPI\n",
1288 gcw.protocol); 1268 protocol);
1289 else if (gcw.device_type != 0) 1269 else if (device_type != 0)
1290 printk(KERN_ERR "ide-floppy: Device type (0x%02x) is not set " 1270 printk(KERN_ERR "ide-floppy: Device type (0x%02x) is not set "
1291 "to floppy\n", gcw.device_type); 1271 "to floppy\n", device_type);
1292 else if (!gcw.removable) 1272 else if (!removable)
1293 printk(KERN_ERR "ide-floppy: The removable flag is not set\n"); 1273 printk(KERN_ERR "ide-floppy: The removable flag is not set\n");
1294 else if (gcw.drq_type == 3) { 1274 else if (drq_type == 3)
1295 printk(KERN_ERR "ide-floppy: Sorry, DRQ type (0x%02x) not " 1275 printk(KERN_ERR "ide-floppy: Sorry, DRQ type (0x%02x) not "
1296 "supported\n", gcw.drq_type); 1276 "supported\n", drq_type);
1297 } else if (gcw.packet_size != 0) { 1277 else if (packet_size != 0)
1298 printk(KERN_ERR "ide-floppy: Packet size (0x%02x) is not 12 " 1278 printk(KERN_ERR "ide-floppy: Packet size (0x%02x) is not 12 "
1299 "bytes long\n", gcw.packet_size); 1279 "bytes\n", packet_size);
1300 } else 1280 else
1301 return 1; 1281 return 1;
1302 return 0; 1282 return 0;
1303} 1283}
@@ -1322,11 +1302,12 @@ static inline void idefloppy_add_settings(ide_drive_t *drive) { ; }
1322 1302
1323static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) 1303static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
1324{ 1304{
1325 struct idefloppy_id_gcw gcw; 1305 u8 gcw[2];
1326 1306
1327 *((u16 *) &gcw) = drive->id->config; 1307 *((u16 *) &gcw) = drive->id->config;
1328 floppy->pc = floppy->pc_stack; 1308 floppy->pc = floppy->pc_stack;
1329 if (gcw.drq_type == 1) 1309
1310 if (((gcw[0] & 0x60) >> 5) == 1)
1330 floppy->flags |= IDEFLOPPY_FLAG_DRQ_INTERRUPT; 1311 floppy->flags |= IDEFLOPPY_FLAG_DRQ_INTERRUPT;
1331 /* 1312 /*
1332 * We used to check revisions here. At this point however I'm giving up. 1313 * We used to check revisions here. At this point however I'm giving up.