|
@@ -147,6 +147,7 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name)
|
|
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
|
|
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
|
|
/**
|
|
/**
|
|
* ide_get_or_set_dma_base - setup BMIBA
|
|
* ide_get_or_set_dma_base - setup BMIBA
|
|
|
|
+ * @d: IDE pci device data
|
|
* @hwif: Interface
|
|
* @hwif: Interface
|
|
*
|
|
*
|
|
* Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space.
|
|
* Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space.
|
|
@@ -154,7 +155,7 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name)
|
|
* and enforce IDE simplex rules.
|
|
* and enforce IDE simplex rules.
|
|
*/
|
|
*/
|
|
|
|
|
|
-static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
|
|
|
|
|
|
+static unsigned long ide_get_or_set_dma_base(ide_pci_device_t *d, ide_hwif_t *hwif)
|
|
{
|
|
{
|
|
unsigned long dma_base = 0;
|
|
unsigned long dma_base = 0;
|
|
struct pci_dev *dev = hwif->pci_dev;
|
|
struct pci_dev *dev = hwif->pci_dev;
|
|
@@ -165,14 +166,15 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
|
|
if (hwif->mate && hwif->mate->dma_base) {
|
|
if (hwif->mate && hwif->mate->dma_base) {
|
|
dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8);
|
|
dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8);
|
|
} else {
|
|
} else {
|
|
- dma_base = pci_resource_start(dev, 4);
|
|
|
|
- if (!dma_base) {
|
|
|
|
- printk(KERN_ERR "%s: dma_base is invalid\n",
|
|
|
|
- hwif->cds->name);
|
|
|
|
- }
|
|
|
|
|
|
+ u8 baridx = (d->host_flags & IDE_HFLAG_CS5520) ? 2 : 4;
|
|
|
|
+
|
|
|
|
+ dma_base = pci_resource_start(dev, baridx);
|
|
|
|
+
|
|
|
|
+ if (dma_base == 0)
|
|
|
|
+ printk(KERN_ERR "%s: DMA base is invalid\n", d->name);
|
|
}
|
|
}
|
|
|
|
|
|
- if (dma_base) {
|
|
|
|
|
|
+ if ((d->host_flags & IDE_HFLAG_CS5520) == 0 && dma_base) {
|
|
u8 simplex_stat = 0;
|
|
u8 simplex_stat = 0;
|
|
dma_base += hwif->channel ? 8 : 0;
|
|
dma_base += hwif->channel ? 8 : 0;
|
|
|
|
|
|
@@ -188,8 +190,8 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
|
|
simplex_stat = hwif->INB(dma_base + 2);
|
|
simplex_stat = hwif->INB(dma_base + 2);
|
|
if (simplex_stat & 0x80) {
|
|
if (simplex_stat & 0x80) {
|
|
printk(KERN_INFO "%s: simplex device: "
|
|
printk(KERN_INFO "%s: simplex device: "
|
|
- "DMA forced\n",
|
|
|
|
- hwif->cds->name);
|
|
|
|
|
|
+ "DMA forced\n",
|
|
|
|
+ d->name);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
@@ -212,8 +214,8 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
|
|
*/
|
|
*/
|
|
if (hwif->mate && hwif->mate->dma_base) {
|
|
if (hwif->mate && hwif->mate->dma_base) {
|
|
printk(KERN_INFO "%s: simplex device: "
|
|
printk(KERN_INFO "%s: simplex device: "
|
|
- "DMA disabled\n",
|
|
|
|
- hwif->cds->name);
|
|
|
|
|
|
+ "DMA disabled\n",
|
|
|
|
+ d->name);
|
|
dma_base = 0;
|
|
dma_base = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -434,7 +436,7 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
|
|
if ((d->host_flags & IDE_HFLAG_NO_AUTODMA) == 0 ||
|
|
if ((d->host_flags & IDE_HFLAG_NO_AUTODMA) == 0 ||
|
|
((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
|
|
((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
|
|
(dev->class & 0x80))) {
|
|
(dev->class & 0x80))) {
|
|
- unsigned long dma_base = ide_get_or_set_dma_base(hwif);
|
|
|
|
|
|
+ unsigned long dma_base = ide_get_or_set_dma_base(d, hwif);
|
|
if (dma_base && !(pcicmd & PCI_COMMAND_MASTER)) {
|
|
if (dma_base && !(pcicmd & PCI_COMMAND_MASTER)) {
|
|
/*
|
|
/*
|
|
* Set up BM-DMA capability
|
|
* Set up BM-DMA capability
|
|
@@ -559,14 +561,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
|
|
if (d->init_iops)
|
|
if (d->init_iops)
|
|
d->init_iops(hwif);
|
|
d->init_iops(hwif);
|
|
|
|
|
|
- if (d->host_flags & IDE_HFLAG_NO_DMA)
|
|
|
|
- goto bypass_legacy_dma;
|
|
|
|
-
|
|
|
|
- if(d->init_setup_dma)
|
|
|
|
- d->init_setup_dma(dev, d, hwif);
|
|
|
|
- else
|
|
|
|
|
|
+ if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0)
|
|
ide_hwif_setup_dma(dev, d, hwif);
|
|
ide_hwif_setup_dma(dev, d, hwif);
|
|
-bypass_legacy_dma:
|
|
|
|
|
|
+
|
|
hwif->host_flags = d->host_flags;
|
|
hwif->host_flags = d->host_flags;
|
|
hwif->pio_mask = d->pio_mask;
|
|
hwif->pio_mask = d->pio_mask;
|
|
|
|
|