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