Commit 938f5b72 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.15 IDE 61

- Fix typo in pdc202xx driver.

- Fix locking order in ioctl.

- Fix wrong time_after usage introduced in 60. Maybe the fact I always get is
   wrong is related to the fact that I'm using the mouse with the left hand!?

- Apply arch-clean-2 by Bartlomiej Zolnierkiewicz.

- Don't disable interrupts during ide_wait_stat(). I see no reason too.

- Push flags down from hwgroup to the ata_chaannel structure.

- Apply small fixes from Franz Sirl to make AEC6280 working properly again.
parent 33f18d46
...@@ -1058,6 +1058,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f ...@@ -1058,6 +1058,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
if (put_user(val, (unsigned long *) arg)) if (put_user(val, (unsigned long *) arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -1081,6 +1082,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f ...@@ -1081,6 +1082,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
if (put_user(val, (unsigned long *) arg)) if (put_user(val, (unsigned long *) arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -1100,7 +1102,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f ...@@ -1100,7 +1102,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
} }
case HDIO_GET_ACOUSTIC: { case HDIO_GET_ACOUSTIC: {
u8 val = drive->acoustic; unsigned long val = drive->acoustic;
if (put_user(val, (u8 *) arg)) if (put_user(val, (u8 *) arg))
return -EFAULT; return -EFAULT;
...@@ -1128,6 +1130,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f ...@@ -1128,6 +1130,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
if (put_user(val, (u8 *) arg)) if (put_user(val, (u8 *) arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -1153,7 +1156,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f ...@@ -1153,7 +1156,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
/* /*
* IDE subdriver functions, registered with ide.c * Subdriver functions.
*/ */
static struct ata_operations idedisk_driver = { static struct ata_operations idedisk_driver = {
owner: THIS_MODULE, owner: THIS_MODULE,
...@@ -1178,11 +1181,9 @@ static void __exit idedisk_exit (void) ...@@ -1178,11 +1181,9 @@ static void __exit idedisk_exit (void)
while ((drive = ide_scan_devices(ATA_DISK, "ide-disk", &idedisk_driver, failed)) != NULL) { while ((drive = ide_scan_devices(ATA_DISK, "ide-disk", &idedisk_driver, failed)) != NULL) {
if (idedisk_cleanup (drive)) { if (idedisk_cleanup (drive)) {
printk (KERN_ERR "%s: cleanup_module() called while still busy\n", drive->name); printk(KERN_ERR "%s: cleanup_module() called while still busy\n", drive->name);
failed++; ++failed;
} }
/* We must remove proc entries defined in this module.
Otherwise we oops while accessing these entries */
} }
} }
...@@ -1203,10 +1204,11 @@ int idedisk_init(void) ...@@ -1203,10 +1204,11 @@ int idedisk_init(void)
idedisk_cleanup(drive); idedisk_cleanup(drive);
continue; continue;
} }
failed--; --failed;
} }
revalidate_drives(); revalidate_drives();
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return 0; return 0;
} }
......
...@@ -382,10 +382,10 @@ static int dma_timer_expiry(struct ata_device *drive, struct request *rq) ...@@ -382,10 +382,10 @@ static int dma_timer_expiry(struct ata_device *drive, struct request *rq)
#ifdef DEBUG #ifdef DEBUG
printk("%s: dma_timer_expiry: dma status == 0x%02x\n", drive->name, dma_stat); printk("%s: dma_timer_expiry: dma status == 0x%02x\n", drive->name, dma_stat);
#endif /* DEBUG */ #endif
#if 0 #if 0
HWGROUP(drive)->expiry = NULL; /* one free ride for now */ drive->expiry = NULL; /* one free ride for now */
#endif #endif
if (dma_stat & 2) { /* ERROR */ if (dma_stat & 2) { /* ERROR */
......
...@@ -122,7 +122,7 @@ static struct ata_channel __init *lookup_channel(unsigned long io_base, int boot ...@@ -122,7 +122,7 @@ static struct ata_channel __init *lookup_channel(unsigned long io_base, int boot
* Unless there is a bootable card that does not use the standard * Unless there is a bootable card that does not use the standard
* ports 1f0/170 (the ide0/ide1 defaults). The (bootable) flag. * ports 1f0/170 (the ide0/ide1 defaults). The (bootable) flag.
*/ */
if (bootable) { if (bootable == ON_BOARD) {
for (h = 0; h < MAX_HWIFS; ++h) { for (h = 0; h < MAX_HWIFS; ++h) {
hwif = &ide_hwifs[h]; hwif = &ide_hwifs[h];
if (hwif->chipset == ide_unknown) if (hwif->chipset == ide_unknown)
...@@ -703,7 +703,7 @@ static void __init scan_pcidev(struct pci_dev *dev) ...@@ -703,7 +703,7 @@ static void __init scan_pcidev(struct pci_dev *dev)
hpt374_device_order_fixup(dev, d); hpt374_device_order_fixup(dev, d);
} else if (d->vendor == PCI_VENDOR_ID_PROMISE && d->device == PCI_DEVICE_ID_PROMISE_20268R) } else if (d->vendor == PCI_VENDOR_ID_PROMISE && d->device == PCI_DEVICE_ID_PROMISE_20268R)
pdc20270_device_order_fixup(dev, d); pdc20270_device_order_fixup(dev, d);
else if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) { else {
printk(KERN_INFO "ATA: %s (%04x:%04x) on PCI slot %s\n", printk(KERN_INFO "ATA: %s (%04x:%04x) on PCI slot %s\n",
dev->name, vendor, device, dev->slot_name); dev->name, vendor, device, dev->slot_name);
setup_pci_device(dev, d); setup_pci_device(dev, d);
......
...@@ -279,6 +279,7 @@ int drive_is_ready(struct ata_device *drive) ...@@ -279,6 +279,7 @@ int drive_is_ready(struct ata_device *drive)
if (stat & BUSY_STAT) if (stat & BUSY_STAT)
return 0; /* drive busy: definitely not interrupting */ return 0; /* drive busy: definitely not interrupting */
return 1; /* drive ready: *might* be interrupting */ return 1; /* drive ready: *might* be interrupting */
} }
......
...@@ -317,7 +317,7 @@ int __ide_end_request(struct ata_device *drive, struct request *rq, int uptodate ...@@ -317,7 +317,7 @@ int __ide_end_request(struct ata_device *drive, struct request *rq, int uptodate
blkdev_dequeue_request(rq); blkdev_dequeue_request(rq);
else else
blk_queue_end_tag(&drive->queue, rq); blk_queue_end_tag(&drive->queue, rq);
HWGROUP(drive)->rq = NULL; drive->rq = NULL;
end_that_request_last(rq); end_that_request_last(rq);
ret = 0; ret = 0;
} }
...@@ -635,7 +635,7 @@ void ide_end_drive_cmd(struct ata_device *drive, struct request *rq, u8 stat, u8 ...@@ -635,7 +635,7 @@ void ide_end_drive_cmd(struct ata_device *drive, struct request *rq, u8 stat, u8
} }
blkdev_dequeue_request(rq); blkdev_dequeue_request(rq);
HWGROUP(drive)->rq = NULL; drive->rq = NULL;
end_that_request_last(rq); end_that_request_last(rq);
} }
...@@ -886,7 +886,6 @@ int ide_wait_stat(ide_startstop_t *startstop, ...@@ -886,7 +886,6 @@ int ide_wait_stat(ide_startstop_t *startstop,
{ {
u8 stat; u8 stat;
int i; int i;
unsigned long flags;
/* bail early if we've exceeded max_failures */ /* bail early if we've exceeded max_failures */
if (drive->max_failures && (drive->failures > drive->max_failures)) { if (drive->max_failures && (drive->failures > drive->max_failures)) {
...@@ -896,24 +895,20 @@ int ide_wait_stat(ide_startstop_t *startstop, ...@@ -896,24 +895,20 @@ int ide_wait_stat(ide_startstop_t *startstop,
udelay(1); /* spec allows drive 400ns to assert "BUSY" */ udelay(1); /* spec allows drive 400ns to assert "BUSY" */
if ((stat = GET_STAT()) & BUSY_STAT) { if ((stat = GET_STAT()) & BUSY_STAT) {
__save_flags(flags); /* local CPU only */
ide__sti(); /* local CPU only */
timeout += jiffies; timeout += jiffies;
while ((stat = GET_STAT()) & BUSY_STAT) { while ((stat = GET_STAT()) & BUSY_STAT) {
if (time_after(timeout, jiffies)) { if (time_after(jiffies, timeout)) {
__restore_flags(flags); /* local CPU only */
*startstop = ide_error(drive, rq, "status timeout", stat); *startstop = ide_error(drive, rq, "status timeout", stat);
return 1; return 1;
} }
} }
__restore_flags(flags); /* local CPU only */
} }
/* /*
* Allow status to settle, then read it again. * Allow status to settle, then read it again. A few rare drives
* A few rare drives vastly violate the 400ns spec here, * vastly violate the 400ns spec here, so we'll wait up to 10usec for a
* so we'll wait up to 10usec for a "good" status * "good" status rather than expensively fail things immediately. This
* rather than expensively fail things immediately. * fix courtesy of Matthew Faupel & Niccolo Rigacci.
* This fix courtesy of Matthew Faupel & Niccolo Rigacci.
*/ */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
udelay(1); udelay(1);
...@@ -1074,15 +1069,13 @@ ide_startstop_t restart_request(struct ata_device *drive) ...@@ -1074,15 +1069,13 @@ ide_startstop_t restart_request(struct ata_device *drive)
struct ata_channel *ch = drive->channel; struct ata_channel *ch = drive->channel;
ide_hwgroup_t *hwgroup = ch->hwgroup; ide_hwgroup_t *hwgroup = ch->hwgroup;
unsigned long flags; unsigned long flags;
struct request *rq;
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
hwgroup->handler = NULL; hwgroup->handler = NULL;
del_timer(&ch->timer); del_timer(&ch->timer);
rq = hwgroup->rq;
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return start_request(drive, rq); return start_request(drive, drive->rq);
} }
/* /*
...@@ -1180,7 +1173,6 @@ static struct ata_device *choose_urgent_device(struct ata_channel *channel) ...@@ -1180,7 +1173,6 @@ static struct ata_device *choose_urgent_device(struct ata_channel *channel)
if (choice) if (choice)
return choice; return choice;
channel->hwgroup->rq = NULL;
sleep = longest_sleep(channel); sleep = longest_sleep(channel);
if (sleep) { if (sleep) {
...@@ -1197,14 +1189,14 @@ static struct ata_device *choose_urgent_device(struct ata_channel *channel) ...@@ -1197,14 +1189,14 @@ static struct ata_device *choose_urgent_device(struct ata_channel *channel)
if (timer_pending(&channel->timer)) if (timer_pending(&channel->timer))
printk(KERN_ERR "ide_set_handler: timer already active\n"); printk(KERN_ERR "ide_set_handler: timer already active\n");
#endif #endif
set_bit(IDE_SLEEP, &channel->hwgroup->flags); set_bit(IDE_SLEEP, &channel->active);
mod_timer(&channel->timer, sleep); mod_timer(&channel->timer, sleep);
/* we purposely leave hwgroup busy while sleeping */ /* we purposely leave hwgroup busy while sleeping */
} else { } else {
/* Ugly, but how can we sleep for the lock otherwise? perhaps /* Ugly, but how can we sleep for the lock otherwise? perhaps
* from tq_disk? */ * from tq_disk? */
ide_release_lock(&irq_lock);/* for atari only */ ide_release_lock(&irq_lock);/* for atari only */
clear_bit(IDE_BUSY, &channel->hwgroup->flags); clear_bit(IDE_BUSY, &channel->active);
} }
return NULL; return NULL;
...@@ -1217,13 +1209,13 @@ static struct ata_device *choose_urgent_device(struct ata_channel *channel) ...@@ -1217,13 +1209,13 @@ static struct ata_device *choose_urgent_device(struct ata_channel *channel)
*/ */
static void queue_commands(struct ata_device *drive, int masked_irq) static void queue_commands(struct ata_device *drive, int masked_irq)
{ {
ide_hwgroup_t *hwgroup = drive->channel->hwgroup; struct ata_channel *ch = drive->channel;
ide_startstop_t startstop = -1; ide_startstop_t startstop = -1;
for (;;) { for (;;) {
struct request *rq = NULL; struct request *rq = NULL;
if (!test_bit(IDE_BUSY, &hwgroup->flags)) if (!test_bit(IDE_BUSY, &ch->active))
printk(KERN_ERR"%s: error: not busy while queueing!\n", drive->name); printk(KERN_ERR"%s: error: not busy while queueing!\n", drive->name);
/* Abort early if we can't queue another command. for non /* Abort early if we can't queue another command. for non
...@@ -1232,13 +1224,13 @@ static void queue_commands(struct ata_device *drive, int masked_irq) ...@@ -1232,13 +1224,13 @@ static void queue_commands(struct ata_device *drive, int masked_irq)
*/ */
if (!ata_can_queue(drive)) { if (!ata_can_queue(drive)) {
if (!ata_pending_commands(drive)) if (!ata_pending_commands(drive))
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &ch->active);
break; break;
} }
drive->sleep = 0; drive->sleep = 0;
if (test_bit(IDE_DMA, &hwgroup->flags)) { if (test_bit(IDE_DMA, &ch->active)) {
printk("ide_do_request: DMA in progress...\n"); printk("ide_do_request: DMA in progress...\n");
break; break;
} }
...@@ -1256,8 +1248,8 @@ static void queue_commands(struct ata_device *drive, int masked_irq) ...@@ -1256,8 +1248,8 @@ static void queue_commands(struct ata_device *drive, int masked_irq)
if (!(rq = elv_next_request(&drive->queue))) { if (!(rq = elv_next_request(&drive->queue))) {
if (!ata_pending_commands(drive)) if (!ata_pending_commands(drive))
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &ch->active);
hwgroup->rq = NULL; drive->rq = NULL;
break; break;
} }
...@@ -1268,7 +1260,7 @@ static void queue_commands(struct ata_device *drive, int masked_irq) ...@@ -1268,7 +1260,7 @@ static void queue_commands(struct ata_device *drive, int masked_irq)
if (!(rq->flags & REQ_CMD) && ata_pending_commands(drive)) if (!(rq->flags & REQ_CMD) && ata_pending_commands(drive))
break; break;
hwgroup->rq = rq; drive->rq = rq;
/* Some systems have trouble with IDE IRQs arriving while the /* Some systems have trouble with IDE IRQs arriving while the
* driver is still setting things up. So, here we disable the * driver is still setting things up. So, here we disable the
...@@ -1339,12 +1331,10 @@ static void queue_commands(struct ata_device *drive, int masked_irq) ...@@ -1339,12 +1331,10 @@ static void queue_commands(struct ata_device *drive, int masked_irq)
*/ */
static void ide_do_request(struct ata_channel *channel, int masked_irq) static void ide_do_request(struct ata_channel *channel, int masked_irq)
{ {
ide_hwgroup_t *hwgroup = channel->hwgroup;
ide_get_lock(&irq_lock, ata_irq_request, hwgroup);/* for atari only: POSSIBLY BROKEN HERE(?) */ ide_get_lock(&irq_lock, ata_irq_request, hwgroup);/* for atari only: POSSIBLY BROKEN HERE(?) */
__cli(); /* necessary paranoia: ensure IRQs are masked on local CPU */ __cli(); /* necessary paranoia: ensure IRQs are masked on local CPU */
while (!test_and_set_bit(IDE_BUSY, &hwgroup->flags)) { while (!test_and_set_bit(IDE_BUSY, &channel->active)) {
struct ata_channel *ch; struct ata_channel *ch;
struct ata_device *drive; struct ata_device *drive;
...@@ -1405,7 +1395,7 @@ static void dma_timeout_retry(struct ata_device *drive, struct request *rq) ...@@ -1405,7 +1395,7 @@ static void dma_timeout_retry(struct ata_device *drive, struct request *rq)
* un-busy drive etc (hwgroup->busy is cleared on return) and * un-busy drive etc (hwgroup->busy is cleared on return) and
* make sure request is sane * make sure request is sane
*/ */
HWGROUP(drive)->rq = NULL; drive->rq = NULL;
rq->errors = 0; rq->errors = 0;
if (rq->bio) { if (rq->bio) {
...@@ -1446,8 +1436,8 @@ void ide_timer_expiry(unsigned long data) ...@@ -1446,8 +1436,8 @@ void ide_timer_expiry(unsigned long data)
* complain about anything. * complain about anything.
*/ */
if (test_and_clear_bit(IDE_SLEEP, &hwgroup->flags)) if (test_and_clear_bit(IDE_SLEEP, &ch->active))
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &ch->active);
} else { } else {
struct ata_device *drive = ch->drive; struct ata_device *drive = ch->drive;
if (!drive) { if (!drive) {
...@@ -1457,11 +1447,11 @@ void ide_timer_expiry(unsigned long data) ...@@ -1457,11 +1447,11 @@ void ide_timer_expiry(unsigned long data)
ide_startstop_t startstop; ide_startstop_t startstop;
/* paranoia */ /* paranoia */
if (!test_and_set_bit(IDE_BUSY, &hwgroup->flags)) if (!test_and_set_bit(IDE_BUSY, &ch->active))
printk("%s: ide_timer_expiry: hwgroup was not busy??\n", drive->name); printk("%s: ide_timer_expiry: hwgroup was not busy??\n", drive->name);
if ((expiry = ch->expiry) != NULL) { if ((expiry = ch->expiry) != NULL) {
/* continue */ /* continue */
if ((wait = expiry(drive, HWGROUP(drive)->rq)) != 0) { if ((wait = expiry(drive, drive->rq)) != 0) {
/* reengage timer */ /* reengage timer */
ch->timer.expires = jiffies + wait; ch->timer.expires = jiffies + wait;
add_timer(&ch->timer); add_timer(&ch->timer);
...@@ -1484,25 +1474,25 @@ void ide_timer_expiry(unsigned long data) ...@@ -1484,25 +1474,25 @@ void ide_timer_expiry(unsigned long data)
#endif #endif
__cli(); /* local CPU only, as if we were handling an interrupt */ __cli(); /* local CPU only, as if we were handling an interrupt */
if (ch->poll_timeout != 0) { if (ch->poll_timeout != 0) {
startstop = handler(drive, ch->hwgroup->rq); startstop = handler(drive, drive->rq);
} else if (drive_is_ready(drive)) { } else if (drive_is_ready(drive)) {
if (drive->waiting_for_dma) if (drive->waiting_for_dma)
udma_irq_lost(drive); udma_irq_lost(drive);
(void) ide_ack_intr(ch); (void) ide_ack_intr(ch);
printk("%s: lost interrupt\n", drive->name); printk("%s: lost interrupt\n", drive->name);
startstop = handler(drive, ch->hwgroup->rq); startstop = handler(drive, drive->rq);
} else { } else {
if (drive->waiting_for_dma) { if (drive->waiting_for_dma) {
startstop = ide_stopped; startstop = ide_stopped;
dma_timeout_retry(drive, ch->hwgroup->rq); dma_timeout_retry(drive, drive->rq);
} else } else
startstop = ide_error(drive, ch->hwgroup->rq, "irq timeout", GET_STAT()); startstop = ide_error(drive, drive->rq, "irq timeout", GET_STAT());
} }
set_recovery_timer(ch); set_recovery_timer(ch);
enable_irq(ch->irq); enable_irq(ch->irq);
spin_lock_irq(&ide_lock); spin_lock_irq(&ide_lock);
if (startstop == ide_stopped) if (startstop == ide_stopped)
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &ch->active);
} }
} }
...@@ -1627,7 +1617,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs) ...@@ -1627,7 +1617,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
goto out_lock; goto out_lock;
} }
/* paranoia */ /* paranoia */
if (!test_and_set_bit(IDE_BUSY, &hwgroup->flags)) if (!test_and_set_bit(IDE_BUSY, &ch->active))
printk(KERN_ERR "%s: %s: hwgroup was not busy!?\n", drive->name, __FUNCTION__); printk(KERN_ERR "%s: %s: hwgroup was not busy!?\n", drive->name, __FUNCTION__);
hwgroup->handler = NULL; hwgroup->handler = NULL;
del_timer(&ch->timer); del_timer(&ch->timer);
...@@ -1637,7 +1627,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs) ...@@ -1637,7 +1627,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
ide__sti(); /* local CPU only */ ide__sti(); /* local CPU only */
/* service this interrupt, may set handler for next interrupt */ /* service this interrupt, may set handler for next interrupt */
startstop = handler(drive, hwgroup->rq); startstop = handler(drive, drive->rq);
spin_lock_irq(&ide_lock); spin_lock_irq(&ide_lock);
/* /*
...@@ -1650,7 +1640,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs) ...@@ -1650,7 +1640,7 @@ void ata_irq_request(int irq, void *data, struct pt_regs *regs)
set_recovery_timer(drive->channel); set_recovery_timer(drive->channel);
if (startstop == ide_stopped) { if (startstop == ide_stopped) {
if (hwgroup->handler == NULL) { /* paranoia */ if (hwgroup->handler == NULL) { /* paranoia */
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &ch->active);
ide_do_request(ch, ch->irq); ide_do_request(ch, ch->irq);
} else { } else {
printk("%s: %s: huh? expected NULL handler on exit\n", drive->name, __FUNCTION__); printk("%s: %s: huh? expected NULL handler on exit\n", drive->name, __FUNCTION__);
...@@ -1738,7 +1728,7 @@ int ide_do_drive_cmd(struct ata_device *drive, struct request *rq, ide_action_t ...@@ -1738,7 +1728,7 @@ int ide_do_drive_cmd(struct ata_device *drive, struct request *rq, ide_action_t
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if (blk_queue_empty(&drive->queue) || action == ide_preempt) { if (blk_queue_empty(&drive->queue) || action == ide_preempt) {
if (action == ide_preempt) if (action == ide_preempt)
HWGROUP(drive)->rq = NULL; drive->rq = NULL;
} else { } else {
if (action == ide_wait || action == ide_end) if (action == ide_wait || action == ide_end)
queue_head = queue_head->prev; queue_head = queue_head->prev;
...@@ -2222,8 +2212,6 @@ int ide_register(int arg1, int arg2, int irq) ...@@ -2222,8 +2212,6 @@ int ide_register(int arg1, int arg2, int irq)
int ide_spin_wait_hwgroup(struct ata_device *drive) int ide_spin_wait_hwgroup(struct ata_device *drive)
{ {
ide_hwgroup_t *hwgroup = HWGROUP(drive);
/* FIXME: Wait on a proper timer. Instead of playing games on the /* FIXME: Wait on a proper timer. Instead of playing games on the
* spin_lock(). * spin_lock().
*/ */
...@@ -2232,7 +2220,7 @@ int ide_spin_wait_hwgroup(struct ata_device *drive) ...@@ -2232,7 +2220,7 @@ int ide_spin_wait_hwgroup(struct ata_device *drive)
spin_lock_irq(&ide_lock); spin_lock_irq(&ide_lock);
while (test_bit(IDE_BUSY, &hwgroup->flags)) { while (test_bit(IDE_BUSY, &drive->channel->active)) {
spin_unlock_irq(&ide_lock); spin_unlock_irq(&ide_lock);
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
printk("%s: channel busy\n", drive->name); printk("%s: channel busy\n", drive->name);
...@@ -2316,7 +2304,9 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -2316,7 +2304,9 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
kdev_t dev; kdev_t dev;
dev = inode->i_rdev; dev = inode->i_rdev;
major = major(dev); minor = minor(dev); major = major(dev);
minor = minor(dev);
if ((drive = get_info_ptr(inode->i_rdev)) == NULL) if ((drive = get_info_ptr(inode->i_rdev)) == NULL)
return -ENODEV; return -ENODEV;
...@@ -2376,6 +2366,7 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -2376,6 +2366,7 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
if (put_user(val, (unsigned long *) arg)) if (put_user(val, (unsigned long *) arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -2384,12 +2375,12 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -2384,12 +2375,12 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
if (arg < 0 || arg > 1) if (arg < 0 || arg > 1)
return -EINVAL; return -EINVAL;
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
if (drive->channel->no_unmask) if (drive->channel->no_unmask)
return -EIO; return -EIO;
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
drive->channel->unmask = arg; drive->channel->unmask = arg;
spin_unlock_irq(&ide_lock); spin_unlock_irq(&ide_lock);
...@@ -2426,11 +2417,20 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -2426,11 +2417,20 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
if (!loc || (drive->type != ATA_DISK && drive->type != ATA_FLOPPY)) if (!loc || (drive->type != ATA_DISK && drive->type != ATA_FLOPPY))
return -EINVAL; return -EINVAL;
if (put_user(drive->bios_head, (byte *) &loc->heads)) return -EFAULT;
if (put_user(drive->bios_sect, (byte *) &loc->sectors)) return -EFAULT; if (put_user(drive->bios_head, (byte *) &loc->heads))
if (put_user(bios_cyl, (unsigned short *) &loc->cylinders)) return -EFAULT; return -EFAULT;
if (put_user(drive->bios_sect, (byte *) &loc->sectors))
return -EFAULT;
if (put_user(bios_cyl, (unsigned short *) &loc->cylinders))
return -EFAULT;
if (put_user((unsigned)drive->part[minor(inode->i_rdev)&PARTN_MASK].start_sect, if (put_user((unsigned)drive->part[minor(inode->i_rdev)&PARTN_MASK].start_sect,
(unsigned long *) &loc->start)) return -EFAULT; (unsigned long *) &loc->start))
return -EFAULT;
return 0; return 0;
} }
...@@ -2440,26 +2440,35 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -2440,26 +2440,35 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
if (!loc || (drive->type != ATA_DISK && drive->type != ATA_FLOPPY)) if (!loc || (drive->type != ATA_DISK && drive->type != ATA_FLOPPY))
return -EINVAL; return -EINVAL;
if (put_user(drive->head, (u8 *) &loc->heads)) return -EFAULT; if (put_user(drive->head, (u8 *) &loc->heads))
if (put_user(drive->sect, (u8 *) &loc->sectors)) return -EFAULT; return -EFAULT;
if (put_user(drive->cyl, (unsigned int *) &loc->cylinders)) return -EFAULT;
if (put_user(drive->sect, (u8 *) &loc->sectors))
return -EFAULT;
if (put_user(drive->cyl, (unsigned int *) &loc->cylinders))
return -EFAULT;
if (put_user((unsigned)drive->part[minor(inode->i_rdev)&PARTN_MASK].start_sect, if (put_user((unsigned)drive->part[minor(inode->i_rdev)&PARTN_MASK].start_sect,
(unsigned long *) &loc->start)) return -EFAULT; (unsigned long *) &loc->start))
return -EFAULT;
return 0; return 0;
} }
case BLKRRPART: /* Re-read partition tables */ case BLKRRPART: /* Re-read partition tables */
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
return ide_revalidate_disk(inode->i_rdev); return ide_revalidate_disk(inode->i_rdev);
case HDIO_GET_IDENTITY: case HDIO_GET_IDENTITY:
if (minor(inode->i_rdev) & PARTN_MASK) if (minor(inode->i_rdev) & PARTN_MASK)
return -EINVAL; return -EINVAL;
if (drive->id == NULL) if (drive->id == NULL)
return -ENOMSG; return -ENOMSG;
if (copy_to_user((char *)arg, (char *)drive->id, sizeof(*drive->id))) if (copy_to_user((char *)arg, (char *)drive->id, sizeof(*drive->id)))
return -EFAULT; return -EFAULT;
return 0; return 0;
case HDIO_GET_NICE: case HDIO_GET_NICE:
...@@ -2468,20 +2477,22 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -2468,20 +2477,22 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
(long *) arg); (long *) arg);
case HDIO_DRIVE_CMD: case HDIO_DRIVE_CMD:
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) if (!capable(CAP_SYS_RAWIO))
return -EACCES; return -EACCES;
return ide_cmd_ioctl(drive, arg); return ide_cmd_ioctl(drive, arg);
case HDIO_SET_NICE: case HDIO_SET_NICE:
if (!capable(CAP_SYS_ADMIN)) return -EACCES;
if (arg != (arg & ((1 << IDE_NICE_DSC_OVERLAP)))) if (arg != (arg & ((1 << IDE_NICE_DSC_OVERLAP))))
return -EPERM; return -EPERM;
drive->dsc_overlap = (arg >> IDE_NICE_DSC_OVERLAP) & 1; drive->dsc_overlap = (arg >> IDE_NICE_DSC_OVERLAP) & 1;
/* Only CD-ROM's and tapes support DSC overlap. */ /* Only CD-ROM's and tapes support DSC overlap. */
if (drive->dsc_overlap && !(drive->type == ATA_ROM || drive->type == ATA_TAPE)) { if (drive->dsc_overlap && !(drive->type == ATA_ROM || drive->type == ATA_TAPE)) {
drive->dsc_overlap = 0; drive->dsc_overlap = 0;
return -EPERM; return -EPERM;
} }
return 0; return 0;
case BLKGETSIZE: case BLKGETSIZE:
...@@ -2505,25 +2516,24 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u ...@@ -2505,25 +2516,24 @@ static int ide_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
return block_ioctl(inode->i_bdev, cmd, arg); return block_ioctl(inode->i_bdev, cmd, arg);
case HDIO_GET_BUSSTATE: case HDIO_GET_BUSSTATE:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (put_user(drive->channel->bus_state, (long *)arg)) if (put_user(drive->channel->bus_state, (long *)arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
case HDIO_SET_BUSSTATE: case HDIO_SET_BUSSTATE:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (drive->channel->busproc) if (drive->channel->busproc)
drive->channel->busproc(drive, (int)arg); drive->channel->busproc(drive, (int)arg);
return 0; return 0;
/* Now check whatever this particular ioctl has a special /* Now check whatever this particular ioctl has a device type
* implementation. * specific implementation.
*/ */
default: default:
if (ata_ops(drive) && ata_ops(drive)->ioctl) if (ata_ops(drive) && ata_ops(drive)->ioctl)
return ata_ops(drive)->ioctl(drive, inode, file, cmd, arg); return ata_ops(drive)->ioctl(drive, inode, file, cmd, arg);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -2545,6 +2555,7 @@ static int ide_check_media_change(kdev_t i_rdev) ...@@ -2545,6 +2555,7 @@ static int ide_check_media_change(kdev_t i_rdev)
res = 1; /* assume it was changed */ res = 1; /* assume it was changed */
ata_put(ata_ops(drive)); ata_put(ata_ops(drive));
} }
return res; return res;
} }
......
...@@ -1450,7 +1450,7 @@ static struct ata_pci_device chipsets[] __initdata = { ...@@ -1450,7 +1450,7 @@ static struct ata_pci_device chipsets[] __initdata = {
init_chipset: pdc202xx_init_chipset, init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx, ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx, init_channel: ide_init_pdc202xx,
exnablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}}, enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
bootable: OFF_BOARD, bootable: OFF_BOARD,
extra: 48, extra: 48,
flags: ATA_F_IRQ | ATA_F_DMA flags: ATA_F_IRQ | ATA_F_DMA
......
...@@ -76,7 +76,7 @@ static void config_for_pio(ide_drive_t *drive, int pio, int report) ...@@ -76,7 +76,7 @@ static void config_for_pio(ide_drive_t *drive, int pio, int report)
if (ide_config_drive_speed(drive, xfer_mode) == 0) if (ide_config_drive_speed(drive, xfer_mode) == 0)
drv_ctrl = get_timing_sl82c105(t); drv_ctrl = get_timing_sl82c105(t);
if (drive->using_dma == 0) { if (!drive->using_dma) {
/* /*
* If we are actually using MW DMA, then we can not * If we are actually using MW DMA, then we can not
* reprogram the interface drive control register. * reprogram the interface drive control register.
......
...@@ -95,15 +95,15 @@ static void tcq_invalidate_queue(struct ata_device *drive) ...@@ -95,15 +95,15 @@ static void tcq_invalidate_queue(struct ata_device *drive)
del_timer(&ch->timer); del_timer(&ch->timer);
if (test_bit(IDE_DMA, &hwgroup->flags)) if (test_bit(IDE_DMA, &ch->active))
udma_stop(drive); udma_stop(drive);
blk_queue_invalidate_tags(q); blk_queue_invalidate_tags(q);
drive->using_tcq = 0; drive->using_tcq = 0;
drive->queue_depth = 1; drive->queue_depth = 1;
clear_bit(IDE_BUSY, &hwgroup->flags); clear_bit(IDE_BUSY, &ch->active);
clear_bit(IDE_DMA, &hwgroup->flags); clear_bit(IDE_DMA, &ch->active);
hwgroup->handler = NULL; hwgroup->handler = NULL;
/* /*
...@@ -152,6 +152,7 @@ static void tcq_invalidate_queue(struct ata_device *drive) ...@@ -152,6 +152,7 @@ static void tcq_invalidate_queue(struct ata_device *drive)
static void ata_tcq_irq_timeout(unsigned long data) static void ata_tcq_irq_timeout(unsigned long data)
{ {
struct ata_device *drive = (struct ata_device *) data; struct ata_device *drive = (struct ata_device *) data;
struct ata_channel *ch = drive->channel;
ide_hwgroup_t *hwgroup = HWGROUP(drive); ide_hwgroup_t *hwgroup = HWGROUP(drive);
unsigned long flags; unsigned long flags;
...@@ -159,7 +160,7 @@ static void ata_tcq_irq_timeout(unsigned long data) ...@@ -159,7 +160,7 @@ static void ata_tcq_irq_timeout(unsigned long data)
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if (test_and_set_bit(IDE_BUSY, &hwgroup->flags)) if (test_and_set_bit(IDE_BUSY, &ch->active))
printk(KERN_ERR "ATA: %s: hwgroup not busy\n", __FUNCTION__); printk(KERN_ERR "ATA: %s: hwgroup not busy\n", __FUNCTION__);
if (hwgroup->handler == NULL) if (hwgroup->handler == NULL)
printk(KERN_ERR "ATA: %s: missing isr!\n", __FUNCTION__); printk(KERN_ERR "ATA: %s: missing isr!\n", __FUNCTION__);
...@@ -170,7 +171,7 @@ static void ata_tcq_irq_timeout(unsigned long data) ...@@ -170,7 +171,7 @@ static void ata_tcq_irq_timeout(unsigned long data)
* if pending commands, try service before giving up * if pending commands, try service before giving up
*/ */
if (ata_pending_commands(drive) && (GET_STAT() & SERVICE_STAT)) if (ata_pending_commands(drive) && (GET_STAT() & SERVICE_STAT))
if (service(drive, hwgroup->rq) == ide_started) if (service(drive, drive->rq) == ide_started)
return; return;
if (drive) if (drive)
...@@ -241,7 +242,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq) ...@@ -241,7 +242,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq)
* Could be called with IDE_DMA in-progress from invalidate * Could be called with IDE_DMA in-progress from invalidate
* handler, refuse to do anything. * handler, refuse to do anything.
*/ */
if (test_bit(IDE_DMA, &HWGROUP(drive)->flags)) if (test_bit(IDE_DMA, &drive->channel->active))
return ide_stopped; return ide_stopped;
/* /*
...@@ -283,7 +284,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq) ...@@ -283,7 +284,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq)
* should not happen, a buggy device could introduce loop * should not happen, a buggy device could introduce loop
*/ */
if ((feat = GET_FEAT()) & NSEC_REL) { if ((feat = GET_FEAT()) & NSEC_REL) {
HWGROUP(drive)->rq = NULL; drive->rq = NULL;
printk("%s: release in service\n", drive->name); printk("%s: release in service\n", drive->name);
return ide_stopped; return ide_stopped;
} }
...@@ -298,7 +299,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq) ...@@ -298,7 +299,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq)
return ide_stopped; return ide_stopped;
} }
HWGROUP(drive)->rq = rq; drive->rq = rq;
/* /*
* we'll start a dma read or write, device will trigger * we'll start a dma read or write, device will trigger
...@@ -529,7 +530,7 @@ static ide_startstop_t udma_tcq_start(struct ata_device *drive, struct request * ...@@ -529,7 +530,7 @@ static ide_startstop_t udma_tcq_start(struct ata_device *drive, struct request *
struct ata_channel *ch = drive->channel; struct ata_channel *ch = drive->channel;
TCQ_PRINTK("%s: setting up queued %d\n", __FUNCTION__, rq->tag); TCQ_PRINTK("%s: setting up queued %d\n", __FUNCTION__, rq->tag);
if (!test_bit(IDE_BUSY, &ch->hwgroup->flags)) if (!test_bit(IDE_BUSY, &ch->active))
printk("queued_rw: IDE_BUSY not set\n"); printk("queued_rw: IDE_BUSY not set\n");
if (tcq_wait_dataphase(drive)) if (tcq_wait_dataphase(drive))
...@@ -584,7 +585,7 @@ ide_startstop_t udma_tcq_taskfile(struct ata_device *drive, struct request *rq) ...@@ -584,7 +585,7 @@ ide_startstop_t udma_tcq_taskfile(struct ata_device *drive, struct request *rq)
*/ */
if ((feat = GET_FEAT()) & NSEC_REL) { if ((feat = GET_FEAT()) & NSEC_REL) {
drive->immed_rel++; drive->immed_rel++;
HWGROUP(drive)->rq = NULL; drive->rq = NULL;
set_irq(drive, ide_dmaq_intr); set_irq(drive, ide_dmaq_intr);
TCQ_PRINTK("REL in queued_start\n"); TCQ_PRINTK("REL in queued_start\n");
......
...@@ -82,10 +82,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -82,10 +82,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif #endif
} }
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASMalpha_IDE_H */ #endif /* __ASMalpha_IDE_H */
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
#include <asm/arch/ide.h> #include <asm/arch/ide.h>
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
/* /*
* We always use the new IDE port registering, * We always use the new IDE port registering,
* so these are fixed here. * so these are fixed here.
......
...@@ -96,10 +96,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -96,10 +96,6 @@ static __inline__ void ide_init_default_hwifs(void)
#undef SUPPORT_SLOW_DATA_PORTS #undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0 #define SUPPORT_SLOW_DATA_PORTS 0
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
/* the drive addressing is done through a controller register on the Etrax CPU */ /* the drive addressing is done through a controller register on the Etrax CPU */
void OUT_BYTE(unsigned char data, ide_ioreg_t reg); void OUT_BYTE(unsigned char data, ide_ioreg_t reg);
unsigned char IN_BYTE(ide_ioreg_t reg); unsigned char IN_BYTE(ide_ioreg_t reg);
......
...@@ -86,10 +86,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -86,10 +86,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif #endif
} }
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASMi386_IDE_H */ #endif /* __ASMi386_IDE_H */
...@@ -92,10 +92,6 @@ ide_init_default_hwifs (void) ...@@ -92,10 +92,6 @@ ide_init_default_hwifs (void)
#endif #endif
} }
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASM_IA64_IDE_H */ #endif /* __ASM_IA64_IDE_H */
...@@ -145,10 +145,13 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -145,10 +145,13 @@ static __inline__ void ide_init_default_hwifs(void)
#endif /* CONFIG_ATARI || CONFIG_Q40 */ #endif /* CONFIG_ATARI || CONFIG_Q40 */
#define ATA_ARCH_ACK_INTR
#ifdef CONFIG_ATARI
#define ATA_ARCH_LOCK
static __inline__ void ide_release_lock (int *ide_lock) static __inline__ void ide_release_lock (int *ide_lock)
{ {
#ifdef CONFIG_ATARI
if (MACH_IS_ATARI) { if (MACH_IS_ATARI) {
if (*ide_lock == 0) { if (*ide_lock == 0) {
printk("ide_release_lock: bug\n"); printk("ide_release_lock: bug\n");
...@@ -157,12 +160,10 @@ static __inline__ void ide_release_lock (int *ide_lock) ...@@ -157,12 +160,10 @@ static __inline__ void ide_release_lock (int *ide_lock)
*ide_lock = 0; *ide_lock = 0;
stdma_release(); stdma_release();
} }
#endif /* CONFIG_ATARI */
} }
static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, struct pt_regs *), void *data) static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, struct pt_regs *), void *data)
{ {
#ifdef CONFIG_ATARI
if (MACH_IS_ATARI) { if (MACH_IS_ATARI) {
if (*ide_lock == 0) { if (*ide_lock == 0) {
if (in_interrupt() > 0) if (in_interrupt() > 0)
...@@ -171,10 +172,8 @@ static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, ...@@ -171,10 +172,8 @@ static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *,
*ide_lock = 1; *ide_lock = 1;
} }
} }
#endif /* CONFIG_ATARI */
} }
#endif /* CONFIG_ATARI */
#define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1)
/* /*
* On the Atari, we sometimes can't enable interrupts: * On the Atari, we sometimes can't enable interrupts:
......
...@@ -68,10 +68,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -68,10 +68,6 @@ static __inline__ void ide_init_default_hwifs(void)
#undef SUPPORT_VLB_SYNC #undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0 #define SUPPORT_VLB_SYNC 0
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASM_IDE_H */ #endif /* __ASM_IDE_H */
...@@ -68,10 +68,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -68,10 +68,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif #endif
} }
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASM_IDE_H */ #endif /* __ASM_IDE_H */
...@@ -81,10 +81,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -81,10 +81,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif #endif
} }
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASMi386_IDE_H */ #endif /* __ASMi386_IDE_H */
...@@ -108,12 +108,8 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -108,12 +108,8 @@ static __inline__ void ide_init_default_hwifs(void)
} }
#if (defined CONFIG_APUS || defined CONFIG_BLK_DEV_MPC8xx_IDE ) #if (defined CONFIG_APUS || defined CONFIG_BLK_DEV_MPC8xx_IDE )
#define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) #define ATA_ARCH_ACK_INTR
#else
#define ide_ack_intr(hwif) (1)
#endif #endif
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -50,10 +50,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -50,10 +50,6 @@ static __inline__ void ide_init_default_hwifs(void)
{ {
} }
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASMPPC64_IDE_H */ #endif /* __ASMPPC64_IDE_H */
...@@ -17,14 +17,6 @@ ...@@ -17,14 +17,6 @@
#define ide__sti() do {} while (0) #define ide__sti() do {} while (0)
/*
* The following are not needed for the non-m68k ports
*/
#define ide_ack_intr(hwif) (1)
#define ide_fix_driveid(id) do {} while (0)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
/* /*
* We always use the new IDE port registering, * We always use the new IDE port registering,
* so these are fixed here. * so these are fixed here.
......
...@@ -17,10 +17,6 @@ ...@@ -17,10 +17,6 @@
#define ide__sti() do {} while (0) #define ide__sti() do {} while (0)
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
/* /*
* We always use the new IDE port registering, * We always use the new IDE port registering,
* so these are fixed here. * so these are fixed here.
......
...@@ -107,10 +107,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -107,10 +107,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif #endif
} }
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASM_SH_IDE_H */ #endif /* __ASM_SH_IDE_H */
...@@ -165,11 +165,6 @@ static __inline__ void ide_outsw(unsigned long port, ...@@ -165,11 +165,6 @@ static __inline__ void ide_outsw(unsigned long port,
/* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */ /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */
} }
#define ide_ack_intr(hwif) (1)
/* #define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) */
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _SPARC_IDE_H */ #endif /* _SPARC_IDE_H */
...@@ -181,10 +181,6 @@ static __inline__ void ide_outsw(unsigned long port, ...@@ -181,10 +181,6 @@ static __inline__ void ide_outsw(unsigned long port,
#endif #endif
} }
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _SPARC64_IDE_H */ #endif /* _SPARC64_IDE_H */
...@@ -86,10 +86,6 @@ static __inline__ void ide_init_default_hwifs(void) ...@@ -86,10 +86,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif #endif
} }
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __ASMi386_IDE_H */ #endif /* __ASMi386_IDE_H */
...@@ -239,6 +239,19 @@ void ide_setup_ports(hw_regs_t *hw, ...@@ -239,6 +239,19 @@ void ide_setup_ports(hw_regs_t *hw,
#include <asm/ide.h> #include <asm/ide.h>
/* Currently only m68k, apus and m8xx need it */
#ifdef ATA_ARCH_ACK_INTR
# define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1)
#else
# define ide_ack_intr(hwif) (1)
#endif
/* Currently only Atari needs it */
#ifndef ATA_ARCH_LOCK
# define ide_release_lock(lock) do {} while (0)
# define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif
/* /*
* If the arch-dependant ide.h did not declare/define any OUT_BYTE or IN_BYTE * If the arch-dependant ide.h did not declare/define any OUT_BYTE or IN_BYTE
* functions, we make some defaults here. The only architecture currently * functions, we make some defaults here. The only architecture currently
...@@ -324,14 +337,16 @@ struct ata_device { ...@@ -324,14 +337,16 @@ struct ata_device {
* magically just go away. * magically just go away.
*/ */
request_queue_t queue; /* per device request queue */ request_queue_t queue; /* per device request queue */
struct request *rq; /* current request */
unsigned long sleep; /* sleep until this time */ unsigned long sleep; /* sleep until this time */
byte using_dma; /* disk is using dma for read/write */
byte using_tcq; /* disk is using queueing */
byte retry_pio; /* retrying dma capable host in pio */ byte retry_pio; /* retrying dma capable host in pio */
byte state; /* retry state */ byte state; /* retry state */
byte dsc_overlap; /* flag: DSC overlap */
unsigned using_dma : 1; /* disk is using dma for read/write */
unsigned using_tcq : 1; /* disk is using queueing */
unsigned dsc_overlap : 1; /* flag: DSC overlap */
unsigned waiting_for_dma: 1; /* dma currently in progress */ unsigned waiting_for_dma: 1; /* dma currently in progress */
unsigned busy : 1; /* currently doing revalidate_disk() */ unsigned busy : 1; /* currently doing revalidate_disk() */
...@@ -403,11 +418,39 @@ struct ata_device { ...@@ -403,11 +418,39 @@ struct ata_device {
int max_depth; int max_depth;
} ide_drive_t; } ide_drive_t;
/*
* Status returned by various functions.
*/
typedef enum {
ide_stopped, /* no drive operation was started */
ide_started, /* a drive operation was started, and a handler was set */
ide_released /* started and released bus */
} ide_startstop_t;
/*
* Interrupt and timeout handler type.
*/
typedef ide_startstop_t (ata_handler_t)(struct ata_device *, struct request *);
typedef int (ata_expiry_t)(struct ata_device *, struct request *);
enum { enum {
ATA_PRIMARY = 0, ATA_PRIMARY = 0,
ATA_SECONDARY = 1 ATA_SECONDARY = 1
}; };
enum {
IDE_BUSY, /* awaiting an interrupt */
IDE_SLEEP,
IDE_DMA /* DMA in progress */
};
typedef struct hwgroup_s {
/* FIXME: We should look for busy request queues instead of looking at
* the !NULL state of this field.
*/
ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */
} ide_hwgroup_t;
struct ata_channel { struct ata_channel {
struct device dev; /* device handle */ struct device dev; /* device handle */
int unit; /* channel number */ int unit; /* channel number */
...@@ -415,7 +458,9 @@ struct ata_channel { ...@@ -415,7 +458,9 @@ struct ata_channel {
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */ struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
struct timer_list timer; /* failsafe timer */ struct timer_list timer; /* failsafe timer */
int (*expiry)(struct ata_device *, struct request *); /* irq handler, if active */ int (*expiry)(struct ata_device *, struct request *); /* irq handler, if active */
unsigned long poll_timeout; /* timeout value during polled operations */
struct ata_device *drive; /* last serviced drive */ struct ata_device *drive; /* last serviced drive */
unsigned long active; /* active processing request */
ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */ ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */
hw_regs_t hw; /* Hardware info */ hw_regs_t hw; /* Hardware info */
...@@ -506,9 +551,8 @@ struct ata_channel { ...@@ -506,9 +551,8 @@ struct ata_channel {
#endif #endif
/* driver soft-power interface */ /* driver soft-power interface */
int (*busproc)(struct ata_device *, int); int (*busproc)(struct ata_device *, int);
byte bus_state; /* power state of the IDE bus */
unsigned long poll_timeout; /* timeout value during polled operations */ byte bus_state; /* power state of the IDE bus */
}; };
/* /*
...@@ -517,27 +561,8 @@ struct ata_channel { ...@@ -517,27 +561,8 @@ struct ata_channel {
extern int ide_register_hw(hw_regs_t *hw, struct ata_channel **hwifp); extern int ide_register_hw(hw_regs_t *hw, struct ata_channel **hwifp);
extern void ide_unregister(struct ata_channel *hwif); extern void ide_unregister(struct ata_channel *hwif);
/*
* Status returned by various functions.
*/
typedef enum {
ide_stopped, /* no drive operation was started */
ide_started, /* a drive operation was started, and a handler was set */
ide_released /* started and released bus */
} ide_startstop_t;
/*
* Interrupt and timeout handler type.
*/
typedef ide_startstop_t (ata_handler_t)(struct ata_device *, struct request *);
typedef int (ata_expiry_t)(struct ata_device *, struct request *);
struct ata_taskfile; struct ata_taskfile;
#define IDE_BUSY 0 /* awaiting an interrupt */
#define IDE_SLEEP 1
#define IDE_DMA 2 /* DMA in progress */
#define IDE_MAX_TAG 32 #define IDE_MAX_TAG 32
#ifdef CONFIG_BLK_DEV_IDE_TCQ #ifdef CONFIG_BLK_DEV_IDE_TCQ
...@@ -561,15 +586,6 @@ static inline int ata_can_queue(struct ata_device *drive) ...@@ -561,15 +586,6 @@ static inline int ata_can_queue(struct ata_device *drive)
# define ata_can_queue(drive) (1) # define ata_can_queue(drive) (1)
#endif #endif
typedef struct hwgroup_s {
/* FIXME: We should look for busy request queues instead of looking at
* the !NULL state of this field.
*/
ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */
unsigned long flags; /* BUSY, SLEEPING */
struct request *rq; /* current request */
} ide_hwgroup_t;
/* FIXME: kill this as soon as possible */ /* FIXME: kill this as soon as possible */
#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
......
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