diff options
author | Sergei Shtylylov <sshtylyov@ru.mvista.com> | 2006-10-03 04:14:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 11:04:07 -0400 |
commit | 020e322de3ff75d32daa58e431aad07071da27c6 (patch) | |
tree | 127509ae4fe684bd557285e246b835fa6a9d5ecd | |
parent | bbb3bbdb0f78cb02451daf5687a99627f7ad1140 (diff) |
[PATCH] IDE: claim extra DMA ports regardless of channel
- Claim extra DMA I/O ports regardless of what IDE channels are
present/enabled.
- Remove extra ports handling from ide_mapped_mmio_dma() since it's not
applicable to the custom-mapping IDE drivers.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/ide/ide-dma.c | 32 | ||||
-rw-r--r-- | drivers/ide/ide.c | 14 | ||||
-rw-r--r-- | include/linux/ide.h | 4 |
3 files changed, 34 insertions, 16 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index c3546fe9af63..9937fa7da546 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -798,9 +798,9 @@ static int ide_release_dma_engine(ide_hwif_t *hwif) | |||
798 | 798 | ||
799 | static int ide_release_iomio_dma(ide_hwif_t *hwif) | 799 | static int ide_release_iomio_dma(ide_hwif_t *hwif) |
800 | { | 800 | { |
801 | if ((hwif->dma_extra) && (hwif->channel == 0)) | ||
802 | release_region((hwif->dma_base + 16), hwif->dma_extra); | ||
803 | release_region(hwif->dma_base, 8); | 801 | release_region(hwif->dma_base, 8); |
802 | if (hwif->extra_ports) | ||
803 | release_region(hwif->extra_base, hwif->extra_ports); | ||
804 | if (hwif->dma_base2) | 804 | if (hwif->dma_base2) |
805 | release_region(hwif->dma_base, 8); | 805 | release_region(hwif->dma_base, 8); |
806 | return 1; | 806 | return 1; |
@@ -840,9 +840,7 @@ static int ide_mapped_mmio_dma(ide_hwif_t *hwif, unsigned long base, unsigned in | |||
840 | { | 840 | { |
841 | printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); | 841 | printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); |
842 | 842 | ||
843 | hwif->dma_base = base; | 843 | hwif->dma_base = base; |
844 | if (hwif->cds->extra && hwif->channel == 0) | ||
845 | hwif->dma_extra = hwif->cds->extra; | ||
846 | 844 | ||
847 | if(hwif->mate) | 845 | if(hwif->mate) |
848 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; | 846 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; |
@@ -854,17 +852,29 @@ static int ide_mapped_mmio_dma(ide_hwif_t *hwif, unsigned long base, unsigned in | |||
854 | static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int ports) | 852 | static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int ports) |
855 | { | 853 | { |
856 | printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx", | 854 | printk(KERN_INFO " %s: BM-DMA at 0x%04lx-0x%04lx", |
857 | hwif->name, base, base + ports - 1); | 855 | hwif->name, base, base + ports - 1); |
856 | |||
858 | if (!request_region(base, ports, hwif->name)) { | 857 | if (!request_region(base, ports, hwif->name)) { |
859 | printk(" -- Error, ports in use.\n"); | 858 | printk(" -- Error, ports in use.\n"); |
860 | return 1; | 859 | return 1; |
861 | } | 860 | } |
861 | |||
862 | hwif->dma_base = base; | 862 | hwif->dma_base = base; |
863 | if ((hwif->cds->extra) && (hwif->channel == 0)) { | 863 | |
864 | request_region(base+16, hwif->cds->extra, hwif->cds->name); | 864 | if (hwif->cds->extra) { |
865 | hwif->dma_extra = hwif->cds->extra; | 865 | hwif->extra_base = base + (hwif->channel ? 8 : 16); |
866 | |||
867 | if (!hwif->mate || !hwif->mate->extra_ports) { | ||
868 | if (!request_region(hwif->extra_base, | ||
869 | hwif->cds->extra, hwif->cds->name)) { | ||
870 | printk(" -- Error, extra ports in use.\n"); | ||
871 | release_region(base, ports); | ||
872 | return 1; | ||
873 | } | ||
874 | hwif->extra_ports = hwif->cds->extra; | ||
875 | } | ||
866 | } | 876 | } |
867 | 877 | ||
868 | if(hwif->mate) | 878 | if(hwif->mate) |
869 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; | 879 | hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base; |
870 | else | 880 | else |
@@ -874,6 +884,8 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port | |||
874 | { | 884 | { |
875 | printk(" -- Error, secondary ports in use.\n"); | 885 | printk(" -- Error, secondary ports in use.\n"); |
876 | release_region(base, ports); | 886 | release_region(base, ports); |
887 | if (hwif->extra_ports) | ||
888 | release_region(hwif->extra_base, hwif->extra_ports); | ||
877 | return 1; | 889 | return 1; |
878 | } | 890 | } |
879 | } | 891 | } |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 2b1a1389c318..8c3f06242280 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -450,7 +450,7 @@ void ide_hwif_release_regions(ide_hwif_t *hwif) | |||
450 | * @hwif: hwif to update | 450 | * @hwif: hwif to update |
451 | * @tmp_hwif: template | 451 | * @tmp_hwif: template |
452 | * | 452 | * |
453 | * Restore hwif to a previous state by copying most settngs | 453 | * Restore hwif to a previous state by copying most settings |
454 | * from the template. | 454 | * from the template. |
455 | */ | 455 | */ |
456 | 456 | ||
@@ -539,9 +539,10 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) | |||
539 | hwif->dma_vendor3 = tmp_hwif->dma_vendor3; | 539 | hwif->dma_vendor3 = tmp_hwif->dma_vendor3; |
540 | hwif->dma_prdtable = tmp_hwif->dma_prdtable; | 540 | hwif->dma_prdtable = tmp_hwif->dma_prdtable; |
541 | 541 | ||
542 | hwif->dma_extra = tmp_hwif->dma_extra; | ||
543 | hwif->config_data = tmp_hwif->config_data; | 542 | hwif->config_data = tmp_hwif->config_data; |
544 | hwif->select_data = tmp_hwif->select_data; | 543 | hwif->select_data = tmp_hwif->select_data; |
544 | hwif->extra_base = tmp_hwif->extra_base; | ||
545 | hwif->extra_ports = tmp_hwif->extra_ports; | ||
545 | hwif->autodma = tmp_hwif->autodma; | 546 | hwif->autodma = tmp_hwif->autodma; |
546 | hwif->udma_four = tmp_hwif->udma_four; | 547 | hwif->udma_four = tmp_hwif->udma_four; |
547 | hwif->no_dsc = tmp_hwif->no_dsc; | 548 | hwif->no_dsc = tmp_hwif->no_dsc; |
@@ -550,7 +551,7 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) | |||
550 | } | 551 | } |
551 | 552 | ||
552 | /** | 553 | /** |
553 | * ide_unregister - free an ide interface | 554 | * ide_unregister - free an IDE interface |
554 | * @index: index of interface (will change soon to a pointer) | 555 | * @index: index of interface (will change soon to a pointer) |
555 | * | 556 | * |
556 | * Perform the final unregister of an IDE interface. At the moment | 557 | * Perform the final unregister of an IDE interface. At the moment |
@@ -563,8 +564,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) | |||
563 | * deadlocking the IDE layer. The shutdown callback is called | 564 | * deadlocking the IDE layer. The shutdown callback is called |
564 | * before we take the lock and free resources. It is up to the | 565 | * before we take the lock and free resources. It is up to the |
565 | * caller to be sure there is no pending I/O here, and that | 566 | * caller to be sure there is no pending I/O here, and that |
566 | * the interfce will not be reopened (present/vanishing locking | 567 | * the interface will not be reopened (present/vanishing locking |
567 | * isnt yet done btw). After we commit to the final kill we | 568 | * isn't yet done BTW). After we commit to the final kill we |
568 | * call the cleanup callback with the ide locks held. | 569 | * call the cleanup callback with the ide locks held. |
569 | * | 570 | * |
570 | * Unregister restores the hwif structures to the default state. | 571 | * Unregister restores the hwif structures to the default state. |
@@ -674,6 +675,9 @@ void ide_unregister(unsigned int index) | |||
674 | hwif->dma_status = 0; | 675 | hwif->dma_status = 0; |
675 | hwif->dma_vendor3 = 0; | 676 | hwif->dma_vendor3 = 0; |
676 | hwif->dma_prdtable = 0; | 677 | hwif->dma_prdtable = 0; |
678 | |||
679 | hwif->extra_base = 0; | ||
680 | hwif->extra_ports = 0; | ||
677 | } | 681 | } |
678 | 682 | ||
679 | /* copy original settings */ | 683 | /* copy original settings */ |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 99620451d958..11608cd03d4c 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -775,10 +775,12 @@ typedef struct hwif_s { | |||
775 | unsigned long dma_prdtable; /* actual prd table address */ | 775 | unsigned long dma_prdtable; /* actual prd table address */ |
776 | unsigned long dma_base2; /* extended base addr for dma ports */ | 776 | unsigned long dma_base2; /* extended base addr for dma ports */ |
777 | 777 | ||
778 | unsigned dma_extra; /* extra addr for dma ports */ | ||
779 | unsigned long config_data; /* for use by chipset-specific code */ | 778 | unsigned long config_data; /* for use by chipset-specific code */ |
780 | unsigned long select_data; /* for use by chipset-specific code */ | 779 | unsigned long select_data; /* for use by chipset-specific code */ |
781 | 780 | ||
781 | unsigned long extra_base; /* extra addr for dma ports */ | ||
782 | unsigned extra_ports; /* number of extra dma ports */ | ||
783 | |||
782 | unsigned noprobe : 1; /* don't probe for this interface */ | 784 | unsigned noprobe : 1; /* don't probe for this interface */ |
783 | unsigned present : 1; /* this interface exists */ | 785 | unsigned present : 1; /* this interface exists */ |
784 | unsigned hold : 1; /* this interface is always present */ | 786 | unsigned hold : 1; /* this interface is always present */ |