[ide] fix drive->ready_stat for ATAPI

ATAPI devices ignore DRDY bit so drive->ready_stat must be set to zero.
It is currently done by device drivers (including ide-default fake driver)
but for PMAC driver it is too late as wait_for_ready() may be called during
probe: probe_hwif()->pmac_ide_dma_check()->pmac_ide_{mdma,udma}_enable()->
->pmac_ide_do_setfeature()->wait_for_ready().

Fixup drive->ready_stat just after detecting ATAPI device.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent dc282020
......@@ -3088,7 +3088,6 @@ int ide_cdrom_setup (ide_drive_t *drive)
drive->queue->unplug_delay = 1;
drive->special.all = 0;
drive->ready_stat = 0;
CDROM_STATE_FLAGS(drive)->media_changed = 1;
CDROM_STATE_FLAGS(drive)->toc_valid = 0;
......
......@@ -57,13 +57,6 @@ static int idedefault_attach (ide_drive_t *drive)
"driver with ide.c\n", drive->name);
return 1;
}
/* For the sake of the request layer, we must make sure we have a
* correct ready_stat value, that is 0 for ATAPI devices or we will
* fail any request like Power Management
*/
if (drive->media != ide_disk)
drive->ready_stat = 0;
return 0;
}
......
......@@ -1793,7 +1793,6 @@ static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy)
*((u16 *) &gcw) = drive->id->config;
drive->driver_data = floppy;
drive->ready_stat = 0;
memset(floppy, 0, sizeof(idefloppy_floppy_t));
floppy->drive = drive;
floppy->pc = floppy->pc_stack;
......
......@@ -221,6 +221,8 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
}
printk (" drive\n");
drive->media = type;
/* an ATAPI device ignores DRDY */
drive->ready_stat = 0;
return;
}
......
......@@ -4537,8 +4537,6 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor)
memset(tape, 0, sizeof (idetape_tape_t));
spin_lock_init(&tape->spinlock);
drive->driver_data = tape;
/* An ATAPI device ignores DRDY */
drive->ready_stat = 0;
drive->dsc_overlap = 1;
#ifdef CONFIG_BLK_DEV_IDEPCI
if (HWIF(drive)->pci_dev != NULL) {
......
......@@ -1751,6 +1751,8 @@ static int __init ide_setup(char *s)
case -4: /* "cdrom" */
drive->present = 1;
drive->media = ide_cdrom;
/* an ATAPI device ignores DRDY */
drive->ready_stat = 0;
hwif->noprobe = 0;
goto done;
case -5: /* "serialize" */
......@@ -1777,6 +1779,7 @@ static int __init ide_setup(char *s)
goto done;
case 3: /* cyl,head,sect */
drive->media = ide_disk;
drive->ready_stat = READY_STAT;
drive->cyl = drive->bios_cyl = vals[0];
drive->head = drive->bios_head = vals[1];
drive->sect = drive->bios_sect = vals[2];
......
......@@ -679,7 +679,6 @@ static void idescsi_add_settings(ide_drive_t *drive)
static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
{
DRIVER(drive)->busy++;
drive->ready_stat = 0;
if (drive->id && (drive->id->config & 0x0060) == 0x20)
set_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags);
set_bit(IDESCSI_TRANSFORM, &scsi->transform);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment