Commit 88da4c77 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.8-pre2 IDE 29b

- Eliminate the mate member of the ata_channel structure. The information
   provided by it is already present. This patch may have undesirable
   effects on the ns87415.c and trm290.c host chip drivers, but it's worth
   for structural reasons to have it.

- Kill unused code, which was "fixing" interrupt routing from ide-pci.c Don't
   pass any "mate" between the functions there.

- Don't define SUPPORT_VLB_SYNC unconditionally in ide-taskfile.c

- Apply Vojtech Pavliks fix for piix host-chip driver crashes.

- Add linux/types.h to ide-pnp.c.

- Apply latest sis5513 host chip driver patch from by Lionel Bouton by hand.

- Apply patch by Paul Macerras for power-mac.

- Try to make the ns87415 driver a bit more reentrant.
parent 6e16d892
...@@ -1386,6 +1386,13 @@ P: Ingo Molnar ...@@ -1386,6 +1386,13 @@ P: Ingo Molnar
M: mingo@redhat.com M: mingo@redhat.com
S: Maintained S: Maintained
SIS 5513 IDE CONTROLLER DRIVER
P: Lionel Bouton
M: Lionel.Bouton@inet6.fr
W: http://inet6.dyn.dhs.org/sponsoring/sis5513/index.html
W: http://gyver.homeip.net/sis5513/index.html
S: Maintained
SIS 900/7016 FAST ETHERNET DRIVER SIS 900/7016 FAST ETHERNET DRIVER
P: Ollie Lho P: Ollie Lho
M: ollie@sis.com.tw M: ollie@sis.com.tw
......
...@@ -212,9 +212,8 @@ void __init init_ali14xx (void) ...@@ -212,9 +212,8 @@ void __init init_ali14xx (void)
ide_hwifs[1].chipset = ide_ali14xx; ide_hwifs[1].chipset = ide_ali14xx;
ide_hwifs[0].tuneproc = &ali14xx_tune_drive; ide_hwifs[0].tuneproc = &ali14xx_tune_drive;
ide_hwifs[1].tuneproc = &ali14xx_tune_drive; ide_hwifs[1].tuneproc = &ali14xx_tune_drive;
ide_hwifs[0].mate = &ide_hwifs[1]; ide_hwifs[0].unit = ATA_PRIMARY;
ide_hwifs[1].mate = &ide_hwifs[0]; ide_hwifs[1].unit = ATA_SECONDARY;
ide_hwifs[1].unit = 1;
/* initialize controller registers */ /* initialize controller registers */
if (!initRegisters()) { if (!initRegisters()) {
......
...@@ -689,7 +689,7 @@ static void cmd640_tune_drive (ide_drive_t *drive, byte mode_wanted) ...@@ -689,7 +689,7 @@ static void cmd640_tune_drive (ide_drive_t *drive, byte mode_wanted)
/* /*
* Probe for a cmd640 chipset, and initialize it if found. Called from ide.c * Probe for a cmd640 chipset, and initialize it if found. Called from ide.c
*/ */
int __init ide_probe_for_cmd640x (void) int __init ide_probe_for_cmd640x(void)
{ {
#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
int second_port_toggled = 0; int second_port_toggled = 0;
...@@ -793,9 +793,7 @@ int __init ide_probe_for_cmd640x (void) ...@@ -793,9 +793,7 @@ int __init ide_probe_for_cmd640x (void)
cmd_hwif0->serialized = 1; cmd_hwif0->serialized = 1;
cmd_hwif1->serialized = 1; cmd_hwif1->serialized = 1;
cmd_hwif1->chipset = ide_cmd640; cmd_hwif1->chipset = ide_cmd640;
cmd_hwif0->mate = cmd_hwif1; cmd_hwif1->unit = ATA_SECONDARY;
cmd_hwif1->mate = cmd_hwif0;
cmd_hwif1->unit = 1;
#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
cmd_hwif1->tuneproc = &cmd640_tune_drive; cmd_hwif1->tuneproc = &cmd640_tune_drive;
#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
...@@ -811,8 +809,8 @@ int __init ide_probe_for_cmd640x (void) ...@@ -811,8 +809,8 @@ int __init ide_probe_for_cmd640x (void)
ide_drive_t *drive = cmd_drives[index]; ide_drive_t *drive = cmd_drives[index];
#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
if (drive->autotune || ((index > 1) && second_port_toggled)) { if (drive->autotune || ((index > 1) && second_port_toggled)) {
/* /*
* Reset timing to the slowest speed and turn off prefetch. * Reset timing to the slowest speed and turn off prefetch.
* This way, the drive identify code has a better chance. * This way, the drive identify code has a better chance.
*/ */
setup_counts [index] = 4; /* max possible */ setup_counts [index] = 4; /* max possible */
......
...@@ -346,8 +346,7 @@ unsigned int __init pci_init_cs5530(struct pci_dev *dev) ...@@ -346,8 +346,7 @@ unsigned int __init pci_init_cs5530(struct pci_dev *dev)
*/ */
void __init ide_init_cs5530(struct ata_channel *hwif) void __init ide_init_cs5530(struct ata_channel *hwif)
{ {
if (hwif->mate) hwif->serialized = 1;
hwif->serialized = hwif->mate->serialized = 1;
if (!hwif->dma_base) { if (!hwif->dma_base) {
hwif->autodma = 0; hwif->autodma = 0;
} else { } else {
......
...@@ -124,7 +124,6 @@ void __init init_dtc2278 (void) ...@@ -124,7 +124,6 @@ void __init init_dtc2278 (void)
ide_hwifs[0].drives[1].no_unmask = 1; ide_hwifs[0].drives[1].no_unmask = 1;
ide_hwifs[1].drives[0].no_unmask = 1; ide_hwifs[1].drives[0].no_unmask = 1;
ide_hwifs[1].drives[1].no_unmask = 1; ide_hwifs[1].drives[1].no_unmask = 1;
ide_hwifs[0].mate = &ide_hwifs[1]; ide_hwifs[0].unit = ATA_PRIMARY;
ide_hwifs[1].mate = &ide_hwifs[0]; ide_hwifs[1].unit = ATA_SECONDARY;
ide_hwifs[1].unit = 1;
} }
...@@ -1125,13 +1125,13 @@ unsigned int __init pci_init_hpt366(struct pci_dev *dev) ...@@ -1125,13 +1125,13 @@ unsigned int __init pci_init_hpt366(struct pci_dev *dev)
if (n_hpt_devs < HPT366_MAX_DEVS) if (n_hpt_devs < HPT366_MAX_DEVS)
hpt_devs[n_hpt_devs++] = dev; hpt_devs[n_hpt_devs++] = dev;
#if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS) #if defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS)
if (!hpt366_proc) { if (!hpt366_proc) {
hpt366_proc = 1; hpt366_proc = 1;
hpt366_display_info = &hpt366_get_info; hpt366_display_info = &hpt366_get_info;
} }
#endif /* DISPLAY_HPT366_TIMINGS && CONFIG_PROC_FS */ #endif
return dev->irq; return dev->irq;
} }
...@@ -1146,7 +1146,7 @@ unsigned int __init ata66_hpt366(struct ata_channel *hwif) ...@@ -1146,7 +1146,7 @@ unsigned int __init ata66_hpt366(struct ata_channel *hwif)
printk("HPT366: reg5ah=0x%02x ATA-%s Cable Port%d\n", printk("HPT366: reg5ah=0x%02x ATA-%s Cable Port%d\n",
ata66, (ata66 & regmask) ? "33" : "66", ata66, (ata66 & regmask) ? "33" : "66",
PCI_FUNC(hwif->pci_dev->devfn)); PCI_FUNC(hwif->pci_dev->devfn));
#endif /* DEBUG */ #endif
return ((ata66 & regmask) ? 0 : 1); return ((ata66 & regmask) ? 0 : 1);
} }
......
...@@ -319,10 +319,9 @@ void __init init_ht6560b (void) ...@@ -319,10 +319,9 @@ void __init init_ht6560b (void)
ide_hwifs[1].tuneproc = &tune_ht6560b; ide_hwifs[1].tuneproc = &tune_ht6560b;
ide_hwifs[0].serialized = 1; /* is this needed? */ ide_hwifs[0].serialized = 1; /* is this needed? */
ide_hwifs[1].serialized = 1; /* is this needed? */ ide_hwifs[1].serialized = 1; /* is this needed? */
ide_hwifs[0].mate = &ide_hwifs[1]; ide_hwifs[0].unit = ATA_PRIMARY;
ide_hwifs[1].mate = &ide_hwifs[0]; ide_hwifs[1].unit = ATA_SECONDARY;
ide_hwifs[1].unit = 1;
/* /*
* Setting default configurations for drives * Setting default configurations for drives
*/ */
......
...@@ -421,7 +421,7 @@ int check_drive_lists (ide_drive_t *drive, int good_bad) ...@@ -421,7 +421,7 @@ int check_drive_lists (ide_drive_t *drive, int good_bad)
return 0; return 0;
} }
static int report_drive_dmaing (ide_drive_t *drive) int report_drive_dmaing (ide_drive_t *drive)
{ {
struct hd_driveid *id = drive->id; struct hd_driveid *id = drive->id;
......
...@@ -182,7 +182,7 @@ typedef struct ide_pci_device_s { ...@@ -182,7 +182,7 @@ typedef struct ide_pci_device_s {
unsigned short device; unsigned short device;
unsigned int (*init_chipset)(struct pci_dev *dev); unsigned int (*init_chipset)(struct pci_dev *dev);
unsigned int (*ata66_check)(struct ata_channel *hwif); unsigned int (*ata66_check)(struct ata_channel *hwif);
void (*init_hwif)(struct ata_channel *hwif); void (*init_channel)(struct ata_channel *hwif);
void (*dma_init)(struct ata_channel *hwif, unsigned long dmabase); void (*dma_init)(struct ata_channel *hwif, unsigned long dmabase);
ide_pci_enablebit_t enablebits[2]; ide_pci_enablebit_t enablebits[2];
unsigned int bootable; unsigned int bootable;
...@@ -436,24 +436,21 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co ...@@ -436,24 +436,21 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co
unsigned long dma_base = 0; unsigned long dma_base = 0;
struct pci_dev *dev = hwif->pci_dev; struct pci_dev *dev = hwif->pci_dev;
/* dma_base = pci_resource_start(dev, 4);
* If we are on the second channel, the dma base address will be one
* entry away from the primary interface.
*/
if (hwif->mate && hwif->mate->dma_base)
dma_base = hwif->mate->dma_base - (hwif->unit ? 0 : 8);
else
dma_base = pci_resource_start(dev, 4);
if (!dma_base) if (!dma_base)
return 0; return 0;
if (extra) /* PDC20246, PDC20262, HPT343, & HPT366 */ /* PDC20246, PDC20262, HPT343, & HPT366 */
if (extra) {
request_region(dma_base + 16, extra, name); request_region(dma_base + 16, extra, name);
hwif->dma_extra = extra;
}
dma_base += hwif->unit ? 8 : 0; /* If we are on the second channel, the dma base address will be one
hwif->dma_extra = extra; * entry away from the primary interface.
*/
if (hwif->unit == ATA_SECONDARY)
dma_base += 8;
if ((dev->vendor == PCI_VENDOR_ID_AL && dev->device == PCI_DEVICE_ID_AL_M5219) || if ((dev->vendor == PCI_VENDOR_ID_AL && dev->device == PCI_DEVICE_ID_AL_M5219) ||
(dev->vendor == PCI_VENDOR_ID_AMD && dev->device == PCI_DEVICE_ID_AMD_VIPER_7409) || (dev->vendor == PCI_VENDOR_ID_AMD && dev->device == PCI_DEVICE_ID_AMD_VIPER_7409) ||
...@@ -463,8 +460,7 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co ...@@ -463,8 +460,7 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co
printk(KERN_INFO "%s: simplex device: DMA forced\n", name); printk(KERN_INFO "%s: simplex device: DMA forced\n", name);
} else { } else {
/* /* If the device claims "simplex" DMA, this means only one of
* If the device claims "simplex" DMA, this means only one of
* the two interfaces can be trusted with DMA at any point in * the two interfaces can be trusted with DMA at any point in
* time. So we should enable DMA only on one of the two * time. So we should enable DMA only on one of the two
* interfaces. * interfaces.
...@@ -472,7 +468,7 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co ...@@ -472,7 +468,7 @@ static unsigned long __init get_dma_base(struct ata_channel *hwif, int extra, co
if ((inb(dma_base + 2) & 0x80)) { if ((inb(dma_base + 2) & 0x80)) {
if ((!hwif->drives[0].present && !hwif->drives[1].present) || if ((!hwif->drives[0].present && !hwif->drives[1].present) ||
(hwif->mate && hwif->mate->dma_base)) { hwif->unit == ATA_SECONDARY) {
printk("%s: simplex device: DMA disabled\n", name); printk("%s: simplex device: DMA disabled\n", name);
dma_base = 0; dma_base = 0;
} }
...@@ -489,8 +485,9 @@ static void __init setup_channel_dma(struct ata_channel *hwif, struct pci_dev *d ...@@ -489,8 +485,9 @@ static void __init setup_channel_dma(struct ata_channel *hwif, struct pci_dev *d
ide_pci_device_t *d, ide_pci_device_t *d,
int port, int port,
u8 class_rev, u8 class_rev,
int pciirq, struct ata_channel **mate, int pciirq,
int autodma, unsigned short *pcicmd) int autodma,
unsigned short *pcicmd)
{ {
unsigned long dma_base; unsigned long dma_base;
...@@ -503,8 +500,13 @@ static void __init setup_channel_dma(struct ata_channel *hwif, struct pci_dev *d ...@@ -503,8 +500,13 @@ static void __init setup_channel_dma(struct ata_channel *hwif, struct pci_dev *d
if (!((d->flags & ATA_F_DMA) || ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 0x80)))) if (!((d->flags & ATA_F_DMA) || ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 0x80))))
return; return;
dma_base = get_dma_base(hwif, (!*mate && d->extra) ? d->extra : 0, dev->name); dma_base = get_dma_base(hwif, ((port == ATA_PRIMARY) && d->extra) ? d->extra : 0, dev->name);
if (dma_base && !(*pcicmd & PCI_COMMAND_MASTER)) { if (!dma_base) {
printk("%s: %s Bus-Master DMA was disabled by BIOS\n", hwif->name, dev->name);
return;
}
if (!(*pcicmd & PCI_COMMAND_MASTER)) {
/* /*
* Set up BM-DMA capability (PnP BIOS should have done this already) * Set up BM-DMA capability (PnP BIOS should have done this already)
...@@ -517,13 +519,10 @@ static void __init setup_channel_dma(struct ata_channel *hwif, struct pci_dev *d ...@@ -517,13 +519,10 @@ static void __init setup_channel_dma(struct ata_channel *hwif, struct pci_dev *d
dma_base = 0; dma_base = 0;
} }
} }
if (dma_base) { if (d->dma_init)
if (d->dma_init) d->dma_init(hwif, dma_base);
d->dma_init(hwif, dma_base); else
else ide_setup_dma(hwif, dma_base, 8);
ide_setup_dma(hwif, dma_base, 8);
} else
printk("%s: %s Bus-Master DMA was disabled by BIOS\n", hwif->name, dev->name);
} }
#endif #endif
...@@ -537,17 +536,16 @@ static int __init setup_host_channel(struct pci_dev *dev, ...@@ -537,17 +536,16 @@ static int __init setup_host_channel(struct pci_dev *dev,
int port, int port,
u8 class_rev, u8 class_rev,
int pciirq, int pciirq,
struct ata_channel **mate,
int autodma, int autodma,
unsigned short *pcicmd) unsigned short *pcicmd)
{ {
unsigned long base = 0; unsigned long base = 0;
unsigned long ctl = 0; unsigned long ctl = 0;
ide_pci_enablebit_t *e = &(d->enablebits[port]); ide_pci_enablebit_t *e = &(d->enablebits[port]);
struct ata_channel *hwif; struct ata_channel *ch;
u8 tmp; u8 tmp;
if (port == 1) { if (port == ATA_SECONDARY) {
/* If this is a Promise FakeRaid controller, the 2nd controller /* If this is a Promise FakeRaid controller, the 2nd controller
* will be marked as disabled while it is actually there and * will be marked as disabled while it is actually there and
...@@ -569,7 +567,7 @@ static int __init setup_host_channel(struct pci_dev *dev, ...@@ -569,7 +567,7 @@ static int __init setup_host_channel(struct pci_dev *dev,
/* Nothing to be done for the second port. /* Nothing to be done for the second port.
*/ */
if (port == 1) { if (port == ATA_SECONDARY) {
if ((d->flags & ATA_F_HPTHACK) && (class_rev < 0x03)) if ((d->flags & ATA_F_HPTHACK) && (class_rev < 0x03))
return 0; return 0;
} }
...@@ -599,57 +597,50 @@ static int __init setup_host_channel(struct pci_dev *dev, ...@@ -599,57 +597,50 @@ static int __init setup_host_channel(struct pci_dev *dev,
if (!base) if (!base)
base = port ? 0x170 : 0x1f0; base = port ? 0x170 : 0x1f0;
if ((hwif = lookup_hwif(base, d->bootable, dev->name)) == NULL) if ((ch = lookup_hwif(base, d->bootable, dev->name)) == NULL)
return -ENOMEM; /* no room in ide_hwifs[] */ return -ENOMEM; /* no room in ide_hwifs[] */
if (hwif->io_ports[IDE_DATA_OFFSET] != base) { if (ch->io_ports[IDE_DATA_OFFSET] != base) {
ide_init_hwif_ports(&hwif->hw, base, (ctl | 2), NULL); ide_init_hwif_ports(&ch->hw, base, (ctl | 2), NULL);
memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); memcpy(ch->io_ports, ch->hw.io_ports, sizeof(ch->io_ports));
hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; ch->noprobe = !ch->io_ports[IDE_DATA_OFFSET];
} }
hwif->chipset = ide_pci; ch->chipset = ide_pci;
hwif->pci_dev = dev; ch->pci_dev = dev;
hwif->unit = port; ch->unit = port;
if (!hwif->irq) if (!ch->irq)
hwif->irq = pciirq; ch->irq = pciirq;
/* Setup the mate interface if we have two channels. /* Serialize the interfaces if requested by configuration information.
*/ */
if (*mate) { if (d->flags & ATA_F_SER)
hwif->mate = *mate; ch->serialized = 1;
(*mate)->mate = hwif;
if (d->flags & ATA_F_SER) {
hwif->serialized = 1;
(*mate)->serialized = 1;
}
}
/* Cross wired IRQ lines on UMC chips and no DMA transfers.*/ /* Cross wired IRQ lines on UMC chips and no DMA transfers.*/
if (d->flags & ATA_F_FIXIRQ) { if (d->flags & ATA_F_FIXIRQ) {
hwif->irq = port ? 15 : 14; ch->irq = port ? 15 : 14;
goto no_dma; goto no_dma;
} }
if (d->flags & ATA_F_NODMA) if (d->flags & ATA_F_NODMA)
goto no_dma; goto no_dma;
/* Check whatever this interface is UDMA4 mode capable. */ /* Check whatever this interface is UDMA4 mode capable. */
if (hwif->udma_four) { if (ch->udma_four) {
printk("%s: warning: ATA-66/100 forced bit set!\n", dev->name); printk("%s: warning: ATA-66/100 forced bit set!\n", dev->name);
} else { } else {
if (d->ata66_check) if (d->ata66_check)
hwif->udma_four = d->ata66_check(hwif); ch->udma_four = d->ata66_check(ch);
} }
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
setup_channel_dma(hwif, dev, d, port, class_rev, pciirq, mate, autodma, pcicmd); setup_channel_dma(ch, dev, d, port, class_rev, pciirq, autodma, pcicmd);
#endif #endif
no_dma: no_dma:
if (d->init_hwif) /* Call chipset-specific routine for each enabled hwif */ /* Call chipset-specific routine for each enabled channel. */
d->init_hwif(hwif); if (d->init_channel)
d->init_channel(ch);
*mate = hwif;
return 0; return 0;
} }
...@@ -671,7 +662,6 @@ static void __init setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) ...@@ -671,7 +662,6 @@ static void __init setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
int pciirq = 0; int pciirq = 0;
unsigned short pcicmd = 0; unsigned short pcicmd = 0;
unsigned short tried_config = 0; unsigned short tried_config = 0;
struct ata_channel *mate = NULL;
unsigned int class_rev; unsigned int class_rev;
#ifdef CONFIG_IDEDMA_AUTO #ifdef CONFIG_IDEDMA_AUTO
...@@ -679,9 +669,9 @@ static void __init setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) ...@@ -679,9 +669,9 @@ static void __init setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
autodma = 1; autodma = 1;
#endif #endif
if (d->init_hwif == IDE_NO_DRIVER) { if (d->init_channel == IDE_NO_DRIVER) {
printk(KERN_WARNING "%s: detected chipset, but driver not compiled in!\n", dev->name); printk(KERN_WARNING "%s: detected chipset, but driver not compiled in!\n", dev->name);
d->init_hwif = NULL; d->init_channel = NULL;
} }
if (pci_enable_device(dev)) { if (pci_enable_device(dev)) {
...@@ -779,8 +769,8 @@ static void __init setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) ...@@ -779,8 +769,8 @@ static void __init setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
/* /*
* Set up IDE chanells. First the primary, then the secondary. * Set up IDE chanells. First the primary, then the secondary.
*/ */
setup_host_channel(dev, d, 0, class_rev, pciirq, &mate, autodma, &pcicmd); setup_host_channel(dev, d, ATA_PRIMARY, class_rev, pciirq, autodma, &pcicmd);
setup_host_channel(dev, d, 1, class_rev, pciirq, &mate, 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, ide_pci_device_t *d)
...@@ -856,12 +846,6 @@ static void __init hpt366_device_order_fixup (struct pci_dev *dev, ide_pci_devic ...@@ -856,12 +846,6 @@ static void __init hpt366_device_order_fixup (struct pci_dev *dev, ide_pci_devic
if (hpt363_shared_pin && hpt363_shared_irq) { 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);
#if 0
/* I forgot why I did this once, but it fixed something. */
pci_write_config_byte(dev2, PCI_INTERRUPT_PIN, dev->irq);
printk("PCI: %s: Fixing interrupt %d pin %d to ZERO \n", d->name, dev2->irq, pin2);
pci_write_config_byte(dev2, PCI_INTERRUPT_LINE, 0);
#endif
} }
break; break;
} }
...@@ -894,7 +878,7 @@ static void __init scan_pcidev(struct pci_dev *dev) ...@@ -894,7 +878,7 @@ static void __init scan_pcidev(struct pci_dev *dev)
while (d->vendor && !(d->vendor == vendor && d->device == device)) while (d->vendor && !(d->vendor == vendor && d->device == device))
++d; ++d;
if (d->init_hwif == ATA_PCI_IGNORE) if (d->init_channel == ATA_PCI_IGNORE)
printk("%s: has been ignored by PCI bus scan\n", dev->name); printk("%s: has been 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;
......
This diff is collapsed.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/types.h>
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/init.h> #include <linux/init.h>
......
...@@ -140,7 +140,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd) ...@@ -140,7 +140,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
/* kludge for Apple PowerBook internal zip */ /* kludge for Apple PowerBook internal zip */
if (!strstr(id->model, "CD-ROM") && strstr(id->model, "ZIP")) { if (!strstr(id->model, "CD-ROM") && strstr(id->model, "ZIP")) {
printk ("FLOPPY"); printk ("FLOPPY");
type = ide_floppy; type = ATA_FLOPPY;
break; break;
} }
#endif #endif
...@@ -666,13 +666,12 @@ static int init_irq(struct ata_channel *hwif) ...@@ -666,13 +666,12 @@ static int init_irq(struct ata_channel *hwif)
hwif->sharing_irq = h->sharing_irq = 1; hwif->sharing_irq = h->sharing_irq = 1;
if (hwif->chipset != ide_pci || h->chipset != ide_pci) if (hwif->chipset != ide_pci || h->chipset != ide_pci)
save_match(hwif, h, &match); save_match(hwif, h, &match);
}
if (hwif->serialized) { /* FIXME: This is still confusing. What would
if (hwif->mate && hwif->mate->irq == h->irq) * happen if we match-ed two times?
save_match(hwif, h, &match); */
}
if (h->serialized) { if (hwif->serialized || h->serialized)
if (h->mate && hwif->irq == h->mate->irq)
save_match(hwif, h, &match); save_match(hwif, h, &match);
} }
} }
...@@ -823,12 +822,11 @@ static void init_gendisk(struct ata_channel *hwif) ...@@ -823,12 +822,11 @@ static void init_gendisk(struct ata_channel *hwif)
for (unit = 0; unit < MAX_DRIVES; ++unit) { for (unit = 0; unit < MAX_DRIVES; ++unit) {
char name[80]; char name[80];
ide_add_generic_settings(hwif->drives + unit); ide_add_generic_settings(hwif->drives + unit);
hwif->drives[unit].dn = ((hwif->unit ? 2 : 0) + unit); hwif->drives[unit].dn = ((hwif->unit ? 2 : 0) + unit);
sprintf (name, "host%d/bus%d/target%d/lun%d", sprintf (name, "host%d/bus%d/target%d/lun%d",
(hwif->unit && hwif->mate) ? hwif->index, hwif->unit, unit, hwif->drives[unit].lun);
hwif->mate->index : hwif->index,
hwif->unit, unit, hwif->drives[unit].lun);
if (hwif->drives[unit].present) if (hwif->drives[unit].present)
hwif->drives[unit].de = devfs_mk_dir(ide_devfs_handle, name, NULL); hwif->drives[unit].de = devfs_mk_dir(ide_devfs_handle, name, NULL);
} }
......
...@@ -164,19 +164,6 @@ static int proc_ide_read_imodel ...@@ -164,19 +164,6 @@ static int proc_ide_read_imodel
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
} }
static int proc_ide_read_mate
(char *page, char **start, off_t off, int count, int *eof, void *data)
{
struct ata_channel *hwif = data;
int len;
if (hwif && hwif->mate && hwif->mate->present)
len = sprintf(page, "%s\n", hwif->mate->name);
else
len = sprintf(page, "(none)\n");
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
}
static int proc_ide_read_channel static int proc_ide_read_channel
(char *page, char **start, off_t off, int count, int *eof, void *data) (char *page, char **start, off_t off, int count, int *eof, void *data)
{ {
...@@ -493,7 +480,6 @@ void destroy_proc_ide_drives(struct ata_channel *hwif) ...@@ -493,7 +480,6 @@ void destroy_proc_ide_drives(struct ata_channel *hwif)
static ide_proc_entry_t hwif_entries[] = { static ide_proc_entry_t hwif_entries[] = {
{ "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL }, { "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL },
{ "mate", S_IFREG|S_IRUGO, proc_ide_read_mate, NULL },
{ "model", S_IFREG|S_IRUGO, proc_ide_read_imodel, NULL }, { "model", S_IFREG|S_IRUGO, proc_ide_read_imodel, NULL },
{ NULL, 0, NULL, NULL } { NULL, 0, NULL, NULL }
}; };
......
...@@ -2177,7 +2177,7 @@ int ide_register_hw(hw_regs_t *hw, struct ata_channel **hwifp) ...@@ -2177,7 +2177,7 @@ int ide_register_hw(hw_regs_t *hw, struct ata_channel **hwifp)
} }
for (h = 0; h < MAX_HWIFS; ++h) { for (h = 0; h < MAX_HWIFS; ++h) {
hwif = &ide_hwifs[h]; hwif = &ide_hwifs[h];
if ((!hwif->present && !hwif->mate && !initializing) || if ((!hwif->present && (hwif->unit == ATA_PRIMARY) && !initializing) ||
(!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing)) (!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing))
goto found; goto found;
} }
...@@ -3052,9 +3052,13 @@ int __init ide_setup (char *s) ...@@ -3052,9 +3052,13 @@ int __init ide_setup (char *s)
goto done; goto done;
case -2: /* "serialize" */ case -2: /* "serialize" */
do_serialize: do_serialize:
hwif->mate = &ide_hwifs[hw^1]; {
hwif->mate->mate = hwif; struct ata_channel *mate;
hwif->serialized = hwif->mate->serialized = 1;
mate = &ide_hwifs[hw ^ 1];
hwif->serialized = 1;
mate->serialized = 1;
}
goto done; goto done;
case -1: /* "noprobe" */ case -1: /* "noprobe" */
......
...@@ -141,11 +141,21 @@ void __init ide_init_ns87415(struct ata_channel *hwif) ...@@ -141,11 +141,21 @@ void __init ide_init_ns87415(struct ata_channel *hwif)
using_inta = progif & (1 << (hwif->unit << 1)); using_inta = progif & (1 << (hwif->unit << 1));
if (!using_inta) if (!using_inta)
using_inta = ctrl & (1 << (4 + hwif->unit)); using_inta = ctrl & (1 << (4 + hwif->unit));
if (hwif->mate) { if (hwif->unit == ATA_SECONDARY) {
hwif->select_data = hwif->mate->select_data;
/* FIXME: If we are initializing the secondary channel, let us
* assume that the primary channel got initialized just a tad
* bit before now. It would be much cleaner if the data in
* ns87415_control just got duplicated.
*/
if (!hwif->select_data)
hwif->select_data = (unsigned long)
&ns87415_control[ns87415_count - 1];
} else { } else {
hwif->select_data = (unsigned long) if (!hwif->select_data)
&ns87415_control[ns87415_count++]; hwif->select_data = (unsigned long)
&ns87415_control[ns87415_count++];
ctrl |= (1 << 8) | (1 << 9); /* mask both IRQs */ ctrl |= (1 << 8) | (1 << 9); /* mask both IRQs */
if (using_inta) if (using_inta)
ctrl &= ~(1 << 6); /* unmask INTA */ ctrl &= ~(1 << 6); /* unmask INTA */
...@@ -170,9 +180,9 @@ void __init ide_init_ns87415(struct ata_channel *hwif) ...@@ -170,9 +180,9 @@ void __init ide_init_ns87415(struct ata_channel *hwif)
do { do {
udelay(50); udelay(50);
stat = inb(hwif->io_ports[IDE_STATUS_OFFSET]); stat = inb(hwif->io_ports[IDE_STATUS_OFFSET]);
if (stat == 0xff) if (stat == 0xff)
break; break;
} while ((stat & BUSY_STAT) && --timeout); } while ((stat & BUSY_STAT) && --timeout);
#endif #endif
} }
...@@ -181,13 +191,23 @@ void __init ide_init_ns87415(struct ata_channel *hwif) ...@@ -181,13 +191,23 @@ void __init ide_init_ns87415(struct ata_channel *hwif)
if (!using_inta) if (!using_inta)
hwif->irq = hwif->unit ? 15 : 14; /* legacy mode */ hwif->irq = hwif->unit ? 15 : 14; /* legacy mode */
else if (!hwif->irq && hwif->mate && hwif->mate->irq) else {
hwif->irq = hwif->mate->irq; /* share IRQ with mate */ static int primary_irq = 0;
/* Ugly way to let the primary and secondary channel on the
* chip use the same IRQ line.
*/
if (hwif->unit == ATA_PRIMARY)
primary_irq = hwif->irq;
else if (!hwif->irq)
hwif->irq = primary_irq;
}
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) if (hwif->dma_base)
hwif->dmaproc = &ns87415_dmaproc; hwif->dmaproc = &ns87415_dmaproc;
#endif /* CONFIG_BLK_DEV_IDEDMA */ #endif
hwif->selectproc = &ns87415_selectproc; hwif->selectproc = &ns87415_selectproc;
} }
...@@ -162,7 +162,7 @@ int __init setup_pdc4030(struct ata_channel *hwif) ...@@ -162,7 +162,7 @@ int __init setup_pdc4030(struct ata_channel *hwif)
struct dc_ident ident; struct dc_ident ident;
int i; int i;
ide_startstop_t startstop; ide_startstop_t startstop;
if (!hwif) return 0; if (!hwif) return 0;
drive = &hwif->drives[0]; drive = &hwif->drives[0];
...@@ -224,9 +224,8 @@ int __init setup_pdc4030(struct ata_channel *hwif) ...@@ -224,9 +224,8 @@ int __init setup_pdc4030(struct ata_channel *hwif)
*/ */
hwif->chipset = hwif2->chipset = ide_pdc4030; hwif->chipset = hwif2->chipset = ide_pdc4030;
hwif->mate = hwif2; hwif->unit = ATA_PRIMARY;
hwif2->mate = hwif; hwif2->unit = ATA_SECONDARY;
hwif2->unit = 1;
hwif->selectproc = hwif2->selectproc = &promise_selectproc; hwif->selectproc = hwif2->selectproc = &promise_selectproc;
hwif->serialized = hwif2->serialized = 1; hwif->serialized = hwif2->serialized = 1;
......
/* /*
* $Id: piix.c,v 1.2 2002/03/13 22:50:43 vojtech Exp $ * $Id: piix.c,v 1.3 2002/03/29 16:06:06 vojtech Exp $
* *
* Copyright (c) 2000-2002 Vojtech Pavlik * Copyright (c) 2000-2002 Vojtech Pavlik
* *
...@@ -128,7 +128,7 @@ static int piix_get_info(char *buffer, char **addr, off_t offset, int count) ...@@ -128,7 +128,7 @@ static int piix_get_info(char *buffer, char **addr, off_t offset, int count)
piix_print("----------PIIX BusMastering IDE Configuration---------------"); piix_print("----------PIIX BusMastering IDE Configuration---------------");
piix_print("Driver Version: 1.2"); piix_print("Driver Version: 1.3");
piix_print("South Bridge: %s", bmide_dev->name); piix_print("South Bridge: %s", bmide_dev->name);
pci_read_config_byte(dev, PCI_REVISION_ID, &t); pci_read_config_byte(dev, PCI_REVISION_ID, &t);
...@@ -331,7 +331,7 @@ static int piix_set_drive(ide_drive_t *drive, unsigned char speed) ...@@ -331,7 +331,7 @@ static int piix_set_drive(ide_drive_t *drive, unsigned char speed)
umul = 2; umul = 2;
T = 1000000000 / piix_clock; T = 1000000000 / piix_clock;
UT = T / umul; UT = umul ? (T / umul) : 0;
ata_timing_compute(drive, speed, &t, T, UT); ata_timing_compute(drive, speed, &t, T, UT);
......
...@@ -411,22 +411,23 @@ int __init probe (int base) ...@@ -411,22 +411,23 @@ int __init probe (int base)
return 1; return 1;
} else { } else {
int i,j; int i;
/* secondary enabled */ /* secondary enabled */
printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n", printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n",
ide_hwifs[0].name,ide_hwifs[1].name); ide_hwifs[0].name,ide_hwifs[1].name);
for (i=0;i<2;i++) { for (i = 0; i < 2; i++) {
int j;
ide_hwifs[i].chipset = ide_qd65xx; ide_hwifs[i].chipset = ide_qd65xx;
ide_hwifs[i].mate = &ide_hwifs[i^1];
ide_hwifs[i].unit = i; ide_hwifs[i].unit = i;
ide_hwifs[i].select_data = base; ide_hwifs[i].select_data = base;
ide_hwifs[i].config_data = config | (control <<8); ide_hwifs[i].config_data = config | (control <<8);
ide_hwifs[i].tuneproc = &qd6580_tune_drive; ide_hwifs[i].tuneproc = &qd6580_tune_drive;
for (j=0;j<2;j++) { for (j = 0; j < 2; j++) {
ide_hwifs[i].drives[j].drive_data = ide_hwifs[i].drives[j].drive_data =
i?QD6580_DEF_DATA2:QD6580_DEF_DATA; i?QD6580_DEF_DATA2:QD6580_DEF_DATA;
ide_hwifs[i].drives[j].io_32bit = 1; ide_hwifs[i].drives[j].io_32bit = 1;
......
This diff is collapsed.
...@@ -248,8 +248,19 @@ void __init ide_init_trm290(struct ata_channel *hwif) ...@@ -248,8 +248,19 @@ void __init ide_init_trm290(struct ata_channel *hwif)
if ((reg & 0x10)) if ((reg & 0x10))
hwif->irq = hwif->unit ? 15 : 14; /* legacy mode */ hwif->irq = hwif->unit ? 15 : 14; /* legacy mode */
else if (!hwif->irq && hwif->mate && hwif->mate->irq) else {
hwif->irq = hwif->mate->irq; /* sharing IRQ with mate */ static int primary_irq = 0;
/* Ugly way to let the primary and secondary channel on the
* chip use the same IRQ line.
*/
if (hwif->unit == ATA_PRIMARY)
primary_irq = hwif->irq;
else if (!hwif->irq)
hwif->irq = primary_irq;
}
ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->unit ? 0x0080 : 0x0000), 3); ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->unit ? 0x0080 : 0x0000), 3);
#ifdef CONFIG_BLK_DEV_IDEDMA #ifdef CONFIG_BLK_DEV_IDEDMA
......
...@@ -146,7 +146,7 @@ void __init init_umc8672 (void) /* called from ide.c */ ...@@ -146,7 +146,7 @@ void __init init_umc8672 (void) /* called from ide.c */
{ {
__restore_flags(flags); /* local CPU only */ __restore_flags(flags); /* local CPU only */
printk ("umc8672: not found\n"); printk ("umc8672: not found\n");
return; return;
} }
outb_p (0xa5,0x108); /* disable umc */ outb_p (0xa5,0x108); /* disable umc */
...@@ -158,7 +158,6 @@ void __init init_umc8672 (void) /* called from ide.c */ ...@@ -158,7 +158,6 @@ void __init init_umc8672 (void) /* called from ide.c */
ide_hwifs[1].chipset = ide_umc8672; ide_hwifs[1].chipset = ide_umc8672;
ide_hwifs[0].tuneproc = &tune_umc; ide_hwifs[0].tuneproc = &tune_umc;
ide_hwifs[1].tuneproc = &tune_umc; ide_hwifs[1].tuneproc = &tune_umc;
ide_hwifs[0].mate = &ide_hwifs[1]; ide_hwifs[0].unit = ATA_PRIMARY;
ide_hwifs[1].mate = &ide_hwifs[0]; ide_hwifs[1].unit = ATA_SECONDARY;
ide_hwifs[1].unit = 1;
} }
...@@ -433,10 +433,10 @@ typedef void (ide_intrproc_t) (ide_drive_t *); ...@@ -433,10 +433,10 @@ typedef void (ide_intrproc_t) (ide_drive_t *);
typedef void (ide_maskproc_t) (ide_drive_t *, int); typedef void (ide_maskproc_t) (ide_drive_t *, int);
typedef void (ide_rw_proc_t) (ide_drive_t *, ide_dma_action_t); typedef void (ide_rw_proc_t) (ide_drive_t *, ide_dma_action_t);
/* enum {
* ide soft-power support ATA_PRIMARY = 0,
*/ ATA_SECONDARY = 1
typedef int (ide_busproc_t) (ide_drive_t *, int); };
struct ata_channel { struct ata_channel {
struct device dev; /* device handle */ struct device dev; /* device handle */
...@@ -467,7 +467,6 @@ struct ata_channel { ...@@ -467,7 +467,6 @@ struct ata_channel {
struct scatterlist *sg_table; /* Scatter-gather list used to build the above */ struct scatterlist *sg_table; /* Scatter-gather list used to build the above */
int sg_nents; /* Current number of entries in it */ int sg_nents; /* Current number of entries in it */
int sg_dma_direction; /* dma transfer direction */ int sg_dma_direction; /* dma transfer direction */
struct ata_channel *mate; /* other hwif from same PCI chip */
unsigned long dma_base; /* base addr for dma ports */ unsigned long dma_base; /* base addr for dma ports */
unsigned dma_extra; /* extra addr for dma ports */ unsigned dma_extra; /* extra addr for dma ports */
unsigned long config_data; /* for use by chipset-specific code */ unsigned long config_data; /* for use by chipset-specific code */
...@@ -480,7 +479,7 @@ struct ata_channel { ...@@ -480,7 +479,7 @@ struct ata_channel {
hwif_chipset_t chipset; /* sub-module for tuning.. */ hwif_chipset_t chipset; /* sub-module for tuning.. */
unsigned noprobe : 1; /* don't probe for this interface */ unsigned noprobe : 1; /* don't probe for this interface */
unsigned present : 1; /* there is a device on this interface */ unsigned present : 1; /* there is a device on this interface */
unsigned serialized : 1; /* serialized operation with mate hwif */ unsigned serialized : 1; /* serialized operation between channels */
unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
unsigned reset : 1; /* reset after probe */ unsigned reset : 1; /* reset after probe */
unsigned autodma : 1; /* automatically try to enable DMA at boot */ unsigned autodma : 1; /* automatically try to enable DMA at boot */
...@@ -490,7 +489,7 @@ struct ata_channel { ...@@ -490,7 +489,7 @@ struct ata_channel {
unsigned long last_time; /* time when previous rq was done */ unsigned long last_time; /* time when previous rq was done */
#endif #endif
byte straight8; /* Alan's straight 8 check */ byte straight8; /* Alan's straight 8 check */
ide_busproc_t *busproc; /* driver soft-power interface */ int (*busproc)(ide_drive_t *, int); /* driver soft-power interface */
byte bus_state; /* power state of the IDE bus */ byte bus_state; /* power state of the IDE bus */
}; };
...@@ -513,7 +512,6 @@ typedef enum { ...@@ -513,7 +512,6 @@ typedef enum {
*/ */
typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *); typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *);
typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
typedef ide_startstop_t (ide_post_handler_t)(ide_drive_t *);
/* /*
* when ide_timer_expiry fires, invoke a handler of this type * when ide_timer_expiry fires, invoke a handler of this type
......
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