aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-sff.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r--drivers/ata/libata-sff.c95
1 files changed, 0 insertions, 95 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 142120cab874..8af18ad1ca7f 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -533,101 +533,6 @@ static int ata_resources_present(struct pci_dev *pdev, int port)
533} 533}
534 534
535/** 535/**
536 * ata_pci_init_native_mode - Initialize native-mode driver
537 * @pdev: pci device to be initialized
538 * @port: array[2] of pointers to port info structures.
539 * @ports: bitmap of ports present
540 *
541 * Utility function which allocates and initializes an
542 * ata_probe_ent structure for a standard dual-port
543 * PIO-based IDE controller. The returned ata_probe_ent
544 * structure can be passed to ata_device_add(). The returned
545 * ata_probe_ent structure should then be freed with kfree().
546 *
547 * The caller need only pass the address of the primary port, the
548 * secondary will be deduced automatically. If the device has non
549 * standard secondary port mappings this function can be called twice,
550 * once for each interface.
551 */
552
553struct ata_probe_ent *
554ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int ports)
555{
556 struct ata_probe_ent *probe_ent;
557 int i;
558 void __iomem * const *iomap;
559
560 /* Discard disabled ports. Some controllers show their unused
561 * channels this way. Disabled ports will be made dummy.
562 */
563 if (ata_resources_present(pdev, 0) == 0)
564 ports &= ~ATA_PORT_PRIMARY;
565 if (ata_resources_present(pdev, 1) == 0)
566 ports &= ~ATA_PORT_SECONDARY;
567
568 if (!ports) {
569 dev_printk(KERN_ERR, &pdev->dev, "no available port\n");
570 return NULL;
571 }
572
573 /* iomap BARs */
574 for (i = 0; i < 4; i++) {
575 if (!(ports & (1 << (i / 2))))
576 continue;
577 if (pcim_iomap(pdev, i, 0) == NULL) {
578 dev_printk(KERN_ERR, &pdev->dev,
579 "failed to iomap PCI BAR %d\n", i);
580 return NULL;
581 }
582 }
583
584 pcim_iomap(pdev, 4, 0); /* may fail */
585 iomap = pcim_iomap_table(pdev);
586
587 /* alloc and init probe_ent */
588 probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]);
589 if (!probe_ent)
590 return NULL;
591
592 probe_ent->n_ports = 2;
593 probe_ent->irq = pdev->irq;
594 probe_ent->irq_flags = IRQF_SHARED;
595
596 if (ports & ATA_PORT_PRIMARY) {
597 probe_ent->port[0].cmd_addr = iomap[0];
598 probe_ent->port[0].altstatus_addr =
599 probe_ent->port[0].ctl_addr = (void __iomem *)
600 ((unsigned long)iomap[1] | ATA_PCI_CTL_OFS);
601 if (iomap[4]) {
602 if ((!(port[0]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
603 (ioread8(iomap[4] + 2) & 0x80))
604 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
605 probe_ent->port[0].bmdma_addr = iomap[4];
606 }
607 ata_std_ports(&probe_ent->port[0]);
608 } else
609 probe_ent->dummy_port_mask |= ATA_PORT_PRIMARY;
610
611 if (ports & ATA_PORT_SECONDARY) {
612 probe_ent->port[1].cmd_addr = iomap[2];
613 probe_ent->port[1].altstatus_addr =
614 probe_ent->port[1].ctl_addr = (void __iomem *)
615 ((unsigned long)iomap[3] | ATA_PCI_CTL_OFS);
616 if (iomap[4]) {
617 if ((!(port[1]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
618 (ioread8(iomap[4] + 10) & 0x80))
619 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
620 probe_ent->port[1].bmdma_addr = iomap[4] + 8;
621 }
622 ata_std_ports(&probe_ent->port[1]);
623 probe_ent->pinfo2 = port[1];
624 } else
625 probe_ent->dummy_port_mask |= ATA_PORT_SECONDARY;
626
627 return probe_ent;
628}
629
630/**
631 * ata_pci_init_bmdma - acquire PCI BMDMA resources and init ATA host 536 * ata_pci_init_bmdma - acquire PCI BMDMA resources and init ATA host
632 * @host: target ATA host 537 * @host: target ATA host
633 * 538 *