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.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index e85d1ed29c2a..24bc884826fc 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -305,7 +305,6 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *
305 * @dev: PCI device holding interface 305 * @dev: PCI device holding interface
306 * @d: IDE port info 306 * @d: IDE port info
307 * @port: port number 307 * @port: port number
308 * @irq: PCI IRQ
309 * @hw: hw_regs_t instance corresponding to this port 308 * @hw: hw_regs_t instance corresponding to this port
310 * 309 *
311 * Perform the initial set up for the hardware interface structure. This 310 * Perform the initial set up for the hardware interface structure. This
@@ -316,7 +315,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *
316 */ 315 */
317 316
318static int ide_hw_configure(struct pci_dev *dev, const struct ide_port_info *d, 317static int ide_hw_configure(struct pci_dev *dev, const struct ide_port_info *d,
319 unsigned int port, int irq, hw_regs_t *hw) 318 unsigned int port, hw_regs_t *hw)
320{ 319{
321 unsigned long ctl = 0, base = 0; 320 unsigned long ctl = 0, base = 0;
322 321
@@ -344,7 +343,6 @@ static int ide_hw_configure(struct pci_dev *dev, const struct ide_port_info *d,
344 } 343 }
345 344
346 memset(hw, 0, sizeof(*hw)); 345 memset(hw, 0, sizeof(*hw));
347 hw->irq = irq;
348 hw->dev = &dev->dev; 346 hw->dev = &dev->dev;
349 hw->chipset = d->chipset ? d->chipset : ide_pci; 347 hw->chipset = d->chipset ? d->chipset : ide_pci;
350 ide_std_init_ports(hw, base, ctl | 2); 348 ide_std_init_ports(hw, base, ctl | 2);
@@ -448,7 +446,6 @@ out:
448 * ide_pci_setup_ports - configure ports/devices on PCI IDE 446 * ide_pci_setup_ports - configure ports/devices on PCI IDE
449 * @dev: PCI device 447 * @dev: PCI device
450 * @d: IDE port info 448 * @d: IDE port info
451 * @pciirq: IRQ line
452 * @hw: hw_regs_t instances corresponding to this PCI IDE device 449 * @hw: hw_regs_t instances corresponding to this PCI IDE device
453 * @hws: hw_regs_t pointers table to update 450 * @hws: hw_regs_t pointers table to update
454 * 451 *
@@ -462,7 +459,7 @@ out:
462 */ 459 */
463 460
464void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, 461void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d,
465 int pciirq, hw_regs_t *hw, hw_regs_t **hws) 462 hw_regs_t *hw, hw_regs_t **hws)
466{ 463{
467 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; 464 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
468 u8 tmp; 465 u8 tmp;
@@ -481,7 +478,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d,
481 continue; /* port not enabled */ 478 continue; /* port not enabled */
482 } 479 }
483 480
484 if (ide_hw_configure(dev, d, port, pciirq, hw + port)) 481 if (ide_hw_configure(dev, d, port, hw + port))
485 continue; 482 continue;
486 483
487 *(hws + port) = hw + port; 484 *(hws + port) = hw + port;
@@ -524,7 +521,7 @@ static int do_ide_setup_pci_device(struct pci_dev *dev,
524 if (noisy) 521 if (noisy)
525 printk(KERN_INFO "%s %s: not 100%% native mode: will " 522 printk(KERN_INFO "%s %s: not 100%% native mode: will "
526 "probe irqs later\n", d->name, pci_name(dev)); 523 "probe irqs later\n", d->name, pci_name(dev));
527 pciirq = ret; 524 pciirq = 0;
528 } else if (!pciirq && noisy) { 525 } else if (!pciirq && noisy) {
529 printk(KERN_WARNING "%s %s: bad irq (%d): will probe later\n", 526 printk(KERN_WARNING "%s %s: bad irq (%d): will probe later\n",
530 d->name, pci_name(dev), pciirq); 527 d->name, pci_name(dev), pciirq);
@@ -549,7 +546,7 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d,
549 if (ret < 0) 546 if (ret < 0)
550 goto out; 547 goto out;
551 548
552 ide_pci_setup_ports(dev, d, 0, &hw[0], &hws[0]); 549 ide_pci_setup_ports(dev, d, &hw[0], &hws[0]);
553 550
554 host = ide_host_alloc(d, hws); 551 host = ide_host_alloc(d, hws);
555 if (host == NULL) { 552 if (host == NULL) {
@@ -568,7 +565,11 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d,
568 goto out; 565 goto out;
569 566
570 /* fixup IRQ */ 567 /* fixup IRQ */
571 hw[1].irq = hw[0].irq = ret; 568 if (ide_pci_is_in_compatibility_mode(dev)) {
569 hw[0].irq = pci_get_legacy_ide_irq(dev, 0);
570 hw[1].irq = pci_get_legacy_ide_irq(dev, 1);
571 } else
572 hw[1].irq = hw[0].irq = ret;
572 573
573 ret = ide_host_register(host, d, hws); 574 ret = ide_host_register(host, d, hws);
574 if (ret) 575 if (ret)
@@ -591,7 +592,7 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
591 if (ret < 0) 592 if (ret < 0)
592 goto out; 593 goto out;
593 594
594 ide_pci_setup_ports(pdev[i], d, 0, &hw[i*2], &hws[i*2]); 595 ide_pci_setup_ports(pdev[i], d, &hw[i*2], &hws[i*2]);
595 } 596 }
596 597
597 host = ide_host_alloc(d, hws); 598 host = ide_host_alloc(d, hws);
@@ -619,7 +620,11 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
619 goto out; 620 goto out;
620 621
621 /* fixup IRQ */ 622 /* fixup IRQ */
622 hw[i*2 + 1].irq = hw[i*2].irq = ret; 623 if (ide_pci_is_in_compatibility_mode(pdev[i])) {
624 hw[i*2].irq = pci_get_legacy_ide_irq(pdev[i], 0);
625 hw[i*2 + 1].irq = pci_get_legacy_ide_irq(pdev[i], 1);
626 } else
627 hw[i*2 + 1].irq = hw[i*2].irq = ret;
623 } 628 }
624 629
625 ret = ide_host_register(host, d, hws); 630 ret = ide_host_register(host, d, hws);