diff options
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index d8b02fb0284c..aed25590d058 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -498,20 +498,6 @@ enum { | |||
498 | #define IDETAPE_ERROR_FILEMARK 102 | 498 | #define IDETAPE_ERROR_FILEMARK 102 |
499 | #define IDETAPE_ERROR_EOD 103 | 499 | #define IDETAPE_ERROR_EOD 103 |
500 | 500 | ||
501 | /* | ||
502 | * The following is used to format the general configuration word of | ||
503 | * the ATAPI IDENTIFY DEVICE command. | ||
504 | */ | ||
505 | struct idetape_id_gcw { | ||
506 | unsigned packet_size :2; /* Packet Size */ | ||
507 | unsigned reserved234 :3; /* Reserved */ | ||
508 | unsigned drq_type :2; /* Command packet DRQ type */ | ||
509 | unsigned removable :1; /* Removable media */ | ||
510 | unsigned device_type :5; /* Device type */ | ||
511 | unsigned reserved13 :1; /* Reserved */ | ||
512 | unsigned protocol :2; /* Protocol type */ | ||
513 | }; | ||
514 | |||
515 | /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ | 501 | /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ |
516 | #define IDETAPE_BLOCK_DESCRIPTOR 0 | 502 | #define IDETAPE_BLOCK_DESCRIPTOR 0 |
517 | #define IDETAPE_CAPABILITIES_PAGE 0x2a | 503 | #define IDETAPE_CAPABILITIES_PAGE 0x2a |
@@ -3254,37 +3240,39 @@ static int idetape_chrdev_release (struct inode *inode, struct file *filp) | |||
3254 | } | 3240 | } |
3255 | 3241 | ||
3256 | /* | 3242 | /* |
3257 | * idetape_identify_device is called to check the contents of the | 3243 | * check the contents of the ATAPI IDENTIFY command results. We return: |
3258 | * ATAPI IDENTIFY command results. We return: | ||
3259 | * | 3244 | * |
3260 | * 1 If the tape can be supported by us, based on the information | 3245 | * 1 - If the tape can be supported by us, based on the information we have so |
3261 | * we have so far. | 3246 | * far. |
3262 | * | 3247 | * |
3263 | * 0 If this tape driver is not currently supported by us. | 3248 | * 0 - If this tape driver is not currently supported by us. |
3264 | */ | 3249 | */ |
3265 | static int idetape_identify_device (ide_drive_t *drive) | 3250 | static int idetape_identify_device(ide_drive_t *drive) |
3266 | { | 3251 | { |
3267 | struct idetape_id_gcw gcw; | 3252 | u8 gcw[2], protocol, device_type, removable, packet_size; |
3268 | struct hd_driveid *id = drive->id; | ||
3269 | 3253 | ||
3270 | if (drive->id_read == 0) | 3254 | if (drive->id_read == 0) |
3271 | return 1; | 3255 | return 1; |
3272 | 3256 | ||
3273 | *((unsigned short *) &gcw) = id->config; | 3257 | *((unsigned short *) &gcw) = drive->id->config; |
3274 | 3258 | ||
3275 | /* Check that we can support this device */ | 3259 | protocol = (gcw[1] & 0xC0) >> 6; |
3260 | device_type = gcw[1] & 0x1F; | ||
3261 | removable = !!(gcw[0] & 0x80); | ||
3262 | packet_size = gcw[0] & 0x3; | ||
3276 | 3263 | ||
3277 | if (gcw.protocol != 2) | 3264 | /* Check that we can support this device */ |
3265 | if (protocol != 2) | ||
3278 | printk(KERN_ERR "ide-tape: Protocol (0x%02x) is not ATAPI\n", | 3266 | printk(KERN_ERR "ide-tape: Protocol (0x%02x) is not ATAPI\n", |
3279 | gcw.protocol); | 3267 | protocol); |
3280 | else if (gcw.device_type != 1) | 3268 | else if (device_type != 1) |
3281 | printk(KERN_ERR "ide-tape: Device type (0x%02x) is not set " | 3269 | printk(KERN_ERR "ide-tape: Device type (0x%02x) is not set " |
3282 | "to tape\n", gcw.device_type); | 3270 | "to tape\n", device_type); |
3283 | else if (!gcw.removable) | 3271 | else if (!removable) |
3284 | printk(KERN_ERR "ide-tape: The removable flag is not set\n"); | 3272 | printk(KERN_ERR "ide-tape: The removable flag is not set\n"); |
3285 | else if (gcw.packet_size != 0) { | 3273 | else if (packet_size != 0) { |
3286 | printk(KERN_ERR "ide-tape: Packet size (0x%02x) is not 12 " | 3274 | printk(KERN_ERR "ide-tape: Packet size (0x%02x) is not 12 " |
3287 | "bytes long\n", gcw.packet_size); | 3275 | "bytes long\n", packet_size); |
3288 | } else | 3276 | } else |
3289 | return 1; | 3277 | return 1; |
3290 | return 0; | 3278 | return 0; |
@@ -3409,8 +3397,8 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
3409 | { | 3397 | { |
3410 | unsigned long t1, tmid, tn, t; | 3398 | unsigned long t1, tmid, tn, t; |
3411 | int speed; | 3399 | int speed; |
3412 | struct idetape_id_gcw gcw; | ||
3413 | int stage_size; | 3400 | int stage_size; |
3401 | u8 gcw[2]; | ||
3414 | struct sysinfo si; | 3402 | struct sysinfo si; |
3415 | u16 *ctl = (u16 *)&tape->caps[12]; | 3403 | u16 *ctl = (u16 *)&tape->caps[12]; |
3416 | 3404 | ||
@@ -3433,7 +3421,9 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
3433 | tape->max_insert_speed = 10000; | 3421 | tape->max_insert_speed = 10000; |
3434 | tape->speed_control = 1; | 3422 | tape->speed_control = 1; |
3435 | *((unsigned short *) &gcw) = drive->id->config; | 3423 | *((unsigned short *) &gcw) = drive->id->config; |
3436 | if (gcw.drq_type == 1) | 3424 | |
3425 | /* Command packet DRQ type */ | ||
3426 | if (((gcw[0] & 0x60) >> 5) == 1) | ||
3437 | set_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags); | 3427 | set_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags); |
3438 | 3428 | ||
3439 | tape->min_pipeline = tape->max_pipeline = tape->max_stages = 10; | 3429 | tape->min_pipeline = tape->max_pipeline = tape->max_stages = 10; |