Commit 4cf319d5 authored by Martin Dalecki's avatar Martin Dalecki Committed by Russell King

[PATCH] 2.5.13 IDE 50

 - Fix wrong usage of time_after in ide.c. This should cure the drive seek
   timeout problems some people where expierencing. This was clarified to me by
   Bartek, who apparently checked whatever the actual code is consistent with
   the comments in front of it. Thank you Bartlomiej Zolnierkiewicz.

   I think now that we should have time_past(xxx) in <linux/timer.h>.

 - Fix hpt34x.c compilation.

 - Minor improvements in ide-pci and some cleanups in ide-probe.c

 - Nuke some vastly outdated comments.
parent 6fe18669
......@@ -249,14 +249,14 @@ static int config_chipset_for_dma (ide_drive_t *drive, byte ultra)
ide_dma_off_quietly);
}
static int config_drive_xfer_rate (ide_drive_t *drive)
static int config_drive_xfer_rate(struct ata_device *drive, struct request *rq)
{
struct hd_driveid *id = drive->id;
ide_dma_action_t dma_func = ide_dma_on;
if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */
if (ide_dmaproc(ide_dma_bad_drive, drive)) {
if (ide_dmaproc(ide_dma_bad_drive, drive, rq)) {
dma_func = ide_dma_off;
goto fast_ata_pio;
}
......@@ -278,7 +278,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
if (dma_func != ide_dma_on)
goto no_dma_set;
}
} else if (ide_dmaproc(ide_dma_good_drive, drive)) {
} else if (ide_dmaproc(ide_dma_good_drive, drive, rq)) {
if (id->eide_dma_time > 150) {
goto no_dma_set;
}
......@@ -301,7 +301,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
dma_func = ide_dma_off;
#endif /* CONFIG_HPT34X_AUTODMA */
return drive->channel->dmaproc(dma_func, drive);
return drive->channel->udma(dma_func, drive, rq);
}
/*
......@@ -312,7 +312,7 @@ static int config_drive_xfer_rate (ide_drive_t *drive)
* by HighPoint|Triones Technologies, Inc.
*/
int hpt34x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
int hpt34x_dmaproc (ide_dma_action_t func, struct ata_device *drive, struct request *rq)
{
struct ata_channel *hwif = drive->channel;
unsigned long dma_base = hwif->dma_base;
......@@ -321,7 +321,7 @@ int hpt34x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
switch (func) {
case ide_dma_check:
return config_drive_xfer_rate(drive);
return config_drive_xfer_rate(drive, rq);
case ide_dma_read:
reading = 1 << 3;
case ide_dma_write:
......@@ -347,7 +347,7 @@ int hpt34x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
default:
break;
}
return ide_dmaproc(func, drive); /* use standard DMA stuff */
return ide_dmaproc(func, drive, rq); /* use standard DMA stuff */
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
......@@ -423,7 +423,7 @@ void __init ide_init_hpt34x(struct ata_channel *hwif)
else
hwif->autodma = 0;
hwif->dmaproc = &hpt34x_dmaproc;
hwif->udma = &hpt34x_dmaproc;
hwif->highmem = 1;
} else {
hwif->drives[0].autotune = 1;
......
/*
* Copyright (C) 1994-1998 Linus Torvalds and authors:
/***** vi:set ts=8 sts=8 sw=8:************************************************
*
* Copyright (C) 1994-1998,2002 Linus Torvalds and authors:
*
* Mark Lord <mlord@pobox.com>
* Gadi Oxman <gadio@netvision.net.il>
* Andre Hedrick <andre@linux-ide.org>
* Jens Axboe <axboe@suse.de>
* Marcin Dalecki <dalecki@evision.ag>
* Mark Lord <mlord@pobox.com>
* Gadi Oxman <gadio@netvision.net.il>
* Andre Hedrick <andre@linux-ide.org>
* Jens Axboe <axboe@suse.de>
* Marcin Dalecki <martin@dalecki.de>
*
* This is the ATA disk device driver, as evolved from hd.c and ide.c.
*/
......
/*
* Copyright (c) 1998-2000 Andre Hedrick <andre@linux-ide.org>
* Copyright (c) 1995-1998 Mark Lord
/**** vi:set ts=8 sts=8 sw=8:************************************************
*
* Copyright (C) 2002 Marcin Dalecki <martin@dalecki.de>
* Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
* Copyright (C) 1995-1998 Mark Lord
*
* May be copied or modified under the terms of the GNU General Public License
*/
......@@ -81,17 +83,10 @@ extern void ide_init_hpt34x(struct ata_channel *);
#endif
#ifdef CONFIG_BLK_DEV_HPT366
extern byte hpt363_shared_irq;
extern byte hpt363_shared_pin;
extern unsigned int pci_init_hpt366(struct pci_dev *);
extern unsigned int ata66_hpt366(struct ata_channel *);
extern void ide_init_hpt366(struct ata_channel *);
extern void ide_dmacapable_hpt366(struct ata_channel *, unsigned long);
#else
/* FIXME: those have to be killed */
static byte hpt363_shared_irq;
static byte hpt363_shared_pin;
#endif
#ifdef CONFIG_BLK_DEV_NS87415
......@@ -177,7 +172,7 @@ typedef struct ide_pci_enablebit_s {
#define ATA_F_PHACK 0x40 /* apply PROMISE hacks */
#define ATA_F_HPTHACK 0x80 /* apply HPT366 hacks */
typedef struct ide_pci_device_s {
struct ata_pci_device {
unsigned short vendor;
unsigned short device;
unsigned int (*init_chipset)(struct pci_dev *dev);
......@@ -188,9 +183,9 @@ typedef struct ide_pci_device_s {
unsigned int bootable;
unsigned int extra;
unsigned int flags;
} ide_pci_device_t;
};
static ide_pci_device_t pci_chipsets[] __initdata = {
static struct ata_pci_device pci_chipsets[] __initdata = {
#ifdef CONFIG_BLK_DEV_PIIX
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371FB_1, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_1, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
......@@ -319,7 +314,7 @@ static ide_pci_device_t pci_chipsets[] __initdata = {
* settings of split-mirror pci-config space, place chipset into init-mode,
* and/or preserve an interrupt if the card is not native ide support.
*/
static unsigned int __init trust_pci_irq(ide_pci_device_t *d, struct pci_dev *dev)
static unsigned int __init trust_pci_irq(struct ata_pci_device *d, struct pci_dev *dev)
{
if (d->flags & ATA_F_IRQ)
return dev->irq;
......@@ -484,7 +479,7 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co
* Setup DMA transfers on a channel.
*/
static void __init setup_channel_dma(struct ata_channel *hwif, struct pci_dev *dev,
ide_pci_device_t *d,
struct ata_pci_device *d,
int port,
u8 class_rev,
int pciirq,
......@@ -534,7 +529,7 @@ static void __init setup_channel_dma(struct ata_channel *hwif, struct pci_dev *d
* This gets called once for the master and for the slave interface.
*/
static int __init setup_host_channel(struct pci_dev *dev,
ide_pci_device_t *d,
struct ata_pci_device *d,
int port,
u8 class_rev,
int pciirq,
......@@ -648,17 +643,16 @@ static int __init setup_host_channel(struct pci_dev *dev,
}
/*
* Looks at the primary/secondary channels on a PCI IDE device and, if they
* are enabled, prepares the IDE driver for use with them. This generic code
* works for most PCI chipsets.
* Looks at the primary/secondary channels on a PCI IDE device and, if they are
* enabled, prepares the IDE driver for use with them. This generic code works
* for most PCI chipsets.
*
* One thing that is not standardized is the location of the primary/secondary
* interface "enable/disable" bits. For chipsets that we "know" about, this
* information is in the ide_pci_device_t struct; for all other chipsets, we
* just assume both interfaces are enabled.
* information is in the struct ata_pci_device struct; for all other chipsets,
* we just assume both interfaces are enabled.
*/
static void __init setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
static void __init setup_pci_device(struct pci_dev *dev, struct ata_pci_device *d)
{
int autodma = 0;
int pciirq = 0;
......@@ -775,10 +769,11 @@ static void __init setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
setup_host_channel(dev, d, ATA_SECONDARY, class_rev, pciirq, autodma, &pcicmd);
}
static void __init pdc20270_device_order_fixup (struct pci_dev *dev, ide_pci_device_t *d)
static void __init pdc20270_device_order_fixup (struct pci_dev *dev, struct ata_pci_device *d)
{
struct pci_dev *dev2 = NULL, *findev;
ide_pci_device_t *d2;
struct pci_dev *dev2 = NULL;
struct pci_dev *findev;
struct ata_pci_device *d2;
if (dev->bus->self &&
dev->bus->self->vendor == PCI_VENDOR_ID_DEC &&
......@@ -814,10 +809,10 @@ static void __init pdc20270_device_order_fixup (struct pci_dev *dev, ide_pci_dev
setup_pci_device(dev2, d2);
}
static void __init hpt366_device_order_fixup (struct pci_dev *dev, ide_pci_device_t *d)
static void __init hpt366_device_order_fixup (struct pci_dev *dev, struct ata_pci_device *d)
{
struct pci_dev *dev2 = NULL, *findev;
ide_pci_device_t *d2;
struct ata_pci_device *d2;
unsigned char pin1 = 0, pin2 = 0;
unsigned int class_rev;
......@@ -843,9 +838,7 @@ static void __init hpt366_device_order_fixup (struct pci_dev *dev, ide_pci_devic
(PCI_FUNC(findev->devfn) & 1)) {
dev2 = findev;
pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin2);
hpt363_shared_pin = (pin1 != pin2) ? 1 : 0;
hpt363_shared_irq = (dev->irq == dev2->irq) ? 1 : 0;
if (hpt363_shared_pin && hpt363_shared_irq) {
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);
}
......@@ -869,7 +862,7 @@ static void __init scan_pcidev(struct pci_dev *dev)
{
unsigned short vendor;
unsigned short device;
ide_pci_device_t *d;
struct ata_pci_device *d;
vendor = dev->vendor;
device = dev->device;
......@@ -881,7 +874,7 @@ static void __init scan_pcidev(struct pci_dev *dev)
++d;
if (d->init_channel == ATA_PCI_IGNORE)
printk("%s: has been ignored by PCI bus scan\n", dev->name);
printk(KERN_INFO "ATA: %s: ignored by PCI bus scan\n", dev->name);
else if ((d->vendor == PCI_VENDOR_ID_OPTI && d->device == PCI_DEVICE_ID_OPTI_82C558) && !(PCI_FUNC(dev->devfn) & 1))
return;
else if ((d->vendor == PCI_VENDOR_ID_CONTAQ && d->device == PCI_DEVICE_ID_CONTAQ_82C693) && (!(PCI_FUNC(dev->devfn) & 1) || !((dev->class >> 8) == PCI_CLASS_STORAGE_IDE)))
......@@ -896,10 +889,10 @@ static void __init scan_pcidev(struct pci_dev *dev)
pdc20270_device_order_fixup(dev, d);
else if (!(d->vendor == 0 && d->device == 0) || (dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
if (d->vendor == 0 && d->device == 0)
printk("%s: unknown IDE controller on PCI slot %s, vendor=%04x, device=%04x\n",
dev->name, dev->slot_name, vendor, device);
printk(KERN_INFO "ATA: unknown ATA interface %s (%04x:%04x) on PCI slot %s\n",
dev->name, vendor, device, dev->slot_name);
else
printk("%s: IDE controller on PCI slot %s\n", dev->name, dev->slot_name);
printk(KERN_INFO "ATA: interface %s on PCI slot %s\n", dev->name, dev->slot_name);
setup_pci_device(dev, d);
}
}
......
This diff is collapsed.
This diff is collapsed.
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