Commit 6e7c72aa authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.19 IDE 82

 - PPC compilation fix by Paul Mackerras.

 - Various fixes by Bartek:

   fix ata_irq_enable() and ata_reset() for legacy ATA-1 devices

   in start_request() for REQ_DRIVE_ACB
   a) don't run ->prehandler() twice
   b) return ata_taskfile() value
parent 08446d85
...@@ -105,11 +105,12 @@ int ata_irq_enable(struct ata_device *drive, int on) ...@@ -105,11 +105,12 @@ int ata_irq_enable(struct ata_device *drive, int on)
if (!ch->io_ports[IDE_CONTROL_OFFSET]) if (!ch->io_ports[IDE_CONTROL_OFFSET])
return 0; return 0;
/* 0x08 is for legacy ATA-1 devices */
if (on) if (on)
OUT_BYTE(0x00, ch->io_ports[IDE_CONTROL_OFFSET]); OUT_BYTE(0x08 | 0x00, ch->io_ports[IDE_CONTROL_OFFSET]);
else { else {
if (!ch->intrproc) if (!ch->intrproc)
OUT_BYTE(0x02, ch->io_ports[IDE_CONTROL_OFFSET]); OUT_BYTE(0x08 | 0x02, ch->io_ports[IDE_CONTROL_OFFSET]);
else else
ch->intrproc(drive); ch->intrproc(drive);
} }
...@@ -131,9 +132,11 @@ void ata_reset(struct ata_channel *ch) ...@@ -131,9 +132,11 @@ void ata_reset(struct ata_channel *ch)
return; return;
printk("%s: reset\n", ch->name); printk("%s: reset\n", ch->name);
OUT_BYTE(0x04, ch->io_ports[IDE_CONTROL_OFFSET]); /* 0x08 is for legacy ATA-1 devices */
OUT_BYTE(0x08 | 0x04, ch->io_ports[IDE_CONTROL_OFFSET]);
udelay(10); udelay(10);
OUT_BYTE(0x00, ch->io_ports[IDE_CONTROL_OFFSET]); /* 0x08 is for legacy ATA-1 devices */
OUT_BYTE(0x08 | 0x00, ch->io_ports[IDE_CONTROL_OFFSET]);
do { do {
mdelay(50); mdelay(50);
stat = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]); stat = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
......
...@@ -431,7 +431,7 @@ pmac_ide_do_setfeature(struct ata_device *drive, u8 command) ...@@ -431,7 +431,7 @@ pmac_ide_do_setfeature(struct ata_device *drive, u8 command)
goto out; goto out;
} }
udelay(10); udelay(10);
ata_irq_enale(drive, 0); ata_irq_enable(drive, 0);
OUT_BYTE(command, IDE_NSECTOR_REG); OUT_BYTE(command, IDE_NSECTOR_REG);
OUT_BYTE(SETFEATURES_XFER, IDE_FEATURE_REG); OUT_BYTE(SETFEATURES_XFER, IDE_FEATURE_REG);
OUT_BYTE(WIN_SETFEATURES, IDE_COMMAND_REG); OUT_BYTE(WIN_SETFEATURES, IDE_COMMAND_REG);
...@@ -1577,9 +1577,9 @@ idepmac_wake_device(struct ata_device *drive, int used_dma) ...@@ -1577,9 +1577,9 @@ idepmac_wake_device(struct ata_device *drive, int used_dma)
*/ */
if (used_dma && !ide_spin_wait_hwgroup(drive)) { if (used_dma && !ide_spin_wait_hwgroup(drive)) {
/* Lock HW group */ /* Lock HW group */
set_bit(IDE_BUSY, &drive->channel->active); set_bit(IDE_BUSY, drive->channel->active);
pmac_ide_check_dma(drive); pmac_ide_check_dma(drive);
clear_bit(IDE_BUSY, &drive->channel->active); clear_bit(IDE_BUSY, drive->channel->active);
spin_unlock_irq(drive->channel->lock); spin_unlock_irq(drive->channel->lock);
} }
#endif #endif
...@@ -1626,7 +1626,7 @@ idepmac_sleep_drive(struct ata_device *drive, int idx, unsigned long base) ...@@ -1626,7 +1626,7 @@ idepmac_sleep_drive(struct ata_device *drive, int idx, unsigned long base)
return; return;
else { else {
/* Lock HW group */ /* Lock HW group */
set_bit(IDE_BUSY, &drive->channel->active); set_bit(IDE_BUSY, drive->channel->active);
/* Stop the device */ /* Stop the device */
idepmac_sleep_device(drive, idx, base); idepmac_sleep_device(drive, idx, base);
spin_unlock_irq(drive->channel->lock); spin_unlock_irq(drive->channel->lock);
...@@ -1656,7 +1656,7 @@ idepmac_wake_drive(struct ata_device *drive, unsigned long base) ...@@ -1656,7 +1656,7 @@ idepmac_wake_drive(struct ata_device *drive, unsigned long base)
/* We resume processing on the lock group */ /* We resume processing on the lock group */
spin_lock_irq(drive->channel->lock); spin_lock_irq(drive->channel->lock);
clear_bit(IDE_BUSY, &drive->channel->active); clear_bit(IDE_BUSY, drive->channel->active);
if (!list_empty(&drive->queue.queue_head)) if (!list_empty(&drive->queue.queue_head))
do_ide_request(&drive->queue); do_ide_request(&drive->queue);
spin_unlock_irq(drive->channel->lock); spin_unlock_irq(drive->channel->lock);
......
...@@ -754,14 +754,7 @@ static ide_startstop_t start_request(struct ata_device *drive, struct request *r ...@@ -754,14 +754,7 @@ static ide_startstop_t start_request(struct ata_device *drive, struct request *r
if (!(ar)) if (!(ar))
goto args_error; goto args_error;
ata_taskfile(drive, ar, NULL); return ata_taskfile(drive, ar, NULL);
if (((ar->command_type == IDE_DRIVE_TASK_RAW_WRITE) ||
(ar->command_type == IDE_DRIVE_TASK_OUT)) &&
ar->prehandler && ar->handler)
return ar->prehandler(drive, rq);
return ide_started;
} }
/* The normal way of execution is to pass and execute the request /* The normal way of execution is to pass and execute the request
......
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