Commit 5ff49f70 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.15 IDE 62a

- Streamline device detection reporting to always use ->slot_name.

- Apply 64 bit sector size fixes to the overall code.

- Push ->handler down to the struct ata_channel.

- Introduce channel group based locking instead of a single global lock for all
   operations. There are still some places where we have preserved the ide_lock.
   We can't lock for queues during device probe and we protect global data
   structures during device registration and unregistration in ide.c with it.

- Start replacement of serialized access to the registers of
   channels which share them with proper host chip driver specific locking.
   This affects the following host chip drivers:

   cmd640.c, rz1000, ... ?

   Seems some are setting the serialize flag just in case. So better let's do it
   gradually over time.

   Well, I still have to think whatever we really need to put channels sharing
   an IRQ line in the same locking group.

   From now on the sick concept of a hw group is gone now. We have full blown
   per channel request queues! Hopefully I will be able soon to get my hands on
   a dual Athlon machine to check how this all behaves on a multi SMP machine.

- Move the whole SUPPORT_VLB_SYNC stuff to the only place where it is used: the
   pdc4030 host chip driver.  Eliminate it from the global driver part.

- Eliminate pseudo portability macros from pdc4030. This is a host chip firmly
   based on VLB.
parent 938f5b72
This diff is collapsed.
......@@ -316,7 +316,7 @@ static ide_startstop_t idedisk_do_request(struct ata_device *drive, struct reque
unsigned long flags;
int ret;
spin_lock_irqsave(&ide_lock, flags);
spin_lock_irqsave(drive->channel->lock, flags);
ret = blk_queue_start_tag(&drive->queue, rq);
......@@ -325,7 +325,7 @@ static ide_startstop_t idedisk_do_request(struct ata_device *drive, struct reque
if (ata_pending_commands(drive) > drive->max_last_depth)
drive->max_last_depth = ata_pending_commands(drive);
spin_unlock_irqrestore(&ide_lock, flags);
spin_unlock_irqrestore(drive->channel->lock, flags);
if (ret) {
BUG_ON(!ata_pending_commands(drive));
......@@ -438,13 +438,6 @@ static int set_multcount(struct ata_device *drive, int arg)
if (!drive->id)
return -EIO;
/* FIXME: Hmm... just bailing out my be problematic, since there *is*
* activity during boot. For now the same problem persists in
* set_pio_mode() we will have to do something about it soon.
*/
if (HWGROUP(drive)->handler)
return -EBUSY;
if (arg > drive->id->max_multsect)
arg = drive->id->max_multsect;
......@@ -466,9 +459,6 @@ static int set_multcount(struct ata_device *drive, int arg)
static int set_nowerr(struct ata_device *drive, int arg)
{
if (HWGROUP(drive)->handler)
return -EBUSY;
drive->nowerr = arg;
drive->bad_wstat = arg ? BAD_R_STAT : BAD_W_STAT;
......@@ -576,8 +566,8 @@ static int idedisk_suspend(struct device *dev, u32 state, u32 level)
return 0;
/* wait until all commands are finished */
printk("ide_disk_suspend()\n");
while (HWGROUP(drive)->handler)
/* FIXME: waiting for spinlocks should be done instead. */
while (drive->channel->handler)
yield();
/* set the drive to standby */
......@@ -1022,7 +1012,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
return -EBUSY;
val = set_lba_addressing(drive, arg);
spin_unlock_irq(&ide_lock);
spin_unlock_irq(drive->channel->lock);
return val;
}
......@@ -1048,7 +1038,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
return -EBUSY;
val = set_multcount(drive, arg);
spin_unlock_irq(&ide_lock);
spin_unlock_irq(drive->channel->lock);
return val;
}
......@@ -1072,7 +1062,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
return -EBUSY;
val = set_nowerr(drive, arg);
spin_unlock_irq(&ide_lock);
spin_unlock_irq(drive->channel->lock);
return val;
}
......@@ -1096,7 +1086,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
return -EBUSY;
val = write_cache(drive, arg);
spin_unlock_irq(&ide_lock);
spin_unlock_irq(drive->channel->lock);
return val;
}
......@@ -1119,7 +1109,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
return -EBUSY;
val = set_acoustic(drive, arg);
spin_unlock_irq(&ide_lock);
spin_unlock_irq(drive->channel->lock);
return val;
}
......@@ -1144,7 +1134,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
return -EBUSY;
val = set_using_tcq(drive, arg);
spin_unlock_irq(&ide_lock);
spin_unlock_irq(drive->channel->lock);
return val;
}
......
......@@ -553,15 +553,14 @@ static void __init pdc20270_device_order_fixup (struct pci_dev *dev, struct ata_
}
}
}
printk("ATA: %s: controller on PCI bus %02x dev %02x\n",
dev->name, dev->bus->number, dev->devfn);
printk(KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n",
dev->name, dev->slot_name, dev->devfn);
setup_pci_device(dev, d);
if (!dev2)
return;
d2 = d;
printk("ATA: %s: controller on PCI bus %02x dev %02x\n",
dev2->name, dev2->bus->number, dev2->devfn);
printk(KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n",
dev2->name, dev2->slot_name, dev2->devfn);
setup_pci_device(dev2, d2);
}
......@@ -584,8 +583,8 @@ static void __init hpt374_device_order_fixup (struct pci_dev *dev, struct ata_pc
}
}
printk("%s: IDE controller on PCI bus %02x dev %02x\n",
dev->name, dev->bus->number, dev->devfn);
printk(KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n",
dev->name, dev->slot_name, dev->devfn);
setup_pci_device(dev, d);
if (!dev2) {
return;
......@@ -601,8 +600,8 @@ static void __init hpt374_device_order_fixup (struct pci_dev *dev, struct ata_pc
}
}
d2 = d;
printk("%s: IDE controller on PCI bus %02x dev %02x\n",
dev2->name, dev2->bus->number, dev2->devfn);
printk(KERN_INFO "ATA: %s: controller on PCI slot %s dev %02x\n",
dev2->name, dev2->slot_name, dev2->devfn);
setup_pci_device(dev2, d2);
}
......@@ -623,7 +622,7 @@ static void __init hpt366_device_order_fixup (struct pci_dev *dev, struct ata_pc
switch(class_rev) {
case 5:
case 4:
case 3: printk("%s: IDE controller on PCI slot %s\n", dev->name, dev->slot_name);
case 3: printk(KERN_INFO "ATA: %s: controller on PCI slot %s\n", dev->name, dev->slot_name);
setup_pci_device(dev, d);
return;
default: break;
......@@ -639,17 +638,17 @@ static void __init hpt366_device_order_fixup (struct pci_dev *dev, struct ata_pc
pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin2);
if ((pin1 != pin2) && (dev->irq == dev2->irq)) {
d->bootable = ON_BOARD;
printk("%s: onboard version of chipset, pin1=%d pin2=%d\n", dev->name, pin1, pin2);
printk(KERN_INFO "ATAL: %s: onboard version of chipset, pin1=%d pin2=%d\n", dev->name, pin1, pin2);
}
break;
}
}
printk("%s: IDE controller on PCI slot %s\n", dev->name, dev->slot_name);
printk(KERN_INFO "ATA: %s: controller on PCI slot %s\n", dev->name, dev->slot_name);
setup_pci_device(dev, d);
if (!dev2)
return;
d2 = d;
printk("%s: IDE controller on PCI slot %s\n", dev2->name, dev2->slot_name);
printk(KERN_INFO "ATA: %s: controller on PCI slot %s\n", dev2->name, dev2->slot_name);
setup_pci_device(dev2, d2);
}
......@@ -679,6 +678,10 @@ static void __init scan_pcidev(struct pci_dev *dev)
}
if (!d) {
/* Only check the device calls, if it wasn't listed, since
* there are in esp. some pdc202xx chips which "work around"
* beeing grabbed by generic drivers.
*/
if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
printk(KERN_INFO "ATA: unknown interface: %s, on PCI slot %s\n",
dev->name, dev->slot_name);
......
......@@ -20,7 +20,9 @@
*
* - Find a way to duplicate less code with ide-dma and use the
* dma fileds in the hwif structure instead of our own
*
* - Fix check_disk_change() call
*
* - Make module-able (includes setting ppc_md. hooks from within
* this file and not from arch code, and handling module deps with
* mediabay (by having both modules do dynamic lookup of each other
......@@ -280,7 +282,7 @@ struct pmu_sleep_notifier idepmac_sleep_notifier = {
#endif /* CONFIG_PMAC_PBOOK */
static int __pmac
pmac_ide_find(ide_drive_t *drive)
pmac_ide_find(struct ata_device *drive)
{
struct ata_channel *hwif = drive->channel;
ide_ioreg_t base;
......@@ -352,7 +354,7 @@ pmac_ide_init_hwif_ports(hw_regs_t *hw,
* device for yaboot configuration
*/
struct device_node*
pmac_ide_get_devnode(ide_drive_t *drive)
pmac_ide_get_devnode(struct ata_device *drive)
{
int i = pmac_ide_find(drive);
if (i < 0)
......@@ -365,7 +367,7 @@ pmac_ide_get_devnode(ide_drive_t *drive)
* is enough, I beleive selectproc will be called whenever an IDE command is started,
* but... */
static void __pmac
pmac_ide_selectproc(ide_drive_t *drive)
pmac_ide_selectproc(struct ata_device *drive)
{
int i = pmac_ide_find(drive);
if (i < 0)
......@@ -391,7 +393,7 @@ pmac_ide_selectproc(ide_drive_t *drive)
* --BenH
*/
static int __pmac
wait_for_ready(ide_drive_t *drive)
wait_for_ready(struct ata_device *drive)
{
/* Timeout bumped for some powerbooks */
int timeout = 2000;
......@@ -417,7 +419,7 @@ wait_for_ready(ide_drive_t *drive)
}
static int __pmac
pmac_ide_do_setfeature(ide_drive_t *drive, byte command)
pmac_ide_do_setfeature(struct ata_device *drive, byte command)
{
int result = 1;
unsigned long flags;
......@@ -477,7 +479,7 @@ pmac_ide_do_setfeature(ide_drive_t *drive, byte command)
/* Calculate PIO timings */
static void __pmac
pmac_ide_tuneproc(ide_drive_t *drive, byte pio)
pmac_ide_tuneproc(struct ata_device *drive, byte pio)
{
struct ata_timing *t;
int i;
......@@ -667,19 +669,19 @@ set_timings_mdma(int intf_type, u32 *timings, byte speed, int drive_cycle_time)
if (halfTick)
*timings |= TR_33_MDMA_HALFTICK;
}
#ifdef IDE_PMAC_DEBUG
# ifdef IDE_PMAC_DEBUG
printk(KERN_ERR "ide_pmac: Set MDMA timing for mode %d, reg: 0x%08x\n",
speed & 0xf, *timings);
#endif
# endif
return 0;
}
#endif /* #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC */
#endif
/* You may notice we don't use this function on normal operation,
* our, normal mdma function is supposed to be more precise
*/
static int __pmac
pmac_ide_tune_chipset (ide_drive_t *drive, byte speed)
pmac_ide_tune_chipset (struct ata_device *drive, byte speed)
{
int intf = pmac_ide_find(drive);
int unit = (drive->select.b.unit & 0x01);
......@@ -714,7 +716,7 @@ pmac_ide_tune_chipset (ide_drive_t *drive, byte speed)
case XFER_SW_DMA_1:
case XFER_SW_DMA_0:
return 1;
#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
#endif
case XFER_PIO_4:
case XFER_PIO_3:
case XFER_PIO_2:
......@@ -950,7 +952,7 @@ pmac_ide_probe(void)
&& strcasecmp(np->parent->name, "media-bay") == 0) {
#ifdef CONFIG_PMAC_PBOOK
media_bay_set_ide_infos(np->parent,base,irq,i);
#endif /* CONFIG_PMAC_PBOOK */
#endif
in_bay = 1;
if (!bidp)
pmif->aapl_bus_id = 1;
......@@ -981,14 +983,14 @@ pmac_ide_probe(void)
#ifdef CONFIG_PMAC_PBOOK
if (in_bay && check_media_bay_by_base(base, MB_CD) == 0)
hwif->noprobe = 0;
#endif /* CONFIG_PMAC_PBOOK */
#endif
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
if (pdev && np->n_addrs >= 2) {
/* has a DBDMA controller channel */
pmac_ide_setup_dma(np, i);
}
#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
#endif
++i;
}
......@@ -998,7 +1000,7 @@ pmac_ide_probe(void)
#ifdef CONFIG_PMAC_PBOOK
pmu_register_sleep_notifier(&idepmac_sleep_notifier);
#endif /* CONFIG_PMAC_PBOOK */
#endif
}
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
......@@ -1230,7 +1232,7 @@ udma_bits_to_command(unsigned char bits, int high_speed)
/* Calculate MultiWord DMA timings */
static int __pmac
pmac_ide_mdma_enable(ide_drive_t *drive, int idx)
pmac_ide_mdma_enable(struct ata_device *drive, int idx)
{
byte bits = drive->id->dma_mword & 0x07;
byte feature = dma_bits_to_command(bits);
......@@ -1271,7 +1273,7 @@ pmac_ide_mdma_enable(ide_drive_t *drive, int idx)
/* Calculate Ultra DMA timings */
static int __pmac
pmac_ide_udma_enable(ide_drive_t *drive, int idx, int high_speed)
pmac_ide_udma_enable(struct ata_device *drive, int idx, int high_speed)
{
byte bits = drive->id->dma_ultra & 0x1f;
byte feature = udma_bits_to_command(bits, high_speed);
......@@ -1302,7 +1304,7 @@ pmac_ide_udma_enable(ide_drive_t *drive, int idx, int high_speed)
}
static int __pmac
pmac_ide_check_dma(ide_drive_t *drive)
pmac_ide_check_dma(struct ata_device *drive)
{
int ata4, udma, idx;
struct hd_driveid *id = drive->id;
......@@ -1343,7 +1345,7 @@ pmac_ide_check_dma(ide_drive_t *drive)
return 0;
}
static void ide_toggle_bounce(ide_drive_t *drive, int on)
static void ide_toggle_bounce(struct ata_device *drive, int on)
{
dma64_addr_t addr = BLK_BOUNCE_HIGH;
......@@ -1530,7 +1532,7 @@ static int pmac_ide_dmaproc(struct ata_device *drive)
}
#endif
static void idepmac_sleep_device(ide_drive_t *drive, int i, unsigned base)
static void idepmac_sleep_device(struct ata_device *drive, int i, unsigned base)
{
int j;
......@@ -1568,7 +1570,7 @@ static void idepmac_sleep_device(ide_drive_t *drive, int i, unsigned base)
#ifdef CONFIG_PMAC_PBOOK
static void __pmac
idepmac_wake_device(ide_drive_t *drive, int used_dma)
idepmac_wake_device(struct ata_device *drive, int used_dma)
{
/* We force the IDE subdriver to check for a media change
* This must be done first or we may lost the condition
......@@ -1590,12 +1592,12 @@ idepmac_wake_device(ide_drive_t *drive, int used_dma)
*/
if (used_dma && !ide_spin_wait_hwgroup(drive)) {
/* Lock HW group */
set_bit(IDE_BUSY, &HWGROUP(drive)->flags);
set_bit(IDE_BUSY, &drive->channel->active);
pmac_ide_check_dma(drive);
clear_bit(IDE_BUSY, &HWGROUP(drive)->flags);
spin_unlock_irq(&ide_lock);
clear_bit(IDE_BUSY, &drive->channel->active);
spin_unlock_irq(drive->channel->lock);
}
#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
#endif
}
static void __pmac
......@@ -1630,7 +1632,7 @@ idepmac_wake_interface(int i, unsigned long base, int mediabay)
}
static void
idepmac_sleep_drive(ide_drive_t *drive, int idx, unsigned long base)
idepmac_sleep_drive(struct ata_device *drive, int idx, unsigned long base)
{
/* Wait for HW group to complete operations */
if (ide_spin_wait_hwgroup(drive))
......@@ -1639,15 +1641,15 @@ idepmac_sleep_drive(ide_drive_t *drive, int idx, unsigned long base)
return;
else {
/* Lock HW group */
set_bit(IDE_BUSY, &HWGROUP(drive)->flags);
set_bit(IDE_BUSY, &drive->channel->active);
/* Stop the device */
idepmac_sleep_device(drive, idx, base);
spin_unlock_irq(&ide_lock);
spin_unlock_irq(drive->channel->lock);
}
}
static void
idepmac_wake_drive(ide_drive_t *drive, unsigned long base)
idepmac_wake_drive(struct ata_device *drive, unsigned long base)
{
int j;
......@@ -1669,7 +1671,7 @@ idepmac_wake_drive(ide_drive_t *drive, unsigned long base)
/* We resume processing on the HW group */
spin_lock_irq(&ide_lock);
clear_bit(IDE_BUSY, &HWGROUP(drive)->flags);
clear_bit(IDE_BUSY, &drive->channel->active);
if (!list_empty(&drive->queue.queue_head))
do_ide_request(&drive->queue);
spin_unlock_irq(&ide_lock);
......@@ -1750,7 +1752,7 @@ idepmac_notify_sleep(struct pmu_sleep_notifier *self, int when)
hwif = &ide_hwifs[i];
for (dn=0; dn<MAX_DRIVES; dn++) {
ide_drive_t *drive = &hwif->drives[dn];
struct ata_device *drive = &hwif->drives[dn];
if (!drive->present)
continue;
/* We don't have re-configured DMA yet */
......
......@@ -578,15 +578,15 @@ static int init_irq(struct ata_channel *ch)
{
unsigned long flags;
int i;
ide_hwgroup_t *hwgroup;
ide_hwgroup_t *new_hwgroup;
spinlock_t *lock;
spinlock_t *new_lock;
struct ata_channel *match = NULL;
/* Spare allocation before sleep. */
new_hwgroup = kmalloc(sizeof(*hwgroup), GFP_KERNEL);
new_lock = kmalloc(sizeof(*lock), GFP_KERNEL);
spin_lock_irqsave(&ide_lock, flags);
ch->hwgroup = NULL;
ch->lock = NULL;
#if MAX_HWIFS > 1
/*
......@@ -596,7 +596,7 @@ static int init_irq(struct ata_channel *ch)
struct ata_channel *h = &ide_hwifs[i];
/* scan only initialized channels */
if (!h->hwgroup)
if (!h->lock)
continue;
if (ch->irq != h->irq)
......@@ -606,7 +606,7 @@ static int init_irq(struct ata_channel *ch)
if (ch->chipset != ide_pci || h->chipset != ide_pci ||
ch->serialized || h->serialized) {
if (match && match->hwgroup && match->hwgroup != h->hwgroup)
if (match && match->lock && match->lock != h->lock)
printk("%s: potential irq problem with %s and %s\n", ch->name, h->name, match->name);
/* don't undo a prior perfect match */
if (!match || match->irq != ch->irq)
......@@ -615,19 +615,20 @@ static int init_irq(struct ata_channel *ch)
}
#endif
/*
* If we are still without a hwgroup, then form a new one
* If we are still without a lock group, then form a new one
*/
if (match) {
hwgroup = match->hwgroup;
if(new_hwgroup)
kfree(new_hwgroup);
} else {
hwgroup = new_hwgroup;
if (!hwgroup) {
if (!match) {
lock = new_lock;
if (!lock) {
spin_unlock_irqrestore(&ide_lock, flags);
return 1;
}
memset(hwgroup, 0, sizeof(*hwgroup));
spin_lock_init(lock);
} else {
lock = match->lock;
if(new_lock)
kfree(new_lock);
}
/*
......@@ -645,7 +646,8 @@ static int init_irq(struct ata_channel *ch)
if (request_irq(ch->irq, &ata_irq_request, sa, ch->name, ch)) {
if (!match)
kfree(hwgroup);
kfree(lock);
spin_unlock_irqrestore(&ide_lock, flags);
return 1;
......@@ -653,9 +655,9 @@ static int init_irq(struct ata_channel *ch)
}
/*
* Everything is okay. Tag us as member of this hardware group.
* Everything is okay. Tag us as member of this lock group.
*/
ch->hwgroup = hwgroup;
ch->lock = lock;
init_timer(&ch->timer);
ch->timer.function = &ide_timer_expiry;
......@@ -678,7 +680,7 @@ static int init_irq(struct ata_channel *ch)
q = &drive->queue;
q->queuedata = drive->channel;
blk_init_queue(q, do_ide_request, &ide_lock);
blk_init_queue(q, do_ide_request, drive->channel->lock);
blk_queue_segment_boundary(q, 0xffff);
/* ATA can do up to 128K per request, pdc4030 needs smaller limit */
......
......@@ -61,41 +61,6 @@ static inline void ide_unmap_rq(struct request *rq, char *to,
* Data transfer functions for polled IO.
*/
#if SUPPORT_VLB_SYNC
/*
* Some localbus EIDE interfaces require a special access sequence
* when using 32-bit I/O instructions to transfer data. We call this
* the "vlb_sync" sequence, which consists of three successive reads
* of the sector count register location, with interrupts disabled
* to ensure that the reads all happen together.
*/
static void ata_read_vlb(struct ata_device *drive, void *buffer, unsigned int wcount)
{
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
IN_BYTE(IDE_NSECTOR_REG);
IN_BYTE(IDE_NSECTOR_REG);
IN_BYTE(IDE_NSECTOR_REG);
insl(IDE_DATA_REG, buffer, wcount);
__restore_flags(flags); /* local CPU only */
}
static void ata_write_vlb(struct ata_device *drive, void *buffer, unsigned int wcount)
{
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
IN_BYTE(IDE_NSECTOR_REG);
IN_BYTE(IDE_NSECTOR_REG);
IN_BYTE(IDE_NSECTOR_REG);
outsl(IDE_DATA_REG, buffer, wcount);
__restore_flags(flags); /* local CPU only */
}
#endif
static void ata_read_32(struct ata_device *drive, void *buffer, unsigned int wcount)
{
insl(IDE_DATA_REG, buffer, wcount);
......@@ -157,11 +122,6 @@ void ata_read(struct ata_device *drive, void *buffer, unsigned int wcount)
io_32bit = drive->channel->io_32bit;
if (io_32bit) {
#if SUPPORT_VLB_SYNC
if (io_32bit & 2)
ata_read_vlb(drive, buffer, wcount);
else
#endif
ata_read_32(drive, buffer, wcount);
} else {
#if SUPPORT_SLOW_DATA_PORTS
......@@ -188,11 +148,6 @@ void ata_write(struct ata_device *drive, void *buffer, unsigned int wcount)
io_32bit = drive->channel->io_32bit;
if (io_32bit) {
#if SUPPORT_VLB_SYNC
if (io_32bit & 2)
ata_write_vlb(drive, buffer, wcount);
else
#endif
ata_write_32(drive, buffer, wcount);
} else {
#if SUPPORT_SLOW_DATA_PORTS
......@@ -320,7 +275,6 @@ static ide_startstop_t pre_task_mulout_intr(struct ata_device *drive, struct req
static ide_startstop_t task_mulout_intr(struct ata_device *drive, struct request *rq)
{
u8 stat = GET_STAT();
ide_hwgroup_t *hwgroup = HWGROUP(drive);
int mcount = drive->mult_count;
ide_startstop_t startstop;
......@@ -349,7 +303,7 @@ static ide_startstop_t task_mulout_intr(struct ata_device *drive, struct request
}
/* no data yet, so wait for another interrupt */
if (hwgroup->handler == NULL)
if (!drive->channel->handler)
ide_set_handler(drive, task_mulout_intr, WAIT_CMD, NULL);
return ide_started;
......@@ -392,7 +346,7 @@ static ide_startstop_t task_mulout_intr(struct ata_device *drive, struct request
} while (mcount);
rq->errors = 0;
if (hwgroup->handler == NULL)
if (!drive->channel->handler)
ide_set_handler(drive, task_mulout_intr, WAIT_CMD, NULL);
return ide_started;
......
This diff is collapsed.
This diff is collapsed.
......@@ -83,7 +83,6 @@ static ide_startstop_t tcq_nop_handler(struct ata_device *drive, struct request
static void tcq_invalidate_queue(struct ata_device *drive)
{
struct ata_channel *ch = drive->channel;
ide_hwgroup_t *hwgroup = ch->hwgroup;
request_queue_t *q = &drive->queue;
struct ata_taskfile *args;
struct request *rq;
......@@ -104,7 +103,7 @@ static void tcq_invalidate_queue(struct ata_device *drive)
drive->queue_depth = 1;
clear_bit(IDE_BUSY, &ch->active);
clear_bit(IDE_DMA, &ch->active);
hwgroup->handler = NULL;
ch->handler = NULL;
/*
* Do some internal stuff -- we really need this command to be
......@@ -153,7 +152,6 @@ static void ata_tcq_irq_timeout(unsigned long data)
{
struct ata_device *drive = (struct ata_device *) data;
struct ata_channel *ch = drive->channel;
ide_hwgroup_t *hwgroup = HWGROUP(drive);
unsigned long flags;
printk(KERN_ERR "ATA: %s: timeout waiting for interrupt...\n", __FUNCTION__);
......@@ -161,9 +159,9 @@ static void ata_tcq_irq_timeout(unsigned long data)
spin_lock_irqsave(&ide_lock, flags);
if (test_and_set_bit(IDE_BUSY, &ch->active))
printk(KERN_ERR "ATA: %s: hwgroup not busy\n", __FUNCTION__);
if (hwgroup->handler == NULL)
printk(KERN_ERR "ATA: %s: missing isr!\n", __FUNCTION__);
printk(KERN_ERR "ATA: %s: IRQ handler not busy\n", __FUNCTION__);
if (!ch->handler)
printk(KERN_ERR "ATA: %s: missing ISR!\n", __FUNCTION__);
spin_unlock_irqrestore(&ide_lock, flags);
......@@ -181,7 +179,6 @@ static void ata_tcq_irq_timeout(unsigned long data)
static void set_irq(struct ata_device *drive, ata_handler_t *handler)
{
struct ata_channel *ch = drive->channel;
ide_hwgroup_t *hwgroup = HWGROUP(drive);
unsigned long flags;
spin_lock_irqsave(&ide_lock, flags);
......@@ -197,8 +194,8 @@ static void set_irq(struct ata_device *drive, ata_handler_t *handler)
ch->timer.function = ata_tcq_irq_timeout;
ch->timer.data = (unsigned long) ch->drive;
mod_timer(&ch->timer, jiffies + 5 * HZ);
ch->handler = handler;
hwgroup->handler = handler;
spin_unlock_irqrestore(&ide_lock, flags);
}
......
......@@ -92,13 +92,11 @@ static void umc_set_speeds (byte speeds[])
out_umc (0xd7,(speedtab[0][speeds[2]] | (speedtab[0][speeds[3]]<<4)));
out_umc (0xd6,(speedtab[0][speeds[0]] | (speedtab[0][speeds[1]]<<4)));
tmp = 0;
for (i = 3; i >= 0; i--)
{
for (i = 3; i >= 0; i--) {
tmp = (tmp << 2) | speedtab[1][speeds[i]];
}
out_umc (0xdc,tmp);
for (i = 0;i < 4; i++)
{
for (i = 0;i < 4; i++) {
out_umc (0xd0+i,speedtab[2][speeds[i]]);
out_umc (0xd8+i,speedtab[2][speeds[i]]);
}
......@@ -108,10 +106,9 @@ static void umc_set_speeds (byte speeds[])
speeds[0], speeds[1], speeds[2], speeds[3]);
}
static void tune_umc (ide_drive_t *drive, byte pio)
static void tune_umc(struct ata_device *drive, byte pio)
{
unsigned long flags;
ide_hwgroup_t *hwgroup = ide_hwifs[drive->channel->index ^ 1].hwgroup;
if (pio == 255)
pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
......@@ -121,16 +118,12 @@ static void tune_umc (ide_drive_t *drive, byte pio)
printk("%s: setting umc8672 to PIO mode%d (speed %d)\n", drive->name, pio, pio_to_umc[pio]);
save_flags(flags); /* all CPUs */
cli(); /* all CPUs */
if (hwgroup && hwgroup->handler != NULL) {
printk("umc8672: other interface is busy: exiting tune_umc()\n");
} else {
current_speeds[drive->name[2] - 'a'] = pio_to_umc[pio];
umc_set_speeds (current_speeds);
}
restore_flags(flags); /* all CPUs */
}
void __init init_umc8672 (void) /* called from ide.c */
void __init init_umc8672(void) /* called from ide.c */
{
unsigned long flags;
......
......@@ -90,9 +90,6 @@ static __inline__ void ide_init_default_hwifs(void)
/* some configuration options we don't need */
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
......
......@@ -83,9 +83,6 @@ static __inline__ void ide_init_default_hwifs(void)
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
/* this definition is used only on startup .. */
#undef HD_DATA
#define HD_DATA NULL
......
......@@ -65,9 +65,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif
}
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
#endif /* __KERNEL__ */
#endif /* __ASM_IDE_H */
......@@ -43,8 +43,6 @@ extern struct ide_machdep_calls ppc_ide_md;
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
#define ide__sti() __sti()
......
......@@ -76,9 +76,6 @@ static __inline__ void ide_init_default_hwifs(void)
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
#undef HD_DATA
#define HD_DATA ((ide_ioreg_t)0)
......
......@@ -72,9 +72,6 @@ static __inline__ void ide_init_default_hwifs(void)
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
#undef HD_DATA
#define HD_DATA ((ide_ioreg_t)0)
......
......@@ -40,9 +40,6 @@
/* Right now this is only needed by a promise controlled.
*/
#ifndef SUPPORT_VLB_SYNC /* 1 to support weird 32-bit chips */
# define SUPPORT_VLB_SYNC 1 /* 0 to reduce kernel size */
#endif
#ifndef DISK_RECOVERY_TIME /* off=0; on=access_delay_time */
# define DISK_RECOVERY_TIME 0 /* for hardware that needs it */
#endif
......@@ -74,8 +71,6 @@ typedef unsigned char byte; /* used everywhere */
*/
#define DMA_PIO_RETRY 1 /* retrying in PIO */
#define HWGROUP(drive) (drive->channel->hwgroup)
/*
* Definitions for accessing IDE controller registers
*/
......@@ -444,18 +439,16 @@ enum {
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 device dev; /* device handle */
int unit; /* channel number */
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
/* This lock is used to serialize requests on the same device queue or
* between differen queues sharing the same irq line.
*/
spinlock_t *lock;
ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */
struct timer_list timer; /* failsafe timer */
int (*expiry)(struct ata_device *, struct request *); /* irq handler, if active */
unsigned long poll_timeout; /* timeout value during polled operations */
......@@ -777,11 +770,7 @@ extern int set_transfer(struct ata_device *, struct ata_taskfile *);
extern int system_bus_speed;
/*
* ide_stall_queue() can be used by a drive to give excess bandwidth back
* to the hwgroup by sleeping for timeout jiffies.
*/
void ide_stall_queue(struct ata_device *, unsigned long);
extern void ide_stall_queue(struct ata_device *, unsigned long);
/*
* CompactFlash cards and their brethern pretend to be removable hard disks,
......
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