aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-dma.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:19 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:19 -0400
commit0d1bad216c43bcee84cc24d1ed003c19134d2645 (patch)
tree3cdcf7592c4e1a8899cde78beb512bffa21abf77 /drivers/ide/ide-dma.c
parent7ebe5936c214c656a1625abf9ec3b09e3d1bf34a (diff)
ide: manage resources for PCI devices in ide_pci_enable() (take 3)
* Reserve PCI BARs 0-3 (0-1 for single port controllers) in ide_pci_enable() and remove ide_hwif_request_regions() call from ide_device_add_all() (also cleanup resource management in scc_pata host driver). * Fix handling of PCI BAR 4 in ide_pci_enable(), then cleanup ide_iomio_dma() (+ init_hwif_trm290() in trm290 host driver) and remove ide_release[_iomio]_dma(). v2: * Fixup trm290 host driver. v3: * Because of scc_pata host driver changes we need to call pci_request_selected_regions() also in setup_mmio_scc(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r--drivers/ide/ide-dma.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index dc4bc06f9871..986ec465cb77 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -810,7 +810,7 @@ void ide_dma_timeout (ide_drive_t *drive)
810 810
811EXPORT_SYMBOL(ide_dma_timeout); 811EXPORT_SYMBOL(ide_dma_timeout);
812 812
813static void ide_release_dma_engine(ide_hwif_t *hwif) 813void ide_release_dma_engine(ide_hwif_t *hwif)
814{ 814{
815 if (hwif->dmatable_cpu) { 815 if (hwif->dmatable_cpu) {
816 struct pci_dev *pdev = to_pci_dev(hwif->dev); 816 struct pci_dev *pdev = to_pci_dev(hwif->dev);
@@ -821,27 +821,6 @@ static void ide_release_dma_engine(ide_hwif_t *hwif)
821 } 821 }
822} 822}
823 823
824static int ide_release_iomio_dma(ide_hwif_t *hwif)
825{
826 release_region(hwif->dma_base, 8);
827 if (hwif->extra_ports)
828 release_region(hwif->extra_base, hwif->extra_ports);
829 return 1;
830}
831
832/*
833 * Needed for allowing full modular support of ide-driver
834 */
835int ide_release_dma(ide_hwif_t *hwif)
836{
837 ide_release_dma_engine(hwif);
838
839 if (hwif->mmio)
840 return 1;
841 else
842 return ide_release_iomio_dma(hwif);
843}
844
845static int ide_allocate_dma_engine(ide_hwif_t *hwif) 824static int ide_allocate_dma_engine(ide_hwif_t *hwif)
846{ 825{
847 struct pci_dev *pdev = to_pci_dev(hwif->dev); 826 struct pci_dev *pdev = to_pci_dev(hwif->dev);
@@ -871,25 +850,9 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base)
871 printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx", 850 printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx",
872 hwif->name, base, base + 7); 851 hwif->name, base, base + 7);
873 852
874 if (!request_region(base, 8, hwif->name)) { 853 if (hwif->cds->extra)
875 printk(" -- Error, ports in use.\n");
876 return 1;
877 }
878
879 if (hwif->cds->extra) {
880 hwif->extra_base = base + (hwif->channel ? 8 : 16); 854 hwif->extra_base = base + (hwif->channel ? 8 : 16);
881 855
882 if (!hwif->mate || !hwif->mate->extra_ports) {
883 if (!request_region(hwif->extra_base,
884 hwif->cds->extra, hwif->cds->name)) {
885 printk(" -- Error, extra ports in use.\n");
886 release_region(base, 8);
887 return 1;
888 }
889 hwif->extra_ports = hwif->cds->extra;
890 }
891 }
892
893 return 0; 856 return 0;
894} 857}
895 858
@@ -909,7 +872,7 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base)
909 return; 872 return;
910 873
911 if (ide_allocate_dma_engine(hwif)) { 874 if (ide_allocate_dma_engine(hwif)) {
912 ide_release_dma(hwif); 875 ide_release_dma_engine(hwif);
913 return; 876 return;
914 } 877 }
915 878