diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-acpi.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide-atapi.c | 21 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 17 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 94 | ||||
-rw-r--r-- | drivers/ide/ide-dma.c | 7 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 9 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 55 | ||||
-rw-r--r-- | drivers/ide/ide-ioctls.c | 21 | ||||
-rw-r--r-- | drivers/ide/ide-iops.c | 24 | ||||
-rw-r--r-- | drivers/ide/ide-lib.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 104 | ||||
-rw-r--r-- | drivers/ide/ide-proc.c | 6 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 30 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 14 | ||||
-rw-r--r-- | drivers/ide/ide.c | 35 | ||||
-rw-r--r-- | drivers/ide/legacy/ht6560b.c | 9 | ||||
-rw-r--r-- | drivers/ide/pci/amd74xx.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/cmd640.c | 14 | ||||
-rw-r--r-- | drivers/ide/pci/it821x.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/ns87415.c | 11 | ||||
-rw-r--r-- | drivers/ide/pci/pdc202xx_old.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/sc1200.c | 3 | ||||
-rw-r--r-- | drivers/ide/pci/trm290.c | 4 | ||||
-rw-r--r-- | drivers/ide/ppc/pmac.c | 4 | ||||
-rw-r--r-- | drivers/scsi/ide-scsi.c | 9 |
25 files changed, 297 insertions, 216 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 2427c380b3dc..244a8a052ce8 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -290,7 +290,7 @@ static int do_drive_get_GTF(ide_drive_t *drive, | |||
290 | DEBPRINT("ENTER: %s at %s, port#: %d, hard_port#: %d\n", | 290 | DEBPRINT("ENTER: %s at %s, port#: %d, hard_port#: %d\n", |
291 | hwif->name, dev->bus_id, port, hwif->channel); | 291 | hwif->name, dev->bus_id, port, hwif->channel); |
292 | 292 | ||
293 | if (!drive->present) { | 293 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) { |
294 | DEBPRINT("%s drive %d:%d not present\n", | 294 | DEBPRINT("%s drive %d:%d not present\n", |
295 | hwif->name, hwif->channel, port); | 295 | hwif->name, hwif->channel, port); |
296 | goto out; | 296 | goto out; |
@@ -420,8 +420,9 @@ static int do_drive_set_taskfiles(ide_drive_t *drive, | |||
420 | 420 | ||
421 | DEBPRINT("ENTER: %s, hard_port#: %d\n", drive->name, drive->dn); | 421 | DEBPRINT("ENTER: %s, hard_port#: %d\n", drive->name, drive->dn); |
422 | 422 | ||
423 | if (!drive->present) | 423 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) |
424 | goto out; | 424 | goto out; |
425 | |||
425 | if (!gtf_count) /* shouldn't be here */ | 426 | if (!gtf_count) /* shouldn't be here */ |
426 | goto out; | 427 | goto out; |
427 | 428 | ||
@@ -660,7 +661,8 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on) | |||
660 | if (!drive->acpidata->obj_handle) | 661 | if (!drive->acpidata->obj_handle) |
661 | drive->acpidata->obj_handle = ide_acpi_drive_get_handle(drive); | 662 | drive->acpidata->obj_handle = ide_acpi_drive_get_handle(drive); |
662 | 663 | ||
663 | if (drive->acpidata->obj_handle && drive->present) { | 664 | if (drive->acpidata->obj_handle && |
665 | (drive->dev_flags & IDE_DFLAG_PRESENT)) { | ||
664 | acpi_bus_set_power(drive->acpidata->obj_handle, | 666 | acpi_bus_set_power(drive->acpidata->obj_handle, |
665 | on? ACPI_STATE_D0: ACPI_STATE_D3); | 667 | on? ACPI_STATE_D0: ACPI_STATE_D3); |
666 | } | 668 | } |
@@ -720,7 +722,7 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif) | |||
720 | 722 | ||
721 | memset(drive->acpidata, 0, sizeof(*drive->acpidata)); | 723 | memset(drive->acpidata, 0, sizeof(*drive->acpidata)); |
722 | 724 | ||
723 | if (!drive->present) | 725 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) |
724 | continue; | 726 | continue; |
725 | 727 | ||
726 | err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff); | 728 | err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff); |
@@ -745,7 +747,7 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif) | |||
745 | for (i = 0; i < MAX_DRIVES; i++) { | 747 | for (i = 0; i < MAX_DRIVES; i++) { |
746 | drive = &hwif->drives[i]; | 748 | drive = &hwif->drives[i]; |
747 | 749 | ||
748 | if (drive->present) | 750 | if (drive->dev_flags & IDE_DFLAG_PRESENT) |
749 | /* Execute ACPI startup code */ | 751 | /* Execute ACPI startup code */ |
750 | ide_acpi_exec_tfs(drive); | 752 | ide_acpi_exec_tfs(drive); |
751 | } | 753 | } |
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 2521677e1f48..a1d8c3557a42 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -261,7 +261,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
261 | ide_expiry_t *expiry; | 261 | ide_expiry_t *expiry; |
262 | unsigned int timeout, temp; | 262 | unsigned int timeout, temp; |
263 | u16 bcount; | 263 | u16 bcount; |
264 | u8 stat, ireason, scsi = drive->scsi, dsc = 0; | 264 | u8 stat, ireason, scsi = !!(drive->dev_flags & IDE_DFLAG_SCSI), dsc = 0; |
265 | 265 | ||
266 | debug_log("Enter %s - interrupt handler\n", __func__); | 266 | debug_log("Enter %s - interrupt handler\n", __func__); |
267 | 267 | ||
@@ -494,7 +494,8 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
494 | } | 494 | } |
495 | 495 | ||
496 | ireason = ide_read_ireason(drive); | 496 | ireason = ide_read_ireason(drive); |
497 | if (drive->media == ide_tape && !drive->scsi) | 497 | if (drive->media == ide_tape && |
498 | (drive->dev_flags & IDE_DFLAG_SCSI) == 0) | ||
498 | ireason = ide_wait_ireason(drive, ireason); | 499 | ireason = ide_wait_ireason(drive, ireason); |
499 | 500 | ||
500 | if ((ireason & ATAPI_COD) == 0 || (ireason & ATAPI_IO)) { | 501 | if ((ireason & ATAPI_COD) == 0 || (ireason & ATAPI_IO)) { |
@@ -512,7 +513,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
512 | timeout = drive->pc_delay; | 513 | timeout = drive->pc_delay; |
513 | expiry = &ide_delayed_transfer_pc; | 514 | expiry = &ide_delayed_transfer_pc; |
514 | } else { | 515 | } else { |
515 | if (drive->scsi) { | 516 | if (drive->dev_flags & IDE_DFLAG_SCSI) { |
516 | timeout = ide_scsi_get_timeout(pc); | 517 | timeout = ide_scsi_get_timeout(pc); |
517 | expiry = ide_scsi_expiry; | 518 | expiry = ide_scsi_expiry; |
518 | } else { | 519 | } else { |
@@ -544,14 +545,14 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout, | |||
544 | struct ide_atapi_pc *pc = drive->pc; | 545 | struct ide_atapi_pc *pc = drive->pc; |
545 | ide_hwif_t *hwif = drive->hwif; | 546 | ide_hwif_t *hwif = drive->hwif; |
546 | u16 bcount; | 547 | u16 bcount; |
547 | u8 dma = 0; | 548 | u8 dma = 0, scsi = !!(drive->dev_flags & IDE_DFLAG_SCSI); |
548 | 549 | ||
549 | /* We haven't transferred any data yet */ | 550 | /* We haven't transferred any data yet */ |
550 | pc->xferred = 0; | 551 | pc->xferred = 0; |
551 | pc->cur_pos = pc->buf; | 552 | pc->cur_pos = pc->buf; |
552 | 553 | ||
553 | /* Request to transfer the entire buffer at once */ | 554 | /* Request to transfer the entire buffer at once */ |
554 | if (drive->media == ide_tape && !drive->scsi) | 555 | if (drive->media == ide_tape && scsi == 0) |
555 | bcount = pc->req_xfer; | 556 | bcount = pc->req_xfer; |
556 | else | 557 | else |
557 | bcount = min(pc->req_xfer, 63 * 1024); | 558 | bcount = min(pc->req_xfer, 63 * 1024); |
@@ -561,19 +562,19 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout, | |||
561 | ide_dma_off(drive); | 562 | ide_dma_off(drive); |
562 | } | 563 | } |
563 | 564 | ||
564 | if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma) { | 565 | if ((pc->flags & PC_FLAG_DMA_OK) && |
565 | if (drive->scsi) | 566 | (drive->dev_flags & IDE_DFLAG_USING_DMA)) { |
567 | if (scsi) | ||
566 | hwif->sg_mapped = 1; | 568 | hwif->sg_mapped = 1; |
567 | dma = !hwif->dma_ops->dma_setup(drive); | 569 | dma = !hwif->dma_ops->dma_setup(drive); |
568 | if (drive->scsi) | 570 | if (scsi) |
569 | hwif->sg_mapped = 0; | 571 | hwif->sg_mapped = 0; |
570 | } | 572 | } |
571 | 573 | ||
572 | if (!dma) | 574 | if (!dma) |
573 | pc->flags &= ~PC_FLAG_DMA_OK; | 575 | pc->flags &= ~PC_FLAG_DMA_OK; |
574 | 576 | ||
575 | ide_pktcmd_tf_load(drive, drive->scsi ? 0 : IDE_TFLAG_OUT_DEVICE, | 577 | ide_pktcmd_tf_load(drive, scsi ? 0 : IDE_TFLAG_OUT_DEVICE, bcount, dma); |
576 | bcount, dma); | ||
577 | 578 | ||
578 | /* Issue the packet command */ | 579 | /* Issue the packet command */ |
579 | if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { | 580 | if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 8650ad43b324..ea7cd4e0b157 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -741,7 +741,7 @@ static ide_startstop_t cdrom_seek_intr(ide_drive_t *drive) | |||
741 | 741 | ||
742 | if (retry && time_after(jiffies, info->start_seek + IDECD_SEEK_TIMER)) { | 742 | if (retry && time_after(jiffies, info->start_seek + IDECD_SEEK_TIMER)) { |
743 | if (--retry == 0) | 743 | if (--retry == 0) |
744 | drive->dsc_overlap = 0; | 744 | drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; |
745 | } | 745 | } |
746 | return ide_stopped; | 746 | return ide_stopped; |
747 | } | 747 | } |
@@ -1129,7 +1129,7 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) | |||
1129 | } | 1129 | } |
1130 | cd->dma = 0; | 1130 | cd->dma = 0; |
1131 | } else | 1131 | } else |
1132 | cd->dma = drive->using_dma; | 1132 | cd->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); |
1133 | 1133 | ||
1134 | if (write) | 1134 | if (write) |
1135 | cd->devinfo.media_written = 1; | 1135 | cd->devinfo.media_written = 1; |
@@ -1166,7 +1166,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
1166 | else | 1166 | else |
1167 | buf = rq->data; | 1167 | buf = rq->data; |
1168 | 1168 | ||
1169 | info->dma = drive->using_dma; | 1169 | info->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); |
1170 | 1170 | ||
1171 | /* | 1171 | /* |
1172 | * check if dma is safe | 1172 | * check if dma is safe |
@@ -1211,7 +1211,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
1211 | if (rq_data_dir(rq) == READ && | 1211 | if (rq_data_dir(rq) == READ && |
1212 | IDE_LARGE_SEEK(info->last_block, block, | 1212 | IDE_LARGE_SEEK(info->last_block, block, |
1213 | IDECD_SEEK_THRESHOLD) && | 1213 | IDECD_SEEK_THRESHOLD) && |
1214 | drive->dsc_overlap) { | 1214 | (drive->dev_flags & IDE_DFLAG_DSC_OVERLAP)) { |
1215 | xferlen = 0; | 1215 | xferlen = 0; |
1216 | fn = cdrom_start_seek_continuation; | 1216 | fn = cdrom_start_seek_continuation; |
1217 | 1217 | ||
@@ -1804,7 +1804,7 @@ static ide_proc_entry_t idecd_proc[] = { | |||
1804 | { NULL, 0, NULL, NULL } | 1804 | { NULL, 0, NULL, NULL } |
1805 | }; | 1805 | }; |
1806 | 1806 | ||
1807 | ide_devset_rw_field(dsc_overlap, dsc_overlap); | 1807 | ide_devset_rw_flag(dsc_overlap, IDE_DFLAG_DSC_OVERLAP); |
1808 | 1808 | ||
1809 | static const struct ide_proc_devset idecd_settings[] = { | 1809 | static const struct ide_proc_devset idecd_settings[] = { |
1810 | IDE_PROC_DEVSET(dsc_overlap, 0, 1), | 1810 | IDE_PROC_DEVSET(dsc_overlap, 0, 1), |
@@ -1910,7 +1910,10 @@ static int ide_cdrom_setup(ide_drive_t *drive) | |||
1910 | /* set correct block size */ | 1910 | /* set correct block size */ |
1911 | blk_queue_hardsect_size(drive->queue, CD_FRAMESIZE); | 1911 | blk_queue_hardsect_size(drive->queue, CD_FRAMESIZE); |
1912 | 1912 | ||
1913 | drive->dsc_overlap = (drive->next != drive); | 1913 | if (drive->next != drive) |
1914 | drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; | ||
1915 | else | ||
1916 | drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; | ||
1914 | 1917 | ||
1915 | if (ide_cdrom_register(drive, nslots)) { | 1918 | if (ide_cdrom_register(drive, nslots)) { |
1916 | printk(KERN_ERR "%s: %s failed to register device with the" | 1919 | printk(KERN_ERR "%s: %s failed to register device with the" |
@@ -1944,7 +1947,7 @@ static void ide_cd_release(struct kref *kref) | |||
1944 | kfree(info->toc); | 1947 | kfree(info->toc); |
1945 | if (devinfo->handle == drive) | 1948 | if (devinfo->handle == drive) |
1946 | unregister_cdrom(devinfo); | 1949 | unregister_cdrom(devinfo); |
1947 | drive->dsc_overlap = 0; | 1950 | drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; |
1948 | drive->driver_data = NULL; | 1951 | drive->driver_data = NULL; |
1949 | blk_queue_prep_rq(drive->queue, NULL); | 1952 | blk_queue_prep_rq(drive->queue, NULL); |
1950 | g->private_data = NULL; | 1953 | g->private_data = NULL; |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 7ea075299bd9..7ee2c9d2e5c2 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -140,9 +140,9 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
140 | sector_t block) | 140 | sector_t block) |
141 | { | 141 | { |
142 | ide_hwif_t *hwif = HWIF(drive); | 142 | ide_hwif_t *hwif = HWIF(drive); |
143 | unsigned int dma = drive->using_dma; | ||
144 | u16 nsectors = (u16)rq->nr_sectors; | 143 | u16 nsectors = (u16)rq->nr_sectors; |
145 | u8 lba48 = (drive->addressing == 1) ? 1 : 0; | 144 | u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); |
145 | u8 dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); | ||
146 | ide_task_t task; | 146 | ide_task_t task; |
147 | struct ide_taskfile *tf = &task.tf; | 147 | struct ide_taskfile *tf = &task.tf; |
148 | ide_startstop_t rc; | 148 | ide_startstop_t rc; |
@@ -237,7 +237,7 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
237 | { | 237 | { |
238 | ide_hwif_t *hwif = HWIF(drive); | 238 | ide_hwif_t *hwif = HWIF(drive); |
239 | 239 | ||
240 | BUG_ON(drive->blocked); | 240 | BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED); |
241 | 241 | ||
242 | if (!blk_fs_request(rq)) { | 242 | if (!blk_fs_request(rq)) { |
243 | blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command"); | 243 | blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command"); |
@@ -452,7 +452,7 @@ static int proc_idedisk_read_cache | |||
452 | char *out = page; | 452 | char *out = page; |
453 | int len; | 453 | int len; |
454 | 454 | ||
455 | if (drive->id_read) | 455 | if (drive->dev_flags & IDE_DFLAG_ID_READ) |
456 | len = sprintf(out, "%i\n", drive->id[ATA_ID_BUF_SIZE] / 2); | 456 | len = sprintf(out, "%i\n", drive->id[ATA_ID_BUF_SIZE] / 2); |
457 | else | 457 | else |
458 | len = sprintf(out, "(none)\n"); | 458 | len = sprintf(out, "(none)\n"); |
@@ -568,15 +568,20 @@ static int set_multcount(ide_drive_t *drive, int arg) | |||
568 | return (drive->mult_count == arg) ? 0 : -EIO; | 568 | return (drive->mult_count == arg) ? 0 : -EIO; |
569 | } | 569 | } |
570 | 570 | ||
571 | ide_devset_get(nowerr, nowerr); | 571 | ide_devset_get_flag(nowerr, IDE_DFLAG_NOWERR); |
572 | 572 | ||
573 | static int set_nowerr(ide_drive_t *drive, int arg) | 573 | static int set_nowerr(ide_drive_t *drive, int arg) |
574 | { | 574 | { |
575 | if (arg < 0 || arg > 1) | 575 | if (arg < 0 || arg > 1) |
576 | return -EINVAL; | 576 | return -EINVAL; |
577 | 577 | ||
578 | drive->nowerr = arg; | 578 | if (arg) |
579 | drive->dev_flags |= IDE_DFLAG_NOWERR; | ||
580 | else | ||
581 | drive->dev_flags &= ~IDE_DFLAG_NOWERR; | ||
582 | |||
579 | drive->bad_wstat = arg ? BAD_R_STAT : BAD_W_STAT; | 583 | drive->bad_wstat = arg ? BAD_R_STAT : BAD_W_STAT; |
584 | |||
580 | return 0; | 585 | return 0; |
581 | } | 586 | } |
582 | 587 | ||
@@ -599,7 +604,7 @@ static void update_ordered(ide_drive_t *drive) | |||
599 | unsigned ordered = QUEUE_ORDERED_NONE; | 604 | unsigned ordered = QUEUE_ORDERED_NONE; |
600 | prepare_flush_fn *prep_fn = NULL; | 605 | prepare_flush_fn *prep_fn = NULL; |
601 | 606 | ||
602 | if (drive->wcache) { | 607 | if (drive->dev_flags & IDE_DFLAG_WCACHE) { |
603 | unsigned long long capacity; | 608 | unsigned long long capacity; |
604 | int barrier; | 609 | int barrier; |
605 | /* | 610 | /* |
@@ -611,8 +616,10 @@ static void update_ordered(ide_drive_t *drive) | |||
611 | * not available so we don't need to recheck that. | 616 | * not available so we don't need to recheck that. |
612 | */ | 617 | */ |
613 | capacity = idedisk_capacity(drive); | 618 | capacity = idedisk_capacity(drive); |
614 | barrier = ata_id_flush_enabled(id) && !drive->noflush && | 619 | barrier = ata_id_flush_enabled(id) && |
615 | (drive->addressing == 0 || capacity <= (1ULL << 28) || | 620 | (drive->dev_flags & IDE_DFLAG_NOFLUSH) == 0 && |
621 | ((drive->dev_flags & IDE_DFLAG_LBA48) == 0 || | ||
622 | capacity <= (1ULL << 28) || | ||
616 | ata_id_flush_ext_enabled(id)); | 623 | ata_id_flush_ext_enabled(id)); |
617 | 624 | ||
618 | printk(KERN_INFO "%s: cache flushes %ssupported\n", | 625 | printk(KERN_INFO "%s: cache flushes %ssupported\n", |
@@ -628,7 +635,7 @@ static void update_ordered(ide_drive_t *drive) | |||
628 | blk_queue_ordered(drive->queue, ordered, prep_fn); | 635 | blk_queue_ordered(drive->queue, ordered, prep_fn); |
629 | } | 636 | } |
630 | 637 | ||
631 | ide_devset_get(wcache, wcache); | 638 | ide_devset_get_flag(wcache, IDE_DFLAG_WCACHE); |
632 | 639 | ||
633 | static int set_wcache(ide_drive_t *drive, int arg) | 640 | static int set_wcache(ide_drive_t *drive, int arg) |
634 | { | 641 | { |
@@ -640,8 +647,12 @@ static int set_wcache(ide_drive_t *drive, int arg) | |||
640 | if (ata_id_flush_enabled(drive->id)) { | 647 | if (ata_id_flush_enabled(drive->id)) { |
641 | err = ide_do_setfeature(drive, | 648 | err = ide_do_setfeature(drive, |
642 | arg ? SETFEATURES_WC_ON : SETFEATURES_WC_OFF, 0); | 649 | arg ? SETFEATURES_WC_ON : SETFEATURES_WC_OFF, 0); |
643 | if (err == 0) | 650 | if (err == 0) { |
644 | drive->wcache = arg; | 651 | if (arg) |
652 | drive->dev_flags |= IDE_DFLAG_WCACHE; | ||
653 | else | ||
654 | drive->dev_flags &= ~IDE_DFLAG_WCACHE; | ||
655 | } | ||
645 | } | 656 | } |
646 | 657 | ||
647 | update_ordered(drive); | 658 | update_ordered(drive); |
@@ -677,7 +688,7 @@ static int set_acoustic(ide_drive_t *drive, int arg) | |||
677 | return 0; | 688 | return 0; |
678 | } | 689 | } |
679 | 690 | ||
680 | ide_devset_get(addressing, addressing); | 691 | ide_devset_get_flag(addressing, IDE_DFLAG_LBA48); |
681 | 692 | ||
682 | /* | 693 | /* |
683 | * drive->addressing: | 694 | * drive->addressing: |
@@ -697,7 +708,10 @@ static int set_addressing(ide_drive_t *drive, int arg) | |||
697 | if (arg == 2) | 708 | if (arg == 2) |
698 | arg = 0; | 709 | arg = 0; |
699 | 710 | ||
700 | drive->addressing = arg; | 711 | if (arg) |
712 | drive->dev_flags |= IDE_DFLAG_LBA48; | ||
713 | else | ||
714 | drive->dev_flags &= ~IDE_DFLAG_LBA48; | ||
701 | 715 | ||
702 | return 0; | 716 | return 0; |
703 | } | 717 | } |
@@ -743,20 +757,20 @@ static void idedisk_setup(ide_drive_t *drive) | |||
743 | 757 | ||
744 | ide_proc_register_driver(drive, idkp->driver); | 758 | ide_proc_register_driver(drive, idkp->driver); |
745 | 759 | ||
746 | if (drive->id_read == 0) | 760 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) |
747 | return; | 761 | return; |
748 | 762 | ||
749 | if (drive->removable) { | 763 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) { |
750 | /* | 764 | /* |
751 | * Removable disks (eg. SYQUEST); ignore 'WD' drives | 765 | * Removable disks (eg. SYQUEST); ignore 'WD' drives |
752 | */ | 766 | */ |
753 | if (m[0] != 'W' || m[1] != 'D') | 767 | if (m[0] != 'W' || m[1] != 'D') |
754 | drive->doorlocking = 1; | 768 | drive->dev_flags |= IDE_DFLAG_DOORLOCKING; |
755 | } | 769 | } |
756 | 770 | ||
757 | (void)set_addressing(drive, 1); | 771 | (void)set_addressing(drive, 1); |
758 | 772 | ||
759 | if (drive->addressing == 1) { | 773 | if (drive->dev_flags & IDE_DFLAG_LBA48) { |
760 | int max_s = 2048; | 774 | int max_s = 2048; |
761 | 775 | ||
762 | if (max_s > hwif->rqsize) | 776 | if (max_s > hwif->rqsize) |
@@ -772,7 +786,8 @@ static void idedisk_setup(ide_drive_t *drive) | |||
772 | init_idedisk_capacity(drive); | 786 | init_idedisk_capacity(drive); |
773 | 787 | ||
774 | /* limit drive capacity to 137GB if LBA48 cannot be used */ | 788 | /* limit drive capacity to 137GB if LBA48 cannot be used */ |
775 | if (drive->addressing == 0 && drive->capacity64 > 1ULL << 28) { | 789 | if ((drive->dev_flags & IDE_DFLAG_LBA48) == 0 && |
790 | drive->capacity64 > 1ULL << 28) { | ||
776 | printk(KERN_WARNING "%s: cannot use LBA48 - full capacity " | 791 | printk(KERN_WARNING "%s: cannot use LBA48 - full capacity " |
777 | "%llu sectors (%llu MB)\n", | 792 | "%llu sectors (%llu MB)\n", |
778 | drive->name, (unsigned long long)drive->capacity64, | 793 | drive->name, (unsigned long long)drive->capacity64, |
@@ -780,13 +795,14 @@ static void idedisk_setup(ide_drive_t *drive) | |||
780 | drive->capacity64 = 1ULL << 28; | 795 | drive->capacity64 = 1ULL << 28; |
781 | } | 796 | } |
782 | 797 | ||
783 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && drive->addressing) { | 798 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && |
799 | (drive->dev_flags & IDE_DFLAG_LBA48)) { | ||
784 | if (drive->capacity64 > 1ULL << 28) { | 800 | if (drive->capacity64 > 1ULL << 28) { |
785 | printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode" | 801 | printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode" |
786 | " will be used for accessing sectors " | 802 | " will be used for accessing sectors " |
787 | "> %u\n", drive->name, 1 << 28); | 803 | "> %u\n", drive->name, 1 << 28); |
788 | } else | 804 | } else |
789 | drive->addressing = 0; | 805 | drive->dev_flags &= ~IDE_DFLAG_LBA48; |
790 | } | 806 | } |
791 | 807 | ||
792 | /* | 808 | /* |
@@ -795,7 +811,7 @@ static void idedisk_setup(ide_drive_t *drive) | |||
795 | */ | 811 | */ |
796 | capacity = idedisk_capacity(drive); | 812 | capacity = idedisk_capacity(drive); |
797 | 813 | ||
798 | if (!drive->forced_geom) { | 814 | if ((drive->dev_flags & IDE_DFLAG_FORCED_GEOM) == 0) { |
799 | if (ata_id_lba48_enabled(drive->id)) { | 815 | if (ata_id_lba48_enabled(drive->id)) { |
800 | /* compatibility */ | 816 | /* compatibility */ |
801 | drive->bios_sect = 63; | 817 | drive->bios_sect = 63; |
@@ -830,14 +846,15 @@ static void idedisk_setup(ide_drive_t *drive) | |||
830 | 846 | ||
831 | /* write cache enabled? */ | 847 | /* write cache enabled? */ |
832 | if ((id[ATA_ID_CSFO] & 1) || ata_id_wcache_enabled(id)) | 848 | if ((id[ATA_ID_CSFO] & 1) || ata_id_wcache_enabled(id)) |
833 | drive->wcache = 1; | 849 | drive->dev_flags |= IDE_DFLAG_WCACHE; |
834 | 850 | ||
835 | set_wcache(drive, 1); | 851 | set_wcache(drive, 1); |
836 | } | 852 | } |
837 | 853 | ||
838 | static void ide_cacheflush_p(ide_drive_t *drive) | 854 | static void ide_cacheflush_p(ide_drive_t *drive) |
839 | { | 855 | { |
840 | if (!drive->wcache || ata_id_flush_enabled(drive->id) == 0) | 856 | if (ata_id_flush_enabled(drive->id) == 0 || |
857 | (drive->dev_flags & IDE_DFLAG_WCACHE) == 0) | ||
841 | return; | 858 | return; |
842 | 859 | ||
843 | if (do_idedisk_flushcache(drive)) | 860 | if (do_idedisk_flushcache(drive)) |
@@ -956,15 +973,16 @@ static int idedisk_open(struct inode *inode, struct file *filp) | |||
956 | 973 | ||
957 | idkp->openers++; | 974 | idkp->openers++; |
958 | 975 | ||
959 | if (drive->removable && idkp->openers == 1) { | 976 | if ((drive->dev_flags & IDE_DFLAG_REMOVABLE) && idkp->openers == 1) { |
960 | check_disk_change(inode->i_bdev); | 977 | check_disk_change(inode->i_bdev); |
961 | /* | 978 | /* |
962 | * Ignore the return code from door_lock, | 979 | * Ignore the return code from door_lock, |
963 | * since the open() has already succeeded, | 980 | * since the open() has already succeeded, |
964 | * and the door_lock is irrelevant at this point. | 981 | * and the door_lock is irrelevant at this point. |
965 | */ | 982 | */ |
966 | if (drive->doorlocking && idedisk_set_doorlock(drive, 1)) | 983 | if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) && |
967 | drive->doorlocking = 0; | 984 | idedisk_set_doorlock(drive, 1)) |
985 | drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; | ||
968 | } | 986 | } |
969 | return 0; | 987 | return 0; |
970 | } | 988 | } |
@@ -978,9 +996,10 @@ static int idedisk_release(struct inode *inode, struct file *filp) | |||
978 | if (idkp->openers == 1) | 996 | if (idkp->openers == 1) |
979 | ide_cacheflush_p(drive); | 997 | ide_cacheflush_p(drive); |
980 | 998 | ||
981 | if (drive->removable && idkp->openers == 1) { | 999 | if ((drive->dev_flags & IDE_DFLAG_REMOVABLE) && idkp->openers == 1) { |
982 | if (drive->doorlocking && idedisk_set_doorlock(drive, 0)) | 1000 | if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) && |
983 | drive->doorlocking = 0; | 1001 | idedisk_set_doorlock(drive, 0)) |
1002 | drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; | ||
984 | } | 1003 | } |
985 | 1004 | ||
986 | idkp->openers--; | 1005 | idkp->openers--; |
@@ -1031,12 +1050,13 @@ static int idedisk_media_changed(struct gendisk *disk) | |||
1031 | ide_drive_t *drive = idkp->drive; | 1050 | ide_drive_t *drive = idkp->drive; |
1032 | 1051 | ||
1033 | /* do not scan partitions twice if this is a removable device */ | 1052 | /* do not scan partitions twice if this is a removable device */ |
1034 | if (drive->attach) { | 1053 | if (drive->dev_flags & IDE_DFLAG_ATTACH) { |
1035 | drive->attach = 0; | 1054 | drive->dev_flags &= ~IDE_DFLAG_ATTACH; |
1036 | return 0; | 1055 | return 0; |
1037 | } | 1056 | } |
1057 | |||
1038 | /* if removable, always assume it was changed */ | 1058 | /* if removable, always assume it was changed */ |
1039 | return drive->removable; | 1059 | return !!(drive->dev_flags & IDE_DFLAG_REMOVABLE); |
1040 | } | 1060 | } |
1041 | 1061 | ||
1042 | static int idedisk_revalidate_disk(struct gendisk *disk) | 1062 | static int idedisk_revalidate_disk(struct gendisk *disk) |
@@ -1094,15 +1114,15 @@ static int ide_disk_probe(ide_drive_t *drive) | |||
1094 | if ((!drive->head || drive->head > 16) && !drive->select.b.lba) { | 1114 | if ((!drive->head || drive->head > 16) && !drive->select.b.lba) { |
1095 | printk(KERN_ERR "%s: INVALID GEOMETRY: %d PHYSICAL HEADS?\n", | 1115 | printk(KERN_ERR "%s: INVALID GEOMETRY: %d PHYSICAL HEADS?\n", |
1096 | drive->name, drive->head); | 1116 | drive->name, drive->head); |
1097 | drive->attach = 0; | 1117 | drive->dev_flags &= ~IDE_DFLAG_ATTACH; |
1098 | } else | 1118 | } else |
1099 | drive->attach = 1; | 1119 | drive->dev_flags |= IDE_DFLAG_ATTACH; |
1100 | 1120 | ||
1101 | g->minors = IDE_DISK_MINORS; | 1121 | g->minors = IDE_DISK_MINORS; |
1102 | g->driverfs_dev = &drive->gendev; | 1122 | g->driverfs_dev = &drive->gendev; |
1103 | g->flags |= GENHD_FL_EXT_DEVT; | 1123 | g->flags |= GENHD_FL_EXT_DEVT; |
1104 | if (drive->removable) | 1124 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) |
1105 | g->flags |= GENHD_FL_REMOVABLE; | 1125 | g->flags = GENHD_FL_REMOVABLE; |
1106 | set_capacity(g, idedisk_capacity(drive)); | 1126 | set_capacity(g, idedisk_capacity(drive)); |
1107 | g->fops = &idedisk_ops; | 1127 | g->fops = &idedisk_ops; |
1108 | add_disk(g); | 1128 | add_disk(g); |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index ef2f1504c0d5..2dacd802c72c 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -397,7 +397,7 @@ EXPORT_SYMBOL_GPL(ide_dma_host_set); | |||
397 | 397 | ||
398 | void ide_dma_off_quietly(ide_drive_t *drive) | 398 | void ide_dma_off_quietly(ide_drive_t *drive) |
399 | { | 399 | { |
400 | drive->using_dma = 0; | 400 | drive->dev_flags &= ~IDE_DFLAG_USING_DMA; |
401 | ide_toggle_bounce(drive, 0); | 401 | ide_toggle_bounce(drive, 0); |
402 | 402 | ||
403 | drive->hwif->dma_ops->dma_host_set(drive, 0); | 403 | drive->hwif->dma_ops->dma_host_set(drive, 0); |
@@ -430,7 +430,7 @@ EXPORT_SYMBOL(ide_dma_off); | |||
430 | 430 | ||
431 | void ide_dma_on(ide_drive_t *drive) | 431 | void ide_dma_on(ide_drive_t *drive) |
432 | { | 432 | { |
433 | drive->using_dma = 1; | 433 | drive->dev_flags |= IDE_DFLAG_USING_DMA; |
434 | ide_toggle_bounce(drive, 1); | 434 | ide_toggle_bounce(drive, 1); |
435 | 435 | ||
436 | drive->hwif->dma_ops->dma_host_set(drive, 1); | 436 | drive->hwif->dma_ops->dma_host_set(drive, 1); |
@@ -727,7 +727,8 @@ static int ide_tune_dma(ide_drive_t *drive) | |||
727 | ide_hwif_t *hwif = drive->hwif; | 727 | ide_hwif_t *hwif = drive->hwif; |
728 | u8 speed; | 728 | u8 speed; |
729 | 729 | ||
730 | if (drive->nodma || ata_id_has_dma(drive->id) == 0) | 730 | if (ata_id_has_dma(drive->id) == 0 || |
731 | (drive->dev_flags & IDE_DFLAG_NODMA)) | ||
731 | return 0; | 732 | return 0; |
732 | 733 | ||
733 | /* consult the list of known "bad" drives */ | 734 | /* consult the list of known "bad" drives */ |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index a11ec86925a3..cdfadb01d07f 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -828,8 +828,8 @@ static int idefloppy_media_changed(struct gendisk *disk) | |||
828 | int ret; | 828 | int ret; |
829 | 829 | ||
830 | /* do not scan partitions twice if this is a removable device */ | 830 | /* do not scan partitions twice if this is a removable device */ |
831 | if (drive->attach) { | 831 | if (drive->dev_flags & IDE_DFLAG_ATTACH) { |
832 | drive->attach = 0; | 832 | drive->dev_flags &= ~IDE_DFLAG_ATTACH; |
833 | return 0; | 833 | return 0; |
834 | } | 834 | } |
835 | ret = !!(drive->atapi_flags & IDE_AFLAG_MEDIA_CHANGED); | 835 | ret = !!(drive->atapi_flags & IDE_AFLAG_MEDIA_CHANGED); |
@@ -896,12 +896,13 @@ static int ide_floppy_probe(ide_drive_t *drive) | |||
896 | drive->debug_mask = debug_mask; | 896 | drive->debug_mask = debug_mask; |
897 | 897 | ||
898 | idefloppy_setup(drive, floppy); | 898 | idefloppy_setup(drive, floppy); |
899 | drive->dev_flags |= IDE_DFLAG_ATTACH; | ||
899 | 900 | ||
900 | g->minors = 1 << PARTN_BITS; | 901 | g->minors = 1 << PARTN_BITS; |
901 | g->driverfs_dev = &drive->gendev; | 902 | g->driverfs_dev = &drive->gendev; |
902 | g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0; | 903 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) |
904 | g->flags = GENHD_FL_REMOVABLE; | ||
903 | g->fops = &idefloppy_ops; | 905 | g->fops = &idefloppy_ops; |
904 | drive->attach = 1; | ||
905 | add_disk(g); | 906 | add_disk(g); |
906 | return 0; | 907 | return 0; |
907 | 908 | ||
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 1c51949833be..5f0ed59bac6b 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -184,7 +184,8 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * | |||
184 | if (drive->media != ide_disk) | 184 | if (drive->media != ide_disk) |
185 | break; | 185 | break; |
186 | /* Not supported? Switch to next step now. */ | 186 | /* Not supported? Switch to next step now. */ |
187 | if (!drive->wcache || ata_id_flush_enabled(drive->id) == 0) { | 187 | if (ata_id_flush_enabled(drive->id) == 0 || |
188 | (drive->dev_flags & IDE_DFLAG_WCACHE) == 0) { | ||
188 | ide_complete_power_step(drive, rq, 0, 0); | 189 | ide_complete_power_step(drive, rq, 0, 0); |
189 | return ide_stopped; | 190 | return ide_stopped; |
190 | } | 191 | } |
@@ -222,7 +223,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * | |||
222 | if (drive->hwif->dma_ops == NULL) | 223 | if (drive->hwif->dma_ops == NULL) |
223 | break; | 224 | break; |
224 | /* | 225 | /* |
225 | * TODO: respect ->using_dma setting | 226 | * TODO: respect IDE_DFLAG_USING_DMA |
226 | */ | 227 | */ |
227 | ide_set_dma(drive); | 228 | ide_set_dma(drive); |
228 | break; | 229 | break; |
@@ -287,7 +288,7 @@ static void ide_complete_pm_request (ide_drive_t *drive, struct request *rq) | |||
287 | if (blk_pm_suspend_request(rq)) { | 288 | if (blk_pm_suspend_request(rq)) { |
288 | blk_stop_queue(drive->queue); | 289 | blk_stop_queue(drive->queue); |
289 | } else { | 290 | } else { |
290 | drive->blocked = 0; | 291 | drive->dev_flags &= ~IDE_DFLAG_BLOCKED; |
291 | blk_start_queue(drive->queue); | 292 | blk_start_queue(drive->queue); |
292 | } | 293 | } |
293 | HWGROUP(drive)->rq = NULL; | 294 | HWGROUP(drive)->rq = NULL; |
@@ -374,7 +375,8 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
374 | { | 375 | { |
375 | ide_hwif_t *hwif = drive->hwif; | 376 | ide_hwif_t *hwif = drive->hwif; |
376 | 377 | ||
377 | if ((stat & ATA_BUSY) || ((stat & ATA_DF) && !drive->nowerr)) { | 378 | if ((stat & ATA_BUSY) || |
379 | ((stat & ATA_DF) && (drive->dev_flags & IDE_DFLAG_NOWERR) == 0)) { | ||
378 | /* other bits are useless when BUSY */ | 380 | /* other bits are useless when BUSY */ |
379 | rq->errors |= ERROR_RESET; | 381 | rq->errors |= ERROR_RESET; |
380 | } else if (stat & ATA_ERR) { | 382 | } else if (stat & ATA_ERR) { |
@@ -428,7 +430,8 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u | |||
428 | { | 430 | { |
429 | ide_hwif_t *hwif = drive->hwif; | 431 | ide_hwif_t *hwif = drive->hwif; |
430 | 432 | ||
431 | if ((stat & ATA_BUSY) || ((stat & ATA_DF) && !drive->nowerr)) { | 433 | if ((stat & ATA_BUSY) || |
434 | ((stat & ATA_DF) && (drive->dev_flags & IDE_DFLAG_NOWERR) == 0)) { | ||
432 | /* other bits are useless when BUSY */ | 435 | /* other bits are useless when BUSY */ |
433 | rq->errors |= ERROR_RESET; | 436 | rq->errors |= ERROR_RESET; |
434 | } else { | 437 | } else { |
@@ -607,7 +610,7 @@ static ide_startstop_t do_special (ide_drive_t *drive) | |||
607 | 610 | ||
608 | if (set_pio_mode_abuse(drive->hwif, req_pio)) { | 611 | if (set_pio_mode_abuse(drive->hwif, req_pio)) { |
609 | /* | 612 | /* |
610 | * take ide_lock for drive->[no_]unmask/[no_]io_32bit | 613 | * take ide_lock for IDE_DFLAG_[NO_]UNMASK/[NO_]IO_32BIT |
611 | */ | 614 | */ |
612 | if (req_pio == 8 || req_pio == 9) { | 615 | if (req_pio == 8 || req_pio == 9) { |
613 | unsigned long flags; | 616 | unsigned long flags; |
@@ -618,7 +621,8 @@ static ide_startstop_t do_special (ide_drive_t *drive) | |||
618 | } else | 621 | } else |
619 | port_ops->set_pio_mode(drive, req_pio); | 622 | port_ops->set_pio_mode(drive, req_pio); |
620 | } else { | 623 | } else { |
621 | int keep_dma = drive->using_dma; | 624 | int keep_dma = |
625 | !!(drive->dev_flags & IDE_DFLAG_USING_DMA); | ||
622 | 626 | ||
623 | ide_set_pio(drive, req_pio); | 627 | ide_set_pio(drive, req_pio); |
624 | 628 | ||
@@ -775,7 +779,7 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
775 | if (blk_pm_suspend_request(rq) && | 779 | if (blk_pm_suspend_request(rq) && |
776 | pm->pm_step == ide_pm_state_start_suspend) | 780 | pm->pm_step == ide_pm_state_start_suspend) |
777 | /* Mark drive blocked when starting the suspend sequence. */ | 781 | /* Mark drive blocked when starting the suspend sequence. */ |
778 | drive->blocked = 1; | 782 | drive->dev_flags |= IDE_DFLAG_BLOCKED; |
779 | else if (blk_pm_resume_request(rq) && | 783 | else if (blk_pm_resume_request(rq) && |
780 | pm->pm_step == ide_pm_state_start_resume) { | 784 | pm->pm_step == ide_pm_state_start_resume) { |
781 | /* | 785 | /* |
@@ -895,7 +899,7 @@ void ide_stall_queue (ide_drive_t *drive, unsigned long timeout) | |||
895 | if (timeout > WAIT_WORSTCASE) | 899 | if (timeout > WAIT_WORSTCASE) |
896 | timeout = WAIT_WORSTCASE; | 900 | timeout = WAIT_WORSTCASE; |
897 | drive->sleep = timeout + jiffies; | 901 | drive->sleep = timeout + jiffies; |
898 | drive->sleeping = 1; | 902 | drive->dev_flags |= IDE_DFLAG_SLEEPING; |
899 | } | 903 | } |
900 | 904 | ||
901 | EXPORT_SYMBOL(ide_stall_queue); | 905 | EXPORT_SYMBOL(ide_stall_queue); |
@@ -935,18 +939,23 @@ repeat: | |||
935 | } | 939 | } |
936 | 940 | ||
937 | do { | 941 | do { |
938 | if ((!drive->sleeping || time_after_eq(jiffies, drive->sleep)) | 942 | u8 dev_s = !!(drive->dev_flags & IDE_DFLAG_SLEEPING); |
939 | && !elv_queue_empty(drive->queue)) { | 943 | u8 best_s = (best && !!(best->dev_flags & IDE_DFLAG_SLEEPING)); |
940 | if (!best | 944 | |
941 | || (drive->sleeping && (!best->sleeping || time_before(drive->sleep, best->sleep))) | 945 | if ((dev_s == 0 || time_after_eq(jiffies, drive->sleep)) && |
942 | || (!best->sleeping && time_before(WAKEUP(drive), WAKEUP(best)))) | 946 | !elv_queue_empty(drive->queue)) { |
943 | { | 947 | if (best == NULL || |
948 | (dev_s && (best_s == 0 || time_before(drive->sleep, best->sleep))) || | ||
949 | (best_s == 0 && time_before(WAKEUP(drive), WAKEUP(best)))) { | ||
944 | if (!blk_queue_plugged(drive->queue)) | 950 | if (!blk_queue_plugged(drive->queue)) |
945 | best = drive; | 951 | best = drive; |
946 | } | 952 | } |
947 | } | 953 | } |
948 | } while ((drive = drive->next) != hwgroup->drive); | 954 | } while ((drive = drive->next) != hwgroup->drive); |
949 | if (best && best->nice1 && !best->sleeping && best != hwgroup->drive && best->service_time > WAIT_MIN_SLEEP) { | 955 | |
956 | if (best && (best->dev_flags & IDE_DFLAG_NICE1) && | ||
957 | (best->dev_flags & IDE_DFLAG_SLEEPING) == 0 && | ||
958 | best != hwgroup->drive && best->service_time > WAIT_MIN_SLEEP) { | ||
950 | long t = (signed long)(WAKEUP(best) - jiffies); | 959 | long t = (signed long)(WAKEUP(best) - jiffies); |
951 | if (t >= WAIT_MIN_SLEEP) { | 960 | if (t >= WAIT_MIN_SLEEP) { |
952 | /* | 961 | /* |
@@ -955,7 +964,7 @@ repeat: | |||
955 | */ | 964 | */ |
956 | drive = best->next; | 965 | drive = best->next; |
957 | do { | 966 | do { |
958 | if (!drive->sleeping | 967 | if ((drive->dev_flags & IDE_DFLAG_SLEEPING) == 0 |
959 | && time_before(jiffies - best->service_time, WAKEUP(drive)) | 968 | && time_before(jiffies - best->service_time, WAKEUP(drive)) |
960 | && time_before(WAKEUP(drive), jiffies + t)) | 969 | && time_before(WAKEUP(drive), jiffies + t)) |
961 | { | 970 | { |
@@ -1026,7 +1035,9 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) | |||
1026 | hwgroup->rq = NULL; | 1035 | hwgroup->rq = NULL; |
1027 | drive = hwgroup->drive; | 1036 | drive = hwgroup->drive; |
1028 | do { | 1037 | do { |
1029 | if (drive->sleeping && (!sleeping || time_before(drive->sleep, sleep))) { | 1038 | if ((drive->dev_flags & IDE_DFLAG_SLEEPING) && |
1039 | (sleeping == 0 || | ||
1040 | time_before(drive->sleep, sleep))) { | ||
1030 | sleeping = 1; | 1041 | sleeping = 1; |
1031 | sleep = drive->sleep; | 1042 | sleep = drive->sleep; |
1032 | } | 1043 | } |
@@ -1075,7 +1086,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) | |||
1075 | } | 1086 | } |
1076 | hwgroup->hwif = hwif; | 1087 | hwgroup->hwif = hwif; |
1077 | hwgroup->drive = drive; | 1088 | hwgroup->drive = drive; |
1078 | drive->sleeping = 0; | 1089 | drive->dev_flags &= ~IDE_DFLAG_SLEEPING; |
1079 | drive->service_start = jiffies; | 1090 | drive->service_start = jiffies; |
1080 | 1091 | ||
1081 | if (blk_queue_plugged(drive->queue)) { | 1092 | if (blk_queue_plugged(drive->queue)) { |
@@ -1109,7 +1120,9 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) | |||
1109 | * We count how many times we loop here to make sure we service | 1120 | * We count how many times we loop here to make sure we service |
1110 | * all drives in the hwgroup without looping for ever | 1121 | * all drives in the hwgroup without looping for ever |
1111 | */ | 1122 | */ |
1112 | if (drive->blocked && !blk_pm_request(rq) && !(rq->cmd_flags & REQ_PREEMPT)) { | 1123 | if ((drive->dev_flags & IDE_DFLAG_BLOCKED) && |
1124 | blk_pm_request(rq) == 0 && | ||
1125 | (rq->cmd_flags & REQ_PREEMPT) == 0) { | ||
1113 | drive = drive->next ? drive->next : hwgroup->drive; | 1126 | drive = drive->next ? drive->next : hwgroup->drive; |
1114 | if (loops++ < 4 && !blk_queue_plugged(drive->queue)) | 1127 | if (loops++ < 4 && !blk_queue_plugged(drive->queue)) |
1115 | goto again; | 1128 | goto again; |
@@ -1491,7 +1504,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) | |||
1491 | */ | 1504 | */ |
1492 | hwif->ide_dma_clear_irq(drive); | 1505 | hwif->ide_dma_clear_irq(drive); |
1493 | 1506 | ||
1494 | if (drive->unmask) | 1507 | if (drive->dev_flags & IDE_DFLAG_UNMASK) |
1495 | local_irq_enable_in_hardirq(); | 1508 | local_irq_enable_in_hardirq(); |
1496 | /* service this interrupt, may set handler for next interrupt */ | 1509 | /* service this interrupt, may set handler for next interrupt */ |
1497 | startstop = handler(drive); | 1510 | startstop = handler(drive); |
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index cf01564901af..a90945f49792 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
@@ -62,7 +62,7 @@ static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd, | |||
62 | int size = (cmd == HDIO_GET_IDENTITY) ? (ATA_ID_WORDS * 2) : 142; | 62 | int size = (cmd == HDIO_GET_IDENTITY) ? (ATA_ID_WORDS * 2) : 142; |
63 | int rc = 0; | 63 | int rc = 0; |
64 | 64 | ||
65 | if (drive->id_read == 0) { | 65 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { |
66 | rc = -ENOMSG; | 66 | rc = -ENOMSG; |
67 | goto out; | 67 | goto out; |
68 | } | 68 | } |
@@ -86,8 +86,10 @@ out: | |||
86 | 86 | ||
87 | static int ide_get_nice_ioctl(ide_drive_t *drive, unsigned long arg) | 87 | static int ide_get_nice_ioctl(ide_drive_t *drive, unsigned long arg) |
88 | { | 88 | { |
89 | return put_user((drive->dsc_overlap << IDE_NICE_DSC_OVERLAP) | | 89 | return put_user((!!(drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) |
90 | (drive->nice1 << IDE_NICE_1), (long __user *)arg); | 90 | << IDE_NICE_DSC_OVERLAP) | |
91 | (!!(drive->dev_flags & IDE_DFLAG_NICE1) | ||
92 | << IDE_NICE_1), (long __user *)arg); | ||
91 | } | 93 | } |
92 | 94 | ||
93 | static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg) | 95 | static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg) |
@@ -97,11 +99,18 @@ static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg) | |||
97 | 99 | ||
98 | if (((arg >> IDE_NICE_DSC_OVERLAP) & 1) && | 100 | if (((arg >> IDE_NICE_DSC_OVERLAP) & 1) && |
99 | (drive->media == ide_disk || drive->media == ide_floppy || | 101 | (drive->media == ide_disk || drive->media == ide_floppy || |
100 | drive->scsi)) | 102 | (drive->dev_flags & IDE_DFLAG_SCSI))) |
101 | return -EPERM; | 103 | return -EPERM; |
102 | 104 | ||
103 | drive->dsc_overlap = (arg >> IDE_NICE_DSC_OVERLAP) & 1; | 105 | if ((arg >> IDE_NICE_DSC_OVERLAP) & 1) |
104 | drive->nice1 = (arg >> IDE_NICE_1) & 1; | 106 | drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; |
107 | else | ||
108 | drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; | ||
109 | |||
110 | if ((arg >> IDE_NICE_1) & 1) | ||
111 | drive->dev_flags |= IDE_DFLAG_NICE1; | ||
112 | else | ||
113 | drive->dev_flags &= ~IDE_DFLAG_NICE1; | ||
105 | 114 | ||
106 | return 0; | 115 | return 0; |
107 | } | 116 | } |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 0a2fd3b37ac4..cec744cbbde0 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -647,7 +647,7 @@ u8 eighty_ninty_three (ide_drive_t *drive) | |||
647 | return 1; | 647 | return 1; |
648 | 648 | ||
649 | no_80w: | 649 | no_80w: |
650 | if (drive->udma33_warned == 1) | 650 | if (drive->dev_flags & IDE_DFLAG_UDMA33_WARNED) |
651 | return 0; | 651 | return 0; |
652 | 652 | ||
653 | printk(KERN_WARNING "%s: %s side 80-wire cable detection failed, " | 653 | printk(KERN_WARNING "%s: %s side 80-wire cable detection failed, " |
@@ -655,7 +655,7 @@ no_80w: | |||
655 | drive->name, | 655 | drive->name, |
656 | hwif->cbl == ATA_CBL_PATA80 ? "drive" : "host"); | 656 | hwif->cbl == ATA_CBL_PATA80 ? "drive" : "host"); |
657 | 657 | ||
658 | drive->udma33_warned = 1; | 658 | drive->dev_flags |= IDE_DFLAG_UDMA33_WARNED; |
659 | 659 | ||
660 | return 0; | 660 | return 0; |
661 | } | 661 | } |
@@ -711,7 +711,7 @@ int ide_driveid_update(ide_drive_t *drive) | |||
711 | 711 | ||
712 | kfree(id); | 712 | kfree(id); |
713 | 713 | ||
714 | if (drive->using_dma && ide_id_dma_bug(drive)) | 714 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) && ide_id_dma_bug(drive)) |
715 | ide_dma_off(drive); | 715 | ide_dma_off(drive); |
716 | 716 | ||
717 | return 1; | 717 | return 1; |
@@ -790,7 +790,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
790 | 790 | ||
791 | skip: | 791 | skip: |
792 | #ifdef CONFIG_BLK_DEV_IDEDMA | 792 | #ifdef CONFIG_BLK_DEV_IDEDMA |
793 | if (speed >= XFER_SW_DMA_0 && drive->using_dma) | 793 | if (speed >= XFER_SW_DMA_0 && (drive->dev_flags & IDE_DFLAG_USING_DMA)) |
794 | hwif->dma_ops->dma_host_set(drive, 1); | 794 | hwif->dma_ops->dma_host_set(drive, 1); |
795 | else if (hwif->dma_ops) /* check if host supports DMA */ | 795 | else if (hwif->dma_ops) /* check if host supports DMA */ |
796 | ide_dma_off_quietly(drive); | 796 | ide_dma_off_quietly(drive); |
@@ -1016,9 +1016,13 @@ static void ide_disk_pre_reset(ide_drive_t *drive) | |||
1016 | drive->special.all = 0; | 1016 | drive->special.all = 0; |
1017 | drive->special.b.set_geometry = legacy; | 1017 | drive->special.b.set_geometry = legacy; |
1018 | drive->special.b.recalibrate = legacy; | 1018 | drive->special.b.recalibrate = legacy; |
1019 | |||
1019 | drive->mult_count = 0; | 1020 | drive->mult_count = 0; |
1020 | if (!drive->keep_settings && !drive->using_dma) | 1021 | |
1022 | if ((drive->dev_flags & IDE_DFLAG_KEEP_SETTINGS) == 0 && | ||
1023 | (drive->dev_flags & IDE_DFLAG_USING_DMA) == 0) | ||
1021 | drive->mult_req = 0; | 1024 | drive->mult_req = 0; |
1025 | |||
1022 | if (drive->mult_req != drive->mult_count) | 1026 | if (drive->mult_req != drive->mult_count) |
1023 | drive->special.b.set_multmode = 1; | 1027 | drive->special.b.set_multmode = 1; |
1024 | } | 1028 | } |
@@ -1030,18 +1034,18 @@ static void pre_reset(ide_drive_t *drive) | |||
1030 | if (drive->media == ide_disk) | 1034 | if (drive->media == ide_disk) |
1031 | ide_disk_pre_reset(drive); | 1035 | ide_disk_pre_reset(drive); |
1032 | else | 1036 | else |
1033 | drive->post_reset = 1; | 1037 | drive->dev_flags |= IDE_DFLAG_POST_RESET; |
1034 | 1038 | ||
1035 | if (drive->using_dma) { | 1039 | if (drive->dev_flags & IDE_DFLAG_USING_DMA) { |
1036 | if (drive->crc_count) | 1040 | if (drive->crc_count) |
1037 | ide_check_dma_crc(drive); | 1041 | ide_check_dma_crc(drive); |
1038 | else | 1042 | else |
1039 | ide_dma_off(drive); | 1043 | ide_dma_off(drive); |
1040 | } | 1044 | } |
1041 | 1045 | ||
1042 | if (!drive->keep_settings) { | 1046 | if ((drive->dev_flags & IDE_DFLAG_KEEP_SETTINGS) == 0) { |
1043 | if (!drive->using_dma) { | 1047 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0) { |
1044 | drive->unmask = 0; | 1048 | drive->dev_flags &= ~IDE_DFLAG_UNMASK; |
1045 | drive->io_32bit = 0; | 1049 | drive->io_32bit = 0; |
1046 | } | 1050 | } |
1047 | return; | 1051 | return; |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index ed426dd0fdd8..9fc4cfb2a272 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -317,7 +317,7 @@ static void ide_dump_sector(ide_drive_t *drive) | |||
317 | { | 317 | { |
318 | ide_task_t task; | 318 | ide_task_t task; |
319 | struct ide_taskfile *tf = &task.tf; | 319 | struct ide_taskfile *tf = &task.tf; |
320 | int lba48 = (drive->addressing == 1) ? 1 : 0; | 320 | u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); |
321 | 321 | ||
322 | memset(&task, 0, sizeof(task)); | 322 | memset(&task, 0, sizeof(task)); |
323 | if (lba48) | 323 | if (lba48) |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 237b9871f80a..57c741876536 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -121,7 +121,8 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) | |||
121 | /* read 512 bytes of id info */ | 121 | /* read 512 bytes of id info */ |
122 | hwif->tp_ops->input_data(drive, NULL, id, SECTOR_SIZE); | 122 | hwif->tp_ops->input_data(drive, NULL, id, SECTOR_SIZE); |
123 | 123 | ||
124 | drive->id_read = 1; | 124 | drive->dev_flags |= IDE_DFLAG_ID_READ; |
125 | |||
125 | local_irq_enable(); | 126 | local_irq_enable(); |
126 | #ifdef DEBUG | 127 | #ifdef DEBUG |
127 | printk(KERN_INFO "%s: dumping identify data\n", drive->name); | 128 | printk(KERN_INFO "%s: dumping identify data\n", drive->name); |
@@ -153,8 +154,8 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) | |||
153 | 154 | ||
154 | printk(KERN_INFO "%s: %s, ", drive->name, m); | 155 | printk(KERN_INFO "%s: %s, ", drive->name, m); |
155 | 156 | ||
156 | drive->present = 1; | 157 | drive->dev_flags |= IDE_DFLAG_PRESENT; |
157 | drive->dead = 0; | 158 | drive->dev_flags &= ~IDE_DFLAG_DEAD; |
158 | 159 | ||
159 | /* | 160 | /* |
160 | * Check for an ATAPI device | 161 | * Check for an ATAPI device |
@@ -172,14 +173,14 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) | |||
172 | printk(KERN_CONT "cdrom or floppy?, assuming "); | 173 | printk(KERN_CONT "cdrom or floppy?, assuming "); |
173 | if (drive->media != ide_cdrom) { | 174 | if (drive->media != ide_cdrom) { |
174 | printk(KERN_CONT "FLOPPY"); | 175 | printk(KERN_CONT "FLOPPY"); |
175 | drive->removable = 1; | 176 | drive->dev_flags |= IDE_DFLAG_REMOVABLE; |
176 | break; | 177 | break; |
177 | } | 178 | } |
178 | } | 179 | } |
179 | /* Early cdrom models used zero */ | 180 | /* Early cdrom models used zero */ |
180 | type = ide_cdrom; | 181 | type = ide_cdrom; |
181 | case ide_cdrom: | 182 | case ide_cdrom: |
182 | drive->removable = 1; | 183 | drive->dev_flags |= IDE_DFLAG_REMOVABLE; |
183 | #ifdef CONFIG_PPC | 184 | #ifdef CONFIG_PPC |
184 | /* kludge for Apple PowerBook internal zip */ | 185 | /* kludge for Apple PowerBook internal zip */ |
185 | if (!strstr(m, "CD-ROM") && strstr(m, "ZIP")) { | 186 | if (!strstr(m, "CD-ROM") && strstr(m, "ZIP")) { |
@@ -195,7 +196,7 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) | |||
195 | break; | 196 | break; |
196 | case ide_optical: | 197 | case ide_optical: |
197 | printk(KERN_CONT "OPTICAL"); | 198 | printk(KERN_CONT "OPTICAL"); |
198 | drive->removable = 1; | 199 | drive->dev_flags |= IDE_DFLAG_REMOVABLE; |
199 | break; | 200 | break; |
200 | default: | 201 | default: |
201 | printk(KERN_CONT "UNKNOWN (type %d)", type); | 202 | printk(KERN_CONT "UNKNOWN (type %d)", type); |
@@ -216,7 +217,7 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) | |||
216 | 217 | ||
217 | /* CF devices are *not* removable in Linux definition of the term */ | 218 | /* CF devices are *not* removable in Linux definition of the term */ |
218 | if (is_cfa == 0 && (id[ATA_ID_CONFIG] & (1 << 7))) | 219 | if (is_cfa == 0 && (id[ATA_ID_CONFIG] & (1 << 7))) |
219 | drive->removable = 1; | 220 | drive->dev_flags |= IDE_DFLAG_REMOVABLE; |
220 | 221 | ||
221 | drive->media = ide_disk; | 222 | drive->media = ide_disk; |
222 | 223 | ||
@@ -226,7 +227,7 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) | |||
226 | 227 | ||
227 | err_misc: | 228 | err_misc: |
228 | kfree(id); | 229 | kfree(id); |
229 | drive->present = 0; | 230 | drive->dev_flags &= ~IDE_DFLAG_PRESENT; |
230 | return; | 231 | return; |
231 | } | 232 | } |
232 | 233 | ||
@@ -426,16 +427,15 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
426 | ide_hwif_t *hwif = HWIF(drive); | 427 | ide_hwif_t *hwif = HWIF(drive); |
427 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 428 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
428 | int rc; | 429 | int rc; |
429 | u8 stat; | 430 | u8 present = !!(drive->dev_flags & IDE_DFLAG_PRESENT), stat; |
431 | |||
432 | /* avoid waiting for inappropriate probes */ | ||
433 | if (present && drive->media != ide_disk && cmd == ATA_CMD_ID_ATA) | ||
434 | return 4; | ||
430 | 435 | ||
431 | if (drive->present) { | ||
432 | /* avoid waiting for inappropriate probes */ | ||
433 | if (drive->media != ide_disk && cmd == ATA_CMD_ID_ATA) | ||
434 | return 4; | ||
435 | } | ||
436 | #ifdef DEBUG | 436 | #ifdef DEBUG |
437 | printk(KERN_INFO "probing for %s: present=%d, media=%d, probetype=%s\n", | 437 | printk(KERN_INFO "probing for %s: present=%d, media=%d, probetype=%s\n", |
438 | drive->name, drive->present, drive->media, | 438 | drive->name, present, drive->media, |
439 | (cmd == ATA_CMD_ID_ATA) ? "ATA" : "ATAPI"); | 439 | (cmd == ATA_CMD_ID_ATA) ? "ATA" : "ATAPI"); |
440 | #endif | 440 | #endif |
441 | 441 | ||
@@ -446,7 +446,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
446 | SELECT_DRIVE(drive); | 446 | SELECT_DRIVE(drive); |
447 | msleep(50); | 447 | msleep(50); |
448 | 448 | ||
449 | if (ide_read_device(drive) != drive->select.all && !drive->present) { | 449 | if (ide_read_device(drive) != drive->select.all && present == 0) { |
450 | if (drive->select.b.unit != 0) { | 450 | if (drive->select.b.unit != 0) { |
451 | /* exit with drive0 selected */ | 451 | /* exit with drive0 selected */ |
452 | SELECT_DRIVE(&hwif->drives[0]); | 452 | SELECT_DRIVE(&hwif->drives[0]); |
@@ -460,7 +460,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
460 | stat = tp_ops->read_status(hwif); | 460 | stat = tp_ops->read_status(hwif); |
461 | 461 | ||
462 | if (OK_STAT(stat, ATA_DRDY, ATA_BUSY) || | 462 | if (OK_STAT(stat, ATA_DRDY, ATA_BUSY) || |
463 | drive->present || cmd == ATA_CMD_ID_ATAPI) { | 463 | present || cmd == ATA_CMD_ID_ATAPI) { |
464 | /* send cmd and wait */ | 464 | /* send cmd and wait */ |
465 | if ((rc = try_to_identify(drive, cmd))) { | 465 | if ((rc = try_to_identify(drive, cmd))) { |
466 | /* failed: try again */ | 466 | /* failed: try again */ |
@@ -542,8 +542,8 @@ static void enable_nest (ide_drive_t *drive) | |||
542 | * and presents things to the user as needed. | 542 | * and presents things to the user as needed. |
543 | * | 543 | * |
544 | * Returns: 0 no device was found | 544 | * Returns: 0 no device was found |
545 | * 1 device was found (note: drive->present might | 545 | * 1 device was found |
546 | * still be 0) | 546 | * (note: IDE_DFLAG_PRESENT might still be not set) |
547 | */ | 547 | */ |
548 | 548 | ||
549 | static inline u8 probe_for_drive (ide_drive_t *drive) | 549 | static inline u8 probe_for_drive (ide_drive_t *drive) |
@@ -559,10 +559,10 @@ static inline u8 probe_for_drive (ide_drive_t *drive) | |||
559 | * Also note that 0 everywhere means "can't do X" | 559 | * Also note that 0 everywhere means "can't do X" |
560 | */ | 560 | */ |
561 | 561 | ||
562 | drive->dev_flags &= ~IDE_DFLAG_ID_READ; | ||
563 | |||
562 | drive->id = kzalloc(SECTOR_SIZE, GFP_KERNEL); | 564 | drive->id = kzalloc(SECTOR_SIZE, GFP_KERNEL); |
563 | drive->id_read = 0; | 565 | if (drive->id == NULL) { |
564 | if(drive->id == NULL) | ||
565 | { | ||
566 | printk(KERN_ERR "ide: out of memory for id data.\n"); | 566 | printk(KERN_ERR "ide: out of memory for id data.\n"); |
567 | return 0; | 567 | return 0; |
568 | } | 568 | } |
@@ -571,14 +571,14 @@ static inline u8 probe_for_drive (ide_drive_t *drive) | |||
571 | strcpy(m, "UNKNOWN"); | 571 | strcpy(m, "UNKNOWN"); |
572 | 572 | ||
573 | /* skip probing? */ | 573 | /* skip probing? */ |
574 | if (!drive->noprobe) { | 574 | if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0) { |
575 | retry: | 575 | retry: |
576 | /* if !(success||timed-out) */ | 576 | /* if !(success||timed-out) */ |
577 | if (do_probe(drive, ATA_CMD_ID_ATA) >= 2) | 577 | if (do_probe(drive, ATA_CMD_ID_ATA) >= 2) |
578 | /* look for ATAPI device */ | 578 | /* look for ATAPI device */ |
579 | (void)do_probe(drive, ATA_CMD_ID_ATAPI); | 579 | (void)do_probe(drive, ATA_CMD_ID_ATAPI); |
580 | 580 | ||
581 | if (!drive->present) | 581 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) |
582 | /* drive not found */ | 582 | /* drive not found */ |
583 | return 0; | 583 | return 0; |
584 | 584 | ||
@@ -588,7 +588,7 @@ retry: | |||
588 | } | 588 | } |
589 | 589 | ||
590 | /* identification failed? */ | 590 | /* identification failed? */ |
591 | if (!drive->id_read) { | 591 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { |
592 | if (drive->media == ide_disk) { | 592 | if (drive->media == ide_disk) { |
593 | printk(KERN_INFO "%s: non-IDE drive, CHS=%d/%d/%d\n", | 593 | printk(KERN_INFO "%s: non-IDE drive, CHS=%d/%d/%d\n", |
594 | drive->name, drive->cyl, | 594 | drive->name, drive->cyl, |
@@ -598,15 +598,17 @@ retry: | |||
598 | } else { | 598 | } else { |
599 | /* nuke it */ | 599 | /* nuke it */ |
600 | printk(KERN_WARNING "%s: Unknown device on bus refused identification. Ignoring.\n", drive->name); | 600 | printk(KERN_WARNING "%s: Unknown device on bus refused identification. Ignoring.\n", drive->name); |
601 | drive->present = 0; | 601 | drive->dev_flags &= ~IDE_DFLAG_PRESENT; |
602 | } | 602 | } |
603 | } | 603 | } |
604 | /* drive was found */ | 604 | /* drive was found */ |
605 | } | 605 | } |
606 | if(!drive->present) | 606 | |
607 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | ||
607 | return 0; | 608 | return 0; |
609 | |||
608 | /* The drive wasn't being helpful. Add generic info only */ | 610 | /* The drive wasn't being helpful. Add generic info only */ |
609 | if (drive->id_read == 0) { | 611 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { |
610 | generic_id(drive); | 612 | generic_id(drive); |
611 | return 1; | 613 | return 1; |
612 | } | 614 | } |
@@ -616,7 +618,7 @@ retry: | |||
616 | ide_disk_init_mult_count(drive); | 618 | ide_disk_init_mult_count(drive); |
617 | } | 619 | } |
618 | 620 | ||
619 | return drive->present; | 621 | return !!(drive->dev_flags & IDE_DFLAG_PRESENT); |
620 | } | 622 | } |
621 | 623 | ||
622 | static void hwif_release_dev(struct device *dev) | 624 | static void hwif_release_dev(struct device *dev) |
@@ -707,7 +709,8 @@ static int ide_port_wait_ready(ide_hwif_t *hwif) | |||
707 | ide_drive_t *drive = &hwif->drives[unit]; | 709 | ide_drive_t *drive = &hwif->drives[unit]; |
708 | 710 | ||
709 | /* Ignore disks that we will not probe for later. */ | 711 | /* Ignore disks that we will not probe for later. */ |
710 | if (!drive->noprobe || drive->present) { | 712 | if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0 || |
713 | (drive->dev_flags & IDE_DFLAG_PRESENT)) { | ||
711 | SELECT_DRIVE(drive); | 714 | SELECT_DRIVE(drive); |
712 | hwif->tp_ops->set_irq(hwif, 1); | 715 | hwif->tp_ops->set_irq(hwif, 1); |
713 | mdelay(2); | 716 | mdelay(2); |
@@ -739,7 +742,7 @@ void ide_undecoded_slave(ide_drive_t *dev1) | |||
739 | { | 742 | { |
740 | ide_drive_t *dev0 = &dev1->hwif->drives[0]; | 743 | ide_drive_t *dev0 = &dev1->hwif->drives[0]; |
741 | 744 | ||
742 | if ((dev1->dn & 1) == 0 || dev0->present == 0) | 745 | if ((dev1->dn & 1) == 0 || (dev0->dev_flags & IDE_DFLAG_PRESENT) == 0) |
743 | return; | 746 | return; |
744 | 747 | ||
745 | /* If the models don't match they are not the same product */ | 748 | /* If the models don't match they are not the same product */ |
@@ -759,7 +762,7 @@ void ide_undecoded_slave(ide_drive_t *dev1) | |||
759 | /* Appears to be an IDE flash adapter with decode bugs */ | 762 | /* Appears to be an IDE flash adapter with decode bugs */ |
760 | printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n"); | 763 | printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n"); |
761 | 764 | ||
762 | dev1->present = 0; | 765 | dev1->dev_flags &= ~IDE_DFLAG_PRESENT; |
763 | } | 766 | } |
764 | 767 | ||
765 | EXPORT_SYMBOL_GPL(ide_undecoded_slave); | 768 | EXPORT_SYMBOL_GPL(ide_undecoded_slave); |
@@ -772,7 +775,8 @@ static int ide_probe_port(ide_hwif_t *hwif) | |||
772 | 775 | ||
773 | BUG_ON(hwif->present); | 776 | BUG_ON(hwif->present); |
774 | 777 | ||
775 | if (hwif->drives[0].noprobe && hwif->drives[1].noprobe) | 778 | if ((hwif->drives[0].dev_flags & IDE_DFLAG_NOPROBE) && |
779 | (hwif->drives[1].dev_flags & IDE_DFLAG_NOPROBE)) | ||
776 | return -EACCES; | 780 | return -EACCES; |
777 | 781 | ||
778 | /* | 782 | /* |
@@ -796,7 +800,7 @@ static int ide_probe_port(ide_hwif_t *hwif) | |||
796 | ide_drive_t *drive = &hwif->drives[unit]; | 800 | ide_drive_t *drive = &hwif->drives[unit]; |
797 | drive->dn = (hwif->channel ? 2 : 0) + unit; | 801 | drive->dn = (hwif->channel ? 2 : 0) + unit; |
798 | (void) probe_for_drive(drive); | 802 | (void) probe_for_drive(drive); |
799 | if (drive->present) | 803 | if (drive->dev_flags & IDE_DFLAG_PRESENT) |
800 | rc = 0; | 804 | rc = 0; |
801 | } | 805 | } |
802 | 806 | ||
@@ -820,17 +824,19 @@ static void ide_port_tune_devices(ide_hwif_t *hwif) | |||
820 | for (unit = 0; unit < MAX_DRIVES; unit++) { | 824 | for (unit = 0; unit < MAX_DRIVES; unit++) { |
821 | ide_drive_t *drive = &hwif->drives[unit]; | 825 | ide_drive_t *drive = &hwif->drives[unit]; |
822 | 826 | ||
823 | if (drive->present && port_ops && port_ops->quirkproc) | 827 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { |
824 | port_ops->quirkproc(drive); | 828 | if (port_ops && port_ops->quirkproc) |
829 | port_ops->quirkproc(drive); | ||
830 | } | ||
825 | } | 831 | } |
826 | 832 | ||
827 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 833 | for (unit = 0; unit < MAX_DRIVES; ++unit) { |
828 | ide_drive_t *drive = &hwif->drives[unit]; | 834 | ide_drive_t *drive = &hwif->drives[unit]; |
829 | 835 | ||
830 | if (drive->present) { | 836 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { |
831 | ide_set_max_pio(drive); | 837 | ide_set_max_pio(drive); |
832 | 838 | ||
833 | drive->nice1 = 1; | 839 | drive->dev_flags |= IDE_DFLAG_NICE1; |
834 | 840 | ||
835 | if (hwif->dma_ops) | 841 | if (hwif->dma_ops) |
836 | ide_set_dma(drive); | 842 | ide_set_dma(drive); |
@@ -840,10 +846,11 @@ static void ide_port_tune_devices(ide_hwif_t *hwif) | |||
840 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 846 | for (unit = 0; unit < MAX_DRIVES; ++unit) { |
841 | ide_drive_t *drive = &hwif->drives[unit]; | 847 | ide_drive_t *drive = &hwif->drives[unit]; |
842 | 848 | ||
843 | if (hwif->host_flags & IDE_HFLAG_NO_IO_32BIT) | 849 | if ((hwif->host_flags & IDE_HFLAG_NO_IO_32BIT) || |
844 | drive->no_io_32bit = 1; | 850 | drive->id[ATA_ID_DWORD_IO]) |
851 | drive->dev_flags |= IDE_DFLAG_NO_IO_32BIT; | ||
845 | else | 852 | else |
846 | drive->no_io_32bit = drive->id[ATA_ID_DWORD_IO] ? 1 : 0; | 853 | drive->dev_flags &= ~IDE_DFLAG_NO_IO_32BIT; |
847 | } | 854 | } |
848 | } | 855 | } |
849 | 856 | ||
@@ -957,7 +964,7 @@ static void ide_port_setup_devices(ide_hwif_t *hwif) | |||
957 | for (i = 0; i < MAX_DRIVES; i++) { | 964 | for (i = 0; i < MAX_DRIVES; i++) { |
958 | ide_drive_t *drive = &hwif->drives[i]; | 965 | ide_drive_t *drive = &hwif->drives[i]; |
959 | 966 | ||
960 | if (!drive->present) | 967 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) |
961 | continue; | 968 | continue; |
962 | 969 | ||
963 | if (ide_init_queue(drive)) { | 970 | if (ide_init_queue(drive)) { |
@@ -1151,12 +1158,13 @@ static struct kobject *ata_probe(dev_t dev, int *part, void *data) | |||
1151 | ide_hwif_t *hwif = data; | 1158 | ide_hwif_t *hwif = data; |
1152 | int unit = *part >> PARTN_BITS; | 1159 | int unit = *part >> PARTN_BITS; |
1153 | ide_drive_t *drive = &hwif->drives[unit]; | 1160 | ide_drive_t *drive = &hwif->drives[unit]; |
1154 | if (!drive->present) | 1161 | |
1162 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | ||
1155 | return NULL; | 1163 | return NULL; |
1156 | 1164 | ||
1157 | if (drive->media == ide_disk) | 1165 | if (drive->media == ide_disk) |
1158 | request_module("ide-disk"); | 1166 | request_module("ide-disk"); |
1159 | if (drive->scsi) | 1167 | if (drive->dev_flags & IDE_DFLAG_SCSI) |
1160 | request_module("ide-scsi"); | 1168 | request_module("ide-scsi"); |
1161 | if (drive->media == ide_cdrom || drive->media == ide_optical) | 1169 | if (drive->media == ide_cdrom || drive->media == ide_optical) |
1162 | request_module("ide-cd"); | 1170 | request_module("ide-cd"); |
@@ -1246,7 +1254,7 @@ static void drive_release_dev (struct device *dev) | |||
1246 | ide_remove_drive_from_hwgroup(drive); | 1254 | ide_remove_drive_from_hwgroup(drive); |
1247 | kfree(drive->id); | 1255 | kfree(drive->id); |
1248 | drive->id = NULL; | 1256 | drive->id = NULL; |
1249 | drive->present = 0; | 1257 | drive->dev_flags &= ~IDE_DFLAG_PRESENT; |
1250 | /* Messed up locking ... */ | 1258 | /* Messed up locking ... */ |
1251 | spin_unlock_irq(&ide_lock); | 1259 | spin_unlock_irq(&ide_lock); |
1252 | blk_cleanup_queue(drive->queue); | 1260 | blk_cleanup_queue(drive->queue); |
@@ -1325,7 +1333,7 @@ static void hwif_register_devices(ide_hwif_t *hwif) | |||
1325 | struct device *dev = &drive->gendev; | 1333 | struct device *dev = &drive->gendev; |
1326 | int ret; | 1334 | int ret; |
1327 | 1335 | ||
1328 | if (!drive->present) | 1336 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) |
1329 | continue; | 1337 | continue; |
1330 | 1338 | ||
1331 | snprintf(dev->bus_id, BUS_ID_SIZE, "%u.%u", hwif->index, i); | 1339 | snprintf(dev->bus_id, BUS_ID_SIZE, "%u.%u", hwif->index, i); |
@@ -1352,9 +1360,9 @@ static void ide_port_init_devices(ide_hwif_t *hwif) | |||
1352 | if (hwif->host_flags & IDE_HFLAG_IO_32BIT) | 1360 | if (hwif->host_flags & IDE_HFLAG_IO_32BIT) |
1353 | drive->io_32bit = 1; | 1361 | drive->io_32bit = 1; |
1354 | if (hwif->host_flags & IDE_HFLAG_UNMASK_IRQS) | 1362 | if (hwif->host_flags & IDE_HFLAG_UNMASK_IRQS) |
1355 | drive->unmask = 1; | 1363 | drive->dev_flags |= IDE_DFLAG_UNMASK; |
1356 | if (hwif->host_flags & IDE_HFLAG_NO_UNMASK_IRQS) | 1364 | if (hwif->host_flags & IDE_HFLAG_NO_UNMASK_IRQS) |
1357 | drive->no_unmask = 1; | 1365 | drive->dev_flags |= IDE_DFLAG_NO_UNMASK; |
1358 | 1366 | ||
1359 | if (port_ops && port_ops->init_dev) | 1367 | if (port_ops && port_ops->init_dev) |
1360 | port_ops->init_dev(drive); | 1368 | port_ops->init_dev(drive); |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index e7030a491463..b26926487cc0 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -227,7 +227,7 @@ static int set_xfer_rate (ide_drive_t *drive, int arg) | |||
227 | 227 | ||
228 | ide_devset_rw(current_speed, xfer_rate); | 228 | ide_devset_rw(current_speed, xfer_rate); |
229 | ide_devset_rw_field(init_speed, init_speed); | 229 | ide_devset_rw_field(init_speed, init_speed); |
230 | ide_devset_rw_field(nice1, nice1); | 230 | ide_devset_rw_flag(nice1, IDE_DFLAG_NICE1); |
231 | ide_devset_rw_field(number, dn); | 231 | ide_devset_rw_field(number, dn); |
232 | 232 | ||
233 | static const struct ide_proc_devset ide_generic_settings[] = { | 233 | static const struct ide_proc_devset ide_generic_settings[] = { |
@@ -622,9 +622,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) | |||
622 | for (d = 0; d < MAX_DRIVES; d++) { | 622 | for (d = 0; d < MAX_DRIVES; d++) { |
623 | ide_drive_t *drive = &hwif->drives[d]; | 623 | ide_drive_t *drive = &hwif->drives[d]; |
624 | 624 | ||
625 | if (!drive->present) | 625 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0 || drive->proc) |
626 | continue; | ||
627 | if (drive->proc) | ||
628 | continue; | 626 | continue; |
629 | 627 | ||
630 | drive->proc = proc_mkdir(drive->name, parent); | 628 | drive->proc = proc_mkdir(drive->name, parent); |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 2c235401aad1..103f9f161716 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -826,12 +826,13 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
826 | */ | 826 | */ |
827 | stat = hwif->tp_ops->read_status(hwif); | 827 | stat = hwif->tp_ops->read_status(hwif); |
828 | 828 | ||
829 | if (!drive->dsc_overlap && !(rq->cmd[13] & REQ_IDETAPE_PC2)) | 829 | if ((drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) == 0 && |
830 | (rq->cmd[13] & REQ_IDETAPE_PC2) == 0) | ||
830 | set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); | 831 | set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); |
831 | 832 | ||
832 | if (drive->post_reset == 1) { | 833 | if (drive->dev_flags & IDE_DFLAG_POST_RESET) { |
833 | set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); | 834 | set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); |
834 | drive->post_reset = 0; | 835 | drive->dev_flags &= ~IDE_DFLAG_POST_RESET; |
835 | } | 836 | } |
836 | 837 | ||
837 | if (!test_and_clear_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags) && | 838 | if (!test_and_clear_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags) && |
@@ -1354,7 +1355,7 @@ static int idetape_init_read(ide_drive_t *drive) | |||
1354 | * No point in issuing this if DSC overlap isn't supported, some | 1355 | * No point in issuing this if DSC overlap isn't supported, some |
1355 | * drives (Seagate STT3401A) will return an error. | 1356 | * drives (Seagate STT3401A) will return an error. |
1356 | */ | 1357 | */ |
1357 | if (drive->dsc_overlap) { | 1358 | if (drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) { |
1358 | bytes_read = idetape_queue_rw_tail(drive, | 1359 | bytes_read = idetape_queue_rw_tail(drive, |
1359 | REQ_IDETAPE_READ, 0, | 1360 | REQ_IDETAPE_READ, 0, |
1360 | tape->merge_bh); | 1361 | tape->merge_bh); |
@@ -1630,7 +1631,7 @@ static ssize_t idetape_chrdev_write(struct file *file, const char __user *buf, | |||
1630 | * point in issuing this if DSC overlap isn't supported, some | 1631 | * point in issuing this if DSC overlap isn't supported, some |
1631 | * drives (Seagate STT3401A) will return an error. | 1632 | * drives (Seagate STT3401A) will return an error. |
1632 | */ | 1633 | */ |
1633 | if (drive->dsc_overlap) { | 1634 | if (drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) { |
1634 | ssize_t retval = idetape_queue_rw_tail(drive, | 1635 | ssize_t retval = idetape_queue_rw_tail(drive, |
1635 | REQ_IDETAPE_WRITE, 0, | 1636 | REQ_IDETAPE_WRITE, 0, |
1636 | tape->merge_bh); | 1637 | tape->merge_bh); |
@@ -2145,7 +2146,7 @@ static int divf_tdsc(ide_drive_t *drive) { return HZ; } | |||
2145 | static int divf_buffer(ide_drive_t *drive) { return 2; } | 2146 | static int divf_buffer(ide_drive_t *drive) { return 2; } |
2146 | static int divf_buffer_size(ide_drive_t *drive) { return 1024; } | 2147 | static int divf_buffer_size(ide_drive_t *drive) { return 1024; } |
2147 | 2148 | ||
2148 | ide_devset_rw_field(dsc_overlap, dsc_overlap); | 2149 | ide_devset_rw_flag(dsc_overlap, IDE_DFLAG_DSC_OVERLAP); |
2149 | 2150 | ||
2150 | ide_tape_devset_rw_field(debug_mask, debug_mask); | 2151 | ide_tape_devset_rw_field(debug_mask, debug_mask); |
2151 | ide_tape_devset_rw_field(tdsc, best_dsc_rw_freq); | 2152 | ide_tape_devset_rw_field(tdsc, best_dsc_rw_freq); |
@@ -2192,15 +2193,19 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
2192 | drive->pc_io_buffers = ide_tape_io_buffers; | 2193 | drive->pc_io_buffers = ide_tape_io_buffers; |
2193 | 2194 | ||
2194 | spin_lock_init(&tape->lock); | 2195 | spin_lock_init(&tape->lock); |
2195 | drive->dsc_overlap = 1; | 2196 | |
2197 | drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; | ||
2198 | |||
2196 | if (drive->hwif->host_flags & IDE_HFLAG_NO_DSC) { | 2199 | if (drive->hwif->host_flags & IDE_HFLAG_NO_DSC) { |
2197 | printk(KERN_INFO "ide-tape: %s: disabling DSC overlap\n", | 2200 | printk(KERN_INFO "ide-tape: %s: disabling DSC overlap\n", |
2198 | tape->name); | 2201 | tape->name); |
2199 | drive->dsc_overlap = 0; | 2202 | drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; |
2200 | } | 2203 | } |
2204 | |||
2201 | /* Seagate Travan drives do not support DSC overlap. */ | 2205 | /* Seagate Travan drives do not support DSC overlap. */ |
2202 | if (strstr((char *)&drive->id[ATA_ID_PROD], "Seagate STT3401")) | 2206 | if (strstr((char *)&drive->id[ATA_ID_PROD], "Seagate STT3401")) |
2203 | drive->dsc_overlap = 0; | 2207 | drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; |
2208 | |||
2204 | tape->minor = minor; | 2209 | tape->minor = minor; |
2205 | tape->name[0] = 'h'; | 2210 | tape->name[0] = 'h'; |
2206 | tape->name[1] = 't'; | 2211 | tape->name[1] = 't'; |
@@ -2247,7 +2252,7 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
2247 | (*(u16 *)&tape->caps[16] * 512) / tape->buffer_size, | 2252 | (*(u16 *)&tape->caps[16] * 512) / tape->buffer_size, |
2248 | tape->buffer_size / 1024, | 2253 | tape->buffer_size / 1024, |
2249 | tape->best_dsc_rw_freq * 1000 / HZ, | 2254 | tape->best_dsc_rw_freq * 1000 / HZ, |
2250 | drive->using_dma ? ", DMA":""); | 2255 | (drive->dev_flags & IDE_DFLAG_USING_DMA) ? ", DMA" : ""); |
2251 | 2256 | ||
2252 | ide_proc_register_driver(drive, tape->driver); | 2257 | ide_proc_register_driver(drive, tape->driver); |
2253 | } | 2258 | } |
@@ -2271,7 +2276,7 @@ static void ide_tape_release(struct kref *kref) | |||
2271 | 2276 | ||
2272 | BUG_ON(tape->merge_bh_size); | 2277 | BUG_ON(tape->merge_bh_size); |
2273 | 2278 | ||
2274 | drive->dsc_overlap = 0; | 2279 | drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; |
2275 | drive->driver_data = NULL; | 2280 | drive->driver_data = NULL; |
2276 | device_destroy(idetape_sysfs_class, MKDEV(IDETAPE_MAJOR, tape->minor)); | 2281 | device_destroy(idetape_sysfs_class, MKDEV(IDETAPE_MAJOR, tape->minor)); |
2277 | device_destroy(idetape_sysfs_class, | 2282 | device_destroy(idetape_sysfs_class, |
@@ -2386,7 +2391,8 @@ static int ide_tape_probe(ide_drive_t *drive) | |||
2386 | if (drive->media != ide_tape) | 2391 | if (drive->media != ide_tape) |
2387 | goto failed; | 2392 | goto failed; |
2388 | 2393 | ||
2389 | if (drive->id_read == 1 && !ide_check_atapi_device(drive, DRV_NAME)) { | 2394 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) && |
2395 | ide_check_atapi_device(drive, DRV_NAME) == 0) { | ||
2390 | printk(KERN_ERR "ide-tape: %s: not supported by this version of" | 2396 | printk(KERN_ERR "ide-tape: %s: not supported by this version of" |
2391 | " the driver\n", drive->name); | 2397 | " the driver\n", drive->name); |
2392 | goto failed; | 2398 | goto failed; |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 487b18b3ebae..8da8d26db7ed 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -116,7 +116,8 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
116 | WAIT_WORSTCASE, NULL); | 116 | WAIT_WORSTCASE, NULL); |
117 | return ide_started; | 117 | return ide_started; |
118 | default: | 118 | default: |
119 | if (drive->using_dma == 0 || dma_ops->dma_setup(drive)) | 119 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || |
120 | dma_ops->dma_setup(drive)) | ||
120 | return ide_stopped; | 121 | return ide_stopped; |
121 | dma_ops->dma_exec_cmd(drive, tf->command); | 122 | dma_ops->dma_exec_cmd(drive, tf->command); |
122 | dma_ops->dma_start(drive); | 123 | dma_ops->dma_start(drive); |
@@ -469,13 +470,12 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) | |||
469 | if (ide_wait_stat(&startstop, drive, ATA_DRQ, | 470 | if (ide_wait_stat(&startstop, drive, ATA_DRQ, |
470 | drive->bad_wstat, WAIT_DRQ)) { | 471 | drive->bad_wstat, WAIT_DRQ)) { |
471 | printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", | 472 | printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", |
472 | drive->name, | 473 | drive->name, drive->hwif->data_phase ? "MULT" : "", |
473 | drive->hwif->data_phase ? "MULT" : "", | 474 | (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); |
474 | drive->addressing ? "_EXT" : ""); | ||
475 | return startstop; | 475 | return startstop; |
476 | } | 476 | } |
477 | 477 | ||
478 | if (!drive->unmask) | 478 | if ((drive->dev_flags & IDE_DFLAG_UNMASK) == 0) |
479 | local_irq_disable(); | 479 | local_irq_disable(); |
480 | 480 | ||
481 | ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); | 481 | ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); |
@@ -591,7 +591,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
591 | 591 | ||
592 | args.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | | 592 | args.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | |
593 | IDE_TFLAG_IN_TF; | 593 | IDE_TFLAG_IN_TF; |
594 | if (drive->addressing == 1) | 594 | if (drive->dev_flags & IDE_DFLAG_LBA48) |
595 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); | 595 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); |
596 | 596 | ||
597 | if (req_task->out_flags.all) { | 597 | if (req_task->out_flags.all) { |
@@ -694,7 +694,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
694 | if ((args.tf_flags & IDE_TFLAG_FLAGGED_SET_IN_FLAGS) && | 694 | if ((args.tf_flags & IDE_TFLAG_FLAGGED_SET_IN_FLAGS) && |
695 | req_task->in_flags.all == 0) { | 695 | req_task->in_flags.all == 0) { |
696 | req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; | 696 | req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; |
697 | if (drive->addressing == 1) | 697 | if (drive->dev_flags & IDE_DFLAG_LBA48) |
698 | req_task->in_flags.all |= (IDE_HOB_STD_IN_FLAGS << 8); | 698 | req_task->in_flags.all |= (IDE_HOB_STD_IN_FLAGS << 8); |
699 | } | 699 | } |
700 | 700 | ||
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 64997873b6d7..78776bbb537e 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -138,7 +138,7 @@ static void __ide_port_unregister_devices(ide_hwif_t *hwif) | |||
138 | for (i = 0; i < MAX_DRIVES; i++) { | 138 | for (i = 0; i < MAX_DRIVES; i++) { |
139 | ide_drive_t *drive = &hwif->drives[i]; | 139 | ide_drive_t *drive = &hwif->drives[i]; |
140 | 140 | ||
141 | if (drive->present) { | 141 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { |
142 | spin_unlock_irq(&ide_lock); | 142 | spin_unlock_irq(&ide_lock); |
143 | device_unregister(&drive->gendev); | 143 | device_unregister(&drive->gendev); |
144 | wait_for_completion(&drive->gendev_rel_comp); | 144 | wait_for_completion(&drive->gendev_rel_comp); |
@@ -254,7 +254,7 @@ ide_devset_get(io_32bit, io_32bit); | |||
254 | 254 | ||
255 | static int set_io_32bit(ide_drive_t *drive, int arg) | 255 | static int set_io_32bit(ide_drive_t *drive, int arg) |
256 | { | 256 | { |
257 | if (drive->no_io_32bit) | 257 | if (drive->dev_flags & IDE_DFLAG_NO_IO_32BIT) |
258 | return -EPERM; | 258 | return -EPERM; |
259 | 259 | ||
260 | if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1)) | 260 | if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1)) |
@@ -265,19 +265,22 @@ static int set_io_32bit(ide_drive_t *drive, int arg) | |||
265 | return 0; | 265 | return 0; |
266 | } | 266 | } |
267 | 267 | ||
268 | ide_devset_get(ksettings, keep_settings); | 268 | ide_devset_get_flag(ksettings, IDE_DFLAG_KEEP_SETTINGS); |
269 | 269 | ||
270 | static int set_ksettings(ide_drive_t *drive, int arg) | 270 | static int set_ksettings(ide_drive_t *drive, int arg) |
271 | { | 271 | { |
272 | if (arg < 0 || arg > 1) | 272 | if (arg < 0 || arg > 1) |
273 | return -EINVAL; | 273 | return -EINVAL; |
274 | 274 | ||
275 | drive->keep_settings = arg; | 275 | if (arg) |
276 | drive->dev_flags |= IDE_DFLAG_KEEP_SETTINGS; | ||
277 | else | ||
278 | drive->dev_flags &= ~IDE_DFLAG_KEEP_SETTINGS; | ||
276 | 279 | ||
277 | return 0; | 280 | return 0; |
278 | } | 281 | } |
279 | 282 | ||
280 | ide_devset_get(using_dma, using_dma); | 283 | ide_devset_get_flag(using_dma, IDE_DFLAG_USING_DMA); |
281 | 284 | ||
282 | static int set_using_dma(ide_drive_t *drive, int arg) | 285 | static int set_using_dma(ide_drive_t *drive, int arg) |
283 | { | 286 | { |
@@ -339,17 +342,20 @@ static int set_pio_mode(ide_drive_t *drive, int arg) | |||
339 | return 0; | 342 | return 0; |
340 | } | 343 | } |
341 | 344 | ||
342 | ide_devset_get(unmaskirq, unmask); | 345 | ide_devset_get_flag(unmaskirq, IDE_DFLAG_UNMASK); |
343 | 346 | ||
344 | static int set_unmaskirq(ide_drive_t *drive, int arg) | 347 | static int set_unmaskirq(ide_drive_t *drive, int arg) |
345 | { | 348 | { |
346 | if (drive->no_unmask) | 349 | if (drive->dev_flags & IDE_DFLAG_NO_UNMASK) |
347 | return -EPERM; | 350 | return -EPERM; |
348 | 351 | ||
349 | if (arg < 0 || arg > 1) | 352 | if (arg < 0 || arg > 1) |
350 | return -EINVAL; | 353 | return -EINVAL; |
351 | 354 | ||
352 | drive->unmask = arg; | 355 | if (arg) |
356 | drive->dev_flags |= IDE_DFLAG_UNMASK; | ||
357 | else | ||
358 | drive->dev_flags &= ~IDE_DFLAG_UNMASK; | ||
353 | 359 | ||
354 | return 0; | 360 | return 0; |
355 | } | 361 | } |
@@ -713,16 +719,16 @@ static void ide_dev_apply_params(ide_drive_t *drive) | |||
713 | 719 | ||
714 | if (ide_nodma & (1 << i)) { | 720 | if (ide_nodma & (1 << i)) { |
715 | printk(KERN_INFO "ide: disallowing DMA for %s\n", drive->name); | 721 | printk(KERN_INFO "ide: disallowing DMA for %s\n", drive->name); |
716 | drive->nodma = 1; | 722 | drive->dev_flags |= IDE_DFLAG_NODMA; |
717 | } | 723 | } |
718 | if (ide_noflush & (1 << i)) { | 724 | if (ide_noflush & (1 << i)) { |
719 | printk(KERN_INFO "ide: disabling flush requests for %s\n", | 725 | printk(KERN_INFO "ide: disabling flush requests for %s\n", |
720 | drive->name); | 726 | drive->name); |
721 | drive->noflush = 1; | 727 | drive->dev_flags |= IDE_DFLAG_NOFLUSH; |
722 | } | 728 | } |
723 | if (ide_noprobe & (1 << i)) { | 729 | if (ide_noprobe & (1 << i)) { |
724 | printk(KERN_INFO "ide: skipping probe for %s\n", drive->name); | 730 | printk(KERN_INFO "ide: skipping probe for %s\n", drive->name); |
725 | drive->noprobe = 1; | 731 | drive->dev_flags |= IDE_DFLAG_NOPROBE; |
726 | } | 732 | } |
727 | if (ide_nowerr & (1 << i)) { | 733 | if (ide_nowerr & (1 << i)) { |
728 | printk(KERN_INFO "ide: ignoring the ATA_DF bit for %s\n", | 734 | printk(KERN_INFO "ide: ignoring the ATA_DF bit for %s\n", |
@@ -731,7 +737,7 @@ static void ide_dev_apply_params(ide_drive_t *drive) | |||
731 | } | 737 | } |
732 | if (ide_cdroms & (1 << i)) { | 738 | if (ide_cdroms & (1 << i)) { |
733 | printk(KERN_INFO "ide: forcing %s as a CD-ROM\n", drive->name); | 739 | printk(KERN_INFO "ide: forcing %s as a CD-ROM\n", drive->name); |
734 | drive->present = 1; | 740 | drive->dev_flags |= IDE_DFLAG_PRESENT; |
735 | drive->media = ide_cdrom; | 741 | drive->media = ide_cdrom; |
736 | /* an ATAPI device ignores DRDY */ | 742 | /* an ATAPI device ignores DRDY */ |
737 | drive->ready_stat = 0; | 743 | drive->ready_stat = 0; |
@@ -740,11 +746,12 @@ static void ide_dev_apply_params(ide_drive_t *drive) | |||
740 | drive->cyl = drive->bios_cyl = ide_disks_chs[i].cyl; | 746 | drive->cyl = drive->bios_cyl = ide_disks_chs[i].cyl; |
741 | drive->head = drive->bios_head = ide_disks_chs[i].head; | 747 | drive->head = drive->bios_head = ide_disks_chs[i].head; |
742 | drive->sect = drive->bios_sect = ide_disks_chs[i].sect; | 748 | drive->sect = drive->bios_sect = ide_disks_chs[i].sect; |
743 | drive->forced_geom = 1; | 749 | |
744 | printk(KERN_INFO "ide: forcing %s as a disk (%d/%d/%d)\n", | 750 | printk(KERN_INFO "ide: forcing %s as a disk (%d/%d/%d)\n", |
745 | drive->name, | 751 | drive->name, |
746 | drive->cyl, drive->head, drive->sect); | 752 | drive->cyl, drive->head, drive->sect); |
747 | drive->present = 1; | 753 | |
754 | drive->dev_flags |= IDE_DFLAG_FORCED_GEOM | IDE_DFLAG_PRESENT; | ||
748 | drive->media = ide_disk; | 755 | drive->media = ide_disk; |
749 | drive->ready_stat = ATA_DRDY; | 756 | drive->ready_stat = ATA_DRDY; |
750 | } | 757 | } |
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 5123ea291d07..c7e5c2246b79 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c | |||
@@ -120,7 +120,8 @@ static void ht6560b_selectproc (ide_drive_t *drive) | |||
120 | * Need to enforce prefetch sometimes because otherwise | 120 | * Need to enforce prefetch sometimes because otherwise |
121 | * it'll hang (hard). | 121 | * it'll hang (hard). |
122 | */ | 122 | */ |
123 | if (drive->media != ide_disk || !drive->present) | 123 | if (drive->media != ide_disk || |
124 | (drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | ||
124 | select |= HT_PREFETCH_MODE; | 125 | select |= HT_PREFETCH_MODE; |
125 | 126 | ||
126 | if (select != current_select || timing != current_timing) { | 127 | if (select != current_select || timing != current_timing) { |
@@ -249,11 +250,11 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state) | |||
249 | */ | 250 | */ |
250 | if (state) { | 251 | if (state) { |
251 | drive->drive_data |= t; /* enable prefetch mode */ | 252 | drive->drive_data |= t; /* enable prefetch mode */ |
252 | drive->no_unmask = 1; | 253 | drive->dev_flags |= IDE_DFLAG_NO_UNMASK; |
253 | drive->unmask = 0; | 254 | drive->dev_flags &= ~IDE_DFLAG_UNMASK; |
254 | } else { | 255 | } else { |
255 | drive->drive_data &= ~t; /* disable prefetch mode */ | 256 | drive->drive_data &= ~t; /* disable prefetch mode */ |
256 | drive->no_unmask = 0; | 257 | drive->dev_flags &= ~IDE_DFLAG_NO_UNMASK; |
257 | } | 258 | } |
258 | 259 | ||
259 | spin_unlock_irqrestore(&ht6560b_lock, flags); | 260 | spin_unlock_irqrestore(&ht6560b_lock, flags); |
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 824471f91bf5..7dbc692c84c3 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -92,7 +92,7 @@ static void amd_set_drive(ide_drive_t *drive, const u8 speed) | |||
92 | 92 | ||
93 | ide_timing_compute(drive, speed, &t, T, UT); | 93 | ide_timing_compute(drive, speed, &t, T, UT); |
94 | 94 | ||
95 | if (peer->present) { | 95 | if (peer->dev_flags & IDE_DFLAG_PRESENT) { |
96 | ide_timing_compute(peer, peer->current_speed, &p, T, UT); | 96 | ide_timing_compute(peer, peer->current_speed, &p, T, UT); |
97 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); | 97 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); |
98 | } | 98 | } |
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 7f39cdb41410..d3afdffcb07a 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -378,13 +378,13 @@ static void __set_prefetch_mode(ide_drive_t *drive, int mode) | |||
378 | { | 378 | { |
379 | if (mode) { /* want prefetch on? */ | 379 | if (mode) { /* want prefetch on? */ |
380 | #if CMD640_PREFETCH_MASKS | 380 | #if CMD640_PREFETCH_MASKS |
381 | drive->no_unmask = 1; | 381 | drive->dev_flags |= IDE_DFLAG_NO_UNMASK; |
382 | drive->unmask = 0; | 382 | drive->dev_flags &= ~IDE_DFLAG_UNMASK; |
383 | #endif | 383 | #endif |
384 | drive->no_io_32bit = 0; | 384 | drive->dev_flags &= ~IDE_DFLAG_NO_IO_32BIT; |
385 | } else { | 385 | } else { |
386 | drive->no_unmask = 0; | 386 | drive->dev_flags &= ~IDE_DFLAG_NO_UNMASK; |
387 | drive->no_io_32bit = 1; | 387 | drive->dev_flags |= IDE_DFLAG_NO_IO_32BIT; |
388 | drive->io_32bit = 0; | 388 | drive->io_32bit = 0; |
389 | } | 389 | } |
390 | } | 390 | } |
@@ -471,7 +471,7 @@ static void program_drive_counts(ide_drive_t *drive, unsigned int index) | |||
471 | ide_drive_t *peer = &hwif->drives[!drive->select.b.unit]; | 471 | ide_drive_t *peer = &hwif->drives[!drive->select.b.unit]; |
472 | unsigned int mate = index ^ 1; | 472 | unsigned int mate = index ^ 1; |
473 | 473 | ||
474 | if (peer->present) { | 474 | if (peer->dev_flags & IDE_DFLAG_PRESENT) { |
475 | if (setup_count < setup_counts[mate]) | 475 | if (setup_count < setup_counts[mate]) |
476 | setup_count = setup_counts[mate]; | 476 | setup_count = setup_counts[mate]; |
477 | if (active_count < active_counts[mate]) | 477 | if (active_count < active_counts[mate]) |
@@ -626,7 +626,7 @@ static void cmd640_init_dev(ide_drive_t *drive) | |||
626 | */ | 626 | */ |
627 | check_prefetch(drive, i); | 627 | check_prefetch(drive, i); |
628 | printk(KERN_INFO DRV_NAME ": drive%d timings/prefetch(%s) preserved\n", | 628 | printk(KERN_INFO DRV_NAME ": drive%d timings/prefetch(%s) preserved\n", |
629 | i, drive->no_io_32bit ? "off" : "on"); | 629 | i, (drive->dev_flags & IDE_DFLAG_NO_IO_32BIT) ? "off" : "on"); |
630 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 630 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
631 | } | 631 | } |
632 | 632 | ||
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 46edd083b348..b761015ee190 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -454,7 +454,7 @@ static void it821x_quirkproc(ide_drive_t *drive) | |||
454 | * IRQ mask as we may well be in PIO (eg rev 0x10) | 454 | * IRQ mask as we may well be in PIO (eg rev 0x10) |
455 | * for now and we know unmasking is safe on this chipset. | 455 | * for now and we know unmasking is safe on this chipset. |
456 | */ | 456 | */ |
457 | drive->unmask = 1; | 457 | drive->dev_flags |= IDE_DFLAG_UNMASK; |
458 | } else { | 458 | } else { |
459 | /* | 459 | /* |
460 | * Perform fixups on smart mode. We need to "lose" some | 460 | * Perform fixups on smart mode. We need to "lose" some |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index 53bd645736d9..99e98e5e271c 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -137,7 +137,7 @@ static void __devinit superio_init_iops(struct hwif_s *hwif) | |||
137 | static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; | 137 | static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; |
138 | 138 | ||
139 | /* | 139 | /* |
140 | * This routine either enables/disables (according to drive->present) | 140 | * This routine either enables/disables (according to IDE_DFLAG_PRESENT) |
141 | * the IRQ associated with the port (HWIF(drive)), | 141 | * the IRQ associated with the port (HWIF(drive)), |
142 | * and selects either PIO or DMA handshaking for the next I/O operation. | 142 | * and selects either PIO or DMA handshaking for the next I/O operation. |
143 | */ | 143 | */ |
@@ -153,7 +153,11 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
153 | 153 | ||
154 | /* Adjust IRQ enable bit */ | 154 | /* Adjust IRQ enable bit */ |
155 | bit = 1 << (8 + hwif->channel); | 155 | bit = 1 << (8 + hwif->channel); |
156 | new = drive->present ? (new & ~bit) : (new | bit); | 156 | |
157 | if (drive->dev_flags & IDE_DFLAG_PRESENT) | ||
158 | new &= ~bit; | ||
159 | else | ||
160 | new |= bit; | ||
157 | 161 | ||
158 | /* Select PIO or DMA, DMA may only be selected for one drive/channel. */ | 162 | /* Select PIO or DMA, DMA may only be selected for one drive/channel. */ |
159 | bit = 1 << (20 + drive->select.b.unit + (hwif->channel << 1)); | 163 | bit = 1 << (20 + drive->select.b.unit + (hwif->channel << 1)); |
@@ -187,7 +191,8 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
187 | 191 | ||
188 | static void ns87415_selectproc (ide_drive_t *drive) | 192 | static void ns87415_selectproc (ide_drive_t *drive) |
189 | { | 193 | { |
190 | ns87415_prepare_drive (drive, drive->using_dma); | 194 | ns87415_prepare_drive(drive, |
195 | !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); | ||
191 | } | 196 | } |
192 | 197 | ||
193 | static int ns87415_dma_end(ide_drive_t *drive) | 198 | static int ns87415_dma_end(ide_drive_t *drive) |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index cb6d2a00c514..6d9240a9dcfa 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -168,7 +168,7 @@ static void pdc202xx_dma_start(ide_drive_t *drive) | |||
168 | { | 168 | { |
169 | if (drive->current_speed > XFER_UDMA_2) | 169 | if (drive->current_speed > XFER_UDMA_2) |
170 | pdc_old_enable_66MHz_clock(drive->hwif); | 170 | pdc_old_enable_66MHz_clock(drive->hwif); |
171 | if (drive->media != ide_disk || drive->addressing == 1) { | 171 | if (drive->media != ide_disk || (drive->dev_flags & IDE_DFLAG_LBA48)) { |
172 | struct request *rq = HWGROUP(drive)->rq; | 172 | struct request *rq = HWGROUP(drive)->rq; |
173 | ide_hwif_t *hwif = HWIF(drive); | 173 | ide_hwif_t *hwif = HWIF(drive); |
174 | unsigned long high_16 = hwif->extra_base - 16; | 174 | unsigned long high_16 = hwif->extra_base - 16; |
@@ -188,7 +188,7 @@ static void pdc202xx_dma_start(ide_drive_t *drive) | |||
188 | 188 | ||
189 | static int pdc202xx_dma_end(ide_drive_t *drive) | 189 | static int pdc202xx_dma_end(ide_drive_t *drive) |
190 | { | 190 | { |
191 | if (drive->media != ide_disk || drive->addressing == 1) { | 191 | if (drive->media != ide_disk || (drive->dev_flags & IDE_DFLAG_LBA48)) { |
192 | ide_hwif_t *hwif = HWIF(drive); | 192 | ide_hwif_t *hwif = HWIF(drive); |
193 | unsigned long high_16 = hwif->extra_base - 16; | 193 | unsigned long high_16 = hwif->extra_base - 16; |
194 | unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); | 194 | unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20); |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index bdc1fed41260..50405ed6f0cb 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -216,7 +216,8 @@ static void sc1200_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
216 | if (mode != -1) { | 216 | if (mode != -1) { |
217 | printk("SC1200: %s: changing (U)DMA mode\n", drive->name); | 217 | printk("SC1200: %s: changing (U)DMA mode\n", drive->name); |
218 | ide_dma_off_quietly(drive); | 218 | ide_dma_off_quietly(drive); |
219 | if (ide_set_dma_mode(drive, mode) == 0 && drive->using_dma) | 219 | if (ide_set_dma_mode(drive, mode) == 0 && |
220 | (drive->dev_flags & IDE_DFLAG_USING_DMA)) | ||
220 | hwif->dma_ops->dma_host_set(drive, 1); | 221 | hwif->dma_ops->dma_host_set(drive, 1); |
221 | return; | 222 | return; |
222 | } | 223 | } |
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 4dfbc6a68b5b..c12ffbb28748 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
@@ -161,7 +161,7 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /* enable IRQ if not probing */ | 163 | /* enable IRQ if not probing */ |
164 | if (drive->present) { | 164 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { |
165 | reg = inw(hwif->config_data + 3); | 165 | reg = inw(hwif->config_data + 3); |
166 | reg &= 0x13; | 166 | reg &= 0x13; |
167 | reg &= ~(1 << hwif->channel); | 167 | reg &= ~(1 << hwif->channel); |
@@ -173,7 +173,7 @@ static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma) | |||
173 | 173 | ||
174 | static void trm290_selectproc (ide_drive_t *drive) | 174 | static void trm290_selectproc (ide_drive_t *drive) |
175 | { | 175 | { |
176 | trm290_prepare_drive(drive, drive->using_dma); | 176 | trm290_prepare_drive(drive, !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); |
177 | } | 177 | } |
178 | 178 | ||
179 | static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) | 179 | static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index c3432da78d52..0a6d40cebe47 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -966,11 +966,11 @@ static void pmac_ide_init_dev(ide_drive_t *drive) | |||
966 | if (pmif->mediabay) { | 966 | if (pmif->mediabay) { |
967 | #ifdef CONFIG_PMAC_MEDIABAY | 967 | #ifdef CONFIG_PMAC_MEDIABAY |
968 | if (check_media_bay_by_base(pmif->regbase, MB_CD) == 0) { | 968 | if (check_media_bay_by_base(pmif->regbase, MB_CD) == 0) { |
969 | drive->noprobe = 0; | 969 | drive->dev_flags &= ~IDE_DFLAG_NOPROBE; |
970 | return; | 970 | return; |
971 | } | 971 | } |
972 | #endif | 972 | #endif |
973 | drive->noprobe = 1; | 973 | drive->dev_flags |= IDE_DFLAG_NOPROBE; |
974 | } | 974 | } |
975 | } | 975 | } |
976 | 976 | ||
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 7d3d03f98914..67e9ed95f669 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -331,7 +331,8 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r | |||
331 | if (blk_sense_request(rq) || blk_special_request(rq)) { | 331 | if (blk_sense_request(rq) || blk_special_request(rq)) { |
332 | struct ide_atapi_pc *pc = (struct ide_atapi_pc *)rq->special; | 332 | struct ide_atapi_pc *pc = (struct ide_atapi_pc *)rq->special; |
333 | 333 | ||
334 | if (drive->using_dma && !idescsi_map_sg(drive, pc)) | 334 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) && |
335 | idescsi_map_sg(drive, pc) == 0) | ||
335 | pc->flags |= PC_FLAG_DMA_OK; | 336 | pc->flags |= PC_FLAG_DMA_OK; |
336 | 337 | ||
337 | return idescsi_issue_pc(drive, pc); | 338 | return idescsi_issue_pc(drive, pc); |
@@ -415,7 +416,7 @@ static void ide_scsi_remove(ide_drive_t *drive) | |||
415 | 416 | ||
416 | ide_scsi_put(scsi); | 417 | ide_scsi_put(scsi); |
417 | 418 | ||
418 | drive->scsi = 0; | 419 | drive->dev_flags &= ~IDE_DFLAG_SCSI; |
419 | } | 420 | } |
420 | 421 | ||
421 | static int ide_scsi_probe(ide_drive_t *); | 422 | static int ide_scsi_probe(ide_drive_t *); |
@@ -767,7 +768,7 @@ static int ide_scsi_probe(ide_drive_t *drive) | |||
767 | !(host = scsi_host_alloc(&idescsi_template,sizeof(idescsi_scsi_t)))) | 768 | !(host = scsi_host_alloc(&idescsi_template,sizeof(idescsi_scsi_t)))) |
768 | return -ENODEV; | 769 | return -ENODEV; |
769 | 770 | ||
770 | drive->scsi = 1; | 771 | drive->dev_flags |= IDE_DFLAG_SCSI; |
771 | 772 | ||
772 | g = alloc_disk(1 << PARTN_BITS); | 773 | g = alloc_disk(1 << PARTN_BITS); |
773 | if (!g) | 774 | if (!g) |
@@ -808,7 +809,7 @@ static int ide_scsi_probe(ide_drive_t *drive) | |||
808 | 809 | ||
809 | put_disk(g); | 810 | put_disk(g); |
810 | out_host_put: | 811 | out_host_put: |
811 | drive->scsi = 0; | 812 | drive->dev_flags &= ~IDE_DFLAG_SCSI; |
812 | scsi_host_put(host); | 813 | scsi_host_put(host); |
813 | return err; | 814 | return err; |
814 | } | 815 | } |