aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/setup-pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/setup-pci.c')
-rw-r--r--drivers/ide/setup-pci.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index c88d33225cf9..30e596c0f120 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -5,12 +5,6 @@
5 * 5 *
6 * Copyright (c) 1995-1998 Mark Lord 6 * Copyright (c) 1995-1998 Mark Lord
7 * May be copied or modified under the terms of the GNU General Public License 7 * May be copied or modified under the terms of the GNU General Public License
8 *
9 * Recent Changes
10 * Split the set up function into multiple functions
11 * Use pci_set_master
12 * Fix misreporting of I/O v MMIO problems
13 * Initial fixups for simplex devices
14 */ 8 */
15 9
16/* 10/*
@@ -407,7 +401,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
407 unsigned long ctl = 0, base = 0; 401 unsigned long ctl = 0, base = 0;
408 ide_hwif_t *hwif; 402 ide_hwif_t *hwif;
409 403
410 if ((d->flags & IDEPCI_FLAG_ISA_PORTS) == 0) { 404 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) {
411 /* Possibly we should fail if these checks report true */ 405 /* Possibly we should fail if these checks report true */
412 ide_pci_check_iomem(dev, d, 2*port); 406 ide_pci_check_iomem(dev, d, 2*port);
413 ide_pci_check_iomem(dev, d, 2*port+1); 407 ide_pci_check_iomem(dev, d, 2*port+1);
@@ -571,7 +565,7 @@ out:
571 565
572void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) 566void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index)
573{ 567{
574 int port; 568 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
575 int at_least_one_hwif_enabled = 0; 569 int at_least_one_hwif_enabled = 0;
576 ide_hwif_t *hwif, *mate = NULL; 570 ide_hwif_t *hwif, *mate = NULL;
577 u8 tmp; 571 u8 tmp;
@@ -582,16 +576,13 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
582 * Set up the IDE ports 576 * Set up the IDE ports
583 */ 577 */
584 578
585 for (port = 0; port <= 1; ++port) { 579 for (port = 0; port < channels; ++port) {
586 ide_pci_enablebit_t *e = &(d->enablebits[port]); 580 ide_pci_enablebit_t *e = &(d->enablebits[port]);
587 581
588 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 582 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) ||
589 (tmp & e->mask) != e->val)) 583 (tmp & e->mask) != e->val))
590 continue; /* port not enabled */ 584 continue; /* port not enabled */
591 585
592 if (d->channels <= port)
593 break;
594
595 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) 586 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL)
596 continue; 587 continue;
597 588
@@ -616,6 +607,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
616 else 607 else
617 ide_hwif_setup_dma(dev, d, hwif); 608 ide_hwif_setup_dma(dev, d, hwif);
618bypass_legacy_dma: 609bypass_legacy_dma:
610 hwif->host_flags = d->host_flags;
611 hwif->pio_mask = d->pio_mask;
612
619 if (d->init_hwif) 613 if (d->init_hwif)
620 /* Call chipset-specific routine 614 /* Call chipset-specific routine
621 * for each enabled hwif 615 * for each enabled hwif